From 454aa52f950f2348756dfffc9c26fb74d4aa3bef Mon Sep 17 00:00:00 2001 From: TizenOpenSource Date: Fri, 8 Dec 2023 13:16:12 +0900 Subject: [PATCH] Imported Upstream version 3.46.0 --- .gitignore | 89 + .gitlab-ci.yml | 144 + .gitlab-ci/Dockerfile | 62 + .gitlab-ci/Dockerfile.old | 40 + .gitlab-ci/README.rst | 2 + .gitlab-ci/coverage-docker.sh | 22 + .gitlab-ci/fixup-lcov-paths.py | 43 + .gitlab-ci/lcovrc | 13 + .gitlab-ci/run-docker-old.sh | 11 + .gitlab-ci/run-docker-runtime.sh | 11 + .gitlab-ci/run-docker.sh | 11 + .gitlab-ci/set_env.sh | 7 + .gitlab-ci/test-docker-old.sh | 23 + .gitlab-ci/test-docker.sh | 59 + .gitlab-ci/test-flatpak.sh | 24 + .gitlab-ci/test-msys2.sh | 52 + .readthedocs.yaml | 9 + AUTHORS | 11 - ChangeLog | 27655 ------------------- INSTALL | 370 - MANIFEST.in | 19 + Makefile.am | 151 - Makefile.in | 1096 - NEWS | 5540 ++-- PKG-INFO | 25 - PKG-INFO.in | 20 +- README | 107 - README.rst | 22 + aclocal.m4 | 2035 -- autogen.sh | 29 - compile | 347 - config.guess | 1558 -- config.h.in | 77 - config.sub | 1791 -- configure | 17201 ------------ configure.ac | 288 - depcomp | 791 - docs/Makefile | 16 + docs/bugs_repo.rst | 31 + docs/changelog.rst | 11 + docs/conf.py | 59 + docs/contact.rst | 26 + docs/devguide/building_testing.rst | 54 + docs/devguide/dev_environ.rst | 216 + docs/devguide/index.rst | 13 + docs/devguide/override_guidelines.rst | 90 + docs/devguide/overview.rst | 16 + docs/devguide/style_guide.rst | 101 + docs/extra.css | 57 + docs/further.rst | 13 + docs/getting_started.rst | 175 + docs/guide/api/api.rst | 75 + docs/guide/api/basic_types.rst | 50 + docs/guide/api/error_handling.rst | 48 + docs/guide/api/flags_enums.rst | 39 + docs/guide/api/gobject.rst | 92 + docs/guide/api/index.rst | 13 + docs/guide/api/properties.rst | 119 + docs/guide/api/signals.rst | 94 + docs/guide/api/weakrefs.rst | 26 + docs/guide/cairo_integration.rst | 39 + docs/guide/code/cairo-demo.py | 125 + docs/guide/debug_profile.rst | 112 + docs/guide/deploy.rst | 54 + docs/guide/faq.rst | 11 + docs/guide/gtk_template.rst | 102 + docs/guide/images/cairo_integration.png | Bin 0 -> 24418 bytes docs/guide/index.rst | 18 + docs/guide/porting.rst | 109 + docs/guide/testing.rst | 39 + docs/guide/threading.rst | 296 + docs/icons.rst | 52 + docs/images/LICENSE | 3 + docs/images/favicon.ico | Bin 0 -> 34494 bytes docs/images/logo.svg | 266 + docs/images/overview.dia | Bin 0 -> 1885 bytes docs/images/overview.svg | 72 + docs/images/pygobject-small.svg | 193 + docs/images/pygobject.svg | 244 + docs/images/start_linux.png | Bin 0 -> 9893 bytes docs/images/start_macos.png | Bin 0 -> 13949 bytes docs/images/start_windows.png | Bin 0 -> 11454 bytes docs/index.rst | 126 + docs/maintguide.rst | 34 + docs/packagingguide.rst | 45 + docs/requirements.txt | 2 + examples/Makefile.am | 1 - examples/Makefile.in | 474 - examples/cairo-demo.py | 1 + examples/demo/demo.py | 363 + examples/demo/demos/Css/__init__.py | 0 examples/demo/demos/Css/css_accordion.py | 80 + examples/demo/demos/Css/css_basics.py | 148 + examples/demo/demos/Css/css_multiplebgs.py | 187 + examples/demo/demos/Entry/__init__.py | 0 examples/demo/demos/Entry/entry_buffer.py | 72 + examples/demo/demos/Entry/entry_completion.py | 86 + examples/demo/demos/Entry/search_entry.py | 254 + examples/demo/demos/IconView/__init__.py | 0 examples/demo/demos/IconView/iconviewbasics.py | 221 + examples/demo/demos/IconView/iconviewedit.py | 99 + examples/demo/demos/TreeView/__init__.py | 0 examples/demo/demos/TreeView/liststore.py | 212 + examples/demo/demos/TreeView/treemodel_filelist.py | 235 + examples/demo/demos/TreeView/treemodel_filetree.py | 280 + examples/demo/demos/TreeView/treemodel_large.py | 143 + examples/demo/demos/__init__.py | 0 examples/demo/demos/appwindow.py | 408 + examples/demo/demos/assistant.py | 135 + examples/demo/demos/builder.py | 65 + examples/demo/demos/button_box.py | 122 + examples/demo/demos/clipboard.py | 228 + examples/demo/demos/colorselector.py | 112 + examples/demo/demos/combobox.py | 319 + examples/demo/demos/data/alphatest.png | Bin 0 -> 26529 bytes examples/demo/demos/data/apple-red.png | Bin 0 -> 3545 bytes examples/demo/demos/data/background.jpg | Bin 0 -> 22219 bytes examples/demo/demos/data/brick.png | Bin 0 -> 5043 bytes examples/demo/demos/data/brick2.png | Bin 0 -> 10713 bytes examples/demo/demos/data/css_accordion.css | 52 + examples/demo/demos/data/css_basics.css | 22 + examples/demo/demos/data/css_multiplebgs.css | 136 + examples/demo/demos/data/cssview.css | 41 + examples/demo/demos/data/demo.gresource | Bin 0 -> 31110 bytes examples/demo/demos/data/demo.gresource.xml | 18 + examples/demo/demos/data/demo.ui | 258 + examples/demo/demos/data/floppybuddy.gif | Bin 0 -> 5216 bytes examples/demo/demos/data/gnome-applets.png | Bin 0 -> 3090 bytes examples/demo/demos/data/gnome-calendar.png | Bin 0 -> 2755 bytes examples/demo/demos/data/gnome-foot.png | Bin 0 -> 2916 bytes examples/demo/demos/data/gnome-fs-directory.png | Bin 0 -> 2044 bytes examples/demo/demos/data/gnome-fs-regular.png | Bin 0 -> 1795 bytes examples/demo/demos/data/gnome-gimp.png | Bin 0 -> 3410 bytes examples/demo/demos/data/gnome-gmush.png | Bin 0 -> 3244 bytes examples/demo/demos/data/gnome-gsame.png | Bin 0 -> 4263 bytes examples/demo/demos/data/gnu-keys.png | Bin 0 -> 3852 bytes examples/demo/demos/data/gtk-logo-rgb.gif | Bin 0 -> 6427 bytes examples/demo/demos/data/reset.css | 68 + examples/demo/demos/dialogs.py | 156 + examples/demo/demos/drawingarea.py | 207 + examples/demo/demos/expander.py | 62 + examples/demo/demos/flowbox.py | 752 + examples/demo/demos/images.py | 305 + examples/demo/demos/infobars.py | 103 + examples/demo/demos/links.py | 77 + examples/demo/demos/menus.py | 134 + examples/demo/demos/pickers.py | 77 + examples/demo/demos/pixbuf.py | 184 + examples/demo/demos/printing.py | 180 + examples/demo/demos/rotatedtext.py | 191 + examples/demo/demos/test.py | 16 + examples/properties.py | 13 +- gi/Makefile.am | 133 - gi/Makefile.in | 1154 - gi/__init__.py | 113 +- gi/_constants.py | 47 + gi/_error.py | 55 + gi/_glib/Makefile.am | 91 - gi/_glib/Makefile.in | 915 - gi/_glib/__init__.py | 25 - gi/_glib/glibmodule.c | 103 - gi/_glib/pyglib-private.h | 49 - gi/_glib/pyglib-python-compat.h | 220 - gi/_glib/pyglib.c | 475 - gi/_glib/pyglib.h | 77 - gi/_gobject/Makefile.am | 87 - gi/_gobject/Makefile.in | 923 - gi/_gobject/__init__.py | 60 - gi/_gobject/constants.py | 49 - gi/_gobject/gobjectmodule.c | 2220 -- gi/_gobject/pygflags.h | 27 - gi/_gobject/pygobject-private.h | 204 - gi/_gobject/pygparamspec.c | 404 - gi/_gobject/pygtype.c | 1927 -- gi/_gobject/pygtype.h | 28 - gi/_gtktemplate.py | 307 + gi/{_glib/option.py => _option.py} | 113 +- gi/_ossighelper.py | 239 + .../propertyhelper.py => _propertyhelper.py} | 157 +- gi/{_gobject/signalhelper.py => _signalhelper.py} | 153 +- gi/docstring.py | 181 +- gi/gimodule.c | 2211 +- gi/gimodule.h | 17 + gi/importer.py | 133 +- gi/meson.build | 91 + gi/module.py | 223 +- gi/overrides/GIMarshallingTests.py | 6 +- gi/overrides/GLib.py | 569 +- gi/overrides/GObject.py | 525 +- gi/overrides/Gdk.py | 547 +- gi/overrides/GdkPixbuf.py | 53 + gi/overrides/Gio.py | 321 +- gi/overrides/Gtk.py | 1535 +- gi/overrides/Makefile.am | 23 - gi/overrides/Makefile.in | 582 - gi/overrides/Pango.py | 22 +- gi/overrides/__init__.py | 357 +- gi/overrides/keysyms.py | 1494 +- gi/overrides/meson.build | 15 + gi/{_gobject => }/pygboxed.c | 162 +- gi/{_gobject => }/pygboxed.h | 15 +- gi/{_gobject => }/pygenum.c | 147 +- gi/pygenum.h | 47 + gi/{_gobject => }/pygflags.c | 155 +- gi/pygflags.h | 46 + gi/pygi-argument.c | 1087 +- gi/pygi-argument.h | 41 +- gi/pygi-array.c | 978 + gi/pygi-array.h | 43 + gi/pygi-basictype.c | 1338 + gi/pygi-basictype.h | 89 + gi/pygi-boxed.c | 168 +- gi/pygi-boxed.h | 23 +- gi/pygi-cache.c | 1867 +- gi/pygi-cache.h | 255 +- gi/pygi-ccallback.c | 52 +- gi/pygi-ccallback.h | 17 +- gi/pygi-closure.c | 1074 +- gi/pygi-closure.h | 20 +- gi/pygi-enum-marshal.c | 407 + gi/pygi-enum-marshal.h | 42 + gi/pygi-error.c | 374 + gi/pygi-error.h | 50 + gi/pygi-foreign-api.h | 85 + gi/pygi-foreign-cairo.c | 549 +- gi/pygi-foreign.c | 114 +- gi/pygi-foreign.h | 23 +- gi/pygi-hashtable.c | 420 + gi/pygi-hashtable.h | 36 + gi/pygi-info.c | 1690 +- gi/pygi-info.h | 28 +- gi/pygi-invoke-state-struct.h | 64 +- gi/pygi-invoke.c | 685 +- gi/pygi-invoke.h | 16 +- gi/pygi-list.c | 500 + gi/pygi-list.h | 39 + gi/pygi-marshal-cleanup.c | 523 +- gi/pygi-marshal-cleanup.h | 65 +- gi/pygi-marshal-from-py.c | 1870 -- gi/pygi-marshal-from-py.h | 151 - gi/pygi-marshal-to-py.c | 891 - gi/pygi-marshal-to-py.h | 104 - gi/pygi-object.c | 381 + gi/pygi-object.h | 52 + gi/pygi-private.h | 87 - gi/pygi-property.c | 251 +- gi/pygi-property.h | 21 +- gi/pygi-repository.c | 144 +- gi/pygi-repository.h | 12 +- gi/pygi-resulttuple.c | 368 + gi/{_gobject/pygenum.h => pygi-resulttuple.h} | 27 +- gi/pygi-signal-closure.c | 107 +- gi/pygi-signal-closure.h | 17 +- gi/pygi-source.c | 139 +- gi/pygi-source.h | 4 +- gi/pygi-struct-marshal.c | 646 + gi/pygi-struct-marshal.h | 69 + gi/pygi-struct.c | 177 +- gi/pygi-struct.h | 23 +- gi/pygi-type.c | 1367 +- gi/pygi-type.h | 52 +- gi/pygi-util.c | 126 + gi/pygi-util.h | 56 + gi/pygi-value.c | 933 + gi/pygi-value.h | 52 + gi/pygi.h | 190 - gi/{_gobject => }/pyginterface.c | 70 +- gi/{_gobject => }/pyginterface.h | 6 +- gi/pygobject-external.h | 75 - gi/pygobject-internal.h | 7 + gi/{_gobject/pygobject.c => pygobject-object.c} | 729 +- gi/pygobject-object.h | 52 + gi/{_gobject => }/pygobject.h | 42 +- gi/{_glib => }/pygoptioncontext.c | 88 +- gi/{_glib => }/pygoptioncontext.h | 6 +- gi/{_glib => }/pygoptiongroup.c | 55 +- gi/{_glib => }/pygoptiongroup.h | 9 +- gi/pygparamspec.c | 423 + gi/{_gobject => }/pygparamspec.h | 8 +- gi/{_gobject => }/pygpointer.c | 71 +- gi/{_gobject => }/pygpointer.h | 16 +- gi/{_glib => }/pygspawn.c | 92 +- gi/{_glib => }/pygspawn.h | 6 +- gi/pygtkcompat.py | 1 - gi/repository/Makefile.am | 16 - gi/repository/Makefile.in | 574 - gi/repository/__init__.py | 2 - gi/repository/meson.build | 5 + gi/types.py | 158 +- install-sh | 527 - ltmain.sh | 9661 ------- m4/as-ac-expand.m4 | 40 - m4/jhflags.m4 | 21 - m4/libtool.m4 | 7991 ------ m4/ltoptions.m4 | 384 - m4/ltsugar.m4 | 123 - m4/ltversion.m4 | 23 - m4/lt~obsolete.m4 | 98 - m4/python.m4 | 251 - meson.build | 221 + meson_options.txt | 3 + missing | 215 - py-compile | 170 - pygobject-3.0-uninstalled.pc.in | 12 - pygobject-3.0.pc.in | 3 +- pygobject.doap | 26 +- pygtkcompat/Makefile.am | 16 - pygtkcompat/Makefile.in | 574 - pygtkcompat/generictreemodel.py | 15 +- pygtkcompat/meson.build | 8 + pygtkcompat/pygtkcompat.py | 365 +- pyproject.toml | 20 + setup.cfg | 11 + setup.py | 1248 + subprojects/.gitignore | 4 + subprojects/glib.wrap | 6 + subprojects/gobject-introspection.wrap | 6 + subprojects/libffi.wrap | 8 + subprojects/pycairo.wrap | 5 + tests/Makefile.am | 155 - tests/Makefile.in | 839 - tests/__init__.py | 137 + tests/compat_test_pygtk.py | 147 - tests/compathelper.py | 69 - tests/conftest.py | 26 + tests/gi/__init__.py | 2 - tests/gimarshallingtestsextra.c | 177 + tests/gimarshallingtestsextra.h | 69 + tests/helper.py | 131 + tests/meson.build | 133 + tests/org.gnome.test.gschema.xml | 4 + tests/regressextra.c | 416 + tests/regressextra.h | 82 + tests/runtests-windows.py | 52 - tests/runtests.py | 94 +- tests/te_ST@nouppera | 50 - tests/test_atoms.py | 42 +- tests/test_cairo.py | 308 + tests/test_docstring.py | 129 +- tests/test_error.py | 157 + tests/test_everything.py | 1011 +- tests/test_fields.py | 185 + tests/test_gdbus.py | 45 + tests/test_generictreemodel.py | 89 +- tests/test_gi.py | 1207 +- tests/test_gio.py | 147 +- tests/test_glib.py | 157 +- tests/test_gobject.py | 305 +- tests/test_gtk_template.py | 721 + tests/test_gtype.py | 61 + tests/test_gtype_instance.py | 8 + tests/test_import_machinery.py | 154 + tests/test_interface.py | 4 + tests/test_internal_api.py | 65 +- tests/test_iochannel.py | 159 +- tests/test_mainloop.py | 71 +- tests/test_object_marshaling.py | 148 +- tests/test_option.py | 80 +- tests/test_ossig.py | 182 + tests/test_overrides.py | 58 - tests/test_overrides_gdk.py | 228 +- tests/test_overrides_gdkpixbuf.py | 47 + tests/test_overrides_gio.py | 360 + tests/test_overrides_glib.py | 255 +- tests/test_overrides_gobject.py | 423 + tests/test_overrides_gtk.py | 1715 +- tests/test_overrides_pango.py | 32 +- tests/test_properties.py | 566 +- tests/test_pycapi.py | 45 + tests/test_pygtkcompat.py | 339 + tests/test_repository.py | 403 + tests/test_resulttuple.py | 89 + tests/test_signal.py | 745 +- tests/test_source.py | 83 +- tests/test_subprocess.py | 138 +- tests/test_thread.py | 11 +- tests/test_typeclass.py | 76 + tests/test_unknown.py | 29 + tests/testhelpermodule.c | 189 +- tests/testmodule.py | 22 - tests/valgrind.supp | 30 + pygi-convert.sh => tools/pygi-convert.sh | 16 +- 382 files changed, 48013 insertions(+), 101809 deletions(-) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 .gitlab-ci/Dockerfile create mode 100644 .gitlab-ci/Dockerfile.old create mode 100644 .gitlab-ci/README.rst create mode 100755 .gitlab-ci/coverage-docker.sh create mode 100644 .gitlab-ci/fixup-lcov-paths.py create mode 100644 .gitlab-ci/lcovrc create mode 100755 .gitlab-ci/run-docker-old.sh create mode 100755 .gitlab-ci/run-docker-runtime.sh create mode 100755 .gitlab-ci/run-docker.sh create mode 100755 .gitlab-ci/set_env.sh create mode 100755 .gitlab-ci/test-docker-old.sh create mode 100755 .gitlab-ci/test-docker.sh create mode 100755 .gitlab-ci/test-flatpak.sh create mode 100755 .gitlab-ci/test-msys2.sh create mode 100644 .readthedocs.yaml delete mode 100644 AUTHORS delete mode 100644 ChangeLog delete mode 100644 INSTALL create mode 100644 MANIFEST.in delete mode 100644 Makefile.am delete mode 100644 Makefile.in delete mode 100644 PKG-INFO delete mode 100644 README create mode 100644 README.rst delete mode 100644 aclocal.m4 delete mode 100755 autogen.sh delete mode 100755 compile delete mode 100755 config.guess delete mode 100644 config.h.in delete mode 100755 config.sub delete mode 100755 configure delete mode 100644 configure.ac delete mode 100755 depcomp create mode 100644 docs/Makefile create mode 100644 docs/bugs_repo.rst create mode 100644 docs/changelog.rst create mode 100644 docs/conf.py create mode 100644 docs/contact.rst create mode 100644 docs/devguide/building_testing.rst create mode 100644 docs/devguide/dev_environ.rst create mode 100644 docs/devguide/index.rst create mode 100644 docs/devguide/override_guidelines.rst create mode 100644 docs/devguide/overview.rst create mode 100644 docs/devguide/style_guide.rst create mode 100644 docs/extra.css create mode 100644 docs/further.rst create mode 100644 docs/getting_started.rst create mode 100644 docs/guide/api/api.rst create mode 100644 docs/guide/api/basic_types.rst create mode 100644 docs/guide/api/error_handling.rst create mode 100644 docs/guide/api/flags_enums.rst create mode 100644 docs/guide/api/gobject.rst create mode 100644 docs/guide/api/index.rst create mode 100644 docs/guide/api/properties.rst create mode 100644 docs/guide/api/signals.rst create mode 100644 docs/guide/api/weakrefs.rst create mode 100644 docs/guide/cairo_integration.rst create mode 100755 docs/guide/code/cairo-demo.py create mode 100644 docs/guide/debug_profile.rst create mode 100644 docs/guide/deploy.rst create mode 100644 docs/guide/faq.rst create mode 100644 docs/guide/gtk_template.rst create mode 100644 docs/guide/images/cairo_integration.png create mode 100644 docs/guide/index.rst create mode 100644 docs/guide/porting.rst create mode 100644 docs/guide/testing.rst create mode 100644 docs/guide/threading.rst create mode 100644 docs/icons.rst create mode 100644 docs/images/LICENSE create mode 100644 docs/images/favicon.ico create mode 100644 docs/images/logo.svg create mode 100644 docs/images/overview.dia create mode 100644 docs/images/overview.svg create mode 100644 docs/images/pygobject-small.svg create mode 100644 docs/images/pygobject.svg create mode 100644 docs/images/start_linux.png create mode 100644 docs/images/start_macos.png create mode 100644 docs/images/start_windows.png create mode 100644 docs/index.rst create mode 100644 docs/maintguide.rst create mode 100644 docs/packagingguide.rst create mode 100644 docs/requirements.txt delete mode 100644 examples/Makefile.am delete mode 100644 examples/Makefile.in create mode 100755 examples/demo/demo.py create mode 100644 examples/demo/demos/Css/__init__.py create mode 100644 examples/demo/demos/Css/css_accordion.py create mode 100644 examples/demo/demos/Css/css_basics.py create mode 100644 examples/demo/demos/Css/css_multiplebgs.py create mode 100644 examples/demo/demos/Entry/__init__.py create mode 100644 examples/demo/demos/Entry/entry_buffer.py create mode 100644 examples/demo/demos/Entry/entry_completion.py create mode 100644 examples/demo/demos/Entry/search_entry.py create mode 100644 examples/demo/demos/IconView/__init__.py create mode 100644 examples/demo/demos/IconView/iconviewbasics.py create mode 100644 examples/demo/demos/IconView/iconviewedit.py create mode 100644 examples/demo/demos/TreeView/__init__.py create mode 100644 examples/demo/demos/TreeView/liststore.py create mode 100644 examples/demo/demos/TreeView/treemodel_filelist.py create mode 100644 examples/demo/demos/TreeView/treemodel_filetree.py create mode 100644 examples/demo/demos/TreeView/treemodel_large.py create mode 100644 examples/demo/demos/__init__.py create mode 100644 examples/demo/demos/appwindow.py create mode 100644 examples/demo/demos/assistant.py create mode 100644 examples/demo/demos/builder.py create mode 100644 examples/demo/demos/button_box.py create mode 100644 examples/demo/demos/clipboard.py create mode 100644 examples/demo/demos/colorselector.py create mode 100644 examples/demo/demos/combobox.py create mode 100644 examples/demo/demos/data/alphatest.png create mode 100644 examples/demo/demos/data/apple-red.png create mode 100644 examples/demo/demos/data/background.jpg create mode 100644 examples/demo/demos/data/brick.png create mode 100644 examples/demo/demos/data/brick2.png create mode 100644 examples/demo/demos/data/css_accordion.css create mode 100644 examples/demo/demos/data/css_basics.css create mode 100644 examples/demo/demos/data/css_multiplebgs.css create mode 100644 examples/demo/demos/data/cssview.css create mode 100644 examples/demo/demos/data/demo.gresource create mode 100644 examples/demo/demos/data/demo.gresource.xml create mode 100644 examples/demo/demos/data/demo.ui create mode 100644 examples/demo/demos/data/floppybuddy.gif create mode 100644 examples/demo/demos/data/gnome-applets.png create mode 100644 examples/demo/demos/data/gnome-calendar.png create mode 100644 examples/demo/demos/data/gnome-foot.png create mode 100644 examples/demo/demos/data/gnome-fs-directory.png create mode 100644 examples/demo/demos/data/gnome-fs-regular.png create mode 100644 examples/demo/demos/data/gnome-gimp.png create mode 100644 examples/demo/demos/data/gnome-gmush.png create mode 100644 examples/demo/demos/data/gnome-gsame.png create mode 100644 examples/demo/demos/data/gnu-keys.png create mode 100644 examples/demo/demos/data/gtk-logo-rgb.gif create mode 100644 examples/demo/demos/data/reset.css create mode 100644 examples/demo/demos/dialogs.py create mode 100644 examples/demo/demos/drawingarea.py create mode 100644 examples/demo/demos/expander.py create mode 100755 examples/demo/demos/flowbox.py create mode 100644 examples/demo/demos/images.py create mode 100644 examples/demo/demos/infobars.py create mode 100644 examples/demo/demos/links.py create mode 100644 examples/demo/demos/menus.py create mode 100644 examples/demo/demos/pickers.py create mode 100644 examples/demo/demos/pixbuf.py create mode 100644 examples/demo/demos/printing.py create mode 100644 examples/demo/demos/rotatedtext.py create mode 100644 examples/demo/demos/test.py delete mode 100644 gi/Makefile.am delete mode 100644 gi/Makefile.in create mode 100644 gi/_constants.py create mode 100644 gi/_error.py delete mode 100644 gi/_glib/Makefile.am delete mode 100644 gi/_glib/Makefile.in delete mode 100644 gi/_glib/__init__.py delete mode 100644 gi/_glib/glibmodule.c delete mode 100644 gi/_glib/pyglib-private.h delete mode 100644 gi/_glib/pyglib-python-compat.h delete mode 100644 gi/_glib/pyglib.c delete mode 100644 gi/_glib/pyglib.h delete mode 100644 gi/_gobject/Makefile.am delete mode 100644 gi/_gobject/Makefile.in delete mode 100644 gi/_gobject/__init__.py delete mode 100644 gi/_gobject/constants.py delete mode 100644 gi/_gobject/gobjectmodule.c delete mode 100644 gi/_gobject/pygflags.h delete mode 100644 gi/_gobject/pygobject-private.h delete mode 100644 gi/_gobject/pygparamspec.c delete mode 100644 gi/_gobject/pygtype.c delete mode 100644 gi/_gobject/pygtype.h create mode 100644 gi/_gtktemplate.py rename gi/{_glib/option.py => _option.py} (78%) create mode 100644 gi/_ossighelper.py rename gi/{_gobject/propertyhelper.py => _propertyhelper.py} (78%) rename gi/{_gobject/signalhelper.py => _signalhelper.py} (69%) create mode 100644 gi/gimodule.h create mode 100644 gi/meson.build create mode 100644 gi/overrides/GdkPixbuf.py delete mode 100644 gi/overrides/Makefile.am delete mode 100644 gi/overrides/Makefile.in create mode 100644 gi/overrides/meson.build rename gi/{_gobject => }/pygboxed.c (52%) rename gi/{_gobject => }/pygboxed.h (64%) rename gi/{_gobject => }/pygenum.c (73%) create mode 100644 gi/pygenum.h rename gi/{_gobject => }/pygflags.c (74%) create mode 100644 gi/pygflags.h create mode 100644 gi/pygi-array.c create mode 100644 gi/pygi-array.h create mode 100644 gi/pygi-basictype.c create mode 100644 gi/pygi-basictype.h create mode 100644 gi/pygi-enum-marshal.c create mode 100644 gi/pygi-enum-marshal.h create mode 100644 gi/pygi-error.c create mode 100644 gi/pygi-error.h create mode 100644 gi/pygi-foreign-api.h create mode 100644 gi/pygi-hashtable.c create mode 100644 gi/pygi-hashtable.h create mode 100644 gi/pygi-list.c create mode 100644 gi/pygi-list.h delete mode 100644 gi/pygi-marshal-from-py.c delete mode 100644 gi/pygi-marshal-from-py.h delete mode 100644 gi/pygi-marshal-to-py.c delete mode 100644 gi/pygi-marshal-to-py.h create mode 100644 gi/pygi-object.c create mode 100644 gi/pygi-object.h delete mode 100644 gi/pygi-private.h create mode 100644 gi/pygi-resulttuple.c rename gi/{_gobject/pygenum.h => pygi-resulttuple.h} (54%) create mode 100644 gi/pygi-struct-marshal.c create mode 100644 gi/pygi-struct-marshal.h create mode 100644 gi/pygi-util.c create mode 100644 gi/pygi-util.h create mode 100644 gi/pygi-value.c create mode 100644 gi/pygi-value.h delete mode 100644 gi/pygi.h rename gi/{_gobject => }/pyginterface.c (60%) rename gi/{_gobject => }/pyginterface.h (86%) delete mode 100644 gi/pygobject-external.h create mode 100644 gi/pygobject-internal.h rename gi/{_gobject/pygobject.c => pygobject-object.c} (83%) create mode 100644 gi/pygobject-object.h rename gi/{_gobject => }/pygobject.h (95%) rename gi/{_glib => }/pygoptioncontext.c (80%) rename gi/{_glib => }/pygoptioncontext.h (84%) rename gi/{_glib => }/pygoptiongroup.c (87%) rename gi/{_glib => }/pygoptiongroup.h (85%) create mode 100644 gi/pygparamspec.c rename gi/{_gobject => }/pygparamspec.h (83%) rename gi/{_gobject => }/pygpointer.c (74%) rename gi/{_gobject => }/pygpointer.h (66%) rename gi/{_glib => }/pygspawn.c (77%) rename gi/{_glib => }/pygspawn.h (82%) delete mode 100644 gi/repository/Makefile.am delete mode 100644 gi/repository/Makefile.in create mode 100644 gi/repository/meson.build delete mode 100755 install-sh delete mode 100644 ltmain.sh delete mode 100644 m4/as-ac-expand.m4 delete mode 100644 m4/jhflags.m4 delete mode 100644 m4/libtool.m4 delete mode 100644 m4/ltoptions.m4 delete mode 100644 m4/ltsugar.m4 delete mode 100644 m4/ltversion.m4 delete mode 100644 m4/lt~obsolete.m4 delete mode 100644 m4/python.m4 create mode 100644 meson.build create mode 100644 meson_options.txt delete mode 100755 missing delete mode 100755 py-compile delete mode 100644 pygobject-3.0-uninstalled.pc.in delete mode 100644 pygtkcompat/Makefile.am delete mode 100644 pygtkcompat/Makefile.in create mode 100644 pygtkcompat/meson.build create mode 100644 pyproject.toml create mode 100644 setup.cfg create mode 100755 setup.py create mode 100644 subprojects/.gitignore create mode 100644 subprojects/glib.wrap create mode 100644 subprojects/gobject-introspection.wrap create mode 100644 subprojects/libffi.wrap create mode 100644 subprojects/pycairo.wrap delete mode 100644 tests/Makefile.am delete mode 100644 tests/Makefile.in create mode 100644 tests/__init__.py delete mode 100644 tests/compat_test_pygtk.py delete mode 100644 tests/compathelper.py create mode 100644 tests/conftest.py delete mode 100644 tests/gi/__init__.py create mode 100644 tests/gimarshallingtestsextra.c create mode 100644 tests/gimarshallingtestsextra.h create mode 100644 tests/helper.py create mode 100644 tests/meson.build create mode 100644 tests/regressextra.c create mode 100644 tests/regressextra.h delete mode 100644 tests/runtests-windows.py delete mode 100644 tests/te_ST@nouppera create mode 100644 tests/test_cairo.py create mode 100644 tests/test_error.py create mode 100644 tests/test_fields.py create mode 100644 tests/test_gtk_template.py create mode 100644 tests/test_gtype_instance.py create mode 100644 tests/test_import_machinery.py create mode 100644 tests/test_ossig.py delete mode 100644 tests/test_overrides.py create mode 100644 tests/test_overrides_gdkpixbuf.py create mode 100644 tests/test_overrides_gio.py create mode 100644 tests/test_overrides_gobject.py create mode 100644 tests/test_pycapi.py create mode 100644 tests/test_pygtkcompat.py create mode 100644 tests/test_repository.py create mode 100644 tests/test_resulttuple.py create mode 100644 tests/test_typeclass.py create mode 100644 tests/test_unknown.py delete mode 100644 tests/testmodule.py create mode 100644 tests/valgrind.supp rename pygi-convert.sh => tools/pygi-convert.sh (97%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..982712f --- /dev/null +++ b/.gitignore @@ -0,0 +1,89 @@ +.venv +.mypy_cache +*.bak +*.lo +*.o +*.orig +*.pyc +*.rej +*.so +*.la +*.tab.c +*~ +.*.sw[nop] +*.gir +*.typelib +*.dll +*.dylib +.DS_STORE +.deps +.libs +.idea +.cache +.pytest_cache +gschemas.compiled +pygobject-*.tar.xz +Makefile +Makefile.in +/.dirstamp +/ChangeLog +/GPATH +/GRTAGS +/GSYMS +/GTAGS +/ID +/INSTALL +/PKG-INFO +/TAGS +/_libs +/aclocal.m4 +/autom4te.cache +/autoscan.log +/compile +/config.cache +/config.guess +/config.h +/config.h.in +/config.log +/config.lt +/config.status +/config.status.lineno +/config.sub +/configure +/configure.lineno +/configure.scan +/depcomp +/gtk-doc.make +/install-sh +/libtool +/ltmain.sh +/m4/libtool.m4 +/m4/ltoptions.m4 +/m4/ltsugar.m4 +/m4/ltversion.m4 +/m4/lt~obsolete.m4 +/m4/glib-2.0.m4 +/m4/pkg.m4 +/m4/ax_*.m4 +/missing +/mkinstalldirs +/omf.make +/py-compile +/pygobject-3.0-uninstalled.pc +/pygobject-3.0.pc +/pygobject-*-coverage* +/so_locations +/stamp-h1 +/tags +/xmldocs.make +/tmp/* +/build/ +/dist/ +/pygobject.egg-info/ +/MANIFEST +/docs/_build +/PyGObject.egg-info/ +*.pyd +*.dll.a +.coverage +poetry.lock \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a4c0ae6 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,144 @@ +image: registry.gitlab.gnome.org/gnome/pygobject/main:v21 + +stages: + - build_and_test + - coverage + - deploy + +cache: + paths: + - _ccache/ + +.defaults: &defaults + stage: build_and_test + artifacts: + paths: + - coverage/ + script: + - bash -x ./.gitlab-ci/test-docker.sh + +.mingw-defaults: &mingw-defaults + stage: build_and_test + tags: + - win32-ps + artifacts: + paths: + - coverage/ + script: + - $env:CHERE_INVOKING = 'yes' + - C:\msys64\usr\bin\pacman --noconfirm -Syyuu + - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh" + +coverage: + stage: coverage + artifacts: + paths: + - coverage/ + variables: + PYTHON_VERSION: "3.9" + script: + - bash -x ./.gitlab-ci/coverage-docker.sh + coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/' + +pages: + stage: deploy + dependencies: + - coverage + script: + - mv coverage/ public/ + artifacts: + paths: + - public + expire_in: 30 days + only: + - master + +mingw32: + variables: + MSYSTEM: "MINGW32" + <<: *mingw-defaults + +mingw64: + variables: + MSYSTEM: "MINGW64" + <<: *mingw-defaults + +python3.8: + variables: + PYTHON_VERSION: "3.8" + TEST_GTK_VERSION: "3.0" + <<: *defaults + +python3.9: + variables: + PYTHON_VERSION: "3.9" + TEST_GTK_VERSION: "3.0" + <<: *defaults + +python3.10: + variables: + PYTHON_VERSION: "3.10" + TEST_GTK_VERSION: "3.0" + <<: *defaults + +python3.11: + variables: + PYTHON_VERSION: "3.11" + TEST_GTK_VERSION: "3.0" + <<: *defaults + +python3.11-gtk4: + variables: + PYTHON_VERSION: "3.11" + TEST_GTK_VERSION: "4.0" + <<: *defaults + +python3.12: + variables: + PYTHON_VERSION: "3.12" + TEST_GTK_VERSION: "3.0" + <<: *defaults + +pypy3.8: + allow_failure: true + variables: + PYTHON_VERSION: "pypy3.8" + TEST_GTK_VERSION: "3.0" + <<: *defaults + +old-i386-py3: + stage: build_and_test + image: registry.gitlab.gnome.org/gnome/pygobject/old:v6 + artifacts: + paths: + - coverage/ + script: + - bash -x ./.gitlab-ci/test-docker-old.sh + +gnome-master: + allow_failure: true + stage: build_and_test + image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master + tags: + - flatpak + artifacts: + paths: + - coverage/ + variables: + TEST_GTK_VERSION: "3.0" + script: + - bash -x ./.gitlab-ci/test-flatpak.sh + +gnome-master-gtk4: + allow_failure: true + stage: build_and_test + image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master + tags: + - flatpak + artifacts: + paths: + - coverage/ + variables: + TEST_GTK_VERSION: "4.0" + script: + - bash -x ./.gitlab-ci/test-flatpak.sh diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile new file mode 100644 index 0000000..9272c6b --- /dev/null +++ b/.gitlab-ci/Dockerfile @@ -0,0 +1,62 @@ +FROM ubuntu:jammy + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y \ + build-essential \ + ccache \ + curl \ + dbus \ + gir1.2-gtk-3.0 \ + gir1.2-gtk-4.0 \ + git \ + gobject-introspection \ + lcov \ + libbz2-dev \ + libcairo2-dev \ + libffi-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + libgtk-3-0 \ + libgtk-4-1 \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + liblzma-dev \ + ninja-build \ + python3-pip \ + sudo \ + xauth \ + xvfb \ + && rm -rf /var/lib/apt/lists/* + +ARG HOST_USER_ID=5555 +ENV HOST_USER_ID ${HOST_USER_ID} +RUN useradd -u $HOST_USER_ID -ms /bin/bash user +RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +USER user +WORKDIR /home/user + +ENV LANG C.UTF-8 +ENV CI true +ENV PYENV_ROOT /home/user/.pyenv +ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}" +ENV PYTHON_CONFIGURE_OPTS="--enable-shared" + +# https://github.com/pyenv/pyenv/releases +ENV PYENV_GIT_TAG v2.3.19 +RUN curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash + +RUN pyenv install pypy3.8 +RUN pyenv install --debug 3.8 +RUN pyenv install --debug 3.9 +RUN pyenv install --debug 3.10 +RUN pyenv install --debug 3.11 +RUN pyenv install --debug 3.12.0b2 + +ENV PATH="/usr/lib/ccache:${PATH}" + +COPY --chown=user:user set_env.sh /home/user/set_env.sh +RUN chmod +x /home/user/set_env.sh +ENTRYPOINT ["/home/user/set_env.sh"] \ No newline at end of file diff --git a/.gitlab-ci/Dockerfile.old b/.gitlab-ci/Dockerfile.old new file mode 100644 index 0000000..2eb01de --- /dev/null +++ b/.gitlab-ci/Dockerfile.old @@ -0,0 +1,40 @@ +FROM i386/debian:bullseye + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y \ + autoconf-archive \ + build-essential \ + ccache \ + curl \ + dbus \ + gir1.2-gtk-3.0 \ + git \ + gobject-introspection \ + lcov \ + libcairo2-dev \ + libffi-dev \ + libgirepository1.0-dev \ + libglib2.0-dev \ + libgtk-3-0 \ + libtool \ + locales \ + python3-dev \ + python3-venv \ + sudo \ + xauth \ + xvfb \ + && rm -rf /var/lib/apt/lists/* + +ARG HOST_USER_ID=5555 +ENV HOST_USER_ID ${HOST_USER_ID} +RUN useradd -u $HOST_USER_ID -ms /bin/bash user +RUN echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +USER user +WORKDIR /home/user + +ENV LANG C.UTF-8 +ENV CI true + +ENV PATH="/usr/lib/ccache:${PATH}" diff --git a/.gitlab-ci/README.rst b/.gitlab-ci/README.rst new file mode 100644 index 0000000..3ebab30 --- /dev/null +++ b/.gitlab-ci/README.rst @@ -0,0 +1,2 @@ +The images are available at +https://gitlab.gnome.org/GNOME/pygobject/container_registry diff --git a/.gitlab-ci/coverage-docker.sh b/.gitlab-ci/coverage-docker.sh new file mode 100755 index 0000000..a1b271e --- /dev/null +++ b/.gitlab-ci/coverage-docker.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +# Make the Windows paths match our current layout +python ./.gitlab-ci/fixup-lcov-paths.py coverage/*.lcov + +# Remove external headers (except gi tests) +for path in coverage/*.lcov; do + lcov --config-file .gitlab-ci/lcovrc -r "${path}" '/usr/include/*' -o "${path}" + lcov --config-file .gitlab-ci/lcovrc -r "${path}" '/home/*' -o "${path}" + lcov --config-file .gitlab-ci/lcovrc -r "${path}" '*/msys64/*' -o "${path}" + lcov --config-file .gitlab-ci/lcovrc -r "${path}" '*subprojects/*' -o "${path}" + lcov --config-file .gitlab-ci/lcovrc -r "${path}" '*tmp-introspect*' -o "${path}" +done + +genhtml --ignore-errors=source --config-file .gitlab-ci/lcovrc \ + coverage/*.lcov -o coverage/ + +cd coverage +rm -f .coverage* +rm -f *.lcov diff --git a/.gitlab-ci/fixup-lcov-paths.py b/.gitlab-ci/fixup-lcov-paths.py new file mode 100644 index 0000000..e8555c7 --- /dev/null +++ b/.gitlab-ci/fixup-lcov-paths.py @@ -0,0 +1,43 @@ +import sys +import os +import re + + +def main(argv): + # Fix paths in lcov files generated on a Windows host so they match our + # current source layout. + paths = argv[1:] + + for path in paths: + print("cov-fixup:", path) + with open(path, "r", encoding="utf-8") as h: + text = h.read() + + text = text.replace("\\\\", "/").replace("\\", "/") + new_root = os.getcwd() + + def make_abs(m): + p = m.group(1) + if p.startswith("C:/"): + p = p.replace("C:/", "/c/") + if not p.startswith("/"): + p = os.path.join(new_root, p) + return "SF:" + p + + text = re.sub("SF:(.*?)$", make_abs, text, 0, re.MULTILINE) + + canidate = None + for old_root in set(re.findall(":(.*?)/gi/.*?$", text, re.MULTILINE)): + if canidate is None or len(old_root) < len(canidate): + canidate = old_root + + if canidate: + print("replacing %r with %r" % (canidate, new_root)) + text = text.replace(canidate, new_root) + + with open(path, "w", encoding="utf-8") as h: + h.write(text) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/.gitlab-ci/lcovrc b/.gitlab-ci/lcovrc new file mode 100644 index 0000000..ac5997b --- /dev/null +++ b/.gitlab-ci/lcovrc @@ -0,0 +1,13 @@ +# lcov and genhtml configuration +# See http://ltp.sourceforge.net/coverage/lcov/lcovrc.5.php + +# Always enable branch coverage +lcov_branch_coverage = 1 + +# Exclude precondition assertions, as we can never reasonably get full branch +# coverage of them, as they should never normally fail. +# See https://github.com/linux-test-project/lcov/issues/44 +lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_ + +# Similarly for unreachable assertions. +lcov_excl_line = LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached diff --git a/.gitlab-ci/run-docker-old.sh b/.gitlab-ci/run-docker-old.sh new file mode 100755 index 0000000..3663cfe --- /dev/null +++ b/.gitlab-ci/run-docker-old.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +TAG="registry.gitlab.gnome.org/gnome/pygobject/old:v6" + +sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \ + --file "Dockerfile.old" . +sudo docker run --rm --security-opt label=disable \ + --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \ + --tty --interactive "${TAG}" bash diff --git a/.gitlab-ci/run-docker-runtime.sh b/.gitlab-ci/run-docker-runtime.sh new file mode 100755 index 0000000..d70cba3 --- /dev/null +++ b/.gitlab-ci/run-docker-runtime.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +TAG="registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master" + +sudo docker pull "${TAG}" +sudo docker run --privileged --rm --security-opt label=disable \ + --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \ + --tty --interactive "${TAG}" xvfb-run -a flatpak run --filesystem=host \ + --share=network --socket=x11 --devel --command=bash org.gnome.Sdk//master diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh new file mode 100755 index 0000000..95e80d4 --- /dev/null +++ b/.gitlab-ci/run-docker.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +TAG="registry.gitlab.gnome.org/gnome/pygobject/main:v21" + +sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \ + --file "Dockerfile" . +sudo docker run --rm --security-opt label=disable \ + --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \ + --tty --interactive "${TAG}" bash diff --git a/.gitlab-ci/set_env.sh b/.gitlab-ci/set_env.sh new file mode 100755 index 0000000..c6671c8 --- /dev/null +++ b/.gitlab-ci/set_env.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +export PYENV_VERSION +PYENV_VERSION="$(pyenv latest "${PYTHON_VERSION:-3}")" +exec "$@" diff --git a/.gitlab-ci/test-docker-old.sh b/.gitlab-ci/test-docker-old.sh new file mode 100755 index 0000000..8d88bd3 --- /dev/null +++ b/.gitlab-ci/test-docker-old.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +python3 --version +python3 -m venv _venv +source _venv/bin/activate + +# ccache setup +export CCACHE_BASEDIR="$(pwd)" +export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" +COV_DIR="$(pwd)/coverage" +COV_KEY="${CI_JOB_NAME}" +export COVERAGE_FILE="${COV_DIR}/.coverage.${COV_KEY}" +mkdir -p "${COV_DIR}" +mkdir -p "${CCACHE_DIR}" + +# test +python -m pip install --upgrade pip +python -m pip install pycairo pytest pytest-faulthandler coverage +python setup.py build_tests +xvfb-run -a python -m coverage run --context "${COV_KEY}" tests/runtests.py +python -m coverage lcov -o "${COV_DIR}/${COV_KEY}.py.lcov" diff --git a/.gitlab-ci/test-docker.sh b/.gitlab-ci/test-docker.sh new file mode 100755 index 0000000..dd11610 --- /dev/null +++ b/.gitlab-ci/test-docker.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +set -e + +python --version + +PYVER=$(python -c "import sys; sys.stdout.write('.'.join(map(str, sys.version_info[:2])))") +PYIMPL=$(python -c "import sys, platform; sys.stdout.write(platform.python_implementation())") +SOURCE_DIR="$(pwd)" +COV_DIR="${SOURCE_DIR}/coverage" +export MALLOC_CHECK_=3 +export MALLOC_PERTURB_=$((${RANDOM} % 255 + 1)) +export G_SLICE="debug-blocks" +COV_KEY="${CI_JOB_NAME}" +export COVERAGE_FILE="${COV_DIR}/.coverage.${COV_KEY}" +export CCACHE_BASEDIR="$(pwd)" +export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" + +# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDEVMODE +export PYTHONDEVMODE=1 + +mkdir -p "${CCACHE_DIR}" +mkdir -p "${COV_DIR}" + +python -m pip install pycairo flake8 pytest pytest-faulthandler coverage setuptools + +export CFLAGS="-coverage -ftest-coverage -fprofile-arcs -Werror" + +# MESON +/usr/bin/python3 -m pip install --user meson +export PATH="${HOME}/.local/bin:${PATH}" +export PKG_CONFIG_PATH="$(python -c 'import sys; sys.stdout.write(sys.prefix)')/lib/pkgconfig" + +meson _build -Dpython="$(which python)" +ninja -C _build +xvfb-run -a meson test --suite pygobject --timeout-multiplier 4 -C _build -v +rm -Rf _build + +# CODE QUALITY +python -m flake8 + +# DOCUMENTATION CHECKS +if [[ "${PYVER}" == "2.7" ]] && [[ "${PYIMPL}" == "CPython" ]]; then + python -m pip install sphinx sphinx_rtd_theme + python -m sphinx -W -a -E -b html -n docs docs/_build +fi; + +# BUILD & TEST AGAIN USING SETUP.PY +python setup.py build_tests + +lcov --config-file .gitlab-ci/lcovrc --directory . --capture --initial --output-file \ + "${COV_DIR}/${CI_JOB_NAME}-baseline.lcov" + +xvfb-run -a python -m coverage run --context "${COV_KEY}" tests/runtests.py +python -m coverage lcov -o "${COV_DIR}/${COV_KEY}.py.lcov" + +# COLLECT GCOV COVERAGE +lcov --config-file .gitlab-ci/lcovrc --directory . --capture --output-file \ + "${COV_DIR}/${CI_JOB_NAME}.lcov" diff --git a/.gitlab-ci/test-flatpak.sh b/.gitlab-ci/test-flatpak.sh new file mode 100755 index 0000000..e40bc7b --- /dev/null +++ b/.gitlab-ci/test-flatpak.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +DIR="$( cd "$( dirname "$0" )" && pwd )" + +if [[ "$1" == "inflatpak" ]]; then + COV_DIR="$(pwd)/coverage" + COV_KEY="flatpak-$TEST_GTK_VERSION" + export COVERAGE_FILE="${COV_DIR}/.coverage.${COV_KEY}" + mkdir -p "${COV_DIR}" + + python3 -m venv _venv + . _venv/bin/activate + python3 -m pip install pytest pytest-faulthandler coverage + python3 setup.py build_tests + python3 -m coverage run --context "${COV_KEY}" tests/runtests.py + python3 -m coverage lcov -o "${COV_DIR}/${COV_KEY}.py.lcov" + chmod -R 777 "${COV_DIR}" +else + # https://gitlab.gnome.org/GNOME/gnome-runtime-images/-/issues/7 + export DBUS_SYSTEM_BUS_ADDRESS="$(dbus-daemon --session --print-address --fork)" + xvfb-run -a flatpak run --user --filesystem=host --share=network --socket=x11 --command=bash org.gnome.Sdk//master -x "${DIR}"/test-flatpak.sh inflatpak +fi diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh new file mode 100755 index 0000000..3a96893 --- /dev/null +++ b/.gitlab-ci/test-msys2.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e + +pacman --noconfirm -Suy + +pacman --noconfirm -S --needed \ + "${MINGW_PACKAGE_PREFIX}"-ccache \ + "${MINGW_PACKAGE_PREFIX}"-glib2 \ + "${MINGW_PACKAGE_PREFIX}"-gobject-introspection \ + "${MINGW_PACKAGE_PREFIX}"-gtk3 \ + "${MINGW_PACKAGE_PREFIX}"-libffi \ + "${MINGW_PACKAGE_PREFIX}"-python \ + "${MINGW_PACKAGE_PREFIX}"-python-cairo \ + "${MINGW_PACKAGE_PREFIX}"-python-coverage \ + "${MINGW_PACKAGE_PREFIX}"-python-pip \ + "${MINGW_PACKAGE_PREFIX}"-python-pytest \ + "${MINGW_PACKAGE_PREFIX}"-toolchain \ + git \ + lcov + +# ccache setup +export PATH="$MSYSTEM/lib/ccache/bin:$PATH" +mkdir -p _ccache +export CCACHE_BASEDIR="$(pwd)" +export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" + +# coverage setup +export CFLAGS="-coverage -ftest-coverage -fprofile-arcs -Werror" +COV_DIR="$(pwd)/coverage" +COV_KEY="${CI_JOB_NAME}" +mkdir -p "${COV_DIR}" +export COVERAGE_FILE="${COV_DIR}/.coverage.${COV_KEY}" + +# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDEVMODE +export PYTHONDEVMODE=1 + +python setup.py build_tests + +lcov \ + --config-file .gitlab-ci/lcovrc \ + --directory "$(pwd)" \ + --capture --initial --output-file \ + "${COV_DIR}/${COV_KEY}-baseline.lcov" + +MSYSTEM= python -m coverage run --context "${COV_KEY}" tests/runtests.py +MSYSTEM= python -m coverage lcov -o "${COV_DIR}/${COV_KEY}.py.lcov" + +lcov \ + --config-file .gitlab-ci/lcovrc \ + --directory "$(pwd)" --capture --output-file \ + "${COV_DIR}/${COV_KEY}.lcov" diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..a862d40 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,9 @@ +version: 2 + +sphinx: + configuration: docs/conf.py + +python: + version: '3.8' + install: + - requirements: docs/requirements.txt \ No newline at end of file diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 76b1091..0000000 --- a/AUTHORS +++ /dev/null @@ -1,11 +0,0 @@ -Original Authors: -James Henstridge -Johan Dahlin - -Current Maintainers: -Ignacio Casal Quinteiro -Martin Pitt -Paolo Borelli -Sebastian Pölsterl -Simon Feltman -Tomeu Vizoso diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 106435e..0000000 --- a/ChangeLog +++ /dev/null @@ -1,27655 +0,0 @@ -commit 506f1e35a9375be80a6a79421bf8272165fdd90a -Author: Simon Feltman -Date: Mon Sep 16 01:23:49 2013 -0700 - - Update current maintainers list in README - - README | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit ef120498e060e88a1efcb82de385a23c1fa9c7da -Author: Simon Feltman -Date: Tue Sep 10 17:11:21 2013 -0700 - - Fix union argument regression when marshaling from python - - Check for union members when marshaling boxed types from Python. - This is a regression caused by stricter type checking added when - merging code from pygi-argument.c. - Re-add pyg_boxed_check to the same bit of code in addition to - __gtype__ checking to avoid a double regression. - - https://bugzilla.gnome.org/show_bug.cgi?id=703873 - - gi/pygi-marshal-from-py.c | 53 - ++++++++++++++++++++++++++--------------------- - 1 file changed, 29 insertions(+), 24 deletions(-) - -commit 59a2964141e963d2961e55d4b84a777927b4f21b -Author: Simon Feltman -Date: Wed Sep 11 05:05:33 2013 -0700 - - Fix GLib.Source sub-classing with initializer args - - Add variable args and keyword args to the GLib.Source.__new__ - method to support sub-classes which want to implement __init__. - - https://bugzilla.gnome.org/show_bug.cgi?id=707904 - - gi/overrides/GLib.py | 2 +- - tests/test_source.py | 11 +++++++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - -commit afa42ab95327da1de0cf86005974cd8ab0d46872 -Author: Vratislav Podzimek -Date: Wed Sep 4 14:17:31 2013 +0200 - - Copy __doc__ when wrapping function - - Signed-off-by: Vratislav Podzimek - Signed-off-by: Martin Pitt - - gi/overrides/__init__.py | 1 + - 1 file changed, 1 insertion(+) - -commit 7914a6828a533d8c579a5b422351e18b9f9afc8c -Author: Martin Pitt -Date: Mon Sep 2 14:56:24 2013 +0200 - - configure.ac: post-release bump to 3.9.92 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit ad8b7d1a89eb2d030a504d521f7589a4c1d835fb -Author: Martin Pitt -Date: Mon Sep 2 14:38:41 2013 +0200 - - release 3.9.91 - - NEWS | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 9df8eb79929025f12d51bc7f79b1d160156c2755 -Author: Simon Feltman -Date: Mon Sep 2 04:19:35 2013 -0700 - - Fix GObject signal methods to work with new annotations - - Add conditional support for signal methods annotated as gpointer - or GObject.Object. This is needed to work with newer versions of - glib which changed annotations to GObject.Object (bug #685387). - - https://bugzilla.gnome.org/show_bug.cgi?id=707280 - - gi/overrides/GObject.py | 106 - ++++++++++++++++++++++++++++++------------------ - 1 file changed, 66 insertions(+), 40 deletions(-) - -commit 9b6b6c7ee6a621cba99f51857eadd622a1535118 -Author: Chun-wei Fan -Date: Thu Aug 15 14:41:40 2013 +0800 - - Fix build on C89 Compilers - - Avoid a variable declaration at the middle of the block - - https://bugzilla.gnome.org/show_bug.cgi?id=707264 - - gi/pygi-closure.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 19c1a2dfb91a83a6fb0ca76b9c95c42a49a3736e -Author: Simon Feltman -Date: Sun Sep 1 20:44:26 2013 -0700 - - Change boxed type checking in marshaling to use __gtype__ attribute - - Replace usage of pyg_boxed_check(pyboxed) with g_type_is_a and - pyg_type_from_object. This has the effect of using the __gtype__ - attribute stashed on object class instead of the PyGBoxed - internally held gtype. This fixes type descrepencies for objects - marshaled into overridden signal class closures and passed back - to functions taking an alias their type. - - https://bugzilla.gnome.org/show_bug.cgi?id=707140 - - gi/pygi-marshal-from-py.c | 8 +++++++- - tests/test_overrides_gtk.py | 34 ++++++++++++++++++++++++++++++++++ - 2 files changed, 41 insertions(+), 1 deletion(-) - -commit dab0c09f1996e124ca98334e5aea0852904b44b5 -Author: Simon Feltman -Date: Sun Sep 1 17:49:09 2013 -0700 - - Use G_IS_VALUE for checking return values in closure marshaling - - Replace return_value argument NULL checks in GClosureMarshal - implementations with G_IS_VALUE. This checks both NULL and - validity of the value (!= G_TYPE_INVALID). This is needed - because GLib can pass either NULL or an invalid value based - on whether or not G_ENABLE_DEBUG is set. - See: https://bugzilla.gnome.org/show_bug.cgi?id=707249 - - https://bugzilla.gnome.org/show_bug.cgi?id=707170 - - gi/_gobject/pygtype.c | 4 ++-- - gi/pygi-signal-closure.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -commit c7b75a8c250078ac8ea28752f087ed687bd20edd -Author: Yanko Kaneti -Date: Wed Aug 21 08:53:07 2013 +0200 - - Fix PEP-8 errors in propertyhelper.py - - https://bugzilla.gnome.org/show_bug.cgi?id=706319 - - Signed-off-by: Martin Pitt - - gi/_gobject/propertyhelper.py | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -commit 6fdd58404103596accb6ab04d4de33846d853c58 -Author: Martin Pitt -Date: Mon Aug 19 17:13:30 2013 +0200 - - configure.ac: post-release bump to 3.9.91 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 6fbe2580deda215896e9583b418b8bc1aceb2f96 -Author: Martin Pitt -Date: Mon Aug 19 17:10:52 2013 +0200 - - release 3.9.90 - - NEWS | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit a8d5da559ef088b05062681206758d2718946269 -Author: Martin Pitt -Date: Mon Aug 19 11:38:31 2013 +0200 - - NEWS: retroactively fix last version number - - NEWS | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit aba45eb2617c4b35168089bc9028f351732a617f -Author: Benjamin Berg -Date: Tue Aug 6 00:41:52 2013 +0200 - - Create GLib.Pid in the same way on python 2 and 3 - - https://bugzilla.gnome.org/show_bug.cgi?id=705451 - - gi/_glib/pygspawn.c | 8 -------- - 1 file changed, 8 deletions(-) - -commit 2d203b7529c95ba4461a5a6d4c6b67169fabc4cf -Author: Benjamin Berg -Date: Mon Aug 5 17:04:15 2013 +0200 - - Use PyLong_Type.tp_new for GLib.Pid - - For GLib.Pid the original implementation for __new__ needs to be used, - as it is able to initialize the integer correctly. - - https://bugzilla.gnome.org/show_bug.cgi?id=705451 - - gi/_glib/pygspawn.c | 1 + - tests/test_subprocess.py | 1 + - 2 files changed, 2 insertions(+) - -commit c32793dafbd52eab87b14ca064b47f5a4fb9000b -Author: Simon Feltman -Date: Mon Aug 5 14:40:38 2013 -0700 - - Add accumulator and accu_data arguments to GObject.Signal decorator - - Update __init__, __call__, and copy methods to accept and pass - accumulators and associated user data through them. Update - accumulator unittests to use Signal decorators for testing accumulator - pass throughs. Verified the __gsignals__ dictionary accepts None - as valid values for accumulator and accu_data so specialization - for these arguments is not necessary. - - https://bugzilla.gnome.org/show_bug.cgi?id=705533 - - gi/_gobject/signalhelper.py | 17 ++++++++++----- - tests/test_signal.py | 52 - ++++++++++++++++++++++++--------------------- - 2 files changed, 40 insertions(+), 29 deletions(-) - -commit 78f72654f5cb6c06e76ed9a532fc1ee328b60e50 -Author: Simon Feltman -Date: Mon Aug 5 14:12:24 2013 -0700 - - Pass return values through the GObject.Signal.emit wrapper - - Return the result of GObject.emit from the Signal decorators wrapping. - Update unittest for decorated return type to use skipUnless for - Python 3. - Add test for Signal decorator return type. - - https://bugzilla.gnome.org/show_bug.cgi?id=705530 - - gi/_gobject/signalhelper.py | 2 +- - tests/test_signal.py | 37 +++++++++++++++++++++---------------- - 2 files changed, 22 insertions(+), 17 deletions(-) - -commit 08cc206afeaefd1ce50ecfd1411807225a11c8f8 -Author: Simon Feltman -Date: Mon Jul 29 03:33:40 2013 -0700 - - configure.ac: post-release bump to 3.9.90 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2d8f5490cdc078b3e56a92deb9eca71b3fc5ef17 -Author: Simon Feltman -Date: Mon Jul 29 02:23:02 2013 -0700 - - release 3.9.5 - - NEWS | 41 +++++++++++++++++++++++++++++++++++++++++ - configure.ac | 2 +- - 2 files changed, 42 insertions(+), 1 deletion(-) - -commit ec3de7608ec970f6f272c9d7937344f02c6e9c3d -Author: Simon Feltman -Date: Mon Jul 29 01:21:19 2013 -0700 - - Ensure exceptions set in closure out argument marshaling are printed - - Call PyErr_Print when an exception occurs after marshaling closure - out arguments. These exceptions were being ignored and cleared out - only to show up in debug builds of Python. - - https://bugzilla.gnome.org/show_bug.cgi?id=705064 - - gi/pygi-closure.c | 8 ++++++++ - tests/test_generictreemodel.py | 17 +++++++++++------ - 2 files changed, 19 insertions(+), 6 deletions(-) - -commit b5dcb1800839f747a052e487643c234668384677 -Author: Simon Feltman -Date: Sun Jul 28 23:00:26 2013 -0700 - - Use Python error messages for marshaling integers from Python - - Use Pythons default error messages where possible. - Change all explicitly raised ValueError to use OverflowError - for out of range data. - - https://bugzilla.gnome.org/show_bug.cgi?id=705057 - - gi/pygi-marshal-from-py.c | 76 - +++++++++++++++++------------------------------ - tests/test_everything.py | 52 ++++++++++++++++---------------- - tests/test_gi.py | 64 +++++++++++++++++++-------------------- - tests/test_gobject.py | 2 +- - 4 files changed, 86 insertions(+), 108 deletions(-) - -commit 3c83bfb14b850670eb7c0208e55c120ca203f8af -Author: Simon Feltman -Date: Sat Jul 27 21:10:07 2013 -0700 - - Use Py_CLEAR for closure cleanup instead of test with Py_DECREF - - gi/pygi-closure.c | 11 ++--------- - 1 file changed, 2 insertions(+), 9 deletions(-) - -commit f5e3876dee512ca82af6ea798b10d5ecad785dd1 -Author: Simon Feltman -Date: Sat Jul 27 15:25:20 2013 -0700 - - Cleanup invoke args and kwargs combiner code - - Change _py_args_combine_and_check_length use cleaner reference - counting. - It no longer DECREFs input arguments and always returns a new value - reference. - Use PyGICallableCache directly as an argument instead of passing - various - members. - - gi/pygi-invoke.c | 44 +++++++++++++++++--------------------------- - 1 file changed, 17 insertions(+), 27 deletions(-) - -commit 91c49822363d8a1efc82163b46daa667d6cfc1b7 -Author: Simon Feltman -Date: Wed Jul 17 16:10:25 2013 -0700 - - Replace Python VFunc descriptor directly with PyGIVFuncInfo - - Add tp_getdesc (__get__) to PyGIVFuncInfo to allow the object - to be used directly as a callable descriptor. This piggy backs - off the added support for functions and constructors in previous - patches. - - https://bugzilla.gnome.org/show_bug.cgi?id=704037 - - gi/pygi-info.c | 25 +++++++++++++++++++++++-- - gi/types.py | 33 ++++----------------------------- - 2 files changed, 27 insertions(+), 31 deletions(-) - -commit 35f79b22ec5abf02fd0bb66352eb1f251b65a078 -Author: Simon Feltman -Date: Tue Jul 16 16:00:14 2013 -0700 - - Add callable and descriptor protocols to PyGICallableInfo - - Add tp_call (__call__) function to callable info objects. - This allows for replacement of wrapped invoke methods directly - with the already created callable info object. This has the - additional side effect of making doc strings lazily bound - (only generated when __doc__ is accessed). - - Add tp_desc_get (__get__) to PyGIFunctionInfo which returns - a bound version of itself for methods and constructors. - - Update various internal type checks to reflect the changes. - Update tests to reflect the new callable type being the same - across Python 2 & 3. - - This patch gives roughly a %17 speedup for Gtk imports and - an %11 speedup for GI method calls. - - https://bugzilla.gnome.org/show_bug.cgi?id=704037 - - gi/module.py | 5 +- - gi/overrides/__init__.py | 10 ++- - gi/pygi-info.c | 179 - ++++++++++++++++++++++++++++++++++++++++++-- - gi/pygi.h | 13 ++++ - gi/types.py | 35 +-------- - tests/test_docstring.py | 6 +- - tests/test_gi.py | 32 +++----- - tests/test_overrides_gtk.py | 4 +- - 8 files changed, 212 insertions(+), 72 deletions(-) - -commit 2339e030e4dc4d93ea770bca380a89f831d56be6 -Author: Simon Feltman -Date: Fri Jul 26 19:33:32 2013 -0700 - - Move "from Python" GObject out arg marshaler into specialized function - - Move hacks specific to out argument marshaling for vfuncs into a - a specialized function. This allows standard function call marshaling - to continue working correctly when there are no extra references - holding the arguments "foo(SomeObject())". This is currently being - masked because all GI functions are wrapped by additional layers - of Python functions. When these layers are removed, it exposes - bugs introduced by reference counting hacks intended for vfunc - return arguments. - - https://bugzilla.gnome.org/show_bug.cgi?id=704037 - - gi/pygi-argument.c | 2 +- - gi/pygi-marshal-from-py.c | 37 ++++++++++++++++++++++++++++++------- - gi/pygi-marshal-from-py.h | 3 +++ - 3 files changed, 34 insertions(+), 8 deletions(-) - -commit 627c5faaa54ed9a2b59ac1547833c171cd1a1e87 -Author: Simon Feltman -Date: Fri Jul 26 17:34:01 2013 -0700 - - Add underscore prefix and _cache_adapter suffix to marshaling - functions - - Add underscores to all _pygi_marshal_* functions. We don't currently - export symbols, but we might need to for C unittesting. This will - ensure we don't have a "public API". - Add _cache_adapter suffix to marshaling functions which are light - weight wrappers intended only for cached marshalers. - - gi/pygi-argument.c | 40 +++++++++++----------- - gi/pygi-cache.c | 10 +++--- - gi/pygi-marshal-from-py.c | 86 - +++++++++++++++++++++++------------------------ - gi/pygi-marshal-from-py.h | 44 ++++++++++++------------ - gi/pygi-marshal-to-py.c | 48 +++++++++++++------------- - gi/pygi-marshal-to-py.h | 34 +++++++++---------- - 6 files changed, 131 insertions(+), 131 deletions(-) - -commit bec0b543be8d993996d8a17c343c3f2f33a9398f -Author: Simon Feltman -Date: Tue Jul 16 11:13:17 2013 -0700 - - Add common attribute accessors to PyGIBaseInfo - - Add __name__, __module__, and __doc__ accessors to - PyGIBaseInfo object. This is a precursory patch for setting - up PyGICallableInfo as a directly callable object with lazy - doc string evaluation. - - https://bugzilla.gnome.org/show_bug.cgi?id=704037 - - gi/_glib/pyglib-python-compat.h | 5 +++ - gi/pygi-info.c | 83 - +++++++++++++++++++++++++++++++++++++++-- - gi/types.py | 7 ++-- - 3 files changed, 88 insertions(+), 7 deletions(-) - -commit ea194404843a16555f9a475cc973872a4428bfe1 -Author: Simon Feltman -Date: Sat Jul 13 23:10:31 2013 -0700 - - Merge method and constructor setup - - Merge _setup_constructors into _setup_methods as they contain same - basic logic. This removes an unnecessary call with additional - filtering of GIObjectInfo.get_methods() which can be large for - objects with many methods. - - https://bugzilla.gnome.org/show_bug.cgi?id=704037 - - gi/types.py | 15 ++++----------- - 1 file changed, 4 insertions(+), 11 deletions(-) - -commit 6b36fbe904d19f515578f447daa7657d3a9a859c -Author: Simon Feltman -Date: Sat Jul 13 18:11:18 2013 -0700 - - Remove redundant info.get_name calls - - Remove a number of redundant calls to GIBaseInfo.get_name. Info - names are already cached on function objects so re-use them when - possible. This gives a small load time improvement by removing over - 2000 calls when importing Gtk. - - https://bugzilla.gnome.org/show_bug.cgi?id=704037 - - gi/module.py | 1 - - gi/types.py | 8 +++----- - 2 files changed, 3 insertions(+), 6 deletions(-) - -commit 6fdde256e840600c84a648ab21da2fe5c212e5bc -Author: Simon Feltman -Date: Fri Jul 12 12:21:54 2013 -0700 - - Move doc string generator into separate module - - Move the doc string generator for creating function signatures - into "gi.docstring". This includes a new API for getting and - setting the doc string creation functions: - - gi.docstring.get_doc_string_generator - gi.docstring.set_doc_string_generator - gi.docstring.generate_doc_string - - Beyond adding the ability for custom doc string generators, - this API is a necessary step for adding lazy __doc__ - attribute access for optimization. - - https://bugzilla.gnome.org/show_bug.cgi?id=704037 - - gi/Makefile.am | 3 +- - gi/docstring.py | 106 - ++++++++++++++++++++++++++++++++++++++++++++++++ - gi/types.py | 55 ++----------------------- - tests/Makefile.am | 1 + - tests/test_docstring.py | 49 ++++++++++++++++++++++ - tests/test_gi.py | 30 -------------- - 6 files changed, 161 insertions(+), 83 deletions(-) - -commit f86701b15ee04c717d9c6bf688101606165e4f83 -Author: Simon Feltman -Date: Wed Jul 24 19:36:28 2013 -0700 - - tests: Change GHashTable marshaling test to use GValue - - Add test to explicitly use a boxed GStrv GValue in addition to a - Python list sub-class. - - https://bugzilla.gnome.org/show_bug.cgi?id=666636 - - tests/test_everything.py | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -commit 6ea41b60691e1ba7e21374582d7aea072af71103 -Author: Simon Feltman -Date: Thu Jul 25 18:00:47 2013 -0700 - - gtk-demo: Change demo to use Gtk.Application - - Replace deriving from Gtk.Window with deriving from Gtk.Application - connected to a Gtk.ApplicationWindow instance. - - https://bugzilla.gnome.org/show_bug.cgi?id=698547 - - demos/gtk-demo/demos/printing.py | 2 +- - demos/gtk-demo/gtk-demo.py | 40 - ++++++++++++++++++++-------------------- - 2 files changed, 21 insertions(+), 21 deletions(-) - -commit fae58044ea0b2e7f47fbdacc5b58ac36f673ecbd -Author: Simon Feltman -Date: Tue Jul 23 14:25:01 2013 -0700 - - Move _pygi_argument_to_object_basic_type into pygi-marshal-to-py.c - - Move _pygi_argument_to_object_basic_type into pygi-marshal-to-py.c - and rename to _pygi_marshal_to_py_basic_type. - Cleanup and simplify dependant sub-marshalers for unichar, utf8, - and filename types. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 73 +----------------------------- - gi/pygi-argument.h | 4 -- - gi/pygi-cache.c | 4 +- - gi/pygi-marshal-to-py.c | 115 - +++++++++++++++++++++++++++++++++++++----------- - gi/pygi-marshal-to-py.h | 27 +++--------- - 5 files changed, 99 insertions(+), 124 deletions(-) - -commit cba401ac1543c2fdb68fff0dba8f6da7eed23bfa -Author: Simon Feltman -Date: Tue Jul 23 13:06:33 2013 -0700 - - Unify and clean up from Python marshalers for basic types - - Unify and cleanup boolean, float, double, gtype, unichar, utf8, - and filename marshalers. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-cache.c | 101 - ++-------------------------------------------- - gi/pygi-marshal-from-py.c | 86 ++++++++++++--------------------------- - gi/pygi-marshal-from-py.h | 30 -------------- - 3 files changed, 28 insertions(+), 189 deletions(-) - -commit 9e6e01d065bf0acc5b99ae0e8c034d689231bfe1 -Author: Simon Feltman -Date: Tue Jul 23 12:35:06 2013 -0700 - - Unify from Python int64 and uint64 marshalers - - Replaced int64 and uint64 cached marshalers with usage of the - unified basic type marshaler. Replace a large amount of int64 - exception formatting code with usage of %S for Python 3 and - give a more vague message for Python 2. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-cache.c | 36 +-------- - gi/pygi-marshal-from-py.c | 193 - ++++++++++------------------------------------ - gi/pygi-marshal-from-py.h | 10 --- - 3 files changed, 43 insertions(+), 196 deletions(-) - -commit 46653922003c7d1d5d16f5cdb39b3faadf9aff27 -Author: Simon Feltman -Date: Tue Jul 23 11:03:14 2013 -0700 - - Unify from Python int16 and int32 marshalers - - Add PyNumber_Check to unified basic type marshaler. - Add bounds checking to unified int16 and int32 marshalers. - Replaced int16 and int32 cached marshalers with usage of - unified basic type marshaler. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-cache.c | 69 +-------------- - gi/pygi-marshal-from-py.c | 218 - ++++++++++------------------------------------ - gi/pygi-marshal-from-py.h | 20 ----- - 3 files changed, 48 insertions(+), 259 deletions(-) - -commit 4b9c725a615fcf4a5e8d089d275d4586032d0d1f -Author: Simon Feltman -Date: Tue Jul 23 00:27:14 2013 -0700 - - Unify from Python boolean, int8, and uint8 marshalers - - Replaced boolean, int8, and uint8 cached marshalers with usage of - unified basic type marshaler. Add bounds checking to unified int8 - marshalers. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-cache.c | 48 +++------------ - gi/pygi-marshal-from-py.c | 146 - +++++++++++----------------------------------- - gi/pygi-marshal-from-py.h | 20 ++----- - 3 files changed, 45 insertions(+), 169 deletions(-) - -commit f517bfbc134b78a23b754332e59b9bb67bb68e98 -Author: Simon Feltman -Date: Mon Jul 22 23:24:13 2013 -0700 - - Add support for PyBytes with int8 and uint8 from Python marshaler - - This additional type marshaling is necessary for unifying marhalers - due to the same feature being available with cached argument - marshaling. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-marshal-from-py.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -commit fe9df90531f3dd04c0d13d73ebd4ae7dd396c9b1 -Author: Simon Feltman -Date: Mon Jul 22 23:23:29 2013 -0700 - - Move from Python integer marshaling into separate function - - Add _pygi_marshal_from_py_long for marshaling Python objects - that can convert to a PyLong type. This allows for better - sharing of code amongst marshalers along with unifying - them across Python 2.7 and 3.0. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 3 +- - gi/pygi-marshal-from-py.c | 159 - ++++++++++++++++++++++++---------------------- - 2 files changed, 84 insertions(+), 78 deletions(-) - -commit f7748affae3d6ef0cc2e409f65761fb29c01b038 -Author: Simon Feltman -Date: Mon Jul 22 22:19:26 2013 -0700 - - Move _pygi_argument_from_object_basic_type into pygi-marshal-from-py.c - - Move _pygi_argument_from_object_basic_type into pygi-marshal-from-py.c - and rename to: _pygi_marshal_from_py_basic_type - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 149 - +--------------------------------------------- - gi/pygi-marshal-from-py.c | 147 - +++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-marshal-from-py.h | 4 ++ - 3 files changed, 152 insertions(+), 148 deletions(-) - -commit 9c9510eec782f242280af24e86adf3561e4fac72 -Author: Simon Feltman -Date: Fri Jul 19 23:37:35 2013 -0700 - - Move basic type marshaling out of _pygi_argument_from_object - - Move the marshaling of Python objects to GI arguments for basic types - into a new function: _pygi_argument_from_object_basic_type - This is staging work needed before unifying basic type marshaling - of arguments from Python to GI. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 73 - ++++++++++++++++++++++++++++++++++-------------------- - 1 file changed, 46 insertions(+), 27 deletions(-) - -commit 0e2441518ef31bd2b4102ba5780c3ded00bec59a -Author: Simon Feltman -Date: Fri Jul 19 20:16:10 2013 -0700 - - Replace to Python cached marshalers with unified basic type marshaler - - Add cached arg marshaler "_pygi_marshal_to_py_basic_type" which - unifies functions, vfuncs, signals, and property marshaling for - "basic types". Remove all the individual cached arg marshalers - for these types. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 104 +++++++++++------------------------ - gi/pygi-argument.h | 4 ++ - gi/pygi-cache.c | 114 +++++++------------------------------- - gi/pygi-marshal-to-py.c | 142 - ++++-------------------------------------------- - gi/pygi-marshal-to-py.h | 48 ++-------------- - 5 files changed, 73 insertions(+), 339 deletions(-) - -commit 663fe5893bbc9f34bf8aa4da3cb6f9186a8233b1 -Author: Simon Feltman -Date: Fri Jul 19 18:00:40 2013 -0700 - - Move to Python basic type marshaling out of _pygi_argument_to_object - - Move the marshaling of GI arguments to Python objects for basic types - into a new function. The required information for this marshaler - is a GITypeTag and GITransfer. Argument marshaling matching these - requirments are now found in: _pygi_argument_to_object_basic_type. - The new marshaler can be used with a generic argument cache marshaler - to unify all of the "basic type" marshaling. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 86 - +++++++++++++++++++++++++++++++++++++++--------------- - 1 file changed, 63 insertions(+), 23 deletions(-) - -commit dd43a1e19440dbe025451d2e4e07a6074086498d -Author: Simon Feltman -Date: Sat Jul 6 14:16:36 2013 -0700 - - Override GValue.set/get_boxed with static C marshaler - - Override boxed type get/set methods on GValue to use the static C - GValue marshaler. This works around the inability of the introspection - version of these methods to know what the held GValue type is. - With this, all boxed types will now marshal properly with GValues as - their storage. - - https://bugzilla.gnome.org/show_bug.cgi?id=688081 - - gi/_gobject/gobjectmodule.c | 38 ++++++++++++++++++++++++++++++++++++++ - gi/overrides/GObject.py | 9 +++++++++ - 2 files changed, 47 insertions(+) - -commit 2cff4827e6d15bcad630316a8a4e67968a70bbbf -Author: Simon Feltman -Date: Sat Jul 6 14:10:20 2013 -0700 - - Refactor pyg_value_from_pyobject into two functions - - Break pyg_value_from_pyobject into two functions. One which keeps - Python exceptions queued (pyg_value_from_pyobject_with_error) and - one which clears them (pyg_value_from_pyobject). This allows for - re-use for code which want to keep the errors around - - https://bugzilla.gnome.org/show_bug.cgi?id=688081 - - gi/_gobject/gobjectmodule.c | 4 ++- - gi/_gobject/pygobject-private.h | 1 + - gi/_gobject/pygobject.h | 2 ++ - gi/_gobject/pygtype.c | 67 - ++++++++++++++++++++++++++++++++--------- - 4 files changed, 59 insertions(+), 15 deletions(-) - -commit 84e91a9da3522d042faca65fd2ada1ccaee60153 -Author: Simon Feltman -Date: Sat Jul 6 20:41:19 2013 -0700 - - Fix indentation for pyg_value_from_pyobject - - https://bugzilla.gnome.org/show_bug.cgi?id=688081 - - gi/_gobject/pygtype.c | 744 - +++++++++++++++++++++++++------------------------- - 1 file changed, 372 insertions(+), 372 deletions(-) - -commit 6a29d9be14ec33d06816ade67a5ccf5c7a1cf398 -Author: Simon Feltman -Date: Sat Jul 6 13:32:39 2013 -0700 - - Add deprecation warning for marshaling arbitrary objects as pointers - - Add deprecation warning for marshaling arbitrary objects to/from void - pointers with the exception of integers, PyCapsules, and None. - - https://bugzilla.gnome.org/show_bug.cgi?id=688081 - - gi/pygi-marshal-from-py.c | 17 ++++++++++++++++- - gi/pygi-marshal-to-py.c | 10 ++++++++-- - 2 files changed, 24 insertions(+), 3 deletions(-) - -commit 077aefed8566adcb99d7570f52fe09c74c2098e5 -Author: Simon Feltman -Date: Sat Jul 6 13:34:53 2013 -0700 - - Move PyGIDeprecationWarning to C for shared Python/C usage - - https://bugzilla.gnome.org/show_bug.cgi?id=688081 - - gi/__init__.py | 19 ++++--------------- - gi/gimodule.c | 18 ++++++++++++++++++ - gi/pygi.h | 2 ++ - 3 files changed, 24 insertions(+), 15 deletions(-) - -commit 90427107af36ea3c624b36967ee181ed13b9828f -Author: Simon Feltman -Date: Thu Jul 18 14:59:55 2013 -0700 - - Replace usage of __import__ with importlib.import_module - - https://bugzilla.gnome.org/show_bug.cgi?id=682320 - - gi/module.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 6391a8e4f03d4010c0d7de79fc83138fd69e0e33 -Author: Mike Gorse -Date: Wed Jul 10 16:44:23 2013 -0500 - - Always unref the GiTypeInfo when generating an argument cache - - We were leaking a GiTypeInfo when handling child arguments. - - https://bugzilla.gnome.org/show_bug.cgi?id=703973 - - gi/pygi-cache.c | 1 + - 1 file changed, 1 insertion(+) - -commit ce0ad7066ebdb7018fdce58dc32bbaa715206a0c -Author: Mike Gorse -Date: Wed Jul 10 12:10:16 2013 -0500 - - Unref interface info when fetching enums or flags - - When calling g_type_info_get_interface, the resulting interface should - be dereferenced by calling g_base_info_unref. - - https://bugzilla.gnome.org/show_bug.cgi?id=703960 - - gi/pygi-marshal-from-py.c | 8 +++++++- - gi/pygi-marshal-to-py.c | 3 +++ - 2 files changed, 10 insertions(+), 1 deletion(-) - -commit a93755ddba9a1761b627583d7b9be63783c2c063 -Author: Daniel Drake -Date: Tue Jul 9 13:03:36 2013 -0600 - - Speed up MRO calculation - - Optimize gi.type.mro() with the following observations and tricks: - - 1. Python prepares all the base classes before trying to calculate the - MRO of the current one (it first needs to populate __bases__, for - example). So we can assume that the base class MRO is already - available - in __mro__ and this will have been previously calculated (by us, - in the - case of gi classes). This avoids repeating a lot of MRO-calculating - work, - and also avoids (re)calculating MROs for inheritance chains - that don't - have any gi classes in them anyway. - - 2. With that simplification in place, we can avoid recursion, which - is not - all that great in Python... - - 3. ...except in the uncommon case of a Python2 old-style classes, - where - __mro__ is not available. There doesn't seem to be any existing - function to calculate or read MRO of old-style python classes, - so just - keep doing as before: calculate the C3 MRO of the old-style - class via - recursion. That behaviour is not really correct, and the - recursion is - not desirable, so we print a warning here. - - This makes the "hello world" Sugar app start up approximately - 0.5 seconds - faster on XO-1.5. - - https://bugzilla.gnome.org/show_bug.cgi?id=703829 - - gi/types.py | 30 +++++++++++++++++++++++++++--- - tests/test_gi.py | 16 ++++++++++++---- - 2 files changed, 39 insertions(+), 7 deletions(-) - -commit 7aca95781fc76f3e820e63325ccc07d128a60075 -Author: Daniel Drake -Date: Wed Jul 10 10:45:47 2013 -0600 - - tests: Add tests for MRO override - - Add tests for the MRO override to prevent against unintended - behaviour changes. - - https://bugzilla.gnome.org/show_bug.cgi?id=703829 - - tests/test_gi.py | 66 - ++++++++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 50 insertions(+), 16 deletions(-) - -commit a15333a36e31b76ea6b80251553840269ec5deb1 -Author: Simon Feltman -Date: Sat Jul 6 13:34:13 2013 -0700 - - Add GIL safety to pyobject_copy for copying boxed PyObjects - - https://bugzilla.gnome.org/show_bug.cgi?id=688081 - - gi/_gobject/pygobject.c | 3 +++ - 1 file changed, 3 insertions(+) - -commit 097c116d43a21bebf8e4bccde9cacc551db1e1e5 -Author: Simon Feltman -Date: Sat Jul 6 09:48:35 2013 -0700 - - testhelper: Fix import requirement for GObject - - Replace the importing of gi._gobject._gobject with - gi.repository.GObject - in tests/testhelpermodule.c - - The testhelper module was only importing the static bindings - (gi._gobject._gobject) and not the overrides (gi.repository.GObject). - This was causing some tests to fail when test_thread was the first - test to run in the suite due to it registering new types based on - PyGObject_Type. - - https://bugzilla.gnome.org/show_bug.cgi?id=703647 - - tests/testhelpermodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 0f6c571755e65b5e77d3d84e4516ef90d8ce0162 -Author: Simon Feltman -Date: Wed Jul 3 05:26:12 2013 -0700 - - Add marshalling of GI_TYPE_TAG_VOID held in a GValue to int - - Replace assertion for this case with a simple marshalling of the - pointer value to a Python int. While not particularly useful - this allows some callbacks in WebKit to function without causing - a segfault. - - https://bugzilla.gnome.org/show_bug.cgi?id=694233 - - gi/pygi-argument.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit e0084e7e73845fa2a2da29017d3622f361f11dfb -Author: Cole Robinson -Date: Sat Feb 16 17:26:43 2013 -0500 - - GTK overrides: Make connect_signals handle tuple - - This is used for passing extra arguments to callbacks during - signal emission in the form of: - builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)}) - - Co-Authored-By: Simon Feltman - - https://bugzilla.gnome.org/show_bug.cgi?id=693994 - - gi/overrides/Gtk.py | 51 ++++++++---- - tests/test_overrides_gtk.py | 196 - +++++++++++++++++++++++++++++--------------- - 2 files changed, 165 insertions(+), 82 deletions(-) - -commit 466567373289e6f141709f08efa80ba588d3d64a -Author: Simon Feltman -Date: Tue Jul 2 18:06:01 2013 -0700 - - Re-add support for passing GValue's by reference - - Fix special casing when marshaling from a Python held GValue - to a GValue argument intended for a function call. - The re-factoring of GValue marshaling in commit #9e47afe459df942d9f - broke this by always making a copy of the GValue. This removed the - ability to retrieve values with functions like - gtk_style_context_get_style_property. - - https://bugzilla.gnome.org/show_bug.cgi?id=701058 - - gi/pygi-argument.c | 2 +- - gi/pygi-marshal-from-py.c | 32 +++++++++++++++----------------- - 2 files changed, 16 insertions(+), 18 deletions(-) - -commit 40a3cd18fd7111ae177f6ab716f78d131f59a1c0 -Author: Simon Feltman -Date: Tue Jul 2 19:20:04 2013 -0700 - - tests: Add test for pass-by-reference GValue - - https://bugzilla.gnome.org/show_bug.cgi?id=701058 - - tests/test_gi.py | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 3b3251593ea107f06b160234b0ca5393cb39ac1b -Author: Simon Feltman -Date: Tue Jul 2 23:02:17 2013 -0700 - - Clear return value of closures to zero when an exception occures - - For return types other than void, set the ffi closure return argument - to 0 when a Python exception occures. This a good default in general - but also has the side affect of fixing failing idle callbacks - by causing them to be removed from main loops (after their stack - is printed). - - https://bugzilla.gnome.org/show_bug.cgi?id=702552 - - gi/pygi-closure.c | 14 ++++++++++++++ - tests/test_gi.py | 8 ++++++++ - 2 files changed, 22 insertions(+) - -commit ae3439f1d22482d6a920a869d3d17e7054af6f80 -Author: Martin Pitt -Date: Wed Jul 3 10:40:28 2013 +0200 - - Don't use doctest syntax in docstrings for examples - - These are not actual doctests, so don't use the >>> syntax there. Just - indent - them. - - This fixes pyflakes 0.7 failures. - - https://bugzilla.gnome.org/show_bug.cgi?id=701009 - - gi/_gobject/propertyhelper.py | 11 +++++------ - gi/overrides/GObject.py | 8 ++++---- - gi/overrides/Gtk.py | 2 +- - 3 files changed, 10 insertions(+), 11 deletions(-) - -commit b96a6dc968566d339a2dfd7dd631ae52d812302a -Author: Garrett Regier -Date: Tue Jul 2 06:07:15 2013 -0700 - - Add support for properties of type GInterface - - Add support for G_TYPE_INTERFACE/GInterface to switch - statement which handles G_TYPE_OBJECT based properties. - - Signed-off-by: Simon Feltman - - https://bugzilla.gnome.org/show_bug.cgi?id=703456 - - gi/_gobject/gobjectmodule.c | 1 + - gi/_gobject/propertyhelper.py | 3 ++- - tests/test_properties.py | 16 ++++++++++++++++ - 3 files changed, 19 insertions(+), 1 deletion(-) - -commit 61b268e44af63d6d78feae42578bf75aa5cfd511 -Author: Martin Pitt -Date: Fri Jun 21 07:27:48 2013 +0200 - - pygtkcompat: Fix for missing methods on Windows - - Deal with non-existing Gtk.Clipboard.get() and - GdkPixbuf.Pixbuf.new_from_file_at_scale() methods. - - https://bugzilla.gnome.org/show_bug.cgi?id=702787 - - pygtkcompat/pygtkcompat.py | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -commit 5e3ab0bb974cc785659666b871d795730b4f06b3 -Author: Chun-wei Fan -Date: Fri Jun 21 12:32:33 2013 +0800 - - gi/pygi-info.c: Avoid C99-style variable declaration - - https://bugzilla.gnome.org/show_bug.cgi?id=702786 - - gi/pygi-info.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 94167e12c118c85cd3172f9f5824fe53e55bcc2d -Author: Martin Pitt -Date: Wed May 29 11:20:35 2013 +0200 - - GLib overrides: fix typo in deprecation message - - Spotted by Dmitrijs Ledkovs, thanks! - - gi/overrides/GLib.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 86569b69ade0fe157fa87365e9369dde84cd5c90 -Author: Martin Pitt -Date: Tue May 28 17:57:20 2013 +0200 - - configure.ac: post-release version bump to 3.9.3 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 10f703189ed6a7104252907d1b1a114f26d79559 -Author: Martin Pitt -Date: Tue May 28 17:56:07 2013 +0200 - - release 3.9.2 - - NEWS | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit af8d048442b924c72a1d0ae868ee63ccf292759d -Author: Martin Pitt -Date: Fri May 24 13:03:07 2013 +0200 - - examples/option.py: Port to GI and Python 3 - - examples/option.py | 38 +++++++++++++++++++------------------- - 1 file changed, 19 insertions(+), 19 deletions(-) - -commit bef5939ca77f4d6939cd9229bd124dfe825b3bdb -Author: Simon Feltman -Date: Sun May 12 18:58:06 2013 -0700 - - Fix vfunc info search for classes with multiple inheritance - - Ensure the search for vfunc GI info continues recursively even if the - current class being looked at does not contain GI info of type - InterfaceInfo. This more exhaustive search is needed for setups with - multiple sub-classes and multiple inheritance. - - https://bugzilla.gnome.org/show_bug.cgi?id=700092 - - gi/types.py | 12 +++++++----- - tests/test_gi.py | 1 - - 2 files changed, 7 insertions(+), 6 deletions(-) - -commit 5b8dff59baa1a3e524dac7877dd5b33dea52b026 -Author: Simon Feltman -Date: Sun May 12 22:19:38 2013 -0700 - - Fix closure argument conversion for enum and flag in args - - Replace incorrect cast and assignment of double with uint for flags - and enums. - - gi/pygi-closure.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 065503d5e284dc89bacd79d0d9a72eb739882bf8 -Author: Simon Feltman -Date: Sat May 11 21:47:54 2013 -0700 - - tests: Add tests for overriding vfunc implementations - - Add tests for overriding vfuncs for both single inheritance - and multiple inheritance with an interface (currently failing). - - https://bugzilla.gnome.org/show_bug.cgi?id=700092 - - tests/test_gi.py | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -commit c4e1112840004af264b4f2a052f333ea38f95cb6 -Author: Simon Feltman -Date: Sat May 11 20:28:22 2013 -0700 - - Fix marshaling Python to FFI return value for enum and flags - - Add break to GI_TYPE_TAG_INTERFACE case. This was falling through - causing - assignment of arg.v_pointer to the ffi return arg. - - gi/pygi-closure.c | 1 + - 1 file changed, 1 insertion(+) - -commit a703217eaf4075e9720d4247351e1dfc4f553772 -Author: Simon Feltman -Date: Fri Apr 19 06:37:24 2013 -0700 - - Remove half implemented GC in PyGIBaseInfo, PyGIStruct, and PyGIBoxed - - Remove half implemented GC tracking from PyGIBaseInfo as it was not - needed (the implemented was also missing usage of - PyObject_GC_New/Track). - Ensure weakref list for PyGIBaseInfo is initialized to NULL and - cleared - properly. - Remove invalid calls to PyObject_GC_UnTrack and PyObject_ClearWeakRefs - for both PyGIStruct and PyGIBoxed as these types were not being - advertised as GC aware with Py_TPFLAGS_HAVE_GC. - - https://bugzilla.gnome.org/show_bug.cgi?id=677091 - - gi/pygi-boxed.c | 4 ---- - gi/pygi-info.c | 20 +++++--------------- - gi/pygi-struct.c | 4 ---- - 3 files changed, 5 insertions(+), 23 deletions(-) - -commit 87e41db2e060acd689a2ac043bc1ac51007de6f3 -Author: Simon Feltman -Date: Fri May 3 02:00:07 2013 -0700 - - Replace usage of pyg_begin_allow_threads with Py_BEGIN_ALLOW_THREADS - - Replace all usage of pyg[lib]_begin_allow_threads with direct usage - of Py_BEGIN_ALLOW_THREADS. - - https://bugzilla.gnome.org/show_bug.cgi?id=699440 - - gi/_glib/pyglib.h | 4 ---- - gi/_glib/pygoptioncontext.c | 4 ++-- - gi/_gobject/pygobject.c | 33 ++++++++++++++++----------------- - gi/gimodule.c | 4 ++-- - gi/pygi-invoke.c | 4 ++-- - 5 files changed, 22 insertions(+), 27 deletions(-) - -commit c9e95663d05de98a9abd3d1479554b1f09753382 -Author: Simon Feltman -Date: Thu May 2 03:57:05 2013 -0700 - - Remove and deprecate API for setting of thread blocking functions - - Remove pyglib_set_thread_block_funcs and deprecate - pyg_set_thread_block_funcs. - The thread block function APIs are no longer be neccessary because - PyGObject - can use the Python C API directly when working with threads. - - https://bugzilla.gnome.org/show_bug.cgi?id=699440 - - gi/_glib/pyglib.c | 41 ----------------------------------- - gi/_glib/pyglib.h | 9 ++++---- - gi/_gobject/gobjectmodule.c | 25 ++++++++------------- - gi/_gobject/pygobject-private.h | 33 ---------------------------- - gi/_gobject/pygobject.h | 48 - ++++++++++++++++++++--------------------- - gi/gimodule.c | 15 +++++++------ - 6 files changed, 46 insertions(+), 125 deletions(-) - -commit 05498a5732582a5ed1944bd1383af154ca5fc4e6 -Author: Martin Pitt -Date: Tue Apr 30 11:51:05 2013 -0700 - - configure.ac: Post-release bump to 3.9.2 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 902bb6685fd9c90c7d81127861a152b0fab4b107 -Author: Martin Pitt -Date: Tue Apr 30 11:49:03 2013 -0700 - - release 3.9.1 - - NEWS | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 49 insertions(+) - -commit f463d7cfaf65e0f3594ec15d897325f84225f1c5 -Author: Simon Feltman -Date: Sun Apr 28 19:59:35 2013 -0700 - - gtk-demo: Wrap description strings at 80 characters - - Wrap trailing demo description strings so they are easier to read - in a programming editor. The gtk-demo itself re-wraps this using - textwrap and the Gtk.TextView dynamic wrapping. - - https://bugzilla.gnome.org/show_bug.cgi?id=698547 - - demos/gtk-demo/demos/Entry/search_entry.py | 6 +++--- - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 8 ++++---- - demos/gtk-demo/demos/Icon View/iconviewedit.py | 5 +++-- - demos/gtk-demo/demos/Tree View/liststore.py | 5 ++++- - demos/gtk-demo/demos/images.py | 6 ++++-- - demos/gtk-demo/demos/menus.py | 20 - ++++++++++++++++---- - demos/gtk-demo/demos/pickers.py | 4 ++-- - demos/gtk-demo/demos/pixbuf.py | 5 +++-- - demos/gtk-demo/demos/rotatedtext.py | 6 ++++-- - 9 files changed, 43 insertions(+), 22 deletions(-) - -commit f0d4b963c42ac31d4d17ec0f2271940df2568644 -Author: Simon Feltman -Date: Sat Apr 27 22:30:35 2013 -0700 - - gtk-demo: Use textwrap to reformat description for Gtk.TextView - - https://bugzilla.gnome.org/show_bug.cgi?id=698547 - - demos/gtk-demo/gtk-demo.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -commit ed41e260dcf5745fcc0656412be3c4a520ee20fc -Author: Simon Feltman -Date: Sat Apr 27 21:58:28 2013 -0700 - - gtk-demo: Use GtkSource.View for showing source code - - Replace manual syntax highlighting of Gtk.TextView with usage of - GtkSource.View when available. Fall back to TextView with no - hightlighting when GtkSource is not available. - - https://bugzilla.gnome.org/show_bug.cgi?id=698547 - - demos/gtk-demo/gtk-demo.py | 170 - ++++++++++++--------------------------------- - 1 file changed, 44 insertions(+), 126 deletions(-) - -commit 150104db47ac5ba32758fba0c156adaecc0fbcc0 -Author: Mike Ruprecht -Date: Sun Apr 28 01:40:34 2013 -0500 - - Use correct class for GtkEditable's get_selection_bounds() function - - https://bugzilla.gnome.org/show_bug.cgi?id=699096 - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 61663928259f6f48c11f6e43334a62dd2b3eb8e6 -Author: Simon Feltman -Date: Thu Apr 25 05:27:35 2013 -0700 - - Test results of g_base_info_get_name for NULL - - Block against potential NULL result when generating type hint with - _g_arg_get_pytype_hint. - - https://bugzilla.gnome.org/show_bug.cgi?id=698829 - - gi/pygi-info.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -commit 0dff1940caf52ea5f1de27cc801ea6d4dab3a446 -Author: Jose Rostagno -Date: Sun Apr 21 19:09:59 2013 -0300 - - Remove g_type_init conditional call - - It's deprecated in the glib version we depend on. - - https://bugzilla.gnome.org/show_bug.cgi?id=698763 - - gi/_gobject/gobjectmodule.c | 3 --- - 1 file changed, 3 deletions(-) - -commit c84b071ed8d3b78b4e4a6aef12f5f8bb99bdc107 -Author: Jose Rostagno -Date: Sat Mar 30 20:59:44 2013 -0300 - - Update deps versions also in README - - commit f957e33bc1ef2a4175bab85cfcd9b5faf092aa2f missed to update - that file - - https://bugzilla.gnome.org/show_bug.cgi?id=698763 - - README | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 4f25fa43e1e5c0f3cd22bcdadadb1d731f01fe34 -Author: Jose Rostagno -Date: Sat Mar 30 20:50:35 2013 -0300 - - Drop compat code for old python version - - https://bugzilla.gnome.org/show_bug.cgi?id=698763 - - gi/_glib/pyglib-python-compat.h | 12 ------------ - 1 file changed, 12 deletions(-) - -commit 8104fa04cac2cba74337e6c4b3ecf56fd6cbb80b -Author: Niklas Koep -Date: Thu Apr 25 06:14:12 2013 +0200 - - Remove duplicate call to _gi.Repository.require() - - repository.require() was called twice in IntrospectionModule's - constructor. - - https://bugzilla.gnome.org/show_bug.cgi?id=698797 - - gi/module.py | 1 - - 1 file changed, 1 deletion(-) - -commit f22b95033c0bcd99e9c70e6f0dc999f5e64b08a6 -Author: Johan Dahlin -Date: Mon Oct 1 03:02:10 2012 -0700 - - Add ObjectInfo.get_class_struct() - - https://bugzilla.gnome.org/show_bug.cgi?id=685218 - - gi/pygi-info.c | 15 +++++++++++++++ - tests/test_gi.py | 4 ++++ - 2 files changed, 19 insertions(+) - -commit 2d34d35e5db06b0eb29cba91d0999b20a5c0b450 -Author: Simon Feltman -Date: Mon Apr 22 03:43:23 2013 -0700 - - Change interpretation of NULL pointer field from None to 0 - - The usage of 0 is needed because these fields should generally - be used to store integer indices or hashes, not necessarily - pointers to actual data. - - https://bugzilla.gnome.org/show_bug.cgi?id=698366 - - gi/pygi-argument.c | 11 +---------- - tests/test_everything.py | 5 +++-- - 2 files changed, 4 insertions(+), 12 deletions(-) - -commit 8d61ad38eb90d639da08289c036ae4cb99336c2a -Author: Sobhan Mohammadpour -Date: Fri Mar 8 08:25:58 2013 +0330 - - Do not build tests until needed - - Originally by [Alexandre Rostovtsev - - https://bugzilla.gnome.org/show_bug.cgi?id=698444 - - tests/Makefile.am | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -commit f61f23b999ae6e27ca852753da906de4ab8e6e25 -Author: Kai Willadsen -Date: Sun Apr 14 15:16:40 2013 +1000 - - pygi-convert: Support toolbar styles - - https://bugzilla.gnome.org/show_bug.cgi?id=698477 - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 7a92ade7ee5fe2f9eb8de2626c34650e2e5c06df -Author: Kai Willadsen -Date: Sun Apr 14 10:54:04 2013 +1000 - - pygi-convert: Support new-style constructors for Gio.File - - https://bugzilla.gnome.org/show_bug.cgi?id=698477 - - pygi-convert.sh | 2 ++ - 1 file changed, 2 insertions(+) - -commit 1e8120992dc103ac817351be3c150e6cb25f719f -Author: Kai Willadsen -Date: Sun Apr 14 10:22:55 2013 +1000 - - pygi-convert: Add some support for recent manager constructs - - https://bugzilla.gnome.org/show_bug.cgi?id=698477 - - pygi-convert.sh | 3 +++ - 1 file changed, 3 insertions(+) - -commit 17d349f98d62ea7947c1553e0ef7e867301523aa -Author: Kai Willadsen -Date: Sun Apr 14 07:37:24 2013 +1000 - - pygi-convert: Check for double quote in require statement - - https://bugzilla.gnome.org/show_bug.cgi?id=698477 - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit cc8bd6bd3fdf99762aa3431ceee347a05f6f3200 -Author: Kai Willadsen -Date: Sun Apr 14 07:37:00 2013 +1000 - - pygi-convert: Don't transform arbitrary keysym imports - - https://bugzilla.gnome.org/show_bug.cgi?id=698477 - - pygi-convert.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 99872a18ed1468b2c85cc7b96a0d12f2ae5167f0 -Author: Simon Feltman -Date: Thu Apr 11 04:09:59 2013 -0700 - - Remove Python keyword escapement in Repository.find_by_name - - Strip trailing underscore from module level items before - calling g_irepository_find_by_name. This fixes a problem - with GI module level items having the same name as a Python - keyword raising an AttributeError during access (Pango.break_). - - https://bugzilla.gnome.org/show_bug.cgi?id=697363 - - gi/pygi-info.c | 32 ++++++++++++++++++++++---------- - gi/pygi-info.h | 2 ++ - gi/pygi-repository.c | 16 ++++++++++++++++ - tests/test_overrides_pango.py | 5 +++++ - 4 files changed, 45 insertions(+), 10 deletions(-) - -commit c07404461b126206e369270b56e613f81369c70a -Author: Daniel Drake -Date: Mon Mar 18 16:08:09 2013 -0600 - - Optimize signal lookup in gi repository - - Now that we have GSignalQuery results available to us when connecting - signals, we already know which GType implements the signal in - question. - - Therefore there is no need to traverse the class parent hierarchy - looking for this, which takes a considerable amount of CPU time. - - There is also no need to canonicalize the signal name; both before - and after this patch, by the time we reach this point we have already - successfully looked up the signal name as presented from Python. - - https://bugzilla.gnome.org/show_bug.cgi?id=696143 - - gi/_gobject/pygobject.c | 5 ++-- - gi/pygi-signal-closure.c | 59 - +++++++++++++----------------------------------- - gi/pygi-signal-closure.h | 1 + - gi/pygi.h | 4 +++- - 4 files changed, 23 insertions(+), 46 deletions(-) - -commit e220706b3e4d9fd454613fbfe1e60e7e1da94ae0 -Author: Daniel Drake -Date: Mon Mar 18 15:38:19 2013 -0600 - - Optimize connection of Python-implemented signals - - Like properties, when working with signals we must detect if the - signal is implemented in a Python class or if it originates from the - gi repository, and act accordingly. - - Asking the gi repository if it can find a signal that is implemented - in a Python class (it can't) takes a considerable amount of CPU time. - - Use g_signal_query() to find out which GType implements the signal. - Then perform a simple test to see if this type is implemented at the - Python level, allowing us to to skip the GI querying in this case. - - https://bugzilla.gnome.org/show_bug.cgi?id=696143 - - gi/_gobject/pygobject.c | 19 +++++++++++++++---- - 1 file changed, 15 insertions(+), 4 deletions(-) - -commit e91b35d72f93678a79623347dce271148d57046f -Author: Daniel Drake -Date: Mon Mar 18 15:24:52 2013 -0600 - - Consolidate signal connection code - - This code was repeated 4 times with very little variance; - consolidate it and add simple tests to ensure basic coverage. - - https://bugzilla.gnome.org/show_bug.cgi?id=696143 - - gi/_gobject/pygobject.c | 129 - +++++++++++++++-------------------------------- - tests/test_everything.py | 33 ++++++++++++ - 2 files changed, 74 insertions(+), 88 deletions(-) - -commit cd91e1d5db617d470acbf8c5bc74c11c92f946f6 -Author: Daniel Drake -Date: Mon Mar 18 15:11:16 2013 -0600 - - Fix setting of struct property values - - "goto out" in this context means that an error occurred, but this - particular instance was sitting in the "good" codepath. - - Fixes setting of struct property values. - - gi/pygi-property.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 8981ea0422c6837d488311dafe8937593372e736 -Author: Daniel Drake -Date: Mon Mar 18 14:25:45 2013 -0600 - - Optimize property get/set when using GObject.props - - Skip GI repository lookup for properties defined on Python - defined GObject types. - - Signed-off-by: Simon Feltman - - https://bugzilla.gnome.org/show_bug.cgi?id=696143 - - gi/_gobject/pygobject.c | 37 +++++++++++++++++++------------------ - 1 file changed, 19 insertions(+), 18 deletions(-) - -commit 266e389ff90d982151bae3ac22b9b8b0739f520f -Author: Christoph Reiter -Date: Sat Apr 13 17:28:26 2013 +0200 - - configure.ac: Fix PYTHON_SO with Python3.3 - - https://bugzilla.gnome.org/show_bug.cgi?id=696646 - - configure.ac | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit e54c2d1df3812a1789ee240b0ba71ddf77c2f90a -Author: Daniel Drake -Date: Mon Mar 18 14:13:37 2013 -0600 - - Simplify registration of custom types - - Use custom quark data to track Python created GTypes. - - Remove previous mechanism to track registration of python-implemented - GTypes as it was unused (no custom registration was ever tracked). - - Leave vtable pointer and set to NULL to avoid an ABI break. - - Signed-off-by: Simon Feltman - - https://bugzilla.gnome.org/show_bug.cgi?id=696143 - - gi/_gobject/gobjectmodule.c | 11 +++++-- - gi/_gobject/pygobject-private.h | 8 ++--- - gi/_gobject/pygobject.c | 8 ++--- - gi/_gobject/pygobject.h | 9 +++--- - gi/_gobject/pygtype.c | 69 - +++-------------------------------------- - 5 files changed, 22 insertions(+), 83 deletions(-) - -commit 50702a09344825e3a8aa54365d78de807f989d88 -Author: Christoph Reiter -Date: Sat Apr 13 16:04:17 2013 +0200 - - pygi-convert.sh: Add GStreamer rules - - https://bugzilla.gnome.org/show_bug.cgi?id=697951 - - pygi-convert.sh | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -commit b289176e6b37cb2825bd555cea019b85b68d5c57 -Author: Jussi Kukkonen -Date: Sun Mar 10 15:04:40 2013 +0200 - - pygi-convert: Add rule for TreeModelFlags - - Signed-off-by: Simon Feltman - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 09610bf42be76f65d7d2afe1c691f7b4a7c64e5b -Author: Simon Feltman -Date: Fri Mar 29 03:20:44 2013 -0700 - - Unify interface struct to Python GI marshaling code - - Add pygi_marshal_to_py_interface_struct used for direct gi method - call out args and vfunc in args. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 72 ++++++------------------------- - gi/pygi-marshal-to-py.c | 112 - +++++++++++++++++++++++++++++------------------- - gi/pygi-marshal-to-py.h | 8 ++++ - 3 files changed, 91 insertions(+), 101 deletions(-) - -commit 6d3a0751e71ee3c37b3bb646723aed75971e5b39 -Author: Simon Feltman -Date: Thu Mar 28 22:41:51 2013 -0700 - - Unify Python interface struct to GI marshaling code - - Add pygi_marshal_from_py_interface_struct used for direct gi method - call in args and vfunc out args. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 75 +++++++-------------- - gi/pygi-cache.c | 12 +--- - gi/pygi-marshal-from-py.c | 167 - +++++++++++++++++++++++++++++----------------- - gi/pygi-marshal-from-py.h | 11 +++ - 4 files changed, 141 insertions(+), 124 deletions(-) - -commit 1ea654b4d34e0d119556b232796cd9370b2572f1 -Author: Simon Feltman -Date: Thu Mar 28 06:17:15 2013 -0700 - - Unify Python float and double to GI marshaling code - - Change _pygi_argument_from_object to use the cachers marshalers - (_pygi_marshal_from_py_float/double) directly instead of keeping a - copy of the code. - Refactor _pygi_marshal_from_py_float/double to use a common utility - _pygi_py_arg_to_double for initial error checking and conversion. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 26 ++++---------------------- - gi/pygi-marshal-from-py.c | 42 ++++++++++++++++++++---------------------- - 2 files changed, 24 insertions(+), 44 deletions(-) - -commit 2eb2a712864a1a685d19018e0860cf0da7c5c9ab -Author: Simon Feltman -Date: Thu Mar 28 05:29:08 2013 -0700 - - Unify filename to Python GI marshaling code - - Change _pygi_argument_to_object to use the cachers marshaler - (_pygi_marshal_to_py_filename) directly instead of keeping a - copy of the code. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 22 ++-------------------- - gi/pygi-marshal-to-py.c | 6 ++---- - 2 files changed, 4 insertions(+), 24 deletions(-) - -commit 54aa043d96deb02589e13042a46917405ca53780 -Author: Simon Feltman -Date: Thu Mar 28 05:20:00 2013 -0700 - - Unify utf8 to Python GI marshaling code - - Change _pygi_argument_to_object to use the cachers marshaler - (_pygi_marshal_to_py_utf8) directly instead of keeping a - copy of the code. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 11 ++++------- - gi/pygi-marshal-to-py.c | 4 +--- - 2 files changed, 5 insertions(+), 10 deletions(-) - -commit 03ff41ae4bb83858338d96cc6210092c7fb82464 -Author: Simon Feltman -Date: Thu Mar 28 05:10:45 2013 -0700 - - Unify unichar to Python GI marshaling code - - Change _pygi_argument_to_object to use the cachers marshaler - (_pygi_marshal_to_py_unichar) directly instead of keeping a - copy of the code. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 19 ++----------------- - 1 file changed, 2 insertions(+), 17 deletions(-) - -commit 594ad084c2cc21cebce209c11740e6d4866b0b82 -Author: Simon Feltman -Date: Sat Feb 16 19:49:59 2013 -0800 - - Unify Python unicode to filename GI marshaling code - - Change _pygi_argument_from_object to use the cachers marshaler - (_pygi_marshal_from_py_filename) directly instead of keeping a - copy of the code. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 30 ++---------------------------- - 1 file changed, 2 insertions(+), 28 deletions(-) - -commit a62e8cdf90f7b03cfc8116125ef3557f9ad08dde -Author: Simon Feltman -Date: Sat Feb 16 19:32:54 2013 -0800 - - Unify Python unicode to utf8 GI marshaling code - - Change _pygi_argument_from_object to use the cachers marshaler - (_pygi_marshal_from_py_utf8) directly instead of keeping a - copy of the code. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 32 ++------------------------------ - 1 file changed, 2 insertions(+), 30 deletions(-) - -commit e253c73335fccabc61e0329f8528a90f79858c67 -Author: Simon Feltman -Date: Sat Feb 16 19:16:43 2013 -0800 - - Unify Python unicode to unichar GI marshaling code - - Change _pygi_argument_from_object to use the cachers marshaler - (_pygi_marshal_from_py_unichar) directly instead of keeping a - copy of the code. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 34 ++-------------------------------- - gi/pygi-marshal-from-py.c | 9 +++++++++ - 2 files changed, 11 insertions(+), 32 deletions(-) - -commit 216caf590b262fed40d10bb34d020089d1197160 -Author: Simon Feltman -Date: Thu Apr 4 15:57:12 2013 -0700 - - Fix enum and flags marshaling type assumptions - - Replace assignments of GFlags and GEnum values to various GIArgument - members with v_uint and v_int respectively. - - gi/pygi-argument.c | 6 +++--- - gi/pygi-property.c | 4 ++-- - 2 files changed, 5 insertions(+), 5 deletions(-) - -commit 4799ef1d0cb9a4b27c7952585d33b58ea9ec34ca -Author: Christoph Reiter -Date: Thu Apr 4 10:08:38 2013 +0200 - - Make AM_CHECK_PYTHON_LIBS not depend on AM_CHECK_PYTHON_HEADERS - - https://bugzilla.gnome.org/show_bug.cgi?id=696648#c6 - - m4/python.m4 | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit f82f755a0f419539c223e4a74e33145726c6e69f -Author: Christoph Reiter -Date: Thu Apr 4 09:05:48 2013 +0200 - - Use distutils.sysconfig to retrieve the python include path. - - https://bugzilla.gnome.org/show_bug.cgi?id=696648 - - m4/python.m4 | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -commit cf81dd66e6387bf27122a71176e91ca39beb6519 -Author: Martin Pitt -Date: Thu Apr 4 06:47:56 2013 +0200 - - Use g_strdup() consistently - - https://bugzilla.gnome.org/show_bug.cgi?id=696650 - - gi/pygi-marshal-from-py.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 6c22fea63fa6978c2a717ff12ff84d3aff776b5e -Author: Christoph Reiter -Date: Tue Mar 26 16:03:59 2013 +0100 - - Support PEP 3149 (ABI version tagged .so files) - - Add a ABI suffix to the shared library retrieved from - distutils.sysconfig - instead of hardcoding it. This should also make things more robust - on Windows. - - https://bugzilla.gnome.org/show_bug.cgi?id=696646 - - configure.ac | 3 +++ - gi/Makefile.am | 14 +++++++------- - gi/_glib/Makefile.am | 14 +++++++------- - gi/_gobject/Makefile.am | 14 +++++++------- - 4 files changed, 24 insertions(+), 21 deletions(-) - -commit 2259ccac8aa2ec23240e92e303ea3f2c53dc2a88 -Author: Simon Feltman -Date: Sun Mar 31 01:32:34 2013 -0700 - - Fix stack corruption due to incorrect format for argument parser - - Fix call to PyArg_ParseTupleAndKeywords that used a format parser - of "l" meaning long (8 bytes) in combination with an output pointer - of guint (4 bytes). Change to use gulong with a format of "k". - - https://bugzilla.gnome.org/show_bug.cgi?id=696892 - - gi/_gobject/pygflags.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 48e52210ece0e144b4c959e773ea542a912358e7 -Author: Simon Feltman -Date: Thu Mar 7 00:26:37 2013 -0800 - - Deprecate GLib and GObject threads_init - - Remove a handful of Python threading related helper functions - from pyglib and pygobject. The binding internals required - GLib.threads_init to be called for PyGObject to work with - Python threads. This was removed as it should not be a requirement. - Using the Python threading module already initializes threading - for us (PyEval_InitThreads). - - https://bugzilla.gnome.org/show_bug.cgi?id=686914 - - gi/_glib/glibmodule.c | 16 -------- - gi/_glib/pyglib.c | 94 - --------------------------------------------- - gi/_glib/pyglib.h | 28 +++++++------- - gi/_gobject/gobjectmodule.c | 31 ++++----------- - gi/overrides/GLib.py | 8 +++- - gi/overrides/GObject.py | 2 +- - 6 files changed, 28 insertions(+), 151 deletions(-) - -commit 89d05f91cee419d46cb5318d4a9001ec315a3475 -Author: Martin Pitt -Date: Mon Mar 25 09:03:51 2013 +0100 - - Drop support for Python 2.6 - - 2.7 has been released long ago, nobody tests PyGObject with 2.6 any - more, and - this unblocks e. g. GNOME #682320. - - Drop usage of PyCObject_* (which has been superseded by PyCapsule - for >= 2.7), - and drop Python 2.6 specific workarounds. - - configure.ac | 2 +- - gi/_glib/pyglib-python-compat.h | 20 ------------------ - gi/_gobject/pygobject.h | 6 ------ - gi/pygi.h | 4 ---- - m4/python.m4 | 2 +- - tests/runtests.py | 45 - +---------------------------------------- - tests/test_gobject.py | 1 - - tests/test_signal.py | 4 ---- - 8 files changed, 3 insertions(+), 81 deletions(-) - -commit 56347953abb1e214817186581eaf2b2d8762cf97 -Author: Martin Pitt -Date: Wed Oct 24 16:43:25 2012 +0200 - - Remove static PollFD bindings - - Use the GLib API through GI instead, and provide an override to keep a - backwards compatible constructor syntax. - - https://bugzilla.gnome.org/show_bug.cgi?id=686795 - - gi/_glib/Makefile.am | 2 -- - gi/_glib/glibmodule.c | 2 -- - gi/_glib/pygsource.c | 98 - --------------------------------------------------- - gi/_glib/pygsource.h | 36 ------------------- - gi/overrides/GLib.py | 17 +++++++-- - 5 files changed, 15 insertions(+), 140 deletions(-) - -commit a93eb5ecc982b5fe1bdf8f78b15ba10351a63b89 -Author: Martin Pitt -Date: Mon Mar 25 08:44:24 2013 +0100 - - Drop test skipping due to too old g-i - - We depend on gobject-introspection 1.35.9 now, which has all this API. - - tests/test_gi.py | 24 ------------------------ - tests/test_object_marshaling.py | 14 -------------- - 2 files changed, 38 deletions(-) - -commit f957e33bc1ef2a4175bab85cfcd9b5faf092aa2f -Author: Martin Pitt -Date: Mon Mar 25 08:37:37 2013 +0100 - - Bump glib and g-i dependencies - - Now require g-i 1.35.9 and glib 2.35.9, i. e. the current stable - GNOME 3.8 - versions. This allows us to drop the conditional test suite skips - and drop the - static PollFD bindings. - - configure.ac | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 252556d044322207429c0d0c269365f48e4d819a -Author: Martin Pitt -Date: Mon Mar 25 08:43:53 2013 +0100 - - configure.ac: post-release version bump to 3.9.1 - - configure.ac | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 5f82e007e2dcdbfd82a20d8c4d54f9cd7b3b77ac -Author: Martin Pitt -Date: Mon Mar 25 08:12:10 2013 +0100 - - release 3.8.0 - - NEWS | 4 ++++ - 1 file changed, 4 insertions(+) - -commit bb4fa093d59173f68a0b16e10016bafe7cd18f62 -Author: Simon Feltman -Date: Wed Mar 20 23:45:01 2013 -0700 - - tests: Fix incorrect assumption when testing pyglib version - - Replace version test of 3.7.2 with 3.0.0 as it is the only reasonable - value that can be used for a future proof unittest here. - - tests/test_glib.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 78b7b0bea3068b81ba67deea4d06b1fb27434841 -Author: Martin Pitt -Date: Mon Mar 18 14:02:29 2013 +0100 - - configure.ac: post-release bump to 3.8.0 - - configure.ac | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit defbd63e95faafaa84230f160bc95dad0f55e37d -Author: Martin Pitt -Date: Mon Mar 18 14:01:05 2013 +0100 - - release 3.7.92 - - NEWS | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -commit a0844a896603c5c91bed24cf94106765f0ced74e -Author: Simon Feltman -Date: Sun Mar 17 23:22:38 2013 -0700 - - Fix stack smasher when marshaling enums as a vfunc return value - - Add special case for marshaling GI_TYPE_TAG_INTERFACE with enum or - flag types. Default interfaces to marshal as a pointer. - Add explicit cases for GType and Unichar out/return marshaling. - Fix leaking of GIBaseInfo when marshaling interface as out arg. - - https://bugzilla.gnome.org/show_bug.cgi?id=637832 - - gi/pygi-closure.c | 69 - ++++++++++++++++++++++++++++++++++++++++++++++--------- - tests/test_gi.py | 19 +++++++++++++++ - 2 files changed, 77 insertions(+), 11 deletions(-) - -commit 669e15c35213dbce6ceb0a4a3d474aae620910ce -Author: Simon Feltman -Date: Sun Mar 17 15:37:09 2013 -0700 - - Change base class of PyGIDeprecationWarning based on minor version - - Use RuntimeWarning as the base class of PyGIDeprecationWarning - for unstable (odd minor version) and use DeprecationWarning for - stable (even minor version). This is so PyGObject deprecations - behave the same as regular Python deprecations in stable releases. - - https://bugzilla.gnome.org/show_bug.cgi?id=696011 - - gi/__init__.py | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -commit 755b2e6fc635489d98d48254ea60b2631b43dfbd -Author: Alban Browaeys -Date: Thu Feb 28 18:57:21 2013 +0100 - - autogen.sh: Source gnome-autogen to fix out of source builddir - - https://bugzilla.gnome.org/show_bug.cgi?id=694889 - - autogen.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit a38392a9d713b0001cf30066d337b1abbbbbc59e -Author: Martin Pitt -Date: Tue Mar 5 12:22:15 2013 +0100 - - Add 3.7.91.1 NEWS entry - - Forgot to push this back then. - - NEWS | 3 +++ - 1 file changed, 3 insertions(+) - -commit 85f8aae849dd0fb21de8722a3af9234ca20ea1e0 -Author: Simon Feltman -Date: Sun Mar 17 04:19:57 2013 -0700 - - pygtkcompat: Make gdk.Window.get_geometry return tuple of 5 - - Make get_geometry return a tuple of (x, y, width, height, depth) - as it did in pygtk 2. - Update pygtkcompat.enable_gtk() to default to version 3.0 because - version 2.0 core dumps trying to use introspection with gtk 2. - - pygtkcompat/pygtkcompat.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -commit 38683f721c33cc35f0260868e58643fd35f04cbe -Author: Simon Feltman -Date: Sun Mar 17 02:08:03 2013 -0700 - - testhelpermodule: Fix build warning for PyGObject_Type redefinition - - Remove dynamic retrieval of PyGObject_Type as it is available - in pygobject.h since commit 2656bc47 (causing this compile warning) - - tests/testhelpermodule.c | 14 +------------- - 1 file changed, 1 insertion(+), 13 deletions(-) - -commit a3ec8867945da7722beebb7e77c6255ee3ba8bb8 -Author: Simon Feltman -Date: Sun Mar 17 01:51:33 2013 -0700 - - pygtkcompat: Initialize hint to zero in set_geometry_hints - - pygtkcompat/pygtkcompat.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 471204953d6fc93b3d311afd133d40f7d75ec541 -Author: Simon Feltman -Date: Fri Mar 15 04:33:22 2013 -0700 - - Remove incorrect bounds check with property helper flags - - Remove bounds check for flags as it is not necessary for the - helper to make these kind of judgement calls in general. - e.g. leave it to marshaling/internals to complain about potential - problems. The flags were being bounds checked to a maximum - value of 32 (the intention was most likely to limit it to 32 bits). - - gi/_gobject/propertyhelper.py | 3 --- - tests/test_properties.py | 1 - - 2 files changed, 4 deletions(-) - -commit 2656bc47ca1219b329066da1c2c58018ae624866 -Author: Simon Feltman -Date: Thu Mar 7 18:07:17 2013 -0800 - - Fix crash when setting property of type object to an incorrect type - - Add type check when marshaling an object from Python for GObject - types. - Add PyGObject_Type as part of the pygobject API to check for this. - - https://bugzilla.gnome.org/show_bug.cgi?id=695420 - - gi/_gobject/gobjectmodule.c | 3 ++- - gi/_gobject/pygobject.h | 2 ++ - gi/pygi-marshal-from-py.c | 8 ++++++++ - tests/test_object_marshaling.py | 4 ++++ - 4 files changed, 16 insertions(+), 1 deletion(-) - -commit 44587f42224a44a480629223c8d78a426bc32a12 -Author: Simon Feltman -Date: Thu Mar 7 17:59:02 2013 -0800 - - Remove skipping of object property tests - - These were showing up as unexpected successes now that bug 675726 - is fixed. - - https://bugzilla.gnome.org/show_bug.cgi?id=695420 - - tests/test_object_marshaling.py | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -commit 10214ba2d96fd6d66eeea159219f585abff8632a -Author: Simon Feltman -Date: Thu Mar 7 15:34:49 2013 -0800 - - Give more informative error when setting property to incorrect type - - https://bugzilla.gnome.org/show_bug.cgi?id=695420 - - gi/_gobject/pygobject.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -commit 9ab6e5451aea43ed086c0d26324c4efed24476d7 -Author: Martin Pitt -Date: Tue Mar 5 12:04:55 2013 +0100 - - Revert "Drop gi.overrides.overridefunc()" - - This reverts commit 1dc2bc9f65669417ae1964d70b85f115928b2963. External - modules - like GEdit plugins use @overrides for functions as well, we must - not break - them. - - https://bugzilla.gnome.org/show_bug.cgi?id=695199 - - gi/overrides/Gtk.py | 7 ++++--- - gi/overrides/__init__.py | 24 ++++++++++++++++++++++-- - 2 files changed, 26 insertions(+), 5 deletions(-) - -commit 862de794bf01a66aa6d796c674bce375cad37ba7 -Author: Martin Pitt -Date: Mon Mar 4 17:33:51 2013 +0100 - - configure.ac: Post-release bump to 3.7.92 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit bb12e652d661cf6ce931b44a89c11951894101bf -Author: Martin Pitt -Date: Mon Mar 4 17:27:50 2013 +0100 - - release 3.7.91 - - NEWS | 33 +++++++++++++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - -commit 25a6f90f28b065dd4f1cd352826598577402dc0b -Author: Martin Pitt -Date: Mon Mar 4 17:16:22 2013 +0100 - - Dot not clobber original Gdk/Gtk functions with overrides - - https://bugzilla.gnome.org/show_bug.cgi?id=686835 - - gi/overrides/Gdk.py | 3 ++- - gi/overrides/Gtk.py | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -commit d50d16428edf42799489fe1befbc4ce56f0fa181 -Author: Martin Pitt -Date: Mon Mar 4 15:30:31 2013 +0100 - - tests: Reorganize GError and GClosure tests - - Split TestGClosure.test_gclosure_in() into its three components. - - Merge the various TestGError* classes into one, to match the structure - of the - other tests. - - tests/test_gi.py | 59 - +++++++++++++++++++++++++------------------------------- - 1 file changed, 26 insertions(+), 33 deletions(-) - -commit 8cfd596c7849bf78a74fee04630fbbb104f02080 -Author: Martin Pitt -Date: Mon Mar 4 15:16:25 2013 +0100 - - Fix memory leaks in property setting/getting - - Do not leak GValues and string arrays, free them properly. As we - always free - the intermediate GValues, use g_value_dup_boxed() instead of - g_value_get_boxed() when appropriate. - - Detected by test_gi.TestPropertiesObject.test_strv test case. - - gi/pygi-property.c | 21 ++++++++++++++++----- - 1 file changed, 16 insertions(+), 5 deletions(-) - -commit eec8c3a932d42e92ccaf7f97d3d90948842e263f -Author: Martin Pitt -Date: Mon Mar 4 12:43:24 2013 +0100 - - Fix memory leak in pyg_flags_get_value_nicks() - - Discovered by test_gi.TestKeywords.test_uppercase() test. - - gi/_gobject/pygflags.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit 002a834dd993b82508a4fe262269befcf1a6d341 -Author: Martin Pitt -Date: Mon Mar 4 12:10:03 2013 +0100 - - Fix memory leak in _pygi_argument_to_array() - - Free the originally allocated GArray data before setting it to - our already - existing C array. - - Discovered by test_gi.TestStructure.test_boxed_struct_return test - case. - - gi/pygi-argument.c | 1 + - 1 file changed, 1 insertion(+) - -commit d32b410a1b1fcca6d10d75fbd771ea789999da64 -Author: Martin Pitt -Date: Mon Mar 4 10:19:34 2013 +0100 - - Fix leaking inout C arrays - - g_*_info_invoke() changes the original state->in_args and state->args - C arrays - to the output values for (inout) arguments, thus losing the pointer - to the - originally allocated array. Remember that in state->args_data, - so that we can - free it in _pygi_marshal_cleanup_from_py_array(). - - Reproduced by test_gi.TestArray.test_array_fixed_inout test case. - - gi/pygi-marshal-cleanup.c | 6 ++++++ - gi/pygi-marshal-from-py.c | 4 ++++ - 2 files changed, 10 insertions(+) - -commit e4098cbc28ff9324fa851bca2e423da4e51b5091 -Author: Martin Pitt -Date: Fri Mar 1 15:12:31 2013 +0100 - - Fix leak in _PyGI_ERROR_PREFIX() - - Properly clean up our allocated py_error_prefix string. - - Fixes memory leak in e. g. test_gi.TestArray.test_array_fixed_int_in. - - gi/pygi-private.h | 1 + - 1 file changed, 1 insertion(+) - -commit b388c3e87ce86d26560337c88eb33d0a95647db8 -Author: Martin Pitt -Date: Fri Mar 1 15:01:06 2013 +0100 - - Fix leaking of boxed array elements - - Commit 631d8ef879a copies struct array elements, but this needlessly - duplicates - and leaks the array element for boxed types. So only do it for - plain structs. - - This fixes the memory leak with - test_gi.TestGValue.test_gvalue_flat_array_out. - - https://bugzilla.gnome.org/show_bug.cgi?id=693402 - - gi/pygi-marshal-to-py.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 1dc2bc9f65669417ae1964d70b85f115928b2963 -Author: Martin Pitt -Date: Fri Mar 1 14:04:34 2013 +0100 - - Drop gi.overrides.overridefunc() - - This just adds an unnecessary extra function call and is not really - needed. - Drop it from the only remaining function which uses this - (Gtk.main_quit) and - drop overridefunc(). - - https://bugzilla.gnome.org/show_bug.cgi?id=686835 - - gi/overrides/Gtk.py | 7 +++---- - gi/overrides/__init__.py | 24 ++---------------------- - 2 files changed, 5 insertions(+), 26 deletions(-) - -commit 1edc4ba31b3f9375ec3920aab5b71eb066ee3739 -Author: Martin Pitt -Date: Fri Mar 1 14:02:02 2013 +0100 - - Add some tests for overridden Gdk/Gtk functions - - Add tests for Gtk.main_quit, Gtk.stock_parse(), and Gdk.color_parse(), - as we - have overrides for them. - - tests/test_overrides_gdk.py | 7 +++++++ - tests/test_overrides_gtk.py | 15 +++++++++++++++ - 2 files changed, 22 insertions(+) - -commit 6f6c0ceff00fea83bc85756b10694f7c96039abc -Author: Martin Pitt -Date: Fri Mar 1 11:10:01 2013 +0100 - - Fix GLib.Source ref leak upon destruction - - In GLib.Source.__del__(), manually unref the source if we are a - custom Source. - As we use a static binding to create it, the GI part won't unref it - for us, - leading to finalize() method not being called and the GSource - object leaking. - - https://bugzilla.gnome.org/show_bug.cgi?id=510511 - - gi/overrides/GLib.py | 4 ++++ - tests/test_source.py | 31 +++++++++++++++++++++++++++++++ - 2 files changed, 35 insertions(+) - -commit 91f76dd94fb0afc6888a821a31c3a4e2e053360e -Author: Martin Pitt -Date: Thu Feb 28 15:08:56 2013 +0100 - - Add performance test for Gtk.ListStore.append - - We are going to optimize this in various ways, so let's measure it. - - tests/test_overrides_gtk.py | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -commit b1ff74b085bdca72c272f019be4dd387073a991a -Author: Simon Feltman -Date: Thu Feb 28 04:32:30 2013 -0800 - - Optimize GValue.get/set_value by setting GValue.g_type to a local - - This increases performance by a factor of 2x for types later - in the dispatch. - - https://bugzilla.gnome.org/show_bug.cgi?id=694857 - - gi/overrides/GObject.py | 98 - +++++++++++++++++++++++++------------------------ - 1 file changed, 51 insertions(+), 47 deletions(-) - -commit 105e6738ee249b64904da26ae45dd273ca4eeba8 -Author: Martin Pitt -Date: Thu Feb 28 11:43:47 2013 +0100 - - Fix leak of caller-allocated boxed values - - Add a new "allocated_slice" argument to _pygi_boxed_new() which - specifies - whether its "boxed" pointer was allocated using a slice (by giving - its size) or - malloc (by specifying 0), as _pygi_boxed_new cannot determine that - itself any - more. - - Use this in _pygi_marshal_to_py_interface_struct() for - caller-allocated boxed - values, as _caller_alloc() uses _pygi_boxed_alloc() for those - (i. e. slices), - which would otherwise leak. - - Thanks to Mike Gorse for the original patch! - - https://bugzilla.gnome.org/show_bug.cgi?id=691501 - - gi/gimodule.c | 2 +- - gi/pygi-argument.c | 2 +- - gi/pygi-boxed.c | 14 ++++++++++---- - gi/pygi-boxed.h | 3 ++- - gi/pygi-marshal-to-py.c | 6 ++++-- - gi/pygi-source.c | 3 ++- - 6 files changed, 20 insertions(+), 10 deletions(-) - -commit 64bcca2d39fed1734ad1abbe291406387e901f5c -Author: Martin Pitt -Date: Thu Feb 28 10:48:18 2013 +0100 - - Fix memory handling of caller-allocated boxed types - - _pygi_marshal_to_py_interface_struct() and other places treat - subtypes of - G_TYPE_BOXED as boxed values and wrap them with _pygi_boxed_new(). Fix - _caller_alloc() and _cleanup_caller_allocates() to consider - G_TYPE_BOXED - subtypes as well and use the slice allocator instead of malloc()'ing - a struct. - This avoids trying to free an malloc'ed struct with g_slice_free() - and properly - cleans up the boxed values. - - The leak was produced with: - - G_SLICE=debug-blocks PYTHONPATH=. valgrind --tool=memcheck - --leak-check=full --show-possibly-lost=no \ - python3 -c 'from gi.repository import Gtk; b=Gtk.TextBuffer(); - (s,e) = b.get_bounds()' - - gi/pygi-invoke.c | 2 +- - gi/pygi-marshal-cleanup.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit 4f5e8b7554b6388aa2d0eb4a3b285d99499163be -Author: Martin Pitt -Date: Wed Feb 27 23:21:34 2013 +0100 - - Fix cleanup of GValue arrays - - Commit bc1fd8 introduced a thinko: We must not change - item_arg_cache->from_py_cleanup, as it's a global cache. Revert - the original - change, and instead put the hack into - _pygi_marshal_cleanup_from_py_array(), - which now short-circuits - _pygi_marshal_cleanup_from_py_interface_struct_gvalue() to avoid - trying to release a slice which has never been allocated in - _pygi_marshal_from_py_array(). - - https://bugzilla.gnome.org/show_bug.cgi?id=672224 - - gi/pygi-marshal-cleanup.c | 11 ++++++++++- - gi/pygi-marshal-from-py.c | 10 +++------- - 2 files changed, 13 insertions(+), 8 deletions(-) - -commit 70118c3840b10e1585d066a4be485c097cd23e99 -Author: Martin Pitt -Date: Wed Feb 27 21:52:43 2013 +0100 - - Revert "Mark caller-allocated boxed structures as having a slice - allocated" - - This is wrong after all, as it sets slice_allocated to TRUE, but - doesn't set a - corresponding size. Also, poking in internal fields from that place - is ugly; - this should rather be fixed in gi/pygi-marshal-cleanup.c - _cleanup_caller_allocates(). - - This reverts commit dc3d21173b75232f7ea0b9913f7309486456a69d. - - gi/pygi-marshal-to-py.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -commit a51c72c771dafc0c13d7990f1ff3e428dca729a1 -Author: Martin Pitt -Date: Wed Feb 27 21:51:30 2013 +0100 - - Run tests with G_SLICE=debug_blocks - - This will help finding regressions in slice management, like in - https://bugzilla.gnome.org/show_bug.cgi?id=691501 - - tests/Makefile.am | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 4f6ebcfe0605a7a593dc3f9dd322a4da9bd091a3 -Author: Martin Pitt -Date: Wed Feb 27 18:30:23 2013 +0100 - - Add override helper for stripping boolean returns - - Introduce a gi.overrides.strip_boolean_result() helper which checks - a boolean - return value and if True, return the remaining arguments, otherwise - return a - default. This pattern is being used by a lot of overrides, which get - significantly smaller and more consistent that way. - - https://bugzilla.gnome.org/show_bug.cgi?id=694431 - - gi/overrides/Gdk.py | 27 +------- - gi/overrides/Gtk.py | 156 - +++++++++-------------------------------------- - gi/overrides/__init__.py | 22 +++++++ - 3 files changed, 53 insertions(+), 152 deletions(-) - -commit 08c97b0bd3140921f1b5c74f7764e23d3a9bf0ee -Author: Martin Pitt -Date: Wed Feb 27 15:39:23 2013 +0100 - - Drop obsolete pygobject_register_sinkfunc() declaration - - There is no definition for this any more, nor is it being used - anywhere. - - https://bugzilla.gnome.org/show_bug.cgi?id=639849 - - gi/_gobject/pygobject-private.h | 2 -- - 1 file changed, 2 deletions(-) - -commit b6fefd625b843d4fc3dabc456584a2ad27a48c8c -Author: Martin Pitt -Date: Wed Feb 27 13:41:55 2013 +0100 - - Fix marshalling of C arrays with explicit length in signal arguments - - We need _pygi_argument_to_array() from both closure marshalling - (where we have - the arguments as GIArgument array) and signal closure marshalling - (where we - have the arguments in a GValue array). Add an alternative - "args_values" - parameter to _pygi_argument_to_array() so that callers can specify - one or the - other depending on which type they have available. - - This allows us to pass on the full argument list for signal closures, - so that - _pygi_argument_to_array() can access the explicit length argument - for an - array. - - This fixes the GSettings:change-event signal. - - https://bugzilla.gnome.org/show_bug.cgi?id=662241 - - gi/pygi-argument.c | 36 ++++++++++++++++++++++++++++-------- - gi/pygi-argument.h | 1 + - gi/pygi-closure.c | 2 +- - gi/pygi-info.c | 4 ++-- - gi/pygi-signal-closure.c | 3 ++- - tests/test_gio.py | 18 ++++++++++++++++++ - 6 files changed, 52 insertions(+), 12 deletions(-) - -commit caeeeb7e4282e183eefc3c53b2d53c8c2bb7de89 -Author: Martin Pitt -Date: Wed Feb 27 08:07:20 2013 +0100 - - Fix signedness, overflow checking, and 32 bit overflow of GFlags - - GFlagsValue.value is a guint, so we must access it as unsigned - type. Define two - new macros PYGLIB_PyLong_FromUnsignedLong() and - PYGLIB_PyLong_AsUnsignedLong() - for that purpose, and consistently use them for handling flag - values. Use the - checked variant of these functions which produce OverflowErrors - instead - of the unchecked PYGLIB_PyLong_AS_LONG(). - - Insert zero padding after the PyLongObject in PyGFlags and - PyGEnum. Without - this, the directly adjacent GType field seems to confuse - PyLong_FromUnsignedLong() and includes the GType into the numeric - value. - - https://bugzilla.gnome.org/show_bug.cgi?id=693121 - - gi/_glib/pyglib-python-compat.h | 8 +++++++ - gi/_gobject/gobjectmodule.c | 2 +- - gi/_gobject/pygflags.c | 52 - +++++++++++++++++++++++++---------------- - gi/_gobject/pygobject-private.h | 10 ++++---- - gi/_gobject/pygobject.h | 4 ++-- - gi/_gobject/pygtype.c | 6 ++--- - tests/test_overrides_gdk.py | 15 ++++++++++++ - 7 files changed, 67 insertions(+), 30 deletions(-) - -commit b3a3da37e369f3f5d434c8dc9f3c7f1e74d537ac -Author: Chun-wei Fan -Date: Tue Feb 26 16:15:36 2013 +0800 - - gi/pygi-marshal-from-py.c: Fix build on Visual C++ - - Since Visual C++ does not provide the INFINITY and NAN constants - in its - math.h (they are items defined by C99), provide fallback - implementations - for it here. The INFINITY constant can be provided with HUGE_VAL, - since - we are using INFINITY to check the value of a variable of double - type, and - we could use a rather simple workaround for NAN. - - Also avoid declaring variables in the middle of the block. - - https://bugzilla.gnome.org/show_bug.cgi?id=692856 - - gi/pygi-marshal-from-py.c | 19 ++++++++++++++++++- - 1 file changed, 18 insertions(+), 1 deletion(-) - -commit 5210e3d5bb7936a21b6a2c938ede505bf1d848c9 -Author: Martin Pitt -Date: Tue Feb 26 16:42:19 2013 +0100 - - Fix some style issues with previous patch - - gi/pygi-cache.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 999679beaa9f5b36d9483abdbd30cd5e113b6bf6 -Author: Martin Pitt -Date: Tue Feb 26 10:15:22 2013 +0100 - - Raise DeprecationWarning on deprecated callables - - Check if a callable is marked as deprecated and raise a - DeprecationWarning in - that case. - - Notes: - - Python hides DeprecationWarning by default, you need to enable - them with -Wd - - The deprecation message is currently not in the typelib (bug - #694728) - - https://bugzilla.gnome.org/show_bug.cgi?id=665084 - - gi/pygi-cache.c | 14 ++++++++++++++ - tests/test_gi.py | 10 ++++++++++ - 2 files changed, 24 insertions(+) - -commit 9f8258cfdcf562aa6cf37b9e66075b7f6a6ed97a -Author: Simon Feltman -Date: Mon Feb 18 00:39:45 2013 -0800 - - pygtkcompat: Add Widget.window, scroll_to_mark, and window methods - - Fix gi.pygtkcompat attempting relative import in Python < 3.0. - Add Gtk.Widget.window property which uses get_window() - Add Gtk.TextView.scroll_to_mark with defaults - Add Gtk.window_list_toplevels and Gtk.window_set_default_icon_name - - https://bugzilla.gnome.org/show_bug.cgi?id=694067 - - gi/pygtkcompat.py | 2 ++ - pygtkcompat/pygtkcompat.py | 14 ++++++++++++++ - 2 files changed, 16 insertions(+) - -commit e8e2bbee7bb79039bbd9a968f7db88438bd937f9 -Author: Simon Feltman -Date: Sun Dec 16 02:56:06 2012 -0800 - - pygtkcompat: Add Gtk.Window.set_geometry_hints which accepts keyword - arguments - - Monkey patch a keyword argument version of set_geometry_hints onto - Gtk.Window. - This version is compatible with pygtk and takes keywords instead of a - Gdk.Geometry and Gdk.GeometryMask. - - https://bugzilla.gnome.org/show_bug.cgi?id=694067 - - pygtkcompat/pygtkcompat.py | 44 - ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - -commit 1ca0e142709843cdae9ca965dfa6cc292ef53ab5 -Author: Martin Pitt -Date: Tue Feb 26 10:09:47 2013 +0100 - - tests: Fix warning behaviour - - -Werror::* does not seem to do what it says on the tin, these - options are - ignored entirely apparently. Just keep -Wd to actually show all - warnings - including DeprecationWarning, which is hidden by default. - - tests/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e7ea6952c7a2d8da68ed8b66770d889cd756df9a -Author: Martin Pitt -Date: Tue Feb 26 08:49:10 2013 +0100 - - Ship pygobject.doap for autogen.sh - - https://bugzilla.gnome.org/show_bug.cgi?id=694591 - - Makefile.am | 1 + - 1 file changed, 1 insertion(+) - -commit 80ed803dab3ad914d7214a475e3c6ed743dfdccc -Author: Simon Feltman -Date: Tue Feb 19 03:07:19 2013 -0800 - - Fix crashes in various GObject signal handler functions - - Fix crashes in a large amount of signal handler functions exposed - on the GObject module. This is possible now that the underlying - GObject pointer is exposed to Python as a PyCapsule which marshaling - can handle. The following functions in the GObject module have been - verified: - - signal_handler_unblock - signal_handler_disconnect - signal_handler_is_connected - signal_stop_emission - signal_stop_emission_by_name - signal_has_handler_pending - signal_connect_closure - signal_connect_closure_by_id - signal_handler_find - signal_handlers_destroy - - https://bugzilla.gnome.org/show_bug.cgi?id=633927 - - gi/_gobject/gobjectmodule.c | 57 ++-------------- - gi/overrides/GObject.py | 158 - ++++++++++++++++++++++++++++++++++---------- - tests/test_signal.py | 121 ++++++++++++++++++++++++++++++++- - 3 files changed, 247 insertions(+), 89 deletions(-) - -commit e9c578c1d47375cb2249ccdd86873faad04b89e1 -Author: Olivier Crête -Date: Fri Sep 14 21:29:53 2012 -0400 - - pygi-closure: Protect the GSList prepend with the GIL - - Signed-off-by: Simon Feltman - - https://bugzilla.gnome.org/show_bug.cgi?id=684060 - - gi/pygi-closure.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 6e0a32f6d9febbd782dc56a619974f009e79abd9 -Author: Simon Feltman -Date: Wed Feb 20 01:21:32 2013 -0800 - - generictreemodel: Fix bad default return type for get_column_type - - pygtkcompat/generictreemodel.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 8ec5c335e223bdf00c7bb6c9aac3e7ac7791e38e -Author: Martin Pitt -Date: Tue Feb 19 12:23:13 2013 +0100 - - configure.ac: post-release bump to 3.7.91 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f2fb7f6142cd7112db9c2526d7f1c642a50cfc2a -Author: Martin Pitt -Date: Tue Feb 19 12:19:35 2013 +0100 - - Release 3.7.90 - - NEWS | 17 +++++++++++++++++ - configure.ac | 2 +- - 2 files changed, 18 insertions(+), 1 deletion(-) - -commit 840c871441cb215f24cc6e7ed26b9f38e5aad0df -Author: Simon Feltman -Date: Mon Feb 18 01:46:22 2013 -0800 - - overrides: Fix inconsistencies with drag and drop target list API - - Add support to Gtk.Widget.drag_dest_set_target_list and - Gtk.Widget.drag_source_set_target_list to accept iterables containing - mixed TargetEntry or a tuple of (target, flags, info). - Add support to Gtk.TreeView.enable_model_drag_source and - Gtk.TreeView.enable_model_drag_dest to accept a list of - Gtk.TargetEntry - items. - - https://bugzilla.gnome.org/show_bug.cgi?id=680640 - - gi/overrides/Gtk.py | 40 +++++++++++++++++++++++++++++----------- - tests/test_overrides_gtk.py | 32 ++++++++++++++++++++++++++++++++ - 2 files changed, 61 insertions(+), 11 deletions(-) - -commit 62e94b0f87845bb7a1cfddf70dcdc89ff7a80bf7 -Author: Simon Feltman -Date: Mon Feb 18 03:19:34 2013 -0800 - - tests: Add test_marshaling_object to Makefile.am - - tests/Makefile.am | 1 + - 1 file changed, 1 insertion(+) - -commit a10fb7216de57046d1ecacb73dd032eaadcbad09 -Author: Simon Feltman -Date: Wed Aug 29 03:46:23 2012 -0700 - - pygtkcompat: Add pygtk compatible GenericTreeModel implementation - - Add Python implementation of the GenericTreeModel that was - available in pygtk. The implementation attempts a better job - than the original at ref counting by guaranteeing no leaks - upon deletion of the model itself. Or by using the extra "node" - argument to the row_deleted signal. The model is available in - the pygtkcompat package directly as - pygtkcompat.generictreemodel.GenericTreeModel or with as - gtk.GenericTreeModel when pygtkcompat.enable_gtk() is set. - - Add file list and tree demos making use of GenericTreeModel - to gtk-demo. - - Auto-expand gtk-demo app tree to give a better overview of - the demos available. - - https://bugzilla.gnome.org/show_bug.cgi?id=682933 - - .../gtk-demo/demos/Tree View/treemodel_filelist.py | 234 ++++++++++++ - .../gtk-demo/demos/Tree View/treemodel_filetree.py | 279 ++++++++++++++ - demos/gtk-demo/gtk-demo.py | 2 +- - gi/pygtkcompat.py | 2 +- - pygtkcompat/Makefile.am | 1 + - pygtkcompat/generictreemodel.py | 420 - +++++++++++++++++++++ - pygtkcompat/pygtkcompat.py | 3 + - tests/Makefile.am | 1 + - tests/test_generictreemodel.py | 406 - ++++++++++++++++++++ - 9 files changed, 1346 insertions(+), 2 deletions(-) - -commit 871878c7a1e18fbdbf0744e0dd52cbcc6b610cdb -Author: Simon Feltman -Date: Mon Feb 18 02:54:14 2013 -0800 - - overrides: Add support for iterables besides tuples for TreePath - creation - - Allow Gtk.TreePath to accept any iterable for creation of the path. - - https://bugzilla.gnome.org/show_bug.cgi?id=682933 - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 93c1536b45f56c20b6d874c41c4cacd2b6cdca0a -Author: Simon Feltman -Date: Fri Feb 15 22:56:29 2013 -0800 - - Unify Python callable to GClosure GI marshaling code - - Add pygi_marshal_from_py_gclosure which can be used for direct - gi method - call args and vfunc out args. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 14 +----------- - gi/pygi-marshal-from-py.c | 55 - ++++++++++++++++++++++++++++------------------- - gi/pygi-marshal-from-py.h | 3 +++ - 3 files changed, 37 insertions(+), 35 deletions(-) - -commit 9e47afe459df942d9ffc4f71b39f1443976293df -Author: Simon Feltman -Date: Fri Feb 15 20:56:12 2013 -0800 - - Unify Python object to GValue GI marshaling code - - Add pygi_marshal_from_py_g_value which can be used for direct - gi method - call args and vfunc out args. The new method also adds an - "is_allocated" - parameter that will be used to fix leaks in the future. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 43 +++++++-------------------- - gi/pygi-marshal-from-py.c | 74 - ++++++++++++++++++++++++++++++++--------------- - gi/pygi-marshal-from-py.h | 5 ++++ - 3 files changed, 65 insertions(+), 57 deletions(-) - -commit 15cd7be5ad80e2411d6c13b04f5e2c33e4f5605e -Author: Simon Feltman -Date: Fri Feb 15 23:07:57 2013 -0800 - - Rename pygi_marshal_from_py_object to make it more explicit - - Rename pygi_marshal_from_py_object to pygi_marshal_from_py_gobject - to make it more explicit and give consistency with future refactoring. - - https://bugzilla.gnome.org/show_bug.cgi?id=693405 - - gi/pygi-argument.c | 2 +- - gi/pygi-marshal-from-py.c | 22 +++++++++++++--------- - gi/pygi-marshal-from-py.h | 6 +++--- - 3 files changed, 17 insertions(+), 13 deletions(-) - -commit 84103dfabd05742d1a18729663a609e9bf7c45f8 -Author: Niklas Koep -Date: Fri Feb 15 21:23:01 2013 -0800 - - Prefix __module__ attribute of function objects with gi.repository - - This allows gi module methods to work with pydoc and help(). - Additionally correct typo in two docstrings of the same module. - - Co-authored-by: Simon Feltman - - https://bugzilla.gnome.org/show_bug.cgi?id=693839 - - gi/overrides/__init__.py | 3 ++- - gi/types.py | 6 +++--- - 2 files changed, 5 insertions(+), 4 deletions(-) - -commit f6d4d2da676ae63d7a24dd172775b488ce665fe4 -Author: Jonathan Ballet -Date: Thu Feb 14 07:50:02 2013 +0100 - - configure.ac: only enable code coverage when available - - When building with an older gnome-common which does not yet provide - code - coverage support, disable it instead of breaking the configure script. - - https://bugzilla.gnome.org/show_bug.cgi?id=693328 - - configure.ac | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -commit 42cbff60e2032f715d9be6ab280954211899e03c -Author: Jonathan Ballet -Date: Tue Feb 12 23:03:00 2013 +0100 - - Correctly set properties on object with statically defined properties - - Fix failures in GObject.Object.set_properties() when used with - statically defined properties: - - * Calling the method was raising a "SystemError: error return without - exception set" since `result` was (most of the time) still NULL at the - end of pygobject_set_properties() - - * Calling the method with several properties would only set one of - the properties, since the function was exiting too early. - - Signed-off-by: Simon Feltman - - https://bugzilla.gnome.org/show_bug.cgi?id=693618 - - gi/_gobject/pygobject.c | 19 +++++++++++-------- - tests/test_gi.py | 6 ++++++ - 2 files changed, 17 insertions(+), 8 deletions(-) - -commit 2384769810a61d6ed08d8742b7ae976ebfaa8cb5 -Author: Martin Pitt -Date: Mon Feb 11 18:08:37 2013 +0100 - - autogen.sh: Use gnome-autogen.sh - - We depend on gnome-common now anyway, so use gnome-autogen.sh. This - will result - in a much better error message when gnome-common is not installed, - too. - - https://bugzilla.gnome.org/show_bug.cgi?id=693328 - - autogen.sh | 30 +++++++++++++++++------------- - 1 file changed, 17 insertions(+), 13 deletions(-) - -commit c107bb1f9275a748b494d3f32818f227e07cadf0 -Author: Christoph Reiter -Date: Mon Feb 11 10:07:47 2013 +0100 - - GTK tests: Add and use context manager for realized widgets - - https://bugzilla.gnome.org/show_bug.cgi?id=693377 - - tests/test_overrides_gtk.py | 91 - +++++++++++++++++++++++++-------------------- - 1 file changed, 50 insertions(+), 41 deletions(-) - -commit e6670ee26b7682e6213f71deef813ce2e7cd6730 -Author: Martin Pitt -Date: Mon Feb 11 08:55:19 2013 +0100 - - _pygi_marshal_from_py_array: Fix uninitialized variable - - gi/pygi-marshal-from-py.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit a37bfdcb3d9dcc8bcdd8126ad55d80fab4729c62 -Author: Christoph Reiter -Date: Mon Feb 11 08:34:42 2013 +0100 - - Skip some vfunc tests with gi 1.34 - - https://bugzilla.gnome.org/show_bug.cgi?id=693374 - - tests/test_object_marshaling.py | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -commit aff2ea1b681c3019f7dbdc841c2e33de78dbb88f -Author: Simon Feltman -Date: Sun Feb 10 13:40:45 2013 -0800 - - Remove workaround for g_struct_info_get_size reporting incorrect size - - Remove workaround for g_struct_info_get_size reporting incorrect size - for boxed GValues. Verified this now returns the correct size of 24. - - https://bugzilla.gnome.org/show_bug.cgi?id=622711 - - gi/pygi-boxed.c | 31 +++++++++++++------------------ - 1 file changed, 13 insertions(+), 18 deletions(-) - -commit 5efe2e5c8458d9f4d72329ea1209d96b5ebecfb4 -Author: Simon Feltman -Date: Mon Feb 4 20:50:10 2013 -0800 - - Fix reference leaks with transient floating objects - - Unify and refactor caller and callee GObject argument marshalers. - Combine code from the large switch statement used to marshal - arguments to and from vfuncs/closures with the marshalers used - for direct calls to gi functions. This fixes a reference leak - when marshalling GObjects to Python with transfer=full due to - the diverging code paths. - Replace ability in gobject_new_full to optionally sink objects - with ability to optionaly "steal" objects. This fits the premise - that binding layers should always sink objects initially. The - steal argument is then used for marshalling arguments which are - transfer=full. - Add hacks and comments to work around GTK+ bugs 693393 and 693400. - - https://bugzilla.gnome.org/show_bug.cgi?id=687522 - - gi/_gobject/gobjectmodule.c | 10 +++++-- - gi/_gobject/pygobject-private.h | 2 +- - gi/_gobject/pygobject.c | 45 ++++++++++++++++++++---------- - gi/_gobject/pygobject.h | 8 ++++-- - gi/pygi-argument.c | 52 +++++++++++++++++------------------ - gi/pygi-marshal-from-py.c | 61 - +++++++++++++++++++++++++++++++++++++---- - gi/pygi-marshal-from-py.h | 6 ++++ - gi/pygi-marshal-to-py.c | 45 +++++++++++++++--------------- - gi/pygi-marshal-to-py.h | 5 ++++ - tests/test_object_marshaling.py | 44 ++++++++++++++--------------- - 10 files changed, 181 insertions(+), 97 deletions(-) - -commit bd54b8ab30fc957849e7f57e9ee4c4b41aa37013 -Author: Simon Feltman -Date: Wed Feb 6 12:56:44 2013 -0800 - - tests: Fix spelling mistakes in new vfunc object marshalling tests - - tests/test_object_marshaling.py | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -commit cd96fd8b8e10add9890f36ec237bb78548de7002 -Author: Martin Pitt -Date: Tue Feb 5 07:53:38 2013 +0100 - - configure.ac: post-release bump to 3.7.6 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 92b1404e61f46348168f32720eff4a482531e5e3 -Author: Martin Pitt -Date: Tue Feb 5 07:46:46 2013 +0100 - - release 3.7.5.1 - - NEWS | 3 +++ - configure.ac | 2 +- - 2 files changed, 4 insertions(+), 1 deletion(-) - -commit a3a30559240077194f23c4651d6f382fa59b7d63 -Author: Simon Feltman -Date: Mon Feb 4 15:16:37 2013 -0800 - - Fix API break with pygobject.h - - Move pygobject_new_full after everything in the public API table. - This fixes a break that went in along with bug 675726. - - https://bugzilla.gnome.org/show_bug.cgi?id=675726 - - gi/_gobject/gobjectmodule.c | 5 +++-- - gi/_gobject/pygobject.h | 2 +- - 2 files changed, 4 insertions(+), 3 deletions(-) - -commit b3ca7e27494c35620995840d777037a097082661 -Author: Martin Pitt -Date: Mon Feb 4 19:53:26 2013 +0100 - - configure.ac: post-release bump to 3.7.6 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 77f638411314218748f349b337a36e2864eed1f4 -Author: Martin Pitt -Date: Mon Feb 4 19:37:14 2013 +0100 - - release 3.7.5 - - NEWS | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -commit 50da4fca1435f8c27072e15875227c5e7fb9b7e4 -Author: Simon Feltman -Date: Sun Feb 3 23:56:14 2013 -0800 - - Fix pointer cast warning that was missed in bug 675726 - - https://bugzilla.gnome.org/show_bug.cgi?id=675726 - - gi/_gobject/pygobject.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b31d8a952cd57dc92b06a381e054199660a2d570 -Author: Simon Feltman -Date: Thu Jan 31 02:35:36 2013 -0800 - - Move various signal methods from static bindings to gi and python - - Move disconnect, handler_is_connected, handler_block, handler_unblock, - and stop_emission from static to gi python overrides. - - https://bugzilla.gnome.org/show_bug.cgi?id=692918 - - gi/_gobject/pygobject.c | 90 - ------------------------------------------------- - gi/overrides/GObject.py | 44 +++++++++++++++++------- - tests/test_signal.py | 19 ++++++----- - 3 files changed, 42 insertions(+), 111 deletions(-) - -commit 3a6a4a7a21a0f5e851518b7912d8ff455aa3ede4 -Author: Paolo Borelli -Date: Fri Feb 1 21:09:26 2013 +0100 - - GLib overrides: Support unpacking 'maybe' variants - - Automatically unpack 'maybe' variants to None or to their actual value - as we do for other kind of variants - - https://bugzilla.gnome.org/show_bug.cgi?id=693032 - - gi/overrides/GLib.py | 5 +++++ - tests/test_overrides_glib.py | 8 ++++++++ - 2 files changed, 13 insertions(+) - -commit 9bc3e6807f6c14fb0e132a90ff8f9984229896f6 -Author: Mike Gorse -Date: Mon Jan 21 16:45:52 2013 -0600 - - Fix ref count leak when creating pygobject wrappers for input args - - Only sink input references for closures and vfuncs when transfer is - everything. This fixes cases where incoming floating references for - callbacks need to maintain their floating state throughout the - callback so they don't leak a strong reference. Re-introduce a - working "sink" argument to pygobject_new_full which allows for this. - Change existing callers to always sink in order maintain behavior. - - Co-Authored-By: Simon Feltman - - https://bugzilla.gnome.org/show_bug.cgi?id=675726 - - gi/_gobject/gobjectmodule.c | 5 +-- - gi/_gobject/pygobject.c | 7 ++-- - gi/_gobject/pygobject.h | 2 ++ - gi/pygi-argument.c | 13 +++---- - tests/test_object_marshaling.py | 76 - +++++++++++++++++++++++++++++++++++++---- - 5 files changed, 85 insertions(+), 18 deletions(-) - -commit a53a9176a3f87cfb26f3ad98ea746ada0f1a39fa -Author: Simon Feltman -Date: Thu Jan 31 01:50:44 2013 -0800 - - Add tests for signal stop_emission, disconnect, and - handler_is_connected - - Add tests for methods which will be moving from static bindings to gi - by using the new __gpointer__ attribute of GObject. - - https://bugzilla.gnome.org/show_bug.cgi?id=692918 - - tests/test_signal.py | 51 - ++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 50 insertions(+), 1 deletion(-) - -commit df18f9cc3828d1bcf6b6cdf26af786fd9f36d77e -Author: Simon Feltman -Date: Wed Jan 30 21:37:07 2013 -0800 - - Add __gpointer__ property to GObject static binding - - Add access to the underlying C GObject pointer by wrapping it in a - PyCapsule/PyCPointer and exposing it as __gpointer__. - Add special case marshaling for gi parameters annotated as gpointer - to accept a PyCapsule and extract the underlying pointer as the arg. - This allows usage of methods like GObject.signal_handler_disconnect - which we can start replacing the static bindings with. - - https://bugzilla.gnome.org/show_bug.cgi?id=692918 - - gi/_gobject/pygobject.c | 11 +++++++++-- - gi/pygi-marshal-from-py.c | 6 +++++- - 2 files changed, 14 insertions(+), 3 deletions(-) - -commit 571e0cb246baa4ef7db179b20da6b325f358fe5b -Author: Simon Feltman -Date: Sun Jan 27 01:22:37 2013 -0800 - - Prefix names of typeless enums and flags for GType registration - - Prefix names given to g_flags_register_static and - g_enum_register_static - with "Py". This avoids conflicts with GTypes of the same name being - registered later by a library which does not provide a "get-type" - annotation. - - https://bugzilla.gnome.org/show_bug.cgi?id=692515 - - gi/gimodule.c | 10 ++++++++-- - tests/test_gi.py | 4 ++-- - 2 files changed, 10 insertions(+), 4 deletions(-) - -commit 97f48f5dcabc8dad4480727a78416b1c2a220777 -Author: Simon Feltman -Date: Wed Jan 30 04:35:32 2013 -0800 - - Add tests for vfunc object arguments and returns - - Add tests which use different combinations of floating, transfer full, - transfer none, and held wrapper as in, out, or return arguments - to vfuncs. - Most of these are marked as skip or expectedFailure due to various - bugs - noted on the tests. - - https://bugzilla.gnome.org/show_bug.cgi?id=687522 - - gi/overrides/GObject.py | 15 +- - tests/test_object_marshaling.py | 540 - ++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 550 insertions(+), 5 deletions(-) - -commit 73a83186329ede7702501d5bc49df269482461e4 -Author: Paolo Borelli -Date: Wed Jan 30 17:48:12 2013 +0100 - - Cosmetic fix to last patch - - gi/pygi-argument.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit 9e0c41509d62e8df7d0d82608a8be75f3defe05c -Author: Chun-wei Fan -Date: Fri Jan 25 13:05:18 2013 +0800 - - gi/pygi-info.c, gi/pygi-repository.c: Deal with C99isms - - Drop the array forward static declarations. They are not necessary - and are not - valid in C89. - - Also move declarations of variables to the top of their respective - blocks. - - https://bugzilla.gnome.org/show_bug.cgi?id=692856 - - gi/pygi-info.c | 18 ++++++++++-------- - gi/pygi-repository.c | 2 -- - 2 files changed, 10 insertions(+), 10 deletions(-) - -commit 2e7c458ef6377a872043634b47737ef12eed744a -Author: Chun-wei Fan -Date: Fri Jan 25 13:00:48 2013 +0800 - - Move variable declaration to top of blocks (C99ism) - - Move variable declarations to the top of their respective blocks, - so that these - code will build under C89 compilers such as Visual C++. - - https://bugzilla.gnome.org/show_bug.cgi?id=692856 - - gi/pygi-argument.c | 10 ++++++---- - gi/pygi-closure.c | 23 +++++++++++++++-------- - gi/pygi-invoke.c | 3 ++- - gi/pygi-marshal-cleanup.c | 3 ++- - gi/pygi-property.c | 3 ++- - 5 files changed, 27 insertions(+), 15 deletions(-) - -commit 20fc5aa7514215fc7807adceb603d17f7943304a -Author: Chun-wei Fan -Date: Fri Jan 25 12:58:26 2013 +0800 - - gi/pygobject-external.h: Remove GCCism - - We can use G_GNUC_UNUSED from GLib that does the same purpose of - __attribute__ ( (unused)) when we are using a GCC that provides this. - - The GLib headers that defines that macro should have already been - included - before this header is included (due to use of gboolean). - - https://bugzilla.gnome.org/show_bug.cgi?id=692856 - - gi/pygobject-external.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 5d2f453f3fdb167a4b4a833011ae777bfd228eb9 -Author: Martin Pitt -Date: Wed Jan 30 14:59:11 2013 +0100 - - tests: Update test_double() after e65c1248 - - Commit e65c1248 introduced support for NaN and ±inf as valid - float values, - rendering the "expect ValueError on 2*double" check broken. Just - remove it. - - tests/test_everything.py | 1 - - 1 file changed, 1 deletion(-) - -commit b8bf4ec6c2478275dc9c813946a90b82ded6d9ce -Author: Martin Pitt -Date: Wed Jan 23 07:14:16 2013 +0100 - - Do not immediately initialize Gdk and Gtk on import - - Raising an exception if Gdk/Gtk cannot be imported makes it - impossible to - merely import a module for e. g. nosetests without actually running - it. - - Programs who want to provide a proper error message should check - Gtk.initialized explicitly after importing. Check initialized - status in - Window.__init__() instead to provide a reasonably early error message - for most - programs. - - https://bugzilla.gnome.org/show_bug.cgi?id=692300 - - gi/overrides/Gdk.py | 2 -- - gi/overrides/Gtk.py | 5 +++-- - 2 files changed, 3 insertions(+), 4 deletions(-) - -commit 93d5cc2986cb3d3d979694b1beb1719d2d8fed53 -Author: Chun-wei Fan -Date: Fri Jan 25 12:49:18 2013 +0800 - - gi/overrides/Glib.py: Fix running on Windows/non-Unix - - The definition of self._signal_source uses a Unix-specific GLib - API, which - does not exist or have a direct equivilant on Windows. - - Only define and use that variable when we aren't on Windows. - - gi/overrides/GLib.py | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -commit e65c124893ceaa9c97eb4c8c743fbeb756b9a6e6 -Author: Martin Pitt -Date: Wed Jan 23 14:56:02 2013 +0100 - - Accept ±inf and NaN as float and double values - - Also fix the broken error message when a float value is out of range. - PyErr_Format() does not support float macros. - - https://bugzilla.gnome.org/show_bug.cgi?id=692381 - - gi/pygi-marshal-from-py.c | 37 +++++++++++++++++++------------------ - tests/test_gobject.py | 14 ++++++++++++++ - 2 files changed, 33 insertions(+), 18 deletions(-) - -commit a52245381fab3c2aebd330cc9c5e717a93c9607d -Author: Martin Pitt -Date: Wed Jan 23 14:28:42 2013 +0100 - - Fix repr() of GLib.Variant - - When using a standard constructor like GLib.Variant.new_*(), the - object does - not have a format_string property, and previously repr() would - crash. Fall back - to get_type_string() instead. - - Also drop the unintended type annotations in repr(). - - gi/overrides/GLib.py | 6 +++++- - tests/test_overrides_glib.py | 15 ++++++++++++++- - 2 files changed, 19 insertions(+), 2 deletions(-) - -commit 2270cf15012005362dc47456213c5d9e7f6ed28a -Author: Martin Pitt -Date: Wed Jan 23 14:14:29 2013 +0100 - - Fix gtk-demo for Python 3 - - It was crashing with - - package = __import__(packagename, globals(), locals(), - [modulename], -1) - ValueError: level must be >= 0 - - Using level zero works with both Python 2 and 3. - - demos/gtk-demo/gtk-demo.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b24d07577da1e17c8e27f758fc1a23d7f2d0f668 -Author: Colin Walters -Date: Tue Jan 22 10:49:57 2013 -0500 - - build: Add autogen.sh to EXTRA_DIST - - So downstreams that patch the autotools can use it. - - Makefile.am | 1 + - 1 file changed, 1 insertion(+) - -commit ed7fb99efa81854d947ae548d41a03f5275c5884 -Author: Martin Pitt -Date: Thu Jan 17 08:23:02 2013 +0100 - - Define GObject.TYPE_VALUE gtype constant - - gi/overrides/GObject.py | 4 +++- - tests/test_gobject.py | 4 ++++ - 2 files changed, 7 insertions(+), 1 deletion(-) - -commit fd32acdd97f49f086a8ad5cf2b65862c4e6ccc44 -Author: Olivier Crête -Date: Mon Sep 17 15:37:04 2012 -0400 - - gobject: Go through introspection on property setting - - Consider introspected properties in object.set_property(). - - https://bugzilla.gnome.org/show_bug.cgi?id=684062 - - gi/_gobject/pygobject.c | 18 +++++++++++++++++- - tests/test_properties.py | 13 ++++++++++--- - 2 files changed, 27 insertions(+), 4 deletions(-) - -commit 9a2060f26c2cc2f9ef79ab6fb9f512c317004856 -Author: Mike Gorse -Date: Tue Jan 15 20:04:46 2013 -0600 - - Clean up caller-allocated GValues and their memory - - When space for a GValue is allocated by the caller (as in - gtk_tree_model_get_value), we need to free the space allocated for the - value along with its contents. The GValue is not needed after - Pyg_value_as_pyobject is called, so call _cleanup_caller_allocates and - have it unset the value and deallocate the memory. - - https://bugzilla.gnome.org/show_bug.cgi?id=691820 - - gi/pygi-marshal-cleanup.c | 20 ++++++++++++++++++-- - 1 file changed, 18 insertions(+), 2 deletions(-) - -commit 45b7975d0a3d78f01f1112ae7b3f4208f15694d8 -Author: Dmitry Shachnev -Date: Wed Jan 16 13:44:42 2013 +0400 - - tests: define correct unittest.skipIf for python 2.6 - - tests/runtests.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 4706cd686ea1b25260c9ecc77abd324d6e4cf505 -Author: Martin Pitt -Date: Wed Jan 16 09:17:13 2013 +0100 - - tests: More robust tree view realization - - With current GNOME git head, the Gtk.TreeViews were not realized - enough any - more to receive property values. Put them into a Gtk.Dialog now and - show it to - ensure that they are realized. - - tests/test_overrides_gtk.py | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) - -commit 90c6f596df2a96f9c8059ae9157bc467a80b7574 -Author: Martin Pitt -Date: Tue Jan 15 10:42:49 2013 +0100 - - Drop deprecated g_thread_create() - - Replace with g_thread_new(). This is available with glib >= 2.32, - and we - already require >= 2.34. - - tests/test-thread.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -commit 98504273dead9eade6e53c2297bcaec7bea6265a -Author: Martin Pitt -Date: Tue Jan 15 10:37:52 2013 +0100 - - Drop usage of deprecated GStaticPrivate - - Replace with GPrivate. - - gi/_gobject/gobjectmodule.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 655e2eece14f5de3baf4505f524d17484b8b5a75 -Author: Martin Pitt -Date: Tue Jan 15 10:29:47 2013 +0100 - - Don't call g_type_init() with glib >= 2.35.x - - This fixes a deprecation warning. - - gi/_gobject/gobjectmodule.c | 2 ++ - 1 file changed, 2 insertions(+) - -commit 206e736380ba798c68de09f661d75c8e27451117 -Author: Martin Pitt -Date: Tue Jan 15 09:47:11 2013 +0100 - - Use GNOME_COMPILE_WARNINGS from gnome-common - - As we are now using gnome-common anyway for the code coverage macro, - also use - GNOME_COMPILE_WARNINGS, and only manually specify the extra options - that we - want beyond that. - - This also enables -Wstrict-prototypes. - - configure.ac | 14 ++++---------- - 1 file changed, 4 insertions(+), 10 deletions(-) - -commit 137679426ff39507e15f08e9e6428d851fee06b7 -Author: Martin Pitt -Date: Tue Jan 15 09:46:01 2013 +0100 - - Fix function prototypes and static functions - - These cause errors/warnings with -Wstrict-prototypes. - - gi/_glib/pyglib-python-compat.h | 2 ++ - gi/pygi-foreign.c | 2 +- - gi/pygi-marshal-from-py.c | 4 ++-- - gi/pygi-marshal-to-py.c | 4 ++-- - gi/pygi-source.c | 2 +- - gi/pygi-source.h | 2 +- - 6 files changed, 9 insertions(+), 7 deletions(-) - -commit d47927f1701a11aec8566425f22688c5df73d7f2 -Author: Martin Pitt -Date: Mon Jan 14 17:38:23 2013 +0100 - - configure.ac: post-release bump to 3.7.5 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit bd6da84a4aec74e47f5d70e8ed18695c37e746c6 -Author: Martin Pitt -Date: Mon Jan 14 17:30:48 2013 +0100 - - release 3.7.4 - - NEWS | 38 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 38 insertions(+) - -commit c90ef9dfac7dd51ec82c99c3605915996bea0f73 -Author: Simonas Kazlauskas -Date: Tue Dec 4 15:45:00 2012 +0200 - - Allow setting values through GtkTreeModelFilter - - Previously, trying to set a value through filter throwed an exception - that the - model has no set_value() method. You had to first retrieve the - deepest child - model and set value to it. - - https://bugzilla.gnome.org/show_bug.cgi?id=689624 - - gi/overrides/Gtk.py | 5 +++++ - tests/test_overrides_gtk.py | 11 +++++++++++ - 2 files changed, 16 insertions(+) - -commit b092630efc691a6f7ae94ae896193254f5a961a6 -Author: Martin Pitt -Date: Mon Jan 14 12:37:18 2013 +0100 - - tests: Add (failing) test case for GParamSpec arguments - - This reproduces - https://bugzilla.gnome.org/show_bug.cgi?id=682355 - - tests/test_gi.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit 52d84b5da7f9fd4f65faea4e6fe3d250f937a208 -Author: Martin Pitt -Date: Mon Jan 14 12:20:27 2013 +0100 - - tests: Skip struct string member tests with g-i 1.34 - - We still support building against gobject-introspection 1.34, so - skip tests - which do not work with that version yet. - - tests/test_gi.py | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit f9429192cb1002725a11a75a7b8f9300375b9caf -Author: Martin Pitt -Date: Mon Jan 14 12:15:27 2013 +0100 - - Support GParamSpec signal arguments from Python - - In pyg_value_from_pyobject(), recognize both the real GI - GObject.ParamSpec type - as well as the statically wrapped _gobject.GParamSpec type. - - This fixes marshalling GObject.ParamSpec signal/vfunc arguments. - - https://bugzilla.gnome.org/show_bug.cgi?id=683099 - - gi/_gobject/pygtype.c | 6 +++++- - tests/test_signal.py | 12 ++++++++++++ - tests/testhelpermodule.c | 13 +++++++++++++ - 3 files changed, 30 insertions(+), 1 deletion(-) - -commit 99f72925c7de76611f7592bce9d8217a9ff46809 -Author: Martin Pitt -Date: Mon Jan 14 11:48:11 2013 +0100 - - pygobject_emit(): Fix cleanup on error - - Dot not try to unset GValues which have not been initialized yet, - when type - conversion fails for a parameter. - - gi/_gobject/pygobject.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit acef1d3266d11b2465d61185a55526df879a5c62 -Author: Simon Feltman -Date: Mon Dec 31 19:01:57 2012 -0800 - - Add signal emission methods to TreeModel which coerce the path - argument - - Override TreeModel row_changed, row_inserted, row_has_child_toggled, - row_deleted, and rows_reordered methods to accept python iterables as - the path parameter. This is for compatibility with pygtk and - consistency - with the rest of the TreeModel and TreePath overrides. - - https://bugzilla.gnome.org/show_bug.cgi?id=682933 - - gi/overrides/Gtk.py | 31 ++++++++++++++++++++++++++++--- - tests/test_overrides_gtk.py | 27 +++++++++++++++++++++++++++ - 2 files changed, 55 insertions(+), 3 deletions(-) - -commit 9cfba517e1a6dced5e66786b28ed5e101b7b4a29 -Author: Martin Pitt -Date: Mon Jan 14 10:36:36 2013 +0100 - - Simplify overrides and tests using the new GObject.Value override - - The previous commit added support for constructing a GObject.Value - with a given - GType and Python object conversion. Use this to simplify the Gtk - override and - the tests that construct GValues. - - See https://bugzilla.gnome.org/show_bug.cgi?id=677473 - - gi/overrides/Gtk.py | 88 - +++------------------------------------------ - tests/test_gi.py | 26 +++++--------- - tests/test_overrides_gtk.py | 2 +- - tests/test_signal.py | 12 ++----- - 4 files changed, 17 insertions(+), 111 deletions(-) - -commit f62b98398177991bfdbe0b6753342e79e6cf170a -Author: Bastian Winkler -Date: Mon Jan 14 10:26:08 2013 +0100 - - Add override for GValue - - Override GValue with a custom constructor and set_value()/get_value() - methods. This allows you to call - - >>> GObject.Value(GObject.TYPE_FLOAT, 42.23) - - instead of - - >>> value = GObject.Value() - >>> value.init(GObject.TYPE_FLOAT) - >>> value.set_float(42.23) - - This is especially useful for overrides that need to convert a Python - value to a expected type like G_TYPE_FLOAT. - - https://bugzilla.gnome.org/show_bug.cgi?id=677473 - - gi/overrides/GObject.py | 127 - +++++++++++++++++++++++++++++++++++++++++++++++- - tests/test_gobject.py | 47 +++++++++++++++++- - 2 files changed, 172 insertions(+), 2 deletions(-) - -commit dc3d21173b75232f7ea0b9913f7309486456a69d -Author: Mike Gorse -Date: Thu Jan 10 15:48:30 2013 -0600 - - Mark caller-allocated boxed structures as having a slice allocated - - When a C function takes a pointer and fills it with a boxed structure - (ie, - gtk_tree_store_insert_with_values), pygi should deallocate the slice - when the - box is no longer being used. - - https://bugzilla.gnome.org/show_bug.cgi?id=699501 - - gi/pygi-marshal-to-py.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit 0c496d230fee7fd3ada90ee9af10e0bc1e29ee12 -Author: Olivier Crête -Date: Fri Sep 14 21:31:32 2012 -0400 - - pygi-property: Support boxed GSList/GList types - - Note that this does not yet work for construct properties. - - Co-Authored-By: Martin Pitt - - https://bugzilla.gnome.org/show_bug.cgi?id=684059 - - gi/pygi-property.c | 10 ++++++++-- - tests/test_gi.py | 21 +++++++++++++++++++++ - 2 files changed, 29 insertions(+), 2 deletions(-) - -commit 074f10d815453e58f4bee2f440c5db799add3876 -Author: Martin Pitt -Date: Mon Jan 14 07:48:31 2013 +0100 - - test_gio: Fix for Python 2 - - Python 2 does not yet take an "encoding" argument for str(), while - Python 3 - requires it. Use a less fancy static test string instead. - - tests/test_gio.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 734979d0c8317201148a7e94a323225fba2d1635 -Author: Martin Pitt -Date: Mon Jan 14 07:40:10 2013 +0100 - - tests: Add missing backwards compat methods for Python 2.6 - - Define skipIf(), assertLess(), and assertLessEqual() for running - the tests with - Python 2.6. - - https://bugzilla.gnome.org/show_bug.cgi?id=691646 - - tests/runtests.py | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -commit dc0dafd1f6ca3ebbf04210768a45587387e44551 -Author: Martin Pitt -Date: Mon Jan 14 07:34:46 2013 +0100 - - tests: Stop using assertSequenceEqual() - - assertSequenceEqual() does not yet exist in Python 2.6, and is - not necessary - either as assertEqual() on sequences automatically does list - comparison. - - Part of https://bugzilla.gnome.org/show_bug.cgi?id=691646 - - tests/test_gtype.py | 6 ++---- - tests/test_signal.py | 6 ++---- - 2 files changed, 4 insertions(+), 8 deletions(-) - -commit 0a5587b6a56d417a6703e342f153596f08cd5889 -Author: Simon Feltman -Date: Sun Jan 13 18:19:51 2013 -0800 - - Allow setting TreeModel values to None - - Change TreeModel.set_value to use an empty but initialized GValue when - None is used as the value argument. This allows clearing of cell data - which was not accessible due to auto-coercion. - - https://bugzilla.gnome.org/show_bug.cgi?id=684094 - - gi/overrides/Gtk.py | 11 ++++++++--- - tests/test_overrides_gtk.py | 8 ++++++++ - 2 files changed, 16 insertions(+), 3 deletions(-) - -commit 5ae129da436793478750f0dc9427a174a980e10b -Author: Mike Gorse -Date: Thu Jan 10 16:42:17 2013 -0600 - - Set clean-up handler for marshalled arrays - - Arrays did not have a cleanup handler set in some cases, resulting - in a leak. - - https://bugzilla.gnome.org/show_bug.cgi?id=691509 - - gi/pygi-cache.c | 1 + - 1 file changed, 1 insertion(+) - -commit 58bd307c57d542a8f69867dea2d0a0eb51230c7b -Author: Vadim Rutkovsky -Date: Fri Jan 11 15:41:27 2013 +0100 - - Support setting string fields in structs - - Co-Authored-By: Martin Pitt - - https://bugzilla.gnome.org/show_bug.cgi?id=678401 - - gi/pygi-info.c | 3 ++- - tests/test_gi.py | 16 ++++++++++++++++ - 2 files changed, 18 insertions(+), 1 deletion(-) - -commit f2bcaa43c1158040a8c2cbc3a2ba5070d126a410 -Author: Martin Pitt -Date: Fri Jan 11 14:58:44 2013 +0100 - - Re-enable test_gi.TestPropertiesObject.test_char test - - The gobject-introspection bug got fixed: - https://bugzilla.gnome.org/show_bug.cgi?id=691524 - - tests/test_gi.py | 14 +++----------- - 1 file changed, 3 insertions(+), 11 deletions(-) - -commit 9a8c49087cf400e01c1f78241fa4d74b4d15f54e -Author: Martin Pitt -Date: Fri Jan 11 09:46:56 2013 +0100 - - tests: Re-enable test_callback_scope_call_array() check - - Drop the expected failure from test_callback_scope_call_array() - and just add - the explicit array length arguments. While it would look cleaner to - not pass - them, it is probably not worth breaking the API for this. - - tests/test_everything.py | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -commit 609636424b5f9b659e99a4bb53a48c165187c430 -Author: Martin Pitt -Date: Fri Jan 11 09:13:36 2013 +0100 - - Permit plain integers for "gchar" values - - Similar to guchar/guint8, allow plain integers (withing correct - boundaries) as - values for gchar/gint8 types. - - This is covered by the test_gi.TestPropertiesObject.test_char - test when - removing the "expected failure" flag. - - gi/_gobject/pygtype.c | 16 ++++++++++++---- - 1 file changed, 12 insertions(+), 4 deletions(-) - -commit a558d3d3a9274aeccfc54705bf5effdf71dee06b -Author: Martin Pitt -Date: Fri Jan 11 09:09:41 2013 +0100 - - Allow single byte values for int8 types - - When fixing gobject-introspection to consider "gchar" as signed (see - https://bugzilla.gnome.org/show_bug.cgi?id=691524), we must also - permit a - single-element "bytes" array as a valid value for int8, not just - for uint8. - - This is caught by the test_overrides_gtk.TestTreeModel.test_tree_store - test. - - gi/pygi-argument.c | 4 ++-- - gi/pygi-marshal-from-py.c | 34 +++++++++++++++++++++------------- - 2 files changed, 23 insertions(+), 15 deletions(-) - -commit aa7f6cd12fe403acb2cffc7890724af7abb9b990 -Author: Mike Gorse -Date: Thu Jan 10 14:11:56 2013 -0600 - - Fix invalid memory access handling errors when registering an - enum type - - Don't free the name until we are done with it. - - gi/gimodule.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit ecd235959317d39b6d598662c00829e0ec717b17 -Author: Martin Pitt -Date: Thu Jan 10 16:42:46 2013 +0100 - - Fix (out) arguments in callbacks - - Do not ignore the first argument in _pygi_closure_set_out_arguments(). - Presumably that has been done to skip over "self", but callbacks - are not - required to have a self argument. As self is never (out), we can - safely include - it in the loop. - - gi/pygi-closure.c | 2 +- - tests/test_gi.py | 4 ---- - 2 files changed, 1 insertion(+), 5 deletions(-) - -commit d8e241e24a816691acbd592775b73defd9aa4f44 -Author: Martin Pitt -Date: Thu Jan 10 15:14:05 2013 +0100 - - Fix C to Python marshalling of struct pointer arrays - - Do not treat an array of pointers to values like an array of values on - marshalling from C. This makes the test_array_boxed_struct_return() - test case - work. - - gi/pygi-marshal-to-py.c | 5 +++-- - tests/test_gi.py | 2 -- - 2 files changed, 3 insertions(+), 4 deletions(-) - -commit 60544b02f6f98c0b212625ae83b94a4c6debddeb -Author: Simonas Kazlauskas -Date: Tue Jan 8 23:22:54 2013 +0200 - - Add tests for GFile - - Most notably this commit contains a test for - Gio.File.replace_contents_async(), - which currently fails. Disable the tests for now as it breaks the - other tests. - - https://bugzilla.gnome.org/show_bug.cgi?id=690525 - - tests/test_gio.py | 64 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 64 insertions(+) - -commit 118c5eaad045580455515876ba73b9537a8468b4 -Author: Martin Pitt -Date: Thu Jan 10 13:56:11 2013 +0100 - - Rename test_overrides_gio.py to test_gio.py - - As we want to add more tests for non-overridden API. - - tests/Makefile.am | 2 +- - tests/test_gio.py | 121 - ++++++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides_gio.py | 121 - -------------------------------------------- - 3 files changed, 122 insertions(+), 122 deletions(-) - -commit 8117e6bce73581e89211371708ff7d5de7d870d4 -Author: Martin Pitt -Date: Thu Jan 10 12:13:16 2013 +0100 - - Don't let Property.setter() method names define property names - - Defining property names in install_properties() is too late when using - @propname.setter decorators; their method names don't define a - property name, - nor are they even required to be a valid property identifier. - - So change the logic to already fix the property name when using - a setter - decorator and use that instead of the member name in - install_properties(). - - https://bugzilla.gnome.org/show_bug.cgi?id=688971 - - gi/_gobject/propertyhelper.py | 29 ++++++++++++++++++++++------- - tests/test_properties.py | 18 ++++++++++++++++++ - 2 files changed, 40 insertions(+), 7 deletions(-) - -commit c0bd060521cc1b481995648dbe286b7e2f9ecd80 -Author: Martin Pitt -Date: Wed Jan 9 10:39:36 2013 +0100 - - tests: Force UTF-8 file name encoding - - The test_gi.TestFilename tests fail if the environment specifies - a non-UTF8 - file name encoding. Force it to "UTF-8" for the tests. - - https://bugzilla.gnome.org/show_bug.cgi?id=691355 - - tests/runtests.py | 1 + - 1 file changed, 1 insertion(+) - -commit c02a00ae9599a661076630b21b7e24e78fb88c29 -Author: Martin Pitt -Date: Tue Jan 8 16:56:40 2013 +0100 - - Use g-i stack allocation API - - Where possible, i. e. when not keeping references across functions, - use the - _load_() methods instead of the _get_() ones from - gobject-introspection, which - is faster and less prone to memory leaks: - - g_callable_info_get_arg () → g_callable_info_load_arg () - g_callable_info_get_return_type() → - g_callable_info_load_return_type () - g_arg_info_get_type() → g_arg_info_load_type () - - https://bugzilla.gnome.org/show_bug.cgi?id=615982 - - gi/pygi-argument.c | 16 ++++------ - gi/pygi-closure.c | 88 - ++++++++++++++++++++++++------------------------------ - 2 files changed, 45 insertions(+), 59 deletions(-) - -commit 23d1f14f553069740465c82eaa937b877c41e0cb -Author: Ray Strode -Date: Wed Dec 19 13:04:32 2012 -0500 - - pyg_value_from_pyobject: support GArray - - This commit adds support for marshalling a python list (or other - sequence) - returned from signal handlers to GArray, if necessary. - - This parallels the implementation written to marshal to (the now - deprecated) - GValueArray. - - This fixes a crash in rhythmbox as seen downstream here: - https://bugzilla.redhat.com/show_bug.cgi?id=872851 - - https://bugzilla.gnome.org/show_bug.cgi?id=690514 - - Co-Authored-By: Martin Pitt - - gi/_gobject/pygtype.c | 60 - ++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_everything.py | 22 ++++++++++++++++++ - 2 files changed, 82 insertions(+) - -commit 2089dbb117bae769b0303411c2630b6f86dc7d2d -Author: Marko Lindqvist -Date: Fri Jan 4 07:01:29 2013 +0100 - - Fix obsolete automake macros - - https://bugzilla.gnome.org/show_bug.cgi?id=691101 - - configure.ac | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -commit 6c02ab0ad720780f176192fdc6372aaa178812fd -Author: Simon Feltman -Date: Mon Dec 31 02:53:07 2012 -0800 - - Change dynamic enum and flag gtype creation to use namespaced naming - - Use the combination of g_base_info_get_namespace and - g_base_info_get_name - as the name for registering enum and flag types with glib through - g_enum_register_static and g_flags_register_static. This avoids - conflicts - with types like GLib.SeekType and Gst.SeekType. Add better exceptions - and memory cleanup for invalid registration problems. - - https://bugzilla.gnome.org/show_bug.cgi?id=690455 - - gi/_gobject/pygenum.c | 6 ++-- - gi/gimodule.c | 78 - ++++++++++++++++++++++++++++++++++++++++++++------- - tests/test_gi.py | 35 +++++++++++++++++++++++ - 3 files changed, 106 insertions(+), 13 deletions(-) - -commit 692c80e11a05e2fb0515580acb22fd6fe65cede1 -Author: Dan Horák -Date: Fri Dec 28 22:12:32 2012 +0100 - - Fix test for GBytes.compare() - - The result of the compare method is defined as equal, less than or - greater than zero - and the test must match to that. The underlaying memcmp() function - can return other - values than -1, 0 and 1. For example on architectures where it is - implemented directly - via a CPU instruction like on s390(x) where I can see -2 as a result - instead of the - "expected" -1. - - https://bugzilla.gnome.org/show_bug.cgi?id=690837 - - tests/test_gi.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 948dbcb223249a08f4398d4ad8861e92e3de0dfa -Author: Jonathan Ballet -Date: Thu Dec 27 16:04:51 2012 +0100 - - Fix Gtk.UIManager.add_ui_from_string() override for non-ASCII chars - - The length argument is the size of the buffer in bytes, not in - characters. - - https://bugzilla.gnome.org/show_bug.cgi?id=690329 - - Co-Authored-By: Martin Pitt - - gi/overrides/Gtk.py | 2 +- - tests/test_overrides_gtk.py | 7 +++++++ - 2 files changed, 8 insertions(+), 1 deletion(-) - -commit 53bc12a87da824cbfb006a4fd65731edec12ecc7 -Author: Mike Gorse -Date: Wed Dec 19 20:51:03 2012 -0500 - - Don't dup strings before passing them to type registration functions - - Strings passed to g_enum_register_static and g_flags_register_static - are - eventually passed to g_quark_from_string, which dups the string - passed to it if - needed and does not take ownership of it, so passing in a - dynamically-allocated - string without freeing it results in a small leak. - - https://bugzilla.gnome.org/show_bug.cgi?id=690532 - - gi/gimodule.c | 2 -- - 1 file changed, 2 deletions(-) - -commit 9454c01f2b1b82d43eea0f72fe9a28ef50065fc9 -Author: Carlos Garnacho -Date: Tue Dec 18 22:47:09 2012 +0100 - - Fix marshalling of arrays of boxed struct values - - This fixes methods like gtk_selection_set_with_data(). In such cases - data is passed as an array of struct pointers, so it must be converted - to an array of structs. - - https://bugzilla.gnome.org/show_bug.cgi?id=656312 - - Co-Authored-By: Martin Pitt - - gi/pygi-marshal-from-py.c | 6 ++++++ - tests/test_gi.py | 12 ++++++++++++ - 2 files changed, 18 insertions(+) - -commit 231d5a7cfc73518b4e2b0c926d4c1ce9a804797e -Author: Simon Feltman -Date: Tue Dec 18 02:03:41 2012 -0800 - - Add reference counting tests for Object.bind_property - - Add tests which ensure transform callbacks and user_data - are propertly ref-counted. - - https://bugzilla.gnome.org/show_bug.cgi?id=690397 - - tests/test_gobject.py | 40 ++++++++++++++++++++++++++++++++++++---- - 1 file changed, 36 insertions(+), 4 deletions(-) - -commit c29e11812d176b1f057074c9bab22c9614ae4f8c -Author: Martin Pitt -Date: Tue Dec 18 11:43:04 2012 +0100 - - testhelpermodule.c: Do not unref called method - - In _wrap_test_gerror_exception(), do not unref the method - arguments. This - causes a crash when being run with the stricter refcounting/memory - checks with - debug-enabled Python builds. - - tests/testhelpermodule.c | 1 - - 1 file changed, 1 deletion(-) - -commit ff0d9106bcd02a6b2c67cc3722481218c599a9f4 -Author: Martin Pitt -Date: Mon Dec 17 23:20:50 2012 +0100 - - configure.ac: post-release bump to 3.7.4 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 061b23d14386c0e54d2c3af113554231bbe85f16 -Author: Martin Pitt -Date: Mon Dec 17 23:18:31 2012 +0100 - - release 3.7.3 - - NEWS | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -commit a242f02823a63c9dca5d0b1ce84b031221053690 -Author: Martin Pitt -Date: Mon Dec 17 23:11:29 2012 +0100 - - Add (failing) tests for callbacks with out arguments - - Most of these fail and need marshalling fixes. - - tests/test_gi.py | 36 ++++++++++++++++++++++++++++++++++++ - 1 file changed, 36 insertions(+) - -commit 449b1ef0d94450c1e457770a093abd6d6c9e6291 -Author: Martin Pitt -Date: Mon Dec 17 22:50:59 2012 +0100 - - Add tests for internal API - - These cover functions like pygobject_new(), pyg_value_from_pyobject() - and - pyg_value_as_pyobject() that are wrapped by testhelpermodule.c. With - that these - functions can be tested in isolation without the whole GI stack - around them. - - tests/Makefile.am | 1 + - tests/test_internal_api.py | 73 - ++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 74 insertions(+) - -commit e44312139426f51e576ef9e880819542cc224383 -Author: Martin Pitt -Date: Mon Dec 17 18:02:15 2012 +0100 - - Add support for caller-allocated GArray out arguments - - https://bugzilla.gnome.org/show_bug.cgi?id=690041 - - gi/pygi-cache.c | 2 +- - gi/pygi-invoke.c | 57 - ++++++++++++++++++++++++++++++-------------------------- - tests/test_gi.py | 5 +++-- - 3 files changed, 35 insertions(+), 29 deletions(-) - -commit f262320ac22b48a9d007c425633f3ca426b7fb4a -Author: Martin Pitt -Date: Mon Dec 17 16:18:24 2012 +0100 - - Add (failing) test for caller-allocated GArray return value - - Call new GIMarshallingTests.garray_utf8_full_out_caller_allocated() - function - which reproduces https://bugzilla.gnome.org/show_bug.cgi?id=690041. - - The test is failing and causing a segfault right now, so disable it - until this - actually works. - - tests/test_gi.py | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 1cb4c30c3cf19690210010d39b6272965f489c58 -Author: Martin Pitt -Date: Mon Dec 17 15:56:44 2012 +0100 - - GLib overrides: Avoid calling deprecated GLib.unix_signal_add_full() - - glib 2.35.x fixed the API to be GLib.unix_signal_add(). Call the - modern API if - available, but fall back to GLib.unix_signal_add_full() until we - depend on glib - 2.36. - - gi/overrides/GLib.py | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -commit 945263a89c3adee61f95d4211cf13b254ad6d51f -Author: Martin Pitt -Date: Fri Nov 30 14:17:18 2012 +0100 - - Re-support calling GLib.io_add_watch with an fd or Python file - - This does not strictly adhere to the GLib API, but it's very - convenient and - unlike the other modes, does not change the number or order of - arguments. So - let's keep support for this and drop the deprecation warning. - - gi/overrides/GLib.py | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -commit 263b9f97e748746e1d26847a82a4d6e53a42798a -Author: Martin Pitt -Date: Fri Nov 30 09:04:20 2012 +0100 - - Robustify test_glib.TestGLib.test_io_add_watch_pyfile - - Use a longer timeout to avoid races on slow architectures, and cut - the main - loop as soon as we received all expected events. - - tests/test_glib.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit 8e4e822cb273db4eb7e6e40f4739eeebee00798a -Author: Martin Pitt -Date: Fri Nov 30 08:44:56 2012 +0100 - - test_overrides_gtk: Ignore GVFS warnings from FileChooserDialog - - Do not cause GVFS warnings from Gtk.FileChooserDialog (which may - concern - unavailable monitor backends in the test environment) to fail - the tests. - - tests/test_overrides_gtk.py | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -commit d47283936b4c0b5e8b6ede8886c4badbf6d6e694 -Author: Martin Pitt -Date: Thu Nov 29 16:45:49 2012 +0100 - - pygtkcompat: Work around IndexError on large flags - - On 32 bit systems pygtkcompat currently fails with - - File "pygtkcompat/pygtkcompat.py", line 74, in _install_enums - name = flag.value_names[-1].replace(modname + '_', '') - IndexError: cannot fit 'int' into an index-sized integer - - on 32 bit systems as some flags in Gdk are too large to fit into a - 32 bit - "long". Work around this crash until this gets fixed properly - (marked as - FIXME). - - pygtkcompat/pygtkcompat.py | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit 3fa31b1a7936c556e76bd8a42030567c6a867e0d -Author: Martin Pitt -Date: Thu Nov 29 14:11:29 2012 +0100 - - Fix pyg_value_from_pyobject() range check for uint - - We cannot use PYGLIB_PyLong_AsLong() for the range check, as on 32 - bit machines - this overflows large uints. Use PyLong_AsLongLong() separately to - check for - negative values, and PyLong_AsUnsignedLong() for the actual - conversion. - - gi/_gobject/pygtype.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -commit 05d767a602571805e80099f1db47ad4164575c53 -Author: Martin Pitt -Date: Thu Nov 29 13:30:56 2012 +0100 - - Fix tests to work with g-i 1.34.2 - - Do not try to call GIMarshallingTests API which isn't present - when running - against g-i 1.34.2. This can be dropped when the g-i dependency gets - bumped to - 1.35.x. - - tests/test_gi.py | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -commit a107c928ef85b4e3b9075a408774b74879586029 -Author: Martin Pitt -Date: Thu Nov 29 13:13:14 2012 +0100 - - Fix wrong refcount for GVariant property defaults - - Drop the bogus DECREF for the GVariant default argument, as we need - to keep it - around in the class. Otherwise the refcount drops to zero, and - the next - garbage collection run causes segfaults. - - https://bugzilla.gnome.org/show_bug.cgi?id=689267 - - gi/_gobject/gobjectmodule.c | 1 - - 1 file changed, 1 deletion(-) - -commit 9b7dd1318cf540d5f8d03655da03534ed72707ec -Author: Martin Pitt -Date: Thu Nov 29 11:44:22 2012 +0100 - - test_gi: Fix TestFilename failure under C locale - - tests/test_gi.py | 1 + - 1 file changed, 1 insertion(+) - -commit 37ab227555ba8628b4fa99aa286bd046208745ed -Author: Martin Pitt -Date: Thu Nov 29 11:16:26 2012 +0100 - - Fix array arguments on 32 bit - - In _pygi_argument_from_object() we never put the actual element - GType into the - constructed array. The array contains GIArguments, or bytes in the - case of - passing a string as an array. - - This happened to work on 64 bit machines where GIArgument and char* - have the - same size, but not on 32 bit machines - (test_gi.TestPropertiesObject.test_strv - fails there). - - gi/pygi-argument.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit 7bd852fc82f92dac8723e18b61a56ed1b1a1b81c -Author: Martin Pitt -Date: Thu Nov 29 10:20:27 2012 +0100 - - test_gi: Disable failing check in test_module_name() - - When calling this under some conditions, such as - - TEST_NAMES='test_thread test_gi.TestOverrides' - - then the module name of GObject.InitiallyUnowned comes out as - "importlib._bootstrap" instead of "gi.repository.GObject". To be - investigated. - Add a couple of other tests to ensure that it is not broken in - general. - - tests/test_gi.py | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -commit 94a6cc93a104b22dcee2ac73cae36b83a4b5d9c1 -Author: Martin Pitt -Date: Thu Nov 29 09:40:32 2012 +0100 - - test_gdbus: Drop failure if timeout=0 works differently - - In some test environments we do not actually get a timeout exceptions - with - timeout=0, but a different error message. So only ensure that we - get the right - kind of error. - - tests/test_gdbus.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit c3b2f5fee573aa03a8a9563efbbbc1bc4fa25da7 -Author: Martin Pitt -Date: Thu Nov 29 09:29:05 2012 +0100 - - test_glib: Drop some assumptions about XDG dirs - - Some directories do not exist in minimal test environments, and this - is not - important for testing that calling these GLib functions works. - - tests/test_glib.py | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -commit e45c690bc83b6d513887649de88965a9752e316d -Author: Martin Pitt -Date: Wed Nov 28 12:20:31 2012 +0100 - - Add backwards compatible API for GLib.unix_signal_add_full() - - This was renamed to GLib.unix_signal_add() in - http://git.gnome.org/browse/glib/commit/?id=fca30c3e165 - - Provide a backwards compatible shim with a deprecation message. - - gi/overrides/GLib.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 00b9ea32d766ae486249f402d9dee511fd9f53a9 -Author: Martin Pitt -Date: Mon Nov 26 08:11:36 2012 +0100 - - Drop MININT64/MAXUINT64 workaround - - g-i 1.34.2 properly handles 64 bit constants now, so bug 685022 has - been fixed - properly now. Drop the workaround in the overrides to manually - set these - constants. - - gi/overrides/GLib.py | 7 ------- - 1 file changed, 7 deletions(-) - -commit d16604f64d25d18409270d7537fc993113b65c19 -Author: Simonas Kazlauskas -Date: Fri Nov 23 19:57:56 2012 +0200 - - Fix maximum and minimum ranges of TYPE_(U)INT64 properties - - In corner case where properties use values 2 ** 62 < ±x < 2 ** 63 for - TYPE_INT64 and 2 ** 63 < x < 2 ** 64 for TYPE_UINT64 they will raise - warnings even tough values are valid. - - https://bugzilla.gnome.org/show_bug.cgi?id=688949 - - gi/_gobject/propertyhelper.py | 6 +++--- - tests/test_properties.py | 11 ++++------- - 2 files changed, 7 insertions(+), 10 deletions(-) - -commit 93e9e309d8ba54884881cfca203e8bc355c2727e -Author: Martin Pitt -Date: Wed Nov 21 12:58:07 2012 +0100 - - Test virtual methods with in and out arguments - - ... and both caller and callee out argument allocation. - - This came up in https://bugzilla.gnome.org/show_bug.cgi?id=688783 - - tests/test_gi.py | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -commit 25a9cfb043448efbab9168ef66f852cc34b9909b -Author: Martin Pitt -Date: Tue Nov 20 07:00:44 2012 +0100 - - Ship pygi-convert.sh in tarballs - - https://bugzilla.gnome.org/show_bug.cgi?id=688697 - - Makefile.am | 1 + - 1 file changed, 1 insertion(+) - -commit 4a8d31e6f56a3f1360bdb880ffd9a6eb139c02d8 -Author: Martin Pitt -Date: Mon Nov 19 15:25:38 2012 +0100 - - Post-release version bump to 3.7.3 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit d0ed62afbc4cada0bf6abc4f8754e5a8d73036e4 -Author: Martin Pitt -Date: Mon Nov 19 15:13:28 2012 +0100 - - release 3.7.2 - - NEWS | 47 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 47 insertions(+) - -commit 29dc7425dd7584411b52ef07b50f929ed119a000 -Author: Martin Pitt -Date: Mon Nov 19 14:37:02 2012 +0100 - - Fix distcheck - - Commit e617f76e forgot to rename the file in EXTRA_DIST - - tests/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 567aae6e7c56bb89f53fcfccb1b0bc732f85b847 -Author: Martin Pitt -Date: Mon Nov 19 14:34:13 2012 +0100 - - tests: Fix unicode vs. str issues in Python 2 - - Some of the tests assumed a system default encoding of UTF-8, which - is not true - in Python 2 unless pygtkcompat is imported. Commit e617f76 uncovered - this. - - tests/test_gi.py | 8 ++++---- - tests/test_iochannel.py | 16 +++++++++------- - 2 files changed, 13 insertions(+), 11 deletions(-) - -commit 509e5ac1a6dd8504e89c33c559fe4f72156a1ddf -Author: Martin Pitt -Date: Mon Nov 19 14:20:56 2012 +0100 - - tests: Fix previous commit to fail properly on test failures - - tests/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e617f76e5b0c301c3ae92e1091aa86792de4d8e8 -Author: Martin Pitt -Date: Mon Nov 19 14:09:14 2012 +0100 - - tests: Run pygtkcompat tests separately - - pygtkcompat changes the global namespace, in particular patching - Gdk and Gtk - overrides. Run the tests in a separate process so that the main - tests are not - potentially affected by the pygtkcompat test. - - runtests.py runs all tests/test_*.py by default, so rename to - compat_test_pygtk.py and run that explicitly after successfully - running the - main tests. - - See https://bugzilla.gnome.org/show_bug.cgi?id=688219 - - tests/Makefile.am | 3 + - tests/compat_test_pygtk.py | 147 - +++++++++++++++++++++++++++++++++++++++++++++ - tests/test_pygtkcompat.py | 147 - --------------------------------------------- - 3 files changed, 150 insertions(+), 147 deletions(-) - -commit 8180b8092f99b7c9f0dee1742418efdbd23ab330 -Author: Simon Feltman -Date: Thu Nov 15 02:51:52 2012 -0800 - - Move pygtkcompat into sibling package of gi - - Move the pygtkcompat module out of the gi package and into - a sibling package as follows: - - pygobject/ - gi/ - pygtkcompat/ - - This allows for pygtkcompat to grow without affecting the gi package. - Add deprecation message to gi/pygtkcompat.py - - https://bugzilla.gnome.org/show_bug.cgi?id=688219 - - Makefile.am | 2 +- - configure.ac | 1 + - gi/pygtkcompat.py | 524 - +++------------------------------------------ - pygtkcompat/Makefile.am | 15 ++ - pygtkcompat/__init__.py | 20 ++ - pygtkcompat/pygtkcompat.py | 501 - +++++++++++++++++++++++++++++++++++++++++++ - tests/test_pygtkcompat.py | 6 +- - 7 files changed, 565 insertions(+), 504 deletions(-) - -commit f736694d09e9d0fca4769d9f1f34ec34e6354d87 -Author: Martin Pitt -Date: Mon Nov 19 13:59:20 2012 +0100 - - Bump g-i dependency to >= 1.34.2 - - We need this for updated GLib annotations and new test API. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f6c994c76cd8010460b76bf455e1a341348d735b -Author: Martin Pitt -Date: Mon Nov 19 10:39:26 2012 +0100 - - test_gi: Fix failing tests with g-i 1.34.x - - Skip tests which require g-i test API from 1.35.x when building - with g-i - 1.34.x. - - tests/test_gi.py | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit 8ce0d028fe79e2ce52cfecbb682afba6651a7a70 -Author: Martin Pitt -Date: Wed Nov 14 11:57:21 2012 +0100 - - test_gi: Add tests for type "filename" - - tests/test_gi.py | 30 ++++++++++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - -commit 3408a151e49d9520f54ad9bc04f620c7777125ec -Author: Martin Pitt -Date: Wed Nov 14 11:09:33 2012 +0100 - - Drop foreign GVariant registration/support - - This is dead code. We have tests for GVariant in and out method - arguments, - callback arguments and return values, properties, etc to ensure that - this stays - working. - - gi/Makefile.am | 2 -- - gi/pygi-foreign-gvariant.c | 63 - ---------------------------------------------- - gi/pygi-foreign-gvariant.h | 41 ------------------------------ - gi/pygi-foreign.c | 8 +----- - 4 files changed, 1 insertion(+), 113 deletions(-) - -commit 47c46d847bb69ebc139d5e0b6c609da6f27201f2 -Author: Martin Pitt -Date: Wed Nov 14 10:33:24 2012 +0100 - - test_properties.py: Fix PEP-8 errors - - tests/test_properties.py | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -commit 78f49e6253500bfa382ce6c07412613d8f7f9d7f -Author: Martin Pitt -Date: Wed Nov 14 10:14:36 2012 +0100 - - Add support for GVariant properties defined in Python - - gi/_gobject/gobjectmodule.c | 13 +++++++ - gi/_gobject/propertyhelper.py | 11 ++++-- - tests/test_properties.py | 81 - +++++++++++++++++++++++++++++++++++++------ - 3 files changed, 91 insertions(+), 14 deletions(-) - -commit f3b77f4304be20b7422c262b973f3eeb540c4bf6 -Author: Martin Pitt -Date: Wed Nov 14 09:33:43 2012 +0100 - - pyg_value_from_pyobject(): Simplify GVariant type check - - Use pyg_type_from_object_strict() instead of the much more expensive - and local - pyg_get_gvariant_type(). - - gi/_gobject/pygtype.c | 23 +---------------------- - 1 file changed, 1 insertion(+), 22 deletions(-) - -commit 0c0fb8ef88a2c61cf95cd1cb96f6d5f296cad5fc -Author: Martin Pitt -Date: Wed Nov 14 09:27:42 2012 +0100 - - test_everything: Add test for callback returning wrong type - - This covers the "expected a GVariant, got something else" check in - pyg_value_from_pyobject(). - - tests/test_everything.py | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -commit 84db7109dfbaf443758a5a4871ee385686d2703d -Author: Martin Pitt -Date: Wed Nov 14 08:42:53 2012 +0100 - - Add type checking to GVariant argument assignment - - gi/pygi-argument.c | 7 ++++++- - tests/test_gi.py | 5 ++--- - 2 files changed, 8 insertions(+), 4 deletions(-) - -commit e944caf5ff53143a98dd4a5578530996358013ec -Author: Martin Pitt -Date: Wed Nov 14 08:22:35 2012 +0100 - - Add support for GVariant properties defined in C - - Note that trying to assign a non-GVariant value to a GVariant property - currently crashes. - - gi/pygi-property.c | 6 +++++- - tests/test_gi.py | 21 +++++++++++++++++++++ - 2 files changed, 26 insertions(+), 1 deletion(-) - -commit 614cc9594cb34d92a6d4b00773427d4fb023c65e -Author: Martin Pitt -Date: Wed Nov 14 07:09:58 2012 +0100 - - test_unknown.py: Check property interface - - NB that the property implementation in test-unknown.c does not - actually do - anything, we just want to assert that the properties are properly - registered. - - tests/test_unknown.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 9d7771affcf788d251cced65da56fc2773a278b3 -Author: Martin Pitt -Date: Wed Nov 14 07:01:24 2012 +0100 - - Fix previous commit for Python 2 - - gi/pygi-foreign-cairo.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 997d4e70b2793039d916acf8921087576622152e -Author: Martin Pitt -Date: Wed Nov 14 06:57:04 2012 +0100 - - pygi-foreign-cairo.c: Use official py3cairo API - - Do not clobber py3cairo's Pycairo_CAPI global variable, and use - import_cairo() - instead of our own code. - - gi/pygi-foreign-cairo.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit cec5d1a55347b81c1ae4ddc47ea2b4fbf964d239 -Author: Martin Pitt -Date: Wed Nov 14 06:47:23 2012 +0100 - - Drop dead code from pygi-callbacks.[hc] - - _pygi_create_callback() and _pygi_scan_for_callbacks() are not - used anywhere. - _pygi_destroy_notify_create() fits better in pygi-marshal-from-py.c, - so move it - there, and drop pygi-callbacks.[hc] completely. - - gi/Makefile.am | 2 - - gi/pygi-callbacks.c | 217 - ---------------------------------------------- - gi/pygi-callbacks.h | 48 ---------- - gi/pygi-marshal-from-py.c | 44 ++++++++++ - gi/pygi-private.h | 1 - - 5 files changed, 44 insertions(+), 268 deletions(-) - -commit 55070cc9c98993ccda7ebcb05783fad182b2eb11 -Author: Carlos Garnacho -Date: Tue Nov 13 18:24:28 2012 +0100 - - Fix marshalling of arrays of struct pointers to Python - - Fill in the pointer to the struct, not the pointer to the - array position. This makes the GdkAtom** argument in - gtk_clipboard_wait_for_targets() work. - - https://bugzilla.gnome.org/show_bug.cgi?id=678620 - - gi/pygi-marshal-to-py.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit fc021516552b1720bacc4afe6b7a610c413194c4 -Author: Martin Pitt -Date: Wed Nov 14 06:27:17 2012 +0100 - - test_atoms.py: Add test for out array - - This reproduces https://bugzilla.gnome.org/show_bug.cgi?id=678620 - - tests/test_atoms.py | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -commit e2790d22610aae773635d4caef2458082a307283 -Author: Martin Pitt -Date: Tue Nov 13 16:38:36 2012 +0100 - - Fix Gdk.Atom str()/repr() fallback - - Fix regression in commit 6713618: If an atom does not have a name, - do not - recursively call our own str()/repr() methods, but just print - "Gdk.Atom". - - gi/overrides/Gdk.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -commit 9879fd41a7d8d72f8db9cadf5b1ee29fc4d5d6bf -Author: Martin Pitt -Date: Tue Nov 13 13:16:14 2012 +0100 - - test_gi: Stop using GLib.bytes.unref_to_array() - - This method isn't safe for GI, and should be (skip)ed. Use get_data() - instead - which is safe and works fine. - - See https://bugzilla.gnome.org/show_bug.cgi?id=688242 - - tests/test_gi.py | 6 ------ - 1 file changed, 6 deletions(-) - -commit 671361841de797ef62b59d1d7568fc3d431898c7 -Author: Martin Pitt -Date: Tue Nov 13 12:56:11 2012 +0100 - - Fix Gdk.Atom to have a proper str() and repr() - - Gdk.Atom is not proper GType'd class, so we cannot override the - whole class. - Just override its __str__() and __repr__() methods so that printing - atoms shows - something sensible. For nameless/invalid atoms, fall back to the old - output to help with debugging. - - https://bugzilla.gnome.org/show_bug.cgi?id=678620 - - gi/overrides/Gdk.py | 21 +++++++++++++++++++++ - tests/test_atoms.py | 12 ++++++++++++ - 2 files changed, 33 insertions(+) - -commit 56e62858e9c2bdde3186f5cf4e83be94fb4e5306 -Author: Simon Feltman -Date: Tue Nov 13 02:53:34 2012 -0800 - - Make sure g_value_set_boxed does not cause a buffer overrun with - GStrvs - - Add NULL terminator to gchar** passed to g_value_set_boxed to - make sure it does not overrun memory in pygi_set_property_value_real. - Add MALLOC_CHECK_=3 to "make check" which prints an error and aborts - in these cases. - - https://bugzilla.gnome.org/show_bug.cgi?id=688232 - - gi/pygi-property.c | 8 ++++++-- - tests/Makefile.am | 1 + - 2 files changed, 7 insertions(+), 2 deletions(-) - -commit ca11ec124fdd3fb2b67efdeb3ac93aaeb8b3fd83 -Author: Martin Pitt -Date: Mon Nov 12 08:35:28 2012 +0100 - - types.py: Fix PEP-8 violation - - gi/types.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit df589458358d7e7bf178dff4e6ad937a70f806e3 -Author: Simon Feltman -Date: Sun Nov 11 22:26:19 2012 -0800 - - Fix leaks with GValues holding boxed and object types - - Expose read access to PyGIBoxed.free_on_dealloc. - Add GObject.Value.__del__ override and call unset() to - correctly free reference counts. - - https://bugzilla.gnome.org/show_bug.cgi?id=688137 - - gi/overrides/GObject.py | 9 +++++++++ - gi/pygi-boxed.c | 12 ++++++++++++ - tests/test_gi.py | 2 -- - 3 files changed, 21 insertions(+), 2 deletions(-) - -commit c01c95b9fb3d726385efac945f6d1270ae65d109 -Author: Simon Feltman -Date: Sun Nov 11 19:46:15 2012 -0800 - - Add expectantly failing unittests for GValue boxed/object leaks - - https://bugzilla.gnome.org/show_bug.cgi?id=688137 - - tests/test_gi.py | 80 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 80 insertions(+) - -commit 13629f5a9c9a7022f3521a3616d9ce8fa4a6161b -Author: Simon Feltman -Date: Thu Aug 16 15:09:08 2012 -0700 - - Add doc strings showing method signatures for gi methods - - Add signature based doc string to all methods pulled in from - introspection. For example: Gtk.SpinButton.get_icon_area.__doc__ - get_icon_area(self, icon_pos:Gtk.EntryIconPosition) -> - icon_area:cairo.RectangleInt - - https://bugzilla.gnome.org/show_bug.cgi?id=681967 - - gi/overrides/GIMarshallingTests.py | 1 + - gi/pygi-info.c | 103 - +++++++++++++++++++++++++++++++++---- - gi/pygi-type.c | 60 +++++++++++++++++++++ - gi/pygi-type.h | 1 + - gi/types.py | 92 - ++++++++++++++++++++++++++------- - tests/test_gi.py | 30 +++++++++++ - 6 files changed, 259 insertions(+), 28 deletions(-) - -commit 7b7277f3cc099280f8e2d6cf6693490290fedc24 -Author: Simon Feltman -Date: Fri Nov 9 19:17:03 2012 -0800 - - Set Property instance doc string and blurb to getter doc string - - Assign Property getter __doc__ strings or explicit blurb parameters - to the Property instances __doc__ attribute. This clobbers the - default Property classes lengthy and unhelpful doc string in the case - of instances. - - https://bugzilla.gnome.org/show_bug.cgi?id=688025 - - gi/_gobject/propertyhelper.py | 10 +++++++--- - tests/test_properties.py | 14 ++++++++++---- - 2 files changed, 17 insertions(+), 7 deletions(-) - -commit c5343d329ebb452d97afac30e4120ebab8477556 -Author: Martin Pitt -Date: Mon Nov 12 07:47:02 2012 +0100 - - tests: Fix for Python 2 - - Add quirks for Python 2's string handling, and disable the - Everything.test_array_gint8_in() as there seems to be no way of - creating a byte - array in Python 2. - - tests/test_everything.py | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit 964f33ca3a74bfb7d850f136d0844ac1551d36e9 -Author: Martin Pitt -Date: Sat Nov 10 15:52:15 2012 +0100 - - test_everything: Add tests for more Regress data and container types - - Add more tests for Regress' data and container type test API. - - This detects a number of bugs, which have been marked as expected - failure, or - disabled completely for the cases where they cause crashes: - - * unsigned enums with values >= 0x80000000 do not work - * nested ghashes in return values do not work - * array length arguments in callbacks are passed instead of - suppressed - - tests/test_everything.py | 156 - ++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 154 insertions(+), 2 deletions(-) - -commit 476e29d1ba3eda92cc021710017bce4ec252e5b5 -Author: Martin Pitt -Date: Fri Nov 9 18:45:22 2012 +0100 - - test_everything: Add tests for Regress type tests - - Add tests for all the data type handling tests of g-i's Regress - module. - - tests/test_everything.py | 183 - +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 183 insertions(+) - -commit 0d7974396e8379b518403983d9d13629066680d7 -Author: Martin Pitt -Date: Fri Nov 9 18:44:50 2012 +0100 - - Add GObject.G_MINSSIZE - - gi/_gobject/gobjectmodule.c | 1 + - gi/overrides/GObject.py | 2 +- - 2 files changed, 2 insertions(+), 1 deletion(-) - -commit b800a6903300dbe9435ed8eb3677eb9c0536ec31 -Author: Martin Pitt -Date: Fri Nov 9 16:02:00 2012 +0100 - - Fix marshalling of GByteArrays - - In _pygi_marshal_from_py_array(), set the array length after copying - the data - in the GI_TYPE_TAG_UINT8 case (which applies for GByteArrays), - otherwise it - will always come out as zero length. - - Enable the TestGByteArray.test_bytearray_none_in() test case as that - works now. - - gi/pygi-marshal-from-py.c | 1 + - tests/test_gi.py | 3 +-- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit fa568949c46dd4b537357f1af74d1f675294b760 -Author: Martin Pitt -Date: Fri Nov 9 15:23:37 2012 +0100 - - Fix marshalling of ssize_t to smaller ints - - Add missing marshalling cases for (u)int8 and (u)int16. This fixes the - TestArray.test_array_in test, so drop the expected failure. - - gi/pygi-marshal-from-py.c | 30 +++++++++++++++++++++++++++++- - tests/test_gi.py | 2 -- - 2 files changed, 29 insertions(+), 3 deletions(-) - -commit 5a5940a0a0704be8e222d4cad6cedda1ad3e0f71 -Author: Martin Pitt -Date: Fri Nov 9 09:37:00 2012 +0100 - - test_gi: Enable GByteArray constructor tests - - GByteArray annotations have been fixed in GLib now, enable the - test case. - - Drop the redundant disabled_test_bytearray_none_in_from_bytes() - test, as this - is the same as disabled_test_bytearray_none_in(). - - tests/test_gi.py | 16 ++++------------ - 1 file changed, 4 insertions(+), 12 deletions(-) - -commit e2c545896ab08b1f1885b502a8472db83f193d08 -Author: Martin Pitt -Date: Fri Nov 9 09:11:38 2012 +0100 - - test_gi: Enable GBytes test cases - - GBytes annotations are fixed in GLib now, enable the test case and - add more - for g_bytes_new_take() and g_bytes_{compare,equal}(). - - Please note that calling unref_to_array() on a GBytes object that - we created - ourselves currently causes a double free crash, so disable that part - for now. - - tests/test_gi.py | 30 +++++++++++++++++++++++++----- - 1 file changed, 25 insertions(+), 5 deletions(-) - -commit 1ba4e201f86ffa28c645d7c9eea99cf31080ea43 -Author: Martin Pitt -Date: Fri Nov 9 08:26:29 2012 +0100 - - test_gi: Add missing data type tests from GIMarshallingTests - - Add tests for types time_t, GBytes, GByteArray, and various variants - of passing - around GValues, flags, enums, arrays, and boxed structs. This tests - API which - is provided by GIMarshallingTests, but which we did not cover yet. - - This detects a number of bugs in annotations and our - marshalling. These have - been marked as expected failure, or disabled completely for the - cases where - they cause crashes. - - tests/test_gi.py | 152 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 152 insertions(+) - -commit 0456d9c892b76ed79134230a4a8610a23c602964 -Author: Martin Pitt -Date: Fri Nov 9 06:44:46 2012 +0100 - - autogen.sh: Only enable code coverage if lcov is installed - - Otherwise we break minimal build environments. - - autogen.sh | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -commit 76a3acebf73f930c541d0f30249f67d254f948ab -Author: Martin Pitt -Date: Fri Nov 9 06:41:58 2012 +0100 - - Lower autoconf dependency to 2.68 again - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f1a5f1b92d577c542d4258e63e595d4da9acd484 -Author: Martin Pitt -Date: Thu Nov 8 14:54:30 2012 +0100 - - Add support for lcov code coverage - - Use gnome-common's new code coverage flags. Default to enabling - code coverage - in autogen.sh (but not for dist). - - To use this, run "make check-code-coverage" after building. - - .gitignore | 1 + - Makefile.am | 2 ++ - autogen.sh | 2 +- - configure.ac | 6 ++++++ - 4 files changed, 10 insertions(+), 1 deletion(-) - -commit e46af4aba220cfaf4b84a9be847f3363da556993 -Author: Martin Pitt -Date: Wed Nov 7 17:14:22 2012 +0100 - - Update documentation files - - Update AUTHORS to have the current maintainers. - - Update HACKING to drop Tomeu's GNOME login (this should be set in - ~/.ssh/config) - - Update INSTALL to current upstream version. - - AUTHORS | 13 ++- - HACKING | 4 +- - INSTALL | 380 - +++++++++++++++++++++++++++++++++++++++++++--------------------- - 3 files changed, 267 insertions(+), 130 deletions(-) - -commit 06f5ed0ebabce34eca6bc6de80221cba6453feec -Author: Martin Pitt -Date: Wed Nov 7 17:08:11 2012 +0100 - - Quiesce automake output - - Use $(AM_V_GEN) with custom $(LINK) commands, and avoid error - messages about - existing symlinks on rebuilds. - - gi/Makefile.am | 2 +- - gi/_glib/Makefile.am | 2 +- - gi/_gobject/Makefile.am | 2 +- - tests/Makefile.am | 6 +++--- - 4 files changed, 6 insertions(+), 6 deletions(-) - -commit 37270de8ead0b281a1824ff204a4aa9686a7225b -Author: Martin Pitt -Date: Wed Nov 7 16:50:07 2012 +0100 - - Drop unused variable, fail builds on those - - Build with -Werror=unused-variable, as these could hide programming - errors or - incomplete refactoring, and are not platform dependent. - - Drop unused variable in pyg_type_add_interfaces(). - - configure.ac | 1 + - gi/_gobject/gobjectmodule.c | 1 - - 2 files changed, 1 insertion(+), 1 deletion(-) - -commit 495fd98555e0c89724bb8fa9478dc096c5d61e22 -Author: Martin Pitt -Date: Wed Nov 7 16:37:04 2012 +0100 - - configure.ac: Drop maintainer mode, modernize libtool declarations - - Use all arguments of AC_INIT. - - AM_MAINTAINER_MODE is discouraged now, drop it. - - Use LT_PREREQ and LT_INIT for libtool initialization instead of - the older - declarations. - - See https://live.gnome.org/GnomeGoals/ModernAutotools - - configure.ac | 19 ++++++------------- - 1 file changed, 6 insertions(+), 13 deletions(-) - -commit 059d0cb879fe5a7b0296ec21f3bfcb64c8596cb0 -Author: Martin Pitt -Date: Wed Nov 7 16:21:13 2012 +0100 - - autoupdate configure.ac - - Result of "autoupdate", with slight manual beautification. - - See https://live.gnome.org/GnomeGoals/ModernAutotools - - configure.ac | 21 +++++++++------------ - 1 file changed, 9 insertions(+), 12 deletions(-) - -commit a932446e6648ecd98c9038298b18c6fbd36c01aa -Author: Jose Rostagno -Date: Mon Nov 5 14:26:05 2012 -0300 - - pygi-convert: remove deprecated GLib → GObject conversions - - Using these functions from the GObject module is deprecated now, - they should be - used from GLib. - - pygi-convert.sh | 5 ----- - 1 file changed, 5 deletions(-) - -commit 21076d4b8f3ec8e253ca236fa3b20b07fde237fe -Author: Simon Feltman -Date: Wed Nov 7 03:49:24 2012 -0800 - - Use hasattr when testing for __info__ when finding vfuncs - - Change gi.types.find_vfunc_info_in_interface to use hasattr - when finding vfuncs. Using '__info__' in __dict__ was skipping - overridden interfaces which don't directly contain the __info__. - - gi/types.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 1b5c9b3d1499b3bc59afb297672abc671e175546 -Author: Martin Pitt -Date: Wed Nov 7 12:05:24 2012 +0100 - - tests: Ensure that the fatal mask is always reset - - On test case failures the fatal mask might be left in a wrong state, - so ensure - with "finally" that it is reset on failed tests as well, to avoid - hiding other - failures. - - tests/test_gi.py | 11 ++++++----- - tests/test_overrides_gtk.py | 33 +++++++++++++++++++-------------- - tests/test_pygtkcompat.py | 6 ++++-- - tests/test_signal.py | 6 ++++-- - 4 files changed, 33 insertions(+), 23 deletions(-) - -commit 463f660cd6bb78ae7f2ea7c70c0491e6b4744942 -Author: Simon Feltman -Date: Tue Nov 6 21:34:06 2012 -0800 - - Replace GObject notify methods with introspection and python - - Replace static context managers for freeze_notify and - handler_block with python context managers. Remove notify, - freeze_notify, thaw_notify static methods as the introspection - versions work fine. - - https://bugzilla.gnome.org/show_bug.cgi?id=672727 - - gi/_gobject/pygobject.c | 173 - ++---------------------------------------------- - gi/overrides/GObject.py | 61 +++++++++++++++-- - tests/test_gobject.py | 26 ++++++-- - tests/test_signal.py | 13 +++- - 4 files changed, 91 insertions(+), 182 deletions(-) - -commit 3fcd987272a779e5ee9173a2c3a043b4b7475842 -Author: Simon Feltman -Date: Tue Oct 23 13:56:32 2012 -0700 - - Add support for overriding GObject.Object - - Shift pygi module mechanics so the introspection generated 'Object' - class becomes derived from the static GObject class. Add initial - GObject.Object override which sets all static methods back essentially - leapfrogging the introspection methods. This sets the stage for having - the ability to remove static methods piecemeal in favor of - introspection/python in future commits. - - https://bugzilla.gnome.org/show_bug.cgi?id=672727 - - gi/module.py | 30 +++++++++++--------- - gi/overrides/GObject.py | 74 - ++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygobject-external.h | 10 +------ - gi/types.py | 7 +++++ - tests/test_gobject.py | 31 ++++++++++++++++---- - tests/testhelpermodule.c | 2 +- - 6 files changed, 126 insertions(+), 28 deletions(-) - -commit 4da6f93d86b104941c5533c3da5edb4a00ec62e9 -Author: Martin Pitt -Date: Tue Nov 6 13:55:21 2012 +0100 - - Bump glib dependency to >= 2.34.2 - - We need 2.34.2 or 2.35.2 as we now depend on the GIOChannel annotation - fixes. - - README | 2 +- - configure.ac | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -commit 85c8dd7a9bc81fb5df5abc6d8a95f966955ec775 -Author: Martin Pitt -Date: Tue Nov 6 11:28:42 2012 +0100 - - Update README - - Point to python-hackers-list instead of the old pygtk list, update - required - versions, and point to wiki page and IRC. - - README | 19 ++++++++++--------- - 1 file changed, 10 insertions(+), 9 deletions(-) - -commit 6d8b29ba56fb085948a155c75af36dcea9c71da8 -Author: Martin Pitt -Date: Tue Nov 6 11:21:32 2012 +0100 - - Add --with-python configure option - - This behaves like setting $PYTHON, but also works in build systems - like jhbuild - which do not support setting environment variables. - - Update README accordingly. - - README | 15 +++++++++------ - configure.ac | 43 ++++++++++++++++++++++++++++++++++--------- - 2 files changed, 43 insertions(+), 15 deletions(-) - -commit 4e5556a5238a3b86da9a0e40fd0e23004ed6af75 -Author: Martin Pitt -Date: Tue Nov 6 10:39:27 2012 +0100 - - python.m4: Add python3.3, do not prefer unversioned "python" - - Add python 3.3 to the search list. - - http://www.python.org/dev/peps/pep-0394/ broke the well-defined - meaning of - "python", so use that as last fallback if more specific versions do - not exist. - - configure.ac | 2 +- - m4/python.m4 | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit e71c046ed8f5b06e6b7383ddc0fc18f06de6abee -Author: Martin Pitt -Date: Tue Nov 6 09:48:50 2012 +0100 - - m4: Update py-compile to current upstream version - - Update py-compile to current versions from automake 1.11.6. - - m4/py-compile | 81 - +++++++++++++++++++++++++++++++++++------------------------ - 1 file changed, 48 insertions(+), 33 deletions(-) - -commit 8406b39f4e9ff98e0d59e880dde3ddb5e5131726 -Author: Martin Pitt -Date: Tue Nov 6 09:57:00 2012 +0100 - - m4: Update introspection.m4 to current upstream version - - m4/introspection.m4 | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 4ffa61b7c39cf038440dc9acfe8d214c9b77c3a6 -Author: Martin Pitt -Date: Tue Nov 6 09:53:15 2012 +0100 - - option.py: Fix PEP-8 error - - gi/_glib/option.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2cbb54e79c23b96486d4a2bfa170460df5bd6c84 -Author: Simon Feltman -Date: Mon Nov 5 18:27:56 2012 -0800 - - Remove DynamicGLibModule and DynamicGObjectModule - - Move final bits of _glib static binding imports directly into - the GLib override. Change _glib/option use the .so directly - rather than the staged variables in _glib/__init__.py. - Remove DynamicGLibModule and DynamicGObjectModule and update - unittest. - - https://bugzilla.gnome.org/show_bug.cgi?id=687488 - - gi/_glib/__init__.py | 11 ---------- - gi/_glib/option.py | 16 +++++++------- - gi/importer.py | 12 ++--------- - gi/module.py | 60 - ---------------------------------------------------- - gi/overrides/GLib.py | 14 ++++++++++++ - tests/test_gi.py | 9 ++------ - 6 files changed, 26 insertions(+), 96 deletions(-) - -commit 901c1b6e3722a9cd999e4948297e2c460f101d20 -Author: Daniel Drake -Date: Thu Nov 1 14:46:22 2012 +0000 - - Fix property lookup in class hierarchy - - Commit 4bfe7972546413f46f5c36737ff03bb5612c1921 introduced a bug where - a Python subclass of a gi-provided base class overrides a property - from the - base class. - - The new behaviour in the above commit causes pygobject to seek - the property - in the base class and try to read it from there (resulting in - confusion) - rather than noticing that the property is overridden and present - in the - Python object instance. - - To provide a nicer solution here, we can exploit the fact that - g_object_class_find_property() will traverse the hierarchy in order to - find the right GParamSpec, and the returned GParamSpec can tell - us exactly - which GType introduces the property. The strategy is: - - 1. Find pspec with g_object_class_find_property() - 2. Find the class that owns that property (pspec->owner_type) - 3. See if girepository owns that class. - 3a. If yes, get property from there. - 3b. If not, get property "directly" - - And the same for property setting. - - Now that _pygi_lookup_property_from_g_type is always passed the - type that - implements the property, it no longer has to go recursing through - parent - classes, which was the original cause of confusion. - - https://bugzilla.gnome.org/show_bug.cgi?id=686942 - - gi/_gobject/pygobject.c | 92 +++++++++++++++++++++++---------- - gi/pygi-property.c | 130 - ++++++++++++++++++++++------------------------- - gi/pygi-property.h | 4 +- - gi/pygi.h | 12 ++--- - tests/test_properties.py | 30 +++++++++++ - 5 files changed, 164 insertions(+), 104 deletions(-) - -commit efcb0f9fda65e24ae98438d61487d06db9eac1b1 -Author: Martin Pitt -Date: Sat Nov 3 16:14:01 2012 +0100 - - Move property and signal creation into _class_init() - - We must not add class interfaces after g_type_class_ref() has been - called the - first time. Move signal and property creation from pyg_type_register() - into - pyg_object_class_init(), and drop the hack of registering interfaces - twice. - - This changed class initialization order now exposes GLib's warning - about - unknown signals, so adjust - test_signal.TestGSignalsError.test_invalid_name() to - not abort on that. - - https://bugzilla.gnome.org/show_bug.cgi?id=686149 - - gi/_gobject/gobjectmodule.c | 177 - ++++++++++++++++++-------------------------- - tests/test_signal.py | 6 +- - 2 files changed, 75 insertions(+), 108 deletions(-) - -commit 655a5002ffaa088b775adbc59e5125444f7bc1ca -Author: Jose Rostagno -Date: Sat Nov 3 13:21:52 2012 -0300 - - Remove unused macro definitions - - PYGLIB_*_VERSION are not used anywhere any more, remove those. - (dropped in commit 8d52bceb1) - - gi/_glib/glibmodule.c | 5 ----- - 1 file changed, 5 deletions(-) - -commit fa054fd15b8874760bee97d9af168a2969e6ece4 -Author: Martin Pitt -Date: Mon Nov 5 14:38:07 2012 +0100 - - testhelpermodule.c: Drop obsolete g_thread_init() - - We already require a new enough glib version as we dropped - g_thread_init() in - the main code a long time ago. But for formality's sake, bump glib - requirement - to >= 2.32. - - configure.ac | 4 ++-- - tests/testhelpermodule.c | 1 - - 2 files changed, 2 insertions(+), 3 deletions(-) - -commit 2e57530a27a44e94927d487cf2f2d9e543777654 -Author: Martin Pitt -Date: Mon Nov 5 14:37:11 2012 +0100 - - pygi-source.c: Drop dead code - - gi/pygi-source.c | 2 -- - 1 file changed, 2 deletions(-) - -commit 2a24c9ccd59bff719fa817a0ec5c959f6da03e1c -Author: Simon Feltman -Date: Sun Nov 4 22:22:53 2012 -0800 - - Move TYPE constants from _gobject to GObject - - Clear out TYPE constants from _gobject/__init__.py and move them - into the - GObject overrides. Disperse class imports among modules that use - them instead - of using _gobject/__init__.py as a staging area (e.g. GInterface). - - https://bugzilla.gnome.org/show_bug.cgi?id=687487 - - gi/_gobject/__init__.py | 30 ------------------------------ - gi/_gobject/constants.py | 2 +- - gi/module.py | 38 +++++++++++++++++++++++++------------- - gi/overrides/__init__.py | 9 ++++++--- - gi/types.py | 10 ++++++---- - 5 files changed, 38 insertions(+), 51 deletions(-) - -commit c2aa6f0d0ed4c4e60f081b106dc7a65513963fce -Author: Martin Pitt -Date: Mon Nov 5 13:10:05 2012 +0100 - - Move G_MIN/MAX constants into GObject overrides - - These really ought to come from GLib's typelib, but are not right - now so we - need to keep the static bindings for those. But drop them from - gi/_gobject/ and - move them into the overrides where they belong. - - gi/_gobject/__init__.py | 17 ----------------- - gi/_gobject/constants.py | 21 --------------------- - gi/_gobject/propertyhelper.py | 2 +- - gi/overrides/GObject.py | 9 +++++++++ - tests/test_gi.py | 32 ++++++++++++++++---------------- - 5 files changed, 26 insertions(+), 55 deletions(-) - -commit 12b84727edc36f686a7031b5c4c6bf662838908d -Author: Martin Pitt -Date: Mon Nov 5 11:04:54 2012 +0100 - - Replace static OPTION_* constants with GI - - Drop static definitions of GLib.OPTION_* constants and use the ones - from GI - instead. - - https://bugzilla.gnome.org/show_bug.cgi?id=686765 - - gi/_glib/__init__.py | 13 ------------- - gi/_glib/glibmodule.c | 32 -------------------------------- - gi/_glib/option.py | 46 - ++++++++++++++++++++++++---------------------- - gi/overrides/GLib.py | 13 +++++++++++++ - gi/overrides/GObject.py | 2 +- - 5 files changed, 38 insertions(+), 68 deletions(-) - -commit 7372e3c9ecb8e836894c32975eab8c4107ba0b28 -Author: Martin Pitt -Date: Mon Nov 5 10:14:52 2012 +0100 - - tests: Do not use deprecated assertRaisesRegexp() - - Use assertRaisesRegex() instead and provide 2.7 compatibility in - tests/runtests.py. - - tests/runtests.py | 3 +++ - tests/test_signal.py | 8 ++++---- - 2 files changed, 7 insertions(+), 4 deletions(-) - -commit da2106902eb3dabebdff1674743cb3040566a745 -Author: Simon Feltman -Date: Sun Nov 4 02:57:29 2012 -0800 - - Move gobject static functions and constants to gi - - Replace the following functions with gi and overrides: - type_children, type_interfaces, signal_list_ids, signal_list_names, - signal_lookup, signal_name, type_parent. Assign SIGNAL_* and - PARAM_* from gi SignalFlags and ParamFlags respectively. - Move module level assignments of a number of static functions to - the GObject.py overrides file. - - https://bugzilla.gnome.org/show_bug.cgi?id=687487 - - docs/reference/pygobject-functions.xml | 25 --- - gi/_gobject/__init__.py | 72 +-------- - gi/_gobject/gobjectmodule.c | 272 - --------------------------------- - gi/overrides/GObject.py | 208 ++++++++++++++++++++++++- - gi/overrides/__init__.py | 5 +- - tests/test_signal.py | 11 +- - 6 files changed, 215 insertions(+), 378 deletions(-) - -commit f4acd6a9d14248d459708f61fd01f6d4735f087d -Author: Simon Feltman -Date: Sun Nov 4 02:52:19 2012 -0800 - - Make unitests for gobject functions moving to gi more strict - - Add expected failure test for invalid SystemError's coming from - signal_lookup and signal_list_ids. Remove excessive type_name - tests and type_from_name tests. - - https://bugzilla.gnome.org/show_bug.cgi?id=687487 - - tests/test_gtype.py | 53 - ---------------------------------------------------- - tests/test_signal.py | 40 ++++++++++++++++++++++++--------------- - 2 files changed, 25 insertions(+), 68 deletions(-) - -commit 3267808318b284814e52f2803b17af56fca648ad -Author: Martin Pitt -Date: Sat Nov 3 14:17:25 2012 +0100 - - [API change] Remove static filename_from_utf8() binding - - Replace static GLib.filename_from_utf8() with GI. The old static - binding always - tried to convert the result to an Unicode object, which will fail - if the result - is not UTF-8 encoded (which is the whole point of this function - really!), so - return bytes now. - - Although the static binding was rather useless before, this is - technically an - API break. - - docs/reference/pyglib-functions.xml | 32 -------------------------------- - gi/_glib/__init__.py | 1 - - gi/_glib/glibmodule.c | 26 -------------------------- - gi/_gobject/__init__.py | 1 - - gi/overrides/GLib.py | 8 ++++++++ - gi/overrides/GObject.py | 3 ++- - tests/test_glib.py | 8 ++++++++ - 7 files changed, 18 insertions(+), 61 deletions(-) - -commit 8d52bceb1e0aa0dc79cf77f36dda9f953f170459 -Author: Martin Pitt -Date: Sat Nov 3 13:14:15 2012 +0100 - - Drop static glib_version and pyglib_version constants - - Use the GLib version from GI instead, and the already existing - gi.version_info. - - docs/reference/pyglib-constants.xml | 50 - ---------------------------------- - docs/reference/pygobject-constants.xml | 19 ------------- - gi/_glib/__init__.py | 2 -- - gi/_glib/glibmodule.c | 21 -------------- - gi/_gobject/__init__.py | 1 - - gi/overrides/GLib.py | 8 +++++- - gi/overrides/GObject.py | 3 +- - tests/test_glib.py | 12 ++++++++ - 8 files changed, 21 insertions(+), 95 deletions(-) - -commit 9f96325e75f7c5f88789ea3f74a068e73cfde1a2 -Author: Martin Pitt -Date: Sat Nov 3 12:12:44 2012 +0100 - - Drop static G_MININT8 and related constants - - Use the introspected constants from GLib instead. - - gi/_gobject/__init__.py | 12 ------------ - gi/_gobject/constants.py | 12 ------------ - gi/_gobject/gobjectmodule.c | 18 +----------------- - gi/overrides/GObject.py | 17 +++++++++++++++++ - tests/test_gobject.py | 4 ++++ - 5 files changed, 22 insertions(+), 41 deletions(-) - -commit 3354c4eda0f098d1a8f744264ef9a2565a38b50d -Author: Martin Pitt -Date: Sat Nov 3 11:58:40 2012 +0100 - - test_gobject: Add test case for min/max int constants - - Related to https://bugzilla.gnome.org/show_bug.cgi?id=685022 - - tests/test_gobject.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit d70cb32789e057fe5a16e61a0cce77d9c54a3ee1 -Author: Jose Rostagno -Date: Sat Oct 27 15:37:32 2012 -0300 - - Use g_object_info_find_signal() - - Replace our custom code with a call to the corresponding - gobject-instrospection - function. - - https://bugzilla.gnome.org/show_bug.cgi?id=687371 - - gi/pygi-signal-closure.c | 21 ++++----------------- - 1 file changed, 4 insertions(+), 17 deletions(-) - -commit ae6d0aada9587cd4dca168375527b80785b604a0 -Author: Martin Pitt -Date: Sat Nov 3 11:23:06 2012 +0100 - - GLib overrides: code cleanup - - Factorize the logic to handle zero or multiple user_data arguments - into - user_data_varargs_shim(), and put code that handles deprecated API - into the - corresponding "then" branches, to improve readability. - - gi/overrides/GLib.py | 87 - ++++++++++++++++++++++++++++------------------------ - 1 file changed, 47 insertions(+), 40 deletions(-) - -commit d7f095b01e7208273703c880f4f0dfcc1a152a9a -Author: Martin Pitt -Date: Sat Nov 3 09:33:08 2012 +0100 - - Restore actual GLib API after previous fix - - Re-fix the acceptance of priority as first argument for idle_add(), - io_add_watch() and timeout_add(), as that is the real GLib API. Ensure - that - this keeps supporting the backwards compatible API with supplying - multiple user - data arguments. - - https://bugzilla.gnome.org/show_bug.cgi?id=687047 - - gi/overrides/GLib.py | 117 - +++++++++++++++++++++++++----------------------- - tests/test_iochannel.py | 74 +++++++++++++++++++++++++++--- - tests/test_source.py | 30 +++++++++++++ - 3 files changed, 158 insertions(+), 63 deletions(-) - -commit 648b653d85bf3bc28dc59c6d309f15d388076af9 -Author: Simon Feltman -Date: Fri Nov 2 21:01:38 2012 -0700 - - Add unittests for module level type and signal functions - - Add tests for the following methods: signal_list_ids, - signal_name, signal_lookup, signal_query, type_children, - type_from_name, type_name, type_is_a, and type_interfaces. - - https://bugzilla.gnome.org/show_bug.cgi?id=687487 - - tests/Makefile.am | 1 + - tests/test_gtype.py | 106 - +++++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_signal.py | 43 +++++++++++++++++++++ - 3 files changed, 150 insertions(+) - -commit 80db2a50feab9898d7c5f88ea27aadc3dfb5bec3 -Author: Simon Feltman -Date: Tue Oct 30 18:33:44 2012 -0700 - - Fix GLib override incompatibilities with old static API - - Change idle_add, timeout_add, timeout_add_seconds, and - io_add_watch to accept *args and **kwargs as arguments - to the callback functions instead of only accepting a single - user_data arg. This ensures the new overridden introspection - methods are backwards compatible with the static versions - they replaced. - - https://bugzilla.gnome.org/show_bug.cgi?id=687047 - - gi/overrides/GLib.py | 98 - ++++++++++++++++++++++++++++--------------------- - tests/test_iochannel.py | 37 +++++++++++++++++-- - 2 files changed, 90 insertions(+), 45 deletions(-) - -commit 9c6399bbf75c312b1ef4933d079712ea5b05a935 -Author: Simon Feltman -Date: Tue Oct 30 12:01:44 2012 -0700 - - Fix IOChannel unittests for python 2.7 - - Use __future__ unicode_literals to minimize difference - between python 2.7 and 3. Comparisons need to encode arguments as - 'UTF-8' for testing readline operations. - Add backwards compatible "next" to support the python 2.7 iteration. - Change isinstance(channel, file) to hasattr(channel, 'fileno') to - support all python versions (and duck typing). - - https://bugzilla.gnome.org/show_bug.cgi?id=687047 - - gi/overrides/GLib.py | 4 +++- - tests/test_iochannel.py | 1 + - 2 files changed, 4 insertions(+), 1 deletion(-) - -commit 0f94a0a4ebd2bbfd06d8f9a2bb2b17dabf7678ef -Author: Martin Pitt -Date: Mon Oct 29 23:00:31 2012 +0100 - - Allow calling io_add_watch with a file object - - The old static bindings allowed that, so we need to allow it to - maintain - backwards compatibility. Deprecate this mode as well, so that we - can get rid of - it at some point. - - https://bugzilla.gnome.org/show_bug.cgi?id=687047 - - gi/overrides/GLib.py | 7 +++++++ - tests/test_glib.py | 26 ++++++++++++++++++++++++++ - 2 files changed, 33 insertions(+) - -commit 3ba67fd41944309077eb81c4c03397519ed29dc4 -Author: John Ralls -Date: Mon Oct 29 14:57:22 2012 -0700 - - Fix duplicate symbols error on OSX - - gi/pygi-source.c | 1 + - 1 file changed, 1 insertion(+) - -commit 5a367aa067e369f2b1e713199614e3426fecc10e -Author: Martin Pitt -Date: Sun Oct 28 17:42:34 2012 +0100 - - Drop removed markup-escape-text() from reference documentation - - docs/reference/pyglib-functions.xml | 36 - ------------------------------------ - 1 file changed, 36 deletions(-) - -commit 057b3d3791e6f1947004f2482c0ae40529de03ae -Author: Martin Pitt -Date: Sun Oct 28 17:41:03 2012 +0100 - - Drop some dead code from gi/_glib/glibmodule.c - - gi/_glib/glibmodule.c | 45 --------------------------------------------- - 1 file changed, 45 deletions(-) - -commit 7b12803bce3418bb487127f497f022c973f35888 -Author: Martin Pitt -Date: Sun Oct 28 17:37:29 2012 +0100 - - Remove static get_current_time() binding - - Use GLib.get_real_time() through GI instead. Deprecate the function, - as - GLib.get_real_time() should be called directly. - - docs/reference/pyglib-functions.xml | 26 -------------------------- - gi/_glib/__init__.py | 1 - - gi/_glib/glibmodule.c | 11 ----------- - gi/_glib/pyglib.c | 16 ---------------- - gi/_glib/pyglib.h | 1 - - gi/_gobject/__init__.py | 1 - - gi/overrides/GLib.py | 8 ++++++++ - gi/overrides/GObject.py | 2 +- - tests/test_glib.py | 6 +++++- - 9 files changed, 14 insertions(+), 58 deletions(-) - -commit b3dfb780b3a74f6933e3afcd2ba512b36dfbe514 -Author: Martin Pitt -Date: Sun Oct 28 17:23:23 2012 +0100 - - Add more tests for GLib.spawn_async() - - Check spawn_async() with getting stdin/out/err pipes and specifying - envp. - - tests/test_subprocess.py | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - -commit 70d78eee4a04dcaefea4615fe351e33fa717dffa -Author: Martin Pitt -Date: Sun Oct 28 14:15:05 2012 +0100 - - Remove static child_add_watch() binding - - Use the GLib API through GI instead, and provide override to keep - backwards - compatible API. Also allow using the actual GLib API, and deprecate - the old - static API of calling without a priority as first argument. - - docs/reference/pyglib-functions.xml | 61 --------------------------- - gi/_glib/__init__.py | 1 - - gi/_glib/glibmodule.c | 72 ------------------------------- - gi/_gobject/__init__.py | 1 - - gi/overrides/GLib.py | 46 ++++++++++++++++++++ - gi/overrides/GObject.py | 2 +- - tests/test_mainloop.py | 2 +- - tests/test_subprocess.py | 84 - ++++++++++++++++++++++++++++++++++--- - 8 files changed, 127 insertions(+), 142 deletions(-) - -commit 4b16427714b850e33c6020d8de1833bae19a3b87 -Author: Martin Pitt -Date: Sun Oct 28 13:44:23 2012 +0100 - - test_subprocess: Cover more child_watch_add() cases - - Verify that priority is set correctly, and also test calling without - userdata. - - tests/test_subprocess.py | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) - -commit 83ff5938612d37d52f112867a472777dd6786d69 -Author: Colin Walters -Date: Sat Oct 27 12:22:53 2012 -0400 - - gi/__init__.py: Pacify pep8 style checker - - It was complaining about finding only 1 blank line. Regression - likely introduced by f976d05b. - - https://bugzilla.gnome.org/show_bug.cgi?id=686991 - - gi/__init__.py | 1 + - 1 file changed, 1 insertion(+) - -commit f976d05b04f26e733d19988e68989e340eb3a29e -Author: Martin Pitt -Date: Fri Oct 26 10:39:28 2012 +0200 - - Use a custom deprecation warning to make them visible by default - - DeprecationWarning is not shown by default, and is thus rather - useless for - developers. Use a custom PyGIDeprecationWarning class and derive - it from - RuntimeWarning to make it visible. - - gi/__init__.py | 5 +++++ - gi/overrides/GLib.py | 5 +++-- - gi/overrides/Gtk.py | 5 +++-- - gi/overrides/__init__.py | 4 ++-- - gi/pygtkcompat.py | 4 ++-- - tests/Makefile.am | 2 +- - tests/test_glib.py | 5 +++-- - tests/test_gobject.py | 3 ++- - tests/test_iochannel.py | 5 +++-- - tests/test_source.py | 3 ++- - 10 files changed, 26 insertions(+), 15 deletions(-) - -commit 366f5d2d3902c6293d0031e0b7dc5d6641a05ac7 -Author: Martin Pitt -Date: Fri Oct 26 09:26:17 2012 +0200 - - Remove static io_add_watch() binding - - Use the GLib API through GI instead, and provide override to keep - backwards - compatible API. Also allow using the actual GLib API, and deprecate - all other - variants: - - calling with an fd as first argument instead of an IOChannel - - calling without a priority as second argument - - docs/reference/pyglib-functions.xml | 106 - ------------------------------------ - gi/_glib/__init__.py | 1 - - gi/_glib/glibmodule.c | 98 - --------------------------------- - gi/_gobject/__init__.py | 1 - - gi/overrides/GLib.py | 51 ++++++++++++++--- - gi/overrides/GObject.py | 3 +- - tests/test_glib.py | 15 ++++- - tests/test_iochannel.py | 70 +++++++++++++++++++++++- - 8 files changed, 126 insertions(+), 219 deletions(-) - -commit 284de1eb5c37a3f6caa7d846dbd439f1eac410a2 -Author: Martin Pitt -Date: Fri Oct 26 08:48:35 2012 +0200 - - Add tests for GLib.io_add_watch() - - tests/test_glib.py | 36 ++++++++++++++++++++++++++++++++++++ - 1 file changed, 36 insertions(+) - -commit 15e717ce2c2a26c02c913f79bc7cf6876d943e92 -Author: Martin Pitt -Date: Thu Oct 25 15:55:46 2012 +0200 - - Remove static GIOChannel bindings - - Use the GLib API through GI instead, and provide overrides to keep - backwards - compatible API, including its bugs. - - We still need to keep a static wrapper around - g_io_channel_read_chars() until - we teach PyGObject to correctly handle caller allocated out array - arguments. - - https://bugzilla.gnome.org/show_bug.cgi?id=686795 - - gi/_glib/Makefile.am | 2 - - gi/_glib/__init__.py | 1 - - gi/_glib/glibmodule.c | 2 - - gi/_glib/pygiochannel.c | 748 - ------------------------------------------------ - gi/_glib/pygiochannel.h | 29 -- - gi/_gobject/__init__.py | 1 - - gi/gimodule.c | 72 +++++ - gi/overrides/GLib.py | 95 +++++- - 8 files changed, 161 insertions(+), 789 deletions(-) - -commit 0bfa6b44b808d9f8f55199216c29c1aec96c7719 -Author: Martin Pitt -Date: Thu Oct 25 12:59:46 2012 +0200 - - test_iochannel.py: Fix data type of IOFlags - - ~GLib.IOFlags.NONBLOCK yields an int instead of a GLib.IOFlags, - so ensure that - the result is of type GLib.IOFlags again. - - tests/test_iochannel.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 25d12afd06863ce223a161ba1317bfe5503bca5c -Author: Martin Pitt -Date: Thu Oct 25 08:24:31 2012 +0200 - - Add environment variable to disable pep8 checks - - pep8 takes quite long for "make check". Skip it if $SKIP_PEP8 is - set, which - makes the test/fix turnaround time faster. - - tests/Makefile.am | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -commit e9624ed1d38c777de2b430e3b0fbae2acbf34956 -Author: Simon Feltman -Date: Wed Oct 24 04:31:26 2012 -0700 - - [API add] Add get_introspection_module for getting un-overridden - modules - - Add gi.module.get_introspection_module to explicitly get a - wrapped module pulled in through introspection without static - and python override handling. This API is intended for python - overrides to use rather than having them access - gi.importer.modules['']._introspection_module directly. - Replace aforementioned usage in all overrides. - - https://bugzilla.gnome.org/show_bug.cgi?id=686828 - - gi/module.py | 38 - +++++++++++++++++++++++++++++++++++--- - gi/overrides/GIMarshallingTests.py | 4 ++-- - gi/overrides/GLib.py | 4 ++-- - gi/overrides/Gdk.py | 6 +++--- - gi/overrides/Gio.py | 4 ++-- - gi/overrides/Gtk.py | 5 +++-- - gi/overrides/Pango.py | 4 ++-- - tests/test_overrides.py | 29 +++++++++++++++++++++++++++++ - 8 files changed, 78 insertions(+), 16 deletions(-) - -commit e6e047ef9b8575c852b3cdc3f5d4dfbb548cc648 -Author: Martin Pitt -Date: Wed Oct 24 15:16:13 2012 +0200 - - test_option: Use public API - - Use GLib.option, not gi._glib.option. - - tests/test_option.py | 42 ++++++++++++++++++++---------------------- - 1 file changed, 20 insertions(+), 22 deletions(-) - -commit 6a586af41b8740c4ba590591d1068d80071ff2dc -Author: Martin Pitt -Date: Wed Oct 24 14:12:05 2012 +0200 - - Drop static SPAWN_* constants - - Use the introspected constants instead, which are identical. Add - backwards - compatible aliases. - - These constants are covered by tests/test_subprocess.py. - - https://bugzilla.gnome.org/show_bug.cgi?id=686765 - - docs/reference/pyglib-constants.xml | 68 - ---------------------------------- - docs/reference/pyglib-functions.xml | 26 ++++++------- - docs/reference/pygobject-constants.xml | 67 - --------------------------------- - gi/_glib/__init__.py | 7 ---- - gi/_glib/glibmodule.c | 15 -------- - gi/_gobject/__init__.py | 7 ---- - gi/overrides/GLib.py | 6 +++ - gi/overrides/GObject.py | 6 ++- - tests/test_subprocess.py | 6 ++- - 9 files changed, 29 insertions(+), 179 deletions(-) - -commit 0137a7af7bf69421e0c8e94120a1f8cff01fbeea -Author: Martin Pitt -Date: Wed Oct 24 13:59:31 2012 +0200 - - Drop static IO_* constants - - Use the introspected constants instead, which are identical. Add - backwards - compatible aliases. - - These constants are covered by tests/test_iochannel.py. - - docs/reference/pyglib-constants.xml | 52 - ------------------------------------- - gi/_glib/__init__.py | 19 -------------- - gi/_glib/glibmodule.c | 32 ----------------------- - gi/_gobject/__init__.py | 18 ------------- - gi/overrides/GLib.py | 18 ++++++++++++- - gi/overrides/GObject.py | 8 +++++- - tests/test_iochannel.py | 1 + - tests/test_source.py | 2 +- - 8 files changed, 26 insertions(+), 124 deletions(-) - -commit 0e1a6ccee45ae2239da1c44de1866596343165ba -Author: Martin Pitt -Date: Wed Oct 24 12:50:50 2012 +0200 - - Fix various bugs in GLib.IOChannel - - - Fix segfault when using an IOChannel as an iterator: PyIter_Next() - returns - NULL on the last element, instead of raising a StopIteration. - - - The default encoding of a stream is 'UTF-8', not NULL. NULL means - that the - stream is being used in binary mode; in that case, we should not - attempt to - do any automagic conversion to an Unicode object. As this special - case is - inconsistent and has never worked anyway, and the current buggy - implementation breaks binary streams, just drop it without - replacement. - (Introduced in commit de9eae4dfcce8) - - These bugs were uncovered by the previously committed tests. - - gi/_glib/pygiochannel.c | 25 +++++-------------------- - 1 file changed, 5 insertions(+), 20 deletions(-) - -commit a98c37937a4f7cb81a0b02c023d12097f386a22c -Author: Martin Pitt -Date: Wed Oct 24 12:49:04 2012 +0200 - - Add tests for GLib.IOChannel - - This did not have any code coverage at all. The tests uncover a - range of bugs, - which will be fixed in the next commit. - - tests/Makefile.am | 1 + - tests/test_iochannel.py | 262 - ++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 263 insertions(+) - -commit 1b27432abf6004553e9476d5ffeb2bf603534419 -Author: Martin Pitt -Date: Wed Oct 24 08:50:37 2012 +0200 - - Remove static idle_add/timeout_add bindings - - Use the GLib functions through GI instead. Add overrides to ensure - that default - arguments continue to work as before, and that callbacks are called - without an - userdata argument if it wasn't specified. - - docs/reference/pyglib-functions.xml | 165 - ------------------------------------ - gi/_glib/__init__.py | 3 - - gi/_glib/glibmodule.c | 139 ------------------------------ - gi/_gobject/__init__.py | 3 - - gi/overrides/GLib.py | 31 +++++++ - gi/overrides/GObject.py | 3 +- - tests/test_source.py | 19 +++++ - 7 files changed, 52 insertions(+), 311 deletions(-) - -commit 2357f4a0237feabcf6886f2a448aa3f42f6781b9 -Author: Martin Pitt -Date: Wed Oct 24 09:14:57 2012 +0200 - - Add tests for priority argument of idle_add/timeout_add - - There is a potential to treat the priority as user data in a call like - "GLib.idle_add(cb, GLib.PRIORITY_HIGH)". The current static bindings - force - using a keyword argument for the priority (but silently ignore it - if you - specify both userdata and priority as a positional argument). - - Test the correct handling of priority as well. - - tests/test_source.py | 63 - ++++++++++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 59 insertions(+), 4 deletions(-) - -commit dceb4d60e210cb1531ad81935733a3f0be0c8edb -Author: Martin Pitt -Date: Wed Oct 24 08:40:50 2012 +0200 - - Drop old ChangeLog.pre-2.18 - - This is ancient by now, quite sizable, and the complete history can - always be - seen in the git log. - - ChangeLog.pre-2.18 | 3608 - ---------------------------------------------------- - Makefile.am | 1 - - 2 files changed, 3609 deletions(-) - -commit 127ef91f1563caa346bc2ac2adb064487a84e6a0 -Author: Martin Pitt -Date: Wed Oct 24 08:39:05 2012 +0200 - - Fix PEP-8 whitespace in previous commit - - tests/test_source.py | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 0bc0b55be0dae7528c2fc7439d672ad4e417335d -Author: Martin Pitt -Date: Wed Oct 24 08:33:49 2012 +0200 - - Add tests for idle_add()/timeout_add with and without user data - - This is implicitly spread over various test cases, but let's test - it explicitly - to ensure that the behaviour stays consistent when moving this to GI. - - tests/test_source.py | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - -commit d0a0332feb7946f4bb6b43211d6fe3ae67e7dba5 -Author: Martin Pitt -Date: Wed Oct 24 08:05:43 2012 +0200 - - tests: consitent naming style - - Stop mixing camel case and underline naming, use the latter - consistently - in all tests. - - tests/test_gobject.py | 64 - +++++++++++++++++++++++------------------------ - tests/test_interface.py | 4 +-- - tests/test_option.py | 14 +++++------ - tests/test_pygtkcompat.py | 32 ++++++++++++------------ - tests/test_signal.py | 10 ++++---- - tests/test_source.py | 23 ++++++++--------- - tests/test_subprocess.py | 2 +- - tests/test_thread.py | 2 +- - tests/test_unknown.py | 2 +- - 9 files changed, 76 insertions(+), 77 deletions(-) - -commit 4b460e2eb18b8340fe99252063fdb08b0c222968 -Author: Martin Pitt -Date: Wed Oct 24 07:28:10 2012 +0200 - - Work around wrong 64 bit constants in GLib Gir - - GLib's gir currently has wrong constants for MININT64 and MAXUINT64; - explicitly - set them in an override, until this gets fixed properly. - - https://bugzilla.gnome.org/show_bug.cgi?id=685022 - - gi/overrides/GLib.py | 8 ++++++++ - tests/test_gi.py | 9 +++++++++ - 2 files changed, 17 insertions(+) - -commit f30efd2619911c89ca873fac6bec06a1b60fab82 -Author: Martin Pitt -Date: Tue Oct 23 13:32:14 2012 +0200 - - Mark GLib.Source.get_current_time() as deprecated - - This method has been deprecated in GLib long ago. We have a workaround - implementation using GLib.get_real_time(), but eventually this should - go away. - - gi/overrides/GLib.py | 5 ++++- - tests/test_source.py | 8 +++++++- - 2 files changed, 11 insertions(+), 2 deletions(-) - -commit 483c86267f2623eaa88d6a9e685c96ec3ba4f121 -Author: Martin Pitt -Date: Tue Oct 23 08:56:19 2012 +0200 - - Mark GLib API that is exposed in GObject as deprecated - - A lot of API in GObject really belongs into GLib and is just there for - historical/backwards compatible reasons. Mark these methods as - deprecated so - that at some point we can drop them. - - gi/overrides/GObject.py | 3 ++- - gi/overrides/__init__.py | 13 +++++++++++++ - tests/test_gobject.py | 24 ++++++++++++++---------- - 3 files changed, 29 insertions(+), 11 deletions(-) - -commit 191cf45af44850fc29f2392ae2f0042aed6d13a9 -Author: Martin Pitt -Date: Fri Oct 19 09:55:05 2012 +0200 - - Remove static MainLoop, MainContext, and some GSource bindings - - glib's MainLoop and MainContext are fully introspectable these days, - so remove - our static bindings. This reduces our code, as well enables GLib - API which - hasn't been available through the static bindings before. - - This also requires dropping our custom static types for GLib Source, - Timeout, - and Idle. The latter two work fine with introspection and just - need tiny - overrides for a backwards compatible API. g_source_new() is not - introspectable, - though, so we need to keep our static wrappers for that. Move - them from - gi/_glib/pygsource.c to gi/pygi-source.c, so that it can use the - GI API. - - Note that gi/_glib/pygsource.[hc] is still required for the static - PollFD type - which is used by the static IOChannel binding. Once the latter - goes away, - PollFD can be dropped as well. - - https://bugzilla.gnome.org/show_bug.cgi?id=686443 - - docs/Makefile.am | 6 +- - docs/reference/pyglib-classes.xml | 2 - - docs/reference/pyglib-constants.xml | 53 --- - docs/reference/pyglib-functions.xml | 58 --- - docs/reference/pyglib-maincontext.xml | 152 -------- - docs/reference/pyglib-mainloop.xml | 202 ----------- - gi/Makefile.am | 2 + - gi/_glib/Makefile.am | 4 - - gi/_glib/__init__.py | 12 - - gi/_glib/glibmodule.c | 45 +-- - gi/_glib/pyglib.c | 15 - - gi/_glib/pyglib.h | 1 - - gi/_glib/pygmaincontext.c | 126 ------- - gi/_glib/pygmaincontext.h | 40 --- - gi/_glib/pygmainloop.c | 362 ------------------- - gi/_glib/pygmainloop.h | 36 -- - gi/_glib/pygsource.c | 640 - ---------------------------------- - gi/_glib/pygsource.h | 3 - - gi/_gobject/__init__.py | 13 - - gi/gimodule.c | 9 + - gi/overrides/GLib.py | 116 +++++- - gi/overrides/GObject.py | 10 +- - gi/pygi-private.h | 1 + - gi/pygi-source.c | 247 +++++++++++++ - gi/pygi-source.h | 31 ++ - tests/test_glib.py | 22 +- - tests/test_gobject.py | 2 + - tests/test_source.py | 3 - - 28 files changed, 437 insertions(+), 1776 deletions(-) - -commit 326218a20681c1f2234a6eea1ed800382be57626 -Author: Simon Feltman -Date: Wed Sep 19 15:37:14 2012 -0700 - - Deprecate void pointer fields as general PyObject storage. - - Complete deprecation of gpointer struct fields as general - PyObject storage. Only int types are now allowed. - Assignment of anything other than an int or None raises - a TypeError stating the error and associated bug URL. - - https://bugzilla.gnome.org/show_bug.cgi?id=683599 - - gi/pygi-argument.c | 25 ++++++++++++++++----- - gi/pygi-info.c | 28 ++++-------------------- - tests/test_everything.py | 53 - +++++++++++++++++++++++++-------------------- - tests/test_overrides_gtk.py | 41 ----------------------------------- - 4 files changed, 54 insertions(+), 93 deletions(-) - -commit 3dba328010a4ffd9259700ffec95871c7341d491 -Author: Martin Pitt -Date: Tue Oct 23 11:59:08 2012 +0200 - - Add some MainLoop, MainContext, and Source test cases - - These cover the remaining static API and behaviour, so that we - have good - regression tests for converting them to GI. - - See https://bugzilla.gnome.org/show_bug.cgi?id=686443 - - tests/test_glib.py | 21 +++++++++++++++++++++ - tests/test_gobject.py | 11 +++++++++++ - tests/test_mainloop.py | 16 ++++++++++++++++ - tests/test_source.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 92 insertions(+) - -commit 7635340271df0a135873459e6a2a365fd4b187a2 -Author: Steve Frécinaux -Date: Wed Feb 9 18:37:33 2011 +0100 - - [API change] Do not bind gobject_get_data() and gobject_set_data() - - They will basically cause a crash if misused, and you can always use a - python member attribute instead. - - These methods were marked as deprecated for 3.4 and throwing a - warning, so - let's remove them for good now. - - https://bugzilla.gnome.org/show_bug.cgi?id=641944 - - Co-Authored-By: Martin Pitt - - docs/reference/pygobject.xml | 63 - -------------------------------------------- - gi/_gobject/pygobject.c | 44 ------------------------------- - 2 files changed, 107 deletions(-) - -commit cfec113e3b3eabf8db834f48b2f16792d1e841a3 -Author: Martin Pitt -Date: Tue Oct 23 08:17:40 2012 +0200 - - Add test for GLib.get_current_time() - - This adds a plausibility test, as well as ensuring the documented - return type. - This will be useful if/once we drop the static _glib binding. - - tests/test_glib.py | 5 +++++ - 1 file changed, 5 insertions(+) - -commit fb473b31054744e5ab59e9d4ed3b74571e27d3ff -Author: Martin Pitt -Date: Tue Oct 23 07:48:52 2012 +0200 - - Drop unnecessary static _glib bindings - - Drop static pyglib bindings which have straightforward and working - GLib GI - bindings. Add tests for all dropped functions to ensure they keep - working. - - docs/reference/pyglib-constants.xml | 59 ------- - docs/reference/pyglib-functions.xml | 270 ------------------------------ - gi/_glib/__init__.py | 24 --- - gi/_glib/glibmodule.c | 319 - ------------------------------------ - gi/_gobject/__init__.py | 9 - - gi/overrides/GLib.py | 16 ++ - gi/overrides/GObject.py | 32 ++++ - gi/overrides/Makefile.am | 1 + - tests/Makefile.am | 1 - - tests/test_glib.py | 46 ++++++ - tests/test_gobject.py | 4 + - tests/test_uris.py | 16 -- - 12 files changed, 99 insertions(+), 698 deletions(-) - -commit 126a10f765af3d3a6f08ce5db7ed9f3ef647848f -Author: Martin Pitt -Date: Tue Oct 23 06:12:08 2012 +0200 - - Fix OverflowError in source_remove() - - GSource IDs are unsigned, so we must use 'I' for parsing then, not - 'i'. - - https://bugzilla.gnome.org/show_bug.cgi?id=684526 - - gi/_glib/glibmodule.c | 2 +- - tests/test_source.py | 13 ++++++++++++- - 2 files changed, 13 insertions(+), 2 deletions(-) - -commit 15f7442bd0c45db25073e3d8494094f1c284ffa4 -Author: Martin Pitt -Date: Mon Oct 22 13:38:23 2012 +0200 - - Fix TestSource.testSources() test case - - PyGObject has established the assumption that the destruction of - a GLib.Source - Python object does not destroy the actual GSource, as shown in - TestSource.setup_timeout(), TestTimeout.test504337(), and - https://bugzilla.gnome.org/show_bug.cgi?id=504337. - - So we need to explicitly destroy our MySource and Idle objects - after using - them, as their callbacks always return True and we do not want them - to spill - over into other tests. - - Also fix the assertions to actually verify that MySources' callback - was callied - (pos > 0, not pos >= 0), and use the unittest comparison API instead - of a - simple assert statement. - - https://bugzilla.gnome.org/show_bug.cgi?id=686627 - - tests/test_source.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -commit b984a5fe0d065818a153f259db4dbde79534f084 -Author: Martin Pitt -Date: Mon Oct 22 17:38:56 2012 +0200 - - configure.ac: post-release bump to 3.7.2 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit ce0825f58c3eba6084143e430605ffb597622369 -Author: Martin Pitt -Date: Mon Oct 22 17:37:17 2012 +0200 - - release 3.7.1 - - NEWS | 42 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - -commit a93763337ba7f952d787c42f45bfbb3ff02cc80d -Author: Martin Pitt -Date: Mon Oct 22 17:33:12 2012 +0200 - - Bump version to 3.7.1 - - Let's follow the real GNOME versioning from now on. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3fb13cc05a281970c3a624c2dd152996031b482c -Author: Martin Pitt -Date: Mon Oct 22 11:36:49 2012 +0200 - - test_mainloop code cleanup - - Ensure that sys.excepthook is always restored, even if the test - fails. Use the - assert{True,False,Equal} unittest API instead of simple asserts for - more useful - failure messages. - - tests/test_mainloop.py | 19 ++++++++++--------- - 1 file changed, 10 insertions(+), 9 deletions(-) - -commit 31061f20083aa60919f6763a12addbf2b052cab7 -Author: Simon Feltman -Date: Sun Oct 21 18:55:24 2012 -0700 - - Change install_properties to not use getattr on classes - - The usage of getattr for accessing a classes __gproperties__ - variable can be problematic due to the potential of it returning - the parent classes variable when it does not exist on the sub-class. - Similar to the fix for - https://bugzilla.gnome.org/show_bug.cgi?id=686496, - cls.__dict__.get is used to ensure this does not happen. - - https://bugzilla.gnome.org/show_bug.cgi?id=686559 - - gi/_gobject/propertyhelper.py | 2 +- - tests/test_properties.py | 6 ++++-- - 2 files changed, 5 insertions(+), 3 deletions(-) - -commit 438d3e68f19e2af5d027e18842ab05e0421d088d -Author: Simon Feltman -Date: Sat Oct 20 19:56:04 2012 -0700 - - Move property install function into propertyhelper.py - - Move _install_properties() into gi/_gobject/propertyhelper.py - and add unittests. - - https://bugzilla.gnome.org/show_bug.cgi?id=686559 - - gi/_gobject/__init__.py | 45 +++---------------------------- - gi/_gobject/propertyhelper.py | 45 +++++++++++++++++++++++++++++++ - tests/test_properties.py | 63 - +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 111 insertions(+), 42 deletions(-) - -commit 695a9077aa8f40357e050f090caa5e2b8c5c9593 -Author: Simon Feltman -Date: Sat Oct 20 03:11:07 2012 -0700 - - Fix Signal decorator to not use base class gsignals dict - - Fix install_signals to not use the parent classes __gsignals__ - dict if one does not exist on the given class. - - https://bugzilla.gnome.org/show_bug.cgi?id=686496 - - gi/_gobject/signalhelper.py | 2 +- - tests/test_signal.py | 43 - +++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 44 insertions(+), 1 deletion(-) - -commit 1ff04e846d50b948df6fa3260c548ef4f4779c58 -Author: Martin Pitt -Date: Fri Oct 19 09:05:01 2012 +0200 - - tests: Consistently use GLib.MainLoop - - ... instead of mixing GObject.MainLoop and GLib.MainLoop. - - tests/test_everything.py | 4 ++-- - tests/test_gdbus.py | 11 +++++------ - 2 files changed, 7 insertions(+), 8 deletions(-) - -commit ff7e7401b4cf50532fef70263f7559ea513b8333 -Author: Kalev Lember -Date: Wed Oct 17 18:27:14 2012 +0200 - - Install the .egg-info files into correct multilib directory - - This makes sure the .egg-info files end up in the same python - top level - directory as the rest of the gi .py files. - - https://bugzilla.gnome.org/show_bug.cgi?id=686315 - - Makefile.am | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 91e4cb2063d4e83fb1f6586a4396471d64f234f4 -Author: Simon Feltman -Date: Mon Oct 15 04:03:50 2012 -0700 - - Fix leaked vfunc return values - - Simple fix to dec ref returned values from closures wrapping - python functions. - - https://bugzilla.gnome.org/show_bug.cgi?id=686140 - - gi/pygi-closure.c | 1 + - tests/test_gi.py | 21 +++++++++++++++++++-- - 2 files changed, 20 insertions(+), 2 deletions(-) - -commit 75e373b99c3cb66dd60b13c803e5f7eec77cc415 -Author: Martin Pitt -Date: Mon Oct 15 07:42:05 2012 +0200 - - Skip Regress tests with --disable-cairo - - We need cairo to build g-i's Regress library, gir, and typelib. Update - configure.ac to only require cairo if --disable-cairo was not - given. With - --disable-cairo, skip building the Regress library and skip all - tests which use - it. - - https://bugzilla.gnome.org/show_bug.cgi?id=685094 - - configure.ac | 5 ++--- - tests/Makefile.am | 45 - +++++++++++++++++++++++++++------------------ - tests/test_everything.py | 15 +++++++++++---- - tests/test_overrides.py | 7 ++++++- - 4 files changed, 46 insertions(+), 26 deletions(-) - -commit a2ab72aa39824579d1767d1fdba7e1031341f86c -Author: Martin Pitt -Date: Fri Oct 12 11:05:24 2012 +0200 - - _pygi_marshal_from_py_uint64: Re-fix check of negative values - - Fix regression from commit 1bfcd5d94 (exposed by several test cases) - when using - Python 2.x. - - https://bugzilla.gnome.org/show_bug.cgi?id=685000 - - gi/pygi-marshal-from-py.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 22c22124b787ae67638aff89796d7ce14900ea8e -Author: Simon Feltman -Date: Mon Oct 8 05:54:30 2012 -0700 - - Fix leak with python callables as closure argument. - - The fix adds an extra args_data list to the PyGIInvokeState - structure. This list is used to track dynamically generated - closures that wrap python callables. This allows the ffi closure - and python callable to be freed when call scope has finished. - - https://bugzilla.gnome.org/show_bug.cgi?id=685598 - - gi/pygi-cache.c | 1 + - gi/pygi-closure.c | 41 +++++++++---- - gi/pygi-invoke-state-struct.h | 4 ++ - gi/pygi-invoke.c | 7 +++ - gi/pygi-marshal-cleanup.c | 14 +++++ - gi/pygi-marshal-cleanup.h | 4 ++ - gi/pygi-marshal-from-py.c | 57 ++++++++++++++---- - tests/test_everything.py | 137 - +++++++++++++++++++++++++++++++----------- - 8 files changed, 206 insertions(+), 59 deletions(-) - -commit c0bc69906df2db64560f7c054277ad1956aab57f -Author: Martin Pitt -Date: Thu Oct 11 17:49:30 2012 +0200 - - Gio overrides: Handle setting GSettings enum keys - - https://bugzilla.gnome.org/show_bug.cgi?id=685947 - - gi/overrides/Gio.py | 9 ++++++++- - tests/test_overrides_gio.py | 3 +++ - 2 files changed, 11 insertions(+), 1 deletion(-) - -commit bbbb7c9ed047a22ac3c43f2b0331d3b5ea32e812 -Author: Martin Pitt -Date: Thu Oct 11 17:20:38 2012 +0200 - - tests: Check reading GSettings enums in Gio overrides - - Also split test_override() into several smaller test cases. - - tests/org.gnome.test.gschema.xml | 9 +++++++++ - tests/test_overrides_gio.py | 14 +++++++++----- - 2 files changed, 18 insertions(+), 5 deletions(-) - -commit 8a2e96cd4e33b6c119a368d73a9d5504576cdccb -Author: Martin Pitt -Date: Thu Oct 11 16:08:11 2012 +0200 - - Fix unsigned values in GArray/GList/GSList/GHash - - _pygi_hash_pointer_to_arg() needs to handle unsigned integers as well. - - https://bugzilla.gnome.org/show_bug.cgi?id=685860 - - gi/pygi-argument.c | 9 +++++++++ - tests/test_gi.py | 12 ++++++++++++ - 2 files changed, 21 insertions(+) - -commit d394acbb58b38e6f52ee71e8e663a892676ab9e4 -Author: Colin Walters -Date: Thu Oct 4 20:13:55 2012 -0400 - - build: Fix srcdir != builddir - - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 1bfcd5d94b71edc9f03c8b3e87952a8bc8097586 -Author: Alban Browaeys -Date: Thu Sep 27 22:44:22 2012 +0200 - - _pygi_marshal_from_py_uint64(): Use correct data type in py2.7 check - - Casting an unsigned to signed and checking if positive was not - good. Check the - unsigned 64 is below G_MAXUINT64 instead. - - Side issue in https://bugzilla.gnome.org/show_bug.cgi?id=685000 - - gi/pygi-marshal-from-py.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit f0870336b9fc7797895f206e0d3ef17a19efe253 -Author: Johan Dahlin -Date: Tue Oct 2 05:30:16 2012 -0700 - - Install an .egg-info file - - This will help easy_install and pip to figure out that PyGObject - is already installed. - - https://bugzilla.gnome.org/show_bug.cgi?id=680138 - - Makefile.am | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -commit 4c9318d97aa34051a0460e8db2ed0f963126b7f5 -Author: Johan Dahlin -Date: Thu Oct 4 09:42:41 2012 +0200 - - PyGProps_getattro(): Fix GObjectClass leak - - https://bugzilla.gnome.org/show_bug.cgi?id=685218 - - gi/_gobject/pygobject.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit 2aa61520eb4f293ce94d54605d7642a39e18e03d -Author: Olivier Crête -Date: Mon Sep 17 15:16:32 2012 -0400 - - pygobject.c: Don't leak GObjectClass reference - - https://bugzilla.gnome.org/show_bug.cgi?id=684062 - - gi/_gobject/pygobject.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit 43d356d03d4c83e9de3c56f98a70d387b46f17af -Author: Alban Browaeys -Date: Sat Sep 29 01:17:14 2012 +0200 - - Fix memory leak in _pygi_argument_to_array() - - Length arg and type info need to be unref'ed. - - https://bugzilla.gnome.org/show_bug.cgi?id=685082 - - gi/pygi-argument.c | 3 +++ - 1 file changed, 3 insertions(+) - -commit 34270a109d2af20391c80e88874ee7303eaf5c09 -Author: Martin Pitt -Date: Fri Sep 28 07:42:51 2012 +0200 - - Fix error messages for out of range numbers - - PyErr_Format() does not understand %lli and %li, it needs to be %lld - and %ld. - So we cannot use those and G_GINT64_FORMAT. - - Also remove the "if (long_ < G_MININT64 || long_ > G_MAXINT64)" - check, as long_ - is a gint64 which can't possibly overflow its own data type. It - would also have - an unprintable error message. - - https://bugzilla.gnome.org/show_bug.cgi?id=684314 - - gi/pygi-marshal-from-py.c | 21 ++++++++------------- - 1 file changed, 8 insertions(+), 13 deletions(-) - -commit 7f1422bf929976722edd6144beb0b4c96d74391b -Author: Martin Pitt -Date: Fri Sep 28 06:59:38 2012 +0200 - - Kill dbus-daemon after running tests - - dbus-launch does not kill the spawned dbus-daemon by itself (see - https://bugs.freedesktop.org/show_bug.cgi?id=39196), so do that - after running - our tests. Take care to preserve the exit code. - - https://bugzilla.gnome.org/show_bug.cgi?id=685009 - - tests/Makefile.am | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit bfd9c8fac1ea240b29fbcd4185dc1702539c1e96 -Author: Martin Pitt -Date: Thu Sep 27 08:18:34 2012 +0200 - - GVariant overrides: Support empty tuple arrays - - Implement the "empty value" branch in _create_tuple(), so that - _create_array() - can call it for parsing the element type for an empty array. - - This fixes creating variants such as GLib.Variant('a(ii)', []). - - https://bugzilla.gnome.org/show_bug.cgi?id=684928 - - gi/overrides/GLib.py | 30 +++++++++++++++++++++++------- - tests/test_overrides_glib.py | 31 +++++++++++++++++++++++++++++++ - 2 files changed, 54 insertions(+), 7 deletions(-) - -commit 75d452ea5b179c3585adcf95356b4316c9180768 -Author: Martin Pitt -Date: Thu Sep 27 06:50:12 2012 +0200 - - TestGVariant: Split creation test case into several smaller ones - - tests/test_overrides_glib.py | 20 ++++++-------------- - 1 file changed, 6 insertions(+), 14 deletions(-) - -commit 4a20bcb3f97614044d351f8e436a81d332db55ba -Author: Martin Pitt -Date: Tue Sep 25 09:10:10 2012 +0200 - - Fix unused variables and results - - This gets rid of all warnings except the deprecated symbol ones. - - gi/_glib/pygiochannel.c | 9 +++------ - gi/pygi-argument.c | 4 +--- - gi/pygi-callbacks.c | 4 ---- - gi/pygi-ccallback.c | 1 - - gi/pygi-repository.c | 3 +-- - 5 files changed, 5 insertions(+), 16 deletions(-) - -commit 5285f14fee93d2729d4422c40a945adc2be69c14 -Author: Martin Pitt -Date: Tue Sep 25 08:56:20 2012 +0200 - - tests: Fix wrong return type in test_int64_callback() - - https://bugzilla.gnome.org/show_bug.cgi?id=684700 - - tests/testhelpermodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e14ebab6099d082466ec11ca21d44de0d6017216 -Author: Giovanni Campagna -Date: Wed Sep 19 00:10:57 2012 +0200 - - Fix GValue marshalling of long and unsigned long - - long can be equivalent to int64 or int32, depending on the - architecture, - and GI conflates this distinction in the typelib, but GType does - not, and - warns if the wrong accessor is used. - - https://bugzilla.gnome.org/show_bug.cgi?id=684331 - - gi/pygi-argument.c | 25 +++++++++++++++++++++---- - 1 file changed, 21 insertions(+), 4 deletions(-) - -commit 50571dd27d1f7c6bed8c5aaa518b504c9f4c4ab6 -Author: Simon Feltman -Date: Wed Sep 19 19:07:00 2012 -0700 - - Clean up deprecation message for assigning gpointers to objects. - - The previous deprecation message was worded as if the deprecation - had already occurred and it has not. - - https://bugzilla.gnome.org/show_bug.cgi?id=683599 - - gi/pygi-info.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 4bfe7972546413f46f5c36737ff03bb5612c1921 -Author: Olivier Crête -Date: Tue Sep 18 08:52:02 2012 +0200 - - pygi-property: Lookup property in base classes of non-introspected - types - - Look for introspection data in the base classes of non-introspected - gtypes. - This is necessary to look up introspection data for plugins. - - https://bugzilla.gnome.org/show_bug.cgi?id=684058 - - gi/pygi-property.c | 28 ++++++++++++++-------------- - tests/test_everything.py | 12 ++++++++++++ - 2 files changed, 26 insertions(+), 14 deletions(-) - -commit 7aa94cc861082147b9c382b930f3257f0a842c84 -Author: Martin Pitt -Date: Mon Sep 24 09:41:10 2012 +0200 - - post-release bump to 3.4.1 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit fcceed3adb8d78baba68861a1408627321b2c1ef -Author: Martin Pitt -Date: Mon Sep 24 09:35:33 2012 +0200 - - release 3.4.0 - - NEWS | 3 +++ - configure.ac | 4 ++-- - 2 files changed, 5 insertions(+), 2 deletions(-) - -commit 645a9d9d4712f8f0d1b63899b309bbc97eb1f216 -Author: Martin Pitt -Date: Mon Sep 24 09:27:47 2012 +0200 - - Bump g-i dependency to 1.33.14 - - To ensure we have all the Regress test APIs that we use. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b6f4ef327fbeaa10fd74571c3df540311834d6ae -Author: Martin Pitt -Date: Mon Sep 17 22:52:49 2012 +0200 - - post-release bump to 3.3.93 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 7e154cf01cf0ce7a8b52c45ba4db755f73b45d1d -Author: Martin Pitt -Date: Mon Sep 17 22:48:13 2012 +0200 - - release 3.3.92 - - NEWS | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -commit adbe30dc72b4d88bb31055f6ee33fddf32638af9 -Author: Martin Pitt -Date: Mon Sep 17 22:32:55 2012 +0200 - - release-news: Generate HTML changelog - - In addition to producing a NEWS paragraph from the changelog, - generate a - changelog HTML which can be put into blog announcements. - - Update HACKING to point this out, too. - - HACKING | 2 +- - Makefile.am | 22 ++++++++++++++++------ - 2 files changed, 17 insertions(+), 7 deletions(-) - -commit be4a0682bdd189ee908ab1961001f759a80e133c -Author: Simon Feltman -Date: Sun Sep 16 17:27:25 2012 -0700 - - [API add] Add ObjectInfo.get_abstract method - - Adds exposure of g_object_info_get_abstract to python for - helping with analysis of non-constructable objects from - within python. - - https://bugzilla.gnome.org/show_bug.cgi?id=675581 - - gi/pygi-info.c | 8 ++++++++ - tests/test_gi.py | 12 ++++++++++++ - 2 files changed, 20 insertions(+) - -commit 3ada408434860d0c8eee6c6a869b5a3d801cfbc8 -Author: Simon Feltman -Date: Thu Sep 13 20:53:22 2012 -0700 - - Add deprecation warning when setting gpointers to anything other - than int. - - This is a first pass which does not change anything except add - a warning - when anything other than an int is set on a gpointer on a boxed type. - - https://bugzilla.gnome.org/show_bug.cgi?id=683599 - - gi/pygi-info.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit a047f61f26d9c78b82d22948199313e5a389e918 -Author: Martin Pitt -Date: Mon Sep 17 09:41:24 2012 +0200 - - test_properties: Test accessing a property from a superclass - - We already cover accessing the superclass' property if that was - defined in - Python. Add a corresponding test case for a property defined in C. - - See https://bugzilla.gnome.org/show_bug.cgi?id=684058 - - tests/test_properties.py | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -commit 3e6a4000cbc4b0cb503fcd89b50202ed0b70d3a7 -Author: Martin Pitt -Date: Mon Sep 17 09:31:05 2012 +0200 - - test_properties.py: Consistent test names - - Use underscore style method/test case names consistently. Also rename - some test - cases to better describe what they do. - - tests/test_properties.py | 78 - ++++++++++++++++++++++++------------------------ - 1 file changed, 39 insertions(+), 39 deletions(-) - -commit 4069c3d8547f35437e0cee175a5912febe25326d -Author: Martin Pitt -Date: Wed Sep 12 06:51:24 2012 +0200 - - test_everything: Ensure TestSignals callback does get called - - tests/test_everything.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit 4e4c87e3868948743e0446abe2ba0cf5626374c4 -Author: Nicolas Dufresne -Date: Fri Sep 7 17:17:09 2012 -0400 - - argument: Fix 64bit integer convertion from GValue - - Trying to get a 64bit integer using the wrong getter was resulting - in an - assertion and 0 being returned. - - Co-Authored-By: Martin Pitt - - https://bugzilla.gnome.org/show_bug.cgi?id=683596 - - gi/pygi-argument.c | 8 ++++++-- - tests/test_everything.py | 52 - ++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 58 insertions(+), 2 deletions(-) - -commit e474ce243ea7a58358af344ccadb1418f4d2c8eb -Author: Martin Pitt -Date: Tue Sep 11 12:32:10 2012 +0200 - - Add Simon Feltman as a project maintainer - - Signed-off-By: Martin Pitt - Signed-off-By: Paolo Borelli - - pygobject.doap | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit ee1fc78258f10e8a7872ee3da6c9ad6e7984706e -Author: Martin Pitt -Date: Tue Sep 11 10:17:50 2012 +0200 - - test_signals.py: Drop global type variables - - Just use the real types and flags from GObject instead of redefining - aliases - for them. They weren't used consistently, make the tests harder to - read, and we - really do not want global single-letter variables like "f" and "l". - - tests/test_signal.py | 38 ++++++++++++++++---------------------- - 1 file changed, 16 insertions(+), 22 deletions(-) - -commit 3688cf6efe7161585b943cfaafcfd4610b7ad768 -Author: Martin Pitt -Date: Tue Sep 11 10:11:58 2012 +0200 - - test_signals.py: Consistent test names - - Use underscore style method/test case names consistently. - - tests/test_signal.py | 88 - ++++++++++++++++++++++++++-------------------------- - 1 file changed, 44 insertions(+), 44 deletions(-) - -commit 4559247553b792db956f69c9674c12344d719c82 -Author: Martin Pitt -Date: Tue Sep 11 09:43:14 2012 +0200 - - Add test cases for GValue signal arguments - - These cover various types, (u)int(64) and string. - - Keep the test case for implicit int64 GValues disabled, as this - currently does - not work and it is not clear whether it should: - https://bugzilla.gnome.org/show_bug.cgi?id=683775 - - tests/test_signal.py | 41 +++++++++++++++++++++++++++++++++++++++++ - tests/testhelpermodule.c | 17 +++++++++++++++++ - 2 files changed, 58 insertions(+) - -commit fddb01b0b71b68d154d130cf40fd5f38647b1a4d -Author: Martin Pitt -Date: Tue Sep 11 09:31:18 2012 +0200 - - Add test for GValue signal return values - - Another attempt to reproduce the reported error in - https://bugzilla.gnome.org/show_bug.cgi?id=683596 - but this works already. - - tests/test_signal.py | 13 +++++++++++++ - tests/testhelpermodule.c | 36 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 49 insertions(+) - -commit 4f77c7798563ea436ff5b6306a987f03de50b211 -Author: Simon Feltman -Date: Fri Sep 7 02:32:15 2012 -0700 - - Improve setting pointer fields/arguments to NULL using None - - Setting gi pointers will set them to the address of the python object. - This is good except in the case of None which should be used to NULL - the pointer out as a special case. - - Commit 21b1d17d2a already fixed this. This improved patch - does that in a cleaner and safer way and adds more comments. - - https://bugzilla.gnome.org/show_bug.cgi?id=683150 - - gi/pygi-argument.c | 8 +------- - gi/pygi-info.c | 14 +++++++++++++- - 2 files changed, 14 insertions(+), 8 deletions(-) - -commit 15046b5a11f6c58a3e5a9c50cf0ce7f31f2cd55f -Author: Martin Pitt -Date: Mon Sep 10 16:46:30 2012 +0200 - - Test gint64 C signal arguments and return values - - tests/test_signal.py | 12 ++++++++++++ - tests/testhelpermodule.c | 14 ++++++++++++++ - 2 files changed, 26 insertions(+) - -commit 822d9e07a95f706a40f64335765293542787da90 -Author: Martin Pitt -Date: Mon Sep 10 16:29:32 2012 +0200 - - Test in/out int64 GValue method arguments. - - See https://bugzilla.gnome.org/show_bug.cgi?id=683596 - - tests/test_gi.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit 2d83e52233812618493af4b165615e8741ba41c8 -Author: Martin Pitt -Date: Wed Sep 5 08:54:53 2012 +0200 - - Bump g-i dependency to 1.33.10 - - To ensure we have all the Regress test APIs that we use. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 6a4f4dc9a3d21c3ac8a0aa51432fb8952b4e1ebf -Author: Thibault Saunier -Date: Wed Aug 8 12:57:41 2012 -0400 - - Fix -uninstalled.pc.in file - - https://bugzilla.gnome.org/show_bug.cgi?id=683379 - - pygobject-3.0-uninstalled.pc.in | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit d8f1398dbc7fa7803639c542a607f24f18614ad6 -Author: Martin Pitt -Date: Mon Sep 3 22:16:47 2012 +0200 - - post-release bump to 3.3.92 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit ea992324b8197b2d04ff2849b9ab46f8a04b4ed7 -Author: Martin Pitt -Date: Mon Sep 3 22:04:01 2012 +0200 - - release 3.3.91 - - NEWS | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - -commit 1e1f5b2f2f15547c1f2cbc948d2b764bd0a37c44 -Author: Martin Pitt -Date: Mon Sep 3 21:57:00 2012 +0200 - - Fix exception test case for Python 2 - - Regression from commit 77844c5 which did not work with Python 2. - - tests/test_everything.py | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -commit 41bb687c058e08b05108b4b2f081cd83d4f93da8 -Author: Martin Pitt -Date: Mon Sep 3 21:16:01 2012 +0200 - - Bump g-i dependency - - Require at least 1.33.9, as we got a couple of bug fixes there which - the tests, - and for some cases the code, depend on. We actually require 1.33.10 - for all - tests to succeed, but that hasn't been released yet. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 77844c571ad0badc189428b93de9f2572051b67e -Author: Martin Pitt -Date: Mon Sep 3 17:58:38 2012 +0200 - - Show proper exception when trying to allocate a disguised struct - - Instead of a simple "MemoryError" with no details, raise a proper - TypeError with a traceback and an explanation what happened. - - https://bugzilla.gnome.org/show_bug.cgi?id=639972 - - gi/pygi-struct.c | 7 +++++++ - tests/test_everything.py | 13 +++++++++++++ - 2 files changed, 20 insertions(+) - -commit 0d099bdb3f4bbd962e5e60b583673d9e6f5673cc -Author: Mark Nauwelaerts -Date: Mon Sep 3 16:47:22 2012 +0200 - - Support marshalling GParamSpec signal arguments - - Fix marshalling GParamSpec arguments from C to Python. - - https://bugzilla.gnome.org/show_bug.cgi?id=683099 - - Co-Authored-By: Martin Pitt - - gi/pygi-argument.c | 10 +++++++++- - tests/test_signal.py | 14 ++++++++++++++ - 2 files changed, 23 insertions(+), 1 deletion(-) - -commit 69fb92c22b3f3d1d5e8c3e14134eee3242fdc5fc -Author: Martin Pitt -Date: Mon Sep 3 16:06:49 2012 +0200 - - Add test for a signal that returns a GParamSpec - - https://bugzilla.gnome.org/show_bug.cgi?id=683265 - - tests/test_signal.py | 6 ++++++ - tests/testhelpermodule.c | 12 ++++++++++++ - 2 files changed, 18 insertions(+) - -commit a7c524219987fbf37e455a91e4c78d2b9b4db12d -Author: Simon Feltman -Date: Tue Mar 20 04:33:50 2012 -0700 - - [API add] Add Signal class for adding and connecting custom signals. - - The Signal class provides easy creation of signals and removes the - need for __gsignals__ in client code. The Signal class can also be - used as a decorator for wrapping up the custom closure. As well as - providing a "BoundSignal" when accessed on an instance for making - connections without specifying a signal name string. - Python3 annotations can also be used to supply closure argument and - return types when Signal is used as a decorator. For example: - - class Eggs(GObject.GObject): - @GObject.Signal - def spam(self, count:int): - pass - - https://bugzilla.gnome.org/show_bug.cgi?id=434924 - - examples/signal.py | 34 ++++-- - gi/_gobject/Makefile.am | 3 +- - gi/_gobject/__init__.py | 5 + - gi/_gobject/signalhelper.py | 251 - ++++++++++++++++++++++++++++++++++++++++++++ - tests/test_signal.py | 208 ++++++++++++++++++++++++++++++++++-- - 5 files changed, 482 insertions(+), 19 deletions(-) - -commit 96fa22369fd188465559fc904c7f76e73040e6dd -Author: Martin Pitt -Date: Mon Sep 3 15:32:12 2012 +0200 - - Fix pygtkcompat's Gtk.TreeView.insert_column_with_attributes() - - We have a proper implementation for insert_column_with_attributes() - now, so - drop pygtkcompat's empty stub for it. - - Also improve test case for - Gtk.TreeView.insert_column_with_attributes(). - - gi/pygtkcompat.py | 6 ------ - tests/test_overrides_gtk.py | 16 ++++++++-------- - 2 files changed, 8 insertions(+), 14 deletions(-) - -commit 542cf22c9de9b2094868c4e879b0f24b15c4c012 -Author: Marta Maria Casetti -Date: Mon Sep 3 13:06:22 2012 +0200 - - Add override for Gtk.TreeView.insert_column_with_attributes() - - https://bugzilla.gnome.org/show_bug.cgi?id=679415 - - Co-Authored-By: Martin Pitt - - gi/overrides/Gtk.py | 7 +++++++ - tests/test_overrides_gtk.py | 38 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 45 insertions(+) - -commit 1c73e845361e471b1c3a3f17e40e6a6cfa740877 -Author: Martin Pitt -Date: Mon Sep 3 11:09:55 2012 +0200 - - .gitignore: Add missing built files - - .gitignore | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -commit 96431f393036a688666dcf67911bf12b9824b264 -Author: Martin Pitt -Date: Mon Sep 3 11:07:32 2012 +0200 - - Ship tests/gi in tarball - - Spotted by distcheck. - - tests/Makefile.am | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit dc2c6e6f60d2757462cbceef6176b0b3013904d3 -Author: Martin Pitt -Date: Mon Sep 3 10:18:45 2012 +0200 - - Fix separate build tree and distcheck - - Fix regression from c7c95a79: We must set sys.path in runtests.py - properly and - cannot rely on setting $PYTHONPATH from Makefile.am only. Python - always - prepends the directory of the source file to sys.path, but that - points to the - source dir, not the build dir. The build dir has to take precedence, - otherwise - we fail to import the built libraries. - - tests/runtests-windows.py | 10 +++++++--- - tests/runtests.py | 13 ++++++++----- - 2 files changed, 15 insertions(+), 8 deletions(-) - -commit 2d8f48f4ff56bb75985136452b50b75895258608 -Author: Martin Pitt -Date: Mon Sep 3 07:57:01 2012 +0200 - - Split test_overrides.py - - Split the huge test_overrides.py into separate files for gdk, gtk, - gio, glib, - and pango. Further split the monolithic classes for Gtk and Gio - into several - ones. - - https://bugzilla.gnome.org/show_bug.cgi?id=683188 - - tests/Makefile.am | 5 + - tests/test_overrides.py | 2198 - +---------------------------------------- - tests/test_overrides_gdk.py | 119 +++ - tests/test_overrides_gio.py | 114 +++ - tests/test_overrides_glib.py | 445 +++++++++ - tests/test_overrides_gtk.py | 1517 ++++++++++++++++++++++++++++ - tests/test_overrides_pango.py | 32 + - 7 files changed, 2234 insertions(+), 2196 deletions(-) - -commit 1223358e2c558dd7ac3300126f989054ec5a5b3f -Author: Martin Pitt -Date: Mon Sep 3 07:17:57 2012 +0200 - - _pygi_argument_to_object(): Clean up array unmarshalling - - The NULL case is already handled at the top, so it does not need to be - re-checked again. - - Emit a critical if we fail to allocate a Python array of the - requested size. - - gi/pygi-argument.c | 47 ++++++++++++++++------------------------------- - 1 file changed, 16 insertions(+), 31 deletions(-) - -commit 65bfbc624bc9da6e18ff2945b14099ab8eeb7601 -Author: Alban Browaeys -Date: Wed Aug 29 21:24:17 2012 +0200 - - Fix memory leak in _pygi_argument_to_object() - - Avoid leaking the item_type_info when breaking out of the - switch in _pygi_argument_to_object() for unmarshalling arrays. - - https://bugzilla.gnome.org/show_bug.cgi?id=682979 - - gi/pygi-argument.c | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 21b1d17d2ada2edf4063a4262b3436c279da3dc2 -Author: Simon Feltman -Date: Sat Sep 1 03:40:31 2012 -0700 - - Fix setting pointer fields/arguments to NULL using None. - - Setting gi pointers will set them to the address of the python object. - This is good except in the case of None which should be used to NULL - the pointer out as a special case. - - https://bugzilla.gnome.org/show_bug.cgi?id=683150 - - gi/pygi-argument.c | 8 +++++++- - tests/test_overrides.py | 41 +++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 48 insertions(+), 1 deletion(-) - -commit 6123e6f5001ca5eaea18123d8a53525abab31a45 -Author: Martin Pitt -Date: Thu Aug 23 06:44:27 2012 +0200 - - Fix for python 2.6, drop support for < 2.6 - - Replace sys.version_info.major access to tuple access which also - works for - Python 2.6. - - When building for Python 2.6, inject some missing unittest API such as - @unittest.skipUnless and assertGreaterEqual() into the unittest - module in - runtests.py, so that the tests have a chance to run. - - As building with Python 2.5 has been broken for a long time with - nobody - complaining, and 2.5 is ancient, bump minimum Python requirement to - 2.6. Drop - obsolete #ifdef paths which only apply to <= 2.5. - - https://bugzilla.gnome.org/show_bug.cgi?id=682422 - - configure.ac | 2 +- - gi/_glib/pyglib-python-compat.h | 8 -------- - gi/_gobject/gobjectmodule.c | 8 -------- - gi/module.py | 2 +- - tests/runtests.py | 27 +++++++++++++++++++++++++++ - tests/test_gi.py | 2 +- - 6 files changed, 30 insertions(+), 19 deletions(-) - -commit b1a9848a7a7255e6b1ccd98712dd62b1514078b9 -Author: Thibault Saunier -Date: Tue Aug 21 07:54:09 2012 +0200 - - Allow overrides in other directories than gi itself - - Use pkgutil.extend_path() for the gi and gi.overrides modules, so that - libraries can install overrides in a path that is different from - the one that - pygobject installs itself into. These overrides need to put this - into their - __init__.py at the top: - - from pkgutil import extend_path - __path__ = extend_path(__path__, __name__) - - and put themselves somewhere into the default PYTHONPATH. - - https://bugzilla.gnome.org/show_bug.cgi?id=680913 - - Co-Authored-By: Martin Pitt - Co-Authored-By: Simon Feltman - - gi/__init__.py | 4 ++++ - gi/overrides/__init__.py | 4 ++++ - tests/gi/__init__.py | 2 ++ - tests/gi/overrides/Regress.py | 26 ++++++++++++++++++++++++++ - tests/gi/overrides/__init__.py | 2 ++ - tests/test_overrides.py | 6 ++++++ - 6 files changed, 44 insertions(+) - -commit c7c95a795eee499373499ea5b771447746317bfb -Author: Simon Feltman -Date: Thu Aug 23 06:03:09 2012 +0200 - - Clean up sys.path handling in tests - - Only set sys.path once in runtests.py, not in the individual test - modules. This - reduces hidden dependencies between tests by building up a run - order dependent - search path, and also makes it easier in the future to run the - tests against - the installed system libraries. - - Side issue in https://bugzilla.gnome.org/show_bug.cgi?id=680913 - - tests/runtests-windows.py | 6 +++++- - tests/runtests.py | 3 +++ - tests/test_everything.py | 1 - - tests/test_gdbus.py | 3 --- - tests/test_overrides.py | 3 --- - tests/test_pygtkcompat.py | 3 --- - 6 files changed, 8 insertions(+), 11 deletions(-) - -commit 3e3525e93d852cde0f63e835b774a9b004773c69 -Author: Simon Feltman -Date: Sun Aug 19 02:30:39 2012 -0700 - - Fix dynamic creation of enum and flag gi types for Python 3.3 - - Importing Gtk was crashing on instantiation of dynamic Enum and Flag - subclasses due to what looks to be an unsupported technique. Change - tp_new() method for classes dynamically derived from PyGEnum_Type and - PyGFlags_Type to call PyLong_Type.tp_new() instead of attempting - to call - __new__() as a python method. This technique seems to work with all - versions of python so the previous python version checking also became - unnecessary. - - https://bugzilla.gnome.org/show_bug.cgi?id=682323 - - gi/_gobject/pygenum.c | 29 ++++++++++++++++------------- - gi/_gobject/pygflags.c | 21 +++++++++------------ - 2 files changed, 25 insertions(+), 25 deletions(-) - -commit dd31b67e821f92b5f1c2ee0382cac5edd477cd11 -Author: Paolo Borelli -Date: Wed Aug 22 10:45:39 2012 +0200 - - [API add] Override g_menu_item_set_attribute - - This C utility API take a vararg, add a corresponding override that - takes a list of tuples - - https://bugzilla.gnome.org/show_bug.cgi?id=682436 - - gi/overrides/Gio.py | 10 ++++++++++ - tests/test_overrides.py | 11 +++++++++++ - 2 files changed, 21 insertions(+) - -commit 836902801373e386d370c44e7487aac3432f19f6 -Author: Martin Pitt -Date: Mon Aug 20 23:37:40 2012 +0200 - - post-release bump to 3.3.91 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 6a629e23ff7b0d6f532184017577c7427d577e28 -Author: Martin Pitt -Date: Mon Aug 20 23:05:49 2012 +0200 - - release 3.3.90 - - NEWS | 13 +++++++++++++ - configure.ac | 2 +- - 2 files changed, 14 insertions(+), 1 deletion(-) - -commit 5cd18c9bd59a60b930ced0b35d728c12bb3291c7 -Author: Mathieu Duponchelle -Date: Mon Aug 20 22:54:52 2012 +0200 - - Implement marshalling for GParamSpec - - https://bugzilla.gnome.org/show_bug.cgi?id=681565 - - Co-Authored-By: Martin Pitt - - gi/pygi-marshal-to-py.c | 16 ++++++++++++---- - tests/test_gi.py | 14 ++++++++++++++ - 2 files changed, 26 insertions(+), 4 deletions(-) - -commit 16462de3f025f14706ec23fa9b3653feb66ad57f -Author: Martin Pitt -Date: Mon Aug 20 15:24:10 2012 +0200 - - Fix pep8/pyflakes invocation - - Fix regression from commit 1e056e4f4a: Do fail the tests if - pyflakes/pep8 - exist, but fail. - - tests/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 1bee194274bcda9ba5f6751fa921218a92c8ac72 -Author: Simon Feltman -Date: Thu Aug 16 16:05:52 2012 -0700 - - Fix erronous import statements for Python 3.3 - - Update pygobject-external.h to use GType (which is what GTypeWrapper - is - exposed as) instead of GTypeWrapper when attempting import. - - Catch ImportError around attempted imports of a typelibs override file - which don't always exist (GObject...). This is a behavioural change in - Python 3.3 (http://bugs.python.org/issue15715), but let's fix - it anyway. - - https://bugzilla.gnome.org/show_bug.cgi?id=682051 - - gi/module.py | 7 +++++-- - gi/pygobject-external.h | 2 +- - 2 files changed, 6 insertions(+), 3 deletions(-) - -commit 1e056e4f4a19fd1139187467677c2592c2722290 -Author: Martin Pitt -Date: Mon Aug 20 11:52:08 2012 +0200 - - Do not fail tests if pyflakes or pep8 are not installed - - These tools might not be desirable in restricted build environments or - backports, and e. g. Fedora patches those out. So let the tests - work without - these tools. - - tests/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit c219fa6da89a7d55c5c111751684aae6876a9fe3 -Author: Martin Pitt -Date: Mon Aug 20 11:42:47 2012 +0200 - - gtk-demo: Fix some PEP-8 whitespace issues - - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 3 +-- - demos/gtk-demo/demos/dialogs.py | 2 +- - demos/gtk-demo/demos/rotatedtext.py | 3 +-- - 3 files changed, 3 insertions(+), 5 deletions(-) - -commit 0ac2a85cae368c046839b5619a96efc9e0b91ba3 -Author: Martin Pitt -Date: Mon Aug 20 11:38:50 2012 +0200 - - test_overrides.py: Fix PEP8 whitespacing - - tests/test_overrides.py | 48 - +++++++++++++++++++++++++----------------------- - 1 file changed, 25 insertions(+), 23 deletions(-) - -commit 631a9cd05cbc7dc3d0f743a84b948ef7d93c0ed4 -Author: Martin Pitt -Date: Mon Aug 20 11:36:19 2012 +0200 - - Ignore E124 pep8 error - - This is "closing bracket does not match visual indentation" which - is really - stupid. We do want the closing bracket at the same indentation level - as the - opening bracket, not the indentation level of the whole statement. - - tests/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 266d37719bb54e6f04d23ff21bcceb9514e20ff2 -Author: David Malcolm -Date: Mon Aug 20 11:27:52 2012 +0200 - - Fix unmarshalling of gssize - - Do not assume that the v_int union member always corresponds to a - gssize. This - is not true on big-endian 64 bit machines like ppc64, so add a new - gi_argument_to_gssize() and use it properly. - - https://bugzilla.gnome.org/show_bug.cgi?id=680693 - https://bugzilla.redhat.com/show_bug.cgi?id=842880 - - gi/pygi-argument.c | 53 - +++++++++++++++++++++++++++++++++++++++++++++--- - gi/pygi-argument.h | 1 + - gi/pygi-closure.c | 2 +- - gi/pygi-info.c | 4 ++-- - gi/pygi-signal-closure.c | 2 +- - 5 files changed, 55 insertions(+), 7 deletions(-) - -commit 1c5d497d3c354f4d02f1d4570df2c61d6f47300c -Author: David Malcolm -Date: Mon Aug 20 11:19:27 2012 +0200 - - Fix various endianess errors - - Fix code which assumed little endian behaviour when mixing different - types of - ints, putting ints into pointers, etc. - - https://bugzilla.gnome.org/show_bug.cgi?id=680692 - https://bugzilla.redhat.com/show_bug.cgi?id=841596 - - gi/pygi-argument.c | 64 +++++++++++++-- - gi/pygi-argument.h | 6 ++ - gi/pygi-cache.c | 2 + - gi/pygi-closure.c | 57 ++++++++++++- - gi/pygi-marshal-from-py.c | 203 - ++++++++++++++++++++++++++++++++++++---------- - gi/pygi-marshal-from-py.h | 3 + - gi/pygi-marshal-to-py.c | 137 ++++++++++++++++++++++++------- - 7 files changed, 391 insertions(+), 81 deletions(-) - -commit ee6da6f1aa2cd6e55834f9edc17f785613d00031 -Author: Paolo Borelli -Date: Wed Aug 15 13:16:11 2012 +0200 - - Add unit test for the TreeModelSort override - - tests/test_overrides.py | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 9f027daa5737107b5959964b699c0089aec8ab1e -Author: Simon Feltman -Date: Thu Aug 9 03:33:06 2012 -0700 - - Gtk overrides: Add TreeModelSort.__init__(self, model) - - This adds "model" as a required argument to TreeModelSort - instead of it being a hidden keyword argument. This is needed - because the model property is set to construct only and the - default value of None/NULL makes the object useless anyhow. - - https://bugzilla.gnome.org/show_bug.cgi?id=681477 - - gi/overrides/Gtk.py | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit c8424c2bb19356679e250e73542682dd5f4c74a5 -Author: Manuel Quiñones -Date: Fri Aug 10 09:38:24 2012 -0300 - - Convert Gtk.CellRendererState in the pygi-convert script - - Signed-off-by: Manuel Quiñones - - https://bugzilla.gnome.org/show_bug.cgi?id=681596 - - pygi-convert.sh | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 54d829b34a0d32d852db370f61cc7f25c149f373 -Author: Paolo Borelli -Date: Mon Aug 6 16:19:28 2012 +0200 - - More updates to the HACKING file - - module-install has been replaced with 'ftpadmin install' and other - minor - changes - - HACKING | 26 ++++++++++---------------- - 1 file changed, 10 insertions(+), 16 deletions(-) - -commit 0788880c6cf4070d3db09896c165fe470d2ec186 -Author: Paolo Borelli -Date: Mon Aug 6 16:00:39 2012 +0200 - - Post-release version bump to 3.3.6 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 664403d953c3e07077d0db90bfae3b51c7f1767c -Author: Paolo Borelli -Date: Mon Aug 6 15:52:22 2012 +0200 - - release 3.3.5 - - NEWS | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - -commit b748753a2a9af018001213e2e58c48d6c8bfadbd -Author: Paolo Borelli -Date: Mon Aug 6 15:44:32 2012 +0200 - - Update HACKING file to mention "make release-news" - - HACKING | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -commit 587a0c33901383b891f8eb77351c17f06af20b4f -Author: Paolo Borelli -Date: Mon Aug 6 15:38:23 2012 +0200 - - pygi-closure: remove unused variables - - These variables are assigned but never actually used - - gi/pygi-closure.c | 8 -------- - 1 file changed, 8 deletions(-) - -commit dbc6df6aad7197fcf8721ade429baadd749f7069 -Author: Martin Pitt -Date: Fri Aug 3 07:13:55 2012 +0200 - - tests: Do not break on Pango warnings - - In some restricted environments (like chroots) we sometimes get - warnings from - Pango when it cannot find an appropriate font. Do not make the tests - fail on - those. - - tests/test_overrides.py | 4 ++++ - tests/test_pygtkcompat.py | 6 ++++++ - 2 files changed, 10 insertions(+) - -commit 770e6abfd5bc5dad7d5f56a18f1ef63f9754ada9 -Author: Martin Pitt -Date: Fri Aug 3 06:45:48 2012 +0200 - - Fix list marshalling on big-endian machines - - On big endian machines we cannot simply set e. g. GIArgument.v_int8 - and expect - GIArgument.v_pointer to be a correct representation. This needs to use - GINT_TO_POINTER/GPOINTER_TO_INT properly, so use the already existing - _pygi_hash_pointer_to_arg()/_pygi_arg_to_hash_pointer() methods - in marshalling - to and from GList and GSList, and handle int8 and int16 as well. - - Part of porting pygobject to ppc64: - https://bugzilla.redhat.com/show_bug.cgi?id=842880 - https://bugzilla.gnome.org/show_bug.cgi?id=680693 - - gi/pygi-marshal-from-py.c | 48 ++++++++++++++++++++++++----------------- - gi/pygi-marshal-to-py.c | 54 - +++++++++++++++++++++++++++-------------------- - 2 files changed, 60 insertions(+), 42 deletions(-) - -commit b5cd13f47309ec26727b7574e33595a357602468 -Author: Colin Walters -Date: Tue Jul 31 11:47:02 2012 -0400 - - pygi-marshal: One more 32-bit -Werror=format fix - - gi/pygi-marshal-from-py.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 526bf43691cb6ed908589312b1693a6389eba00c -Author: Martin Pitt -Date: Tue Jul 31 17:14:37 2012 +0200 - - Beautify class/interface type mismatch error messages - - Avoid saying ".int", just skip the module name - completely if we do not have one. - - gi/pygi-marshal-from-py.c | 20 ++++++++++++-------- - 1 file changed, 12 insertions(+), 8 deletions(-) - -commit 8fb18c62d9c7faff38df3886cb4289b618c81b85 -Author: Martin Pitt -Date: Tue Jul 31 13:13:21 2012 +0200 - - Skip instead of fail tests which need Pango, Atk, Gdk, Gtk - - On initial jhbuild bootstrap or restricted environments, the Pango, - Atk, Gdk, - and Gtk typelibs might not be available. Skip tests which need these - instead of - failing the testsuite. - - tests/test_atoms.py | 7 ++++++- - tests/test_everything.py | 9 ++++++++- - tests/test_overrides.py | 32 ++++++++++++++++++++++++++------ - tests/test_pygtkcompat.py | 30 ++++++++++++++++++++---------- - 4 files changed, 60 insertions(+), 18 deletions(-) - -commit a2e73c109f3ed6080eabc85810e624b9f984317e -Author: Colin Walters -Date: Tue Jul 31 09:02:24 2012 -0400 - - pygi-argument: Fix -Wformat warning on 32 bit builds - - gi/pygi-argument.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 7563bb9f8ed5740f52ddf0ca59daf7839853505b -Author: Martin Pitt -Date: Tue Jul 31 11:14:36 2012 +0200 - - Fix tests for Python 2 - - In Python 2 we get different error messages for a mismatching self - type. Fixes - check after commit 121b14028. - - tests/test_gi.py | 32 ++++++++++++++++++++------------ - 1 file changed, 20 insertions(+), 12 deletions(-) - -commit 5c5b066854cc0b3b7702f31d212aa3f511c62127 -Author: Martin Pitt -Date: Tue Jul 31 10:30:22 2012 +0200 - - Build with -Werror=format - - This catches format string problems on particular architectures like - in commit - dea24f8e12 much more insistently. - - configure.ac | 1 + - 1 file changed, 1 insertion(+) - -commit 6e84a3052667fdc88c2081e20cc6dc3257ec9d6c -Author: Simon Feltman -Date: Mon Jul 30 02:00:16 2012 -0700 - - [API add] pygtkcompat: Add more pixbuf creation functions - - Add the following functions: - pixbuf_new_from_data - pixbuf_new_from_file_at_scale - pixbuf_new_from_file_at_size - pixbuf_new_from_inline - pixbuf_new_from_stream - pixbuf_new_from_stream_at_scale - pixbuf_new_from_xpm_data - pixbuf_get_file_info - - https://bugzilla.gnome.org/show_bug.cgi?id=680814 - - gi/pygtkcompat.py | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -commit dea24f8e1221516b2d8ea578e55124b0409d6a76 -Author: Colin Walters -Date: Mon Jul 30 22:17:44 2012 -0400 - - marshal: Fix a lot of format string warnings on 32 bit - - G_GUINT64_FORMAT and friends handle "%lld" portably. - - https://bugzilla.gnome.org/show_bug.cgi?id=680878 - - gi/pygi-marshal-from-py.c | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - -commit b630038d9a1c8cb7e5914c77fbacbed646c154d1 -Author: Colin Walters -Date: Mon Jul 30 22:30:07 2012 -0400 - - marshal: Fix build break on Python 2 - - I *think* using this wrapper function instead is right. - - https://bugzilla.gnome.org/show_bug.cgi?id=680879 - - gi/pygi-marshal-from-py.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit a8338a991bbe919f0e2d9b92f7b71f89ccd2c875 -Author: Manuel Quiñones -Date: Mon Jul 30 12:53:36 2012 -0300 - - Improve testcase for tree_view_column_set_attributes - - Signed-off-by: Manuel Quiñones - - https://bugzilla.gnome.org/show_bug.cgi?id=680320 - - tests/test_overrides.py | 20 ++++++++++++++++++-- - 1 file changed, 18 insertions(+), 2 deletions(-) - -commit 121b1402860407fe46f7501e42447bf3607872ec -Author: Martin Pitt -Date: Tue Jul 31 00:37:55 2012 +0200 - - Fix error messages on interface/class type mismatches - - Previously, when you called a function with an argument which was not - compatible with the expected class/interface type, you got an - error message - like - - TypeError: Expected Gtk.TreeViewColumn, but got GObjectMeta - - which had the wrong (and useless) class name for the actual type, - and did not - tell you which argument caused the problem. With this it says e. g. - - TypeError: argument column: Expected Gtk.TreeViewColumn, but - got Gtk.Button - - instead. - - gi/pygi-marshal-from-py.c | 41 ++++++++++++++++++++++++++-------- - tests/test_gi.py | 57 - ++++++++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 88 insertions(+), 10 deletions(-) - -commit 8f31e85db1392eb7222593fc0d05144c2bca06a3 -Author: Simon Feltman -Date: Sun Jul 29 23:36:25 2012 -0700 - - Fix crash when returning (False, None) from - Gtk.TreeModel.do_get_iter() - - Add a Py_None check before attempting memcpy(). - - https://bugzilla.gnome.org/show_bug.cgi?id=680812 - - Signed-off-by: Martin Pitt - - gi/pygi-closure.c | 10 +++++++--- - tests/test_overrides.py | 9 +++++++++ - 2 files changed, 16 insertions(+), 3 deletions(-) - -commit 94e5d58e7794de91d3291e0e51c42070da4fc92b -Author: Martin Pitt -Date: Mon Jul 30 11:58:24 2012 +0200 - - Add test case for Gtk.TextIter.forward_search() - - https://bugzilla.gnome.org/show_bug.cgi?id=679415 - - tests/test_overrides.py | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -commit aae4e77482c02e21154ab02b159f380f5f0f74be -Author: Martin Pitt -Date: Fri Jul 27 23:06:39 2012 +0200 - - Add missing static declarations - - This fixes a lot of -Wmissing-prototype warnings. - - Also remove _pygi_marshal_cleanup_closure_unref() which is not - used anywhere. - - gi/_gobject/gobjectmodule.c | 4 ++-- - gi/_gobject/pygobject.c | 2 +- - gi/pygi-cache.c | 2 +- - gi/pygi-foreign-cairo.c | 24 ++++++++++++------------ - gi/pygi-foreign.c | 2 +- - gi/pygi-marshal-cleanup.c | 9 --------- - tests/test-unknown.c | 2 +- - tests/testhelpermodule.c | 4 ++-- - 8 files changed, 20 insertions(+), 29 deletions(-) - -commit 5f88d3017f853c4ff5e9fd89ef39e4569a9b9c16 -Author: Martin Pitt -Date: Fri Jul 27 23:01:08 2012 +0200 - - Fix more missing #includes - - Add missing includes which caused -Wmissing-prototypes warnings. - - gi/_gobject/pygenum.c | 2 ++ - gi/_gobject/pyginterface.c | 2 ++ - 2 files changed, 4 insertions(+) - -commit 97b5184c6650964ae8a7616353f5ce8e3ca19af3 -Author: Martin Pitt -Date: Fri Jul 27 22:59:21 2012 +0200 - - Make some warnings fatal - - Add -Werror for some warnings which are real errors in the source - which we - really want to avoid. This includes -Wmissing-prototypes, but that - currently - breaks on building g-i's regress.c. - - configure.ac | 5 +++++ - 1 file changed, 5 insertions(+) - -commit c2ee8c550199de59dd220561ed028ec6fb8e1daf -Author: Martin Pitt -Date: Fri Jul 27 22:08:47 2012 +0200 - - Fix missing #includes - - Add missing includes which caused -Wmissing-prototypes warnings. - - gi/_glib/pygiochannel.c | 2 ++ - gi/_glib/pygspawn.c | 2 ++ - 2 files changed, 4 insertions(+) - -commit 8bc98fc6665ebab763ee92361929139a0ebe66b5 -Author: Martin Pitt -Date: Fri Jul 27 20:52:00 2012 +0200 - - pygi-info.c: Robustify pointer arithmetic - - In _wrap_g_field_info_{get,set}_value(), use explicit char* casts - to point out - that we are using byte offsets. Fixes warnings: - - pygi-info.c:1277:43: warning: pointer of type 'void *' used in - arithmetic [-Werror=pointer-arith] - - gi/pygi-info.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit d0a561057b727ebcc1fd06fa6a3b48f2a1f8338e -Author: Martin Pitt -Date: Fri Jul 27 20:50:30 2012 +0200 - - pyglib.c: Remove some dead code - - Drop unused pyglib_gil_state_ensure_py23() and - pyglib_gil_state_release_py23(). - - gi/_glib/pyglib.c | 18 ------------------ - 1 file changed, 18 deletions(-) - -commit a46d165d906d0ac7613f4d946542423e979f39d5 -Author: Manuel Quiñones -Date: Fri Jul 20 10:37:04 2012 -0300 - - Add set_attributes() override to Gtk.TreeViewColumn - - Looking at the C code, gtk_tree_view_column_set_attributesv just calls - gtk_cell_layout_clear_attributes and then - gtk_cell_layout_add_attribute for each (name, value) passed. This - patch makes the same in the overrides. - - Signed-off-by: Manuel Quiñones - Signed-off-by: Martin Pitt - - gi/overrides/Gtk.py | 7 +++++++ - tests/test_overrides.py | 6 ++++++ - 2 files changed, 13 insertions(+) - -commit 4df676e10a5ea595a0d491af10268f557dd722d7 -Author: Daniel Narvaez -Date: Tue Jul 24 13:49:15 2012 +0200 - - Drop git.mk - - The autogenerated gitignores was missing several files. So we - was using a manual .gitignore at the root. But since it's - enough to add a couple of entries to it to cover the whole - tree, there is no much point in using git.mk at all. - - https://bugzilla.gnome.org/show_bug.cgi?id=678192 - - Makefile.am | 3 - - docs/Makefile.am | 2 - - examples/Makefile.am | 3 - - gi/Makefile.am | 3 - - gi/_glib/Makefile.am | 3 - - gi/_gobject/Makefile.am | 2 - - gi/overrides/Makefile.am | 2 - - gi/repository/Makefile.am | 2 - - git.mk | 200 - ---------------------------------------------- - tests/Makefile.am | 2 - - 10 files changed, 222 deletions(-) - -commit 0d729c1534c7f3226b492f549d8f6ad3bb3ac8b7 -Author: Simon Feltman -Date: Fri Jul 20 19:55:46 2012 -0700 - - Gtk overrides: Add TreePath.__getitem__() - - Use pythons sub-script operator for indexing into TreePaths - as was the case in PyGtk. Also changed __iter__ to use - TreePath.get_indices as opposed to formatting and re-parsing - a string for getting an index list. - - https://bugzilla.gnome.org/show_bug.cgi?id=680353 - - gi/overrides/Gtk.py | 5 ++++- - tests/test_overrides.py | 4 ++++ - 2 files changed, 8 insertions(+), 1 deletion(-) - -commit affc7faa3fa7250e2e8c2c65e6860906f6fbc4fb -Author: Simon Feltman -Date: Fri Jul 20 21:34:33 2012 -0700 - - Fix property type mapping from int to TYPE_INT for python3. - - Python3 does not have a long type, however, propertyhelper.py was - using long_ = int; to get things working. Type mapping code - was then checking for long_ first and always returning TYPE_LONG. - Additional refactoring was done to move large if/elif statements - into dictionary lookups and usage of tuples instead of lists - for simple 'in' list of items tests. - - https://bugzilla.gnome.org/show_bug.cgi?id=679939 - - gi/_gobject/propertyhelper.py | 117 - +++++++++++++++++++----------------------- - tests/test_properties.py | 55 +++++++++++++++----- - 2 files changed, 96 insertions(+), 76 deletions(-) - -commit 6fddba5bc5ea02938677a89ffeb0cfc53229b894 -Author: Manuel Quiñones -Date: Thu Jul 19 12:11:34 2012 -0300 - - Convert Gtk.DestDefaults constants in pygi-convert.sh script - - Signed-off-by: Manuel Quiñones - - https://bugzilla.gnome.org/show_bug.cgi?id=680259 - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit d58c3553062fd8704a81a8233b4a1563a6611718 -Author: Manuel Quiñones -Date: Thu Jul 19 12:04:03 2012 -0300 - - Convert all Gdk.WindowState constants in pygi-convert.sh - - Signed-off-by: Manuel Quiñones - - https://bugzilla.gnome.org/show_bug.cgi?id=680257 - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit a3aae2e152c0b955037b7b85e16d14d00881d870 -Author: Joe R. Nassimian -Date: Thu Jul 19 15:48:20 2012 +0200 - - [API add] Add API for checking pygobject's version - - Add a gi.__version__ attribute for the textual version, and - gi.version_info for - a version triple similar to sys.version_info. - - Also add a gi.require_version() which raises an - exception if - the pygobject version is older. - - https://bugzilla.gnome.org/show_bug.cgi?id=680176 - - Signed-off-by: Martin Pitt - - gi/__init__.py | 16 ++++++++++++++++ - tests/test_gi.py | 16 ++++++++++++++++ - 2 files changed, 32 insertions(+) - -commit a2d9b71d84f0fcb7aaf5ce483ffee3b3a1ccaca1 -Author: Manuel Quiñones -Date: Mon Jul 16 17:14:46 2012 -0300 - - pygi-convert.sh: Add some missing Gdk.CursorTypes - - This patch adds WATCH, ARROW and CLOCK. - - https://bugzilla.gnome.org/show_bug.cgi?id=680050 - - Signed-off-by: Manuel Quiñones - Signed-off-by: Martin Pitt - - pygi-convert.sh | 3 +++ - 1 file changed, 3 insertions(+) - -commit 0b08c01414ac73a4604acd9a846e7af09574929f -Author: Manuel Kaufmann -Date: Tue Jul 17 09:05:27 2012 -0300 - - pygi-convert.sh: convert rsvg.Handle(data=...) - - Replace rsvg.Handle(data=data) with Rsvg.Handle.new_from_data(data) - - https://bugzilla.gnome.org/show_bug.cgi?id=680092 - - Signed-off-by: Manuel Kaufmann - Signed-off-by: Martin Pitt - - pygi-convert.sh | 2 ++ - 1 file changed, 2 insertions(+) - -commit 975855d0fff7f2042fe1f0e843f96b9a37cc6b79 -Author: Martin Pitt -Date: Mon Jul 16 17:35:38 2012 +0200 - - configure.ac: post-release bump to 3.3.5 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 126842b7227fcc1381dc158acdc5a96d0a465515 -Author: Martin Pitt -Date: Mon Jul 16 17:33:08 2012 +0200 - - release 3.3.4 - - NEWS | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - -commit 079b73b3eb9083bd53e06d095f9dccc02acf2a6e -Author: Martin Pitt -Date: Mon Jul 16 17:29:22 2012 +0200 - - test_gi: Fix for Python 2 - - tests/test_gi.py | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit 30935fe31bfe201bbfdb7734f09fdd2bbaf80e08 -Author: Martin Pitt -Date: Mon Jul 16 16:35:33 2012 +0200 - - pygi-convert.sh: Drop bogus filter_new() conversion - - my_tree_model.filter_new() is still a method on GtkTreeModel, not a - constructor, so do not try to convert it to a constructor call. - - https://bugzilla.gnome.org/show_bug.cgi?id=679999 - - pygi-convert.sh | 1 - - 1 file changed, 1 deletion(-) - -commit c0607d970fc59528ca27d518282cf2871b92e909 -Author: Martin Pitt -Date: Mon Jul 16 16:00:40 2012 +0200 - - Fix help() for GI modules - - Derive DynamicModule from types.ModuleType, so that the inspect - modules' - ismodule() actually succeeds on those and generates useful help on - a GI - repository module. - - https://bugzilla.gnome.org/show_bug.cgi?id=679804 - - gi/module.py | 3 ++- - tests/test_gi.py | 15 +++++++++++++++ - 2 files changed, 17 insertions(+), 1 deletion(-) - -commit 3235f1a397c334de5a7570f5ceed4da709fe1714 -Author: Martin Pitt -Date: Mon Jul 16 15:53:31 2012 +0200 - - Skip gi.CallbackInfo objects from a module's dir() - - Skip gi.CallbackInfo items from IntrospectionModule's __dir__(), - as we do not - implement __getattr__ for those. - - Add a test case that dir() works on GI modules, contain expected - identifiers, - and that all identifiers in dir() can actually be retrieved. - - Prerequisite for https://bugzilla.gnome.org/show_bug.cgi?id=679804 - - gi/module.py | 7 +++++-- - tests/test_gi.py | 14 ++++++++++++++ - 2 files changed, 19 insertions(+), 2 deletions(-) - -commit f6cc039e014448a553d626aac4020ee69717edab -Author: Martin Pitt -Date: Mon Jul 16 15:38:05 2012 +0200 - - Fix __path__ module attribute - - get_typelib_path() returns bytes, not strings, so in Python 3 we - need to decode - it to get a proper __path__ attribute. - - gi/module.py | 17 +++++++++++++++++ - tests/test_gi.py | 10 ++++++++++ - 2 files changed, 27 insertions(+) - -commit 858048f7cec78129aa914e2341ab80aac0e95cc5 -Author: Joe R. Nassimian -Date: Mon Jul 16 15:02:10 2012 +0200 - - pygi-convert.sh: Fix some child → getChild() false positives - - https://bugzilla.gnome.org/show_bug.cgi?id=680004 - - pygi-convert.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit a31fabdc12f1da301c8df0af319ca3f4181671ee -Author: Mikkel Kamstrup Erlandsen -Date: Thu Jul 12 09:19:42 2012 +0200 - - Fix array handling for interfaces, properties, and signals - - Fix lots of corner cases where arrays are not handled properly. - _pygi_argument_to_object() now has the documented expectation of - getting arrays - packed in GArrays. This was implicit before and not correctly done - on most call - sites. - - The helper _pygi_argument_to_array() has been improved to work on - any kind of - array. Fix all call sites of _pygi_argument_to_object() to do the - array conversion appropriately before calling - _pygi_argument_to_object(). - - Adds a test case that implements a GInterface with a method that - takes an array - of variants as input. - - https://bugzilla.gnome.org/show_bug.cgi?id=667244 - - gi/pygi-argument.c | 156 - ++++++++++++++++++++++++++++++++--------------- - gi/pygi-argument.h | 4 +- - gi/pygi-closure.c | 11 ++++ - gi/pygi-info.c | 20 ++++-- - gi/pygi-property.c | 1 + - gi/pygi-signal-closure.c | 14 ++++- - tests/test_gi.py | 18 ++++++ - 7 files changed, 167 insertions(+), 57 deletions(-) - -commit bb80d124269ee2389c04d03a478475868fd9ff7b -Author: Manuel Quiñones -Date: Wed Jul 11 22:05:41 2012 -0300 - - Add conversion of the Gdk.PropMode constants to pygi-convert.sh script - - Signed-off-by: Manuel Quiñones - - https://bugzilla.gnome.org/show_bug.cgi?id=679775 - - pygi-convert.sh | 3 +++ - 1 file changed, 3 insertions(+) - -commit e3a63eefa5fb2abeabd210790e12642e577363c8 -Author: Manuel Quiñones -Date: Wed Jul 11 13:18:16 2012 -0300 - - Add the same rules for pack_start to convert pack_end - - Signed-off-by: Manuel Quiñones - - https://bugzilla.gnome.org/show_bug.cgi?id=679760 - - pygi-convert.sh | 5 +++++ - 1 file changed, 5 insertions(+) - -commit b4bef457c2d0ca6899e06a021f1f06252a37e326 -Author: Dave Malcolm -Date: Wed Jul 11 08:21:27 2012 +0200 - - Add error-checking for the case where _arg_cache_new() fails - - This can happen when a typelib and its underlying library are - out-of-sync. This - converts the segfault into a more helpful traceback. - - https://bugzilla.gnome.org/show_bug.cgi?id=678914 - - gi/pygi-cache.c | 2 ++ - 1 file changed, 2 insertions(+) - -commit 41287d8a439c656e4ac60361fddec643c713234c -Author: Manuel Quiñones -Date: Wed Jul 11 11:13:38 2012 -0300 - - Add conversion of the Gdk.NotifyType constants to pygi-convert.sh - script - - Signed-off-by: Manuel Quiñones - - https://bugzilla.gnome.org/show_bug.cgi?id=679754 - - pygi-convert.sh | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit 5403149b900d1b73cbc78767dc43be2eb344c836 -Author: Simon Feltman -Date: Tue Jul 10 19:07:32 2012 -0700 - - Fix PyObject_Repr and PyObject_Str reference leaks - - Fix all calls to PyObject_Repr() and PyObject_Str() to be properly - DECREF'd. - - https://bugzilla.gnome.org/show_bug.cgi?id=675857 - - Signed-off-by: Martin Pitt - - gi/_glib/glibmodule.c | 10 +++++++-- - gi/_gobject/gobjectmodule.c | 17 ++++++++++----- - gi/_gobject/pygobject.c | 53 - ++++++++++++++++++++++++++++++--------------- - gi/pygi-marshal-from-py.c | 9 +++++--- - 4 files changed, 62 insertions(+), 27 deletions(-) - -commit 0ddfecf3bf0a5d7893cd02cff41503d810ef6ce8 -Author: Martin Pitt -Date: Wed Jul 4 08:46:30 2012 +0200 - - [API add] Gtk overrides: Add TreePath.__len__() - - Use the path depth as length of a Gtk.TreePath object. - - https://bugzilla.gnome.org/show_bug.cgi?id=679199 - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 4 ++++ - 2 files changed, 7 insertions(+) - -commit e1e849d1a9af77c29ee35971db8d439bac60d573 -Author: Martin Pitt -Date: Wed Jul 4 08:35:16 2012 +0200 - - GLib.Variant: Fix repr(), add proper str() - - Fix the GLib.Variant override's repr() after commit 16280d6985. Also - add a - proper __str__() method, and tests for both. - - Thanks to Rul Matos for spotting this! - - https://bugzilla.gnome.org/show_bug.cgi?id=679336 - - gi/overrides/GLib.py | 6 +++++- - tests/test_overrides.py | 5 +++++ - 2 files changed, 10 insertions(+), 1 deletion(-) - -commit af20d7c929b9c1888454b52932a308d346e1c12b -Author: Martin Pitt -Date: Thu Jun 28 06:51:22 2012 +0200 - - m4/python.m4: Update Python version list - - Thanks to Dieter Verfaillie for pointing this out. - - m4/python.m4 | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -commit a96a26234e2aaa157837d26094864e3ad9b63edf -Author: Micah Carrick -Date: Mon Jun 25 09:05:59 2012 -0700 - - Remove "label" property from Gtk.MenuItem if it is not set - - The Gtk.MenuItem will not render as a separator if the "label" or - "user-underline" properties have been accessed. The constructor - for Gtk.MenuItem override should not pass the "label" property - as an argument if it is None since that will still result in an - empty label widget which breaks Gtk.SeparatorMenuItem. - - https://bugzilla.gnome.org/show_bug.cgi?id=670575 - - Signed-off-by: Martin Pitt - - gi/overrides/Gtk.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit afa12faf339efb4f7780168e884ecf49b630644a -Author: Martin Pitt -Date: Mon Jun 25 16:36:31 2012 +0200 - - configure.ac: Post-release bump to 3.3.4. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 198066effc0ca44ccb897e9f0738ab627e8b3275 -Author: Martin Pitt -Date: Mon Jun 25 16:35:49 2012 +0200 - - release 3.3.3.1 - - NEWS | 3 +++ - configure.ac | 2 +- - 2 files changed, 4 insertions(+), 1 deletion(-) - -commit cb70ae0aa52ab7624b2b8c30297d8a52a7db7f44 -Author: Martin Pitt -Date: Mon Jun 25 16:32:45 2012 +0200 - - Do not escape enum and flag names that are Python keywords - - These are translated to upper case, and thus can never be - keywords. This broke - existing API such as Gtk.ShadowType.IN. - - gi/module.py | 2 +- - gi/pygi-info.c | 7 +++++++ - tests/test_gi.py | 3 +++ - 3 files changed, 11 insertions(+), 1 deletion(-) - -commit f2524a982b0b8ba7cdbb77003372416af0b7a978 -Author: Martin Pitt -Date: Mon Jun 25 15:39:50 2012 +0200 - - configure.ac: Post-release version bump to 3.3.4 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit fe56faa346c8e8f9fd5915602424778d458a776d -Author: Martin Pitt -Date: Mon Jun 25 15:36:37 2012 +0200 - - release 3.3.3 - - NEWS | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 299a2fd726f0aceaf67b1cec7a0ef8b21ff7bcbc -Author: Martin Pitt -Date: Mon Jun 25 15:35:19 2012 +0200 - - Bring back ChangeLog make target - - This is being used by "make dist". - - Makefile.am | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 760118e4ed73de2f022706ef897fcc848e90c005 -Author: Martin Pitt -Date: Mon Jun 25 15:31:14 2012 +0200 - - Remove obsolete ChangeLog and release-tag make targets - - Makefile.am | 23 ----------------------- - 1 file changed, 23 deletions(-) - -commit e92278692bb51679d6e957c2ac36db64498a7c73 -Author: Simon Schampijer -Date: Fri Jun 15 16:11:21 2012 +0200 - - Do not do any python calls when GObjects are destroyed after the - python interpreter has been finalized - - This happens when pygobject_data_free () function is called after - the python - interpreter shuts down, we can't do python calls after that. - - Benzea did the findings because of a bug in Sugar, and commented - in this - SugarLabs ticket: http://bugs.sugarlabs.org/ticket/3670 - - https://bugzilla.gnome.org/show_bug.cgi?id=678046 - - Signed-off-by: Benjamin Berg - Signed-off-by: Martin Pitt - - gi/_gobject/pygobject.c | 27 ++++++++++++++++++++++----- - 1 file changed, 22 insertions(+), 5 deletions(-) - -commit de4aa426002eeb09a060f8fd70bd6cb25a17766a -Author: Martin Pitt -Date: Mon Jun 25 15:06:47 2012 +0200 - - Do not change constructor-only "type" Window property - - When reading a Gtk.Window subclass from a GtkBuilder object, - the object's - properties are already set at __init__ time. Do not try to set it - again, to - avoid a warning. - - https://bugzilla.gnome.org/show_bug.cgi?id=678510 - - gi/overrides/Gtk.py | 8 +++++++- - tests/test_overrides.py | 36 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 43 insertions(+), 1 deletion(-) - -commit 16280d6985f2cf4db9cf062e857650e620fd9da8 -Author: Martin Pitt -Date: Mon Jun 25 09:40:38 2012 +0200 - - Escape identifiers which are Python keywords - - Add a trailing underscore to identifiers which are Python keywords. - - We use a per-major-version static identifier list derived from - keyword.kwlist - instead of calling out to Python's keyword.iskeyword(). This is - much faster, - and also allows us to tweak the result. For example, Python 3 dropped - "print" - as a keyword, but we still want to escape that to avoid breaking - the API - between different Python versions. - - Error out when building with a major Python version not covered yet, - so that we - do not forget to update the list in the future. - - https://bugzilla.gnome.org/show_bug.cgi?id=676746 - - gi/pygi-info.c | 38 +++++++++++++++++++++++++++++++++++++- - tests/test_gi.py | 17 +++++++++++++++++ - 2 files changed, 54 insertions(+), 1 deletion(-) - -commit 3864d7a3b7def035ee2daf22ba717371c8d261de -Author: Martin Pitt -Date: Fri Jun 22 13:13:37 2012 +0200 - - Ignore E123 in pep8 tests - - This is "closing bracket does not match indentation of opening - bracket's line", - but it really looks better to have the closing bracket on the - indentation level - of the opening bracket instead of the indentation level of the - line that - contains the opening bracket. - - tests/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit fb436dd6d3b40b3f2a8ba6f402e2987752ad1902 -Author: Martin Pitt -Date: Fri Jun 22 13:08:34 2012 +0200 - - PEP8: Fix indentation - - Spotted by current pep8 checker. - - demos/gtk-demo/demos/Entry/entry_buffer.py | 6 +-- - demos/gtk-demo/demos/Entry/entry_completion.py | 6 +-- - demos/gtk-demo/demos/Entry/search_entry.py | 4 +- - demos/gtk-demo/demos/appwindow.py | 2 +- - demos/gtk-demo/demos/clipboard.py | 8 +-- - demos/gtk-demo/demos/colorselector.py | 6 +-- - demos/gtk-demo/demos/rotatedtext.py | 8 +-- - demos/gtk-demo/gtk-demo.py | 6 +-- - examples/option.py | 29 ++++++----- - examples/signal.py | 3 +- - gi/_glib/option.py | 6 +-- - gi/_gobject/propertyhelper.py | 18 +++---- - gi/module.py | 14 +++--- - gi/overrides/GLib.py | 2 +- - gi/overrides/Gio.py | 11 +++-- - gi/overrides/Gtk.py | 16 +++--- - gi/pygtkcompat.py | 7 ++- - gi/types.py | 17 ++++--- - tests/runtests.py | 2 +- - tests/test_gdbus.py | 55 +++++++++++---------- - tests/test_gi.py | 15 +++--- - tests/test_gobject.py | 18 +++---- - tests/test_option.py | 26 +++++----- - tests/test_overrides.py | 67 - +++++++++++++------------- - tests/test_properties.py | 30 ++++++------ - tests/test_signal.py | 2 +- - tests/test_uris.py | 9 ++-- - 27 files changed, 200 insertions(+), 193 deletions(-) - -commit 129462ccc4a2191ecbb42247030c91bd0f1454f6 -Author: Martin Pitt -Date: Fri Jun 22 12:36:54 2012 +0200 - - PEP8: Use isinstance() instead of direct type comparisons - - Spotted by current pep8 checker. - - gi/overrides/GLib.py | 2 +- - gi/overrides/__init__.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit 50e45a624e6301e65c150e137aad6d092f203f3f -Author: Martin Pitt -Date: Fri Jun 22 12:30:10 2012 +0200 - - PEP8: Fix continuation lines - - Spotted by current pep8 checker. - - demos/gtk-demo/demos/Entry/search_entry.py | 6 +++--- - gi/__init__.py | 6 +++--- - gi/_gobject/__init__.py | 6 ++---- - gi/module.py | 6 +++--- - tests/test_overrides.py | 11 +++-------- - 5 files changed, 14 insertions(+), 21 deletions(-) - -commit ef06548b0dc6aee0e8ab208a78966dc1d5d917ee -Author: Martin Pitt -Date: Fri Jun 22 12:24:32 2012 +0200 - - PEP8: Consistent comparisons against True, False, and None - - Spotted by current pep8 checker. - - demos/gtk-demo/demos/clipboard.py | 4 ++-- - demos/gtk-demo/demos/drawingarea.py | 4 ++-- - demos/gtk-demo/gtk-demo.py | 8 ++++---- - gi/overrides/Gdk.py | 2 +- - gi/overrides/Gtk.py | 2 +- - tests/test_gi.py | 4 ++-- - tests/test_overrides.py | 3 +-- - 7 files changed, 13 insertions(+), 14 deletions(-) - -commit 379c1474a071292a1e8da413af2f5438cff09fc8 -Author: Martin Pitt -Date: Wed Jun 20 12:23:12 2012 +0200 - - Fix crash in GLib.find_program_in_path() - - We need to handle a NULL return value properly. - - https://bugzilla.gnome.org/show_bug.cgi?id=678119 - - gi/_glib/glibmodule.c | 10 ++++++++-- - tests/Makefile.am | 1 + - tests/test_glib.py | 15 +++++++++++++++ - 3 files changed, 24 insertions(+), 2 deletions(-) - -commit 73531fd7820bd1922347bd856298d68205a27877 -Author: Martin Pitt -Date: Wed Jun 20 11:16:39 2012 +0200 - - Revert "Do not bind gobject_get_data() and gobject_set_data()" - - We should have some deprecation period for this, so bring back - these two - methods and add deprecation warnings. - - This reverts commit 24cc09a7105299805fcc5bc151f53ac69958d728. - - https://bugzilla.gnome.org/show_bug.cgi?id=641944 - - gi/_gobject/pygobject.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - -commit a0daa843801658929ffee5bcb9eb67d955dc7921 -Author: David Keijser -Date: Mon Jun 18 15:09:34 2012 +0200 - - GVariant: Raise proper TypeError on invalid tuple input - - https://bugzilla.gnome.org/show_bug.cgi?id=678317 - - Signed-off-by: Martin Pitt - - gi/overrides/GLib.py | 4 ++-- - tests/test_overrides.py | 1 + - 2 files changed, 3 insertions(+), 2 deletions(-) - -commit fb39ba934180e1e48fd15774e69d1cecf47a4c84 -Author: Martin Pitt -Date: Tue Jun 5 19:11:38 2012 +0200 - - configure.ac: Post-release bump to 3.3.3 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 7f0995e7fa865ebde7490d0570a7135a2f962cdf -Author: Martin Pitt -Date: Tue Jun 5 19:09:12 2012 +0200 - - Release 3.3.2 - - NEWS | 44 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - -commit 8209c1ae1632c77768699481e574d5d378956e71 -Author: Martin Pitt -Date: Tue Jun 5 19:04:49 2012 +0200 - - Fix "release-news" make target - - Actually list changes since the previous release, not since 3.1.92. - - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b21f66d2a399b8c9a36a1758107b7bdff0ec8eaa -Author: Bastian Winkler -Date: Wed May 9 19:04:01 2012 +0200 - - foreign: Register cairo.Path and cairo.FontOptions foreign structs - - They are rarely used, but they are used at least by Gdk, PangoCairo - and - Clutter. - - clutter.Path is not used by any API that the test suite uses, so - leave that - without a test for now. - - https://bugzilla.gnome.org/show_bug.cgi?id=677388 - - Signed-off-by: Martin Pitt - - gi/pygi-foreign-cairo.c | 85 - ++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_everything.py | 8 +++++ - 2 files changed, 93 insertions(+) - -commit 635a7d1b48d99ddd1ea123797c493b18b0cdfd45 -Author: Marien Zwart -Date: Wed May 23 01:51:46 2012 +0200 - - Check types in GBoxed assignments - - Check if the Python value is GBoxed instead of assuming it is. - Without this, the following segfaults: - - from gi.repository import Soup - - msg = Soup.Message() - msg.props.uri = 'http://www.gnome.org' - - as we assume the new property is a GBoxed while it is actually a - string. - - https://bugzilla.gnome.org/show_bug.cgi?id=676603 - - Co-authored-by: Martin Pitt - Signed-off-by: Martin Pitt - - gi/pygi-argument.c | 10 +++++++--- - tests/test_gi.py | 19 +++++++++++++++++++ - 2 files changed, 26 insertions(+), 3 deletions(-) - -commit 2305dcd7e8841f87dc2fc683390df78453a5dc2a -Author: Bastian Winkler -Date: Sat May 12 14:08:51 2012 +0200 - - [API add] Gtk overrides: Add TreeModelRow.get_previous() - - TreeModelRow has get_next() and a next property, it should also have - get_previous() and previous. - - https://bugzilla.gnome.org/show_bug.cgi?id=677389 - - Signed-off-by: Martin Pitt - - gi/overrides/Gtk.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit 5501fba534696974899f2591929bff9e1b6ecd65 -Author: Bastian Winkler -Date: Sat May 12 13:50:02 2012 +0200 - - [API add] Add missing GObject.TYPE_VARIANT - - Add TYPE_VARIANT to constants to make it accessible as - GObject.TYPE_VARIANT. - - https://bugzilla.gnome.org/show_bug.cgi?id=677387 - - Signed-off-by: Martin Pitt - - gi/_gobject/__init__.py | 1 + - gi/_gobject/constants.py | 1 + - 2 files changed, 2 insertions(+) - -commit 4c51a5411092f8ab6f8f6e9692a9b49692f621a7 -Author: Jasper St. Pierre -Date: Fri Jun 1 02:53:13 2012 -0400 - - Fix boxed type equality - - Each boxed type has its own Python type, not PyGBoxed_Type. Use - PyObject_IsInstance instead of comparing against PyGBoxed_Type - directly. - - https://bugzilla.gnome.org/show_bug.cgi?id=677249 - - Signed-off-by: Martin Pitt - - gi/_gobject/pygboxed.c | 3 ++- - tests/test_everything.py | 8 ++++++++ - 2 files changed, 10 insertions(+), 1 deletion(-) - -commit dc8eef26906753fcb3ce057b23ca110137897fa5 -Author: Jose Rostagno -Date: Fri Jun 1 13:43:38 2012 +0200 - - Fix TestProperties.testBoxed test - - A typo was preventing the test from being run. - - https://bugzilla.gnome.org/show_bug.cgi?id=676644 - - Signed-off-by: Martin Pitt - - tests/test_properties.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 853e6a71234ebd66af5a64dfb296e323c2c905a6 -Author: Carlos Garnacho -Date: Thu May 17 17:09:15 2012 +0200 - - Fix handling of by-reference structs as out parameters - - When marshalling back from python, copy the result of by-reference - structs into the memory expected by the native caller, instead of - attempting to handle it as a pointer. - - https://bugzilla.gnome.org/show_bug.cgi?id=653151 - - Signed-off-by: Martin Pitt - - gi/pygi-closure.c | 17 +++++++++++++++++ - tests/test_gi.py | 5 +++++ - 2 files changed, 22 insertions(+) - -commit bac9d526f6a9774821d1c9c0e7b35cc6db942975 -Author: Martin Pitt -Date: Fri Jun 1 12:28:53 2012 +0200 - - tests: Add more vfunc checks for GIMarshallingTestsObject - - tests/test_gi.py | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - -commit e1aaf4a48453be0e69e7f3a70a2e7a790871a4d2 -Author: Martin Pitt -Date: Fri Jun 1 12:02:55 2012 +0200 - - Test caller-allocated GValue out parameter - - This came up as a side issue in - https://bugzilla.gnome.org/show_bug.cgi?id=653151 - - tests/test_gi.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit edc17e703e1a05e20545d3df9167ceb076450443 -Author: Bastian Winkler -Date: Wed May 16 11:13:05 2012 +0200 - - GObject.bind_property: Support transform functions - - Add support for optional transformation functions to - pygobject_bind_property(). It uses a custom PyGClosure to marshal the - return value correctly. - - https://bugzilla.gnome.org/show_bug.cgi?id=676169 - - Signed-off-by: Martin Pitt - - gi/_gobject/pygobject.c | 130 - +++++++++++++++++++++++++++++++++++++++++++++--- - tests/test_gobject.py | 59 ++++++++++++++++++++++ - 2 files changed, 181 insertions(+), 8 deletions(-) - -commit 07a08b49aae83a297e2f91240448314e4663f724 -Author: Carlos Garnacho -Date: Mon May 14 15:31:14 2012 +0200 - - Fix lookup of vfuncs in parent classes - - https://bugzilla.gnome.org/show_bug.cgi?id=672864. - - As subclasses implemented in python override the attribute for the - vfunc, __mro__ has to be used so subclasses of the subclass overriding - methods may find the corresponding VFuncInfo. - - Co-Authored-by: Martin Pitt - - gi/types.py | 6 +++--- - tests/test_gi.py | 27 +++++++++++++++++++++++++++ - 2 files changed, 30 insertions(+), 3 deletions(-) - -commit b965ee15bac6cd28d16d32205d96d2b1bdd3f0e1 -Author: Martin Pitt -Date: Fri Jun 1 08:18:40 2012 +0200 - - tests/test_properties.py: Fix whitespace - - The pep8 check failed on this. - - tests/test_properties.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 274d60a7c08d74a299f4b83d8054c00eadb4bdbd -Author: Jasper St. Pierre -Date: Wed May 30 16:45:53 2012 -0400 - - gi: Support zero-terminated arrays with length arguments - - Sometimes, you may see (array zero-terminated=1 length=length) - annotations. - Don't expose the length argument to the user in this case. - - https://bugzilla.gnome.org/show_bug.cgi?id=677124 - - gi/pygi-cache.c | 13 ++++--------- - tests/test_gi.py | 3 +++ - 2 files changed, 7 insertions(+), 9 deletions(-) - -commit 62c2e962a225ec2527aa3d7406aa0dae232a0886 -Author: Jasper St. Pierre -Date: Fri May 25 17:09:55 2012 -0400 - - Fix build - - libregress now needs cairo-gobject - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 9477f0f2f17a6d9b97e5ee08378bc009b8d4c30a -Author: Martin Pitt -Date: Mon May 14 15:48:34 2012 +0200 - - Fix comment in previous commit - - tests/test_gobject.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 6610428394d0c65987de5021bf2c38641cdb7116 -Author: Simon Feltman -Date: Tue May 8 20:04:09 2012 -0700 - - [API add] Add GObject.bind_property method - - This adds the "bind_property" method for binding two gobject - properties - together. The method returns a weak reference to a GBinding object. - The BindingWeakRef object is used to manage GBinding objects within - python - created through GObject.bind_property. It is a sub-class - PyGObjectWeakRef so - that we can maintain the same reference counting semantics between - Python - and GObject Binding objects. This gives explicit direct control of the - binding lifetime by using the "unbind" method on the BindingWeakRef - object - along with implicit management based on the lifetime of the source or - target objects. - - Note this does not yet include support for converter closures. This - can come - later after the initial implementation is accepted. - - https://bugzilla.gnome.org/show_bug.cgi?id=675582 - - Signed-off-by: Martin Pitt - - gi/_gobject/pygobject.c | 104 - +++++++++++++++++++++++++++++++++++++++++++++++- - tests/test_gobject.py | 90 +++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 193 insertions(+), 1 deletion(-) - -commit 88babe7377402f6e6f912a8b83615aab848eae81 -Author: Jose Rostagno -Date: Fri May 11 19:08:47 2012 -0300 - - pygtkcompat: Correctly set flags - - https://bugzilla.gnome.org/show_bug.cgi?id=675911 - - Signed-off-by: Martin Pitt - - gi/pygtkcompat.py | 5 ++--- - tests/test_pygtkcompat.py | 1 + - 2 files changed, 3 insertions(+), 3 deletions(-) - -commit 3f712b56397296bca2f5358cd52977b1a2011964 -Author: Jose Rostagno -Date: Fri May 11 12:39:05 2012 -0300 - - Gtk overrides: Implement __delitem__ on TreeModel - - https://bugzilla.gnome.org/show_bug.cgi?id=675892 - - Signed-off-by: Martin Pitt - - gi/overrides/Gtk.py | 16 ++++++++++++---- - tests/test_overrides.py | 9 +++++++++ - 2 files changed, 21 insertions(+), 4 deletions(-) - -commit 9a1a07742ec0b1821d469603f9996a2b7d832f40 -Author: Simon Feltman -Date: Sun May 6 18:10:39 2012 -0700 - - Gdk Color override should support red/green/blue_float properties - - Added red_float, green_float, and blue_float properties to Color. - Also added Color.from_floats, RGBA.to_color, and RGBA.from_color. - - https://bugzilla.gnome.org/show_bug.cgi?id=675579 - - Signed-off-by: Martin Pitt - - gi/overrides/Gdk.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ - tests/Makefile.am | 2 +- - tests/test_overrides.py | 17 +++++++++++++++++ - 3 files changed, 62 insertions(+), 1 deletion(-) - -commit d9608c332d9592f03545b110cfac8105453ea035 -Author: Martin Pitt -Date: Sat May 5 12:42:42 2012 -0700 - - Support marshalling of GVariants for closures - - Add GVariant handling to pyg_value_{as,from}_pyobject(), so that - closures can - be called with GVariant arguments and return GVariant. - - Unmark the corresponding test case as "expected failure", and also - add cases - for None values and type mismatches. - - https://bugzilla.gnome.org/show_bug.cgi?id=656554 - - gi/_gobject/pygtype.c | 47 - +++++++++++++++++++++++++++++++++++++++++++++-- - tests/test_everything.py | 16 ++++++++++++---- - 2 files changed, 57 insertions(+), 6 deletions(-) - -commit e7a909c16dc1c625ab11e270f23d540f15c71767 -Author: Johan Dahlin -Date: Mon May 7 10:33:40 2012 -0300 - - Require gobject-introspection 1.33.0 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 9e8239684433631e0d1650d25416e4d7bf92a058 -Author: Martin Pitt -Date: Sun May 6 18:28:23 2012 -0700 - - NEWS: Add API additions since 3.2.0 - - NEWS | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -commit d1a2bf51eb25b54028fbf496d20dfad9546bcb5e -Author: Martin Pitt -Date: Sun May 6 18:25:23 2012 -0700 - - NEWS: Mark API changes since 3.2.0 - - NEWS | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit a3329539291bd8ea9aa6cb184a05ea7c21f8885a -Author: Martin Pitt -Date: Sun May 6 18:19:35 2012 -0700 - - Fix commit 168a087 for Python 3 - - Simplify the type check and use the already existing one. Fix the - string check - to work with both Python 2 and 3. - - gi/pygi-argument.c | 42 +++++++++--------------------------------- - 1 file changed, 9 insertions(+), 33 deletions(-) - -commit 42c717ed77613e02f3c8ef2685bc071462b87d73 -Author: Martin Pitt -Date: Sun May 6 18:08:57 2012 -0700 - - pygtkcompat.py: Typo fix - - Was missing a space around operator, causing the PEP8 check to fail. - - gi/pygtkcompat.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 168a08753cec1ff77ccca5d81b9a5fd2af5d3720 -Author: Martin Pitt -Date: Sun May 6 18:02:04 2012 -0700 - - _pygi_argument_from_object(): Check for compatible data type - - Verify that the passed PyObject actually matches the expected type - of the - argument. With this, trying to assign a wrong type to a property - will now raise - a proper TypeError. - - gi/pygi-argument.c | 39 +++++++++++++++++++++++++++++++++++++++ - gi/pygi-property.c | 3 +++ - tests/test_gi.py | 40 ++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 82 insertions(+) - -commit 5948b62ba3e08ea943e6965ee38c94c363186226 -Author: Martin Pitt -Date: Sun May 6 17:59:57 2012 -0700 - - pygtkcompat: Fix color conversion - - gtk_style_context_get_background_color() returns a GdkRGBA value, - which has - float values between 0 and 1. However, we construct a GdkColor - object from - that, so we need to scale to 0..65535 and round to int. - - gi/pygtkcompat.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 6af74c501bc604559f8b5b4e0d856d022ed882bb -Author: Martin Pitt -Date: Sun May 6 06:02:31 2012 -0700 - - test_gi: Check setting properties in constructor - - tests/test_gi.py | 33 +++++++++++++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - -commit 9f50fd214e4214f83959b2883a0c667f7f157c97 -Author: Martin Pitt -Date: Sun May 6 05:50:00 2012 -0700 - - Support getting and setting GStrv properties - - gi/pygi-property.c | 36 ++++++++++++++++++++++++++++++++++++ - tests/test_gi.py | 11 +++++++++++ - 2 files changed, 47 insertions(+) - -commit 8321af2c7df499291e664c676376f149a0c3dcac -Author: Martin Pitt -Date: Sat May 5 13:58:29 2012 -0700 - - Support defining GStrv properties from Python - - gi/_gobject/propertyhelper.py | 10 ++++++-- - tests/test_properties.py | 58 - +++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 64 insertions(+), 4 deletions(-) - -commit f2494526e1c579c41babfe7ff67deef0f6966adf -Author: Martin Pitt -Date: Sat May 5 13:21:20 2012 -0700 - - Add GObject.TYPE_STRV constant - - gi/_gobject/__init__.py | 1 + - gi/_gobject/constants.py | 1 + - tests/test_everything.py | 2 +- - tests/test_signal.py | 2 +- - 4 files changed, 4 insertions(+), 2 deletions(-) - -commit 8c7306e4d6355ca45f8f1b4adf7d0595b4e8bcf8 -Author: Martin Pitt -Date: Sat May 5 09:28:36 2012 +0200 - - Unref GVariants when destroying the wrapper - - https://bugzilla.gnome.org/show_bug.cgi?id=675472 - - gi/overrides/GLib.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit d6c091d87c86c8ccc7cb54347fbceccedac61633 -Author: Martin Pitt -Date: Sat May 5 09:23:55 2012 +0200 - - Fix TestArrayGVariant test cases - - test_array_gvariant_container_in() and test_array_gvariant_full_in() - called - GIMarshallingTests.array_gvariant_none_in(), presumably a copy&paste - error. - Actually do what they mean to do now and call the corresponding - GIMarshallingTests methods. - - tests/test_gi.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit fda8a069d503e63c76a6b1ba285a181822549059 -Author: Jose Rostagno -Date: Sat May 5 08:52:41 2012 +0200 - - pygtkcompat: Add gdk.pixbuf_get_formats compat code - - https://bugzilla.gnome.org/show_bug.cgi?id=675489 - - Signed-off-by: Martin Pitt - - gi/pygtkcompat.py | 20 ++++++++++++++++++++ - tests/test_pygtkcompat.py | 8 ++++++++ - 2 files changed, 28 insertions(+) - -commit 2b49c5f58bb841de7a9077eeeaf996eb9851dab3 -Author: Jose Rostagno -Date: Mon Apr 30 13:44:19 2012 -0300 - - pygtkcompat: Add some more compat functions - - https://bugzilla.gnome.org/show_bug.cgi?id=675489 - - Signed-off-by: Martin Pitt - - gi/pygtkcompat.py | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -commit 16fbb17a9fd17eeb9f886af99e89a214d328dae1 -Author: Martin Pitt -Date: Thu May 3 12:25:04 2012 +0200 - - Fix tests for Python 3 - - cmp() does not exist any more in Python 3, replace with comparison - operators. - - GIMarshallingTests.array_in_nonzero_nonlen() expects a guint8 array, - so we - can't pass a str (which is an Unicode object in Python 3). Pass a - byte array - instead. - - tests/test_gi.py | 2 +- - tests/test_overrides.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit fd7f8eefbe8aba0b29d80e3eb9d985d33a268c8a -Author: Martin Pitt -Date: Thu May 3 09:38:56 2012 +0200 - - Fix building with --disable-cairo - - Build gobject-introspection's regress.c against cairo, not - pycairo/py3cairo. We - always need cairo to build, so unconditionally check for this in - configure.ac. - - In test_everything.py, gracefully handle the absence of the "cairo" - Python - module, which we do not have when building without cairo support. - - configure.ac | 3 +++ - tests/Makefile.am | 4 ++-- - tests/test_everything.py | 8 +++++++- - 3 files changed, 12 insertions(+), 3 deletions(-) - -commit 1c5634e6d98c8b67b37a2747951c66f5d8f1907d -Author: Martin Pitt -Date: Thu May 3 09:28:51 2012 +0200 - - tests: Fix deprecated assertions - - assertAlmostEquals → assertAlmostEqual - assertNotEquals → assertNotEqual - - tests/test_everything.py | 4 ++-- - tests/test_gi.py | 12 ++++++------ - tests/test_overrides.py | 10 +++++----- - 3 files changed, 13 insertions(+), 13 deletions(-) - -commit 07f312e66c07357168098d3f96813d2c997e8dc7 -Author: Martin Pitt -Date: Wed May 2 12:08:19 2012 +0200 - - Run tests with MALLOC_PERTURB_ - - We mostly use the glib allocation functions, but this might - help to uncover access to already freed or uninitialized memory in - a few edge - cases. - - tests/Makefile.am | 1 + - 1 file changed, 1 insertion(+) - -commit b0740d386c2cbbd153878209b584b568968e4d98 -Author: Martin Pitt -Date: Mon Apr 30 16:26:57 2012 +0200 - - configure.ac: Post-release bump to 3.3.2 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit d3977266faadacd3d05705497c1cf51a01a6606f -Author: Martin Pitt -Date: Mon Apr 30 16:08:09 2012 +0200 - - Release 3.3.1 - - NEWS | 66 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 66 insertions(+) - -commit a8e222f04aac3bcf7e4421c4da8d080eeb8b5f56 -Author: Giovanni Campagna -Date: Sun Apr 29 23:55:15 2012 +0200 - - GSettings: allow extra keyword arguments - - All GObject constructors are expected to accept any construct - property as keyword argument, and overrides should respect that. - In particular, not doing this for GSettings prevents using a custom - GSettingsSchema. - - https://bugzilla.gnome.org/show_bug.cgi?id=675105 - - Signed-off-by: Martin Pitt - - gi/overrides/Gio.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 592c67482c254f65817c1a1b5c5de5dfcaab31b4 -Author: Jose Rostagno -Date: Sun Apr 29 12:56:50 2012 -0300 - - pygtkcompat: Correct Userlist module use - - https://bugzilla.gnome.org/show_bug.cgi?id=675084 - - Signed-off-by: Martin Pitt - - gi/pygtkcompat.py | 2 +- - tests/test_pygtkcompat.py | 4 ++++ - 2 files changed, 5 insertions(+), 1 deletion(-) - -commit 3551462a429ef30274fa01fc8111da5025f9c342 -Author: Martin Pitt -Date: Sun Apr 29 20:17:47 2012 +0200 - - Add release-news make rule - - This produces a commit log since the previous release in our - current NEWS - format. This does not currently wrap long lines automatically, though. - - Do include bug numbers from now on, as they are very useful. - - Makefile.am | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -commit fe79ef612a7853f024b73c7997b8ec89015ae94c -Author: Martin Pitt -Date: Wed Apr 25 13:07:59 2012 +0200 - - Add "make check.nemiver" target - - Similar to "check.gdb", but invokes nemiver. - - Makefile.am | 3 +++ - tests/Makefile.am | 3 +++ - 2 files changed, 6 insertions(+) - -commit 3090cc70a7ce8df38dd6cf6c17350417a7367c0b -Author: Martin Pitt -Date: Tue Apr 24 13:24:00 2012 +0200 - - Test flags and enums in GHash values - - https://bugzilla.gnome.org/show_bug.cgi?id=637466 - - tests/test_everything.py | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -commit 88d189ec3e3d900a96496a50c1d6e76615b19558 -Author: Martin Pitt -Date: Tue Apr 24 13:03:36 2012 +0200 - - tests: Activate test_hash_in and apply workaround - - Work around pygobject's current inability to produce a GStrv object - from a - string array by explicitly producing a GStrV object, and reactivate - test case. - - https://bugzilla.gnome.org/show_bug.cgi?id=666636 - - tests/test_everything.py | 24 +++++++++++++----------- - 1 file changed, 13 insertions(+), 11 deletions(-) - -commit 8ee21619b3cfc179cf114813478470d9aa3f6fb8 -Author: Martin Pitt -Date: Mon Apr 23 12:33:09 2012 +0200 - - Add special case for Gdk.Atom array entries from Python - - Gdk.Atom pretends to be a struct pointer, but is really just an - int wrapped - into a pointer. So we must not dereference it directly, nor free - it, but - instead just copy the pointer value. - - Also add a few other test cases for "single Atom return", "single - Atom argument - in", and Atom GList return", which already work fine. - - https://bugzilla.gnome.org/show_bug.cgi?id=661709 - - gi/pygi-marshal-from-py.c | 18 ++++++++++++++---- - tests/Makefile.am | 1 + - tests/test_atoms.py | 41 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 56 insertions(+), 4 deletions(-) - -commit b9f24b4fbc2ca9f9b94b86f029c59b2fc3e8590f -Author: Martin Pitt -Date: Mon Apr 23 20:09:43 2012 +0200 - - test_gdbus: Call GetConnectionUnixProcessID() with correct signature - - https://bugzilla.gnome.org/show_bug.cgi?id=667954 - - tests/test_gdbus.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3ae38d7519524288a57e5d522954b9d6725f0185 -Author: Martin Pitt -Date: Mon Apr 23 18:47:34 2012 +0200 - - Add test case for Gtk.ListStore custom sort - - This works in Python 2, but crashes in Python 3, another case of - the segfaults - we get when C calls a Python callback in Python 3. - - https://bugzilla.gnome.org/show_bug.cgi?id=674475 - - tests/test_overrides.py | 31 +++++++++++++++++++++++++++++++ - 1 file changed, 31 insertions(+) - -commit c12b10ca0feaaf61f23354c7b6631a9ef3635c36 -Author: Martin Pitt -Date: Mon Apr 23 17:40:23 2012 +0200 - - GTK overrides: Add missing keyword arguments - - Add missing **kwargs to overridden __init__() constructors, to - allow specifying - arbitrary widget properties. - - https://bugzilla.gnome.org/show_bug.cgi?id=660018 - - gi/overrides/Gtk.py | 34 ++++++++++++++++++---------------- - tests/test_overrides.py | 6 ++++++ - 2 files changed, 24 insertions(+), 16 deletions(-) - -commit d37680bb9390426f7f58ea3d352c3e5e2106e978 -Author: Martin Pitt -Date: Mon Apr 23 15:24:04 2012 +0200 - - Add missing override for TreeModel.iter_previous() - - This should behave like the override for TreeModel.iter_next(). - - https://bugzilla.gnome.org/show_bug.cgi?id=660018 - - gi/overrides/Gtk.py | 6 ++++++ - tests/test_overrides.py | 4 ++++ - 2 files changed, 10 insertions(+) - -commit e03284f852f0e404cc91374f3e2e42b0ac1977b4 -Author: Martin Pitt -Date: Sun Apr 22 16:45:06 2012 +0200 - - pygi-convert.py: Drop obsolete drag method conversions - - Drop conversion of drag_source_unset() and drag_dest_{,un}set(). These - were - fixed a while ago to be proper Widget methods again. - - https://bugzilla.gnome.org/show_bug.cgi?id=652860 - - pygi-convert.sh | 3 --- - 1 file changed, 3 deletions(-) - -commit f82eca6006dec21624796074af8ffe9b2256f7a4 -Author: Martin Pitt -Date: Sat Apr 21 14:00:50 2012 +0200 - - tests: Replace deprecated assertEquals() with assertEqual() - - tests/test_everything.py | 144 ++++++------- - tests/test_gi.py | 502 - +++++++++++++++++++++++----------------------- - tests/test_gobject.py | 58 +++--- - tests/test_option.py | 6 +- - tests/test_overrides.py | 352 ++++++++++++++++---------------- - tests/test_properties.py | 18 +- - tests/test_pygtkcompat.py | 42 ++-- - 7 files changed, 561 insertions(+), 561 deletions(-) - -commit ddb0bf01e694585d58af52673a21796e7c9578ea -Author: Paolo Borelli -Date: Sat Apr 21 12:02:54 2012 +0200 - - Plug tiny leak in constant_info_get_value - - Fixes https://bugzilla.gnome.org/show_bug.cgi?id=642754 - - gi/pygi-info.c | 1 + - 1 file changed, 1 insertion(+) - -commit 9c48a561c5ee010410df7d6e430353b41d5fbd88 -Author: Bastian Winkler -Date: Thu Apr 12 20:30:05 2012 +0200 - - Fix len_arg_index for array arguments - - Don't set len_arg_index for arrays without the length annotation - given. - This fixes methods like Clutter.Texture.set_from_rgb_data() and - Clutter.Image.set_data() - - https://bugzilla.gnome.org/show_bug.cgi?id=674271 - - Signed-off-by: Martin Pitt - - gi/pygi-cache.c | 4 +++- - gi/pygi-marshal-cleanup.c | 4 ++-- - tests/test_gi.py | 3 +++ - 3 files changed, 8 insertions(+), 3 deletions(-) - -commit 71246ca0568bf3e9b81e88dd13b6d29e9417e313 -Author: Martin Pitt -Date: Thu Apr 19 13:11:56 2012 +0200 - - Support defining GType properties from Python - - Commit 84e3471 fixed the handling of GType properties for properties - that are - defined in the C library already. Add the missing support for - defining such - properties in Python as well. - - https://bugzilla.gnome.org/show_bug.cgi?id=674351 - - gi/_gobject/gobjectmodule.c | 5 ++++- - gi/_gobject/propertyhelper.py | 9 ++++++--- - tests/test_properties.py | 42 - +++++++++++++++++++++++++++++++++++++++--- - 3 files changed, 49 insertions(+), 7 deletions(-) - -commit 2158ecd05a2770d6538bae67d01d1f718855a7d4 -Author: Martin Pitt -Date: Thu Apr 19 16:12:29 2012 +0200 - - Fix typo in previous commit - - In the test case, actually assign the newly created object, so that - we test the - properties of the right object. - - tests/test_everything.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 84e3471ba4595534cbe6875f1c8b77776e1d1814 -Author: Bastian Winkler -Date: Wed Apr 18 21:44:08 2012 +0200 - - Handle GType properties correctly - - Fix conversion from/to properties of type G_TYPE_GTYPE - - https://bugzilla.gnome.org/show_bug.cgi?id=674351 - - Signed-off-by: Martin Pitt - - gi/_gobject/pygtype.c | 9 +++++++-- - tests/test_everything.py | 15 +++++++++++++++ - 2 files changed, 22 insertions(+), 2 deletions(-) - -commit d1362451e070e156d2f49c9cde930cc38befb12b -Author: Martin Pitt -Date: Thu Apr 19 07:27:10 2012 +0200 - - Add missing GObject.TYPE_GTYPE - - gi/_gobject/__init__.py | 1 + - gi/_gobject/constants.py | 1 + - 2 files changed, 2 insertions(+) - -commit d3225f1540e09719caa73e52d402e946da3add24 -Author: Martin Pitt -Date: Tue Apr 10 12:44:00 2012 +0200 - - Fix test_mainloop.py for Python 3 - - tests/test_mainloop.py | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -commit 903283119896f3e054694484da4147788b02ce60 -Author: Martin Pitt -Date: Mon Apr 9 15:20:39 2012 +0200 - - Make callback exception propagation test stricter - - Propagating Python exceptions from callbacks through the C context - back to the - original caller does not currently happen, is nontrivial/unsafe - to implement, - and not desirable at this point any more as by now we have established - the - current behaviour. So remove the catching of ZeroDivisionError in - the tests. - - https://bugzilla.gnome.org/show_bug.cgi?id=616279 - - tests/test_everything.py | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -commit 0fd900d351c8d7d57dc6a1b049ee05f342f6ab1d -Author: Simon Feltman -Date: Sun Mar 18 15:59:58 2012 -0700 - - Add context management to freeze_notify() and handler_block(). - - These methods now return a context manager object. Within the - __exit__ method - thaw_notify() and handler_unblock() are called respectively. This - allows - statements like the following: - - with obj.freeze_notify(): - obj.props.width = 100 - obj.props.height = 100 - obj.props.opacity = 0.5 - - This does not affect standard usage of these methods. - - https://bugzilla.gnome.org/show_bug.cgi?id=672324 - - Signed-off-by: Martin Pitt - - gi/_gobject/pygobject.c | 138 +++++++++++++++++++++++++++++++++++++++--- - tests/test_gobject.py | 158 - ++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 288 insertions(+), 8 deletions(-) - -commit c0922589964c1d8bffe5a56d2f56df96eedfac10 -Author: Martin Pitt -Date: Wed Apr 4 19:08:54 2012 +0200 - - Add support for GFlags properties - - https://bugzilla.gnome.org/show_bug.cgi?id=620943 - - gi/_gobject/propertyhelper.py | 9 +++++++-- - tests/test_properties.py | 28 +++++++++++++++++++++++++++- - 2 files changed, 34 insertions(+), 3 deletions(-) - -commit d4054be9de3b7e4ed64c8172ebbde0a697462c79 -Author: Martin Pitt -Date: Wed Apr 4 17:54:52 2012 +0200 - - Wrap GLib.Source.is_destroyed() method - - Based on original patch from Bryan Silverthorn. - - https://bugzilla.gnome.org/show_bug.cgi?id=524719 - - gi/_glib/pygsource.c | 15 +++++++++++++++ - tests/test_source.py | 24 ++++++++++++++++++++++++ - 2 files changed, 39 insertions(+) - -commit 05030a95a4d3090162ed5f510a26d69bbb152942 -Author: Martin Pitt -Date: Wed Apr 4 15:59:24 2012 +0200 - - Fix error message when trying to override a non-GI class - - Based on original patch by Juanje Ojeda . - - https://bugzilla.gnome.org/show_bug.cgi?id=646667 - - gi/overrides/__init__.py | 7 ++++--- - tests/test_overrides.py | 13 +++++++++++++ - 2 files changed, 17 insertions(+), 3 deletions(-) - -commit 96f14989baea76fe8692f10c1a37e2dfc45fecbf -Author: Steve Frécinaux -Date: Wed Apr 4 15:30:55 2012 +0200 - - Fix segfault when accessing __grefcount__ before creating the GObject - - When creating a new instance using Type() and trying to access - __grefcount__ before calling the subclass's __init__ function, there - used to be a segmentation fault because we were trying to access the - not yet created object. Now raise a proper exception instead. - - https://bugzilla.gnome.org/show_bug.cgi?id=640434 - - Co-authored-by: Martin Pitt - - gi/_gobject/pygobject.c | 4 ++++ - tests/test_gobject.py | 11 +++++++++++ - 2 files changed, 15 insertions(+) - -commit 24cc09a7105299805fcc5bc151f53ac69958d728 -Author: Steve Frécinaux -Date: Wed Feb 9 18:37:33 2011 +0100 - - Do not bind gobject_get_data() and gobject_set_data() - - They will basically cause a crash if misused, and you can always use a - python member attribute instead. - - https://bugzilla.gnome.org/show_bug.cgi?id=641944 - - Signed-off-by: Martin Pitt - - gi/_gobject/pygobject.c | 40 ---------------------------------------- - 1 file changed, 40 deletions(-) - -commit 2a5a33a9c9c170830c98c2e32fa8dcea3c35f2e6 -Author: Martin Pitt -Date: Tue Apr 3 22:26:34 2012 +0200 - - Add test case for multiple GLib.MainLoop instances - - Commit 832f16f9 fixed a lockup with multiple GLib.MainLoops. Add - corresponding - test case. - - https://bugzilla.gnome.org/show_bug.cgi?id=663068 - - tests/test_mainloop.py | 25 ++++++++++++++++++++++++- - 1 file changed, 24 insertions(+), 1 deletion(-) - -commit d03696c1aaa7e66f8f16554cf4a4b97addb5aea1 -Author: John (J5) Palmieri -Date: Tue Feb 21 15:13:42 2012 +0100 - - Add a ccallback type which is used to invoke callbacks passed to - a vfunc - - Used when overriding methods like gtk_container_forall wich pass in a - callback that needs to be executed on internal children: - def do_forall(self, callback, userdata): - callback(self.custom_child, userdata) - - https://bugzilla.gnome.org/show_bug.cgi?id=644926 - - Co-authored-by: Tomeu Vizoso - Co-authored-by: Simon Schampijer - - Signed-off-by: Martin Pitt - - gi/Makefile.am | 2 + - gi/gimodule.c | 1 + - gi/module.py | 5 +++ - gi/pygi-argument.c | 12 +---- - gi/pygi-cache.c | 28 ++++++++++-- - gi/pygi-cache.h | 9 ++-- - gi/pygi-ccallback.c | 100 - ++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-ccallback.h | 41 +++++++++++++++++ - gi/pygi-closure.c | 50 ++++++++++++++++++++- - gi/pygi-invoke-state-struct.h | 2 + - gi/pygi-invoke.c | 73 ++++++++++++++++++++---------- - gi/pygi-invoke.h | 3 ++ - gi/pygi-private.h | 1 + - gi/pygi.h | 10 +++++ - tests/test_gi.py | 16 +++++++ - 15 files changed, 312 insertions(+), 41 deletions(-) - -commit db7e1d078db16b6f11dee51aa97525c451346632 -Author: Alberto Mardegan -Date: Tue Mar 27 17:34:48 2012 +0200 - - Regression test: marshalling GValues in GHashTable - - https://bugzilla.gnome.org/show_bug.cgi?id=668903 - - Signed-off-by: Martin Pitt - - tests/test_everything.py | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -commit 7c0017c30129a8db391f902ed592782200d69c64 -Author: Martin Pitt -Date: Mon Mar 26 17:55:41 2012 +0200 - - Bump version to 3.3.1 - - 3.2.x is built from the pygobject-3-2 branch now, and 3.2.0 is - released. So - continue with 3.3.x on master. - - configure.ac | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 8309f305e5ce508fc5f6411c8153bea2cee5f741 -Author: Martin Pitt -Date: Mon Mar 26 17:51:37 2012 +0200 - - Update .gitignore - - - Ignore *.o, backup files, and generated Makefiles in all - subdirectories - - Ignore *.pyc files. - - Do not ignore .gitignore, we actually want to track this. - - .gitignore | 61 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 61 insertions(+) - -commit 81de788a72b40acd2f857718d78bdeea01d12eb1 -Author: Martin Pitt -Date: Mon Mar 26 17:45:08 2012 +0200 - - Fix "distcheck" and tests with out-of-tree builds - - - Symlink *.py files from srcdir into builddir during build, as - Python does not - accept the extensions and modules in different paths. - - "make clean" should remove *.pyc files - - tests/runtests.py: Look for tests in srcdir, not in builddir - - Makefile.am | 6 ++++-- - gi/Makefile.am | 13 +++++++++++-- - gi/_glib/Makefile.am | 12 ++++++++++-- - gi/_gobject/Makefile.am | 12 ++++++++++-- - gi/overrides/Makefile.am | 10 ++++++++++ - gi/repository/Makefile.am | 11 +++++++++++ - tests/runtests.py | 6 ++++-- - 7 files changed, 60 insertions(+), 10 deletions(-) - -commit f83d95e6fff572bda659a48e309b4524dafa4e83 -Author: Johan Dahlin -Date: Thu Mar 22 11:14:03 2012 -0300 - - Add a pep8 check to the makefile - - Also reorganize the pyflakes check, since target dependencies do not - take the exit status of the shell command into account. - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - tests/Makefile.am | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -commit d1f5474c6c50163aefe660e0689dc7f30e6cd48b -Author: Johan Dahlin -Date: Thu Mar 22 10:56:59 2012 -0300 - - PEP8: Remaining whitespace fixes - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/Icon View/iconviewedit.py | 7 +++---- - demos/gtk-demo/demos/Tree View/liststore.py | 28 - +++++++++++++------------- - demos/gtk-demo/demos/appwindow.py | 10 ++++----- - demos/gtk-demo/demos/rotatedtext.py | 2 +- - examples/cairo-demo.py | 4 ++-- - tests/test_gi.py | 12 +++++------ - tests/test_overrides.py | 2 +- - 7 files changed, 32 insertions(+), 33 deletions(-) - -commit 032fcce2bf6070a9001cbb780e90403051e303b1 -Author: Johan Dahlin -Date: Thu Mar 22 10:56:03 2012 -0300 - - PEP8: Add spaces before # - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/drawingarea.py | 6 +++--- - demos/gtk-demo/demos/images.py | 10 +++++----- - demos/gtk-demo/demos/rotatedtext.py | 2 +- - gi/__init__.py | 2 +- - gi/_glib/option.py | 2 +- - gi/_gobject/__init__.py | 2 +- - gi/overrides/GLib.py | 12 ++++++------ - gi/types.py | 4 ++-- - tests/runtests.py | 2 +- - tests/test_gdbus.py | 4 ++-- - 10 files changed, 23 insertions(+), 23 deletions(-) - -commit 6a58edbf11c612e9a14347b1556d1e0dd2ec1823 -Author: Johan Dahlin -Date: Thu Mar 22 10:52:05 2012 -0300 - - PEP8: Add missing whitespace after : and , - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/Tree View/liststore.py | 2 +- - demos/gtk-demo/demos/appwindow.py | 2 +- - tests/test_everything.py | 23 +++++++++-------------- - tests/test_gi.py | 2 +- - tests/test_overrides.py | 2 +- - 5 files changed, 13 insertions(+), 18 deletions(-) - -commit a8d361e66b2a0e09cfa5dbade4725074b0cc2fd1 -Author: Johan Dahlin -Date: Thu Mar 22 10:49:52 2012 -0300 - - PEP8: Remove too whitespace before } - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - tests/test_overrides.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2b8eb9fa5b9ca454d7130b3eec15a982fee1bdc9 -Author: Johan Dahlin -Date: Thu Mar 22 10:49:27 2012 -0300 - - PEP8: Remove too many blank lines - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/rotatedtext.py | 1 - - tests/test_overrides.py | 1 - - 2 files changed, 2 deletions(-) - -commit 03e597cb8f3b075efae556ee51a598695a883ad3 -Author: Johan Dahlin -Date: Thu Mar 22 10:48:59 2012 -0300 - - PEP8: Fix whitespace around operators - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/images.py | 2 +- - examples/cairo-demo.py | 8 ++++---- - tests/test_gi.py | 4 ++-- - tests/test_overrides.py | 8 ++++---- - tests/test_properties.py | 14 +++++++------- - tests/test_signal.py | 2 +- - 6 files changed, 19 insertions(+), 19 deletions(-) - -commit 21aeb19107b718293116e51ecd6479d4d7198b8f -Author: Johan Dahlin -Date: Thu Mar 22 10:46:17 2012 -0300 - - PEP8: Remove whitespace before ( - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/Entry/entry_buffer.py | 2 +- - demos/gtk-demo/demos/Entry/entry_completion.py | 2 +- - demos/gtk-demo/demos/Entry/search_entry.py | 12 ++--- - demos/gtk-demo/demos/Icon View/iconviewedit.py | 4 +- - demos/gtk-demo/demos/Tree View/liststore.py | 2 +- - demos/gtk-demo/demos/dialogs.py | 12 ++--- - demos/gtk-demo/demos/pickers.py | 8 ++-- - demos/gtk-demo/demos/pixbuf.py | 4 +- - demos/gtk-demo/demos/printing.py | 8 ++-- - demos/gtk-demo/demos/rotatedtext.py | 2 +- - demos/gtk-demo/gtk-demo.py | 4 +- - gi/module.py | 4 +- - gi/overrides/Pango.py | 2 +- - gi/pygtkcompat.py | 4 +- - tests/test_everything.py | 4 +- - tests/test_overrides.py | 62 - +++++++++++++------------- - 16 files changed, 68 insertions(+), 68 deletions(-) - -commit b04d209930ab01bae6563b0d714aec829739bdc6 -Author: Johan Dahlin -Date: Thu Mar 22 10:40:46 2012 -0300 - - PEP8: Remove whitespace around {} - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - tests/test_signal.py | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -commit 725483a5dc36739dc7836716b5d6d48091564bf8 -Author: Johan Dahlin -Date: Thu Mar 22 10:38:59 2012 -0300 - - PEP8: run via --fix from craigds fork - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/Entry/entry_buffer.py | 1 + - demos/gtk-demo/demos/Entry/entry_completion.py | 1 + - demos/gtk-demo/demos/Entry/search_entry.py | 3 +- - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 1 + - demos/gtk-demo/demos/Icon View/iconviewedit.py | 2 + - demos/gtk-demo/demos/Tree View/liststore.py | 3 ++ - demos/gtk-demo/demos/appwindow.py | 13 +++++- - demos/gtk-demo/demos/assistant.py | 1 + - demos/gtk-demo/demos/builder.py | 1 + - demos/gtk-demo/demos/button_box.py | 1 + - demos/gtk-demo/demos/clipboard.py | 2 +- - demos/gtk-demo/demos/colorselector.py | 1 + - demos/gtk-demo/demos/combobox.py | 4 +- - demos/gtk-demo/demos/dialogs.py | 2 + - demos/gtk-demo/demos/drawingarea.py | 1 + - demos/gtk-demo/demos/expander.py | 4 +- - demos/gtk-demo/demos/images.py | 10 +++-- - demos/gtk-demo/demos/infobars.py | 2 + - demos/gtk-demo/demos/links.py | 2 + - demos/gtk-demo/demos/menus.py | 2 + - demos/gtk-demo/demos/pickers.py | 2 + - demos/gtk-demo/demos/pixbuf.py | 2 + - demos/gtk-demo/demos/printing.py | 5 ++- - demos/gtk-demo/demos/rotatedtext.py | 4 +- - demos/gtk-demo/demos/test.py | 1 + - demos/gtk-demo/gtk-demo.py | 9 ++-- - examples/cairo-demo.py | 57 - ++++++++++++++---------- - examples/option.py | 1 - - examples/properties.py | 1 + - examples/signal.py | 4 ++ - gi/__init__.py | 2 + - gi/_glib/option.py | 4 +- - gi/_gobject/__init__.py | 1 + - gi/_gobject/propertyhelper.py | 5 ++- - gi/module.py | 3 ++ - gi/overrides/GIMarshallingTests.py | 2 + - gi/overrides/GLib.py | 12 +++-- - gi/overrides/Gdk.py | 9 ++++ - gi/overrides/Gio.py | 4 ++ - gi/overrides/Gtk.py | 56 - ++++++++++++++++++++--- - gi/overrides/Pango.py | 2 + - gi/overrides/__init__.py | 5 ++- - gi/pygtkcompat.py | 16 +++++-- - gi/types.py | 4 ++ - tests/test_everything.py | 30 +++++++++---- - tests/test_gdbus.py | 1 + - tests/test_gi.py | 30 +++++++------ - tests/test_gobject.py | 3 +- - tests/test_mainloop.py | 1 + - tests/test_option.py | 1 + - tests/test_overrides.py | 55 - ++++++++++++----------- - tests/test_properties.py | 11 ++++- - tests/test_signal.py | 32 ++++++++++++- - tests/test_source.py | 1 + - tests/test_subprocess.py | 1 + - tests/test_thread.py | 1 + - tests/test_uris.py | 1 + - tests/testmodule.py | 1 + - 58 files changed, 326 insertions(+), 111 deletions(-) - -commit 917275d4aa81db39ccaca34fa514032fb80a3187 -Author: Johan Dahlin -Date: Thu Mar 22 10:33:29 2012 -0300 - - PEP8: Remove spaces around = for keyword arguments - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/appwindow.py | 8 ++++---- - demos/gtk-demo/demos/colorselector.py | 4 ++-- - demos/gtk-demo/gtk-demo.py | 24 ++++++++++++------------ - examples/option.py | 4 ++-- - gi/_glib/option.py | 2 +- - gi/overrides/Gtk.py | 2 +- - tests/test_gi.py | 26 +++++++++++++------------- - tests/test_option.py | 2 +- - tests/test_overrides.py | 8 ++++---- - 9 files changed, 40 insertions(+), 40 deletions(-) - -commit 0c85656f95d3cb31becff10bbee7faae7b0b875b -Author: Johan Dahlin -Date: Thu Mar 22 10:28:28 2012 -0300 - - PEP8: Remove trailing ; - - https://bugzilla.gnome.org/show_bug.cgi?id=672627 - - demos/gtk-demo/demos/appwindow.py | 4 ++-- - demos/gtk-demo/demos/dialogs.py | 30 +++++++++++++++--------------- - demos/gtk-demo/demos/links.py | 2 +- - demos/gtk-demo/demos/pixbuf.py | 2 +- - demos/gtk-demo/demos/printing.py | 8 ++++---- - gi/overrides/Gtk.py | 4 ++-- - tests/test_everything.py | 22 +++++++++++----------- - tests/test_gi.py | 2 +- - tests/test_overrides.py | 8 ++++---- - 9 files changed, 41 insertions(+), 41 deletions(-) - -commit 32cc594ab6dfbd4843f3db5ec8338d31ad5df6c6 -Author: Johan Dahlin -Date: Thu Mar 22 10:24:40 2012 -0300 - - Remove all tabs and fix indentation - - By running the whole source tree via the indent.py script found - in the Python distribution. - - demos/gtk-demo/demos/Entry/search_entry.py | 4 +- - demos/gtk-demo/demos/Icon View/iconviewedit.py | 41 +++---- - demos/gtk-demo/demos/Tree View/liststore.py | 8 +- - demos/gtk-demo/demos/appwindow.py | 18 +-- - demos/gtk-demo/demos/dialogs.py | 26 ++--- - demos/gtk-demo/demos/expander.py | 6 +- - demos/gtk-demo/demos/images.py | 2 +- - demos/gtk-demo/demos/links.py | 2 +- - demos/gtk-demo/demos/rotatedtext.py | 20 ++-- - gi/_glib/option.py | 2 +- - gi/_gobject/constants.py | 1 - - gi/importer.py | 1 - - gi/module.py | 10 +- - gi/overrides/GLib.py | 11 +- - gi/overrides/Gdk.py | 30 ++--- - gi/overrides/Gio.py | 4 +- - gi/overrides/Gtk.py | 150 - ++++++++++++------------- - gi/overrides/Pango.py | 1 - - gi/overrides/__init__.py | 10 +- - gi/pygtkcompat.py | 2 +- - tests/compathelper.py | 2 +- - tests/runtests.py | 19 ++-- - tests/test_everything.py | 22 ++-- - tests/test_gdbus.py | 11 +- - tests/test_gi.py | 38 +++---- - tests/test_gobject.py | 2 +- - tests/test_interface.py | 1 - - tests/test_option.py | 1 - - tests/test_overrides.py | 78 ++++++------- - tests/test_properties.py | 2 +- - tests/test_uris.py | 1 - - 31 files changed, 255 insertions(+), 271 deletions(-) - -commit c375e3136f0f48eb8a6717c0053155db088b329d -Author: Martin Pitt -Date: Thu Mar 22 10:32:43 2012 +0100 - - tests: Replace deprecated Python API - - failIf → assertFalse, failUnless → assertTrue - - Caught by the previous commit of making deprecations fatal. - - tests/test_option.py | 10 +++---- - tests/test_overrides.py | 66 - +++++++++++++++++++++++------------------------ - tests/test_properties.py | 14 +++++----- - tests/test_pygtkcompat.py | 18 ++++++------- - tests/test_signal.py | 4 +-- - 5 files changed, 56 insertions(+), 56 deletions(-) - -commit 32525e565cc48454cdacbc44ad3fd751b81cb7e3 -Author: Martin Pitt -Date: Thu Mar 22 10:31:22 2012 +0100 - - Fail tests if they use or encounter deprecations - - tests/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 65762243a34af014950527c323a51a29d40fb3e1 -Author: Martin Pitt -Date: Thu Mar 22 10:15:16 2012 +0100 - - Do not run tests in two phases any more - - As we dropped the static bindings a while ago, there is no need any - more to run - the tests in two phases (static/GI). Now just run them all in one go, - simplifying tests/Makefile.am. - - As this changes the order of the tests, defining $GSETTINGS_SCHEMA_DIR - now - needs to happen even further, so move it from tests/test_overrides.py - to - tests/runtests.py. - - tests/Makefile.am | 33 ++++++++++++--------------------- - tests/runtests.py | 7 +++++++ - tests/test_overrides.py | 6 ------ - 3 files changed, 19 insertions(+), 27 deletions(-) - -commit 3b4ae83a0ece8e3aed1de5452e2acd32841e629a -Author: Martin Pitt -Date: Thu Mar 22 09:58:21 2012 +0100 - - test_overrides: Find local gsettings schema with current glib - - With current glib, gsettings now fails to find the gschemas.compiled - during the - tests. Move the setting of $GSETTINGS_SCHEMA_DIR before the module - import, - which makes this work again. - - tests/test_overrides.py | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -commit 927f7877ffa5e16c4cabcecbc05656ee0ec6a167 -Author: Paolo Borelli -Date: Wed Mar 21 21:09:24 2012 +0100 - - Add GtkComboBoxEntry compatibility - - This widget has been removed in Gtk+ 3, add a small wrapper to the - compat module to make at least basic pygtk programs that use it work. - - https://bugzilla.gnome.org/show_bug.cgi?id=672589 - - gi/pygtkcompat.py | 19 +++++++++++++++++++ - tests/test_pygtkcompat.py | 22 ++++++++++++++++++++++ - 2 files changed, 41 insertions(+) - -commit b322d6a1f6d44bace4eefb98558cfe94a73a727c -Author: Johan Dahlin -Date: Wed Mar 21 16:01:35 2012 -0300 - - Correct review comments from Martin - - https://bugzilla.gnome.org/show_bug.cgi?id=672578 - - tests/test_everything.py | 4 ++-- - tests/test_pygtkcompat.py | 18 ++++++++++++++++++ - 2 files changed, 20 insertions(+), 2 deletions(-) - -commit c8bc6ae10cfe8b2eff4204ec2175907a6eb0585a -Author: Johan Dahlin -Date: Wed Mar 21 14:45:53 2012 -0300 - - Correct pyflakes warnings/errors - - And add a target to make check that runs pyflakes. - - https://bugzilla.gnome.org/show_bug.cgi?id=672578 - - demos/gtk-demo/demos/Entry/entry_buffer.py | 2 +- - demos/gtk-demo/demos/Entry/entry_completion.py | 2 +- - demos/gtk-demo/demos/Entry/search_entry.py | 12 +- - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 2 +- - demos/gtk-demo/demos/Icon View/iconviewedit.py | 2 +- - demos/gtk-demo/demos/Tree View/liststore.py | 3 +- - demos/gtk-demo/demos/appwindow.py | 13 +- - demos/gtk-demo/demos/assistant.py | 4 +- - demos/gtk-demo/demos/builder.py | 4 +- - demos/gtk-demo/demos/button_box.py | 2 +- - demos/gtk-demo/demos/clipboard.py | 2 +- - demos/gtk-demo/demos/colorselector.py | 2 +- - demos/gtk-demo/demos/combobox.py | 4 +- - demos/gtk-demo/demos/dialogs.py | 4 +- - demos/gtk-demo/demos/drawingarea.py | 2 +- - demos/gtk-demo/demos/expander.py | 4 +- - demos/gtk-demo/demos/images.py | 8 +- - demos/gtk-demo/demos/infobars.py | 2 +- - demos/gtk-demo/demos/links.py | 2 +- - demos/gtk-demo/demos/menus.py | 5 +- - demos/gtk-demo/demos/pickers.py | 2 +- - demos/gtk-demo/demos/pixbuf.py | 2 +- - demos/gtk-demo/demos/printing.py | 3 +- - demos/gtk-demo/demos/rotatedtext.py | 6 +- - demos/gtk-demo/gtk-demo.py | 9 +- - examples/cairo-demo.py | 2 +- - gi/__init__.py | 4 + - gi/_glib/__init__.py | 101 ++++++++++- - gi/_glib/option.py | 1 + - gi/_gobject/__init__.py | 203 - ++++++++++++++++++++--- - gi/_gobject/constants.py | 2 - - gi/_gobject/propertyhelper.py | 4 +- - gi/importer.py | 2 +- - gi/module.py | 1 - - gi/overrides/Gtk.py | 1 - - gi/overrides/__init__.py | 1 - - gi/pygtkcompat.py | 2 + - gi/types.py | 3 + - tests/Makefile.am | 5 + - tests/test_everything.py | 6 +- - tests/test_gi.py | 8 +- - tests/test_option.py | 10 +- - tests/test_overrides.py | 30 ++-- - tests/test_properties.py | 12 +- - tests/test_pygtkcompat.py | 4 - - tests/test_signal.py | 4 +- - tests/test_source.py | 6 +- - 47 files changed, 377 insertions(+), 138 deletions(-) - -commit 39650906559fcc39b4be406fa7e25c4788d349a3 -Author: Martin Pitt -Date: Wed Mar 21 16:59:33 2012 +0100 - - Make tests fail on CRITICAL logs, too, and apply to all tests - - Instead of setting warnings/criticals to fatal in individual test - modules, do - it in runtests.py, so that it applies to all tests. - - We currently have some tests which are known to generate CRITICALs - (now marked - with FIXME), and some WARNINGs (as they test behaviour with known-bad - values). - For these, warnings/criticals are now explicitly permitted. - - tests/runtests.py | 1 + - tests/test_gi.py | 7 ++++++- - tests/test_overrides.py | 14 +++++++------- - tests/test_properties.py | 36 +++++++++++++++++++++--------------- - 4 files changed, 35 insertions(+), 23 deletions(-) - -commit efcb4b0b32c4dda06c3eeec83802fc0f302f0d27 -Author: Alberto Mardegan -Date: Tue Mar 20 14:55:07 2012 +0400 - - Support marshalling GI_TYPE_TAG_INTERFACE - - Marshalling of interfaces got broken with commit - 7746d2188ac4933c2c9011d84525d1e62fc18953. - - Also, do not abort on unsupported types, but log a critical failure - and - continue. - - https://bugzilla.gnome.org/show_bug.cgi?id=668903 - - gi/pygi-marshal-from-py.c | 3 ++- - gi/pygi-marshal-to-py.c | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -commit 8d85d6639778ec6364235071d272d67e7aae49ae -Author: Martin Pitt -Date: Wed Mar 21 14:34:36 2012 +0100 - - Fix warnings on None values in added tree/list store rows - - Commit bf8c95836e1c changed the List/TreeStore overrides to use - insert_with_valuesv(), but supplied all columns instead of just - those which are - not None. With this, None values cause warnings like - - (runtests.py:12375): Gtk-WARNING **: - /build/buildd/gtk+3.0-3.3.20/./gtk/gtkliststore.c:851: Unable to - convert from (null) to gboolean - - Update the tests to make warnings fatal, to catch this better. - - Change _convert_row() to skip the None entries and return the list - of not-None - columns, and use the latter instead of a simple range(n_columns). This - matches - the behaviour before bf8c95836e1c, where columns with None values - were skipped - as well. - - https://bugzilla.gnome.org/show_bug.cgi?id=672463 - - gi/overrides/Gtk.py | 26 ++++++++++++++------------ - tests/test_overrides.py | 5 +++++ - 2 files changed, 19 insertions(+), 12 deletions(-) - -commit 38aecc481741fd3a319a76a0ec8bf5329a483876 -Author: Martin Pitt -Date: Wed Mar 21 15:21:02 2012 +0100 - - pygtkcompat test: Properly clean up PixbufLoader - - Tests currently give - - (runtests.py:15072): GdkPixbuf-WARNING **: GdkPixbufLoader finalized - without calling gdk_pixbuf_loader_close() - this is not allowed. You - must explicitly end the data stream to the loader before dropping - the last reference. - - Fix this by calling close(). - - tests/test_pygtkcompat.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 5e0e5e72a4436badd09f0aa07f62960afcdca8c6 -Author: Martin Pitt -Date: Mon Mar 19 16:58:22 2012 +0100 - - post-release bump - - Use 3.1.93 for now, this will most likely become 3.2.0 as it is. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 88924e399d7ccf7af2e9a78720e0c508cd6080d8 -Author: Martin Pitt -Date: Mon Mar 19 16:41:17 2012 +0100 - - Release 3.1.92 - - NEWS | 46 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 46 insertions(+) - -commit b41e6139befb984c0b78bcefe2630ab1393b4b40 -Author: Martin Pitt -Date: Mon Mar 19 16:14:54 2012 +0100 - - README: Update current maintainers - - Also update Martin's email address. - - README | 10 ++++++---- - pygobject.doap | 2 +- - 2 files changed, 7 insertions(+), 5 deletions(-) - -commit 45e27ba7e447552057a2950fc768c63ff2e6612e -Author: Martin Pitt -Date: Mon Mar 19 16:11:22 2012 +0100 - - Bump version to 3.1.92, in sync with GNOME - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 77d358f8c5f524259249ea686899e3a4da05562e -Author: Johan Dahlin -Date: Mon Mar 19 11:54:07 2012 -0300 - - Correct Gtk.TreePath.__iter__ to work with Python 3 - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 1f18bcb37bdc42368ad9a07c7f348f736c2f665d -Author: Martin Pitt -Date: Mon Mar 19 15:54:13 2012 +0100 - - Fix pygtkcompat.py to work with Python 3 - - gi/pygtkcompat.py | 20 +++++++++++++++----- - 1 file changed, 15 insertions(+), 5 deletions(-) - -commit 96a9f92da801989464fbcedf6d849819f6dbea64 -Author: Martin Pitt -Date: Mon Mar 19 15:32:22 2012 +0100 - - Fix test_everything.TestSignals.test_object_param_signal test case - - The callback gets two arguments, not one. This short-circuited - the actual - assertions. Fix the arguments and update the refcount check, as it - is not - exactly two at the moment. - - tests/test_everything.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit ba00afb1e50759b2b321f16e05a15946053cdafa -Author: Johan Dahlin -Date: Mon Mar 19 10:58:09 2012 -0300 - - pygtkcompat: Remove first argument for get_origin() - - gi/pygtkcompat.py | 5 +++++ - tests/test_pygtkcompat.py | 5 +++++ - 2 files changed, 10 insertions(+) - -commit 65499246a862ce6a82bc3b0cc74fe8ff82dde687 -Author: Johan Dahlin -Date: Fri Mar 16 16:08:44 2012 -0300 - - GtkViewport: Add a default values for the adjustment constructor - parameters - - https://bugzilla.gnome.org/show_bug.cgi?id=672260 - - gi/overrides/Gtk.py | 10 ++++++++++ - tests/test_overrides.py | 11 +++++++++++ - 2 files changed, 21 insertions(+) - -commit 43c761d9f35252dcb58b9cf2278016d841eea4ec -Author: Johan Dahlin -Date: Fri Mar 16 16:08:23 2012 -0300 - - GtkIconSet: Add a default value for the pixbuf constructor parameter - - https://bugzilla.gnome.org/show_bug.cgi?id=672260 - - gi/overrides/Gtk.py | 11 +++++++++++ - tests/test_overrides.py | 6 ++++++ - 2 files changed, 17 insertions(+) - -commit 116d3712251b1b8aa2d4f4a9e40e22f5b9fcbe4f -Author: Johan Dahlin -Date: Fri Mar 16 16:07:30 2012 -0300 - - PangoLayout: Add a default value for set_markup() - - https://bugzilla.gnome.org/show_bug.cgi?id=672260 - - gi/overrides/Pango.py | 3 +++ - tests/test_overrides.py | 4 ++++ - 2 files changed, 7 insertions(+) - -commit a3ca47b086b7fcf084282be788c5d737dde847ac -Author: Johan Dahlin -Date: Fri Mar 16 16:06:37 2012 -0300 - - Gtk[HV]Scrollbar: Add a default value for the adjustment constructor - parameter - - https://bugzilla.gnome.org/show_bug.cgi?id=672260 - - gi/overrides/Gtk.py | 15 +++++++++++++++ - tests/test_overrides.py | 14 ++++++++++++++ - 2 files changed, 29 insertions(+) - -commit 458dab08c78cb730dd95bcd67af20a0d73a3af2f -Author: Johan Dahlin -Date: Fri Mar 16 16:06:12 2012 -0300 - - GtkToolButton: Add a default value for the stock_id constructor - parameter - - https://bugzilla.gnome.org/show_bug.cgi?id=672260 - - gi/overrides/Gtk.py | 10 ++++++++++ - tests/test_overrides.py | 9 ++++++++- - 2 files changed, 18 insertions(+), 1 deletion(-) - -commit 2f7789a5a1f55ec38c5ff0f96bc5c9023679a333 -Author: Johan Dahlin -Date: Fri Mar 16 16:05:55 2012 -0300 - - GtkIconView: Add a default value for the model constructor parameter - - https://bugzilla.gnome.org/show_bug.cgi?id=672260 - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 11 +++++++++++ - 2 files changed, 14 insertions(+) - -commit 2dd9dadd1bd92c3324e9de209ba8205a9d4106d6 -Author: Johan Dahlin -Date: Thu Mar 15 15:22:46 2012 -0300 - - Add a default value for column in Gtk.TreeView.get_cell_area() - - https://bugzilla.gnome.org/show_bug.cgi?id=672260 - - gi/overrides/Gtk.py | 5 +++++ - tests/test_overrides.py | 3 +++ - 2 files changed, 8 insertions(+) - -commit bf8c95836e1cc1e1629937cbc69ea3027fb82746 -Author: Martin Pitt -Date: Thu Mar 15 09:48:10 2012 +0100 - - Atomic inserts in Gtk.{List,Tree}Store overrides - - Gtk.{List,Tree}Store's overrides provide append(), insert() - etc. methods which - take an optional data row array. If this is given, use - insert_with_valuesv() - instead of creating a new iter and then filling it with data. The - latter sent a - row-added signal, at which time the row was still empty, and a - subsequent - row-changed signal. With this we only get a single row-added - signal with - complete row data. - - Note that this does not change insert_{before,after}(), as there is no - counterpart of insert_with_valuesv() which takes a TreeIter instead - of a - position. For those you will still get two signals, and have to deal - with None - values. - - https://bugzilla.gnome.org/show_bug.cgi?id=671610 - - gi/overrides/Gtk.py | 81 - ++++++++++++++++++++++++++++++------------------- - tests/test_overrides.py | 74 ++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 124 insertions(+), 31 deletions(-) - -commit f7db4eaf8148f2dd8bf1718152a1dcae509470c7 -Author: Martin Pitt -Date: Sun Mar 18 16:07:26 2012 +0100 - - Fix Gtk.Button constructor to accept use_stock parameter - - Thanks to kalanzun@googlemail.com! - - https://bugzilla.gnome.org/show_bug.cgi?id=672318 - - Signed-off-by: Martin Pitt - - gi/overrides/Gtk.py | 4 +--- - tests/test_overrides.py | 6 ++++++ - 2 files changed, 7 insertions(+), 3 deletions(-) - -commit 466337cf2fd091738eeab12c10d250a9d0827284 -Author: Johan Dahlin -Date: Fri Mar 16 16:55:47 2012 -0300 - - Correct bad rebase, remove duplicate Window - - gi/overrides/Gtk.py | 7 ------- - 1 file changed, 7 deletions(-) - -commit c60d5ee3c88bd8e1c68ea97f079947cf79d5bb7d -Author: Johan Dahlin -Date: Thu Mar 15 15:42:28 2012 -0300 - - Add a PyGTK compatibility layer - - This module tries quite a bit harder to maintain compatibility - with PyGTK, module names, enums, flags and some API. - - https://bugzilla.gnome.org/show_bug.cgi?id=653462 - - gi/Makefile.am | 3 +- - gi/pygtkcompat.py | 421 - ++++++++++++++++++++++++++++++++++++++++++++++ - tests/Makefile.am | 3 +- - tests/test_pygtkcompat.py | 77 +++++++++ - 4 files changed, 502 insertions(+), 2 deletions(-) - -commit 680a2e04ac4f80ad16e820d3f753519477c988aa -Author: Johan Dahlin -Date: Wed Mar 14 15:20:53 2012 -0300 - - Add bw-compatible arguments to Gtk.Adjustment - - The argument used to be called page/step_incr, if they - are found map them to the existing properties for extra - compatibility. - - https://bugzilla.gnome.org/show_bug.cgi?id=672087 - - gi/overrides/Gtk.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -commit fbd21ee7176bc1b70547ea464b512c8ffd674187 -Author: Johan Dahlin -Date: Wed Mar 14 17:13:04 2012 -0300 - - GtkTreePath: make it iterable - - https://bugzilla.gnome.org/show_bug.cgi?id=672093 - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 2 ++ - 2 files changed, 5 insertions(+) - -commit a7b08cb75541612c78d123b1d968be7874e3c481 -Author: Johan Dahlin -Date: Wed Mar 14 13:32:31 2012 -0300 - - Add a default argument to TreeModelFilter.set_visible_func() - - https://bugzilla.gnome.org/show_bug.cgi?id=672081 - - gi/overrides/Gtk.py | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -commit 02950cabb38b1b3c9378c42c069eefdbccbce17d -Author: Johan Dahlin -Date: Wed Mar 14 13:31:41 2012 -0300 - - Add a default argument to Gtk.TreeView.set_cursor - - And also make sure that the path is a Gtk.TreePath. - - https://bugzilla.gnome.org/show_bug.cgi?id=672081 - - gi/overrides/Gtk.py | 4 ++++ - tests/test_overrides.py | 10 ++++++++++ - 2 files changed, 14 insertions(+) - -commit 7245bd0ae3f6243c79fa8543a0ed1e50e5015844 -Author: Johan Dahlin -Date: Wed Mar 14 13:31:06 2012 -0300 - - Add a default argument to Pango.Context.get_metrics() - - https://bugzilla.gnome.org/show_bug.cgi?id=672081 - - gi/overrides/Pango.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit bc1fd8814df6c1e85b586d0fb943c89f7e2b78b5 -Author: Martin Pitt -Date: Fri Mar 16 13:27:56 2012 +0100 - - Fix double-freeing GValues in arrays - - When marshalling a GValue array to C, the GValue items are copied - into a C - GValue array, not a C GValue pointer - array. _pygi_marshal_from_py_array() - already calls the cleanup_func for the original item; - _pygi_marshal_cleanup_from_py_array() must not do it again, as this - would try - to g_slice_free the array item. - - https://bugzilla.gnome.org/show_bug.cgi?id=672224 - - gi/pygi-marshal-from-py.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit a906b7d1947ba905f959d3f738eb6c29b02f96e7 -Author: Simon Feltman -Date: Fri Mar 16 00:29:31 2012 -0700 - - Renamed "property" class to "Property" - - Renamed to match the rest of the class names in GObject and also - not clobber the builtin python property. - - Keep the old "property" identifier for backwards compatibility - for now. - - https://bugzilla.gnome.org/show_bug.cgi?id=672168 - - Signed-off-by: Martin Pitt - - examples/properties.py | 6 +-- - gi/_gobject/__init__.py | 7 ++-- - gi/_gobject/propertyhelper.py | 12 +++--- - tests/test_interface.py | 4 +- - tests/test_properties.py | 94 - +++++++++++++++++++++---------------------- - 5 files changed, 62 insertions(+), 61 deletions(-) - -commit d7d28d717e38c0546529b09b8b571a5cc631c5b5 -Author: Martin Pitt -Date: Wed Mar 14 22:52:47 2012 +0100 - - Fix Python to C marshalling of GValue arrays - - For GValues we cannot just copy the GValue memory in - _pygi_marshal_from_py_array(), as the from_py_cleanup() function - clears and - releases the GValue and with it its v_pointer. Use g_value_copy() - to copy by - value instead. - - This uncovered another bug in _pygi_marshal_cleanup_from_py_array(): - It always - assumed that C arrays contained pointers, but this is not the case - for GValue - arrays: these are actual struct arrays, not struct pointer arrays - (cf. their - construction in _pygi_marshal_from_py_array()). Check if an array - contains - pointers or values and compute the correct array item pointer for - both cases. - - Also add a corresponding test case for marshalling GValue arrays - from C back to - Python, which works fine. - - https://bugzilla.gnome.org/show_bug.cgi?id=672065 - - gi/pygi-marshal-cleanup.c | 19 ++++++++++++++----- - gi/pygi-marshal-from-py.c | 13 ++++++++++++- - tests/test_gi.py | 8 ++++++++ - 3 files changed, 34 insertions(+), 6 deletions(-) - -commit 27ac9c1de6487035b18ef4511c155d251cb6d39d -Author: Johan Dahlin -Date: Fri Mar 16 09:59:57 2012 +0100 - - Correct the Gtk.Window hierarchy - - We need to make sure that all Gtk.Dialog subclasses inherit from - the overridden Window class. For that to be done automaticly we need - to create the Window class before the Dialog class. - - Now when it's inherited properly we need to avoid calling the Window - constructor twice as it passes in a construct-only parameter. So add - **kwargs to the Window constructor to allow us to pass in any kind - of GObject property to it and refactor the Dialog subclasses to pass - in all properties to the same constructor. - - Also adds a bunch of tests to make sure that the hiearchy is correct. - - https://bugzilla.gnome.org/show_bug.cgi?id=672158 - - Signed-off-by: Martin Pitt - - gi/overrides/Gtk.py | 56 - ++++++++++++++++++++++++------------------------- - tests/test_overrides.py | 35 +++++++++++++++++++++++++++++-- - 2 files changed, 61 insertions(+), 30 deletions(-) - -commit 77ab27ab8a580d98f76730f075e083e1e870f55e -Author: simon -Date: Tue Mar 13 01:41:53 2012 -0700 - - Renamed getter/setter instance attributes to fget/fset respectively. - - The python 'property' class allows for decoration of methods using - .getter and .setter. These were added as methods to the - GObject.property - class to match that of the python property class and allow for - decoratored - setter methods. - - In addition, __call__ was added to allow an instantiated decorator - with - args to also decorate a method: - - class C(GObject.GObject): - _value = 0 - @GObject.property(type=int, default=0) - def propInt(self): - return self._value - @propInt.setter - def propInt(self, value): - self._value = value - - https://bugzilla.gnome.org/show_bug.cgi?id=586181 - - Signed-off-by: Martin Pitt - - gi/_gobject/__init__.py | 10 ++++---- - gi/_gobject/propertyhelper.py | 59 - +++++++++++++++++++++++++++++++------------ - tests/test_properties.py | 41 ++++++++++++++++++++++++++++++ - 3 files changed, 89 insertions(+), 21 deletions(-) - -commit 174a61fb3149c07dab5cc35e64825922cdefcb95 -Author: Johan Dahlin -Date: Tue Mar 13 17:10:13 2012 -0300 - - Add Gtk.Arrow/Gtk.Window constructor override - - Adds argument that makes them compatible with PyGTK. - - https://bugzilla.gnome.org/show_bug.cgi?id=672045 - - gi/overrides/Gtk.py | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -commit 7746d2188ac4933c2c9011d84525d1e62fc18953 -Author: Michel Dänzer -Date: Fri Mar 9 12:26:53 2012 +0100 - - Fix marshalling to/from Python to work on big endian machines. - - https://bugzilla.gnome.org/show_bug.cgi?id=668903 - - Signed-off-by: Martin Pitt - - gi/pygi-argument.c | 25 ++++++++++++++++--------- - gi/pygi-marshal-from-py.c | 32 +++++++++++++++++++++++++------- - gi/pygi-marshal-to-py.c | 19 +++++++++++++++++++ - 3 files changed, 60 insertions(+), 16 deletions(-) - -commit 0591cc6f160ae6e9d8c3970934ae105ef340d7d3 -Author: Michel Dänzer -Date: Thu Mar 8 12:21:28 2012 +0100 - - Use gi_cclosure_marshal_generic instead of duplicating it. - - Bump gobject-introspection dependency to ensure that we have the - corresponding - changes in g-i. - - https://bugzilla.gnome.org/show_bug.cgi?id=668903 - - Signed-off-by: Michel Dänzer - Signed-off-by: Martin Pitt - - configure.ac | 3 +- - gi/_gobject/Makefile.am | 7 +- - gi/_gobject/ffi-marshaller.c | 194 - ------------------------------------------- - gi/_gobject/ffi-marshaller.h | 31 ------- - gi/_gobject/gobjectmodule.c | 12 +-- - 5 files changed, 4 insertions(+), 243 deletions(-) - -commit 8ca828825a2c47080055c5f986979aac8da9a93f -Author: René Stadler -Date: Mon Mar 5 21:10:55 2012 +0100 - - Override Gtk.TreeView.get_visible_range to fix return - - Just like IconView. - - https://bugzilla.gnome.org/show_bug.cgi?id=671409 - - gi/overrides/Gtk.py | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 4824ceaa77b59788325a2c1ee0f994d4e74d7a1c -Author: Paolo Borelli -Date: Sun Mar 4 16:41:18 2012 +0100 - - Plug memory leak in _is_union_member - - When we found the member, unref the objects before breaking out of the - loop. - - gi/pygi-marshal-from-py.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -commit c6ae29ac157978a61b11cc2de9e8485d8a175105 -Author: Sebastian Pölsterl -Date: Tue Feb 21 15:37:18 2012 +0100 - - tests: Split TestInterfaces into separate tests - - tests/test_gi.py | 36 +++++++++++++++++++----------------- - 1 file changed, 19 insertions(+), 17 deletions(-) - -commit de3299818ae5fdf1c7abbe05a36bfd5cdface7b8 -Author: Sebastian Pölsterl -Date: Mon Feb 20 19:37:32 2012 +0100 - - Post release version bump to 3.1.2 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit fd020e783c0dacea3320225b4ddd57d6a0fce7ea -Author: Sebastian Pölsterl -Date: Mon Feb 20 19:33:56 2012 +0100 - - Prepare 3.1.1 release - - NEWS | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -commit 99485d96811667ef7a7a393b68b7361733157d61 -Author: Sebastian Pölsterl -Date: Sat Feb 18 00:38:05 2012 +0100 - - Don't use C99 style - - gi/pygi-cache.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 0739c39f6282d95fc17ee406fa1151d074b0450d -Author: Martin Pitt -Date: Thu Feb 16 16:42:53 2012 +0100 - - Add test for GPtrArray with transfer full - - This complements the already existing test for a "transfer container" - return - array. We can't verify the internal refcount as these arrays get - marshalled - internally, but at least we can verify that it does not crash due to - double-free. - - tests/test_everything.py | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -commit 087a104f66793a981a0c02f1c7ab9cc1cf659da3 -Author: Martin Pitt -Date: Wed Feb 15 13:36:39 2012 +0100 - - Drop obsolete g_thread_init() - - Not necessary any more since glib 2.24, and we depend on 2.31. - - gi/_glib/pyglib.c | 3 --- - 1 file changed, 3 deletions(-) - -commit 66fb610e45912a7def29e5848577d280ef55643a -Author: Martin Pitt -Date: Wed Feb 15 13:35:33 2012 +0100 - - Fix deprecated g_source_get_current_time() - - Use g_get_real_time() instead as recommended by the - documentation. This also - simplifies the code. - - gi/_glib/pygsource.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -commit 18342edded05d3d9cccf648ed92bc1cac95c51eb -Author: Martin Pitt -Date: Wed Feb 15 13:31:23 2012 +0100 - - Fix deprecated g_value_[gs]et_char() - - Replace with _schar(). We depend on glib >= 2.31 already. - - gi/_gobject/ffi-marshaller.c | 2 +- - gi/_gobject/pygtype.c | 6 +++--- - gi/pygi-argument.c | 2 +- - 3 files changed, 5 insertions(+), 5 deletions(-) - -commit 3dfb8dcbe7cf09dc170433fc48d3273c6ea9448e -Author: Simon Schampijer -Date: Thu Feb 2 19:06:01 2012 +0100 - - Make pygiconvert.sh correctly convert gtk.gdk.x11_* - - Looking at the gir file gtk.gdk.x11_* should get converted to - GdkX11.x11_*. Fixing pygiconvert.sh to do so. - - pygi-convert.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3af5016978df598d5fd1c225cc49bb2c04dc4e35 -Author: Sebastian Pölsterl -Date: Fri Feb 10 13:29:41 2012 +0100 - - Raise required glib version to 2.31 because of g_value_(get|set)_schar - - Commit ee62df4d2fc0cc63c2f29d3ad9b47b875dbd5f89 introduced both calls - - configure.ac | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 50c3b1bad3ea79750649f4b48fce0adbfaba5268 -Author: Dieter Verfaillie -Date: Fri Feb 10 09:28:36 2012 +0100 - - Fix cset_first typo - - https://bugzilla.gnome.org/show_bug.cgi?id=649267 - - gi/_gobject/pygparamspec.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 6ab542fb3ec1031922ba65664d77bbaac0df453e -Author: Bastian Winkler -Date: Mon Nov 14 14:41:08 2011 +0100 - - pygi-convert: Handle Clutter and Cogl - - https://bugzilla.gnome.org/show_bug.cgi?id=664496 - - pygi-convert.sh | 76 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 76 insertions(+) - -commit 4aeb27efc43e131de5d0bc0f60dca7c1d34c3d45 -Author: Cédric Krier -Date: Fri Feb 10 09:04:18 2012 +0100 - - Provide access to gpointer struct values - - https://bugzilla.gnome.org/show_bug.cgi?id=668356 - - Signed-off-by: Martin Pitt - - gi/pygi-argument.c | 3 ++- - gi/pygi-info.c | 13 +++++++++++++ - tests/test_everything.py | 21 +++++++++++++++++++++ - 3 files changed, 36 insertions(+), 1 deletion(-) - -commit 5c0b20cc1a261cb7430a5251dffe60da698033b5 -Author: Paolo Borelli -Date: Thu Feb 9 18:15:42 2012 +0100 - - Add some GType tests - - Use what was recently added in g-i - - tests/test_gi.py | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) - -commit ea7778f6f37a6fc38f88d89d4b6cae8be0ed9753 -Author: Paolo Borelli -Date: Thu Feb 9 18:14:52 2012 +0100 - - Split GStrv and array variant tests in their own classes - - Also tidy up the spacing a bit - - tests/test_gi.py | 29 +++++++++++++++++++++++------ - 1 file changed, 23 insertions(+), 6 deletions(-) - -commit db7f9be319d3cf52aef300fbac60cabb7ff57276 -Author: Paolo Borelli -Date: Wed Feb 8 22:23:30 2012 +0100 - - Add unit test for builder's connect_after - - tests/test_overrides.py | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit 671f9b0dd73ac41a84caf9d1f04cec351bc01b47 -Author: Ryan Lortie -Date: Wed Feb 8 16:06:22 2012 -0500 - - fix GtkBuilder signal connection 'after' logic - - All GtkBuilder signals are presently being connected 'after', ignoring - what is specified in the builder XML. This is due to an obvious logic - error. - - https://bugzilla.gnome.org/show_bug.cgi?id=669705 - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 1d23d8006be98b77a0134fddd23b76df05e489fa -Author: Patrick Welche -Date: Tue Feb 7 11:49:58 2012 +0000 - - test(1) uses '=' to test if strings are identical - - https://bugzilla.gnome.org/show_bug.cgi?id=669598 - - m4/python.m4 | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 945fd18e531c2131440af93dcd89f6c63abbfd7c -Author: Ryan Lortie -Date: Tue Feb 7 13:42:19 2012 -0500 - - pygspawn: improve error checking - - gspawn 'argv' and 'envp' parameters expect sequences of strings. This - is enforced by checking that the passed argument is a sequence - and that - each item returned from it is a string. - - We do now, however, verify that each item can be successfully - taken from - the sequence. 'os.environ' is an example of an object that passes - PySequence_Check() but fails to return objects from PySequence_ITEM(). - - Add a simple NULL check to avoid the crash. - - https://bugzilla.gnome.org/show_bug.cgi?id=669594 - - gi/_glib/pygspawn.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 8fc969c45d6d720400dc6c9ef391d0ca93f14b5a -Author: Sebastian Pölsterl -Date: Mon Feb 6 19:15:53 2012 +0100 - - Post release version bump to 3.1.1 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f76b2fe6d37be76bf129ee2adee90b2cc0eee56e -Author: Sebastian Pölsterl -Date: Mon Feb 6 19:11:52 2012 +0100 - - Prepare 3.1.0 release - - NEWS | 34 ++++++++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - -commit c09d0dffc5a570d5ae4df1ae07b2e5594c3ca1bf -Author: Sebastian Pölsterl -Date: Mon Feb 6 19:04:41 2012 +0100 - - Updated DOAP file to only include people currently actively working - on the project - - Removed obsolete MAINTAINERS file - - MAINTAINERS | 19 ------------------- - pygobject.doap | 44 +++++++++++++++----------------------------- - 2 files changed, 15 insertions(+), 48 deletions(-) - -commit 0285e107be581c4d594127dc06cd05df1f02fb3f -Author: Sebastian Pölsterl -Date: Mon Feb 6 18:57:01 2012 +0100 - - Revert "Convert all strings to utf-8 encoding when retrieving from - TreeModel" - - This reverts commit 654711d0f940d7480d0f1cdb25a3dc9996f7a706. - - Due to this commit breaking backwards compatability, we decided to - revert this change - - gi/overrides/Gtk.py | 15 --------------- - tests/compathelper.py | 2 -- - tests/test_overrides.py | 31 +------------------------------ - 3 files changed, 1 insertion(+), 47 deletions(-) - -commit 0e921cd26ed5a6e3bc6ef5f553e8b22b862d72a6 -Author: Sebastian Pölsterl -Date: Sun Feb 5 13:47:10 2012 +0100 - - tests: Fixed issues with python3 - - tests/test_gi.py | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -commit ee62df4d2fc0cc63c2f29d3ad9b47b875dbd5f89 -Author: Sebastian Pölsterl -Date: Sun Feb 5 11:59:51 2012 +0100 - - Properly distinguish between different integer types for properties - - https://bugzilla.gnome.org/show_bug.cgi?id=664150 - - gi/pygi-property.c | 48 ++++++++++++++++++++++++++++++++++++++---- - tests/test_gi.py | 62 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 106 insertions(+), 4 deletions(-) - -commit c329bf2aee8d75ce452638db75e09197ff2b9b65 -Author: Sebastian Pölsterl -Date: Sun Feb 5 11:46:21 2012 +0100 - - Distinguish between GArray and GPtrArray when cleaning up - - This fixes a crash in test_gi.TestGPtrArray and makes sure - memory is free'd correctly - - https://bugzilla.gnome.org/show_bug.cgi?id=669393 - - gi/pygi-marshal-cleanup.c | 32 +++++++++++++++++++++++--------- - 1 file changed, 23 insertions(+), 9 deletions(-) - -commit 4ea37c606f67df843788261b2c8acd6bac4c1e0c -Author: Paolo Borelli -Date: Sun Feb 5 18:51:53 2012 +0100 - - Add null_gerror_callback unit test - - This models the case where the callback is successful and does not set - an error. - - https://bugzilla.gnome.org/show_bug.cgi?id=669415 - - tests/test_everything.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit a41984780ee49dcf02c718ca1be87bba747472e5 -Author: Martin Pitt -Date: Mon Feb 6 09:34:28 2012 +0100 - - pyglib_error_check: Re-add missing NULL check - - Commit adcfe96d49b09bc accidentally dropped the check if *error is - NULL, i. e. - any error is actually set. Due to that, pyglib_error_check() - always returned - TRUE. Reintroduce the check. - - Thanks to Alberto Mardegan for spotting this! - - https://bugzilla.gnome.org/show_bug.cgi?id=669415 - - gi/_glib/pyglib.c | 2 ++ - 1 file changed, 2 insertions(+) - -commit 2c797c17913999379e277788d5e4cce8d68cebb0 -Author: Michael Culbertson -Date: Sat Feb 4 16:11:34 2012 +0100 - - Add tests/runtests-windows.py to source tarball - - https://bugzilla.gnome.org/show_bug.cgi?id=663288 - - tests/Makefile.am | 1 + - 1 file changed, 1 insertion(+) - -commit d6a899cdf70e978534326155e3fad75a705f4b20 -Author: Sebastian Pölsterl -Date: Sat Feb 4 15:55:55 2012 +0100 - - Don't issue a depreciation warning for GtkDialog's NO_SEPARATOR flag, - even when unused - - https://bugzilla.gnome.org/show_bug.cgi?id=665553 - - gi/overrides/Gtk.py | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -commit 534ec71c575a279ff1c05da20a8858bb1145b4d0 -Author: Nirbheek Chauhan -Date: Sat Feb 4 15:42:36 2012 +0100 - - Fix bool() operations on GLib.Variant objects - - Defines __nonzero__ (python2) and __bool__ (python3) for GLib.Variant - - Also adds some tests for boolean comparisons. - - https://bugzilla.gnome.org/show_bug.cgi?id=647723 - - gi/overrides/GLib.py | 18 ++++++++++++++++++ - tests/test_overrides.py | 45 - +++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 63 insertions(+) - -commit 8d6a127df5dd1e5f26faeba8f977074b4496b24f -Author: Nirbheek Chauhan -Date: Sat Feb 4 15:41:08 2012 +0100 - - Fix hash() and __eq__() for GLib.Variant objects - - Define __hash__, __eq__, __ne__ for GLib.Variant so that objects can - be used in sets, dicts, and can be compared using == and != easily. - - Also adds some tests for this. - - https://bugzilla.gnome.org/show_bug.cgi?id=647725 - - gi/overrides/GLib.py | 23 ++++++++++++++++++++ - tests/test_overrides.py | 56 - +++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 79 insertions(+) - -commit f82404034be042bf2026bbb7f1e33b11d6e17a6f -Author: Martin Pitt -Date: Wed Jan 25 07:01:06 2012 +0100 - - Fix method names of callback tests - - Change test_everything.TestCallbacks.* test names from camelCase - to the - standard PEP-8 underscore_style. This is now consistent with all - other test - case names. - - tests/test_everything.py | 30 +++++++++++++++--------------- - 1 file changed, 15 insertions(+), 15 deletions(-) - -commit e37ee78fbf0aa72159a40da4165a26bea065faf1 -Author: Will Thompson -Date: Mon Jan 23 13:10:30 2012 +0000 - - Cairo: add missing braces around array-of-struct definition - - This triggered a -Wmissing-braces warning. - - https://bugzilla.gnome.org/show_bug.cgi?id=668497 - - gi/pygi-foreign-cairo.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit db24865d6b60351d72f5b8f47103d6d0a6c63b2e -Author: Will Thompson -Date: Mon Jan 23 13:06:41 2012 +0000 - - g_instance_init: cast to PyGObject * as needed - - This squashes a compiler warning. - - https://bugzilla.gnome.org/show_bug.cgi?id=668497 - - gi/_gobject/gobjectmodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit a8408cfd68cd5e7cdb0b8a83e107d9a0d828e4bd -Author: Will Thompson -Date: Mon Jan 23 13:01:27 2012 +0000 - - Fix a few set-but-not-used warnings. - - In a couple of cases, the variable in question was set to a value - spelled out again later in the function. - - The 'sequence_cache' variable is re-declared five lines below. - - The return value of 'read' was previously completely ignored. The - 'gssize ret' variable was in fact added to squash an unused-result - warning. - - https://bugzilla.gnome.org/show_bug.cgi?id=668497 - - gi/_glib/pygiochannel.c | 2 +- - gi/_glib/pygmainloop.c | 3 +-- - gi/_gobject/pygobject.c | 2 +- - gi/pygi-marshal-cleanup.c | 2 -- - 4 files changed, 3 insertions(+), 6 deletions(-) - -commit 29a30490ed51e347e8f57d2bf9af69400734eee8 -Author: Stefano Facchini -Date: Thu Jan 19 18:09:07 2012 +0100 - - pygmainloop: allow for extra arguments in 'quit' method - - To allow for the common syntax: - - object.connect('signal-name', main_loop.quit) - - https://bugzilla.gnome.org/show_bug.cgi?id=668288 - - gi/_glib/pygmainloop.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 557a61c12c01137a0d7c679c4b053973df09d445 -Author: Alexandre Rostovtsev -Date: Mon Dec 26 00:44:56 2011 -0500 - - Fix bytearray test compatibility with python3 - - https://bugs.gentoo.org/show_bug.cgi?id=321879 - - https://bugzilla.gnome.org/show_bug.cgi?id=666852 - - tests/test_gi.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit d69e5b3c7bdb9113382fd125c256b12bff4c24d2 -Author: Alberto Mardegan -Date: Mon Jan 23 12:37:26 2012 +0200 - - Respect transfer-type when demarshalling GErrors - - The marshaller previously ignored "transfer full" on GError* - arguments, causing - crashes due to double-freeing them. This causes the - testCallbackUserdata() test - case to crash after the previous GError/GHashTable marshalling fix. - - https://bugzilla.gnome.org/show_bug.cgi?id=666270 - - gi/pygi-argument.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -commit 77f32d9110bfeb6dad8457f565b4c70b5998fef6 -Author: Alberto Mardegan -Date: Thu Dec 15 16:12:01 2011 +0200 - - Support GHashTable and GError as callback/closure arguments - - Marshalling of these types from C is already implemented, let's - take it - into use for calbacks and closures too. - - Add corresponding test cases. - - https://bugzilla.gnome.org/show_bug.cgi?id=666270 - - Signed-off-by: Martin Pitt - - gi/pygi-closure.c | 2 ++ - tests/test_everything.py | 35 +++++++++++++++++++++++++++++++++++ - 2 files changed, 37 insertions(+) - -commit 4b9dc03d0e49e9a1f4bf0f2df503bdff00d13a2b -Author: Will Thompson -Date: Mon Jan 23 13:56:02 2012 +0000 - - Don't leak when marshalling GErrors to C - - Python-land GLib.GErrors are supposed to have three attributes: - "message", "domain" and "code". If those attributes are missing, - or they - have the wrong types, the C GError is filled in with a message - describing the error. The present-but-ill-typed code paths did not - DECREF the ill-typed values. - - https://bugzilla.gnome.org/show_bug.cgi?id=666098 - - gi/_glib/pyglib.c | 3 +++ - 1 file changed, 3 insertions(+) - -commit adcfe96d49b09bcc550653d73de196610fd5144d -Author: Will Thompson -Date: Fri Jan 20 16:20:10 2012 +0000 - - Support functions which return GError - - GStreamer has the following method: - - void gst_message_parse_error ( - GstMessage *message, - GError **error, - gchar **debug_message); - - With this patch, we marshal the GError out parameter as a - GObject.GError - exception, but return it rather than throwing it. The test cases cover - two variations on the theme of the function above (one with (transfer - full), as in GStreamer, and another with (transfer none)) as well as a - function with return type GError *. - - https://bugzilla.gnome.org/show_bug.cgi?id=666098 - - gi/_glib/pyglib.c | 46 - +++++++++++++++++++++++++++++++++++----------- - gi/_glib/pyglib.h | 1 + - gi/pygi-marshal-to-py.c | 16 +++++++++++++--- - tests/test_gi.py | 32 ++++++++++++++++++++++++++++++++ - 4 files changed, 81 insertions(+), 14 deletions(-) - -commit 09f003729eac9d553a208c343c2a14d253b77d9a -Author: Alberto Mardegan -Date: Mon Jan 23 12:42:21 2012 +0200 - - Fix indentation of _pygi_argument_to_object() - - Side issue in https://bugzilla.gnome.org/show_bug.cgi?id=666270 - - Signed-off-by: Martin Pitt - - gi/pygi-argument.c | 26 +++++++++++++------------- - 1 file changed, 13 insertions(+), 13 deletions(-) - -commit c71c010be01d706f90bc200194325fd82f4071b2 -Author: Paolo Borelli -Date: Sat Jan 14 14:24:23 2012 +0100 - - Avoid C99 syntax. - - gi/gimodule.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -commit c299d058c22385ececaec64c872d1dd1bc1ae17a -Author: Paolo Borelli -Date: Fri Jan 6 13:39:31 2012 +0100 - - Connect to first action of a radio group. - - gi/overrides/Gtk.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit dee2f179037902a3883bd0e61ff1c350e1fd8a4f -Author: Paolo Borelli -Date: Wed Jan 4 16:40:51 2012 +0100 - - Use g_slist_free_full in pygi-closure. - - gi/pygi-closure.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -commit 2bee4207ab6f07dc9c0952affe72f0e304cfb624 -Author: Paolo Borelli -Date: Wed Jan 4 15:24:13 2012 +0100 - - Avoid O(n^2) behavior when marshalling lists - - Appending requires walking the list every time: just prepend and - reverse - the list at the end. - - https://bugzilla.gnome.org/show_bug.cgi?id=667261 - - gi/pygi-marshal-from-py.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit d68455e99b1a9ebba31209b17a11317b1958678b -Author: Paolo Borelli -Date: Tue Jan 3 16:57:40 2012 +0100 - - Handle NULL as a valid case of a char** array - - Treat NULL as an empty array and add the corresponding testcase - - gi/pygi-marshal-to-py.c | 9 +++++---- - tests/test_gi.py | 3 +++ - 2 files changed, 8 insertions(+), 4 deletions(-) - -commit e3451b8e6018bb76e9992fb6af24a71725de5cfd -Author: Tomeu Vizoso -Date: Fri Dec 23 12:01:43 2011 +0100 - - Branching, bump version to 3.1.0 - - configure.ac | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 8d1a36cc73f5f4df091ecb289c8a7b38ec2ab605 -Author: Tomeu Vizoso -Date: Mon Dec 12 18:35:30 2011 +0100 - - Add notes about branching to HACKING - - HACKING | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 00030bc6f0fb961c716ed692144cd8e4bb9be7d0 -Author: Sebastian Pölsterl -Date: Sat Dec 10 12:51:45 2011 +0100 - - Fixed bug where GObject.property did not respect minimum and maximum - values - - https://bugzilla.gnome.org/show_bug.cgi?id=664864 - - gi/_gobject/propertyhelper.py | 2 +- - tests/test_properties.py | 31 +++++++++++++++++++++++++++++++ - 2 files changed, 32 insertions(+), 1 deletion(-) - -commit 7b78abc6c399abd0daa4c11c644d107e1bb7b452 -Author: Tomeu Vizoso -Date: Mon Dec 12 17:00:24 2011 +0100 - - Remove mention of removed option --enable-docs - - HACKING | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 4cba52f5b5e79b7b6212cb0795e8976a9da9f21d -Author: Tomeu Vizoso -Date: Mon Dec 12 17:00:03 2011 +0100 - - Fix sebp's name in NEWS - - NEWS | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 8c95981d0ba224a577f87998030c384b3dae3d80 -Author: Tomeu Vizoso -Date: Mon Dec 12 16:20:09 2011 +0100 - - Release 3.0.3 - - NEWS | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 58e47fd28c5d75bb78042c8f9eb5aae84de9c64d -Author: Tomeu Vizoso -Date: Mon Dec 12 16:16:44 2011 +0100 - - Pre-release version bump - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 884468d4816fc976c0c0c72651e7f81d13f3f78b -Author: Manuel Quiñones -Date: Thu Dec 1 11:50:38 2011 -0300 - - Convert all modifier constants to Gdk.ModifierType - - Signed-off-by: Manuel Quiñones - - pygi-convert.sh | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -commit 654711d0f940d7480d0f1cdb25a3dc9996f7a706 -Author: Sebastian Pölsterl -Date: Tue Nov 8 12:38:12 2011 +0100 - - Convert all strings to utf-8 encoding when retrieving from TreeModel - - https://bugzilla.gnome.org/show_bug.cgi?id=663610 - - gi/overrides/Gtk.py | 15 +++++++++++++++ - tests/compathelper.py | 2 ++ - tests/test_overrides.py | 31 ++++++++++++++++++++++++++++++- - 3 files changed, 47 insertions(+), 1 deletion(-) - -commit 4f637212f13b197a95c824967a58496b9e3b877c -Author: John (J5) Palmieri -Date: Wed Nov 2 14:51:24 2011 -0400 - - add test for bytearray variants - - tests/test_gi.py | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 20ca3f129d6cc662285cce8c732b55596016aefa -Author: John (J5) Palmieri -Date: Wed Nov 2 14:50:42 2011 -0400 - - handle NULL arrays correctly for each array type - - gi/pygi-marshal-to-py.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -commit ce2f780bffe44b1d4de617dcbce4b90c58b03c18 -Author: John (J5) Palmieri -Date: Wed Nov 2 14:17:21 2011 -0400 - - Revert "Revert "Fix array termination and size calculation"" - - This reverts commit cfda820e8d9604c5ef2ad1161c22b20080d5daf4. - - gi/pygi-marshal-from-py.c | 6 +++++- - gi/pygi-marshal-to-py.c | 8 +++++++- - 2 files changed, 12 insertions(+), 2 deletions(-) - -commit 832f16f96815adc22cc3acbeb3fa969631795a29 -Author: Owen W. Taylor -Date: Sun Oct 30 18:08:57 2011 -0400 - - pygmainloop: avoid lockups if multiple glib.MainLoop exist - - If multiple glib.MainLoop() sources exist, then we will add multiple - watches, and when python writes a byte to the wakeup pipe, all of the - sources will try to read it; only one will succeed and the others - will block. Set both ends of the pipe nonblocking to avoid this. - - https://bugzilla.gnome.org/show_bug.cgi?id=663068 - - gi/_glib/pygmainloop.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit 2fd3aa9d4ca0906a5e609845ee500ba72e358f94 -Author: Tomeu Vizoso -Date: Sat Oct 29 15:08:03 2011 +0200 - - Properly chain up to the class that implements a given vfunc. - - https://bugzilla.gnome.org/show_bug.cgi?id=662994 - - gi/types.py | 22 +++++++++++++--------- - tests/test_gi.py | 20 ++++++++++---------- - 2 files changed, 23 insertions(+), 19 deletions(-) - -commit cfda820e8d9604c5ef2ad1161c22b20080d5daf4 -Author: Tomeu Vizoso -Date: Wed Nov 2 14:54:21 2011 +0100 - - Revert "Fix array termination and size calculation" - - This reverts commit eef35b2df8023ffff2d195ee16c084f5cfcb6ba3. - - gi/pygi-marshal-from-py.c | 6 +----- - gi/pygi-marshal-to-py.c | 8 +------- - 2 files changed, 2 insertions(+), 12 deletions(-) - -commit eef35b2df8023ffff2d195ee16c084f5cfcb6ba3 -Author: Holger Berndt -Date: Sun Oct 30 16:36:32 2011 +0100 - - Fix array termination and size calculation - - When creating an array of element type uint8 and setting it directly - with - memcpy(), make sure that zero-termination is respected. - - When calculating the length of a zero-terminated array of type uint8, - fall back to strlen() instead of g_strv_length(). - - https://bugzilla.gnome.org/show_bug.cgi?id=662550 - - gi/pygi-marshal-from-py.c | 6 +++++- - gi/pygi-marshal-to-py.c | 8 +++++++- - 2 files changed, 12 insertions(+), 2 deletions(-) - -commit 4c1d9f01b8fa6702f73b290180f934250e179caa -Author: Daniel Drake -Date: Sun Oct 30 09:20:45 2011 +0000 - - pygi-convert: fix for Pango.Alignment - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit e3abd76096cc9f335681c7225f452c286b9c59e2 -Author: Daniel Drake -Date: Sun Oct 30 07:06:57 2011 +0000 - - pygi-convert: fix for Gtk.Orientation - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 52b82c5f78ef3755388457fa9440c36ccd2dfbbf -Author: Martin Pitt -Date: Thu Oct 27 07:16:24 2011 +0200 - - Add tests for calling closures - - Add checks for correct handling of closure calls. - Regress.test_closure_one_arg() is working fine and should continue - to do so. - Regress.test_closure_variant() is known to not work yet, so mark - this as EXFAIL - for now. (See https://bugzilla.gnome.org/show_bug.cgi?id=656554) - - tests/test_everything.py | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -commit c7aa0e79dfb4c1092c51ae1464b8414083b4f3fc -Author: Mikkel Kamstrup Erlandsen -Date: Tue Oct 4 12:28:26 2011 +0200 - - fix marshaling of arrays of GVariants - - Add unit tests for marshaling of arrays of variants with all - transfer modes. Requires latest gobject-introspection. - - Plug potential leaks of GArray data members - - Fix calling of wrong cleanup_from_py for arrays - - Simplify and fix logic for cleaning up arrays both in from_py() - and to_py() code paths. - - https://bugzilla.gnome.org/show_bug.cgi?id=638915 - - Signed-off-by: Martin Pitt - - gi/pygi-cache.c | 2 +- - gi/pygi-marshal-cleanup.c | 81 - ++++++++++++++++++++++++++++++----------------- - gi/pygi-marshal-from-py.c | 10 ++++-- - gi/pygi-marshal-to-py.c | 13 ++++++-- - tests/test_gi.py | 14 +++++++- - 5 files changed, 85 insertions(+), 35 deletions(-) - -commit c2ec4d8eb46ae2e6ee4372b2a4f9d5df0e5d82f3 -Author: Ignacio Casal Quinteiro -Date: Sat Oct 22 00:20:57 2011 +0200 - - Release 3.0.2 - - NEWS | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit 5c24760b797e985721f7fe51d52252e4dd54a417 -Author: Martin Pitt -Date: Fri Oct 21 17:31:41 2011 +0200 - - Fix "Returns: (skip)" method calls without (out) arguments - - When we have a method call with a skipped return value, but no - other out - arguments, we previously returned NULL to Python, which causes - "SystemError: - error return without exception set". Return None instead. - - https://bugzilla.gnome.org/show_bug.cgi?id=662383 - - gi/pygi-invoke.c | 10 ++++++++++ - tests/test_everything.py | 8 ++++++++ - 2 files changed, 18 insertions(+) - -commit 585222915dc98b0e375de3db4771466278a32e81 -Author: John (J5) Palmieri -Date: Tue Oct 18 00:39:16 2011 -0400 - - Do union member checks for unions that are parameters - - * before we were only doing checks if the union was an instance - - https://bugzilla.gnome.org/show_bug.cgi?id=661673 - - gi/pygi-marshal-from-py.c | 121 - ++++++++++++++++++++++++++-------------------- - 1 file changed, 68 insertions(+), 53 deletions(-) - -commit 8deaec6b9abd87f02060c9feec773d4693e89028 -Author: Martin Pitt -Date: Wed Oct 19 14:35:11 2011 +0200 - - Gdk overrides: Unbreak for Gdk-2.0 - - Fix regression from commit 31db3ed: Gdk 2.0 did not yet have - atom_intern(), so - only do this for Gdk >= 3.0. - - https://launchpad.net/bugs/875399 - - gi/overrides/Gdk.py | 95 - +++++++++++++++++++++++++++-------------------------- - 1 file changed, 48 insertions(+), 47 deletions(-) - -commit f395fb131caf7ca550acd17138d8061926ef4f92 -Author: John (J5) Palmieri -Date: Fri Oct 14 17:19:45 2011 -0400 - - unit test for checking ref count of object param in signals - - https://bugzilla.gnome.org/show_bug.cgi?id=661359 - - tests/test_everything.py | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -commit 611f58b99851328653af4930f188c33eccaa9f6f -Author: John (J5) Palmieri -Date: Fri Oct 14 16:42:32 2011 -0400 - - when converting an object with transfer none, make sure the wrapper - owns a ref - - https://bugzilla.gnome.org/show_bug.cgi?id=661359 - - gi/pygi-argument.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 0f1eb9fa0e7aa5e7c22dabc709c0dfb469e404f1 -Author: Timo Vanwynsberghe -Date: Tue Oct 4 11:13:43 2011 +0200 - - Allow GBoxed types as property - - Add the GBoxed type as valid type to the gobject property helper - https://bugzilla.gnome.org/show_bug.cgi?id=660798 - - gi/_gobject/propertyhelper.py | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -commit bef8d385117dd0295c9ba7567710d76fc2bb729a -Author: Ignacio Casal Quinteiro -Date: Mon Oct 10 11:24:42 2011 +0200 - - Add tests for boxed properties. - - tests/test_properties.py | 20 ++++++++++++++++++-- - 1 file changed, 18 insertions(+), 2 deletions(-) - -commit 77123ffeb1585837033848f4d5a90cfa63fdaee0 -Author: Ignacio Casal Quinteiro -Date: Fri Sep 30 20:21:07 2011 +0200 - - Post release bump version - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f5ccfec0a1bc4c999bfa49d75383ea06d3a068c4 -Author: Ignacio Casal Quinteiro -Date: Fri Sep 30 20:19:46 2011 +0200 - - Release 3.0.1 - - NEWS | 5 +++++ - configure.ac | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -commit 56ac9339eb1d6950623dc4d8c3b9972874e7fa86 -Author: John (J5) Palmieri -Date: Thu Sep 22 19:03:20 2011 -0400 - - when checking instances union members are same type as parent - - * this is so we can support sending Gdk.Event members in place of - the Event union into methods - * we only support this if the union member has a type of GI_INTERFACE - for now - - https://bugzilla.gnome.org/show_bug.cgi?id=659879 - - gi/pygi-marshal-from-py.c | 60 - +++++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 56 insertions(+), 4 deletions(-) - -commit 311a4f8035a95b41bc3c0a836c32b7a5bf2d9959 -Author: John (J5) Palmieri -Date: Wed Sep 21 21:50:48 2011 -0400 - - add a floating flag to pygobjects - - * this allows us to correctly refcount when custom gobjects are - instantiated - via g_object_new - - gi/_gobject/gobjectmodule.c | 5 +++++ - gi/_gobject/pygobject-private.h | 3 +++ - gi/_gobject/pygobject.c | 27 ++++++++++++++++++++++++++- - gi/_gobject/pygobject.h | 3 ++- - 4 files changed, 36 insertions(+), 2 deletions(-) - -commit d2d29ae5845217254b9336fd8629f369cb119b25 -Author: John (J5) Palmieri -Date: Wed Sep 21 21:13:22 2011 -0400 - - Revert "Fix refcount bug by not creating python wrapper during - gobject init stage" - - This reverts commit f6fa5dd8f39af1b8a52d7600d257400b0983e8c5. - - gi/_gobject/gobjectmodule.c | 32 +++++++++++++++++--------------- - 1 file changed, 17 insertions(+), 15 deletions(-) - -commit a24c10b779f2a1b0425d56d03d59c393389cad98 -Author: John (J5) Palmieri -Date: Wed Sep 21 21:10:00 2011 -0400 - - make sure to commit the NEWS file - - NEWS | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 2eed2940c9be099fb6305288d895265e6b35d3d2 -Author: John (J5) Palmieri -Date: Mon Sep 19 13:19:57 2011 -0400 - - prep for 3.0 release - - configure.ac | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit fbd58b70c2c3c1128f95a87eb4cc8313b6a401b8 -Author: John (J5) Palmieri -Date: Fri Sep 16 14:19:15 2011 -0400 - - up version required of gobject-introspection to 1.29.0 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 225f21117b6b3546989abe22538c784291e86b2a -Author: John (J5) Palmieri -Date: Fri Sep 16 12:26:10 2011 -0400 - - fix most warnings - - * remove some unused vars - * correctly cast vars - * handle deprecated enums in switch statments by using default: - * unused wanrings still remain in some places - - gi/pygi-argument.c | 2 +- - gi/pygi-cache.c | 7 ++----- - gi/pygi-info.c | 6 ++++++ - gi/pygi-invoke.c | 2 +- - gi/pygi-marshal-from-py.c | 17 +++++++++-------- - gi/pygi-marshal-to-py.c | 3 +-- - 6 files changed, 20 insertions(+), 17 deletions(-) - -commit 9a70f01288e1b049206d25d67938907f1b38a490 -Author: John (J5) Palmieri -Date: Fri Sep 16 12:24:38 2011 -0400 - - post release bump - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3ec4020205e909ee4400650434f9ae7b89c2bde8 -Author: John (J5) Palmieri -Date: Thu Sep 15 18:12:01 2011 -0400 - - edit HACKING file to show correct tag format - - HACKING | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2e864fd05bc0adf48df9f65ab72785ebb1d0d3f0 -Author: John (J5) Palmieri -Date: Thu Sep 15 18:10:33 2011 -0400 - - update NEWS file to prep for release - - NEWS | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - -commit 0da687fa699aba4f42c42a924d6754e2bd47df50 -Author: John (J5) Palmieri -Date: Thu Sep 15 17:59:31 2011 -0400 - - fix typo s/lenth/length - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 0e4861abaff64d8e7e8d1aeedf9dd1e80de8aab2 -Author: John (J5) Palmieri -Date: Thu Sep 15 17:48:58 2011 -0400 - - fix typo in docstring - - gi/_gobject/propertyhelper.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e7fcc326d64def610e5a1003cf6c7ca97023814d -Author: John (J5) Palmieri -Date: Thu Sep 15 17:46:46 2011 -0400 - - do not pass in len(str) to the length argument of - gtk_test_buffer_insert* apis - - * in python 3 len(str) returns the number of characters while - the length - parameter is expecting the number of bytes. It also excepts -1 - for null - terminated string. Since all of our strings are null terminated, - just - set length to that. - - gi/overrides/Gtk.py | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -commit 6f380153afb3390f7da9f4b8befb1c4ee224da17 -Author: Dieter Verfaillie -Date: Mon Sep 12 21:07:20 2011 +0200 - - Switch tarball compression format to tar.xz only. - - See - http://mail.gnome.org/archives/gnome-announce-list/2011-September/msg00031.html - for more information. - - https://bugzilla.gnome.org/show_bug.cgi?id=659140 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 11c45ac6dcb6ffad766d03bfc77f45a6d703a90d -Author: Dieter Verfaillie -Date: Thu Sep 15 14:18:57 2011 +0200 - - Remove pygtk_version attribute from internal gi._gobject module. - - This used to be provided for backwards compatibility with older PyGTK - versions. As PyGObject3 no longer provides support for static bindings - like PyGTK, the pygtk_version attribute has become obsolete. - - https://bugzilla.gnome.org/show_bug.cgi?id=659142 - - gi/_gobject/gobjectmodule.c | 4 ---- - gi/_gobject/pygobject.h | 2 -- - 2 files changed, 6 deletions(-) - -commit 7e48fd6dfd86b7082c3fd35d25d9693c56c9665a -Author: John (J5) Palmieri -Date: Thu Sep 15 15:52:18 2011 -0400 - - remove overridesdir from the .pc file and add it to the gi module - - * having the variable in the .pc file caused issues parallel - installing - for different versions of python - * putting it into the module allows us to give the correct directory - based on which version of python you run the script from - * access the var as such: - import gi - installdir = gi._overridesdir - - gi/__init__.py | 2 ++ - pygobject-3.0.pc.in | 10 +++++++++- - 2 files changed, 11 insertions(+), 1 deletion(-) - -commit beea7072a5a989be47a755ac46647380d4dbd6b4 -Author: John (J5) Palmieri -Date: Thu Sep 15 00:11:09 2011 -0400 - - fix tests to correctly construct a dummy Gtk.TargetEntry - - * structs are sometimes a pain in gi. Simply constructing them - using the - the standard constructor (e.g. Gtk.TargetEntry()) will malloc - the struct - but not correctly initialize the fields which can cause a crash. - * tests didn't crash before because they were sending in bogus - data that - somehow did not trigger the issue - * now with the C struct array marshallers doing the right thing, - the incorrect - use of TargetEntry was causing a crash - - https://bugzilla.gnome.org/show_bug.cgi?id=627236 - - tests/test_overrides.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 46ba7f04ef3df08e07ddda5c10f0c98bec5fa183 -Author: John (J5) Palmieri -Date: Thu Sep 15 00:08:31 2011 -0400 - - we now assume that C arrays of structs are flat so memcpy them - when marshalling - - * there is no way in GI to tell if a C array is flat or an array - of pointers - so we assume that all arrays of simple structs and gvalues are - flat and - all arrays of objects and boxed structs are pointer arrays. - * this will be removed once GI gets the ability to annotate level - of indirection - for arrays - https://bugzilla.gnome.org/show_bug.cgi?id=627236 - - gi/pygi-marshal-from-py.c | 35 ++++++++++++++++++++++++++++++++--- - tests/test_gi.py | 29 +++++++++++++++++++++++++++++ - 2 files changed, 61 insertions(+), 3 deletions(-) - -commit e30a41592baa942188574e5c9f99572963e2e387 -Author: John (J5) Palmieri -Date: Thu Sep 15 00:02:34 2011 -0400 - - only update the arg counts once if child arg comes before parent arg - - * if the child arg comes before the parent arg we need to update the - argument counts and take the child arg out of the marshalling lists - since it is handled by the parent - * when two parents reference the same child arg as is the case with - two arrays which have a single length argument we only want - to update - the count once - * to do this we introduce the PYGI_META_ARG_CHILD_NEEDS_UPDATE - meta type - and only do the count update if this is set - * APIs should keep in mind that this take extra processing so - child args - should really come after their parents - - https://bugzilla.gnome.org/show_bug.cgi?id=627236 - - gi/pygi-cache.c | 30 ++++++++++++++++++++---------- - gi/pygi-cache.h | 9 +++++++-- - 2 files changed, 27 insertions(+), 12 deletions(-) - -commit f6fa5dd8f39af1b8a52d7600d257400b0983e8c5 -Author: John (J5) Palmieri -Date: Wed Sep 14 20:26:15 2011 -0400 - - Fix refcount bug by not creating python wrapper during gobject - init stage - - * This only applys to python subclasses of GObject which are - instantiated - using GObject.new - * Because we were creating the wrapper when the gobject is - initialized - and then again calling pygobject_new_full the wrapper would get - ref'ed twice. - * we could not simply Py_DECREF the wrapper due to the fact that - non-subclassed objects (e.g. GObject.Object) instantiated via - new do not run the same initialization code and would not have the - extra ref - * solution was to simply not create the wrapper during initialization - because if it doesn't exist when pygobject_new_full is called - it gets created and registered there - * move the call to __init__ into pyg_object_new - - https://bugzilla.gnome.org/show_bug.cgi?id=657403 - - gi/_gobject/gobjectmodule.c | 32 +++++++++++++++----------------- - 1 file changed, 15 insertions(+), 17 deletions(-) - -commit 61b64a65beee9011f8e4ed20f0a83e6630ba154f -Author: John (J5) Palmieri -Date: Tue Sep 13 18:08:04 2011 -0400 - - don't destroy just created wrapper when object is created via - g_object_new - - https://bugzilla.gnome.org/show_bug.cgi?id=657403 - - gi/_gobject/gobjectmodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 93e12cc2eb7e7f2c18971da86e9c9452d3f566b7 -Author: Steve Frécinaux -Date: Fri Aug 26 11:22:09 2011 +0200 - - Remove deprecated API from pygobject.h - - https://bugzilla.gnome.org/show_bug.cgi?id=657416 - - gi/_gobject/pygobject.h | 19 +------------------ - 1 file changed, 1 insertion(+), 18 deletions(-) - -commit e1c71092af6e2cffa36248519adfceac1874051d -Author: Marcin Owsiany -Date: Wed Aug 31 09:43:28 2011 +0100 - - Convert gtk.TRUE/FALSE to Python True/False. - - https://bugzilla.gnome.org/show_bug.cgi?id=657785 - - pygi-convert.sh | 2 ++ - 1 file changed, 2 insertions(+) - -commit 3ace5c2e2268285a5dcb39889fcb2a71bc1063bd -Author: Steve Frécinaux -Date: Fri Sep 2 08:37:15 2011 +0200 - - Drop legacy __gobject_init__ method of GObject.Object. - - This method was used in gobject initialization at some point, but now - using GObject.__init__() is sufficient, so let's not keep this old - method around and let people misuse it. - - https://bugzilla.gnome.org/show_bug.cgi?id=658032 - - examples/signal.py | 2 -- - gi/_gobject/pygobject.c | 11 ----------- - 2 files changed, 13 deletions(-) - -commit fcd457d1d1d8a813acb2ebfe5ee0e9aab2c9c88c -Author: Dieter Verfaillie -Date: Tue Sep 13 12:05:30 2011 +0200 - - AM_CHECK_PYTHON_LIBS does not work for lib64 - - But on Windows, Python extension modules need to be explicitly - linked to libpython. - - https://bugzilla.gnome.org/show_bug.cgi?id=658856 - - configure.ac | 4 +++- - gi/Makefile.am | 9 ++++++--- - gi/_glib/Makefile.am | 10 ++++++++-- - gi/_gobject/Makefile.am | 8 +++++++- - 4 files changed, 24 insertions(+), 7 deletions(-) - -commit 863c087911203a8f3ebaa8e77622a3437a7cd320 -Author: Dieter Verfaillie -Date: Mon Sep 12 23:03:05 2011 +0200 - - Remove common_ldflags from Makefile.am as it is no longer used. - - https://bugzilla.gnome.org/show_bug.cgi?id=658856 - - Makefile.am | 6 ------ - 1 file changed, 6 deletions(-) - -commit 24b920f9922e367bdb8b3e56c2f61e0c8f5cdb66 -Author: John (J5) Palmieri -Date: Tue Sep 13 16:20:48 2011 -0400 - - cast params for PyObject_IsInstance to suppress warnings - - gi/_gobject/pygobject-private.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 861369ec59b17f67151813dc2e87c6e86126b954 -Author: John (J5) Palmieri -Date: Tue Sep 13 16:04:31 2011 -0400 - - check if object is actually a PyGFlag before trying to access g_type - - * we are lucky this bit of code worked for as long as it did but when - checking if an object is a PyGFlag we can't just rely on looking - at the g_type field because if a regular gobject is passed in - as is the case when you compare a long to a gflag, the gobject - will not have a g_type field. Accessing a non-existant field - could at best give you a false positive and at worse read - memory beyond the bounds of the actual structure passed in - - gi/_gobject/pygobject-private.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit eea93e89fb064253bd8903c8b453daf4b3c87c2c -Author: John (J5) Palmieri -Date: Tue Sep 13 16:03:02 2011 -0400 - - fix regression - add instance type checks since Py3 no longer does - this for us - - gi/pygi-marshal-from-py.c | 21 +++++++++++++++++++-- - 1 file changed, 19 insertions(+), 2 deletions(-) - -commit a4e4318b50a24a688e32579273fbcfa51d1b422a -Author: John (J5) Palmieri -Date: Fri Sep 2 18:39:51 2011 -0400 - - refactor in/out marshalling to be to_py/from_py - - * in/out make sense from a C perspective but when you get to the - python layers it makes more sense to label them as to_py and - from_py to denote which way we are marshalling - * this helps clear up the difference between callbacks which - call into python and invoked functions which call into C - * in the callback case we marshal in values to Python objects - and out values to C types but in the invoke case we do the - reverse. Dealing with to_py/from_py makes the code much more - resuable and consistant - - https://bugzilla.gnome.org/show_bug.cgi?id=658362 - - gi/Makefile.am | 8 +- - gi/pygi-cache.c | 673 ++++++++++----------- - gi/pygi-cache.h | 62 +- - gi/pygi-invoke.c | 144 ++--- - gi/pygi-marshal-cleanup.c | 168 +++--- - gi/pygi-marshal-cleanup.h | 128 ++-- - gi/pygi-marshal-from-py.c | 1412 - +++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-marshal-from-py.h | 186 ++++++ - gi/pygi-marshal-in.c | 1412 - --------------------------------------------- - gi/pygi-marshal-in.h | 186 ------ - gi/pygi-marshal-out.c | 768 ------------------------ - gi/pygi-marshal-out.h | 144 ----- - gi/pygi-marshal-to-py.c | 768 ++++++++++++++++++++++++ - gi/pygi-marshal-to-py.h | 144 +++++ - 14 files changed, 3122 insertions(+), 3081 deletions(-) - -commit 45b0fcff9e948c65a3903c32a3957802034c5e47 -Author: Dieter Verfaillie -Date: Fri Sep 9 16:50:25 2011 +0200 - - Examples: fix cairo-demo.py imports - - examples/cairo-demo.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 3ca19fc13e6024fd04851e6f269020a92b09fa17 -Author: Dieter Verfaillie -Date: Fri Sep 9 15:08:27 2011 +0200 - - Fix paths and add missing overridesdir variable used in uninstalled - pkgconfig file - - https://bugzilla.gnome.org/show_bug.cgi?id=658654 - - pygobject-3.0-uninstalled.pc.in | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -commit 6e773175b9d2f46b3df5075ec952a8c5aff3c607 -Author: Dieter Verfaillie -Date: Fri Sep 9 15:08:04 2011 +0200 - - Remove no longer used variables from pkgconfig files - - https://bugzilla.gnome.org/show_bug.cgi?id=658654 - - pygobject-3.0-uninstalled.pc.in | 6 ------ - pygobject-3.0.pc.in | 5 +---- - 2 files changed, 1 insertion(+), 10 deletions(-) - -commit 81d388780311311d8dc4a027a59d114edf9a00fc -Author: Dieter Verfaillie -Date: Fri Sep 9 14:57:58 2011 +0200 - - docs/Makefile.am and m4/python.m4: Python3 portability fixes - - https://bugzilla.gnome.org/show_bug.cgi?id=658652 - - docs/Makefile.am | 2 +- - m4/python.m4 | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit 7e692ee061406e48e4862b98a0829650b1d6d585 -Author: Dieter Verfaillie -Date: Fri Sep 9 14:57:46 2011 +0200 - - Refactor and clean Makefile.am files - - https://bugzilla.gnome.org/show_bug.cgi?id=658652 - - Makefile.am | 2 - - gi/Makefile.am | 81 +++++++++++++++++++++++-------------- - gi/_glib/Makefile.am | 100 - ++++++++++++++++++++++++++++++---------------- - gi/_gobject/Makefile.am | 85 ++++++++++++++++++++------------------- - gi/overrides/Makefile.am | 4 +- - gi/repository/Makefile.am | 4 +- - 6 files changed, 162 insertions(+), 114 deletions(-) - -commit 3dd59b07d1f4a93ee1f65d6a64e1afb6f5e84232 -Author: Dieter Verfaillie -Date: Fri Sep 9 14:57:36 2011 +0200 - - Remove all PLATFORM_VERSION = 2.0 traces - - https://bugzilla.gnome.org/show_bug.cgi?id=658652 - - gi/Makefile.am | 2 -- - gi/overrides/Makefile.am | 1 - - gi/repository/Makefile.am | 1 - - 3 files changed, 4 deletions(-) - -commit db1e484bfa157967de55ee2e0e18a82b8e388b61 -Author: Dieter Verfaillie -Date: Fri Sep 9 14:57:25 2011 +0200 - - Remove gi/tests/ directory as all the tests now live in tests/ - - https://bugzilla.gnome.org/show_bug.cgi?id=658652 - - gi/tests/Makefile.am | 24 ------------------------ - gi/tests/runtests.py | 21 --------------------- - 2 files changed, 45 deletions(-) - -commit b0ecbf00138ef1147e478ebf3c66f0e9b3f85dfc -Author: Dieter Verfaillie -Date: Fri Sep 9 14:55:25 2011 +0200 - - autogen.sh: Use autoreconf instead of a custom script and honor - ACLOCAL_FLAGS - - https://bugzilla.gnome.org/show_bug.cgi?id=658652 - - Makefile.am | 2 +- - autogen.sh | 95 - +++++++------------------------------------------------------ - 2 files changed, 12 insertions(+), 85 deletions(-) - -commit 4671f5397003f376f00830e3fd1c214de594619f -Author: Dieter Verfaillie -Date: Fri Sep 9 14:55:01 2011 +0200 - - use improved python.m4 macros to search for Python headers and libs - - https://bugzilla.gnome.org/show_bug.cgi?id=658652 - - configure.ac | 3 ++- - m4/python.m4 | 47 +++++++++++++++++++++++++++++++++++++---------- - 2 files changed, 39 insertions(+), 11 deletions(-) - -commit 2c9fd09da196d35db968bff4ae63fcce2d891e69 -Author: Javier Jardón -Date: Fri Sep 9 15:38:22 2011 +0100 - - Make maintiner mode enabled by default - - See - http://blogs.gnome.org/desrt/2011/09/08/am_maintainer_mode-is-not-cool/ - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b24dcb415406668931e02a1f669ef9861bb3a660 -Author: Dieter Verfaillie -Date: Wed Aug 24 09:58:10 2011 +0200 - - Disable documentation for now since they are completely wrong for GI. - - https://bugzilla.gnome.org/show_bug.cgi?id=657054 - - Makefile.am | 2 +- - configure.ac | 25 ------------------------- - 2 files changed, 1 insertion(+), 26 deletions(-) - -commit ecea2358a379c8ff44dff2f8f9c30a9092af1681 -Author: Dieter Verfaillie -Date: Wed Sep 7 10:38:28 2011 +0200 - - Fix documentation installation directory - - https://bugzilla.gnome.org/show_bug.cgi?id=657054 - - docs/Makefile.am | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -commit 8d3125c8ce9890c70400dd8a3ac273b590fe6a31 -Author: Dieter Verfaillie -Date: Tue Sep 6 22:22:11 2011 +0200 - - Remove distutils based build system. - - The only reason this might be brought back to life again is when - the whole stack can be built with Visual Studio (including - gobject-introspection) again. Building with MinGW/MSYS can now - be done with the usual autogen.sh/configure/make/make install dance. - - https://bugzilla.gnome.org/show_bug.cgi?id=657054 - - MANIFEST.in | 7 - - Makefile.am | 25 +-- - README.win32 | 21 -- - dsextras.py | 509 - ----------------------------------------------- - pygobject_postinstall.py | 9 - - setup.py | 351 -------------------------------- - 6 files changed, 7 insertions(+), 915 deletions(-) - -commit b82d916635aa0b732840548088a3fcfcb2e41bc4 -Author: Dieter Verfaillie -Date: Wed Sep 7 10:40:36 2011 +0200 - - [gtk-demo] Fix syntax highlighter encoding issue - - With Python 3, Gtk.TextBuffer.get_text returns a str (not bytes), with - Python 2 however we get a str (not unicode). So with Python 2 the - tokenizer returned bogus data when ran over a demo that contains real - UTF-8 codepoints (like rotatedtext.py for example). - - This patch thus fixes the "Gtk-CRITICAL **: - gtk_text_iter_set_line_offset: - assertion `char_on_line <= chars_in_line` failed" assertions when - selecting - the rotated text demo in the treeview. - - demos/gtk-demo/gtk-demo.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit 31db3ed3d233bd495c3a2f99b3fa51031bfa30c6 -Author: Ignacio Casal Quinteiro -Date: Tue Sep 6 22:13:54 2011 +0200 - - overrides: add constants for atoms - - gi/overrides/Gdk.py | 49 - +++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 49 insertions(+) - -commit 81861bc2d664eb38d46e5c38ff755d436f040f63 -Author: Steve Frécinaux -Date: Wed Aug 31 14:18:56 2011 +0200 - - Drop pygobject_construct() from public API. - - These functions were introduced in 2005 because python objects - could not - "just" be instantiated using g_object_new(), but this is not true - anymore since the introduction of new-style constructors. Hence - this API - has no reason to be there anymore. - - Nowadays, people who want to construct GObjects defined in python - should - just use g_object_new(). - - https://bugzilla.gnome.org/show_bug.cgi?id=657814 - - gi/_gobject/gobjectmodule.c | 118 - +++++++++------------------------------- - gi/_gobject/pygobject-private.h | 3 - - gi/_gobject/pygobject.h | 8 --- - 3 files changed, 26 insertions(+), 103 deletions(-) - -commit c4c55a98ccf9e39ed0d10ed49b66a76dc7d7c509 -Author: Ignacio Casal Quinteiro -Date: Wed Aug 31 18:00:44 2011 +0200 - - post release version bump - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit ac5a0f46242abdd3cd98ec5f9f2bf8e5b05f3845 -Author: Ignacio Casal Quinteiro -Date: Wed Aug 31 17:58:37 2011 +0200 - - Release 2.90.3 - - NEWS | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -commit 429569abddada5a3bad554de707ddf35b349936e -Author: John (J5) Palmieri -Date: Thu Aug 25 13:57:53 2011 -0400 - - support skip annotation for return values - - * this is used for things like skiping gboolean returns that are - useful is C but useless in python - - * cleans up after skipped returns that are also marked transfer - full - https://bugzilla.gnome.org/show_bug.cgi?id=650135 - - gi/pygi-cache.c | 1 + - gi/pygi-cache.h | 1 + - gi/pygi-invoke.c | 48 - ++++++++++++++++++++++++++++++------------------ - tests/test_everything.py | 8 ++++++++ - 4 files changed, 40 insertions(+), 18 deletions(-) - -commit 7a234b185b131f3eb6a6e8a8c717ddf4d508b15e -Author: Xavier Claessens -Date: Tue Aug 2 12:05:12 2011 +0200 - - Test GPtrArray regression - - tests/test_everything.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit 42fc9fa437102c882844a0e70a081ab08de92658 -Author: Steve Frécinaux -Date: Fri Aug 26 10:53:43 2011 +0200 - - Drop support for old constructor style. - - Bindings don't write their own constructors anymore, and the old style - has been deprecated for ages, so let's just drop them now and make - pygobject simpler. - - https://bugzilla.gnome.org/show_bug.cgi?id=657413 - - gi/_gobject/gobjectmodule.c | 20 -------------------- - gi/_gobject/pygobject-private.h | 1 - - gi/_gobject/pygobject.c | 1 - - gi/_gobject/pygobject.h | 2 -- - gi/gimodule.c | 28 ---------------------------- - gi/types.py | 2 -- - tests/testhelpermodule.c | 5 ----- - 7 files changed, 59 deletions(-) - -commit 3961a405e1bddef22e1a5a0c7aa3ae55e4ec09ad -Author: Steve Frécinaux -Date: Fri Aug 26 10:45:59 2011 +0200 - - Drop support for sink functions. - - Sink functions were meant to deal with floating references in a custom - way. They are not useful anymore with the dynamic bindings. - - https://bugzilla.gnome.org/show_bug.cgi?id=642233 - - gi/_gobject/gobjectmodule.c | 1 - - gi/_gobject/pygobject.c | 53 ---------------------------------------- - gi/_gobject/pygobject.h | 4 --- - tests/test-floating.c | 59 - +++++++-------------------------------------- - tests/test-floating.h | 42 +++++++++----------------------- - tests/test_gobject.py | 13 +++------- - tests/testhelpermodule.c | 32 +++++++----------------- - 7 files changed, 32 insertions(+), 172 deletions(-) - -commit 631d8ef879a13492945a3e30b3df9863a4ba2f44 -Author: Mike Gorse -Date: Wed Aug 24 17:30:09 2011 -0500 - - Reinstate copying of in-line structs in arrays - - For arrays of in-line, non-boxed structures with (transfer full), - _pygi_marshal_free_out_array eventually gets called and frees - the array - data, so we should copy it (IE, BGO#653588). - - https://bugzilla.gnome.org/show_bug.cgi?id=657120 - - gi/pygi-marshal-out.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -commit f38511f251602e18551c04617cc2e2d42e812e1e -Author: John (J5) Palmieri -Date: Tue Aug 23 14:18:43 2011 -0400 - - fix inline struct array handling - - * we now assume any non-boxed structs are inline in an array since - there is - no way to check in GI and this is the most common use for an - array of - non-boxed structs - - https://bugzilla.gnome.org/show_bug.cgi?id=657120 - - gi/pygi-marshal-out.c | 23 +++++++++-------------- - tests/test_gi.py | 8 ++++++++ - 2 files changed, 17 insertions(+), 14 deletions(-) - -commit d92846a5446b0dd2e69c813f56224a1966ab1a33 -Author: Dieter Verfaillie -Date: Tue Aug 23 11:30:41 2011 +0200 - - [gtk-demo] printing.py: set print and error dialog transient parent - - demos/gtk-demo/demos/printing.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 1aebc1565752840075027b9452fe2a67217bf53b -Author: Dieter Verfaillie -Date: Tue Aug 23 11:28:05 2011 +0200 - - [gtk-demo] printing.py: exit Gtk mainloop when done and correctly - handle printing errors - - demos/gtk-demo/demos/printing.py | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -commit 1f9e4486c5b84209ce0038887738fc16a4ef7da3 -Author: Dieter Verfaillie -Date: Tue Aug 23 08:05:43 2011 +0200 - - [gtk-demo] show "activated" demo's in italic font in the TreeView - - demos/gtk-demo/gtk-demo.py | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit 971d063f7a36e13ef6621db7002b00af52f6292a -Author: Dieter Verfaillie -Date: Mon Aug 22 14:52:28 2011 +0200 - - [gtk-demo] source colorizer: Python3 does not have the BACKQUOTE - token, so simply remove it - - demos/gtk-demo/gtk-demo.py | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -commit c2979a37d6d505095b6e55789150a6498d95819d -Author: Dieter Verfaillie -Date: Mon Aug 22 14:22:18 2011 +0200 - - [gtk-demo] In Python3, GLib.file_get_contents returns a bytes object - but Gtk.TextBuffer.insert expects a string. - - Fixed by using codes.open() as hinted in - http://docs.python.org/dev/howto/pyporting.html#text-files - section "If pre-2.6 compatibility is needed" (because configure.ac - is still happy with Python 2.5.2). - - demos/gtk-demo/gtk-demo.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit 9ea56535f35abbea4cd977dea4c89247e4b01694 -Author: Dieter Verfaillie -Date: Mon Aug 22 12:30:24 2011 +0200 - - [gtk-demo] images.py: fix 'Insensitive 'button mnenomic - - demos/gtk-demo/demos/images.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 7829dae1cdb8697a19c2b5e158ef0e08f6c2558b -Author: Dieter Verfaillie -Date: Mon Aug 22 10:38:04 2011 +0200 - - [gtk-demo] printing.py: fix Pango.EllipsizeType > Pango.EllipsizeMode - & get_pixel_size - - demos/gtk-demo/demos/printing.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 07f0274301d77d9bf62b49a14b059d9a52afb445 -Author: Dieter Verfaillie -Date: Mon Aug 22 10:37:08 2011 +0200 - - [gtk-demo] printing.py: fix text file loading - - demos/gtk-demo/demos/printing.py | 32 ++++++++++++++++---------------- - 1 file changed, 16 insertions(+), 16 deletions(-) - -commit 135148a4c35aac1d132b0b8fa3adbf1fdcdb3a24 -Author: Dieter Verfaillie -Date: Mon Aug 22 10:20:35 2011 +0200 - - [gtk-demo] pixbuf.py: fix image loading - - demos/gtk-demo/demos/pixbuf.py | 25 +++++++++++-------------- - 1 file changed, 11 insertions(+), 14 deletions(-) - -commit a93cae2c80e30a408f86e7e6c4d15a538011a189 -Author: Dieter Verfaillie -Date: Mon Aug 22 10:10:02 2011 +0200 - - [gtk-demo] images.py: fix logo loading - - demos/gtk-demo/demos/images.py | 70 - +++++++++++++++++------------------------- - 1 file changed, 29 insertions(+), 41 deletions(-) - -commit eddc0824e0e4c156fca5de05bdeb600c534d4b24 -Author: Dieter Verfaillie -Date: Wed Aug 24 12:19:21 2011 +0200 - - [gtk-demo] appwindow.py: set AboutDialog parent - - demos/gtk-demo/demos/appwindow.py | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -commit 7fe10a5b33148b1f029f3d34f76b7f880c1c2e7a -Author: Dieter Verfaillie -Date: Mon Aug 22 07:58:25 2011 +0200 - - [gtk-demo] appwindow.py: fix logo loading - - demos/gtk-demo/demos/appwindow.py | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -commit 62fda288c1c37167c589e8e9d49ed625f770a98a -Author: Dieter Verfaillie -Date: Mon Aug 22 07:57:31 2011 +0200 - - [gtk-demo] appwindow.py: fix callback signatures - - demos/gtk-demo/demos/appwindow.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 87e9ab4d3a0aac4f4710aa0f8af0a1736f781ad9 -Author: Dieter Verfaillie -Date: Mon Aug 22 07:48:28 2011 +0200 - - [gtk-demo] fix glib vs GLib usage - - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 2 +- - demos/gtk-demo/demos/appwindow.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit d29cad6976a80862e1fc590d3e7d190e8a234866 -Author: Dieter Verfaillie -Date: Wed Aug 24 12:19:02 2011 +0200 - - [gtk-demo] iconviewedit.py: fix for Gdk.color_parse API breakage - caused by improved GDK overrides - - demos/gtk-demo/demos/Icon View/iconviewedit.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit f29d3a85a275a39e8481484779264b0dea1160ab -Author: Dieter Verfaillie -Date: Mon Aug 22 07:25:32 2011 +0200 - - [gtk-demo] optimize source colorizer by only preparing iters for - known colorized tokens - - demos/gtk-demo/gtk-demo.py | 20 +++++++++++++++----- - 1 file changed, 15 insertions(+), 5 deletions(-) - -commit ecd1eb00b19733da3f2e3d7935792378f34cab19 -Author: Dieter Verfaillie -Date: Fri Aug 19 18:31:20 2011 +0200 - - [gtk-demo] small formatting fixes - - demos/gtk-demo/demos/Entry/entry_buffer.py | 1 + - demos/gtk-demo/demos/Entry/entry_completion.py | 1 + - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 8 ++++---- - demos/gtk-demo/demos/assistant.py | 1 + - demos/gtk-demo/demos/builder.py | 4 +++- - demos/gtk-demo/demos/button_box.py | 1 + - demos/gtk-demo/demos/clipboard.py | 1 + - demos/gtk-demo/demos/colorselector.py | 1 + - demos/gtk-demo/demos/combobox.py | 1 + - demos/gtk-demo/demos/drawingarea.py | 4 +++- - demos/gtk-demo/demos/test.py | 2 ++ - 11 files changed, 19 insertions(+), 6 deletions(-) - -commit c42cb4da399ff5732f4ca732b85134de796a60fa -Author: Dieter Verfaillie -Date: Fri Aug 19 18:30:50 2011 +0200 - - [gtk-demo] remove "is_fully_bound" from demos - - demos/gtk-demo/demos/Entry/entry_buffer.py | 2 -- - demos/gtk-demo/demos/Entry/entry_completion.py | 2 -- - demos/gtk-demo/demos/appwindow.py | 3 --- - demos/gtk-demo/demos/assistant.py | 2 -- - demos/gtk-demo/demos/builder.py | 2 -- - demos/gtk-demo/demos/button_box.py | 2 -- - demos/gtk-demo/demos/clipboard.py | 2 -- - demos/gtk-demo/demos/colorselector.py | 2 -- - demos/gtk-demo/demos/combobox.py | 2 -- - demos/gtk-demo/demos/drawingarea.py | 2 -- - demos/gtk-demo/demos/test.py | 1 - - 11 files changed, 22 deletions(-) - -commit cad6a62c63f455f0b1315465a9cd71c0f02b12a5 -Author: Dieter Verfaillie -Date: Fri Aug 19 18:26:31 2011 +0200 - - [gtk-demo] add source colorizer loosely based on PyGTK's pygtk-demo - and GTK+'s gtk-demo code - - demos/gtk-demo/gtk-demo.py | 116 - +++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 101 insertions(+), 15 deletions(-) - -commit 250c36f4a8352ff1b31c1c85b156d3e803d4b8ef -Author: Dieter Verfaillie -Date: Fri Aug 19 15:08:15 2011 +0200 - - [gtk-demo] remove C-isms - - demos/gtk-demo/gtk-demo.py | 28 ++++++++++++++-------------- - 1 file changed, 14 insertions(+), 14 deletions(-) - -commit cf35fe8e259e786d0fa21b08b1f5c64c9bb0a84e -Author: Dieter Verfaillie -Date: Fri Aug 19 14:54:39 2011 +0200 - - [gtk-demo] fix text on info tab to be more like GTK+'s gtk-demo - - demos/gtk-demo/gtk-demo.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 241827208e25c72a990d8edd95a3b879470d6409 -Author: Dieter Verfaillie -Date: Fri Aug 19 14:40:56 2011 +0200 - - [gtk-demo] remove duplicate storage of demos by only storing them - in a TreeStore subclass - - This also moves demos loading code into the TreeStore subclass and - demo loading code into the Demo class - - demos/gtk-demo/gtk-demo.py | 151 - +++++++++++++++++++++------------------------ - 1 file changed, 70 insertions(+), 81 deletions(-) - -commit 58797c355a08a35375988881a17958bb42ad54bb -Author: Dieter Verfaillie -Date: Fri Aug 19 14:40:00 2011 +0200 - - [gtk-demo] make GtkDemoApp a Gtk.Window subclass and adapt main() - to demonstrate the GLib.MainLoop - - demos/gtk-demo/gtk-demo.py | 43 - ++++++++++++++++++++++++++----------------- - 1 file changed, 26 insertions(+), 17 deletions(-) - -commit 1e4fc1ea54527cff78f6c633db39e9a0bd3c64d2 -Author: Dieter Verfaillie -Date: Fri Aug 19 11:46:17 2011 +0200 - - [gtk-demo] correctly load demo code when cwd != demos/gtk-demo/ - - demos/gtk-demo/gtk-demo.py | 39 +++++++++++++++++++++++---------------- - 1 file changed, 23 insertions(+), 16 deletions(-) - -commit 6ffc999fbd4c9990fb5bde53ddd46d139b53245e -Author: Dieter Verfaillie -Date: Fri Aug 19 11:02:35 2011 +0200 - - [gtk-demo] drawingarea: fix labels - - demos/gtk-demo/demos/drawingarea.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 9fd3986affe11cbc5a816adcccdc56d0592f3618 -Author: Dieter Verfaillie -Date: Fri Aug 19 09:57:31 2011 +0200 - - [gtk-demo] fix imports - - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 6 ++++-- - demos/gtk-demo/demos/appwindow.py | 9 ++++++--- - demos/gtk-demo/gtk-demo.py | 8 ++++---- - 3 files changed, 14 insertions(+), 9 deletions(-) - -commit 9f314babfdee3b82799e00ea003972b0bbe6a8d5 -Author: Dieter Verfaillie -Date: Fri Aug 19 10:07:14 2011 +0200 - - [gtk-demo] fix shebang - - demos/gtk-demo/gtk-demo.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 01142060ae7d71a8a1f7d3e9bbc6f52e65f01c8d -Author: Sebastian Pölsterl -Date: Fri Aug 19 12:27:04 2011 +0200 - - Added support for __setitem__ to TreeModel and support for slices - to TreeModelRow - - https://bugzilla.gnome.org/show_bug.cgi?id=656891 - - gi/overrides/Gtk.py | 26 ++++++++++++++++++++-- - tests/test_overrides.py | 57 - +++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 81 insertions(+), 2 deletions(-) - -commit d6da96c65b2ed3cda238886990a624fbc31f6987 -Author: Olav Vitters -Date: Wed Aug 24 16:31:12 2011 +0200 - - Convert ACCEL_* constants into Gtk.AccelFlags. - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 0841d41698302abb5d987849a5874252564ed428 -Author: Olav Vitters -Date: Wed Aug 24 16:22:17 2011 +0200 - - Convert TREE_VIEW_DROP_* constants into Gtk.TreeViewDropPosition - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 37b0d0f9dc3d485829cae6e50da369fdea91a2d1 -Author: John (J5) Palmieri -Date: Thu Aug 18 14:06:32 2011 -0400 - - post commit version bump - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e51efc50835a14e0418cc27cc928c52d1aa6a3cf -Author: John (J5) Palmieri -Date: Thu Aug 18 14:02:30 2011 -0400 - - release 2.90.2 - - NEWS | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 74c727b53fcf64f465ee77b5a1ea04a69ca90968 -Author: John (J5) Palmieri -Date: Thu Aug 18 13:50:51 2011 -0400 - - remove tests that were removed from gi - - tests/test_gi.py | 11 ----------- - 1 file changed, 11 deletions(-) - -commit 11ea24dd30d8eeca11c8433c6bd75b06e52ae1ef -Author: John (J5) Palmieri -Date: Thu Aug 18 13:48:57 2011 -0400 - - don't calculate item_size using is_pointer - - * is_pointer is poorly defined and cacluating item_size for - arrays causes a crash in the tests because of this - * disregaurd is_pointer when cacluating item sizes - - gi/pygi-info.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -commit 493b4a21dd162d78cf572b548b58ba6a9ff22971 -Author: Timo Vanwynsberghe -Date: Wed Jul 6 01:50:31 2011 +0200 - - Updated signal example to use GObject introspection - - https://bugzilla.gnome.org/show_bug.cgi?id=654162 - - examples/signal.py | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -commit 0332010e704e253380e993874eab9dd122e59a7e -Author: Timo Vanwynsberghe -Date: Wed Jul 6 01:54:50 2011 +0200 - - Updated properties example to use GObject introspection - - https://bugzilla.gnome.org/show_bug.cgi?id=654162 - - examples/properties.py | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -commit c39f4555ebd703651eca6f978ed9870655b737f0 -Author: Martin Pitt -Date: Fri Aug 12 22:55:02 2011 +0200 - - Add override for GLib.Variant.split_signature() - - This is useful for e. g. iterating over method parameters which are - passed as a - single Variant. In particular we will need it for automatically - generating - introspection XML for exported DBus server objects. - - gi/overrides/GLib.py | 50 - +++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides.py | 22 ++++++++++++++++++++++ - 2 files changed, 72 insertions(+) - -commit 735f98d83c1c19df7457aa32a378e8c80cf2831f -Author: Timo Vanwynsberghe -Date: Mon Aug 15 18:58:31 2011 +0200 - - [pygi-convert.sh] Handle the import of pygtk and require Gtk 3.0 - - https://bugzilla.gnome.org/show_bug.cgi?id=654001 - - pygi-convert.sh | 2 ++ - 1 file changed, 2 insertions(+) - -commit d0a96a0a75f2bc969522abce2d326ef440cf143a -Author: Ignacio Casal Quinteiro -Date: Mon Aug 15 13:12:49 2011 +0200 - - Install pygobject.h again. - - This is needed by libpeas. - - gi/_gobject/Makefile.am | 5 ++++- - pygobject-3.0-uninstalled.pc.in | 4 ++-- - pygobject-3.0.pc.in | 6 +++--- - 3 files changed, 9 insertions(+), 6 deletions(-) - -commit 081dc2eb03b677eac9f08d3ad05deecc7c51554c -Author: John (J5) Palmieri -Date: Sun Aug 14 11:20:15 2011 -0400 - - update the doap file - - pygobject.doap | 26 ++++++++++++++------------ - 1 file changed, 14 insertions(+), 12 deletions(-) - -commit 762a36d2343bc39a502507d600fd1b9db9649dae -Author: John (J5) Palmieri -Date: Sun Aug 14 11:13:25 2011 -0400 - - prerelease bump - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit d3f85a61ec4b1a1d04838f73dc8d862258150048 -Author: John (J5) Palmieri -Date: Sun Aug 14 10:13:37 2011 -0400 - - get things ready for release - - NEWS | 194 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 194 insertions(+) - -commit ffd057649380d4249c1c52e1225e3646f3994bc6 -Author: John (J5) Palmieri -Date: Sun Aug 14 05:26:18 2011 -0400 - - pass exta keywords to the Box constructor - - gi/overrides/Gtk.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit cadbd4142bd0045368b5123d4b0a1876bdd5d798 -Author: John (J5) Palmieri -Date: Sat Aug 13 11:03:07 2011 -0400 - - add (Tree|List)Store set method override - - gi/overrides/Gtk.py | 50 ++++++++++++++++++++++++ - tests/test_overrides.py | 102 - ++++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 149 insertions(+), 3 deletions(-) - -commit 9ee9b22bd95e44bd2eca26e7bf3b0a9a988700c5 -Author: John (J5) Palmieri -Date: Sat Aug 13 09:19:29 2011 -0400 - - add test for object arrays - - tests/test_everything.py | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit c9d9ffd0380878792cbdb13dec4e53be897e5fbc -Author: John (J5) Palmieri -Date: Sat Aug 13 08:46:18 2011 -0400 - - only support C pointer arrays for structs and objects - - * There is no way to know if an array of structs or objects are - pointer arrays - or flat arrays. Since pointer arrays are the most useful and - prevelant - it has been decided to only support those arrays - - gi/pygi-marshal-out.c | 2 +- - tests/test_gi.py | 8 -------- - 2 files changed, 1 insertion(+), 9 deletions(-) - -commit b12379de1790b72d51883bf7b63c892639a892e7 -Author: John (J5) Palmieri -Date: Sat Aug 13 06:31:52 2011 -0400 - - revert Gtk.Window override because it causes issues with subclasses - - gi/overrides/Gtk.py | 9 --------- - 1 file changed, 9 deletions(-) - -commit 3e64a62d6d7f9e9d2820aad54187ef9c34710a1f -Author: Jonathan Matthew -Date: Thu Apr 7 21:05:32 2011 +1000 - - take GIL in _pygi_invoke_closure_free (bug #647016) - - gi/pygi-closure.c | 3 +++ - 1 file changed, 3 insertions(+) - -commit f8de9b8615f5dc30f492781d792aef5fc1e9ab73 -Author: Johan Dahlin -Date: Mon Jun 27 00:41:24 2011 -0300 - - Add a default parameter to GtkTreeModel.filter_new - - https://bugzilla.gnome.org/show_bug.cgi?id=653462 - - gi/overrides/Gtk.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit 583d0b3c6b53712128d7c2d5f075000a2a76ae5f -Author: Johan Dahlin -Date: Mon Jun 27 00:40:12 2011 -0300 - - Add vbox/action_area properties - - Accessing vbox/action_area directly creates segmentation fault, - avoid that by mapping the fields to their getters for PyGTK - API compatibility - - https://bugzilla.gnome.org/show_bug.cgi?id=653462 - - gi/overrides/Gtk.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit 017fdfc1dd06259006719e02ffa48883cee01ffd -Author: Johan Dahlin -Date: Mon Jun 27 00:39:41 2011 -0300 - - Add a couple of constructors - - This is for PyGTK compatibility, so that gtk.HBox(True, 2) etc - works. - - https://bugzilla.gnome.org/show_bug.cgi?id=653462 - - gi/overrides/Gtk.py | 40 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 40 insertions(+) - -commit af8bc9d5cdba48a7ee728ccb7ea9039df3ecceba -Author: Johan Dahlin -Date: Mon Jun 27 00:38:30 2011 -0300 - - Do not always pass in user_data to callbacks. - - This keeps API compatibility with PyGTK and avoids sending - in user_data if it's None. - - https://bugzilla.gnome.org/show_bug.cgi?id=653462 - - gi/overrides/Gtk.py | 15 ++++++++++++--- - 1 file changed, 12 insertions(+), 3 deletions(-) - -commit 7914d814350af1a18bdeda64f049c8e9a68d1d18 -Author: Johan Dahlin -Date: Mon Jun 27 00:38:20 2011 -0300 - - Add a default detail value for Widget.render_icon - - https://bugzilla.gnome.org/show_bug.cgi?id=653462 - - gi/overrides/Gtk.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit 5b1c875269b7979caae97e84919a690a34d92f29 -Author: Johan Dahlin -Date: Mon Jun 27 00:36:20 2011 -0300 - - Add an override for Gdk.color_parse() - - Change Gdk.color_parse() to not return a tuple, instead just - return the created color or None if it wasn't possible to parse - the name into a color. - - This keeps compatibility with PyGTK but breaks the current API. - - https://bugzilla.gnome.org/show_bug.cgi?id=653462 - - gi/overrides/Gdk.py | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit 187a2932bbf1e724f759ff3ed3392fc7341c6aa8 -Author: Laszlo Pandy -Date: Mon Aug 8 12:06:18 2011 +0200 - - Support function calling with keyword arguments in invoke. - - https://bugzilla.gnome.org/show_bug.cgi?id=625596 - - gi/pygi-cache.c | 39 ++++++++++++ - gi/pygi-cache.h | 4 ++ - gi/pygi-invoke.c | 162 - +++++++++++++++++++++++++++++++++++++++++++++-- - gi/types.py | 12 ++-- - tests/test_everything.py | 2 +- - tests/test_gi.py | 58 +++++++++++++++++ - 6 files changed, 265 insertions(+), 12 deletions(-) - -commit e5df32ffbf37481dbb6a70c4d4e7b7b9778c5549 -Author: John (J5) Palmieri -Date: Sat Aug 13 04:13:28 2011 -0400 - - remove references to deprecated GI_INFO_TYPE_ERROR_DOMAIN - - gi/pygi-info.c | 5 ----- - 1 file changed, 5 deletions(-) - -commit 745001178fc72be5626c7211366d694f41162987 -Author: Martin Pitt -Date: Thu Aug 11 15:11:42 2011 +0200 - - Fix gobject vs. gi.repository warning - - Check the warning earlier and fix the operator, so that it actually - works. Also - update the warning to explain how to fix the problem. - - gi/_gobject/__init__.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 25d2d05cba05414cd4551e0e06f6286a9b97a509 -Author: John (J5) Palmieri -Date: Fri Jul 22 15:46:31 2011 -0400 - - make GObject and GLib able to take overrides - - * derive directly from DynamicModule instead of InterfaceModule - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - gi/importer.py | 11 +++--- - gi/module.py | 118 - ++++++++++++++++++++++++++++----------------------------- - 2 files changed, 64 insertions(+), 65 deletions(-) - -commit 698b2284e29c0f699198cf6a22eeb0e399daba6e -Author: John (J5) Palmieri -Date: Fri Jul 22 15:45:09 2011 -0400 - - avoid dependency issue by importing the internal gobject - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - gi/__init__.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 7b068ebe59884ebd9aeb4425dc80cdff73a66fb1 -Author: John (J5) Palmieri -Date: Fri Jul 22 14:13:02 2011 -0400 - - fix tests to use the new GLib module - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - tests/test_mainloop.py | 7 +++---- - tests/test_option.py | 3 ++- - tests/test_source.py | 24 +++++++++++------------- - tests/test_subprocess.py | 12 +++++------- - tests/test_thread.py | 10 ++++------ - tests/test_uris.py | 4 ++-- - 6 files changed, 27 insertions(+), 33 deletions(-) - -commit 191ef79315f8a5641699536fde58da18e23ef904 -Author: John (J5) Palmieri -Date: Fri Jul 22 14:11:53 2011 -0400 - - add DynamicGLibModule which works like DynamicGObjectModule - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - gi/importer.py | 7 +++++-- - gi/module.py | 32 +++++++++++++++++++++++++++++--- - 2 files changed, 34 insertions(+), 5 deletions(-) - -commit fbd4a8263260c187211799454c08b1e55e2cb998 -Author: John (J5) Palmieri -Date: Fri Jul 22 12:27:41 2011 -0400 - - refactor, add objects and types to the correct internal module - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - gi/_glib/pygiochannel.c | 38 +++++++++++++++++++------------------- - gi/_glib/pygmaincontext.c | 2 +- - gi/_glib/pygmainloop.c | 4 ++-- - gi/_glib/pygoptioncontext.c | 4 ++-- - gi/_glib/pygoptiongroup.c | 4 ++-- - gi/_glib/pygsource.c | 14 +++++++------- - gi/_glib/pygspawn.c | 14 +++++++------- - 7 files changed, 40 insertions(+), 40 deletions(-) - -commit 7431b49a161df9178c55b814d3adff992ac2d722 -Author: John (J5) Palmieri -Date: Fri Jul 22 12:26:32 2011 -0400 - - rename the pyglib shared library so we don't load the old one - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - gi/Makefile.am | 2 +- - gi/_glib/Makefile.am | 10 +++++----- - gi/_gobject/Makefile.am | 2 +- - 3 files changed, 7 insertions(+), 7 deletions(-) - -commit b8700451acd4a19b59b64fc8641fca748d2189e2 -Author: John (J5) Palmieri -Date: Fri Jul 22 11:20:09 2011 -0400 - - refactor tests to only use PyGObject 3 syntax - - * for PyGObject 3 we want to discourage the use of legacy - interfaces - * Using interfaces like from gi.repository import GObject makes - sure that the internal _gobject module is loaded and not - PyGObject 2's gobject module which would cause the application - to not work correctly - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - tests/runtests-windows.py | 4 +- - tests/test_gdbus.py | 12 ++--- - tests/test_gi.py | 4 +- - tests/test_gobject.py | 31 ++++++------ - tests/test_interface.py | 16 +++--- - tests/test_mainloop.py | 3 +- - tests/test_overrides.py | 8 +-- - tests/test_properties.py | 124 - +++++++++++++++++++++++----------------------- - tests/test_signal.py | 98 ++++++++++++++++++------------------ - tests/test_source.py | 5 +- - tests/test_subprocess.py | 3 +- - tests/test_thread.py | 5 +- - tests/test_unknown.py | 8 +-- - tests/testhelpermodule.c | 2 +- - tests/testmodule.py | 10 ++-- - 15 files changed, 169 insertions(+), 164 deletions(-) - -commit c980dae21468fe073cc8782608148c346bb90ad7 -Author: John (J5) Palmieri -Date: Fri Jul 22 11:16:00 2011 -0400 - - refactor the internal _glib module to import correct modules - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - gi/_glib/__init__.py | 3 ++- - gi/_glib/glibmodule.c | 10 +++++----- - gi/_glib/option.py | 4 ++-- - gi/_glib/pyglib.c | 18 +++++++++--------- - 4 files changed, 18 insertions(+), 17 deletions(-) - -commit 65ac35cca8d24f4c133991e1c6ac02f49416a9a4 -Author: John (J5) Palmieri -Date: Fri Jul 22 11:10:46 2011 -0400 - - refactor to use the new internal _glib and _gobject modules - - * use relative imports instead of aboslute - * fix the C imports to import the internal _gobject libs - * add a check to see if the PyGObject 2 gobject module - was already imported - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - gi/_gobject/__init__.py | 20 +++++++++++++------- - gi/_gobject/constants.py | 3 +-- - gi/_gobject/gobjectmodule.c | 2 +- - gi/_gobject/propertyhelper.py | 11 +++++------ - gi/_gobject/pygobject.c | 16 ++++++++-------- - gi/_gobject/pygobject.h | 2 +- - 6 files changed, 29 insertions(+), 25 deletions(-) - -commit 59ed1289f76bc287443b3974710ea0da3e2cc8cc -Author: John (J5) Palmieri -Date: Fri Jul 22 11:07:10 2011 -0400 - - refactor gi module to import and use internal _gobject module - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - gi/importer.py | 2 -- - gi/module.py | 31 ++++++++++++++++--------------- - gi/overrides/Gtk.py | 2 +- - gi/overrides/__init__.py | 6 +++--- - gi/pygobject-external.h | 2 +- - gi/types.py | 12 ++++++------ - 6 files changed, 27 insertions(+), 28 deletions(-) - -commit 6b9d738d78c6ac45d49f00402c89356887555069 -Author: John (J5) Palmieri -Date: Fri Jul 22 11:02:49 2011 -0400 - - move the static bits internal to gi and refactor build files - - * the glib module now becomes the gi._glib module - * the gobject module now becomes the gi._gobject module - * we do this so we can install in parallel with PyGObject 2 - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - Makefile.am | 2 +- - configure.ac | 6 +- - gi/Makefile.am | 8 +- - gi/_glib/Makefile.am | 58 + - gi/_glib/__init__.py | 25 + - gi/_glib/glibmodule.c | 969 ++++++++++++++ - gi/_glib/option.py | 358 ++++++ - gi/_glib/pygiochannel.c | 764 ++++++++++++ - gi/_glib/pygiochannel.h | 29 + - gi/_glib/pyglib-private.h | 49 + - gi/_glib/pyglib-python-compat.h | 245 ++++ - gi/_glib/pyglib.c | 633 ++++++++++ - gi/_glib/pyglib.h | 83 ++ - gi/_glib/pygmaincontext.c | 126 ++ - gi/_glib/pygmaincontext.h | 40 + - gi/_glib/pygmainloop.c | 360 ++++++ - gi/_glib/pygmainloop.h | 36 + - gi/_glib/pygoptioncontext.c | 337 +++++ - gi/_glib/pygoptioncontext.h | 39 + - gi/_glib/pygoptiongroup.c | 298 +++++ - gi/_glib/pygoptiongroup.h | 42 + - gi/_glib/pygsource.c | 725 +++++++++++ - gi/_glib/pygsource.h | 39 + - gi/_glib/pygspawn.c | 264 ++++ - gi/_glib/pygspawn.h | 32 + - gi/_gobject/Makefile.am | 71 ++ - gi/_gobject/__init__.py | 117 ++ - gi/_gobject/constants.py | 83 ++ - gi/_gobject/ffi-marshaller.c | 194 +++ - gi/_gobject/ffi-marshaller.h | 31 + - gi/_gobject/gobjectmodule.c | 2638 - +++++++++++++++++++++++++++++++++++++++ - gi/_gobject/propertyhelper.py | 312 +++++ - gi/_gobject/pygboxed.c | 234 ++++ - gi/_gobject/pygboxed.h | 27 + - gi/_gobject/pygenum.c | 366 ++++++ - gi/_gobject/pygenum.h | 27 + - gi/_gobject/pygflags.c | 485 +++++++ - gi/_gobject/pygflags.h | 27 + - gi/_gobject/pyginterface.c | 122 ++ - gi/_gobject/pyginterface.h | 40 + - gi/_gobject/pygobject-private.h | 241 ++++ - gi/_gobject/pygobject.c | 2397 - +++++++++++++++++++++++++++++++++++ - gi/_gobject/pygobject.h | 667 ++++++++++ - gi/_gobject/pygparamspec.c | 404 ++++++ - gi/_gobject/pygparamspec.h | 31 + - gi/_gobject/pygpointer.c | 198 +++ - gi/_gobject/pygpointer.h | 27 + - gi/_gobject/pygtype.c | 1844 +++++++++++++++++++++++++++ - gi/_gobject/pygtype.h | 28 + - glib/Makefile.am | 61 - - glib/__init__.py | 25 - - glib/glibmodule.c | 969 -------------- - glib/option.py | 358 ------ - glib/pygiochannel.c | 764 ------------ - glib/pygiochannel.h | 29 - - glib/pyglib-private.h | 49 - - glib/pyglib-python-compat.h | 245 ---- - glib/pyglib.c | 633 ---------- - glib/pyglib.h | 83 -- - glib/pygmaincontext.c | 126 -- - glib/pygmaincontext.h | 40 - - glib/pygmainloop.c | 360 ------ - glib/pygmainloop.h | 36 - - glib/pygoptioncontext.c | 337 ----- - glib/pygoptioncontext.h | 39 - - glib/pygoptiongroup.c | 298 ----- - glib/pygoptiongroup.h | 42 - - glib/pygsource.c | 725 ----------- - glib/pygsource.h | 39 - - glib/pygspawn.c | 264 ---- - glib/pygspawn.h | 32 - - gobject/Makefile.am | 73 -- - gobject/__init__.py | 117 -- - gobject/constants.py | 83 -- - gobject/ffi-marshaller.c | 194 --- - gobject/ffi-marshaller.h | 31 - - gobject/gobjectmodule.c | 2638 - --------------------------------------- - gobject/propertyhelper.py | 312 ----- - gobject/pygboxed.c | 234 ---- - gobject/pygboxed.h | 27 - - gobject/pygenum.c | 366 ------ - gobject/pygenum.h | 27 - - gobject/pygflags.c | 485 ------- - gobject/pygflags.h | 27 - - gobject/pyginterface.c | 122 -- - gobject/pyginterface.h | 40 - - gobject/pygobject-private.h | 241 ---- - gobject/pygobject.c | 2397 - ----------------------------------- - gobject/pygobject.h | 667 ---------- - gobject/pygparamspec.c | 404 ------ - gobject/pygparamspec.h | 31 - - gobject/pygpointer.c | 198 --- - gobject/pygpointer.h | 27 - - gobject/pygtype.c | 1844 --------------------------- - gobject/pygtype.h | 28 - - tests/Makefile.am | 2 +- - 96 files changed, 16172 insertions(+), 16175 deletions(-) - -commit f0d2ddcf7e61c36f79a9adf8ccc53bf3db9349d3 -Author: John (J5) Palmieri -Date: Mon Jul 18 18:46:31 2011 -0400 - - remove pygtk.py - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - Makefile.am | 5 ---- - pygtk.py | 95 - ------------------------------------------------------------- - 2 files changed, 100 deletions(-) - -commit 75e9f7d80d9224c05e6063b88479f1baee48c489 -Author: John (J5) Palmieri -Date: Mon Jul 18 18:41:41 2011 -0400 - - introspection is no longer optional - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - Makefile.am | 8 +------- - configure.ac | 43 +++++++++++++++++-------------------------- - gi/pygi.h | 37 ------------------------------------- - gobject/Makefile.am | 5 +---- - tests/Makefile.am | 7 +------ - 5 files changed, 20 insertions(+), 80 deletions(-) - -commit d862168d6a82edd59547d39f5b0ab8279b1e511c -Author: John (J5) Palmieri -Date: Mon Jul 18 18:28:50 2011 -0400 - - up platform version to 3.0 - - https://bugzilla.gnome.org/show_bug.cgi?id=642048 - - Makefile.am | 2 +- - configure.ac | 4 ++-- - pygobject-2.0-uninstalled.pc.in | 18 ------------------ - pygobject-2.0.pc.in | 22 ---------------------- - pygobject-3.0-uninstalled.pc.in | 18 ++++++++++++++++++ - pygobject-3.0.pc.in | 22 ++++++++++++++++++++++ - 6 files changed, 43 insertions(+), 43 deletions(-) - -commit 5189b360ccddbbaee267ce857968fbf1aafdd07a -Author: Martin Pitt -Date: Thu Aug 11 09:53:15 2011 +0200 - - [gi] Handle GVariants from callback return values - - Callbacks still use GIArgument, add missing GVariant support for - return types. - - gi/pygi-argument.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -commit 18a240cc492d2e5ebe2709a0d7155e27c8ff9e63 -Author: Martin Pitt -Date: Wed Aug 10 14:11:10 2011 +0200 - - Handle GVariants for callback arguments - - Callbacks still use GIArgument, add missing GVariant support. This - is the - equivalent of what commit 9d5604220bd56 did for pygi_marshall_*(). - - gi/pygi-argument.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit aa820d6ce2fee83e61e3e9de7c6b7d2452e2847d -Author: Laszlo Pandy -Date: Mon Aug 8 01:58:10 2011 +0200 - - [gi] Fix crash: check return value of - _invoke_state_init_from_callable_cache() before continuing. - - gi/pygi-invoke.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit eaad9f3c71cedfe28ff2d2bb05ea6c64e323715f -Author: Laszlo Pandy -Date: Fri Aug 5 21:03:33 2011 +0200 - - [gi] Pass gtype as first parameter to vfuncs (instead of using - kwargs). - - gi/pygi-invoke.c | 32 ++++++++++++++++++-------------- - gi/types.py | 2 +- - 2 files changed, 19 insertions(+), 15 deletions(-) - -commit 76edfd0d5776f61c92c84fd9fb8dcc246c580e93 -Author: John (J5) Palmieri -Date: Mon Jul 18 18:21:51 2011 -0400 - - remove codegen - - Makefile.am | 2 +- - codegen/Makefile.am | 33 - - codegen/README.defs | 351 -------- - codegen/__init__.py | 16 - - codegen/argtypes.py | 1043 ----------------------- - codegen/code-coverage.py | 44 - - codegen/codegen.py | 1722 - -------------------------------------- - codegen/createdefs.py | 17 - - codegen/definitions.py | 575 ------------- - codegen/defsconvert.py | 132 --- - codegen/defsgen.py | 737 ---------------- - codegen/defsparser.py | 153 ---- - codegen/docextract.py | 461 ---------- - codegen/docextract_to_xml.py | 142 ---- - codegen/docgen.py | 766 ----------------- - codegen/h2def.py | 631 -------------- - codegen/mergedefs.py | 26 - - codegen/missingdefs.py | 17 - - codegen/mkskel.py | 89 -- - codegen/override.py | 285 ------- - codegen/pygobject-codegen-2.0.in | 11 - - codegen/reversewrapper.py | 912 -------------------- - codegen/scanvirtuals.py | 54 -- - codegen/scmexpr.py | 143 ---- - configure.ac | 5 - - pygobject-2.0-uninstalled.pc.in | 1 - - pygobject-2.0.pc.in | 1 - - 27 files changed, 1 insertion(+), 8368 deletions(-) - -commit bf284c7c47c3e52ab4d8700327a170903e9ebad2 -Author: John (J5) Palmieri -Date: Mon Jul 18 11:04:58 2011 -0400 - - remove some left over ifdefs to complete merge of the invoke-rewrite - branch - - gi/pygi-cache.h | 2 -- - gi/pygi-info.c | 2 -- - gi/pygi-private.h | 5 +---- - gi/pygi.h | 2 -- - 4 files changed, 1 insertion(+), 10 deletions(-) - -commit 8c653ec3033fab47c4bb4071b5732a349357141f -Author: John (J5) Palmieri -Date: Mon Jul 18 10:59:45 2011 -0400 - - rename pygi-invoke-ng to pygi-invoke - - gi/Makefile.am | 3 +- - gi/pygi-invoke-ng.c | 464 - ---------------------------------------------------- - gi/pygi-invoke.c | 464 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 466 insertions(+), 465 deletions(-) - -commit 62d59fa2c2b31d7a3cac8996d58234d4b13bb19f -Author: John (J5) Palmieri -Date: Mon Jul 18 10:56:36 2011 -0400 - - make invoke-ng the only invoker - - configure.ac | 11 - - gi/Makefile.am | 10 +- - gi/pygi-invoke.c | 1030 - ------------------------------------------------------ - 3 files changed, 1 insertion(+), 1050 deletions(-) - -commit 2937cfe5bb7122dd3783c7919294d6a34a3dfc05 -Merge: 519e556 917ea2d -Author: John (J5) Palmieri -Date: Mon Jul 18 10:45:18 2011 -0400 - - Merge branch 'master' into invoke-rewrite - -commit 519e556dc1e5874e1668bad93043fb9258c7ee79 -Merge: bab7e88 38cca3c -Author: John (J5) Palmieri -Date: Mon Jul 18 10:37:20 2011 -0400 - - Merge branch 'master' into invoke-rewrite - -commit bab7e88251bffcd360186c6dedc26be8eb077084 -Author: John (J5) Palmieri -Date: Mon Jul 18 10:35:10 2011 -0400 - - split the marshalling routines into two source files - - * update copy and paste copyright info to list the correct owner - - gi/Makefile.am | 6 +- - gi/pygi-cache.c | 3 +- - gi/pygi-marshal-in.c | 1412 ++++++++++++++++++++++++++++++++ - gi/pygi-marshal-in.h | 186 +++++ - gi/pygi-marshal-out.c | 767 ++++++++++++++++++ - gi/pygi-marshal-out.h | 144 ++++ - gi/pygi-marshal.c | 2145 - ------------------------------------------------- - gi/pygi-marshal.h | 303 ------- - 8 files changed, 2515 insertions(+), 2451 deletions(-) - -commit 917ea2dfa2d097e563233145003a66b3e4423287 -Author: Martin Pitt -Date: Thu Jul 14 11:21:10 2011 +0200 - - Ship tests/te_ST@nouppera in release tarballs for tests to succeed - - tests/Makefile.am | 1 + - 1 file changed, 1 insertion(+) - -commit e024e832ab9c82d3e299cc6e1cb427de44f2d16e -Author: John (J5) Palmieri -Date: Wed Jul 13 15:43:02 2011 -0400 - - [invoke] break out caller_allocates allocating into its own function - - gi/pygi-invoke-ng.c | 78 - +++++++++++++++++++++++++++++++++-------------------- - 1 file changed, 49 insertions(+), 29 deletions(-) - -commit fc8b8ce768ac780f7ed9edc63b70dd35194153c0 -Author: John (J5) Palmieri -Date: Wed Jul 13 15:42:26 2011 -0400 - - [invoke] missed a bit when removing constructor_class usage - - gi/pygi-invoke-ng.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit c94bcf4ae7e36f90c356c89712b00609f9f849bd -Author: John (J5) Palmieri -Date: Wed Jul 13 15:16:17 2011 -0400 - - [invoke] don't hold on to the constructor class, just add a TODO - - gi/pygi-invoke-ng.c | 11 +++++------ - gi/pygi-invoke-state-struct.h | 1 - - 2 files changed, 5 insertions(+), 7 deletions(-) - -commit c11d3195f324ea41e86e3da7ff99b55425c2faec -Author: Martin Pitt -Date: Wed Jul 13 10:40:25 2011 +0200 - - [gi] Port test_properties from static gio to GI Gio - - As we ripped out the static gio bindings a while ago, this test case - was using - the system installed gio bindings with Python 2, and now fails - completely with - Python 3. Rewrite it to use gi.repository.Gio. - - tests/test_properties.py | 38 +++++++++++++++++++------------------- - 1 file changed, 19 insertions(+), 19 deletions(-) - -commit 8f89ff24fcac627ce15ca93038711fded1a7c5ed -Author: Martin Pitt -Date: Wed Jul 13 08:42:22 2011 +0200 - - [python3] Fix maketrans import - - Python3 moved the maketrans() function from the string module to a - str method. - This unbreaks gi/module.py for Python 3 again. - - gi/module.py | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -commit 20aea4b052126fa0bface3e6e0dccfd77f9505b1 -Author: John (J5) Palmieri -Date: Fri Jul 8 14:39:22 2011 -0400 - - [caching] remove all inline compiler flags - - gi/pygi-cache.c | 96 - ++++++++++++++++++++++++++++----------------------------- - 1 file changed, 48 insertions(+), 48 deletions(-) - -commit bf7bb79b66ad406063fb443e7452d830c55986ef -Author: John (J5) Palmieri -Date: Fri Jul 8 14:35:20 2011 -0400 - - [caching] refactor function names to be less confusing - - gi/pygi-cache.c | 307 - +++++++++++++++++++++++++++----------------------------- - 1 file changed, 150 insertions(+), 157 deletions(-) - -commit c167a9345b01c070bd5a84b4a4b3a53baf9e217d -Author: John (J5) Palmieri -Date: Fri Jul 8 11:24:09 2011 -0400 - - [overrides] deprecate the use of type keyword MessageDialog - constructor - - * pygtk used type to determine the "type" of message dialog to - display but we - use the proper property name "message_type" since we should not be - overriding a reserved word - * to keep compat with pygtk we check the kwds hash for the key - 'type' and - assign it to message_type while throwing a deprecation warning - * also add a deprication warning when trying to use the depricated - NO_SEPARATOR - flag - - gi/overrides/Gtk.py | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -commit 367e4ededd4a45125157050bcc9e4e685fd4a82d -Author: Martin Pitt -Date: Fri Jul 8 10:15:53 2011 +0200 - - gdbus tests: Fix hang if test case fails - - In the TestGDBusClient.test_native_calls_async() test case, the main - loop was - never quit when the call failed. - - tests/test_gdbus.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -commit 11b578400cbf9f7c270b662a5e8953ccd466e5ef -Author: John (J5) Palmieri -Date: Thu Jul 7 19:30:11 2011 -0400 - - use an enum instead of booleans to denote function type - - gi/pygi-cache.c | 85 - ++++++++++++++++++++++++++++++----------------------- - gi/pygi-cache.h | 18 +++++++++--- - gi/pygi-invoke-ng.c | 8 ++--- - 3 files changed, 67 insertions(+), 44 deletions(-) - -commit 10e31005baec26f61c0f8fca2b5c0337b0be6c70 -Author: John (J5) Palmieri -Date: Thu Jul 7 15:18:03 2011 -0400 - - rename aux arguments to child arguments to make their purpose clearer - - gi/pygi-cache.c | 64 - ++++++++++++++++++++++++++--------------------------- - gi/pygi-cache.h | 29 ++++++++++++++++-------- - gi/pygi-invoke-ng.c | 10 ++++----- - gi/pygi-marshal.c | 12 +++++----- - 4 files changed, 63 insertions(+), 52 deletions(-) - -commit b4ad91c40f713ebdc278ce40b011e4adf9ddbbd7 -Author: Timo Vanwynsberghe -Date: Thu Jul 7 10:59:08 2011 +0200 - - Fixed the cairo example - - https://bugzilla.gnome.org/show_bug.cgi?id=653844 - - examples/cairo-demo.py | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -commit a606bab1ddc605167f2e9dc7c46c8f929fdce23b -Author: Adam Dingle -Date: Tue Jul 5 14:28:20 2011 -0700 - - Add override binding for Gtk.ListStore.prepend(). - - https://bugzilla.gnome.org/show_bug.cgi?id=654056 - - gi/overrides/Gtk.py | 8 ++++++++ - tests/test_overrides.py | 13 ++++++++++++- - 2 files changed, 20 insertions(+), 1 deletion(-) - -commit fc5c869486c7f6929e285ea7a86623ec41ecd9bd -Author: Martin Pitt -Date: Thu Jul 7 13:39:19 2011 +0200 - - Fix crash in Gtk.TextIter overrides - - With commit 17cd0fb3 Gtk.TextIter.{forward,backward}_search() - returns undefined - pointers when the search was unsuccessful. Actually check the - "success" return - value; if it is False return None, just like PyGTK used to. - - Thanks to Michael Vogt for discovering this and writing the test case! - - Test case: - - -------------- 8< ----------------- - from gi.repository import Gtk - - win = Gtk.Window.new(Gtk.WindowType.TOPLEVEL) - textview = Gtk.TextView() - buffer = textview.get_buffer() - buffer.set_text("hello world") - win.add(textview) - - win.show_all() - - iter = buffer.get_start_iter() - end = buffer.get_end_iter() - ret = iter.forward_search("foo", - Gtk.TextSearchFlags.VISIBLE_ONLY, - end) - print "this is my return value" - print ret - print "now I crash" - print ret[0].get_offset() - - Gtk.main() - -------------- 8< ----------------- - - gi/overrides/Gtk.py | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -commit 5c04fc5b2ca7e262c052426d5863d69d0c4a24da -Author: John (J5) Palmieri -Date: Tue Jul 5 15:57:23 2011 -0400 - - use gssize instead of int for arg indexes - - gi/pygi-cache.c | 24 ++++++++++++------------ - gi/pygi-cache.h | 6 +++--- - gi/pygi-invoke-ng.c | 6 +++--- - gi/pygi-marshal-cleanup.c | 6 +++--- - 4 files changed, 21 insertions(+), 21 deletions(-) - -commit ecc09749c34cd4eabf47cc722d768b042dc0be9f -Author: John (J5) Palmieri -Date: Tue Jul 5 14:17:30 2011 -0400 - - [cache] remove refrence to default value as it is not implemented yet - - gi/pygi-cache.h | 1 - - 1 file changed, 1 deletion(-) - -commit 433e0fb259047d8c81e5949a31abb5e0feefd27b -Author: Sebastian Pölsterl -Date: Thu May 12 18:53:06 2011 +0200 - - Handle arguments that are flags correctly - - https://bugzilla.gnome.org/show_bug.cgi?id=647581 - - gi/pygi-argument.c | 2 ++ - 1 file changed, 2 insertions(+) - -commit 38cca3c14e79fbc383e3fc65a120bee03714b99f -Author: John (J5) Palmieri -Date: Fri Jul 1 05:19:15 2011 -0400 - - correctly initialize the _gi_cairo_functions array to be zero filled - - gi/pygi-foreign-cairo.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 9ae43fdbcc547eb1e3c61bf9545da40555b2e2c6 -Author: John (J5) Palmieri -Date: Fri Jul 1 05:19:15 2011 -0400 - - correctly initialize the _gi_cairo_functions array to be zero filled - - gi/pygi-foreign-cairo.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit d3ee40b36b1718e6fb4544dbe07e291138ea1eb9 -Author: John (J5) Palmieri -Date: Wed Jun 29 18:14:40 2011 -0400 - - pass in the address of the gerror, not the gerror itself - - gi/pygi-argument.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 49dc98eb9339ea64355cd752ca000c79da56f3a2 -Author: John (J5) Palmieri -Date: Wed Jun 29 18:01:44 2011 -0400 - - [gi] handle marshalling gerrors arguments for signals - - gi/pygi-argument.c | 18 ++++++++++++++++-- - 1 file changed, 16 insertions(+), 2 deletions(-) - -commit db9419fcef628e9ffee10591156007ea9c0bc1f0 -Author: John (J5) Palmieri -Date: Wed Jun 29 12:12:29 2011 -0400 - - [gi-invoke-ng] fix NULL check to check before we access the cache - struct - - gi/pygi-cache.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 9027e1a20fd06df5c26edcec1893ef0814ec938a -Author: John (J5) Palmieri -Date: Tue Jun 28 18:21:55 2011 -0400 - - [gi-tests] add test for PyGObject->PyObject TreeModel storage - - * make sure we can store a custom GObject as a PyObject inside of - a TreeModel - - tests/test_overrides.py | 26 +++++++++++++++----------- - 1 file changed, 15 insertions(+), 11 deletions(-) - -commit b6842e4b2a28733e143d4022864041ca82e91f7a -Author: John (J5) Palmieri -Date: Tue Jun 28 18:13:38 2011 -0400 - - [gtk-overrides] special case TreeModel columns of PYGOBJECT types - - * box the PYGOBJECT in a GValue so we can store PyGObjects in a - TreeModel row - - gi/overrides/Gtk.py | 7 ++++--- - gobject/pygtype.c | 7 ++++--- - 2 files changed, 8 insertions(+), 6 deletions(-) - -commit 7fc9d45860210fd9d333fd3769c6cf93a6a20eb6 -Author: John (J5) Palmieri -Date: Tue Jun 28 17:32:29 2011 -0400 - - [gi-invoke-ng] copy structs when transfer is full for array - - gi/pygi-marshal.c | 21 ++++++++++++++++++--- - 1 file changed, 18 insertions(+), 3 deletions(-) - -commit 8d60c0bc7b327aa757a8727f1146f02cc0b78af8 -Author: John (J5) Palmieri -Date: Tue Jun 28 13:54:48 2011 -0400 - - [gtk-override] print warning if user imports Gtk 2.0 - - * this is needed because people file bugs not realizing they are - importing 2.0 - which is not supported - - gi/overrides/Gtk.py | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -commit 7c589c0c1de1a786e00685afd5292b6fb1f93ed3 -Author: John (J5) Palmieri -Date: Tue Jun 28 13:08:49 2011 -0400 - - [gtk-overrides] allow the message_type keyword to be used for - MessageDialogs - - * for pygtk compat we use the type keyword for message type but - we prefer - the use of message_type because it is more descriptive and does - not clash - with a python reserved word - * if you passed message_type into a MessageDialog constructor you - would get - an error because we also convert type to message_type when - calling the - parent constructor - * this patch looks to see if message_type was passed in as a - keyword and - assigns it to type while removing message_type from the keywords - dict - to avoid name clashing - - gi/overrides/Gtk.py | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 2aa12267bee91aa696633a0cea2a0accae09250a -Author: Johan Dahlin -Date: Mon Jun 27 10:56:20 2011 -0300 - - Add support for enums in gobject.property - - https://bugzilla.gnome.org/show_bug.cgi?id=653488 - - gobject/propertyhelper.py | 23 ++++++++++++++++------- - tests/test_properties.py | 40 ++++++++++++++++++++++++++++++++++++---- - 2 files changed, 52 insertions(+), 11 deletions(-) - -commit dc62e67b447ef526a6f2d1aa8648ad101d95024b -Author: Johan Dahlin -Date: Mon Jun 27 10:56:20 2011 -0300 - - Add support for enums in gobject.property - - https://bugzilla.gnome.org/show_bug.cgi?id=653488 - - gobject/propertyhelper.py | 23 ++++++++++++++++------- - tests/test_properties.py | 40 ++++++++++++++++++++++++++++++++++++---- - 2 files changed, 52 insertions(+), 11 deletions(-) - -commit 50cfccb5801c1b9a0a42ffe2826cd245f21fd88d -Author: John (J5) Palmieri -Date: Fri Jun 24 14:17:24 2011 -0400 - - [gi-invoke-ng] use g_slice for allocating GValues that are caller - allocated - - gi/pygi-invoke-ng.c | 2 ++ - gi/pygi-marshal-cleanup.c | 2 ++ - 2 files changed, 4 insertions(+) - -commit eff65cd2ce490296865441c3c78b7846f380459c -Author: John (J5) Palmieri -Date: Fri Jun 24 11:49:05 2011 -0400 - - [gi-invoke-ng] Convert Overflow errors to ValueErrors when marshalling - integers - - gi/pygi-marshal.c | 56 - +++++++++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 44 insertions(+), 12 deletions(-) - -commit 05ed688d54e3ff04e961b60d0b5d3ed0b97c771d -Author: John (J5) Palmieri -Date: Wed Jun 22 12:26:39 2011 -0400 - - [gi-invoke-ng] only cache caller allocates for interfaces as some - API are broken - - gi/pygi-cache.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -commit 4fd957a5de364c0588168dee15e1e61d4f12e173 -Author: John (J5) Palmieri -Date: Fri Jun 17 17:07:56 2011 -0400 - - [gi-invoke-ng] handle in pointer array marshalling - - gi/pygi-marshal.c | 28 ++++++++++++++++++++++------ - 1 file changed, 22 insertions(+), 6 deletions(-) - -commit df3911ad2ce83af9bf9679ed1b221847b23ba2de -Author: Alex Eftimie -Date: Fri Jun 10 08:44:04 2011 +0300 - - Adding GPtrArray tests - - tests/test_gi.py | 43 ++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 42 insertions(+), 1 deletion(-) - -commit e32c2be53175014399d89e1e85c9afc6e53c94be -Author: John (J5) Palmieri -Date: Fri Jun 17 11:32:28 2011 -0400 - - [gi-invoke-ng] fix array element offset calculations - - * use pointer arithmetic to calculate based on element size instead of - relying on the size of GIArgument - * special case GPtrArrays - - gi/pygi-marshal.c | 27 +++++++++------------------ - 1 file changed, 9 insertions(+), 18 deletions(-) - -commit 6e8dc28cb261cafbfed40fc0797a0dd5f91f497b -Author: John (J5) Palmieri -Date: Wed Jun 15 12:46:03 2011 -0400 - - [gi] don't clean up arguments that weren't yet processed during in - arg failure - - gi/pygi-marshal-cleanup.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit af7c93ea98b7f492eef265e58c8b3c878805524f -Author: John (J5) Palmieri -Date: Wed Jun 15 12:06:47 2011 -0400 - - [gi-overrides] use new instead of init when constructing a - GLib.VariantBuilder - - * init is now skipped in the gir - - gi/overrides/GLib.py | 18 ++++++++---------- - tests/test_overrides.py | 6 ++---- - 2 files changed, 10 insertions(+), 14 deletions(-) - -commit c6112307f29f9a850e6e9efa5f55d5d4a363c6b0 -Author: John (J5) Palmieri -Date: Wed Jun 15 11:42:45 2011 -0400 - - [gi-invoke-ng] actual code to import overrides - - gi/pygi-cache.c | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -commit 902575d857beffb14e56821ea8a52f705385f6bb -Author: John (J5) Palmieri -Date: Wed Jun 15 11:25:10 2011 -0400 - - [gi-invoke-ng] import pytypes so we get overrides - - gi/pygi-marshal.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit 9d5604220bd56ae2708e9b74122c14208e0a30b4 -Author: John (J5) Palmieri -Date: Tue Jun 14 16:13:37 2011 -0400 - - [gi-invoke-ng] handle gvariants now that they are not foreign - - gi/pygi-marshal.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit c1f5651062687e800a52b5d8d16c88c0acde2934 -Author: John (J5) Palmieri -Date: Tue Jun 14 16:12:43 2011 -0400 - - [gi-invoke-ng] do not try to clean up NULL arguments - - gi/pygi-marshal-cleanup.c | 24 ++++++++++++++++-------- - 1 file changed, 16 insertions(+), 8 deletions(-) - -commit fbf5382fbc1aed49ed491d2255d616a1643a45fc -Merge: 499b68d 1491f62 -Author: John (J5) Palmieri -Date: Mon Jun 13 17:28:23 2011 -0400 - - Merge branch 'master' into invoke-rewrite - -commit 499b68d6c9040cffc6e43dc87789d68446564a92 -Merge: 4c9bced 426c710 -Author: John (J5) Palmieri -Date: Mon Jun 13 17:26:37 2011 -0400 - - Merge branch 'master' into invoke-rewrite - -commit 1491f6225b9906bd369b5a42e6369ab6884736b7 -Author: Ignacio Casal Quinteiro -Date: Fri Jun 10 14:01:32 2011 +0200 - - closure: avoid double free crash - - gi/pygi-closure.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - -commit 929f4236f2b8601e7960a4a7b0a860d976ad83c6 -Author: Jason Siefken -Date: Fri Jun 3 23:11:17 2011 -0700 - - Added __eq__ method for Gdk.Color and Gdk.RGBA - - Call Gdk.Color.equal and Gdk.RGBA.equal when - == equality testing is used. - - gi/overrides/Gdk.py | 6 ++++++ - tests/test_overrides.py | 4 ++++ - 2 files changed, 10 insertions(+) - -commit dff5961ba229c7c34bd7b0a18a446b56bbe39e3a -Author: Ignacio Casal Quinteiro -Date: Wed Jun 8 19:13:48 2011 +0200 - - closure: Check the out arg is not null. Fixes bug #651812 - - gi/pygi-closure.c | 3 +++ - 1 file changed, 3 insertions(+) - -commit d7d178206bfbb0858556fcfd6c9ca8eefda3fdf5 -Author: Tomeu Vizoso -Date: Wed Jun 8 09:47:20 2011 +0200 - - Use constants instead of literals - - tests/test_overrides.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit fe386a0ad548a23e30e9cb947bfa2198fb48ef29 -Author: Tomeu Vizoso -Date: Mon Jun 6 19:07:22 2011 +0200 - - GVariant has now a GType, take that into account - - https://bugzilla.gnome.org/show_bug.cgi?id=647509 - - gi/pygi-argument.c | 8 ++++---- - gi/pygi-invoke.c | 20 +++++++++++++------- - 2 files changed, 17 insertions(+), 11 deletions(-) - -commit bd7b8d96a7420522c1fdc127ef8cfb7d6e8a1b31 -Author: Tomeu Vizoso -Date: Mon Jun 6 19:05:07 2011 +0200 - - GVariantType is a boxed struct - - https://bugzilla.gnome.org/show_bug.cgi?id=647509 - - gi/gimodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2d73012e5dbcc45a5782a6c119dfb272c14b5a61 -Author: Tomeu Vizoso -Date: Mon Jun 6 17:38:21 2011 +0200 - - Use _gi.Struct to wrap fundamentals - - https://bugzilla.gnome.org/show_bug.cgi?id=647509 - - gi/module.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit d82e6c8d1d9f2fc48fdcc15b7d2a97e4f24cf3bf -Author: Tomeu Vizoso -Date: Mon Jun 6 17:24:28 2011 +0200 - - Merge gi/HACKING into /HACKING - - HACKING | 16 ++++++++++++++++ - gi/HACKING | 26 -------------------------- - 2 files changed, 16 insertions(+), 26 deletions(-) - -commit 92aca4416a7930e5870b8d1a4016bae8140462ee -Author: Daniel Drake -Date: Fri Jun 3 16:59:15 2011 +0100 - - Fix GC-related crash during PyGObject deallocation - - Python-2.7.1's GC source has the following comment: - - /* Python's cyclic gc should never see an incoming refcount - * of 0: if something decref'ed to 0, it should have been - * deallocated immediately at that time. - * Possible cause (if the assert triggers): a tp_dealloc - * routine left a gc-aware object tracked during its teardown - * phase, and did something-- or allowed something to - happen -- - * that called back into Python. gc can trigger then, and may - * see the still-tracked dying object. Before this assert - * was added, such mistakes went on to allow gc to try to - * delete the object again. In a debug build, that caused - * a mysterious segfault, when _Py_ForgetReference tried - * to remove the object from the doubly-linked list of all - * objects a second time. In a release build, an actual - * double deallocation occurred, which leads to corruption - * of the allocator's internal bookkeeping pointers. That's - * so serious that maybe this should be a release-build - * check instead of an assert? - */ - - As shown in a backtrace at - https://bugzilla.redhat.com/show_bug.cgi?id=640972 , pygobject - is making - this exact mistake. Before untracking its object, pygobject_dealloc - calls PyObject_ClearWeakRefs() which can call back into python, create - new allocations, and trigger the GC. - - This is causing Sugar (based on pygobject2 + pygtk2 static bindings) - to - crash on a regular basis while interacting with widgets or launching - applications. - - Fix this by untracking the object early. Also fix the same issue - spotted - in the GSource wrapper. - - Thanks to Bernie Innocenti for initial diagnosis. - - glib/pygsource.c | 6 ++++-- - gobject/pygobject.c | 8 +++++++- - 2 files changed, 11 insertions(+), 3 deletions(-) - -commit 4c9bcedb4e11ad66a4b86174e2425c7afcafc473 -Author: John (J5) Palmieri -Date: Tue May 31 16:59:41 2011 -0400 - - [gi-invoke-ng] enable invoke-ng by default - - configure.ac | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 2e4cfb85a55ff205e263591d573ee5ecf0ffff3e -Author: John (J5) Palmieri -Date: Tue May 31 16:37:21 2011 -0400 - - [gi-invoke-ng] add code to clean up when input values fail to marshal - - gi/pygi-marshal-cleanup.c | 30 +++++++++++++++++++++++++----- - 1 file changed, 25 insertions(+), 5 deletions(-) - -commit 508b1b6ca1b143f1e123a3ddb83e8ce146758dfc -Author: John (J5) Palmieri -Date: Tue May 31 16:01:03 2011 -0400 - - [gi-invoke-ng] add hash cleanup routines - - gi/pygi-cache.c | 2 ++ - gi/pygi-marshal-cleanup.c | 64 - +++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-marshal-cleanup.h | 10 ++++++-- - 3 files changed, 74 insertions(+), 2 deletions(-) - -commit 1954c75b94a74259b4e5d28f5ff8d76aa4610832 -Author: John (J5) Palmieri -Date: Tue May 31 14:47:30 2011 -0400 - - [gi-invoke-ng] handle arrays with transfers of GI_TRANSFER_CONTAINER - - gi/pygi-marshal-cleanup.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit b626c46b4a95602c7bf1278c2a39aacb7f5027d9 -Author: John (J5) Palmieri -Date: Tue May 31 14:40:49 2011 -0400 - - [gi-invoke-ng] add list cleanup routines - - gi/pygi-cache.c | 8 ++--- - gi/pygi-marshal-cleanup.c | 84 - +++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-marshal-cleanup.h | 8 +++++ - 3 files changed, 96 insertions(+), 4 deletions(-) - -commit 2e542c327cd52c1f77af28905557dd25c64175d8 -Author: John (J5) Palmieri -Date: Thu May 26 16:10:13 2011 -0400 - - indentation fix - - gi/pygi-marshal.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 601aec11c49e821fe97dd30a2187fe3c75844712 -Author: John (J5) Palmieri -Date: Thu May 26 16:09:38 2011 -0400 - - [gi-invoke-ng] add out array cleanup - - gi/pygi-cache.c | 2 +- - gi/pygi-marshal-cleanup.c | 24 ++++++++++++++++++++++++ - gi/pygi-marshal.c | 37 +++++++++++++++++++++++++++++++------ - 3 files changed, 56 insertions(+), 7 deletions(-) - -commit e9ad4428b769f8c9ace1cdc973c684de84fb1a5e -Author: John (J5) Palmieri -Date: Thu May 26 13:22:38 2011 -0400 - - [gi-invoke-ng] do not allocate null terminator for garray - - * We are simply setting our own array so we don't want any allocate - null byte - - gi/pygi-marshal.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit a986b2b8e5ee37f2a330f5aabc85c73ebb0de508 -Author: John (J5) Palmieri -Date: Thu May 26 13:21:55 2011 -0400 - - [gi-invoke-ng] add array cleanup for in arrays - - gi/pygi-cache.c | 2 +- - gi/pygi-marshal-cleanup.c | 72 - ++++++++++++++++++++++++++++++++++++++++++++++- - gi/pygi-marshal-cleanup.h | 9 ++++++ - gi/pygi-marshal.c | 13 +++++++-- - 4 files changed, 91 insertions(+), 5 deletions(-) - -commit 990c60805c8ef718eb29e2e1b24f057552c6159e -Author: John (J5) Palmieri -Date: Mon May 23 17:06:30 2011 -0400 - - [gi-invoke-ng] remove remaining bits of the invoke stage state machine - - gi/pygi-invoke-ng.c | 7 +------ - gi/pygi-invoke-state-struct.h | 14 -------------- - 2 files changed, 1 insertion(+), 20 deletions(-) - -commit dbbcf4a0e76fb572d85843ee31c3798df5cd5cc5 -Author: John (J5) Palmieri -Date: Mon May 23 16:59:57 2011 -0400 - - [gi-invoke-ng] revamp cleanup framework to be orthogonal to cache - setup - - * cleanup now has symmetry with setup so there are now in and out - cleanups - for each type that needs to be cleaned up - * no longer use state machine but instead call different cleanup - functions at - different stages of invoke, making it easier to understand what - happens at - each stage - - gi/pygi-cache.c | 19 ++- - gi/pygi-cache.h | 7 +- - gi/pygi-invoke-ng.c | 10 +- - gi/pygi-invoke-state-struct.h | 2 + - gi/pygi-marshal-cleanup.c | 301 - +++++++++++++++++------------------------- - gi/pygi-marshal-cleanup.h | 45 ++++--- - gi/pygi-marshal.c | 15 +-- - 7 files changed, 174 insertions(+), 225 deletions(-) - -commit 198714dc4585f7463f38929f1ca4e4b60a27dadb -Author: John (J5) Palmieri -Date: Thu May 12 17:29:20 2011 -0400 - - [gi-invoke-ng] stub out a cleaner way of cleaning up after ourselves - - * The state machine concept of cleaning up was getting a bit messy. - It was like we took a big bowl of spaghetti code and dumped it. - * Now we call specific cleanup functions at the point of failure (or - successful completion of a marshalling stage) - - gi/pygi-invoke-ng.c | 59 +++++++++++++++++++++++++++++++------- - gi/pygi-marshal-cleanup.c | 72 - +++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-marshal-cleanup.h | 14 +++++++++ - 3 files changed, 135 insertions(+), 10 deletions(-) - -commit c1389dadbf35afee3f28d90ef637efd8c1f071a5 -Author: José Alburquerque -Date: Thu May 12 11:53:40 2011 -0400 - - Doc Extractor: Correct the logic of the --no-since option. - - * codegen/docextract.py (process_final_sections): If the - --no-since - option has been specified and a "Since:" is encountered during the - processing of the final sections, simply don't append the - "Since: ..." - instead of reading the next line. This preserves the logical - flow of - processing. - - codegen/docextract.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 303d8e8ab9e60cb554de7fc0e8592cd9b2c50843 -Author: José Alburquerque -Date: Mon May 9 17:32:09 2011 -0400 - - Doc Extractor: Add a --no-since option. - - * codegen/docextract.py: - * codegen/docextract_to_xml.py: Modified so that if a --no-since - option is specified at the command line, the "Since: ..." portion - of - the gtkdoc function block is omitted. This is useful for C++ - modules - such as gstreamermm where this information would not be useful - as long - as the C API is still unstable. - - codegen/docextract.py | 15 ++++++++++++++- - codegen/docextract_to_xml.py | 9 ++++++--- - 2 files changed, 20 insertions(+), 4 deletions(-) - -commit 4f615c6e300d6f2d7551b640efa301060206ab58 -Author: John (J5) Palmieri -Date: Thu May 5 14:04:34 2011 -0400 - - [gi-invoke-ng] tweek cleanup routines - - gi/pygi-cache.c | 5 +++ - gi/pygi-marshal-cleanup.c | 87 - +++++++++++++++++++++++++++++++++++------------ - gi/pygi-marshal-cleanup.h | 6 ++-- - gi/pygi-marshal.c | 11 ++---- - 4 files changed, 76 insertions(+), 33 deletions(-) - -commit 63c7f17c224821cb7136d06e8ef87eab7291848d -Author: Martin Pitt -Date: Mon May 2 15:49:52 2011 +0200 - - Fix symbol names to be locale independent - - We currently use upper() to present enum values, which are usually - defined in - lower case in the typelib, in upper cases. However, upper() is locale - dependent, so that e. g. in tr_TR.UTF-8, "invalid" becomes "iNVALiD" - because Turkish has some extra variants of "i". - - Use a local ASCII-only translate() call instead to avoid this. Thanks - to Nils - Philippsen for the idea! - - This also adds a test locale "te_ST@nouppera" which defines - toupper('a') == 'a'. - Run the Enum tests under this locale to reproduce the bug and verify - the fix. - - https://bugzilla.gnome.org/show_bug.cgi?id=649165 - - gi/module.py | 9 ++++++++- - tests/te_ST@nouppera | 50 - ++++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gi.py | 30 ++++++++++++++++++++++++++++++ - 3 files changed, 88 insertions(+), 1 deletion(-) - -commit b5e150da76c3d4de1a75f58d03c3a761e9005a63 -Author: Martin Pitt -Date: Wed May 4 08:35:27 2011 +0200 - - [gi] pygi-convert.sh: Convert gtk.gdk.CROSSHAIR - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit fcc5ea201ab25da6db94ea8a37364a1d3c4d7c65 -Author: John (J5) Palmieri -Date: Fri Apr 29 17:41:08 2011 -0400 - - [gi-invoke-ng] handle filename cleanup with the utf8 cleanup function - - gi/pygi-cache.c | 2 ++ - 1 file changed, 2 insertions(+) - -commit dbe8c4fabc8ac19415a3be0e854d3a54c2317e0b -Author: John (J5) Palmieri -Date: Fri Apr 29 17:40:13 2011 -0400 - - [gi-invoke-ng] handle caller allocates cleanup - - gi/pygi-invoke-ng.c | 5 ++- - gi/pygi-marshal-cleanup.c | 104 - ++++++++++++++++++++++++++++++++++++---------- - gi/pygi-marshal-cleanup.h | 7 ++-- - 3 files changed, 90 insertions(+), 26 deletions(-) - -commit cdbf57f3b1f041a06cf545a5557424f701ed1ec7 -Author: John (J5) Palmieri -Date: Thu Apr 28 19:16:02 2011 -0400 - - [gi-invoke-ng] refactor the cleanup code and add utf8 cleanup as - initial test - - gi/pygi-cache.c | 15 ++----------- - gi/pygi-invoke-ng.c | 8 +++---- - gi/pygi-invoke-state-struct.h | 2 ++ - gi/pygi-marshal-cleanup.c | 51 - ++++++++++++++++++++++++++++++++++++++++++- - gi/pygi-marshal-cleanup.h | 3 +++ - 5 files changed, 60 insertions(+), 19 deletions(-) - -commit d1f1f4ccc55f9ecab73b7c0ee78762c4039b2c79 -Author: John (J5) Palmieri -Date: Wed Apr 27 15:47:19 2011 -0400 - - use PyCapsule when importing pycairo/require pycairo 1.10.0 for - python3 builds - - * PyCObject is deprecated and pycairo 1.10.0 is first release to - fix this issue - - configure.ac | 15 +++++++++++---- - gi/pygi-foreign-cairo.c | 2 +- - 2 files changed, 12 insertions(+), 5 deletions(-) - -commit 83b7823a510b0b391560c6deaf9d15d8303c7b14 -Author: Ignacio Casal Quinteiro -Date: Thu Apr 21 16:52:20 2011 +0200 - - [python3] fix build. PYcairo_IMPORT doesn't exists anymore - - gi/pygi-foreign-cairo.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit 3e933784df423757e591d703614cb700adb0bbe0 -Author: Sebastian Pölsterl -Date: Mon Apr 18 18:36:25 2011 +0200 - - Updated DOAP file - - pygobject.doap | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 399d06b4b20685eb38acfd7e43226e06737ab7d2 -Author: Sebastian Pölsterl -Date: Sat Apr 16 16:02:05 2011 +0200 - - [gi] Don't create variant twice - - gi/overrides/GLib.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 8d8a84ea23d28d25851c5870f261c020d762cef4 -Author: Sebastian Pölsterl -Date: Fri Apr 15 16:14:43 2011 +0200 - - pygi-convert.sh: Make sure the uppercase GObject module is imported - instead of the lowercase - - https://bugzilla.gnome.org/show_bug.cgi?id=647736 - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 3b51d6426d0f59b2dd7e0dcdcded4bed43d6b9d8 -Author: Sebastian Pölsterl -Date: Fri Apr 15 15:58:53 2011 +0200 - - [gi] Removed hack to avoid using GLib.Variant.new_variant. - - The bug in the annotations of GLib is fixed now. - https://bugzilla.gnome.org/show_bug.cgi?id=639952 - https://bugzilla.gnome.org/show_bug.cgi?id=647796 - - gi/overrides/GLib.py | 14 +------------- - 1 file changed, 1 insertion(+), 13 deletions(-) - -commit bb4dce14ba666969815d4e56adbc38f0ac4f7ff7 -Author: Sebastian Pölsterl -Date: Fri Apr 15 15:58:31 2011 +0200 - - [gi] Added additional test case for GVariant handling - - tests/test_overrides.py | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 138df2778543409752e229a09828a805f68a420d -Author: Sebastian Pölsterl -Date: Mon Apr 11 18:34:31 2011 +0200 - - [gi] Added support for GVariant arguments - - This is required in order for the "g-signal" signal of GDBusProxy - to work properly and thus to properly receive DBus signals with any - type of argument. - - https://bugzilla.gnome.org/show_bug.cgi?id=647477 - - gi/pygi-argument.c | 2 ++ - 1 file changed, 2 insertions(+) - -commit 985f239d891c7697d76ccecb797b189669ae6ee1 -Author: John (J5) Palmieri -Date: Tue Mar 22 18:46:28 2011 -0400 - - fix static ABI for setting string gvalues from python objects - - * the static bindings used to be able to set a string gvalue to - any python - object that implemented __str__, for instance when setting a - treemodel column - * this restores that code while still keeping unicode and python 3 - compatability - - gobject/pygtype.c | 28 +++++++++++++++++++--------- - tests/test_properties.py | 8 ++++++++ - 2 files changed, 27 insertions(+), 9 deletions(-) - -commit 58cfc3cd1152b4448b56a6ff597f954d8450b83e -Author: Dieter Verfaillie -Date: Tue Mar 22 20:47:51 2011 +0100 - - dsextras.py: ensure eol characters are preserved when writing template - files (so \n does not become \r\n) - - dsextras.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 629d267478982c426ba61a639d5c9603fed856e6 -Author: Dieter Verfaillie -Date: Tue Mar 22 11:35:44 2011 +0100 - - dsextras.py: remove \r as wel as \n character - - dsextras.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 426c7109d4c0dbf0d56cc075f97f33b3451f79a8 -Author: John (J5) Palmieri -Date: Wed Apr 27 15:47:19 2011 -0400 - - use PyCapsule when importing pycairo/require pycairo 1.10.0 for - python3 builds - - * PyCObject is deprecated and pycairo 1.10.0 is first release to - fix this issue - - configure.ac | 15 +++++++++++---- - gi/pygi-foreign-cairo.c | 2 +- - 2 files changed, 12 insertions(+), 5 deletions(-) - -commit 4e5833d0c2fe548617e5ea510f05920fd0caf73b -Author: Ignacio Casal Quinteiro -Date: Thu Apr 21 16:52:20 2011 +0200 - - [python3] fix build. PYcairo_IMPORT doesn't exists anymore - - gi/pygi-foreign-cairo.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit 91ec337359720839862d3f5a8a0ea98f760a0752 -Author: Sebastian Pölsterl -Date: Mon Apr 18 18:36:25 2011 +0200 - - Updated DOAP file - - pygobject.doap | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 05c766044c83340c44564d0097514bfc1d1d9df7 -Author: Sebastian Pölsterl -Date: Sat Apr 16 16:02:05 2011 +0200 - - [gi] Don't create variant twice - - gi/overrides/GLib.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit eb8f212e3687af30407cf01fcdfbf530257bcddb -Author: Sebastian Pölsterl -Date: Fri Apr 15 16:14:43 2011 +0200 - - pygi-convert.sh: Make sure the uppercase GObject module is imported - instead of the lowercase - - https://bugzilla.gnome.org/show_bug.cgi?id=647736 - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit af31729573de24161ee90563e5738187c749783c -Author: Sebastian Pölsterl -Date: Fri Apr 15 15:58:53 2011 +0200 - - [gi] Removed hack to avoid using GLib.Variant.new_variant. - - The bug in the annotations of GLib is fixed now. - https://bugzilla.gnome.org/show_bug.cgi?id=639952 - https://bugzilla.gnome.org/show_bug.cgi?id=647796 - - gi/overrides/GLib.py | 14 +------------- - 1 file changed, 1 insertion(+), 13 deletions(-) - -commit 070f6688be4afb926656038dcceac4c8b8ed97c7 -Author: Sebastian Pölsterl -Date: Fri Apr 15 15:58:31 2011 +0200 - - [gi] Added additional test case for GVariant handling - - tests/test_overrides.py | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 65aa040e86d94ee6bb227a2bce09668b60208027 -Author: John (J5) Palmieri -Date: Tue Apr 12 14:51:35 2011 -0400 - - [gi-invoke-ng] fix prototype - - gi/pygi-cache.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 12aa4e6376366ca9d758434f6544c9c70a1e5df8 -Author: John (J5) Palmieri -Date: Tue Apr 12 14:48:16 2011 -0400 - - [gi-invoke-ng] create new framework for cleaning up args - - * we now have a state machine so we know what point in the marshalling - process - we are and which args need to be cleaned up - * call the cleanup functions after invoking the gi callable, after - marshalling - the out parameters and at any time an error occures - - gi/Makefile.am | 4 ++- - gi/pygi-cache.c | 25 +++++++------ - gi/pygi-cache.h | 5 ++- - gi/pygi-invoke-ng.c | 34 ++++++++++++++---- - gi/pygi-invoke-state-struct.h | 13 +++++++ - gi/pygi-marshal-cleanup.c | 81 - +++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-marshal-cleanup.h | 43 +++++++++++++++++++++++ - gi/pygi-marshal.c | 1 + - 8 files changed, 187 insertions(+), 19 deletions(-) - -commit 0463295cd046bd6382ad9dc71ea1518858d63c5f -Author: Sebastian Pölsterl -Date: Mon Apr 11 18:34:31 2011 +0200 - - [gi] Added support for GVariant arguments - - This is required in order for the "g-signal" signal of GDBusProxy - to work properly and thus to properly receive DBus signals with any - type of argument. - - https://bugzilla.gnome.org/show_bug.cgi?id=647477 - - gi/pygi-argument.c | 2 ++ - 1 file changed, 2 insertions(+) - -commit 1d64c3d3db2ec17b9a48df55271f712db6c07060 -Author: John (J5) Palmieri -Date: Wed Mar 30 16:40:31 2011 -0400 - - [gi-invoke-ng] fix marshal header that is no longer part of - pygi-arguments.h - - gi/pygi-marshal.h | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 3580cd1c7222022ebeef3476f9e609c8045f12a3 -Author: John (J5) Palmieri -Date: Wed Mar 30 15:53:13 2011 -0400 - - [gi-invoke-ng] code style space fixes - - gi/pygi-cache.c | 420 +++++++++++++++++++------------------- - gi/pygi-invoke-ng.c | 145 +++++++------- - gi/pygi-marshal.c | 565 - ++++++++++++++++++++++++++-------------------------- - 3 files changed, 566 insertions(+), 564 deletions(-) - -commit 81662fcd09f112bfffcdc5b7f01a5537b84cd9d4 -Author: John (J5) Palmieri -Date: Tue Mar 29 16:54:44 2011 -0400 - - [gi-invoke-ng] don't decref value taken from a dict as it is borrowed - - gi/pygi-invoke-ng.c | 1 - - 1 file changed, 1 deletion(-) - -commit a456fc0adc1f8a0754bf59cde8924f905bfc7dc1 -Author: John (J5) Palmieri -Date: Tue Mar 29 15:23:06 2011 -0400 - - [gi-invoke-ng] return None when appropriate so we don't crash - - gi/pygi-marshal.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -commit e8c8c37e5587dc7ff62519df336988a12e6f5d0a -Author: John (J5) Palmieri -Date: Tue Mar 29 15:21:41 2011 -0400 - - [gi-invoke-ng] fix aux value caching - - gi/pygi-cache.c | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -commit 4e4c1847c713a4eb4ab34d04488e94dac24d9167 -Author: John (J5) Palmieri -Date: Mon Mar 28 20:25:46 2011 -0400 - - [gi-invoke-ng] backport handling flags with no gtype - - gi/pygi-marshal.c | 25 ++++++++++++++++++++++++- - 1 file changed, 24 insertions(+), 1 deletion(-) - -commit fd76423e655b3711e1ffbf9b61ea4e2c94040234 -Author: John (J5) Palmieri -Date: Mon Mar 28 18:32:00 2011 -0400 - - [gi-invoke-ng] backport raw gvalue handling - - gi/pygi-marshal.c | 23 ++++++++++++++++++----- - 1 file changed, 18 insertions(+), 5 deletions(-) - -commit 507b5051c83f70ceae79e0fa693c86e5cbb9f442 -Author: John (J5) Palmieri -Date: Mon Mar 28 18:30:31 2011 -0400 - - [gi-invoke-ng] marshal instances seperately since they differ slightly - from other args - - gi/pygi-cache.c | 2 +- - gi/pygi-marshal.c | 38 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 39 insertions(+), 1 deletion(-) - -commit 726a27c0e74ace3ff23d9cc4d393ae53e57f1fac -Author: John (J5) Palmieri -Date: Mon Mar 28 18:26:09 2011 -0400 - - [gi-invoke-ng] refactor FunctionCache to be more generic CallableCache - - gi/pygi-cache.c | 392 - +++++++++++++++++++++++++++------------------------- - gi/pygi-cache.h | 12 +- - gi/pygi-info.c | 2 +- - gi/pygi-invoke-ng.c | 40 +++--- - gi/pygi-marshal.c | 140 +++++++++---------- - gi/pygi-marshal.h | 159 +++++++++------------ - gi/pygi.h | 2 +- - 7 files changed, 362 insertions(+), 385 deletions(-) - -commit 3d5d9ff5c18a850650992bdd52e8e4c722b23396 -Author: John (J5) Palmieri -Date: Mon Mar 28 15:01:12 2011 -0400 - - [gi-invoke-rewrite] backport glib error handling - - gi/pygi-invoke-ng.c | 14 ++++++-------- - 1 file changed, 6 insertions(+), 8 deletions(-) - -commit 37b14b28a5f2aec16ac7f321efbf07e1403e9531 -Author: John (J5) Palmieri -Date: Fri Mar 25 18:48:42 2011 -0400 - - [gi-invoke-ng] backport closure passing from invoke - - gi/pygi-marshal.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -commit cf7f97eabc9c49773c2916929b8c43ef453d0652 -Author: John (J5) Palmieri -Date: Fri Mar 25 18:47:36 2011 -0400 - - [gi-invoke-ng] handle vfuncs and fix cosntrutors - - gi/pygi-cache.c | 9 +++++++ - gi/pygi-cache.h | 2 ++ - gi/pygi-invoke-ng.c | 56 - ++++++++++++++++++++++++++++++++----------- - gi/pygi-invoke-state-struct.h | 2 ++ - 4 files changed, 55 insertions(+), 14 deletions(-) - -commit af2ce400fcf771ee6c9bc01aecfb59467be5a0ce -Author: John (J5) Palmieri -Date: Fri Mar 25 18:39:06 2011 -0400 - - [gi-invoke-ng] handle foreign types correctly - - gi/pygi-cache.c | 22 ++++++---------------- - gi/pygi-marshal.c | 3 +++ - 2 files changed, 9 insertions(+), 16 deletions(-) - -commit 482553ae5d863ca523be3bd1eededa5d02a4f87e -Author: John (J5) Palmieri -Date: Fri Mar 25 13:14:01 2011 -0400 - - [gi] remove the class parameter from the argument list of constructors - - * constructors pass in their class to be constructed. Since we - use GI - and g_object_new to do the construction we ignore this for now but - keep it around in the state for future use. - - gi/pygi-invoke-ng.c | 46 - +++++++++++++++++++++++++++++++++++++------ - gi/pygi-invoke-state-struct.h | 1 + - 2 files changed, 41 insertions(+), 6 deletions(-) - -commit 0534eb0e843cdf09611143da184052f7e549e4dc -Author: John (J5) Palmieri -Date: Tue Mar 22 18:46:28 2011 -0400 - - fix static ABI for setting string gvalues from python objects - - * the static bindings used to be able to set a string gvalue to - any python - object that implemented __str__, for instance when setting a - treemodel column - * this restores that code while still keeping unicode and python 3 - compatability - - gobject/pygtype.c | 28 +++++++++++++++++++--------- - tests/test_properties.py | 8 ++++++++ - 2 files changed, 27 insertions(+), 9 deletions(-) - -commit 5f0e130026a663a57ed1317e0fa0e1f78f9e6e0a -Author: Dieter Verfaillie -Date: Tue Mar 22 20:47:51 2011 +0100 - - dsextras.py: ensure eol characters are preserved when writing template - files (so \n does not become \r\n) - - dsextras.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 62a6274105003ef386ddfe9ef38e8afa8c43d124 -Author: Dieter Verfaillie -Date: Tue Mar 22 11:35:44 2011 +0100 - - dsextras.py: remove \r as wel as \n character - - dsextras.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 86c436978c933f6ebe17627abe98325ce66f6baa -Author: John (J5) Palmieri -Date: Tue Mar 22 16:13:58 2011 -0400 - - [gi] make new invoke-ng codepath compile correctly - - configure.ac | 4 + - gi/Makefile.am | 5 +- - gi/pygi-cache.c | 2 +- - gi/pygi-invoke-ng.c | 841 ---------------------- - gi/pygi-marshal.c | 1962 - +-------------------------------------------------- - gi/pygi-private.h | 4 +- - 6 files changed, 9 insertions(+), 2809 deletions(-) - -commit 35619fec43f4df85edf5456f3fc9733b16f2ba90 -Author: John (J5) Palmieri -Date: Tue Mar 22 15:40:02 2011 -0400 - - [gi] conditionalize invoke code paths - - configure.ac | 7 +++++++ - gi/Makefile.am | 20 +++++++++++++++----- - gi/pygi-cache.h | 2 ++ - gi/pygi-info.c | 4 +++- - gi/pygi-private.h | 9 +++++++-- - gi/pygi.h | 4 +++- - 6 files changed, 37 insertions(+), 9 deletions(-) - -commit 83c51bd2bb6ca24ce610c04cff1527bcd2689d90 -Author: John (J5) Palmieri -Date: Tue Mar 22 15:37:24 2011 -0400 - - [gi] revert back to the type.py from master - - gi/types.py | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -commit cb30d00d1c92e73d9bfb08cc7b600a5aa70f2fc0 -Author: John (J5) Palmieri -Date: Tue Mar 22 14:46:29 2011 -0400 - - [gi] revert pygi-argument.h and move the invoke-ng code to - pygi-marshal.h - - gi/pygi-argument.h | 268 +----------------------------------------- - gi/pygi-marshal.h | 336 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 337 insertions(+), 267 deletions(-) - -commit 17cb714cfdaf45b6d7dd627b0189bd24e6578f74 -Merge: 7332a1b 01596a9 -Author: John (J5) Palmieri -Date: Tue Mar 22 13:34:36 2011 -0400 - - Merge branch 'master' into invoke-rewrite - - Conflicts: - gi/Makefile.am - gi/pygi-argument.c - gi/pygi-foreign-cairo.c - gi/pygi-foreign-gvariant.c - gi/pygi-foreign-gvariant.h - gi/pygi-foreign.c - gi/pygi-foreign.h - gi/pygi-private.h - gi/pygi.h - -commit 01596a9b7cc0ceef3904da5b96939140ee0732fd -Author: John (J5) Palmieri -Date: Tue Mar 22 13:20:54 2011 -0400 - - [gi] foreign types now take interface infos instead of type infos - - * this is a prep for the invoke-rewrite branch - * when marshalling foreign structs we may not have the type info but - we will always have the interface info to pass - * this simplifies the code because we were simply converting the - type info back to an interface info anyway so there is less - refcounting to keep track of - * also fixes a bug where we were leaking PyNone ref counts - - gi/pygi-argument.c | 4 ++-- - gi/pygi-foreign-cairo.c | 16 ++++++++-------- - gi/pygi-foreign-gvariant.c | 12 ++++++------ - gi/pygi-foreign.c | 32 +++++++++++++------------------- - gi/pygi-foreign.h | 8 ++++---- - gi/pygi-invoke.c | 6 +++--- - gi/pygi.h | 12 ++++++------ - 7 files changed, 42 insertions(+), 48 deletions(-) - -commit fbabc1fdafa1dcbd1f6aaea7b821bd1c64a546ab -Author: Martin Pitt -Date: Tue Mar 22 15:04:01 2011 +0100 - - Fix GSchema tests for separate build tree - - When using a separate build tree, the compiled GSettings schema will - be in the - build tree, but as the test scripts are only in the source tree they - won't find - the compiled schema. Pass the build dir as environment variable and - prefer it - over test_overrides.py's directory. - - tests/Makefile.am | 3 ++- - tests/test_overrides.py | 4 +++- - 2 files changed, 5 insertions(+), 2 deletions(-) - -commit 7332a1b99775519fdc5500cab6628b713e946a8c -Author: John (J5) Palmieri -Date: Mon Mar 21 19:03:29 2011 -0400 - - [gi] start of merge from master - - * move some of the modified files that will cause merge conflicts - to their - own, nonconflicting files - * copy the old files out of master - - gi/pygi-argument.c | 2101 +++------------------------ - gi/pygi-invoke-ng.c | 1179 ++++++++++++++++ - gi/pygi-invoke.c | 421 ++---- - gi/pygi-marshal.c | 3916 - +++++++++++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 5389 insertions(+), 2228 deletions(-) - -commit 62b49dae97441953452d097cb1751df14302547a -Author: John (J5) Palmieri -Date: Wed Mar 16 17:34:18 2011 -0400 - - [gi] marshal raw closures - - * before we were able to marshal python callables into methods - that took - GClosures but we had no way to take a GClosure returned from one - method and pass it to another - this enables that usecase - - https://bugzilla.gnome.org/show_bug.cgi?id=644757 - - gi/pygi-argument.c | 17 ++++++++++------- - tests/test_gi.py | 4 ++++ - 2 files changed, 14 insertions(+), 7 deletions(-) - -commit 1e70957c5470a0f4bceba38ca66a4e4274fdc8d8 -Author: John Stowers -Date: Sun Mar 6 23:41:01 2011 +1300 - - pygi-convert.sh add GObject.xxx and webkit - - https://bugzilla.gnome.org/show_bug.cgi?id=644347 - - pygi-convert.sh | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 2292673c96e7973a0732ca15bbd5b0bf7a9c7dcf -Author: John Stowers -Date: Sun Mar 6 23:41:30 2011 +1300 - - pygi-convert.sh remove gobject tests, GObject works now - - https://bugzilla.gnome.org/show_bug.cgi?id=644347 - - pygi-convert.sh | 28 ---------------------------- - 1 file changed, 28 deletions(-) - -commit d26e5cc45f277f6b7edb32aa416520bb53bff9c2 -Author: John (J5) Palmieri -Date: Fri Mar 11 14:09:02 2011 -0500 - - [gi-demos] add pickers demo - - demos/gtk-demo/demos/pickers.py | 74 - +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 74 insertions(+) - -commit b8d926a458ed7d7e92719e41b5bc1c36f68882b3 -Author: John (J5) Palmieri -Date: Thu Mar 10 18:12:50 2011 -0500 - - [gi-demos] add menu demo - - demos/gtk-demo/demos/menus.py | 122 - ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 122 insertions(+) - -commit 9baec8ed1c5d99c1677a75eaa1d38912f41f0b2d -Author: John (J5) Palmieri -Date: Wed Mar 9 13:02:50 2011 -0500 - - [gi-overrides] fix exception block so it works in Python 2.5 - - gi/overrides/Gio.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit 5ac534ac3ceee3cc19fe2297e3cd009817ed726f -Author: Martin Pitt -Date: Mon Mar 21 13:19:58 2011 +0100 - - Revert "Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES" - - This reverts commit fc7d7f7f153d57ff3866b7bfd5e6479d702cc4d9. - - This introduces additional libpython dependencies, which breaks - distributions - which support multiple Python versions, and also causes the python - interpreter - to be in memory twice in some cases. - - https://bugzilla.gnome.org/show_bug.cgi?id=620215 - - gi/Makefile.am | 4 +--- - glib/Makefile.am | 2 +- - m4/python.m4 | 7 ++----- - tests/Makefile.am | 2 +- - 4 files changed, 5 insertions(+), 10 deletions(-) - -commit cd01f8ce1373f28b1427dd847bef44f747f1e6b3 -Author: Dieter Verfaillie -Date: Fri Mar 18 17:06:08 2011 +0100 - - setup.py: fix user_access_control option - - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2da60baec4f43c41f43527cbfde4e21e0eea728c -Author: Martin Pitt -Date: Wed Mar 16 10:22:35 2011 +0100 - - [gi] Respect the MessageType for Gtk.MessageDialog - - Don't just ignore the type argument, actually pass it on. Thanks - to Tualatrix - Chou for spotting this! - - gi/overrides/Gtk.py | 1 + - 1 file changed, 1 insertion(+) - -commit 029a79d1af1e0998aa6bc88ce1c1f48ce0ccd2a0 -Author: Martin Pitt -Date: Tue Mar 15 10:22:39 2011 +0100 - - [gi] Do not require signature for D-BUS methods without arguments - - Calling methods on DBusProxy objects usually requires specifying - the signature - as first argument. However, if the D-BUS method does not take any - arguments, - specifying the empty '()' signature does not give any additional - information, - so allow the caller to just call the proxy method without any - arguments. - - Also ensure that passing a non-string signature raises a - comprehensible - exception, instead of crashing deep in the GVariant leaf constructor. - - https://bugzilla.gnome.org/show_bug.cgi?id=644260 - - gi/overrides/Gio.py | 16 +++++++++++++++- - tests/test_gdbus.py | 13 +++++++++++++ - 2 files changed, 28 insertions(+), 1 deletion(-) - -commit 5bf66ce79267b25bcc80251f9170498fa1d765f6 -Author: John Stowers -Date: Sun Mar 6 23:05:33 2011 +1300 - - [gi-overrides] TreeViewColumn.set_cell_data_func func_data can be None - - https://bugzilla.gnome.org/show_bug.cgi?id=644343 - - gi/overrides/Gtk.py | 2 ++ - 1 file changed, 2 insertions(+) - -commit 8e4f86e17a1de533a93b0748fd8de3cbfa70ba62 -Author: John Stowers -Date: Sun Mar 6 17:48:04 2011 +1300 - - [gi-demos] dont try and run demos that represent directories - - demos/gtk-demo/gtk-demo.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 097e5efab29d3d2d91d0b9fc75bf00219e9b7810 -Author: John (J5) Palmieri -Date: Mon Mar 7 18:09:18 2011 -0500 - - [gi-demos] some python 3 compat fixes - - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 6 ++++++ - demos/gtk-demo/demos/Tree View/liststore.py | 2 +- - demos/gtk-demo/demos/rotatedtext.py | 4 ++-- - demos/gtk-demo/gtk-demo.py | 4 ++-- - 4 files changed, 11 insertions(+), 5 deletions(-) - -commit fd5d5ef3abc947d3c6066eea6378514f87b7f0ce -Author: John (J5) Palmieri -Date: Tue Feb 22 15:07:40 2011 -0500 - - [gi-demos] add liststore demo - - demos/gtk-demo/demos/Tree View/__init__.py | 0 - demos/gtk-demo/demos/Tree View/liststore.py | 205 - ++++++++++++++++++++++++++++ - 2 files changed, 205 insertions(+) - -commit 09de5cf99474fc8a34b5f4a61cede1fb47353ebb -Author: John (J5) Palmieri -Date: Mon Mar 7 18:08:40 2011 -0500 - - [gi-demos] catch the correct error class - - demos/gtk-demo/demos/images.py | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -commit 7284d2d4622978fc9ddfd00f2714b3a572b7ab56 -Author: Steve Frécinaux -Date: Sun Mar 6 21:18:36 2011 +0100 - - Do not leak python references when using the gobject.property() - helper. - - Since this helper was storing plain references in a long-lived - dict, the - refcount for the instances would never drop to zero, and so they would - never get finalized. - - https://bugzilla.gnome.org/show_bug.cgi?id=644039 - - gobject/propertyhelper.py | 5 ++--- - tests/test_properties.py | 23 +++++++++++++++++++++++ - 2 files changed, 25 insertions(+), 3 deletions(-) - -commit 618dbb0ee15b47e5e7cb16a34ffce0937d7fa26d -Author: John (J5) Palmieri -Date: Fri Mar 4 12:25:49 2011 -0500 - - handle uchar as bytes, not strings in python 3 - - * This worked in Python2 because bytes and strings are equivilant - and the macro - PYGLIB_PyString_FromStringAndSize evaluated to a PyString - * In Python 3 PYGLIB_PyString_FromStringAndSize evaluates to - a PyUnicode - * PYGLIB_PyBytes_FromStringAndSize evaluates to a PyString in Python 2 - and a PyBytes object in Python 3 - - gobject/pygtype.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 7e9483ff75b7a63ddda0fa9a9847f9f22ad71240 -Author: John (J5) Palmieri -Date: Fri Mar 4 12:24:35 2011 -0500 - - [gi-overrides] handle unichar gvalues when setting treemodels - - gi/overrides/Gtk.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 6367bffa006e94dc667d7008fccad8d47d8d3646 -Author: John (J5) Palmieri -Date: Fri Mar 4 11:43:51 2011 -0500 - - [gi-overrides] special case python 2 keywords that crept in - - gi/overrides/Gtk.py | 6 +++++- - tests/test_overrides.py | 8 ++++---- - 2 files changed, 9 insertions(+), 5 deletions(-) - -commit 83b0f8a37d5f3236780d87a1ca466c5e44ae2bc0 -Author: John (J5) Palmieri -Date: Fri Mar 4 11:10:16 2011 -0500 - - check for the py3 _thread module in configure.ac if thread is - not found - - configure.ac | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit 4645af87d3c587f535404867dab56608719e5c7b -Author: John (J5) Palmieri -Date: Fri Mar 4 00:39:23 2011 -0500 - - [gi-demos] add iconview demo - - demos/gtk-demo/demos/Icon View/iconviewbasics.py | 212 - +++++++++++++++++++++++ - 1 file changed, 212 insertions(+) - -commit 761dcb516a04f7a89b3c7d68e88fff23055e2a80 -Author: John (J5) Palmieri -Date: Thu Mar 3 18:39:16 2011 -0500 - - [gi] wrap the keyword argument in a dict so we don't break Python 2.5 - - * python < 2.6 does not allow sending in keyword litterals after - sending in - *args. You can only send in **kwds. - - gi/types.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f9604e90af12a1b9dbe7d7f311308e87cd0ed7dd -Author: John (J5) Palmieri -Date: Thu Mar 3 18:30:40 2011 -0500 - - [gi-demos] add the combobox with string ids section to the demos - - demos/gtk-demo/demos/combobox.py | 49 - +++++++++++++++++++++++++++++++++++++++- - 1 file changed, 48 insertions(+), 1 deletion(-) - -commit b70f4daf071cf77a4561b57f5521eb928f66d1ce -Author: John (J5) Palmieri -Date: Thu Mar 3 16:47:51 2011 -0500 - - [gi-overrides] add an override for Gdk.RGBA - - gi/overrides/Gdk.py | 18 ++++++++++++++++++ - tests/test_overrides.py | 10 ++++++++++ - 2 files changed, 28 insertions(+) - -commit ee2b63f60f350332ed21927721ed9ddff3a8034e -Author: John (J5) Palmieri -Date: Thu Mar 3 16:10:17 2011 -0500 - - [gi-demos] fix up search-entry to reflect annotations fixed in Gtk+ - master - - demos/gtk-demo/demos/Entry/search_entry.py | 23 +++++++++-------------- - 1 file changed, 9 insertions(+), 14 deletions(-) - -commit cd046e4c355706ead5f512b810a2a48317f8c32e -Author: John (J5) Palmieri -Date: Wed Mar 2 18:13:43 2011 -0500 - - [gi-demos] add search entry demo - - demos/gtk-demo/demos/Entry/search_entry.py | 257 - +++++++++++++++++++++++++++++ - 1 file changed, 257 insertions(+) - -commit d5ddaa92e6349c2f52b67317326060973cb69661 -Author: John (J5) Palmieri -Date: Wed Mar 2 15:37:27 2011 -0500 - - [gi] wrap map in a list for Python 3 compat - - gi/types.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3e5ab72a2e1fa2d8c4c2864137c6251f264ff4af -Author: John (J5) Palmieri -Date: Tue Mar 1 14:52:00 2011 -0500 - - [gi-demos] fix up the validation combobox - - demos/gtk-demo/demos/combobox.py | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -commit 08af5f99f0838b3584f6a3b210d0a0304811e8ff -Author: John (J5) Palmieri -Date: Tue Mar 1 12:31:35 2011 -0500 - - add overridesdir variable in the .pc file for 3rd party overrides - - pygobject-2.0.pc.in | 1 + - 1 file changed, 1 insertion(+) - -commit 4a6b14a92a687a2311516b2c16c355216b5270a7 -Author: Dieter Verfaillie -Date: Fri Feb 11 17:14:11 2011 +0100 - - setup.py: Set bdist_wininst user-access-control property - - setup.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit ad3ab659b83cb985730e19a83651da319d4bcb9c -Author: Martin Pitt -Date: Wed Mar 2 16:29:00 2011 +0100 - - Fix uninitialized variable in gi.require_version() - - gi/__init__.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 6e7606ee8830f6f51b777f41f6df2f6ea1784e89 -Author: Martin Pitt -Date: Tue Mar 1 23:26:07 2011 +0100 - - Run tests with LC_MESSAGES="C" - - Some tests, such as tests/test_gdbus.py check parts of error messages - or other - visible strings. Ensure that these do not get translated in the - test suite. - - tests/runtests.py | 2 ++ - 1 file changed, 2 insertions(+) - -commit 0461e05174637ae02f34029b85ba217d5ae48c53 -Author: John (J5) Palmieri -Date: Mon Feb 28 18:21:43 2011 -0500 - - [gi-overrides] override Gtk.stock_lookup to not return success - - demos/gtk-demo/demos/combobox.py | 2 +- - gi/overrides/Gtk.py | 9 +++++++++ - 2 files changed, 10 insertions(+), 1 deletion(-) - -commit 40decf3501823004a6e4d3acbbf204c4d4d0a7ec -Author: John (J5) Palmieri -Date: Mon Feb 28 14:16:00 2011 -0500 - - update NEWS to reflect changes in the 2.27.91 release (PYGOBJECT_2_28 - branch) - - NEWS | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 50 insertions(+) - -commit c2d5122b8e3cf51ec52418f90f1788895b842b6a -Author: John (J5) Palmieri -Date: Mon Feb 28 14:08:05 2011 -0500 - - [gi-tests] use Gdk.test_simulate_button instead of emitting event - ourselves - - * this function is available specifically so we can test events so - use this - instead of creating our own button press event - - tests/test_overrides.py | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -commit 1be1a2ea2787dffeb71ab4a38233fb71e761bd21 -Author: Laszlo Pandy -Date: Thu Feb 24 19:30:32 2011 +0100 - - [gi-tests] tests for EventButton override. - - * John (J5) Palmieri - fixed up original patch so that we actually - emit the event instead of just creating a Gdk.ButtonEvent object - - https://bugzilla.gnome.org/show_bug.cgi?id=642554 - - tests/test_overrides.py | 21 +++++++++++++++++++++ - 1 file changed, 21 insertions(+) - -commit 99044a4860dd65c97f52b41b7cd3f216f4a97cd4 -Author: John (J5) Palmieri -Date: Wed Feb 23 18:43:27 2011 -0500 - - [gi-overrides] Add event methods to all event union members - - https://bugzilla.gnome.org/show_bug.cgi?id=642554 - - gi/overrides/Gdk.py | 70 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 70 insertions(+) - -commit 6e30c69d38fd382414eb820097c297a80be547ac -Author: John (J5) Palmieri -Date: Wed Feb 23 14:14:16 2011 -0500 - - [gi] check to see if object is a member of a union when validating - paramaters - - * union members are not subclasses of the union they belong to so - if an - inteface requires you pass a union but you pass one of its members - there will be a type error - * this patch checks to see if the type you are passing is a member - of the - union and passes the checks if it is - * this works in python 3 but in python 2 methods do their own - isinstance - check on the instance parameter (e.g. self) so we need to figure - out how to override that for union methods - (e.g. Gdk.Event.get_state) - - https://bugzilla.gnome.org/show_bug.cgi?id=642554 - - gi/pygi-argument.c | 38 ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 38 insertions(+) - -commit 525f21d1365c24488b768955362085bf82512dee -Author: Tomeu Vizoso -Date: Wed Feb 16 09:44:12 2011 +0100 - - Skip interfaces when checking for conflicts in the MRO - - https://bugzilla.gnome.org/show_bug.cgi?id=642437 - - gi/types.py | 40 ++++++++++++++++++++++++++++++++++++++++ - gobject/gobjectmodule.c | 9 +++++++-- - tests/test_gi.py | 16 ++++++++++++++++ - 3 files changed, 63 insertions(+), 2 deletions(-) - -commit da212024772a7a0c32f04f3589bfb24d2eb5706f -Author: Laszlo Pandy -Date: Thu Feb 24 18:46:15 2011 +0100 - - [gi] Remove DyanmicModule.load() to _load() to prevent overriding - GI attrs. - - gi/importer.py | 2 +- - gi/module.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit 2ce6b58c7427cf67ba4f55731ba0a4c04703e495 -Author: Laszlo Pandy -Date: Wed Feb 23 12:05:03 2011 +0100 - - Test case with John's fix for crash with C arrays and a GError is set. - - I have added a test case, and made a few fixes to John's patch, - but the - solution is the same his. - - Workaround a bug when freeing C array types - - * This is a hack and there is really no way around it without - ripping out - the current array handling code which spans between pygi-invoke.c - and - pygi-argument.c and completely rewriting it. - * The is no time before our stable release - * This patch trades a segfault for a leak in the very unusual - case where - an error occures inside an interface that takes one or more C - arrays. Since - we wrap C arrays in GArrays internally but have to unwrap them - to send them - to the introspected C function, there is a period of time where - an error - can occure with the C array in an unknown state (some being true - C arrays - and others still wrapped in a GArray) - * This patch adds a c_arrays_are_wrapped state to signal that it - is safe to - free them. However since c_arrays_are_wrapped can only track - arrays - as a group, not individually, if it is set to FALSE we can - not assume - that every array is a pure C array, so instead we will simply - leak them - to avoid incorrectly freeing one and causing a segfault. - * This issue is fixed in the invoke rewrite branch as it treats - C arrays and - GArrays separately, however that branch is not yet ready to be - merged and - won't be until the next release. - - https://bugzilla.gnome.org/show_bug.cgi?id=642708 - - gi/pygi-invoke.c | 54 - ++++++++++++++++++++++++++++++++++++++++++++++++++---- - tests/test_gi.py | 9 +++++++++ - 2 files changed, 59 insertions(+), 4 deletions(-) - -commit 702a89beca92cab6b0142829b20281b9245f28b8 -Author: John (J5) Palmieri -Date: Wed Feb 23 15:11:59 2011 -0500 - - [gi-overrides] fix setting rows in treeview to accept None as a value - - * as done in PyGTK None indicates the column should not be set - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 18 +++++++++++++----- - 2 files changed, 16 insertions(+), 5 deletions(-) - -commit 498f0d9c903131aca5efe27ffaad7620e40f72ea -Author: Laszlo Pandy -Date: Wed Feb 23 14:23:19 2011 +0100 - - [gi] Add value_name for enum and flags from introspection - "c:identifier" (if attr is available). - - gi/gimodule.c | 22 ++++++++++++++++++---- - tests/test_gi.py | 36 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 54 insertions(+), 4 deletions(-) - -commit 824aeb7fab17d6590e5babf2d1f64298f2d0e16b -Author: Laszlo Pandy -Date: Wed Feb 23 11:40:55 2011 +0100 - - Fix flags with multiple names for the same value. - - Flags constructs a dict __flags_values__ and uses it to cache - instances. However some flags in Glib such as G_IO_FLAG_MASK and - G_IO_FLAG_GET_MASK are aliases for the same int value, and will - override each other's place in the dictionary. - - The dict length check is not necessary. It only reduces the number - of duplicate instances we keep, because if an instance is not - found in the dict, a new one is created anyway. - - gobject/pygflags.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3afbebeee486e14fd3f48552368903eb78f6b10c -Author: Laszlo Pandy -Date: Tue Feb 22 21:37:33 2011 +0100 - - Don't force loading of DynamicModule until set in sys.modules - - This fixes Tomeu's previous commit, which removed lazy loading. - Forcing the loading of a module before it is installed in sys.modules - prevents some overrides from being registered (namely Gtk.main_quit). - - https://bugzilla.gnome.org/show_bug.cgi?id=642305 - - gi/importer.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2a9cbfb435b47dc646e2c6ffe630464b560229a6 -Author: John (J5) Palmieri -Date: Mon Feb 21 17:20:57 2011 -0500 - - use GValue support to marshal GtkTreeModel values correctly - - * needs patch from https://bugzilla.gnome.org/show_bug.cgi?id=642914 - - https://bugzilla.gnome.org/show_bug.cgi?id=642921 - - gi/overrides/Gtk.py | 37 ++++++++++++++++++--- - tests/test_overrides.py | 87 - +++++++++++++++++++++++++++++++++++++++++-------- - 2 files changed, 107 insertions(+), 17 deletions(-) - -commit 9e4ce7dc0f03ea407654c4af028122f57cbc4c5e -Author: John (J5) Palmieri -Date: Mon Feb 21 16:14:20 2011 -0500 - - [gi] pass raw GValues instead of trying to marshal them - - * Right now GValues are transparent to the user but this leave us no - way to describe fundimental types other than those supported - directly - by python (e.g. int, str, etc) - * If an interface is expecting a uint or other GValue type a user - can now use - the raw GValue interfaces and expect paramaters that take - GValues to - marshal them correctly e.g.: - value = GObject.Value() - value.int(GObject.TYPE_UINT) - value.set_uint(1234) - * The objective here is to not for users to use this API but for - overrides - to be able to utilize them. For instance in the TreeModel API - we can - get the expected type for a column and them create a GValue with - the correct - type so that he underlying python object is marshalled correctly. - - https://bugzilla.gnome.org/show_bug.cgi?id=642914 - - gi/pygi-argument.c | 24 ++++++++++++++++++------ - tests/test_gi.py | 9 ++++++++- - 2 files changed, 26 insertions(+), 7 deletions(-) - -commit b458f6f3424a04f6ceece09d443009372d70544c -Author: John (J5) Palmieri -Date: Sat Feb 19 19:42:41 2011 -0500 - - [gi-demos] add icon view edit and drag-and-drop demo - - demos/gtk-demo/demos/Icon View/__init__.py | 0 - demos/gtk-demo/demos/Icon View/iconviewedit.py | 101 - +++++++++++++++++++++++++ - 2 files changed, 101 insertions(+) - -commit 7b47289e25d1dd57ce15556ccfbb3ede1c4bfe8b -Author: John (J5) Palmieri -Date: Sat Feb 19 17:26:42 2011 -0500 - - [gi-demos] add info bars demo - - demos/gtk-demo/demos/infobars.py | 99 - ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 99 insertions(+) - -commit 76758efb6579752237a0dc4d56cf9518de6c6e55 -Author: Tomeu Vizoso -Date: Wed Feb 16 11:53:18 2011 +0100 - - Load typelibs at import time, add gi.require_version() - - also adds Repository.get_loaded_namespaces() - - https://bugzilla.gnome.org/show_bug.cgi?id=642305 - - gi/__init__.py | 29 ++++++++++++++++++++++++++++- - gi/importer.py | 1 + - gi/module.py | 21 ++++----------------- - gi/pygi-repository.c | 23 +++++++++++++++++++++++ - 4 files changed, 56 insertions(+), 18 deletions(-) - -commit 96f7d1aed732db09a74cd463ed894b7347dbcb15 -Author: Laszlo Pandy -Date: Sat Feb 19 23:11:25 2011 +0100 - - [gi] Register GType for non-GType enums and flags at runtime. - - Note: rebuild of gobject-introspection is required for new tests. - - Previously non-GType enums used a separate type implemented in - Python, and non-GType flags had no implementation at all. This - removes the separate type for enums, and registers a new GType at - runtime if there isn't one. - - This allows non-GType enums and flags to use the same Python type - as GType enums and flags. This removes duplication of code, and - make both kinds behave identically. - - https://bugzilla.gnome.org/show_bug.cgi?id=642607 - - gi/gimodule.c | 117 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - gi/module.py | 24 ++++++----- - gi/pygi-info.c | 15 +++++++ - gi/types.py | 16 -------- - gobject/pygflags.c | 13 ++++-- - tests/test_gi.py | 35 ++++++++++++++++ - 6 files changed, 191 insertions(+), 29 deletions(-) - -commit 63a60bcc20e724f96ea8d565ee0cf13a228b72b9 -Author: Martin Pitt -Date: Tue Feb 8 15:38:21 2011 +0100 - - [gi] Add Pythonic gdbus method invocation - - Provide a wrapper for Gio.DBusProxy for calling D-Bus methods like - on a normal - Python object. This will handle the Python object <-> GVariant - conversion, and - optional keyword arguments for flags, timeout, and a result handler - for - asynchronous calls. - - Require specifying the input argument signature as the first argument - of each - method call. This ensures that the types of e. g. integers are - always correct, - and avoids having to do expensive D-Bus introspection for each call. - - https://bugzilla.gnome.org/show_bug.cgi?id=640181 - - gi/overrides/Gio.py | 99 - ++++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gdbus.py | 102 - ++++++++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 199 insertions(+), 2 deletions(-) - -commit ed5cdbb6f52bdbd13521a814516b15687955d6f7 -Author: Laszlo Pandy -Date: Fri Feb 18 22:48:59 2011 +0100 - - Skip GError out parameters in Python closure. - - Python code should have never have to explicitely return a GError. - Once we are able to marshal exceptions the Python code should - throw an exception instead. Until then, set GError to NULL, and - don't complain if a Python function doesn't return an arg for it. - - https://bugzilla.gnome.org/show_bug.cgi?id=642715 - - gi/pygi-closure.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit 5a5ee3877e22939a697772a7f0630ef8cae3d52f -Author: Laszlo Pandy -Date: Fri Feb 18 10:15:59 2011 +0100 - - Fix runtests.py to work with Python3 (print function syntax error). - - tests/runtests.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit ad5d3fccff9433e2dadac89d731dac5cafb0eac3 -Author: John (J5) Palmieri -Date: Thu Feb 17 19:46:49 2011 -0500 - - [gi-demos] added rotate text demo - - * needs some Pango Attr fixes to be 100% done, See FIXME - - demos/gtk-demo/demos/rotatedtext.py | 196 - ++++++++++++++++++++++++++++++++++++ - 1 file changed, 196 insertions(+) - -commit 9ac11c3c3b1c0399c85ece57c0983ed60d419d7a -Author: John (J5) Palmieri -Date: Thu Feb 17 17:25:00 2011 -0500 - - [gi-demos] add images demo - - * needs annotation fix from GdkPixbuf for ImageLoader to work - - demos/gtk-demo/demos/images.py | 311 - +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 311 insertions(+) - -commit 13b06170b89b3468e6255be32af4833ffc675c9d -Author: John (J5) Palmieri -Date: Thu Feb 17 14:48:24 2011 -0500 - - [gi-demos] add pixbuf demo - - demos/gtk-demo/demos/pixbuf.py | 183 - +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 183 insertions(+) - -commit 7abcfd5b4db99bb0f50c5a47d346a2de3836f994 -Author: John (J5) Palmieri -Date: Thu Feb 17 14:47:12 2011 -0500 - - [gi-demos] remove fixmes from print demo, fixed in pango - - demos/gtk-demo/demos/printing.py | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -commit 9b13f49356da7d71c69b82da2a59d92f456a6913 -Author: John (J5) Palmieri -Date: Wed Feb 16 19:39:30 2011 -0500 - - [gi-demos] add printing demo - - * needs some annotations for pango before it is 100% useful - - demos/gtk-demo/demos/printing.py | 177 - +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 177 insertions(+) - -commit 6025b62ee662af347e48b6752e6d5be74b4a8215 -Author: John (J5) Palmieri -Date: Wed Feb 16 17:52:38 2011 -0500 - - [gi-overrides] add cursor overrides - - https://bugzilla.gnome.org/show_bug.cgi?id=635947 - - gi/overrides/Gdk.py | 41 +++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides.py | 23 +++++++++++++++++++++++ - 2 files changed, 64 insertions(+) - -commit 03c0aa498470037ef2aa6a8233198ff521f8d42f -Author: John (J5) Palmieri -Date: Wed Feb 16 16:18:24 2011 -0500 - - [gi-demos] add the links demo - - demos/gtk-demo/demos/links.py | 74 - +++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 74 insertions(+) - -commit 79ecddf8d54b3f4f8b5ef05d302675152622c832 -Author: John (J5) Palmieri -Date: Wed Feb 16 15:48:40 2011 -0500 - - [gi-demos] add expander demo - - demos/gtk-demo/demos/expander.py | 60 - ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 60 insertions(+) - -commit 76cdb13ab872f91f8384d26b0f2932087a746117 -Author: John (J5) Palmieri -Date: Wed Feb 16 15:14:35 2011 -0500 - - [gi-overrides] use pop instead of del and add extra tests for - Gtk.Table kwargs - - gi/overrides/Gtk.py | 6 ++---- - tests/test_overrides.py | 8 ++++++++ - 2 files changed, 10 insertions(+), 4 deletions(-) - -commit 6ef83c049735689c42f085ca9d7b8e1f251c410f -Author: Laszlo Pandy -Date: Tue Feb 15 20:07:42 2011 +0100 - - [tests] Separate processes for GI and static binding tests. - - Importing and using both static gobject bindings and - introspection GObject bindings in the same process can cause - conflicts with types which otherwise wouldn't be there. - - This patch changes "make check" to call runtests.py twice -- once - for each set of tests. - - In the case of a test failure, runtests.py now sets the exit code - so that make does not continue. Otherwise you might miss the - failures from the first batch of tests in the scrollback. - - tests/Makefile.am | 19 +++++++++++-------- - tests/runtests.py | 4 +++- - 2 files changed, 14 insertions(+), 9 deletions(-) - -commit e0896b45f60f37097ec521f1bc38778383b78dd8 -Author: John (J5) Palmieri -Date: Tue Feb 15 14:47:10 2011 -0500 - - [gi-demos] add dialogs demo - - demos/gtk-demo/demos/dialogs.py | 153 - ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 153 insertions(+) - -commit 2dea743e82f6b18697950c34f116b2d0f1d6b1dd -Author: John (J5) Palmieri -Date: Tue Feb 15 14:46:41 2011 -0500 - - [gi-overrides] fix typo in GtkTable constructor - - gi/overrides/Gtk.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 9c277e1782c5a9d672d91fabf5289c5415891682 -Author: John (J5) Palmieri -Date: Tue Feb 15 13:26:38 2011 -0500 - - [gi-demos] keep popup menu from destroying itself by holding a ref - in app class - - demos/gtk-demo/demos/clipboard.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 18800c4db0e1faea38fd84f635d26a7ded5d10de -Author: John (J5) Palmieri -Date: Tue Feb 15 13:25:13 2011 -0500 - - [gi-overrides] add a Gtk.Menu override for the popup method - - gi/overrides/Gtk.py | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit ad93386ba9f73ef4c3826544b3868cf03c01225e -Author: John (J5) Palmieri -Date: Tue Feb 15 13:24:33 2011 -0500 - - [gi-demos] fix the about dialog in appwindow demo - - demos/gtk-demo/demos/appwindow.py | 22 +++++++++------------- - 1 file changed, 9 insertions(+), 13 deletions(-) - -commit d0c45c80974f05b6adfd3bb01d785be268a53a98 -Author: John (J5) Palmieri -Date: Tue Feb 15 11:21:13 2011 -0500 - - [gi-demos] fix clipboard demo so DnD works - - * menu popups don't work because the API takes a callback without - a destroy - notify - - demos/gtk-demo/demos/clipboard.py | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -commit 02d0327508234ab2e3b7dc6de506d70e6fcaaa17 -Author: John (J5) Palmieri -Date: Tue Feb 15 10:18:53 2011 -0500 - - [gi-demos] fix clipboard demo to reflect new API - - demos/gtk-demo/demos/clipboard.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit aa006cad6990eff0cbb68fa9550e428f2bc96473 -Author: John (J5) Palmieri -Date: Mon Feb 14 18:17:20 2011 -0500 - - [gi-demo] Fix color dialog demo to run with new draw, style and - color apis - - demos/gtk-demo/demos/colorselector.py | 44 - ++++++++++++++--------------------- - 1 file changed, 17 insertions(+), 27 deletions(-) - -commit f94a96c53e9432ac085bd05acee7ebdd2803fbad -Author: John (J5) Palmieri -Date: Mon Feb 14 17:58:25 2011 -0500 - - [gi-demos] fix most of the combobox app - - * Still having some issues with filtering the ComboBoxText widget - - demos/gtk-demo/demos/combobox.py | 17 ++++++++--------- - 1 file changed, 8 insertions(+), 9 deletions(-) - -commit 3606eb20ad1651af621bf1aa429ec102082565eb -Author: Laszlo Pandy -Date: Mon Feb 14 19:36:27 2011 +0100 - - Use PyGI type conversion (to fix foreign types) for signal callbacks. - - First attempt at patch to fix foreign types in signal callbacks. - Tests are not implemented yet. - - https://bugzilla.gnome.org/show_bug.cgi?id=637601 - - gi/Makefile.am | 2 + - gi/gimodule.c | 1 + - gi/pygi-argument.c | 91 ++++++++++++++++++ - gi/pygi-argument.h | 2 + - gi/pygi-private.h | 1 + - gi/pygi-signal-closure.c | 245 - +++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-signal-closure.h | 46 +++++++++ - gi/pygi.h | 28 ++++++ - gobject/pygobject.c | 24 ++++- - 9 files changed, 436 insertions(+), 4 deletions(-) - -commit 2e39d5e8f96be2253acb2f34a0d0b5b9c9adb8ff -Author: John (J5) Palmieri -Date: Mon Feb 14 16:47:03 2011 -0500 - - [gi-demos] fix drawingarea app to use the new draw api - - demos/gtk-demo/demos/drawingarea.py | 144 - +++++++++++++----------------------- - 1 file changed, 50 insertions(+), 94 deletions(-) - -commit 8385afbbc5df295d9b7cd3b5d19c90faa1f7ea8e -Author: John (J5) Palmieri -Date: Mon Feb 14 16:43:35 2011 -0500 - - [gi-overrides] for Gtk 3 alias Gdk.Rectangle to cairo.RectangleInt - - * note this is the introspected gobject-cairo boxed type not the - static cairo - bindings - * we alias this so people do not get confused - - gi/overrides/Gdk.py | 5 +++++ - 1 file changed, 5 insertions(+) - -commit d491c369e049ab726f09002af0462391d5c2f3ec -Author: John (J5) Palmieri -Date: Mon Feb 14 15:07:11 2011 -0500 - - [gi-overrides] let user set the proper property names in Gtk.Table - - * the old override added a columns and rows parameters to the Table - constuctor - to be in sync with PyGtk. - * The GTK properties are n_columns and n_rows - * support both - - gi/overrides/Gtk.py | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit 95bc2b2b025d659725d701c3b759c0c4d9681a36 -Author: John (J5) Palmieri -Date: Mon Feb 14 15:06:38 2011 -0500 - - [gi-demos] get appwindow demo working again - - demos/gtk-demo/demos/appwindow.py | 24 ++++-------------------- - 1 file changed, 4 insertions(+), 20 deletions(-) - -commit 015185f502c498c21cb108d3bb288c5b6dbf202f -Author: John (J5) Palmieri -Date: Mon Feb 14 15:05:44 2011 -0500 - - [gi-demos] fixed use of tree_iter_get - - demos/gtk-demo/gtk-demo.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 0c20977e4598e5447dd07c069e91226efacb1160 -Author: Simon van der Linden -Date: Fri Feb 11 22:02:03 2011 +0100 - - Remove last GIO-related bits - - https://bugzilla.gnome.org/show_bug.cgi?id=638899 - - PKG-INFO.in | 2 +- - README | 3 +- - configure.ac | 3 -- - examples/gio/directory-async.py | 33 ------------------ - examples/gio/downloader.py | 77 - ----------------------------------------- - pygobject.doap | 2 +- - 6 files changed, 3 insertions(+), 117 deletions(-) - -commit e4ebbd7de5570af1abf41bdf9469d4ce3edd48cb -Author: Simon van der Linden -Date: Fri Feb 11 18:38:27 2011 +0100 - - Remove GIO documentation - - https://bugzilla.gnome.org/show_bug.cgi?id=638899 - - docs/Makefile.am | 82 +- - docs/reference/pygio-appinfo.xml | 894 ----- - docs/reference/pygio-applaunchcontext.xml | 194 -- - docs/reference/pygio-asyncresult.xml | 117 - - docs/reference/pygio-bufferedinputstream.xml | 461 --- - docs/reference/pygio-bufferedoutputstream.xml | 275 -- - docs/reference/pygio-cancellable.xml | 290 -- - docs/reference/pygio-classes.xml | 47 - - docs/reference/pygio-constants.xml | 1540 --------- - docs/reference/pygio-datainputstream.xml | 799 ----- - docs/reference/pygio-dataoutputstream.xml | 504 --- - docs/reference/pygio-drive.xml | 546 --- - docs/reference/pygio-emblem.xml | 232 -- - docs/reference/pygio-emblemedicon.xml | 160 - - docs/reference/pygio-file.xml | 4534 - ------------------------- - docs/reference/pygio-fileattributeinfo.xml | 73 - - docs/reference/pygio-fileenumerator.xml | 488 --- - docs/reference/pygio-fileicon.xml | 109 - - docs/reference/pygio-fileinfo.xml | 346 -- - docs/reference/pygio-fileinputstream.xml | 214 -- - docs/reference/pygio-filemonitor.xml | 128 - - docs/reference/pygio-fileoutputstream.xml | 257 -- - docs/reference/pygio-filterinputstream.xml | 152 - - docs/reference/pygio-filteroutputstream.xml | 152 - - docs/reference/pygio-functions.xml | 395 --- - docs/reference/pygio-icon.xml | 217 -- - docs/reference/pygio-inputstream.xml | 730 ---- - docs/reference/pygio-loadableicon.xml | 198 -- - docs/reference/pygio-memoryinputstream.xml | 151 - - docs/reference/pygio-memoryoutputstream.xml | 175 - - docs/reference/pygio-mount.xml | 962 ------ - docs/reference/pygio-mountoperation.xml | 726 ---- - docs/reference/pygio-outputstream.xml | 140 - - docs/reference/pygio-seekable.xml | 231 -- - docs/reference/pygio-simpleasyncresult.xml | 317 -- - docs/reference/pygio-themedicon.xml | 204 -- - docs/reference/pygio-unixinputstream.xml | 202 -- - docs/reference/pygio-unixoutputstream.xml | 202 -- - docs/reference/pygio-volume.xml | 718 ---- - docs/reference/pygio-volumemonitor.xml | 844 ----- - docs/reference/pygiounix-classes.xml | 13 - - docs/reference/pygobject-ref.xml | 2 - - 42 files changed, 1 insertion(+), 19020 deletions(-) - -commit abdebc7f6515f9658812c0355d8ad0892e5371e4 -Author: John (J5) Palmieri -Date: Fri Feb 11 11:05:04 2011 -0500 - - bump version to reflect the master branch moving towards pygobject 3.0 - - * added NEWS file from branch pygobject-2-28 - * bump to 2.90.1 - * this branch will drop support for the static binding - * use the pygobject-2-28 branch for static binding fixes - - NEWS | 289 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - configure.ac | 4 +- - 2 files changed, 291 insertions(+), 2 deletions(-) - -commit 16140237aa45b4f188923da9f95b9d2af971011b -Author: John (J5) Palmieri -Date: Thu Feb 10 16:46:08 2011 -0500 - - fix build to correctly use python-config - - autogen.sh | 3 +++ - configure.ac | 6 ------ - m4/python.m4 | 9 +++++---- - tests/runtests.py | 1 + - 4 files changed, 9 insertions(+), 10 deletions(-) - -commit c2079f415638ef892b1e51f25eaafa3e1621667f -Author: Simon van der Linden -Date: Thu Feb 10 22:26:00 2011 +0100 - - Add missing libraries to link against - - glib/Makefile.am | 2 +- - gobject/Makefile.am | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -commit 3cca62a9e7afd3d3d302c66f4fafe253f7743d4e -Author: Steve Frécinaux -Date: Wed Jan 19 15:00:56 2011 +0100 - - Make runtests.py able to run command-line provided test files - - With this patch we are now able to run ./runtests.py , which - is more friendly than defining an environment variable to run some - specific tests. - - https://bugzilla.gnome.org/show_bug.cgi?id=639948 - - tests/runtests.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit 14c4cf8e6edae893538680964380d543bde4a14d -Author: Martin Pitt -Date: Wed Feb 9 11:34:59 2011 +0100 - - Run test suite under dbus-launch - - When available, run the test suite in dbus-launch, so that the - GDBus tests - succeed even when building this in an environment without a running - session - D-BUS (such as distribution package builds). - - tests/Makefile.am | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 0858f550e2b6f75e3f583f963f5952f5ddae4e0e -Author: Martin Pitt -Date: Tue Feb 8 15:46:36 2011 +0100 - - Fix test_gdbus.py to be Python3 friendly - - - TestCase.assert_() has been deprecated by assertTrue(). - - Exceptions don't have a message attribute any more, use str(e) - - tests/test_gdbus.py | 34 +++++++++++++++------------------- - 1 file changed, 15 insertions(+), 19 deletions(-) - -commit b7f32e4cca0cef201489b55653f96ac64a8f9ab9 -Author: Martin Pitt -Date: Sat Jan 29 12:20:50 2011 +0100 - - [gi] Provide comfortable GSettings API - - Make Gio.Settings behave like a dictionary, with transparent - conversion from/to - GVariants. Also provide a more comfortable constructor. - - https://bugzilla.gnome.org/show_bug.cgi?id=640838 - - gi/overrides/Gio.py | 54 +++++++++++++++++++++++++++++ - tests/org.gnome.test.gschema.xml | 9 +++++ - tests/test_overrides.py | 73 - ++++++++++++++++++++++++++++++++-------- - 3 files changed, 122 insertions(+), 14 deletions(-) - -commit 8dad0eaed60a9de26e9a729a48a1f6bc74be486e -Author: Laszlo Pandy -Date: Fri Feb 4 16:36:07 2011 +0100 - - Fix vfunc search bug when using GInterfaces and a do_* method. - - If a class inherits from a GInterface, as well as implements a do_* - method (which is not in a super class), all the base interfaces - will be searched for an __info__ attribute. GInterface doesn't - have one, causing an error on class creation. - - https://bugzilla.gnome.org/show_bug.cgi?id=641493 - - gi/types.py | 4 +++- - tests/test_gi.py | 8 ++++++++ - 2 files changed, 11 insertions(+), 1 deletion(-) - -commit 2660be1f227be7a53092483bc9d8ead1bd1fb266 -Author: Laszlo Pandy -Date: Thu Feb 3 15:31:42 2011 +0100 - - [GI] Add tests for Gtk.Widget.drag_* methods. - - Previously all the drag_* methods were accessible as Gtk.drag_*. - Now that the (method) attribute has been included for these - methods in Gtk+, this test checks that they are included as class - methods when using pygobject introspection. - - https://bugzilla.gnome.org/show_bug.cgi?id=639945 - - tests/test_overrides.py | 40 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 40 insertions(+) - -commit d57500537014b3da624be33b40401ba289fa22b8 -Author: John (J5) Palmieri -Date: Thu Feb 3 09:02:16 2011 -0500 - - [gi] make caller allocates work again - - gi/pygi-cache.c | 18 +++--------------- - gi/pygi-invoke.c | 37 ++++++++++++++++++++++++++++++++++--- - 2 files changed, 37 insertions(+), 18 deletions(-) - -commit 99d6e6c8d806e6f9e48c3c2380024fb3511d110a -Author: John (J5) Palmieri -Date: Wed Feb 2 19:27:40 2011 -0500 - - [gi] fix container object reffing - - gi/pygi-argument.c | 7 +++---- - gi/pygi-cache.c | 12 ++++-------- - 2 files changed, 7 insertions(+), 12 deletions(-) - -commit 09acaff29dfaabc77477cffca2c7137f68991e7f -Author: Ignacio Casal Quinteiro -Date: Wed Feb 2 21:00:48 2011 +0100 - - [python 3] use the right syntaxis to raise exceptions - - codegen/argtypes.py | 8 ++++---- - codegen/definitions.py | 14 +++++++------- - gi/overrides/Gtk.py | 2 +- - 3 files changed, 12 insertions(+), 12 deletions(-) - -commit 36094e5982d3e05d5662843b6d401f0974f5235f -Author: Ignacio Casal Quinteiro -Date: Wed Feb 2 20:50:12 2011 +0100 - - [gi] return PYGLIB_MODULE_ERROR_RETURN on error and use pygobject_init - - tests/testhelpermodule.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit c913c1789296310c2cf27554ce719d7f6e9c94cd -Author: Ignacio Casal Quinteiro -Date: Wed Feb 2 20:37:21 2011 +0100 - - [gi] return PYGLIB_MODULE_ERROR_RETURN on error - - This is to avoid some warnings when building with python 3 - - gi/gimodule.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 7bc4122897d9d05172a2bd5b56bded87e2afaec4 -Author: Steve Frécinaux -Date: Sat Jan 29 00:16:50 2011 +0100 - - Fix wrong refcount when calling introspected widget constructors - - Introspected widget constructors, like Gtk.Button.new(), can return - objects with a floating reference, which was then reffed by pygobject, - resulting in two references, despite the object is not owned by - anyone. - - This patch uses ref_sink() when pygobject takes its own reference, to - avoid adding that extra reference. Hence we now claim ownership on - objects returned by constructors with transfer=none (which is the case - for nearly all the widget constructors, despite the floating ref). - - https://bugzilla.gnome.org/show_bug.cgi?id=640868 - - gobject/pygobject.c | 4 +++- - tests/test_everything.py | 9 ++++++++- - 2 files changed, 11 insertions(+), 2 deletions(-) - -commit afeaaa126f7cd6556fb855ecd0facc174c0f946c -Author: Simon Schampijer -Date: Wed Jan 19 16:19:46 2011 +0100 - - Gdk.Window: Map the standard constructor to the *new* constructor - - Gdk.Window had to be made abstract - (see c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec in gtk), - this override allows using the standard constructor - - This commit adds as well a testcase. - - https://bugzilla.gnome.org/show_bug.cgi?id=639936 - - gi/overrides/Gdk.py | 6 ++++++ - tests/test_overrides.py | 8 ++++++++ - 2 files changed, 14 insertions(+) - -commit 4a67f45880433905de33632fe0c32a13b44c0b33 -Author: John (J5) Palmieri -Date: Mon Jan 31 16:51:37 2011 -0500 - - [gi] handle hash being NULL - - gi/pygi-argument.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit 2fbfe410f4b4394a2018ada0e538585c1bec23ae -Author: John (J5) Palmieri -Date: Mon Jan 31 16:50:52 2011 -0500 - - [gi] handle the situation where an aux arg comes before its parent - - gi/pygi-cache.c | 70 - ++++++++++++++++++++++++++++++++++++++++---------------- - gi/pygi-invoke.c | 2 +- - 2 files changed, 51 insertions(+), 21 deletions(-) - -commit 858669f92c9907dd70b4966d6a8521ed122225be -Author: Martin Pitt -Date: Mon Jan 31 17:38:52 2011 +0100 - - Ship tests/org.gnome.test.gschema.xml in dist tarballs - - tests/Makefile.am | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 77d76df59606e470808085e977fb199cc76e8251 -Author: John (J5) Palmieri -Date: Sun Jan 30 18:21:24 2011 -0500 - - [gi] allow caching and marshalling of ghash out - - gi/pygi-argument.c | 155 - +++++++++++++++++++++++++++++++++++++++++++++++++---- - gi/pygi-cache.c | 27 ++++++---- - 2 files changed, 162 insertions(+), 20 deletions(-) - -commit bd66af67f248a3ca90d2fa2626605263c2392e16 -Author: John (J5) Palmieri -Date: Sun Jan 30 17:06:44 2011 -0500 - - [gi] whitespace fixes - - gi/pygi-cache.c | 60 - ++++++++++++++++++++++++++++----------------------------- - 1 file changed, 30 insertions(+), 30 deletions(-) - -commit 1cdbd4be9b015f792c2c02afa5ac7e24edbdae86 -Author: John (J5) Palmieri -Date: Sun Jan 30 17:04:13 2011 -0500 - - [gi] added ugly aux arg counters - - * we need to simplify the ffi invoke so we can simply reference args - at their position in the C parameter list - * this works for now but is fragile if new aux values are added in - the future - - gi/pygi-argument.c | 12 ++++++++-- - gi/pygi-cache.c | 66 - +++++++++++++++++++++++++++++++++++++----------------- - gi/pygi-cache.h | 2 ++ - gi/pygi-invoke.c | 12 +++++++--- - 4 files changed, 66 insertions(+), 26 deletions(-) - -commit c51447f4efde2ce4caf39c1ffac905ec428d1d64 -Author: John (J5) Palmieri -Date: Sun Jan 30 11:30:54 2011 -0500 - - [gi] make inout marshalling work - - * refactor cache generation so we can create caches and then fill - in their - values based on if they are in, out or inout - * in invoke we order the pointers based on their direction - - gi/pygi-cache.c | 1445 - ++++++++++++++++++++++++++---------------------------- - gi/pygi-invoke.c | 19 +- - 2 files changed, 711 insertions(+), 753 deletions(-) - -commit 2b185362de45f46ce0f0b8816499aef06ab1ad1e -Author: John (J5) Palmieri -Date: Sat Jan 29 13:49:36 2011 -0500 - - [gi] marshal arrays out - - gi/pygi-argument.c | 101 - +++++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 99 insertions(+), 2 deletions(-) - -commit e62e7062d5cfd782eac64852f681c63e2776b8d4 -Author: John (J5) Palmieri -Date: Sat Jan 29 13:48:23 2011 -0500 - - [gi] fix sequence caching to support out - - gi/pygi-cache.c | 111 - ++++++++++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 87 insertions(+), 24 deletions(-) - -commit 69207910209ebfe450df616aeb8fa4cc2e7eccf3 -Author: Martin Pitt -Date: Fri Jan 28 17:14:19 2011 +0100 - - [gi] Add GSettings tests - - Ryan Lortie proposed an override for more convenient GSettings access, - so let's - first make sure that the canonical GLib API works. - - tests/Makefile.am | 7 +++++-- - tests/org.gnome.test.gschema.xml | 16 ++++++++++++++++ - tests/test_overrides.py | 31 +++++++++++++++++++++++++++++++ - 3 files changed, 52 insertions(+), 2 deletions(-) - -commit 488478a83640d50baee963337fcc870fec76b784 -Author: Martin Pitt -Date: Fri Jan 28 07:20:26 2011 +0100 - - [gi] Provide GtkTextBuffer.insert_with_tags_by_name() - - Provide an actual insert_with_tags_by_name() instead of overloading - insert_with_tags() to handle both types. This keeps the overrides - consistent - with the actual GTK API. - - gi/overrides/Gtk.py | 19 ++++++++++++++----- - tests/test_overrides.py | 4 ++-- - 2 files changed, 16 insertions(+), 7 deletions(-) - -commit dace1a553793fb7fb054b60760f02c9e5cf00b38 -Author: Martin Pitt -Date: Thu Jan 27 13:37:18 2011 +0100 - - [gi] Support tag names in GtkTextBuffer.insert_with_tags() - - Neither insert_with_tags() nor insert_with_tags_by_name() are - introspectable - due to using varargs. As both are useful, support both cases in - the override. - - gi/overrides/Gtk.py | 5 +++++ - tests/test_overrides.py | 9 +++++++++ - 2 files changed, 14 insertions(+) - -commit 91d34124b2a5128e93e13c7fee8693d5edc4e9bb -Author: Ignacio Casal Quinteiro -Date: Thu Jan 27 12:23:18 2011 +0100 - - Add MAINTAINERCLEANFILES - - This var behaves like .gitignore and allows us to skip some specific - files. - - Makefile.am | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -commit 8a98d26981ce68809a21c64cac4962e58c927905 -Author: Ignacio Casal Quinteiro -Date: Thu Jan 27 12:15:30 2011 +0100 - - Remove .gitignore files and use git.mk - - git.mk is a script maintained in pango. From time to time we must - check if it was updated and update it here. - - .gitignore | 46 ----------- - Makefile.am | 2 + - codegen/.gitignore | 2 - - codegen/Makefile.am | 2 + - docs/.gitignore | 7 -- - docs/Makefile.am | 2 + - examples/Makefile.am | 2 + - gi/.gitignore | 40 ---------- - gi/Makefile.am | 2 + - gi/overrides/Makefile.am | 2 + - gi/repository/Makefile.am | 2 + - gi/tests/Makefile.am | 2 + - git.mk | 200 - ++++++++++++++++++++++++++++++++++++++++++++++ - glib/Makefile.am | 2 + - gobject/.gitignore | 3 - - gobject/Makefile.am | 2 + - tests/.gitignore | 2 - - tests/Makefile.am | 2 + - 18 files changed, 222 insertions(+), 100 deletions(-) - -commit 331c42b63bc60a3b906fa21e1c0a7c1b9428f347 -Author: Martin Pitt -Date: Thu Jan 27 12:04:19 2011 +0100 - - pygi-convert.sh: Convert Pango.TabAlign.* - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit be1a2959fa0a3d8682e0e8aef389d73dacab0689 -Author: Martin Pitt -Date: Thu Jan 27 12:02:39 2011 +0100 - - pygi-convert.sh: Drop window -> get_window() conversion - - It is doing more harm than good for projects which use things like - self.window. - - pygi-convert.sh | 1 - - 1 file changed, 1 deletion(-) - -commit dd7deb4b658c56857c26b1a278a3d688f2ea6a2a -Author: Martin Pitt -Date: Thu Jan 27 11:58:26 2011 +0100 - - pygi-convert.sh: Don't convert self.window assignments - - pygi-convert.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 975341a26772966d4afc87a88a6a566d61237fa0 -Author: Steve Frécinaux -Date: Fri Jan 21 18:41:54 2011 +0100 - - Fix leaked python reference in python-defined subclasses - - https://bugzilla.gnome.org/show_bug.cgi?id=640184 - - gobject/gobjectmodule.c | 1 + - tests/test_gobject.py | 4 ++++ - 2 files changed, 5 insertions(+) - -commit a59e2d58bdb3f31a4f415dbe14b7d9988ac28ce3 -Author: Steve Frécinaux -Date: Fri Jan 21 15:54:43 2011 +0100 - - Add some tests for the number of python refs held at creation time - - https://bugzilla.gnome.org/show_bug.cgi?id=640184 - - tests/test_gobject.py | 21 +++++++++++++++++++++ - 1 file changed, 21 insertions(+) - -commit 7d70105eb324ea4b6a58c2d3fb3f2dda36e7ab33 -Author: Steve Frécinaux -Date: Fri Jan 21 17:24:49 2011 +0100 - - Factor out parameter marshalling from construction functions. - - https://bugzilla.gnome.org/show_bug.cgi?id=640197 - - gobject/gobjectmodule.c | 35 ++-------------------- - gobject/pygobject-private.h | 5 ++++ - gobject/pygobject.c | 71 - +++++++++++++++++++++++++++------------------ - 3 files changed, 50 insertions(+), 61 deletions(-) - -commit a3e0cfe8924887ecd1e07cedd2cfb999c853ac62 -Author: John (J5) Palmieri -Date: Wed Jan 26 15:34:24 2011 -0500 - - [gi] in python 3 an array of uint8 can be bytes but not string - - tests/test_gi.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit 843553ea958eddec185bb660851a310dc050a14b -Author: John (J5) Palmieri -Date: Wed Jan 26 15:30:06 2011 -0500 - - [gi] fix Gio.FileEnumerator to reflect the Python 3 iter protocol - - gi/overrides/Gio.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit 6ff357839feb39930a5f3175de3d0ed35f24d3f4 -Author: John (J5) Palmieri -Date: Wed Jan 26 15:17:03 2011 -0500 - - [gi] python 3 fixes - - Patches need to work in Python 3 - here are some of the issues I - fixed up. - Patch submitters should keep this in mind. When I note to only - use something - in tests it means that there is a compat module that is only available - to the - tests. Actuall code should either add the workaround to the top - of their - module or try not to have a distinction between things such as - unicode and - longs which no longer exist in Python 3 - - * use range instead of xrange - loss of performance in Python 2 but - Python 3 i - treats range similarly to python 2's xrange - * use dict.items() instead of dict.iteritems() - same as the xrange - issue - * callable does not exist in 3.x, use hasattr(obj, '__call__') or - - if sys.version_info > (3, 0): - def callable(obj): - return hasattr(obj, '__call__') - - * using unicode in tests is tricky, you can't use u'' even in - a versioned - conditional as python3's parser chokes on it. Do this in tests - (and only i - in tests): - - from compathelper import _unicode - unicode_string = _unicode('this is a unicode string') - - * exception caching changed in 2.7, instead of except Exception, - e we now use - except Exception as e. Do this to be compatible with older - versions: - - except Exception: - etype, e = sys.exc_info()[:2] - - * Unbound methods with an im_func attribute no longer exits in 3.x. - Unbound methods are now just functions so class.method in 3.x is - equivalent to class.method.im_func in 2.x. If you have to go this - low level do this: - - func = class1.method - if sys.version_info < (3,0): - func = func.im_func - - * all numbers are long in 3.x so 42L is invalid in 3.x. In tests (and - only in tests) do this: - - from compathelper import _long - l = _long(42) - - gi/overrides/GLib.py | 16 ++++++++-------- - gi/types.py | 5 ++++- - tests/compathelper.py | 19 +++++++++++++++++++ - tests/test_gdbus.py | 12 ++++++++---- - tests/test_gi.py | 19 ++++++++++++------- - tests/test_overrides.py | 8 +++++--- - 6 files changed, 56 insertions(+), 23 deletions(-) - -commit 832d662b9f90f5762bbf28b3cca73f947c1f83ce -Author: John (J5) Palmieri -Date: Wed Jan 26 14:00:08 2011 -0500 - - [gi] fix try/except blocks using depricated raise format - - gi/overrides/GLib.py | 4 ++-- - gi/overrides/Gdk.py | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -commit d3e30e240fed6ef1dd40fd29fd13dc2effc6c7b1 -Author: Martin Pitt -Date: Wed Jan 26 19:03:48 2011 +0100 - - [gi] Add docstring to GLib.Variant constructor - - gi/overrides/GLib.py | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -commit 963cd52fec26f7a4fb34414f8ac6662932ede322 -Author: Martin Pitt -Date: Wed Jan 26 18:45:38 2011 +0100 - - [gi] update gdbus test cases for previous GVariant change - - tests/test_gdbus.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 27e3a6276ff5f2cdc03ddf69ee80d44c3bf2c094 -Author: Martin Pitt -Date: Wed Jan 26 18:39:17 2011 +0100 - - [gi] Accept only a single object in GLib.Variant constructor - - We previously allowed flat arguments for tuple signatures, e. g. - - GLib.Variant('(ii)', 1, 2) - - However, that's not how GVariant is supposed to work. Remove the - special case - to handle flat argument lists, and only accept a single value, i. e. - - GLib.Variant('(ii)', (1, 2)) - - Note that this breaks the current API, but as it is not used widely - yet, let's - better fix it now. - - Thanks to Ryan Lortie for pointing this out! - - gi/overrides/GLib.py | 25 ++++++++++--------------- - tests/test_overrides.py | 32 +++++++++++++------------------- - 2 files changed, 23 insertions(+), 34 deletions(-) - -commit b15e8e2c0c933d0f827a70280faf875ac383d81b -Author: Laszlo Pandy -Date: Wed Jan 26 00:40:49 2011 +0100 - - Speed up _setup_native_vfuncs() - - This changes _setup_native_vfuncs() to only install native - vfunc wrappers from the current class on the current class. - Native vfuncs will not be propogated up or down the class - hierarchy as this is unnecessary and wastes CPU and memory. - - Since the normal process in python to retrieve a method or - attribute recurses to the base classes if an attribute is not - found in the subclass, there is no need to setup all base class - virtual functions on a subclass. - - This patch removes the recursion in _setup_native_vfuncs() - and lets Python find them in the base classes like a normal - Python class would work. This significantly increases the speed - of any class which is or inherits from a C class which includes - virtual methods. - - https://bugzilla.gnome.org/show_bug.cgi?id=640629 - - gi/types.py | 26 +++++++++++++------------- - tests/test_gi.py | 13 +++++++++++++ - 2 files changed, 26 insertions(+), 13 deletions(-) - -commit 569d42ac2f50fb706ef289ff631db743483f40ee -Author: Laszlo Pandy -Date: Thu Jan 20 16:26:18 2011 +0100 - - Speed up class creation: rewrite _setup_vfuncs() to be much more - efficient. - - This patch rewrites the _setup_vfuncs() method to remove recursion and - make the running time linear in the number of virtual functions to - hook up - (ie. methods starting with "do_") instead of linear in the number of - virtual functions in the base class which could possibly be - overridden. - - Since most classes do not override all of the virtual functions in the - base class (and many override none), this runs much faster. - - It is possible to not recurse on all base classes because - non-interface - base classes will have the virtual function installed as an attribute. - Thus getattr() can be called, which recurses to the base classes much - faster than a custom implementation in Python. If the method cannot be - found with getattr(), all interface bases classes are searched - manually. - - The function is_function_in_classes() has been deleted. Because of the - above changes, it is not used anymore. - - https://bugzilla.gnome.org/show_bug.cgi?id=640073 - - gi/types.py | 104 - ++++++++++++++++++++++++++++++++++--------------------- - tests/test_gi.py | 13 +++++++ - 2 files changed, 77 insertions(+), 40 deletions(-) - -commit 8f4e6536f3c2edf38a45632d1c23eb7c6681c3be -Author: Sebastian Pölsterl -Date: Mon Jan 24 19:23:19 2011 +0100 - - pygi-convert.sh: Convert gtk.UI_MANAGER_* - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 1f473b5164407a178203eb8cc7f3c786e0d0e5c2 -Author: Sebastian Pölsterl -Date: Fri Jan 21 18:41:54 2011 +0100 - - pygi-convert.sh: Convert gdk.GRAB_* - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit f5d0b7b9d189f65503c0bf66d8bda4186ca3223a -Author: Ignacio Casal Quinteiro -Date: Fri Jan 21 16:45:07 2011 +0100 - - [gi] set the gtype GValue correctly - - gi/pygi-property.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit ce521011d7f6d7f082aaea76fa05c5af9f6e93f5 -Author: Ignacio Casal Quinteiro -Date: Fri Jan 21 16:20:23 2011 +0100 - - [gi] use the right argument type for callback - - gi/pygi-foreign-cairo.c | 8 ++++---- - gi/pygi-foreign-gvariant.c | 4 ++-- - gi/pygi-foreign-gvariant.h | 2 +- - gi/pygi-foreign.c | 2 +- - gi/pygi.h | 2 +- - 5 files changed, 9 insertions(+), 9 deletions(-) - -commit 9f101baaa63a75acf62f955cfc4b311ff0dd5464 -Author: John (J5) Palmieri -Date: Fri Jan 21 09:23:54 2011 -0500 - - [gi] marshal out flags and enum - - gi/pygi-argument.c | 14 +++++++++----- - gi/pygi-cache.c | 24 ++++++++++++------------ - 2 files changed, 21 insertions(+), 17 deletions(-) - -commit 4c93bdeae76830aa4029dfc86e32e6f277d5271d -Author: John (J5) Palmieri -Date: Fri Jan 21 08:18:37 2011 -0500 - - [gi] marshal unions - - gi/pygi-cache.c | 27 +++++++++++++-------------- - 1 file changed, 13 insertions(+), 14 deletions(-) - -commit a060287d1a6d190acb9d344f08fd5662e3296da5 -Author: Martin Pitt -Date: Fri Jan 21 11:00:27 2011 +0100 - - [gi] Add test cases for GDBus client operations - - tests/Makefile.am | 1 + - tests/test_gdbus.py | 94 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 95 insertions(+) - -commit e7699d9af41f8c374326b8a4ec0939ef1426e386 -Author: John (J5) Palmieri -Date: Fri Jan 21 04:28:15 2011 -0500 - - [gi] error out if the constructor returns NULL - - gi/pygi-invoke.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 58ff2b2c38c1004861083ca88633be76767229f0 -Author: John (J5) Palmieri -Date: Fri Jan 21 04:26:45 2011 -0500 - - [gi] throw error for caller allocates until we can write code to - support it - - gi/pygi-cache.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -commit 5eb779439daa8bf1e86df689377dc10ef1430eab -Author: John (J5) Palmieri -Date: Fri Jan 21 04:26:11 2011 -0500 - - [gi] support struct out - - gi/pygi-argument.c | 30 ++++++++++++++++++++++++++---- - gi/pygi-cache.c | 15 ++------------- - 2 files changed, 28 insertions(+), 17 deletions(-) - -commit 3133dc595adf44279397d30712c0f8595f0e1acc -Author: John (J5) Palmieri -Date: Fri Jan 21 04:22:06 2011 -0500 - - [gi] move to using type_info and interface_info instead of arg_info - - * only arguments have arg_infos, not return types and instances so - type_info is much better to pass. In fact most API that took an - arg_info simply converted it to a type_info - * In the case of instances for methods we don't even have a type_info. - Since all instances are interfaces, we also attach the - interface_info - to the interface cache - - gi/pygi-argument.c | 20 ++++---------------- - gi/pygi-cache.c | 43 - ++++++++++++++++++++++++++++++++----------- - gi/pygi-cache.h | 4 +++- - gi/pygi-foreign-cairo.c | 24 ++++++++++++------------ - gi/pygi-foreign-gvariant.c | 11 +++++------ - gi/pygi-foreign-gvariant.h | 10 +++++----- - gi/pygi-foreign.c | 21 +++++++++------------ - gi/pygi-foreign.h | 6 +++--- - gi/pygi.h | 8 ++++---- - 9 files changed, 77 insertions(+), 70 deletions(-) - -commit e97e28048efb966ecc1a03277d36cbaa81b8db7d -Author: Martin Pitt -Date: Fri Jan 21 09:54:14 2011 +0100 - - [gi] Add Variant construction/unpack support for boxed Variants - - Construction uses a GVariantBuilder for now, as the new_variant() - constructor - currently does not work (see - https://bugzilla.gnome.org/show_bug.cgi?id=639952) - - gi/overrides/GLib.py | 18 +++++++++++++++++- - tests/test_overrides.py | 26 ++++++++++++++++++++++++++ - 2 files changed, 43 insertions(+), 1 deletion(-) - -commit 71dd03261fc06b8180c14cd31b54d8e4b200be3a -Merge: bc29600 bd002c7 -Author: Dieter Verfaillie -Date: Fri Jan 21 09:33:16 2011 +0100 - - Merge branch 'windows-setup-fixes' - -commit bc29600a2a04c972ceab7ef8d3292e8633977591 -Author: Thomas Hindoe Paaboel Andersen -Date: Thu Jan 20 19:48:23 2011 +0100 - - pygi-convert.sh: GdkPixbuf methods - - GNOME bug #639880 - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit d1b0fa501cc431baa530d96fb50f4c35590890ac -Author: Thomas Hindoe Paaboel Andersen -Date: Thu Jan 20 19:45:01 2011 +0100 - - pygi-convert.sh: Gdk.COLORSPACE_RGB - - GNOME bug #639880 - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 6d8ff4d5bdda5480089543869535cc3ee83da2f5 -Author: Martin Pitt -Date: Wed Jan 19 11:41:11 2011 +0100 - - [gi] Support nested objects and empty sequences in GLib.Variant - building - - The GVariant constructor (in the overrides) previously did not - support empty - arrays/dictionaries or nested structures. Rewrite the VariantCreator - class to - be fully recursive and determine the element types of - arrays/dictionaries. - - This now also allows you to use actual tuples as input values for - GVariant - tuple types. Taking values from the flat argument list is still - supported for - convenience, though. - - https://bugzilla.gnome.org/show_bug.cgi?id=639939 - - gi/overrides/GLib.py | 229 - ++++++++++++++++++++++++++---------------------- - tests/test_overrides.py | 159 +++++++++++++++++++++++++++++++-- - 2 files changed, 273 insertions(+), 115 deletions(-) - -commit ac095f5435f106e175fa3297cb273e63c85d2809 -Author: Tomeu Vizoso -Date: Thu Jan 20 15:55:45 2011 +0100 - - Uncomment test_gi.TestInterfaceClash - - tests/test_gi.py | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -commit 1239f3709ba257c404dda72b7067b77b19c240fa -Author: John (J5) Palmieri -Date: Thu Jan 20 09:05:02 2011 -0500 - - [gi] add support for enum and flags - - gi/pygi-argument.c | 121 - +++++++++++++++++++++++++++++++++++++++++------------ - gi/pygi-cache.c | 30 ++++++------- - 2 files changed, 111 insertions(+), 40 deletions(-) - -commit f0a0b6c2eda89622de2b1e5ebb6a48103ad72a42 -Author: Steve Frécinaux -Date: Thu Jan 20 14:14:15 2011 +0100 - - Fix reference leaks for GInitiallyUnowned objects - - References were leaked for GInitiallyUnowned objects which got their - wrappers created several times, because someone else holds reference - on it and it got out of python scope at some point. - - https://bugzilla.gnome.org/show_bug.cgi?id=639949 - - gobject/gobjectmodule.c | 2 ++ - gobject/pygobject.c | 14 +++++------ - tests/test-floating.c | 36 +++++++++++++++++++++++++++ - tests/test-floating.h | 21 ++++++++++++++++ - tests/test_gobject.py | 63 - ++++++++++++++++++++++++++++++++++++++++++++++++ - tests/testhelpermodule.c | 50 ++++++++++++++++++++++++++++++++++++++ - 6 files changed, 179 insertions(+), 7 deletions(-) - -commit cae2cf3d4fb049c94389bf8f84d7d97a544d7a3f -Author: Steve Frécinaux -Date: Wed Jan 19 16:57:57 2011 +0100 - - Add tests for refcount of a GObject owned by a library - - When the object is constructed, its refcount is 2 because the library - refs it once. It should remain around until we ask the library to - release its reference. - - https://bugzilla.gnome.org/show_bug.cgi?id=639949 - - tests/test-floating.c | 30 +++++++++++++++++++++++ - tests/test-floating.h | 20 ++++++++++++++++ - tests/test_gobject.py | 62 - ++++++++++++++++++++++++++++++++++++++++++++++++ - tests/testhelpermodule.c | 51 +++++++++++++++++++++++++++++++++++++++ - 4 files changed, 163 insertions(+) - -commit b6737b91938d527872eff1d645a205cacf94e15d -Author: Steve Frécinaux -Date: Wed Jan 19 14:52:41 2011 +0100 - - Add a test to check for regular object reference count - - https://bugzilla.gnome.org/show_bug.cgi?id=639949 - - tests/test_gobject.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -commit 2b0f1ede820414ef1cfd6b37569fcb946d2031fc -Author: Martin Pitt -Date: Thu Jan 20 14:15:52 2011 +0100 - - [gi] Update TreeView.enable_model_drag_{source,dest} to current GTK - - GTK master now landed a lot of annotation fixes which also correctly - marks the - array length argument of - Gtk.TreeView.enable_model_drag_{source,dest}(). Thus - drop the explicit array length argument from the call in the override. - - gi/overrides/Gtk.py | 2 -- - 1 file changed, 2 deletions(-) - -commit b59edf4f0f7cab44033f9d704d476e10ee0d0c0a -Author: Steve Frécinaux -Date: Wed Jan 19 18:04:10 2011 +0100 - - Fix a typo in a private symbol name. - - gobject/gobjectmodule.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 6447688e283a8fb22de3ab68cbc06e34ad23d198 -Author: Martin Pitt -Date: Thu Jan 20 11:49:08 2011 +0100 - - pygi-convert.sh: Convert glib.source_remove() - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 84ee8de4bc00a8f901926cc6386d73c12dbd0b0b -Author: Martin Pitt -Date: Thu Jan 20 11:42:34 2011 +0100 - - Fix typo in previous commit to actually convert glib.GError - - pygi-convert.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b238cb614338f46e6feb7935cca0a55c7a929418 -Author: Martin Pitt -Date: Thu Jan 20 11:40:14 2011 +0100 - - pygi-convert.sh: Move some glib bits which are better handled - by gobject - - pygi-convert.sh | 3 +++ - 1 file changed, 3 insertions(+) - -commit 21c09a7ee294b59abb3eca6f64f13bf5c8a2fa0e -Author: Laszlo Pandy -Date: Wed Jan 19 12:00:02 2011 +0100 - - Modify override for Gtk.Adjustment to allow position or keyword - arguments in __init__(). - - Previously passing no arguments was not working, because the default - value for each parameter was None, and GObject.__init__() refuses to - allow None for integer properties. This patch does not pass None up - to GObject.__init__. Instead it does not pass the parameter at all, - and uses the class's default values. - - https://bugzilla.gnome.org/show_bug.cgi?id=639934 - - gi/overrides/Gtk.py | 14 ++++++++++++-- - tests/test_overrides.py | 34 +++++++++++++++++++++++++++------- - 2 files changed, 39 insertions(+), 9 deletions(-) - -commit d465e25297ad6589ff2cd0c00e11e8bd8ffe3f78 -Author: Martin Pitt -Date: Wed Jan 19 22:52:51 2011 +0100 - - [gi] Fix small typo in previous commit - - The GVariant signature of the self test had a trailing 'i'. The - current - GVariant builder doesn't mind, but the new implementation proposed - in bug - 639939 does. - - tests/test_overrides.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2b8e1d0531dcb8f57dc9f2fddf25970bee3daa90 -Author: Martin Pitt -Date: Wed Jan 19 20:18:19 2011 +0100 - - [gi] Add pythonic iterator and indexing for string GVariants - - This extends commit b1a98083c to also work for strings. - - gi/overrides/GLib.py | 8 +++++++- - tests/test_overrides.py | 13 +++++++++++++ - 2 files changed, 20 insertions(+), 1 deletion(-) - -commit 8efd14c87b35072cdd039bf223f8ced8f51be9bb -Author: John (J5) Palmieri -Date: Wed Jan 19 14:08:03 2011 -0500 - - [gi] return NULL if out_marshaller fails - - gi/pygi-invoke.c | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 5b1db41d60204c8021f47f43b85dac126c389c8d -Author: John (J5) Palmieri -Date: Wed Jan 19 13:57:54 2011 -0500 - - [gi] fix some transfer issues and test case failures - - gi/pygi-argument.c | 4 ++++ - gi/pygi-cache.c | 11 ++++++++--- - gi/pygi-invoke.c | 17 +++++++++-------- - 3 files changed, 21 insertions(+), 11 deletions(-) - -commit 7c2f48bb6d67ec9a1ee5ac03a5aee34b54c6ebdd -Author: Tomeu Vizoso -Date: Wed Jan 19 18:09:23 2011 +0100 - - Construct structs using default API constructor - - If the struct has something that looks like a default constructor, - use it instead of trying to directly allocate it, as it will fail - if the struct fields are not exposed. - - https://bugzilla.gnome.org/show_bug.cgi?id=627444 - - gi/pygi-info.c | 37 +++++++++++++++++++++++++++++++++++++ - gi/types.py | 7 +++++++ - 2 files changed, 44 insertions(+) - -commit db7300e173388d9557dcd2333781bfaa6b021605 -Author: Martin Pitt -Date: Wed Jan 19 18:54:39 2011 +0100 - - pygi-convert.sh: Migrate Gdk.Cursor constructor, and some cursor names - - pygi-convert.sh | 2 ++ - 1 file changed, 2 insertions(+) - -commit 4c1d4faddf1c9cb233c484da3eadd8e31c231f70 -Author: Martin Pitt -Date: Wed Jan 19 18:43:29 2011 +0100 - - pygi-convert.sh: Handle .window attributes - - In general, convert them to .get_window(). For some of them, prefer - calling the - GtkWidget methods instead. - - pygi-convert.sh | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit b1049b947d073fb569ba900a4d5c8519482d831e -Author: Tomeu Vizoso -Date: Wed Jan 19 17:35:09 2011 +0100 - - Also deal with foreign boxed structs - - cairo.Context has been boxed and our tests started failing - - https://bugzilla.gnome.org/show_bug.cgi?id=639967 - - gi/pygi-argument.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 25b69ae257a12b6dc97ed3f2f7ea54b166ddbba1 -Author: Laszlo Pandy -Date: Wed Jan 19 17:45:11 2011 +0100 - - [gi] Convert GErrors to GObject.GError exceptions, and throw them - upon returning from calling the C function. - - This changes gi to make use of pyglib_error_check() which already - exists in pyglib. - - The included tests make use of the other patch attached to this bug, - to check that the right exception is thrown from the new function - in GIMarshallingTests. - two Gtk C functions. - - https://bugzilla.gnome.org/show_bug.cgi?id=639834 - - gi/Makefile.am | 3 ++- - gi/pygi-invoke.c | 12 +++--------- - tests/test_gi.py | 10 ++++++++++ - 3 files changed, 15 insertions(+), 10 deletions(-) - -commit 18b84767db1d66e3d6f09067ab19ffd4b82539ca -Author: John (J5) Palmieri -Date: Wed Jan 19 12:05:45 2011 -0500 - - [gi] fix out marshalling for a couple of int types - - gi/pygi-argument.c | 2 +- - gi/pygi-cache.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit c5d7c730008275b2c585b2609fc2ff5e051cce47 -Author: John (J5) Palmieri -Date: Wed Jan 19 11:59:09 2011 -0500 - - [gi] fixed range checking and type conversion with unsigned and - large numbers - - gi/pygi-argument.c | 90 - +++++++++++++++++++++++++++++++++++++++++++++--------- - gi/pygi-cache.c | 2 +- - 2 files changed, 76 insertions(+), 16 deletions(-) - -commit e6fcafc6179e963cbae7774e7ee50415bde2c523 -Author: Martin Pitt -Date: Wed Jan 19 17:03:06 2011 +0100 - - pygi-convert.sh: Don't convert glib -> GLib for now - - This currently leads to a load of crashes, MemoryErrors, etc, as - GLib is not - very well introspectable, due to the low-level operations that - it performs. - - John Palmieri confirms that using the static "glib" binding is - preferred for - now, so disable the replacement rules. - - pygi-convert.sh | 19 ++++++++++--------- - 1 file changed, 10 insertions(+), 9 deletions(-) - -commit 167261d556eab0d2e448c7ed28eef540a024ba1d -Author: Tomeu Vizoso -Date: Wed Jan 19 16:47:08 2011 +0100 - - Link libregress.so to GIO_LIBS again - - configure.ac | 5 +++++ - 1 file changed, 5 insertions(+) - -commit d143afa6da4f5b5f47be8df11fa41d7b47ab1794 -Author: Laszlo Pandy -Date: Wed Jan 19 16:14:42 2011 +0100 - - Fix attributes 2BUTTON_PRESS and 3BUTTON_PRESS of Gdk.EventType. - - This puts an underscore in front of 2BUTTON_PRESS and 3BUTTON_PRESS - because in Python attributes starting with a numeral causes a - syntax error. - - gi/overrides/Gdk.py | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit 4f5d20966d4a8c649e5fae584039621edab178f3 -Author: John (J5) Palmieri -Date: Wed Jan 19 10:02:40 2011 -0500 - - [gi] use correct format stings when setting errors - - gi/pygi-argument.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -commit 7f08fd5c33ee5c9907f5becbe2f21fb7122d6e19 -Author: John (J5) Palmieri -Date: Wed Jan 19 09:45:09 2011 -0500 - - [gi] allow marshalling strings as None - - gi/pygi-argument.c | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 093242a9e125998cd07bf66fc4b2880f532a2e4d -Author: John (J5) Palmieri -Date: Wed Jan 19 09:41:56 2011 -0500 - - [gi] make error messages more detailed - - gi/pygi-argument.c | 2 +- - gi/pygi-cache.c | 18 +++++++++--------- - 2 files changed, 10 insertions(+), 10 deletions(-) - -commit f0b17605ed2eb917b350654b070984beb553eae3 -Author: John (J5) Palmieri -Date: Wed Jan 19 09:41:13 2011 -0500 - - [gi] allow marshalling None for hashes - - gi/pygi-argument.c | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 93f1b787ab8420300d1064c0237a0c2d8a2ac98f -Author: John (J5) Palmieri -Date: Wed Jan 19 09:40:37 2011 -0500 - - [gi] add marshalling to some out values - - gi/pygi-argument.c | 50 - +++++++++++++++++++++++++++++++++++++++++--------- - 1 file changed, 41 insertions(+), 9 deletions(-) - -commit 614b6ca7f45c4acbee088fe74fecf279ed50cc0c -Author: Sebastian Pölsterl -Date: Wed Jan 19 15:27:33 2011 +0100 - - [gi] Fixed typo in exception - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 5f16df31b5a5a9f45f702eee48c3a18899ea3f71 -Author: John (J5) Palmieri -Date: Wed Jan 19 09:13:44 2011 -0500 - - [gi] fix marshalling structs - - gi/pygi-argument.c | 47 +++++++++++++++++++++++++++++++++++------------ - gi/pygi-foreign.c | 18 ++++++++++++------ - gi/pygi-foreign.h | 8 ++++---- - 3 files changed, 51 insertions(+), 22 deletions(-) - -commit b2189424f9dd6d3a4a5b9792f0d5843fc27657d1 -Author: Sebastian Pölsterl -Date: Wed Jan 19 15:12:25 2011 +0100 - - [gi] Enable handling of Gdk.EventType.2BUTTON_PRESS and 3BUTTON_PRESS - - gi/overrides/Gdk.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 5eca5ff2c9509ec96158fe43b29f0fd951243efe -Author: Martin Pitt -Date: Wed Jan 19 14:54:57 2011 +0100 - - Revert "Fix Pango FontDescription override" - - According to - http://library.gnome.org/devel/pango/1.28/pango-Fonts.html#pango-font-description-new - the default constructor actually does take no arguments; we should - actually fix - the MemoryError. Add a test case for this. - - Remove the FIXME though, as pango_font_description_from_string() - is not a - FontDescription constructor, but a static factory method. - - Thanks to Paolo Borelli for pointing this out! - - This reverts commit 8878c57676091c08e66bc6cbe735d898cb420582. - - gi/overrides/Pango.py | 5 ++++- - tests/test_overrides.py | 5 +++++ - 2 files changed, 9 insertions(+), 1 deletion(-) - -commit 9e7b95b3676a1b502662523a9bd4ebe40ccb4845 -Author: Tony Young -Date: Thu Dec 16 23:39:33 2010 +0000 - - Python iterator interface support for GFileEnumerator. - - gi/overrides/Gio.py | 41 +++++++++++++++++++++++++++++++++++++++++ - gi/overrides/Makefile.am | 1 + - tests/test_overrides.py | 20 ++++++++++++++++++++ - 3 files changed, 62 insertions(+) - -commit bca5834fc8fa342149e0eec7b396877a2abe6d33 -Author: Tomeu Vizoso -Date: Fri Jan 7 12:10:37 2011 +0100 - - Remove gio static bindings - - https://bugzilla.gnome.org/show_bug.cgi?id=638899 - - Makefile.am | 2 +- - configure.ac | 25 - - gio/.gitignore | 3 - - gio/Makefile.am | 117 - - gio/__init__.py | 40 - - gio/gappinfo.override | 213 -- - gio/gapplaunchcontext.override | 99 - - gio/gbufferedinputstream.override | 70 - - gio/gcancellable.override | 38 - - gio/gdatainputstream.override | 250 -- - gio/gdrive.override | 347 -- - gio/gfile.override | 2215 ----------- - gio/gfileattribute.override | 153 - - gio/gfileenumerator.override | 184 - - gio/gfileinfo.override | 121 - - gio/gfileinputstream.override | 68 - - gio/gfileiostream.override | 68 - - gio/gfileoutputstream.override | 68 - - gio/gicon.override | 310 -- - gio/ginputstream.override | 344 -- - gio/gio-types.defs | 807 ---- - gio/gio.defs | 7465 - ------------------------------------- - gio/gio.override | 409 -- - gio/giomodule.c | 208 -- - gio/giostream.override | 68 - - gio/gmemoryinputstream.override | 91 - - gio/gmemoryoutputstream.override | 45 - - gio/gmount.override | 454 --- - gio/goutputstream.override | 292 -- - gio/gresolver.override | 312 -- - gio/gsocket.override | 575 --- - gio/gvolume.override | 237 -- - gio/gvolumemonitor.override | 94 - - gio/pygio-utils.c | 236 -- - gio/pygio-utils.h | 49 - - gio/unix-types.defs | 55 - - gio/unix.defs | 475 --- - gio/unix.override | 62 - - gio/unixmodule.c | 52 - - tests/Makefile.am | 9 - - tests/runtests-windows.py | 3 - - tests/test_gcancellable.py | 15 - - tests/test_gicon.py | 112 - - tests/test_gio.py | 1138 ------ - tests/test_gresolver.py | 68 - - tests/test_gsocket.py | 126 - - 46 files changed, 1 insertion(+), 18191 deletions(-) - -commit 6ab3d8d286573289cf8e41eee31eb806621f6f43 -Author: John (J5) Palmieri -Date: Wed Jan 19 07:56:16 2011 -0500 - - [gi] switch from using (*arg). to arg-> when referencing union - memebers - - gi/pygi-argument.c | 54 - +++++++++++++++++++++++++++--------------------------- - 1 file changed, 27 insertions(+), 27 deletions(-) - -commit 762ccb3d2620ea22023446b6ae79f3a111d8b56a -Author: John (J5) Palmieri -Date: Wed Jan 19 07:49:52 2011 -0500 - - [gi] return FALSE when setting errors in the marshaller - - gi/pygi-argument.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit cbaba6357937cbed3ebd34d2db1cdd59d37df118 -Author: John (J5) Palmieri -Date: Wed Jan 19 07:14:18 2011 -0500 - - [gi] do arg counting in new invoke - - gi/pygi-cache.c | 2 ++ - gi/pygi-cache.h | 14 ++++++++------ - gi/pygi-invoke-state-struct.h | 2 +- - gi/pygi-invoke.c | 20 +++++++++++++++++++- - 4 files changed, 30 insertions(+), 8 deletions(-) - -commit f45033858bed70d7defec3f71f26aa5b3999d680 -Author: John (J5) Palmieri -Date: Wed Jan 19 06:35:45 2011 -0500 - - [gi] set length for uint8 in arrays in new invoke marshaller - - gi/pygi-argument.c | 1 + - 1 file changed, 1 insertion(+) - -commit 09f7ca7e2378e6679002677ac3f4802f4cc7d9d5 -Author: Ignacio Casal Quinteiro -Date: Wed Jan 19 12:04:15 2011 +0100 - - [gi] set length when marshalling guint8 erases - - gi/pygi-argument.c | 1 + - tests/test_gi.py | 4 ++++ - 2 files changed, 5 insertions(+) - -commit 22eee43e50a150ace80694213fb87be9f0c72f51 -Author: Sebastian Pölsterl -Date: Wed Jan 19 10:27:47 2011 +0100 - - Convert Gdk.Pixbuf to GdkPixbuf.Pixbuf - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit a4b210d69c832629894090b7154ae194209b0c60 -Author: Arnaud Charlet -Date: Tue Jan 18 18:31:29 2011 +0100 - - Disable calls to PyGILState_* when threads are disabled - - Since threads may also be disabled in Python too, those symbols - may not - be resolved. - - https://bugzilla.gnome.org/show_bug.cgi?id=374603 - - glib/pyglib.c | 12 ++++++++++++ - gobject/pygobject-private.h | 6 ++++++ - 2 files changed, 18 insertions(+) - -commit 329afb6fb1b3c325a6a9de2b6aca91c64d51dd9f -Author: John (J5) Palmieri -Date: Tue Jan 18 12:31:57 2011 -0500 - - [gi] fix handling of garrays vs c arrays - - gi/pygi-argument.c | 9 +++++++-- - gi/pygi-cache.c | 2 ++ - gi/pygi-cache.h | 1 + - 3 files changed, 10 insertions(+), 2 deletions(-) - -commit a000627ec3904b9414ce375aec8d144fc0c26248 -Author: Martin Pitt -Date: Tue Jan 18 18:29:50 2011 +0100 - - pygi-convert.sh: Do not comment out set_cell_data_func() calls; - these should be ported properly - - pygi-convert.sh | 1 - - 1 file changed, 1 deletion(-) - -commit 99ff4610fb5ece2fc8d2f9eba13e661968adf3f0 -Author: Martin Pitt -Date: Tue Jan 18 18:26:01 2011 +0100 - - pygi-convert.sh: Fix match for adding missing imports - - pygi-convert.sh | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 3aa95011fad67df20370e92bf25236a34d7d08d3 -Author: Martin Pitt -Date: Tue Jan 18 18:09:30 2011 +0100 - - pygi-convert.sh: Fix Gtk.Label handling to be idempotent - - As we are not replacing line by line, but the whole file at once, - this is a bit - hackish unfortunately. We can't use a match test or a lookahead/behind - assertion. - - pygi-convert.sh | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -commit f66051380c0432bf142774542ade2144adcd455e -Author: John (J5) Palmieri -Date: Tue Jan 18 11:44:27 2011 -0500 - - [gi] use correct union memeber when marshalling floats - - gi/pygi-argument.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 36bc1c17e7d4189059337cc6a73c64edd819ec12 -Author: Laszlo Pandy -Date: Tue Jan 18 17:29:52 2011 +0100 - - Remove trailing whitespace from gi/overrides/Gtk.py - - gi/overrides/Gtk.py | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -commit 1006df1929a667716c25e74b35b8f14643358732 -Author: John (J5) Palmieri -Date: Tue Jan 18 11:24:06 2011 -0500 - - [gi] fix constructor invoking and add some support for interface - out values - - * constructors are now simplified and are treated like normal - static methods - which happen to return an instance - - gi/pygi-argument.c | 8 ++-- - gi/pygi-cache.c | 132 - +++++++++++++++++++++++++++++++++++++++++++++++++++-- - gi/pygi-invoke.c | 9 ++-- - gi/types.py | 21 +++------ - 4 files changed, 142 insertions(+), 28 deletions(-) - -commit 8878c57676091c08e66bc6cbe735d898cb420582 -Author: Martin Pitt -Date: Tue Jan 18 16:47:10 2011 +0100 - - Fix Pango FontDescription override - - Trying to call __new__() on a record crashes with a MemoryError, - so just call - the intended static factory method for a None argument as well - (which works - just fine now). - - gi/overrides/Pango.py | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -commit efbbe71634037fa100b17327389b883b259cca54 -Author: Martin Pitt -Date: Tue Jan 18 16:23:39 2011 +0100 - - tests: Respect existing $GI_TYPELIB_PATH - - This allows us to run the test suite against local typelibs. - - tests/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit c96ca383350e5b9b079d9a86464922314939c006 -Author: John (J5) Palmieri -Date: Tue Jan 18 07:16:40 2011 -0500 - - [gi] fix aux value offsets for methods and element size crashers - - * if the callable is a method we need to add 1 to the aux index - for in values so we grab the right argument cache - * use _pygi_g_type_info_size instead of _pygi_g_type_tag_size to - support all types - - gi/pygi-cache.c | 42 ++++++++++++++++++++++++------------------ - 1 file changed, 24 insertions(+), 18 deletions(-) - -commit f56d85a7f39c2088bf9fd50b1b1e5b67c03104d3 -Merge: 84d6142 7d997b6 -Author: Sebastian Pölsterl -Date: Tue Jan 18 13:14:45 2011 +0100 - - Merge branch 'value' - -commit 7d997b6fe88343776c4d67a9f3437ba0c4122da0 -Author: Sebastian Pölsterl -Date: Tue Jan 18 13:12:36 2011 +0100 - - GTK overrides: Do type conversion to column types of ListStore and - TreeStore in set_value - - gi/overrides/Gtk.py | 28 ++++++++++++++++++---------- - tests/test_overrides.py | 12 +++++++++++- - 2 files changed, 29 insertions(+), 11 deletions(-) - -commit 84d6142c14a7ebfb7284d3db52e14d3393f93905 -Author: Steve Frécinaux -Date: Mon Jan 17 18:57:58 2011 +0100 - - Always register a new GType when a GObject class is subclassed - - This patch makes the GType <-> python mapping much more predictible, - and fixes the bug caused by overriding methods without specifying a - __gtype_name__ member in the subclass, and makes type_register useless - for real :-) - - It is still possible to provide an explicit __gtype_name__ member - in the - subclass as it allows having a predictible GType name, which is handy - for some of our tests. There is also an explicit special case for - overrides because we obviously do not want to register new GTypes for - those ones as it would clearly defeat the purpose of overrides. - - https://bugzilla.gnome.org/show_bug.cgi?id=543056 - - gobject/__init__.py | 6 +++--- - tests/test_gi.py | 21 ++------------------- - 2 files changed, 5 insertions(+), 22 deletions(-) - -commit 30750ccef31e6c864628f418fc00e8c573d29a1b -Author: Simon van der Linden -Date: Tue Jan 18 12:57:13 2011 +0100 - - Raise required versions of GLib and GObject-Introspection - - https://bugzilla.gnome.org/show_bug.cgi?id=612126 - - configure.ac | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 761e98d32729f5894f4c75a54c65ed11329dc9d5 -Author: Martin Pitt -Date: Tue Jan 18 12:52:32 2011 +0100 - - pygi-convert.sh: Handle keysyms - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit d62cdfa38a675c1daf3bc12d5cd769434eea5dc8 -Author: Martin Pitt -Date: Tue Jan 18 12:14:09 2011 +0100 - - GLib overrides: Add test case for array variant building - - tests/test_overrides.py | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 69a78307f3762e3f54d28d98514cec7d31ff20db -Author: Tomeu Vizoso -Date: Tue Jan 18 10:21:03 2011 +0100 - - Remove cairo.RectangleInt from the foreign module - - https://bugzilla.gnome.org/show_bug.cgi?id=639824 - - gi/pygi-foreign-cairo.c | 96 - ------------------------------------------------- - 1 file changed, 96 deletions(-) - -commit 017680c9a5e163021628bf29543598861a3b600a -Author: Tomeu Vizoso -Date: Tue Jan 18 10:20:25 2011 +0100 - - Dont try to guess the transfer if its a boxed - - https://bugzilla.gnome.org/show_bug.cgi?id=639823 - - gi/pygi-invoke.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit 771ef76574690eb98926249f38661d741d1ebbb0 -Author: Ignacio Casal Quinteiro -Date: Tue Jan 18 12:02:01 2011 +0100 - - The tags can be Empty not None. - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b1a98083cdc50653e1d7bfb809bdf089f833df3d -Author: Martin Pitt -Date: Tue Jan 18 12:01:28 2011 +0100 - - Add Pythonic iterators and indexing to GVariant - - Add the usual set of iterators and index accessors to GLib.Variant - objects - which are containers. - - Add corresponding test cases. - - gi/overrides/GLib.py | 50 ++++++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides.py | 55 - +++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 105 insertions(+) - -commit ecb9f824c503c529d43e585b4cdb4c1c9ab14593 -Author: Martin Pitt -Date: Tue Jan 18 10:48:03 2011 +0100 - - Add GLib.Variant.unpack() - - This method decomposes a GLib.Variant into a native Python object, - i. e. the - counterpart of _VariantCreator. This makes it a lot nicer for - application - developers to use e. g. return values from gdbus calls. - - Add appropriate test case. - - gi/overrides/GLib.py | 45 - +++++++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides.py | 33 ++++++++++++++++++++++++++++++++- - 2 files changed, 77 insertions(+), 1 deletion(-) - -commit 31c73dee34a52fd22b5ff3a23adce92cea5ddc3d -Author: Ignacio Casal Quinteiro -Date: Tue Jan 18 10:56:18 2011 +0100 - - Add override for gtk_text_buffer_insert_with_tags - - gi/overrides/Gtk.py | 12 ++++++++++++ - tests/test_overrides.py | 6 ++++++ - 2 files changed, 18 insertions(+) - -commit fc7d7f7f153d57ff3866b7bfd5e6479d702cc4d9 -Author: Simon van der Linden -Date: Mon Jan 17 14:35:14 2011 +0100 - - Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES - - https://bugzilla.gnome.org/show_bug.cgi?id=620215 - - gi/Makefile.am | 6 ++++-- - gio/Makefile.am | 2 +- - glib/Makefile.am | 2 +- - m4/python.m4 | 7 +++++-- - tests/Makefile.am | 2 +- - 5 files changed, 12 insertions(+), 7 deletions(-) - -commit bceec758b27e6c396d17a79424633b5dc9116f54 -Author: Simon van der Linden -Date: Mon Jan 17 14:20:55 2011 +0100 - - Kill JD_CHECK_PYTHON_HEADERS - - Use AM_CHECK_PYTHON_HEADERS instead, which is identical. - - https://bugzilla.gnome.org/show_bug.cgi?id=620215 - - configure.ac | 2 +- - m4/python.m4 | 31 +------------------------------ - 2 files changed, 2 insertions(+), 31 deletions(-) - -commit e2dea065da94d17a915abe1ce4671b1dc48e02c0 -Author: Sebastian Pölsterl -Date: Mon Jan 17 19:09:27 2011 +0100 - - Revert "Override Gtk.Box.pack_start and pack_end to set default - values to be compliant with pygtk" - - This reverts commit a8c727b9c4195d8085a45661683a18614ae84485. - - Conflicts: - - gi/overrides/Gtk.py - - gi/overrides/Gtk.py | 10 ---------- - 1 file changed, 10 deletions(-) - -commit 4fbae9629adc166627de05bb0946b71485343d69 -Author: Sebastian Pölsterl -Date: Mon Jan 17 19:08:23 2011 +0100 - - Revert "Override Gtk.CellLayout.pack_start and pack_end to add - default values to be compliant with pygtk" - - This reverts commit 232841148f35684be83a2f47b5b18da4fb74f63a. - - gi/overrides/Gtk.py | 13 ++----------- - 1 file changed, 2 insertions(+), 11 deletions(-) - -commit c054f0aca67952876b3519bb75ddc62c5517f7cb -Author: Sebastian Pölsterl -Date: Mon Jan 17 19:08:06 2011 +0100 - - Revert "Override Gtk.TreeViewColumn.pack_start, pack_end and - set_cell_data_func to add default values to be compliant with pygtk" - - This reverts commit ed7e7a8f22b1481acf78c0c2e4c489dbad72f599. - - gi/overrides/Gtk.py | 9 --------- - 1 file changed, 9 deletions(-) - -commit 2d9534f347505573da46743b47318e08bf073aef -Author: Martin Pitt -Date: Mon Jan 17 18:54:10 2011 +0100 - - pygi-convert.sh: Handle gtk.combo_box_new_text() - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 0586a83212a9f9234fe00659ae744ab04e7ccc67 -Author: John (J5) Palmieri -Date: Mon Jan 17 12:31:03 2011 -0500 - - support callbacks - - gi/pygi-argument.c | 68 ++++++++++++++++++++++++++++++++++++++++++++-- - gi/pygi-cache.c | 80 - +++++++++++++++++++++++++++++++++++++++++------------- - gi/pygi-cache.h | 13 +++++++-- - gi/pygi-invoke.c | 2 +- - 4 files changed, 138 insertions(+), 25 deletions(-) - -commit 914d3a0a29680f4d3aa0e1f8afdd625b017b013a -Author: Sebastian Pölsterl -Date: Mon Jan 17 16:57:53 2011 +0100 - - Override TreeSortable.set_sort_func and set_default_sort_func to - add default values to be pygtk compliant - - gi/overrides/Gtk.py | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit ed7e7a8f22b1481acf78c0c2e4c489dbad72f599 -Author: Sebastian Pölsterl -Date: Mon Jan 17 16:29:28 2011 +0100 - - Override Gtk.TreeViewColumn.pack_start, pack_end and - set_cell_data_func to add default values to be compliant with pygtk - - gi/overrides/Gtk.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit 232841148f35684be83a2f47b5b18da4fb74f63a -Author: Sebastian Pölsterl -Date: Mon Jan 17 16:28:51 2011 +0100 - - Override Gtk.CellLayout.pack_start and pack_end to add default values - to be compliant with pygtk - - gi/overrides/Gtk.py | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -commit 1dec12826753756fcadefc8ef8c756fc902c320b -Author: Sebastian Pölsterl -Date: Mon Jan 17 15:54:32 2011 +0100 - - Override Gtk.Paned pack1 and pack2 to add default values to be - compliant with pygtk - - gi/overrides/Gtk.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit a8c727b9c4195d8085a45661683a18614ae84485 -Author: Sebastian Pölsterl -Date: Mon Jan 17 15:46:25 2011 +0100 - - Override Gtk.Box.pack_start and pack_end to set default values to - be compliant with pygtk - - gi/overrides/Gtk.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 7cc8ac35bb0d8dbf7d66f014f8cd7ff070b3acb8 -Author: Steve Frécinaux -Date: Wed Aug 4 00:30:05 2010 +0200 - - Handle GObject subclasses in the property helper. - - https://bugzilla.gnome.org/show_bug.cgi?id=625982 - - gobject/propertyhelper.py | 26 +++++++++++++------------- - tests/test_properties.py | 9 +++++++++ - 2 files changed, 22 insertions(+), 13 deletions(-) - -commit 7a0548dbfbdfe481f75315b6bc7824a9f1a8a87b -Author: Martin Pitt -Date: Mon Jan 17 17:52:15 2011 +0100 - - Fix handling of unicode for GtkTreeModels - - The code previously converted an unicode object into unicode, but - in Python 2.X - models actually have to specify 'str' (GTK expects a gchararray). So - encode to - UTF-8 instead to get what GTK expects. - - Add corresponding test case. - - gi/overrides/Gtk.py | 2 +- - tests/test_overrides.py | 12 +++++++++++- - 2 files changed, 12 insertions(+), 2 deletions(-) - -commit 09c21c79fb6063c8451f53d4588363d2be7239f4 -Author: Laszlo Pandy -Date: Mon Jan 17 16:46:08 2011 +0100 - - In IntrospectionModule and DynamicModule classes, make all instance - attributes start with an underscore. - - This changes IntrospectionModule.version to _version and - DynamicModule.introspection_module to _introspection_module. - This is done to mark the attributes as private, and also avoid name - collisions with attributes from the typelib. - In Gstreamer, there is a function gst_version, which was previously - inaccessible because of IntrospectionModule.version overriding it. - - gi/module.py | 26 +++++++++++++------------- - gi/overrides/GIMarshallingTests.py | 2 +- - gi/overrides/GLib.py | 2 +- - gi/overrides/Gdk.py | 10 +++++----- - gi/overrides/Gtk.py | 2 +- - gi/overrides/Pango.py | 2 +- - gi/overrides/__init__.py | 2 +- - tests/test_everything.py | 2 +- - 8 files changed, 24 insertions(+), 24 deletions(-) - -commit 2c70beca9e76e4dc253453c556e6985ce59a3dd9 -Author: Laszlo Pandy -Date: Mon Jan 17 16:17:25 2011 +0100 - - Amend previous enum wrapping commit to remove redundant setting of - __info__ attribute. - - gi/module.py | 2 +- - gi/types.py | 6 +++--- - 2 files changed, 4 insertions(+), 4 deletions(-) - -commit 6fbb6be5a5d0d9cd43e1504b8dda5aa75feb95ca -Author: Martin Pitt -Date: Mon Jan 17 16:16:45 2011 +0100 - - pygi-convert.sh: Handle GdkPixbuf.InterpType - - pygi-convert.sh | 2 ++ - 1 file changed, 2 insertions(+) - -commit 66a5784f4ab5de5b6d8d51eb4ce869fa26f6a601 -Author: Laszlo Pandy -Date: Mon Jan 17 15:43:34 2011 +0100 - - Fix wrapping of enums: Create new Python type for each non-gtype enum. - - Previously non-gtype enums used the same class, which meant they - were all the same type. - This caused another problem that since they were all the same class, - attributes from different enums were available from each other. - - A new test case is created to check for this bug. It requires a new - enum from the GIMarshallingTests (updating gobject-introspection - will be required). - - gi/module.py | 2 +- - gi/types.py | 2 ++ - tests/test_gi.py | 10 ++++++++++ - 3 files changed, 13 insertions(+), 1 deletion(-) - -commit da50d5620a42046d4fc905bb28a0890d73533cb1 -Author: Tomeu Vizoso -Date: Mon Dec 13 18:03:51 2010 +0100 - - Use g_vfunc_info_invoke for chaining up in vfuncs - - https://bugzilla.gnome.org/show_bug.cgi?id=637165 - - gi/pygi-info.c | 4 ++-- - gi/pygi-invoke.c | 72 - +++++++++++++++++++++++++++++++++++++++++++------------- - gi/pygi-invoke.h | 3 ++- - gi/types.py | 28 +++++++++++++++++++++- - tests/test_gi.py | 5 ++-- - 5 files changed, 89 insertions(+), 23 deletions(-) - -commit 8ceef79c98a1c2e22ed8ab655ef1169f1763dd23 -Author: Simon van der Linden -Date: Fri Dec 31 18:38:04 2010 +0100 - - Move pyglib_{main_context, option_context, option_group}_new into - _PyGLib_API - - _PyG{MainContext, OptionContext, and OptionGroup_Type} were not - be initialized - when used inside the glib module, since pyglib_init is not called. - - pyglib.c is compiled as a stand-alone library loaded by the _glib - module that - declares the above-mentioned types. Hence, they cannot be accessed - by the - former. This patch moves the functions that need those symbols - into the - glib._glib module and exports them to the pyglib library through - _PyGLib_API. - - https://bugzilla.gnome.org/show_bug.cgi?id=636656 - - glib/glibmodule.c | 5 ++++- - glib/pyglib-private.h | 3 +++ - glib/pyglib.c | 48 - +++--------------------------------------------- - glib/pygmaincontext.c | 22 ++++++++++++++++++++++ - glib/pygmaincontext.h | 2 +- - glib/pygmainloop.c | 2 +- - glib/pygoptioncontext.c | 21 +++++++++++++++++++++ - glib/pygoptioncontext.h | 2 ++ - glib/pygoptiongroup.c | 26 ++++++++++++++++++++++++++ - glib/pygoptiongroup.h | 2 ++ - glib/pygsource.c | 2 +- - 11 files changed, 86 insertions(+), 49 deletions(-) - -commit 17caffe4eeefeaf33a56ececbc6c7454f60b9d76 -Author: Martin Pitt -Date: Mon Jan 17 14:51:26 2011 +0100 - - pygi-convert.sh: Handle Gdk.DragAction - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit aa390aa80f06ac83ec89e5c5ee143d21ace97917 -Author: Martin Pitt -Date: Mon Jan 17 14:46:58 2011 +0100 - - pygi-convert.sh: Generalize Gtk.Settings migration - - There are other GSettings.get_* functions like get_for_screen(). - - pygi-convert.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2e6d5bb49425e6087ca61765ecb72e7a760f2ab2 -Author: Martin Pitt -Date: Mon Jan 17 11:22:46 2011 +0100 - - pygi-convert.sh: Don't change the name of "glib" submodules - - This particular affects dbus.mainloop.glib.* - - pygi-convert.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3887b030fc19d25e0cd7b4ed504f4ed23363c3d6 -Author: Paolo Borelli -Date: Sun Jan 16 22:09:56 2011 +0100 - - Plug another memory leak - - Do not leak interface info in (g|s)_et_property. - - gi/pygi-property.c | 4 ++++ - 1 file changed, 4 insertions(+) - -commit a4950b4cbb3c7567a8586061bb361adb7d9afb98 -Author: Paolo Borelli -Date: Sun Jan 16 21:43:30 2011 +0100 - - Plug a small memory leak. - - Do not leak type_info in find_vfunc_info - - gi/gimodule.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -commit d0cbcc45366d40702c69cef207d3c0f361260c02 -Author: Paolo Borelli -Date: Sun Jan 16 12:16:31 2011 +0100 - - Override Table.attach() to behave like pygtk - - It is fairly common and even gtk itself still has attach_defaults. - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 4 ++++ - 2 files changed, 7 insertions(+) - -commit 6409d659326bf3cefdf6051379e8bc2031f16733 -Author: Martin Pitt -Date: Sat Jan 15 11:20:23 2011 -0600 - - pygi-convert.sh: Convert Pango.WrapMode - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 6aaa6a38198e84a189ca1e8d26b1871d5b6bb711 -Author: Martin Pitt -Date: Sat Jan 15 11:17:09 2011 -0600 - - pygi-convert.sh: Don't change the name of "gtk" submodules - - Some projects have local modules like "myproject.ui.gtk". Avoid - changing those, - just change module names which start with "gtk" or "gdk". - - pygi-convert.sh | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 9be0f1f2dfb89150faf1827ef482feea03645149 -Author: John (J5) Palmieri -Date: Thu Jan 13 23:56:19 2011 -0500 - - [gi] implement aux arg handling for array lengths - - gi/pygi-argument.c | 8 ++++++++ - gi/pygi-cache.c | 36 ++++++++++++++++++++++++++++-------- - gi/pygi-cache.h | 1 - - gi/pygi-invoke.c | 8 ++++++-- - 4 files changed, 42 insertions(+), 11 deletions(-) - -commit cfca2f0a53a5c29f543875ca4cb83a2e18d3bc72 -Author: John (J5) Palmieri -Date: Thu Jan 13 21:07:25 2011 -0500 - - [gi] marshal in hashes - - gi/pygi-argument.c | 93 ++++++++++++++++++++++++++++++++++++++-- - gi/pygi-cache.c | 122 - +++++++++++++++++++++++++++++++++++++---------------- - 2 files changed, 176 insertions(+), 39 deletions(-) - -commit c36fbf4918c8557a8e274a12004a412da3b22b2c -Author: Laszlo Pandy -Date: Tue Jan 11 21:41:47 2011 +0100 - - Fix the __dir__() methods on DynamicModule and IntrospectionModule - - Previously the __dir__() methods did not list all attributes. - A simple test case is included. It does not test to see if - every attribute is listed, it just tests a few of each kind: - - (wrapped) typelib attributes - - class attributes and methods - - instance attributes - - A set() is used to avoid returning duplicate attributes. - The test case checks for this as well. - - https://bugzilla.gnome.org/show_bug.cgi?id=639229 - - gi/module.py | 28 +++++++++++++++++++++------- - tests/test_everything.py | 18 ++++++++++++++++++ - 2 files changed, 39 insertions(+), 7 deletions(-) - -commit 1679e6af3f212e4d4644e048dc3c6177ed3fac6b -Author: Paolo Borelli -Date: Thu Jan 13 00:02:20 2011 +0100 - - pygi-convert.sh: handle ReliefStyle - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit e9166ba5d19f2b586f65a3b83a671a5afd486d8f -Author: John (J5) Palmieri -Date: Wed Jan 12 16:50:30 2011 -0500 - - [gi] support for GList and GSList in - - gi/pygi-argument.c | 122 - ++++++++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 116 insertions(+), 6 deletions(-) - -commit 9baf3240fbac103823ad0feaaf1c82e46d276722 -Author: John (J5) Palmieri -Date: Wed Jan 12 16:24:17 2011 -0500 - - [gi] handle allow_none for all args - - gi/pygi-cache.c | 3 ++- - gi/pygi-cache.h | 1 + - gi/pygi-invoke.c | 7 +++++++ - 3 files changed, 10 insertions(+), 1 deletion(-) - -commit d54d12c66226910952b0dc44c8d9514a7edaa6f2 -Author: John (J5) Palmieri -Date: Wed Jan 12 16:23:02 2011 -0500 - - [gi] fix marshalling fixed arrays - - * get the correct item_size and pass the GArray data not the GArray - - gi/pygi-argument.c | 39 ++++++++++++++++++++++----------------- - gi/pygi-cache.c | 3 ++- - 2 files changed, 24 insertions(+), 18 deletions(-) - -commit 3b0eff80d2ee35e0417476f0a170b9e178e3d1ee -Author: John (J5) Palmieri -Date: Tue Jan 11 17:20:43 2011 -0500 - - [gi] implement out arg handling - - gi/pygi-argument.c | 43 ++++++++++--------------------------- - gi/pygi-cache.c | 22 ++++++++++++++----- - gi/pygi-invoke-state-struct.h | 13 +++++++++++ - gi/pygi-invoke.c | 50 - +++++++++++++++++++++++++++++++++++++++++-- - 4 files changed, 89 insertions(+), 39 deletions(-) - -commit bd002c72675d35b5e60ab773181e7c36c30d2625 -Author: Dieter Verfaillie -Date: Tue Jan 11 22:21:18 2011 +0100 - - setup.py: fix the provides keyword argument - - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 59dac72d0fa8e1d68bbbc13d76c2747f1cb11857 -Author: Dieter Verfaillie -Date: Tue Jan 11 22:19:18 2011 +0100 - - setup.py: use the same spaces-less format for all setup() parameters - - setup.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit c5c149be171895d292852df364541f14f0ec423a -Author: John (J5) Palmieri -Date: Tue Jan 11 15:39:09 2011 -0500 - - [gi] implemented return marshalling and started on out marshalling - - gi/pygi-argument.c | 387 - ++++++++++++++++++++++++++++++++++++++++++++++++++++- - gi/pygi-argument.h | 117 ++++++++++++++++ - gi/pygi-cache.c | 316 ++++++++++++++++++++++++++++++++++++++++++- - gi/pygi-cache.h | 8 +- - gi/pygi-invoke.c | 12 +- - 5 files changed, 829 insertions(+), 11 deletions(-) - -commit 4fcca8518774ab89607196dfc52037e3da30ac8a -Author: John (J5) Palmieri -Date: Tue Jan 11 13:49:58 2011 -0500 - - [gi] flesh out interface in marshalling a bit more - - gi/pygi-argument.c | 74 - ++++++++++++++++++++++++++++++++++++++++---------- - gi/pygi-cache.c | 79 - ++++++++++++++++++++++++++++++++++++++++++------------ - gi/pygi-cache.h | 1 + - 3 files changed, 123 insertions(+), 31 deletions(-) - -commit 4992dca9f5cea68d85eb2ed86105c9c6b8311d79 -Author: Laszlo Pandy -Date: Tue Jan 11 19:30:38 2011 +0100 - - Add a __repr__() method to DynamicModule. - - This patch adds a __repr__() method to DynamicModule so that modules - provide a - meaningful string with the typelib path included: - - >>> from gi.repository import Gtk - >>> Gtk - - - https://bugzilla.gnome.org/show_bug.cgi?id=639232 - - gi/module.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit 2ffaec59e7349c145a0e2a5edba2ffb7d8628369 -Author: Tomeu Vizoso -Date: Tue Jan 11 19:40:19 2011 +0100 - - Go back to using getattr() in DynamicModule.__getattr__ - - Breaks marshalling of some types - - gi/module.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 52a298cc0f05ceec96457f17f9a801e9838fb757 -Author: Laszlo Pandy -Date: Tue Jan 11 19:26:50 2011 +0100 - - Change __dir__() to report all the attributes that __getattr__ - supports - - Change DynamicModule.__dir__() to return the local class members as - well as the - typelib attributes. - - Change DynamicModule.__getattr__() to call - IntrospectionModule.__getattr__() - directly, so that it won't inadvertently return class attributes from - IntrospectionModule. - - https://bugzilla.gnome.org/show_bug.cgi?id=639229 - - gi/module.py | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -commit 369a75ba5fb64ff7a7c95d21f8bfe359e639e9ff -Author: John (J5) Palmieri -Date: Mon Jan 10 17:55:03 2011 -0500 - - [gi] add object and interface in marshalling - - * also remove the PyGIArgCleanup sinature as GDestroyNotify works - just fine - - gi/pygi-argument.c | 15 +++-- - gi/pygi-cache.c | 182 - ++++++++++++++++++++++++++++++++++++++++++++++++----- - gi/pygi-cache.h | 1 - - gi/pygi-invoke.c | 1 + - 4 files changed, 178 insertions(+), 21 deletions(-) - -commit 88531c58d0491a31dd319387237a03df5c9edc07 -Author: John (J5) Palmieri -Date: Mon Jan 10 15:33:56 2011 -0500 - - [gi] fix casting when marshaling a char to uint8 - - gi/pygi-argument.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 441da4a7346ca059630dbc820c5b46e4d0222f4b -Author: John (J5) Palmieri -Date: Mon Jan 10 15:07:16 2011 -0500 - - [gi] hook up invoke to the cache - - * We now can invoke with in values - * out, constructors and returns still don't work along with numerous - complex - in types - - gi/Makefile.am | 1 + - gi/pygi-argument.c | 60 +++++++++-------- - gi/pygi-argument.h | 60 ++++++++--------- - gi/pygi-cache.h | 6 +- - gi/pygi-invoke-state-struct.h | 26 ++++++++ - gi/pygi-invoke.c | 149 - ++++++++++++++++++++++++++++++++---------- - gi/pygi-invoke.h | 2 +- - gi/pygi-private.h | 1 + - 8 files changed, 208 insertions(+), 97 deletions(-) - -commit f32b1f494aa5d09b9b198f607722c819c6bbd808 -Author: John (J5) Palmieri -Date: Sun Jan 9 19:37:55 2011 -0500 - - hooked up caching stage and fixed segfaults - - * caching stage is hooked up but not used yet - * throws exceptions for everything that can not be cached yet - - gi/pygi-cache.c | 59 - +++++++++++++++++++++++++++++++++++++++++++------------- - gi/pygi-info.c | 3 +++ - gi/pygi-invoke.c | 5 +++++ - gi/pygi.h | 2 ++ - 4 files changed, 56 insertions(+), 13 deletions(-) - -commit c2bf1d4d9cf2e9f8e313528fe717f6279dad5da1 -Author: John (J5) Palmieri -Date: Sun Jan 9 18:05:31 2011 -0500 - - [gi] fix some function names - - gi/pygi-cache.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -commit 2ec4230a5180f048c26c2e4234b2a098d42f030b -Author: John (J5) Palmieri -Date: Sun Jan 9 15:58:06 2011 -0500 - - [gi] refactor cache structs so they inherit from ArgCache - - gi/pygi-argument.c | 122 +++++++++---------- - gi/pygi-cache.c | 344 - +++++++++++++++++++++++++++++------------------------ - gi/pygi-cache.h | 50 ++++---- - 3 files changed, 273 insertions(+), 243 deletions(-) - -commit f4cdf0c0321285da015686fcb7115bd91bfd5c7c -Author: John (J5) Palmieri -Date: Sat Jan 8 20:45:11 2011 -0500 - - [gi]fix cache compile error - now compiles but cache still not - hooked up - - gi/Makefile.am | 2 + - gi/pygi-argument.c | 100 +++++++++++++++--------------- - gi/pygi-argument.h | 174 - ++++++++++++++++++++++++++++++++++++++++++++--------- - gi/pygi-cache.c | 169 - +++++++++++++++++++++++++-------------------------- - gi/pygi-cache.h | 25 ++++---- - 5 files changed, 293 insertions(+), 177 deletions(-) - -commit 5f8f3044dd8085b2e8ce0bf70e9d52f05abf909d -Author: John (J5) Palmieri -Date: Sat Jan 8 19:10:29 2011 -0500 - - add sequence caching and array marshalling w/ item marshalling - - * simplify what we pass into the arg cache generators so we may - use them - for geneating marshalling caches for container items, not just - arguments - - gi/pygi-argument.c | 76 ++++++++++++++++- - gi/pygi-cache.c | 242 - ++++++++++++++++++++++------------------------------- - gi/pygi-cache.h | 4 +- - 3 files changed, 175 insertions(+), 147 deletions(-) - -commit 202a268db7f98f5a3c525c6e65ec4bff1917257e -Author: Emilio Pozuelo Monfort -Date: Sat Jan 8 02:19:52 2011 +0000 - - Bump the minimum gio dependency - - Needed for G_TYPE_CONVERTER_FLAGS and others. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit c3aa36151fdef9ed9884d93114786bbe86387983 -Author: Tomeu Vizoso -Date: Fri Jan 7 12:58:11 2011 +0100 - - Add test for incorrect attributes in Gdk.Event - - tests/test_overrides.py | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 204b45c7e95eb50d9e3843127fb10e13b1b17fee -Author: Simon van der Linden -Date: Sun Jan 2 19:25:55 2011 +0100 - - Don't call getattr again in gi.overrides.Gdk.Event.__getattr__ - - __getattr__ is only called when the attribute is not found through - the normal - mechanism, so getattr must not be called again in __getattr__ - (which would - create an infinite loop). - - Another possibility would be to implement __getattribute__ instead, - which is - called in place of the normal mechanism. In that case, calling - getattr would be - needed for normal attributes. - - https://bugzilla.gnome.org/show_bug.cgi?id=638523 - - gi/overrides/Gdk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 6cf298ca5565d0eb99824f050ff47407e50a5c01 -Author: Mike Gorse -Date: Fri Jan 7 09:08:31 2011 +0100 - - Release allocated array of arguments when handling closures - - https://bugzilla.gnome.org/show_bug.cgi?id=638847 - - gi/pygi-closure.c | 3 +++ - 1 file changed, 3 insertions(+) - -commit 1be76d5e006efa24598ff7bf26153660dbe0a890 -Author: Mike Gorse -Date: Fri Jan 7 09:07:35 2011 +0100 - - Release GIValueInfo when checking an enum argument - - https://bugzilla.gnome.org/show_bug.cgi?id=638847 - - gi/pygi-argument.c | 1 + - 1 file changed, 1 insertion(+) - -commit 43849c51391fc9cd239697065c3d40fa02fb6783 -Author: John (J5) Palmieri -Date: Thu Jan 6 17:30:14 2011 -0500 - - whitespace fixes - - gi/pygi-cache.c | 24 ++++++++++++------------ - gi/pygi-cache.h | 42 +++++++++++++++++++++--------------------- - 2 files changed, 33 insertions(+), 33 deletions(-) - -commit 8b5b3d2bbbbdf5d26c83e9a6fe67121cbd77ebe1 -Author: John (J5) Palmieri -Date: Thu Jan 6 17:29:00 2011 -0500 - - add marshalling for basic types and add more skeleton code - - * still doesn't compile - - gi/pygi-argument.c | 708 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-argument.h | 35 ++- - gi/pygi-cache.c | 82 +++++-- - gi/pygi-cache.h | 41 +++- - 4 files changed, 832 insertions(+), 34 deletions(-) - -commit f554cf62848104d31518138ae85bc51acaafda67 -Author: John (J5) Palmieri -Date: Tue Jan 4 18:49:53 2011 -0500 - - first checkin of the new caching branch - - * this does not compile and is not hooked up to the build system - * lays out the caching data structures and some skeleton functions - - gi/pygi-cache.c | 480 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-cache.h | 104 ++++++++++++ - 2 files changed, 584 insertions(+) - -commit 8d5a7857876669f56bb03bf618bcfdcc290721c0 -Author: Eitan Isaacson -Date: Wed Dec 22 12:34:10 2010 -0800 - - Respect different type lengths when assigning out-argument pointers. - - https://bugzilla.gnome.org/show_bug.cgi?id=637832 - - gi/pygi-closure.c | 66 - ++++++++++++++++++++++++++++++++++++++++++++++--------- - 1 file changed, 56 insertions(+), 10 deletions(-) - -commit f14976ffabec28f6cafe1e37dc81d207a947d4ca -Author: Tomeu Vizoso -Date: Tue Dec 28 18:34:25 2010 +0100 - - Fix stupid name clash - - gi/module.py | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit 01b2a193d403beb861eab524300b4f1af63157ce -Author: Tomeu Vizoso -Date: Tue Dec 28 13:49:18 2010 +0100 - - Add /usr/share to XDG_DATA_DIRS when running the tests - - tests/Makefile.am | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit efc186f692f9eac781cc47456be74a3da7f14dcd -Author: Tomeu Vizoso -Date: Tue Dec 28 13:25:34 2010 +0100 - - Comment out tests that require SRV lookups - - tests/test_gresolver.py | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit d2462cc1ab51d76fb4625c47c3d34de1d5d0dee8 -Author: Tomeu Vizoso -Date: Tue Dec 28 13:00:16 2010 +0100 - - Use suppresion file when running valgrind - - tests/Makefile.am | 2 +- - tests/python.supp | 387 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 388 insertions(+), 1 deletion(-) - -commit 0ee58113ecbea72784c52de928c041fc8fc88984 -Author: Ignacio Casal Quinteiro -Date: Thu Dec 23 00:10:41 2010 +0100 - - Fix warnings. - - gi/pygi-argument.c | 16 +++++++--------- - gi/pygi-foreign-cairo.c | 13 ++----------- - gio/gfile.override | 5 ++--- - glib/pyglib-python-compat.h | 3 +++ - glib/pyglib.c | 2 +- - glib/pygmainloop.c | 3 ++- - 6 files changed, 17 insertions(+), 25 deletions(-) - -commit 78ea84cd91392400ebac5a361ef8793bfe928fd0 -Author: Jesse van den Kieboom -Date: Sun Dec 19 23:10:57 2010 +0100 - - Allow comparing Gtk.TreePath to None - - https://bugzilla.gnome.org/show_bug.cgi?id=637615 - - gi/overrides/Gtk.py | 12 ++++++------ - tests/test_overrides.py | 6 ++++++ - 2 files changed, 12 insertions(+), 6 deletions(-) - -commit 046cc5915286e042d1040271a90676b77632409e -Author: John (J5) Palmieri -Date: Thu Dec 16 15:41:10 2010 -0500 - - handle unicode objects in properties - - * There are still some cavets in Python 2: - - properties are returned as String objects with the unicode - code points - - you must add # coding=utf-8 to the top of your python file - or python - will error out if it sees embeded unicode charaters (such as when - supporting python 3 and python 2 from the same source) - - https://bugzilla.gnome.org/show_bug.cgi?id=620579 - - gobject/pygtype.c | 35 ++++++++++++++++++++++++++--------- - tests/test_properties.py | 16 ++++++++++++++++ - 2 files changed, 42 insertions(+), 9 deletions(-) - -commit 7aa783d5cd674f34da318f826bd5f4a0e09d24cb -Author: Dieter Verfaillie -Date: Tue Dec 14 12:29:54 2010 +0100 - - dsextras.py: check if gcc is there when platform is win32 and compiler - is mingw32 - - dsextras.py | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit cebf5f09a6c5018ced64f35e7747fc81b93b823e -Author: Dieter Verfaillie -Date: Tue Dec 14 12:29:01 2010 +0100 - - dsextras.py: be consistent in how distutils imports are done - - dsextras.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 35e590d48c78f2e76c47c2b4eaf0f7e8d1ed5c93 -Author: Dieter Verfaillie -Date: Tue Dec 14 12:25:07 2010 +0100 - - dsextras.py: add have_gcc() function - - dsextras.py | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 637c2c287cfb0e89365026531c651111f5593ac7 -Author: Dieter Verfaillie -Date: Tue Dec 14 12:24:41 2010 +0100 - - dsextras.py: use distutils.spawn.find_executable for have_pkgconfig() - - dsextras.py | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -commit 020d00bc0ce7b77006b4d4f42d63122d79bcbf89 -Author: Dieter Verfaillie -Date: Tue Dec 14 12:22:54 2010 +0100 - - setup.py: fix another case of use True/False instead of 1/0 - - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b03cc9e0d66d8caea3cd6a63db198c43de9267e9 -Author: Paolo Borelli -Date: Mon Dec 13 10:21:52 2010 +0100 - - pygi-convert.sh: improve GtkSourceView conversion - - pygi-convert.sh | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit fbc12cd7c09a67de9e28b7b0b28de9dc0e0e3418 -Author: Paolo Borelli -Date: Mon Dec 13 10:27:56 2010 +0100 - - pygi-convert.sh: Gtk.DialogFlags conversion - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 73e933d2429aea4d14e15350a538da1c5c3f71eb -Author: José Alburquerque -Date: Sun Dec 12 20:38:46 2010 -0500 - - Doc Extractor: Print the gtk-doc blocks sorted by function name. - - * codegen/docextract_to_xml.py: Print the xml of the gtk-doc - block in - alphabetical order according to the identifier (function name) - so that - the generation of xml files in the C++ bindings is deterministic. - Thanks to Krzesimir Nowak for suggesting this in a gtksourceviewmm - recent commit. - - codegen/docextract_to_xml.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit db7ffa75b007074cb6b33b547c6d8140da300a3e -Author: Paolo Borelli -Date: Mon Dec 13 00:17:26 2010 +0100 - - pygi-convert.sh: add more Gtk conversions and sort - - pygi-convert.sh | 50 ++++++++++++++++++++++++++------------------------ - 1 file changed, 26 insertions(+), 24 deletions(-) - -commit f4bfe73d0ccedf7f671d3acd6d9e262d5383b733 -Author: Paolo Borelli -Date: Mon Dec 13 00:01:40 2010 +0100 - - pygi-convert.sh: convert Atk - - pygi-convert.sh | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -commit e55ce3667eb1d352bf96f265bf018ffe8aea75f9 -Author: Paolo Borelli -Date: Sun Dec 12 23:48:48 2010 +0100 - - pygi-convert.sh: convert a few more Gio types - - pygi-convert.sh | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit acc9f84bc6e13d76c6516cefe393d4a4f868aa24 -Author: Paolo Borelli -Date: Sun Dec 12 14:19:00 2010 +0100 - - pygi-convert.sh: more GLib conversion - - pygi-convert.sh | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit c903390814bebdc62d530472f6f94feecc59b8b3 -Author: Paolo Borelli -Date: Sun Dec 12 14:00:34 2010 +0100 - - pygi-convert.sh: remove two cases handled by overrides - - pygi-convert.sh | 2 -- - 1 file changed, 2 deletions(-) - -commit d33c987e505ec8ddffa2b8cb5526f05b9b5f62be -Author: Paolo Borelli -Date: Sun Dec 12 13:38:56 2010 +0100 - - Override Gtk.ScrolledWindow constructor - - gi/overrides/Gtk.py | 7 +++++++ - tests/test_overrides.py | 7 +++++++ - 2 files changed, 14 insertions(+) - -commit 1c24bb089fcd69e3104ae72a0e7560a8c5a3f05b -Author: Paolo Borelli -Date: Sun Dec 12 12:32:39 2010 +0100 - - pygi-convert.sh: Fix 'find' syntax - - pygi-convert.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f0a1d6b6bb53d0fa2788d8b9027d737b0aef8dfc -Author: Paolo Borelli -Date: Sun Dec 12 12:29:38 2010 +0100 - - pygi-convert.sh: start handling Gio and GLib - - pygi-convert.sh | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit 365bf3251af3498dc797a58cce071805451b49b1 -Author: Paolo Borelli -Date: Sat Dec 11 23:05:31 2010 +0100 - - pygi-convert.sh: convert Gdk.ScrollDirection. - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit bca603de0f217fb290189a0ea330f82961c46d5d -Author: Paolo Borelli -Date: Sat Dec 11 15:03:21 2010 +0100 - - Override Pango.Layout constructor. - - I must take a Pango.Context argument. Unfortumately the context is - not a - gobject property so we need to jump through some oops. - - gi/overrides/Pango.py | 13 +++++++++++++ - tests/test_overrides.py | 6 ++++++ - 2 files changed, 19 insertions(+) - -commit df233301802e3f7f9ce338cde015ca2a2fc648ab -Author: Paolo Borelli -Date: Sat Dec 11 14:18:53 2010 +0100 - - Remove Pango.FontDescription() conversion. - - It is now properly handled by an override. - - pygi-convert.sh | 1 - - 1 file changed, 1 deletion(-) - -commit d8abcc9463542af9cd43d71849d0ad4c183b570b -Author: Paolo Borelli -Date: Fri Dec 10 14:05:20 2010 +0100 - - Override GtkAction and GtkRadioAction constructors. - - gi/overrides/Gtk.py | 20 +++++++++++++++++--- - tests/test_overrides.py | 18 ++++++++++++++++++ - 2 files changed, 35 insertions(+), 3 deletions(-) - -commit 7924b18a99a0680c04aca46be4b64a7aa507dfe5 -Author: Dmitrijs Ledkovs -Date: Sat Dec 4 22:13:28 2010 +0000 - - Override Adjustment constructor to behave like pygtk - - https://bugzilla.gnome.org/show_bug.cgi?id=636486 - - gi/overrides/Gtk.py | 7 +++++++ - tests/test_overrides.py | 9 +++++++++ - 2 files changed, 16 insertions(+) - -commit e76352dd83c8706e68ad57d00d185da9afea99c4 -Author: John (J5) Palmieri -Date: Thu Dec 9 13:23:10 2010 -0500 - - add secondary_text apis to MessageDialog - - gi/overrides/Gtk.py | 8 ++++++++ - tests/test_overrides.py | 8 ++++++++ - 2 files changed, 16 insertions(+) - -commit de682b2d36c362140ab7d43c0743b01ec0865a74 -Author: John (J5) Palmieri -Date: Wed Dec 8 16:39:27 2010 -0500 - - [gi] get rid of some debug prints and fix error messages - - gi/overrides/Gtk.py | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -commit dbb16571803bf51f497768bf80944514f4290ee5 -Author: Paolo Borelli -Date: Wed Dec 8 18:25:15 2010 +0100 - - Fix demo for override changes. - - demos/gtk-demo/gtk-demo.py | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -commit 2adcd95762944a4e27123093d3c8d080e49be1ea -Author: Paolo Borelli -Date: Wed Dec 8 18:06:01 2010 +0100 - - Override Pango.FontDescription. - - demos/gtk-demo/gtk-demo.py | 2 +- - gi/overrides/Makefile.am | 1 + - gi/overrides/Pango.py | 40 ++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides.py | 7 +++++++ - 4 files changed, 49 insertions(+), 1 deletion(-) - -commit 769da968c9187414d0420412d8fb8c833d12042a -Author: Tomeu Vizoso -Date: Wed Dec 8 17:38:11 2010 +0100 - - Stop checking that all vfuncs are implemented - - Because some methods are optionally implementable but g-i won't - tell us. - - https://bugzilla.gnome.org/show_bug.cgi?id=619606 - - gi/gimodule.c | 4 +++- - gi/types.py | 12 ++---------- - tests/test_gi.py | 10 ---------- - 3 files changed, 5 insertions(+), 21 deletions(-) - -commit 167a01c46b3fa0b3c8339502c875d32bd2bca974 -Author: Paolo Borelli -Date: Wed Dec 8 17:37:00 2010 +0100 - - Fix usage of TreeIter api that is now an override. - - demos/gtk-demo/gtk-demo.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit d2cfd6e9250d40de7c715ac74e299deddf137683 -Author: Paolo Borelli -Date: Wed Dec 8 17:34:54 2010 +0100 - - Fix Gtk.Label(label="Foo") - - Use 'label' as an argument name instead of 'str', otherwise we may - end up up with two 'label' in the kwds dict. Besides 'str' is a - reserved keyword. - - gi/overrides/Gtk.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit c0c684c9bb4e2bc08d7cb6ac246705e8a3b77656 -Author: Paolo Borelli -Date: Wed Dec 8 14:16:39 2010 +0100 - - Fix typo when raising an exception - - gi/types.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 88c9a3ad49d9fcf779c3523672d8bf4767910301 -Author: Sebastian Pölsterl -Date: Wed Dec 8 10:46:27 2010 +0100 - - pygi-convert.sh: Added more conversions - - pygi-convert.sh | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -commit 4d8d96326b2cac91e6d75e6601b92e202d1918ff -Author: Paolo Borelli -Date: Tue Dec 7 20:39:15 2010 +0100 - - Override LinkButton constructor to make 'uri' mandatory - - gi/overrides/Gtk.py | 7 +++++++ - tests/test_overrides.py | 6 ++++++ - 2 files changed, 13 insertions(+) - -commit f4f7fb35af1b41598dc050f5df155a01c370a920 -Author: Dmitry Morozov -Date: Sat Dec 4 19:19:19 2010 +0600 - - Container should be iterable. - - gi/overrides/Gtk.py | 9 +++++++++ - tests/test_overrides.py | 6 +++++- - 2 files changed, 14 insertions(+), 1 deletion(-) - -commit d2ad05d6d8d53b941e0ad33fcb200f1245a2d308 -Author: Paolo Borelli -Date: Tue Dec 7 14:13:00 2010 +0100 - - No need to import Gdk - - gi/overrides/Gtk.py | 1 - - 1 file changed, 1 deletion(-) - -commit b6a40badf0b2b59e690ce818efb03c7c816b8a04 -Author: Paolo Borelli -Date: Tue Dec 7 14:07:53 2010 +0100 - - Remove semicolumns - - gi/overrides/Gtk.py | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -commit cdc9c26553bf47ea488676e7bdc5f8ab0a2c906b -Author: John (J5) Palmieri -Date: Mon Dec 6 16:05:30 2010 -0500 - - [gi] make sure Gtk.Button override passes all keywords to parent - constructor - - gi/overrides/Gtk.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit cede81ad65db017e95543d8d35715751aa202fed -Author: Paolo Borelli -Date: Sun Dec 5 13:31:20 2010 +0100 - - Fix cut&paste error in the Label override - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 607c59b74ebbc1e39cb4121c870b689e1888c106 -Author: Paolo Borelli -Date: Sat Dec 4 16:03:27 2010 +0100 - - pygi-convert.sh: handle TextWindowType - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit dfeabe0b68938e27da2e65903983b5113dc422f1 -Author: Paolo Borelli -Date: Sat Dec 4 15:49:15 2010 +0100 - - Override Label constructor to behave like pygtk - - gi/overrides/Gtk.py | 7 +++++++ - tests/test_overrides.py | 4 ++++ - 2 files changed, 11 insertions(+) - -commit da4e045e5abbed2796cc4ed39df35a0dde2de31b -Author: Paolo Borelli -Date: Sat Dec 4 15:40:35 2010 +0100 - - Override GtkTable constructor to behave like pygtk - - gi/overrides/Gtk.py | 7 +++++++ - tests/test_overrides.py | 12 ++++++++++++ - 2 files changed, 19 insertions(+) - -commit 81452c23ab1befa59ff375692e582791432796a5 -Author: Paolo Borelli -Date: Sat Dec 4 12:59:43 2010 +0100 - - pygi-convert.sh: convert MovementStep - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 4d097eea94258eda0c328711491fd456cbd6741b -Author: Paolo Borelli -Date: Sat Dec 4 11:57:02 2010 +0100 - - Update Gdk overrides to work with latest Gtk+ 3 - - For now added consitionals on version == 2.0, but maybe at some - point we - shuld just clean up the old stuff. - - gi/overrides/Gdk.py | 22 ++++++++++++++++------ - 1 file changed, 16 insertions(+), 6 deletions(-) - -commit cda317195566711d66190145b545e26ed7226172 -Author: Johan Dahlin -Date: Thu Dec 2 23:47:40 2010 -0200 - - Gtk: add an override for Gtk.main_quit - - Override gtk.main_quit so that it can be used as a callback - to signals, most importantly to the destroy signal of a widget: - - widget.connect('destroy', gtk.main_quit) - - This is compatible with what PyGTK does. - - https://bugzilla.gnome.org/show_bug.cgi?id=636336 - - gi/overrides/Gtk.py | 5 ++++- - gi/overrides/__init__.py | 27 +++++++++++++++++++++++++-- - 2 files changed, 29 insertions(+), 3 deletions(-) - -commit 82689cbf53d92b1b951a459fe3de0e1d3a91791a -Author: John (J5) Palmieri -Date: Thu Dec 2 16:27:04 2010 -0500 - - [gi] handle subtypes when inserting into tree models - - * Often modules will give back basic types wrapped in a subtype. - This is the case with D-Bus where you may want to keep some of the - metadata around. More often than not, the developer is just looking - to use the basetype. - - * This override checks the column type and handles basic types such as - gchararrays, ints, longs, floats and doubles, converting them - to their - base types before sending them to the generic GI type marshaller. - - * More types may need to be supported but these are the common - cases where - apps break. - - https://bugzilla.gnome.org/show_bug.cgi?id=635172 - - gi/overrides/Gtk.py | 38 ++++++++++++++++++++++++++++++++++++-- - tests/test_overrides.py | 8 +++++++- - 2 files changed, 43 insertions(+), 3 deletions(-) - -commit 677490e9402bad7b7c2a832345ef54f7f0c5fc7f -Author: Paolo Borelli -Date: Fri Dec 3 23:39:50 2010 +0100 - - Override TreeSelection.select_path and TreeView.scroll_to_cell - - The "path" argument may also be a string or a tuple - - gi/overrides/Gtk.py | 10 ++++++++++ - tests/test_overrides.py | 29 +++++++++++++++++++++++++++++ - 2 files changed, 39 insertions(+) - -commit dacfe618fa244445c979f1a5efa80c1f9a5a4ae9 -Author: Paolo Borelli -Date: Fri Dec 3 23:29:00 2010 +0100 - - Override TreePath.__new__ - - Instead of having a private _tree_path_from_string it is cleaner to - override __new__ and it will be useful for all the api that take a - TreePath or a string or a tuple. - - gi/overrides/Gtk.py | 33 +++++++++++++++------------------ - tests/test_overrides.py | 18 ++++++++++++++++++ - 2 files changed, 33 insertions(+), 18 deletions(-) - -commit 7a8af9e220ee48aa28f6b025c5dae324b14fe128 -Author: Paolo Borelli -Date: Sun Nov 28 13:02:30 2010 +0100 - - Override Container to behave like a sequence - - gi/overrides/Gtk.py | 6 ++++++ - tests/test_overrides.py | 11 +++++++++++ - 2 files changed, 17 insertions(+) - -commit 94e8befc935d4a6c7f766e34195e10fc3fb3b93a -Author: John (J5) Palmieri -Date: Tue Nov 30 16:57:05 2010 -0500 - - refactor Jonathan Matthew recurse vfunc patch so it applys and clean - up a bit - - * this patch does the recursion using the previous patche's support - functions - - gi/types.py | 55 +++++++++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 45 insertions(+), 10 deletions(-) - -commit 9c5aee4f06f92457f9ae987656c0c469f76d0ee8 -Author: Jonathan Matthew -Date: Thu Jul 22 23:19:51 2010 +1000 - - Recurse up through base classes when setting up vfuncs - - * this patch adds the support methods to do the recursion - - https://bugzilla.gnome.org/show_bug.cgi?id=625033 - - gi/gimodule.c | 130 - ++++++++++++++++++++++++++++++++++++++++--------------- - tests/test_gi.py | 37 ++++++++++++++++ - 2 files changed, 131 insertions(+), 36 deletions(-) - -commit 78358e1ab54d02317f397276adee03ecb2187588 -Author: John (J5) Palmieri -Date: Mon Nov 29 18:29:57 2010 -0500 - - add a profiling torture test for when we fix up invoke - - tests/test_everything.py | 67 - ++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 67 insertions(+) - -commit 792e679c06df4357843fd310c7953a931172fc99 -Author: John (J5) Palmieri -Date: Mon Nov 29 16:41:38 2010 -0500 - - moved dynamic and base modules outside of gtk-2.0 directory - - * do not move header files yet as they are mostly used by static - bindings - * do not remove pygtk.pth and pygtk.py files yet - there is a debate - on moving - these back to pygtk but you might want to import gio static - bindings without - having to have pygtk installed - * I have not tested this with pygtk, committing it so we can find - out if it - causes any issues with legacy modules and code - - gi/Makefile.am | 2 +- - gi/overrides/Makefile.am | 2 +- - gi/repository/Makefile.am | 2 +- - glib/Makefile.am | 2 +- - gobject/Makefile.am | 2 +- - tests/test_gi.py | 2 -- - tests/test_overrides.py | 3 --- - 7 files changed, 5 insertions(+), 10 deletions(-) - -commit c587e1ace7429195ac6fd4db03d2f33e2af09838 -Author: John (J5) Palmieri -Date: Mon Nov 29 15:11:46 2010 -0500 - - add test for inout argument count - - tests/test_gi.py | 1 + - 1 file changed, 1 insertion(+) - -commit 5de88b4bcffdafcf8c7c20033cdf95dc690199ce -Author: John (J5) Palmieri -Date: Mon Nov 22 19:17:23 2010 -0500 - - [gi] add check for UNICHAR - - https://bugzilla.gnome.org/show_bug.cgi?id=623615 - - gi/pygi-argument.c | 27 ++++++++++++++++++++++++++- - tests/test_everything.py | 17 +++++++++++++++-- - 2 files changed, 41 insertions(+), 3 deletions(-) - -commit f129b3db2c78d3cce3614993fdd1619fb9eb9c79 -Author: Paolo Borelli -Date: Sun Nov 21 12:16:53 2010 +0100 - - Support gunichar - - https://bugzilla.gnome.org/show_bug.cgi?id=623615 - - gi/pygi-argument.c | 60 - ++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-info.c | 5 ++++ - tests/test_everything.py | 5 ++++ - 3 files changed, 70 insertions(+) - -commit fd2c0288eb67823fca1265348a27a9f8f147ae50 -Author: Paolo Borelli -Date: Sat Nov 27 23:01:42 2010 +0100 - - pygi-convert.sh: gtk.accel_map -> Gtk.AccelMap._ - - pygi-convert.sh | 1 + - 1 file changed, 1 insertion(+) - -commit 13d0ff1d9c129bb458e234b630ebe920b50e2e0f -Author: Paolo Borelli -Date: Sat Nov 27 22:34:13 2010 +0100 - - pygi-convert.sh: handle "from gtk import gdk" - - pygi-convert.sh | 2 ++ - 1 file changed, 2 insertions(+) - -commit 63a97634031c3d159ad77fdaa1f6341d7656eb07 -Author: Paolo Borelli -Date: Sat Nov 27 22:23:24 2010 +0100 - - pygi-convert.sh: add some Pango special cases - - pygi-convert.sh | 3 +++ - 1 file changed, 3 insertions(+) - -commit 57e42bf4230d1aa20a47e3b0df2e509602333892 -Author: Paolo Borelli -Date: Sat Nov 27 19:51:38 2010 +0100 - - Override TextIter (begins|ends|toggles)_tag() - - Make the tag argument optional. - - gi/overrides/Gtk.py | 9 +++++++++ - tests/test_overrides.py | 17 +++++++++++++++++ - 2 files changed, 26 insertions(+) - -commit 828b698e47ee819a60d24a772a3cc51ff9cd6601 -Author: Paolo Borelli -Date: Sat Nov 27 19:32:48 2010 +0100 - - Override TextBuffer.set_text() to make length optional - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 11 ++++++++++- - 2 files changed, 13 insertions(+), 1 deletion(-) - -commit bf55dc862755a57bb1b998702d284fc460e88a30 -Author: Paolo Borelli -Date: Sat Nov 27 16:46:40 2010 +0100 - - Override TextBuffer.create_mark() - - Override create_mark to make the left_gravity argument optional - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 3 +++ - 2 files changed, 6 insertions(+) - -commit 94c0e2f71636d055bdebe3ec378f3d339eea66c9 -Author: Paolo Borelli -Date: Sat Nov 27 16:10:33 2010 +0100 - - Fix TextBuffer.get_selection_bounds() override - - Fix the override and add unit test - - gi/overrides/Gtk.py | 8 +++++--- - tests/test_overrides.py | 7 +++++++ - 2 files changed, 12 insertions(+), 3 deletions(-) - -commit 0cd717e3926276540b9145e58a4a3368136b00de -Author: John (J5) Palmieri -Date: Mon Nov 22 18:35:09 2010 -0500 - - [gi] fix ActionGroup constructor to allow other keyword properties - to be set - - gi/overrides/Gtk.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 226777cdb70fc72d206664ffd8b6737f7239d23f -Author: John (J5) Palmieri -Date: Mon Nov 22 18:32:28 2010 -0500 - - [gi] require the name parameter when creatin a Gtk.ActionGroup - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 2 ++ - 2 files changed, 5 insertions(+) - -commit d0049fa9982d13b3553b05569fb0a227e48b6647 -Author: Paolo Borelli -Date: Sun Nov 21 15:20:58 2010 +0100 - - Override UIManager.insert_action_group - - https://bugzilla.gnome.org/show_bug.cgi?id=635437 - - gi/overrides/Gtk.py | 3 +++ - tests/test_overrides.py | 34 +++++++++++++++++++++------------- - 2 files changed, 24 insertions(+), 13 deletions(-) - -commit e1db544e46aeed984133896af34b671a6a5547df -Author: Paolo Borelli -Date: Sun Nov 21 23:03:25 2010 +0100 - - Override TreeModel.get() to return a tuple - - https://bugzilla.gnome.org/show_bug.cgi?id=635466 - - gi/overrides/Gtk.py | 15 +++++++++++++++ - tests/test_overrides.py | 6 ++++++ - 2 files changed, 21 insertions(+) - -commit a5e806ad8a8b279402ff7adb1c1cdc04f9f3da76 -Author: Paolo Borelli -Date: Sun Nov 21 21:57:40 2010 +0100 - - Make TreeSelection.get_selected_rows compatible with PyGtk - - https://bugzilla.gnome.org/show_bug.cgi?id=635464 - - gi/overrides/Gtk.py | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit 1c537bc67107948c92b51ba6ba749747e84263e2 -Author: John (J5) Palmieri -Date: Mon Nov 22 15:04:00 2010 -0500 - - [gi] switch to using sequences/tuples when marshalling - cairo_rectangle_int_t - - * Upstream pycairo didn't want to add a new wrapper for - cairo_rectangle_int_t - * this works around that issue by using 4 element squences instead - which - should be accepted by pycairo for any API that takes a rect - - gi/pygi-foreign-cairo.c | 85 - +++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 64 insertions(+), 21 deletions(-) - -commit 4cede8f12321bed6c3b71813a62c01b61853ba69 -Author: John (J5) Palmieri -Date: Fri Nov 19 16:46:53 2010 -0500 - - [gi] overrides for treeview Drag and Drop - - https://bugzilla.gnome.org/show_bug.cgi?id=627367 - - gi/overrides/Gdk.py | 7 +++++++ - gi/overrides/Gtk.py | 25 +++++++++++++++++++++++++ - 2 files changed, 32 insertions(+) - -commit 3fd51bb903724b752f72f49c7cb35652b819791d -Author: John (J5) Palmieri -Date: Fri Nov 19 16:44:32 2010 -0500 - - [gi] when encountering guint8 arrays treat them as byte arrays - - * In Python 2 this means returning a PyString object - * In Python 3 we return a PyBytes object - - https://bugzilla.gnome.org/show_bug.cgi?id=627367 - - gi/pygi-argument.c | 65 - ++++++++++++++++++++++++++++++++++++++++++++---------- - tests/test_gi.py | 6 +++-- - 2 files changed, 57 insertions(+), 14 deletions(-) - -commit 7ddb0f7fd8b1b9e8f691c6d42a83cb16c6561d26 -Author: Martin Pitt -Date: Fri Nov 19 18:19:38 2010 +0100 - - pygi-convert.sh: Add pynotify -> Notify - - pygi-convert.sh | 3 +++ - 1 file changed, 3 insertions(+) - -commit bf03d4db03a7739ac16ddc4e614441557ede554d -Author: Martin Pitt -Date: Fri Nov 19 09:08:07 2010 +0100 - - pygi-convert.sh: Remove sugar specifics, and allow command line - file list - - This script is generally useful for converting pygtk2 projects, - not just for - sugar. Remove the sugar specific bits, since they will just cause - errors. - - Also allow the user to specify the files to convert as command line - arguments. If not given, all *.py files will be processed. - - https://bugzilla.gnome.org/show_bug.cgi?id=635244 - - pygi-convert.sh | 25 +++++-------------------- - 1 file changed, 5 insertions(+), 20 deletions(-) - -commit 18f5d229d3a4b9520c1c456be2635c8e36015c12 -Author: Martin Pitt -Date: Fri Nov 19 09:00:35 2010 +0100 - - pygi-convert.sh: Cover Message and Buttons types - - https://bugzilla.gnome.org/show_bug.cgi?id=635244 - - pygi-convert.sh | 2 ++ - 1 file changed, 2 insertions(+) - -commit ef74273c2043944708515e59a654ebe4944b46ff -Author: John (J5) Palmieri -Date: Thu Nov 18 13:54:48 2010 -0500 - - [gi] fix actiongroup test since actions are hashed - - * when actions are listed they may not show up in the order they - were entered - since they reside in an unordered hash internally - - tests/test_overrides.py | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -commit 2c25886bf6710568d0646f82dce4770faa44c40d -Author: John (J5) Palmieri -Date: Wed Nov 17 14:38:09 2010 -0500 - - [gi] when converting to UTF-8 accept Python Unicode objects as input - (Python 2) - - https://bugzilla.gnome.org/show_bug.cgi?id=620579 - - gi/pygi-argument.c | 14 ++++++++++++-- - glib/pyglib-python-compat.h | 5 +++++ - tests/test_gi.py | 3 +++ - 3 files changed, 20 insertions(+), 2 deletions(-) - -commit 8c2d32c8205b971b4353e3d5d2ed1efa6ef0e06c -Author: Damien Caliste -Date: Fri Nov 12 10:20:32 2010 +0100 - - Correct a bug in the freeing of memory in pygi-invoke.c. - - When a method with inout arguments is called from Python with - a wrong number of arguments, the system crashs because of an - assertion fail. This patch corrects this behaviour. - - https://bugzilla.gnome.org/show_bug.cgi?id=634671 - - gi/pygi-invoke.c | 25 ++++++++++++++----------- - 1 file changed, 14 insertions(+), 11 deletions(-) - -commit d9bab3b185bb59bd29e3c3f6225f3636f58ec45e -Author: John (J5) Palmieri -Date: Wed Nov 10 14:11:56 2010 -0500 - - update news for release - - NEWS | 73 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 73 insertions(+) - -commit 1338a95339e21cc02b9df6d10166996c8b97a6bf -Author: Jonathan Matthew -Date: Tue Sep 28 13:44:13 2010 +1000 - - Implement richcompare for GIBaseInfo - - https://bugzilla.gnome.org/show_bug.cgi?id=625033 - - gi/pygi-info.c | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - -commit 9ce3edf69824935aeca9e676eaa9782786c22a97 -Author: John (J5) Palmieri -Date: Tue Nov 9 22:57:41 2010 -0500 - - [gi] add the rectangle_int_t forign cairo type - - * the pycairo maintainer is not being responsive so you will need - the patch at - https://bugs.freedesktop.org/show_bug.cgi?id=31111 - * added conditionals, if the api doesn't exist in PyCairo we will - compile - without the forign structs - - gi/pygi-foreign-cairo.c | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 68b8211d8b014cf26ca7e9ab751fb3f61f228290 -Author: John (J5) Palmieri -Date: Mon Oct 25 18:28:36 2010 -0400 - - add a foreign type for cairo_rectangle_int_t and allow it to be - caller-allocated - - * this is needed because Gdk and Gtk switched from returning a - GdkRectangle - to a CairoRectangleInt structure - * the patch in https://bugs.freedesktop.org/show_bug.cgi?id=31111 - is required - for pycairo (however there is currently no patch for python 2) - * added fix for foreign types to allow them to be caller allocated - * in order for a type to be caller allocated it must be able to take - a NULL - and create an empty struct in foreign_struct_from_arg and it must - be able - to handle GI_TRANFER_EVERYTHING in foreign_struct_to_arg. - - https://bugzilla.gnome.org/show_bug.cgi?id=627545 - - gi/pygi-foreign-cairo.c | 57 - +++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-invoke.c | 15 +++++++++++-- - 2 files changed, 70 insertions(+), 2 deletions(-) - -commit ce8b948310220288e9eef904eef4ec8f4e24a376 -Author: John (J5) Palmieri -Date: Tue Nov 9 22:11:51 2010 -0500 - - [gi] add overrides to Gtk.Editable - - gi/overrides/Gtk.py | 17 +++++++++++++++++ - tests/test_overrides.py | 12 ++++++++++++ - 2 files changed, 29 insertions(+) - -commit 87dbc716f26cefc0e9427c3d6e8befe8eabd3d1e -Author: John (J5) Palmieri -Date: Tue Nov 9 21:12:54 2010 -0500 - - [gi] handle virtual invokers - - * right now we check to see if there is an method with the same name - as the virtual method and assume that is the invoker - * some invokers are named different so we now ask the VFuncInfo if - the vfunc has an invoker - * this is still not completly correct, gi needs to support telling - us which vfuncs must be overridden. - * this keeps the old way of checking vfuncs while adding the edge case - where vfunc is named differently from their invoker - - gi/pygi-info.c | 16 ++++++++++++++++ - gi/types.py | 2 +- - 2 files changed, 17 insertions(+), 1 deletion(-) - -commit 540e9f1f349ba3625e28b7673c92210eb8974098 -Author: John (J5) Palmieri -Date: Tue Nov 9 12:17:05 2010 -0500 - - add overrides for the insert* apis of list_store and tree_store - - * add set_row to tree_model as convinience method for both list and - tree stores - - https://bugzilla.gnome.org/show_bug.cgi?id=634423 - - gi/overrides/Gtk.py | 80 - ++++++++++++++++++++++++++++++++++++++----------- - tests/test_overrides.py | 53 +++++++++++++++++++++++++++++++- - 2 files changed, 114 insertions(+), 19 deletions(-) - -commit 0bcb58b9541d9ae52e1d96e6239e9dbe0698872a -Author: John (J5) Palmieri -Date: Fri Nov 5 13:56:12 2010 -0400 - - fix dialogs overrides which were relying on broken inheritance - behavior - - gi/overrides/Gtk.py | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - -commit 89c104d17d79d7b935cd76101cba19d49390f7be -Author: John (J5) Palmieri -Date: Thu Nov 4 12:00:14 2010 -0400 - - Add a overrides registry so we can refrence overrides inside the - module - - * Overrides have a reentrancy issue when doing inheritance. If an - override - inherits from another override down the stack it won't see the - override - because the module is not finished loading and will inherit from the - non-overriden object instead. This causes type errors later. - * By adding the overrides to a registry outside of the module we - can order - registration and make the override available as soon as the class - is parsed, - not when the whole module is parsed. - - https://bugzilla.gnome.org/show_bug.cgi?id=633347 - - gi/module.py | 12 ++++++++++- - gi/overrides/GIMarshallingTests.py | 2 +- - gi/overrides/Gdk.py | 2 +- - gi/overrides/Gtk.py | 2 +- - gi/overrides/__init__.py | 43 - ++++++++++++++++++++++++++++++++++++++ - gi/types.py | 8 ------- - tests/test_overrides.py | 27 ++++++++++++++++++++++++ - 7 files changed, 84 insertions(+), 12 deletions(-) - -commit 878b8f630acd2146bee364054acd45cd33eea37a -Merge: cdacaa9 e317838 -Author: John Stowers -Date: Fri Nov 5 11:40:22 2010 +1300 - - Merge remote branch 'dieterv/setup-fixes-for-merge' - -commit e317838178fba5f0590fb8bd323f49602d564b53 -Author: Dieter Verfaillie -Date: Thu Nov 4 11:16:43 2010 +0100 - - setup.py: ease maintenance burden for tests installation - - setup.py | 23 +++-------------------- - 1 file changed, 3 insertions(+), 20 deletions(-) - -commit cdacaa9572893796e0f3aa3730d0191911cb29ee -Author: John (J5) Palmieri -Date: Wed Nov 3 09:51:09 2010 -0400 - - fix inheritence issues in overrides - - gi/overrides/Gtk.py | 79 - +++++++++++++++++++++++++++-------------------------- - 1 file changed, 40 insertions(+), 39 deletions(-) - -commit 3d5955767d81f45e796ab2af0707533375681774 -Author: Dieter Verfaillie -Date: Wed Nov 3 09:38:56 2010 +0100 - - tests: add runtests-windows.py script - - Signed-off-by: Dieter Verfaillie - - tests/runtests-windows.py | 47 - +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 47 insertions(+) - -commit 8cb3f2e78161639c568110aad6a807dcf59f3ae8 -Author: Dieter Verfaillie -Date: Wed Nov 3 09:35:52 2010 +0100 - - pygobject_postinstall.py: remove pygobject-2.0.pc treatment from - postinstall as pkg-config on windows figures out the correct prefix - at runtime - - Signed-off-by: Dieter Verfaillie - - pygobject_postinstall.py | 26 +++----------------------- - 1 file changed, 3 insertions(+), 23 deletions(-) - -commit 63167574df53eb481cc11b6a097b2bfe7d5747f5 -Author: Dieter Verfaillie -Date: Wed Nov 3 09:34:38 2010 +0100 - - pygobject_postinstall.py: remove shortcut creation - - Signed-off-by: Dieter Verfaillie - - pygobject_postinstall.py | 35 +---------------------------------- - 1 file changed, 1 insertion(+), 34 deletions(-) - -commit f7b12611f94fd8c27fb67a03746c10149ce6e0ef -Author: Dieter Verfaillie -Date: Wed Nov 3 09:31:14 2010 +0100 - - setup.py: formatting cleanup, makes things readable - - Signed-off-by: Dieter Verfaillie - - setup.py | 56 ++++++++++++++++++++++++++------------------------------ - 1 file changed, 26 insertions(+), 30 deletions(-) - -commit a31b4196fbb4638a245430f2fdeafd7534b1d84d -Author: Dieter Verfaillie -Date: Wed Nov 3 09:28:36 2010 +0100 - - setup.py: build and install tests - - Signed-off-by: Dieter Verfaillie - - setup.py | 61 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 61 insertions(+) - -commit 7c3b0c20b83c05833d73c240690dce3daf43fde8 -Author: Dieter Verfaillie -Date: Wed Nov 3 09:26:59 2010 +0100 - - setup.py: install documentation when available on build system - - Signed-off-by: Dieter Verfaillie - - setup.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit 78533d851ee1314686f18cfa793613a9cf7d6686 -Author: Dieter Verfaillie -Date: Wed Nov 3 09:25:56 2010 +0100 - - setup.py: install pygobject-codegen script - - Signed-off-by: Dieter Verfaillie - - setup.py | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - -commit ad40688df533dda0b1f7be8ea37c542b8796a26b -Author: Dieter Verfaillie -Date: Wed Nov 3 09:24:45 2010 +0100 - - setup.py: install fixxref.py script - - Signed-off-by: Dieter Verfaillie - - setup.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit 21ddfc66e4e18c002a33154eb4ab81170ed71ecc -Author: Dieter Verfaillie -Date: Wed Nov 3 09:23:05 2010 +0100 - - setup.py: rearrange constants - - Signed-off-by: Dieter Verfaillie - - setup.py | 37 ++++++++++++++++++++----------------- - 1 file changed, 20 insertions(+), 17 deletions(-) - -commit 7d353d04892de67265bf693f591f37fd393de639 -Author: Dieter Verfaillie -Date: Wed Nov 3 09:18:11 2010 +0100 - - setup.py: check python version and pkgconig availability before - anything else - - Signed-off-by: Dieter Verfaillie - - setup.py | 18 ++++++++++-------- - 1 file changed, 10 insertions(+), 8 deletions(-) - -commit 286364ed39953e942e24d5911519bcac2f90975a -Author: Dieter Verfaillie -Date: Wed Nov 3 09:05:59 2010 +0100 - - setup.py: simplify sys.platform != 'win32' detection and error - reporting - - Signed-off-by: Dieter Verfaillie - - setup.py | 29 +++++++++-------------------- - 1 file changed, 9 insertions(+), 20 deletions(-) - -commit 3f70f92904c123e6cc40929c0affd3f75d061828 -Author: Dieter Verfaillie -Date: Wed Nov 3 09:02:30 2010 +0100 - - setup.py: rearrange imports - - Signed-off-by: Dieter Verfaillie - - setup.py | 31 ++++++++++++++++++++++--------- - 1 file changed, 22 insertions(+), 9 deletions(-) - -commit 9aa54b65f729c0f3b0e96ab7ff797f87dad6a455 -Author: Dieter Verfaillie -Date: Wed Nov 3 08:58:00 2010 +0100 - - README.win32: update build instructions - - Signed-off-by: Dieter Verfaillie - - README.win32 | 13 +++++-------- - 1 file changed, 5 insertions(+), 8 deletions(-) - -commit 5a33105f690ba84b2e4bb15d73d3467e92fa06e0 -Author: Dieter Verfaillie -Date: Wed Nov 3 07:59:18 2010 +0100 - - dsextras.py: formatting cleanup, makes things readable - - Signed-off-by: Dieter Verfaillie - - dsextras.py | 148 - ++++++++++++++++++++++++++++++++++++++---------------------- - 1 file changed, 93 insertions(+), 55 deletions(-) - -commit d03503d0412d173acb383926ab3c2d640dad3e3f -Author: Dieter Verfaillie -Date: Wed Nov 3 07:00:40 2010 +0100 - - dsextras.py: add ggc4 to MSVC compatible struct packing comment - - Signed-off-by: Dieter Verfaillie - - dsextras.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 8c62968e9f8467e24870b8c4f61112676eef4630 -Author: Dieter Verfaillie -Date: Wed Nov 3 06:56:32 2010 +0100 - - dsextras.py: use the pkgc_ functions instead of repeating pgk-config - incantations all over the place - - Signed-off-by: Dieter Verfaillie - - dsextras.py | 15 ++++++--------- - 1 file changed, 6 insertions(+), 9 deletions(-) - -commit b98277afc24886bbda400e0ad360992bffa77b7c -Author: Dieter Verfaillie -Date: Wed Nov 3 06:49:48 2010 +0100 - - dsextras.py: add pkgc_get_version and pkgc_get_defs_dir functions - - Signed-off-by: Dieter Verfaillie - - dsextras.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit a565558652ebc3fa49d7aea40d399b06bbe376c4 -Author: Dieter Verfaillie -Date: Wed Nov 3 06:45:05 2010 +0100 - - dsextras.py: PEP8: Comparisons to singletons like None should always - be done with 'is' or 'is not', never the equality operators. - - Signed-off-by: Dieter Verfaillie - - dsextras.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 4b1ff0c7f9953f925d2178069263cca67ca7db02 -Author: Dieter Verfaillie -Date: Wed Nov 3 06:44:21 2010 +0100 - - dsextras.py: use True/False instead of 1/0 - - Signed-off-by: Dieter Verfaillie - - dsextras.py | 25 +++++++++++++------------ - 1 file changed, 13 insertions(+), 12 deletions(-) - -commit 819a21cea831c3892040390e9446b78a91d1cbbe -Author: Dieter Verfaillie -Date: Wed Nov 3 06:28:04 2010 +0100 - - dsextras.py: rearrange imports - - Signed-off-by: Dieter Verfaillie - - dsextras.py | 58 - +++++++++++++++++++++++++++++++--------------------------- - 1 file changed, 31 insertions(+), 27 deletions(-) - -commit d20edbfdde2819f8d4fee8cb3170c126fcd31d5f -Author: Dieter Verfaillie -Date: Wed Nov 3 06:16:21 2010 +0100 - - Add distutils generated build/dist directories and eclipse - configuration files to .gitignore - - Signed-off-by: Dieter Verfaillie - - .gitignore | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 268d6ed2b0b1d266c612da4453b6117d9e14437e -Author: John (J5) Palmieri -Date: Thu Oct 28 15:32:28 2010 -0400 - - [gi] add tests for calling dir on a dynamic module - - tests/test_gi.py | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -commit f6386a6e0d225c83cdbe1add4c4d3ea51d3ec2f0 -Author: Deepankar Sharma -Date: Wed Oct 27 18:28:11 2010 -0400 - - [gi] dir() now works for modules - - https://bugzilla.gnome.org/show_bug.cgi?id=625093 - - gi/module.py | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit 28ed01c34c503cfb4f14fe7af7912060ca70aba6 -Author: Simón Pena -Date: Mon Sep 20 23:10:14 2010 +0200 - - Don't check the inner type when comparing gpointers - - When using pyg_pointer_richcompare to compare two objects, - don't check their inner types. As we can't compare their private - fields, nor get a proper compare function, we can consider them - gpointers and compare them that way. - - https://bugzilla.gnome.org/show_bug.cgi?id=629552 - - gobject/pygpointer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 1731f89e4b5a20c33976963e12a1f39a21d33fde -Author: John (J5) Palmieri -Date: Thu Oct 28 14:21:12 2010 -0400 - - Release GIL when calling into C functions - - Author: Daniel P. Berrange - - https://bugzilla.gnome.org/show_bug.cgi?id=629042 - - gi/pygi-invoke.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -commit 783e2e351ec7470bda6b441e51f387dd61543c4b -Author: José Aliste -Date: Fri Oct 15 14:30:10 2010 -0300 - - _gi.Repository : Implement missing info bindings. - - https://bugzilla.gnome.org/show_bug.cgi?id=632185 - - gi/pygi-info.c | 91 - +++++++++++++++++++++++++++++++++++++++++++++++++--------- - gi/pygi-info.h | 7 +++++ - 2 files changed, 84 insertions(+), 14 deletions(-) - -commit 2ca897273f52ae38f5e06e72c773a048e199eee5 -Author: John (J5) Palmieri -Date: Thu Oct 28 13:49:15 2010 -0400 - - include Python.h so that PY_VERSION_HEX gets defined - - gi/pygi-foreign-cairo.c | 1 + - 1 file changed, 1 insertion(+) - -commit 8b28b1d713df33931e255600ab98feda37a8e02a -Author: John (J5) Palmieri -Date: Thu Oct 28 13:47:34 2010 -0400 - - [gi] make overrides work for python 3.x protocols and alias for - python 2.x - - gi/overrides/Gtk.py | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -commit 3c09710d2f68af9c16ce39fd25656147656a486a -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:24:24 2010 +0200 - - Override Gtk.Widget.translate_coordinates to not return success value - - gi/overrides/Gtk.py | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -commit 9d4443b3de8c327d8645ddde0a7a6dc5b977d7b4 -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:22:36 2010 +0200 - - Override Gtk.TreeViewColumn.cell_get_position to not return success - value - - gi/overrides/Gtk.py | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 6679d39ace06294e98f9d6fc911ed6fb27656010 -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:21:36 2010 +0200 - - Override get_path_at_pos and get_dest_row_at_pos of Gtk.TreeView to - not return success value - - gi/overrides/Gtk.py | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 80b1b266fa68a5c67106871502017166628f71e4 -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:20:38 2010 +0200 - - Override Gtk.TreeSortable.get_sort_column_id to not return success - value - - gi/overrides/Gtk.py | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -commit 17cd0fb3a2d2ca0c6109c41727ba0b8c42217cd5 -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:19:20 2010 +0200 - - Override forward_search and backward_search of Gtk.TextIter to not - return success value - - gi/overrides/Gtk.py | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -commit 95c86fa31da3d2fe84db0e2b5bc2a6dc896c9223 -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:18:09 2010 +0200 - - Override Gtk.TextBuffer.get_selection_bounds to not return success - value - - gi/overrides/Gtk.py | 5 +++++ - 1 file changed, 5 insertions(+) - -commit da6d87460b9392c29d025a7eed9249fb604204bc -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:17:04 2010 +0200 - - Override Gtk.RecentInfo.get_application_info to not return success - value - - gi/overrides/Gtk.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 0ed2e8772bdc405b0d0c7e0b2803e0e141abcb6a -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:16:21 2010 +0200 - - Override Gtk.IMContext.get_surrounding to not return success value - - gi/overrides/Gtk.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit b85b445f15421209c0b4adf676d7c8218d6437c5 -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:15:24 2010 +0200 - - Override get_item_at_pos, get_visible_range, get_dest_item_at_pos - of Gtk.IconView to not return success value - - gi/overrides/Gtk.py | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -commit 684d716192d58c972083e579e909bcd97f8a5025 -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:13:47 2010 +0200 - - Override Gtk.Container.get_focus_chain to not return success value - - gi/overrides/Gtk.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit 8ec830c57fafbfe50d9619c6caba3cb95a00d688 -Author: Sebastian Pölsterl -Date: Sat Oct 23 14:12:44 2010 +0200 - - Override Gtk.ComboBox.get_active_iter to not return success value - - gi/overrides/Gtk.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit b483852904468722230903989e3451c7c6a24c0f -Author: John (J5) Palmieri -Date: Tue Oct 12 12:18:33 2010 -0400 - - [gi] make parameter check less strict when dealing with GValue params - - * Some GValue API can store a pointer to a python object for later - use but our parameter checking was too strict to allow this - * Add pyg_type_from_object_strict API which takes a strict boolean and - returns PY_TYPE_OBJECT if no other GType can be found - * Since we don't have enough info to genrically check GValue - parameters - use the less strict type guessing when encountering a GValue param - * Other API stays the same and continues to do strict testing - - https://bugzilla.gnome.org/show_bug.cgi?id=622987 - - gi/pygi-argument.c | 17 ++++++--------- - gobject/gobjectmodule.c | 4 ++-- - gobject/pygobject-private.h | 1 + - gobject/pygobject.h | 2 ++ - gobject/pygtype.c | 37 +++++++++++++++++++++++++++++---- - tests/test_gi.py | 1 - - tests/test_overrides.py | 50 - +++++++++++++++++++++++++++++++++++++++++---- - 7 files changed, 90 insertions(+), 22 deletions(-) - -commit 8c87d622dcc6d76a981edfc5818fe67bb2e114e2 -Author: John Stowers -Date: Fri Oct 22 13:28:31 2010 +1300 - - Shortcut removal is not needed on post-uninstall - - pygobject_postinstall.py | 14 ++------------ - 1 file changed, 2 insertions(+), 12 deletions(-) - -commit a3ed97fe6f80548801739fe6b72771b9eb6d93f7 -Author: John Stowers -Date: Thu Oct 21 13:25:35 2010 +1300 - - Disable shortcut creation in windows installer - - pygobject_postinstall.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit a3d6212b0abccef58f05d454c091936776413d98 -Author: John (J5) Palmieri -Date: Thu Oct 7 11:43:27 2010 -0400 - - overrides for all subclasses of dialog - - https://bugzilla.gnome.org/show_bug.cgi?id=631634 - - gi/overrides/Gtk.py | 94 - +++++++++++++++++++++++++++++++++++++++++++++---- - tests/test_overrides.py | 64 ++++++++++++++++++++++++++++++++- - 2 files changed, 151 insertions(+), 7 deletions(-) - -commit a87e3ba64b54e6df0b5b96af47c34e3be790b58f -Author: Sebastian Pölsterl -Date: Thu Oct 7 19:37:53 2010 +0200 - - Make TreeModel behave like in GTK-2.x - - Moved stuff from __getitem__ to get_iter. - Added TreePath.__cmp__ - - get_iter_from_string throws ValueError. - iterchildren() does not return None. - - Adjusted tests to new TreeModel and added TestGtk.test_tree_model - method - - Added support for negative row and column indices - - Use rich comparison methods instead of __cmp__ - - Added TreeModel.__bool__/__nonzero__ - - Raise Error if tree path string is empty - - https://bugzilla.gnome.org/show_bug.cgi?id=631547 - - gi/overrides/Gtk.py | 195 - ++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides.py | 160 +++++++++++++++++++++++++++++++++++++-- - 2 files changed, 349 insertions(+), 6 deletions(-) - -commit acfcc29af727fb67d0dfbbcc7cc14963ef21f1ea -Author: John Stowers -Date: Sat Oct 16 18:59:25 2010 +1300 - - Correctly build GIO on windows - - setup.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 33b59fd7437009b6c3ed43412e171d2cc91ee317 -Author: John Stowers -Date: Sat Oct 16 18:17:28 2010 +1300 - - Require Python >= 2.6.0 for Windows build - - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 544e0e4de4f5f97b0584eaf72ae8a081eca28ab6 -Author: John Stowers -Date: Sat Oct 16 17:41:01 2010 +1300 - - Fix depreciation warning in dsextras.py - - dsextras.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 239ff961778e4e1587404d8a70dfbe8630ab0623 -Author: John Stowers -Date: Sat Oct 16 17:34:50 2010 +1300 - - Fix build on windows - - gi/pygi-foreign.c | 5 ++++- - gi/pygi.h | 5 ++++- - setup.py | 4 ++-- - 3 files changed, 10 insertions(+), 4 deletions(-) - -commit 9a2f81d63012fef23fdde2b4d903bd69601c07c6 -Author: Michael Culbertson -Date: Sat Oct 16 17:08:11 2010 +1300 - - Support for GCC4 in Windows distutils build - bug 626548 - - dsextras.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 27367c8dc3a3a31fdd778505b319cd3f4afb9e27 -Author: John Stowers -Date: Fri Oct 15 09:39:02 2010 +1300 - - Remove obsolete comments in dsextras.py - - dsextras.py | 11 ++--------- - 1 file changed, 2 insertions(+), 9 deletions(-) - -commit b5f383f854fb8f72677828b029589320c59006d1 -Author: John Stowers -Date: Fri Oct 15 09:21:03 2010 +1300 - - Broken dsextras.py pkg-config check error message - - * Fixes bug 631962 - - dsextras.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e1981da105b574e273ae6500fc6d25caf6af6aae -Author: John (J5) Palmieri -Date: Tue Sep 28 15:31:03 2010 -0400 - - add compat functions for the deprecated PyCObject api - - * Moved to using the PyCapsule API for python >= 3 - * PyCObject is removed from Python 3.2 - * It has also been deprecated in 2.7 but since we use the API in - header files - which are consumed by static binding modules, appling this for - python 2.7 - causes crashes unless the modules are recompiled, breaking ABI. - It is safe - to rely on for 2.7 because it will never be removed and there is - talk of - undeprecating it upstream. - * There is no issues with static bindings under python 3 because - they are not - supported yet and most likely never will be. - * Even if PyCObject is brought back in 3.2, PyCapsule is a much - safer API - which adds a poorman's type check when unboxing. - - https://bugzilla.gnome.org/show_bug.cgi?id=630844 - - gi/gimodule.c | 2 +- - gi/pygi.h | 5 ++++- - glib/glibmodule.c | 2 +- - glib/pyglib-python-compat.h | 28 ++++++++++++++++++++++++++++ - glib/pyglib.c | 6 +++--- - glib/pygoptioncontext.c | 2 +- - gobject/gobjectmodule.c | 2 +- - gobject/pygobject.h | 6 ++++++ - gobject/pygtype.c | 10 +++++----- - 9 files changed, 50 insertions(+), 13 deletions(-) - -commit 03d2e2924e27a9d6cae89e5748f70e0a51be91c6 -Author: Damien Caliste -Date: Tue Sep 28 12:44:42 2010 +0200 - - Add __path__ attributes. - - Add an attribute __path__ to DynamicModule and IntrospectionModule, - using the path of the typelib. - - https://bugzilla.gnome.org/show_bug.cgi?id=630807 - - gi/module.py | 2 ++ - 1 file changed, 2 insertions(+) - -commit 28f9366c9cb382801bad080864f667c867daa3c7 -Author: Sebastian Pölsterl -Date: Sat Oct 9 17:40:40 2010 +0200 - - Override Gtk.TreeSelection.get_selected to not return success value. - - https://bugzilla.gnome.org/show_bug.cgi?id=631765 - - gi/overrides/Gtk.py | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -commit f01a7d9e8222663ce52100e061033f2745a5e7af -Author: Vincent Untz -Date: Thu Oct 7 09:42:24 2010 +0200 - - Make row optional in Gtk.TreeStore/ListStore.append override - - https://bugzilla.gnome.org/show_bug.cgi?id=631548 - - gi/overrides/Gtk.py | 36 ++++++++++++++++++++++-------------- - 1 file changed, 22 insertions(+), 14 deletions(-) - -commit 1e1357f5fa1a034b0b707040d664ac46be6e23f7 -Author: John (J5) Palmieri -Date: Mon Oct 4 12:50:55 2010 -0400 - - Revert "add compat functions for the deprecated PyCObject api" - - This reverts commit f25e763d53e5cdd4de08e90b04aea4b4c4720ac0. - - I ment to commit another patch and ended up comitting both - - gi/gimodule.c | 2 +- - gi/pygi.h | 5 +---- - glib/glibmodule.c | 2 +- - glib/pyglib-python-compat.h | 19 ------------------- - glib/pyglib.c | 6 +++--- - glib/pygoptioncontext.c | 2 +- - gobject/gobjectmodule.c | 2 +- - gobject/pygobject.h | 6 ------ - gobject/pygtype.c | 10 +++++----- - 9 files changed, 13 insertions(+), 41 deletions(-) - -commit 97774cb149c5b03d5ef82a5af3f19e2ce4d79d0b -Author: John (J5) Palmieri -Date: Mon Oct 4 12:43:31 2010 -0400 - - return NULL instead of -1 which fixes crash when introspection is - turned off - - * see https://bugzilla.gnome.org/show_bug.cgi?id=631158 - - gi/pygi.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f25e763d53e5cdd4de08e90b04aea4b4c4720ac0 -Author: John (J5) Palmieri -Date: Tue Sep 28 15:31:03 2010 -0400 - - add compat functions for the deprecated PyCObject api - - * Moved to using the PyCapsule API for python >= 2.7 - - https://bugzilla.gnome.org/show_bug.cgi?id=630844 - - gi/gimodule.c | 2 +- - gi/pygi.h | 5 ++++- - glib/glibmodule.c | 2 +- - glib/pyglib-python-compat.h | 19 +++++++++++++++++++ - glib/pyglib.c | 6 +++--- - glib/pygoptioncontext.c | 2 +- - gobject/gobjectmodule.c | 2 +- - gobject/pygobject.h | 6 ++++++ - gobject/pygtype.c | 10 +++++----- - 9 files changed, 41 insertions(+), 13 deletions(-) - -commit 80b8ccd450fe4e3ea77b27e58bb63cabc2a2bb2b -Author: John (J5) Palmieri -Date: Tue Sep 28 15:28:16 2010 -0400 - - fix commit 7fe83108 which didn't use the compat functions for - string handling - - glib/glibmodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 9562842907a9d94f6adae2c1bb20d6b1f189abda -Author: John (J5) Palmieri -Date: Tue Sep 28 13:15:57 2010 -0400 - - Python 3 fixes for dsextras and the python.m4 distribution files - - dsextras.py | 13 +++++++------ - m4/python.m4 | 4 ++-- - 2 files changed, 9 insertions(+), 8 deletions(-) - -commit 98f69957ee9e3037b0a05a037098e4d2133ca256 -Author: John (J5) Palmieri -Date: Mon Sep 27 14:01:31 2010 -0400 - - post release bump to 2.27.0 unstable - - * update hacking to fill in some holes in the release instructions - - HACKING | 6 ++++-- - configure.ac | 2 +- - 2 files changed, 5 insertions(+), 3 deletions(-) - -commit fd38010101411e6bc1ca9314657f418de660fa13 -Author: John (J5) Palmieri -Date: Mon Sep 27 12:03:10 2010 -0400 - - update NEWS for release - - NEWS | 93 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 93 insertions(+) - -commit 7072d56b6cba13da97a052c75d1ae0c2cc417fd1 -Author: Tomeu Vizoso -Date: Sun Sep 26 08:37:31 2010 +0200 - - Pre-release version bump 2.26.0 - - configure.ac | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit a549f429d2ced7a78d5baa5e2f28f6750b4788f2 -Author: John Stowers -Date: Fri Sep 24 22:44:03 2010 +1200 - - Wrap g_get_system_{config,data}_dirs () - - * Also tidy up g_get_{cache,config,data}_dir - to share common code - - glib/glibmodule.c | 68 - ++++++++++++++++++++++++++++++++++++++++--------------- - 1 file changed, 50 insertions(+), 18 deletions(-) - -commit 328aca600714bdca89dfdb531c222ee561ede27e -Author: John (J5) Palmieri -Date: Fri Sep 24 12:16:22 2010 -0400 - - fixed make check and make dist - - tests/Makefile.am | 31 ++++++++++++++++++------------- - 1 file changed, 18 insertions(+), 13 deletions(-) - -commit 27023fd56148dd17b5576c1e81e0fe851d9b8727 -Author: John Stowers -Date: Fri Sep 24 21:20:53 2010 +1200 - - Disable GI tests when introspection disabled - - tests/Makefile.am | 2 ++ - 1 file changed, 2 insertions(+) - -commit 7fe831081cdd2e26f5d948326b9f89ea0694e752 -Author: Tomeu Vizoso -Date: Sat Jul 18 19:35:08 2009 +0200 - - Wrap g_uri_list_extract_uris. Fixes bug #584431 - - glib/glibmodule.c | 38 ++++++++++++++++++++++++++++++++++++++ - gobject/__init__.py | 2 +- - tests/Makefile.am | 3 ++- - tests/test_uris.py | 15 +++++++++++++++ - 4 files changed, 56 insertions(+), 2 deletions(-) - -commit d6721a59c294f2471142b8c32de2f647b7084bca -Author: Paul Bolle -Date: Thu Sep 23 15:38:40 2010 -0400 - - Fix a few uses of TRUE and FALSE in the docs - - docs/reference/pygio-mount.xml | 5 +++-- - docs/reference/pyglib-functions.xml | 18 +++++++++--------- - docs/reference/pyglib-maincontext.xml | 12 ++++++------ - docs/reference/pyglib-mainloop.xml | 6 +++--- - docs/reference/pygobject-functions.xml | 6 +++--- - docs/reference/pygobject.xml | 4 ++-- - 6 files changed, 26 insertions(+), 25 deletions(-) - -commit a08c9fffb4262ae678e17f90bbfb2d5f880cfad0 -Author: Damien Caliste -Date: Tue Sep 21 17:52:14 2010 +0200 - - pygi: always free the invocation_state struct - - In pygi-invoke.c, the invocation_state struct is never freed - in case of success. Thus, always call _free_invocation_state() - before leaving. - Modify _free_invocation_state to avoid double free in case of - caller-allocated GValue, once as a released argument in the - _process routine and another time in the _free as the special - case. So move all argument releasing code from the _process - routine to the _free one. - Modify the tests for the callback routines to return an integer - value as specified in the GIR file. - - Make check is as successful as before (already existing error - related to GVariant is still there). - - https://bugzilla.gnome.org/show_bug.cgi?id=630271 - - gi/pygi-invoke.c | 83 - +++++++++++++++++++++--------------------------- - tests/test_everything.py | 4 ++- - 2 files changed, 40 insertions(+), 47 deletions(-) - -commit 9714d765a34e246899f11b6792eea3aecce0b7ec -Author: Tomeu Vizoso -Date: Mon Sep 13 16:36:47 2010 +0200 - - Start implementing something equivalent to g_variant_new - - https://bugzilla.gnome.org/show_bug.cgi?id=629367 - - gi/gimodule.c | 20 +++++++ - gi/overrides/GLib.py | 131 - ++++++++++++++++++++++++++++++++++++++++++--- - gi/pygi-foreign-gvariant.c | 2 +- - tests/test_everything.py | 16 ------ - tests/test_overrides.py | 25 +++++++++ - 5 files changed, 170 insertions(+), 24 deletions(-) - -commit fc45abdd9b55ab63556798ab0f04715be79dba08 -Author: John (J5) Palmieri -Date: Thu Sep 23 10:49:36 2010 -0400 - - fixed typo - missing comma in glib.option module - - * https://bugzilla.gnome.org/show_bug.cgi?id=627449 - - glib/option.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 4ed100f3183c6325dd04461484e877bb7d4131b1 -Author: John (J5) Palmieri -Date: Fri Sep 17 12:08:09 2010 -0400 - - add checks so we can compile under python 3 by setting PYTHON=python3 - - * compile for python 3 - * disables gio if compiling under python 3.x - * runs only pertinant tests - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - configure.ac | 32 +++++++++++++++++++++++++++++--- - tests/Makefile.am | 35 ++++++++++++++++++++--------------- - tests/runtests.py | 4 ++++ - 3 files changed, 53 insertions(+), 18 deletions(-) - -commit 269ff8564eeb597dc06c27e293354b7ff7a71a82 -Author: Tomeu Vizoso -Date: Fri Sep 17 15:50:47 2010 +0200 - - Rename static methods as functions - - In recent gobject-introspection releases, static methods have been - removed and placed as functions in the namespace level. In a future - releases it's planned to become static methods again but for now - let's fix the tests. - - tests/test_gi.py | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -commit 2da8da589644d6125101210712defb1272a8abb1 -Author: John (J5) Palmieri -Date: Thu Sep 9 13:52:14 2010 -0400 - - fix a couple of compiler warnings - - https://bugzilla.gnome.org/show_bug.cgi?id=629199 - - gi/pygi-argument.c | 4 ++-- - gi/pygi-struct.c | 2 +- - gobject/gobjectmodule.c | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - -commit 6769a4704f0876ac3baacd4da03ff16d9f0906be -Author: John (J5) Palmieri -Date: Thu Sep 9 13:55:17 2010 -0400 - - remove unused code - - * we use richcompare now - - https://bugzilla.gnome.org/show_bug.cgi?id=629198 - - gobject/pygtype.c | 9 --------- - 1 file changed, 9 deletions(-) - -commit 98f54f9d33996baeaa8c8c1240310f5396d03a1d -Author: John (J5) Palmieri -Date: Tue Sep 14 14:10:49 2010 -0400 - - Check the type of the instance object - - * in python 2 methods were added to classes as unbound methods and - they would - check the instance type to make sure it was correct - * in python 3 for perfomance reasons methods are added to classes - as simple - functions which treat the instance as an untyped argument so - no checks - are made. - * this patch adds a type check so that the correct errors are - thrown in - python 3 (python 2 this just adds another layer of redundancy should - something change with type checking in the future) - * since GI handles regular args and the instance arg slightly - differently - we had to split out the interface checks in - _pygi_g_type_info_check_object - in order to not duplicate code - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/pygi-argument.c | 182 - ++++++++++++++++++++++++++++------------------------- - gi/pygi-argument.h | 2 + - gi/pygi-invoke.c | 14 +++++ - 3 files changed, 112 insertions(+), 86 deletions(-) - -commit 5d79498d38b147b66ae72c1481e397160491e8d6 -Author: John (J5) Palmieri -Date: Wed Sep 15 10:26:20 2010 -0400 - - include the correct pycairo version - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/pygi-foreign-cairo.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit b855562e5c0019cd7e4982fe00c467ede9e3926d -Author: John (J5) Palmieri -Date: Thu Sep 9 22:16:58 2010 -0400 - - Use PyMapping_Keys to determine if an object is a dict (py3k fix) - - * in Py3k PyMapping_Check returns true for sequences such as strings - and lists. Since we need to get the keys anyway, and it returns - NULL if this is not a dict, this is a much better test, even in - Py2 - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/pygi-argument.c | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -commit 0e72e28c6c5502c7db5103cf1299c9f0e6689fdd -Author: John (J5) Palmieri -Date: Thu Sep 9 18:44:11 2010 -0400 - - fix handling of UINT64 and INT64 arguments in py3k - - * decode to the right sized C long - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/pygi-argument.c | 20 ++++++++++++-------- - 1 file changed, 12 insertions(+), 8 deletions(-) - -commit d5666d99a1c0396b7da0cb14f9f4ff8892da7e2e -Author: John (J5) Palmieri -Date: Thu Sep 9 17:35:10 2010 -0400 - - properly handle ulongs properties in py3k - - * If this is a PyLong object pull use AsUnsignedLong - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gobject/pygtype.c | 29 ++++++++++++++++------------- - 1 file changed, 16 insertions(+), 13 deletions(-) - -commit 3d431c7dd0de97db10cb0c00c39d9c1837bed2f2 -Author: Tomeu Vizoso -Date: Fri Sep 17 12:14:56 2010 +0200 - - Specify encoding of tests/test_gi.py - - tests/test_gi.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit a808bdabb9fa6f4a9b9ce42e1cce05fb37403f0f -Author: John (J5) Palmieri -Date: Thu Sep 9 13:24:30 2010 -0400 - - use actual unicode in the tests on py3k, not the byte representation - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - tests/test_gi.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -commit 928f4485041d80d0c36ff2daeae4bcd09bd0bde4 -Author: John (J5) Palmieri -Date: Thu Sep 9 12:45:21 2010 -0400 - - s/METH_KEYWORDS/METH_VARARGS|METH_KEYWORDS/ when defining object - methods - - * in Py3k the METH_KEYWORDS flag by itself is invalid. A method - must be defined - with both the METH_VARARGS and METH_KEYWORDS flags. - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - glib/pygiochannel.c | 30 +++++++++++++++--------------- - glib/pygsource.c | 4 ++-- - gobject/pygobject.c | 2 +- - 3 files changed, 18 insertions(+), 18 deletions(-) - -commit b5ee20afa4399c7689fbec8939fa20b927eeb782 -Author: John (J5) Palmieri -Date: Thu Sep 9 08:04:40 2010 -0400 - - fix subclassing PyLong by calling __new__ correctly - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - glib/pygspawn.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit a499b2f0d622b671bd154544f66b73f1278e66ed -Author: John (J5) Palmieri -Date: Thu Sep 9 07:56:44 2010 -0400 - - minor py3k fixups for python modules - - * add _basestring and _bytes and _callable wrappers - * use items instead of iteritems and range instead of xrange - - fix py3k modules - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/overrides/Gtk.py | 24 ++++++++++++++++-------- - glib/option.py | 16 ++++++++++++---- - 2 files changed, 28 insertions(+), 12 deletions(-) - -commit dec9001d26c97949e7b3578086cb35e98075c047 -Author: John (J5) Palmieri -Date: Thu Sep 9 07:36:04 2010 -0400 - - minor fixes in tests for py3k compat - - * add a _bytes wrapper for API that expects bytes in py3k but str - in py2 - * fix some more exception handling using sys.exc_info()[:2] - * use range instead of xrange, items instead of iteritems since py3k - dropped support for the different ways of accessing iterators - - this is less efficient in py2 but we plan to target py3k as the - primary platform - * use list(dict.items()) since py3k only returns iterables which - are not - indexable - * missed some _long wrapping - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - tests/compathelper.py | 18 ++++++++++++++++++ - tests/test_everything.py | 5 +++-- - tests/test_mainloop.py | 3 ++- - tests/test_option.py | 6 ++++-- - tests/test_overrides.py | 4 ++-- - tests/test_properties.py | 6 +++--- - 6 files changed, 32 insertions(+), 10 deletions(-) - -commit 09a0daeedf49eaf376c1288be5743b57fbc76d51 -Author: Colin Walters -Date: Thu Sep 9 16:25:51 2010 -0400 - - compilation: Fix syntax error - - gi/pygi-info.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 9f7afd6d5afd8c1a5f36bf1295814757b71c8cbc -Author: Tomeu Vizoso -Date: Thu Sep 9 22:17:00 2010 +0200 - - Add missing file - - gi/overrides/GLib.py | 48 - ++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 48 insertions(+) - -commit 306b792ac97a458ddee59fb86d66453495117f3e -Author: Tomeu Vizoso -Date: Thu Jul 22 13:48:51 2010 +0100 - - Add override for GLib.Variant.new_tuple - - * gi/gimodule.c: Add _wrap_pyg_variant_new_tuple - * gi/overrides/GLib.py: Override Variant.new_tuple and - Variant.get_string - * gi/pygi-type.[hc]: split _pygi_type_import_by_name out from - _pygi_type_import_by_gi_info - * gi/types.py: Never override gobject.TYPE_NONE - * tests/test_everything.py: Add tests for GVariant tuples - - https://bugzilla.gnome.org/show_bug.cgi?id=625050 - - gi/gimodule.c | 38 ++++++++++++++++++++++++++++++++++++++ - gi/overrides/Makefile.am | 1 + - gi/pygi-type.c | 15 +++++++++------ - gi/pygi-type.h | 2 ++ - gi/types.py | 1 + - tests/test_everything.py | 9 +++++++++ - 6 files changed, 60 insertions(+), 6 deletions(-) - -commit 22e53aa2ed9cf6173a877b0af6928d5ab8da2f4f -Author: John (J5) Palmieri -Date: Wed Sep 8 13:08:48 2010 -0400 - - fix for changes in the gi test libraries - - tests/test_everything.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 246877074617b0e9c3b2ba2a5395a73e0ed9cd5d -Author: John (J5) Palmieri -Date: Wed Sep 8 13:08:07 2010 -0400 - - Gtk.DialogFlags.NO_SEPARATOR has been removed in Gtk 3.0 - - gi/overrides/Gtk.py | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -commit f92fc48e7e2ec50996e994ccb7d08a61e7374f22 -Author: John (J5) Palmieri -Date: Wed Sep 8 12:35:09 2010 -0400 - - no need to offset arg positions when is_method is true - - * The old GI libraries required we offset arg positions for the - missing - self argument. The new library fixes this so we don't have - to offset - anymore. - - https://bugzilla.gnome.org/show_bug.cgi?id=629087 - - gi/pygi-callbacks.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -commit 8c517de2d278bdef641c72b8f2919a3924290ec1 -Author: Tomeu Vizoso -Date: Fri Aug 20 14:54:35 2010 +0200 - - gi: Add support for more property types - - https://bugzilla.gnome.org/show_bug.cgi?id=627494 - - gi/pygi-property.c | 156 - ++++++++++++++++++++++++++++++++++++----------- - tests/test_everything.py | 34 +++++++++++ - 2 files changed, 154 insertions(+), 36 deletions(-) - -commit 6d183d1fff55d54569ba3e1f90a10284df74fd40 -Author: John (J5) Palmieri -Date: Fri Sep 3 12:04:16 2010 -0400 - - use PyObject_SetAttrString, not PyDict_SetItemString when setting - __gtype__ - - * When registering a gtype wrapper we used to set tp_dict - directly. This works - in python 2 but python 3 seems to handle attributes in a slightly - different - way where the tp_dict and attr get out of sync. By setting the attr - directly we avoid this issue. - * Note that there are many more places where we set __gtype__ - using tp_dict - however for objects which are not instantiated yet we have to - set tp_dict - directly. - * Since this one change fixes a lot of failed tests, for now we - ignore the - other places where we set __gtype__. If we run into more issues - dealing - with __gtype__ we can take a closer look later. - - https://bugzilla.gnome.org/show_bug.cgi?id=627878 - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gobject/gobjectmodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b7bf4269682a3335f5e0a52b46fa721af134d09a -Author: Tomeu Vizoso -Date: Wed Sep 1 11:03:40 2010 +0200 - - Rename GArgument to GIArgument - - gi/pygi-argument.c | 52 - +++++++++++++++++++++++----------------------- - gi/pygi-argument.h | 10 ++++----- - gi/pygi-closure.c | 34 +++++++++++++++--------------- - gi/pygi-foreign-cairo.c | 8 +++---- - gi/pygi-foreign-gvariant.c | 4 ++-- - gi/pygi-foreign-gvariant.h | 4 ++-- - gi/pygi-foreign.c | 12 +++++------ - gi/pygi-foreign.h | 8 +++---- - gi/pygi-info.c | 8 +++---- - gi/pygi-invoke.c | 28 ++++++++++++------------- - gi/pygi-property.c | 4 ++-- - gi/pygi.h | 16 +++++++------- - 12 files changed, 94 insertions(+), 94 deletions(-) - -commit 7197f85c9be2b03636639ac909ca2c3170653509 -Author: John (J5) Palmieri -Date: Wed Aug 18 10:29:19 2010 -0400 - - fix up tests so they run in py3k - - * add a compat helper that should only be used by tests - * fix long notation to use the compat helper instead - * add parens to print statements - * use compatable try/except pattern - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gobject/propertyhelper.py | 16 +++++++++++----- - tests/compathelper.py | 32 ++++++++++++++++++++++++++++++++ - tests/test_option.py | 7 ++++++- - tests/test_properties.py | 24 ++++++++++++++---------- - tests/test_signal.py | 14 +++++++------- - tests/test_source.py | 4 ++-- - 6 files changed, 72 insertions(+), 25 deletions(-) - -commit 720e614acdbcf734d4bcccc403e639b5a5bcae24 -Author: Colin Walters -Date: Fri Aug 20 10:58:48 2010 -0400 - - tests: Port to new introspection tests - - Everything is renamed "Regress", and both it and GIMarshallingTests - are now in source form, so we compile them. - - The scanner now adds "static methods" to objects, structs, and unions, - so update the test code to use those. - - In the tests, remove broken (inout) cases - the person writing these - tests misunderstood the semantics of (inout). It's not acceptable for - a C API to mutate e.g. a GSList* passed in, or unref an object. - - The invocation code needed to be updated for this - remove some - broken hacks. - - https://bugzilla.gnome.org/show_bug.cgi?id=627878 - - configure.ac | 5 +- - gi/pygi-argument.c | 9 +-- - gi/pygi-invoke.c | 147 - +++++---------------------------------------- - tests/Makefile.am | 42 ++++++++++++- - tests/test_everything.py | 6 +- - tests/test_gi.py | 151 - +++++++++-------------------------------------- - 6 files changed, 93 insertions(+), 267 deletions(-) - -commit f6c4d9e58c8f05cb2d82e158c9eb8480308565bd -Author: John (J5) Palmieri -Date: Fri Aug 20 10:43:58 2010 -0400 - - we need to specify tp_hash since we overide tp_richcompare - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gobject/pygenum.c | 1 + - gobject/pygflags.c | 1 + - 2 files changed, 2 insertions(+) - -commit c03e6b482548aee99362356807c804f8834fad2b -Author: John Ehresman -Date: Thu Apr 15 17:11:30 2010 -0400 - - working enum/flags/pid subclasses of long - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - glib/pygspawn.c | 7 ++--- - gobject/pygenum.c | 61 ++++++++++++++++++++++++------------------- - gobject/pygflags.c | 76 - +++++++++++++++++++++++------------------------------- - 3 files changed, 71 insertions(+), 73 deletions(-) - -commit 0db676fd2296750a46ba0fb069e472da06ecc53a -Author: John (J5) Palmieri -Date: Wed Aug 18 11:03:32 2010 -0400 - - make vfuncs work in py3k - - * methods now export __func__ instead of im_func for getting the - function - out of a method closure - * however classes no longer return unbound methods in py3k and instead - return the actual function - * in python 2 we use im_func when getting the function from the - vfunc closure - * in py3k we simply assign vfunc to the function - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/types.py | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -commit 286dcd0c6455961d818ac7f05f80f82435abc1dc -Author: John (J5) Palmieri -Date: Tue Aug 17 15:43:42 2010 -0400 - - make cairo module compile in py3k - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/Makefile.am | 2 +- - gi/pygi-foreign-cairo.c | 17 +++++++---------- - 2 files changed, 8 insertions(+), 11 deletions(-) - -commit bda58ec34fc443fe1108afc8532bec50f6fd0b44 -Author: John (J5) Palmieri -Date: Tue Aug 17 02:33:45 2010 -0400 - - fix exceptions so they work in python 3.x - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/module.py | 2 +- - gi/types.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit 427a3c8053feca35ccd746575760ac8a0ed50a12 -Author: John (J5) Palmieri -Date: Tue Aug 17 02:24:44 2010 -0400 - - make the gi module compile under 3.x - - * include the compat macros - * use GLIB_MODULE_START/END to define module - * add PyInit__gi to the exported symbols - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/Makefile.am | 2 +- - gi/gimodule.c | 24 +++++++++--------------- - 2 files changed, 10 insertions(+), 16 deletions(-) - -commit 1dee5dcd2b1747b4a4af438c0443d7930e4802db -Author: John (J5) Palmieri -Date: Tue Aug 17 02:14:14 2010 -0400 - - fix up testshelper module so it compiles in python 3.x - - * include the compat header - * fix up PyInts to be PYGLIB_Long - * Use PYGLIB_DEFINE_TYPE macros to define module objects - * Use PYGLIB_MODULE_START/END to define modules - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - tests/Makefile.am | 2 +- - tests/testhelpermodule.c | 221 - ++++++----------------------------------------- - 2 files changed, 28 insertions(+), 195 deletions(-) - -commit 1ff83a2ccb7301c8f675913f1c4f6118ea50b9c7 -Author: John (J5) Palmieri -Date: Mon Aug 16 21:14:27 2010 -0400 - - convert to using PYGLIB_DEFINE_TYPE for module objects - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/pygi-boxed.c | 43 ++----------- - gi/pygi-info.c | 171 - ++++++++++++++++++++------------------------------- - gi/pygi-repository.c | 39 +++--------- - gi/pygi-struct.c | 45 +++----------- - 4 files changed, 88 insertions(+), 210 deletions(-) - -commit 1efa2b12913b194d433c17014bc1077271a6ca32 -Author: John (J5) Palmieri -Date: Mon Aug 16 13:51:05 2010 -0400 - - some more p3k PyString and PyInt eradication in GI - - * add the glib dir to the includes list in the build - * make sure we include the compat macros - * add GLIB_PyBytes_FromString to compat macros - * add GLIB_PyNumber_Long to compat macros - * use RichCompare instead of Compare - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/Makefile.am | 2 +- - gi/pygi-argument.c | 96 - +++++++++++++++++++++++++++------------------ - gi/pygi-boxed.c | 1 + - gi/pygi-info.c | 13 +++--- - gi/pygi-private.h | 23 +++++++++++ - gi/pygi-repository.c | 8 ++-- - gi/pygi-struct.c | 1 + - glib/pyglib-python-compat.h | 6 +++ - 8 files changed, 103 insertions(+), 47 deletions(-) - -commit 6b902c66200c1684513a9ef31bdef3f2ff64e4fa -Author: Tomeu Vizoso -Date: Fri Aug 20 09:28:57 2010 +0200 - - pyglib: Fix typo (Leo Singer) - - https://bugzilla.gnome.org/show_bug.cgi?id=627408 - - glib/option.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 3cefffecc1317b6ad77a5ed936bfb990d16bf9d3 -Author: Gustavo Noronha Silva -Date: Thu Aug 19 18:45:05 2010 -0300 - - Add defines for size_t and ssize_t conversion functions - - These missing defines cause the resulting module to have unresolved - symbols, rendering it unusable. - - https://bugzilla.gnome.org/show_bug.cgi?id=627440 - - glib/pyglib-python-compat.h | 2 ++ - 1 file changed, 2 insertions(+) - -commit d45c7031876f355e15409f00f3e50e77d18f8f4b -Author: Colin Walters -Date: Thu Aug 19 17:50:35 2010 -0400 - - pyglib: Fix a compiler warning - - glib/pyglib.c | 1 + - 1 file changed, 1 insertion(+) - -commit 0fe6828ddce187ac1897a1f02ca1c5480796d5b9 -Author: Tomeu Vizoso -Date: Wed Aug 18 20:36:51 2010 +0200 - - Don't force gtk 2.0 - - pygi-convert.sh | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -commit ac59c18a4f2bfff47c862b763aaf1d1cf136a4f5 -Author: Steve Frécinaux -Date: Tue Aug 17 14:49:30 2010 +0200 - - Fix some ref leaks in hook_up_vfunc_implementation() - - https://bugzilla.gnome.org/show_bug.cgi?id=627143 - - gi/gimodule.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -commit 18ee0db673c2fa42244ab85950bbf4840edb674b -Author: John (J5) Palmieri -Date: Thu Aug 12 12:16:31 2010 -0400 - - handle strings correctly in gio - - gio/gappinfo.override | 5 +++++ - gio/pygio-utils.c | 42 +++++++++++++++++++++++++++++++++++------- - 2 files changed, 40 insertions(+), 7 deletions(-) - -commit 45ab0c03110c911b47519941dfd753326891b5e0 -Author: John (J5) Palmieri -Date: Wed Aug 11 16:13:59 2010 -0400 - - make giomodule compile under py3k - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gio/giomodule.c | 153 - +++++++++++++++++++++++++++++--------------------------- - 1 file changed, 78 insertions(+), 75 deletions(-) - -commit c52f8ed3ae8cb66a03b5695e980770c3f467f755 -Author: John (J5) Palmieri -Date: Wed Aug 11 16:04:48 2010 -0400 - - for py3k we need to do some more processing to get bytes from a - unicode string - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - gi/pygi-argument.c | 31 +++++++++++++++++++++++++++---- - 1 file changed, 27 insertions(+), 4 deletions(-) - -commit de9eae4dfcce856a42cc5c569a5b9683c28d0eeb -Author: John (J5) Palmieri -Date: Wed Aug 11 15:03:55 2010 -0400 - - use Bytes instead of Unicode when reading io - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - glib/pygiochannel.c | 30 ++++++++++++++++++++++++------ - 1 file changed, 24 insertions(+), 6 deletions(-) - -commit 5824ff98175b749dbcfa72d24b994230b6e05377 -Author: John (J5) Palmieri -Date: Mon Aug 9 15:16:51 2010 -0400 - - prefix compat macros with PYGLIB - - * refactor from John Ehresman py3k branch - * fix up some extranious PyString calls - * remove duplicate macros from pyglib.h that are in - pyglib-python-compat.h - * pygobject.h can't import pyglib-python-compat.h so add codepaths - for both Py3k and legacy code instead of using macros - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - glib/glibmodule.c | 48 +++++----- - glib/pygiochannel.c | 46 +++++----- - glib/pyglib-python-compat.h | 153 +++++++++++++++++++++++-------- - glib/pyglib.c | 22 ++--- - glib/pyglib.h | 14 --- - glib/pygoptioncontext.c | 4 +- - glib/pygsource.c | 16 ++-- - glib/pygspawn.c | 32 +++---- - gobject/gobjectmodule.c | 216 - ++++++++++++++++++++++---------------------- - gobject/pygboxed.c | 2 +- - gobject/pygenum.c | 84 ++++++++--------- - gobject/pygflags.c | 122 ++++++++++++------------- - gobject/pygobject-private.h | 12 +-- - gobject/pygobject.c | 46 +++++----- - gobject/pygobject.h | 23 +++++ - gobject/pygparamspec.c | 24 ++--- - gobject/pygpointer.c | 2 +- - gobject/pygtype.c | 170 +++++++++++++++++----------------- - 18 files changed, 563 insertions(+), 473 deletions(-) - -commit 231e934cc01d061e81bb60d35127a133cd0e1793 -Author: John (J5) Palmieri -Date: Mon Aug 16 10:14:04 2010 +0200 - - Gtk.Button unit tests - - https://bugzilla.gnome.org/show_bug.cgi?id=622606 - - tests/test_overrides.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -commit f07cfde377e42686c6b80f56cac62338ee333e61 -Author: Johan Dahlin -Date: Mon Aug 16 10:08:38 2010 +0200 - - [Gtk] Add overrides for Button - - https://bugzilla.gnome.org/show_bug.cgi?id=622606 - - gi/overrides/Gtk.py | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -commit 65a06a7216163c7e65b32c5b5f3388faa7fda5d6 -Author: Simon van der Linden -Date: Thu Aug 12 16:18:58 2010 +0200 - - Make Cairo an optional dependency - - Add the --enable-cairo configure argument. - - https://bugzilla.gnome.org/show_bug.cgi?id=616732 - - configure.ac | 15 ++++++++++++--- - gi/Makefile.am | 20 ++++++++++++-------- - 2 files changed, 24 insertions(+), 11 deletions(-) - -commit b83507263231d9bf47f6c8450583e3d03f0a3b5b -Author: Tomeu Vizoso -Date: Mon Aug 16 09:55:35 2010 +0200 - - Don't import again PyGObject (John Ralls) - - https://bugzilla.gnome.org/show_bug.cgi?id=626996 - - gi/pygi.h | 1 + - 1 file changed, 1 insertion(+) - -commit 0dc3656070f496431829c6e8441ca17129c569f8 -Author: John (J5) Palmieri -Date: Mon Aug 9 16:11:55 2010 -0400 - - move to using richcompare slot instead of compare - - https://bugzilla.gnome.org/show_bug.cgi?id=615872 - - glib/pygiochannel.c | 18 +++++++---- - glib/pyglib.c | 85 - +++++++++++++++++++++++++++++++++++++++++++++++++ - glib/pyglib.h | 3 ++ - glib/pygmaincontext.c | 17 ++++++---- - glib/pygmainloop.c | 17 ++++++---- - glib/pygoptioncontext.c | 18 +++++++---- - glib/pygoptiongroup.c | 22 +++++++------ - gobject/pygboxed.c | 18 +++++++---- - gobject/pygobject.c | 44 ++++++++++++++++++------- - gobject/pygparamspec.c | 19 +++++++---- - gobject/pygpointer.c | 17 ++++++---- - gobject/pygtype.c | 26 +++++++++++---- - 12 files changed, 233 insertions(+), 71 deletions(-) - -commit b426e531dc53d4b50e572a2da19733479635e662 -Author: Simon van der Linden -Date: Thu Aug 12 18:09:33 2010 +0200 - - Replace autogen.sh by a newer version - - It pulls automake 1.10 or 1.11. - Greatly inspired from GLib's. - - https://bugzilla.gnome.org/show_bug.cgi?id=625661 - - autogen.sh | 506 - +++++++------------------------------------------------------ - 1 file changed, 58 insertions(+), 448 deletions(-) - -commit 769645e00d6d055a4cd802454dbfc1bbfcbee691 -Author: Simon van der Linden -Date: Thu Aug 12 14:11:55 2010 +0200 - - Fix some warnings - - pyglib.c: In function ‘pyglib_gerror_exception_check’: - pyglib.c:362: warning: format not a string literal and no format - arguments - pyglib.c:371: warning: format not a string literal and no format - arguments - - gio.override: In function 'pygio_notify_allocate_buffer': - gio.override:144:13: warning: format '%d' expects type 'int', but - argument 3 - has type 'gsize' - - https://bugzilla.gnome.org/show_bug.cgi?id=625437 - - gio/gio.override | 2 +- - glib/pyglib.c | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -commit e4c4cccb588b258dbcd21702e6cddcfe9ebe4ffc -Author: Simon van der Linden -Date: Thu Aug 12 11:09:37 2010 +0200 - - Fix caller-allocates emergency free. - - In the state, args, args[i], arg_infos[i], and arg_type_infos[i] - must not be - NULL in order to be able caller-allocates. This patch adds those - conditions. - - Moreover, the interface info needs to be freed afterwards. - - https://bugzilla.gnome.org/show_bug.cgi?id=626684 - - gi/pygi-invoke.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -commit 0ab967ca40ddcffc2834d4e656bb2010c6b9bdda -Author: Simon van der Linden -Date: Thu Aug 12 10:46:17 2010 +0200 - - Remove useless checks. - - No need to check for state->arg_infos, state->arg_type_infos, and - state->args_is_auxiliary to be NULL, they are always allocated. - - https://bugzilla.gnome.org/show_bug.cgi?id=626684 - - gi/pygi-invoke.c | 14 +++----------- - 1 file changed, 3 insertions(+), 11 deletions(-) - -commit e17be9cd288fee5d7cb174d9d577eb9279044c67 -Author: Tomeu Vizoso -Date: Tue Aug 10 17:40:16 2010 +0200 - - Call valgrind with G_SLICE=always-malloc G_DEBUG=gc-friendly - - tests/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 8be59c37dd57acc51875c7189ca09d728b729013 -Author: Ignacio Casal Quinteiro -Date: Wed Aug 4 13:43:17 2010 +0200 - - Fix some warnings. - - gi/pygi-argument.c | 2 -- - gi/pygi-invoke.c | 2 +- - gi/pygi-struct.c | 1 - - 3 files changed, 1 insertion(+), 4 deletions(-) - -commit 529eca6054e9a7e2267f1529e317c2373932762f -Author: Simon van der Linden -Date: Fri Jul 30 22:39:40 2010 +0200 - - Add myself as a maintainer - - MAINTAINERS | 4 ++++ - 1 file changed, 4 insertions(+) - -commit caac75a6ed6f671b37e38a78e71b87906a00ac1b -Author: Tomeu Vizoso -Date: Fri Jul 30 14:14:16 2010 +0200 - - Properly allocate boxed structs that are (caller-allocates) - - * gi/pygi-boxed.[hc]: Refactor out the allocation of boxed structs - * gi/pygi-invoke.c: Don't use g_malloc0 for boxed structs that - are (caller-allocates) - * tests/test_overrides.py: Split the TreeView tests - - https://bugzilla.gnome.org/show_bug.cgi?id=625653 - - gi/pygi-boxed.c | 50 - ++++++++++++++++++++++++++++++++----------------- - gi/pygi-boxed.h | 10 ++++++---- - gi/pygi-invoke.c | 16 ++++++---------- - tests/test_overrides.py | 39 +++++++++++++++++++------------------- - 4 files changed, 64 insertions(+), 51 deletions(-) - -commit 99c7322898c00a576c7319ea0a7c808446253133 -Author: Toms Baugis -Date: Fri Jul 30 15:44:21 2010 +0200 - - override gdk.Event to return attribute from the proper event object - - https://bugzilla.gnome.org/show_bug.cgi?id=620593 - - gi/overrides/Gdk.py | 48 - ++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-invoke.c | 4 ---- - tests/test_overrides.py | 10 ++++++++++ - 3 files changed, 58 insertions(+), 4 deletions(-) - -commit 55814e722c2ae11310f346790c9221e4fad92b50 -Author: John (J5) Palmieri -Date: Fri Jul 30 06:30:48 2010 -0400 - - check if z# needs an int or Py_ssize_t - - https://bugzilla.gnome.org/show_bug.cgi?id=625438 - - gio/gio.override | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 477315465d0a6d84b51e146e86e254873bc564ff -Author: John (J5) Palmieri -Date: Fri Jul 30 06:43:06 2010 -0400 - - make sure we parse parameters to python object vars not glib vars - - * py_flags was already set up but due to a typo &flags was being - passed - instead - - https://bugzilla.gnome.org/show_bug.cgi?id=625438 - - gio/gfile.override | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit faa7d4eece7ddb698725098970c2478a3b45c4d5 -Author: Paul Bolle -Date: Fri Jul 30 10:56:01 2010 +0200 - - Make an example and a demo work out of the box - - cairo-demo.py and gtk-demo.py need the two (kind of) magic lines - regarding pygtk to work out of the box. So add those. - - Signed-off-by: Paul Bolle - - https://bugzilla.gnome.org/show_bug.cgi?id=625638 - - demos/gtk-demo/gtk-demo.py | 2 ++ - examples/cairo-demo.py | 2 ++ - 2 files changed, 4 insertions(+) - -commit c9da5782e6c633d9af43ee85075e9ee65db09780 -Author: John (J5) Palmieri -Date: Fri Jul 9 13:14:42 2010 -0400 - - make sure caller allocated structs are freed when they go out of scope - - * Move struct transfer checks from pygi-arguments to pygi-invoke - * add better warning if an unknown struct is fully transfered - * only free GValues we create in the invoke cleanup. All other - structs - get cleaned up when they go out of scope in python - * Fixes issues with caller allocated treeiters getting freed to early - * this is a fix to crashes in the current test suite when API's - returning - TreeIters were annotated as out caller-allocates so no new tests - are needed - - https://bugzilla.gnome.org/show_bug.cgi?id=623969 - - gi/pygi-argument.c | 13 +++++-------- - gi/pygi-invoke.c | 46 ++++++++++++++++++++++++++++++++++++++++------ - 2 files changed, 45 insertions(+), 14 deletions(-) - -commit e0a85305cd107aae5902e524afd074cd8c329927 -Author: Tomeu Vizoso -Date: Fri Jul 30 10:35:33 2010 +0200 - - Revert "override gdk.Event to return attribute from the proper - event object." - - Pushed by mistake, we still need testcases - - This reverts commit e7bb3954880568884ca66e7751ede689dc2f24f6. - - gi/overrides/Gdk.py | 44 -------------------------------------------- - 1 file changed, 44 deletions(-) - -commit 61ffb8d6d08fcfe638f71ea97ceac3a366e5536d -Author: Paul Bolle -Date: Thu Jul 29 22:55:28 2010 +0200 - - PyGI: properly quit cairo-demo - - Signed-off-by: Paul Bolle - - https://bugzilla.gnome.org/show_bug.cgi?id=625619 - - examples/cairo-demo.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e7bb3954880568884ca66e7751ede689dc2f24f6 -Author: Toms Baugis -Date: Tue Jul 27 21:37:16 2010 +0200 - - override gdk.Event to return attribute from the proper event object. - - https://bugzilla.gnome.org/show_bug.cgi?id=620593 - - gi/overrides/Gdk.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - -commit 0a9f1da052fd33dcef81d0e267fc7972f02c7888 -Author: Simon van der Linden -Date: Wed Jul 28 14:56:00 2010 +0200 - - Clean and improve the test infrastructure - - To run select tests, use for instance: - % make check TEST_NAMES='test_everything test_gi.TestConstant' - - It works with check.gdb and check.valgrind too. - - https://bugzilla.gnome.org/show_bug.cgi?id=625488 - - Makefile.am | 5 ---- - tests/Makefile.am | 65 - +++++++++++++++++++++------------------------- - tests/common.py | 47 --------------------------------- - tests/runtests.py | 43 ++++++++++++------------------ - tests/test_gcancellable.py | 4 +-- - tests/test_gi.py | 3 --- - tests/test_gicon.py | 3 ++- - tests/test_gio.py | 3 ++- - tests/test_gobject.py | 3 ++- - tests/test_gresolver.py | 4 +-- - tests/test_gsocket.py | 4 ++- - tests/test_interface.py | 6 ++++- - tests/test_mainloop.py | 11 +++----- - tests/test_signal.py | 4 ++- - tests/test_source.py | 4 +-- - tests/test_subprocess.py | 5 +--- - tests/test_thread.py | 5 +++- - tests/test_unknown.py | 5 +++- - 18 files changed, 82 insertions(+), 142 deletions(-) - -commit 82f4cb5ebf5d992493b7a2f74cfd5f175e19eb76 -Author: Tomeu Vizoso -Date: Thu Jul 29 12:34:19 2010 +0200 - - Add some more transformations to pygi-convert.sh - - pygi-convert.sh | 37 +++++++++++++++++++++++++++++-------- - 1 file changed, 29 insertions(+), 8 deletions(-) - -commit de519adcd21947a0aef7932cdecb78cef200c85e -Author: Tomeu Vizoso -Date: Wed Jul 28 14:42:36 2010 +0200 - - Adapt to API changes: g_irepository_enumerate_versions - - gi/importer.py | 2 +- - gi/pygi-repository.c | 12 ++++++------ - 2 files changed, 7 insertions(+), 7 deletions(-) - -commit 01cd9abb43f93f9a57a5a05b6dc9560614e666e3 -Author: Tomeu Vizoso -Date: Wed Jul 28 12:26:48 2010 +0200 - - Add GValue<->GArgument marshalling for some more types - - gi/pygi-property.c | 37 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 36 insertions(+), 1 deletion(-) - -commit ddffa70c3ee0e837070f390632bc692430f79171 -Author: Tomeu Vizoso -Date: Wed Jul 28 11:10:42 2010 +0200 - - Chain up with the non-introspection implementation for properties - if needed - - gobject/pygobject.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit 045433a1f8167205dc8eae613dcb8835d02c8916 -Author: Tomeu Vizoso -Date: Wed Jul 28 10:59:49 2010 +0200 - - Improve error reporting for missing attributes in introspection - modules - - gi/module.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 6655a79b2f13fe417aefdf6aebab0f2d6162ba00 -Author: Tomeu Vizoso -Date: Tue Jul 27 21:52:49 2010 +0200 - - Implement getting and setting properties using introspection - information. - - This allows us to use information not present in GObject such as - transfer and element types. - - https://bugzilla.gnome.org/show_bug.cgi?id=620808 - - gi/Makefile.am | 2 + - gi/gimodule.c | 2 + - gi/pygi-argument.c | 2 + - gi/pygi-private.h | 1 + - gi/pygi-property.c | 226 - +++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-property.h | 39 ++++++++ - gi/pygi.h | 41 +++++++++ - gobject/pygobject.c | 9 ++ - tests/test_everything.py | 19 ++++ - 9 files changed, 341 insertions(+) - -commit 85f4572b3ffbfa364ebb2e470eab759edc557b36 -Author: Tomeu Vizoso -Date: Tue Jul 27 21:32:41 2010 +0200 - - Readd Gdk.Rectangle override for Gtk-2.0 - - gi/overrides/Gdk.py | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -commit 2082ee35e2a33f52bf1e8ec49cb4a43398e91989 -Author: Tomeu Vizoso -Date: Tue Jul 27 18:25:27 2010 +0200 - - Allow specifying a version when loading a typelib - - * gi/importer.py: Defer loading the typelib until first usage. - * gi/module.py: Load the typelib in IntrospectionModule(). - * gi/overrides/*.py: Adapt to API change. - * gi/pygi-repository.c: Add wrappers for g_irepository_enumerate and - g_irepository_get_version. - - gi/importer.py | 26 ++++++----------- - gi/module.py | 58 - +++++++++++++++++++++++++------------- - gi/overrides/GIMarshallingTests.py | 2 +- - gi/overrides/Gdk.py | 2 +- - gi/overrides/Gtk.py | 2 +- - gi/pygi-repository.c | 56 - +++++++++++++++++++++++++++++++++++- - 6 files changed, 105 insertions(+), 41 deletions(-) - -commit 6d7ed6c322234c240b1063a1dfaadd17157432a9 -Author: Jonathan Matthew -Date: Tue Jul 13 20:27:28 2010 +1000 - - treat GFreeFunc as equivalent to GDestroyNotify when scanning - callbacks - - https://bugzilla.gnome.org/show_bug.cgi?id=624232 - - gi/pygi-callbacks.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 7e9cbd5601ad548b78d106bac1a1576d33b91c65 -Author: Simon van der Linden -Date: Mon Jul 26 17:00:23 2010 +0200 - - Don't use == to compare doubles, use <= and =>. - - This avoids inequality due to small precisions difference. - - https://bugzilla.gnome.org/show_bug.cgi?id=625326 - - tests/testhelpermodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 5ca2a41f16f4a5fcc3ab4d00bec46b077c7eb384 -Author: Tomeu Vizoso -Date: Thu Jul 8 11:36:12 2010 +0200 - - Allow passing ints as enum args - - https://bugzilla.gnome.org/show_bug.cgi?id=622584 - - gi/pygi-argument.c | 23 +++++++++++++++++++++-- - tests/test_gi.py | 6 ++++-- - 2 files changed, 25 insertions(+), 4 deletions(-) - -commit 890c3233f8a9f884b045a294bf0122bb3afcd54a -Author: Tomeu Vizoso -Date: Sun Jul 25 17:30:40 2010 +0100 - - Make error message less ambiguous - - https://bugzilla.gnome.org/show_bug.cgi?id=625095 - - gi/pygi-callbacks.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 1162e436273ff8e9e4e24bd8ba74615fd4624753 -Author: John (J5) Palmieri -Date: Thu Jun 24 10:07:12 2010 -0400 - - fix passing in type names as a GType and add gtype unit tests - - * a simple call to pyg_type_from_object covers all the bases - * added unit tests to check for correct GType value passing - * fixed up tree override tests to also check different ways of - passing GTypes - - https://bugzilla.gnome.org/show_bug.cgi?id=622605 - - gi/pygi-argument.c | 8 +------- - tests/test_everything.py | 27 +++++++++++++++++++++++++++ - tests/test_overrides.py | 6 ++---- - 3 files changed, 30 insertions(+), 11 deletions(-) - -commit 8becd32fc042445d62b885bac12dac326b2dc1fa -Author: Tomeu Vizoso -Date: Mon Jul 26 11:54:47 2010 +0200 - - Increase a bit verbosity of tests so people know which test failed - - tests/runtests.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3b3c63514f311592e6769a373d37a2bde7ea6b38 -Author: Tomeu Vizoso -Date: Thu Jul 15 15:17:53 2010 +0200 - - Actually add the files for GVariant foreign structs - - gi/pygi-foreign-gvariant.c | 63 - ++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-foreign-gvariant.h | 41 ++++++++++++++++++++++++++++++ - 2 files changed, 104 insertions(+) - -commit e65275bc57f345c111eb12a6b4476ff1ddc3bc24 -Author: Tomeu Vizoso -Date: Thu Jul 15 13:31:33 2010 +0200 - - Add foreign struct support for GVariant - - * gi/pygi-invoke.c: Wrap foreign structs returned by constructors - * gi/pygi-foreign.c: Register foreign support for GVariant - * gi/pygi-struct.c: properly release foreign structs - * gi/pygi-argument.c, gi/pygi-foreign-cairo.c, gi/pygi.h: Adapt to - API changes - * tests/test_everything.py: Add basic tests for GVariant - - https://bugzilla.gnome.org/show_bug.cgi?id=619501 - - gi/Makefile.am | 2 + - gi/pygi-argument.c | 2 +- - gi/pygi-foreign-cairo.c | 16 +++---- - gi/pygi-foreign.c | 107 - +++++++++++++++++++++++++++++------------------ - gi/pygi-foreign.h | 7 ++-- - gi/pygi-invoke.c | 18 ++++---- - gi/pygi-struct.c | 10 ++++- - gi/pygi.h | 9 ++-- - tests/test_everything.py | 8 ++++ - 9 files changed, 110 insertions(+), 69 deletions(-) - -commit 3b3bd4da3fbc993fa7f7cfb46ed4e67671c94cc0 -Author: Tomeu Vizoso -Date: Mon Jul 12 11:19:06 2010 +0200 - - Add HACKING to MANIFEST.in - - MANIFEST.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 40bf08ff001b119c7daf709197005ef6480216c5 -Author: Tomeu Vizoso -Date: Mon Jul 12 11:18:04 2010 +0200 - - Add HACKING file with instructions for releasing - - HACKING | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -commit 3b9dffe7cc3820dfb84fd968fc604899601c5dc4 -Author: Tomeu Vizoso -Date: Mon Jul 12 11:09:58 2010 +0200 - - Post release version bump to 2.21.6 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 42a5a0897b38156ae010c396ea254abf502f35de -Author: Tomeu Vizoso -Date: Mon Jul 12 11:00:29 2010 +0200 - - Update NEWS and release PyGObject-2.21.5 - - NEWS | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -commit 5857f25c1c6e25b79e6134558bd7151bc6c30ef7 -Author: Tomeu Vizoso -Date: Mon Jul 12 11:00:20 2010 +0200 - - Pre-release version bump to 2.21.5 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e500adc3ac19ef6f436809e5a8828ac7e8db28f6 -Author: Florian Müllner -Date: Sat Jul 10 22:35:13 2010 +0200 - - Shut up some compiler warnings - - Remove unused variables, make sure variables are properly initialized. - - https://bugzilla.gnome.org/show_bug.cgi?id=624066 - - gi/pygi-callbacks.c | 1 - - gi/pygi-closure.c | 2 +- - gi/pygi-invoke.c | 1 - - 3 files changed, 1 insertion(+), 3 deletions(-) - -commit 2efa18afbcc2fac1c90958535b2f80e6e730ee56 -Author: =?UTF-8?q?Florian=20M=C3=BCllner?= -Date: Mon Jul 12 10:31:42 2010 +0200 - - Adjust to API break in GObject-Introspection - - As of commit 5cb925b20, many type_tags for standard C types have - been removed - namely machine-dependent integer types and derived - types (size_t, time_t). - - Most removals are just synonyms of other types, so their removal - should not have too much impact, with the exception of time_t, - which was translated to a native datetime object before. - - Also remove time_t tests (Tomeu Vizoso). - - https://bugzilla.gnome.org/show_bug.cgi?id=624065 - - configure.ac | 2 +- - gi/importer.py | 7 +-- - gi/pygi-argument.c | 146 - ----------------------------------------------------- - gi/pygi-closure.c | 10 ---- - gi/pygi-info.c | 37 -------------- - tests/test_gi.py | 21 -------- - 6 files changed, 5 insertions(+), 218 deletions(-) - -commit 27a417c71f8c122e46c7472663bb25c17413f103 -Author: John (J5) Palmieri -Date: Thu Jul 8 16:01:25 2010 -0400 - - pass in the demo app so demos can use utility methods like requesting - file paths - - demos/gtk-demo/demos/Entry/entry_buffer.py | 2 +- - demos/gtk-demo/demos/Entry/entry_completion.py | 2 +- - demos/gtk-demo/demos/appwindow.py | 13 +++++++++++-- - demos/gtk-demo/demos/assistant.py | 2 +- - demos/gtk-demo/demos/builder.py | 14 ++++++++++---- - demos/gtk-demo/demos/button_box.py | 2 +- - demos/gtk-demo/demos/clipboard.py | 8 +------- - demos/gtk-demo/demos/colorselector.py | 2 +- - demos/gtk-demo/demos/combobox.py | 8 +++++--- - demos/gtk-demo/demos/drawingarea.py | 2 +- - demos/gtk-demo/demos/test.py | 2 +- - demos/gtk-demo/gtk-demo.py | 6 +++--- - 12 files changed, 37 insertions(+), 26 deletions(-) - -commit e7daae919c2c6ae35d3927f0006252aacd49ea86 -Author: John (J5) Palmieri -Date: Thu Jul 8 15:38:07 2010 -0400 - - demo fixes to keep up with Gtk+ - - * treeiter changes to reflect caller-allocate annotations - * fix some flag handling - * use get_indicies_with_depth instead of get_indices for paths - - demos/gtk-demo/demos/appwindow.py | 10 +++++++--- - demos/gtk-demo/demos/combobox.py | 24 ++++++++++++------------ - demos/gtk-demo/gtk-demo.py | 13 +++++-------- - 3 files changed, 24 insertions(+), 23 deletions(-) - -commit 3d9fd6391710cc33058394d6821e4d4e11f09b22 -Author: John (J5) Palmieri -Date: Thu Jul 8 12:54:43 2010 -0400 - - override test fixes for new GTK+ annotations - - tests/test_overrides.py | 23 +++++++++++++---------- - 1 file changed, 13 insertions(+), 10 deletions(-) - -commit 7a400f8139b70ddfe7c949035e0851689951c647 -Author: Ignacio Casal Quinteiro -Date: Thu Jul 8 12:42:25 2010 +0200 - - Fix warning. - - gi/pygi-argument.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 39fd0a85a3de06b1b877d1125f91036409886373 -Author: John (J5) Palmieri -Date: Wed Jul 7 15:48:36 2010 -0400 - - fix up treeiter usage due to caller-allocates annotations in gtk+ - - * we still don't pass tests because the caller-allocates code path - does not - handle the case where the parameter is followed by a regular - in parameter - - gi/overrides/Gtk.py | 7 +++---- - tests/test_overrides.py | 21 +++++++++++---------- - 2 files changed, 14 insertions(+), 14 deletions(-) - -commit 4d970b75dc5c75c1bec04cb2954c9985b476070c -Author: John (J5) Palmieri -Date: Tue Jul 6 17:50:10 2010 -0400 - - add entry completion demo - - demos/gtk-demo/demos/Entry/entry_completion.py | 87 - ++++++++++++++++++++++++++ - 1 file changed, 87 insertions(+) - -commit f3531eaa1bfa4e01651d35cd587384d30a398ba8 -Author: John (J5) Palmieri -Date: Tue Jul 6 17:49:18 2010 -0400 - - string changes - - demos/gtk-demo/demos/Entry/entry_buffer.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit baf1e9bb550c7bf45e2ac0b70ba29c434ef1ccc6 -Author: John (J5) Palmieri -Date: Tue Jul 6 17:27:04 2010 -0400 - - add the Entry demo directory and the entry_buffer demo - - demos/gtk-demo/demos/Entry/__init__.py | 0 - demos/gtk-demo/demos/Entry/entry_buffer.py | 73 - ++++++++++++++++++++++++++++++ - 2 files changed, 73 insertions(+) - -commit f2b1d222120f055bec9339cca55c9cc90f538c00 -Author: John (J5) Palmieri -Date: Tue Jul 6 17:26:03 2010 -0400 - - fix loading of demo modules to support sub modules - - demos/gtk-demo/gtk-demo.py | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -commit 4f9390fb1892b13ab2ea00ed66c5000a40f09029 -Author: John (J5) Palmieri -Date: Tue Jul 6 15:56:34 2010 -0400 - - add the ability to have demos in sub catagories - - demos/gtk-demo/gtk-demo.py | 76 - ++++++++++++++++++++++++++++++++-------------- - 1 file changed, 54 insertions(+), 22 deletions(-) - -commit dc2249a3ecf339008351316217191d0551ccc588 -Author: Jose Aliste -Date: Mon Jul 5 14:36:59 2010 -0400 - - Add __name__ to DynamicModule class. - - Fixes bug #623486. - - gi/module.py | 1 + - 1 file changed, 1 insertion(+) - -commit 2357bca8d14539894b6bd0acfdc18d30b4bb4db6 -Author: Ignacio Casal Quinteiro -Date: Mon Jul 5 16:11:07 2010 +0200 - - Do not override GdkRectangle. - - This class was lately removed from gtk+ 3, so there is no need - to override - it anymore. - - gi/overrides/Gdk.py | 19 ------------------- - 1 file changed, 19 deletions(-) - -commit daca09dc2c2306d4fa82a68bbdd147d4b170a1e7 -Author: Philip Withnall -Date: Tue Jun 29 16:37:36 2010 +0100 - - Add override for TreeModel implementing __len__() - - Closes: bgo#622882 - - gi/overrides/Gtk.py | 11 +++++++++-- - tests/test_overrides.py | 5 +++++ - 2 files changed, 14 insertions(+), 2 deletions(-) - -commit bb8adb7f02f0c5494df2cb6e535e44d23902e8f5 -Author: Tomeu Vizoso -Date: Tue Jun 29 11:27:13 2010 +0200 - - Update NEWS and release PyGObject-2.21.4 - - NEWS | 27 +++++++++++++++++++++++++-- - 1 file changed, 25 insertions(+), 2 deletions(-) - -commit 2d473ee17be4671244bb4a2a0953a21ccf2a0df6 -Author: Tomeu Vizoso -Date: Tue Jun 29 10:55:03 2010 +0200 - - Remove files from the makefiles - - gi/Makefile.am | 4 +--- - gobject/Makefile.am | 3 +-- - 2 files changed, 2 insertions(+), 5 deletions(-) - -commit 89827314fd183eac07443c8e9d275ca9d4ce59df -Author: Tomeu Vizoso -Date: Tue Jun 29 10:27:39 2010 +0200 - - Build the cairo shim as a python module so the _gi module stops - linking to it - - https://bugzilla.gnome.org/show_bug.cgi?id=623021 - - configure.ac | 2 + - gi/Makefile.am | 38 ++++++++++----- - gi/gimodule.c | 8 +--- - gi/pygi-argument.c | 10 +--- - gi/pygi-foreign-cairo.c | 56 ++++++++++++++++------ - gi/pygi-foreign-cairo.h | 55 --------------------- - gi/pygi-foreign.c | 125 - ++++++++++++++++++++++++++++-------------------- - gi/pygi-foreign.h | 31 ++++++------ - gi/pygi.h | 40 ++++++++++++++-- - 9 files changed, 196 insertions(+), 169 deletions(-) - -commit a6a90551311bc64f037cbd442e13f70c30060871 -Author: Tomeu Vizoso -Date: Mon Jun 28 14:20:43 2010 +0200 - - Remove pygi-external.h - - https://bugzilla.gnome.org/show_bug.cgi?id=623021 - - gi/gimodule.c | 8 +++--- - gi/pygi-type.c | 4 +-- - gi/pygi-type.h | 2 +- - gi/pygi.h | 54 ++++++++++++++++----------------------- - gobject/Makefile.am | 6 +++++ - gobject/pygboxed.c | 2 +- - gobject/pygenum.c | 2 +- - gobject/pygflags.c | 2 +- - gobject/pygi-external.h | 67 - ------------------------------------------------- - gobject/pygobject.c | 2 +- - gobject/pygpointer.c | 2 +- - 11 files changed, 40 insertions(+), 111 deletions(-) - -commit 8b3a3baacb45cb3f9112f7597607602fa89c6634 -Author: Tomeu Vizoso -Date: Fri Jun 25 13:54:57 2010 +0200 - - Revert "correctly handle floating objects in gtk" - - This reverts commit 60fdf4b8f738dd0f5c190bc18ddf010032d3c5ca. - - Conflicts: - - gi/gimodule.c - tests/test_everything.py - - gi/gimodule.c | 13 ------------- - tests/test_everything.py | 3 ++- - 2 files changed, 2 insertions(+), 14 deletions(-) - -commit 0f2a09d7eae63abb71723b7cd8fb290dcba33426 -Author: Tomeu Vizoso -Date: Fri Jun 25 13:49:04 2010 +0200 - - Make valgrind happy again - - * gi/pygi-argument.c, gi/pygi-info.c: Zero two GArgument instances. - * gi/pygi-invoke.c: workaround bgo#622711 and zero invocation_state. - - gi/pygi-argument.c | 1 + - gi/pygi-info.c | 2 ++ - gi/pygi-invoke.c | 8 ++++++-- - 3 files changed, 9 insertions(+), 2 deletions(-) - -commit 63afe55906c8637e913783e65b82b540b81bed65 -Author: John (J5) Palmieri -Date: Thu Jun 24 16:13:37 2010 -0400 - - add drawing area demo - - demos/gtk-demo/demos/drawingarea.py | 249 - ++++++++++++++++++++++++++++++++++++ - 1 file changed, 249 insertions(+) - -commit 8bba5f842393a284367cdd15f3d32a8c7745516a -Author: John (J5) Palmieri -Date: Thu Jun 24 14:11:00 2010 -0400 - - sort the demo list - - demos/gtk-demo/gtk-demo.py | 2 ++ - 1 file changed, 2 insertions(+) - -commit b9da82742701ed276b01dee39626cd71cbef8556 -Author: John (J5) Palmieri -Date: Thu Jun 24 13:56:18 2010 -0400 - - rename iter to treeiter so we aren't using a python reserved word - - demos/gtk-demo/gtk-demo.py | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -commit c93935621f2fb1ff5e8c424ae884bd684ea68e50 -Author: John (J5) Palmieri -Date: Thu Jun 24 13:47:54 2010 -0400 - - Fixup for change in buffer API - - * Part of buffer API dealing with TextIter now marked (out - caller-allocates) - - demos/gtk-demo/gtk-demo.py | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -commit 8d9516a593a515290109401a9db7aa259b5aa35c -Author: John (J5) Palmieri -Date: Wed Jun 23 17:04:33 2010 -0400 - - add ListStore, TreeStore and TreeViewColumn APIs - - * this is enough to support the gtk-demo.py shell - * TreeStore and ListStore allow passing in as an argument list - of either python or GLib types to the constructor as a description - of the columns in the model - * TreeStore and ListStore override the append method, allowing - the application developer to send in a list of column values - for one row in the model. Unlike the append in C which - just returns an iter that you can then add data to, - this append actualy appends data in one step - * TreeViewColumn overrides the constructor to allow the adding - of attributes and a cell renderer when constructing the - column - - https://bugzilla.gnome.org/show_bug.cgi?id=620405 - - gi/overrides/Gtk.py | 59 ++++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides.py | 69 - +++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 128 insertions(+) - -commit c305fbeb7bdb44623d5198f4a8f0a374d529fdf4 -Author: Johan Dahlin -Date: Wed Jun 23 14:34:28 2010 -0300 - - [gi] Add -I../gobject to cflags - - Since we're no longer pulling in pygobject cflags, - add this to be able to include pygobject.h - - gi/Makefile.am | 3 +++ - 1 file changed, 3 insertions(+) - -commit 53a093198851e3ba5abd1f6c3314737decd401d8 -Author: Ignacio Casal Quinteiro -Date: Wed Jun 23 18:09:19 2010 +0200 - - Add unit test for add_actions user data. - - tests/test_overrides.py | 20 +++++++++++++++----- - 1 file changed, 15 insertions(+), 5 deletions(-) - -commit 7f829af620cba768de619dd9f228d5d2ebf7fee4 -Author: Paolo Borelli -Date: Wed Jun 23 18:06:46 2010 +0200 - - Pass user_data param when adding actions - - gi/overrides/Gtk.py | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -commit 8f537ccd62f41ebe0db3853e2ae08080666f598f -Author: John (J5) Palmieri -Date: Wed Jun 23 12:02:04 2010 -0400 - - add an exception type to the try/except block - - * we should always specify what exception types we are expecting - - gi/overrides/Gtk.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit f140a8ebf59347162b67b550bd6f62d2eafad29a -Author: Johan Dahlin -Date: Wed Jun 23 12:31:51 2010 -0300 - - Avoid duplicating required versions - - Avoid duplicating the version of all required packages. - Also remove cyclic dependency of pygobject - - https://bugzilla.gnome.org/show_bug.cgi?id=622503 - - configure.ac | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -commit e8bd25355fbe7de38a28b7a0583167a2c0ffc31f -Author: John (J5) Palmieri -Date: Tue Jun 22 15:03:08 2010 -0400 - - return PyList instead of PyTuple for array, return empty list for - NULL arrays - - * returns an empty list when a NULL array (empty array) is encountered - * fix tests to check for lists instead of tuples or None - * test the ability to send in both None and empty list for arrays - and lists - - gi/pygi-argument.c | 7 ++-- - tests/test_everything.py | 5 ++- - tests/test_gi.py | 84 - ++++++++++++++++++++++++------------------------ - 3 files changed, 49 insertions(+), 47 deletions(-) - -commit f312e6a49505eca07815146cfbdb0e48e5b3b8a8 -Author: Tomeu Vizoso -Date: Wed Jun 23 15:42:29 2010 +0200 - - Fix 'make distcheck' - - * Makefile.am: put the tests dir to the end - * g*/Makefile.am: build the .so when running make check - * tests/Makefile.am: Don't pass the src dir to runtests.py and - remove (hopefully) unneeded cruft. - * tests/common.py: Don't add the src dir to the python path - * tests/runtests.py: Don't pass the src dir to common.py - - Makefile.am | 4 +++- - gi/Makefile.am | 1 + - gio/Makefile.am | 1 + - glib/Makefile.am | 2 +- - gobject/Makefile.am | 1 + - tests/Makefile.am | 17 ++--------------- - tests/common.py | 3 +-- - tests/runtests.py | 12 +++++------- - 8 files changed, 15 insertions(+), 26 deletions(-) - -commit 5f82e7d2909cbbbecbf5dbee2342f516c0d1f371 -Author: Tomeu Vizoso -Date: Wed Jun 23 13:59:14 2010 +0200 - - Allow building pygobject without introspection support by providing - --disable-introspection to configure. - - Makefile.am | 6 +++++- - configure.ac | 15 ++++++++------- - gobject/pygi-external.h | 4 ++-- - tests/Makefile.am | 8 ++++++-- - tests/runtests.py | 21 +++++++-------------- - 5 files changed, 28 insertions(+), 26 deletions(-) - -commit cc3ea77318ee572673d2a044deca9001366b0f08 -Author: Tomeu Vizoso -Date: Wed Jun 23 12:26:51 2010 +0200 - - Make sure that sys.argv is a list and not a sequence. - - Because Python's optparse will try to do things on it that can - only be done with list. - - gi/overrides/Gtk.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3d72b8248cc534a689dee5679a729b2fba56c528 -Author: Tomeu Vizoso -Date: Wed Jun 23 12:26:02 2010 +0200 - - Force loading the GObject typelib so we have available the wrappers - for base classes such as GInitiallyUnowned. - - gi/__init__.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit c7c94ef349c30597f2f10d90f74718d678ec7add -Author: John (J5) Palmieri -Date: Tue Jun 22 14:45:48 2010 -0400 - - we shouldn't g_array_free NULL pointers - - https://bugzilla.gnome.org/show_bug.cgi?id=622425 - - gi/pygi-info.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -commit fb1ee243493616d7a7e4f6924c574db39f5a423d -Merge: acf7b43 5f9cb91 -Author: Tomeu Vizoso -Date: Wed Jun 23 12:53:05 2010 +0200 - - Merge branch 'pygi' - -commit 5f9cb91c2b3851056d5e2d7ff1401d4ce2be7c1f -Author: John (J5) Palmieri -Date: Tue Jun 22 15:39:46 2010 -0400 - - remove unneeded TextIter creation in the tests - - tests/test_overrides.py | 3 --- - 1 file changed, 3 deletions(-) - -commit 53c355d2cc0894e7f551e9b4eb719b89188a978e -Author: John (J5) Palmieri -Date: Mon Jun 21 11:42:12 2010 -0400 - - add override for TextBuffer - - * TextBuffer.create_tag takes vargs which we can't bind yet so - change it - to except a keyword list of properties - * override the insert* methods so the developer does not have to - enter a length - - lengths are already encapsulated by a string in Python - - https://bugzilla.gnome.org/show_bug.cgi?id=620583 - - gi/overrides/Gtk.py | 51 - +++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_overrides.py | 25 ++++++++++++++++++++++++ - 2 files changed, 76 insertions(+) - -commit 1d89a88b212c7411ad28e74eda80ae751de92e50 -Author: John (J5) Palmieri -Date: Tue Jun 22 12:46:39 2010 -0400 - - fix up some build issues - - * configure.ac: moved AM_PROG_CC_C_O below AM_PROG_CC_STDC because - autoconf - was complaining that AM_PROG_CC_STDC can't come after AM_PROC_CC_C_0 - * tests/Makefile.am: fix check-local target to use EXEC_NAME so - targets like - make check.gdb work - - configure.ac | 2 +- - tests/Makefile.am | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -commit 4fe0d94c219deb69a2309693202309c53a0e5e69 -Author: John (J5) Palmieri -Date: Tue Jun 22 11:50:30 2010 -0400 - - make the overrides file git friendly by appending to __all__ after - each override - - * modifying the __all__ line for each override would confuse git as - each override needs to get seperate approval before comitting. - Because of - this commits would not always go in in the same order as they - are created. - Also different people working on the same file would start from - different - commit states. This caused conflicts when patches were merged. - * instead of modifying a single hard coded list we now append to - the list - after each override. This creates distinct blocks of changed text - which will not conflict - - gi/overrides/GIMarshallingTests.py | 10 ++++------ - gi/overrides/Gdk.py | 8 ++++---- - gi/overrides/Gtk.py | 7 +++++-- - 3 files changed, 13 insertions(+), 12 deletions(-) - -commit 49321b934603e1ec69fb04082c63902970907d2b -Author: Paolo Borelli -Date: Sun Jun 20 13:27:34 2010 +0200 - - Override Dialog constructor and add_buttons method - - gi/overrides/Gtk.py | 46 - +++++++++++++++++++++++++++++++++++++++++++++- - tests/test_overrides.py | 16 ++++++++++++++++ - 2 files changed, 61 insertions(+), 1 deletion(-) - -commit acf7b43a41ce814f0c57ce609a090826f04771db -Author: Tomeu Vizoso -Date: Mon Jun 21 18:17:38 2010 +0200 - - Post release version bump to 2.21.4 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit a7fa8b80406227a06cf18f8675dbc1f471283829 -Author: Tomeu Vizoso -Date: Mon Jun 21 18:10:32 2010 +0200 - - Update NEWS and release PyGObject-2.21.3 - - NEWS | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 79acac7b86ec52cd3681d94d7f116314c3f00167 -Author: Ludovic L'Hours -Date: Tue Jul 21 16:28:34 2009 +0200 - - Proper handling of null-ok in virtual methods - - https://bugzilla.gnome.org/show_bug.cgi?id=589253 - - codegen/codegen.py | 2 ++ - codegen/reversewrapper.py | 18 +++++++++++++++--- - 2 files changed, 17 insertions(+), 3 deletions(-) - -commit 259a4b08f009aa01451caed20dbb6e68b402da2a -Author: Tomeu Vizoso -Date: Mon Jun 21 17:34:54 2010 +0200 - - Add *~ and *.orig to .gitignore - - .gitignore | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -commit 00a85f6a844714d1715e2f67431747d1a4cdacb1 -Author: Tomeu Vizoso -Date: Mon Jun 21 17:33:56 2010 +0200 - - Fall back to use the floating references API in glib if there isn't - a sinkfunc defined. - - * tests/*: Add ref counting tests for floating objects - * gobject/gobjectmodule.c, gobject/pygobject.c: Fall back to - g_object_ref_sink - or g_object_ref if there isn't a sinkfunc defined. Make sure that - pygobject_sink gets called only once per GObject instance. - - https://bugzilla.gnome.org/show_bug.cgi?id=583909 - - gobject/gobjectmodule.c | 2 - - gobject/pygobject.c | 50 +++++++++++++--------- - gobject/pygobject.h | 1 + - tests/Makefile.am | 2 + - tests/test-floating.c | 95 +++++++++++++++++++++++++++++++++++++++++ - tests/test-floating.h | 60 ++++++++++++++++++++++++++ - tests/test_gobject.py | 19 ++++++++- - tests/testhelpermodule.c | 109 - +++++++++++++++++++++++++++++++++++++++++++++++ - 8 files changed, 315 insertions(+), 23 deletions(-) - -commit e71238a699ae783fd1a59c8a76e3555d8066cf82 -Author: Tomeu Vizoso -Date: Mon Jun 21 13:06:13 2010 +0200 - - Revert "Drop sinkfuncs." - - This reverts commit 04627488220b4f2a16e11f8982af7866fea9f7eb. - - gobject/gobjectmodule.c | 3 ++- - gobject/pygobject.c | 42 ++++++++++++++++++++++++++++++++++-------- - gobject/pygobject.h | 1 - - 3 files changed, 36 insertions(+), 10 deletions(-) - -commit b2661054d6bde673484eab472e69ca021124528d -Author: Johan Dahlin -Date: Sun Jun 20 11:09:57 2010 -0300 - - Merge back pygi - - For reasons outlined at: - http://mail.gnome.org/archives/python-hackers-list/2010-June/msg00009.html - - Makefile.am | 14 +- - configure.ac | 29 +- - demos/gtk-demo/demos/__init__.py | 0 - demos/gtk-demo/demos/appwindow.py | 411 +++++ - demos/gtk-demo/demos/assistant.py | 134 ++ - demos/gtk-demo/demos/builder.py | 57 + - demos/gtk-demo/demos/button_box.py | 121 ++ - demos/gtk-demo/demos/clipboard.py | 238 +++ - demos/gtk-demo/demos/colorselector.py | 121 ++ - demos/gtk-demo/demos/combobox.py | 282 ++++ - demos/gtk-demo/demos/data/alphatest.png | Bin 0 -> - 26529 bytes - demos/gtk-demo/demos/data/apple-red.png | Bin 0 -> 3545 bytes - demos/gtk-demo/demos/data/background.jpg | Bin 0 -> - 22219 bytes - demos/gtk-demo/demos/data/demo.ui | 258 ++++ - demos/gtk-demo/demos/data/floppybuddy.gif | Bin 0 -> 5216 bytes - demos/gtk-demo/demos/data/gnome-applets.png | Bin 0 -> 3090 bytes - demos/gtk-demo/demos/data/gnome-calendar.png | Bin 0 -> 2755 bytes - demos/gtk-demo/demos/data/gnome-foot.png | Bin 0 -> 2916 bytes - demos/gtk-demo/demos/data/gnome-fs-directory.png | Bin 0 -> 2044 bytes - demos/gtk-demo/demos/data/gnome-fs-regular.png | Bin 0 -> 1795 bytes - demos/gtk-demo/demos/data/gnome-gimp.png | Bin 0 -> 3410 bytes - demos/gtk-demo/demos/data/gnome-gmush.png | Bin 0 -> 3244 bytes - demos/gtk-demo/demos/data/gnome-gsame.png | Bin 0 -> 4263 bytes - demos/gtk-demo/demos/data/gnu-keys.png | Bin 0 -> 3852 bytes - demos/gtk-demo/demos/data/gtk-logo-rgb.gif | Bin 0 -> 6427 bytes - demos/gtk-demo/demos/test.py | 14 + - demos/gtk-demo/gtk-demo.py | 266 ++++ - examples/Makefile.am | 2 +- - examples/cairo-demo.py | 121 ++ - gi/Makefile.am | 4 +- - gi/demos/gtk-demo/demos/__init__.py | 0 - gi/demos/gtk-demo/demos/appwindow.py | 411 ----- - gi/demos/gtk-demo/demos/assistant.py | 134 -- - gi/demos/gtk-demo/demos/builder.py | 57 - - gi/demos/gtk-demo/demos/button_box.py | 121 -- - gi/demos/gtk-demo/demos/clipboard.py | 238 --- - gi/demos/gtk-demo/demos/colorselector.py | 121 -- - gi/demos/gtk-demo/demos/combobox.py | 282 ---- - gi/demos/gtk-demo/demos/data/alphatest.png | Bin 26529 -> - 0 bytes - gi/demos/gtk-demo/demos/data/apple-red.png | Bin 3545 -> 0 bytes - gi/demos/gtk-demo/demos/data/background.jpg | Bin 22219 -> - 0 bytes - gi/demos/gtk-demo/demos/data/demo.ui | 258 ---- - gi/demos/gtk-demo/demos/data/floppybuddy.gif | Bin 5216 -> 0 bytes - gi/demos/gtk-demo/demos/data/gnome-applets.png | Bin 3090 -> 0 bytes - gi/demos/gtk-demo/demos/data/gnome-calendar.png | Bin 2755 -> 0 bytes - gi/demos/gtk-demo/demos/data/gnome-foot.png | Bin 2916 -> 0 bytes - .../gtk-demo/demos/data/gnome-fs-directory.png | Bin 2044 -> 0 bytes - gi/demos/gtk-demo/demos/data/gnome-fs-regular.png | Bin 1795 -> 0 bytes - gi/demos/gtk-demo/demos/data/gnome-gimp.png | Bin 3410 -> 0 bytes - gi/demos/gtk-demo/demos/data/gnome-gmush.png | Bin 3244 -> 0 bytes - gi/demos/gtk-demo/demos/data/gnome-gsame.png | Bin 4263 -> 0 bytes - gi/demos/gtk-demo/demos/data/gnu-keys.png | Bin 3852 -> 0 bytes - gi/demos/gtk-demo/demos/data/gtk-logo-rgb.gif | Bin 6427 -> 0 bytes - gi/demos/gtk-demo/demos/test.py | 14 - - gi/demos/gtk-demo/gtk-demo.py | 266 ---- - gi/examples/Makefile.am | 2 - - gi/examples/cairo-demo.py | 121 -- - gi/tests/test_everything.py | 270 ---- - gi/tests/test_gi.py | 1624 - -------------------- - gi/tests/test_overrides.py | 132 -- - pygi-Makefile.am | 28 - - pygi-configure.ac | 60 - - pygi.doap | 34 - - pygobject.doap | 16 +- - tests/Makefile.am | 23 +- - tests/test_everything.py | 270 ++++ - tests/test_gi.py | 1624 - ++++++++++++++++++++ - tests/test_overrides.py | 132 ++ - 68 files changed, 4124 insertions(+), 4186 deletions(-) - -commit 597bd64319d7966045b5b8613ca6fc85668c3f56 -Merge: ec8d148 fa91dfd -Author: Johan Dahlin -Date: Sun Jun 20 10:53:46 2010 -0300 - - Merge branch 'pygi-merge' - -commit fa91dfd3ec79ecd03c9fb59b9363eab4a5b3ff2b -Author: Johan Dahlin -Date: Sun Jun 20 10:53:36 2010 -0300 - - Prepare pygi move - - .gitignore | 40 - - HACKING | 26 - - Makefile.am | 28 - - autogen.sh | 166 -- - configure.ac | 60 - - demos/gtk-demo/demos/__init__.py | 0 - demos/gtk-demo/demos/appwindow.py | 411 ----- - demos/gtk-demo/demos/assistant.py | 134 -- - demos/gtk-demo/demos/builder.py | 57 - - demos/gtk-demo/demos/button_box.py | 121 -- - demos/gtk-demo/demos/clipboard.py | 238 --- - demos/gtk-demo/demos/colorselector.py | 121 -- - demos/gtk-demo/demos/combobox.py | 282 ---- - demos/gtk-demo/demos/data/alphatest.png | Bin 26529 -> - 0 bytes - demos/gtk-demo/demos/data/apple-red.png | Bin 3545 -> 0 bytes - demos/gtk-demo/demos/data/background.jpg | Bin 22219 -> - 0 bytes - demos/gtk-demo/demos/data/demo.ui | 258 ---- - demos/gtk-demo/demos/data/floppybuddy.gif | Bin 5216 -> 0 bytes - demos/gtk-demo/demos/data/gnome-applets.png | Bin 3090 -> 0 bytes - demos/gtk-demo/demos/data/gnome-calendar.png | Bin 2755 -> 0 bytes - demos/gtk-demo/demos/data/gnome-foot.png | Bin 2916 -> 0 bytes - demos/gtk-demo/demos/data/gnome-fs-directory.png | Bin 2044 -> 0 bytes - demos/gtk-demo/demos/data/gnome-fs-regular.png | Bin 1795 -> 0 bytes - demos/gtk-demo/demos/data/gnome-gimp.png | Bin 3410 -> 0 bytes - demos/gtk-demo/demos/data/gnome-gmush.png | Bin 3244 -> 0 bytes - demos/gtk-demo/demos/data/gnome-gsame.png | Bin 4263 -> 0 bytes - demos/gtk-demo/demos/data/gnu-keys.png | Bin 3852 -> 0 bytes - demos/gtk-demo/demos/data/gtk-logo-rgb.gif | Bin 6427 -> 0 bytes - demos/gtk-demo/demos/test.py | 14 - - demos/gtk-demo/gtk-demo.py | 266 ---- - examples/Makefile.am | 2 - - examples/cairo-demo.py | 121 -- - gi/.gitignore | 40 + - gi/HACKING | 26 + - gi/demos/gtk-demo/demos/__init__.py | 0 - gi/demos/gtk-demo/demos/appwindow.py | 411 +++++ - gi/demos/gtk-demo/demos/assistant.py | 134 ++ - gi/demos/gtk-demo/demos/builder.py | 57 + - gi/demos/gtk-demo/demos/button_box.py | 121 ++ - gi/demos/gtk-demo/demos/clipboard.py | 238 +++ - gi/demos/gtk-demo/demos/colorselector.py | 121 ++ - gi/demos/gtk-demo/demos/combobox.py | 282 ++++ - gi/demos/gtk-demo/demos/data/alphatest.png | Bin 0 -> - 26529 bytes - gi/demos/gtk-demo/demos/data/apple-red.png | Bin 0 -> 3545 bytes - gi/demos/gtk-demo/demos/data/background.jpg | Bin 0 -> - 22219 bytes - gi/demos/gtk-demo/demos/data/demo.ui | 258 ++++ - gi/demos/gtk-demo/demos/data/floppybuddy.gif | Bin 0 -> 5216 bytes - gi/demos/gtk-demo/demos/data/gnome-applets.png | Bin 0 -> 3090 bytes - gi/demos/gtk-demo/demos/data/gnome-calendar.png | Bin 0 -> 2755 bytes - gi/demos/gtk-demo/demos/data/gnome-foot.png | Bin 0 -> 2916 bytes - .../gtk-demo/demos/data/gnome-fs-directory.png | Bin 0 -> 2044 bytes - gi/demos/gtk-demo/demos/data/gnome-fs-regular.png | Bin 0 -> 1795 bytes - gi/demos/gtk-demo/demos/data/gnome-gimp.png | Bin 0 -> 3410 bytes - gi/demos/gtk-demo/demos/data/gnome-gmush.png | Bin 0 -> 3244 bytes - gi/demos/gtk-demo/demos/data/gnome-gsame.png | Bin 0 -> 4263 bytes - gi/demos/gtk-demo/demos/data/gnu-keys.png | Bin 0 -> 3852 bytes - gi/demos/gtk-demo/demos/data/gtk-logo-rgb.gif | Bin 0 -> 6427 bytes - gi/demos/gtk-demo/demos/test.py | 14 + - gi/demos/gtk-demo/gtk-demo.py | 266 ++++ - gi/examples/Makefile.am | 2 + - gi/examples/cairo-demo.py | 121 ++ - gi/tests/Makefile.am | 22 + - gi/tests/runtests.py | 21 + - gi/tests/test_everything.py | 270 ++++ - gi/tests/test_gi.py | 1624 - ++++++++++++++++++++ - gi/tests/test_overrides.py | 132 ++ - pygi-Makefile.am | 28 + - pygi-configure.ac | 60 + - tests/Makefile.am | 22 - - tests/runtests.py | 21 - - tests/test_everything.py | 270 ---- - tests/test_gi.py | 1624 - -------------------- - tests/test_overrides.py | 132 -- - 73 files changed, 4248 insertions(+), 4414 deletions(-) - -commit ec8d148eccbb3714093f21b595ea77ae4c7c3bce -Author: Johan Dahlin -Date: Sun Jun 20 10:49:55 2010 -0300 - - [giounix] Make it possible to compile on glib 2.20 - - gio/unix.override | 2 ++ - 1 file changed, 2 insertions(+) - -commit 606018a2c551d890fc2bb987d99683f777598bda -Author: John (J5) Palmieri -Date: Mon Jun 7 16:32:29 2010 -0400 - - Don't free transfer full struct pointers because we can't do it safely - - * Most libraries which are sending back structs as transfer-full - are either annotated incorrectly or should be sending boxed types - * It is much better to throw a warning and leak memory than it is to - call free on an unknown struct pointer. Doing so may cause - a double free - * Specific case is gdk_atom_intern where a GdkAtom is not actually - a pointer - but an integer stuffed into a pointer type - - https://bugzilla.gnome.org/show_bug.cgi?id=620898 - - gi/pygi-argument.c | 9 ++++++++- - gi/pygi-invoke.c | 11 +++++++++-- - 2 files changed, 17 insertions(+), 3 deletions(-) - -commit 433ee2aa029a1482961f478252a06492bd3498e6 -Author: Sjoerd Simons -Date: Tue Jun 15 11:42:28 2010 +0200 - - Release the lock when potentially invoking Python code. - - * gobject/pygobject.c: Release GIL lock when retrieving properties - and when clearing a PyGObject. - - https://bugzilla.gnome.org/show_bug.cgi?id=530935 - - gobject/pygobject.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -commit aa1e82c7eb87620bd73e1edb486f5b9e0d49aa96 -Author: John (J5) Palmieri -Date: Mon Jun 14 18:36:57 2010 -0400 - - add combobox example - - demos/gtk-demo/demos/combobox.py | 282 - +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 282 insertions(+) - -commit a8668694da59c2dd959c875f13337e64ca22f7e9 -Author: John (J5) Palmieri -Date: Mon Jun 14 13:43:53 2010 -0400 - - fix leak in the allow None callbacks patch - - gi/pygi-callbacks.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 729072e73d65e7fd5b5197ebe5a8c53a449d0ec0 -Author: John (J5) Palmieri -Date: Mon Jun 7 17:12:09 2010 -0400 - - Allow passing None for callbacks which are annotated allow-none - - * Many callbacks are optional parameters yet we were asserting on - Py_None - * We now check to see if allow_none is set when setting up callbacks, - if it is set and py_function == Py_None, we set the closure to NULL - and return - * pygi-invoke.c now checks to see if the closure == NULL when setting - arguments - * if it is NULL there is no reason to set the the destroy notify - handler - so we skip that too - - https://bugzilla.gnome.org/show_bug.cgi?id=620906 - - gi/pygi-callbacks.c | 7 +++++++ - gi/pygi-invoke.c | 14 +++++++++++--- - tests/test_everything.py | 4 ++++ - 3 files changed, 22 insertions(+), 3 deletions(-) - -commit a3eb5c7de5836c37aa7ae01dbe98996ec2632c17 -Author: Paolo Borelli -Date: Mon Jun 14 19:06:45 2010 +0200 - - Fix to match latest gtk annotations - - demos/gtk-demo/demos/appwindow.py | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -commit 6306dd73cc74aa9202569eac0eaaa5f825c8dc59 -Author: John (J5) Palmieri -Date: Tue Jun 8 15:03:49 2010 -0400 - - fix variable member names in Gdk.Color override - - * override was using r, g, and b for the red, green, blue components - but - the struct specifies red, green, blue so we need to use those names - - https://bugzilla.gnome.org/show_bug.cgi?id=621007 - - gi/overrides/Gdk.py | 10 +++++----- - tests/test_overrides.py | 6 +++--- - 2 files changed, 8 insertions(+), 8 deletions(-) - -commit d182630e1128fef6f1c2aea28ccd8da4bddd2c8f -Author: Tomeu Vizoso -Date: Thu Jun 10 20:23:13 2010 +0200 - - Post release version bump to 2.21.3 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit c4e64d5d264593051b9a3131e4985a58e8e76f8b -Author: Tomeu Vizoso -Date: Thu Jun 10 20:21:13 2010 +0200 - - Update NEWS and release PyGObject-2.21.2 - - NEWS | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -commit e0fe844d5fe8f7e26316f197444fd4143ed36adf -Author: Tomeu Vizoso -Date: Thu Jun 10 20:09:07 2010 +0200 - - Remove deleted files from the Makefile. - - test_conversion.py - test_enum.py - test_gtype.py - test_subtype.py - - tests/Makefile.am | 4 ---- - 1 file changed, 4 deletions(-) - -commit 495a301cb81c5e914bcef905999265604faa27fc -Author: Tomeu Vizoso -Date: Thu Jun 10 19:39:09 2010 +0200 - - Add myself to the maintainers list in the README - - README | 1 + - 1 file changed, 1 insertion(+) - -commit 04627488220b4f2a16e11f8982af7866fea9f7eb -Author: Tomeu Vizoso -Date: Thu Jun 10 19:24:31 2010 +0200 - - Drop sinkfuncs. - - * use g_object methods to sink floating refs instead of allowing - custom sink functions to be registered - * we now sink inside of pygobject_new_full to handle cases where - a library creates its own gobject via g_object_new and just - needs a python wrapper - - a previous patch had done the sink when creating the gobject, - since it needs to call pygobject_new_full to wrap the object, - this patch handles both cases (e.g. pygobject created object - and externally created gobject) - - https://bugzilla.gnome.org/show_bug.cgi?id=583909 - - gobject/gobjectmodule.c | 3 +-- - gobject/pygobject.c | 42 ++++++++---------------------------------- - gobject/pygobject.h | 1 + - 3 files changed, 10 insertions(+), 36 deletions(-) - -commit 07df124dc06cf506634e95d08397f50a2d07fce2 -Author: Steve Frécinaux -Date: Mon Jun 7 09:47:23 2010 +0200 - - Make the "wrong argument count" exception more explicit. - - Previously we had messages like this one: - TypeError: takes exactly 2 argument(s) (1 given) - - With this patch, they become like this: - TypeError: get_end_iter() takes exactly 2 argument(s) (1 given) - - It makes things much easier to debug when there are several pygi calls - on the same line. - - https://bugzilla.gnome.org/show_bug.cgi?id=620804 - - gi/pygi-invoke.c | 3 ++- - tests/test_everything.py | 6 ++++++ - 2 files changed, 8 insertions(+), 1 deletion(-) - -commit b435319fe830a909cc4d414533b3b66574931e24 -Author: Steve Frécinaux -Date: Mon Jun 7 09:54:06 2010 +0200 - - Use bash explicitely in the pre-commit hook. - - The "builtin" command is not available in all sh flavours, so the - pre-commit hook is going to fail if you use dash or others instead of - bash as your default 'sh' alias. - - https://bugzilla.gnome.org/show_bug.cgi?id=620805 - - pre-commit.hook | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e9ee2916494eb7654004925c1ee1e94f99b14f1a -Author: John (J5) Palmieri -Date: Tue Jun 8 16:55:26 2010 -0400 - - colorselector demo - - demos/gtk-demo/demos/colorselector.py | 121 - ++++++++++++++++++++++++++++++++++ - 1 file changed, 121 insertions(+) - -commit ec598128de9e90dccab662ed2f5511c8d659e156 -Author: Tomeu Vizoso -Date: Tue Jun 8 15:48:33 2010 +0200 - - Update PyGObject dependency to 2.21.1 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 87774a17bd607724a56e18c2eb1ac71b04b7079d -Author: Tomeu Vizoso -Date: Tue Jun 8 10:40:39 2010 +0200 - - Add myself to maintainers - - MAINTAINERS | 4 ++++ - pygobject.doap | 7 +++++++ - 2 files changed, 11 insertions(+) - -commit 46c91a11d448e5e11d142d3362aff1483226bca4 -Author: Colin Walters -Date: Wed May 5 13:54:27 2010 -0400 - - Clear error if we failed the import - - Otherwise we leave the exception set which causes bizarre problems - later in unrelated code. - - https://bugzilla.redhat.com/show_bug.cgi?id=569885 - - https://bugzilla.gnome.org/show_bug.cgi?id=617796 - - gobject/pygi-external.h | 2 ++ - 1 file changed, 2 insertions(+) - -commit c1c41576d053cc1cdd8366d8cd1e59fff1c3a9c6 -Author: John (J5) Palmieri -Date: Mon Jun 7 17:19:30 2010 -0400 - - fix some typos and add a link to a patch which fixes a FIXME - - demos/gtk-demo/demos/clipboard.py | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit e7fabb5024d94a3166766e5fca740741bc50380a -Author: John (J5) Palmieri -Date: Mon Jun 7 16:21:42 2010 -0400 - - clipboard demo - - demos/gtk-demo/demos/clipboard.py | 235 - ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 235 insertions(+) - -commit e0f1dce5ec58d071759f886697501da6eeea549d -Author: John (J5) Palmieri -Date: Sun Jun 6 13:27:46 2010 -0400 - - set is_fully_bound to false - - demos/gtk-demo/demos/button_box.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 986db1c73746d3a8ad7d8d5141c7eed194e7b948 -Author: John (J5) Palmieri -Date: Sat Jun 5 23:53:36 2010 -0400 - - new button box demo - - demos/gtk-demo/demos/button_box.py | 121 - +++++++++++++++++++++++++++++++++++++ - 1 file changed, 121 insertions(+) - -commit e9f5f8a829121e59367bae690442150f144946ad -Author: John (J5) Palmieri -Date: Sat Jun 5 23:26:03 2010 -0400 - - set is_fully_bound to True fro builder example - - demos/gtk-demo/demos/builder.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit d9968c3a4dea1d4a73a9376009cf486c80ea3da6 -Author: John (J5) Palmieri -Date: Sat Jun 5 23:24:36 2010 -0400 - - fix up formatting in demos - - demos/gtk-demo/demos/appwindow.py | 16 ++++++++-------- - demos/gtk-demo/demos/assistant.py | 24 ++++++++++++------------ - demos/gtk-demo/demos/builder.py | 2 +- - 3 files changed, 21 insertions(+), 21 deletions(-) - -commit ffca02536bafb55e8c3bce31cd992365207429f6 -Author: John (J5) Palmieri -Date: Sat Jun 5 14:54:47 2010 -0400 - - add the builder demo - - demos/gtk-demo/demos/builder.py | 57 - +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 57 insertions(+) - -commit a96dbafdf562a2ac6bde4df27919d3628689dbdb -Author: John (J5) Palmieri -Date: Fri Jun 4 17:48:24 2010 -0400 - - add assistant demo - - demos/gtk-demo/demos/assistant.py | 134 - ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 134 insertions(+) - -commit 7e1b8cf32f33d45603aaec76afb0d14be84ffd94 -Author: John (J5) Palmieri -Date: Fri Jun 4 16:56:46 2010 -0400 - - add formatting rules and copyright notice - - demos/gtk-demo/demos/appwindow.py | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -commit 03b99692b81631d397ab62dcd263341465bcee88 -Author: John (J5) Palmieri -Date: Fri Jun 4 16:26:54 2010 -0400 - - add the gtk-demo app along with a couple of demos - - * note there are still a couple of patches in bugzilla that are - needed for this - to run correctly: - - http://bugzilla-attachments.gnome.org/attachment.cgi?id=162682 - - http://bugzilla-attachments.gnome.org/attachment.cgi?id=162764 - - demos/gtk-demo/demos/__init__.py | 0 - demos/gtk-demo/demos/appwindow.py | 393 - +++++++++++++++++++++++ - demos/gtk-demo/demos/data/alphatest.png | Bin 0 -> 26529 bytes - demos/gtk-demo/demos/data/apple-red.png | Bin 0 -> 3545 bytes - demos/gtk-demo/demos/data/background.jpg | Bin 0 -> 22219 bytes - demos/gtk-demo/demos/data/demo.ui | 258 +++++++++++++++ - demos/gtk-demo/demos/data/floppybuddy.gif | Bin 0 -> 5216 bytes - demos/gtk-demo/demos/data/gnome-applets.png | Bin 0 -> 3090 bytes - demos/gtk-demo/demos/data/gnome-calendar.png | Bin 0 -> 2755 bytes - demos/gtk-demo/demos/data/gnome-foot.png | Bin 0 -> 2916 bytes - demos/gtk-demo/demos/data/gnome-fs-directory.png | Bin 0 -> 2044 bytes - demos/gtk-demo/demos/data/gnome-fs-regular.png | Bin 0 -> 1795 bytes - demos/gtk-demo/demos/data/gnome-gimp.png | Bin 0 -> 3410 bytes - demos/gtk-demo/demos/data/gnome-gmush.png | Bin 0 -> 3244 bytes - demos/gtk-demo/demos/data/gnome-gsame.png | Bin 0 -> 4263 bytes - demos/gtk-demo/demos/data/gnu-keys.png | Bin 0 -> 3852 bytes - demos/gtk-demo/demos/data/gtk-logo-rgb.gif | Bin 0 -> 6427 bytes - demos/gtk-demo/demos/test.py | 14 + - demos/gtk-demo/gtk-demo.py | 266 +++++++++++++++ - 19 files changed, 931 insertions(+) - -commit b3b1f029d8d16cf9bd74160009808147d07e3b3f -Author: Tomeu Vizoso -Date: Fri Jun 4 11:25:08 2010 +0200 - - Update gobject-introspection dependency to 0.6.14 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 45c4e46ae93bd83a0e3f3550df6c64ce96bbedb4 -Author: Tomeu Vizoso -Date: Fri Jun 4 11:23:41 2010 +0200 - - Post-release version bump to 0.6.1 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 7a94270dac48b67aabc7dbad156cf1180db9cb5e -Author: Tomeu Vizoso -Date: Fri Jun 4 08:29:42 2010 +0200 - - Pre-release version bump 0.6.0 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 1e42ee6eb25a07a5201f24ffeac18d298a98477e -Author: John (J5) Palmieri -Date: Fri May 28 10:03:11 2010 -0400 - - support for caller-allocates annotations for structs - - * out caller-allocates parameters expect an already constructed - structure - to be passed in by reference. It is then modified and the caller - uses the - modified value. We support this by using only one level of pointer - indirection. - * Only structs are considered to be caller-allocates parameters - even if - they are marked as such by GI. This is because the GI scanner - isn't smart - enough to correctly guess 100% of the time - * GValues are a special case of a caller-allocates parameter when - cleaning - up (e.g. g_value_unset is called). GValues make no sense in - a scripting - language. Developers should never deal with them. - - https://bugzilla.gnome.org/show_bug.cgi?id=620406 - - gi/pygi-invoke.c | 73 - +++++++++++++++++++++++++++++++++++++++++++++--- - tests/test_everything.py | 28 +++++++++++++++++++ - 2 files changed, 97 insertions(+), 4 deletions(-) - -commit c3f467e0ae99aa78c2fdb91b973a272d2fe970bd -Author: John (J5) Palmieri -Date: Wed Jun 2 14:14:16 2010 -0400 - - don't import gobject directly in the tests - - * use from gi.repository import GObject - - tests/test_overrides.py | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -commit 46b5133fea4cd5db57a360b3cbe9ee923e27560c -Author: Tomeu Vizoso -Date: Tue Jun 1 14:28:57 2010 +0200 - - Wrap C arrays in structs as GArrays before converting to Python - - https://bugzilla.gnome.org/show_bug.cgi?id=620247 - - gi/pygi-info.c | 11 +++++++++++ - tests/test_gi.py | 17 +++++++++++++++++ - 2 files changed, 28 insertions(+) - -commit 5f0f9a9c9145a129a063b041424c3109a24d9ead -Author: Tomeu Vizoso -Date: Wed May 26 13:20:27 2010 +0200 - - Install pre-commit hook that checks the code changes for style - conformance - - autogen.sh | 7 +++++++ - pre-commit.hook | 39 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 46 insertions(+) - -commit 1319da5b7f483e48a90b0b7489f77236ba26f479 -Author: Tomeu Vizoso -Date: Wed May 26 12:19:17 2010 +0200 - - Apply consistent whitespace formatting with: - - astyle -p -d -c -S -U -M60 - - This won't affect git blame nor git diff if the switch -w is used. - - gi/gimodule.c | 138 +++---- - gi/pygi-argument.c | 960 - ++++++++++++++++++++++++------------------------ - gi/pygi-boxed.c | 108 +++--- - gi/pygi-callbacks.c | 154 ++++---- - gi/pygi-callbacks.h | 8 +- - gi/pygi-closure.c | 270 +++++++------- - gi/pygi-closure.h | 18 +- - gi/pygi-foreign-cairo.c | 36 +- - gi/pygi-foreign-cairo.h | 36 +- - gi/pygi-foreign.c | 54 +-- - gi/pygi-foreign.h | 10 +- - gi/pygi-info.c | 646 ++++++++++++++++---------------- - gi/pygi-invoke.c | 380 +++++++++---------- - gi/pygi-repository.c | 114 +++--- - gi/pygi-struct.c | 88 ++--- - gi/pygi-type.c | 32 +- - gi/pygi.h | 20 +- - gi/pygobject-external.h | 14 +- - 18 files changed, 1544 insertions(+), 1542 deletions(-) - -commit 6156f15cb15b4c20e975527227135d49207c520a -Author: Tomeu Vizoso -Date: Tue May 25 14:08:51 2010 +0200 - - Prepend gi.repository to the __module__ attribute of wrapper classes. - - https://bugzilla.gnome.org/show_bug.cgi?id=619597 - - gi/module.py | 4 ++-- - tests/test_gi.py | 4 +++- - 2 files changed, 5 insertions(+), 3 deletions(-) - -commit 097b92983b7a322c58fecb1e691ba6ddf5035548 -Author: Tomeu Vizoso -Date: Tue May 25 14:17:13 2010 +0200 - - Correctly identify at creation time: - - * if the class is defined in python -> hook up vfuncs - * if the class wraps a type from a .typelib -> set atributes - * else (GLocalFile) -> do nothing - - https://bugzilla.gnome.org/show_bug.cgi?id=619604 - - gi/types.py | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -commit 686e10fcdb108af9758eb025a3447813c3513a93 -Author: Tomeu Vizoso -Date: Thu Apr 29 10:55:13 2010 +0200 - - Dont complain if another base has implemented the method - - https://bugzilla.gnome.org/show_bug.cgi?id=617153 - - gi/types.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 9f34d120845d936b04546a5cea599ec67e9181a7 -Author: John (J5) Palmieri -Date: Mon May 24 16:16:50 2010 -0400 - - fix up Builder override, add new override methods, and add unit tests - - * check for flags when connecting signals now that we get gi - GObject types - * override the add_from_string and add_objects_from string overrides - so - that you don't have to pass in the length of the buffer - * add test that loads objects from strings and connects them to - signals - - gi/overrides/Gtk.py | 19 +++++++++++-- - tests/test_overrides.py | 72 - ++++++++++++++++++++++++++++++++++++++++++++++--- - 2 files changed, 86 insertions(+), 5 deletions(-) - -commit 1561d2977691f1cb8684f183a2e274c47960d931 -Author: Tomeu Vizoso -Date: Mon May 24 18:48:10 2010 +0200 - - Improve handling of subclasses without __gtype_name__ - - Gives a better message at type registration. - - https://bugzilla.gnome.org/show_bug.cgi?id=616849 - - gi/gimodule.c | 9 +++++++++ - tests/test_gi.py | 13 ++++++++++++- - 2 files changed, 21 insertions(+), 1 deletion(-) - -commit c9d44d4d46c3da3a445000b1db592baa9c378a92 -Author: Tomeu Vizoso -Date: Fri Apr 30 18:17:50 2010 +0200 - - Add support for GArray args - - https://bugzilla.gnome.org/show_bug.cgi?id=617054 - - gi/pygi-invoke.c | 11 +++++++---- - tests/test_gi.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 57 insertions(+), 4 deletions(-) - -commit c171579ee22681e1ee4ad33441c89f1053bdc3d1 -Author: John (J5) Palmieri -Date: Mon May 24 11:48:16 2010 -0400 - - check refcounting of callback userdata in unit tests - - tests/test_everything.py | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -commit 8eb809468fe3e1f8e4f92bd7f25d96f9cf802cd4 -Author: Tomeu Vizoso -Date: Sat May 22 15:12:37 2010 +0200 - - Add support for out args in callbacks - - This patch refactors argument marshalling for closures in - preparation for more complete support. - - Also fixes a bug in the memory management of user_data args. - - https://bugzilla.gnome.org/show_bug.cgi?id=617780 - - gi/pygi-closure.c | 335 - +++++++++++++++++++++++++++++++++++++++++------------- - tests/test_gi.py | 4 + - 2 files changed, 263 insertions(+), 76 deletions(-) - -commit 0df0c956bb2476392c9d81f0a243a7e84c067166 -Author: Tomeu Vizoso -Date: Sun May 23 10:59:27 2010 +0200 - - If None is passed to an interface which takes an object, convert it to - NULL - - * without this patch PyGI treats the None object as a PyGObject - and ends up - extracting garbage data causing a crash - * None's equivalent in C is NULL so we must provide a special case - where we - marshal the None as NULL - - https://bugzilla.gnome.org/show_bug.cgi?id=617880 - - gi/pygi-argument.c | 5 +++++ - tests/test_everything.py | 6 ++++++ - 2 files changed, 11 insertions(+) - -commit 60fdf4b8f738dd0f5c190bc18ddf010032d3c5ca -Author: John (J5) Palmieri -Date: Sat May 22 14:06:37 2010 +0200 - - correctly handle floating objects in gtk - - * this is a stopgap so we work with older pygobject libraries - * there is a patch at - https://bugzilla.gnome.org/show_bug.cgi?id=583909 - which adds the correct fix to pygobject - * once pygobject accepts the above patch this patch does not need to - be reverted because pygobject_register_sinkfunc becomes a noop - * add tests (Tomeu) - - https://bugzilla.gnome.org/show_bug.cgi?id=619007 - - gi/gimodule.c | 12 ++++++++++++ - tests/test_everything.py | 3 +++ - 2 files changed, 15 insertions(+) - -commit 4b369f8aca980fc6a582094d6648f40fe4af5e9f -Author: John (J5) Palmieri -Date: Sat May 22 13:21:30 2010 +0200 - - Return an empty list when a NULL GList and GSList is returned - - * In GTK a GList * and GSList set to NULL is equivilant to empty - list. All - GTK list methods can take a NULL and treat it as an empty list. e.g. - g_list_length(NULL) returns 0 - * PyGtk consitently returns empty list when a NULL is returned for - GList or - GSList return - * Many PyGtk apps do this: - for i in range(len(obj.get_list())): - ... - * If we were to continue to return None, they would have to add - a check - which is needlessly verbose and isn't very "pythonic" - - https://bugzilla.gnome.org/show_bug.cgi?id=619232 - - gi/pygi-argument.c | 6 ------ - tests/test_everything.py | 4 ++-- - 2 files changed, 2 insertions(+), 8 deletions(-) - -commit 71a2148b00dfdda99e0d961ae39b901608724e59 -Author: Steve Frécinaux -Date: Fri May 21 19:05:03 2010 +0200 - - Fix warning in configure. - - The warning is caused by the use of the construction 'CFLAGS+=' in a - sh version that doesn't understand it (in this case, 'dash'). - - https://bugzilla.gnome.org/show_bug.cgi?id=619311 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit aa0357e468eb91e0f3707346e9b32f312fbf51d3 -Author: Tomeu Vizoso -Date: Thu Apr 29 13:06:15 2010 +0200 - - GTypeInterface cannot be unrefed - - https://bugzilla.gnome.org/show_bug.cgi?id=617159 - - gi/gimodule.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit ab1aaff108d23aabd28c3634edfb67236eb55460 -Author: John (J5) Palmieri -Date: Sat May 22 13:09:48 2010 +0200 - - fix NULL array unit tests and fix crasher when sending None as - an array - - * Unit tests were wrong given the annotation for - test_array_int_null_in and - test_array_int_null_out: - - /** - * test_array_int_null_in: - * @arr: (array length=len) (allow-none): - * @len: length - */ - - -- and -- - - /** - * test_array_int_null_out: - * @arr: (out) (array length=len) (allow-none): - * @len: (out) : length - */ - - The (array length=len) annotation meant we don't pass in or - receive the len argument as this is handled under the hood - (Python's representation of an array, the list type, encapsulates - the length inside the type) - - * Fixing up the tests revealed a latent crasher bug when passing - None to an - interface that accepts an array. The fix was to check for NULL - and set - the length argument to 0 when invoking the bound method. - - https://bugzilla.gnome.org/show_bug.cgi?id=619235 - - gi/pygi-invoke.c | 6 +++++- - tests/test_everything.py | 4 ++-- - 2 files changed, 7 insertions(+), 3 deletions(-) - -commit e928ea9b1df9d87314ff8e93479530e26be9bd87 -Author: John (J5) Palmieri -Date: Fri May 14 14:57:27 2010 -0400 - - don't error out on methods with callbacks as return type - - * Right now we just throw an error which means API's like - gtk_about_dialog_set_url_hook aren't able to be called, - * this allows us to call such APIs while printing a warning, in - most cases - API such as this doesn't need to be used anymore and is a result of - early GTK development - - gi/pygi-argument.c | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -commit d963007aab123f4e53a944a66a935db2d22907c2 -Author: John (J5) Palmieri -Date: Mon May 17 11:54:34 2010 -0400 - - reset sys.argv to the return value of Gtk.init_check - - * applications which check command line arguments will error out if it - encounters a GTK command line switch such as --g-fatal-warnings. - * The Gtk.init* API reads these switches and returns a new argv with - the GTK - switches stripped out - * In C argv is modified in place but in Python we must set sys.argv - to the - new modified argument list - * fixes https://bugzilla.gnome.org/show_bug.cgi?id=618889 - - gi/overrides/Gtk.py | 1 + - 1 file changed, 1 insertion(+) - -commit 897420ed97cc4a7b8a806894df5e76ed72617614 -Author: John (J5) Palmieri -Date: Wed May 12 14:25:32 2010 -0400 - - add GtkUIManager and GtkActionGroup overrides - - * fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=618476 - - gi/overrides/Gtk.py | 167 - +++++++++++++++++++++++++++++++++++++++++++++++- - tests/test_overrides.py | 45 +++++++++++++ - 2 files changed, 211 insertions(+), 1 deletion(-) - -commit 865939d29c1e9d69dbe6b9cf89477b5516dbff1f -Author: Zach Goldberg -Date: Thu May 13 01:02:24 2010 -0400 - - Bump version for development to 0.5.2 (hopefully 0.6) - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2674a9546b0246d4a75d71cf1708df77dc0173f9 -Author: Tomeu Vizoso -Date: Wed May 5 15:54:39 2010 +0200 - - Fix overrides.Gdk.Color.__new__ args - - https://bugzilla.gnome.org/show_bug.cgi?id=617757 - - gi/overrides/Gdk.py | 2 +- - tests/Makefile.am | 3 ++- - tests/test_overrides.py | 22 ++++++++++++++++++++++ - 3 files changed, 25 insertions(+), 2 deletions(-) - -commit c20b9f632a35bada1320ccc10fb7d5b2c06b9a88 -Author: John (J5) Palmieri -Date: Thu Apr 29 14:55:33 2010 -0400 - - wrap GObject module so we can go through GI when requesting attrs - - * This gives us the best of both worlds. - - We remain backwards compatable with pygobject by checking for - existing - attrs in the gobject module - - If an attr does not exist we use the GI mechanism to look it up - so that - things like flags look the same whether exported from GObject, Gtk - or any GI managed library - - * add DynamicGObjectModule tests and make tests use the new module - - change import gobject to from gi.repository import GObject - - gi/importer.py | 6 ++-- - gi/module.py | 30 ++++++++++++++++ - tests/test_everything.py | 6 ++-- - tests/test_gi.py | 93 - ++++++++++++++++++++++++++---------------------- - 4 files changed, 87 insertions(+), 48 deletions(-) - -commit 64324a4c629432b2e688299b6edbfd5da4439a2a -Author: John (J5) Palmieri -Date: Fri Apr 30 14:11:55 2010 -0400 - - override Gdk.Drawable to add cairo_create convinience method - - gi/overrides/Gdk.py | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -commit 17fa1289b1e2ed841dd5de09a2ec7c25d401886e -Author: Tomeu Vizoso -Date: Mon May 3 19:13:46 2010 +0200 - - Fix passing callbacks as constructor args - - https://bugzilla.gnome.org/show_bug.cgi?id=617551 - - gi/pygi-callbacks.c | 3 ++- - gi/pygi-callbacks.h | 1 + - gi/pygi-invoke.c | 7 +++++-- - tests/test_everything.py | 21 +++++++++++++++++++++ - 4 files changed, 29 insertions(+), 3 deletions(-) - -commit f9fff978d56ddf2c012b906169ae16abb7fdc2a5 -Author: Tomeu Vizoso -Date: Wed May 5 08:06:03 2010 +0200 - - Avoid freeing garbage - - gi/pygi-invoke.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -commit 5e20c018ae09a936f5ff140df5d1c133c98e98ba -Author: Tomeu Vizoso -Date: Thu Apr 29 13:09:03 2010 +0200 - - Only hookup vfunc implementations for locally-defined methods - - https://bugzilla.gnome.org/show_bug.cgi?id=617160 - - gi/types.py | 10 +++++++++- - tests/test_gi.py | 10 ++++++++++ - 2 files changed, 19 insertions(+), 1 deletion(-) - -commit 3e61e7d4450a2bb133c7f3862e0962a35339ce8d -Author: Tomeu Vizoso -Date: Mon May 3 18:35:13 2010 +0200 - - Fix passing GDestroyNotify - - https://bugzilla.gnome.org/show_bug.cgi?id=617542 - - gi/pygi-invoke.c | 3 ++- - tests/test_everything.py | 10 ++++++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - -commit 9669acd0fad193013ef3505ae231588307f9834c -Author: Tomeu Vizoso -Date: Mon May 3 12:23:58 2010 +0200 - - Move invocation code to its own file - - https://bugzilla.gnome.org/show_bug.cgi?id=617107 - - gi/Makefile.am | 2 + - gi/pygi-info.c | 884 - ---------------------------------------------------- - gi/pygi-invoke.c | 909 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-invoke.h | 37 +++ - gi/pygi-private.h | 1 + - 5 files changed, 949 insertions(+), 884 deletions(-) - -commit 9b923a68dfde06fc2df6321b3f1e53f1c57b3666 -Author: John (J5) Palmieri -Date: Tue Apr 27 19:13:08 2010 -0400 - - Add the Gtk.Builder override - - gi/overrides/Gtk.py | 37 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 36 insertions(+), 1 deletion(-) - -commit 9fc6783406b8263ebd67ceae2730b4e86689b43e -Author: Tomeu Vizoso -Date: Fri Apr 30 15:00:52 2010 +0200 - - Fix GAsyncReadyCallback - - https://bugzilla.gnome.org/show_bug.cgi?id=616236 - - gi/pygi-closure.c | 8 +++++++- - tests/test_everything.py | 16 ++++++++++++++++ - 2 files changed, 23 insertions(+), 1 deletion(-) - -commit 5657ccaaec09e2a3194ea2e9a923724bcc66759e -Author: Tomeu Vizoso -Date: Thu Apr 29 18:32:50 2010 +0200 - - Add override for Gdk.Color - - https://bugzilla.gnome.org/show_bug.cgi?id=617162 - - gi/overrides/Gdk.py | 20 +++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) - -commit 4410abd589a2f64cfbd7bbcb4013fae9e4aa734f -Author: John (J5) Palmieri -Date: Wed Apr 28 13:19:48 2010 -0400 - - make __all__ be a list of strings, fix override mechanism to use - it correctly - - * before we were adding classes to the __all__ module property but - the convention is to use the name of the class - * simplified the check to just check the name against __all__ - instead of trying to get the class and then checking the class - against None as well as in __all__ - * went through all the overrides and made __all__ be a list of strings - - gi/module.py | 9 ++++----- - gi/overrides/GIMarshallingTests.py | 2 +- - gi/overrides/Gdk.py | 2 +- - 3 files changed, 6 insertions(+), 7 deletions(-) - -commit 64fa8f936bad9a90628df446e690d67d947a0a22 -Author: Tomeu Vizoso -Date: Mon Apr 26 11:41:06 2010 +0200 - - One more step at refactoring _wrap_g_function_info_invoke - - https://bugzilla.gnome.org/show_bug.cgi?id=616357 - - gi/pygi-callbacks.c | 22 +- - gi/pygi-callbacks.h | 4 +- - gi/pygi-info.c | 582 - ++++++++++++++++++++++++++++++---------------------- - 3 files changed, 346 insertions(+), 262 deletions(-) - -commit 7fc5528273edae5ecdd5d8bdf0e5b898eec7a624 -Author: Zach Goldberg -Date: Tue Apr 20 23:23:38 2010 -0400 - - Step 1 of refactoring _wrap_g_function_info_invoke - - Original patch by David Malcom - - This patch bitrots *REALLY* fast. - - https://bugzilla.gnome.org/show_bug.cgi?id=616357 - - gi/pygi-info.c | 417 - +++++++++++++++++++++++++++++---------------------------- - 1 file changed, 214 insertions(+), 203 deletions(-) - -commit 1d9c6b6d76a3e27f66e6f0cfc7b16c5191e4fc22 -Author: Tomeu Vizoso -Date: Tue Apr 27 10:24:35 2010 +0200 - - Dont force subclasses to implement all virtual methods of their bases - - https://bugzilla.gnome.org/show_bug.cgi?id=616674 - - gi/types.py | 4 ++-- - tests/test_gi.py | 15 +++++++++++++++ - 2 files changed, 17 insertions(+), 2 deletions(-) - -commit 8a0c48f4dd512797e5cf132f8ec6fb6d4d1e7aaa -Author: Zach Goldberg -Date: Sun Apr 25 15:09:08 2010 -0400 - - Correct the reference counting of userdata in closure handling - - Without this we lose references on every call and eventually end up - free'ing objects - while they are still in use. - - https://bugzilla.gnome.org/show_bug.cgi?id=616786 - - gi/pygi-closure.c | 3 +++ - tests/test_everything.py | 13 +++++++++++++ - 2 files changed, 16 insertions(+) - -commit 2b12049306bf57513c43d08017185468bf897a4a -Author: Zach Goldberg -Date: Tue Apr 20 22:57:14 2010 -0400 - - Change SCOPE_TYPE_INVALID handling to be a more verbose error. - - (Previous commit did not include the proper error message. I blame - git-bz) - - https://bugzilla.gnome.org/show_bug.cgi?id=616356 - - gi/pygi-closure.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 8240320d0b67074ce91bdf7aadcf5951c5a8c45a -Author: Zach Goldberg -Date: Tue Apr 20 23:53:57 2010 -0400 - - Force out arguments to be initialized as NULL. Comes with a test. - - This fix was motivated by a real world library which had a transfer - full - utf8 out argument which sometimes was not set. We would leave - the pointer - dangling and try and free it at the end of invoke() and crash. - Library refused - to change their behavior so we're forced to take care of it on - our end. - - https://bugzilla.gnome.org/show_bug.cgi?id=616043 - - gi/pygi-info.c | 1 + - tests/test_gi.py | 3 +++ - 2 files changed, 4 insertions(+) - -commit 10e558ca283cdd06725bb0d24b5071ccbecc7d13 -Author: Zach Goldberg -Date: Tue Apr 20 22:57:14 2010 -0400 - - Change SCOPE_TYPE_INVALID handling to be a warning and not an error - - Be slightly nicer to library maintainers. It really isn't a fatal - condition - if we don't have a proper scope type, better to leave a good code - comment - and a warning than to cause their code to segv. - - https://bugzilla.gnome.org/show_bug.cgi?id=616356 - - gi/pygi-closure.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit d3b5fae9d609dbcd83deb0fa9102b24faf76787c -Author: Zach Goldberg -Date: Tue Apr 20 22:43:20 2010 -0400 - - Refactor implementation of scope call to allow for multiple calls - during lifetime of function invocation. - - https://bugzilla.gnome.org/show_bug.cgi?id=616343 - - gi/pygi-closure.c | 10 +++++----- - gi/pygi-info.c | 9 +++++++-- - tests/test_everything.py | 9 +++++++++ - 3 files changed, 21 insertions(+), 7 deletions(-) - -commit 3ba666b7ab9c393963922c272e7d87bff50a93f9 -Author: Tomeu Vizoso -Date: Sat Jan 2 16:31:55 2010 +0100 - - Add basic support for unions - - https://bugzilla.gnome.org/show_bug.cgi?id=603598 - - gi/module.py | 3 +- - gi/pygi-argument.c | 24 +++----------- - gi/pygi-boxed.c | 18 +++++++++-- - gi/pygi-info.c | 94 - ++++++++++++++++++++++++++++++++++++++++++++++++------ - gi/pygi-info.h | 1 + - tests/test_gi.py | 56 ++++++++++++++++++++++++++++++++ - 6 files changed, 165 insertions(+), 31 deletions(-) - -commit af9e4e086d160fe7fb24758ed81753e784b198a8 -Author: Simon van der Linden -Date: Fri Jan 22 22:16:32 2010 +0100 - - Bump required GLib version to 2.22 - - Since PyGObject now depends on GLib 2.22.4, there is no need to - keep PyGI - backward-compatible. - - configure.ac | 2 +- - gi/pygi-private.h | 20 -------------------- - 2 files changed, 1 insertion(+), 21 deletions(-) - -commit c0f40de5648e2ebc556c449342a0025ffce2e33b -Author: Tomeu Vizoso -Date: Sun Apr 18 11:50:14 2010 -0400 - - Refactor get_* methods in the *Info wrappers - - https://bugzilla.gnome.org/show_bug.cgi?id=616108 - - gi/pygi-info.c | 360 - +++++++++++++++++++++++++++------------------------------ - 1 file changed, 168 insertions(+), 192 deletions(-) - -commit 24bb89f1310dc2fc8ee6ddaf945342ebf80055cd -Author: Tomeu Vizoso -Date: Tue Apr 20 15:12:47 2010 +0200 - - Print any error messages raised inside _pygi_closure_handle - - https://bugzilla.gnome.org/show_bug.cgi?id=616279 - - gi/pygi-closure.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -commit d1ba23cdd05686ea721425f233371d573a2e9cce -Author: Tomeu Vizoso -Date: Thu Apr 22 19:57:17 2010 +0200 - - Rename variable with a very generic name - - gi/module.py | 28 ++++++++++++++-------------- - 1 file changed, 14 insertions(+), 14 deletions(-) - -commit 391640b30ede50af3667b1019edb72bd79f2c68c -Author: Tomeu Vizoso -Date: Thu Apr 22 19:53:06 2010 +0200 - - Add support for enums without GType - - https://bugzilla.gnome.org/show_bug.cgi?id=616520 - - gi/module.py | 6 +++++- - gi/pygi-argument.c | 22 +++++++++++++++++++++- - gi/types.py | 14 ++++++++++++++ - tests/test_gi.py | 30 ++++++++++++++++++++++++++++-- - 4 files changed, 68 insertions(+), 4 deletions(-) - -commit 89704f60ddae0c81f1383d86491ef2785590a353 -Author: Zach Goldberg -Date: Tue Apr 20 22:20:42 2010 -0400 - - Bump version during development to 0.5.1 - - This follows what is, according to Colin Walters, - standard versioning practice. During development the - version in your config is the *next* version you will release, - not the version after. Thus after a release you make a new commit - bumping to the next development version. - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e203dc7c8f524c16aa52e15758dc3a2b09fbac75 -Author: John Ehresman -Date: Tue Apr 20 20:40:02 2010 -0400 - - Added missing , to keyword list of gio.GFile.set_attribute - - gio/gresolver.override | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 0b222f01ac9ceea1d127083623ad532ecc75bf7e -Author: John Ehresman -Date: Tue Apr 20 20:37:12 2010 -0400 - - Fix arg conversion in gio.GFile.set_attribute - - gio/gfile.override | 232 - +++++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 227 insertions(+), 5 deletions(-) - -commit a579ccc8bea90937bf970be3d461e2b650b0c7d6 -Author: John Ehresman -Date: Tue Apr 20 20:01:53 2010 -0400 - - Set constants under python 2.5 or before - - gobject/gobjectmodule.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit 11fa39a861abf679e01b5f0da97be93ae0adf0f0 -Author: José Alburquerque -Date: Sun Apr 18 20:22:21 2010 -0400 - - Doc Extractor: Use replacements that make sense for &...; - expressions. - - * codegen/docextract_to_xml.py: Use # and   respectively - for - # (#) and  . These are interpreted correctly in XML - and will - not make the parsing crash. - - codegen/docextract_to_xml.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 8dbc2cb016acef7b364804cd9bc8f0b1da37e84b -Author: Zach Goldberg -Date: Sun Apr 18 14:32:06 2010 -0400 - - Bump version for release 0.5.0 - - HACKING | 7 +++++++ - configure.ac | 4 ++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -commit 3293c91d90c5c497b45e42a527d7f79f7435823e -Author: Tomeu Vizoso -Date: Sun Apr 18 14:28:13 2010 -0400 - - One more missing file... - - examples/Makefile.am | 2 ++ - 1 file changed, 2 insertions(+) - -commit 1dc575af19fe985cc3fa3ec0cf18aeab1f43c16d -Author: Tomeu Vizoso -Date: Sun Apr 18 14:18:44 2010 -0400 - - Add more stuff to the tarballs - - Makefile.am | 8 +++++++- - configure.ac | 1 + - 2 files changed, 8 insertions(+), 1 deletion(-) - -commit 8a9bb04755057e934b7f46c917af6ef281a2fedd -Author: Tomeu Vizoso -Date: Sun Apr 18 13:48:45 2010 -0400 - - Add one more missing file to tarballs - - gi/overrides/GIMarshallingTests.py | 0 - gi/overrides/Makefile.am | 1 + - 2 files changed, 1 insertion(+) - -commit 979e01852fc7f830ee91093accdc387fa535075f -Author: Tomeu Vizoso -Date: Sun Apr 18 13:45:29 2010 -0400 - - Add missing file to tarballs - - tests/Makefile.am | 1 + - 1 file changed, 1 insertion(+) - -commit 8b70faa7a9a32b9ea8862f28a503e38f496cfd89 -Author: Tomeu Vizoso -Date: Sun Apr 18 13:11:11 2010 -0400 - - Implement vfuncs. - - https://bugzilla.gnome.org/show_bug.cgi?id=602736 - - gi/gimodule.c | 89 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-argument.c | 1 + - gi/pygi-callbacks.c | 3 +- - gi/pygi-closure.c | 4 +-- - gi/pygi-closure.h | 2 +- - gi/pygi-info.c | 86 - +++++++++++++++++++++++++++++++++++++++++++++++++-- - gi/pygi-info.h | 1 + - gi/types.py | 44 +++++++++++++++++--------- - tests/test_gi.py | 18 +++++++++++ - 9 files changed, 227 insertions(+), 21 deletions(-) - -commit e239faacb4798fe2d166233ca1a19a843a6225e3 -Author: Zach Goldberg -Date: Sun Apr 18 11:59:06 2010 -0400 - - Fix a typo in pygi-callbacks.c header - - gi/pygi-callbacks.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 79aa416ae8632b123da61d79fb820d9e2704209c -Author: Zach Goldberg -Date: Sat Apr 17 12:00:05 2010 -0400 - - Implement nullable argument support, including tests - - https://bugzilla.gnome.org/show_bug.cgi?id=616035 - - gi/pygi-argument.c | 43 +++++++++++++++++++++++++++++++++++++------ - gi/pygi-argument.h | 3 ++- - gi/pygi-info.c | 19 +++++++++++++------ - tests/test_everything.py | 28 ++++++++++++++++++++++++++++ - 4 files changed, 80 insertions(+), 13 deletions(-) - -commit 7d533b8893bc4a8a82fd9708278fa1dce5d3551e -Author: Zach Goldberg -Date: Sat Apr 17 12:56:19 2010 -0400 - - Move some tests from test_gi to test_everything - - tests/test_everything.py | 60 - ++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gi.py | 62 - +----------------------------------------------- - 2 files changed, 61 insertions(+), 61 deletions(-) - -commit a90298cc9e6c0f336f887a71d80b1efd07ec2811 -Author: Tomeu Vizoso -Date: Sun Apr 18 10:44:35 2010 -0400 - - Update to latest version of the pygi-convert.sh script - - pygi-convert.sh | 193 - ++++++++++++++++++++++++++++++++++++++++---------------- - 1 file changed, 137 insertions(+), 56 deletions(-) - -commit 34a39318c674737c6d64f2430456daef86ba1626 -Author: Colin Walters -Date: Sun Apr 18 10:40:44 2010 -0400 - - Add Tomeu's prototype script for converting pygtk to pygi - - pygi-convert.sh | 71 - +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 71 insertions(+) - -commit a3afdb5fd33de0bf11d63857a245a8f5edec242c -Author: Olav Vitters -Date: Sun Apr 18 13:01:58 2010 +0200 - - Fix doap file - - pygi.doap | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 0de73d0bba79f92af22f43693f3575c596712416 -Author: Zach Goldberg -Date: Sat Apr 17 16:01:31 2010 -0400 - - Add Zach Goldberg as a pygi maintainer - - pygi.doap | 5 +++++ - 1 file changed, 5 insertions(+) - -commit a0e22e36e8cf0c1e0da3c0ec48c821fdb5a07ccd -Author: Tomeu Vizoso -Date: Sat Apr 17 11:47:54 2010 -0400 - - Require PyCairo - - configure.ac | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -commit 2778f8a1bf6379a46beec6546c8efcb0fec2d7ad -Author: Tomeu Vizoso -Date: Sat Apr 17 11:40:14 2010 -0400 - - Add examples/cairo-demo.py - - examples/cairo-demo.py | 121 - +++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 121 insertions(+) - -commit 610dd1eec87fab5c8c3badb4d104cba74477c745 -Author: Zach Goldberg -Date: Sat Apr 17 09:17:14 2010 -0400 - - Implementation callback support with scoping and basic argument - support. - - This patch was originally written by - Zach Goldberg with modifications and - review by Simon van der Linden and - Colin Walters . - - This impementation enforces the assumption that any one function - signature can only have one (callback, userdata, destronotify) tuple. - This allows us to move callback creation into the actual function - invoke pipeline and also to keep just one destroy notify callback - around, vastly simplifying the code. - - https://bugzilla.gnome.org/show_bug.cgi?id=603095 - - configure.ac | 2 + - gi/Makefile.am | 4 + - gi/pygi-argument.c | 12 ++- - gi/pygi-callbacks.c | 216 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-callbacks.h | 47 ++++++++++++ - gi/pygi-closure.c | 205 - +++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-closure.h | 57 ++++++++++++++ - gi/pygi-info.c | 49 ++++++++++-- - gi/pygi-private.h | 2 + - tests/test_gi.py | 64 +++++++++++++++- - 10 files changed, 648 insertions(+), 10 deletions(-) - -commit a34cb9f0038a6c89e5e6c5f7761d48a5a833044f -Author: Tomeu Vizoso -Date: Sat Apr 17 10:54:45 2010 -0400 - - Add support for foreign structs - - https://bugzilla.gnome.org/show_bug.cgi?id=603712 - - configure.ac | 6 +++ - gi/Makefile.am | 10 +++- - gi/gimodule.c | 7 +++ - gi/pygi-argument.c | 27 ++++++++++- - gi/pygi-foreign-cairo.c | 103 +++++++++++++++++++++++++++++++++++++++ - gi/pygi-foreign-cairo.h | 55 +++++++++++++++++++++ - gi/pygi-foreign.c | 123 - +++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-foreign.h | 52 ++++++++++++++++++++ - gi/pygi-private.h | 1 + - tests/test_everything.py | 48 ++++++++++++++++++ - 10 files changed, 428 insertions(+), 4 deletions(-) - -commit e73b6f6fe8b5f23a2a390ae0a6bbced593ded155 -Author: Tomeu Vizoso -Date: Fri Apr 16 14:35:13 2010 -0400 - - Allow creating structs with pointers - - https://bugzilla.gnome.org/show_bug.cgi?id=603537 - - gi/pygi-struct.c | 6 ------ - tests/test_gi.py | 3 ++- - 2 files changed, 2 insertions(+), 7 deletions(-) - -commit fc9ff02e53aacf9e77625c70985e99813544912a -Author: Tomeu Vizoso -Date: Fri Apr 16 10:40:40 2010 -0400 - - Add gdb and valgrind variants for the tests - - HACKING | 19 +++++++++++++++++++ - Makefile.am | 12 ++++++++++++ - tests/Makefile.am | 14 +++++++++++++- - 3 files changed, 44 insertions(+), 1 deletion(-) - -commit 695ac7bc5c60371a32538d690c7a15509f3c9637 -Author: John Stowers -Date: Fri Apr 16 14:36:11 2010 +1200 - - Add build docs for windows - - Makefile.am | 1 + - README.win32 | 24 ++++++++++++++++++++++++ - 2 files changed, 25 insertions(+) - -commit e580da87f0b2fd36cb5d8008fb2fb0c3b01f456a -Author: John Stowers -Date: Thu Apr 15 13:40:39 2010 +1200 - - Setup.py cosmetic tidy - - * Remove local doc install, point to website instead - * link to versioned docs - - pygobject_postinstall.py | 43 ++++++++++++++++++++++++++----------------- - setup.py | 39 ++++++++++++++------------------------- - 2 files changed, 40 insertions(+), 42 deletions(-) - -commit 69ecd506c83ddf180c6cc9a2a8dc753a02543959 -Author: John Stowers -Date: Sat Jul 25 14:12:30 2009 +1200 - - Fix crash when importing gio - - Only seems to be necessary on windows, but - no harm on linux as multiple calls to init - are OK - - gio/giomodule.c | 3 +++ - 1 file changed, 3 insertions(+) - -commit 5d159a13d89587cba189a0ca3203ac003e2f1f2b -Author: John Stowers -Date: Thu Apr 15 22:52:48 2010 +1200 - - Bug 589671 - Dont use generate-constants - - This breaks the build using distutils, and it is - largely unneeded. Just add the G_XXX constants - to the module directly - - gobject/Makefile.am | 16 +-------- - gobject/constants.py | 83 - ++++++++++++++++++++++++++++++++++++++++++++ - gobject/constants.py.in | 50 -------------------------- - gobject/generate-constants.c | 44 ----------------------- - gobject/gobjectmodule.c | 35 +++++++++++++++++++ - setup.py | 2 +- - tests/runtests.py | 3 +- - 7 files changed, 121 insertions(+), 112 deletions(-) - -commit 6d7a3ab9ce352692d0faccbf106974d264fa953d -Author: John Stowers -Date: Thu Apr 15 22:49:17 2010 +1200 - - Bug 589671 - Fix setup.py for windows build - - * Building pyglib as a static private library - * Update to include new defs - * Modernise setup.py and add more util functions - to dsextras - - dsextras.py | 32 ++++++++++++++++--- - setup.py | 102 - +++++++++++++++++++++++++++++++++++++++++++++++++++--------- - 2 files changed, 116 insertions(+), 18 deletions(-) - -commit d11ef47072acae5801ce25c68d1289e425eb9fc2 -Author: John Stowers -Date: Thu Apr 15 22:48:28 2010 +1200 - - Include pygsource.h - - glib/pygiochannel.c | 1 + - 1 file changed, 1 insertion(+) - -commit c5f6af4844c74354abc508d17969d9d45153acf2 -Author: Tomeu Vizoso -Date: Thu Apr 15 14:25:59 2010 -0400 - - Add metadata to the .doap file - - pygi.doap | 3 +++ - 1 file changed, 3 insertions(+) - -commit 81796cb77cbe6b9598a652bd63c047af93e747ee -Author: John (J5) Palmieri -Date: Wed Apr 14 12:01:43 2010 -0400 - - override that wasn't checked in - fixes some test cases - - gi/overrides/GIMarshallingTests.py | 69 - ++++++++++++++++++++++++++++++++++++++ - 1 file changed, 69 insertions(+) - -commit de5d2ea1584b01af809346316c7fbd4955a9db1d -Author: Colin Walters -Date: Wed Apr 14 10:06:07 2010 -0400 - - [Makefile.am] Clean up CFLAGS handling, don't override all: target - - First, we should move the CFLAGS into AM_CFLAGS, otherwise the - per-target CFLAGS forces Automake to prefix object files, which - is unnecessary since we only have one target. - - More importantly, avoid overriding the all: target here; that's - owned by Automake. Use all-local instead to append things to - the end of the normal build. - - gi/Makefile.am | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -commit 5a47e96e3f580c973e6880dafa747f54c144c760 -Author: Tomeu Vizoso -Date: Tue Apr 13 19:15:49 2010 -0400 - - Use GIMarshallingTests (old TestGI) in gobject-introspection - - gi/overrides/TestGI.py | 69 -- - tests/Makefile.am | 40 - - tests/libtestgi.c | 2924 - ------------------------------------------------ - tests/libtestgi.h | 628 ----------- - tests/test_gi.py | 832 +++++++------- - 5 files changed, 416 insertions(+), 4077 deletions(-) - -commit 681832c3cd040433a488a400693b68f213bf7078 -Author: José Alburquerque -Date: Tue Apr 13 13:33:12 2010 -0400 - - codegen/docextract_to_xml.py: One more &...; replacement ( ). - - * codegen/docextract_to_xml.py: Replace   which also causes - errors with a regular space. - - codegen/docextract_to_xml.py | 1 + - 1 file changed, 1 insertion(+) - -commit bd4e7f2459e34957aaae59b9be807d6dff5ec1eb -Author: José Alburquerque -Date: Tue Apr 13 12:28:10 2010 -0400 - - codegen/docextract_to_xml.py: Replace some &..; that cause errors. - - * codegen/docextract_to_xml.py (escape_text): Replace some &..; - expressions that cause errors with more appropriate output. - - codegen/docextract_to_xml.py | 4 ++++ - 1 file changed, 4 insertions(+) - -commit f00b9ce91fc9c3aabd4af4132fc112d9e415e12e -Author: José Alburquerque -Date: Sun Apr 11 17:46:40 2010 -0400 - - codegen/docextract_to_xml.py: Handle C++ multi-line comments. - - * codegen/docextract_to_xml.py (escape_text): Translate '/*' - and '*/' - in text to '/ *' and '* /' respectively so that comment errors - don't - show up when the descriptions that include C++ code with C++ - multi-line comments are used in Doxygen blocks. - - codegen/docextract_to_xml.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -commit a2fcdecbb5e109da5568084d7acb2332af83b6f5 -Author: José Alburquerque -Date: Sun Apr 11 16:15:01 2010 -0400 - - codegen/docextract.py: Stop final section processing on first - match. - - * codegen/docextract.py (process_final_sections): Modify the final - section pattern matching for loop to stop on first match so - that it - doesn't match both a colon return ('Returns: ...') and a no colon - return ('Returns ...') which leads to annotation extraction - errors. - - codegen/docextract.py | 4 ++++ - 1 file changed, 4 insertions(+) - -commit 825fd305f03b726665edca34963978ce27448182 -Author: José Alburquerque -Date: Sun Apr 11 15:45:09 2010 -0400 - - Update doc extraction tool to handle GObjectIntrospection - annotations. - - * codegen/docextract.py (FunctionDoc): Renamed class to GtkDoc. - (GtkDoc::annotations): Added a list field to store annotations - which - are 2-tuples of (name, value). - (GtkDoc::ret): Modified field to store the return description - along - with a list of annotations as described above. - (GtkDoc::params): Now holds a list of 3-tupples: name, - description and - annotations (as described above). - (GtkDoc::block_type): Add a field to tell if the comment block - is a - function block, signal block or property block. - (GtkDoc::set_type): - (GtkDoc::get_type): Add methods for setting/getting the block - type. - (GtkDoc::add_param): Modified to also accept a list of - annotations to - be added with the parameter. - (GtkDoc::add_annotation): - (GtkDoc::get_annotations): Added methods to add/get annotations - for - the comment block. - (GtkDoc::append_description): Renamed to append_to_description(). - (GtkDoc::get_param_description): Removed unused method. - (GtkDoc::get_description): Added method to get block description. - (GtkDoc::add_return): Added method to add a return accepting - the first - line of the description and its annotations. - (GtkDoc::append_return): Renamed to append_to_return(). - (Regular expressions): - - Made the names of the variables un-abbreviated. - - - Added 'since', 'deprecated' and 'rename to' regular - expressions. - - - Modified the return matching regular expression so that - it doesn't - match descriptions that begin with 'Returns ...'. - This improves - the docs of many function. - - - Added signal and property comment block identifier matching - regular - expressions in case those are useful. - - - Modified existing identifier matching regular expressions - (function, - signal, and property regular expressions) to properly parse - annotations. Also added a regular expression for extracting - annotations from the parameter and return descriptions. - - - Refined the function name matching regular expression to - only accept - identifiers that begin with a lowercase letter. This eliminates - 'SECTION:' matches. - - - Finally, grouped commonly related expressions like - return_pattern, - since_pattern, etc. into groups (in lists) so that matching - those - sections can be done using loops. - - (Parsing algorithm): Modified the algorithm to use a functional - approach to parsing. Extra methods like skip_to_comment() and - processs_params() have been added and used in the parse_file() - function to now process the comment blocks. - (parse_dir): Added file processing output to stderr. - * codegen/docextract_to_xml.py (usage): Added function to - print out - the usage. - (print_annotations): Added function to print the given list of - annotations. - (options): Added --with-signals (-i), with-properties (-p) and - --with-annotation (-a) to the existing --source-dir (-s) option. - - (algorithm): Now prints annotations, if specified. Also, prints - signals and properties correctly (using names like - Class::signal-one - for signals and Classs:property) with xml such as .... The return xml is slightly modified with - annotations but this would only be exhibited if annotation xml is - requested. - - codegen/docextract.py | 439 - ++++++++++++++++++++++++++++++++++--------- - codegen/docextract_to_xml.py | 87 ++++++--- - 2 files changed, 414 insertions(+), 112 deletions(-) - -commit 9fef1acb42cd900d4a814a7378f60bc189121785 -Author: Tomeu Vizoso -Date: Fri Apr 9 13:47:03 2010 +0200 - - Always create the .so link - - gi/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit e9f7fd414e94595e40eb1ba0fc471ca69136d82f -Author: Paul Bolle -Date: Thu Apr 8 11:52:25 2010 +0200 - - Docs: replace gio.IO_ERROR_* with gio.ERROR_* - - Signed-off-by: Paul Bolle - - docs/reference/pygio-file.xml | 58 - ++++++++++++++++++------------------ - docs/reference/pygio-inputstream.xml | 22 +++++++------- - docs/reference/pygio-mount.xml | 10 +++---- - 3 files changed, 45 insertions(+), 45 deletions(-) - -commit 4cbd9941c5705970a9f7a429e236e1203d3155a1 -Author: Gian Mario Tagliaretti -Date: Mon Apr 5 18:10:42 2010 +0200 - - Bug 613341 - pygobject tests seem to require pygtk causing a circular - dependencies problem - - move tests that require pygtk to pygtk itself - - tests/test_conversion.py | 83 -------------- - tests/test_enum.py | 234 -------------------------------------- - tests/test_gtype.py | 112 ------------------ - tests/test_subtype.py | 289 - ----------------------------------------------- - 4 files changed, 718 deletions(-) - -commit ef0ceb266a45715ece58642fb0042e3376416755 -Author: Simon van der Linden -Date: Wed Feb 3 20:33:03 2010 +0100 - - Add modelines and copyright information to overrides modules - - gi/overrides/Gdk.py | 21 +++++++++++++++++++++ - gi/overrides/Gtk.py | 21 +++++++++++++++++++++ - gi/overrides/TestGI.py | 20 ++++++++++++++++++++ - 3 files changed, 62 insertions(+) - -commit 5106523a4b8378997a1e6cb0488398aa73e7d9d5 -Author: Simon van der Linden -Date: Wed Feb 3 20:29:55 2010 +0100 - - Fix and complete overrides tests - - Those tests were missing in the last commit - - https://bugzilla.gnome.org/show_bug.cgi?id=602830 - - gi/overrides/TestGI.py | 49 - +++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gi.py | 8 +++++++- - 2 files changed, 56 insertions(+), 1 deletion(-) - -commit 23fc0f615d87994acafd9d39e92dd92b587fc2eb -Author: Simon van der Linden -Date: Thu Jan 21 17:30:51 2010 +0100 - - Don't raise an error in _pygi_import if pygi support is disabled - - http://bugzilla.gnome.org/show_bug.cgi?id=607674 - - gobject/pygboxed.c | 6 +----- - gobject/pygi-external.h | 1 - - gobject/pygobject.c | 6 +----- - gobject/pygpointer.c | 6 +----- - 4 files changed, 3 insertions(+), 16 deletions(-) - -commit aefac8c5f64bf059dd6652f8a843d17b34fa0854 -Author: Simon van der Linden -Date: Fri Jan 22 22:22:37 2010 +0100 - - Remove support for pointers to basic types as input-only argument - and return value - - There is no reason for an API to use such things, and - g_function_info_invoke - broke such features. - - https://bugzilla.gnome.org/show_bug.cgi?id=607759 - - gi/pygi-argument.c | 586 ++++------------------------------------------- - gi/pygi-argument.h | 1 - - gi/pygi-info.c | 8 +- - tests/libtestgi.c | 660 - ----------------------------------------------------- - tests/libtestgi.h | 86 ------- - tests/test_gi.py | 144 ------------ - 6 files changed, 47 insertions(+), 1438 deletions(-) - -commit eaf7cb8ebb7e34f9493ac83b2f04af4dcf45f40f -Author: Simon van der Linden -Date: Fri Jan 22 13:41:21 2010 +0100 - - Restore the overrides support - - Add a ModuleProxy in front of the DynamicModule when an overrides - module is - present. There is no need for an overrides module to be a class; - it can just be a module. - - Add an override decorator to override the wrapper of a registered - type. - - Adapt Gdk and Gtk accordingly. - - Add tests. - - https://bugzilla.gnome.org/show_bug.cgi?id=602830 - - gi/importer.py | 40 +++++++------------- - gi/module.py | 43 ++++++++++++++------- - gi/overrides/Gdk.py | 42 +++++++++++++-------- - gi/overrides/Gtk.py | 16 ++++---- - gi/types.py | 6 +++ - tests/libtestgi.c | 105 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - tests/libtestgi.h | 49 ++++++++++++++++++++++++ - tests/test_gi.py | 36 ++++++++++++++++++ - 8 files changed, 273 insertions(+), 64 deletions(-) - -commit 289d641775d1ea52d2a5379126b70b7fcee46683 -Author: Tomeu Vizoso -Date: Sun Jan 10 21:01:59 2010 +0100 - - Initialize PyGPollFD_Type.fd_obj to NULL - - https://bugzilla.gnome.org/show_bug.cgi?id=606582 - - gio/gcancellable.override | 1 + - 1 file changed, 1 insertion(+) - -commit b11cf2595987c1f0fc4ffd834f07c98b92aa2355 -Author: Simon van der Linden -Date: Fri Jan 8 21:10:28 2010 +0100 - - Initialize struct fields to 0 when allocating - - gi/pygi-struct.c | 2 +- - tests/test_gi.py | 5 +++++ - 2 files changed, 6 insertions(+), 1 deletion(-) - -commit b4189be2b2d3c350fdf33e27309bee5a72e4f72a -Author: Simon van der Linden -Date: Fri Jan 8 20:33:44 2010 +0100 - - Don't set a default constructor for structures. - - Update tests accordingly. - - The reason for this change is that setting __new__ in the metaclass - doesn't let - one overrides it afterwards, in a subclass (in my experience, at - least, even - though it seems weird). - - https://bugzilla.gnome.org/show_bug.cgi?id=603536 - - gi/types.py | 35 +++++++---------------------------- - tests/libtestgi.c | 33 --------------------------------- - tests/libtestgi.h | 7 ------- - tests/test_gi.py | 21 ++++++++++----------- - 4 files changed, 17 insertions(+), 79 deletions(-) - -commit 4db68b958ea11bd2c3a88067cae03fd6bdd1d24b -Author: Simon van der Linden -Date: Tue Jan 5 13:36:44 2010 +0100 - - Suppress compilation warnings - - gi/pygi-argument.c | 3 ++- - gi/pygi-boxed.c | 2 -- - gi/pygobject-external.h | 2 +- - 3 files changed, 3 insertions(+), 4 deletions(-) - -commit 4e2efa91d101bf755739e1cca8eee41eb0ad20fd -Author: Gian Mario Tagliaretti -Date: Mon Jan 4 08:35:14 2010 +0100 - - Bug 605937 - pygobject: Makefile.am sets $TMPDIR, disrupting distcc - - Committed a patch from Kevin Pyle - - Makefile.am | 27 +++++++++++++-------------- - 1 file changed, 13 insertions(+), 14 deletions(-) - -commit 8ddcbca0e98e0b0c082170a2b2b6cfcbd7864b40 -Author: Simon van der Linden -Date: Fri Dec 11 22:24:30 2009 +0100 - - sys.path must be modified after pygtk is imported - - Otherwise, sys.path is overridden by pygtk and gi.repository is - loaded from the - system's default site-package directory. - - tests/runtests.py | 1 - - tests/test_gi.py | 3 +++ - 2 files changed, 3 insertions(+), 1 deletion(-) - -commit 284a1e1c0143c95d3007cf58e6c248b5d11fb4d1 -Author: Gian Mario Tagliaretti -Date: Sun Jan 3 11:02:57 2010 +0100 - - Wrap gio.Cancellable.make_pollfd() and add a test - - gio/Makefile.am | 1 + - gio/gcancellable.override | 37 +++++++++++++++++++++++++++++++++++++ - gio/gio.override | 3 +++ - tests/test_gcancellable.py | 15 +++++++++++++++ - 4 files changed, 56 insertions(+) - -commit 82d7bcbf37200ee2ef5892dd12bebd2f39965c56 -Author: Gian Mario Tagliaretti -Date: Sat Jan 2 23:15:56 2010 +0100 - - Make cancellable an optional parameter in many methods - - gio/gio.defs | 102 - +++++++++++++++++++++++++++++------------------------------ - 1 file changed, 51 insertions(+), 51 deletions(-) - -commit 49a078cd22d55dc33a03ecfda235d63955edc741 -Author: Gian Mario Tagliaretti -Date: Sat Jan 2 23:15:21 2010 +0100 - - Post release version bump to 2.21.2 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 4f9f1f43ab4e2cfb204ffa0e257a34cfd95d84e2 -Author: Gian Mario Tagliaretti -Date: Sat Jan 2 22:58:36 2010 +0100 - - Update NEWS and release PyGObject-2.21.1 - - NEWS | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 55 insertions(+) - -commit c1f34be73bd186d7b4682dfef133da2c4229d213 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 20:25:35 2010 +0100 - - Wrap gio.Volume.eject_with_operation() - - gio/gvolume.override | 54 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 54 insertions(+) - -commit 9b76fbff6f6897aaf26ed4644c1f19efc2826917 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 20:22:21 2010 +0100 - - gio.Mount.unmount_with_operation() fix a copy/paste leftover - - gio/gmount.override | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 6f459786dd641cd49d81eba403d940620f961cab -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 20:21:05 2010 +0100 - - Wrap gio.Mount.eject_with_operation() - - gio/gmount.override | 54 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 54 insertions(+) - -commit d4b5d1b4839364e5676eb2da28f1d21db7e2552d -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 20:15:38 2010 +0100 - - Wrap gio.Mount.unmount_mountable_with_operation() - - gio/gmount.override | 54 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 54 insertions(+) - -commit e919d47c2430451b436cec955e9b99237f97028c -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 18:22:46 2010 +0100 - - Wrap File.unmount_mountable_with_operation() - - gio/gfile.override | 54 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 54 insertions(+) - -commit 5a614df9c5507d67f240462f7bf71b4cd411addf -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 18:14:11 2010 +0100 - - Wrap gio.File.stop_mountable() - - gio/gfile.override | 52 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 52 insertions(+) - -commit 6af506647f36f2b825bc6556df5ee57fa7721906 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 18:10:49 2010 +0100 - - Wrap gio.File.start_mountable() - - gio/gfile.override | 52 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 52 insertions(+) - -commit e700efc839fc0b651fc9794a1611190bffa80263 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 18:02:46 2010 +0100 - - Wrap gio.File.replace_readwrite_async() - - gio/gfile.override | 55 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 55 insertions(+) - -commit 92662f129fc728258fd5e34f53dcb081e3715017 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 17:00:26 2010 +0100 - - Wrap gio.File.poll_mountable() - - gio/gfile.override | 41 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 41 insertions(+) - -commit 99902b786500948c3278779841e4db54223b9256 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 16:56:26 2010 +0100 - - Wrap gio.File.open_readwrite_async() - - gio/gfile.override | 44 ++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - -commit 8cff5d53183ae81364ac74a34a1d52e55e082eb4 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 16:50:15 2010 +0100 - - Wrap gio.File.eject_mountable_with_operation() - - gio/gfile.override | 54 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 54 insertions(+) - -commit ca436fe7785fd24b0f0e65f2f8c9fa6478277682 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 13:30:24 2010 +0100 - - Wrap gio.File.create_readwrite_async() and add a test - - gio/gfile.override | 51 - +++++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gio.py | 24 ++++++++++++++++++++++++ - 2 files changed, 75 insertions(+) - -commit f72c5e451dfaeb01b3c3d9243fed2732d3620462 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 13:20:11 2010 +0100 - - Wrap gio.Drive.stop() - - gio/gdrive.override | 52 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 52 insertions(+) - -commit 29043bade408338cefa13fb4b0c875aabd3ef05e -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 13:00:42 2010 +0100 - - Wrap gio.Drive.start() - - gio/gdrive.override | 52 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 52 insertions(+) - -commit dff374287bbecc8af782bbc726fad86c6c867754 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 12:45:29 2010 +0100 - - Add more remainders on missing methods of gio.Socket and related types - - gio/gsocket.override | 3 +++ - 1 file changed, 3 insertions(+) - -commit b8c7e996498bd72df551011af85ff05ef7335b4f -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 12:41:08 2010 +0100 - - Wrap gio.SocketListener.accept_socket_async|finish() and add a test - - gio/gsocket.override | 86 - +++++++++++++++++++++++++++++++++++++++++++++++++-- - tests/test_gsocket.py | 24 ++++++++++++++ - 2 files changed, 108 insertions(+), 2 deletions(-) - -commit a5ae2d5ba3db34967fe07a3cc97b75df2793988c -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 12:28:53 2010 +0100 - - Wrap gio.SocketListener.accept_finish() and add a test - - gio/gsocket.override | 44 ++++++++++++++++++++++++++++++++++++++++++-- - tests/test_gsocket.py | 24 ++++++++++++++++++++++++ - 2 files changed, 66 insertions(+), 2 deletions(-) - -commit a5ab26cc1bb3e9dd57e2fdb26ef5c02e8066d097 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 11:19:34 2010 +0100 - - Wrap gio.SocketListener.accept_async() - - gio/gsocket.override | 42 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - -commit c9496b29ef9ef232020a4044577d2947353953a5 -Author: Gian Mario Tagliaretti -Date: Fri Jan 1 11:14:35 2010 +0100 - - Wrap gio.SocketListener.accept_socket() and add a test - - gio/gsocket.override | 48 - +++++++++++++++++++++++++++++++++++++++++++++++- - tests/test_gsocket.py | 13 +++++++++++++ - 2 files changed, 60 insertions(+), 1 deletion(-) - -commit 1aa5e301c49f11e1c5ef58de44b4b03f714d1a70 -Author: Gian Mario Tagliaretti -Date: Thu Dec 31 16:35:18 2009 +0100 - - Wrap gio.SocketListener.accept() and add a test - - gio/gsocket.override | 46 +++++++++++++++++++++++++++++++++++++++++++++- - tests/test_gsocket.py | 13 +++++++++++++ - 2 files changed, 58 insertions(+), 1 deletion(-) - -commit aaedcf166c78baf5449ef59d0ade4a29077fedc7 -Author: Gian Mario Tagliaretti -Date: Thu Dec 31 16:25:33 2009 +0100 - - Make cancellable optional in gio.SocketClient.connect_to_host() - - gio/gio.defs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 3829d7667b19126fb74562b28d271e616b154c99 -Author: Gian Mario Tagliaretti -Date: Thu Dec 31 15:25:10 2009 +0100 - - Wrap gio.SocketListener.add_address() and add a test - - gio/gsocket.override | 57 - ++++++++++++++++++++++++++++++++++++++++++++++++++- - tests/test_gsocket.py | 9 ++++++++ - 2 files changed, 65 insertions(+), 1 deletion(-) - -commit 5bec72f34ea75bc56158cae5c39d61a2a4e7e601 -Author: Gian Mario Tagliaretti -Date: Thu Dec 31 10:19:47 2009 +0100 - - Add more remainders on missing methods of gio.Socket and related types - - gio/gsocket.override | 8 ++++++++ - 1 file changed, 8 insertions(+) - -commit b08b20f2b1a57bcbf400d6fe8e87cf052bdb719d -Author: Gian Mario Tagliaretti -Date: Thu Dec 31 10:16:18 2009 +0100 - - Wrap gio.SocketClient.connect_to_service_async() - - gio/gsocket.override | 47 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 47 insertions(+) - -commit 116ea1bfe32946e67aa54eb8dc7b977e57f254c2 -Author: Gian Mario Tagliaretti -Date: Thu Dec 31 10:10:43 2009 +0100 - - Wrap gio.SocketClient.connect_to_host_async() - - gio/gsocket.override | 48 - ++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 48 insertions(+) - -commit 9c930910505d5b9001b8cec17ff98fadeaa799e2 -Author: Gian Mario Tagliaretti -Date: Thu Dec 31 09:59:46 2009 +0100 - - Wrap gio.SocketClient.connect_async() - - gio/gsocket.override | 45 +++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 45 insertions(+) - -commit dff024256295c15e49888ad9d5fef74a7746edd7 -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 23:44:25 2009 +0100 - - Wrap gio.SocketAddressEnumerator.next_async() and add a test - - gio/gsocket.override | 42 ++++++++++++++++++++++++++++++++++++++++++ - tests/test_gsocket.py | 16 ++++++++++++++++ - 2 files changed, 58 insertions(+) - -commit e2330bd0d6cbc49b0ecb27b30e3b0593935ce229 -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 23:43:14 2009 +0100 - - Add a missing object gio.InetSocketAddress new in GIO 2.22 - - gio/gio-types.defs | 7 +++++++ - gio/gio.defs | 31 +++++++++++++++++++++++++++++++ - 2 files changed, 38 insertions(+) - -commit 6040b33467ea381c6cb02f6a5efc0745fa8fa47b -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 22:54:47 2009 +0100 - - Make cancellable optional for gio.SocketAddressEnumerator.next() - - gio/gio.defs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit b19f59790b9de943d69b6c5e483928e0443c3d20 -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 22:17:44 2009 +0100 - - Add a remainder of the Socket methods that needs manual wrapping still - - gio/gsocket.override | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 771a7c3fdef7b2e98e509293a8376a81c1282286 -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 17:20:35 2009 +0100 - - Wrap gio.Socket.condition_wait() and add a test - - gio/gsocket.override | 27 +++++++++++++++++++++++++++ - tests/test_gsocket.py | 6 +++++- - 2 files changed, 32 insertions(+), 1 deletion(-) - -commit 50960656815b0897a5ebe5f011537b8dcbdc857e -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 16:21:49 2009 +0100 - - Wrap gio.Socket.condition_check() and add a test - - gio/Makefile.am | 1 + - gio/gio.override | 1 + - gio/gsocket.override | 41 +++++++++++++++++++++++++++++++++++++++++ - tests/test_gsocket.py | 21 +++++++++++++++++++++ - 4 files changed, 64 insertions(+) - -commit de7a359e81792ae8573ac944455ea289985449ed -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 14:07:52 2009 +0100 - - Wrap gio.Resolver.lookup_service_finish() and add a test - - gio/gresolver.override | 37 +++++++++++++++++++++++++++++++++++++ - tests/test_gresolver.py | 13 +++++++++++++ - 2 files changed, 50 insertions(+) - -commit 308421789ce849040d645077c41c80b6e2e65e83 -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 14:00:22 2009 +0100 - - Wrap gio.Resolver.lookup_service_async() - - gio/gresolver.override | 48 - ++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 48 insertions(+) - -commit 9d56ce775f56fff1b1ef3c75843c0583e39f75c3 -Author: Gian Mario Tagliaretti -Date: Wed Dec 30 11:11:32 2009 +0100 - - Wrap gio.Resolver.lookup_service() and add a test - - gio/gresolver.override | 42 ++++++++++++++++++++++++++++++++++++++++++ - tests/test_gresolver.py | 5 +++++ - 2 files changed, 47 insertions(+) - -commit 7fc71f490494dae73a5264869a97a9d30814930e -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 22:12:50 2009 +0100 - - Wrap gio.Resolver.lookup_by_address_async() and add a test - - gio/gresolver.override | 46 - ++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gresolver.py | 14 ++++++++++++++ - 2 files changed, 60 insertions(+) - -commit c91656dbe56f07d3ebbad5113467c22427cf212a -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 21:41:30 2009 +0100 - - Wrap gio.Resolver.lookup_by_name_finish() and add a test - - gio/gresolver.override | 82 - +++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gresolver.py | 16 ++++++++-- - 2 files changed, 96 insertions(+), 2 deletions(-) - -commit 45b477342fa1c2435917c6d97745ad57665c4734 -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 17:15:44 2009 +0100 - - Wrap gio.Drive.eject_with_data() - - gio/gdrive.override | 54 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 54 insertions(+) - -commit 635227480f9659a1f91ab1ec12536d3ed012a976 -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 17:06:52 2009 +0100 - - Deprecate old gio.Drive methods - - gio/gdrive.override | 7 ++++++- - gio/gio.defs | 1 + - 2 files changed, 7 insertions(+), 1 deletion(-) - -commit 3c0cbc95af29b1e192ed4b5963e96e39c70b349c -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 13:51:54 2009 +0100 - - Small fix in the header - - gio/gdrive.override | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 7589128515b79d836365247dc876538c6352da23 -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 12:40:50 2009 +0100 - - Wrap gio.Resolver.lookup_by_name() and add a couple of tests - - gio/Makefile.am | 1 + - gio/gio.override | 1 + - gio/gresolver.override | 57 - +++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gresolver.py | 21 ++++++++++++++++++ - 4 files changed, 80 insertions(+) - -commit 604d2bf220b1fefa415baaedbdb2882dbaf9e07e -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 12:39:13 2009 +0100 - - Make cancellable an optional parameter in - gio.Resolver.lookup_by_address() - - gio/gio.defs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 00029145f4cd10759b37b38fb9f72435bf26b28b -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 10:15:14 2009 +0100 - - Strip g_ prefix for many other functions - - gio/gio.defs | 94 - ++++++++++++++++++++++++++++++------------------------------ - 1 file changed, 47 insertions(+), 47 deletions(-) - -commit 56d5dfc4fd862e32c19f944a0feb7a00a9154f06 -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 10:12:53 2009 +0100 - - Strip g_prefix from InetAddress functions - - gio/gio.defs | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 1d360301d51a587a36a59f5d62e354484bbd2b31 -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 10:03:59 2009 +0100 - - Fix function name gio.resolver_get_default() - - Strip the g_ prefix from function name - - gio/gio.defs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 0fe00109c4f6fc27cbaae9b0a24ecfac71355d2f -Author: Gian Mario Tagliaretti -Date: Tue Dec 29 09:54:05 2009 +0100 - - Wrap gio.FileIOStream.query_info_async() and add a test - - gio/Makefile.am | 1 + - gio/gfileiostream.override | 68 - ++++++++++++++++++++++++++++++++++++++++++++++ - gio/gio.override | 1 + - tests/test_gio.py | 18 ++++++++++++ - 4 files changed, 88 insertions(+) - -commit 86783c695f3641b9491962e8f95a4dcb91f4017c -Author: Tomeu Vizoso -Date: Tue Dec 29 13:08:29 2009 +0100 - - Register enums and flags in PyGI if needed - - https://bugzilla.gnome.org/show_bug.cgi?id=603534 - - gobject/pygenum.c | 20 ++++++++++++++------ - gobject/pygflags.c | 19 +++++++++++++------ - 2 files changed, 27 insertions(+), 12 deletions(-) - -commit b90c01cff5ff5cb2796182f2ffd7b5248eaeed6a -Author: Gian Mario Tagliaretti -Date: Mon Dec 28 22:41:54 2009 +0100 - - Wrap GIOStream.close_async() and add a test - - gio/Makefile.am | 1 + - gio/gio.override | 1 + - gio/giostream.override | 68 - ++++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_gio.py | 21 ++++++++++++++++ - 4 files changed, 91 insertions(+) - -commit 0bff01bcee73a0e0d18342331136119c4e8bf151 -Author: Gian Mario Tagliaretti -Date: Mon Dec 28 22:39:09 2009 +0100 - - Make cancellable an optional parameter in GFile.create_readwrite() - - gio/gio.defs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 1cabd733cde269ce3164834933f4a226673ecb0b -Author: Gian Mario Tagliaretti -Date: Mon Dec 28 21:39:50 2009 +0100 - - Remove a duplicate entry in gio.defs - - gio/gio.defs | 9 --------- - 1 file changed, 9 deletions(-) - -commit 9ac372ad0bcfdec4bb1c96bc152246542a59a9b1 -Author: Gian Mario Tagliaretti -Date: Mon Dec 28 21:37:49 2009 +0100 - - Wrap gio.FileInfo.set_modification_time and add a test - - gio/gfileinfo.override | 33 ++++++++++++++++++++++++++++++++- - tests/test_gio.py | 7 ++++++- - 2 files changed, 38 insertions(+), 2 deletions(-) - -commit 7bc2673f92138b1804d8eba091942d14d8884f90 -Author: Gian Mario Tagliaretti -Date: Mon Dec 28 18:28:03 2009 +0100 - - Wrap gio.EmblemedIcon.get_emblems() and add a test - - gio/gicon.override | 14 ++++++++++++++ - tests/test_gicon.py | 7 +++++++ - 2 files changed, 21 insertions(+) - -commit 3d5056ad766d6856d8d6459fe9b377de2f0fd172 -Author: Gian Mario Tagliaretti -Date: Sat Dec 26 22:27:48 2009 +0100 - - Update Enums and Flags with new API - - gio/gio-types.defs | 153 - +++++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 149 insertions(+), 4 deletions(-) - -commit 62a9d660a4a2d5fab1d57c6c96c984ff02d25ccd -Author: Gian Mario Tagliaretti -Date: Fri Dec 25 18:06:39 2009 +0100 - - Post release version bump to 2.21.1 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 2bd92cba5b028f0f78c35ecb34e648e95248f9d3 -Author: Bastian Winkler -Date: Fri Aug 14 15:10:26 2009 +0200 - - Fix handling of uchar in pyg_value_from_pyobject - - Set the value by g_value_set_uchar and allow to use integer types - from python. - - gobject/pygtype.c | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -commit 828d0f042b59ea0319f33a23803c179af34ef2f1 -Author: Tomeu Vizoso -Date: Tue Dec 22 18:05:47 2009 +0100 - - Add Gtk.keysyms to overrides - - gi/overrides/Gtk.py | 2 + - gi/overrides/Makefile.am | 1 + - gi/overrides/keysyms.py | 1499 - ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 1502 insertions(+) - -commit 24fa1224ff00b9da177e0bfaa1e14e1b899e4976 -Author: Tomeu Vizoso -Date: Wed Nov 25 10:33:56 2009 +0100 - - The array field 'length' starts to count from the C arg list, so - need to decrement when it's a method - - https://bugzilla.gnome.org/show_bug.cgi?id=602640 - - gi/pygi-argument.c | 11 +++++++++- - gi/pygi-argument.h | 3 ++- - gi/pygi-info.c | 14 +++++++++++-- - tests/libtestgi.c | 60 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++ - tests/libtestgi.h | 4 ++++ - tests/test_gi.py | 15 ++++++++++++++ - 6 files changed, 103 insertions(+), 4 deletions(-) - -commit 867536c6734e606d045760837ed22583da06566e -Author: Gian Mario Tagliaretti -Date: Fri Dec 18 10:50:09 2009 +0100 - - Update NEWS and README, release pygobject 2.21.0 - - NEWS | 18 ++++++++++++++++++ - README | 6 +++--- - 2 files changed, 21 insertions(+), 3 deletions(-) - -commit f50fbd24fa61863aaefa4ae1e12e0b314ecd43ae -Author: Gian Mario Tagliaretti -Date: Fri Dec 18 10:31:48 2009 +0100 - - Add pygi-external.h into Makefile SOURCES - - gobject/Makefile.am | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 108c03b78f04b4bcfe066a6cb4d941e172bd32fe -Author: Gian Mario Tagliaretti -Date: Fri Dec 18 01:20:34 2009 +0100 - - Bug 598435 - No wrapping for g_find_program_in_path () - - glib/glibmodule.c | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -commit d3d5cb3a4a2c2cb2bd0c2571304d59e19bc08452 -Author: Gian Mario Tagliaretti -Date: Thu Dec 17 21:54:36 2009 +0100 - - Wrap new API added in GIO-UNIX 2.22 - - gio/unix-types.defs | 22 ++++++++++ - gio/unix.defs | 115 - +++++++++++++++++++++++++++++++++++++++++++++++++++- - gio/unix.override | 8 ++++ - 3 files changed, 144 insertions(+), 1 deletion(-) - -commit c87c8a81947a68507e8f3bcaf8e0e969b3e5331b -Author: Gian Mario Tagliaretti -Date: Thu Dec 17 21:52:11 2009 +0100 - - Bump required glib version to 2.22.4 - - I've committed a patch to glib which will be released in the stable - branch. - Without the patch the unix module will fail, so I'm forced to bump. - - configure.ac | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit b630c8d4b1e55938dac89729768c4a877b305215 -Author: Gian Mario Tagliaretti -Date: Thu Dec 17 02:24:45 2009 +0100 - - Properly define Connectable as interface type and not object type - - gio/gio-types.defs | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -commit e955b931b07113c7432f7a85f882f69f12d263ad -Author: Anderson Lizardo -Date: Mon Nov 30 22:01:25 2009 +0100 - - Depend on GLib 2.20 rather than 2.22 - - Backport g_array_get_element_size. - - https://bugzilla.gnome.org/show_bug.cgi?id=603411 - - configure.ac | 2 +- - gi/pygi-private.h | 19 +++++++++++++++++++ - 2 files changed, 20 insertions(+), 1 deletion(-) - -commit 542fdf6da4ad8f2d28d0d50152bd93cb4d8ee39a -Author: Tomeu Vizoso -Date: Sat Nov 28 18:48:19 2009 +0000 - - Use the limit constants from glib and interpret G_MAXUINT32 as - PyLong_FromLongLong - - https://bugzilla.gnome.org/show_bug.cgi?id=602384 - - gi/pygi-argument.c | 14 +++++++------- - tests/test_gi.py | 18 +++++++++--------- - 2 files changed, 16 insertions(+), 16 deletions(-) - -commit 38e89942d29f2a1dba47ab4a8d5edc84322707cd -Author: Simon van der Linden -Date: Mon Nov 30 00:10:56 2009 +0100 - - Suppress warnings about format conversion - - https://bugzilla.gnome.org/show_bug.cgi?id=603355 - - gobject/generate-constants.c | 32 ++++++++++++++++---------------- - 1 file changed, 16 insertions(+), 16 deletions(-) - -commit cfa7d005487e17e8f7c1ceb14282d3a5baadb736 -Author: Simon van der Linden -Date: Sat Nov 28 00:22:21 2009 +0100 - - Remove global checks for pointers and move them in type cases that - need them - - gi/pygi-argument.c | 516 - +++++++++++++++++++++++++++++++++++++++++++---------- - gi/pygi-info.c | 333 +++++++++++++++++----------------- - 2 files changed, 596 insertions(+), 253 deletions(-) - -commit d1ae73f3cf7cebdb74c9ec56b08928a2a53b9de6 -Author: Johan Dahlin -Date: Mon Nov 23 15:58:17 2009 -0200 - - Pythonify. Avoid ; and () around if statements - - https://bugzilla.gnome.org/show_bug.cgi?id=602830 - - gi/types.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit a8660621679c629fc81320a8ddf5bf2c7ee1f177 -Author: Johan Dahlin -Date: Tue Nov 24 10:36:18 2009 -0200 - - Remove trailing whitespace - - https://bugzilla.gnome.org/show_bug.cgi?id=602830 - - gi/module.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit 66c34805223af9e63c7d61f21a3dbd7505a8f256 -Author: Tomeu Vizoso -Date: Mon Nov 30 10:03:34 2009 +0000 - - Set a default constructor for boxed structs that don't have one - - https://bugzilla.gnome.org/show_bug.cgi?id=602735 - - gi/Makefile.am | 2 + - gi/gimodule.c | 1 + - gi/module.py | 2 +- - gi/pygi-argument.c | 14 +++- - gi/pygi-boxed.c | 184 - +++++++++++++++++++++++++++++++++++++++++++++++++++++ - gi/pygi-boxed.h | 40 ++++++++++++ - gi/pygi-info.c | 2 +- - gi/pygi-private.h | 1 + - gi/pygi.h | 6 ++ - gi/types.py | 18 ------ - tests/libtestgi.c | 72 ++++++++++----------- - tests/libtestgi.h | 18 +++--- - tests/test_gi.py | 47 ++++++++------ - 13 files changed, 321 insertions(+), 86 deletions(-) - -commit e7e2fccae36c28c7e9f288fcd4c90a001140e307 -Author: Tomeu Vizoso -Date: Mon Nov 30 10:53:57 2009 +0000 - - Revert "Use the limit constants from glib and interpret G_MAXUINT32 - as PyLong_FromLongLong" - - This reverts commit 05a2ed55f3e5d2620de8b3b6b0d99e928ef3b041. - - gi/pygi-argument.c | 14 +++++++------- - tests/test_gi.py | 18 +++++++++--------- - 2 files changed, 16 insertions(+), 16 deletions(-) - -commit 05a2ed55f3e5d2620de8b3b6b0d99e928ef3b041 -Author: Tomeu Vizoso -Date: Sat Nov 28 18:48:19 2009 +0000 - - Use the limit constants from glib and interpret G_MAXUINT32 as - PyLong_FromLongLong - - https://bugzilla.gnome.org/show_bug.cgi?id=602384 - - gi/pygi-argument.c | 14 +++++++------- - tests/test_gi.py | 18 +++++++++--------- - 2 files changed, 16 insertions(+), 16 deletions(-) - -commit e24d155dd7b4a5b9c25c054137d1370c369d3192 -Author: Tomeu Vizoso -Date: Sat Nov 28 18:45:54 2009 +0000 - - Add the missing limit constants from glibconfig.h - - https://bugzilla.gnome.org/show_bug.cgi?id=603244 - - gobject/generate-constants.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -commit 3a295cb7ffaaaf29c71b8833cf0ee5ec7ceaa909 -Author: Gian Mario Tagliaretti -Date: Sat Nov 28 18:48:49 2009 +0100 - - Fix bad name when rebuilding the unix source module - - gio/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit a8cbb6fb72dbe6630d1265b18095c9a96f496b86 -Author: Gian Mario Tagliaretti -Date: Sat Nov 28 18:47:26 2009 +0100 - - Wrap new API added in GIO 2.22 - - gio/gio-types.defs | 138 +++ - gio/gio.defs | 2444 - +++++++++++++++++++++++++++++++++++++++++++++++----- - 2 files changed, 2360 insertions(+), 222 deletions(-) - -commit 96f6c638709636d7e2ddf560b877879691da3314 -Author: Tomeu Vizoso -Date: Sat Nov 28 11:03:51 2009 +0000 - - A few tests about interfaces - - https://bugzilla.gnome.org/show_bug.cgi?id=601181 - - tests/libtestgi.c | 23 +++++++++++++++++++++++ - tests/libtestgi.h | 16 ++++++++++++++++ - tests/test_gi.py | 21 +++++++++++++++++++++ - 3 files changed, 60 insertions(+) - -commit 076ba3156c13375a75983cef7a409c8c8afea119 -Author: Simon van der Linden -Date: Thu Nov 26 23:50:54 2009 +0100 - - Fix members initialization in metaclasses - - In metaclasses, the test for the name of the class was wrong, since it - prevented one to create a subclass with the same name (especially - annoying for - overrides). Now, if a GType is available from the info, the fact - that it - doesn't have any wrapper yet means that the metaclass is creating - the base - class, which will be registerd just after its creation. This is - true for - objects, and for structures registered as boxed or pointer too. - - This patch includes a test for basic subclassing in Python. It - notably tests - that methods don't get overridden by the metaclass. - - gi/types.py | 5 +++-- - tests/test_gi.py | 19 +++++++++++++++++++ - 2 files changed, 22 insertions(+), 2 deletions(-) - -commit ac80e64c9f7d257865aa820753e52d56cf2871c8 -Author: Tomeu Vizoso -Date: Fri Nov 27 12:06:59 2009 +0000 - - Structs in arrays are not marshalled correctly - - https://bugzilla.gnome.org/show_bug.cgi?id=602709 - - gi/pygi-argument.c | 29 ++++++++++++++++++++++++----- - tests/libtestgi.c | 23 ++++++++++++++++++++++- - tests/libtestgi.h | 7 +++++-- - tests/test_gi.py | 8 ++++++++ - 4 files changed, 59 insertions(+), 8 deletions(-) - -commit 4a373b8ad6ec137e911b92a3e745e0fd76541292 -Author: Simon van der Linden -Date: Wed Nov 25 16:53:55 2009 +0100 - - Use the right variable when looking up in sys.modules - - gi/importer.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit fc3dca018e85aee34ade79d104ebd8cdd1dd5968 -Author: Tomeu Vizoso -Date: Tue Nov 24 15:52:47 2009 +0100 - - Accept 0 as a valid value for flag and enum arguments - - https://bugzilla.gnome.org/show_bug.cgi?id=602638 - - gi/pygi-argument.c | 19 ++++++++++++++++++- - tests/libtestgi.c | 6 ++++++ - tests/libtestgi.h | 1 + - tests/test_gi.py | 1 + - 4 files changed, 26 insertions(+), 1 deletion(-) - -commit 33081c29a1c2fdec2b8bfe17ae0a72b8db7a8d84 -Author: Tomeu Vizoso -Date: Tue Nov 24 13:10:11 2009 +0100 - - Add stuff to .gitignore - - .gitignore | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 5c010fe673d9bd01c27c8d7d312064665275888c -Author: Simon van der Linden -Date: Mon Nov 23 22:39:12 2009 +0100 - - Remove the girepository module - - Makefile.am | 2 +- - configure.ac | 17 - - girepository/Makefile.am | 54 -- - girepository/__init__.py | 24 - - girepository/bank-argument.c | 379 ------------ - girepository/bank-info.c | 1194 - ------------------------------------ - girepository/bank-repository.c | 236 ------- - girepository/bank.c | 155 ----- - girepository/bank.h | 80 --- - girepository/btypes.py | 300 --------- - girepository/importer.py | 51 -- - girepository/module.py | 224 ------- - girepository/overrides/Gdk.py | 14 - - girepository/overrides/Gtk.py | 8 - - girepository/overrides/__init__.py | 0 - girepository/repository.py | 51 -- - tests/test_girepository.py | 386 ------------ - 17 files changed, 1 insertion(+), 3174 deletions(-) - -commit a644edf0515c26ed027522891ccf02aceac764e8 -Author: Johan Dahlin -Date: Mon Nov 23 15:32:16 2009 -0200 - - Create overridden modules in two passes - - This patch splits overridden module creation into two passes. The - first pass - creates the auto-generated module normally before the overridden - module is - attempted to be imported. The second pass imports the overridden - module and - replaces the auto-generated module with the overridden. This is - necessary - for the overridden modules to be able to access the auto-generated - ones. - - gi/importer.py | 34 +++++++++++++++++++++------------- - 1 file changed, 21 insertions(+), 13 deletions(-) - -commit fad89e12a744b57e6348968f351d25d167de8248 -Author: Tomeu Vizoso -Date: Sun Nov 22 17:56:20 2009 +0100 - - Add support for Any arguments - - https://bugzilla.gnome.org/show_bug.cgi?id=601253 - - gi/pygi-argument.c | 20 ++++++++++++-------- - tests/libtestgi.c | 5 +++++ - tests/libtestgi.h | 5 +++++ - tests/test_gi.py | 5 +++++ - 4 files changed, 27 insertions(+), 8 deletions(-) - -commit 1dc62a998dd8d2a0a397f8309011a8d79cb56034 -Author: Tomeu Vizoso -Date: Sun Nov 22 17:25:04 2009 +0100 - - Register interfaces - - https://bugzilla.gnome.org/show_bug.cgi?id=601181 - - gi/gimodule.c | 33 +++++++++++++++++++++++++++++++++ - gi/types.py | 5 ++++- - 2 files changed, 37 insertions(+), 1 deletion(-) - -commit d67d5afb5115c1d8294415b2e1a82af2c737ba17 -Author: Paul Pogonyshev -Date: Sun Nov 22 18:23:02 2009 +0200 - - Ignore one more file. - - .gitignore | 1 + - 1 file changed, 1 insertion(+) - -commit 408b2186aea58a41ec26b9d0ca29ecd42df5ef7e -Author: Paul Pogonyshev -Date: Sun Nov 22 18:22:23 2009 +0200 - - Fix wrong minimum checking in float properties - - Bug #587637. Test the fix. - - gobject/propertyhelper.py | 5 +++-- - tests/test_properties.py | 6 ++++++ - 2 files changed, 9 insertions(+), 2 deletions(-) - -commit 6ccf58afcf58e118903ced0135f0fe69b00e09ad -Author: Tomeu Vizoso -Date: Mon Oct 26 18:06:06 2009 +0000 - - Treat GI_INFO_TYPE_INTERFACE same as GI_INFO_TYPE_OBJECT - - gi/pygi-argument.c | 3 +++ - 1 file changed, 3 insertions(+) - -commit e6f730d6e1431e36bd5f6b503a1038617f8d1e7d -Author: Simon van der Linden -Date: Sat Nov 14 21:42:43 2009 +0100 - - Import pygtk properly to avoid failure on some setups - - tests/test_gi.py | 3 +++ - 1 file changed, 3 insertions(+) - -commit e604a89e9dc1a79687ef5fb94af7a2182be07dfb -Author: Alex Dedul -Date: Sat Nov 14 21:39:15 2009 +0100 - - Search for python-config-${VERSION} when python${VERSION}-config is - not found - - On Gentoo, notably, the config tool is named python-config-${VERSION}, - while on - Fedora and Ubuntu, it is named python${VERSION}-config. - - Signed-off-by: Simon van der Linden - - configure.ac | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -commit 4a887cfabb326cb99dc65073d592c03f59e2f141 -Author: Simon van der Linden -Date: Sat Nov 14 21:36:19 2009 +0100 - - Fix silent rules setup - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 602afea88c338a38327cd84e08703c5daa384ec6 -Author: Paul Pogonyshev -Date: Tue Nov 10 22:32:33 2009 +0200 - - Move threads_init() function from 'gobject' to 'glib' - - Retain in original place for backward compatibility, but remove it - from the docs. - - docs/reference/pygobject-functions.xml | 36 - +++++++--------------------------- - glib/glibmodule.c | 16 +++++++++++++++ - 2 files changed, 23 insertions(+), 29 deletions(-) - -commit 734755912fff11332dc0e96317b7d6b7c4014e6a -Author: Simon van der Linden -Date: Mon Nov 9 22:44:12 2009 +0100 - - Remove PyGObject patches since they've been merged to master - - ...pytype-aware-of-the-interface-enum-flags-.patch | 78 -------- - patches/0002-Fix-girpository-build-setup.patch | 186 - ------------------- - ...capabilities-to-import-wrappers-from-pygi.patch | 200 - --------------------- - ...ances-by-calling-tp_alloc-rather-than-PyO.patch | 29 --- - 4 files changed, 493 deletions(-) - -commit 6a69288941e65312fe82649ec72d2f21b2dc618f -Author: Simon van der Linden -Date: Sat Nov 7 23:42:07 2009 +0100 - - Create instances by calling tp_alloc rather than PyObject_NEW - - PyObject_NEW calls a generic allocator and should only be called by - tp_new, knowing - that the type's free function agrees. In pyg_boxed_new, we may - allocate - PyGBoxed subtypes, so the subtype's allocation function must be - called instead. - - gobject/pygboxed.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit 000f7c36e667c6e078e3370769ea868e56a1b4ee -Author: Simon van der Linden -Date: Sat Nov 7 16:43:35 2009 +0100 - - Add capabilities to import wrappers from pygi - - At instance creation for boxed and pointers, at lookup for objects, - when the gtype has no wrapper yet, a wrapper may be imported from - pygi. - - The feature is turned on at configure time by --enable-pygi. - - Because we couldn't create a circular build dependency, PyGI's import - function and - API definition had to be copied in this tree. - - configure.ac | 8 ++++++ - gobject/pygboxed.c | 10 ++++++++ - gobject/pygi-external.h | 66 - +++++++++++++++++++++++++++++++++++++++++++++++++ - gobject/pygobject.c | 10 ++++++++ - gobject/pygpointer.c | 11 +++++++++ - 5 files changed, 105 insertions(+) - -commit fdfbc90dbc9e305646b62d73de506b5e0e99cc91 -Author: Simon van der Linden -Date: Sun Nov 8 20:03:58 2009 +0100 - - Update PyGObject patches - - A file, pygi-external.h, was missing in patch #3. - - ...capabilities-to-import-wrappers-from-pygi.patch | 74 - ++++++++++++++++++++-- - ...ances-by-calling-tp_alloc-rather-than-PyO.patch | 2 +- - 2 files changed, 69 insertions(+), 7 deletions(-) - -commit 8f53ca8a72f9958711765281dd5c5bdfb7042d7d -Author: Tomeu Vizoso -Date: Sun Nov 8 16:52:18 2009 +0100 - - Add myself to pygi.doap - - pygi.doap | 5 +++++ - 1 file changed, 5 insertions(+) - -commit 6f50d5102aec9288e1851f12e9d232b9c141d524 -Author: Simon van der Linden -Date: Sun Nov 8 15:40:51 2009 +0100 - - Add a doap file - - pygi.doap | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -commit ce673b9027868e6add4eeb438bc707eb40bfd046 -Author: Simon van der Linden -Date: Sun Nov 8 13:06:54 2009 +0100 - - Add PyGObject patches - - ...pytype-aware-of-the-interface-enum-flags-.patch | 78 +++++++++ - patches/0002-Fix-girpository-build-setup.patch | 186 - +++++++++++++++++++++ - ...capabilities-to-import-wrappers-from-pygi.patch | 138 +++++++++++++++ - ...ances-by-calling-tp_alloc-rather-than-PyO.patch | 29 ++++ - 4 files changed, 431 insertions(+) - -commit b24fd9633cabe1d95cde173a04e9a49833b06a26 -Author: Simon van der Linden -Date: Sun Nov 8 12:35:08 2009 +0100 - - Initial import - - .gitignore | 33 + - Makefile.am | 10 + - autogen.sh | 159 +++ - configure.ac | 53 + - gi/Makefile.am | 50 + - gi/__init__.py | 24 + - gi/gimodule.c | 144 ++ - gi/importer.py | 89 ++ - gi/module.py | 167 +++ - gi/overrides/Gdk.py | 21 + - gi/overrides/Gtk.py | 13 + - gi/overrides/Makefile.am | 10 + - gi/overrides/__init__.py | 0 - gi/pygi-argument.c | 1976 ++++++++++++++++++++++++++ - gi/pygi-argument.h | 65 + - gi/pygi-info.c | 2093 ++++++++++++++++++++++++++++ - gi/pygi-info.h | 64 + - gi/pygi-private.h | 55 + - gi/pygi-repository.c | 238 ++++ - gi/pygi-repository.h | 39 + - gi/pygi-struct.c | 175 +++ - gi/pygi-struct.h | 40 + - gi/pygi-type.c | 96 ++ - gi/pygi-type.h | 43 + - gi/pygi.h | 99 ++ - gi/pygobject-external.h | 83 ++ - gi/repository/Makefile.am | 8 + - gi/repository/__init__.py | 30 + - gi/types.py | 163 +++ - tests/Makefile.am | 48 + - tests/libtestgi.c | 3397 - +++++++++++++++++++++++++++++++++++++++++++++ - tests/libtestgi.h | 643 +++++++++ - tests/runtests.py | 22 + - tests/test_gi.py | 1416 +++++++++++++++++++ - 34 files changed, 11566 insertions(+) - -commit bfd3100a580b8bea9db25b8bb7443fb8c3dbe1cc -Author: Simon van der Linden -Date: Sat Nov 7 13:23:53 2009 +0100 - - Fix girpository build setup - - configure.ac | 21 ++++++----- - girepository/Makefile.am | 13 ++++--- - m4/introspection.m4 | 92 - ++++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 111 insertions(+), 15 deletions(-) - -commit 421c03b1c5b69f90c778663df901b45ca3ee8ba5 -Author: Simon van der Linden -Date: Fri Nov 6 19:17:36 2009 +0100 - - Make GType.pytype aware of the interface, enum, flags, pointer and - boxed wrappers - - gobject/pygtype.c | 39 +++++++++++++++++++++++++++++++++------ - 1 file changed, 33 insertions(+), 6 deletions(-) - -commit a9c168c58cc6a449b51653417bf3f58bdd41457c -Author: Philippe Normad -Date: Wed Oct 21 18:01:16 2009 +0200 - - pygmainloop: fix use of PySignal_WakeUpFD API for nested loops - - Fixes bug #481569 - - glib/pygmainloop.c | 95 - ++++++++++++++++++++++++++++-------------------------- - 1 file changed, 50 insertions(+), 45 deletions(-) - -commit c6a5750379354c12e2599b3c73b4f9a23fd39114 -Author: Gian Mario Tagliaretti -Date: Fri Sep 25 20:12:21 2009 +0200 - - Post release version bump to 2.21.0 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 33920eb013628a5e22b7b32403fb965ae3210f47 -Author: Gian Mario Tagliaretti -Date: Wed Sep 23 21:52:04 2009 +0200 - - Update NEWS and release 2.20.0 - - NEWS | 6 ++++++ - 1 file changed, 6 insertions(+) - -commit 66b12f7d2f54143ea80b4f8aec863b26800363d6 -Author: Gian Mario Tagliaretti -Date: Wed Sep 23 21:51:43 2009 +0200 - - Bump version to 2.20.0 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 7bf87338a026ac82f908aa5fddf2bfea2daf6617 -Author: Brian Cameron -Date: Wed Sep 23 12:11:50 2009 -0500 - - Updated uninstalled.pc file so that it contains the right paths for - defsdir files and codegen files. See bug #596023. - - pygobject-2.0-uninstalled.pc.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit d042402b7c649b2bed7f20038eb82518ec7cc9b3 -Author: Paul Pogonyshev -Date: Tue Sep 22 22:02:27 2009 +0300 - - Plug reference leak of GSource in pyg_main_loop_init() - - Bug #579406, second change. - - glib/pygmainloop.c | 1 + - 1 file changed, 1 insertion(+) - -commit 640be8109d066e85ed77c810830a5f73c750415b -Author: Frédéric Péters -Date: Sun Aug 30 16:46:02 2009 +0200 - - Specify programming language in .devhelp file - - This add a new language attribute (hardcoded to python) in the - .devhelp - file that is produced when using ref-html-style.xsl. - - docs/xsl/devhelp.xsl | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit c888b5ca722fcad6a03de585606c677c2969ebd6 -Author: Paolo Borelli -Date: Thu Aug 13 21:32:07 2009 +0200 - - Allow to use automake 1.11 - - autogen.sh | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - -commit 30deaba4bd1e199aab75cb346ee9237237807fbd -Author: Gian Mario Tagliaretti -Date: Tue Aug 11 22:19:50 2009 +0200 - - Update README - - README | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -commit af165d350d0d1bb493be5140bf84376d3da1e4d8 -Author: Gian Mario Tagliaretti -Date: Tue Aug 11 22:16:52 2009 +0200 - - Update AUTHORS - - AUTHORS | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -commit 5f9f87f276b97964b525a501d8584ea8b4d8bfd2 -Author: Gian Mario Tagliaretti -Date: Tue Aug 11 22:11:43 2009 +0200 - - Add myself and Paul as maintainers - - MAINTAINERS | 8 ++++++++ - pygobject.doap | 14 ++++++++++++++ - 2 files changed, 22 insertions(+) - -commit 3bfae47fbcb5523d91fb2d1ed7ea347eeddd1775 -Author: Gian Mario Tagliaretti -Date: Tue Aug 11 20:52:44 2009 +0200 - - Update NEWS release 2.19.0 - - NEWS | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - -commit e82a1841f31ad54dd50569d0d45290713409e0bf -Author: John Finlay -Date: Tue Aug 11 00:04:31 2009 -0700 - - Add macros to help with Python list to/from GList/GSList conversions. - - gobject/pygobject.h | 242 - +++++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 241 insertions(+), 1 deletion(-) - -commit f1fad96da2c531fbd3218923baa4fe806a2942d4 -Author: Gian Mario Tagliaretti -Date: Sat Aug 8 21:37:54 2009 +0200 - - Bug 590063 – GFileInfo.list_attributes should accept None/NULL - - gio/gfileinfo.override | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -commit b7907cf6ff6ccf8d38b5206f09f5c864c205e5de -Author: Johan Dahlin -Date: Fri Jul 24 14:30:37 2009 -0300 - - Remove myself as a maintainer - - MAINTAINERS | 4 ---- - pygobject.doap | 7 ------- - 2 files changed, 11 deletions(-) - -commit be6eb21320b4688bcfcd8cbea33f7be29a76f2a2 -Author: John Finlay -Date: Wed Jul 8 15:47:44 2009 -0700 - - * codegen/defsgen.py (clean_patterns): Strip out Windows - DLL API macros. - - codegen/defsgen.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit 2214cad3529979e29342a7e1fdc2915b90ce9c10 -Author: Gian Mario Tagliaretti -Date: Tue Jun 23 21:18:23 2009 +0200 - - Fix the gio.unix namespace in docs - - docs/Makefile.am | 2 ++ - docs/reference/pygio-classes.xml | 2 -- - docs/reference/pygio-unixinputstream.xml | 26 +++++++++++++------------- - docs/reference/pygio-unixoutputstream.xml | 26 +++++++++++++------------- - docs/reference/pygiounix-classes.xml | 13 +++++++++++++ - docs/reference/pygobject-ref.xml | 1 + - 6 files changed, 42 insertions(+), 28 deletions(-) - -commit c0acaedfe7f4e488a490e07e3184f0709e1fadc2 -Author: Gian Mario Tagliaretti -Date: Mon Jun 22 23:13:36 2009 +0200 - - Add docs for gio functions (mostly for content types) - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-functions.xml | 395 - +++++++++++++++++++++++++++++++++++++ - 3 files changed, 398 insertions(+) - -commit ebddee47fb7f3e06f9e0a7a14b9532d5cf8a3881 -Author: Gian Mario Tagliaretti -Date: Sun Jun 21 18:35:56 2009 +0200 - - Add docs for gio.Unix[In|Out]putStream classes - - docs/Makefile.am | 4 + - docs/reference/pygio-classes.xml | 2 + - docs/reference/pygio-unixinputstream.xml | 202 - ++++++++++++++++++++++++++++++ - docs/reference/pygio-unixoutputstream.xml | 202 - ++++++++++++++++++++++++++++++ - 4 files changed, 410 insertions(+) - -commit 5b71e58117c85634d95d08449eb54079b246e5be -Author: Paul Pogonyshev -Date: Sun Jun 21 16:50:03 2009 +0300 - - Document that many functions got moved gobject -> glib - - docs/reference/pygobject-functions.xml | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit b270dc43f2cef5260b0bbc71356fd8e6a2b7f754 -Author: Gian Mario Tagliaretti -Date: Sat Jun 20 19:23:25 2009 +0200 - - Add docs for class gio.DataOutputStream - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-dataoutputstream.xml | 504 - ++++++++++++++++++++++++++++++ - 3 files changed, 507 insertions(+) - -commit 549313fc4886fa3deb31761de6f5400708165d86 -Author: Murray Cumming -Date: Thu Jun 18 18:48:37 2009 +0200 - - Allow h2def.py to work when there are tabs or multiple spaces after - the struct keyword. - - codegen/h2def.py | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit 5c36ef20dca8cd1793f2d3e88949675299097f40 -Author: Gian Mario Tagliaretti -Date: Mon Jun 15 23:02:34 2009 +0200 - - Add dpcs for class gio.DataInputStream - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-constants.xml | 66 +++ - docs/reference/pygio-datainputstream.xml | 799 - +++++++++++++++++++++++++++++++ - 4 files changed, 868 insertions(+) - -commit a8b36c343c6850af929c1d5a930f923831b4e637 -Author: Theppitak Karoonboonyanan -Date: Mon Jun 15 23:25:01 2009 +0300 - - Fix build when builddir is not the same as srcdir - - Bug #585817. - - girepository/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 9d9ae97b8a49836ec1f3b8d6529bafe1cc06d4d7 -Author: Paul Pogonyshev -Date: Mon Jun 15 23:19:47 2009 +0300 - - Make gio.Emblem constructor new-style - - Add optional 'origin' parameter. Expand gio.Emblem documentation and - mark gio.emblem_new_with_origin as sort-of-deprecated. - - docs/reference/pygio-emblem.xml | 51 - +++++++++++++++++++++++++++++++++++++++-- - gio/gio.defs | 5 ++-- - 2 files changed, 52 insertions(+), 4 deletions(-) - -commit 268e1681fd5b46e6412d3a8db84f3f1cb02fdbde -Author: Gian Mario Tagliaretti -Date: Sat Jun 13 14:44:47 2009 +0200 - - Add docs for gio.BufferedOutputStream class - - docs/Makefile.am | 96 ++++----- - docs/reference/pygio-bufferedoutputstream.xml | 275 - ++++++++++++++++++++++++++ - docs/reference/pygio-classes.xml | 1 + - 3 files changed, 325 insertions(+), 47 deletions(-) - -commit a6e25aaa7c8f27d62f2917b06728d7ccfcd46416 -Author: Gian Mario Tagliaretti -Date: Sat Jun 13 14:38:34 2009 +0200 - - Fix gio.BufferedInputStream docs - - Added the constructor reference and fixed a typo in properties header - - docs/reference/pygio-bufferedinputstream.xml | 34 - ++++++++++++++++++++++++++-- - 1 file changed, 32 insertions(+), 2 deletions(-) - -commit a9b13b60a5aad726d7d7dd7fdc5153b1561fb591 -Author: Gian Mario Tagliaretti -Date: Sat Jun 13 01:25:06 2009 +0200 - - Add docs for gio.BufferedInputStream - - docs/Makefile.am | 2 + - docs/reference/pygio-bufferedinputstream.xml | 431 - +++++++++++++++++++++++++++ - docs/reference/pygio-classes.xml | 1 + - 3 files changed, 434 insertions(+) - -commit 7766daa59b0e2b85413cee368bf2ebd2afe198e1 -Author: Paul Pogonyshev -Date: Sun May 31 18:25:47 2009 +0300 - - Cleanup GIO overrides to use Python function/method names - - Also move several gio.Mount overrides over from 'gio.override' to - existing 'gmount.override'. Part of bug #584289. - - gio/gfile.override | 20 ++--- - gio/gfileenumerator.override | 6 +- - gio/ginputstream.override | 2 +- - gio/gio.override | 204 - ------------------------------------------- - gio/gmount.override | 204 - +++++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 218 insertions(+), 218 deletions(-) - -commit 07e9c18dc092f6546230168b6b69c1b3454e120a -Author: Paul Pogonyshev -Date: Sun May 31 18:56:55 2009 +0300 - - Make codegen report errors using Python function/method names - - Part of bug #584289. - - codegen/codegen.py | 9 +++++---- - codegen/definitions.py | 10 +++++++++- - 2 files changed, 14 insertions(+), 5 deletions(-) - -commit 235fde85d015382f2ba38b21968e82b3ac0b6612 -Author: Gian Mario Tagliaretti -Date: Fri Jun 12 00:12:17 2009 +0200 - - Fix object type in gio.BufferedInputStream_fill_async - - gio/gbufferedinputstream.override | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 407b0e909056f15960e6a4e549896d786ce0a0b2 -Author: Gian Mario Tagliaretti -Date: Tue Jun 9 00:08:21 2009 +0200 - - Wrap gio.BufferedInputStream.fill_async - - Wrap the method gio.BufferedInputStream.fill_async and add a test - - gio/Makefile.am | 1 + - gio/gbufferedinputstream.override | 70 - +++++++++++++++++++++++++++++++++++++++ - gio/gio.override | 1 + - tests/test_gio.py | 25 ++++++++++++++ - 4 files changed, 97 insertions(+) - -commit b7c96b41b287685fe57504e0add3a6f16e649975 -Author: Gian Mario Tagliaretti -Date: Mon Jun 8 15:42:40 2009 +0200 - - Add gio.BufferedOutputStream which was forgotten in the types - definition - - gio/gio-types.defs | 7 +++++++ - 1 file changed, 7 insertions(+) - -commit 3666f75af4ef2c8e038116aee5afada59d59f689 -Author: Gian Mario Tagliaretti -Date: Mon Jun 8 14:20:02 2009 +0200 - - Add docs for gio.MemoryOutputStream - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-memoryoutputstream.xml | 175 - ++++++++++++++++++++++++++++ - 3 files changed, 178 insertions(+) - -commit 6eb5e3988cbddb4afb3d5747364d6eb80370bb78 -Author: Gian Mario Tagliaretti -Date: Mon Jun 8 13:30:15 2009 +0200 - - Split overrides for gio.MemoryOutputStream - - gio/Makefile.am | 1 + - gio/gio.override | 1 + - gio/gmemoryoutputstream.override | 45 - ++++++++++++++++++++++++++++++++++++++++ - gio/goutputstream.override | 24 --------------------- - 4 files changed, 47 insertions(+), 24 deletions(-) - -commit dfbdf23633a772e78b47b0e7b0c3e3b87855d9ff -Author: Gian Mario Tagliaretti -Date: Mon Jun 8 11:45:11 2009 +0200 - - Wrap gio.memory_input_stream_new_from_data - - Add the wrapper for gio.memory_input_stream_new_from_data including - docs and a test. - - docs/Makefile.am | 4 +- - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-memoryinputstream.xml | 151 - +++++++++++++++++++++++++++++ - gio/Makefile.am | 1 + - gio/ginputstream.override | 34 ------- - gio/gio.override | 1 + - gio/gmemoryinputstream.override | 91 +++++++++++++++++ - tests/test_gio.py | 4 + - 8 files changed, 252 insertions(+), 35 deletions(-) - -commit fcc3cb0e167789746a1a9db0cba54ea7a97c7259 -Author: Simon van der Linden -Date: Mon Jun 8 19:15:24 2009 +0200 - - Fixes whitespaces style issues with girepository. - - girepository/Makefile.am | 2 +- - girepository/bank-repository.c | 67 - +++++++++++++++++++++--------------------- - girepository/bank.h | 2 +- - girepository/btypes.py | 6 ++-- - girepository/module.py | 2 +- - 5 files changed, 39 insertions(+), 40 deletions(-) - -commit fb4b2c8cdad2853e6bfe9526529e3a3ab052c5e0 -Author: Simon van der Linden -Date: Fri Jun 5 19:03:59 2009 +0200 - - Removes the header but the modeline in test_girepository.py. - - tests/test_girepository.py | 26 +------------------------- - 1 file changed, 1 insertion(+), 25 deletions(-) - -commit abe4828f52c7eb3a08f5b592e7ced1e97a58ef5c -Author: Simon van der Linden -Date: Wed Jun 3 10:47:58 2009 +0200 - - Adds overrides modules from PyBank. - - girepository/Makefile.am | 3 +++ - girepository/importer.py | 3 +-- - girepository/overrides/Gdk.py | 14 ++++++++++++++ - girepository/overrides/Gtk.py | 8 ++++++++ - girepository/overrides/__init__.py | 0 - 5 files changed, 26 insertions(+), 2 deletions(-) - -commit c12964e6a3354d8063355225c94e6d21d621e08b -Author: Simon van der Linden -Date: Tue Jun 2 23:40:41 2009 +0200 - - Disables the tests that fail in tests/test_girepository.py. - - tests/test_girepository.py | 242 - ++++++++++++++++++++++++++++++++++----------- - 1 file changed, 182 insertions(+), 60 deletions(-) - -commit a4469a3f7d32a25156bae5e7aef9ec4ae5f6e140 -Author: Simon van der Linden -Date: Tue Jun 2 23:03:26 2009 +0200 - - Imports test_girepository.py from former PyBank's - everything_unittest.py. - - tests/test_girepository.py | 288 - +++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 288 insertions(+) - -commit e4f2a5ef8734cf40cf8345d442612db1f6c62d5a -Author: Simon van der Linden -Date: Thu May 28 17:45:11 2009 +0200 - - Introduces the girepository module from the former PyBank. - - INSTALL | 69 +-- - Makefile.am | 2 +- - configure.ac | 12 + - girepository/Makefile.am | 52 ++ - girepository/__init__.py | 24 + - girepository/bank-argument.c | 379 +++++++++++++ - girepository/bank-info.c | 1194 - ++++++++++++++++++++++++++++++++++++++++ - girepository/bank-repository.c | 237 ++++++++ - girepository/bank.c | 155 ++++++ - girepository/bank.h | 80 +++ - girepository/btypes.py | 300 ++++++++++ - girepository/importer.py | 52 ++ - girepository/module.py | 224 ++++++++ - girepository/repository.py | 51 ++ - 14 files changed, 2799 insertions(+), 32 deletions(-) - -commit f5ab5046fe9b67ec5e8fc64679e1a3d01787af7e -Author: Gian Mario Tagliaretti -Date: Tue Jun 2 18:28:22 2009 +0200 - - Fix the docs for gio.FilterOutputStream - - docs/reference/pygio-filteroutputstream.xml | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -commit fded60d8376fc45d19bf6cd8be6b927cc3f2e8c6 -Author: Gian Mario Tagliaretti -Date: Tue Jun 2 18:27:00 2009 +0200 - - Add gio.FilterOutputStream docs - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-filteroutputstream.xml | 152 - ++++++++++++++++++++++++++++ - 3 files changed, 155 insertions(+) - -commit e2c31f916967229b6547e68013628ce0082cf875 -Author: Gian Mario Tagliaretti -Date: Tue Jun 2 13:29:59 2009 +0200 - - Add gio.FilterInputStream docs - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-filterinputstream.xml | 152 - +++++++++++++++++++++++++++++ - 3 files changed, 155 insertions(+) - -commit 49a467eee445bc75554db0374006722ac075194b -Author: Gian Mario Tagliaretti -Date: Tue Jun 2 11:33:20 2009 +0200 - - Add API appeared in 2.20 but not marked as such in gio docs - - gio/gio.defs | 30 ++++++++++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - -commit 180c157f2a20b7d2dd9af05bfb5f515fd23870a0 -Author: Gian Mario Tagliaretti -Date: Tue Jun 2 10:41:26 2009 +0200 - - Wrap gio.FileOutputStream.query_info_async - - Add the wrapper for gio.FileOutputStream.query_info_async - including docs and a test. - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-fileoutputstream.xml | 257 - ++++++++++++++++++++++++++++++ - gio/Makefile.am | 3 +- - gio/gfileoutputstream.override | 68 ++++++++ - gio/gio.override | 1 + - tests/test_gio.py | 27 ++++ - 7 files changed, 358 insertions(+), 1 deletion(-) - -commit 4673577d1f6c3d54423808dd575987092fb05ad2 -Author: Gian Mario Tagliaretti -Date: Tue Jun 2 10:17:41 2009 +0200 - - Fix gio.FileInputStream docs - - Add implemented interface section and remove a method description - - docs/reference/pygio-fileinputstream.xml | 25 +++++++++---------------- - 1 file changed, 9 insertions(+), 16 deletions(-) - -commit 1e1cad02879d514745b5233658654cbe944530a5 -Author: Gian Mario Tagliaretti -Date: Mon Jun 1 22:54:26 2009 +0200 - - Fix the method name - - gio/gfileinputstream.override | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -commit f605811afe8c91f121e89b6f9ec28c70b62f4110 -Author: Gian Mario Tagliaretti -Date: Mon Jun 1 22:40:56 2009 +0200 - - Wrap gio.FileInputStream.query_async - - Add the wrapper for gio.FileInputStream.query_async including docs and - a test. - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-fileinputstream.xml | 221 - +++++++++++++++++++++++++++++++ - gio/Makefile.am | 1 + - gio/gfileinputstream.override | 68 ++++++++++ - gio/gio.override | 1 + - tests/test_gio.py | 27 ++++ - 7 files changed, 321 insertions(+) - -commit 08623e54a426377c1504b5c364aabae5a17f8ad8 -Author: Paul Pogonyshev -Date: Sun May 31 17:43:16 2009 +0300 - - Install executable codegen parts with executing permissions - - Also add shebang where it was missing. Bug #583979. - - codegen/Makefile.am | 23 ++++++++++++----------- - codegen/code-coverage.py | 2 ++ - codegen/codegen.py | 2 ++ - codegen/createdefs.py | 0 - codegen/defsconvert.py | 2 ++ - codegen/defsgen.py | 0 - codegen/docgen.py | 0 - codegen/scmexpr.py | 0 - 8 files changed, 18 insertions(+), 11 deletions(-) - -commit 833d4da202bcfcb01a414f8aec4b751ec8e1ccb2 -Author: Paul Pogonyshev -Date: Sat May 30 16:57:49 2009 +0300 - - Wrap gio.DataInputStream.read_line_async and read_until_async - - Wrap the functions and their corresponding *_finish() functions. - Create 'gdatainputstream.override' for these and move two existing - functions there. Add unit tests. Re-enable synchronous read_line - unit test and adjust it for new official GIO behavior. Bug #584285. - - gio/Makefile.am | 1 + - gio/gdatainputstream.override | 250 - ++++++++++++++++++++++++++++++++++++++++++ - gio/ginputstream.override | 65 ----------- - gio/gio.defs | 4 +- - gio/gio.override | 1 + - tests/test_gio.py | 51 ++++++++- - 6 files changed, 300 insertions(+), 72 deletions(-) - -commit 2cb569c0ced49f9ed5ca83292d5f15c837066688 -Author: Paul Pogonyshev -Date: Sat May 30 17:24:15 2009 +0300 - - Fix gio.OutputStream.splice_async - - Bug #584290. - - gio/goutputstream.override | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -commit e43fa429f6b4019a432acb481bbc07c8201cc46d -Author: Paul Pogonyshev -Date: Wed May 27 21:19:27 2009 +0300 - - Code maintenance: ignore one more file created by unit tests - - tests/.gitignore | 1 + - 1 file changed, 1 insertion(+) - -commit 76e9dc74ac706a9207f9d31f887d6e38df2a678f -Author: Gian Mario Tagliaretti -Date: Mon May 25 20:20:38 2009 +0200 - - Update the docs with new 2.20 API - - docs/reference/pygio-appinfo.xml | 115 +++++++++++++++++++++++++++++ - docs/reference/pygio-icon.xml | 99 ++++++++++++++++++++++++- - docs/reference/pygio-mount.xml | 156 - +++++++++++++++++++++++++++++++++++++++ - 3 files changed, 367 insertions(+), 3 deletions(-) - -commit 8e40d71ac23deb7d91789486ee8cad440a6be1dd -Author: Gian Mario Tagliaretti -Date: Mon May 25 01:33:08 2009 +0200 - - Add gio 2.20 API - - add the new API added in gio 2.20, some needs to be wrapped manually - - gio/gio.defs | 106 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - gio/unix.defs | 48 +++++++++++++++++++++----- - 2 files changed, 146 insertions(+), 8 deletions(-) - -commit 0d08df42514fba6abc896814abfee0d2d083c29e -Author: Gian Mario Tagliaretti -Date: Mon May 25 00:14:21 2009 +0200 - - Post release version bump 2.19.0 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit edfb09e3de7baf294b3beba84b4ecb94e1f16764 -Author: Gian Mario Tagliaretti -Date: Sun May 24 23:56:29 2009 +0200 - - Update NEWS, release 2.18.0 - - NEWS | 14 ++++++++++++++ - configure.ac | 4 ++-- - 2 files changed, 16 insertions(+), 2 deletions(-) - -commit e0648ea435e0b309cdd5bb0ebe56d4534efd26e4 -Author: Gian Mario Tagliaretti -Date: Sun May 24 22:18:40 2009 +0200 - - Add documentation for the gio.OutputStream class - - The docs for this class are not completed, missing methods - descriptions. - The index is complete though, it will be completed once all the - classes - are in place so we can ship a (almost) complete reference. - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 3 +- - docs/reference/pygio-outputstream.xml | 140 - ++++++++++++++++++++++++++++++++++ - 3 files changed, 144 insertions(+), 1 deletion(-) - -commit 11524cdf6472d9115a812ce431f6767aec5627bc -Author: Gian Mario Tagliaretti -Date: Sun May 24 22:12:04 2009 +0200 - - Wrap gio.OutputStream.splice_async() - - wrap gio.OutputStream.splice_async() and add a test. - - gio/goutputstream.override | 58 - +++++++++++++++++++++++++++++++++++++++++++++- - tests/test_gio.py | 20 ++++++++++++++++ - 2 files changed, 77 insertions(+), 1 deletion(-) - -commit 82ad6b8c8ea4d6694126f5e0e67b826717e38f19 -Author: Emilio Pozuelo Monfort -Date: Sun May 24 22:55:16 2009 +0300 - - Add Python version into installed libpyglib name - - Do this now, while no-one (as far as we know) links to the library - besides PyGObject itself. Bug #550235. - - configure.ac | 2 ++ - gio/Makefile.am | 2 +- - glib/Makefile.am | 10 +++++----- - gobject/Makefile.am | 2 +- - 4 files changed, 9 insertions(+), 7 deletions(-) - -commit 59da8cd24ea390b6c983995833ec6b0e5d028b35 -Author: Gian Mario Tagliaretti -Date: Sun May 24 11:44:24 2009 +0200 - - Wrap gio.OutputStream.flush_async() - - wrap gio.OutputStream.flush_async() and add a test. - - gio/goutputstream.override | 47 - +++++++++++++++++++++++++++++++++++++++++++++- - tests/test_gio.py | 11 +++++++++++ - 2 files changed, 57 insertions(+), 1 deletion(-) - -commit 84ab6178ed0033f69932df5bc73c86bdff80c953 -Author: Gian Mario Tagliaretti -Date: Sun May 17 17:29:37 2009 +0200 - - Add documentation for the gio.FileMonitor class - - The docs for this class are not completed, missing methods - descriptions. - The index is complete though, it will be completed once all the - classes - are in place so we can ship a (almost) complete reference. - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-filemonitor.xml | 128 - +++++++++++++++++++++++++++++++++++ - 3 files changed, 131 insertions(+) - -commit 629496a5617d30e4dfa494b05a62c85a6af77b9a -Author: Josselin Mouette -Date: Sun May 17 18:03:44 2009 +0300 - - Use 'Requires.private' for libffi in '.pc' files - - Correction for patch in bug #550231. - - pygobject-2.0-uninstalled.pc.in | 3 ++- - pygobject-2.0.pc.in | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -commit 90cd8b7c4a25cd2ecb751f8337b401c98538272b -Author: Gian Mario Tagliaretti -Date: Wed May 13 21:54:39 2009 +0200 - - Add wrapper for gio.FileAttributeMatcher - - added a boxed type for gio.FileAttributeMatcher which has been - forgotten while - wrapping the gio API. This should probably be done in gio itself. - - gio/gfileinfo.override | 24 ++++++++++++++++++++++-- - gio/gio-types.defs | 7 +++++++ - gio/gio.override | 2 ++ - 3 files changed, 31 insertions(+), 2 deletions(-) - -commit e707447d9313f2f2ecba395cfe3682d5a5e859f4 -Author: Paul Pogonyshev -Date: Wed May 13 22:06:25 2009 +0300 - - Mark relevant glib.IOChannel methods as METH_NOARGS - - Additionally fix glib.IOChannel.set_close_on_unref: was marked - METH_NOARGS but actually accepted arguments. Fixes bug #582427. - - glib/pygiochannel.c | 83 - +++++++++++++---------------------------------------- - 1 file changed, 20 insertions(+), 63 deletions(-) - -commit 002915e5f458fec5a89766a54e8119a70a80caa7 -Author: Gian Mario Tagliaretti -Date: Tue May 12 20:37:24 2009 +0200 - - Add documentation for the gio.FileInfo class - - The docs for this class are not completed, missing methods - descriptions. - The index is complete though, it will be completed once all the - classes - are in place so we can ship a (almost) complete reference. - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-fileinfo.xml | 346 - ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 349 insertions(+) - -commit 8cd25c871609580425c6c4c9e5bc6ec8d40862a1 -Author: Paul Pogonyshev -Date: Sat May 9 16:46:04 2009 +0300 - - Retire hand-written ChangeLog; autocreate from Git history - - Basically copied over from GLib source tree. - - ChangeLog | 3606 - --------------------------------------------------- - ChangeLog.pre-2.18 | 3608 - ++++++++++++++++++++++++++++++++++++++++++++++++++++ - Makefile.am | 32 + - 3 files changed, 3640 insertions(+), 3606 deletions(-) - -commit 23556bdbcf9cf06db866901fb822dd78a9043648 -Author: Gian Mario Tagliaretti -Date: Sat May 9 00:03:05 2009 +0200 - - Fix a bug in InputStream.skip_async - - use the count argument instead of buffer_size which is always zero - - gio/ginputstream.override | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -commit ed6b06315c17441b41c001d38537c904b8fe18de -Author: Gian Mario Tagliaretti -Date: Sat May 9 00:02:33 2009 +0200 - - Add docs for the gio.InputStream class - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-inputstream.xml | 730 - +++++++++++++++++++++++++++++++++++ - 3 files changed, 733 insertions(+) - -commit d58322b84d47da7905f95b43e9e0daf9f7c4b507 -Author: Gian Mario Tagliaretti -Date: Mon May 4 23:40:28 2009 +0200 - - Wrap gio.InputStream.skip_async() - - wrap gio.InputStream.skip_async() and add a test. - - gio/ginputstream.override | 50 - ++++++++++++++++++++++++++++++++++++++++++++++- - tests/test_gio.py | 20 +++++++++++++++++++ - 2 files changed, 69 insertions(+), 1 deletion(-) - -commit 2311187824d1b48a996ee2620fd3c9a63e3edd66 -Author: Siavash Safi -Date: Mon May 4 15:46:49 2009 +0430 - - Add -n --namespace option and the code to remove - dll API in headers, Added documentation - - Patch from bug #579275 - - ChangeLog | 8 ++++ - codegen/h2def.py | 133 - +++++++++++++++++++++++++++++++++++++++++++++---------- - 2 files changed, 117 insertions(+), 24 deletions(-) - -commit 442ec5bb997bb7dab55baeea6e54e79d3ce0d3c1 -Author: Paul Pogonyshev -Date: Sat May 2 23:54:52 2009 +0300 - - Properly mark glib.get_user_special_dir() as a keywords method - - Fixes bug #581082. - - glib/glibmodule.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit f466dca880cc6ea68b9fe236943eea7a07d33520 -Author: Gian Mario Tagliaretti -Date: Sun May 3 11:03:25 2009 +0200 - - Add docs for the gio.LoadableIcon class - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-loadableicon.xml | 198 - ++++++++++++++++++++++++++++++++++ - 3 files changed, 201 insertions(+) - -commit eab4ebf7f6c82580b61205f34e1cfe535aeada60 -Author: Gian Mario Tagliaretti -Date: Sun May 3 01:21:55 2009 +0200 - - Add docs for the gio.ThemedIcon class - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-themedicon.xml | 204 - ++++++++++++++++++++++++++++++++++++ - 3 files changed, 207 insertions(+) - -commit 22d7de8b620055f14b30f9c3c99160c8b4ebe672 -Author: Gian Mario Tagliaretti -Date: Sat May 2 12:25:19 2009 +0200 - - post release version bump to 2.17.1 - - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 282ac3c76e1e3513bd76f819f320ec56aba15d9e -Author: Gian Mario Tagliaretti -Date: Fri May 1 23:40:31 2009 +0200 - - Fix the class title - - docs/reference/pygio-mountoperation.xml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit d8b70dec1e5c09b73ae277f4f5b246315841fb8e -Author: Gian Mario Tagliaretti -Date: Fri May 1 22:24:33 2009 +0200 - - Add docs for the gio.MountOperation class - - docs/Makefile.am | 2 + - docs/reference/pygio-classes.xml | 1 + - docs/reference/pygio-constants.xml | 107 +++++ - docs/reference/pygio-mountoperation.xml | 726 - ++++++++++++++++++++++++++++++++ - 4 files changed, 836 insertions(+) - -commit fceea8e843e880f0469e454df23141e7dd2bc0cf -Author: Gian Mario Tagliaretti -Date: Thu Apr 30 22:13:06 2009 +0200 - - Update NEWS, release 2.17.0 - - NEWS | 93 - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 93 insertions(+) - -commit 47389217d1a65a8e3f404d486c508cf5d3164756 -Author: Paul Pogonyshev -Date: Thu Apr 30 22:47:19 2009 +0300 - - Fix memory leak in gio.File.query_info_async() - - After the recent patch it would leak exception data if old argument - order was used. Properly decref the objects. - - gio/gfile.override | 4 ++++ - 1 file changed, 4 insertions(+) diff --git a/INSTALL b/INSTALL deleted file mode 100644 index d60e29a..0000000 --- a/INSTALL +++ /dev/null @@ -1,370 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation, -Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Basic Installation -================== - - Briefly, the shell commands './configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the 'README' file for -instructions specific to this package. Some packages provide this -'INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The 'configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a 'Makefile' in each directory of the package. -It may also create one or more '.h' files containing system-dependent -definitions. Finally, it creates a shell script 'config.status' that -you can run in the future to recreate the current configuration, and a -file 'config.log' containing compiler output (useful mainly for -debugging 'configure'). - - It can also use an optional file (typically called 'config.cache' -and enabled with '--cache-file=config.cache' or simply '-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how 'configure' could check whether to do them, and mail -diffs or instructions to the address given in the 'README' so they can -be considered for the next release. If you are using the cache, and at -some point 'config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file 'configure.ac' (or 'configure.in') is used to create -'configure' by a program called 'autoconf'. You need 'configure.ac' if -you want to change it or regenerate 'configure' using a newer version -of 'autoconf'. - - The simplest way to compile this package is: - - 1. 'cd' to the directory containing the package's source code and type - './configure' to configure the package for your system. - - Running 'configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type 'make' to compile the package. - - 3. Optionally, type 'make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type 'make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the 'make install' phase executed with root - privileges. - - 5. Optionally, type 'make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior 'make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing 'make clean'. To also remove the - files that 'configure' created (so you can compile the package for - a different kind of computer), type 'make distclean'. There is - also a 'make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type 'make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide `make - distcheck', which can by used by developers to test that all other - targets like 'make install' and 'make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the 'configure' script does not know about. Run './configure --help' -for details on some of the pertinent environment variables. - - You can give 'configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU 'make'. 'cd' to the -directory where you want the object files and executables to go and run -the 'configure' script. 'configure' automatically checks for the -source code in the directory that 'configure' is in and in '..'. This -is known as a "VPATH" build. - - With a non-GNU 'make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use 'make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple '-arch' options to the -compiler but only a single '-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the 'lipo' tool if you have problems. - -Installation Names -================== - - By default, 'make install' installs the package's commands under -'/usr/local/bin', include files under '/usr/local/include', etc. You -can specify an installation prefix other than '/usr/local' by giving -'configure' the option '--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option '--exec-prefix=PREFIX' to 'configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like '--bindir=DIR' to specify different values for particular -kinds of files. Run 'configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of '${prefix}', so that -specifying just '--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to 'configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -'make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, `make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -'${prefix}'. Any directories that were specified during 'configure', -but not in terms of '${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the 'DESTDIR' variable. For -example, 'make install DESTDIR=/alternate/directory' will prepend -'/alternate/directory' before all installation names. The approach of -'DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of '${prefix}' -at 'configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving 'configure' the -option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. - - Some packages pay attention to '--enable-FEATURE' options to -'configure', where FEATURE indicates an optional part of the package. -They may also pay attention to '--with-PACKAGE' options, where PACKAGE -is something like 'gnu-as' or 'x' (for the X Window System). The -'README' should mention any '--enable-' and '--with-' options that the -package recognizes. - - For packages that use the X Window System, 'configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the 'configure' options '--x-includes=DIR' and -'--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of 'make' will be. For these packages, running `./configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with 'make V=1'; while running `./configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with 'make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - HP-UX 'make' updates targets which have the same time stamps as -their prerequisites, which makes it generally unusable when shipped -generated files such as 'configure' are involved. Use GNU 'make' -instead. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its '' header file. The option '-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put '/usr/ucb' early in your 'PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in '/usr/bin'. So, if you need '/usr/ucb' -in your 'PATH', put it _after_ '/usr/bin'. - - On Haiku, software installed for all users goes in '/boot/common', -not '/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - -Specifying the System Type -========================== - - There may be some features 'configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, 'configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -'--build=TYPE' option. TYPE can either be a short name for the system -type, such as 'sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file 'config.sub' for the possible values of each field. If -'config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option '--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with '--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for 'configure' scripts to share, -you can create a site shell script called 'config.site' that gives -default values for variables like 'CC', 'cache_file', and 'prefix'. -'configure' looks for 'PREFIX/share/config.site' if it exists, then -'PREFIX/etc/config.site' if it exists. Or, you can set the -'CONFIG_SITE' environment variable to the location of the site script. -A warning: not all 'configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to 'configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the 'configure' command line, using 'VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified 'gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for 'CONFIG_SHELL' due to -an Autoconf limitation. Until the limitation is lifted, you can use -this workaround: - - CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash - -'configure' Invocation -====================== - - 'configure' recognizes the following options to control how it -operates. - -'--help' -'-h' - Print a summary of all of the options to 'configure', and exit. - -'--help=short' -'--help=recursive' - Print a summary of the options unique to this package's - 'configure', and exit. The 'short' variant lists options used - only in the top level, while the 'recursive' variant lists options - also present in any nested packages. - -'--version' -'-V' - Print the version of Autoconf used to generate the 'configure' - script, and exit. - -'--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally 'config.cache'. FILE defaults to '/dev/null' to - disable caching. - -'--config-cache' -'-C' - Alias for '--cache-file=config.cache'. - -'--quiet' -'--silent' -'-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to '/dev/null' (any error - messages will still be shown). - -'--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - 'configure' can determine that directory automatically. - -'--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -'--no-create' -'-n' - Run the configure checks, but stop before creating any output - files. - -'configure' also accepts some other, not widely useful, options. Run -'configure --help' for more details. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..9fa260d --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,19 @@ +include setup.cfg +include pyproject.toml +include COPYING +include *.in +include NEWS +include tools/pygi-convert.sh +include pygobject.doap +include README.rst +include .gitlab-ci.yml +include *.yaml +include subprojects/*.wrap +include meson.build +include meson_options.txt +recursive-include examples *.py *.png *.css *.ui *.gif *.gresource *.jpg *.xml +recursive-include gi *.h meson.build +recursive-include tests *.py *.c *.h *.xml *.supp meson.build +recursive-include docs *.rst *.svg LICENSE *.ico *.png *.css *.py *.dia Makefile *.txt +recursive-include .gitlab-ci *.sh *.rst *.py Dockerfile* lcovrc +recursive-include pygtkcompat meson.build diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 5e91024..0000000 --- a/Makefile.am +++ /dev/null @@ -1,151 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -AUTOMAKE_OPTIONS = 1.7 - -SUBDIRS = examples gi tests pygtkcompat - -PLATFORM_VERSION = 3.0 - -CLEANFILES = \ - `find "$(builddir)" -type f -name "*.pyc" -print` - -EXTRA_DIST = \ - autogen.sh \ - pygobject.doap \ - pygobject-$(PLATFORM_VERSION).pc.in \ - PKG-INFO \ - PKG-INFO.in \ - pygi-convert.sh \ - m4/as-ac-expand.m4 \ - m4/jhflags.m4 \ - m4/python.m4 - -MAINTAINERCLEANFILES = \ - $(srcdir)/INSTALL \ - $(srcdir)/aclocal.m4 \ - $(srcdir)/autoscan.log \ - $(srcdir)/compile \ - $(srcdir)/config.guess \ - $(srcdir)/config.h.in \ - $(srcdir)/config.sub \ - $(srcdir)/configure.scan \ - $(srcdir)/depcomp \ - $(srcdir)/install-sh \ - $(srcdir)/ltmain.sh \ - $(srcdir)/missing \ - $(srcdir)/mkinstalldirs \ - $(srcdir)/omf.make \ - $(srcdir)/xmldocs.make \ - $(srcdir)/gtk-doc.make \ - $(srcdir)/ChangeLog \ - $(srcdir)/py-compile \ - $(srcdir)/m4/libtool.m4 \ - $(srcdir)/m4/ltoptions.m4 \ - $(srcdir)/m4/ltsugar.m4 \ - $(srcdir)/m4/ltversion.m4 \ - $(srcdir)/m4/lt~obsolete.m4 \ - `find "$(srcdir)" -type f -name Makefile.in -print` \ - `find "$(builddir)" -type f -name "*.pyc" -print` - -BUILT_EXTRA_DIST = \ - ChangeLog - -# pkg-config files -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = pygobject-$(PLATFORM_VERSION).pc - -# python -pyexec_LTLIBRARIES = - -# install pth file. - -EGG_NAME = $(PACKAGE)-$(PACKAGE_VERSION)-py$(PYTHON_VERSION)-$(PLATFORM) - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(pyexecdir) - cp $(top_builddir)/PKG-INFO $(DESTDIR)$(pyexecdir)/$(EGG_NAME).egg-info -install-exec-local: - $(mkinstalldirs) $(DESTDIR)$(pyexecdir) -uninstall-local: - rm -f $(DESTDIR)$(pyexecdir)/$(EGG_NAME).egg-info - -egg: EGG_TMPDIR:=$(TMPDIR)/$(PACKAGE)-$(PACKAGE_VERSION) -egg: $(top_srcdir)/gobject/gobject.la PKG-INFO - rm -fr $(EGG_TMPDIR) - echo $(EGG_NAME).egg - $(MKDIR_P) $(EGG_TMPDIR) - $(MKDIR_P) $(EGG_TMPDIR)/EGG-INFO - $(MAKE) -C gobject install-pkgpyexecLTLIBRARIES pkgpyexecdir=$(EGG_TMPDIR) - rm -fr $(EGG_TMPDIR)/gobject.la - $(INSTALL) PKG-INFO $(EGG_TMPDIR)/EGG-INFO - echo "gobject.so" >> $(EGG_TMPDIR)/EGG-INFO/native_libs.txt - ( echo "gobject" ) >> $(EGG_TMPDIR)/EGG-INFO/top_level.txt - cd $(EGG_TMPDIR) && zip -rq $(EGG_NAME).egg . - mv $(EGG_TMPDIR)/$(EGG_NAME).egg . - rm -fr $(EGG_TMPDIR) - -doc-dist: - mkdir pygobject - cp -r docs/html/*.html pygobject - cp -r docs/html/*.sgml pygobject - cp -r docs/html/*.devhelp pygobject - cp -r docs/style.css pygobject - tar cfz $(PACKAGE)-docs.tar.gz pygobject - rm -fr pygobject - -release-news: - printf "%-8s%s\n" "$(VERSION)" "`LC_TIME=C date '+%d-%b-%Y'`" > NEWS.tmp - - @echo -e "\n\n\nFor blogging, you can copy&paste this HTML formatted news:" - @echo "-------------- 8< -------------" - @last=`head -n1 NEWS | cut -f1 -d' '`; \ - echo "
    "; \ - for commit in `git rev-list $$last..`; do \ - data=`git log --format="format:%s%n%an%n%b" $$commit^..$$commit`; \ - echo "$$data" | perl -e '$$subj = <>; chomp $$subj; $$author = <>; chomp $$author; while (<>) { if (/bugzilla.gnome.org.*id=([0-9]+)/) { $$bug = $$1 }}; print "
  • $$subj ($$author)"; if ($$bug) { print " (#$$bug)"; }; print "
  • \n"'; \ - echo "$$data" | perl -e '$$subj = <>; chomp $$subj; $$author = <>; chomp $$author; while (<>) { if (/bugzilla.gnome.org.*id=([0-9]+)/) { $$bug = $$1 }}; print " - $$subj ($$author)"; if ($$bug) { print " (#$$bug)"; }; print "\n"' >> NEWS.tmp; \ - done - @echo "
" - @echo "-------------- 8< -------------" - - @echo >> NEWS.tmp - @cat NEWS >> NEWS.tmp - @mv NEWS.tmp NEWS - -.PHONY: ChangeLog release-news - -ChangeLog: - @echo Creating $@ - @if test -d "$(srcdir)/.git"; then \ - (GIT_DIR=$(top_srcdir)/.git ./missing --run git log PYGOBJECT_2_17_0^^.. --stat) | fmt --split-only > $@.tmp \ - && mv -f $@.tmp $@ \ - || ($(RM) $@.tmp; \ - echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ - (test -f $@ || echo git-log is required to generate this file >> $@)); \ - else \ - test -f $@ || \ - (echo A git checkout and git-log is required to generate ChangeLog >&2 && \ - echo A git checkout and git-log is required to generate this file >> $@); \ - fi - - -distclean-local: - if test $(srcdir) = .; then :; else \ - rm -f $(BUILT_EXTRA_DIST); \ - fi - -dist-hook: $(BUILT_EXTRA_DIST) - files='$(BUILT_EXTRA_DIST)'; \ - for f in $$files; do \ - if test -f $$f; then d=.; else d=$(srcdir); fi; \ - rm -f $(distdir)/$$f && cp $$d/$$f $(distdir) || exit 1; done - -check.gdb: - cd tests && $(MAKE) check.gdb - -check.nemiver: - cd tests && $(MAKE) check.nemiver - -check.valgrind: - cd tests && $(MAKE) check.valgrind - -@GNOME_CODE_COVERAGE_RULES@ diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 7ee9ff7..0000000 --- a/Makefile.in +++ /dev/null @@ -1,1096 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = . -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/configure $(am__configure_deps) \ - $(srcdir)/config.h.in $(srcdir)/pygobject-3.0.pc.in \ - $(srcdir)/pygobject-3.0-uninstalled.pc.in \ - $(srcdir)/PKG-INFO.in AUTHORS COPYING ChangeLog INSTALL NEWS \ - README compile config.guess config.sub depcomp install-sh \ - missing py-compile ltmain.sh -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = pygobject-3.0.pc pygobject-3.0-uninstalled.pc \ - PKG-INFO -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(pkgconfigdir)" -LTLIBRARIES = $(pyexec_LTLIBRARIES) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -DATA = $(pkgconfig_DATA) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__post_remove_distdir = $(am__remove_distdir) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -GZIP_ENV = --best -DIST_ARCHIVES = $(distdir).tar.xz -DIST_TARGETS = dist-xz -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.7 -SUBDIRS = examples gi tests pygtkcompat -PLATFORM_VERSION = 3.0 -CLEANFILES = \ - `find "$(builddir)" -type f -name "*.pyc" -print` - -EXTRA_DIST = \ - autogen.sh \ - pygobject.doap \ - pygobject-$(PLATFORM_VERSION).pc.in \ - PKG-INFO \ - PKG-INFO.in \ - pygi-convert.sh \ - m4/as-ac-expand.m4 \ - m4/jhflags.m4 \ - m4/python.m4 - -MAINTAINERCLEANFILES = \ - $(srcdir)/INSTALL \ - $(srcdir)/aclocal.m4 \ - $(srcdir)/autoscan.log \ - $(srcdir)/compile \ - $(srcdir)/config.guess \ - $(srcdir)/config.h.in \ - $(srcdir)/config.sub \ - $(srcdir)/configure.scan \ - $(srcdir)/depcomp \ - $(srcdir)/install-sh \ - $(srcdir)/ltmain.sh \ - $(srcdir)/missing \ - $(srcdir)/mkinstalldirs \ - $(srcdir)/omf.make \ - $(srcdir)/xmldocs.make \ - $(srcdir)/gtk-doc.make \ - $(srcdir)/ChangeLog \ - $(srcdir)/py-compile \ - $(srcdir)/m4/libtool.m4 \ - $(srcdir)/m4/ltoptions.m4 \ - $(srcdir)/m4/ltsugar.m4 \ - $(srcdir)/m4/ltversion.m4 \ - $(srcdir)/m4/lt~obsolete.m4 \ - `find "$(srcdir)" -type f -name Makefile.in -print` \ - `find "$(builddir)" -type f -name "*.pyc" -print` - -BUILT_EXTRA_DIST = \ - ChangeLog - - -# pkg-config files -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = pygobject-$(PLATFORM_VERSION).pc - -# python -pyexec_LTLIBRARIES = - -# install pth file. -EGG_NAME = $(PACKAGE)-$(PACKAGE_VERSION)-py$(PYTHON_VERSION)-$(PLATFORM) -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): - -config.h: stamp-h1 - @if test ! -f $@; then rm -f stamp-h1; else :; fi - @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -pygobject-3.0.pc: $(top_builddir)/config.status $(srcdir)/pygobject-3.0.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -pygobject-3.0-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/pygobject-3.0-uninstalled.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -PKG-INFO: $(top_builddir)/config.status $(srcdir)/PKG-INFO.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(pyexecdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pyexecdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyexecdir)"; \ - } - -uninstall-pyexecLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(pyexec_LTLIBRARIES)'; test -n "$(pyexecdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pyexecdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pyexecdir)/$$f"; \ - done - -clean-pyexecLTLIBRARIES: - -test -z "$(pyexec_LTLIBRARIES)" || rm -f $(pyexec_LTLIBRARIES) - @list='$(pyexec_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool config.lt -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__post_remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__post_remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) - -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__post_remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile $(LTLIBRARIES) $(DATA) config.h -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(pkgconfigdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-pyexecLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-hdr \ - distclean-libtool distclean-local distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-data-local install-pkgconfigDATA - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: install-exec-local install-pyexecLTLIBRARIES - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-local uninstall-pkgconfigDATA \ - uninstall-pyexecLTLIBRARIES - -.MAKE: $(am__recursive_targets) all install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--refresh check check-am clean clean-cscope clean-generic \ - clean-libtool clean-pyexecLTLIBRARIES cscope cscopelist-am \ - ctags ctags-am dist dist-all dist-bzip2 dist-gzip dist-hook \ - dist-lzip dist-shar dist-tarZ dist-xz dist-zip distcheck \ - distclean distclean-generic distclean-hdr distclean-libtool \ - distclean-local distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-data-local install-dvi install-dvi-am install-exec \ - install-exec-am install-exec-local install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-pkgconfigDATA install-ps \ - install-ps-am install-pyexecLTLIBRARIES install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-local \ - uninstall-pkgconfigDATA uninstall-pyexecLTLIBRARIES - - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(pyexecdir) - cp $(top_builddir)/PKG-INFO $(DESTDIR)$(pyexecdir)/$(EGG_NAME).egg-info -install-exec-local: - $(mkinstalldirs) $(DESTDIR)$(pyexecdir) -uninstall-local: - rm -f $(DESTDIR)$(pyexecdir)/$(EGG_NAME).egg-info - -egg: EGG_TMPDIR:=$(TMPDIR)/$(PACKAGE)-$(PACKAGE_VERSION) -egg: $(top_srcdir)/gobject/gobject.la PKG-INFO - rm -fr $(EGG_TMPDIR) - echo $(EGG_NAME).egg - $(MKDIR_P) $(EGG_TMPDIR) - $(MKDIR_P) $(EGG_TMPDIR)/EGG-INFO - $(MAKE) -C gobject install-pkgpyexecLTLIBRARIES pkgpyexecdir=$(EGG_TMPDIR) - rm -fr $(EGG_TMPDIR)/gobject.la - $(INSTALL) PKG-INFO $(EGG_TMPDIR)/EGG-INFO - echo "gobject.so" >> $(EGG_TMPDIR)/EGG-INFO/native_libs.txt - ( echo "gobject" ) >> $(EGG_TMPDIR)/EGG-INFO/top_level.txt - cd $(EGG_TMPDIR) && zip -rq $(EGG_NAME).egg . - mv $(EGG_TMPDIR)/$(EGG_NAME).egg . - rm -fr $(EGG_TMPDIR) - -doc-dist: - mkdir pygobject - cp -r docs/html/*.html pygobject - cp -r docs/html/*.sgml pygobject - cp -r docs/html/*.devhelp pygobject - cp -r docs/style.css pygobject - tar cfz $(PACKAGE)-docs.tar.gz pygobject - rm -fr pygobject - -release-news: - printf "%-8s%s\n" "$(VERSION)" "`LC_TIME=C date '+%d-%b-%Y'`" > NEWS.tmp - - @echo -e "\n\n\nFor blogging, you can copy&paste this HTML formatted news:" - @echo "-------------- 8< -------------" - @last=`head -n1 NEWS | cut -f1 -d' '`; \ - echo "
    "; \ - for commit in `git rev-list $$last..`; do \ - data=`git log --format="format:%s%n%an%n%b" $$commit^..$$commit`; \ - echo "$$data" | perl -e '$$subj = <>; chomp $$subj; $$author = <>; chomp $$author; while (<>) { if (/bugzilla.gnome.org.*id=([0-9]+)/) { $$bug = $$1 }}; print "
  • $$subj ($$author)"; if ($$bug) { print " (#$$bug)"; }; print "
  • \n"'; \ - echo "$$data" | perl -e '$$subj = <>; chomp $$subj; $$author = <>; chomp $$author; while (<>) { if (/bugzilla.gnome.org.*id=([0-9]+)/) { $$bug = $$1 }}; print " - $$subj ($$author)"; if ($$bug) { print " (#$$bug)"; }; print "\n"' >> NEWS.tmp; \ - done - @echo "
" - @echo "-------------- 8< -------------" - - @echo >> NEWS.tmp - @cat NEWS >> NEWS.tmp - @mv NEWS.tmp NEWS - -.PHONY: ChangeLog release-news - -ChangeLog: - @echo Creating $@ - @if test -d "$(srcdir)/.git"; then \ - (GIT_DIR=$(top_srcdir)/.git ./missing --run git log PYGOBJECT_2_17_0^^.. --stat) | fmt --split-only > $@.tmp \ - && mv -f $@.tmp $@ \ - || ($(RM) $@.tmp; \ - echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ - (test -f $@ || echo git-log is required to generate this file >> $@)); \ - else \ - test -f $@ || \ - (echo A git checkout and git-log is required to generate ChangeLog >&2 && \ - echo A git checkout and git-log is required to generate this file >> $@); \ - fi - -distclean-local: - if test $(srcdir) = .; then :; else \ - rm -f $(BUILT_EXTRA_DIST); \ - fi - -dist-hook: $(BUILT_EXTRA_DIST) - files='$(BUILT_EXTRA_DIST)'; \ - for f in $$files; do \ - if test -f $$f; then d=.; else d=$(srcdir); fi; \ - rm -f $(distdir)/$$f && cp $$d/$$f $(distdir) || exit 1; done - -check.gdb: - cd tests && $(MAKE) check.gdb - -check.nemiver: - cd tests && $(MAKE) check.nemiver - -check.valgrind: - cd tests && $(MAKE) check.valgrind - -@GNOME_CODE_COVERAGE_RULES@ - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/NEWS b/NEWS index c445bf2..bd08aa6 100644 --- a/NEWS +++ b/NEWS @@ -1,2011 +1,3529 @@ -3.9.92 16-Sep-2013 - - Fix union argument regression when marshaling from python - (Simon Feltman) (#703873) - - Fix GLib.Source sub-classing with initializer args (Simon Feltman) - (#707904) - - Copy __doc__ when wrapping function (Vratislav Podzimek) - -3.9.91 02-Sep-2013 - - Fix GObject signal methods to work with new annotations - (Simon Feltman) (#707280) - - Fix build on C89 Compilers (Chun-wei Fan) (#707264) - - Change boxed type checking in marshaling to use __gtype__ attribute - (Simon Feltman) (#707140) - - Use G_IS_VALUE for checking return values in closure marshaling - (Simon Feltman) (#707170) - - Fix PEP-8 errors in propertyhelper.py (Yanko Kaneti) (#706319) - -3.9.90 19-Aug-2013 - - Create GLib.Pid in the same way on python 2 and 3 (Benjamin Berg) - (#705451) - - Use PyLong_Type.tp_new for GLib.Pid (Benjamin Berg) (#705451) - - Add accumulator and accu_data arguments to GObject.Signal decorator - (Simon Feltman) (#705533) - - Pass return values through the GObject.Signal.emit wrapper - (Simon Feltman) (#705530) - -3.9.5 29-Jul-2013 - - Ensure exceptions set in closure out argument marshaling are printed - (Simon Feltman) (#705064) - - Always raise OverflowError for marshaling integers from Python - (not ValueError or OverflowError) (Simon Feltman) (#705057) - - Cleanup invoke args and kwargs combiner code (Simon Feltman) (#640812) - - gtk-demo: Change demo to use Gtk.Application (Simon Feltman) (#698547) - - Add callable and descriptor protocols to PyGICallableInfo - (Simon Feltman) (#704037) - - Unify basic type argument marshaling for methods, closures, and - properties (Simon Feltman) (#693405) - - Override GValue.set/get_boxed with static C marshaler - (Simon Feltman) (#688081, #693405) - - Add deprecation warning for marshaling arbitrary objects as pointers - (Simon Feltman) (#688081) - - Replace usage of __import__ with importlib.import_module - (Simon Feltman) (#682320) - - Always unref the GiTypeInfo when generating an argument cache - (Mike Gorse) (#703973) - - Unref interface info when fetching enums or flags - (Mike Gorse) (#703960) - - Speed up MRO calculation (Daniel Drake) (#703829) - - Add GIL safety to pyobject_copy for copying boxed PyObjects - (Simon Feltman) (#688081) - - Add marshaling of GI_TYPE_TAG_VOID held in a GValue to int - (Simon Feltman) (#694233) - - GTK overrides: Make connect_signals handle tuple - (Cole Robinson) (#693994) - - Re-add support for passing GValue's by reference - (Simon Feltman) (#701058) - - Clear return value of closures to zero when an exception occurs - (Simon Feltman) (#702552) - - Don't use doctest syntax in docstrings for examples - (Martin Pitt) (#701009) - - Add support for properties of type GInterface - (Garrett Regier) (#703456) - - pygtkcompat: Fix for missing methods on Windows - (Martin Pitt) (#702787) - - gi/pygi-info.c: Avoid C99-style variable declaration - (Chun-wei Fan) (#702786) - -3.9.2 28-May-2013 - - examples/option.py: Port to GI and Python 3 (Martin Pitt) - - Fix vfunc info search for classes with multiple inheritance - (Simon Feltman) (#700092) - - Fix closure argument conversion for enum and flag in args - (Simon Feltman) - - Fix marshaling Python to FFI return value for enum and flags - (Simon Feltman) - - Remove half implemented GC in PyGIBaseInfo, PyGIStruct, and PyGIBoxed - (Simon Feltman) (#677091) - - Replace usage of pyg_begin_allow_threads with Py_BEGIN_ALLOW_THREADS - (Simon Feltman) (#699440) - - Remove and deprecate API for setting of thread blocking functions - (Simon Feltman) (#699440) - -3.9.1 30-Apr-2013 - - gtk-demo: Wrap description strings at 80 characters (Simon Feltman) - (#698547) - - gtk-demo: Use textwrap to reformat description for Gtk.TextView - (Simon Feltman) (#698547) - - gtk-demo: Use GtkSource.View for showing source code (Simon Feltman) - (#698547) - - Use correct class for GtkEditable's get_selection_bounds() function - (Mike Ruprecht) (#699096) - - Test results of g_base_info_get_name for NULL (Simon Feltman) - (#698829) - - Add ObjectInfo.get_class_struct() (Johan Dahlin) (#685218) - - Change interpretation of NULL pointer field from None to 0 - (Simon Feltman) (#698366) - - Do not build tests until needed (Sobhan Mohammadpour) (#698444) - - pygi-convert: Support toolbar styles (Kai Willadsen) (#698477) - - pygi-convert: Support new-style constructors for Gio.File - (Kai Willadsen) (#698477) - - pygi-convert: Add some support for recent manager constructs - (Kai Willadsen) (#698477) - - pygi-convert: Don't transform arbitrary keysym imports - (Kai Willadsen) (#698477) - - Remove Python keyword escapement in Repository.find_by_name - (Simon Feltman) (#697363) - - Optimize signal lookup in gi repository (Daniel Drake) (#696143) - - Optimize connection of Python-implemented signals (Daniel Drake) - (#696143) - - Consolidate signal connection code (Daniel Drake) (#696143) - - Fix setting of struct property values (Daniel Drake) - - Optimize property get/set when using GObject.props (Daniel Drake) - (#696143) - - configure.ac: Fix PYTHON_SO with Python3.3 (Christoph Reiter) - (#696646) - - Simplify registration of custom types (Daniel Drake) (#696143) - - pygi-convert.sh: Add GStreamer rules (Christoph Reiter) (#697951) - - pygi-convert: Add rule for TreeModelFlags (Jussi Kukkonen) - - Unify GI marshalling code (Simon Feltman) (#693405) - - Use distutils.sysconfig to retrieve the python include path. - (Christoph Reiter) (#696648) - - Support PEP 3149 (ABI version tagged .so files) (Christoph Reiter) - (#696646) - - Fix stack corruption due to incorrect format for argument parser - (Simon Feltman) (#696892) - - Deprecate GLib and GObject threads_init (Simon Feltman) (#686914) - - Drop support for Python 2.6 (Martin Pitt) - - Remove static PollFD bindings (Martin Pitt) (#686795) - - Drop test skipping due to too old g-i (Martin Pitt) - - Bump glib and g-i dependencies (Martin Pitt) - -3.8.0 25-Mar-2013 - - tests: Fix incorrect assumption when testing pyglib version - (Simon Feltman) - -3.7.92 18-Mar-2013 - - Fix stack smasher when marshaling enums as a vfunc return value - (Simon Feltman) (#637832) - - Change base class of PyGIDeprecationWarning based on minor version - (Simon Feltman) (#696011) - - autogen.sh: Source gnome-autogen to fix out of source builddir (Alban - Browaeys) (#694889) - - pygtkcompat: Make gdk.Window.get_geometry return tuple of 5 - (Simon Feltman) - - pygtkcompat: Initialize hint to zero in set_geometry_hints - (Simon Feltman) - - Remove incorrect bounds check with property helper flags - (Simon Feltman) - - Fix crash when setting property of type object to an incorrect type - (Simon Feltman) (#695420) - - Give more informative error when setting property to incorrect type - (Simon Feltman) (#695420) - -3.7.91.1 05-Mar-2013 - - Revert "Drop gi.overrides.overridefunc()" (Martin Pitt) (#695199) - -3.7.91 04-Mar-2013 - - Fix many memory leaks (#675726, #693402, #691501, #510511, #691501, - #672224, and several more which are detected by our test suite) - (Martin Pitt) - - Dot not clobber original Gdk/Gtk functions with overrides - (Martin Pitt) (#686835) - - Optimize GValue.get/set_value by setting GValue.g_type to a local - (Simon Feltman) (#694857) - - Run tests with G_SLICE=debug_blocks (Martin Pitt) (#691501) - - Add override helper for stripping boolean returns (Martin Pitt) - (#694431) - - Drop obsolete pygobject_register_sinkfunc() declaration (Martin Pitt) - (#639849) - - Fix marshalling of C arrays with explicit length in signal arguments - (Martin Pitt) (#662241) - - Fix signedness, overflow checking, and 32 bit overflow of GFlags - (Martin Pitt) (#693121) - - gi/pygi-marshal-from-py.c: Fix build on Visual C++ (Chun-wei Fan) - (#692856) - - Raise DeprecationWarning on deprecated callables (Martin Pitt) - (#665084) - - pygtkcompat: Add Widget.window, scroll_to_mark, and window methods - (Simon Feltman) (#694067) - - pygtkcompat: Add Gtk.Window.set_geometry_hints which accepts keyword - arguments (Simon Feltman) (#694067) - - Ship pygobject.doap for autogen.sh (Martin Pitt) (#694591) - - Fix crashes in various GObject signal handler functions - (Simon Feltman) (#633927) - - pygi-closure: Protect the GSList prepend with the GIL (Olivier Crête) - (#684060) - - generictreemodel: Fix bad default return type for get_column_type - (Simon Feltman) - -3.7.90 19-Feb-2013 - - overrides: Fix inconsistencies with drag and drop target list API - (Simon Feltman) (#680640) - - pygtkcompat: Add pygtk compatible GenericTreeModel implementation - (Simon Feltman) (#682933) - - overrides: Add support for iterables besides tuples for TreePath - creation (Simon Feltman) (#682933) - - Prefix __module__ attribute of function objects with gi.repository - (Niklas Koep) (#693839) - - configure.ac: only enable code coverage when available, to fix - autogen.sh with older gnome-commons (Jonathan Ballet) (#693328) - - Correctly set properties on object with statically defined properties - (Jonathan Ballet) (#693618) - - autogen.sh: Use gnome-autogen.sh (Martin Pitt) (#693328) - - Fix reference leaks with transient floating objects (Simon Feltman) - (#687522) - -3.7.5.1 05-Feb-2013 - - Fix ABI break with pygobject.h from 3.7.5 (Simon Feltman) (#675726) - -3.7.5 04-Feb-2013 - - Move various signal methods from static bindings to GI - (Simon Feltman) (#692918) - - GLib overrides: Support unpacking 'maybe' variants (Paolo Borelli) - (#693032) - - Fix ref count leak when creating pygobject wrappers for input args - (Mike Gorse) (#675726) - - Prefix names of typeless enums and flags for GType registration - (Simon Feltman) (#692515) - - Fix compilation with non-C99 compilers such as Visual C++ - (Chun-wei Fan) (#692856) - - gi/overrides/Glib.py: Fix running on Windows/non-Unix (Chun-wei Fan) - - Do not immediately initialize Gdk and Gtk on import (Martin Pitt) - (#692300) - - Accept ±inf and NaN as float and double values (Martin Pitt) (#692381) - - Fix repr() of GLib.Variant (Martin Pitt) - - Fix gtk-demo for Python 3 (Martin Pitt) - - Define GObject.TYPE_VALUE gtype constant (Martin Pitt) - - gobject: Go through introspection on property setting (Olivier Crête) - (#684062) - - Clean up caller-allocated GValues and their memory (Mike Gorse) - (#691820) - - Use GNOME_COMPILE_WARNINGS from gnome-common (Martin Pitt) - -3.7.4 14-Jan-2013 - - Allow setting values through GtkTreeModelFilter (Simonas Kazlauskas) - (#689624) - - Support GParamSpec signal arguments from Python (Martin Pitt) - (#683099) - - pygobject_emit(): Fix cleanup on error (Martin Pitt) - - Add signal emission methods to TreeModel which coerce the path - argument (Simon Feltman) (#682933) - - Add override for GValue (Bastian Winkler) (#677473) - - Mark caller-allocated boxed structures as having a slice allocated - (Mike Gorse) (#699501) - - pygi-property: Support boxed GSList/GList types (Olivier Crête) - (#684059) - - tests: Add missing backwards compat methods for Python 2.6 - (Martin Pitt) (#691646) - - Allow setting TreeModel values to None (Simon Feltman) (#684094) - - Set clean-up handler for marshalled arrays (Mike Gorse) (#691509) - - Support setting string fields in structs (Vadim Rutkovsky) (#678401) - - Permit plain integers for "gchar" values (Martin Pitt) - - Allow single byte values for int8 types (Martin Pitt) (#691524) - - Fix invalid memory access handling errors when registering an enum - type (Mike Gorse) - - Fix (out) arguments in callbacks (Martin Pitt) - - Fix C to Python marshalling of struct pointer arrays (Martin Pitt) - - Don't let Property.setter() method names define property names - (Martin Pitt) (#688971) - - Use g-i stack allocation API (Martin Pitt) (#615982) - - pyg_value_from_pyobject: support GArray (Ray Strode) (#690514) - - Fix obsolete automake macros (Marko Lindqvist) (#691101) - - Change dynamic enum and flag gtype creation to use namespaced naming - (Simon Feltman) (#690455) - - Fix Gtk.UIManager.add_ui_from_string() override for non-ASCII chars - (Jonathan Ballet) (#690329) - - Don't dup strings before passing them to type registration functions - (Mike Gorse) (#690532) - - Fix marshalling of arrays of boxed struct values (Carlos Garnacho) - (#656312) - -3.7.3 17-Dec-2012 - - Add support for caller-allocated GArray out arguments (Martin Pitt) - (#690041) - - [API add] Re-support calling GLib.io_add_watch with an fd or Python - file (Martin Pitt) - - pygtkcompat: Work around IndexError on large flags (Martin Pitt) - - Fix pyg_value_from_pyobject() range check for uint (Martin Pitt) - - Fix tests to work with g-i 1.34.2 (Martin Pitt) - - Fix wrong refcount for GVariant property defaults (Martin Pitt) - (#689267) - - Fix array arguments on 32 bit architectures (Martin Pitt) - - Add backwards compatible API for GLib.unix_signal_add_full() - (Martin Pitt) - - Drop MININT64/MAXUINT64 workaround, current g-i gets this right now - (Martin Pitt) - - Fix maximum and minimum ranges of TYPE_(U)INT64 properties - (Simonas Kazlauskas) (#688949) - - Ship pygi-convert.sh in tarballs (Martin Pitt) (#688697) - -3.7.2 19-Nov-2012 - - [API change] Drop almost all static GLib bindings and replace them - with proper introspection. This gets rid of several cases where the - PyGObject API was not matching the real GLib API, makes the full GLib - API available through introspection, and makes the code smaller, - easier to maintain. For backwards compatibility, overrides are - provided to emulate the old static binding API, but this will throw a - PyGIDeprecationWarning for the cases that diverge from the official - API (in particular, GLib.io_add_watch() and GLib.child_watch_add() - being called without a priority argument). (Martin Pitt, Simon Feltman) - - [API change] Deprecate calling GLib API through the GObject - namespace. This has always been a misnomer with introspection, and - will be removed in a later version; for now this throws a - PyGIDeprecationWarning. - - [API change] Do not bind gobject_get_data() and gobject_set_data(). - These have been deprecated for a cycle, now dropped entirely. - (Steve Frécinaux) (#641944) - - [API change] Deprecate void pointer fields as general PyObject - storage. (Simon Feltman) (#683599) - - Add support for GVariant properties (Martin Pitt) - - Add type checking to GVariant argument assignment (Martin Pitt) - - Fix marshalling of arrays of struct pointers to Python (Carlos Garnacho) (#678620) - - Fix Gdk.Atom to have a proper str() and repr() (Martin Pitt) (#678620) - - Make sure g_value_set_boxed does not cause a buffer overrun with GStrvs (Simon Feltman) (#688232) - - Fix leaks with GValues holding boxed and object types (Simon Feltman) (#688137) - - Add doc strings showing method signatures for gi methods (Simon Feltman) (#681967) - - Set Property instance doc string and blurb to getter doc string (Simon Feltman) (#688025) - - Add GObject.G_MINSSIZE (Martin Pitt) - - Fix marshalling of GByteArrays (Martin Pitt) - - Fix marshalling of ssize_t to smaller ints (Martin Pitt) - - Add support for lcov code coverage, and add a lot of missing - GIMarshallingTests and g-i Regress tests. (Martin Pitt) - - pygi-convert: remove deprecated GLib → GObject conversions (Jose Rostagno) - - Add support for overriding GObject.Object (Simon Feltman) (#672727) - - Add --with-python configure option (Martin Pitt) - - Do not prefer unversioned "python" when configuring, as some distros - have "python" as Python 3. Use Python 3 by default if available. Add - --with-python configure option as an alternative to setting $PYTHON, - whic is more discoverable. (Martin Pitt) - - Fix property lookup in class hierarchy (Daniel Drake) (#686942) - - Move property and signal creation into _class_init() (Martin Pitt) (#686149) - - Fix duplicate symbols error on OSX (John Ralls) - - [API add] Add get_introspection_module for getting un-overridden modules (Simon Feltman) (#686828) - - Work around wrong 64 bit constants in GLib Gir (Martin Pitt) (#685022) - - Mark GLib.Source.get_current_time() as deprecated (Martin Pitt) - - Fix OverflowError in source_remove() (Martin Pitt) (#684526) - -3.7.1 22-Oct-2012 - - Bump version to 3.7.1; let's follow the real GNOME versioning from - now on (Martin Pitt) - - Change install_properties to not use getattr on classes - (Simon Feltman) (#686559) - - Move property install function into propertyhelper.py (Simon Feltman) - (#686559) - - Fix Signal decorator to not use base class gsignals dict - (Simon Feltman) (#686496) - - tests: Consistently use GLib.MainLoop (Martin Pitt) - - Install the .egg-info files into correct multilib directory - (Kalev Lember) (#686315) - - Fix leaked vfunc return values (Simon Feltman) (#686140) - - Skip Regress tests with --disable-cairo (Martin Pitt) (#685094) - - Fix leak with python callables as closure argument. (Simon Feltman) - (#685598) - - Gio overrides: Handle setting GSettings enum keys (Martin Pitt) - (#685947) - - tests: Check reading GSettings enums in Gio overrides (Martin Pitt) - - Fix unsigned values in GArray/GList/GSList/GHash (Martin Pitt) - (#685860) - - _pygi_marshal_from_py_uint64(): Use correct data type in py2.7 check - (Alban Browaeys) (#685000) - - Install an .egg-info file (Johan Dahlin) (#680138) - - PyGProps_getattro(): Fix GObjectClass leak (Johan Dahlin) (#685218) - - pygobject.c: Don't leak GObjectClass reference (Olivier Crête) - (#684062) - - Fix memory leak in _pygi_argument_to_array() (Alban Browaeys) - (#685082) - - Fix error messages for out of range numbers (Martin Pitt) (#684314) - - Kill dbus-daemon after running tests (Martin Pitt) (#685009) - - GVariant overrides: Support empty tuple arrays (Martin Pitt) - (#684928) - - tests: Fix wrong return type in test_int64_callback() (Martin Pitt) - (#684700) - - Fix GValue marshalling of long and unsigned long (Giovanni Campagna) - (#684331) - - Clean up deprecation message for assigning gpointers to objects. - (Simon Feltman) (#683599) - - pygi-property: Lookup property in base classes of non-introspected - types (Olivier Crête) (#684058) - -3.4.0 24-Sep-2012 - - Bump g-i dependency to 1.33.14 (Martin Pitt) - -3.3.92 17-Sep-2012 - - [API add] Add ObjectInfo.get_abstract method (Simon Feltman) (#675581) - - Add deprecation warning when setting gpointers to anything other than - int. (Simon Feltman) (#683599) - - argument: Fix 64bit integer convertion from GValue (Nicolas Dufresne) - (#683596) - - Improve setting pointer fields/arguments to NULL using None - (Simon Feltman) (#683150) - - Bump g-i dependency to 1.33.10 (Martin Pitt) - - Fix -uninstalled.pc.in file (Thibault Saunier) (#683379) - - Various test suite additions and improvements (Martin Pitt) - -3.3.91 03-Sep-2012 - - Fix exception test case for Python 2 (Martin Pitt) - - Bump g-i dependency to >= 1.3.9 (Martin Pitt) - - Show proper exception when trying to allocate a disguised struct - (Martin Pitt) (#639972) - - Support marshalling GParamSpec signal arguments (Mark Nauwelaerts) - (#683099) - - Add test for a signal that returns a GParamSpec (Martin Pitt) - (#683265) - - [API add] Add Signal class for adding and connecting custom signals. - (Simon Feltman) (#434924) - - Fix pygtkcompat's Gtk.TreeView.insert_column_with_attributes() - (Martin Pitt) - - Add override for Gtk.TreeView.insert_column_with_attributes() - (Marta Maria Casetti) (#679415) - - .gitignore: Add missing built files (Martin Pitt) - - Ship tests/gi in tarball (Martin Pitt) - - Split test_overrides.py (Martin Pitt) (#683188) - - _pygi_argument_to_object(): Clean up array unmarshalling (Martin Pitt) - - Fix memory leak in _pygi_argument_to_object() (Alban Browaeys) - (#682979) - - Fix setting pointer fields/arguments to NULL using None. - (Simon Feltman) (#683150) - - Fix for python 2.6, officially drop support for < 2.6 (Martin Pitt) - (#682422) - - Allow overrides in other directories than gi itself - (Thibault Saunier) (#680913) - - Clean up sys.path handling in tests (Simon Feltman) (#680913) - - Fix dynamic creation of enum and flag gi types for Python 3.3 - (Simon Feltman) (#682323) - - [API add] Override g_menu_item_set_attribute (Paolo Borelli) (#682436) - -3.3.90 20-Aug-2012 - - Implement marshalling for GParamSpec (Mathieu Duponchelle) (#681565) - - Fix erronous import statements for Python 3.3 (Simon Feltman) - (#682051) - - Do not fail tests if pyflakes or pep8 are not installed (Martin Pitt) - - Fix PEP-8 whitespace checking and issues in the code (Martin Pitt) - - Fix unmarshalling of gssize (David Malcolm) (#680693) - - Fix various endianess errors (David Malcolm) (#680692) - - Gtk overrides: Add TreeModelSort.__init__(self, model) - (Simon Feltman) (#681477) - - Convert Gtk.CellRendererState in the pygi-convert script - (Manuel Quiñones) (#681596) - -3.3.5 06-Aug-2012 - - Fix list marshalling on big-endian machines (Martin Pitt) - (#680693) - - Beautify class/interface type mismatch error messages (Martin Pitt) - - Skip instead of fail tests which need Pango, Atk, Gdk, Gtk (Martin Pitt) - - [API add] pygtkcompat: Add more pixbuf creation functions (Simon Feltman) - (#680814) - - Fix error messages on interface/class type mismatches (Martin Pitt) - - Fix crash when returning (False, None) from Gtk.TreeModel.do_get_iter() (Simon Feltman) - (#680812) - - Add test case for Gtk.TextIter.forward_search() (Martin Pitt) - (#679415) - - pygi-info.c: Robustify pointer arithmetic (Martin Pitt) - - Add set_attributes() override to Gtk.TreeViewColumn (Manuel Quiñones) - - Gtk overrides: Add TreePath.__getitem__() (Simon Feltman) - (#680353) - - Fix property type mapping from int to TYPE_INT for python3. (Simon Feltman) - (#679939) - - Convert Gtk.DestDefaults constants in pygi-convert.sh script (Manuel Quiñones) - (#680259) - - Convert all Gdk.WindowState constants in pygi-convert.sh (Manuel Quiñones) - (#680257) - - [API add] Add API for checking pygobject's version (Joe R. Nassimian) - (#680176) - - pygi-convert.sh: Add some missing Gdk.CursorTypes (Manuel Quiñones) - (#680050) - - pygi-convert.sh: convert rsvg.Handle(data=...) (Manuel Kaufmann) - (#680092) - -3.3.4 16-Jul-2012 - - pygi-convert.sh: Drop bogus filter_new() conversion (Martin Pitt) - (#679999) - - Fix help() for GI modules (Martin Pitt) (#679804) - - Skip gi.CallbackInfo objects from a module's dir() (Martin Pitt) - (#679804) - - Fix __path__ module attribute (Martin Pitt) - - pygi-convert.sh: Fix some child → getChild() false positives - (Joe R. Nassimian) (#680004) - - Fix array handling for interfaces, properties, and signals - (Mikkel Kamstrup Erlandsen) (#667244) - - Add conversion of the Gdk.PropMode constants to pygi-convert.sh - script (Manuel Quiñones) (#679775) - - Add the same rules for pack_start to convert pack_end (Manuel - Quiñones) (#679760) - - Add error-checking for the case where _arg_cache_new() fails - (Dave Malcolm) (#678914) - - Add conversion of the Gdk.NotifyType constants to pygi-convert.sh - script (Manuel Quiñones) (#679754) - - Fix PyObject_Repr and PyObject_Str reference leaks (Simon Feltman) - (#675857) - - [API add] Gtk overrides: Add TreePath.__len__() (Martin Pitt) - (#679199) - - GLib.Variant: Fix repr(), add proper str() (Martin Pitt) (#679336) - - m4/python.m4: Update Python version list (Martin Pitt) - - Remove "label" property from Gtk.MenuItem if it is not set - (Micah Carrick) (#670575) - -3.3.3.1 25-Jun-2012 - - Do not escape enum and flag names that are Python keywords (Martin Pitt) - -3.3.3 25-Jun-2012 - - Remove obsolete release-tag make target (Martin Pitt) - - Do not do any python calls when GObjects are destroyed after the - python interpreter has been finalized (Simon Schampijer) (#678046) - - Do not change constructor-only "type" Window property (Martin Pitt) - (#678510) - - Escape identifiers which are Python keywords (Martin Pitt) (#676746) - - Fix code for PEP-8 violations detected by the latest pep8 checker. - (Martin Pitt) - - Fix crash in GLib.find_program_in_path() (Martin Pitt) (#678119) - - Revert "Do not bind gobject_get_data() and gobject_set_data()" (Martin Pitt) - (#641944) - - GVariant: Raise proper TypeError on invalid tuple input (David Keijser) - (#678317) - -3.3.2 05-Jun-2012 - - foreign: Register cairo.Path and cairo.FontOptions foreign structs - (Bastian Winkler) (#677388) - - Check types in GBoxed assignments (Marien Zwart) (#676603) - - [API add] Gtk overrides: Add TreeModelRow.get_previous() - (Bastian Winkler) (#677389) - - [API add] Add missing GObject.TYPE_VARIANT (Bastian Winkler) (#677387) - - Fix boxed type equality (Jasper St. Pierre) (#677249) - - Fix TestProperties.testBoxed test (Jose Rostagno) (#676644) - - Fix handling of by-reference structs as out parameters - (Carlos Garnacho) (#653151) - - tests: Add more vfunc checks for GIMarshallingTestsObject - (Martin Pitt) - - Test caller-allocated GValue out parameter (Martin Pitt) (#653151) - - GObject.bind_property: Support transform functions (Bastian Winkler) - (#676169) - - Fix lookup of vfuncs in parent classes (Carlos Garnacho) (#672864) - - tests/test_properties.py: Fix whitespace (Martin Pitt) - - gi: Support zero-terminated arrays with length arguments - (Jasper St. Pierre) (#677124) - - [API add] Add GObject.bind_property method (Simon Feltman) (#675582) - - pygtkcompat: Correctly set flags (Jose Rostagno) (#675911) - - Gtk overrides: Implement __delitem__ on TreeModel (Jose Rostagno) - (#675892) - - Gdk Color override should support red/green/blue_float properties - (Simon Feltman) (#675579) - - Support marshalling of GVariants for closures (Martin Pitt) (#656554) - - _pygi_argument_from_object(): Check for compatible data type - (Martin Pitt) - - pygtkcompat: Fix color conversion (Martin Pitt) - - test_gi: Check setting properties in constructor (Martin Pitt) - - Support getting and setting GStrv properties (Martin Pitt) - - Support defining GStrv properties from Python (Martin Pitt) - - Add GObject.TYPE_STRV constant (Martin Pitt) - - Unref GVariants when destroying the wrapper (Martin Pitt) (#675472) - - Fix TestArrayGVariant test cases (Martin Pitt) - - pygtkcompat: Add gdk.pixbuf_get_formats compat code (Jose Rostagno) - (#675489) - - pygtkcompat: Add some more compat functions (Jose Rostagno) (#675489) - - Fix tests for Python 3 (Martin Pitt) - - Fix building with --disable-cairo (Martin Pitt) - - tests: Fix deprecated assertions (Martin Pitt) - - Run tests with MALLOC_PERTURB_ (Martin Pitt) - -3.3.1 30-Apr-2012 - - GSettings: allow extra keyword arguments (Giovanni Campagna) - (#675105) - - pygtkcompat: Correct Userlist module use (Jose Rostagno) (#675084) - - Add release-news make rule (Martin Pitt) - - Add "make check.nemiver" target (Martin Pitt) - - Test flags and enums in GHash values (Martin Pitt) (#637466) - - tests: Activate test_hash_in and apply workaround (Martin Pitt) - (#666636) - - Add special case for Gdk.Atom array entries from Python (Martin Pitt) - (#661709) - - test_gdbus: Call GetConnectionUnixProcessID() with correct signature - (Martin Pitt) (#667954) - - Add test case for Gtk.ListStore custom sort (Martin Pitt) (#674475) - - GTK overrides: Add missing keyword arguments (Martin Pitt) (#660018) - - [API change] Add missing override for TreeModel.iter_previous() - (Martin Pitt) (#660018) - - pygi-convert.py: Drop obsolete drag method conversions (Martin Pitt) - (#652860) - - tests: Replace deprecated assertEquals() with assertEqual() - (Martin Pitt) - - Plug tiny leak in constant_info_get_value (Paolo Borelli) (#642754) - - Fix len_arg_index for array arguments (Bastian Winkler) (#674271) - - Support defining GType properties from Python (Martin Pitt) (#674351) - - Handle GType properties correctly (Bastian Winkler) (#674351) - - Add missing GObject.TYPE_GTYPE (Martin Pitt) - - Fix test_mainloop.py for Python 3 (Martin Pitt) - - Make callback exception propagation test stricter (Martin Pitt) - (#616279) - - [API add] Add context management to freeze_notify() and - handler_block(). (Simon Feltman) (#672324) - - Add support for GFlags properties (Martin Pitt) (#620943) - - [API add] Wrap GLib.Source.is_destroyed() method (Martin Pitt) - (#524719) - - Fix error message when trying to override a non-GI class - (Martin Pitt) (#646667) - - Fix segfault when accessing __grefcount__ before creating the GObject - (Steve Frécinaux) (#640434) - - [API change] Do not bind gobject_get_data() and gobject_set_data() - (Steve Frécinaux) (#641944) - - Add test case for multiple GLib.MainLoop instances (Martin Pitt) - (#663068) - - Add a ccallback type which is used to invoke callbacks passed to a - vfunc (John (J5) Palmieri) (#644926) - - Regression test: marshalling GValues in GHashTable (Alberto Mardegan) - (#668903) - - Update .gitignore (Martin Pitt) - - Fix "distcheck" and tests with out-of-tree builds (Martin Pitt) - - Add a pep8 check to the makefile (Johan Dahlin) (#672627) - - PEP8 whitespace fixes (Johan Dahlin) (#672627) - - PEP8: Remove trailing ; (Johan Dahlin) (#672627) - - tests: Replace deprecated Python API (Martin Pitt) - - Fail tests if they use or encounter deprecations (Martin Pitt) - - Do not run tests in two phases any more (Martin Pitt) - - test_overrides: Find local gsettings schema with current glib - (Martin Pitt) - - Add GtkComboBoxEntry compatibility (Paolo Borelli) (#672589) - - Correct review comments from Martin (Johan Dahlin) (#672578) - - Correct pyflakes warnings/errors (Johan Dahlin) (#672578) - - Make tests fail on CRITICAL logs, too, and apply to all tests - (Martin Pitt) - - Support marshalling GI_TYPE_TAG_INTERFACE (Alberto Mardegan) - (#668903) - - Fix warnings on None values in added tree/list store rows - (Martin Pitt) (#672463) - - pygtkcompat test: Properly clean up PixbufLoader (Martin Pitt) - -3.1.92 19-Mar-2012 - - Correct Gtk.TreePath.__iter__ to work with Python 3 (Johan Dahlin) - - Fix test_everything.TestSignals.test_object_param_signal test case - (Martin Pitt) - - Add a PyGTK compatibility layer (Johan Dahlin) - - pygtkcompat: Remove first argument for get_origin() (Johan Dahlin) - - Fix pygtkcompat.py to work with Python 3 (Martin Pitt) - - GtkViewport: Add a default values for the adjustment constructor - parameters (Johan Dahlin) - - GtkIconSet: Add a default value for the pixbuf constructor parameter - (Johan Dahlin) - - PangoLayout: Add a default value for set_markup() (Johan Dahlin) - - Gtk[HV]Scrollbar: Add a default value for the adjustment constructor - parameter (Johan Dahlin) - - GtkToolButton: Add a default value for the stock_id constructor - parameter (Johan Dahlin) - - GtkIconView: Add a default value for the model constructor parameter - (Johan Dahlin) - - Add a default value for column in Gtk.TreeView.get_cell_area() - (Johan Dahlin) - - Atomic inserts in Gtk.{List,Tree}Store overrides (Martin Pitt) - - Fix Gtk.Button constructor to accept use_stock parameter - (Martin Pitt) - - Correct bad rebase, remove duplicate Window (Johan Dahlin) - - Add bw-compatible arguments to Gtk.Adjustment (Johan Dahlin) - - GtkTreePath: make it iterable (Johan Dahlin) - - Add a default argument to TreeModelFilter.set_visible_func() - (Johan Dahlin) - - Add a default argument to Gtk.TreeView.set_cursor (Johan Dahlin) - - Add a default argument to Pango.Context.get_metrics() (Johan Dahlin) - - Fix double-freeing GValues in arrays (Martin Pitt) - - Renamed "property" class to "Property" (Simon Feltman) - - Fix Python to C marshalling of GValue arrays (Martin Pitt) - - Correct the Gtk.Window hierarchy (Johan Dahlin) - - Renamed getter/setter instance attributes to fget/fset respectively. - (Simon Feltman) - - Add Gtk.Arrow/Gtk.Window constructor override (Johan Dahlin) - - Fix marshalling to/from Python to work on big endian machines. - (Michel Dänzer) - - Use gi_cclosure_marshal_generic instead of duplicating it. - (Michel Dänzer) - - Override Gtk.TreeView.get_visible_range to fix return (René Stadler) - - Plug memory leak in _is_union_member (Paolo Borelli) - - tests: Split TestInterfaces into separate tests (Sebastian Pölsterl) - - README: Update current maintainers (Martin Pitt) - -3.1.1 20-Feb-2012 - - Don't use C99 style (Sebastian Pölsterl) - - Add test for GPtrArray with transfer full (Martin Pitt) - - Drop obsolete g_thread_init() (Martin Pitt) - - Fix deprecated g_source_get_current_time() (Martin Pitt) - - Fix deprecated g_value_[gs]et_char() (Martin Pitt) - - Make pygiconvert.sh correctly convert gtk.gdk.x11_* (Simon Schampijer) - - Raise required glib version to 2.31 because of g_value_(get|set)_schar (Sebastian Pölsterl) - - Fix cset_first typo (Dieter Verfaillie) - - pygi-convert: Handle Clutter and Cogl (Bastian Winkler) - - Provide access to gpointer struct values (Cédric Krier) - - Add some GType tests (Paolo Borelli) - - Split GStrv and array variant tests in their own classes (Paolo Borelli) - - Add unit test for builder's connect_after (Paolo Borelli) - - fix GtkBuilder signal connection 'after' logic (Ryan Lortie) - - test(1) uses '=' to test if strings are identical (Patrick Welche) - - pygspawn: improve error checking (Ryan Lortie) - -3.1.0 06-Feb-2012 - - Updated DOAP file to only include people currently actively working on the project (Sebastian Pölsterl) - - Revert "Convert all strings to utf-8 encoding when retrieving from TreeModel" (Sebastian Pölsterl) - - tests: Fixed issues with python3 (Sebastian Pölsterl) - - Properly distinguish between different integer types for properties (Sebastian Pölsterl) - - Distinguish between GArray and GPtrArray when cleaning up (Sebastian Pölsterl) - - Add null_gerror_callback unit test (Paolo Borelli) - - pyglib_error_check: Re-add missing NULL check (Martin Pitt) - - Add tests/runtests-windows.py to source tarball (Michael Culbertson) - - Don't issue a depreciation warning for GtkDialog's NO_SEPARATOR flag, even when unused (Sebastian Pölsterl) - - Fix bool() operations on GLib.Variant objects (Nirbheek Chauhan) - - Fix hash() and __eq__() for GLib.Variant objects (Nirbheek Chauhan) - - Fix method names of callback tests (Martin Pitt) - - Cairo: add missing braces around array-of-struct definition (Will Thompson) - - g_instance_init: cast to PyGObject * as needed (Will Thompson) - - Fix a few set-but-not-used warnings. (Will Thompson) - - pygmainloop: allow for extra arguments in 'quit' method (Stefano Facchini) - - Fix bytearray test compatibility with python3 (Alexandre Rostovtsev) - - Respect transfer-type when demarshalling GErrors (Alberto Mardegan) - - Support GHashTable and GError as callback/closure arguments (Alberto Mardegan) - - Don't leak when marshalling GErrors to C (Will Thompson) - - Support functions which return GError (Will Thompson) - - Fix indentation of _pygi_argument_to_object() (Alberto Mardegan) - - Avoid C99 syntax. (Paolo Borelli) - - Connect to first action of a radio group. (Paolo Borelli) - - Use g_slist_free_full in pygi-closure. (Paolo Borelli) - - Avoid O(n^2) behavior when marshalling lists (Paolo Borelli) - - Handle NULL as a valid case of a char** array (Paolo Borelli) - - Branching, bump version to 3.1.0 (Tomeu Vizoso) - - Add notes about branching to HACKING (Tomeu Vizoso) - - Fixed bug where GObject.property did not respect minimum and maximum values (Sebastian Pölsterl) - - Remove mention of removed option --enable-docs (Tomeu Vizoso) - - Fix sebp's name in NEWS (Tomeu Vizoso) - -3.0.3 12-Dec-2011 - - Convert all modifier constants to Gdk.ModifierType (Manuel Quiñones) - - Convert all strings to utf-8 encoding when retrieving from TreeModel (Sebastian Pölsterl) - - add test for bytearray variants (John (J5) Palmieri) - - handle NULL arrays correctly for each array type (John (J5) Palmieri) - - Revert "Revert "Fix array termination and size calculation"" (John (J5) Palmieri) - - pygmainloop: avoid lockups if multiple glib.MainLoop exist (Owen W. Taylor) - - Properly chain up to the class that implements a given vfunc. (Tomeu Vizoso) - - Revert "Fix array termination and size calculation" (Tomeu Vizoso) - - Fix array termination and size calculation (Holger Berndt) - - pygi-convert: fix for Pango.Alignment (Daniel Drake) - - pygi-convert: fix for Gtk.Orientation (Daniel Drake) - - Add tests for calling closures (Martin Pitt) - - fix marshaling of arrays of GVariants (Mikkel Kamstrup Erlandsen) - -3.0.2 21-Oct-2011 - - Add tests for boxed properties. (Ignacio Casal Quinteiro) - - Allow GBoxed types as property (Timo Vanwynsberghe) - - when converting an object with transfer none, make sure the wrapper owns a ref (John (J5) Palmieri) - - unit test for checking ref count of object param in signals (John (J5) Palmieri) - - Gdk overrides: Unbreak for Gdk-2.0 (Martin Pitt) - - Do union member checks for unions that are parameters (John (J5) Palmieri) - -3.0.1 30-Sep-2011 - - when checking instances union members are same type as parent - - add a floating flag to pygobjects - - Revert "Fix refcount bug by not creating python wrapper during gobject init stage" - -3.0.0 19-Sep-2011 - - up version required of gobject-introspection to 1.29.0 (John (J5) Palmieri) - - fix most warnings (John (J5) Palmieri) - -2.90.4 15-Sep-2011 (3.0 pre-release) - - do not pass in len(str) to the length argument of gtk_test_buffer_insert* apis (John (J5) Palmieri) - - Switch tarball compression format to tar.xz only. (Dieter Verfaillie) - - Remove pygtk_version attribute from internal gi._gobject module. (Dieter Verfaillie) - - remove overridesdir from the .pc file and add it to the gi module (John (J5) Palmieri) - - fix tests to correctly construct a dummy Gtk.TargetEntry (John (J5) Palmieri) - - we now assume that C arrays of structs are flat so memcpy them when marshalling (John (J5) Palmieri) - - only update the arg counts once if child arg comes before parent arg (John (J5) Palmieri) - - Fix refcount bug by not creating python wrapper during gobject init stage (John (J5) Palmieri) - - don't destroy just created wrapper when object is created via g_object_new (John (J5) Palmieri) - - Remove deprecated API from pygobject.h (Steve Frécinaux) - - Convert gtk.TRUE/FALSE to Python True/False. (Marcin Owsiany) - - Drop legacy __gobject_init__ method of GObject.Object. (Steve Frécinaux) - - AM_CHECK_PYTHON_LIBS does not work for lib64 (Dieter Verfaillie) - - Remove common_ldflags from Makefile.am as it is no longer used. (Dieter Verfaillie) - - check if object is actually a PyGFlag before trying to access g_type (John (J5) Palmieri) - - fix regression - add instance type checks since Py3 no longer does this for us (John (J5) Palmieri) - - refactor in/out marshalling to be to_py/from_py (John (J5) Palmieri) - - Examples: fix cairo-demo.py imports (Dieter Verfaillie) - - Fix paths and add missing overridesdir variable used in uninstalled pkgconfig file (Dieter Verfaillie) - - Remove no longer used variables from pkgconfig files (Dieter Verfaillie) - - docs/Makefile.am and m4/python.m4: Python3 portability fixes (Dieter Verfaillie) - - Refactor and clean Makefile.am files (Dieter Verfaillie) - - Remove all PLATFORM_VERSION = 2.0 traces (Dieter Verfaillie) - - Remove gi/tests/ directory as all the tests now live in tests/ (Dieter Verfaillie) - - autogen.sh: Use autoreconf instead of a custom script and honor ACLOCAL_FLAGS (Dieter Verfaillie) - - use improved python.m4 macros to search for Python headers and libs (Dieter Verfaillie) - - Make maintiner mode enabled by default (Javier Jardón) - - Disable documentation for now since they are completely wrong for GI. (Dieter Verfaillie) - - Fix documentation installation directory (Dieter Verfaillie) - - Remove distutils based build system. (Dieter Verfaillie) - - [gtk-demo] Fix syntax highlighter encoding issue (Dieter Verfaillie) - - overrides: add constants for atoms (Ignacio Casal Quinteiro) - - Drop pygobject_construct() from public API. (Steve Frécinaux) - -2.90.3 31-Aug-2011 (3.0 pre-release) - - support skip annotation for return values (John (J5) Palmieri) - - Test GPtrArray regression (Xavier Claessens) - - Drop support for old constructor style. (Steve Frécinaux) - - Drop support for sink functions. (Steve Frécinaux) - - Reinstate copying of in-line structs in arrays (Mike Gorse) - - fix inline struct array handling (John (J5) Palmieri) - - fix on demos (Dieter Verfaillie) - - Added support for __setitem__ to TreeModel and support for slices to TreeModelRow (Sebastian Pölsterl) - - Convert ACCEL_* constants into Gtk.AccelFlags. (Olav Vitters) - - Convert TREE_VIEW_DROP_* constants into Gtk.TreeViewDropPosition (Olav Vitters) - -2.90.2 18-Aug-2011 (3.0 pre-release) - - remove tests that were removed from gi (John (J5) Palmieri) - - don't calculate item_size using is_pointer (John (J5) Palmieri) - - Updated signal example to use GObject introspection (Timo Vanwynsberghe) - - Updated properties example to use GObject introspection (Timo Vanwynsberghe) - - Add override for GLib.Variant.split_signature() (Martin Pitt) - - [pygi-convert.sh] Handle the import of pygtk and require Gtk 3.0 (Timo Vanwynsberghe) - - Install pygobject.h again. (Ignacio Casal Quinteiro) - - update the doap file (John (J5) Palmieri) - -2.90.1 14-Aug-2011 (3.0 pre-release) - - pass exta keywords to the Box constructor (John (J5) Palmieri) - - add (Tree|List)Store set method override (John (J5) Palmieri) - - add test for object arrays (John (J5) Palmieri) - - only support C pointer arrays for structs and objects (John (J5) Palmieri) - - revert Gtk.Window override because it causes issues with subclasses (John (J5) Palmieri) - - take GIL in _pygi_invoke_closure_free (bug #647016) (Jonathan Matthew) - - Add a default parameter to GtkTreeModel.filter_new (Johan Dahlin) - - Add vbox/action_area properties (Johan Dahlin) - - Add a couple of constructors (Johan Dahlin) - - Do not always pass in user_data to callbacks. (Johan Dahlin) - - Add a default detail value for Widget.render_icon (Johan Dahlin) - - Add an override for Gdk.color_parse() (Johan Dahlin) - - Support function calling with keyword arguments in invoke. (Laszlo Pandy) - - remove references to deprecated GI_INFO_TYPE_ERROR_DOMAIN (John (J5) Palmieri) - - Fix gobject vs. gi.repository warning (Martin Pitt) - - make GObject and GLib able to take overrides (John (J5) Palmieri) - - avoid dependency issue by importing the internal gobject (John (J5) Palmieri) - - fix tests to use the new GLib module (John (J5) Palmieri) - - add DynamicGLibModule which works like DynamicGObjectModule (John (J5) Palmieri) - - refactor, add objects and types to the correct internal module (John (J5) Palmieri) - - rename the pyglib shared library so we don't load the old one (John (J5) Palmieri) - - refactor tests to only use PyGObject 3 syntax (John (J5) Palmieri) - - refactor the internal _glib module to import correct modules (John (J5) Palmieri) - - refactor to use the new internal _glib and _gobject modules (John (J5) Palmieri) - - refactor gi module to import and use internal _gobject module (John (J5) Palmieri) - - move the static bits internal to gi and refactor build files (John (J5) Palmieri) - - remove pygtk.py (John (J5) Palmieri) - - introspection is no longer optional (John (J5) Palmieri) - - up platform version to 3.0 (John (J5) Palmieri) - - [gi] Handle GVariants from callback return values (Martin Pitt) - - Handle GVariants for callback arguments (Martin Pitt) - - [gi] Fix crash: check return value of _invoke_state_init_from_callable_cache() before continuing. (Laszlo Pandy) - - [gi] Pass gtype as first parameter to vfuncs (instead of using kwargs). (Laszlo Pandy) - - remove codegen (John (J5) Palmieri) - - remove some left over ifdefs to complete merge of the invoke-rewrite branch (John (J5) Palmieri) - - rename pygi-invoke-ng to pygi-invoke (John (J5) Palmieri) - - make invoke-ng the only invoker (John (J5) Palmieri) - - Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) - - Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) - - split the marshalling routines into two source files (John (J5) Palmieri) - - Ship tests/te_ST@nouppera in release tarballs for tests to succeed (Martin Pitt) - - [invoke] break out caller_allocates allocating into its own function (John (J5) Palmieri) - - [invoke] missed a bit when removing constructor_class usage (John (J5) Palmieri) - - [invoke] don't hold on to the constructor class, just add a TODO (John (J5) Palmieri) - - [gi] Port test_properties from static gio to GI Gio (Martin Pitt) - - [python3] Fix maketrans import (Martin Pitt) - - [caching] remove all inline compiler flags (John (J5) Palmieri) - - [caching] refactor function names to be less confusing (John (J5) Palmieri) - - [overrides] deprecate the use of type keyword MessageDialog constructor (John (J5) Palmieri) - - gdbus tests: Fix hang if test case fails (Martin Pitt) - - use an enum instead of booleans to denote function type (John (J5) Palmieri) - - rename aux arguments to child arguments to make their purpose clearer (John (J5) Palmieri) - - Fixed the cairo example (Timo Vanwynsberghe) - - Add override binding for Gtk.ListStore.prepend(). (Adam Dingle) - - Fix crash in Gtk.TextIter overrides (Martin Pitt) - - use gssize instead of int for arg indexes (John (J5) Palmieri) - - [cache] remove refrence to default value as it is not implemented yet (John (J5) Palmieri) - - Handle arguments that are flags correctly (Sebastian Pölsterl) - - correctly initialize the _gi_cairo_functions array to be zero filled (John (J5) Palmieri) - - correctly initialize the _gi_cairo_functions array to be zero filled (John (J5) Palmieri) - - pass in the address of the gerror, not the gerror itself (John (J5) Palmieri) - - [gi] handle marshalling gerrors arguments for signals (John (J5) Palmieri) - - [gi-invoke-ng] fix NULL check to check before we access the cache struct (John (J5) Palmieri) - - [gi-tests] add test for PyGObject->PyObject TreeModel storage (John (J5) Palmieri) - - [gtk-overrides] special case TreeModel columns of PYGOBJECT types (John (J5) Palmieri) - - [gi-invoke-ng] copy structs when transfer is full for array (John (J5) Palmieri) - - [gtk-override] print warning if user imports Gtk 2.0 (John (J5) Palmieri) - - [gtk-overrides] allow the message_type keyword to be used for MessageDialogs (John (J5) Palmieri) - - Add support for enums in gobject.property (Johan Dahlin) - - Add support for enums in gobject.property (Johan Dahlin) - - [gi-invoke-ng] use g_slice for allocating GValues that are caller allocated (John (J5) Palmieri) - - [gi-invoke-ng] Convert Overflow errors to ValueErrors when marshalling integers (John (J5) Palmieri) - - [gi-invoke-ng] only cache caller allocates for interfaces as some API are broken (John (J5) Palmieri) - - [gi-invoke-ng] handle in pointer array marshalling (John (J5) Palmieri) - - Adding GPtrArray tests (Alex Eftimie) - - [gi-invoke-ng] fix array element offset calculations (John (J5) Palmieri) - - [gi] don't clean up arguments that weren't yet processed during in arg failure (John (J5) Palmieri) - - [gi-overrides] use new instead of init when constructing a GLib.VariantBuilder (John (J5) Palmieri) - - [gi-invoke-ng] actual code to import overrides (John (J5) Palmieri) - - [gi-invoke-ng] import pytypes so we get overrides (John (J5) Palmieri) - - [gi-invoke-ng] handle gvariants now that they are not foreign (John (J5) Palmieri) - - [gi-invoke-ng] do not try to clean up NULL arguments (John (J5) Palmieri) - - Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) - - Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) - - closure: avoid double free crash (Ignacio Casal Quinteiro) - - Added __eq__ method for Gdk.Color and Gdk.RGBA (Jason Siefken) - - closure: Check the out arg is not null. Fixes bug #651812 (Ignacio Casal Quinteiro) - - Use constants instead of literals (Tomeu Vizoso) - - GVariant has now a GType, take that into account (Tomeu Vizoso) - - GVariantType is a boxed struct (Tomeu Vizoso) - - Use _gi.Struct to wrap fundamentals (Tomeu Vizoso) - - Merge gi/HACKING into /HACKING (Tomeu Vizoso) - - Fix GC-related crash during PyGObject deallocation (Daniel Drake) - - [gi-invoke-ng] enable invoke-ng by default (John (J5) Palmieri) - - [gi-invoke-ng] add code to clean up when input values fail to marshal (John (J5) Palmieri) - - [gi-invoke-ng] add hash cleanup routines (John (J5) Palmieri) - - [gi-invoke-ng] handle arrays with transfers of GI_TRANSFER_CONTAINER (John (J5) Palmieri) - - [gi-invoke-ng] add list cleanup routines (John (J5) Palmieri) - - indentation fix (John (J5) Palmieri) - - [gi-invoke-ng] add out array cleanup (John (J5) Palmieri) - - [gi-invoke-ng] do not allocate null terminator for garray (John (J5) Palmieri) - - [gi-invoke-ng] add array cleanup for in arrays (John (J5) Palmieri) - - [gi-invoke-ng] remove remaining bits of the invoke stage state machine (John (J5) Palmieri) - - [gi-invoke-ng] revamp cleanup framework to be orthogonal to cache setup (John (J5) Palmieri) - - [gi-invoke-ng] stub out a cleaner way of cleaning up after ourselves (John (J5) Palmieri) - - Doc Extractor: Correct the logic of the --no-since option. (José Alburquerque) - - Doc Extractor: Add a --no-since option. (José Alburquerque) - - [gi-invoke-ng] tweek cleanup routines (John (J5) Palmieri) - - Fix symbol names to be locale independent (Martin Pitt) - - [gi] pygi-convert.sh: Convert gtk.gdk.CROSSHAIR (Martin Pitt) - - [gi-invoke-ng] handle filename cleanup with the utf8 cleanup function (John (J5) Palmieri) - - [gi-invoke-ng] handle caller allocates cleanup (John (J5) Palmieri) - - [gi-invoke-ng] refactor the cleanup code and add utf8 cleanup as initial test (John (J5) Palmieri) - - use PyCapsule when importing pycairo/require pycairo 1.10.0 for python3 builds (John (J5) Palmieri) - - [python3] fix build. PYcairo_IMPORT doesn't exists anymore (Ignacio Casal Quinteiro) - - Updated DOAP file (Sebastian Pölsterl) - - [gi] Don't create variant twice (Sebastian Pölsterl) - - pygi-convert.sh: Make sure the uppercase GObject module is imported instead of the lowercase (Sebastian Pölsterl) - - [gi] Removed hack to avoid using GLib.Variant.new_variant. (Sebastian Pölsterl) - - [gi] Added additional test case for GVariant handling (Sebastian Pölsterl) - - [gi] Added support for GVariant arguments (Sebastian Pölsterl) - - fix static ABI for setting string gvalues from python objects (John (J5) Palmieri) - - dsextras.py: ensure eol characters are preserved when writing template files (so \n does not become \r\n) (Dieter Verfaillie) - - dsextras.py: remove \r as wel as \n character (Dieter Verfaillie) - - use PyCapsule when importing pycairo/require pycairo 1.10.0 for python3 builds (John (J5) Palmieri) - - [python3] fix build. PYcairo_IMPORT doesn't exists anymore (Ignacio Casal Quinteiro) - - Updated DOAP file (Sebastian Pölsterl) - - [gi] Don't create variant twice (Sebastian Pölsterl) - - pygi-convert.sh: Make sure the uppercase GObject module is imported instead of the lowercase (Sebastian Pölsterl) - - [gi] Removed hack to avoid using GLib.Variant.new_variant. (Sebastian Pölsterl) - - [gi] Added additional test case for GVariant handling (Sebastian Pölsterl) - - [gi-invoke-ng] fix prototype (John (J5) Palmieri) - - [gi-invoke-ng] create new framework for cleaning up args (John (J5) Palmieri) - - [gi] Added support for GVariant arguments (Sebastian Pölsterl) - - [gi-invoke-ng] fix marshal header that is no longer part of pygi-arguments.h (John (J5) Palmieri) - - [gi-invoke-ng] code style space fixes (John (J5) Palmieri) - - [gi-invoke-ng] don't decref value taken from a dict as it is borrowed (John (J5) Palmieri) - - [gi-invoke-ng] return None when appropriate so we don't crash (John (J5) Palmieri) - - [gi-invoke-ng] fix aux value caching (John (J5) Palmieri) - - [gi-invoke-ng] backport handling flags with no gtype (John (J5) Palmieri) - - [gi-invoke-ng] backport raw gvalue handling (John (J5) Palmieri) - - [gi-invoke-ng] marshal instances seperately since they differ slightly from other args (John (J5) Palmieri) - - [gi-invoke-ng] refactor FunctionCache to be more generic CallableCache (John (J5) Palmieri) - - [gi-invoke-rewrite] backport glib error handling (John (J5) Palmieri) - - [gi-invoke-ng] backport closure passing from invoke (John (J5) Palmieri) - - [gi-invoke-ng] handle vfuncs and fix cosntrutors (John (J5) Palmieri) - - [gi-invoke-ng] handle foreign types correctly (John (J5) Palmieri) - - [gi] remove the class parameter from the argument list of constructors (John (J5) Palmieri) - - fix static ABI for setting string gvalues from python objects (John (J5) Palmieri) - - dsextras.py: ensure eol characters are preserved when writing template files (so \n does not become \r\n) (Dieter Verfaillie) - - dsextras.py: remove \r as wel as \n character (Dieter Verfaillie) - - [gi] make new invoke-ng codepath compile correctly (John (J5) Palmieri) - - [gi] conditionalize invoke code paths (John (J5) Palmieri) - - [gi] revert back to the type.py from master (John (J5) Palmieri) - - [gi] revert pygi-argument.h and move the invoke-ng code to pygi-marshal.h (John (J5) Palmieri) - - Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) - - [gi] foreign types now take interface infos instead of type infos (John (J5) Palmieri) - - Fix GSchema tests for separate build tree (Martin Pitt) - - [gi] start of merge from master (John (J5) Palmieri) - - [gi] marshal raw closures (John (J5) Palmieri) - - pygi-convert.sh add GObject.xxx and webkit (John Stowers) - - pygi-convert.sh remove gobject tests, GObject works now (John Stowers) - - [gi-demos] add pickers demo (John (J5) Palmieri) - - [gi-demos] add menu demo (John (J5) Palmieri) - - [gi-overrides] fix exception block so it works in Python 2.5 (John (J5) Palmieri) - - Revert "Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES" (Martin Pitt) - - setup.py: fix user_access_control option (Dieter Verfaillie) - - [gi] Respect the MessageType for Gtk.MessageDialog (Martin Pitt) - - [gi] Do not require signature for D-BUS methods without arguments (Martin Pitt) - - [gi-overrides] TreeViewColumn.set_cell_data_func func_data can be None (John Stowers) - - [gi-demos] dont try and run demos that represent directories (John Stowers) - - [gi-demos] some python 3 compat fixes (John (J5) Palmieri) - - [gi-demos] add liststore demo (John (J5) Palmieri) - - [gi-demos] catch the correct error class (John (J5) Palmieri) - - Do not leak python references when using the gobject.property() helper. (Steve Frécinaux) - - handle uchar as bytes, not strings in python 3 (John (J5) Palmieri) - - [gi-overrides] handle unichar gvalues when setting treemodels (John (J5) Palmieri) - - [gi-overrides] special case python 2 keywords that crept in (John (J5) Palmieri) - - check for the py3 _thread module in configure.ac if thread is not found (John (J5) Palmieri) - - [gi-demos] add iconview demo (John (J5) Palmieri) - - [gi] wrap the keyword argument in a dict so we don't break Python 2.5 (John (J5) Palmieri) - - [gi-demos] add the combobox with string ids section to the demos (John (J5) Palmieri) - - [gi-overrides] add an override for Gdk.RGBA (John (J5) Palmieri) - - [gi-demos] fix up search-entry to reflect annotations fixed in Gtk+ master (John (J5) Palmieri) - - [gi-demos] add search entry demo (John (J5) Palmieri) - - [gi] wrap map in a list for Python 3 compat (John (J5) Palmieri) - - [gi-demos] fix up the validation combobox (John (J5) Palmieri) - - add overridesdir variable in the .pc file for 3rd party overrides (John (J5) Palmieri) - - setup.py: Set bdist_wininst user-access-control property (Dieter Verfaillie) - - Fix uninitialized variable in gi.require_version() (Martin Pitt) - - Run tests with LC_MESSAGES="C" (Martin Pitt) - - [gi-overrides] override Gtk.stock_lookup to not return success (John (J5) Palmieri) - -2.27.91 28-Feb-2011 (2.28 pre-release) - - [gi-tests] use Gdk.test_simulate_button instead of emitting event ourselves (John (J5) Palmieri) - - [gi-tests] tests for EventButton override. (Laszlo Pandy) - - Skip interfaces when checking for conflicts in the MRO (Tomeu Vizoso) - - [gi-overrides] Add event methods to all event union members (John (J5) Palmieri) - - [gi] check to see if object is a member of a union when validating paramaters (John (J5) Palmieri) - - [gi] Remove DyanmicModule.load() to _load() to prevent overriding GI attrs. (Laszlo Pandy) - - Test case with John's fix for crash with C arrays and a GError is set. (Laszlo Pandy) - - [gi-overrides] fix setting rows in treeview to accept None as a value (John (J5) Palmieri) - - [gi] Add value_name for enum and flags from introspection "c:identifier" (if attr is available). (Laszlo Pandy) - - Don't force loading of DynamicModule until set in sys.modules (Laszlo Pandy) - - Fix flags with multiple names for the same value. (Laszlo Pandy) - - [gi-demos] add liststore demo (John (J5) Palmieri) - - [gi-demos] run through the demos and remove the FIXMEs that have been fixed (John (J5) Palmieri) - - Load typelibs at import time, add gi.require_version() (Tomeu Vizoso) - - use GValue support to marshal GtkTreeModel values correctly (John (J5) Palmieri) - - [gi] pass raw GValues instead of trying to marshal them (John (J5) Palmieri) - - [gi-demos] add icon view edit and drag-and-drop demo (John (J5) Palmieri) - - [gi] Register GType for non-GType enums and flags at runtime. (Laszlo Pandy) - - [gi-demos] add info bars demo (John (J5) Palmieri) - - tests/runtests.py: Add missing "import sys" (Martin Pitt) - - [gi] Add Pythonic gdbus method invocation (Martin Pitt) - - Skip GError out parameters in Python closure. (Laszlo Pandy) - - [gi-demos] added rotate text demo (John (J5) Palmieri) - - [gi-demos] add images demo (John (J5) Palmieri) - - [gi-demos] add pixbuf demo (John (J5) Palmieri) - - [gi-demos] remove fixmes from print demo, fixed in pango (John (J5) Palmieri) - - [gi-demos] add printing demo (John (J5) Palmieri) - - [gi-overrides] add cursor overrides (John (J5) Palmieri) - - [gi-demos] add the links demo (John (J5) Palmieri) - - [gi-demos] add expander demo (John (J5) Palmieri) - - [gi-overrides] use pop instead of del and add extra tests for Gtk.Table kwargs (John (J5) Palmieri) - - [tests] Separate processes for GI and static binding tests. (Laszlo Pandy) - - [GI] Remove implicit loading of gi module preserve the code path for static bindings. (Laszlo Pandy) - - [gi-demos] add dialogs demo (John (J5) Palmieri) - - [gi-overrides] fix typo in GtkTable constructor (John (J5) Palmieri) - - [gi-demos] keep popup menu from destroying itself by holding a ref in app class (John (J5) Palmieri) - - [gi-overrides] add a Gtk.Menu override for the popup method (John (J5) Palmieri) - - [gi-demos] fix the about dialog in appwindow demo (John (J5) Palmieri) - - [gi-demos] fix clipboard demo so DnD works (John (J5) Palmieri) - - [gi-demos] fix clipboard demo to reflect new API (John (J5) Palmieri) - - [gi-demo] Fix color dialog demo to run with new draw, style and color apis (John (J5) Palmieri) - - [gi-demos] fix most of the combobox app (John (J5) Palmieri) - - Use PyGI type conversion (to fix foreign types) for signal callbacks. (Laszlo Pandy) - - [gi-demos] fix drawingarea app to use the new draw api (John (J5) Palmieri) - - [gi-overrides] for Gtk 3 alias Gdk.Rectangle to cairo.RectangleInt (John (J5) Palmieri) - - [gi-overrides] let user set the proper property names in Gtk.Table (John (J5) Palmieri) - - [gi-demos] get appwindow demo working again (John (J5) Palmieri) - - [gi-demos] fixed use of tree_iter_get (John (J5) Palmieri) - -2.27.90 11-Feb-2011 (2.28 pre-release) - - fix build to correctly use python-config (John (J5) Palmieri) - - Run gio tests separately when enabled (Martin Pitt) - - Revert "Remove gio static bindings" (Martin Pitt) - - Decrease the refcount for GInitiallyUnowned constructors. (Steve Frécinaux) - - Ensure the sink functions are only ran once. (Steve Frécinaux) - - Revert "Fix wrong refcount when calling introspected widget constructors" (Steve Frécinaux) - - Revert "Fix reference leaks for GInitiallyUnowned objects" (Steve Frécinaux) - - Run test suite under dbus-launch (Martin Pitt) - - Fix test_gdbus.py to be Python3 friendly (Martin Pitt) - - [gi] Provide comfortable GSettings API (Martin Pitt) - - Fix vfunc search bug when using GInterfaces and a do_* method. (Laszlo Pandy) - - [GI] Add tests for Gtk.Widget.drag_* methods. (Laszlo Pandy) - - [python 3] use the right syntaxis to raise exceptions (Ignacio Casal Quinteiro) - - [gi] return PYGLIB_MODULE_ERROR_RETURN on error and use pygobject_init (Ignacio Casal Quinteiro) - - [gi] return PYGLIB_MODULE_ERROR_RETURN on error (Ignacio Casal Quinteiro) - - Fix wrong refcount when calling introspected widget constructors (Steve Frécinaux) - - Gdk.Window: Map the standard constructor to the *new* constructor (Simon Schampijer) - - Ship tests/org.gnome.test.gschema.xml in dist tarballs (Martin Pitt) - - [gi] Add GSettings tests (Martin Pitt) - - [gi] Provide GtkTextBuffer.insert_with_tags_by_name() (Martin Pitt) - - [gi] Support tag names in GtkTextBuffer.insert_with_tags() (Martin Pitt) - - Add MAINTAINERCLEANFILES (Ignacio Casal Quinteiro) - - Remove .gitignore files and use git.mk (Ignacio Casal Quinteiro) - - pygi-convert.sh: Convert Pango.TabAlign.* (Martin Pitt) - - pygi-convert.sh: Drop window -> get_window() conversion (Martin Pitt) - - pygi-convert.sh: Don't convert self.window assignments (Martin Pitt) - - Fix leaked python reference in python-defined subclasses (Steve Frécinaux) - - Add some tests for the number of python refs held at creation time (Steve Frécinaux) - - Factor out parameter marshalling from construction functions. (Steve Frécinaux) - - [gi] in python 3 an array of uint8 can be bytes but not string (John (J5) Palmieri) - - [gi] fix Gio.FileEnumerator to reflect the Python 3 iter protocol (John (J5) Palmieri) - - [gi] python 3 fixes (John (J5) Palmieri) - - [gi] fix try/except blocks using depricated raise format (John (J5) Palmieri) - - [gi] Add docstring to GLib.Variant constructor (Martin Pitt) - - [gi] update gdbus test cases for previous GVariant change (Martin Pitt) - - [gi] Accept only a single object in GLib.Variant constructor (Martin Pitt) - - Speed up _setup_native_vfuncs() (Laszlo Pandy) - - Speed up class creation: rewrite _setup_vfuncs() to be much more efficient. (Laszlo Pandy) - - pygi-convert.sh: Convert gtk.UI_MANAGER_* (Sebastian Pölsterl) - - pygi-convert.sh: Convert gdk.GRAB_* (Sebastian Pölsterl) - - [gi] set the gtype GValue correctly (Ignacio Casal Quinteiro) - - [gi] use the right argument type for callback (Ignacio Casal Quinteiro) - - [gi] Add test cases for GDBus client operations (Martin Pitt) - - [gi] Add Variant construction/unpack support for boxed Variants (Martin Pitt) - - Merge branch 'windows-setup-fixes' (Dieter Verfaillie) - - pygi-convert.sh: GdkPixbuf methods (Thomas Hindoe Paaboel Andersen) - - pygi-convert.sh: Gdk.COLORSPACE_RGB (Thomas Hindoe Paaboel Andersen) - - [gi] Support nested objects and empty sequences in GLib.Variant building (Martin Pitt) - - Uncomment test_gi.TestInterfaceClash (Tomeu Vizoso) - - Fix reference leaks for GInitiallyUnowned objects (Steve Frécinaux) - - Add tests for refcount of a GObject owned by a library (Steve Frécinaux) - - Add a test to check for regular object reference count (Steve Frécinaux) - - [gi] Update TreeView.enable_model_drag_{source,dest} to current GTK (Martin Pitt) - - Fix a typo in a private symbol name. (Steve Frécinaux) - - pygi-convert.sh: Convert glib.source_remove() (Martin Pitt) - - Fix typo in previous commit to actually convert glib.GError (Martin Pitt) - - pygi-convert.sh: Move some glib bits which are better handled by gobject (Martin Pitt) - - Modify override for Gtk.Adjustment to allow position or keyword arguments in __init__(). (Laszlo Pandy) - - [gi] Fix small typo in previous commit (Martin Pitt) - - [gi] Add pythonic iterator and indexing for string GVariants (Martin Pitt) - - Construct structs using default API constructor (Tomeu Vizoso) - - pygi-convert.sh: Migrate Gdk.Cursor constructor, and some cursor names (Martin Pitt) - - pygi-convert.sh: Handle .window attributes (Martin Pitt) - - Also deal with foreign boxed structs (Tomeu Vizoso) - - [gi] Convert GErrors to GObject.GError exceptions, and throw them upon returning from calling the C function. (Laszlo Pandy) - - pygi-convert.sh: Don't convert glib -> GLib for now (Martin Pitt) - - Link libregress.so to GIO_LIBS again (Tomeu Vizoso) - - Fix attributes 2BUTTON_PRESS and 3BUTTON_PRESS of Gdk.EventType. (Laszlo Pandy) - - [gi] Fixed typo in exception (Sebastian Pölsterl) - - [gi] Enable handling of Gdk.EventType.2BUTTON_PRESS and 3BUTTON_PRESS (Sebastian Pölsterl) - - Revert "Fix Pango FontDescription override" (Martin Pitt) - - Python iterator interface support for GFileEnumerator. (Tony Young) - - Remove gio static bindings (Tomeu Vizoso) - - [gi] set length when marshalling guint8 erases (Ignacio Casal Quinteiro) - - Convert Gdk.Pixbuf to GdkPixbuf.Pixbuf (Sebastian Pölsterl) - - Disable calls to PyGILState_* when threads are disabled (Arnaud Charlet) - - pygi-convert.sh: Do not comment out set_cell_data_func() calls; these should be ported properly (Martin Pitt) - - pygi-convert.sh: Fix match for adding missing imports (Martin Pitt) - - pygi-convert.sh: Fix Gtk.Label handling to be idempotent (Martin Pitt) - - Remove trailing whitespace from gi/overrides/Gtk.py (Laszlo Pandy) - - Fix Pango FontDescription override (Martin Pitt) - - tests: Respect existing $GI_TYPELIB_PATH (Martin Pitt) - - Merge branch 'value' (Sebastian Pölsterl) - - GTK overrides: Do type conversion to column types of ListStore and TreeStore in set_value (Sebastian Pölsterl) - - Always register a new GType when a GObject class is subclassed (Steve Frécinaux) - - Raise required versions of GLib and GObject-Introspection (Simon van der Linden) - - pygi-convert.sh: Handle keysyms (Martin Pitt) - - GLib overrides: Add test case for array variant building (Martin Pitt) - - Remove cairo.RectangleInt from the foreign module (Tomeu Vizoso) - - Dont try to guess the transfer if its a boxed (Tomeu Vizoso) - - The tags can be Empty not None. (Ignacio Casal Quinteiro) - - Add Pythonic iterators and indexing to GVariant (Martin Pitt) - - Add GLib.Variant.unpack() (Martin Pitt) - - Add override for gtk_text_buffer_insert_with_tags (Ignacio Casal Quinteiro) - - Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES (Simon van der Linden) - - Kill JD_CHECK_PYTHON_HEADERS (Simon van der Linden) - - Revert "Override Gtk.Box.pack_start and pack_end to set default values to be compliant with pygtk" (Sebastian Pölsterl) - - Revert "Override Gtk.CellLayout.pack_start and pack_end to add default values to be compliant with pygtk" (Sebastian Pölsterl) - - Revert "Override Gtk.TreeViewColumn.pack_start, pack_end and set_cell_data_func to add default values to be compliant with pygtk" (Sebastian Pölsterl) - - pygi-convert.sh: Handle gtk.combo_box_new_text() (Martin Pitt) - - Override TreeSortable.set_sort_func and set_default_sort_func to add default values to be pygtk compliant (Sebastian Pölsterl) - - Override Gtk.TreeViewColumn.pack_start, pack_end and set_cell_data_func to add default values to be compliant with pygtk (Sebastian Pölsterl) - - Override Gtk.CellLayout.pack_start and pack_end to add default values to be compliant with pygtk (Sebastian Pölsterl) - - Override Gtk.Paned pack1 and pack2 to add default values to be compliant with pygtk (Sebastian Pölsterl) - - Override Gtk.Box.pack_start and pack_end to set default values to be compliant with pygtk (Sebastian Pölsterl) - - Handle GObject subclasses in the property helper. (Steve Frécinaux) - - Fix handling of unicode for GtkTreeModels (Martin Pitt) - - In IntrospectionModule and DynamicModule classes, make all instance attributes start with an underscore. (Laszlo Pandy) - - Amend previous enum wrapping commit to remove redundant setting of __info__ attribute. (Laszlo Pandy) - - pygi-convert.sh: Handle GdkPixbuf.InterpType (Martin Pitt) - - Fix wrapping of enums: Create new Python type for each non-gtype enum. (Laszlo Pandy) - - Use g_vfunc_info_invoke for chaining up in vfuncs (Tomeu Vizoso) - - Move pyglib_{main_context, option_context, option_group}_new into _PyGLib_API (Simon van der Linden) - - pygi-convert.sh: Handle Gdk.DragAction (Martin Pitt) - - pygi-convert.sh: Generalize Gtk.Settings migration (Martin Pitt) - - pygi-convert.sh: Don't change the name of "glib" submodules (Martin Pitt) - - Plug another memory leak (Paolo Borelli) - - Plug a small memory leak. (Paolo Borelli) - - Override Table.attach() to behave like pygtk (Paolo Borelli) - - pygi-convert.sh: Convert Pango.WrapMode (Martin Pitt) - - pygi-convert.sh: Don't change the name of "gtk" submodules (Martin Pitt) - - Fix the __dir__() methods on DynamicModule and IntrospectionModule (Laszlo Pandy) - - pygi-convert.sh: handle ReliefStyle (Paolo Borelli) - - setup.py: fix the provides keyword argument (Dieter Verfaillie) - - setup.py: use the same spaces-less format for all setup() parameters (Dieter Verfaillie) - - Add a __repr__() method to DynamicModule. (Laszlo Pandy) - - Go back to using getattr() in DynamicModule.__getattr__ (Tomeu Vizoso) - - Change __dir__() to report all the attributes that __getattr__ supports (Laszlo Pandy) - - Bump the minimum gio dependency (Emilio Pozuelo Monfort) - - Add test for incorrect attributes in Gdk.Event (Tomeu Vizoso) - - Don't call getattr again in gi.overrides.Gdk.Event.__getattr__ (Simon van der Linden) - - Release allocated array of arguments when handling closures (Mike Gorse) - - Release GIValueInfo when checking an enum argument (Mike Gorse) - - Respect different type lengths when assigning out-argument pointers. (Eitan Isaacson) - - Fix stupid name clash (Tomeu Vizoso) - - Add /usr/share to XDG_DATA_DIRS when running the tests (Tomeu Vizoso) - - Comment out tests that require SRV lookups (Tomeu Vizoso) - - Use suppresion file when running valgrind (Tomeu Vizoso) - - Fix warnings. (Ignacio Casal Quinteiro) - - Allow comparing Gtk.TreePath to None (Jesse van den Kieboom) - - handle unicode objects in properties (John (J5) Palmieri) - - dsextras.py: check if gcc is there when platform is win32 and compiler is mingw32 (Dieter Verfaillie) - - dsextras.py: be consistent in how distutils imports are done (Dieter Verfaillie) - - dsextras.py: add have_gcc() function (Dieter Verfaillie) - - dsextras.py: use distutils.spawn.find_executable for have_pkgconfig() (Dieter Verfaillie) - - setup.py: fix another case of use True/False instead of 1/0 (Dieter Verfaillie) - - pygi-convert.sh: improve GtkSourceView conversion (Paolo Borelli) - - pygi-convert.sh: Gtk.DialogFlags conversion (Paolo Borelli) - - Doc Extractor: Print the gtk-doc blocks sorted by function name. (José Alburquerque) - - pygi-convert.sh: add more Gtk conversions and sort (Paolo Borelli) - - pygi-convert.sh: convert Atk (Paolo Borelli) - - pygi-convert.sh: convert a few more Gio types (Paolo Borelli) - - pygi-convert.sh: more GLib conversion (Paolo Borelli) - - pygi-convert.sh: remove two cases handled by overrides (Paolo Borelli) - - Override Gtk.ScrolledWindow constructor (Paolo Borelli) - - pygi-convert.sh: Fix 'find' syntax (Paolo Borelli) - - pygi-convert.sh: start handling Gio and GLib (Paolo Borelli) - - pygi-convert.sh: convert Gdk.ScrollDirection. (Paolo Borelli) - - Override Pango.Layout constructor. (Paolo Borelli) - - Remove Pango.FontDescription() conversion. (Paolo Borelli) - - Override GtkAction and GtkRadioAction constructors. (Paolo Borelli) - - Override Adjustment constructor to behave like pygtk (Dmitrijs Ledkovs) - - add secondary_text apis to MessageDialog (John (J5) Palmieri) - - [gi] get rid of some debug prints and fix error messages (John (J5) Palmieri) - - Fix demo for override changes. (Paolo Borelli) - - Override Pango.FontDescription. (Paolo Borelli) - - Stop checking that all vfuncs are implemented (Tomeu Vizoso) - - Fix usage of TreeIter api that is now an override. (Paolo Borelli) - - Fix Gtk.Label(label="Foo") (Paolo Borelli) - - Fix typo when raising an exception (Paolo Borelli) - - pygi-convert.sh: Added more conversions (Sebastian Pölsterl) - - Override LinkButton constructor to make 'uri' mandatory (Paolo Borelli) - - Container should be iterable. (Dmitry Morozov) - - No need to import Gdk (Paolo Borelli) - - Remove semicolumns (Paolo Borelli) - - [gi] make sure Gtk.Button override passes all keywords to parent constructor (John (J5) Palmieri) - - Fix cut&paste error in the Label override (Paolo Borelli) - - pygi-convert.sh: handle TextWindowType (Paolo Borelli) - - Override Label constructor to behave like pygtk (Paolo Borelli) - - Override GtkTable constructor to behave like pygtk (Paolo Borelli) - - pygi-convert.sh: convert MovementStep (Paolo Borelli) - - Update Gdk overrides to work with latest Gtk+ 3 (Paolo Borelli) - - Gtk: add an override for Gtk.main_quit (Johan Dahlin) - - [gi] handle subtypes when inserting into tree models (John (J5) Palmieri) - - Override TreeSelection.select_path and TreeView.scroll_to_cell (Paolo Borelli) - - Override TreePath.__new__ (Paolo Borelli) - - Override Container to behave like a sequence (Paolo Borelli) - - refactor Jonathan Matthew recurse vfunc patch so it applys and clean up a bit (John (J5) Palmieri) - - Recurse up through base classes when setting up vfuncs (Jonathan Matthew) - - add a profiling torture test for when we fix up invoke (John (J5) Palmieri) - - moved dynamic and base modules outside of gtk-2.0 directory (John (J5) Palmieri) - - add test for inout argument count (John (J5) Palmieri) - - [gi] add check for UNICHAR (John (J5) Palmieri) - - Support gunichar (Paolo Borelli) - - pygi-convert.sh: gtk.accel_map -> Gtk.AccelMap._ (Paolo Borelli) - - pygi-convert.sh: handle "from gtk import gdk" (Paolo Borelli) - - pygi-convert.sh: add some Pango special cases (Paolo Borelli) - - Override TextIter (begins|ends|toggles)_tag() (Paolo Borelli) - - Override TextBuffer.set_text() to make length optional (Paolo Borelli) - - Override TextBuffer.create_mark() (Paolo Borelli) - - Fix TextBuffer.get_selection_bounds() override (Paolo Borelli) - - [gi] fix ActionGroup constructor to allow other keyword properties to be set (John (J5) Palmieri) - - [gi] require the name parameter when creatin a Gtk.ActionGroup (John (J5) Palmieri) - - Override UIManager.insert_action_group (Paolo Borelli) - - Override TreeModel.get() to return a tuple (Paolo Borelli) - - Make TreeSelection.get_selected_rows compatible with PyGtk (Paolo Borelli) - - [gi] switch to using sequences/tuples when marshalling cairo_rectangle_int_t (John (J5) Palmieri) - - [gi] overrides for treeview Drag and Drop (John (J5) Palmieri) - - [gi] when encountering guint8 arrays treat them as byte arrays (John (J5) Palmieri) - - pygi-convert.sh: Add pynotify -> Notify (Martin Pitt) - - pygi-convert.sh: Remove sugar specifics, and allow command line file list (Martin Pitt) - - pygi-convert.sh: Cover Message and Buttons types (Martin Pitt) - - [gi] fix actiongroup test since actions are hashed (John (J5) Palmieri) - - [gi] when converting to UTF-8 accept Python Unicode objects as input (Python 2) (John (J5) Palmieri) - - Correct a bug in the freeing of memory in pygi-invoke.c. (Damien Caliste) - - update news for release (John (J5) Palmieri) - - Implement richcompare for GIBaseInfo (Jonathan Matthew) - - [gi] add the rectangle_int_t forign cairo type (John (J5) Palmieri) - - add a foreign type for cairo_rectangle_int_t and allow it to be caller-allocated (John (J5) Palmieri) - - [gi] add overrides to Gtk.Editable (John (J5) Palmieri) - - [gi] handle virtual invokers (John (J5) Palmieri) - - add overrides for the insert* apis of list_store and tree_store (John (J5) Palmieri) - - fix dialogs overrides which were relying on broken inheritance behavior (John (J5) Palmieri) - - Add a overrides registry so we can refrence overrides inside the module (John (J5) Palmieri) - - Merge remote branch 'dieterv/setup-fixes-for-merge' (John Stowers) - - setup.py: ease maintenance burden for tests installation (Dieter Verfaillie) - - fix inheritence issues in overrides (John (J5) Palmieri) - - tests: add runtests-windows.py script (Dieter Verfaillie) - - pygobject_postinstall.py: remove pygobject-2.0.pc treatment from postinstall as pkg-config on windows figures out the correct prefix at runtime (Dieter Verfaillie) - - pygobject_postinstall.py: remove shortcut creation (Dieter Verfaillie) - - setup.py: formatting cleanup, makes things readable (Dieter Verfaillie) - - setup.py: build and install tests (Dieter Verfaillie) - - setup.py: install documentation when available on build system (Dieter Verfaillie) - - setup.py: install pygobject-codegen script (Dieter Verfaillie) - - setup.py: install fixxref.py script (Dieter Verfaillie) - - setup.py: rearrange constants (Dieter Verfaillie) - - setup.py: check python version and pkgconig availability before anything else (Dieter Verfaillie) - - setup.py: simplify sys.platform != 'win32' detection and error reporting (Dieter Verfaillie) - - setup.py: rearrange imports (Dieter Verfaillie) - - README.win32: update build instructions (Dieter Verfaillie) - - dsextras.py: formatting cleanup, makes things readable (Dieter Verfaillie) - - dsextras.py: add ggc4 to MSVC compatible struct packing comment (Dieter Verfaillie) - - dsextras.py: use the pkgc_ functions instead of repeating pgk-config incantations all over the place (Dieter Verfaillie) - - dsextras.py: add pkgc_get_version and pkgc_get_defs_dir functions (Dieter Verfaillie) - - dsextras.py: PEP8: Comparisons to singletons like None should always be done with 'is' or 'is not', never the equality operators. (Dieter Verfaillie) - - dsextras.py: use True/False instead of 1/0 (Dieter Verfaillie) - - dsextras.py: rearrange imports (Dieter Verfaillie) - - Add distutils generated build/dist directories and eclipse configuration files to .gitignore (Dieter Verfaillie) - - [gi] add tests for calling dir on a dynamic module (John (J5) Palmieri) - - [gi] dir() now works for modules (Deepankar Sharma) - - Don't check the inner type when comparing gpointers (Simón Pena) - - Release GIL when calling into C functions (John (J5) Palmieri) - - _gi.Repository : Implement missing info bindings. (José Aliste) - - include Python.h so that PY_VERSION_HEX gets defined (John (J5) Palmieri) - - [gi] make overrides work for python 3.x protocols and alias for python 2.x (John (J5) Palmieri) - - Override Gtk.Widget.translate_coordinates to not return success value (Sebastian Pölsterl) - - Override Gtk.TreeViewColumn.cell_get_position to not return success value (Sebastian Pölsterl) - - Override get_path_at_pos and get_dest_row_at_pos of Gtk.TreeView to not return success value (Sebastian Pölsterl) - - Override Gtk.TreeSortable.get_sort_column_id to not return success value (Sebastian Pölsterl) - - Override forward_search and backward_search of Gtk.TextIter to not return success value (Sebastian Pölsterl) - - Override Gtk.TextBuffer.get_selection_bounds to not return success value (Sebastian Pölsterl) - - Override Gtk.RecentInfo.get_application_info to not return success value (Sebastian Pölsterl) - - Override Gtk.IMContext.get_surrounding to not return success value (Sebastian Pölsterl) - - Override get_item_at_pos, get_visible_range, get_dest_item_at_pos of Gtk.IconView to not return success value (Sebastian Pölsterl) - - Override Gtk.Container.get_focus_chain to not return success value (Sebastian Pölsterl) - - Override Gtk.ComboBox.get_active_iter to not return success value (Sebastian Pölsterl) - - [gi] make parameter check less strict when dealing with GValue params (John (J5) Palmieri) - - Shortcut removal is not needed on post-uninstall (John Stowers) - - Disable shortcut creation in windows installer (John Stowers) - - overrides for all subclasses of dialog (John (J5) Palmieri) - - Make TreeModel behave like in GTK-2.x (Sebastian Pölsterl) - - Correctly build GIO on windows (John Stowers) - - Require Python >= 2.6.0 for Windows build (John Stowers) - - Fix depreciation warning in dsextras.py (John Stowers) - - Fix build on windows (John Stowers) - - Support for GCC4 in Windows distutils build - bug 626548 (Michael Culbertson) - - Remove obsolete comments in dsextras.py (John Stowers) - - Broken dsextras.py pkg-config check error message (John Stowers) - - add compat functions for the deprecated PyCObject api (John (J5) Palmieri) - - Add __path__ attributes. (Damien Caliste) - - Override Gtk.TreeSelection.get_selected to not return success value. (Sebastian Pölsterl) - - Make row optional in Gtk.TreeStore/ListStore.append override (Vincent Untz) - - Revert "add compat functions for the deprecated PyCObject api" (John (J5) Palmieri) - - return NULL instead of -1 which fixes crash when introspection is turned off (John (J5) Palmieri) - - add compat functions for the deprecated PyCObject api (John (J5) Palmieri) - - fix commit 7fe83108 which didn't use the compat functions for string handling (John (J5) Palmieri) - - Python 3 fixes for dsextras and the python.m4 distribution files (John (J5) Palmieri) - -2.27.0 10-Nov-2010 - - Implement richcompare for GIBaseInfo (Jonathan Matthew) - - [gi] add the rectangle_int_t forign cairo type (John (J5) Palmieri) - - add a foreign type for cairo_rectangle_int_t and allow it to be caller-allocated (John (J5) Palmieri) - - [gi] add overrides to Gtk.Editable (John (J5) Palmieri) - - [gi] handle virtual invokers (John (J5) Palmieri) - - add overrides for the insert* apis of list_store and tree_store (John (J5) Palmieri) - - fix dialogs overrides which were relying on broken inheritance behavior (John (J5) Palmieri) - - Add a overrides registry so we can refrence overrides inside the module (John (J5) Palmieri) - - Merge remote branch 'dieterv/setup-fixes-for-merge' (John Stowers) - - setup.py: ease maintenance burden for tests installation (Dieter Verfaillie) - - fix inheritence issues in overrides (John (J5) Palmieri) - - tests: add runtests-windows.py script (Dieter Verfaillie) - - pygobject_postinstall.py: remove pygobject-2.0.pc treatment from postinstall as pkg-config on windows figures out the correct prefix at runtime (Dieter Verfaillie) - - pygobject_postinstall.py: remove shortcut creation (Dieter Verfaillie) - - setup.py: formatting cleanup, makes things readable (Dieter Verfaillie) - - setup.py: build and install tests (Dieter Verfaillie) - - setup.py: install documentation when available on build system (Dieter Verfaillie) - - setup.py: install pygobject-codegen script (Dieter Verfaillie) - - setup.py: install fixxref.py script (Dieter Verfaillie) - - setup.py: rearrange constants (Dieter Verfaillie) - - setup.py: check python version and pkgconig availability before anything else (Dieter Verfaillie) - - setup.py: simplify sys.platform != 'win32' detection and error reporting (Dieter Verfaillie) - - setup.py: rearrange imports (Dieter Verfaillie) - - README.win32: update build instructions (Dieter Verfaillie) - - dsextras.py: formatting cleanup, makes things readable (Dieter Verfaillie) - - dsextras.py: add ggc4 to MSVC compatible struct packing comment (Dieter Verfaillie) - - dsextras.py: use the pkgc_ functions instead of repeating pgk-config incantations all over the place (Dieter Verfaillie) - - dsextras.py: add pkgc_get_version and pkgc_get_defs_dir functions (Dieter Verfaillie) - - dsextras.py: PEP8: Comparisons to singletons like None should always be done with 'is' or 'is not', never the equality operators. (Dieter Verfaillie) - - dsextras.py: use True/False instead of 1/0 (Dieter Verfaillie) - - dsextras.py: rearrange imports (Dieter Verfaillie) - - Add distutils generated build/dist directories and eclipse configuration files to .gitignore (Dieter Verfaillie) - - [gi] add tests for calling dir on a dynamic module (John (J5) Palmieri) - - [gi] dir() now works for modules (Deepankar Sharma) - - Don't check the inner type when comparing gpointers (Simón Pena) - - Release GIL when calling into C functions (John (J5) Palmieri) - - _gi.Repository : Implement missing info bindings. (José Aliste) - - include Python.h so that PY_VERSION_HEX gets defined (John (J5) Palmieri) - - [gi] make overrides work for python 3.x protocols and alias for python 2.x (John (J5) Palmieri) - - Override Gtk.Widget.translate_coordinates to not return success value (Sebastian Pölsterl) - - Override Gtk.TreeViewColumn.cell_get_position to not return success value (Sebastian Pölsterl) - - Override get_path_at_pos and get_dest_row_at_pos of Gtk.TreeView to not return success value (Sebastian Pölsterl) - - Override Gtk.TreeSortable.get_sort_column_id to not return success value (Sebastian Pölsterl) - - Override forward_search and backward_search of Gtk.TextIter to not return success value (Sebastian Pölsterl) - - Override Gtk.TextBuffer.get_selection_bounds to not return success value (Sebastian Pölsterl) - - Override Gtk.RecentInfo.get_application_info to not return success value (Sebastian Pölsterl) - - Override Gtk.IMContext.get_surrounding to not return success value (Sebastian Pölsterl) - - Override get_item_at_pos, get_visible_range, get_dest_item_at_pos of Gtk.IconView to not return success value (Sebastian Pölsterl) - - Override Gtk.Container.get_focus_chain to not return success value (Sebastian Pölsterl) - - Override Gtk.ComboBox.get_active_iter to not return success value (Sebastian Pölsterl) - - [gi] make parameter check less strict when dealing with GValue params (John (J5) Palmieri) - - Shortcut removal is not needed on post-uninstall (John Stowers) - - Disable shortcut creation in windows installer (John Stowers) - - overrides for all subclasses of dialog (John (J5) Palmieri) - - Make TreeModel behave like in GTK-2.x (Sebastian Pölsterl) - - Correctly build GIO on windows (John Stowers) - - Require Python >= 2.6.0 for Windows build (John Stowers) - - Fix depreciation warning in dsextras.py (John Stowers) - - Fix build on windows (John Stowers) - - Support for GCC4 in Windows distutils build - bug 626548 (Michael Culbertson) - - Remove obsolete comments in dsextras.py (John Stowers) - - Broken dsextras.py pkg-config check error message (John Stowers) - - add compat functions for the deprecated PyCObject api (John (J5) Palmieri) - - Add __path__ attributes. (Damien Caliste) - - Override Gtk.TreeSelection.get_selected to not return success value. (Sebastian Pölsterl) - - Make row optional in Gtk.TreeStore/ListStore.append override (Vincent Untz) - - Revert "add compat functions for the deprecated PyCObject api" (John (J5) Palmieri) - - return NULL instead of -1 which fixes crash when introspection is turned off (John (J5) Palmieri) - - add compat functions for the deprecated PyCObject api (John (J5) Palmieri) - - fix commit 7fe83108 which didn't use the compat functions for string handling (John (J5) Palmieri) - - Python 3 fixes for dsextras and the python.m4 distribution files (John (J5) Palmieri) - -2.26.0 24-Sep-2010 - - Wrap g_get_system_{config,data}_dirs () (John Strowers) - - fixed make check and make dist (John (J5) Palmieri) - - Disable GI tests when introspection disabled (John Stowers) - - Wrap g_uri_list_extract_uris. Fixes bug #584431 (Tomeu Vizoso) - - Fix a few uses of TRUE and FALSE in the docs (Paul Bolle) - - pygi: always free the invocation_state struct (Damien Caliste) - - Start implementing something equivalent to g_variant_new (Tomeu Vizoso) - - fixed typo - missing comma in glib.option module (John (J5) Palmieri) - - add checks so we can compile under python 3 by setting PYTHON=python3 (John (J5) Palmieri) - - Rename static methods as functions (Tomeu Vizoso) - - fix a couple of compiler warnings (John (J5) Palmieri) - - remove unused code (John (J5) Palmieri) - - Check the type of the instance object (John (J5) Palmieri) - - include the correct pycairo version (John (J5) Palmieri) - - Use PyMapping_Keys to determine if an object is a dict (py3k fix) (John (J5) Palmieri) - - fix handling of UINT64 and INT64 arguments in py3k (John (J5) Palmieri) - - properly handle ulongs properties in py3k (John (J5) Palmieri) - - Specify encoding of tests/test_gi.py (Tomeu Vizoso) - - use actual unicode in the tests on py3k, not the byte representation (John (J5) Palmieri) - - s/METH_KEYWORDS/METH_VARARGS|METH_KEYWORDS/ when defining object methods (John (J5) Palmieri) - - fix subclassing PyLong by calling __new__ correctly (John (J5) Palmieri) - - minor py3k fixups for python modules (John (J5) Palmieri) - - minor fixes in tests for py3k compat (John (J5) Palmieri) - - compilation: Fix syntax error (Colin Walters) - - Add missing file (Tomeu Vizoso) - - Add override for GLib.Variant.new_tuple (Tomeu Vizoso) - - fix for changes in the gi test libraries (John (J5) Palmieri) - - Gtk.DialogFlags.NO_SEPARATOR has been removed in Gtk 3.0 (John (J5) Palmieri) - - no need to offset arg positions when is_method is true (John (J5) Palmieri) - - gi: Add support for more property types (Tomeu Vizoso) - - use PyObject_SetAttrString, not PyDict_SetItemString when setting __gtype__ (John (J5) Palmieri) - - Rename GArgument to GIArgument (Tomeu Vizoso) - - fix up tests so they run in py3k (John (J5) Palmieri) - - tests: Port to new introspection tests (Colin Walters) - - we need to specify tp_hash since we overide tp_richcompare (John (J5) Palmieri) - - working enum/flags/pid subclasses of long (John Ehresman) - - make vfuncs work in py3k (John (J5) Palmieri) - - make cairo module compile in py3k (John (J5) Palmieri) - - fix exceptions so they work in python 3.x (John (J5) Palmieri) - - make the gi module compile under 3.x (John (J5) Palmieri) - - fix up testshelper module so it compiles in python 3.x (John (J5) Palmieri) - - convert to using PYGLIB_DEFINE_TYPE for module objects (John (J5) Palmieri) - - some more p3k PyString and PyInt eradication in GI (John (J5) Palmieri) - - pyglib: Fix typo (Leo Singer) (Tomeu Vizoso) - - Add defines for size_t and ssize_t conversion functions (Gustavo Noronha Silva) - - pyglib: Fix a compiler warning (Colin Walters) - - Don't force gtk 2.0 (Tomeu Vizoso) - - Fix some ref leaks in hook_up_vfunc_implementation() (Steve Frécinaux) - - handle strings correctly in gio (John (J5) Palmieri) - - make giomodule compile under py3k (John (J5) Palmieri) - - for py3k we need to do some more processing to get bytes from a unicode string (John (J5) Palmieri) - - use Bytes instead of Unicode when reading io (John (J5) Palmieri) - - prefix compat macros with PYGLIB (John (J5) Palmieri) - - Gtk.Button unit tests (John (J5) Palmieri) - - [Gtk] Add overrides for Button (Johan Dahlin) - - Make Cairo an optional dependency (Simon van der Linden) - - Don't import again PyGObject (John Ralls) (Tomeu Vizoso) - - move to using richcompare slot instead of compare (John (J5) Palmieri) - - Replace autogen.sh by a newer version (Simon van der Linden) - - Fix some warnings (Simon van der Linden) - - Fix caller-allocates emergency free. (Simon van der Linden) - - Remove useless checks. (Simon van der Linden) - - Call valgrind with G_SLICE=always-malloc G_DEBUG=gc-friendly (Tomeu Vizoso) - - Fix some warnings. (Ignacio Casal Quinteiro) - - Add myself as a maintainer (Simon van der Linden) - - Properly allocate boxed structs that are (caller-allocates) (Tomeu Vizoso) - - override gdk.Event to return attribute from the proper event object (Toms Baugis) - - check if z# needs an int or Py_ssize_t (John (J5) Palmieri) - - make sure we parse parameters to python object vars not glib vars (John (J5) Palmieri) - - Make an example and a demo work out of the box (Paul Bolle) - - make sure caller allocated structs are freed when they go out of scope (John (J5) Palmieri) - - Revert "override gdk.Event to return attribute from the proper event object." (Tomeu Vizoso) - - PyGI: properly quit cairo-demo (Paul Bolle) - - override gdk.Event to return attribute from the proper event object. (Toms Baugis) - - Clean and improve the test infrastructure (Simon van der Linden) - - Add some more transformations to pygi-convert.sh (Tomeu Vizoso) - - Adapt to API changes: g_irepository_enumerate_versions (Tomeu Vizoso) - - Add GValue<->GArgument marshalling for some more types (Tomeu Vizoso) - - Chain up with the non-introspection implementation for properties if needed (Tomeu Vizoso) - - Improve error reporting for missing attributes in introspection modules (Tomeu Vizoso) - - Implement getting and setting properties using introspection information. (Tomeu Vizoso) - - Readd Gdk.Rectangle override for Gtk-2.0 (Tomeu Vizoso) - - Allow specifying a version when loading a typelib (Tomeu Vizoso) - - treat GFreeFunc as equivalent to GDestroyNotify when scanning callbacks (Jonathan Matthew) - - Don't use == to compare doubles, use <= and =>. (Simon van der Linden) - - Allow passing ints as enum args (Tomeu Vizoso) - - Make error message less ambiguous (Tomeu Vizoso) - - fix passing in type names as a GType and add gtype unit tests (John (J5) Palmieri) - - Increase a bit verbosity of tests so people know which test failed (Tomeu Vizoso) - - Actually add the files for GVariant foreign structs (Tomeu Vizoso) - - Add foreign struct support for GVariant (Tomeu Vizoso) - -2.21.5 12-Jul-2010 - - Shut up some compiler warnings (Florian Müllner) - - Adjust to API break in GObject-Introspection (Florian Müllner) - - pass in the demo app so demos can use utility methods like requesting file paths (John (J5) Palmieri) - - demo fixes to keep up with Gtk+ (John (J5) Palmieri) - - override test fixes for new GTK+ annotations (John (J5) Palmieri) - - Fix warning. (Ignacio Casal Quinteiro) - - fix up treeiter usage due to caller-allocates annotations in gtk+ (John (J5) Palmieri) - - add entry completion demo (John (J5) Palmieri) - - string changes (John (J5) Palmieri) - - add the Entry demo directory and the entry_buffer demo (John (J5) Palmieri) - - fix loading of demo modules to support sub modules (John (J5) Palmieri) - - add the ability to have demos in sub catagories (John (J5) Palmieri) - - Add __name__ to DynamicModule class. (Jose Aliste) - - Do not override GdkRectangle. (Ignacio Casal Quinteiro) - - Add override for TreeModel implementing __len__() (Philip Withnall) - -2.21.4 29-Jun-2010 - - Build the cairo shim as a python module so the _gi module stops linking to it (Tomeu Vizoso) - - add drawing area demo (John (J5) Palmieri) - - sort the demo list (John (J5) Palmieri) - - rename iter to treeiter so we aren't using a python reserved word (John (J5) Palmieri) - - Fixup for change in buffer API (John (J5) Palmieri) - - add ListStore, TreeStore and TreeViewColumn APIs (John (J5) Palmieri) - - Add unit test for add_actions user data. (Ignacio Casal Quinteiro) - - Pass user_data param when adding actions (Paolo Borelli) - - add an exception type to the try/except block (John (J5) Palmieri) - - return PyList instead of PyTuple for array, return empty list for NULL arrays (John (J5) Palmieri) - - Fix 'make distcheck' (Tomeu Vizoso) - - Allow building pygobject without introspection support by providing --disable-introspection to configure. (Tomeu Vizoso) - - Make sure that sys.argv is a list and not a sequence. (Tomeu Vizoso) - - Force loading the GObject typelib so we have available the wrappers for base classes such as GInitiallyUnowned. (Tomeu Vizoso) - - we shouldn't g_array_free NULL pointers (John (J5) Palmieri) - - remove unneeded TextIter creation in the tests (John (J5) Palmieri) - - add override for TextBuffer (John (J5) Palmieri) - - fix up some build issues (John (J5) Palmieri) - - make the overrides file git friendly by appending to __all__ after each override (John (J5) Palmieri) - - Override Dialog constructor and add_buttons method (Paolo Borelli) - - Merge PyGI (Johan Dahlin) - -2.21.3 21-Jun-2010 - - Proper handling of null-ok in virtual methods (Ludovic L'Hours) - - Fall back to use the floating references API in glib if there isn't a sinkfunc defined. (Tomeu Vizoso) - - Revert "Drop sinkfuncs." (Tomeu Vizoso) - - [giounix] Make it possible to compile on glib 2.20 (Johan Dahlin) - - Release the lock when potentially invoking Python code. (Sjoerd Simons) - -2.21.2 10-Jun-2010 - - Drop sinkfuncs. (Tomeu Vizoso) - - Clear error if we failed the import (Colin Walters) - - Added missing , to keyword list of gio.GFile.set_attribute (John Ehresman) - - Fix arg conversion in gio.GFile.set_attribute (John Ehresman) - - Set constants under python 2.5 or before (John Ehresman) - - Doc Extractor: Use replacements that make sense for &...; expressions. (José Alburquerque) - - Add build docs for windows (John Stowers) - - Setup.py cosmetic tidy (John Stowers) - - Fix crash when importing gio (John Stowers) - - Bug 589671 - Dont use generate-constants (John Stowers) - - Bug 589671 - Fix setup.py for windows build (John Stowers) - - Include pygsource.h (John Stowers) - - codegen/docextract_to_xml.py: One more &...; replacement ( ). (José Alburquerque) - - codegen/docextract_to_xml.py: Replace some &..; that cause errors. (José Alburquerque) - - codegen/docextract_to_xml.py: Handle C++ multi-line comments. (José Alburquerque) - - codegen/docextract.py: Stop final section processing on first match. (José Alburquerque) - - Update doc extraction tool to handle GObjectIntrospection annotations. (José Alburquerque) - - Docs: replace gio.IO_ERROR_* with gio.ERROR_* (Paul Bolle) - - Bug 613341 - pygobject tests seem to require pygtk causing a circular (Gian Mario) - - Don't raise an error in _pygi_import if pygi support is disabled (Simon van der Linden) - - Initialize PyGPollFD_Type.fd_obj to NULL (Tomeu Vizoso) - - Bug 605937 - pygobject: Makefile.am sets $TMPDIR, disrupting distcc (Gian Mario) - - Wrap gio.Cancellable.make_pollfd() and add a test (Gian Mario) - - Make cancellable an optional parameter in many methods (Gian Mario) - -2.21.1 02-Jan-2010 - - Wrap gio.Volume.eject_with_operation (Gian Mario) - - Wrap gio.Mount.eject_with_operation (Gian Mario) - - Wrap gio.Mount.unmount_mountable_with_operation (Gian Mario) - - Wrap File.unmount_mountable_with_operation (Gian Mario) - - Wrap gio.File.stop_mountable (Gian Mario) - - Wrap gio.File.start_mountable (Gian Mario) - - Wrap gio.File.replace_readwrite_async (Gian Mario) - - Wrap gio.File.poll_mountable (Gian Mario) - - Wrap gio.File.open_readwrite_async (Gian Mario) - - Wrap gio.File.eject_mountable_with_operation (Gian Mario) - - Wrap gio.File.create_readwrite_async (Gian Mario) - - Wrap gio.Drive.stop (Gian Mario) - - Wrap gio.Drive.start (Gian Mario) - - Wrap gio.SocketListener.accept_socket_async|finish (Gian Mario) - - Wrap gio.SocketListener.accept_finish (Gian Mario) - - Wrap gio.SocketListener.accept_async (Gian Mario) - - Wrap gio.SocketListener.accept_socket (Gian Mario) - - Wrap gio.SocketListener.accept (Gian Mario) - - Make cancellable optional in gio.SocketClient.connect_to_host - (Gian Mario) - - Wrap gio.SocketListener.add_address (Gian Mario) - - Wrap gio.SocketClient.connect_to_service_async (Gian Mario) - - Wrap gio.SocketClient.connect_to_host_async (Gian Mario) - - Wrap gio.SocketClient.connect_async (Gian Mario) - - Wrap gio.SocketAddressEnumerator.next_async (Gian Mario) - - Add a missing object gio.InetSocketAddress new in GIO 2.22 - (Gian Mario) - - Make cancellable optional for gio.SocketAddressEnumerator.next - (Gian Mario) - - Wrap gio.Socket.condition_wait (Gian Mario) - - Wrap gio.Socket.condition_check (Gian Mario) - - Wrap gio.Resolver.lookup_service_finish (Gian Mario) - - Wrap gio.Resolver.lookup_service_async (Gian Mario) - - Wrap gio.Resolver.lookup_service (Gian Mario) - - Wrap gio.Resolver.lookup_by_address_async (Gian Mario) - - Wrap gio.Resolver.lookup_by_name_finish (Gian Mario) - - Wrap gio.Drive.eject_with_data (Gian Mario) - - Deprecate old gio.Drive methods (Gian Mario) - - Wrap gio.Resolver.lookup_by_name (Gian Mario) - - Make cancellable optional in gio.Resolver.lookup_by_address - (Gian Mario) - - Strip g_ prefix for many other functions (Gian Mario) - - Strip g_ prefix from InetAddress functions (Gian Mario) - - Fix function name gio.resolver_get_default (Gian Mario) - - Wrap gio.FileIOStream.query_info_async (Gian Mario) - - Register enums and flags in PyGI if needed (Tomeu Vizoso, #603534) - - Wrap gio.IOStream.close_async (Gian Mario) - - Make cancellable optional in GFile.create_readwrite (Gian Mario) - - Remove a duplicate entry in gio.defs (Gian Mario) - - Wrap gio.FileInfo.set_modification_time (Gian Mario) - - Wrap gio.EmblemedIcon.get_emblems (Gian Mario) - - Update Enums and Flags with new API (Gian Mario) - - Fix handling of uchar in pyg_value_from_pyobject (Bastian Winkler) - -2.21.0 18-dec-2009 - - pygmainloop: fix use of PySignal_WakeUpFD API for nested loops - (Philippe Normad, #481569) - - Add capabilities to import wrappers from pygi (Simon van der Linden) - - Move threads_init() function from 'gobject' to 'glib' (Paul) - - Fix wrong minimum checking in float properties (Paul, #587637) - - Wrap new API added in GIO 2.22 (Gian Mario) - - Fix bad name when rebuilding the unix source module (Gian Mario) - - Add the missing limit constants from glibconfig.h - (Tomeu Vizoso, #603244) - - Suppress warnings about format conversion - (Simon van der Linden, #603355) - - Properly define Connectable as interface type and not object type - (Gian Mario) - - Wrap new API added in GIO-UNIX 2.22 (Gian Mario) - - Wrap g_find_program_in_path (Gian Mario, #598435) - - Add pygi-external.h into Makefile SOURCES (Gian Mario) - -2.20.0 23-sep-2009 - - Allow to use automake 1.11 (Paolo Borelli) - - Specify programming language in .devhelp file (Frédéric Péters) - - Plug reference leak of GSource in pyg_main_loop_init (Paul) - - Updated uninstalled.pc file (Brian Cameron) - -2.19.0 10-aug-2009 - - Add macros to help with Python list to/from GList/GSList conversions. - (John Finlay) - - GIO docs practically completed (Gian) - - GFileInfo.list_attributes should accept None/NULL (Gian) - - Strip out Windows DLL API macros (John Finlay) - - Document that many functions got moved gobject -> glib (Paul) - - Allow h2def.py to work when there are tabs or multiple spaces after - the struct keyword. (Murray Cumming) - - Fix build when builddir is not the same as srcdir - (Theppitak Karoonboonyanan) - - Make gio.Emblem constructor new-style (Paul) - - Cleanup GIO overrides to use Python function/method names (Paul) - - Make codegen report errors using Python function/method names (Paul) - - Fix object type in gio.BufferedInputStream_fill_async (Gian) - - Wrap gio.BufferedInputStream.fill_async (Gian) - - Add gio.BufferedOutputStream which was forgotten in the types (Gian) - - Split overrides for gio.MemoryOutputStream (Gian) - - Wrap gio.memory_input_stream_new_from_data (Gian) - - Introduces the girepository module from the former PyBank - (Simon van der Linden) - - Add API appeared in 2.20 but not marked as such in gio docs (Gian) - - Wrap gio.FileOutputStream.query_info_async (Gian) - - Wrap gio.FileInputStream.query_async (Gian) - - Install executable codegen parts with executing permissions (Paul) - - Wrap gio.DataInputStream.read_line_async and read_until_async (Paul) - - Fix gio.OutputStream.splice_async (Paul) - - Add GIO 2.20 API and update docs (Gian) - -2.18.0 24-may-2009 - - Improve gio docs with some more classes (Gian) - - Wrap gio.OutputStream.splice_async() (Gian) - - Add Python ver into installed libpyglib name (Emilio Pozuelo Monfort) - - Wrap gio.OutputStream.flush_async() (Gian) - - Use 'Requires.private' for libffi in '.pc' files (Josselin Mouette) - - Add wrapper for gio.FileAttributeMatcher (Gian) - - Mark relevant glib.IOChannel methods as METH_NOARGS (Paul) - - Retire hand-written ChangeLog; autocreate from Git history (Paul) - - Wrap gio.InputStream.skip_async() (Gian) - - Add in codegen -n --namespace option and the code to remove dll - API in headers, added documentation (Siavash Safi) - - Properly mark glib.get_user_special_dir() as a keywords method (Paul) - -2.17.0 30-apr-2009 - - Write a good part of the docs for gio (Gian) - - Wrap g_mount_guess_content_type g_mount_guess_content_type_finish - g_mount_guess_content_type_sync (Gian, #580802) - - Swap first two arguments of gio.File.query_info_async (Paul, #580490) - - Fix a crash in pyg_type_add_interfaces (Paul, #566571) - - Remove an empty structure, use sizeof(PyObject) - instead (Paul, #560591) - - Wrap four g_get_user_*_dir() functions (Paul, #575999) - - Remove 'ltihooks.py' as using deprecated Python module (Paul) - - Code maintenance: add .gitignore files (Paul) - - CellRendererPixbuf stock-size property has wrong type (Paul, #568499) - - Add a doap file after git migration (Johan Dahlin) - - missing dep on libffi in pygobject-2.0.pc (Götz Waschk, #550231) - - g_volume_monitor_tp_new new function, return the singleton object. - (Paul, #555613) - - Remove a DeprecationWarning under python 2.6 (James Westby, #573753) - - several scripts from codegen directory are not distributed - (Krzesimir Nowak) - - g_file_copy_async change argument order to keep it consistent with the - other methods (Gian) - - memory leak in gio.File.copy_async (Paul Pogonyshev, #578870) - - g_file_monitor should accept None for cancellable and set the default - flag to G_FILE_MONITOR_NONE (Gian) - - pyg_notify_free needs to ensure it has GIL before calling Py_XDECREF - (Jonathan Matthew) - - Wrap g_file_set_display_name_async (Gian) - - Add a semi-private method to return the option context C object from - an option context wrapper (Tristan Hill) - - Converting a negative long Python value to a GUINT64 GValue doesn't - error out as it should (Gustavo J. A. M. Carneiro, #577999) - - Wrap g_file_set_attributes_async and - g_file_set_attributes_finish (Gian) - - g_file_query_filesystem_info_async fix a typo (Gian) - - Wrap g_file_query_filesystem_info_async (Gian) - - Add missing g_file_query_filesystem_info_async and - g_file_query_filesystem_info_finish (Gian) - - Wrap g_file_eject_mountable (Gian) - - g_file_copy callback cannot be optional (Gian) - - Swap various kwargs names to reflect the code (Gian) - - Update the address of the FSF (Tobias Mueller, #577134) - - Add g_volume_should_automount (Gian) - - Wrap g_drive_enumerate_identifiers and g_volume_enumerate_identifiers - (Gian) - - Add a couple of convinence functions to convert from/to a python list - and an array of strings (Gian) - - Allow setting pytype wrapper class (Mark Lee, John Ehresman, #559001) - - Wrap g_file_enumerator_close_async (Gian Mario Tagliaretti) - -2.16.1 22-feb-2009 - - Apply the patch provided by Cygwin Ports maintainer - (Paul Pogonyshev, #564018) - - Bad -I ordering can break build, patch from [dmacks netspace org] - (Gian Mario Tagliaretti, #566737) - - Fix keyword list to be in sync with positional arguments - (Paul, #566744) - - Add a comment explaining why the two for loops for registering - interfaces (Gustavo Carneiro) - - Huge cleanup of GIO overrides (Paul, #566706) - - gtk.Buildable interface method override is not recognized - (Paul, #566571) - - Do not escape the ampersand "&" in entity references. Replace some - unusual entity references in the output with their literal values. - (Daniel Elstner, #568485) - - gio.InputStream.read_async can cause memory corruption. - (Paul, #567792) - - Inconsistent use of tabs and spaces in pygtk.py (Paul, #569350) - - Huge fix of memory leaks in GIO (Paul, Paolo Borelli, Gian, #568427) - - non-async functions don't release python locks before calling - blocking C functions (Gian, Gustavo, #556250) - - Change comment to avoid false positives when grep'ing for deprecated - gtk functions (Andre Klapper) - - ltihooks.py updating license header from GPL to LGPL - (James Henstridge) - -2.16.0 04-jan-2009 - - gobject.timeout_add_seconds() not found in docs - (Paul Pogonyshev, #547119) - - _wrap_g_output_stream_write_async not adding a reference to the - buffer passed (Paul, #564102) - - gio.VolumeMonitor segfaults (Gian Mario Tagliaretti, #555613) - - Test if `domain' is not-null before using it to avoids segfaults - (Paul, #561826) - - g_output_stream_write_all use gsize instead of gssize (Gian) - - add __repr__ to gio.Drive, gio.Mount and gio.Volume - (Paul, #530935) - - Missing AC_CONFIG_MACRO_DIR([m4]) (Loïc Minier, #551227) - - Make codegen not import when corresponding argument types are not - registered (Paul, #551056) - - Fix typos breaking compilation (Frederic Peters #551212) - - GFile load_contents methods chop data at first \0 - (Jonathan Matthew, #551059) - -2.15.4 3-sep-2008 - - Fix typo in GPointer type registration (Loïc Minier,#550463) - - support G_TYPE_CLOSURE in codegen (Gian) - -2.15.3 31-aug-2008 - - Beginning of porting to 3.0. glib & gobject module ported. - - Wrap g_app_info_* functions (Gian) - - Wrap gio.FileAttributeInfo (Gian) - - Wrap g_vfs_get_supported_uri_schemes (Johan, #545846) - - Wrap g_file_info_get_modification_time (Johan, #545861) - - Wrap gio.Volume.mount/eject (Johan) - - Wrap gio.File.move (Johan) - - Wrap gio.query_writable_namespaces (Gian, #545920) - - Separate glib & gobject documentation - - Wrap GFile.append_to_async (Gian, #545959) - - Wrap GFile.create_async (Gian, #546020) - - Change return value from 'gboolean' to 'int' and changed semantics - to Pythonic (Paul, #544946) - - Wrap GFile.replace_async and query_info_async (Gian, #546046) - - GIcon and implementations improvements (Paul, #546135) - - Improve __repr__ and richcompare for gio classes (Paul) - - Missing Py_INCREFs for some file async methods (Jonathan Matthew, #546734) - - File.copy progress_callback does not work (Paul, #546591) - - add File.replace_contents, replace_contents_async, replace_contents_finish. - (Jonathan Matthew, #547067) - - Add GFile.query_default_handler (Gian) - - fix docstring line length (Jonathan Matthew, #547134) - - improve runtime type wrapper creation (Paul, #547104) - - make gio.File more Pythonic (Paul, #546120) - - No TypeError raised when type is None (Paul, #540376) - - wrap a few memory stream methods (Paul, #547354) - - wrap gio.DataInputStream.read_line and ...read_until (Paul, #547484) - - wrap four important asynchronous methods in gio.Drive and gio.Mount - (Paul, #547495) - - gio.InputStream.read() looks broken (Paul, #547494) - - wrap g_content_types_get_registered() (Paul, #547088) - - cannot create new threads when pygtk is used (Paul, #547633) - - an unitialized variable in PyGLib (Paul, #549351) - - Constructor of gtk.TreeView raises TypeError when model is None - (Paul, #549191) - - Fix memory problems reported by valgrind due to invalid tp_basicsize in - PyGPropsDescr_Type. (Gustavo, #549945) - -2.15.2 26-jul-2008 - - New module: glib, which contains the parts of the old - gobject bindings which are in the glib library. - MainLoop/MainContext/Sources/GOption and a few others has now moved. - - Add a new installed library libpyglib-2.0, which contains the extension - API for third-part modules instead of relying on macros which accesses - struct fields. - - Add bindings for gio.File.enumerate_children_async, - gio.FileEnumerator.next_files_async, gio.Mount.mount, - gio.File.mount_mountable, gio.File.mount_enclosing_volume, - gio.File.unmount_mountable, gio.File.copy. - - Add a new api for mapping a GError domain to an exception and register - an exception for GIOError. - - Remove leading IO_* prefix for the gio flags and register a quark - for the domain. - - Use GSlice in the glib module and bump required version to 2.14. - -2.15.1 15-jul-2008 - - Rename pygtk-codegen-2.0 to pygobject-codegen-2.0 to avoid - conflicting with PyGTK (Paul Pogonyshev) - -2.15.0 15-jul-2008 - - Add GIO bindings (Johan, Mario Tagliaretti, Thomas Leonard) - - Move codegen from PyGTK (Johan, Paul Pogonyshev, #542821) - - Add more variables to the .pc files (Damien Carbery, Paul, - Dan Winship, #486876) - - Add pyg_option_group_new to the public API (Johan) - - Add g_get_application_anme and g_get_progname (Sebastian Rittau) - - Avoid making wakeups when using Python 2.6 (Johan, Gustavo, - Adam Olsen, Josselin Mouette, Philippe Normand, Guido Van Rossum) - - Only link against libffi when found (Ed Catmur, #496006) - - Improve gobject.property (Tomeu Vizoso, #523352) - - Improve enum comparision and warnings (Paul, Phil Dumont, #428732) - - Many gobject.Source improvements (Bryan Silverthorn) - - Apply some fixes to make pylint happier (Johan, Simon Schampijer, - #523821) - - Fix error message in pyg_io_add_watch (Juha Sahkangas) - - Improve h2def.py (Oliver Crete, Murray Cumming, Lauro Moura) - -2.14.0 16-sep-2007 - - Fix a Python 2.6 deprecation warning (Johannes Hölzl, #342948) - - Wrap g_timeout_add_seconds, when compiling with glib 2.14 (Gustavo) - - Always fully initialize the PyGObject (Ed Catmur, #466082) - - Fix compilation in Solaris, again (#339924, Gustavo) - - Fix check for default value in boolean type (Marco Giusti, #470230) - - Fix new style properties with subclasses (Johan Dahlin, #470718) - - Docs generation fixes (John Finlay) - -2.13.2 07-jul-2007 - - Fix build on opensolaris (Damien Carbery, #339924) - - Proxy GOption exceptions from Python to C (Johannes Hölzl, #342948) - - Support G_TYPE_VALUE boxed args/signals - (Ed Catmur, Carlos Martin, #351072) - - pyg_error_exception_check bug fix (Sebastian Granjoux, #449879) - - Toggle references bug fix (#447271, Gustavo Carneiro) - - use python-config to get python includes (#448173, Sebastien Bacher) - - Support GObject properties in new properties API (Gustavo) - - generate-constants fixes (Muntyan) - - Allow running autogen.sh from outside $srcdir (Muntyan) - -2.13.1 02-may-2007 - - Generic CClosure marshaller using libffi (Johan, #353816) - - Uninstalled .pc file (Damien Carbery, #385129) - - Fix leak in GFlags handling (Daniel Berrange, #428726) - - Use dirname in autogen (Loïc Minier, #409234) - - Treat None in a GValueArray as pointer/NULL (Ed Catmur, #352209) - - Toggle reference bug fix in tp_setattro (Gustavo, #434659) - - Add a simplified helper for creating properties (Johan, Gustavo, #338089) - - Avoid throwing an exception in GValue converter (James Livingstone, - Ed Catmur, #374653) - - Build fix in .pc file (Luca Ferretti, #435132) - -2.13.0 23-april-2007 - - Release the GIL in g_object_set_property (Edward Hervey, #395048) - - Break PyGObject<->GObject reference cycle (Gustavo Carneiro, #320428) - - use static inline functions for init_pygobject (Gustavo, #419379) - - Wrap g_set_application_name, g_set_prgname - (Havoc Pennington, #415853) - - New pyg_gerror_exception_check API (Gustavo, #425242) - - New API to get/set multiple properties - (Gian Mario Tagliaretti, #403212) - - Misc. bug fixes. - -2.12.3 18-november-2006 - - distutils build fixes (Cedric) - - documentation updates (John) - - gobject.handler_block_by_func and friends now accept methods - (Johan, Dima, #375589) - - avoid truncating of gparamspec (Yevgen Muntyan, #353943) - - set __module__ on gobject derived types (Johan, - Osmo Salomaa, #376099) - - Ensure exceptions are raised on errors in gobject.OptionGroup - (Johan, Laszlo Pandy, #364576 - -2.12.2 3-october-2006 - - Make PyGObject 64-bit safe for Python 2.5 (Gustavo) - - All headers are now LGPL and not GPL (Johan) - - Remove a couple of GCC warnings (Gustavo) - - Revive distutils support (Cedric Gustin) - - Emission hook reference count bugfix (Gustavo) - - MSVC/ANSI C compilation fix (John Ehresman) - - Bump Ctrl-C timeout handler from 100ms to 1000 (Johan) - -2.12.1 4-september-2006 - - Corrected version check (Sebastian Dröge, #354364) - -2.12.0 4-september-2006 - - Install the html files even when using --disable-docs (#353159, Johan, - Matthias Clasen) - -2.11.4 27-august-2006 - - Include pre-generated html docs in the tarball (Johan) - - Fix bug in do_set_property called from constructor (Gustavo, #353039) - - Fix type registration involving interfaces with signals and/or - properties (Gustavo) - -2.11.3 21-august-2006 - - Documentation updates (John) - - Documentation build fixes (Johan, John, Gian Mario Tagliaretti) - - PyGObject can now be compiled using a C++ compiler (Murray Cumming) - - Type registration bug fix (Gustavo) - -2.11.2 8-august-2006 - - Add fixxref.py from PyGTK (Johan) - - Fix parallel build (#350225, Ed Catmur) - -2.11.1 4-august-2006 - - Add John Finlay's reference manual (Johan, John) - - Fix GOption mem leak (Gustavo) - - Infrastructure for lazy type registration (Johan) - - Enum/Flags fixes (Gustavo, John) - - Eliminate some GCC warnings (Johan) - -2.11.0 12-july-2006 - - Add GOption support (#163645, Johannes Hölzl) - - GObject metaclass converted to Python code (Gustavo) - - Register GType constants from Python-land (Johan) - - Distutils updates (John Ehresman, Cedric Gustin) - - Add support for signal emission hooks (#154845, Johan) - - g_spawn_close_pid support (Gustavo) - - Add new APIs do add or disable log redirections (Muntyan, #323786) - - "sub-sub-type" bug fixed (Gustavo) - - Coverity report code fixes (Johan) - - Support retrieving signal and property info from interfaces (Finlay) - - Support parameters of type G_TYPE_GSTRING in signals (Gustavo) - - Wrap a few g_filename_* APIs (Gustavo) - -2.10.1 11-april-2006 - - uint64 property bug fix (Andy Wingo) - - Hard code path to 2.0 (Gustavo) - - Allow only tuples and lists in strv to value (Gustavo) - - Include dsextras.py in the dist (Johan) - -2.10.0 13-march-2006 - - enum/leak fix (Michael Smith) - -2.9.0 16-january-2006 - - Signal accumulator support (Gustavo) - - GObject doc string generation improvements (Gustavo) - - Discover GInterfaces in runtime (Gustavo) - - Warn if return value in iowatch callback is not bool (Gustavo) - - Convert string arrays properly (Christopher Aillon) - -2.8.0 9-january-2006 - - Initial release, split of from PyGTK. - - Updates for Python 2.5's richcompare (Manish Yosh) - - PyFlags bug fixes (Gustavo) - - Fix leak in pygobject_new_with_interfaces (Johan) - - Undeprecate gobject.type_register (Johan) +3.46.0 - 2023-09-10 +------------------- + +* build: Drop Python 3.7 support :mr:`238` +* build: Require glib 2.64 and gobject-introspection 1.64 :mr:`243` +* Add support for Python 3.12 (minor test fixes) :mr:`247` +* Drop GTK 2 support (after being effectively unsupported for 12 years) :mr:`182` +* meson: Require meson 0.56.0 :mr:`220` +* meson: Set PYTHONPATH in devenv :mr:`235` +* meson: define pycairo_dep in case pycairo=disabled :mr:`242` +* meson: Use pycairo from target python before pkg-config :mr:`223` +* Complete the PEP-451 implementation in gi.importer :mr:`229` +* Replace usage of deprecated FFI closure API :mr:`241` +* Fix invalid marshalling in some cases for boxed values, for example with + Gtk.StyleContext.get_property() :mr:`213` +* Consistent setting of enum and flag property :mr:`192` +* Fix docstring for methods that return an array and have a length (out) argument :mr:`249` +* overrides: Fix incompatibility for CssProvider.load_from_data() (GTK 4.10) :mr:`231` +* overrides: Allow Gdk.{Color,RGBA} instances to be compared with other objects :mr:`233` +* overrides: Add overrides for Gdk.FileList in Gdk-4.0 :mr:`245` +* docs: Fix underline too short warning :mr:`246` +* docs: Fix build failure due to extlinks with Sphinx 6 :mr:`244` +* docs: List additional projects using PyGObject :mr:`230` +* docs: Update Development Environment Docs :mr:`232` +* docs: Update docs and code examples to GTK 4 :mr:`215` + + +3.44.1 - 2023-03-24 +------------------- + +* Fix tests with glib 2.76 :mr:`240` + + +3.44.0 - 2023-03-19 +------------------- + +No changes compared to 3.43.1 + + +3.43.1 - 2023-01-28 +------------------- + +* Note: PyGObject is in need of more maintainers, please read + https://www.bassi.io/articles/2022/12/02/on-pygobject/ +* Note: This is an unstable release. + +* Drop support for Python 3.6 :mr:`184` +* meson: bump minimum version to 0.53.0 and update subprojects :mr:`227` +* gimodule: fix floating state of python objects created with g_object_new :mr:`129` +* Gtk.Template: Accept PathLike objects as a filename :mr:`195` +* info: Show which type/object callables are bound to :mr:`194` +* IntrospectionModule: handle two threads loading type at same time :mr:`149` +* Port to Py_TRASHCAN_BEGIN :mr:`226` +* Other cleanups/improvements: :mr:`181` :mr:`173` +* This release also includes all changes from 3.42.1 and 3.42.2 + + +3.42.2 - 2022-07-16 +------------------- + +* Error out instead of crashing when marshaling unsupported fundamental types in some cases :mr:`180` +* Add a workaround for a PyPy 3.9+ bug when threads are used :mr:`200` +* Fix crashes when marshaling zero terminated arrays for certain item types :mr:`191` +* Fix a crash/refcounting error in case marshaling a hash table fails :mr:`191` +* Make the test suite pass again with PyPy :mr:`191` +* tests: support running tests with (MSVC) CPython 3.8+ on Windows :mr:`206` +* interface: Fix leak when overriding GInterfaceInfo :mr:`204` +* setup.py: look up pycairo headers without importing the module + (helps with building on Windows and MSVC CPython 3.8+) :mr:`205` + + +3.42.1 - 2022-04-17 +------------------- + +* Do not error out for unknown scopes :mr:`179` +* gtk overrides: restore Gtk.ListStore.insert_with_valuesv with newer gtk4 :issue:`467` +* gtk overrides: Do not override Treeview.enable_model_drag_xx for GTK4 :mr:`175` +* Implement DynamicImporter.find_spec() to silence a deprecation warning with Python 3.10 :issue:`473` +* Some test/CI fixes + + +3.42.0 - 2021-09-19 +------------------- + +* meson: Bump minimum meson_version to 0.47.0 +* Expose GObject.Object.run_dispose() :issue:`470` +* docs: document Gtk.Template. :issue:`396` +* dev: Add poetry support +* meson: use main branch for glib subproject +* Fix some small memory leaks :mr:`178` + + +3.40.1 - 2021-03-30 +------------------- + +* Fix tests with glib 2.68 :mr:`166` +* Fix a regression with marshalling partial() objects :mr:`165` :issue:`464` + + +3.40.0 - 2021-03-19 +------------------- + +* GTK 4 compatibility fixes :mr:`148` :mr:`159` :mr:`144` :mr:`145` +* Python 3.9 and 3.10 compatibility fixes :mr:`152` :mr:`156` +* New minimal dependency requirements due to dropping support for Ubuntu 16.04 :mr:`151` + * Python 3.6+ + * glib 2.56+ + * gobject-introspection 1.56+ + * pycairo 1.16+ + + +3.38.0 - 2020-09-12 +------------------- + +* Python 2 is no longer supported. + + Note for distros/packagers: + In case you want to keep Python 2 support you'll likely split any existing + package into a Python 2 and 3 version. Since these aren't parallel installable + here are some recommendations on how to make it work: + + * Build the devel package from the Python 3 source package + * Drop the headers/.pc files from the Python 2 build/package + * Make sure no Python 2 using package depends on the devel package + (@Arch: gnumeric can be build without Python support for example) + + See :issue:`392` for details + +* meson: Make the `pycairo` option a feature :mr:`146` :mr:`147` +* gdk overrides: Fix wrapping of scroll events :mr:`141` +* Add overrides for Gtk.Button set/get_focus_on_click :mr:`132` + + +3.36.1 - 2020-05-06 +------------------- + +* tests: Fix failing tests with pytest 5.4.0+ +* Gtk: Add override to make sure both TreeModelSort.new_with_model and + TreeModel.sort_new_with_model exist independend of the gtk version +* Gtk.Template: Fix initialisation order errors with Widgets getting created from C + (potentially through other templates) :issue:`257` :issue:`386` :issue:`341` :mr:`140` (:user:`Jean Felder `) +* Gtk.Template: Fix errors when calling init_template() multiple times :mr:`140` (:user:`Jean Felder `) + + +3.36.0 - 2020-03-08 +------------------- + +This will be the last release supporting Python 2. + +* pygobject-object: Avoid checking whether NULL is floating :mr:`135` (:user:`Alexandru Băluț `) +* Avoid various new glib deprecation warnings +* Port to g_object_new_with_properties() +* Drop Python 2 support on Windows +* gtk overrides: Drop Menu, MenuItem for Gtk 4 (:user:`Marinus Schraal `) +* Docs: + + * Update openSUSE instructions (:user:`sharkwouter`) + * Add Gaphor to Who is Using PyGObject (:user:`Dan Yeaw `) + * Remove reference to a fixed bug (:user:`Christian Stadelmann `) + + +3.34.0 - 2019-09-09 +------------------- + +* No changes since 3.33.1 + + +3.33.1 - 2019-08-18 +------------------- + +* Make GLib.Variant.unpack a bit less costly :mr:`121` (:user:`Mathieu Bridon `) +* pygobject: ignore GParameter deprecations :mr:`122` (:user:`Christian Hergert `) +* pygobject-object: fix refcount of floating return values :mr:`120` (:user:`Mathieu Duponchelle `) +* pygi-info: remove some dead code :issue:`303` + + +3.32.2 - 2019-06-23 +------------------- + +* Python 3.8b1 compatibility fixes +* tests: fix a test error when run under wayland +* setup.py: specify python_requires + + +3.30.5 - 2019-06-16 +------------------- + +* tests/gimarshallingtestsextra.c/h: relicense to LGPLv2.1+ :issue:`320` +* Fix a crash when marshalling a GError to Python fails :mr:`115` +* Fix leak of transfer-full/container C arrays :mr:`117` (:user:`Tomasz Miąsko `) +* Python 3.8b1 compatibility fixes + + +3.32.1 - 2019-04-20 +------------------- + +* tests/gimarshallingtestsextra.c/h: relicense to LGPLv2.1+ :issue:`320` +* meson: add ``tests`` option for disabling tests :mr:`113` (:user:`Adam Duskett `) +* meson: tests: pass ``--quiet`` to g-ir-scanner :mr:`114` (:user:`Tim-Philipp Müller `) +* Fix a crash when marshalling a GError to Python fails :mr:`115` +* Fix leak of transfer-full/container C arrays :mr:`117` (:user:`Tomasz Miąsko `) + + +3.32.0 - 2019-03-10 +------------------- + +* No changes since 3.31.4 + + +3.31.4 - 2019-03-07 +------------------- + +* docs: document GObject.Object.weak_ref() :issue:`245` +* cairo: Add cairo pattern foreign struct support :mr:`111` (:user:`Renato Florentino Garcia `) +* cairo: Add cairo_matrix_t converter to GValue :mr:`112` (:user:`Renato Florentino Garcia `) + + +3.31.3 - 2019-02-02 +------------------- + +* Speed up destruction of boxed types :mr:`106` and GObject.Value.set_value() calls. + This makes appending to a Gtk.TreeModel nearly twice as fast for example :issue:`46`, :issue:`218` +* Allow passing None for boolean parameters +* meson: Install .egg-info directory to arch'd dir. :mr:`109` (:user:`Elliott Sales de Andrade `) +* gtk overrides: raise in case Gtk.Window is instantiated after gtk_init failed :issue:`298` +* gio overrides: Warn when creating various dbus types without a constructor :issue:`15` +* tests: Fix tests with glib 2.59.x :issue:`287` +* tests: fix test_atoms failing in some environments :issue:`300` + + +3.31.2 - 2018-12-15 +------------------- + +* Changes included in 3.30.4 +* GLib.Variant.keys: correctly raise TypeError for non-dict types +* GLib.Variant: implement __bool__ for maybe types +* cairo: Fix GValue converters in case of NULL +* setup.py: Print an install command hint when pkg-config is missing +* pygi-info: wrap g_union_info_get_alignment() + :mr:`105` (:user:`Tomasz Miąsko `) + + +3.30.4 - 2018-11-30 +------------------- + +* gtk overrides: Fix rows getting inserted on the wrong level with + TreeStore.insert_before/insert_after if parent=None. + :issue:`281` (3.30 regression, thanks to :user:`Cian Wilson ` + for the report) + + +3.30.3 - 2018-11-27 +------------------- + +* GValue: fall back to the custom C marshaller to support fundamental types. + This makes GValue work with GstFraction. :issue:`280` +* GValue: Work around wrong annotations for GVariant +* Fix GObject attribute access during instance init which can lead to errors + with __getattr__ implementations of subclasses. This lead to criticals when + instantiating Gio.DBusProxy. :issue:`267` + + +3.31.1 - 2018-11-17 +------------------- + +* Changes included in 3.30.2 +* overrides: add Pango.Layout.set_text() override. :issue:`259` :mr:`89` +* docs: link updates :mr:`93` (:user:`tijder`) +* overrides: Use functools.wraps instead of custom version. + :issue:`271` :mr:`95` (:user:`Kai Willadsen `) +* tests: Make tests run with current gtk4 master +* Add (again) a pyproject.toml for specifying the pycairo build dep + (requires pip >=18.0) +* setup.py: Make it possible to build without cairo support through the + PYGOBJECT_WITHOUT_PYCAIRO env var. :issue:`250` + + +3.30.2 - 2018-11-11 +------------------- + +* tests: Fix some test with newer glib. +* overrides: Fix crash when using non-ascii text with. + Gtk.Builder.add_from_string/add_objects_from_string. :issue:`255` +* Various meson/distutils build fixes for MSVC. + :mr:`91` (:user:`Chun-wei Fan `) +* foreign-cairo: Fix cairo marshalling not using the foreign converters in + some cases. :issue:`260` +* build: setup.py reproducible build fixes. + :mr:`94` (:user:`Bernhard M. Wiedemann `) + + +3.30.1 - 2018-09-14 +------------------- + +* Fix various crashes on big endian systems. + :issue:`247` (:user:`Dan Horák `) +* meson: Don't link against libpython on non-Windows systems. + :issue:`253` :mr:`84` + + +3.30.0 - 2018-08-31 +------------------- + +* Various test suite fixes to get things to pass with Ubuntu 18.10. + + +3.29.3 - 2018-08-16 +------------------- + +* meson: Support building pycairo as a subproject. :mr:`76` +* meson: Declare_dependency for use by potential superprojects + (:user:`Mathieu Duponchelle `) +* meson: Update glib wrap file. :mr:`80` (:user:`Carlos Soriano `) +* meson: Fix the Python 2 build not not use the system pycairo extension when + running tests. :issue:`242` +* pygi-convert.sh: Various fixes and updates. :mr:`77` :mr:`78` + (:user:`Sander Sweers `) +* Gtk.Template: Fix instantiation error when using the new code with older + PyGObject. :mr:`79` (:user:`Kai Willadsen `) +* Gtk.Template: Don't error out when loading a resource that is only available + in an overlay. :issue:`230` +* Fix various crashes when running against a debug Python 3.7 build. :mr:`82` + (:user:`Simon McVittie `) +* overrides: Allow calling GObject.Binding.unbind() multiple times with + GLib 2.58+. :issue:`240` +* overrides: Gio.ListStore overrides use splice() when adding/removing many + items with GLib 2.58+. :issue:`115` :mr:`83` +* Work around pylint reporting bogus warnings regarding a missing self + argument for normal functions. :issue:`217` +* Add override for GdkPixbuf.Pixbuf.new_from_data() to wrap new_from_bytes() + to work around a use after free. :issue:`225` :mr:`74` + + +3.28.3 - 2018-05-31 +------------------- + +* Fix Gio.Application leak in case no signal handler is set before. + :issue:`219` +* Squash critical warning when using array as hash value + (:user:`Philip Withnall `) + + +3.29.2 - 2018-05-16 +------------------- + +* Add a meson build system. :issue:`165` + (:user:`Mathieu Duponchelle`) +* Gtk.Template: Allow marking children as "internal-child". :mr:`58` +* Gio.ListModel: implement most of the mutable sequence protocol. + :issue:`115` :mr:`59` +* Gio.Settings: implement __iter__. +* Gio.Settings: support range types in __setitem__. :issue:`134` +* Add overrides for Gio.ListStore.sort and Gio.ListStore.insert_sorted. + :issue:`130` +* Make Gtk.Widget.freeze_child_notify a context manager. :issue:`45` +* OptionParser.parse_args: return leftover arguments. :issue:`200` +* Release the GIL when emitting a signal. :mr:`66` + (John Bassett ) +* Add ActionMap and ActionMap.add_action_entries() to overrides. + :issue:`29` :mr:`65` (:user:`yangfl`) +* importer: raise ImportError in load_module() and not find_module(). + :issue:`213` +* Don't wrap GValue in GValue when creating GValueArray. :mr:`66` + (Stian Selnes ) +* ossig: Don't leak the callbacks in case the event loops are not stopped + through SIGINT. :issue:`219` :mr:`72` +* Various fixes (Havard Graff ) +* Destroy custom GLib.Source instances when they get freed. :issue:`193` +* Revert "Add PEP518/pyproject.toml file", fixes installation with pip 10, + see https://github.com/pypa/pip/issues/5244 +* Various fixes/improvements for PyPy. +* Don't crash on multiple calls to GObject.Value.__del__. :mr:`66` + +Documentation: + * Added StackOverflow (with PyGObject tag) as an contact resource. + (:user:`buhtz`) + * Add introduction to handling GLib.Error. :mr:`68` + (:user:`Kai Willadsen `) + * Add pycairo requires for development setup. :mr:`70` + (:user:`Kai Willadsen `) + + +3.29.1 - 2018-04-15 +------------------- + +* Support for `PyPy `__ and PyPy3. :issue:`180` +* cairo: support :class:`cairo.Matrix` conversion. :issue:`16` +* Speed up repeated closure creation by caching the closure cache in the + argument cache :issue:`103` (:user:`Garrett Regier `\, + :user:`Christoph Reiter `) +* setup.py: make setuptools/pkg_resources optional. :issue:`186` +* setup.py: print installation instructions in case a dependency is missing. + :issue:`194` +* Remove autotools build system. +* overrides: Make :meth:`Gtk.ListStore.insert_before`, + :meth:`Gtk.ListStore.insert_after`, :meth:`Gtk.TreeStore.insert_before` and + :meth:`Gtk.TreeStore.insert_after` atomic. +* Make :class:`GLib.Error` picklable. :issue:`145` +* Add basic support for template based widgets through ``Gtk.Template``. + :issue:`52` +* Various documentation improvements. :mr:`29` (:user:`Dan Yeaw `) +* Add PEP518/pyproject.toml file. :mr:`44` (:user:`James Tocknell `) +* Avoid truncating value returned from g_value_info_get_value. :mr:`51` + (:user:`Tomasz Miąsko `) +* Fix typo in BoundSignal disconnect. :mr:`55` + (:user:`Vladislav Glinsky `) + + +3.28.2 - 2018-03-27 +------------------- + +* setup.py: Don't install the test C extension when it's built. :issue:`181` +* setup.py: Always define PY_SSIZE_T_CLEAN. :issue:`185` +* Fix __str__ return type of Gtk.TreePath with depth == 0. :issue:`143` +* Fix a crash when setting a str property with a value containing surrogates. + :issue:`169` +* tests: Fix a potential crash during tests + + +3.28.1 - 2018-03-17 +------------------- + +* Fix a GValue leak (regression). :issue:`176` + (:user:`Mathieu Duponchelle`) +* setup.py: don't install the tests package +* Various fixes for 64bit Windows. :mr:`34` + (:user:`Mathieu Duponchelle`) +* Fix tests with glib 2.56.0 +* Various fixes for Python 3.7. :issue:`170` :mr:`28` + + +3.28.0 - 2018-03-12 +------------------- + +* GLib.Variant: Fix creation of guchar arrays from bytes (3.27.2 regression). + :issue:`174` :mr:`30` + + +3.27.5 - 2018-03-01 +------------------- + +* Re-revert transfer-none boxed copy changes (:mr:`23`). Now with more fixes + and tests. :mr:`24` (:user:`Mathieu Duponchelle `) +* Add caching for boxed type lookup and try to avoid the import lock. :mr:`13` + (:user:`Mikhail Fludkov `) + + +3.27.4 - 2018-02-14 +------------------- + +* tests: Fix tests under Wayland. :issue:`163` +* tests: Make it possible to use pytest directly. +* Reverted transfer-none boxed copy changes (:mr:`10`) due to regressions in + gnome-music. :issue:`164` :mr:`23` + + +3.27.3 - 2018-02-10 +------------------- + +* Fix a 3.27.2 regression where functions return invalid boxed values. :mr:`16` + (thanks to :user:`Mikhail Fludkov ` for providing a test) +* tests: Make tests run without Gtk/Gdk installed. :mr:`17` + (:user:`Mikhail Fludkov `) +* tests: Remove dependency on ``localedef``. :commit:`64b02e301` +* tests: Require/Use pytest. :mr:`20` :issue:`153` + + +3.27.2 - 2018-02-07 +------------------- + +* setup.py: Add a "quality" command which is equal to "make check.quality". +* setup.py: Add a "test" command which is equal to "make check". :mr:`5` +* setup.py: Install pkg-config and header files. +* setup.py: Improve pycairo header lookup with pycairo >=1.16. :issue:`150` +* autotools: "make check.quality" now requires flake8. +* overrides: Fix ``Gtk.Adjustment.__init__()`` overrides not setting "value" + sometimes. :issue:`151` :mr:`3` +* overrides: ``GLib.Variant``: add support to create maybe types. + :issue:`152` :mr:`4` (:user:`Alberto Ruiz `) +* Make it possible to resolve ambiguous vmethod names. Ambiguities can be + resolved by implementing methods named + "do_$namespaced_base_class_name_$vfunc_name". :mr:`9` :issue:`105` + (:user:`Mathieu Duponchelle `) +* Fix setting a property installed in Python from C in some cases. :mr:`8` + (:user:`Mathieu Duponchelle `) +* pygobject-object: fix memory corruption around list of closures. :mr:`12` + :issue:`158` (:user:`Mikhail Fludkov `) +* Don't copy the boxed if we are the sole owner of the wrapper after a closure. + :mr:`14` +* Only copy transfer-none boxed values in closures once the closure exists. + This allows modifying the passed boxed while allowing to keep the wrapper + around after the closure is done. :mr:`10` + (:user:`Mathieu Duponchelle `) + + +3.27.1 - 2017-12-11 +------------------- + +* Revert "setup.py: Also set setup_requires to require pycairo" (Christoph Reiter) +* setup.py: Also set setup_requires to require pycairo (Christoph Reiter) +* setup.py: Provide a os.path.samefile fallback for Python 2 under Windows (Christoph Reiter) +* Add sphinx based documentation (Christoph Reiter) (:bzbug:`791448`) +* PKG-INFO: Revert name back to PyGObject (Christoph Reiter) +* setup.py: Rework pycairo discovery to not use pkg-config (Christoph Reiter) +* setup.py: Fix the distcheck command on Windows (Christoph Reiter) +* setup.py: Remove various classifiers and the download-url which aren't accepted by pypi (Christoph Reiter) +* version bump (Christoph Reiter) + +3.27.0 - 2017-12-08 +------------------- + +* demo: pep8 fixes (Christoph Reiter) +* Fix ctypes.PyDLL construction under Windows (Christoph Reiter) (:bzbug:`622084`) +* configure.ac: Error out in case autoconf-archive isn't installed (Christoph Reiter) (:bzbug:`784428`) +* Move pygi-convert.sh into tools (Christoph Reiter) +* README: Convert to reST (Christoph Reiter) +* demo: Move demo into examples and dist it (Christoph Reiter) (:bzbug:`735918`) +* demo: Add new Gtk.FlowBox example (Gian Mario Tagliaretti) (:bzbug:`735918`) +* demo: Use HeaderBar for main app window (Simon Feltman) (:bzbug:`735918`) +* demo: PyFlakes and PEP8 fixes (Simon Feltman) (:bzbug:`735918`) +* demo: Rename gtk-demo.py to demo.py (Simon Feltman) (:bzbug:`735918`) +* demo: Rename demos/gtk-demo to simply demo (Simon Feltman) (:bzbug:`735918`) +* Remove AUTHORS file (Christoph Reiter) +* Remove pre-commit.hook (Christoph Reiter) +* setup.py: Port to distutils/setuptools (Christoph Reiter) (:bzbug:`789211`) +* Install a default SIGINT handler for functions which start an event loop (Christoph Reiter) (:bzbug:`622084`) +* Make Python OS signal handlers run when an event loop is idling (Christoph Reiter) (:bzbug:`622084`) +* Drop Python 3.3 support (Christoph Reiter) (:bzbug:`790787`) +* Drop set_value usage in Gtk.List/TreeStore.set override (Sander Sweers) (:bzbug:`790346`) +* pygobject-object: Fix Python GC collecting a ref cycle too early (Christoph Reiter) (:bzbug:`731501`) +* Fix potential uninitialized memory access during GC (Daniel Colascione) (:bzbug:`786872`) +* test: revert parts of the previous test as it's broken on 32 bit builds (Christoph Reiter) (:bzbug:`786948`) +* flags: Add testcase for bug 786948 (Christoph Reiter) (:bzbug:`786948`) +* fix potential overflow when marshalling flags from py interface (Philippe Renon) (:bzbug:`786948`) +* to_py_array: Properly handle enum array items (Christoph Reiter) (:bzbug:`788890`) +* pygobject.doap: Add myself as maintainer (Christoph Reiter) +* closure: Fix unaligned and out-of-bounds access (James Clarke) (:bzbug:`788894`) +* build: Fix not installing .egg-info file (Christoph Reiter) (:bzbug:`777719`) +* Drop pygobject-3.0-uninstalled.pc file (Christoph Reiter) +* tests: Windows fix (Christoph Reiter) +* tests: some more C locale fixes (Christoph Reiter) +* tests: Make the test suite pass with the C locale (Christoph Reiter) +* configure.ac: post-release version bump to 3.27.0 (Christoph Reiter) + +3.26.1 - 2017-10-27 +------------------- + +* pygobject-object: Fix Python GC collecting a ref cycle too early (Christoph Reiter) (:bzbug:`731501`) +* Fix potential uninitialized memory access during GC (Daniel Colascione) (:bzbug:`786872`) +* test: revert parts of the previous test as it's broken on 32 bit builds (Christoph Reiter) (:bzbug:`786948`) +* flags: Add testcase for bug 786948 (Christoph Reiter) (:bzbug:`786948`) +* fix potential overflow when marshalling flags from py interface (Philippe Renon) (:bzbug:`786948`) +* to_py_array: Properly handle enum array items (Christoph Reiter) (:bzbug:`788890`) +* closure: Fix unaligned and out-of-bounds access (James Clarke) (:bzbug:`788894`) +* build: Fix not installing .egg-info file (Christoph Reiter) (:bzbug:`777719`) +* configure.ac: version bump to 3.26.1 (Christoph Reiter) + +2.28.7 - 2017-10-13 +------------------- + +* Move property and signal creation into _class_init() (Martin Pitt) +* gio-types.defs: change some enums to flags (Ryan Lortie) +* Fix set_qdata warning on accessing NULL gobject property (Ivan Stankovic) +* Disable introspection support by default (Dieter Verfaillie) +* Don't install codegen for Python 3 (Arfrever Frehtes Taifersar Arahesis) +* Ship tests/te_ST@nouppera in release tarballs for tests to succeed (Martin Pitt) +* [gi] Port test_properties from static gio to GI Gio (Martin Pitt) +* [python3] fix build. PYcairo_IMPORT doesn't exists anymore (Ignacio Casal Quinteiro) +* [python3] Fix maketrans import (Martin Pitt) +* [gi-overrides] fix MessageBox so it correctly handles the type constructor param (John (J5) Palmieri) +* gdbus tests: Fix hang if test case fails (Martin Pitt) +* Fix crash in Gtk.TextIter overrides (Martin Pitt) +* correctly initialize the _gi_cairo_functions array to be zero filled (John (J5) Palmieri) +* [gtk-override] print warning if user imports Gtk 2.0 (John (J5) Palmieri) +* Add support for enums in gobject.property (Johan Dahlin) + +3.26.0 - 2017-09-12 +------------------- + +* configure.ac: pre-release version bump to 3.26.0 (Christoph Reiter) +* closure: silence a new compiler warning (Christoph Reiter) +* tests: skip some failing test under Windows with Python 3.6 (Christoph Reiter) +* tests: pyflakes/pep8 fixes (Christoph Reiter) +* tests: Fix cairo test with pycairo >= 1.13 (Christoph Reiter) +* Make sure version information passed to require_version is a string. (Benjamin Berg) (:bzbug:`781582`) +* configure.ac: post-release version bump to 3.25.2 (Christoph Reiter) + +3.25.1 - 2017-04-21 +------------------- + +* Bump pycairo requirement to 1.11.1 (Christoph Reiter) (:bzbug:`707196`) +* configure.ac: Always disable -Werror (Christoph Reiter) +* foreign-cairo: Enable cairo.Region support also on Python 2 if available (Christoph Reiter) +* configure.ac: remove unused PLATFORM variable (Christoph Reiter) +* configure.ac: Remove unused PySignal_SetWakeupFd check (Christoph Reiter) +* tests: remove python 2.5/3.2 compat code (Christoph Reiter) +* configure.ac: Require Python 3.3 (Christoph Reiter) +* tests: Make test suite run with GTK+ 4 (Christoph Reiter) +* tests: always call require_version; add TEST_GTK_VERSION env var (Christoph Reiter) +* tests: Fix make check.valgrind (Christoph Reiter) +* tests: Don't skip Regress tests when cairo is missing (Christoph Reiter) +* tests: fix invalid regex escaping (Christoph Reiter) +* tests: avoid mapping a GtkWindow (Christoph Reiter) (:bzbug:`780812`) +* tests: silence some glib deprecation warnings (Christoph Reiter) (:bzbug:`780812`) +* tests: avoid deprecation warnings for assertRegexpMatches/assertRaisesRegexp (Christoph Reiter) (:bzbug:`780812`) +* pygi-source: clear exceptions in finalize handler (Christoph Reiter) (:bzbug:`780812`) +* Fix pep8 errors (Christoph Reiter) +* Remove gi._gi._gobject and gi._gobject modules (Christoph Reiter) (:bzbug:`735206`) +* Remove gi._gi._glib module (Christoph Reiter) (:bzbug:`735206`) +* GValue: add overflow checking for py -> gint; forward marshaling exceptions (Christoph Reiter) (:bzbug:`769789`) +* pygobject_lookup_class: clear exceptions between calls and don't return with one set (Christoph Reiter) (:bzbug:`773394`) +* Avoid some new deprecation warnings (Christoph Reiter) (:bzbug:`780768`) +* Raise RuntimeError in case an uninitilialized GObject.Object is marshaled (Christoph Reiter) (:bzbug:`730908`) +* closure: support unichar args (Christoph Reiter) (:bzbug:`759276`) +* Add support for bytes and non-utf-8 file names. (Christoph Reiter) (:bzbug:`746564`) +* test_gi: use correct min/max constants for gsize/gssize (Christoph Reiter) (:bzbug:`780591`) +* Don't use long format string for formatting pointers (Christoph Reiter) (:bzbug:`780591`) +* Fix conversion from pointers to hashfunc return values. (Christoph Reiter) (:bzbug:`780591`) +* Fix PyLong <-> GPid conversion on 64bit Windows (Christoph Reiter) (:bzbug:`780591`) +* property: support setting flags (Christoph Reiter) (:bzbug:`726484`) +* overrides: warn on instantiation of Gio.VolumeMonitor (Christoph Reiter) (:bzbug:`744690`) +* Remove gi.overrides.overridefunc (Christoph Reiter) (:bzbug:`686835`) +* tests: Reduce usage of timeout_add() and sleep() (Christoph Reiter) (:bzbug:`698548`) +* tests: Remove TestMainLoop.test_concurrency (Christoph Reiter) (:bzbug:`698548`) +* Update .gitignore: add ``*.dll``, ``*.dylib``, ``.DS_STORE`` (Christoph Reiter) +* tests: Make test suite run on Windows (Christoph Reiter) (:bzbug:`780396`) +* tests: Make test suite run on macOS (Christoph Reiter) (:bzbug:`780396`) +* Fix various compiler warnings for 32bit builds (Christoph Reiter) (:bzbug:`780409`) +* pep8 fix (Christoph Reiter) +* testhelper: only link against libpython on Windows (Christoph Reiter) (:bzbug:`773803`) +* overrides: Fix Gtk.TextBuffer.insert_with_tags_by_name() with no tags (Garrett Regier) (:bzbug:`772896`) +* Make use of instance-argument annotations (Christoph Reiter) (:bzbug:`735076`) +* Remove pyglib_gil_state_ensure/pyglib_gil_state_release (Christoph Reiter) (:bzbug:`699440`) +* Remove support for building without threads (Christoph Reiter) (:bzbug:`699440`) +* pygtkcompat: Allow multiple calls to enable(), enable_gtk() as long as the version matches (Christoph Reiter) (:bzbug:`759009`) +* tests: Update Makefile for building tests on OS X (Simon Feltman) (:bzbug:`762176`) +* testhelper: propagate exception if _gobject could not be imported (Mikhail Fludkov) (:bzbug:`772949`) +* pygi-info: initialize GIArgument before passing it to g_constant_info_get_value (Christoph Reiter) (:bzbug:`772949`) +* tests: build libregress with disabled cairo (Mikhail Fludkov) (:bzbug:`772949`) +* tests: use g-ir utils found by pkg-config (Mikhail Fludkov) (:bzbug:`772949`) +* Add a foreign type for cairo_region_t. (Shyouzou Sugitani) (:bzbug:`667959`) +* aclocal: make local file discover by reading AC_CONFIG_MACRO_DIR work (Christoph Reiter) (:bzbug:`777713`) +* Port from gnome-common to autoconf-archive (Christoph Reiter) (:bzbug:`777713`) +* Fix various potential compiler warnings (Christoph Reiter) (:bzbug:`777713`) +* configure.ac: post-release version bump to 3.25.0 (Christoph Reiter) +* Remove egg make target (Christoph Reiter) (:bzbug:`777719`) +* Remove legacy docs (Christoph Reiter) (:bzbug:`777719`) + +3.24.1 - 2017-04-10 +------------------- + +* pygi-info: initialize GIArgument before passing it to g_constant_info_get_value (Christoph Reiter) (:bzbug:`772949`) +* configure.ac: post-release version bump to 3.24.1 (Christoph Reiter) + +3.24.0 - 2017-03-20 +------------------- + +* configure.ac: pre-release version bump to 3.24.0 (Christoph Reiter) + +3.23.92 - 2017-03-13 +-------------------- + +* overrides: Update for Gdk-4.0 and Gtk+-4.0 (Fabian Orccon) (:bzbug:`777680`) +* Disable -Werror=missing-prototypes (Christoph Reiter) (:bzbug:`777534`) +* Fix new PEP8 errors (Christoph Reiter) (:bzbug:`776009`) +* Move pep8/pyflakes tests from 'make check' to 'make check.quality' (Christoph Reiter) (:bzbug:`764087`) +* overrides: Update for Gtk-4.0 (Christoph Reiter) (:bzbug:`773315`) +* Handle exception unreffing Variant at exit (Dan Nicholson) (:bzbug:`776092`) +* Handle multiple deinit of callable cache (Dan Nicholson) (:bzbug:`776092`) +* configure.ac: post-release version bump to 3.23.0 (Christoph Reiter) + +3.22.0 - 2016-09-19 +------------------- + +* configure.ac: pre-release version bump to 3.22.0 (Christoph Reiter) + +3.21.92 - 2016-09-11 +-------------------- + +* Handle nullable filename parameters (Christoph Reiter) (:bzbug:`770821`) +* Fix list/hashtable enum <-> hash conversion on 64-bit big endian (Aurelien Jarno) (:bzbug:`770608`) +* Allow passing sockets to io_add_watch on win32 (Lukas K) (:bzbug:`766396`) +* tests: use dbus-run-session instead of dbus-launch to run tests (Michael Biebl) (:bzbug:`770798`) +* configure.ac: post-release version bump to 3.21.92 (Christoph Reiter) + +3.21.91 - 2016-08-25 +-------------------- + +* Allow installing with pip (Mathieu Bridon) (:bzbug:`767988`) +* Skip a test with older glib (Christoph Reiter) (:bzbug:`740301`) +* Fix a test with Python 3.1/3.2 (Arfrever Frehtes Taifersar Arahesis, Christoph Reiter) (:bzbug:`740324`) +* tests: Use places kwarg for assertAlmostEqual (Arfrever Frehtes Taifersar Arahesis, Christoph Reiter) (:bzbug:`740337`) +* Print exception if marshalling a signal argument fails (Christoph Reiter) (:bzbug:`748198`) +* overrides: allow treemodel sequence shorthands (Marinus Schraal) (:bzbug:`766580`) +* Remove pygobject-external.h (Christoph Reiter) (:bzbug:`767084`) +* Remove pygobject-private.h and rename pygobject.c to pygobject-object.c (Christoph Reiter) (:bzbug:`767084`) +* Merge pyglib-private.h into pyglib.h (Christoph Reiter) (:bzbug:`767084`) +* Remove pygi.h and pygi-private.h (Christoph Reiter) (:bzbug:`767084`) +* configure.ac: post-release version bump to 3.21.1 (Simon Feltman) + +3.21.0 - 2016-04-24 +------------------- + +* gi: Add require_versions() function (Dustin Falgout) (:bzbug:`761141`) +* test_gerror_novalue: Don't assign the error to a variable + (Iain Lane) (:bzbug:`764165`) +* build: Do not enable code coverage based on lcov + (Emmanuele Bassi) (:bzbug:`764075`) + +3.20.1 - 2016-04-24 +------------------- + +* test_gerror_novalue: Don't assign the error to a variable + (Iain Lane) (:bzbug:`764165`) + +3.20.0 - 2016-03-21 +------------------- + +3.19.92 - 2016-03-15 +-------------------- + +3.19.91 - 2016-03-01 +-------------------- + +* Fix marshaling of GError stored in GValue + (Simon Feltman) (Thibault Saunier) (:bzbug:`761592`) +* Fix marshaling or GError from Python to C from function calls + (Simon Feltman) (:bzbug:`685197`) +* Error handling/reporting fixes (Christoph Reiter) (:bzbug:`751956`) +* Fix crash due to GVariant implemented as PyGBoxed not PyGIStruct + (Christoph Reiter) (:bzbug:`751956`) +* Fix crash with GValueArray stored in GValue + (Mikhail Fludkov) (:bzbug:`754359`) + +3.19.90 - 2016-02-20 +-------------------- + +* tests: Set the active style context state before retrieving values + (Simon Feltman) +* tests: Fix crash with empty drag source icon names + (Simon Feltman) (:bzbug:`762392`) +* Try to import GdkX11 in Gdk overrides (Christoph Reiter) (:bzbug:`673396`) +* Fix import warnings pointing to the wrong code with CPython 3.3/3.5 + (Christoph Reiter) (:bzbug:`757184`) + +3.19.2 - 2015-10-31 +------------------- + +* tests: Fix failure due to new GTK+ warning regarding size_allocate() + (Simon Feltman) +* Fix build warnings regarding _POSIX_C_SOURCE redefinition + (Simon Feltman) +* Drop -std=c90 for now (Matthias Clasen) + +3.19.1 - 2015-10-30 +------------------- + +* Use a named tuple for returning multiple values (Christoph Reiter) (:bzbug:`727374`) +* enum/flags: use gir info for type names and __repr__ instead of the gtype name (Christoph Reiter) (:bzbug:`657915`) +* Improve and unify __repr__ format for PyGObject, PyGBoxed and PyGIStruct (Christoph Reiter) (:bzbug:`657915`) +* Don't leak internal RepositoryError on import. (Christoph Reiter) (:bzbug:`756033`) +* Import dependencies when importing typelibs from gi.repository (Christoph Reiter) (:bzbug:`656314`) +* Fix Gdk.rectangle_intersect/rectangle_union missing with GTK+ 3.18 (Christoph Reiter) (:bzbug:`756364`) +* Don't import inspect at module level (Christoph Reiter) +* invoke state: add a free memory cache for PyGIInvokeArgState (Christoph Reiter) (:bzbug:`750658`) +* invoke/closure: reduce g_slice_alloc usage (Christoph Reiter) (:bzbug:`750658`) +* pep8: ignore new errors reported by pep8 1.6 (Christoph Reiter) +* Bump g-i dependency to latest stable (Garrett Regier) +* Avoid calling g_slist_length() during invoke (Garrett Regier) +* Simplify closure_convert_arguments() (Garrett Regier) +* Remove a level of indentation in convert_ffi_arguments() (Garrett Regier) +* Prevent passing the user data multiple times to callbacks (Garrett Regier) (:bzbug:`750347`) +* Support throwing exceptions in closures (Garrett Regier) (:bzbug:`710671`) +* Don't emit require_version warning if namespace was loaded previously using g_irepository_require (Christoph Reiter) (:bzbug:`754491`) +* configure.ac: post release version bump to 3.19.1 (Garrett Regier) + +3.18.2 - 2015-10-24 +------------------- + +* configure.ac: post release version bump to 3.18.2 (Christoph Reiter) + +3.18.1 - 2015-10-23 +------------------- + +* Fix Gdk.rectangle_intersect/rectangle_union missing with GTK+ 3.18 (Christoph Reiter) (:bzbug:`756364`) +* pep8: ignore new errors reported by pep8 1.6 (Christoph Reiter) +* Don't emit require_version warning if namespace was loaded previously using g_irepository_require (Christoph Reiter) (:bzbug:`754491`) +* configure.ac: post release version bump to 3.18.1 (Garrett Regier) + +3.18.0 - 2015-09-22 +------------------- + +3.17.90 - 2015-08-19 +-------------------- + +* Allow passing unicode lists to GStrv properties on Python 2 + (Christoph Reiter) (:bzbug:`744745`) +* Avoid a silent long to int truncation (Rui Matos) (:bzbug:`749698`) +* Handle gtype marshalling (Mathieu Bridon) (:bzbug:`749696`) +* pygi-foreign-cairo.c: fix include for py3cairo.h + (Daniel Hahler) (:bzbug:`746742`) +* tests: Silence various error messages and warnings + (Christoph Reiter) (:bzbug:`751156`) +* Fix test regression when xdg-user-dirs is not installed + (Christoph Reiter) (:bzbug:`751299`) +* Explicitly check if an override exists instead of ImportError + (Garrett Regier) (:bzbug:`749532`) + +3.17.1 - 2015-06-15 +------------------- + +* Add gi.PyGIWarning used when import version is not specified + (Christoph Reiter) (:bzbug:`727379`) +* Remove Gdk.Rectangle alias with newer gobject-introspection and GTK+ + (Christoph Reiter) (:bzbug:`749625`) +* overrides: Provide _overrides_module attribute + (Christoph Reiter) (:bzbug:`736678`) +* overrides: Conditionalize touch override support in Gdk + (Simon Feltman) (:bzbug:`747717`) +* Field setters: Remove unneeded type/range checks and unused code + (Christoph Reiter) (:bzbug:`746985`) +* pygi-argument: Remove unused imports/includes + (Christoph Reiter) (:bzbug:`746985`) +* Improve test coverage for field setters/getters + (Christoph Reiter) (:bzbug:`746985`) + +3.16.2 - 2015-06-15 +------------------- + +* overrides: Provide _overrides_module attribute + (Christoph Reiter) (:bzbug:`736678`) + +3.16.1 - 2015-04-13 +------------------- + +* overrides: Conditionalize touch override support in Gdk + (Simon Feltman) (:bzbug:`747717`) + +3.16.0 - 2015-03-24 +------------------- + +3.15.91 - 2015-03-05 +-------------------- + +* tests: Don't use deprecated override attributes + (Christoph Reiter) (:bzbug:`743514`) +* Add GLib.MINFLOAT etc. and mark GObject.G_MINFLOAT etc. deprecated + (Christoph Reiter) (:bzbug:`743514`) +* Emit PyGIDeprecationWarning when accessing deprecated override attributes + (Christoph Reiter) (:bzbug:`743514`) +* Add namespace and container name to all warnings/error messages + (Christoph Reiter) (:bzbug:`743468`) +* tests: Add test for GIRepository.UnionInfo.get_size() + (Garrett Regier) (:bzbug:`745362`) +* Avoid duping filenames when marshalling from Python to C + (Garrett Regier) (:bzbug:`744719`) + +3.15.0 - 2015-02-20 +------------------- + +* Avoid copying bytearrays from Python to C when transfer nothing (Garrett Regier) (:bzbug:`743278`) +* Allows passing arguments to opaque Boxed types (Garrett Regier) (:bzbug:`743214`) +* Emit ImportWarning when gi.require_version() is not used (Christoph Reiter) (:bzbug:`727379`) +* Refactor overrides import/modules (Christoph Reiter) (:bzbug:`736678`) +* Replace statically bound GLib.Variant.new_tuple() with GI (Simon Feltman) (:bzbug:`735199`) +* overrides: Add Gdk.EventTouch union discrimination (Simon Feltman) (:bzbug:`736380`) +* PyGObjectFlags: Remove a trailing comma on the enum. (Murray Cumming) +* Remove redefinitions of function and vfunc cache typedefs (Simon Feltman) (:bzbug:`737874`) + +3.14.0 - 2014-09-22 +------------------- + +* configure.ac: pre release version bump to 3.14.0 (Simon Feltman) + +3.13.92 - 2014-09-15 +-------------------- + +* tests: Add test for Gio.Application.add_main_option() (Simon Feltman) +* tests: Split up various test cases (Simon Feltman) (:bzbug:`735193`) +* Fix invalid read error in argument cleanup code (Simon Feltman) +* Fix memory management problems with struct arguments to signals + (Simon Feltman) (:bzbug:`736175`) + +3.13.91 - 2014-09-01 +-------------------- + +* docs: Fix return types in auto-generated doc strings (Simon Feltman) +* Special case signal output arguments which are structs as + pass-by-reference (Simon Feltman) (:bzbug:`735486`) +* Ignore closure callbacks when Python is not initialized + (Simon Feltman) (:bzbug:`722562`) +* Change boxed init with args to warn instead of raise + (Christoph Reiter) (:bzbug:`727810`) +* Fix crash in GList/GSList marshaling error handling path. + (Christoph Reiter) (:bzbug:`735201`) +* Fix reference counting problems with GLib.Variant.new_tuple() + (Simon Feltman) (:bzbug:`735166`) +* Skip marshalling NULL output arguments in Python closures + (Simon Feltman) (:bzbug:`735090`) + +3.13.90 - 2014-08-18 +-------------------- + +* Support array lengths on struct fields (Simon Feltman) (:bzbug:`688792`) +* Fast path Python property get access (Simon Feltman) (:bzbug:`723872`) +* Unify accessing properties through props and get_property() + (Simon Feltman) (:bzbug:`726999`) +* Refactor boxed wrapper memory management strategy + (Simon Feltman) (:bzbug:`726999`) +* Replace GObject.signal_query with introspected version + (Simon Feltman) (:bzbug:`688792`) +* Fix memory leak with unboxed caller allocated structs (Simon Feltman) +* tests: Add failing tests for GObject sub-class doc-strings + (Piotr Iwaniuk) (:bzbug:`731452`) +* Don't mask GObject sub-class doc strings in meta-class + (Tobias Mueller) (:bzbug:`731452`) + +3.13.4 - 2014-08-14 +------------------- + +* Marshaling cache refactor and cache usage in vfuncs + (Garrett Regier) (:bzbug:`727004`) +* Fix array argument out and inout marshaling from vfuncs + (Garrett Regier) (:bzbug:`702508`) +* Cleanup input args when marshaling in closures + (Garrett Regier) (:bzbug:`727004`) +* Add deprecation warning for connect_object() with non-GObject argument + (Simon Feltman) (:bzbug:`688064`) +* Add Python implementation of Object.connect_data() + (Simon Feltman) (:bzbug:`701843`) +* Add GClosure marshaling cleanup (Simon Feltman) (:bzbug:`695128`) +* Fix GCallback Python wrapper leak (Simon Feltman) (:bzbug:`695130`) +* tests: Add failing test for marshaling an array of GValues through + signals (Martin Pitt) (:bzbug:`669496`) +* Add protection against attempts at importing static bindings + (Simon Feltman) (:bzbug:`709183`) +* Update and deprecate gi.overrides.keysyms (Simon Feltman) (:bzbug:`721295`) +* Generate .dll libraries on windows (Ignacio Casal Quinteiro) (:bzbug:`734288`) +* Windows build fixes (Alexey Pavlov) + (:bzbug:`734284`, :bzbug:`734289`, :bzbug:`734286`, :bzbug:`734287`) + +3.13.3 - 2014-06-23 +------------------- + +* demos: Cleanup CSS accordion demo to use a loop for adding buttons + (Simon Feltman) +* refactor: Move builder connection utilities outside of Builder class + (Simon Feltman) (:bzbug:`701843`) +* tests: Move TestSignals from test_everything into test_signal + (Simon Feltman) (:bzbug:`701843`) + +3.13.2 - 2014-05-26 +------------------- + +* Python 3.4 make check fixes (Simon Feltman) (:bzbug:`730411`) +* overrides: Add Gtk.Container.child_get/set overrides (Simon Feltman) + (:bzbug:`685076`) +* overrides: Make value argument to Widget.style_get_property optional + (Simon Feltman) (:bzbug:`685076`) +* overrides: Make value argument to Container.child_get_property optional + (Simon Feltman) (:bzbug:`685076`) +* Add GTypeClass methods as Python GObject class methods + (Johan Dahlin) (:bzbug:`685218`) +* Add marshalling coercion for Python classes and instances to GTypeClass + (Simon Feltman) (:bzbug:`685218`) +* Replace direct parent class call by super() (Andrew Grigorev) (:bzbug:`729970`) +* Add cairo marshaling support for non-introspected signals + (Simon Feltman) (:bzbug:`694604`) +* [New API] Add gi.require_foreign (Simon Feltman) (:bzbug:`707735`) +* Initialize the foreign API at PyGI load time (Simon Feltman) (:bzbug:`694604`) +* Move pygi foreign API into pygi-foreign-api.h (Simon Feltman) (:bzbug:`694604`) +* Unify GLib.GError and GLib.Error (Simon Feltman) (:bzbug:`712519`) +* PEP8 fixes (Simon Feltman) + +3.12.2 - 2014-05-26 +------------------- + +* PEP8 fixes (Simon Feltman) +* Python 3.4 make check fixes (Simon Feltman) (:bzbug:`730411`) + +3.13.1 - 2014-04-28 +------------------- + +* Raise TypeError if arguments are passed to Boxed.__init__ + (Christoph Reiter) (:bzbug:`727810`) +* Gdk.Event: Override __setattr__ to set fields based on the event type + (Christoph Reiter) (:bzbug:`727810`) +* Gdk.Event: Include GdkEventType in __repr__ (Christoph Reiter) (:bzbug:`727810`) +* Fix crash with type checking for GObject arguments (Simon Feltman) (:bzbug:`727604`) +* Do not leak info of destroy notify (Paolo Borelli) +* Ignore GValueArray deprecations (Simon Feltman) +* Raise ImportError when importing modules not found in repository + (Simon Feltman) (:bzbug:`726877`) +* tests: Rename test_overrides to test_import_machinery + (Simon Feltman) (:bzbug:`726877`) + +3.12.1 - 2014-04-14 +------------------- + +* Fix crash with type checking invalid GObject arguments + (Simon Feltman) (:bzbug:`727604`) +* Do not leak info of destroy notify (Paolo Borelli) + +3.12.0 - 2014-03-24 +------------------- + +3.11.92 - 2014-03-17 +-------------------- + +* configure.ac: Remove option to build without libffi (Simon Feltman) +* docs: Standardize Python doc strings (Simon Feltman) +* Fix reference leaks with (transfer full) foreign struct returns + (Owen W. Taylor) (:bzbug:`726206`) + +3.11.91 - 2014-03-03 +-------------------- + +* Use ffi_call directly instead of g_callable_info_invoke + (Simon Feltman) (:bzbug:`723642`) +* configure.ac: Use -std=c90 and error on declaration-after-statement + (Simon Feltman) +* Fix Build on Visual Studio (Chun-wei Fan) (:bzbug:`725122`) + +3.11.90 - 2014-02-17 +-------------------- + +* Use GObject type checking for instance arguments (Simon Feltman) (:bzbug:`724009`) +* configure.ac: post release version bump to 3.11.90 (Simon Feltman) + +3.11.5 - 2014-02-03 +------------------- + +* cache refactoring: Move all cache marshalers into files based on type + (Simon Feltman) (:bzbug:`709700`) +* tests: Add test for an owned boxed struct passed in a callback + (Mike Gorse) (:bzbug:`722899`) +* build: Add --without-common configure option for package maintainers + (Patrick Welche) (:bzbug:`721646`) +* demo: Add TreeModel interface implementation demonstration + (Simon Feltman) +* build: Set PLATFORM_VERSION again to 3.0 (Colin Walters) +* tests: Run PyFlakes and PEP8 only on SUBDIRS (Simon Feltman) +* Merge static PyGLib and PyGObject modules into PyGI + (Simon Feltman) (:bzbug:`712197`) +* Add test for callback user data arguments with following arguments + (Martin Pitt) (:bzbug:`722104`) + +3.11.4 - 2014-01-13 +------------------- + +* overrides: Fix __repr__ for various Gdk structs (Simon Feltman) +* Add enum and flags member methods (Simon Feltman) (:bzbug:`693099`) +* python.m4: g/c JD_PYTHON_CHECK_VERSION (Patrick Welche) (:bzbug:`721662`) +* Support union creation with PyGIStruct (Simon Feltman) +* docs: List constructors in object and struct doc strings + (Simon Feltman) (:bzbug:`708060`) +* docs: Fix array length argument skipping with preceding out arguments +* docs: Add return values and skip implicit out arguments in functions + (Simon Feltman) (:bzbug:`697356`) +* docs: Skip implicit array length args when building function doc + strings (Simon Feltman) (:bzbug:`697356`) +* gtk-demo: Add CSS demos (Gian Mario Tagliaretti) (:bzbug:`719722`) +* build: Avoid clash between gi/types.py and stdlib + (Colin Watson) (:bzbug:`721025`) + +3.11.3 - 2013-12-16 +------------------- + +* Replace usage of PyGIBoxed_Type with PyGIStruct_Type + (Simon Feltman) (:bzbug:`581525`) + +3.11.2 - 2013-11-17 +------------------- + +* gkt-demo: Change main info/source notebook into a GtkStack (Simon Feltman) +* Add deprecation warnings and cleanup class initializer overrides (Simon Feltman) (:bzbug:`705810`) +* Fix dir method for static GParamSpec in Python 3 (Simon Feltman) +* Remove overzealous argument checking for callback userdata (Simon Feltman) (:bzbug:`711173`) + +3.10.2 - 2013-11-11 +------------------- + +* Fix thread safety problems by always enabling the GIL + (Simon Feltman) (:bzbug:`709223`, :bzbug:`710447`) + +3.11.1 - 2013-10-28 +------------------- + +* Fix toggleref safety problems by always enabling the GIL + (Simon Feltman) (:bzbug:`709223`) +* Add consistent GLib.MainLoop SIGINT cleanup (Simon Feltman) (:bzbug:`710978`) +* docs: Add a keyword value of None for allow-none annotations + (Simon Feltman) (:bzbug:`640812`) +* Remove overrides for supporting pre-3.10 GObject signal functions + (Simon Feltman) +* Add threads_init back as a requirement for non-Python threaded repos + (Simon Feltman) (:bzbug:`710447`) +* Add dir method to GObject props accessor (Simon Feltman) (:bzbug:`705754`) +* Remove PyGObjectWeakRef now that g_binding_unbind exists + (Simon Feltman) (:bzbug:`699571`) +* Fix lots of memory leaks leaks (Simon Feltman) (:bzbug:`693402`, :bzbug:`709397`) +* Add support for variable user data arguments (Simon Feltman) (:bzbug:`640812`) +* Bump glib and g-i dependencies to latest stable. (Martin Pitt) +* Fix TypeError when setting drag target_list to None (Nuno Araujo) + (:bzbug:`709926`) +* Use qdata for wrapper retrieval in toggle reference notifications + (Simon Feltman) (:bzbug:`709223`) +* Expose all GI enum and flags types (Simon Feltman) (:bzbug:`709008`) +* Add support for default arguments annotated with allow-none + (Simon Feltman) (:bzbug:`640812`) +* Refactor argument cache handling (Simon Feltman) (:bzbug:`640812`) +* Remove support for allowing PyObjects as void pointers + (Simon Feltman) (:bzbug:`688081`) + +3.10.1 - 2013-10-14 +------------------- + +* Fix TypeError when setting drag target_list to None (Nuno Araujo) + (:bzbug:`709926`) +* Use qdata for wrapper retrieval in toggle reference notifications + (Simon Feltman) (:bzbug:`709223`) +* Fix memory leak for caller allocated GValue out arguments + (Simon Feltman) (:bzbug:`709397`) + +3.10.0 - 2013-09-23 +------------------- + +* Fix test_gi.TestProjectVersion.test_version_str() (Martin Pitt) + +3.9.92 - 2013-09-16 +------------------- + +* Fix union argument regression when marshaling from python + (Simon Feltman) (:bzbug:`703873`) +* Fix GLib.Source sub-classing with initializer args (Simon Feltman) + (:bzbug:`707904`) +* Copy __doc__ when wrapping function (Vratislav Podzimek) + +3.9.91 - 2013-09-02 +------------------- + +* Fix GObject signal methods to work with new annotations + (Simon Feltman) (:bzbug:`707280`) +* Fix build on C89 Compilers (Chun-wei Fan) (:bzbug:`707264`) +* Change boxed type checking in marshaling to use __gtype__ attribute + (Simon Feltman) (:bzbug:`707140`) +* Use G_IS_VALUE for checking return values in closure marshaling + (Simon Feltman) (:bzbug:`707170`) +* Fix PEP-8 errors in propertyhelper.py (Yanko Kaneti) (:bzbug:`706319`) + +3.9.90 - 2013-08-19 +------------------- + +* Create GLib.Pid in the same way on python 2 and 3 (Benjamin Berg) + (:bzbug:`705451`) +* Use PyLong_Type.tp_new for GLib.Pid (Benjamin Berg) (:bzbug:`705451`) +* Add accumulator and accu_data arguments to GObject.Signal decorator + (Simon Feltman) (:bzbug:`705533`) +* Pass return values through the GObject.Signal.emit wrapper + (Simon Feltman) (:bzbug:`705530`) + +3.9.5 - 2013-07-29 +------------------ + +* Ensure exceptions set in closure out argument marshaling are printed + (Simon Feltman) (:bzbug:`705064`) +* Always raise OverflowError for marshaling integers from Python + (not ValueError or OverflowError) (Simon Feltman) (:bzbug:`705057`) +* Cleanup invoke args and kwargs combiner code (Simon Feltman) (:bzbug:`640812`) +* gtk-demo: Change demo to use Gtk.Application (Simon Feltman) (:bzbug:`698547`) +* Add callable and descriptor protocols to PyGICallableInfo + (Simon Feltman) (:bzbug:`704037`) +* Unify basic type argument marshaling for methods, closures, and + properties (Simon Feltman) (:bzbug:`693405`) +* Override GValue.set/get_boxed with static C marshaler + (Simon Feltman) (:bzbug:`688081`, :bzbug:`693405`) +* Add deprecation warning for marshaling arbitrary objects as pointers + (Simon Feltman) (:bzbug:`688081`) +* Replace usage of __import__ with importlib.import_module + (Simon Feltman) (:bzbug:`682320`) +* Always unref the GiTypeInfo when generating an argument cache + (Mike Gorse) (:bzbug:`703973`) +* Unref interface info when fetching enums or flags + (Mike Gorse) (:bzbug:`703960`) +* Speed up MRO calculation (Daniel Drake) (:bzbug:`703829`) +* Add GIL safety to pyobject_copy for copying boxed PyObjects + (Simon Feltman) (:bzbug:`688081`) +* Add marshaling of GI_TYPE_TAG_VOID held in a GValue to int + (Simon Feltman) (:bzbug:`694233`) +* GTK overrides: Make connect_signals handle tuple + (Cole Robinson) (:bzbug:`693994`) +* Re-add support for passing GValue's by reference + (Simon Feltman) (:bzbug:`701058`) +* Clear return value of closures to zero when an exception occurs + (Simon Feltman) (:bzbug:`702552`) +* Don't use doctest syntax in docstrings for examples + (Martin Pitt) (:bzbug:`701009`) +* Add support for properties of type GInterface + (Garrett Regier) (:bzbug:`703456`) +* pygtkcompat: Fix for missing methods on Windows + (Martin Pitt) (:bzbug:`702787`) +* gi/pygi-info.c: Avoid C99-style variable declaration + (Chun-wei Fan) (:bzbug:`702786`) + +3.8.3 - 2013-07-05 +------------------ + +* Add marshalling of GI_TYPE_TAG_VOID held in a GValue to int. While + not particularly useful this allows some callbacks in WebKit to + function without causing a segfault. (Simon Feltman) (:bzbug:`694233`) +* pygtkcompat: Fix for missing methods on Windows (Martin Pitt) + (:bzbug:`702787`) +* gi/pygi-info.c: Avoid C99-style variable declaration (Chun-wei Fan) + (:bzbug:`702786`) +* Clear return value of closures to zero when an exception occures + (Simon Feltman) (:bzbug:`702552`) +* Re-add support for passing GValue's by reference (Simon Feltman) + (:bzbug:`701058`) +* Don't use doctest syntax in docstrings for examples, to fix test + failures with pyflakes 0.7.x (Martin Pitt) (:bzbug:`701009`) +* examples/option.py: Port to GI and Python 3 (Martin Pitt) + +3.9.2 - 2013-05-28 +------------------ + +* examples/option.py: Port to GI and Python 3 (Martin Pitt) +* Fix vfunc info search for classes with multiple inheritance + (Simon Feltman) (:bzbug:`700092`) +* Fix closure argument conversion for enum and flag in args + (Simon Feltman) +* Fix marshaling Python to FFI return value for enum and flags + (Simon Feltman) +* Remove half implemented GC in PyGIBaseInfo, PyGIStruct, and PyGIBoxed + (Simon Feltman) (:bzbug:`677091`) +* Replace usage of pyg_begin_allow_threads with Py_BEGIN_ALLOW_THREADS + (Simon Feltman) (:bzbug:`699440`) +* Remove and deprecate API for setting of thread blocking functions + (Simon Feltman) (:bzbug:`699440`) + +3.8.2 - 2013-05-13 +------------------ + +* Fix vfunc info search for classes with multiple inheritance + (Simon Feltman) (:bzbug:`700092`) +* Fix closure argument conversion for enum and flag in args + (Simon Feltman) +* Fix marshaling Python to FFI return value for enum and flags + (Simon Feltman) +* Use correct class for GtkEditable's get_selection_bounds() function + (Mike Ruprecht) (:bzbug:`699096`) +* Test results of g_base_info_get_name for NULL (Simon Feltman) + (:bzbug:`698829`) +* Change interpretation of NULL pointer field from None to 0 + (Simon Feltman) (:bzbug:`698366`) +* Remove Python keyword escapement in Repository.find_by_name + (Simon Feltman) (:bzbug:`697363`) + +3.9.1 - 2013-04-30 +------------------ + +* gtk-demo: Wrap description strings at 80 characters (Simon Feltman) + (:bzbug:`698547`) +* gtk-demo: Use textwrap to reformat description for Gtk.TextView + (Simon Feltman) (:bzbug:`698547`) +* gtk-demo: Use GtkSource.View for showing source code (Simon Feltman) + (:bzbug:`698547`) +* Use correct class for GtkEditable's get_selection_bounds() function + (Mike Ruprecht) (:bzbug:`699096`) +* Test results of g_base_info_get_name for NULL (Simon Feltman) + (:bzbug:`698829`) +* Add ObjectInfo.get_class_struct() (Johan Dahlin) (:bzbug:`685218`) +* Change interpretation of NULL pointer field from None to 0 + (Simon Feltman) (:bzbug:`698366`) +* Do not build tests until needed (Sobhan Mohammadpour) (:bzbug:`698444`) +* pygi-convert: Support toolbar styles (Kai Willadsen) (:bzbug:`698477`) +* pygi-convert: Support new-style constructors for Gio.File + (Kai Willadsen) (:bzbug:`698477`) +* pygi-convert: Add some support for recent manager constructs + (Kai Willadsen) (:bzbug:`698477`) +* pygi-convert: Don't transform arbitrary keysym imports + (Kai Willadsen) (:bzbug:`698477`) +* Remove Python keyword escapement in Repository.find_by_name + (Simon Feltman) (:bzbug:`697363`) +* Optimize signal lookup in gi repository (Daniel Drake) (:bzbug:`696143`) +* Optimize connection of Python-implemented signals (Daniel Drake) + (:bzbug:`696143`) +* Consolidate signal connection code (Daniel Drake) (:bzbug:`696143`) +* Fix setting of struct property values (Daniel Drake) +* Optimize property get/set when using GObject.props (Daniel Drake) + (:bzbug:`696143`) +* configure.ac: Fix PYTHON_SO with Python3.3 (Christoph Reiter) + (:bzbug:`696646`) +* Simplify registration of custom types (Daniel Drake) (:bzbug:`696143`) +* pygi-convert.sh: Add GStreamer rules (Christoph Reiter) (:bzbug:`697951`) +* pygi-convert: Add rule for TreeModelFlags (Jussi Kukkonen) +* Unify GI marshalling code (Simon Feltman) (:bzbug:`693405`) +* Use distutils.sysconfig to retrieve the python include path. + (Christoph Reiter) (:bzbug:`696648`) +* Support PEP 3149 (ABI version tagged .so files) (Christoph Reiter) + (:bzbug:`696646`) +* Fix stack corruption due to incorrect format for argument parser + (Simon Feltman) (:bzbug:`696892`) +* Deprecate GLib and GObject threads_init (Simon Feltman) (:bzbug:`686914`) +* Drop support for Python 2.6 (Martin Pitt) +* Remove static PollFD bindings (Martin Pitt) (:bzbug:`686795`) +* Drop test skipping due to too old g-i (Martin Pitt) +* Bump glib and g-i dependencies (Martin Pitt) + +3.8.1 - 2013-04-15 +------------------ + +* pygi-convert.sh: Add GStreamer rules (Christoph Reiter) (:bzbug:`697951`) +* pygi-convert: Add rule for TreeModelFlags (Jussi Kukkonen) +* Fix enum and flags marshaling type assumptions (Simon Feltman) +* Use g_strdup() consistently (Martin Pitt) (:bzbug:`696650`) +* Fix stack corruption due to incorrect format for argument parser + (Simon Feltman) (:bzbug:`696892`) + +3.8.0 - 2013-03-25 +------------------ + +* tests: Fix incorrect assumption when testing pyglib version + (Simon Feltman) + +3.7.92 - 2013-03-18 +------------------- + +* Fix stack smasher when marshaling enums as a vfunc return value + (Simon Feltman) (:bzbug:`637832`) +* Change base class of PyGIDeprecationWarning based on minor version + (Simon Feltman) (:bzbug:`696011`) +* autogen.sh: Source gnome-autogen to fix out of source builddir (Alban + Browaeys) (:bzbug:`694889`) +* pygtkcompat: Make gdk.Window.get_geometry return tuple of 5 + (Simon Feltman) +* pygtkcompat: Initialize hint to zero in set_geometry_hints + (Simon Feltman) +* Remove incorrect bounds check with property helper flags + (Simon Feltman) +* Fix crash when setting property of type object to an incorrect type + (Simon Feltman) (:bzbug:`695420`) +* Give more informative error when setting property to incorrect type + (Simon Feltman) (:bzbug:`695420`) + +3.7.91.1 - 2013-03-05 +--------------------- + +* Revert "Drop gi.overrides.overridefunc()" (Martin Pitt) (:bzbug:`695199`) + +3.7.91 - 2013-03-04 +------------------- + +* Fix many memory leaks (:bzbug:`675726`, :bzbug:`693402`, :bzbug:`691501`, :bzbug:`510511`, :bzbug:`691501`, + :bzbug:`672224`, and several more which are detected by our test suite) + (Martin Pitt) +* Dot not clobber original Gdk/Gtk functions with overrides + (Martin Pitt) (:bzbug:`686835`) +* Optimize GValue.get/set_value by setting GValue.g_type to a local + (Simon Feltman) (:bzbug:`694857`) +* Run tests with G_SLICE=debug_blocks (Martin Pitt) (:bzbug:`691501`) +* Add override helper for stripping boolean returns (Martin Pitt) + (:bzbug:`694431`) +* Drop obsolete pygobject_register_sinkfunc() declaration (Martin Pitt) + (:bzbug:`639849`) +* Fix marshalling of C arrays with explicit length in signal arguments + (Martin Pitt) (:bzbug:`662241`) +* Fix signedness, overflow checking, and 32 bit overflow of GFlags + (Martin Pitt) (:bzbug:`693121`) +* gi/pygi-marshal-from-py.c: Fix build on Visual C++ (Chun-wei Fan) + (:bzbug:`692856`) +* Raise DeprecationWarning on deprecated callables (Martin Pitt) + (:bzbug:`665084`) +* pygtkcompat: Add Widget.window, scroll_to_mark, and window methods + (Simon Feltman) (:bzbug:`694067`) +* pygtkcompat: Add Gtk.Window.set_geometry_hints which accepts keyword + arguments (Simon Feltman) (:bzbug:`694067`) +* Ship pygobject.doap for autogen.sh (Martin Pitt) (:bzbug:`694591`) +* Fix crashes in various GObject signal handler functions + (Simon Feltman) (:bzbug:`633927`) +* pygi-closure: Protect the GSList prepend with the GIL (Olivier Crête) + (:bzbug:`684060`) +* generictreemodel: Fix bad default return type for get_column_type + (Simon Feltman) + +3.7.90 - 2013-02-19 +------------------- + +* overrides: Fix inconsistencies with drag and drop target list API + (Simon Feltman) (:bzbug:`680640`) +* pygtkcompat: Add pygtk compatible GenericTreeModel implementation + (Simon Feltman) (:bzbug:`682933`) +* overrides: Add support for iterables besides tuples for TreePath + creation (Simon Feltman) (:bzbug:`682933`) +* Prefix __module__ attribute of function objects with gi.repository + (Niklas Koep) (:bzbug:`693839`) +* configure.ac: only enable code coverage when available, to fix + autogen.sh with older gnome-commons (Jonathan Ballet) (:bzbug:`693328`) +* Correctly set properties on object with statically defined properties + (Jonathan Ballet) (:bzbug:`693618`) +* autogen.sh: Use gnome-autogen.sh (Martin Pitt) (:bzbug:`693328`) +* Fix reference leaks with transient floating objects (Simon Feltman) + (:bzbug:`687522`) + +3.7.5.1 - 2013-02-05 +-------------------- + +* Fix ABI break with pygobject.h from 3.7.5 (Simon Feltman) (:bzbug:`675726`) + +3.7.5 - 2013-02-04 +------------------ + +* Move various signal methods from static bindings to GI + (Simon Feltman) (:bzbug:`692918`) +* GLib overrides: Support unpacking 'maybe' variants (Paolo Borelli) + (:bzbug:`693032`) +* Fix ref count leak when creating pygobject wrappers for input args + (Mike Gorse) (:bzbug:`675726`) +* Prefix names of typeless enums and flags for GType registration + (Simon Feltman) (:bzbug:`692515`) +* Fix compilation with non-C99 compilers such as Visual C++ + (Chun-wei Fan) (:bzbug:`692856`) +* gi/overrides/Glib.py: Fix running on Windows/non-Unix (Chun-wei Fan) +* Do not immediately initialize Gdk and Gtk on import (Martin Pitt) + (:bzbug:`692300`) +* Accept ±inf and NaN as float and double values (Martin Pitt) (:bzbug:`692381`) +* Fix repr() of GLib.Variant (Martin Pitt) +* Fix gtk-demo for Python 3 (Martin Pitt) +* Define GObject.TYPE_VALUE gtype constant (Martin Pitt) +* gobject: Go through introspection on property setting (Olivier Crête) + (:bzbug:`684062`) +* Clean up caller-allocated GValues and their memory (Mike Gorse) + (:bzbug:`691820`) +* Use GNOME_COMPILE_WARNINGS from gnome-common (Martin Pitt) + +3.7.4 - 2013-01-14 +------------------ + +* Allow setting values through GtkTreeModelFilter (Simonas Kazlauskas) + (:bzbug:`689624`) +* Support GParamSpec signal arguments from Python (Martin Pitt) + (:bzbug:`683099`) +* pygobject_emit(): Fix cleanup on error (Martin Pitt) +* Add signal emission methods to TreeModel which coerce the path + argument (Simon Feltman) (:bzbug:`682933`) +* Add override for GValue (Bastian Winkler) (:bzbug:`677473`) +* Mark caller-allocated boxed structures as having a slice allocated + (Mike Gorse) (:bzbug:`699501`) +* pygi-property: Support boxed GSList/GList types (Olivier Crête) + (:bzbug:`684059`) +* tests: Add missing backwards compat methods for Python 2.6 + (Martin Pitt) (:bzbug:`691646`) +* Allow setting TreeModel values to None (Simon Feltman) (:bzbug:`684094`) +* Set clean-up handler for marshalled arrays (Mike Gorse) (:bzbug:`691509`) +* Support setting string fields in structs (Vadim Rutkovsky) (:bzbug:`678401`) +* Permit plain integers for "gchar" values (Martin Pitt) +* Allow single byte values for int8 types (Martin Pitt) (:bzbug:`691524`) +* Fix invalid memory access handling errors when registering an enum + type (Mike Gorse) +* Fix (out) arguments in callbacks (Martin Pitt) +* Fix C to Python marshalling of struct pointer arrays (Martin Pitt) +* Don't let Property.setter() method names define property names + (Martin Pitt) (:bzbug:`688971`) +* Use g-i stack allocation API (Martin Pitt) (:bzbug:`615982`) +* pyg_value_from_pyobject: support GArray (Ray Strode) (:bzbug:`690514`) +* Fix obsolete automake macros (Marko Lindqvist) (:bzbug:`691101`) +* Change dynamic enum and flag gtype creation to use namespaced naming + (Simon Feltman) (:bzbug:`690455`) +* Fix Gtk.UIManager.add_ui_from_string() override for non-ASCII chars + (Jonathan Ballet) (:bzbug:`690329`) +* Don't dup strings before passing them to type registration functions + (Mike Gorse) (:bzbug:`690532`) +* Fix marshalling of arrays of boxed struct values (Carlos Garnacho) + (:bzbug:`656312`) + +3.7.3 - 2012-12-17 +------------------ + +* Add support for caller-allocated GArray out arguments (Martin Pitt) + (:bzbug:`690041`) +* [API add] Re-support calling GLib.io_add_watch with an fd or Python + file (Martin Pitt) +* pygtkcompat: Work around IndexError on large flags (Martin Pitt) +* Fix pyg_value_from_pyobject() range check for uint (Martin Pitt) +* Fix tests to work with g-i 1.34.2 (Martin Pitt) +* Fix wrong refcount for GVariant property defaults (Martin Pitt) + (:bzbug:`689267`) +* Fix array arguments on 32 bit architectures (Martin Pitt) +* Add backwards compatible API for GLib.unix_signal_add_full() + (Martin Pitt) +* Drop MININT64/MAXUINT64 workaround, current g-i gets this right now + (Martin Pitt) +* Fix maximum and minimum ranges of TYPE_(U)INT64 properties + (Simonas Kazlauskas) (:bzbug:`688949`) +* Ship pygi-convert.sh in tarballs (Martin Pitt) (:bzbug:`688697`) + +3.7.2 - 2012-11-19 +------------------ + +* [API change] Drop almost all static GLib bindings and replace them + with proper introspection. This gets rid of several cases where the + PyGObject API was not matching the real GLib API, makes the full GLib + API available through introspection, and makes the code smaller, + easier to maintain. For backwards compatibility, overrides are + provided to emulate the old static binding API, but this will throw a + PyGIDeprecationWarning for the cases that diverge from the official + API (in particular, GLib.io_add_watch() and GLib.child_watch_add() + being called without a priority argument). (Martin Pitt, Simon Feltman) +* [API change] Deprecate calling GLib API through the GObject + namespace. This has always been a misnomer with introspection, and + will be removed in a later version; for now this throws a + PyGIDeprecationWarning. +* [API change] Do not bind gobject_get_data() and gobject_set_data(). + These have been deprecated for a cycle, now dropped entirely. + (Steve Frécinaux) (:bzbug:`641944`) +* [API change] Deprecate void pointer fields as general PyObject + storage. (Simon Feltman) (:bzbug:`683599`) +* Add support for GVariant properties (Martin Pitt) +* Add type checking to GVariant argument assignment (Martin Pitt) +* Fix marshalling of arrays of struct pointers to Python (Carlos Garnacho) (:bzbug:`678620`) +* Fix Gdk.Atom to have a proper str() and repr() (Martin Pitt) (:bzbug:`678620`) +* Make sure g_value_set_boxed does not cause a buffer overrun with GStrvs (Simon Feltman) (:bzbug:`688232`) +* Fix leaks with GValues holding boxed and object types (Simon Feltman) (:bzbug:`688137`) +* Add doc strings showing method signatures for gi methods (Simon Feltman) (:bzbug:`681967`) +* Set Property instance doc string and blurb to getter doc string (Simon Feltman) (:bzbug:`688025`) +* Add GObject.G_MINSSIZE (Martin Pitt) +* Fix marshalling of GByteArrays (Martin Pitt) +* Fix marshalling of ssize_t to smaller ints (Martin Pitt) +* Add support for lcov code coverage, and add a lot of missing + GIMarshallingTests and g-i Regress tests. (Martin Pitt) +* pygi-convert: remove deprecated GLib → GObject conversions (Jose Rostagno) +* Add support for overriding GObject.Object (Simon Feltman) (:bzbug:`672727`) +* Add --with-python configure option (Martin Pitt) +* Do not prefer unversioned "python" when configuring, as some distros + have "python" as Python 3. Use Python 3 by default if available. Add + --with-python configure option as an alternative to setting $PYTHON, + whic is more discoverable. (Martin Pitt) +* Fix property lookup in class hierarchy (Daniel Drake) (:bzbug:`686942`) +* Move property and signal creation into _class_init() (Martin Pitt) (:bzbug:`686149`) +* Fix duplicate symbols error on OSX (John Ralls) +* [API add] Add get_introspection_module for getting un-overridden modules (Simon Feltman) (:bzbug:`686828`) +* Work around wrong 64 bit constants in GLib Gir (Martin Pitt) (:bzbug:`685022`) +* Mark GLib.Source.get_current_time() as deprecated (Martin Pitt) +* Fix OverflowError in source_remove() (Martin Pitt) (:bzbug:`684526`) + +3.4.2 - 2012-11-12 +------------------ + +* Fix marshalling of GByteArrays (Martin Pitt) +* Fix marshalling of ssize_t to smaller ints (Martin Pitt) +* Fix crash with GLib.child_watch_add (Daniel Narvaez) (:bzbug:`688067`) +* Fix various bugs in GLib.IOChannel (Martin Pitt) +* Work around wrong 64 bit constants in GLib Gir (Martin Pitt) + (:bzbug:`685022`) +* Fix OverflowError in source_remove() (Martin Pitt) (:bzbug:`684526`) +* Fix Signal decorator to not use base class gsignals dict + (Simon Feltman) (:bzbug:`686496`) + +3.7.1 - 2012-10-22 +------------------ + +* Bump version to 3.7.1; let's follow the real GNOME versioning from + now on (Martin Pitt) +* Change install_properties to not use getattr on classes + (Simon Feltman) (:bzbug:`686559`) +* Move property install function into propertyhelper.py (Simon Feltman) + (:bzbug:`686559`) +* Fix Signal decorator to not use base class gsignals dict + (Simon Feltman) (:bzbug:`686496`) +* tests: Consistently use GLib.MainLoop (Martin Pitt) +* Install the .egg-info files into correct multilib directory + (Kalev Lember) (:bzbug:`686315`) +* Fix leaked vfunc return values (Simon Feltman) (:bzbug:`686140`) +* Skip Regress tests with --disable-cairo (Martin Pitt) (:bzbug:`685094`) +* Fix leak with python callables as closure argument. (Simon Feltman) + (:bzbug:`685598`) +* Gio overrides: Handle setting GSettings enum keys (Martin Pitt) + (:bzbug:`685947`) +* tests: Check reading GSettings enums in Gio overrides (Martin Pitt) +* Fix unsigned values in GArray/GList/GSList/GHash (Martin Pitt) + (:bzbug:`685860`) +* _pygi_marshal_from_py_uint64(): Use correct data type in py2.7 check + (Alban Browaeys) (:bzbug:`685000`) +* Install an .egg-info file (Johan Dahlin) (:bzbug:`680138`) +* PyGProps_getattro(): Fix GObjectClass leak (Johan Dahlin) (:bzbug:`685218`) +* pygobject.c: Don't leak GObjectClass reference (Olivier Crête) + (:bzbug:`684062`) +* Fix memory leak in _pygi_argument_to_array() (Alban Browaeys) + (:bzbug:`685082`) +* Fix error messages for out of range numbers (Martin Pitt) (:bzbug:`684314`) +* Kill dbus-daemon after running tests (Martin Pitt) (:bzbug:`685009`) +* GVariant overrides: Support empty tuple arrays (Martin Pitt) + (:bzbug:`684928`) +* tests: Fix wrong return type in test_int64_callback() (Martin Pitt) + (:bzbug:`684700`) +* Fix GValue marshalling of long and unsigned long (Giovanni Campagna) + (:bzbug:`684331`) +* Clean up deprecation message for assigning gpointers to objects. + (Simon Feltman) (:bzbug:`683599`) +* pygi-property: Lookup property in base classes of non-introspected + types (Olivier Crête) (:bzbug:`684058`) + +3.4.1.1 - 2012-10-17 +-------------------- + +* Bump g-i dependency to >= 1.34.1.1 (Paolo Borelli) +* Fix leaked vfunc return values (Simon Feltman) (:bzbug:`686140`) +* Install egg-info files in the right dir Kalev Lember) (:bzbug:`686315`) + +3.4.1 - 2012-10-15 +------------------ + +* Skip Regress tests with --disable-cairo (Martin Pitt) (:bzbug:`685094`) +* Fix leak with python callables as closure argument. (Simon Feltman) (:bzbug:`685598`) +* Gio overrides: Handle setting GSettings enum keys (Martin Pitt) (:bzbug:`685947`) +* Fix unsigned values in GArray/GList/GSList/GHash (Martin Pitt) (:bzbug:`685860`) +* _pygi_marshal_from_py_uint64(): Use correct data type in py2.7 check (Alban Browaeys) (:bzbug:`685000`) +* Install an .egg-info file (Johan Dahlin) (:bzbug:`680138`) +* PyGProps_getattro(): Fix GObjectClass leak (Johan Dahlin) (:bzbug:`685218`) +* pygobject.c: Don't leak GObjectClass reference (Olivier Crête) (:bzbug:`684062`) +* Fix memory leak in _pygi_argument_to_array() (Alban Browaeys) (:bzbug:`685082`) +* Fix error messages for out of range numbers (Martin Pitt) (:bzbug:`684314`) +* Kill dbus-daemon after running tests (Martin Pitt) (:bzbug:`685009`) +* GVariant overrides: Support empty tuple arrays (Martin Pitt) (:bzbug:`684928`) +* tests: Fix wrong return type in test_int64_callback() (Martin Pitt) (:bzbug:`684700`) +* Fix GValue marshalling of long and unsigned long (Giovanni Campagna) (:bzbug:`684331`) +* Clean up deprecation message for assigning gpointers to objects. (Simon Feltman) (:bzbug:`683599`) +* pygi-property: Lookup property in base classes of non-introspected types (Olivier Crête) (:bzbug:`684058`) + +3.4.0 - 2012-09-24 +------------------ + +* Bump g-i dependency to 1.33.14 (Martin Pitt) + +3.3.92 - 2012-09-17 +------------------- + +* [API add] Add ObjectInfo.get_abstract method (Simon Feltman) (:bzbug:`675581`) +* Add deprecation warning when setting gpointers to anything other than + int. (Simon Feltman) (:bzbug:`683599`) +* argument: Fix 64bit integer convertion from GValue (Nicolas Dufresne) + (:bzbug:`683596`) +* Improve setting pointer fields/arguments to NULL using None + (Simon Feltman) (:bzbug:`683150`) +* Bump g-i dependency to 1.33.10 (Martin Pitt) +* Fix -uninstalled.pc.in file (Thibault Saunier) (:bzbug:`683379`) +* Various test suite additions and improvements (Martin Pitt) + +3.3.91 - 2012-09-03 +------------------- + +* Fix exception test case for Python 2 (Martin Pitt) +* Bump g-i dependency to >= 1.3.9 (Martin Pitt) +* Show proper exception when trying to allocate a disguised struct + (Martin Pitt) (:bzbug:`639972`) +* Support marshalling GParamSpec signal arguments (Mark Nauwelaerts) + (:bzbug:`683099`) +* Add test for a signal that returns a GParamSpec (Martin Pitt) + (:bzbug:`683265`) +* [API add] Add Signal class for adding and connecting custom signals. + (Simon Feltman) (:bzbug:`434924`) +* Fix pygtkcompat's Gtk.TreeView.insert_column_with_attributes() + (Martin Pitt) +* Add override for Gtk.TreeView.insert_column_with_attributes() + (Marta Maria Casetti) (:bzbug:`679415`) +* .gitignore: Add missing built files (Martin Pitt) +* Ship tests/gi in tarball (Martin Pitt) +* Split test_overrides.py (Martin Pitt) (:bzbug:`683188`) +* _pygi_argument_to_object(): Clean up array unmarshalling (Martin Pitt) +* Fix memory leak in _pygi_argument_to_object() (Alban Browaeys) + (:bzbug:`682979`) +* Fix setting pointer fields/arguments to NULL using None. + (Simon Feltman) (:bzbug:`683150`) +* Fix for python 2.6, officially drop support for < 2.6 (Martin Pitt) + (:bzbug:`682422`) +* Allow overrides in other directories than gi itself + (Thibault Saunier) (:bzbug:`680913`) +* Clean up sys.path handling in tests (Simon Feltman) (:bzbug:`680913`) +* Fix dynamic creation of enum and flag gi types for Python 3.3 + (Simon Feltman) (:bzbug:`682323`) +* [API add] Override g_menu_item_set_attribute (Paolo Borelli) (:bzbug:`682436`) + +3.3.90 - 2012-08-20 +------------------- + +* Implement marshalling for GParamSpec (Mathieu Duponchelle) (:bzbug:`681565`) +* Fix erronous import statements for Python 3.3 (Simon Feltman) + (:bzbug:`682051`) +* Do not fail tests if pyflakes or pep8 are not installed (Martin Pitt) +* Fix PEP-8 whitespace checking and issues in the code (Martin Pitt) +* Fix unmarshalling of gssize (David Malcolm) (:bzbug:`680693`) +* Fix various endianess errors (David Malcolm) (:bzbug:`680692`) +* Gtk overrides: Add TreeModelSort.__init__(self, model) + (Simon Feltman) (:bzbug:`681477`) +* Convert Gtk.CellRendererState in the pygi-convert script + (Manuel Quiñones) (:bzbug:`681596`) + +3.3.5 - 2012-08-06 +------------------ + +* Fix list marshalling on big-endian machines (Martin Pitt) + (:bzbug:`680693`) +* Beautify class/interface type mismatch error messages (Martin Pitt) +* Skip instead of fail tests which need Pango, Atk, Gdk, Gtk (Martin Pitt) +* [API add] pygtkcompat: Add more pixbuf creation functions (Simon Feltman) + (:bzbug:`680814`) +* Fix error messages on interface/class type mismatches (Martin Pitt) +* Fix crash when returning (False, None) from Gtk.TreeModel.do_get_iter() (Simon Feltman) + (:bzbug:`680812`) +* Add test case for Gtk.TextIter.forward_search() (Martin Pitt) + (:bzbug:`679415`) +* pygi-info.c: Robustify pointer arithmetic (Martin Pitt) +* Add set_attributes() override to Gtk.TreeViewColumn (Manuel Quiñones) +* Gtk overrides: Add TreePath.__getitem__() (Simon Feltman) + (:bzbug:`680353`) +* Fix property type mapping from int to TYPE_INT for python3. (Simon Feltman) + (:bzbug:`679939`) +* Convert Gtk.DestDefaults constants in pygi-convert.sh script (Manuel Quiñones) + (:bzbug:`680259`) +* Convert all Gdk.WindowState constants in pygi-convert.sh (Manuel Quiñones) + (:bzbug:`680257`) +* [API add] Add API for checking pygobject's version (Joe R. Nassimian) + (:bzbug:`680176`) +* pygi-convert.sh: Add some missing Gdk.CursorTypes (Manuel Quiñones) + (:bzbug:`680050`) +* pygi-convert.sh: convert rsvg.Handle(data=...) (Manuel Kaufmann) + (:bzbug:`680092`) + +3.3.4 - 2012-07-16 +------------------ + +* pygi-convert.sh: Drop bogus filter_new() conversion (Martin Pitt) + (:bzbug:`679999`) +* Fix help() for GI modules (Martin Pitt) (:bzbug:`679804`) +* Skip gi.CallbackInfo objects from a module's dir() (Martin Pitt) + (:bzbug:`679804`) +* Fix __path__ module attribute (Martin Pitt) +* pygi-convert.sh: Fix some child → getChild() false positives + (Joe R. Nassimian) (:bzbug:`680004`) +* Fix array handling for interfaces, properties, and signals + (Mikkel Kamstrup Erlandsen) (:bzbug:`667244`) +* Add conversion of the Gdk.PropMode constants to pygi-convert.sh + script (Manuel Quiñones) (:bzbug:`679775`) +* Add the same rules for pack_start to convert pack_end (Manuel + Quiñones) (:bzbug:`679760`) +* Add error-checking for the case where _arg_cache_new() fails + (Dave Malcolm) (:bzbug:`678914`) +* Add conversion of the Gdk.NotifyType constants to pygi-convert.sh + script (Manuel Quiñones) (:bzbug:`679754`) +* Fix PyObject_Repr and PyObject_Str reference leaks (Simon Feltman) + (:bzbug:`675857`) +* [API add] Gtk overrides: Add TreePath.__len__() (Martin Pitt) + (:bzbug:`679199`) +* GLib.Variant: Fix repr(), add proper str() (Martin Pitt) (:bzbug:`679336`) +* m4/python.m4: Update Python version list (Martin Pitt) +* Remove "label" property from Gtk.MenuItem if it is not set + (Micah Carrick) (:bzbug:`670575`) + +3.3.3.1 - 2012-06-25 +-------------------- + +* Do not escape enum and flag names that are Python keywords (Martin Pitt) + +3.3.3 - 2012-06-25 +------------------ + +* Remove obsolete release-tag make target (Martin Pitt) +* Do not do any python calls when GObjects are destroyed after the + python interpreter has been finalized (Simon Schampijer) (:bzbug:`678046`) +* Do not change constructor-only "type" Window property (Martin Pitt) + (:bzbug:`678510`) +* Escape identifiers which are Python keywords (Martin Pitt) (:bzbug:`676746`) +* Fix code for PEP-8 violations detected by the latest pep8 checker. + (Martin Pitt) +* Fix crash in GLib.find_program_in_path() (Martin Pitt) (:bzbug:`678119`) +* Revert "Do not bind gobject_get_data() and gobject_set_data()" (Martin Pitt) + (:bzbug:`641944`) +* GVariant: Raise proper TypeError on invalid tuple input (David Keijser) + (:bzbug:`678317`) + +3.3.2 - 2012-06-05 +------------------ + +* foreign: Register cairo.Path and cairo.FontOptions foreign structs + (Bastian Winkler) (:bzbug:`677388`) +* Check types in GBoxed assignments (Marien Zwart) (:bzbug:`676603`) +* [API add] Gtk overrides: Add TreeModelRow.get_previous() + (Bastian Winkler) (:bzbug:`677389`) +* [API add] Add missing GObject.TYPE_VARIANT (Bastian Winkler) (:bzbug:`677387`) +* Fix boxed type equality (Jasper St. Pierre) (:bzbug:`677249`) +* Fix TestProperties.testBoxed test (Jose Rostagno) (:bzbug:`676644`) +* Fix handling of by-reference structs as out parameters + (Carlos Garnacho) (:bzbug:`653151`) +* tests: Add more vfunc checks for GIMarshallingTestsObject + (Martin Pitt) +* Test caller-allocated GValue out parameter (Martin Pitt) (:bzbug:`653151`) +* GObject.bind_property: Support transform functions (Bastian Winkler) + (:bzbug:`676169`) +* Fix lookup of vfuncs in parent classes (Carlos Garnacho) (:bzbug:`672864`) +* tests/test_properties.py: Fix whitespace (Martin Pitt) +* gi: Support zero-terminated arrays with length arguments + (Jasper St. Pierre) (:bzbug:`677124`) +* [API add] Add GObject.bind_property method (Simon Feltman) (:bzbug:`675582`) +* pygtkcompat: Correctly set flags (Jose Rostagno) (:bzbug:`675911`) +* Gtk overrides: Implement __delitem__ on TreeModel (Jose Rostagno) + (:bzbug:`675892`) +* Gdk Color override should support red/green/blue_float properties + (Simon Feltman) (:bzbug:`675579`) +* Support marshalling of GVariants for closures (Martin Pitt) (:bzbug:`656554`) +* _pygi_argument_from_object(): Check for compatible data type + (Martin Pitt) +* pygtkcompat: Fix color conversion (Martin Pitt) +* test_gi: Check setting properties in constructor (Martin Pitt) +* Support getting and setting GStrv properties (Martin Pitt) +* Support defining GStrv properties from Python (Martin Pitt) +* Add GObject.TYPE_STRV constant (Martin Pitt) +* Unref GVariants when destroying the wrapper (Martin Pitt) (:bzbug:`675472`) +* Fix TestArrayGVariant test cases (Martin Pitt) +* pygtkcompat: Add gdk.pixbuf_get_formats compat code (Jose Rostagno) + (:bzbug:`675489`) +* pygtkcompat: Add some more compat functions (Jose Rostagno) (:bzbug:`675489`) +* Fix tests for Python 3 (Martin Pitt) +* Fix building with --disable-cairo (Martin Pitt) +* tests: Fix deprecated assertions (Martin Pitt) +* Run tests with ``MALLOC_PERTURB_`` (Martin Pitt) + +3.2.2 - 2012-05-14 +------------------ + +* pygtkcompat: Correctly set flags (Jose Rostagno) (:bzbug:`675911`) +* Gtk overrides: Implement __delitem__ on TreeModel (Jose Rostagno) + (:bzbug:`675892`) + +3.2.1 - 2012-05-10 +------------------ + +* Reindent files in tests to use 4-space indentation (Sebastian Pölsterl +* Add missing override for TreeModel.iter_previous() (Martin Pitt) +* GSettings: allow extra keyword arguments (Giovanni Campagna) +* pygtkcompat: Correct Userlist module use (Jose Rostagno) +* test_gdbus: Call GetConnectionUnixProcessID() with correct signature (Martin Pitt) +* GTK overrides: Add missing keyword arguments (Martin Pitt) +* pygi-convert.py: Drop obsolete drag method conversions (Martin Pitt) +* Fix len_arg_index for array arguments (Bastian Winkler) +* Add missing GObject.TYPE_GTYPE (Martin Pitt) +* Fix "distcheck" and tests with out-of-tree builds (Martin Pitt) +* Add GtkComboBoxEntry compatibility (Paolo Borelli) + +3.3.1 - 2012-04-30 +------------------ + +* GSettings: allow extra keyword arguments (Giovanni Campagna) + (:bzbug:`675105`) +* pygtkcompat: Correct Userlist module use (Jose Rostagno) (:bzbug:`675084`) +* Add release-news make rule (Martin Pitt) +* Add "make check.nemiver" target (Martin Pitt) +* Test flags and enums in GHash values (Martin Pitt) (:bzbug:`637466`) +* tests: Activate test_hash_in and apply workaround (Martin Pitt) + (:bzbug:`666636`) +* Add special case for Gdk.Atom array entries from Python (Martin Pitt) + (:bzbug:`661709`) +* test_gdbus: Call GetConnectionUnixProcessID() with correct signature + (Martin Pitt) (:bzbug:`667954`) +* Add test case for Gtk.ListStore custom sort (Martin Pitt) (:bzbug:`674475`) +* GTK overrides: Add missing keyword arguments (Martin Pitt) (:bzbug:`660018`) +* [API change] Add missing override for TreeModel.iter_previous() + (Martin Pitt) (:bzbug:`660018`) +* pygi-convert.py: Drop obsolete drag method conversions (Martin Pitt) + (:bzbug:`652860`) +* tests: Replace deprecated assertEquals() with assertEqual() + (Martin Pitt) +* Plug tiny leak in constant_info_get_value (Paolo Borelli) (:bzbug:`642754`) +* Fix len_arg_index for array arguments (Bastian Winkler) (:bzbug:`674271`) +* Support defining GType properties from Python (Martin Pitt) (:bzbug:`674351`) +* Handle GType properties correctly (Bastian Winkler) (:bzbug:`674351`) +* Add missing GObject.TYPE_GTYPE (Martin Pitt) +* Fix test_mainloop.py for Python 3 (Martin Pitt) +* Make callback exception propagation test stricter (Martin Pitt) + (:bzbug:`616279`) +* [API add] Add context management to freeze_notify() and + handler_block(). (Simon Feltman) (:bzbug:`672324`) +* Add support for GFlags properties (Martin Pitt) (:bzbug:`620943`) +* [API add] Wrap GLib.Source.is_destroyed() method (Martin Pitt) + (:bzbug:`524719`) +* Fix error message when trying to override a non-GI class + (Martin Pitt) (:bzbug:`646667`) +* Fix segfault when accessing __grefcount__ before creating the GObject + (Steve Frécinaux) (:bzbug:`640434`) +* [API change] Do not bind gobject_get_data() and gobject_set_data() + (Steve Frécinaux) (:bzbug:`641944`) +* Add test case for multiple GLib.MainLoop instances (Martin Pitt) + (:bzbug:`663068`) +* Add a ccallback type which is used to invoke callbacks passed to a + vfunc (John (J5) Palmieri) (:bzbug:`644926`) +* Regression test: marshalling GValues in GHashTable (Alberto Mardegan) + (:bzbug:`668903`) +* Update .gitignore (Martin Pitt) +* Fix "distcheck" and tests with out-of-tree builds (Martin Pitt) +* Add a pep8 check to the makefile (Johan Dahlin) (:bzbug:`672627`) +* PEP8 whitespace fixes (Johan Dahlin) (:bzbug:`672627`) +* PEP8: Remove trailing ; (Johan Dahlin) (:bzbug:`672627`) +* tests: Replace deprecated Python API (Martin Pitt) +* Fail tests if they use or encounter deprecations (Martin Pitt) +* Do not run tests in two phases any more (Martin Pitt) +* test_overrides: Find local gsettings schema with current glib + (Martin Pitt) +* Add GtkComboBoxEntry compatibility (Paolo Borelli) (:bzbug:`672589`) +* Correct review comments from Martin (Johan Dahlin) (:bzbug:`672578`) +* Correct pyflakes warnings/errors (Johan Dahlin) (:bzbug:`672578`) +* Make tests fail on CRITICAL logs, too, and apply to all tests + (Martin Pitt) +* Support marshalling GI_TYPE_TAG_INTERFACE (Alberto Mardegan) + (:bzbug:`668903`) +* Fix warnings on None values in added tree/list store rows + (Martin Pitt) (:bzbug:`672463`) +* pygtkcompat test: Properly clean up PixbufLoader (Martin Pitt) + +3.2.0 - 2012-03-26 +------------------ + +* No changes since 3.1.93 except version number. + +3.1.93 - 2012-03-22 +------------------- + +* Fix warnings on None values in added tree/list store rows. + (:bzbug:`672463`, Martin Pitt) +* Support marshalling GI_TYPE_TAG_INTERFACE (:bzbug:`668903`, Alberto Mardegan) +* test_overrides: Find local gsettings schema with current glib + (Martin Pitt) +* pygtkcompat test: Properly clean up PixbufLoader (Martin Pitt) + +3.1.92 - 2012-03-19 +------------------- + +* Correct Gtk.TreePath.__iter__ to work with Python 3 (Johan Dahlin) +* Fix test_everything.TestSignals.test_object_param_signal test case + (Martin Pitt) +* Add a PyGTK compatibility layer (Johan Dahlin) +* pygtkcompat: Remove first argument for get_origin() (Johan Dahlin) +* Fix pygtkcompat.py to work with Python 3 (Martin Pitt) +* GtkViewport: Add a default values for the adjustment constructor + parameters (Johan Dahlin) +* GtkIconSet: Add a default value for the pixbuf constructor parameter + (Johan Dahlin) +* PangoLayout: Add a default value for set_markup() (Johan Dahlin) +* Gtk[HV]Scrollbar: Add a default value for the adjustment constructor + parameter (Johan Dahlin) +* GtkToolButton: Add a default value for the stock_id constructor + parameter (Johan Dahlin) +* GtkIconView: Add a default value for the model constructor parameter + (Johan Dahlin) +* Add a default value for column in Gtk.TreeView.get_cell_area() + (Johan Dahlin) +* Atomic inserts in Gtk.{List,Tree}Store overrides (Martin Pitt) +* Fix Gtk.Button constructor to accept use_stock parameter + (Martin Pitt) +* Correct bad rebase, remove duplicate Window (Johan Dahlin) +* Add bw-compatible arguments to Gtk.Adjustment (Johan Dahlin) +* GtkTreePath: make it iterable (Johan Dahlin) +* Add a default argument to TreeModelFilter.set_visible_func() + (Johan Dahlin) +* Add a default argument to Gtk.TreeView.set_cursor (Johan Dahlin) +* Add a default argument to Pango.Context.get_metrics() (Johan Dahlin) +* Fix double-freeing GValues in arrays (Martin Pitt) +* Renamed "property" class to "Property" (Simon Feltman) +* Fix Python to C marshalling of GValue arrays (Martin Pitt) +* Correct the Gtk.Window hierarchy (Johan Dahlin) +* Renamed getter/setter instance attributes to fget/fset respectively. + (Simon Feltman) +* Add Gtk.Arrow/Gtk.Window constructor override (Johan Dahlin) +* Fix marshalling to/from Python to work on big endian machines. + (Michel Dänzer) +* Use gi_cclosure_marshal_generic instead of duplicating it. + (Michel Dänzer) +* Override Gtk.TreeView.get_visible_range to fix return (René Stadler) +* Plug memory leak in _is_union_member (Paolo Borelli) +* tests: Split TestInterfaces into separate tests (Sebastian Pölsterl) +* README: Update current maintainers (Martin Pitt) + +3.1.1 - 2012-02-20 +------------------ + +* Don't use C99 style (Sebastian Pölsterl) +* Add test for GPtrArray with transfer full (Martin Pitt) +* Drop obsolete g_thread_init() (Martin Pitt) +* Fix deprecated g_source_get_current_time() (Martin Pitt) +* Fix deprecated g_value_[gs]et_char() (Martin Pitt) +* Make pygiconvert.sh correctly convert gtk.gdk.x11_* (Simon Schampijer) +* Raise required glib version to 2.31 because of g_value_(get|set)_schar (Sebastian Pölsterl) +* Fix cset_first typo (Dieter Verfaillie) +* pygi-convert: Handle Clutter and Cogl (Bastian Winkler) +* Provide access to gpointer struct values (Cédric Krier) +* Add some GType tests (Paolo Borelli) +* Split GStrv and array variant tests in their own classes (Paolo Borelli) +* Add unit test for builder's connect_after (Paolo Borelli) +* fix GtkBuilder signal connection 'after' logic (Ryan Lortie) +* test(1) uses '=' to test if strings are identical (Patrick Welche) +* pygspawn: improve error checking (Ryan Lortie) + +3.0.4 - 2012-02-09 +------------------ + +* Revert "Convert all strings to utf-8 encoding when retrieving from TreeModel" (Martin Pitt) +* Fixed bug where GObject.property did not respect minimum and maximum values (Sebastian Pölsterl) +* Remove mention of removed option --enable-docs (Tomeu Vizoso) + +3.1.0 - 2012-02-06 +------------------ + +* Updated DOAP file to only include people currently actively working on the project (Sebastian Pölsterl) +* Revert "Convert all strings to utf-8 encoding when retrieving from TreeModel" (Sebastian Pölsterl) +* tests: Fixed issues with python3 (Sebastian Pölsterl) +* Properly distinguish between different integer types for properties (Sebastian Pölsterl) +* Distinguish between GArray and GPtrArray when cleaning up (Sebastian Pölsterl) +* Add null_gerror_callback unit test (Paolo Borelli) +* pyglib_error_check: Re-add missing NULL check (Martin Pitt) +* Add tests/runtests-windows.py to source tarball (Michael Culbertson) +* Don't issue a depreciation warning for GtkDialog's NO_SEPARATOR flag, even when unused (Sebastian Pölsterl) +* Fix bool() operations on GLib.Variant objects (Nirbheek Chauhan) +* Fix hash() and __eq__() for GLib.Variant objects (Nirbheek Chauhan) +* Fix method names of callback tests (Martin Pitt) +* Cairo: add missing braces around array-of-struct definition (Will Thompson) +* g_instance_init: cast to PyGObject * as needed (Will Thompson) +* Fix a few set-but-not-used warnings. (Will Thompson) +* pygmainloop: allow for extra arguments in 'quit' method (Stefano Facchini) +* Fix bytearray test compatibility with python3 (Alexandre Rostovtsev) +* Respect transfer-type when demarshalling GErrors (Alberto Mardegan) +* Support GHashTable and GError as callback/closure arguments (Alberto Mardegan) +* Don't leak when marshalling GErrors to C (Will Thompson) +* Support functions which return GError (Will Thompson) +* Fix indentation of _pygi_argument_to_object() (Alberto Mardegan) +* Avoid C99 syntax. (Paolo Borelli) +* Connect to first action of a radio group. (Paolo Borelli) +* Use g_slist_free_full in pygi-closure. (Paolo Borelli) +* Avoid O(n^2) behavior when marshalling lists (Paolo Borelli) +* Handle NULL as a valid case of a char** array (Paolo Borelli) +* Branching, bump version to 3.1.0 (Tomeu Vizoso) +* Add notes about branching to HACKING (Tomeu Vizoso) +* Fixed bug where GObject.property did not respect minimum and maximum values (Sebastian Pölsterl) +* Remove mention of removed option --enable-docs (Tomeu Vizoso) +* Fix sebp's name in NEWS (Tomeu Vizoso) + +3.0.3 - 2011-12-12 +------------------ + +* Convert all modifier constants to Gdk.ModifierType (Manuel Quiñones) +* Convert all strings to utf-8 encoding when retrieving from TreeModel (Sebastian Pölsterl) +* add test for bytearray variants (John (J5) Palmieri) +* handle NULL arrays correctly for each array type (John (J5) Palmieri) +* Revert "Revert "Fix array termination and size calculation"" (John (J5) Palmieri) +* pygmainloop: avoid lockups if multiple glib.MainLoop exist (Owen W. Taylor) +* Properly chain up to the class that implements a given vfunc. (Tomeu Vizoso) +* Revert "Fix array termination and size calculation" (Tomeu Vizoso) +* Fix array termination and size calculation (Holger Berndt) +* pygi-convert: fix for Pango.Alignment (Daniel Drake) +* pygi-convert: fix for Gtk.Orientation (Daniel Drake) +* Add tests for calling closures (Martin Pitt) +* fix marshaling of arrays of GVariants (Mikkel Kamstrup Erlandsen) + +3.0.2 - 2011-10-21 +------------------ + +* Add tests for boxed properties. (Ignacio Casal Quinteiro) +* Allow GBoxed types as property (Timo Vanwynsberghe) +* when converting an object with transfer none, make sure the wrapper owns a ref (John (J5) Palmieri) +* unit test for checking ref count of object param in signals (John (J5) Palmieri) +* Gdk overrides: Unbreak for Gdk-2.0 (Martin Pitt) +* Do union member checks for unions that are parameters (John (J5) Palmieri) + +3.0.1 - 2011-09-30 +------------------ + +* when checking instances union members are same type as parent +* add a floating flag to pygobjects +* Revert "Fix refcount bug by not creating python wrapper during gobject init stage" + +3.0.0 - 2011-09-19 +------------------ + +* up version required of gobject-introspection to 1.29.0 (John (J5) Palmieri) +* fix most warnings (John (J5) Palmieri) + +2.90.4 - 2011-09-15 (3.0 pre-release) +------------------------------------- + +* do not pass in len(str) to the length argument of gtk_test_buffer_insert* apis (John (J5) Palmieri) +* Switch tarball compression format to tar.xz only. (Dieter Verfaillie) +* Remove pygtk_version attribute from internal gi._gobject module. (Dieter Verfaillie) +* remove overridesdir from the .pc file and add it to the gi module (John (J5) Palmieri) +* fix tests to correctly construct a dummy Gtk.TargetEntry (John (J5) Palmieri) +* we now assume that C arrays of structs are flat so memcpy them when marshalling (John (J5) Palmieri) +* only update the arg counts once if child arg comes before parent arg (John (J5) Palmieri) +* Fix refcount bug by not creating python wrapper during gobject init stage (John (J5) Palmieri) +* don't destroy just created wrapper when object is created via g_object_new (John (J5) Palmieri) +* Remove deprecated API from pygobject.h (Steve Frécinaux) +* Convert gtk.TRUE/FALSE to Python True/False. (Marcin Owsiany) +* Drop legacy __gobject_init__ method of GObject.Object. (Steve Frécinaux) +* AM_CHECK_PYTHON_LIBS does not work for lib64 (Dieter Verfaillie) +* Remove common_ldflags from Makefile.am as it is no longer used. (Dieter Verfaillie) +* check if object is actually a PyGFlag before trying to access g_type (John (J5) Palmieri) +* fix regression - add instance type checks since Py3 no longer does this for us (John (J5) Palmieri) +* refactor in/out marshalling to be to_py/from_py (John (J5) Palmieri) +* Examples: fix cairo-demo.py imports (Dieter Verfaillie) +* Fix paths and add missing overridesdir variable used in uninstalled pkgconfig file (Dieter Verfaillie) +* Remove no longer used variables from pkgconfig files (Dieter Verfaillie) +* docs/Makefile.am and m4/python.m4: Python3 portability fixes (Dieter Verfaillie) +* Refactor and clean Makefile.am files (Dieter Verfaillie) +* Remove all PLATFORM_VERSION = 2.0 traces (Dieter Verfaillie) +* Remove gi/tests/ directory as all the tests now live in tests/ (Dieter Verfaillie) +* autogen.sh: Use autoreconf instead of a custom script and honor ACLOCAL_FLAGS (Dieter Verfaillie) +* use improved python.m4 macros to search for Python headers and libs (Dieter Verfaillie) +* Make maintiner mode enabled by default (Javier Jardón) +* Disable documentation for now since they are completely wrong for GI. (Dieter Verfaillie) +* Fix documentation installation directory (Dieter Verfaillie) +* Remove distutils based build system. (Dieter Verfaillie) +* [gtk-demo] Fix syntax highlighter encoding issue (Dieter Verfaillie) +* overrides: add constants for atoms (Ignacio Casal Quinteiro) +* Drop pygobject_construct() from public API. (Steve Frécinaux) + +2.90.3 - 2011-08-31(3.0 pre-release) +------------------------------------ + +* support skip annotation for return values (John (J5) Palmieri) +* Test GPtrArray regression (Xavier Claessens) +* Drop support for old constructor style. (Steve Frécinaux) +* Drop support for sink functions. (Steve Frécinaux) +* Reinstate copying of in-line structs in arrays (Mike Gorse) +* fix inline struct array handling (John (J5) Palmieri) +* fix on demos (Dieter Verfaillie) +* Added support for __setitem__ to TreeModel and support for slices to TreeModelRow (Sebastian Pölsterl) +* Convert ACCEL_* constants into Gtk.AccelFlags. (Olav Vitters) +* Convert TREE_VIEW_DROP_* constants into Gtk.TreeViewDropPosition (Olav Vitters) + +2.90.2 - 2011-08-18 (3.0 pre-release) +------------------------------------- + +* remove tests that were removed from gi (John (J5) Palmieri) +* don't calculate item_size using is_pointer (John (J5) Palmieri) +* Updated signal example to use GObject introspection (Timo Vanwynsberghe) +* Updated properties example to use GObject introspection (Timo Vanwynsberghe) +* Add override for GLib.Variant.split_signature() (Martin Pitt) +* [pygi-convert.sh] Handle the import of pygtk and require Gtk 3.0 (Timo Vanwynsberghe) +* Install pygobject.h again. (Ignacio Casal Quinteiro) +* update the doap file (John (J5) Palmieri) + +2.90.1 - 2011-08-14 (3.0 pre-release) +------------------------------------- + +* pass exta keywords to the Box constructor (John (J5) Palmieri) +* add (Tree|List)Store set method override (John (J5) Palmieri) +* add test for object arrays (John (J5) Palmieri) +* only support C pointer arrays for structs and objects (John (J5) Palmieri) +* revert Gtk.Window override because it causes issues with subclasses (John (J5) Palmieri) +* take GIL in _pygi_invoke_closure_free (bug :bzbug:`647016`) (Jonathan Matthew) +* Add a default parameter to GtkTreeModel.filter_new (Johan Dahlin) +* Add vbox/action_area properties (Johan Dahlin) +* Add a couple of constructors (Johan Dahlin) +* Do not always pass in user_data to callbacks. (Johan Dahlin) +* Add a default detail value for Widget.render_icon (Johan Dahlin) +* Add an override for Gdk.color_parse() (Johan Dahlin) +* Support function calling with keyword arguments in invoke. (Laszlo Pandy) +* remove references to deprecated GI_INFO_TYPE_ERROR_DOMAIN (John (J5) Palmieri) +* Fix gobject vs. gi.repository warning (Martin Pitt) +* make GObject and GLib able to take overrides (John (J5) Palmieri) +* avoid dependency issue by importing the internal gobject (John (J5) Palmieri) +* fix tests to use the new GLib module (John (J5) Palmieri) +* add DynamicGLibModule which works like DynamicGObjectModule (John (J5) Palmieri) +* refactor, add objects and types to the correct internal module (John (J5) Palmieri) +* rename the pyglib shared library so we don't load the old one (John (J5) Palmieri) +* refactor tests to only use PyGObject 3 syntax (John (J5) Palmieri) +* refactor the internal _glib module to import correct modules (John (J5) Palmieri) +* refactor to use the new internal _glib and _gobject modules (John (J5) Palmieri) +* refactor gi module to import and use internal _gobject module (John (J5) Palmieri) +* move the static bits internal to gi and refactor build files (John (J5) Palmieri) +* remove pygtk.py (John (J5) Palmieri) +* introspection is no longer optional (John (J5) Palmieri) +* up platform version to 3.0 (John (J5) Palmieri) +* [gi] Handle GVariants from callback return values (Martin Pitt) +* Handle GVariants for callback arguments (Martin Pitt) +* [gi] Fix crash: check return value of _invoke_state_init_from_callable_cache() before continuing. (Laszlo Pandy) +* [gi] Pass gtype as first parameter to vfuncs (instead of using kwargs). (Laszlo Pandy) +* remove codegen (John (J5) Palmieri) +* remove some left over ifdefs to complete merge of the invoke-rewrite branch (John (J5) Palmieri) +* rename pygi-invoke-ng to pygi-invoke (John (J5) Palmieri) +* make invoke-ng the only invoker (John (J5) Palmieri) +* Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) +* Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) +* split the marshalling routines into two source files (John (J5) Palmieri) +* Ship tests/te_ST@nouppera in release tarballs for tests to succeed (Martin Pitt) +* [invoke] break out caller_allocates allocating into its own function (John (J5) Palmieri) +* [invoke] missed a bit when removing constructor_class usage (John (J5) Palmieri) +* [invoke] don't hold on to the constructor class, just add a TODO (John (J5) Palmieri) +* [gi] Port test_properties from static gio to GI Gio (Martin Pitt) +* [python3] Fix maketrans import (Martin Pitt) +* [caching] remove all inline compiler flags (John (J5) Palmieri) +* [caching] refactor function names to be less confusing (John (J5) Palmieri) +* [overrides] deprecate the use of type keyword MessageDialog constructor (John (J5) Palmieri) +* gdbus tests: Fix hang if test case fails (Martin Pitt) +* use an enum instead of booleans to denote function type (John (J5) Palmieri) +* rename aux arguments to child arguments to make their purpose clearer (John (J5) Palmieri) +* Fixed the cairo example (Timo Vanwynsberghe) +* Add override binding for Gtk.ListStore.prepend(). (Adam Dingle) +* Fix crash in Gtk.TextIter overrides (Martin Pitt) +* use gssize instead of int for arg indexes (John (J5) Palmieri) +* [cache] remove refrence to default value as it is not implemented yet (John (J5) Palmieri) +* Handle arguments that are flags correctly (Sebastian Pölsterl) +* correctly initialize the _gi_cairo_functions array to be zero filled (John (J5) Palmieri) +* correctly initialize the _gi_cairo_functions array to be zero filled (John (J5) Palmieri) +* pass in the address of the gerror, not the gerror itself (John (J5) Palmieri) +* [gi] handle marshalling gerrors arguments for signals (John (J5) Palmieri) +* [gi-invoke-ng] fix NULL check to check before we access the cache struct (John (J5) Palmieri) +* [gi-tests] add test for PyGObject->PyObject TreeModel storage (John (J5) Palmieri) +* [gtk-overrides] special case TreeModel columns of PYGOBJECT types (John (J5) Palmieri) +* [gi-invoke-ng] copy structs when transfer is full for array (John (J5) Palmieri) +* [gtk-override] print warning if user imports Gtk 2.0 (John (J5) Palmieri) +* [gtk-overrides] allow the message_type keyword to be used for MessageDialogs (John (J5) Palmieri) +* Add support for enums in gobject.property (Johan Dahlin) +* Add support for enums in gobject.property (Johan Dahlin) +* [gi-invoke-ng] use g_slice for allocating GValues that are caller allocated (John (J5) Palmieri) +* [gi-invoke-ng] Convert Overflow errors to ValueErrors when marshalling integers (John (J5) Palmieri) +* [gi-invoke-ng] only cache caller allocates for interfaces as some API are broken (John (J5) Palmieri) +* [gi-invoke-ng] handle in pointer array marshalling (John (J5) Palmieri) +* Adding GPtrArray tests (Alex Eftimie) +* [gi-invoke-ng] fix array element offset calculations (John (J5) Palmieri) +* [gi] don't clean up arguments that weren't yet processed during in arg failure (John (J5) Palmieri) +* [gi-overrides] use new instead of init when constructing a GLib.VariantBuilder (John (J5) Palmieri) +* [gi-invoke-ng] actual code to import overrides (John (J5) Palmieri) +* [gi-invoke-ng] import pytypes so we get overrides (John (J5) Palmieri) +* [gi-invoke-ng] handle gvariants now that they are not foreign (John (J5) Palmieri) +* [gi-invoke-ng] do not try to clean up NULL arguments (John (J5) Palmieri) +* Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) +* Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) +* closure: avoid double free crash (Ignacio Casal Quinteiro) +* Added __eq__ method for Gdk.Color and Gdk.RGBA (Jason Siefken) +* closure: Check the out arg is not null. Fixes bug :bzbug:`651812` (Ignacio Casal Quinteiro) +* Use constants instead of literals (Tomeu Vizoso) +* GVariant has now a GType, take that into account (Tomeu Vizoso) +* GVariantType is a boxed struct (Tomeu Vizoso) +* Use _gi.Struct to wrap fundamentals (Tomeu Vizoso) +* Merge gi/HACKING into /HACKING (Tomeu Vizoso) +* Fix GC-related crash during PyGObject deallocation (Daniel Drake) +* [gi-invoke-ng] enable invoke-ng by default (John (J5) Palmieri) +* [gi-invoke-ng] add code to clean up when input values fail to marshal (John (J5) Palmieri) +* [gi-invoke-ng] add hash cleanup routines (John (J5) Palmieri) +* [gi-invoke-ng] handle arrays with transfers of GI_TRANSFER_CONTAINER (John (J5) Palmieri) +* [gi-invoke-ng] add list cleanup routines (John (J5) Palmieri) +* indentation fix (John (J5) Palmieri) +* [gi-invoke-ng] add out array cleanup (John (J5) Palmieri) +* [gi-invoke-ng] do not allocate null terminator for garray (John (J5) Palmieri) +* [gi-invoke-ng] add array cleanup for in arrays (John (J5) Palmieri) +* [gi-invoke-ng] remove remaining bits of the invoke stage state machine (John (J5) Palmieri) +* [gi-invoke-ng] revamp cleanup framework to be orthogonal to cache setup (John (J5) Palmieri) +* [gi-invoke-ng] stub out a cleaner way of cleaning up after ourselves (John (J5) Palmieri) +* Doc Extractor: Correct the logic of the --no-since option. (José Alburquerque) +* Doc Extractor: Add a --no-since option. (José Alburquerque) +* [gi-invoke-ng] tweek cleanup routines (John (J5) Palmieri) +* Fix symbol names to be locale independent (Martin Pitt) +* [gi] pygi-convert.sh: Convert gtk.gdk.CROSSHAIR (Martin Pitt) +* [gi-invoke-ng] handle filename cleanup with the utf8 cleanup function (John (J5) Palmieri) +* [gi-invoke-ng] handle caller allocates cleanup (John (J5) Palmieri) +* [gi-invoke-ng] refactor the cleanup code and add utf8 cleanup as initial test (John (J5) Palmieri) +* use PyCapsule when importing pycairo/require pycairo 1.10.0 for python3 builds (John (J5) Palmieri) +* [python3] fix build. PYcairo_IMPORT doesn't exists anymore (Ignacio Casal Quinteiro) +* Updated DOAP file (Sebastian Pölsterl) +* [gi] Don't create variant twice (Sebastian Pölsterl) +* pygi-convert.sh: Make sure the uppercase GObject module is imported instead of the lowercase (Sebastian Pölsterl) +* [gi] Removed hack to avoid using GLib.Variant.new_variant. (Sebastian Pölsterl) +* [gi] Added additional test case for GVariant handling (Sebastian Pölsterl) +* [gi] Added support for GVariant arguments (Sebastian Pölsterl) +* fix static ABI for setting string gvalues from python objects (John (J5) Palmieri) +* dsextras.py: ensure eol characters are preserved when writing template files (so \n does not become \r\n) (Dieter Verfaillie) +* dsextras.py: remove \r as wel as \n character (Dieter Verfaillie) +* use PyCapsule when importing pycairo/require pycairo 1.10.0 for python3 builds (John (J5) Palmieri) +* [python3] fix build. PYcairo_IMPORT doesn't exists anymore (Ignacio Casal Quinteiro) +* Updated DOAP file (Sebastian Pölsterl) +* [gi] Don't create variant twice (Sebastian Pölsterl) +* pygi-convert.sh: Make sure the uppercase GObject module is imported instead of the lowercase (Sebastian Pölsterl) +* [gi] Removed hack to avoid using GLib.Variant.new_variant. (Sebastian Pölsterl) +* [gi] Added additional test case for GVariant handling (Sebastian Pölsterl) +* [gi-invoke-ng] fix prototype (John (J5) Palmieri) +* [gi-invoke-ng] create new framework for cleaning up args (John (J5) Palmieri) +* [gi] Added support for GVariant arguments (Sebastian Pölsterl) +* [gi-invoke-ng] fix marshal header that is no longer part of pygi-arguments.h (John (J5) Palmieri) +* [gi-invoke-ng] code style space fixes (John (J5) Palmieri) +* [gi-invoke-ng] don't decref value taken from a dict as it is borrowed (John (J5) Palmieri) +* [gi-invoke-ng] return None when appropriate so we don't crash (John (J5) Palmieri) +* [gi-invoke-ng] fix aux value caching (John (J5) Palmieri) +* [gi-invoke-ng] backport handling flags with no gtype (John (J5) Palmieri) +* [gi-invoke-ng] backport raw gvalue handling (John (J5) Palmieri) +* [gi-invoke-ng] marshal instances seperately since they differ slightly from other args (John (J5) Palmieri) +* [gi-invoke-ng] refactor FunctionCache to be more generic CallableCache (John (J5) Palmieri) +* [gi-invoke-rewrite] backport glib error handling (John (J5) Palmieri) +* [gi-invoke-ng] backport closure passing from invoke (John (J5) Palmieri) +* [gi-invoke-ng] handle vfuncs and fix cosntrutors (John (J5) Palmieri) +* [gi-invoke-ng] handle foreign types correctly (John (J5) Palmieri) +* [gi] remove the class parameter from the argument list of constructors (John (J5) Palmieri) +* fix static ABI for setting string gvalues from python objects (John (J5) Palmieri) +* dsextras.py: ensure eol characters are preserved when writing template files (so \n does not become \r\n) (Dieter Verfaillie) +* dsextras.py: remove \r as wel as \n character (Dieter Verfaillie) +* [gi] make new invoke-ng codepath compile correctly (John (J5) Palmieri) +* [gi] conditionalize invoke code paths (John (J5) Palmieri) +* [gi] revert back to the type.py from master (John (J5) Palmieri) +* [gi] revert pygi-argument.h and move the invoke-ng code to pygi-marshal.h (John (J5) Palmieri) +* Merge branch 'master' into invoke-rewrite (John (J5) Palmieri) +* [gi] foreign types now take interface infos instead of type infos (John (J5) Palmieri) +* Fix GSchema tests for separate build tree (Martin Pitt) +* [gi] start of merge from master (John (J5) Palmieri) +* [gi] marshal raw closures (John (J5) Palmieri) +* pygi-convert.sh add GObject.xxx and webkit (John Stowers) +* pygi-convert.sh remove gobject tests, GObject works now (John Stowers) +* [gi-demos] add pickers demo (John (J5) Palmieri) +* [gi-demos] add menu demo (John (J5) Palmieri) +* [gi-overrides] fix exception block so it works in Python 2.5 (John (J5) Palmieri) +* Revert "Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES" (Martin Pitt) +* setup.py: fix user_access_control option (Dieter Verfaillie) +* [gi] Respect the MessageType for Gtk.MessageDialog (Martin Pitt) +* [gi] Do not require signature for D-BUS methods without arguments (Martin Pitt) +* [gi-overrides] TreeViewColumn.set_cell_data_func func_data can be None (John Stowers) +* [gi-demos] dont try and run demos that represent directories (John Stowers) +* [gi-demos] some python 3 compat fixes (John (J5) Palmieri) +* [gi-demos] add liststore demo (John (J5) Palmieri) +* [gi-demos] catch the correct error class (John (J5) Palmieri) +* Do not leak python references when using the gobject.property() helper. (Steve Frécinaux) +* handle uchar as bytes, not strings in python 3 (John (J5) Palmieri) +* [gi-overrides] handle unichar gvalues when setting treemodels (John (J5) Palmieri) +* [gi-overrides] special case python 2 keywords that crept in (John (J5) Palmieri) +* check for the py3 _thread module in configure.ac if thread is not found (John (J5) Palmieri) +* [gi-demos] add iconview demo (John (J5) Palmieri) +* [gi] wrap the keyword argument in a dict so we don't break Python 2.5 (John (J5) Palmieri) +* [gi-demos] add the combobox with string ids section to the demos (John (J5) Palmieri) +* [gi-overrides] add an override for Gdk.RGBA (John (J5) Palmieri) +* [gi-demos] fix up search-entry to reflect annotations fixed in Gtk+ master (John (J5) Palmieri) +* [gi-demos] add search entry demo (John (J5) Palmieri) +* [gi] wrap map in a list for Python 3 compat (John (J5) Palmieri) +* [gi-demos] fix up the validation combobox (John (J5) Palmieri) +* add overridesdir variable in the .pc file for 3rd party overrides (John (J5) Palmieri) +* setup.py: Set bdist_wininst user-access-control property (Dieter Verfaillie) +* Fix uninitialized variable in gi.require_version() (Martin Pitt) +* Run tests with LC_MESSAGES="C" (Martin Pitt) +* [gi-overrides] override Gtk.stock_lookup to not return success (John (J5) Palmieri) + +2.28.6 - 2011-06-11 +------------------- + +* closure: avoid double free crash (Ignacio Casal Quinteiro) +* [gi] backport of "GVariant has a GType" fe386a (John (J5) Palmieri) +* [gi] fixes to backport commit 6b5a65 - in older glib GVariants are still structs (John (J5) Palmieri) +* GVariantType is a boxed struct (Tomeu Vizoso) +* Use _gi.Struct to wrap fundamentals (Tomeu Vizoso) +* Added __eq__ method for Gdk.Color and Gdk.RGBA (Jason Siefken) +* Remove useless import (Ignacio Casal Quinteiro) +* Revert "[gi] Removed hack to avoid using GLib.Variant.new_variant." (Ignacio Casal Quinteiro) +* closure: Check the out arg is not null. Fixes bug :bzbug:`651812` (Ignacio Casal Quinteiro) +* Fix GC-related crash during PyGObject deallocation (Daniel Drake) +* Fix symbol names to be locale independent (Martin Pitt) +* Updated DOAP file (Sebastian Pölsterl) + +2.28.4 - 2011-04-18 +------------------- + +* Version bump to 2.24.4 (Sebastian Pölsterl) +* [gi] Don't create variant twice (Sebastian Pölsterl) +* pygi-convert.sh: Make sure the uppercase GObject module is imported instead of the lowercase (Sebastian Pölsterl) +* [gi] Removed hack to avoid using GLib.Variant.new_variant. (Sebastian Pölsterl) +* [gi] Added additional test case for GVariant handling (Sebastian Pölsterl) +* [gi] Added support for GVariant arguments (Sebastian Pölsterl) +* Fix ABI break in old static bindings. (Steve Frécinaux) +* fetch size from an enum type (Mike Gorse) +* dsextras.py: ensure eol characters are preserved when writing template files (so \n does not become \r\n) (Dieter Verfaillie) + +2.28.3 - 2011-03-23 +------------------- + +* fix a typo when converting objects to strings gvalues (John (J5) Palmieri) + +2.28.2 - 2011-03-22 +------------------- + +* fix static ABI for setting string gvalues from python objects (John (J5) Palmieri) +* Fix GSchema tests for separate build tree (Martin Pitt) +* GIO tests: Fix remaining test case for separate build tree (Martin Pit +* GIO tests: Fix for separate build tree (Martin Pitt) + +2.28.1 - 2011-03-21 +------------------- + +* pygi-convert.sh remove gobject tests, GObject works now (John Stowers) +* pygi-convert.sh add GObject.xxx and webkit (John Stowers) +* [gi] marshal raw closures (John (J5) Palmieri) +* Revert "Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES" (Martin Pitt) +* setup.py: fix user_access_control option (Dieter Verfaillie) +* [gi-overrides] fix marshalling pygobjects in treemodels (John (J5) Palmieri) +* [gi] Respect the MessageType for Gtk.MessageDialog (Martin Pitt) +* [gi] Do not require signature for D-BUS methods without arguments (Martin Pitt) +* [gi-demos] add pickers demo (John (J5) Palmieri) +* [gi-demos] add menu demo (John (J5) Palmieri) +* [gi-overrides] TreeViewColumn.set_cell_data_func func_data can be None +* [gi-demos] dont try and run demos that represent directories (John Stowers) +* [gi-overrides] fix exception block so it works in Python 2.5 (John (J5) Palmieri) + +2.28.0 - 2011-03-08 +------------------- + +* [gi-demos] some python 3 compat fixes (John (J5) Palmieri) +* [gi-demos] catch the correct error class (John (J5) Palmieri) +* Try not to sink objects returned by C functions. (Steve Frécinaux) +* Do not leak python references when using the gobject.property() helper. (Steve Frécinaux) +* [gi] fix try except blocks so they work in Python 2.5 (John (J5) Palmieri) +* handle uchar as bytes, not strings in python 3 (John (J5) Palmieri) +* [gi-overrides] handle unichar gvalues when setting treemodels (John (J5) Palmieri) +* [gi-overrides] special case python 2 keywords that crept in (John (J5) Palmieri) +* check for the py3 _thread module in configure.ac if thread is not found (John (J5) Palmieri) +* [gi-demos] add iconview demo (John (J5) Palmieri) +* [gi] wrap the keyword argument in a dict so we don't break Python 2.5 (John (J5) Palmieri) +* [gi-demos] add the combobox with string ids section to the demos (John (J5) Palmieri) +* [gi-overrides] add an override for Gdk.RGBA (John (J5) Palmieri) +* [gi-demos] fix up search-entry to reflect annotations fixed in Gtk+ master (John (J5) Palmieri) +* [gi-demos] add search entry demo (John (J5) Palmieri) +* [gi] wrap map in a list for Python 3 compat (John (J5) Palmieri) +* [gi-demos] fix up the validation combobox (John (J5) Palmieri) +* add overridesdir variable in the .pc file for 3rd party overrides (John (J5) Palmieri) +* [gi] remove unref for closures since they are floating objects that get sunk (John (J5) Palmieri) +* setup.py: Set bdist_wininst user-access-control property (Dieter Verfaillie) +* Fix uninitialized variable in gi.require_version() (Martin Pitt) +* Run tests with LC_MESSAGES="C" (Martin Pitt) +* [gi-overrides] override Gtk.stock_lookup to not return success (John (J5) Palmieri) + +2.27.91 - 2011-02-28 (2.28 pre-release) +--------------------------------------- + +* [gi-tests] use Gdk.test_simulate_button instead of emitting event ourselves (John (J5) Palmieri) +* [gi-tests] tests for EventButton override. (Laszlo Pandy) +* Skip interfaces when checking for conflicts in the MRO (Tomeu Vizoso) +* [gi-overrides] Add event methods to all event union members (John (J5) Palmieri) +* [gi] check to see if object is a member of a union when validating paramaters (John (J5) Palmieri) +* [gi] Remove DyanmicModule.load() to _load() to prevent overriding GI attrs. (Laszlo Pandy) +* Test case with John's fix for crash with C arrays and a GError is set. (Laszlo Pandy) +* [gi-overrides] fix setting rows in treeview to accept None as a value (John (J5) Palmieri) +* [gi] Add value_name for enum and flags from introspection "c:identifier" (if attr is available). (Laszlo Pandy) +* Don't force loading of DynamicModule until set in sys.modules (Laszlo Pandy) +* Fix flags with multiple names for the same value. (Laszlo Pandy) +* [gi-demos] add liststore demo (John (J5) Palmieri) +* [gi-demos] run through the demos and remove the FIXMEs that have been fixed (John (J5) Palmieri) +* Load typelibs at import time, add gi.require_version() (Tomeu Vizoso) +* use GValue support to marshal GtkTreeModel values correctly (John (J5) Palmieri) +* [gi] pass raw GValues instead of trying to marshal them (John (J5) Palmieri) +* [gi-demos] add icon view edit and drag-and-drop demo (John (J5) Palmieri) +* [gi] Register GType for non-GType enums and flags at runtime. (Laszlo Pandy) +* [gi-demos] add info bars demo (John (J5) Palmieri) +* tests/runtests.py: Add missing "import sys" (Martin Pitt) +* [gi] Add Pythonic gdbus method invocation (Martin Pitt) +* Skip GError out parameters in Python closure. (Laszlo Pandy) +* [gi-demos] added rotate text demo (John (J5) Palmieri) +* [gi-demos] add images demo (John (J5) Palmieri) +* [gi-demos] add pixbuf demo (John (J5) Palmieri) +* [gi-demos] remove fixmes from print demo, fixed in pango (John (J5) Palmieri) +* [gi-demos] add printing demo (John (J5) Palmieri) +* [gi-overrides] add cursor overrides (John (J5) Palmieri) +* [gi-demos] add the links demo (John (J5) Palmieri) +* [gi-demos] add expander demo (John (J5) Palmieri) +* [gi-overrides] use pop instead of del and add extra tests for Gtk.Table kwargs (John (J5) Palmieri) +* [tests] Separate processes for GI and static binding tests. (Laszlo Pandy) +* [GI] Remove implicit loading of gi module preserve the code path for static bindings. (Laszlo Pandy) +* [gi-demos] add dialogs demo (John (J5) Palmieri) +* [gi-overrides] fix typo in GtkTable constructor (John (J5) Palmieri) +* [gi-demos] keep popup menu from destroying itself by holding a ref in app class (John (J5) Palmieri) +* [gi-overrides] add a Gtk.Menu override for the popup method (John (J5) Palmieri) +* [gi-demos] fix the about dialog in appwindow demo (John (J5) Palmieri) +* [gi-demos] fix clipboard demo so DnD works (John (J5) Palmieri) +* [gi-demos] fix clipboard demo to reflect new API (John (J5) Palmieri) +* [gi-demo] Fix color dialog demo to run with new draw, style and color apis (John (J5) Palmieri) +* [gi-demos] fix most of the combobox app (John (J5) Palmieri) +* Use PyGI type conversion (to fix foreign types) for signal callbacks. (Laszlo Pandy) +* [gi-demos] fix drawingarea app to use the new draw api (John (J5) Palmieri) +* [gi-overrides] for Gtk 3 alias Gdk.Rectangle to cairo.RectangleInt (John (J5) Palmieri) +* [gi-overrides] let user set the proper property names in Gtk.Table (John (J5) Palmieri) +* [gi-demos] get appwindow demo working again (John (J5) Palmieri) +* [gi-demos] fixed use of tree_iter_get (John (J5) Palmieri) + +2.27.90 - 2011-02-11 (2.28 pre-release) +--------------------------------------- + +* fix build to correctly use python-config (John (J5) Palmieri) +* Run gio tests separately when enabled (Martin Pitt) +* Revert "Remove gio static bindings" (Martin Pitt) +* Decrease the refcount for GInitiallyUnowned constructors. (Steve Frécinaux) +* Ensure the sink functions are only ran once. (Steve Frécinaux) +* Revert "Fix wrong refcount when calling introspected widget constructors" (Steve Frécinaux) +* Revert "Fix reference leaks for GInitiallyUnowned objects" (Steve Frécinaux) +* Run test suite under dbus-launch (Martin Pitt) +* Fix test_gdbus.py to be Python3 friendly (Martin Pitt) +* [gi] Provide comfortable GSettings API (Martin Pitt) +* Fix vfunc search bug when using GInterfaces and a do_* method. (Laszlo Pandy) +* [GI] Add tests for Gtk.Widget.drag_* methods. (Laszlo Pandy) +* [python 3] use the right syntaxis to raise exceptions (Ignacio Casal Quinteiro) +* [gi] return PYGLIB_MODULE_ERROR_RETURN on error and use pygobject_init (Ignacio Casal Quinteiro) +* [gi] return PYGLIB_MODULE_ERROR_RETURN on error (Ignacio Casal Quinteiro) +* Fix wrong refcount when calling introspected widget constructors (Steve Frécinaux) +* Gdk.Window: Map the standard constructor to the *new* constructor (Simon Schampijer) +* Ship tests/org.gnome.test.gschema.xml in dist tarballs (Martin Pitt) +* [gi] Add GSettings tests (Martin Pitt) +* [gi] Provide GtkTextBuffer.insert_with_tags_by_name() (Martin Pitt) +* [gi] Support tag names in GtkTextBuffer.insert_with_tags() (Martin Pitt) +* Add MAINTAINERCLEANFILES (Ignacio Casal Quinteiro) +* Remove .gitignore files and use git.mk (Ignacio Casal Quinteiro) +* pygi-convert.sh: Convert Pango.TabAlign.* (Martin Pitt) +* pygi-convert.sh: Drop window -> get_window() conversion (Martin Pitt) +* pygi-convert.sh: Don't convert self.window assignments (Martin Pitt) +* Fix leaked python reference in python-defined subclasses (Steve Frécinaux) +* Add some tests for the number of python refs held at creation time (Steve Frécinaux) +* Factor out parameter marshalling from construction functions. (Steve Frécinaux) +* [gi] in python 3 an array of uint8 can be bytes but not string (John (J5) Palmieri) +* [gi] fix Gio.FileEnumerator to reflect the Python 3 iter protocol (John (J5) Palmieri) +* [gi] python 3 fixes (John (J5) Palmieri) +* [gi] fix try/except blocks using depricated raise format (John (J5) Palmieri) +* [gi] Add docstring to GLib.Variant constructor (Martin Pitt) +* [gi] update gdbus test cases for previous GVariant change (Martin Pitt) +* [gi] Accept only a single object in GLib.Variant constructor (Martin Pitt) +* Speed up _setup_native_vfuncs() (Laszlo Pandy) +* Speed up class creation: rewrite _setup_vfuncs() to be much more efficient. (Laszlo Pandy) +* pygi-convert.sh: Convert gtk.UI_MANAGER_* (Sebastian Pölsterl) +* pygi-convert.sh: Convert gdk.GRAB_* (Sebastian Pölsterl) +* [gi] set the gtype GValue correctly (Ignacio Casal Quinteiro) +* [gi] use the right argument type for callback (Ignacio Casal Quinteiro) +* [gi] Add test cases for GDBus client operations (Martin Pitt) +* [gi] Add Variant construction/unpack support for boxed Variants (Martin Pitt) +* Merge branch 'windows-setup-fixes' (Dieter Verfaillie) +* pygi-convert.sh: GdkPixbuf methods (Thomas Hindoe Paaboel Andersen) +* pygi-convert.sh: Gdk.COLORSPACE_RGB (Thomas Hindoe Paaboel Andersen) +* [gi] Support nested objects and empty sequences in GLib.Variant building (Martin Pitt) +* Uncomment test_gi.TestInterfaceClash (Tomeu Vizoso) +* Fix reference leaks for GInitiallyUnowned objects (Steve Frécinaux) +* Add tests for refcount of a GObject owned by a library (Steve Frécinaux) +* Add a test to check for regular object reference count (Steve Frécinaux) +* [gi] Update TreeView.enable_model_drag_{source,dest} to current GTK (Martin Pitt) +* Fix a typo in a private symbol name. (Steve Frécinaux) +* pygi-convert.sh: Convert glib.source_remove() (Martin Pitt) +* Fix typo in previous commit to actually convert glib.GError (Martin Pitt) +* pygi-convert.sh: Move some glib bits which are better handled by gobject (Martin Pitt) +* Modify override for Gtk.Adjustment to allow position or keyword arguments in __init__(). (Laszlo Pandy) +* [gi] Fix small typo in previous commit (Martin Pitt) +* [gi] Add pythonic iterator and indexing for string GVariants (Martin Pitt) +* Construct structs using default API constructor (Tomeu Vizoso) +* pygi-convert.sh: Migrate Gdk.Cursor constructor, and some cursor names (Martin Pitt) +* pygi-convert.sh: Handle .window attributes (Martin Pitt) +* Also deal with foreign boxed structs (Tomeu Vizoso) +* [gi] Convert GErrors to GObject.GError exceptions, and throw them upon returning from calling the C function. (Laszlo Pandy) +* pygi-convert.sh: Don't convert glib -> GLib for now (Martin Pitt) +* Link libregress.so to GIO_LIBS again (Tomeu Vizoso) +* Fix attributes 2BUTTON_PRESS and 3BUTTON_PRESS of Gdk.EventType. (Laszlo Pandy) +* [gi] Fixed typo in exception (Sebastian Pölsterl) +* [gi] Enable handling of Gdk.EventType.2BUTTON_PRESS and 3BUTTON_PRESS (Sebastian Pölsterl) +* Revert "Fix Pango FontDescription override" (Martin Pitt) +* Python iterator interface support for GFileEnumerator. (Tony Young) +* Remove gio static bindings (Tomeu Vizoso) +* [gi] set length when marshalling guint8 erases (Ignacio Casal Quinteiro) +* Convert Gdk.Pixbuf to GdkPixbuf.Pixbuf (Sebastian Pölsterl) +* Disable calls to PyGILState_* when threads are disabled (Arnaud Charlet) +* pygi-convert.sh: Do not comment out set_cell_data_func() calls; these should be ported properly (Martin Pitt) +* pygi-convert.sh: Fix match for adding missing imports (Martin Pitt) +* pygi-convert.sh: Fix Gtk.Label handling to be idempotent (Martin Pitt) +* Remove trailing whitespace from gi/overrides/Gtk.py (Laszlo Pandy) +* Fix Pango FontDescription override (Martin Pitt) +* tests: Respect existing $GI_TYPELIB_PATH (Martin Pitt) +* Merge branch 'value' (Sebastian Pölsterl) +* GTK overrides: Do type conversion to column types of ListStore and TreeStore in set_value (Sebastian Pölsterl) +* Always register a new GType when a GObject class is subclassed (Steve Frécinaux) +* Raise required versions of GLib and GObject-Introspection (Simon van der Linden) +* pygi-convert.sh: Handle keysyms (Martin Pitt) +* GLib overrides: Add test case for array variant building (Martin Pitt) +* Remove cairo.RectangleInt from the foreign module (Tomeu Vizoso) +* Dont try to guess the transfer if its a boxed (Tomeu Vizoso) +* The tags can be Empty not None. (Ignacio Casal Quinteiro) +* Add Pythonic iterators and indexing to GVariant (Martin Pitt) +* Add GLib.Variant.unpack() (Martin Pitt) +* Add override for gtk_text_buffer_insert_with_tags (Ignacio Casal Quinteiro) +* Deduce PYTHON_LIBS in addition to PYTHON_INCLUDES (Simon van der Linden) +* Kill JD_CHECK_PYTHON_HEADERS (Simon van der Linden) +* Revert "Override Gtk.Box.pack_start and pack_end to set default values to be compliant with pygtk" (Sebastian Pölsterl) +* Revert "Override Gtk.CellLayout.pack_start and pack_end to add default values to be compliant with pygtk" (Sebastian Pölsterl) +* Revert "Override Gtk.TreeViewColumn.pack_start, pack_end and set_cell_data_func to add default values to be compliant with pygtk" (Sebastian Pölsterl) +* pygi-convert.sh: Handle gtk.combo_box_new_text() (Martin Pitt) +* Override TreeSortable.set_sort_func and set_default_sort_func to add default values to be pygtk compliant (Sebastian Pölsterl) +* Override Gtk.TreeViewColumn.pack_start, pack_end and set_cell_data_func to add default values to be compliant with pygtk (Sebastian Pölsterl) +* Override Gtk.CellLayout.pack_start and pack_end to add default values to be compliant with pygtk (Sebastian Pölsterl) +* Override Gtk.Paned pack1 and pack2 to add default values to be compliant with pygtk (Sebastian Pölsterl) +* Override Gtk.Box.pack_start and pack_end to set default values to be compliant with pygtk (Sebastian Pölsterl) +* Handle GObject subclasses in the property helper. (Steve Frécinaux) +* Fix handling of unicode for GtkTreeModels (Martin Pitt) +* In IntrospectionModule and DynamicModule classes, make all instance attributes start with an underscore. (Laszlo Pandy) +* Amend previous enum wrapping commit to remove redundant setting of __info__ attribute. (Laszlo Pandy) +* pygi-convert.sh: Handle GdkPixbuf.InterpType (Martin Pitt) +* Fix wrapping of enums: Create new Python type for each non-gtype enum. (Laszlo Pandy) +* Use g_vfunc_info_invoke for chaining up in vfuncs (Tomeu Vizoso) +* Move pyglib_{main_context, option_context, option_group}_new into _PyGLib_API (Simon van der Linden) +* pygi-convert.sh: Handle Gdk.DragAction (Martin Pitt) +* pygi-convert.sh: Generalize Gtk.Settings migration (Martin Pitt) +* pygi-convert.sh: Don't change the name of "glib" submodules (Martin Pitt) +* Plug another memory leak (Paolo Borelli) +* Plug a small memory leak. (Paolo Borelli) +* Override Table.attach() to behave like pygtk (Paolo Borelli) +* pygi-convert.sh: Convert Pango.WrapMode (Martin Pitt) +* pygi-convert.sh: Don't change the name of "gtk" submodules (Martin Pitt) +* Fix the __dir__() methods on DynamicModule and IntrospectionModule (Laszlo Pandy) +* pygi-convert.sh: handle ReliefStyle (Paolo Borelli) +* setup.py: fix the provides keyword argument (Dieter Verfaillie) +* setup.py: use the same spaces-less format for all setup() parameters (Dieter Verfaillie) +* Add a __repr__() method to DynamicModule. (Laszlo Pandy) +* Go back to using getattr() in DynamicModule.__getattr__ (Tomeu Vizoso) +* Change __dir__() to report all the attributes that __getattr__ supports (Laszlo Pandy) +* Bump the minimum gio dependency (Emilio Pozuelo Monfort) +* Add test for incorrect attributes in Gdk.Event (Tomeu Vizoso) +* Don't call getattr again in gi.overrides.Gdk.Event.__getattr__ (Simon van der Linden) +* Release allocated array of arguments when handling closures (Mike Gorse) +* Release GIValueInfo when checking an enum argument (Mike Gorse) +* Respect different type lengths when assigning out-argument pointers. (Eitan Isaacson) +* Fix stupid name clash (Tomeu Vizoso) +* Add /usr/share to XDG_DATA_DIRS when running the tests (Tomeu Vizoso) +* Comment out tests that require SRV lookups (Tomeu Vizoso) +* Use suppresion file when running valgrind (Tomeu Vizoso) +* Fix warnings. (Ignacio Casal Quinteiro) +* Allow comparing Gtk.TreePath to None (Jesse van den Kieboom) +* handle unicode objects in properties (John (J5) Palmieri) +* dsextras.py: check if gcc is there when platform is win32 and compiler is mingw32 (Dieter Verfaillie) +* dsextras.py: be consistent in how distutils imports are done (Dieter Verfaillie) +* dsextras.py: add have_gcc() function (Dieter Verfaillie) +* dsextras.py: use distutils.spawn.find_executable for have_pkgconfig() (Dieter Verfaillie) +* setup.py: fix another case of use True/False instead of 1/0 (Dieter Verfaillie) +* pygi-convert.sh: improve GtkSourceView conversion (Paolo Borelli) +* pygi-convert.sh: Gtk.DialogFlags conversion (Paolo Borelli) +* Doc Extractor: Print the gtk-doc blocks sorted by function name. (José Alburquerque) +* pygi-convert.sh: add more Gtk conversions and sort (Paolo Borelli) +* pygi-convert.sh: convert Atk (Paolo Borelli) +* pygi-convert.sh: convert a few more Gio types (Paolo Borelli) +* pygi-convert.sh: more GLib conversion (Paolo Borelli) +* pygi-convert.sh: remove two cases handled by overrides (Paolo Borelli) +* Override Gtk.ScrolledWindow constructor (Paolo Borelli) +* pygi-convert.sh: Fix 'find' syntax (Paolo Borelli) +* pygi-convert.sh: start handling Gio and GLib (Paolo Borelli) +* pygi-convert.sh: convert Gdk.ScrollDirection. (Paolo Borelli) +* Override Pango.Layout constructor. (Paolo Borelli) +* Remove Pango.FontDescription() conversion. (Paolo Borelli) +* Override GtkAction and GtkRadioAction constructors. (Paolo Borelli) +* Override Adjustment constructor to behave like pygtk (Dmitrijs Ledkovs) +* add secondary_text apis to MessageDialog (John (J5) Palmieri) +* [gi] get rid of some debug prints and fix error messages (John (J5) Palmieri) +* Fix demo for override changes. (Paolo Borelli) +* Override Pango.FontDescription. (Paolo Borelli) +* Stop checking that all vfuncs are implemented (Tomeu Vizoso) +* Fix usage of TreeIter api that is now an override. (Paolo Borelli) +* Fix Gtk.Label(label="Foo") (Paolo Borelli) +* Fix typo when raising an exception (Paolo Borelli) +* pygi-convert.sh: Added more conversions (Sebastian Pölsterl) +* Override LinkButton constructor to make 'uri' mandatory (Paolo Borelli) +* Container should be iterable. (Dmitry Morozov) +* No need to import Gdk (Paolo Borelli) +* Remove semicolumns (Paolo Borelli) +* [gi] make sure Gtk.Button override passes all keywords to parent constructor (John (J5) Palmieri) +* Fix cut&paste error in the Label override (Paolo Borelli) +* pygi-convert.sh: handle TextWindowType (Paolo Borelli) +* Override Label constructor to behave like pygtk (Paolo Borelli) +* Override GtkTable constructor to behave like pygtk (Paolo Borelli) +* pygi-convert.sh: convert MovementStep (Paolo Borelli) +* Update Gdk overrides to work with latest Gtk+ 3 (Paolo Borelli) +* Gtk: add an override for Gtk.main_quit (Johan Dahlin) +* [gi] handle subtypes when inserting into tree models (John (J5) Palmieri) +* Override TreeSelection.select_path and TreeView.scroll_to_cell (Paolo Borelli) +* Override TreePath.__new__ (Paolo Borelli) +* Override Container to behave like a sequence (Paolo Borelli) +* refactor Jonathan Matthew recurse vfunc patch so it applys and clean up a bit (John (J5) Palmieri) +* Recurse up through base classes when setting up vfuncs (Jonathan Matthew) +* add a profiling torture test for when we fix up invoke (John (J5) Palmieri) +* moved dynamic and base modules outside of gtk-2.0 directory (John (J5) Palmieri) +* add test for inout argument count (John (J5) Palmieri) +* [gi] add check for UNICHAR (John (J5) Palmieri) +* Support gunichar (Paolo Borelli) +* pygi-convert.sh: gtk.accel_map -> Gtk.AccelMap._ (Paolo Borelli) +* pygi-convert.sh: handle "from gtk import gdk" (Paolo Borelli) +* pygi-convert.sh: add some Pango special cases (Paolo Borelli) +* Override TextIter (begins|ends|toggles)_tag() (Paolo Borelli) +* Override TextBuffer.set_text() to make length optional (Paolo Borelli) +* Override TextBuffer.create_mark() (Paolo Borelli) +* Fix TextBuffer.get_selection_bounds() override (Paolo Borelli) +* [gi] fix ActionGroup constructor to allow other keyword properties to be set (John (J5) Palmieri) +* [gi] require the name parameter when creatin a Gtk.ActionGroup (John (J5) Palmieri) +* Override UIManager.insert_action_group (Paolo Borelli) +* Override TreeModel.get() to return a tuple (Paolo Borelli) +* Make TreeSelection.get_selected_rows compatible with PyGtk (Paolo Borelli) +* [gi] switch to using sequences/tuples when marshalling cairo_rectangle_int_t (John (J5) Palmieri) +* [gi] overrides for treeview Drag and Drop (John (J5) Palmieri) +* [gi] when encountering guint8 arrays treat them as byte arrays (John (J5) Palmieri) +* pygi-convert.sh: Add pynotify -> Notify (Martin Pitt) +* pygi-convert.sh: Remove sugar specifics, and allow command line file list (Martin Pitt) +* pygi-convert.sh: Cover Message and Buttons types (Martin Pitt) +* [gi] fix actiongroup test since actions are hashed (John (J5) Palmieri) +* [gi] when converting to UTF-8 accept Python Unicode objects as input (Python 2) (John (J5) Palmieri) +* Correct a bug in the freeing of memory in pygi-invoke.c. (Damien Caliste) +* update news for release (John (J5) Palmieri) +* Implement richcompare for GIBaseInfo (Jonathan Matthew) +* [gi] add the rectangle_int_t forign cairo type (John (J5) Palmieri) +* add a foreign type for cairo_rectangle_int_t and allow it to be caller-allocated (John (J5) Palmieri) +* [gi] add overrides to Gtk.Editable (John (J5) Palmieri) +* [gi] handle virtual invokers (John (J5) Palmieri) +* add overrides for the insert* apis of list_store and tree_store (John (J5) Palmieri) +* fix dialogs overrides which were relying on broken inheritance behavior (John (J5) Palmieri) +* Add a overrides registry so we can refrence overrides inside the module (John (J5) Palmieri) +* Merge remote branch 'dieterv/setup-fixes-for-merge' (John Stowers) +* setup.py: ease maintenance burden for tests installation (Dieter Verfaillie) +* fix inheritence issues in overrides (John (J5) Palmieri) +* tests: add runtests-windows.py script (Dieter Verfaillie) +* pygobject_postinstall.py: remove pygobject-2.0.pc treatment from postinstall as pkg-config on windows figures out the correct prefix at runtime (Dieter Verfaillie) +* pygobject_postinstall.py: remove shortcut creation (Dieter Verfaillie) +* setup.py: formatting cleanup, makes things readable (Dieter Verfaillie) +* setup.py: build and install tests (Dieter Verfaillie) +* setup.py: install documentation when available on build system (Dieter Verfaillie) +* setup.py: install pygobject-codegen script (Dieter Verfaillie) +* setup.py: install fixxref.py script (Dieter Verfaillie) +* setup.py: rearrange constants (Dieter Verfaillie) +* setup.py: check python version and pkgconig availability before anything else (Dieter Verfaillie) +* setup.py: simplify sys.platform != 'win32' detection and error reporting (Dieter Verfaillie) +* setup.py: rearrange imports (Dieter Verfaillie) +* README.win32: update build instructions (Dieter Verfaillie) +* dsextras.py: formatting cleanup, makes things readable (Dieter Verfaillie) +* dsextras.py: add ggc4 to MSVC compatible struct packing comment (Dieter Verfaillie) +* dsextras.py: use the ``pkgc_`` functions instead of repeating pgk-config incantations all over the place (Dieter Verfaillie) +* dsextras.py: add pkgc_get_version and pkgc_get_defs_dir functions (Dieter Verfaillie) +* dsextras.py: PEP8: Comparisons to singletons like None should always be done with 'is' or 'is not', never the equality operators. (Dieter Verfaillie) +* dsextras.py: use True/False instead of 1/0 (Dieter Verfaillie) +* dsextras.py: rearrange imports (Dieter Verfaillie) +* Add distutils generated build/dist directories and eclipse configuration files to .gitignore (Dieter Verfaillie) +* [gi] add tests for calling dir on a dynamic module (John (J5) Palmieri) +* [gi] dir() now works for modules (Deepankar Sharma) +* Don't check the inner type when comparing gpointers (Simón Pena) +* Release GIL when calling into C functions (John (J5) Palmieri) +* _gi.Repository : Implement missing info bindings. (José Aliste) +* include Python.h so that PY_VERSION_HEX gets defined (John (J5) Palmieri) +* [gi] make overrides work for python 3.x protocols and alias for python 2.x (John (J5) Palmieri) +* Override Gtk.Widget.translate_coordinates to not return success value (Sebastian Pölsterl) +* Override Gtk.TreeViewColumn.cell_get_position to not return success value (Sebastian Pölsterl) +* Override get_path_at_pos and get_dest_row_at_pos of Gtk.TreeView to not return success value (Sebastian Pölsterl) +* Override Gtk.TreeSortable.get_sort_column_id to not return success value (Sebastian Pölsterl) +* Override forward_search and backward_search of Gtk.TextIter to not return success value (Sebastian Pölsterl) +* Override Gtk.TextBuffer.get_selection_bounds to not return success value (Sebastian Pölsterl) +* Override Gtk.RecentInfo.get_application_info to not return success value (Sebastian Pölsterl) +* Override Gtk.IMContext.get_surrounding to not return success value (Sebastian Pölsterl) +* Override get_item_at_pos, get_visible_range, get_dest_item_at_pos of Gtk.IconView to not return success value (Sebastian Pölsterl) +* Override Gtk.Container.get_focus_chain to not return success value (Sebastian Pölsterl) +* Override Gtk.ComboBox.get_active_iter to not return success value (Sebastian Pölsterl) +* [gi] make parameter check less strict when dealing with GValue params (John (J5) Palmieri) +* Shortcut removal is not needed on post-uninstall (John Stowers) +* Disable shortcut creation in windows installer (John Stowers) +* overrides for all subclasses of dialog (John (J5) Palmieri) +* Make TreeModel behave like in GTK-2.x (Sebastian Pölsterl) +* Correctly build GIO on windows (John Stowers) +* Require Python >= 2.6.0 for Windows build (John Stowers) +* Fix depreciation warning in dsextras.py (John Stowers) +* Fix build on windows (John Stowers) +* Support for GCC4 in Windows distutils build - bug 626548 (Michael Culbertson) +* Remove obsolete comments in dsextras.py (John Stowers) +* Broken dsextras.py pkg-config check error message (John Stowers) +* add compat functions for the deprecated PyCObject api (John (J5) Palmieri) +* Add __path__ attributes. (Damien Caliste) +* Override Gtk.TreeSelection.get_selected to not return success value. (Sebastian Pölsterl) +* Make row optional in Gtk.TreeStore/ListStore.append override (Vincent Untz) +* Revert "add compat functions for the deprecated PyCObject api" (John (J5) Palmieri) +* return NULL instead of -1 which fixes crash when introspection is turned off (John (J5) Palmieri) +* add compat functions for the deprecated PyCObject api (John (J5) Palmieri) +* fix commit 7fe83108 which didn't use the compat functions for string handling (John (J5) Palmieri) +* Python 3 fixes for dsextras and the python.m4 distribution files (John (J5) Palmieri) + +2.27.0 - 2010-11-10 +------------------- + +* Implement richcompare for GIBaseInfo (Jonathan Matthew) +* [gi] add the rectangle_int_t forign cairo type (John (J5) Palmieri) +* add a foreign type for cairo_rectangle_int_t and allow it to be caller-allocated (John (J5) Palmieri) +* [gi] add overrides to Gtk.Editable (John (J5) Palmieri) +* [gi] handle virtual invokers (John (J5) Palmieri) +* add overrides for the insert* apis of list_store and tree_store (John (J5) Palmieri) +* fix dialogs overrides which were relying on broken inheritance behavior (John (J5) Palmieri) +* Add a overrides registry so we can refrence overrides inside the module (John (J5) Palmieri) +* Merge remote branch 'dieterv/setup-fixes-for-merge' (John Stowers) +* setup.py: ease maintenance burden for tests installation (Dieter Verfaillie) +* fix inheritence issues in overrides (John (J5) Palmieri) +* tests: add runtests-windows.py script (Dieter Verfaillie) +* pygobject_postinstall.py: remove pygobject-2.0.pc treatment from postinstall as pkg-config on windows figures out the correct prefix at runtime (Dieter Verfaillie) +* pygobject_postinstall.py: remove shortcut creation (Dieter Verfaillie) +* setup.py: formatting cleanup, makes things readable (Dieter Verfaillie) +* setup.py: build and install tests (Dieter Verfaillie) +* setup.py: install documentation when available on build system (Dieter Verfaillie) +* setup.py: install pygobject-codegen script (Dieter Verfaillie) +* setup.py: install fixxref.py script (Dieter Verfaillie) +* setup.py: rearrange constants (Dieter Verfaillie) +* setup.py: check python version and pkgconig availability before anything else (Dieter Verfaillie) +* setup.py: simplify sys.platform != 'win32' detection and error reporting (Dieter Verfaillie) +* setup.py: rearrange imports (Dieter Verfaillie) +* README.win32: update build instructions (Dieter Verfaillie) +* dsextras.py: formatting cleanup, makes things readable (Dieter Verfaillie) +* dsextras.py: add ggc4 to MSVC compatible struct packing comment (Dieter Verfaillie) +* dsextras.py: use the ``pkgc_`` functions instead of repeating pgk-config incantations all over the place (Dieter Verfaillie) +* dsextras.py: add pkgc_get_version and pkgc_get_defs_dir functions (Dieter Verfaillie) +* dsextras.py: PEP8: Comparisons to singletons like None should always be done with 'is' or 'is not', never the equality operators. (Dieter Verfaillie) +* dsextras.py: use True/False instead of 1/0 (Dieter Verfaillie) +* dsextras.py: rearrange imports (Dieter Verfaillie) +* Add distutils generated build/dist directories and eclipse configuration files to .gitignore (Dieter Verfaillie) +* [gi] add tests for calling dir on a dynamic module (John (J5) Palmieri) +* [gi] dir() now works for modules (Deepankar Sharma) +* Don't check the inner type when comparing gpointers (Simón Pena) +* Release GIL when calling into C functions (John (J5) Palmieri) +* _gi.Repository : Implement missing info bindings. (José Aliste) +* include Python.h so that PY_VERSION_HEX gets defined (John (J5) Palmieri) +* [gi] make overrides work for python 3.x protocols and alias for python 2.x (John (J5) Palmieri) +* Override Gtk.Widget.translate_coordinates to not return success value (Sebastian Pölsterl) +* Override Gtk.TreeViewColumn.cell_get_position to not return success value (Sebastian Pölsterl) +* Override get_path_at_pos and get_dest_row_at_pos of Gtk.TreeView to not return success value (Sebastian Pölsterl) +* Override Gtk.TreeSortable.get_sort_column_id to not return success value (Sebastian Pölsterl) +* Override forward_search and backward_search of Gtk.TextIter to not return success value (Sebastian Pölsterl) +* Override Gtk.TextBuffer.get_selection_bounds to not return success value (Sebastian Pölsterl) +* Override Gtk.RecentInfo.get_application_info to not return success value (Sebastian Pölsterl) +* Override Gtk.IMContext.get_surrounding to not return success value (Sebastian Pölsterl) +* Override get_item_at_pos, get_visible_range, get_dest_item_at_pos of Gtk.IconView to not return success value (Sebastian Pölsterl) +* Override Gtk.Container.get_focus_chain to not return success value (Sebastian Pölsterl) +* Override Gtk.ComboBox.get_active_iter to not return success value (Sebastian Pölsterl) +* [gi] make parameter check less strict when dealing with GValue params (John (J5) Palmieri) +* Shortcut removal is not needed on post-uninstall (John Stowers) +* Disable shortcut creation in windows installer (John Stowers) +* overrides for all subclasses of dialog (John (J5) Palmieri) +* Make TreeModel behave like in GTK-2.x (Sebastian Pölsterl) +* Correctly build GIO on windows (John Stowers) +* Require Python >= 2.6.0 for Windows build (John Stowers) +* Fix depreciation warning in dsextras.py (John Stowers) +* Fix build on windows (John Stowers) +* Support for GCC4 in Windows distutils build - bug 626548 (Michael Culbertson) +* Remove obsolete comments in dsextras.py (John Stowers) +* Broken dsextras.py pkg-config check error message (John Stowers) +* add compat functions for the deprecated PyCObject api (John (J5) Palmieri) +* Add __path__ attributes. (Damien Caliste) +* Override Gtk.TreeSelection.get_selected to not return success value. (Sebastian Pölsterl) +* Make row optional in Gtk.TreeStore/ListStore.append override (Vincent Untz) +* Revert "add compat functions for the deprecated PyCObject api" (John (J5) Palmieri) +* return NULL instead of -1 which fixes crash when introspection is turned off (John (J5) Palmieri) +* add compat functions for the deprecated PyCObject api (John (J5) Palmieri) +* fix commit 7fe83108 which didn't use the compat functions for string handling (John (J5) Palmieri) +* Python 3 fixes for dsextras and the python.m4 distribution files (John (J5) Palmieri) + +2.26.0 - 2010-09-24 +------------------- + +* Wrap g_get_system_{config,data}_dirs () (John Strowers) +* fixed make check and make dist (John (J5) Palmieri) +* Disable GI tests when introspection disabled (John Stowers) +* Wrap g_uri_list_extract_uris. Fixes bug :bzbug:`584431` (Tomeu Vizoso) +* Fix a few uses of TRUE and FALSE in the docs (Paul Bolle) +* pygi: always free the invocation_state struct (Damien Caliste) +* Start implementing something equivalent to g_variant_new (Tomeu Vizoso) +* fixed typo - missing comma in glib.option module (John (J5) Palmieri) +* add checks so we can compile under python 3 by setting PYTHON=python3 (John (J5) Palmieri) +* Rename static methods as functions (Tomeu Vizoso) +* fix a couple of compiler warnings (John (J5) Palmieri) +* remove unused code (John (J5) Palmieri) +* Check the type of the instance object (John (J5) Palmieri) +* include the correct pycairo version (John (J5) Palmieri) +* Use PyMapping_Keys to determine if an object is a dict (py3k fix) (John (J5) Palmieri) +* fix handling of UINT64 and INT64 arguments in py3k (John (J5) Palmieri) +* properly handle ulongs properties in py3k (John (J5) Palmieri) +* Specify encoding of tests/test_gi.py (Tomeu Vizoso) +* use actual unicode in the tests on py3k, not the byte representation (John (J5) Palmieri) +* s/METH_KEYWORDS/METH_VARARGS|METH_KEYWORDS/ when defining object methods (John (J5) Palmieri) +* fix subclassing PyLong by calling __new__ correctly (John (J5) Palmieri) +* minor py3k fixups for python modules (John (J5) Palmieri) +* minor fixes in tests for py3k compat (John (J5) Palmieri) +* compilation: Fix syntax error (Colin Walters) +* Add missing file (Tomeu Vizoso) +* Add override for GLib.Variant.new_tuple (Tomeu Vizoso) +* fix for changes in the gi test libraries (John (J5) Palmieri) +* Gtk.DialogFlags.NO_SEPARATOR has been removed in Gtk 3.0 (John (J5) Palmieri) +* no need to offset arg positions when is_method is true (John (J5) Palmieri) +* gi: Add support for more property types (Tomeu Vizoso) +* use PyObject_SetAttrString, not PyDict_SetItemString when setting __gtype__ (John (J5) Palmieri) +* Rename GArgument to GIArgument (Tomeu Vizoso) +* fix up tests so they run in py3k (John (J5) Palmieri) +* tests: Port to new introspection tests (Colin Walters) +* we need to specify tp_hash since we overide tp_richcompare (John (J5) Palmieri) +* working enum/flags/pid subclasses of long (John Ehresman) +* make vfuncs work in py3k (John (J5) Palmieri) +* make cairo module compile in py3k (John (J5) Palmieri) +* fix exceptions so they work in python 3.x (John (J5) Palmieri) +* make the gi module compile under 3.x (John (J5) Palmieri) +* fix up testshelper module so it compiles in python 3.x (John (J5) Palmieri) +* convert to using PYGLIB_DEFINE_TYPE for module objects (John (J5) Palmieri) +* some more p3k PyString and PyInt eradication in GI (John (J5) Palmieri) +* pyglib: Fix typo (Leo Singer) (Tomeu Vizoso) +* Add defines for size_t and ssize_t conversion functions (Gustavo Noronha Silva) +* pyglib: Fix a compiler warning (Colin Walters) +* Don't force gtk 2.0 (Tomeu Vizoso) +* Fix some ref leaks in hook_up_vfunc_implementation() (Steve Frécinaux) +* handle strings correctly in gio (John (J5) Palmieri) +* make giomodule compile under py3k (John (J5) Palmieri) +* for py3k we need to do some more processing to get bytes from a unicode string (John (J5) Palmieri) +* use Bytes instead of Unicode when reading io (John (J5) Palmieri) +* prefix compat macros with PYGLIB (John (J5) Palmieri) +* Gtk.Button unit tests (John (J5) Palmieri) +* [Gtk] Add overrides for Button (Johan Dahlin) +* Make Cairo an optional dependency (Simon van der Linden) +* Don't import again PyGObject (John Ralls) (Tomeu Vizoso) +* move to using richcompare slot instead of compare (John (J5) Palmieri) +* Replace autogen.sh by a newer version (Simon van der Linden) +* Fix some warnings (Simon van der Linden) +* Fix caller-allocates emergency free. (Simon van der Linden) +* Remove useless checks. (Simon van der Linden) +* Call valgrind with G_SLICE=always-malloc G_DEBUG=gc-friendly (Tomeu Vizoso) +* Fix some warnings. (Ignacio Casal Quinteiro) +* Add myself as a maintainer (Simon van der Linden) +* Properly allocate boxed structs that are (caller-allocates) (Tomeu Vizoso) +* override gdk.Event to return attribute from the proper event object (Toms Baugis) +* check if z# needs an int or Py_ssize_t (John (J5) Palmieri) +* make sure we parse parameters to python object vars not glib vars (John (J5) Palmieri) +* Make an example and a demo work out of the box (Paul Bolle) +* make sure caller allocated structs are freed when they go out of scope (John (J5) Palmieri) +* Revert "override gdk.Event to return attribute from the proper event object." (Tomeu Vizoso) +* PyGI: properly quit cairo-demo (Paul Bolle) +* override gdk.Event to return attribute from the proper event object. (Toms Baugis) +* Clean and improve the test infrastructure (Simon van der Linden) +* Add some more transformations to pygi-convert.sh (Tomeu Vizoso) +* Adapt to API changes: g_irepository_enumerate_versions (Tomeu Vizoso) +* Add GValue<->GArgument marshalling for some more types (Tomeu Vizoso) +* Chain up with the non-introspection implementation for properties if needed (Tomeu Vizoso) +* Improve error reporting for missing attributes in introspection modules (Tomeu Vizoso) +* Implement getting and setting properties using introspection information. (Tomeu Vizoso) +* Readd Gdk.Rectangle override for Gtk-2.0 (Tomeu Vizoso) +* Allow specifying a version when loading a typelib (Tomeu Vizoso) +* treat GFreeFunc as equivalent to GDestroyNotify when scanning callbacks (Jonathan Matthew) +* Don't use == to compare doubles, use <= and =>. (Simon van der Linden) +* Allow passing ints as enum args (Tomeu Vizoso) +* Make error message less ambiguous (Tomeu Vizoso) +* fix passing in type names as a GType and add gtype unit tests (John (J5) Palmieri) +* Increase a bit verbosity of tests so people know which test failed (Tomeu Vizoso) +* Actually add the files for GVariant foreign structs (Tomeu Vizoso) +* Add foreign struct support for GVariant (Tomeu Vizoso) + +2.21.5 - 2010-07-12 +------------------- + +* Shut up some compiler warnings (Florian Müllner) +* Adjust to API break in GObject-Introspection (Florian Müllner) +* pass in the demo app so demos can use utility methods like requesting file paths (John (J5) Palmieri) +* demo fixes to keep up with Gtk+ (John (J5) Palmieri) +* override test fixes for new GTK+ annotations (John (J5) Palmieri) +* Fix warning. (Ignacio Casal Quinteiro) +* fix up treeiter usage due to caller-allocates annotations in gtk+ (John (J5) Palmieri) +* add entry completion demo (John (J5) Palmieri) +* string changes (John (J5) Palmieri) +* add the Entry demo directory and the entry_buffer demo (John (J5) Palmieri) +* fix loading of demo modules to support sub modules (John (J5) Palmieri) +* add the ability to have demos in sub catagories (John (J5) Palmieri) +* Add __name__ to DynamicModule class. (Jose Aliste) +* Do not override GdkRectangle. (Ignacio Casal Quinteiro) +* Add override for TreeModel implementing __len__() (Philip Withnall) + +2.21.4 - 2010-06-29 +------------------- + +* Build the cairo shim as a python module so the _gi module stops linking to it (Tomeu Vizoso) +* add drawing area demo (John (J5) Palmieri) +* sort the demo list (John (J5) Palmieri) +* rename iter to treeiter so we aren't using a python reserved word (John (J5) Palmieri) +* Fixup for change in buffer API (John (J5) Palmieri) +* add ListStore, TreeStore and TreeViewColumn APIs (John (J5) Palmieri) +* Add unit test for add_actions user data. (Ignacio Casal Quinteiro) +* Pass user_data param when adding actions (Paolo Borelli) +* add an exception type to the try/except block (John (J5) Palmieri) +* return PyList instead of PyTuple for array, return empty list for NULL arrays (John (J5) Palmieri) +* Fix 'make distcheck' (Tomeu Vizoso) +* Allow building pygobject without introspection support by providing --disable-introspection to configure. (Tomeu Vizoso) +* Make sure that sys.argv is a list and not a sequence. (Tomeu Vizoso) +* Force loading the GObject typelib so we have available the wrappers for base classes such as GInitiallyUnowned. (Tomeu Vizoso) +* we shouldn't g_array_free NULL pointers (John (J5) Palmieri) +* remove unneeded TextIter creation in the tests (John (J5) Palmieri) +* add override for TextBuffer (John (J5) Palmieri) +* fix up some build issues (John (J5) Palmieri) +* make the overrides file git friendly by appending to __all__ after each override (John (J5) Palmieri) +* Override Dialog constructor and add_buttons method (Paolo Borelli) +* Merge PyGI (Johan Dahlin) + +2.21.3 - 2010-06-21 +------------------- + +* Proper handling of null-ok in virtual methods (Ludovic L'Hours) +* Fall back to use the floating references API in glib if there isn't a sinkfunc defined. (Tomeu Vizoso) +* Revert "Drop sinkfuncs." (Tomeu Vizoso) +* [giounix] Make it possible to compile on glib 2.20 (Johan Dahlin) +* Release the lock when potentially invoking Python code. (Sjoerd Simons) + +2.21.2 - 2010-06-10 +------------------- + +* Drop sinkfuncs. (Tomeu Vizoso) +* Clear error if we failed the import (Colin Walters) +* Added missing , to keyword list of gio.GFile.set_attribute (John Ehresman) +* Fix arg conversion in gio.GFile.set_attribute (John Ehresman) +* Set constants under python 2.5 or before (John Ehresman) +* Doc Extractor: Use replacements that make sense for &...; expressions. (José Alburquerque) +* Add build docs for windows (John Stowers) +* Setup.py cosmetic tidy (John Stowers) +* Fix crash when importing gio (John Stowers) +* Bug 589671 - Dont use generate-constants (John Stowers) +* Bug 589671 - Fix setup.py for windows build (John Stowers) +* Include pygsource.h (John Stowers) +* codegen/docextract_to_xml.py: One more &...; replacement ( ). (José Alburquerque) +* codegen/docextract_to_xml.py: Replace some &..; that cause errors. (José Alburquerque) +* codegen/docextract_to_xml.py: Handle C++ multi-line comments. (José Alburquerque) +* codegen/docextract.py: Stop final section processing on first match. (José Alburquerque) +* Update doc extraction tool to handle GObjectIntrospection annotations. (José Alburquerque) +* Docs: replace gio.IO_ERROR_* with gio.ERROR_* (Paul Bolle) +* Bug 613341 - pygobject tests seem to require pygtk causing a circular (Gian Mario) +* Don't raise an error in _pygi_import if pygi support is disabled (Simon van der Linden) +* Initialize PyGPollFD_Type.fd_obj to NULL (Tomeu Vizoso) +* Bug 605937 - pygobject: Makefile.am sets $TMPDIR, disrupting distcc (Gian Mario) +* Wrap gio.Cancellable.make_pollfd() and add a test (Gian Mario) +* Make cancellable an optional parameter in many methods (Gian Mario) + +2.21.1 - 2010-01-02 +------------------- + +* Wrap gio.Volume.eject_with_operation (Gian Mario) +* Wrap gio.Mount.eject_with_operation (Gian Mario) +* Wrap gio.Mount.unmount_mountable_with_operation (Gian Mario) +* Wrap File.unmount_mountable_with_operation (Gian Mario) +* Wrap gio.File.stop_mountable (Gian Mario) +* Wrap gio.File.start_mountable (Gian Mario) +* Wrap gio.File.replace_readwrite_async (Gian Mario) +* Wrap gio.File.poll_mountable (Gian Mario) +* Wrap gio.File.open_readwrite_async (Gian Mario) +* Wrap gio.File.eject_mountable_with_operation (Gian Mario) +* Wrap gio.File.create_readwrite_async (Gian Mario) +* Wrap gio.Drive.stop (Gian Mario) +* Wrap gio.Drive.start (Gian Mario) +* Wrap gio.SocketListener.accept_socket_async|finish (Gian Mario) +* Wrap gio.SocketListener.accept_finish (Gian Mario) +* Wrap gio.SocketListener.accept_async (Gian Mario) +* Wrap gio.SocketListener.accept_socket (Gian Mario) +* Wrap gio.SocketListener.accept (Gian Mario) +* Make cancellable optional in gio.SocketClient.connect_to_host + (Gian Mario) +* Wrap gio.SocketListener.add_address (Gian Mario) +* Wrap gio.SocketClient.connect_to_service_async (Gian Mario) +* Wrap gio.SocketClient.connect_to_host_async (Gian Mario) +* Wrap gio.SocketClient.connect_async (Gian Mario) +* Wrap gio.SocketAddressEnumerator.next_async (Gian Mario) +* Add a missing object gio.InetSocketAddress new in GIO 2.22 + (Gian Mario) +* Make cancellable optional for gio.SocketAddressEnumerator.next + (Gian Mario) +* Wrap gio.Socket.condition_wait (Gian Mario) +* Wrap gio.Socket.condition_check (Gian Mario) +* Wrap gio.Resolver.lookup_service_finish (Gian Mario) +* Wrap gio.Resolver.lookup_service_async (Gian Mario) +* Wrap gio.Resolver.lookup_service (Gian Mario) +* Wrap gio.Resolver.lookup_by_address_async (Gian Mario) +* Wrap gio.Resolver.lookup_by_name_finish (Gian Mario) +* Wrap gio.Drive.eject_with_data (Gian Mario) +* Deprecate old gio.Drive methods (Gian Mario) +* Wrap gio.Resolver.lookup_by_name (Gian Mario) +* Make cancellable optional in gio.Resolver.lookup_by_address + (Gian Mario) +* Strip ``g_`` prefix for many other functions (Gian Mario) +* Strip ``g_`` prefix from InetAddress functions (Gian Mario) +* Fix function name gio.resolver_get_default (Gian Mario) +* Wrap gio.FileIOStream.query_info_async (Gian Mario) +* Register enums and flags in PyGI if needed (Tomeu Vizoso, :bzbug:`603534`) +* Wrap gio.IOStream.close_async (Gian Mario) +* Make cancellable optional in GFile.create_readwrite (Gian Mario) +* Remove a duplicate entry in gio.defs (Gian Mario) +* Wrap gio.FileInfo.set_modification_time (Gian Mario) +* Wrap gio.EmblemedIcon.get_emblems (Gian Mario) +* Update Enums and Flags with new API (Gian Mario) +* Fix handling of uchar in pyg_value_from_pyobject (Bastian Winkler) + +2.21.0 - 2009-12-18 +------------------- + +* pygmainloop: fix use of PySignal_WakeUpFD API for nested loops + (Philippe Normad, :bzbug:`481569`) +* Add capabilities to import wrappers from pygi (Simon van der Linden) +* Move threads_init() function from 'gobject' to 'glib' (Paul) +* Fix wrong minimum checking in float properties (Paul, :bzbug:`587637`) +* Wrap new API added in GIO 2.22 (Gian Mario) +* Fix bad name when rebuilding the unix source module (Gian Mario) +* Add the missing limit constants from glibconfig.h + (Tomeu Vizoso, :bzbug:`603244`) +* Suppress warnings about format conversion + (Simon van der Linden, :bzbug:`603355`) +* Properly define Connectable as interface type and not object type + (Gian Mario) +* Wrap new API added in GIO-UNIX 2.22 (Gian Mario) +* Wrap g_find_program_in_path (Gian Mario, :bzbug:`598435`) +* Add pygi-external.h into Makefile SOURCES (Gian Mario) + +2.20.0 - 2009-09-23 +------------------- + +* Allow to use automake 1.11 (Paolo Borelli) +* Specify programming language in .devhelp file (Frédéric Péters) +* Plug reference leak of GSource in pyg_main_loop_init (Paul) +* Updated uninstalled.pc file (Brian Cameron) + +2.19.0 - 2009-08-10 +------------------- + +* Add macros to help with Python list to/from GList/GSList conversions. + (John Finlay) +* GIO docs practically completed (Gian) +* GFileInfo.list_attributes should accept None/NULL (Gian) +* Strip out Windows DLL API macros (John Finlay) +* Document that many functions got moved gobject -> glib (Paul) +* Allow h2def.py to work when there are tabs or multiple spaces after + the struct keyword. (Murray Cumming) +* Fix build when builddir is not the same as srcdir + (Theppitak Karoonboonyanan) +* Make gio.Emblem constructor new-style (Paul) +* Cleanup GIO overrides to use Python function/method names (Paul) +* Make codegen report errors using Python function/method names (Paul) +* Fix object type in gio.BufferedInputStream_fill_async (Gian) +* Wrap gio.BufferedInputStream.fill_async (Gian) +* Add gio.BufferedOutputStream which was forgotten in the types (Gian) +* Split overrides for gio.MemoryOutputStream (Gian) +* Wrap gio.memory_input_stream_new_from_data (Gian) +* Introduces the girepository module from the former PyBank + (Simon van der Linden) +* Add API appeared in 2.20 but not marked as such in gio docs (Gian) +* Wrap gio.FileOutputStream.query_info_async (Gian) +* Wrap gio.FileInputStream.query_async (Gian) +* Install executable codegen parts with executing permissions (Paul) +* Wrap gio.DataInputStream.read_line_async and read_until_async (Paul) +* Fix gio.OutputStream.splice_async (Paul) +* Add GIO 2.20 API and update docs (Gian) + +2.18.0 - 2009-05-24 +------------------- + +* Improve gio docs with some more classes (Gian) +* Wrap gio.OutputStream.splice_async() (Gian) +* Add Python ver into installed libpyglib name (Emilio Pozuelo Monfort) +* Wrap gio.OutputStream.flush_async() (Gian) +* Use 'Requires.private' for libffi in '.pc' files (Josselin Mouette) +* Add wrapper for gio.FileAttributeMatcher (Gian) +* Mark relevant glib.IOChannel methods as METH_NOARGS (Paul) +* Retire hand-written ChangeLog; autocreate from Git history (Paul) +* Wrap gio.InputStream.skip_async() (Gian) +* Add in codegen -n --namespace option and the code to remove dll + API in headers, added documentation (Siavash Safi) +* Properly mark glib.get_user_special_dir() as a keywords method (Paul) + +2.17.0 - 2009-04-30 +------------------- + +* Write a good part of the docs for gio (Gian) +* Wrap g_mount_guess_content_type g_mount_guess_content_type_finish + g_mount_guess_content_type_sync (Gian, :bzbug:`580802`) +* Swap first two arguments of gio.File.query_info_async (Paul, :bzbug:`580490`) +* Fix a crash in pyg_type_add_interfaces (Paul, :bzbug:`566571`) +* Remove an empty structure, use sizeof(PyObject) + instead (Paul, :bzbug:`560591`) +* Wrap four g_get_user_*_dir() functions (Paul, :bzbug:`575999`) +* Remove 'ltihooks.py' as using deprecated Python module (Paul) +* Code maintenance: add .gitignore files (Paul) +* CellRendererPixbuf stock-size property has wrong type (Paul, :bzbug:`568499`) +* Add a doap file after git migration (Johan Dahlin) +* missing dep on libffi in pygobject-2.0.pc (Götz Waschk, :bzbug:`550231`) +* g_volume_monitor_tp_new new function, return the singleton object. + (Paul, :bzbug:`555613`) +* Remove a DeprecationWarning under python 2.6 (James Westby, :bzbug:`573753`) +* several scripts from codegen directory are not distributed + (Krzesimir Nowak) +* g_file_copy_async change argument order to keep it consistent with the + other methods (Gian) +* memory leak in gio.File.copy_async (Paul Pogonyshev, :bzbug:`578870`) +* g_file_monitor should accept None for cancellable and set the default + flag to G_FILE_MONITOR_NONE (Gian) +* pyg_notify_free needs to ensure it has GIL before calling Py_XDECREF + (Jonathan Matthew) +* Wrap g_file_set_display_name_async (Gian) +* Add a semi-private method to return the option context C object from + an option context wrapper (Tristan Hill) +* Converting a negative long Python value to a GUINT64 GValue doesn't + error out as it should (Gustavo J. A. M. Carneiro, :bzbug:`577999`) +* Wrap g_file_set_attributes_async and + g_file_set_attributes_finish (Gian) +* g_file_query_filesystem_info_async fix a typo (Gian) +* Wrap g_file_query_filesystem_info_async (Gian) +* Add missing g_file_query_filesystem_info_async and + g_file_query_filesystem_info_finish (Gian) +* Wrap g_file_eject_mountable (Gian) +* g_file_copy callback cannot be optional (Gian) +* Swap various kwargs names to reflect the code (Gian) +* Update the address of the FSF (Tobias Mueller, :bzbug:`577134`) +* Add g_volume_should_automount (Gian) +* Wrap g_drive_enumerate_identifiers and g_volume_enumerate_identifiers + (Gian) +* Add a couple of convinence functions to convert from/to a python list + and an array of strings (Gian) +* Allow setting pytype wrapper class (Mark Lee, John Ehresman, :bzbug:`559001`) +* Wrap g_file_enumerator_close_async (Gian Mario Tagliaretti) + +2.16.1 - 2009-02-22 +------------------- + +* Apply the patch provided by Cygwin Ports maintainer + (Paul Pogonyshev, :bzbug:`564018`) +* Bad -I ordering can break build, patch from [dmacks netspace org] + (Gian Mario Tagliaretti, :bzbug:`566737`) +* Fix keyword list to be in sync with positional arguments + (Paul, :bzbug:`566744`) +* Add a comment explaining why the two for loops for registering + interfaces (Gustavo Carneiro) +* Huge cleanup of GIO overrides (Paul, :bzbug:`566706`) +* gtk.Buildable interface method override is not recognized + (Paul, :bzbug:`566571`) +* Do not escape the ampersand "&" in entity references. Replace some + unusual entity references in the output with their literal values. + (Daniel Elstner, :bzbug:`568485`) +* gio.InputStream.read_async can cause memory corruption. + (Paul, :bzbug:`567792`) +* Inconsistent use of tabs and spaces in pygtk.py (Paul, :bzbug:`569350`) +* Huge fix of memory leaks in GIO (Paul, Paolo Borelli, Gian, :bzbug:`568427`) +* non-async functions don't release python locks before calling + blocking C functions (Gian, Gustavo, :bzbug:`556250`) +* Change comment to avoid false positives when grep'ing for deprecated + gtk functions (Andre Klapper) +* ltihooks.py updating license header from GPL to LGPL + (James Henstridge) + +2.16.0 - 2009-01-04 +------------------- + +* gobject.timeout_add_seconds() not found in docs + (Paul Pogonyshev, :bzbug:`547119`) +* _wrap_g_output_stream_write_async not adding a reference to the + buffer passed (Paul, :bzbug:`564102`) +* gio.VolumeMonitor segfaults (Gian Mario Tagliaretti, :bzbug:`555613`) +* Test if `domain` is not-null before using it to avoids segfaults + (Paul, :bzbug:`561826`) +* g_output_stream_write_all use gsize instead of gssize (Gian) +* add __repr__ to gio.Drive, gio.Mount and gio.Volume + (Paul, :bzbug:`530935`) +* Missing AC_CONFIG_MACRO_DIR([m4]) (Loïc Minier, :bzbug:`551227`) +* Make codegen not import when corresponding argument types are not + registered (Paul, :bzbug:`551056`) +* Fix typos breaking compilation (Frederic Peters :bzbug:`551212`) +* GFile load_contents methods chop data at first \0 + (Jonathan Matthew, :bzbug:`551059`) + +2.15.4 - 2008-09-03 +------------------- + +* Fix typo in GPointer type registration (Loïc Minier,:bzbug:`550463`) +* support G_TYPE_CLOSURE in codegen (Gian) + +2.15.3 - 2008-08-31 +------------------- + +* Beginning of porting to 3.0. glib & gobject module ported. +* Wrap g_app_info_* functions (Gian) +* Wrap gio.FileAttributeInfo (Gian) +* Wrap g_vfs_get_supported_uri_schemes (Johan, :bzbug:`545846`) +* Wrap g_file_info_get_modification_time (Johan, :bzbug:`545861`) +* Wrap gio.Volume.mount/eject (Johan) +* Wrap gio.File.move (Johan) +* Wrap gio.query_writable_namespaces (Gian, :bzbug:`545920`) +* Separate glib & gobject documentation +* Wrap GFile.append_to_async (Gian, :bzbug:`545959`) +* Wrap GFile.create_async (Gian, :bzbug:`546020`) +* Change return value from 'gboolean' to 'int' and changed semantics + to Pythonic (Paul, :bzbug:`544946`) +* Wrap GFile.replace_async and query_info_async (Gian, :bzbug:`546046`) +* GIcon and implementations improvements (Paul, :bzbug:`546135`) +* Improve __repr__ and richcompare for gio classes (Paul) +* Missing Py_INCREFs for some file async methods (Jonathan Matthew, :bzbug:`546734`) +* File.copy progress_callback does not work (Paul, :bzbug:`546591`) +* add File.replace_contents, replace_contents_async, replace_contents_finish. + (Jonathan Matthew, :bzbug:`547067`) +* Add GFile.query_default_handler (Gian) +* fix docstring line length (Jonathan Matthew, :bzbug:`547134`) +* improve runtime type wrapper creation (Paul, :bzbug:`547104`) +* make gio.File more Pythonic (Paul, :bzbug:`546120`) +* No TypeError raised when type is None (Paul, :bzbug:`540376`) +* wrap a few memory stream methods (Paul, :bzbug:`547354`) +* wrap gio.DataInputStream.read_line and ...read_until (Paul, :bzbug:`547484`) +* wrap four important asynchronous methods in gio.Drive and gio.Mount + (Paul, :bzbug:`547495`) +* gio.InputStream.read() looks broken (Paul, :bzbug:`547494`) +* wrap g_content_types_get_registered() (Paul, :bzbug:`547088`) +* cannot create new threads when pygtk is used (Paul, :bzbug:`547633`) +* an unitialized variable in PyGLib (Paul, :bzbug:`549351`) +* Constructor of gtk.TreeView raises TypeError when model is None + (Paul, :bzbug:`549191`) +* Fix memory problems reported by valgrind due to invalid tp_basicsize in + PyGPropsDescr_Type. (Gustavo, :bzbug:`549945`) + +2.15.2 - 2008-07-26 +------------------- + +* New module: glib, which contains the parts of the old + gobject bindings which are in the glib library. + MainLoop/MainContext/Sources/GOption and a few others has now moved. +* Add a new installed library libpyglib-2.0, which contains the extension + API for third-part modules instead of relying on macros which accesses + struct fields. +* Add bindings for gio.File.enumerate_children_async, + gio.FileEnumerator.next_files_async, gio.Mount.mount, + gio.File.mount_mountable, gio.File.mount_enclosing_volume, + gio.File.unmount_mountable, gio.File.copy. +* Add a new api for mapping a GError domain to an exception and register + an exception for GIOError. +* Remove leading IO_* prefix for the gio flags and register a quark + for the domain. +* Use GSlice in the glib module and bump required version to 2.14. + +2.15.1 - 2008-07-15 +------------------- + +* Rename pygtk-codegen-2.0 to pygobject-codegen-2.0 to avoid + conflicting with PyGTK (Paul Pogonyshev) + +2.15.0 - 2008-07-15 +------------------- + +* Add GIO bindings (Johan, Mario Tagliaretti, Thomas Leonard) +* Move codegen from PyGTK (Johan, Paul Pogonyshev, :bzbug:`542821`) +* Add more variables to the .pc files (Damien Carbery, Paul, + Dan Winship, :bzbug:`486876`) +* Add pyg_option_group_new to the public API (Johan) +* Add g_get_application_anme and g_get_progname (Sebastian Rittau) +* Avoid making wakeups when using Python 2.6 (Johan, Gustavo, + Adam Olsen, Josselin Mouette, Philippe Normand, Guido Van Rossum) +* Only link against libffi when found (Ed Catmur, :bzbug:`496006`) +* Improve gobject.property (Tomeu Vizoso, :bzbug:`523352`) +* Improve enum comparision and warnings (Paul, Phil Dumont, :bzbug:`428732`) +* Many gobject.Source improvements (Bryan Silverthorn) +* Apply some fixes to make pylint happier (Johan, Simon Schampijer, + :bzbug:`523821`) +* Fix error message in pyg_io_add_watch (Juha Sahkangas) +* Improve h2def.py (Oliver Crete, Murray Cumming, Lauro Moura) + +2.14.2 - 2008-05-23 +------------------- + +* Allow gobject.property work with subclasses. (:bzbug:`523352`, Tomeu Vizoso) +* Unbreak Source.prepare (:bzbug:`523075`, Bryan Silverthorn) +* Never override customly set 'tp_new' and 'tp_alloc' (Paul Pogonyshev) +* Don't link against libffi if we cannot find libffi + on the system. (:bzbug:`496006`, Ed Catmur) +* Dist .m4 files. (:bzbug:`496011`, Ed Catmur) +* Don't return NULL after warning of enum comparsion + (:bzbug:`519631`, Paul Pogonyshev) + +2.14.1 - 2008-01-03 +------------------- + +* Avoid wakeups when using Python trunk (Johan Dahlin, :bzbug:`481569`) +* Add an uninstalled.pc (Damien Carbery, :bzbug:`486876`) + +2.14.0 - 2007-09-16 +------------------- + +* Fix a Python 2.6 deprecation warning (Johannes Hölzl, :bzbug:`342948`) +* Wrap g_timeout_add_seconds, when compiling with glib 2.14 (Gustavo) +* Always fully initialize the PyGObject (Ed Catmur, :bzbug:`466082`) +* Fix compilation in Solaris, again (:bzbug:`339924`, Gustavo) +* Fix check for default value in boolean type (Marco Giusti, :bzbug:`470230`) +* Fix new style properties with subclasses (Johan Dahlin, :bzbug:`470718`) +* Docs generation fixes (John Finlay) + +2.13.2 - 2007-07-07 +------------------- + +* Fix build on opensolaris (Damien Carbery, :bzbug:`339924`) +* Proxy GOption exceptions from Python to C (Johannes Hölzl, :bzbug:`342948`) +* Support G_TYPE_VALUE boxed args/signals + (Ed Catmur, Carlos Martin, :bzbug:`351072`) +* pyg_error_exception_check bug fix (Sebastian Granjoux, :bzbug:`449879`) +* Toggle references bug fix (:bzbug:`447271`, Gustavo Carneiro) +* use python-config to get python includes (:bzbug:`448173`, Sebastien Bacher) +* Support GObject properties in new properties API (Gustavo) +* generate-constants fixes (Muntyan) +* Allow running autogen.sh from outside $srcdir (Muntyan) + +2.13.1 - 2007-05-02 +------------------- + +* Generic CClosure marshaller using libffi (Johan, :bzbug:`353816`) +* Uninstalled .pc file (Damien Carbery, :bzbug:`385129`) +* Fix leak in GFlags handling (Daniel Berrange, :bzbug:`428726`) +* Use dirname in autogen (Loïc Minier, :bzbug:`409234`) +* Treat None in a GValueArray as pointer/NULL (Ed Catmur, :bzbug:`352209`) +* Toggle reference bug fix in tp_setattro (Gustavo, :bzbug:`434659`) +* Add a simplified helper for creating properties (Johan, Gustavo, :bzbug:`338089`) +* Avoid throwing an exception in GValue converter (James Livingstone, + Ed Catmur, :bzbug:`374653`) +* Build fix in .pc file (Luca Ferretti, :bzbug:`435132`) + +2.13.0 - 2007-04-23 +------------------- + +* Release the GIL in g_object_set_property (Edward Hervey, :bzbug:`395048`) +* Break PyGObject<->GObject reference cycle (Gustavo Carneiro, :bzbug:`320428`) +* use static inline functions for init_pygobject (Gustavo, :bzbug:`419379`) +* Wrap g_set_application_name, g_set_prgname + (Havoc Pennington, :bzbug:`415853`) +* New pyg_gerror_exception_check API (Gustavo, :bzbug:`425242`) +* New API to get/set multiple properties + (Gian Mario Tagliaretti, :bzbug:`403212`) +* Misc. bug fixes. + +2.12.3 - 2006-11-18 +------------------- + +* distutils build fixes (Cedric) +* documentation updates (John) +* gobject.handler_block_by_func and friends now accept methods + (Johan, Dima, :bzbug:`375589`) +* avoid truncating of gparamspec (Yevgen Muntyan, :bzbug:`353943`) +* set __module__ on gobject derived types (Johan, + Osmo Salomaa, :bzbug:`376099`) +* Ensure exceptions are raised on errors in gobject.OptionGroup + (Johan, Laszlo Pandy, :bzbug:`364576` + +2.12.2 - 2006-10-03 +------------------- + +* Make PyGObject 64-bit safe for Python 2.5 (Gustavo) +* All headers are now LGPL and not GPL (Johan) +* Remove a couple of GCC warnings (Gustavo) +* Revive distutils support (Cedric Gustin) +* Emission hook reference count bugfix (Gustavo) +* MSVC/ANSI C compilation fix (John Ehresman) +* Bump Ctrl-C timeout handler from 100ms to 1000 (Johan) + +2.12.1 - 2006-09-04 +------------------- + +* Corrected version check (Sebastian Dröge, :bzbug:`354364`) + +2.12.0 - 2006-09-04 +------------------- + +* Install the html files even when using --disable-docs (:bzbug:`353159`, Johan, + Matthias Clasen) + +2.11.4 - 2006-08-27 +------------------- + +* Include pre-generated html docs in the tarball (Johan) +* Fix bug in do_set_property called from constructor (Gustavo, :bzbug:`353039`) +* Fix type registration involving interfaces with signals and/or + properties (Gustavo) + +2.11.3 - 2006-08-21 +------------------- + +* Documentation updates (John) +* Documentation build fixes (Johan, John, Gian Mario Tagliaretti) +* PyGObject can now be compiled using a C++ compiler (Murray Cumming) +* Type registration bug fix (Gustavo) + +2.11.2 - 2006-08-08 +------------------- + +* Add fixxref.py from PyGTK (Johan) +* Fix parallel build (:bzbug:`350225`, Ed Catmur) + +2.11.1 - 2006-08-04 +------------------- + +* Add John Finlay's reference manual (Johan, John) +* Fix GOption mem leak (Gustavo) +* Infrastructure for lazy type registration (Johan) +* Enum/Flags fixes (Gustavo, John) +* Eliminate some GCC warnings (Johan) + +2.11.0 - 2006-07-12 +------------------- + +* Add GOption support (:bzbug:`163645`, Johannes Hölzl) +* GObject metaclass converted to Python code (Gustavo) +* Register GType constants from Python-land (Johan) +* Distutils updates (John Ehresman, Cedric Gustin) +* Add support for signal emission hooks (:bzbug:`154845`, Johan) +* g_spawn_close_pid support (Gustavo) +* Add new APIs do add or disable log redirections (Muntyan, :bzbug:`323786`) +* "sub-sub-type" bug fixed (Gustavo) +* Coverity report code fixes (Johan) +* Support retrieving signal and property info from interfaces (Finlay) +* Support parameters of type G_TYPE_GSTRING in signals (Gustavo) +* Wrap a few g_filename_* APIs (Gustavo) + +2.10.1 - 2006-04-11 +------------------- + +* uint64 property bug fix (Andy Wingo) +* Hard code path to 2.0 (Gustavo) +* Allow only tuples and lists in strv to value (Gustavo) +* Include dsextras.py in the dist (Johan) + +2.10.0 - 2006-03-13 +------------------- + +* enum/leak fix (Michael Smith) + +2.9.1 - 2006-01-16 +------------------ + +2.9.0 - 2006-01-16 +------------------ + +* Signal accumulator support (Gustavo) +* GObject doc string generation improvements (Gustavo) +* Discover GInterfaces in runtime (Gustavo) +* Warn if return value in iowatch callback is not bool (Gustavo) +* Convert string arrays properly (Christopher Aillon) + +2.8.0 - 2006-01-09 +------------------ + +* Initial release, split of from PyGTK. +* Updates for Python 2.5's richcompare (Manish Yosh) +* PyFlags bug fixes (Gustavo) +* Fix leak in pygobject_new_with_interfaces (Johan) +* Undeprecate gobject.type_register (Johan) diff --git a/PKG-INFO b/PKG-INFO deleted file mode 100644 index 726498b..0000000 --- a/PKG-INFO +++ /dev/null @@ -1,25 +0,0 @@ -Metadata-Version: 1.0 -Name: PyGObject -Version: 3.9.92 -Summary: Python bindings for GObject -Home-page: http://www.pygtk.org/ -Author: James Henstridge -Author-email: james@daa.com.au -Maintainer: Johan Dahlin -Maintainer-email: johan@gnome.org -License: GNU LGPL -Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.92.tar.gz -Description: Python bindings for GLib and GObject -Platform: POSIX, Windows -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Linux -Classifier: Environment :: MacOS X -Classifier: Environment :: Win32 (MS Windows) -Classifier: Environment :: Unix -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) -Classifier: Operating System :: POSIX -Classifier: Operating System :: Microsoft :: Windows -Classifier: Programming Language :: C -Classifier: Programming Language :: Python -Classifier: Topic :: Software Development :: Libraries :: Python Modules diff --git a/PKG-INFO.in b/PKG-INFO.in index 5cffe13..2cd1ef5 100644 --- a/PKG-INFO.in +++ b/PKG-INFO.in @@ -1,25 +1,21 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.2 Name: PyGObject Version: @VERSION@ -Summary: Python bindings for GObject -Home-page: http://www.pygtk.org/ +Summary: Python bindings for GObject Introspection +Home-page: https://pygobject.readthedocs.io Author: James Henstridge Author-email: james@daa.com.au -Maintainer: Johan Dahlin -Maintainer-email: johan@gnome.org +Maintainer: Simon Feltman +Maintainer-email: sfeltman@src.gnome.org License: GNU LGPL -Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/@PYGOBJECT_MAJOR_VERSION@.@PYGOBJECT_MINOR_VERSION@/pygobject-@VERSION@.tar.gz -Description: Python bindings for GLib and GObject +Description: Python bindings for GObject Introspection Platform: POSIX, Windows Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Linux -Classifier: Environment :: MacOS X -Classifier: Environment :: Win32 (MS Windows) -Classifier: Environment :: Unix Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) +Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) Classifier: Operating System :: POSIX Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: C Classifier: Programming Language :: Python Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: >=3.8, <4 diff --git a/README b/README deleted file mode 100644 index 7530c61..0000000 --- a/README +++ /dev/null @@ -1,107 +0,0 @@ -PyGObject -===== -Original authors: James Henstridge - Johan Dahlin - -Current maintainers: Tomeu Vizoso - Martin Pitt - Paolo Borelli - Ignacio Casal Quinteiro - Sebastian Pölsterl - Simon Feltman - - -This archive contains bindings for the GLib, and GObject, -to be used in Python. It is a fairly complete set of bindings, -it's already rather useful, and is usable to write moderately -complex programs. (see the examples directory for some examples -of the simpler programs you could write). - -If you have any enhancements or bug reports, please file them in -bugzilla at: - http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject - -If you have a patch, file the bug first and then use the "create new -attachment" link on the bug's info page. My preferred format for -patches is unified diff format (ie. diff -u). Please don't send me -diffs which don't have any context, as these make it very difficult to -see what the patch does. - -New Versions -============ - -New versions of this package can be found at: - http://ftp.gnome.org/pub/GNOME/sources/pygobject/ - - -Mailing list -============ - -pygobject development is discussed on the GNOME python-hackers mailing list. -You can subscribe to it through the web interface: - - https://mail.gnome.org/mailman/listinfo/python-hackers-list/ - -Requirements -============ - * C compiler (GCC and MSVC supported) - * Python 2.7 or higher - * Glib/Gio 2.35.9 or higher - * libffi (optional) - -Copyright Information -===================== - -This software is covered by the GNU Lesser General Public Licence -(version 2.1, or if you choose, a later version). Basically just don't -say you wrote bits you didn't. - -Compilation -=========== - -PyGObject uses the standard autotools for the build infrastructure. To -build, it should be as simple as running: - - $ ./configure --prefix= - $ make - $ make install - -By default, configure searches for a few well-known Python interpreter -names, such as "python3", "python2", "python2.7", or "python". If your -Python interpreter isn't in the path, or is not called "python", you can -configure pygobject to build against that with --with-python= or -setting the PYTHON environment variable: - - $ ./configure --with-python=python3 - $ PYTHON=python3.2 ./configure - $ ./configure --with-python=~/my-patched-python/python - -If configure can't find GTK+, you may need to set the PKG_CONFIG_PATH -environment variable to help it find the libraries. - -The "make install" target will generate normal and optimised bytecode -for all the .py files. - -Note. If you're installing to another prefix than the one where python -is installed you'll need to set the PYTHONPATH variable to the -$prefix/lib/pythonX.Y/site-packages directory created by -the PyGObject installation. - -Tests -===== - -After having compiled and installed pygobject, you may want to test them. -There are a number of example programs available in the examples/ -subdirectory. - - -Getting Help -============ - -If you have questions about programming with PyGObject, you might want to -check the documentation on - - https://live.gnome.org/PyGObject/ - -If that does not help, send a message to the mailing list (information on -subscribing is above), or join #python on irc.gnome.org. diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..b1a0fd9 --- /dev/null +++ b/README.rst @@ -0,0 +1,22 @@ +.. image:: https://pygobject.readthedocs.io/en/latest/_images/pygobject.svg + :align: center + :width: 400px + :height: 98px + +| + +**PyGObject** is a Python package which provides bindings for `GObject +`__ based libraries such as `GTK +`__, `GStreamer `__, +`WebKitGTK `__, `GLib +`__, `GIO +`__ and many more. + +It supports Linux, Windows and macOS and works with **Python 3.8+** and +**PyPy3**. PyGObject, including this documentation, is licensed under the +**LGPLv2.1+**. + + +---- + +For more information visit https://pygobject.readthedocs.io diff --git a/aclocal.m4 b/aclocal.m4 deleted file mode 100644 index 2ef1960..0000000 --- a/aclocal.m4 +++ /dev/null @@ -1,2035 +0,0 @@ -# generated automatically by aclocal 1.13.3 -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. - -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -# Copyright (C) 2002-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.13' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.13.3], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.13.3])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -AM_MISSING_PROG([AUTOHEADER], [autoheader]) -AM_MISSING_PROG([MAKEINFO], [makeinfo]) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl -]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -]) - -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST([install_sh])]) - -# Copyright (C) 2003-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_CC_C_O -# -------------- -# Like AC_PROG_CC_C_O, but changed for automake. -AC_DEFUN([AM_PROG_CC_C_O], -[AC_REQUIRE([AC_PROG_CC_C_O])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -dnl Make sure AC_PROG_CC is never called again, or it will override our -dnl setting of CC. -m4_define([AC_PROG_CC], - [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) -fi -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# --------------------------------------------------------------------------- -# Adds support for distributing Python modules and packages. To -# install modules, copy them to $(pythondir), using the python_PYTHON -# automake variable. To install a package with the same name as the -# automake package, install to $(pkgpythondir), or use the -# pkgpython_PYTHON automake variable. -# -# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as -# locations to install python extension modules (shared libraries). -# Another macro is required to find the appropriate flags to compile -# extension modules. -# -# If your package is configured with a different prefix to python, -# users will have to add the install directory to the PYTHONPATH -# environment variable, or create a .pth file (see the python -# documentation for details). -# -# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will -# cause an error if the version of python installed on the system -# doesn't meet the requirement. MINIMUM-VERSION should consist of -# numbers and dots only. -AC_DEFUN([AM_PATH_PYTHON], - [ - dnl Find a Python interpreter. Python versions prior to 2.0 are not - dnl supported. (2.0 was released on October 16, 2000). - m4_define_default([_AM_PYTHON_INTERPRETER_LIST], -[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl - python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0]) - - AC_ARG_VAR([PYTHON], [the Python interpreter]) - - m4_if([$1],[],[ - dnl No version check is needed. - # Find any Python interpreter. - if test -z "$PYTHON"; then - AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) - fi - am_display_PYTHON=python - ], [ - dnl A version check is needed. - if test -n "$PYTHON"; then - # If the user set $PYTHON, use it and don't search something else. - AC_MSG_CHECKING([whether $PYTHON version is >= $1]) - AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Python interpreter is too old])]) - am_display_PYTHON=$PYTHON - else - # Otherwise, try each interpreter until we find one that satisfies - # VERSION. - AC_CACHE_CHECK([for a Python interpreter with version >= $1], - [am_cv_pathless_PYTHON],[ - for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do - test "$am_cv_pathless_PYTHON" = none && break - AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) - done]) - # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. - if test "$am_cv_pathless_PYTHON" = none; then - PYTHON=: - else - AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) - fi - am_display_PYTHON=$am_cv_pathless_PYTHON - fi - ]) - - if test "$PYTHON" = :; then - dnl Run any user-specified action, or abort. - m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) - else - - dnl Query Python for its version number. Getting [:3] seems to be - dnl the best way to do this; it's what "site.py" does in the standard - dnl library. - - AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], - [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) - AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) - - dnl Use the values of $prefix and $exec_prefix for the corresponding - dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made - dnl distinct variables so they can be overridden if need be. However, - dnl general consensus is that you shouldn't need this ability. - - AC_SUBST([PYTHON_PREFIX], ['${prefix}']) - AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) - - dnl At times (like when building shared libraries) you may want - dnl to know which OS platform Python thinks this is. - - AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], - [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) - AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) - - # Just factor out some code duplication. - am_python_setup_sysconfig="\ -import sys -# Prefer sysconfig over distutils.sysconfig, for better compatibility -# with python 3.x. See automake bug#10227. -try: - import sysconfig -except ImportError: - can_use_sysconfig = 0 -else: - can_use_sysconfig = 1 -# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: -# -try: - from platform import python_implementation - if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': - can_use_sysconfig = 0 -except ImportError: - pass" - - dnl Set up 4 directories: - - dnl pythondir -- where to install python scripts. This is the - dnl site-packages directory, not the python standard library - dnl directory like in previous automake betas. This behavior - dnl is more consistent with lispdir.m4 for example. - dnl Query distutils for this directory. - AC_CACHE_CHECK([for $am_display_PYTHON script directory], - [am_cv_python_pythondir], - [if test "x$prefix" = xNONE - then - am_py_prefix=$ac_default_prefix - else - am_py_prefix=$prefix - fi - am_cv_python_pythondir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pythondir in - $am_py_prefix*) - am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` - am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` - ;; - *) - case $am_py_prefix in - /usr|/System*) ;; - *) - am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - ]) - AC_SUBST([pythondir], [$am_cv_python_pythondir]) - - dnl pkgpythondir -- $PACKAGE directory under pythondir. Was - dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is - dnl more consistent with the rest of automake. - - AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) - - dnl pyexecdir -- directory for installing python extension modules - dnl (shared libraries) - dnl Query distutils for this directory. - AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], - [am_cv_python_pyexecdir], - [if test "x$exec_prefix" = xNONE - then - am_py_exec_prefix=$am_py_prefix - else - am_py_exec_prefix=$exec_prefix - fi - am_cv_python_pyexecdir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pyexecdir in - $am_py_exec_prefix*) - am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` - am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` - ;; - *) - case $am_py_exec_prefix in - /usr|/System*) ;; - *) - am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - ]) - AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) - - dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) - - AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) - - dnl Run any user-specified action. - $2 - fi - -]) - - -# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) -# --------------------------------------------------------------------------- -# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. -# Run ACTION-IF-FALSE otherwise. -# This test uses sys.hexversion instead of the string equivalent (first -# word of sys.version), in order to cope with versions such as 2.2c1. -# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). -AC_DEFUN([AM_PYTHON_CHECK_VERSION], - [prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] -sys.exit(sys.hexversion < minverhex)" - AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT([yes]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) - -# Copyright (C) 2009-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor 'install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -# -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], - - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -dnl GNOME_CODE_COVERAGE -dnl -dnl Defines CODE_COVERAGE_CFLAGS and CODE_COVERAGE_LDFLAGS which should be -dnl included in the CFLAGS and LIBS/LDFLAGS variables of every build target -dnl (program or library) which should be built with code coverage support. -dnl Also defines GNOME_CODE_COVERAGE_RULES which should be substituted in your -dnl Makefile; and $enable_code_coverage which can be used in subsequent -dnl configure output. -dnl -dnl Note that all optimisation flags in CFLAGS must be disabled when code -dnl coverage is enabled. -dnl -dnl Derived from Makefile.decl in GLib, originally licenced under LGPLv2.1+. -dnl This file is licenced under LGPLv2.1+. -dnl -dnl Usage example: -dnl configure.ac: -dnl GNOME_CODE_COVERAGE -dnl -dnl Makefile.am: -dnl @GNOME_CODE_COVERAGE_RULES@ -dnl my_program_LIBS = … $(CODE_COVERAGE_LDFLAGS) … -dnl my_program_CFLAGS = … $(CODE_COVERAGE_CFLAGS) … -dnl -dnl This results in a “check-code-coverage” rule being added to any Makefile.am -dnl which includes “@GNOME_CODE_COVERAGE_RULES@” (assuming the module has been -dnl configured with --enable-code-coverage). Running `make check-code-coverage` -dnl in that directory will run the module’s test suite (`make check`) and build -dnl a code coverage report detailing the code which was touched, then print the -dnl URI for the report. - -AC_DEFUN([GNOME_CODE_COVERAGE],[ - dnl Check for --enable-code-coverage - AC_MSG_CHECKING([whether to build with code coverage support]) - AC_ARG_ENABLE([code-coverage], AS_HELP_STRING([--enable-code-coverage], [Whether to enable code coverage support]),, enable_code_coverage=no) - AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) - AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) - AC_MSG_RESULT($enable_code_coverage) - - AS_IF([ test "$enable_code_coverage" = "yes" ], [ - dnl Check if gcc is being used - AS_IF([ test "$GCC" = "no" ], [ - AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) - ]) - - # List of supported lcov versions. - lcov_version_list="1.6 1.7 1.8 1.9" - - AC_CHECK_PROG([LCOV], [lcov], [lcov]) - AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) - - AS_IF([ test "$LCOV" ], [ - AC_CACHE_CHECK([for lcov version], gnome_cv_lcov_version, [ - gnome_cv_lcov_version=invalid - lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` - for lcov_check_version in $lcov_version_list; do - if test "$lcov_version" = "$lcov_check_version"; then - gnome_cv_lcov_version="$lcov_check_version (ok)" - fi - done - ]) - ], [ - lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" - AC_MSG_ERROR([$lcov_msg]) - ]) - - case $gnome_cv_lcov_version in - ""|invalid[)] - lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." - AC_MSG_ERROR([$lcov_msg]) - LCOV="exit 0;" - ;; - esac - - AS_IF([ test -z "$GENHTML" ], [ - AC_MSG_ERROR([Could not find genhtml from the lcov package]) - ]) - - dnl Build the code coverage flags - CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_LDFLAGS="-lgcov" - - AC_SUBST([CODE_COVERAGE_CFLAGS]) - AC_SUBST([CODE_COVERAGE_LDFLAGS]) - ]) - -GNOME_CODE_COVERAGE_RULES=' -# Code coverage -# -# Optional: -# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. -# (Default: $(top_builddir)) -# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated -# by lcov for code coverage. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) -# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage -# reports to be created. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) -# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the lcov instance. -# (Default: empty) -# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml -# instance. (Default: empty) -# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore -# -# The generated report will be titled using the $(PACKAGE_NAME) and -# $(PACKAGE_VERSION). In order to add the current git hash to the title, -# use the git-version-gen script, available online. - -# Optional variables -CODE_COVERAGE_DIRECTORY ?= $(top_builddir) -CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info -CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage -CODE_COVERAGE_LCOV_OPTIONS ?= -CODE_COVERAGE_GENHTML_OPTIONS ?= -CODE_COVERAGE_IGNORE_PATTERN ?= - -code_coverage_quiet = $(code_coverage_quiet_$(V)) -code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) -code_coverage_quiet_0 = --quiet - -# Use recursive makes in order to ignore errors during check -check-code-coverage: -ifdef CODE_COVERAGE_ENABLED - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) code-coverage-capture -else - @echo "Need to reconfigure with --enable-code-coverage" -endif - -# Capture code coverage data -code-coverage-capture: code-coverage-capture-hook -ifdef CODE_COVERAGE_ENABLED - $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS) - $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" - -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp - LANG=C $(GENHTML) $(code_coverage_quiet) --prefix $(CODE_COVERAGE_DIRECTORY) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) - @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" -else - @echo "Need to reconfigure with --enable-code-coverage" -endif - -# Hook rule executed before code-coverage-capture, overridable by the user -code-coverage-capture-hook: - -clean: code-coverage-clean -code-coverage-clean: - -$(LCOV) --directory $(top_builddir) -z - -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -find . -name "*.gcda" -o -name "*.gcov" -delete - -GITIGNOREFILES ?= -GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -DISTCHECK_CONFIGURE_FLAGS ?= -DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage - -.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean -' - - AC_SUBST([GNOME_CODE_COVERAGE_RULES]) - m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([GNOME_CODE_COVERAGE_RULES])]) -]) - -dnl GNOME_COMPILE_WARNINGS -dnl Turn on many useful compiler warnings and substitute the result into -dnl WARN_CFLAGS -dnl For now, only works on GCC -AC_DEFUN([GNOME_COMPILE_WARNINGS],[ - dnl ****************************** - dnl More compiler warnings - dnl ****************************** - - AC_ARG_ENABLE(compile-warnings, - AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@], - [Turn on compiler warnings]),, - [enable_compile_warnings="m4_default([$1],[yes])"]) - - if test "x$GCC" != xyes; then - enable_compile_warnings=no - fi - - warning_flags= - realsave_CFLAGS="$CFLAGS" - - dnl These are warning flags that aren't marked as fatal. Can be - dnl overridden on a per-project basis with -Wno-foo. - base_warn_flags=" \ - -Wall \ - -Wstrict-prototypes \ - -Wnested-externs \ - " - - dnl These compiler flags typically indicate very broken or suspicious - dnl code. Some of them such as implicit-function-declaration are - dnl just not default because gcc compiles a lot of legacy code. - dnl We choose to make this set into explicit errors. - base_error_flags=" \ - -Werror=missing-prototypes \ - -Werror=implicit-function-declaration \ - -Werror=pointer-arith \ - -Werror=init-self \ - -Werror=format-security \ - -Werror=format=2 \ - -Werror=missing-include-dirs \ - " - - case "$enable_compile_warnings" in - no) - warning_flags= - ;; - minimum) - warning_flags="-Wall" - ;; - yes) - warning_flags="$base_warn_flags $base_error_flags" - ;; - maximum|error) - warning_flags="$base_warn_flags $base_error_flags" - ;; - *) - AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings) - ;; - esac - - if test "$enable_compile_warnings" = "error" ; then - warning_flags="$warning_flags -Werror" - fi - - dnl Check whether GCC supports the warning options - for option in $warning_flags; do - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $option" - AC_MSG_CHECKING([whether gcc understands $option]) - AC_TRY_COMPILE([], [], - has_option=yes, - has_option=no,) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT([$has_option]) - if test $has_option = yes; then - tested_warning_flags="$tested_warning_flags $option" - fi - unset has_option - unset save_CFLAGS - done - unset option - CFLAGS="$realsave_CFLAGS" - AC_MSG_CHECKING(what warning flags to pass to the C compiler) - AC_MSG_RESULT($tested_warning_flags) - - AC_ARG_ENABLE(iso-c, - AC_HELP_STRING([--enable-iso-c], - [Try to warn if code is not ISO C ]),, - [enable_iso_c=no]) - - AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) - complCFLAGS= - if test "x$enable_iso_c" != "xno"; then - if test "x$GCC" = "xyes"; then - case " $CFLAGS " in - *[\ \ ]-ansi[\ \ ]*) ;; - *) complCFLAGS="$complCFLAGS -ansi" ;; - esac - case " $CFLAGS " in - *[\ \ ]-pedantic[\ \ ]*) ;; - *) complCFLAGS="$complCFLAGS -pedantic" ;; - esac - fi - fi - AC_MSG_RESULT($complCFLAGS) - - WARN_CFLAGS="$tested_warning_flags $complCFLAGS" - AC_SUBST(WARN_CFLAGS) -]) - -dnl For C++, do basically the same thing. - -AC_DEFUN([GNOME_CXX_WARNINGS],[ - AC_ARG_ENABLE(cxx-warnings, - AC_HELP_STRING([--enable-cxx-warnings=@<:@no/minimum/yes@:>@] - [Turn on compiler warnings.]),, - [enable_cxx_warnings="m4_default([$1],[minimum])"]) - - AC_MSG_CHECKING(what warning flags to pass to the C++ compiler) - warnCXXFLAGS= - if test "x$GXX" != xyes; then - enable_cxx_warnings=no - fi - if test "x$enable_cxx_warnings" != "xno"; then - if test "x$GXX" = "xyes"; then - case " $CXXFLAGS " in - *[\ \ ]-Wall[\ \ ]*) ;; - *) warnCXXFLAGS="-Wall -Wno-unused" ;; - esac - - ## -W is not all that useful. And it cannot be controlled - ## with individual -Wno-xxx flags, unlike -Wall - if test "x$enable_cxx_warnings" = "xyes"; then - warnCXXFLAGS="$warnCXXFLAGS -Wshadow -Woverloaded-virtual" - fi - fi - fi - AC_MSG_RESULT($warnCXXFLAGS) - - AC_ARG_ENABLE(iso-cxx, - AC_HELP_STRING([--enable-iso-cxx], - [Try to warn if code is not ISO C++ ]),, - [enable_iso_cxx=no]) - - AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler) - complCXXFLAGS= - if test "x$enable_iso_cxx" != "xno"; then - if test "x$GXX" = "xyes"; then - case " $CXXFLAGS " in - *[\ \ ]-ansi[\ \ ]*) ;; - *) complCXXFLAGS="$complCXXFLAGS -ansi" ;; - esac - - case " $CXXFLAGS " in - *[\ \ ]-pedantic[\ \ ]*) ;; - *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;; - esac - fi - fi - AC_MSG_RESULT($complCXXFLAGS) - - WARN_CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS" - AC_SUBST(WARN_CXXFLAGS) -]) - -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) -# -# Copyright © 2004 Scott James Remnant . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) -m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi -fi[]dnl -])# PKG_PROG_PKG_CONFIG - -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test -n "$$1"; then - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], - [pkg_failed=yes]) - else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG - -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED - - -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - m4_default([$4], [AC_MSG_ERROR( -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT])[]dnl - ]) -elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -_PKG_TEXT - -To get pkg-config, see .])[]dnl - ]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - AC_MSG_RESULT([yes]) - $3 -fi[]dnl -])# PKG_CHECK_MODULES - -# Configure paths for GLIB -# Owen Taylor 1997-2001 - -dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) -dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject, -dnl gthread, or gio is specified in MODULES, pass to pkg-config -dnl -AC_DEFUN([AM_PATH_GLIB_2_0], -[dnl -dnl Get the cflags and libraries from pkg-config -dnl -AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], - , enable_glibtest=yes) - - pkg_config_args=glib-2.0 - for module in . $4 - do - case "$module" in - gmodule) - pkg_config_args="$pkg_config_args gmodule-2.0" - ;; - gmodule-no-export) - pkg_config_args="$pkg_config_args gmodule-no-export-2.0" - ;; - gobject) - pkg_config_args="$pkg_config_args gobject-2.0" - ;; - gthread) - pkg_config_args="$pkg_config_args gthread-2.0" - ;; - gio*) - pkg_config_args="$pkg_config_args $module-2.0" - ;; - esac - done - - PKG_PROG_PKG_CONFIG([0.16]) - - no_glib="" - - if test "x$PKG_CONFIG" = x ; then - no_glib=yes - PKG_CONFIG=no - fi - - min_glib_version=ifelse([$1], ,2.0.0,$1) - AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) - - if test x$PKG_CONFIG != xno ; then - ## don't try to run the test against uninstalled libtool libs - if $PKG_CONFIG --uninstalled $pkg_config_args; then - echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" - enable_glibtest=no - fi - - if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then - : - else - no_glib=yes - fi - fi - - if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` - glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_glibtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$GLIB_LIBS $LIBS" -dnl -dnl Now check if the installed GLIB is sufficiently new. (Also sanity -dnl checks the results of pkg-config to some extent) -dnl - rm -f conf.glibtest - AC_TRY_RUN([ -#include -#include -#include - -int -main () -{ - unsigned int major, minor, micro; - char *tmp_version; - - fclose (fopen ("conf.glibtest", "w")); - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_glib_version"); - if (sscanf(tmp_version, "%u.%u.%u", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_glib_version"); - exit(1); - } - - if ((glib_major_version != $glib_config_major_version) || - (glib_minor_version != $glib_config_minor_version) || - (glib_micro_version != $glib_config_micro_version)) - { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", - $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, - glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If pkg-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); - printf("*** to point to the correct configuration files\n"); - } - else if ((glib_major_version != GLIB_MAJOR_VERSION) || - (glib_minor_version != GLIB_MINOR_VERSION) || - (glib_micro_version != GLIB_MICRO_VERSION)) - { - printf("*** GLIB header files (version %d.%d.%d) do not match\n", - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - glib_major_version, glib_minor_version, glib_micro_version); - } - else - { - if ((glib_major_version > major) || - ((glib_major_version == major) && (glib_minor_version > minor)) || - ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", - glib_major_version, glib_minor_version, glib_micro_version); - printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", - major, minor, micro); - printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} -],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_glib" = x ; then - AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$PKG_CONFIG" = "no" ; then - echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" - else - if test -f conf.glibtest ; then - : - else - echo "*** Could not run GLIB test program, checking why..." - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$LIBS $GLIB_LIBS" - AC_TRY_LINK([ -#include -#include -], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GLIB or finding the wrong" - echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GLIB_CFLAGS="" - GLIB_LIBS="" - GLIB_GENMARSHAL="" - GOBJECT_QUERY="" - GLIB_MKENUMS="" - GLIB_COMPILE_RESOURCES="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(GLIB_CFLAGS) - AC_SUBST(GLIB_LIBS) - AC_SUBST(GLIB_GENMARSHAL) - AC_SUBST(GOBJECT_QUERY) - AC_SUBST(GLIB_MKENUMS) - AC_SUBST(GLIB_COMPILE_RESOURCES) - rm -f conf.glibtest -]) - -m4_include([m4/as-ac-expand.m4]) -m4_include([m4/jhflags.m4]) -m4_include([m4/libtool.m4]) -m4_include([m4/ltoptions.m4]) -m4_include([m4/ltsugar.m4]) -m4_include([m4/ltversion.m4]) -m4_include([m4/lt~obsolete.m4]) -m4_include([m4/python.m4]) diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 3c7605d..0000000 --- a/autogen.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# Run this to generate all the initial makefiles, etc. -set -e -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -PKG_NAME="pygobject" - -(test -f $srcdir/configure.ac \ - && test -f $srcdir/$PKG_NAME.doap) || { - echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" - echo " top-level $PKG_NAME directory" - exit 1 -} - -if type lcov >/dev/null 2>&1; then - EXTRA_ARGS="--enable-code-coverage" -else - echo "lcov not installed, not enabling code coverage" -fi - - -which gnome-autogen.sh || { - echo "You need to install gnome-common." - exit 1 -} - -. gnome-autogen.sh "$EXTRA_ARGS" "$@" - diff --git a/compile b/compile deleted file mode 100755 index 531136b..0000000 --- a/compile +++ /dev/null @@ -1,347 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand '-c -o'. - -scriptversion=2012-10-14.11; # UTC - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - if test -f "$dir/lib$lib.a"; then - found=yes - lib=$dir/lib$lib.a - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; -esac - -ofile= -cfile= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/config.guess b/config.guess deleted file mode 100755 index b79252d..0000000 --- a/config.guess +++ /dev/null @@ -1,1558 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. - -timestamp='2013-06-10' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -# -# Please send patches with a ChangeLog entry to config-patches@gnu.org. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; -esac - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/config.h.in b/config.h.in deleted file mode 100644 index fa098f6..0000000 --- a/config.h.in +++ /dev/null @@ -1,77 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if PySignal_SetWakeupFd is available */ -#undef HAVE_PYSIGNAL_SETWAKEUPFD - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* pygobject major version */ -#undef PYGOBJECT_MAJOR_VERSION - -/* pygobject micro version */ -#undef PYGOBJECT_MICRO_VERSION - -/* pygobject minor version */ -#undef PYGOBJECT_MINOR_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/config.sub b/config.sub deleted file mode 100755 index 9633db7..0000000 --- a/config.sub +++ /dev/null @@ -1,1791 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. - -timestamp='2013-08-10' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches with a ChangeLog entry to config-patches@gnu.org. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2013 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or1k-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/configure b/configure deleted file mode 100755 index b98afbb..0000000 --- a/configure +++ /dev/null @@ -1,17201 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pygobject 3.9.92. -# -# Report bugs to . -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject -$0: about your system, including any error possibly output -$0: before this message. Then install a modern shell, or -$0: manually run the script under such a shell if you do -$0: have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='pygobject' -PACKAGE_TARNAME='pygobject' -PACKAGE_VERSION='3.9.92' -PACKAGE_STRING='pygobject 3.9.92' -PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject' -PACKAGE_URL='https://live.gnome.org/PyGObject/' - -ac_unique_file="gi/gimodule.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -GNOME_CODE_COVERAGE_RULES -CODE_COVERAGE_LDFLAGS -CODE_COVERAGE_CFLAGS -GENHTML -LCOV -CODE_COVERAGE_ENABLED -CODE_COVERAGE_ENABLED_FALSE -CODE_COVERAGE_ENABLED_TRUE -WARN_CFLAGS -INTROSPECTION_COMPILER -INTROSPECTION_SCANNER -ENABLE_CAIRO_FALSE -ENABLE_CAIRO_TRUE -PYCAIRO_LIBS -PYCAIRO_CFLAGS -CAIRO_LIBS -CAIRO_CFLAGS -GI_DATADIR -GI_LIBS -GI_CFLAGS -GIO_LIBS -GIO_CFLAGS -LIBFFI_PC -HAVE_LIBFFI_FALSE -HAVE_LIBFFI_TRUE -FFI_LIBS -FFI_CFLAGS -DATADIR -PYTHON_BASENAME -GLIB_COMPILE_RESOURCES -GLIB_MKENUMS -GOBJECT_QUERY -GLIB_GENMARSHAL -GLIB_LIBS -GLIB_CFLAGS -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH -PKG_CONFIG -THREADING_CFLAGS -PLATFORM -PYTHON_LIB_LOC -PYTHON_LIBS -PYTHON_INCLUDES -PYTHON_SO -pkgpyexecdir -pyexecdir -pkgpythondir -pythondir -PYTHON_PLATFORM -PYTHON_EXEC_PREFIX -PYTHON_PREFIX -PYTHON_VERSION -PYTHON -CPP -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -MANIFEST_TOOL -RANLIB -ac_ct_AR -AR -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -LIBTOOL -OBJDUMP -DLLTOOL -AS -OS_WIN32_FALSE -OS_WIN32_TRUE -PLATFORM_WIN32_FALSE -PLATFORM_WIN32_TRUE -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V -PYGOBJECT_MICRO_VERSION -PYGOBJECT_MINOR_VERSION -PYGOBJECT_MAJOR_VERSION -ACLOCAL_AMFLAGS -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_silent_rules -enable_static -enable_shared -with_pic -enable_fast_install -enable_dependency_tracking -with_gnu_ld -with_sysroot -enable_libtool_lock -with_python -enable_thread -enable_glibtest -with_ffi -enable_cairo -enable_compile_warnings -enable_iso_c -enable_code_coverage -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -PYTHON -PKG_CONFIG -PKG_CONFIG_PATH -PKG_CONFIG_LIBDIR -FFI_CFLAGS -FFI_LIBS -GIO_CFLAGS -GIO_LIBS -GI_CFLAGS -GI_LIBS -CAIRO_CFLAGS -CAIRO_LIBS -PYCAIRO_CFLAGS -PYCAIRO_LIBS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures pygobject 3.9.92 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/pygobject] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of pygobject 3.9.92:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") - --enable-static[=PKGS] build static libraries [default=no] - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build - --disable-libtool-lock avoid locking (might break parallel builds) - --disable-thread Disable pygobject threading support - --disable-glibtest do not try to compile and run a test GLIB program - --enable-cairo Enable Cairo bindings using introspection - information - --enable-compile-warnings=[no/minimum/yes/maximum/error] - Turn on compiler warnings - --enable-iso-c Try to warn if code is not ISO C - --enable-code-coverage Whether to enable code coverage support - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot=DIR Search for dependent libraries within DIR - (or the compiler's sysroot if not specified). - --with-python=PATH Path to Python interpreter; searches $PATH if only a - program name is given; if not given, searches for a - few standard names such as "python3" or "python2" - --without-ffi Disable libffi support - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - PYTHON the Python interpreter - PKG_CONFIG path to pkg-config utility - PKG_CONFIG_PATH - directories to add to pkg-config's search path - PKG_CONFIG_LIBDIR - path overriding pkg-config's built-in search path - FFI_CFLAGS C compiler flags for FFI, overriding pkg-config - FFI_LIBS linker flags for FFI, overriding pkg-config - GIO_CFLAGS C compiler flags for GIO, overriding pkg-config - GIO_LIBS linker flags for GIO, overriding pkg-config - GI_CFLAGS C compiler flags for GI, overriding pkg-config - GI_LIBS linker flags for GI, overriding pkg-config - CAIRO_CFLAGS - C compiler flags for CAIRO, overriding pkg-config - CAIRO_LIBS linker flags for CAIRO, overriding pkg-config - PYCAIRO_CFLAGS - C compiler flags for PYCAIRO, overriding pkg-config - PYCAIRO_LIBS - linker flags for PYCAIRO, overriding pkg-config - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -pygobject home page: . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -pygobject configure 3.9.92 -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by pygobject $as_me 3.9.92, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ACLOCAL_AMFLAGS="-I m4 -I ." - - - - - -$as_echo "#define PYGOBJECT_MAJOR_VERSION 3" >>confdefs.h - -PYGOBJECT_MAJOR_VERSION=3 - - -$as_echo "#define PYGOBJECT_MINOR_VERSION 9" >>confdefs.h - -PYGOBJECT_MINOR_VERSION=9 - - -$as_echo "#define PYGOBJECT_MICRO_VERSION 92" >>confdefs.h - -PYGOBJECT_MICRO_VERSION=92 - - -ac_config_headers="$ac_config_headers config.h" - -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=0;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - -am__api_version='1.13' - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='pygobject' - VERSION='3.9.92' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -mkdir_p='$(MKDIR_P)' - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - - - -ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for some Win32 platform" >&5 -$as_echo_n "checking for some Win32 platform... " >&6; } -case "$host" in - *-*-mingw*|*-*-cygwin*) - platform_win32=yes - ;; - *) - platform_win32=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_win32" >&5 -$as_echo "$platform_win32" >&6; } - if test "$platform_win32" = "yes"; then - PLATFORM_WIN32_TRUE= - PLATFORM_WIN32_FALSE='#' -else - PLATFORM_WIN32_TRUE='#' - PLATFORM_WIN32_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native Win32" >&5 -$as_echo_n "checking for native Win32... " >&6; } -case "$host" in - *-*-mingw*) - os_win32=yes - ;; - *) - os_win32=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $os_win32" >&5 -$as_echo "$os_win32" >&6; } - if test "$os_win32" = "yes"; then - OS_WIN32_TRUE= - OS_WIN32_FALSE='#' -else - OS_WIN32_TRUE='#' - OS_WIN32_FALSE= -fi - - - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4.2' -macro_revision='1.3337' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} -: ${AR_FLAGS=cru} - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi - - - - - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&5 - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&5 - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - - - -# Set options -enable_dlopen=yes -enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AS=$ac_cv_prog_AS -if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AS"; then - ac_ct_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AS"; then - ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AS=$ac_cv_prog_ac_ct_AS -if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AS" = x; then - AS="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AS=$ac_ct_AS - fi -else - AS="$ac_cv_prog_AS" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - - ;; -esac - -test -z "$AS" && AS=as - - - - - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - -# Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=no -fi - - - - - - - - - - - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for lt_pkg in $withval; do - IFS="$lt_save_ifs" - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - if test -n "$lt_prog_compiler_pic"; then - lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ F* | *Sun*Fortran*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Intel*\ [CF]*Compiler*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - *Portland\ Group*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - link_all_deplibs=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 -$as_echo_n "checking for library containing strerror... " >&6; } -if ${ac_cv_search_strerror+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char strerror (); -int -main () -{ -return strerror (); - ; - return 0; -} -_ACEOF -for ac_lib in '' cposix; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_strerror=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_strerror+:} false; then : - break -fi -done -if ${ac_cv_search_strerror+:} false; then : - -else - ac_cv_search_strerror=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 -$as_echo "$ac_cv_search_strerror" >&6; } -ac_res=$ac_cv_search_strerror -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -if test "x$CC" != xcc; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 -$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 -$as_echo_n "checking whether cc understands -c and -o together... " >&6; } -fi -set dummy $CC; ac_cc=`$as_echo "$2" | - sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -# Make sure it works both with $CC and with simple cc. -# We do the test twice because some compilers refuse to overwrite an -# existing .o file with -o, though they will create one. -ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' -rm -f conftest2.* -if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; -then - eval ac_cv_prog_cc_${ac_cc}_c_o=yes - if test "x$CC" != xcc; then - # Test first that cc exists at all. - if { ac_try='cc -c conftest.$ac_ext >&5' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' - rm -f conftest2.* - if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; - then - # cc works too. - : - else - # cc exists but doesn't like -o. - eval ac_cv_prog_cc_${ac_cc}_c_o=no - fi - fi - fi -else - eval ac_cv_prog_cc_${ac_cc}_c_o=no -fi -rm -f core conftest* - -fi -if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h - -fi - -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi - - - -# option to specify python interpreter to use; this just sets $PYTHON, so that -# we will fallback to reading $PYTHON if --with-python is not given, and -# python.m4 will get the expected input - -# Check whether --with-python was given. -if test "${with_python+set}" = set; then : - withval=$with_python; PYTHON="$withval" -fi - -if test x"$PYTHON" = xyes; then - as_fn_error $? "--with-python option requires a path or program argument" "$LINENO" 5 -fi -if test -n "$PYTHON" && ! which "$PYTHON"; then - as_fn_error $? "Python interpreter $PYTHON does not exist" "$LINENO" 5 -fi - -# check that we have the minimum version of python necessary to build - - - - - if test -n "$PYTHON"; then - # If the user set $PYTHON, use it and don't search something else. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version >= 2.7" >&5 -$as_echo_n "checking whether $PYTHON version >= 2.7... " >&6; } - prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '2.7'.split('.'))) + [0, 0, 0] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] -sys.exit(sys.hexversion < minverhex)" - if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 - ($PYTHON -c "$prog") >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - as_fn_error $? "too old" "$LINENO" 5 -fi - am_display_PYTHON=$PYTHON - else - # Otherwise, try each interpreter until we find one that satisfies - # VERSION. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.7" >&5 -$as_echo_n "checking for a Python interpreter with version >= 2.7... " >&6; } -if ${am_cv_pathless_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - - for am_cv_pathless_PYTHON in python3 python3.3 python3.2 python3.1 python2 python2.7 python none; do - test "$am_cv_pathless_PYTHON" = none && break - prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '2.7'.split('.'))) + [0, 0, 0] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] -sys.exit(sys.hexversion < minverhex)" - if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 - ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - break -fi - done -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 -$as_echo "$am_cv_pathless_PYTHON" >&6; } - # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. - if test "$am_cv_pathless_PYTHON" = none; then - PYTHON=: - else - # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. -set dummy $am_cv_pathless_PYTHON; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PYTHON in - [\\/]* | ?:[\\/]*) - ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PYTHON=$ac_cv_path_PYTHON -if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi - am_display_PYTHON=$am_cv_pathless_PYTHON - fi - - - if test "$PYTHON" = :; then - as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5 - else - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 -$as_echo_n "checking for $am_display_PYTHON version... " >&6; } -if ${am_cv_python_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 -$as_echo "$am_cv_python_version" >&6; } - PYTHON_VERSION=$am_cv_python_version - - - - PYTHON_PREFIX='${prefix}' - - PYTHON_EXEC_PREFIX='${exec_prefix}' - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 -$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } -if ${am_cv_python_platform+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 -$as_echo "$am_cv_python_platform" >&6; } - PYTHON_PLATFORM=$am_cv_python_platform - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 -$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } -if ${am_cv_python_pythondir+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX'))" 2>/dev/null || - echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 -$as_echo "$am_cv_python_pythondir" >&6; } - pythondir=$am_cv_python_pythondir - - - - pkgpythondir=\${pythondir}/$PACKAGE - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 -$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } -if ${am_cv_python_pyexecdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX'))" 2>/dev/null || - echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 -$as_echo "$am_cv_python_pyexecdir" >&6; } - pyexecdir=$am_cv_python_pyexecdir - - - - pkgpyexecdir=\${pyexecdir}/$PACKAGE - - - - fi - - - -# check if we are building for python 3 -prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '3.0'.split('.'))) + [0, 0, 0] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] -sys.exit(sys.hexversion < minverhex)" - if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 - ($PYTHON -c "$prog") >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - build_py3k=true -else - build_py3k=false -fi - -# if building for python 3 make sure we have the minimum version supported -if test $build_py3k = true ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $PYTHON >= 3.1" >&5 -$as_echo_n "checking for $PYTHON >= 3.1... " >&6; } - prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '3.1'.split('.'))) + [0, 0, 0] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] -sys.exit(sys.hexversion < minverhex)" - if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 - ($PYTHON -c "$prog") >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - as_fn_error $? "too old" "$LINENO" 5 -fi -fi - -# - 'SO' for PyPy, CPython 2.7-3.2 -# - 'EXT_SUFFIX' for CPython3.3+ (http://bugs.python.org/issue16754) -# - fallback to '.so' -PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; get = distutils.sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"` - - - - - - - - - # Find any Python interpreter. - if test -z "$PYTHON"; then - for ac_prog in python3 python3.3 python3.2 python3.1 python2 python2.7 python -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PYTHON in - [\\/]* | ?:[\\/]*) - ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PYTHON=$ac_cv_path_PYTHON -if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$PYTHON" && break -done -test -n "$PYTHON" || PYTHON=":" - - fi - am_display_PYTHON=python - - - if test "$PYTHON" = :; then - as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5 - else - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 -$as_echo_n "checking for $am_display_PYTHON version... " >&6; } -if ${am_cv_python_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 -$as_echo "$am_cv_python_version" >&6; } - PYTHON_VERSION=$am_cv_python_version - - - - PYTHON_PREFIX='${prefix}' - - PYTHON_EXEC_PREFIX='${exec_prefix}' - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 -$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } -if ${am_cv_python_platform+:} false; then : - $as_echo_n "(cached) " >&6 -else - am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 -$as_echo "$am_cv_python_platform" >&6; } - PYTHON_PLATFORM=$am_cv_python_platform - - - # Just factor out some code duplication. - am_python_setup_sysconfig="\ -import sys -# Prefer sysconfig over distutils.sysconfig, for better compatibility -# with python 3.x. See automake bug#10227. -try: - import sysconfig -except ImportError: - can_use_sysconfig = 0 -else: - can_use_sysconfig = 1 -# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: -# -try: - from platform import python_implementation - if python_implementation() == 'CPython' and sys.version[:3] == '2.7': - can_use_sysconfig = 0 -except ImportError: - pass" - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 -$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } -if ${am_cv_python_pythondir+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$prefix" = xNONE - then - am_py_prefix=$ac_default_prefix - else - am_py_prefix=$prefix - fi - am_cv_python_pythondir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pythondir in - $am_py_prefix*) - am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` - am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` - ;; - *) - case $am_py_prefix in - /usr|/System*) ;; - *) - am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 -$as_echo "$am_cv_python_pythondir" >&6; } - pythondir=$am_cv_python_pythondir - - - - pkgpythondir=\${pythondir}/$PACKAGE - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 -$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } -if ${am_cv_python_pyexecdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$exec_prefix" = xNONE - then - am_py_exec_prefix=$am_py_prefix - else - am_py_exec_prefix=$exec_prefix - fi - am_cv_python_pyexecdir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pyexecdir in - $am_py_exec_prefix*) - am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` - am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` - ;; - *) - case $am_py_exec_prefix in - /usr|/System*) ;; - *) - am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 -$as_echo "$am_cv_python_pyexecdir" >&6; } - pyexecdir=$am_cv_python_pyexecdir - - - - pkgpyexecdir=\${pyexecdir}/$PACKAGE - - - - fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for headers required to compile python extensions" >&5 -$as_echo_n "checking for headers required to compile python extensions... " >&6; } -if test "x$PYTHON_INCLUDES" = x; then - PYTHON_CONFIG=`which $PYTHON`-config - if test -x "$PYTHON_CONFIG"; then - PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null` - else - PYTHON_INCLUDES=`$PYTHON -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc(True))"` - PYTHON_INCLUDES="-I$PYTHON_INCLUDES" - fi -fi - -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 -$as_echo "found" >&6; } - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } -as_fn_error $? "Python headers not found" "$LINENO" 5 -fi -rm -f conftest.err conftest.i conftest.$ac_ext -CPPFLAGS="$save_CPPFLAGS" - -if test "x$os_win32" = "xyes"; then - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libraries required to embed python" >&5 -$as_echo_n "checking for libraries required to embed python... " >&6; } -py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` -if test "x$PYTHON_LIBS" = x; then - PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}" -fi -if test "x$PYTHON_LIB_LOC" = x; then - PYTHON_LIB_LOC="${py_prefix}/lib" -fi - - -save_LIBS="$LIBS" -LIBS="$LIBS $PYTHON_LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char Py_Initialize (); -int -main () -{ -return Py_Initialize (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - LIBS="$save_LIBS"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; }; -else - LIBS="$save_LIBS"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; as_fn_error $? "Python libs not found. Windows requires Python modules to be explicitly linked to libpython." "$LINENO" 5 -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PySignal_SetWakeupFd in Python.h" >&5 -$as_echo_n "checking for PySignal_SetWakeupFd in Python.h... " >&6; } -old_CPPFLAGS=$CPPFLAGS -CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -PySignal_SetWakeupFd(0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - setwakeupfd_ok=yes -else - setwakeupfd_ok=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $setwakeupfd_ok" >&5 -$as_echo "$setwakeupfd_ok" >&6; } -if test "x$setwakeupfd_ok" != xno; then - -$as_echo "#define HAVE_PYSIGNAL_SETWAKEUPFD 1" >>confdefs.h - -fi -CPPFLAGS=$old_CPPFLAGS - -PLATFORM=`$PYTHON -c "import sys; from distutils import util; sys.stdout.write(util.get_platform())"` - - -# Check whether --enable-thread was given. -if test "${enable_thread+set}" = set; then : - enableval=$enable_thread; -else - enable_thread=yes -fi - - - -py_mod_var=`echo thread'_' | sed 'y%./+-%__p_%'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python module thread" >&5 -$as_echo_n "checking for python module thread... " >&6; } -if eval \${py_cv_mod_$py_mod_var+:} false; then : - $as_echo_n "(cached) " >&6 -else - -prog=" -import sys -try: - import thread -except ImportError: - sys.exit(1) -except: - sys.exit(0) -sys.exit(0)" -if $PYTHON -c "$prog" 1>&5 2>&5 - then - eval "py_cv_mod_$py_mod_var=yes" - else - eval "py_cv_mod_$py_mod_var=no" - fi - -fi - -py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"` -if test "x$py_val" != xno; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - enable_thread=check_for_py3_module -fi - -if test "x$enable_thread" = xcheck_for_py3_module; then - -py_mod_var=`echo _thread'_' | sed 'y%./+-%__p_%'` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python module _thread" >&5 -$as_echo_n "checking for python module _thread... " >&6; } -if eval \${py_cv_mod_$py_mod_var+:} false; then : - $as_echo_n "(cached) " >&6 -else - -prog=" -import sys -try: - import _thread -except ImportError: - sys.exit(1) -except: - sys.exit(0) -sys.exit(0)" -if $PYTHON -c "$prog" 1>&5 2>&5 - then - eval "py_cv_mod_$py_mod_var=yes" - else - eval "py_cv_mod_$py_mod_var=no" - fi - -fi - -py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"` -if test "x$py_val" != xno; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - enable_thread=yes -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - enable_thread=no -fi - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable threading in pygobject" >&5 -$as_echo_n "checking whether to enable threading in pygobject... " >&6; } -if test "x$enable_thread" != xno; then - extra_mods=gthread - THREADING_CFLAGS= - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - extra_mods= - THREADING_CFLAGS="-DDISABLE_THREADING" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -CPPFLAGS="${CPPFLAGS} $THREADING_CFLAGS" - -export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` - -# Check whether --enable-glibtest was given. -if test "${enable_glibtest+set}" = set; then : - enableval=$enable_glibtest; -else - enable_glibtest=yes -fi - - - pkg_config_args=glib-2.0 - for module in . gobject $extra_mods - do - case "$module" in - gmodule) - pkg_config_args="$pkg_config_args gmodule-2.0" - ;; - gmodule-no-export) - pkg_config_args="$pkg_config_args gmodule-no-export-2.0" - ;; - gobject) - pkg_config_args="$pkg_config_args gobject-2.0" - ;; - gthread) - pkg_config_args="$pkg_config_args gthread-2.0" - ;; - gio*) - pkg_config_args="$pkg_config_args $module-2.0" - ;; - esac - done - - - - - - - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.16 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi -fi - - no_glib="" - - if test "x$PKG_CONFIG" = x ; then - no_glib=yes - PKG_CONFIG=no - fi - - min_glib_version=2.35.9 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5 -$as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; } - - if test x$PKG_CONFIG != xno ; then - ## don't try to run the test against uninstalled libtool libs - if $PKG_CONFIG --uninstalled $pkg_config_args; then - echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" - enable_glibtest=no - fi - - if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then - : - else - no_glib=yes - fi - fi - - if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` - glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_glibtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$GLIB_LIBS $LIBS" - rm -f conf.glibtest - if test "$cross_compiling" = yes; then : - echo $ac_n "cross compiling; assumed OK... $ac_c" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include - -int -main () -{ - unsigned int major, minor, micro; - char *tmp_version; - - fclose (fopen ("conf.glibtest", "w")); - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_glib_version"); - if (sscanf(tmp_version, "%u.%u.%u", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_glib_version"); - exit(1); - } - - if ((glib_major_version != $glib_config_major_version) || - (glib_minor_version != $glib_config_minor_version) || - (glib_micro_version != $glib_config_micro_version)) - { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", - $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, - glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If pkg-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); - printf("*** to point to the correct configuration files\n"); - } - else if ((glib_major_version != GLIB_MAJOR_VERSION) || - (glib_minor_version != GLIB_MINOR_VERSION) || - (glib_micro_version != GLIB_MICRO_VERSION)) - { - printf("*** GLIB header files (version %d.%d.%d) do not match\n", - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - glib_major_version, glib_minor_version, glib_micro_version); - } - else - { - if ((glib_major_version > major) || - ((glib_major_version == major) && (glib_minor_version > minor)) || - ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", - glib_major_version, glib_minor_version, glib_micro_version); - printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", - major, minor, micro); - printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - no_glib=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_glib" = x ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 -$as_echo "yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; } - : - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "$PKG_CONFIG" = "no" ; then - echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" - else - if test -f conf.glibtest ; then - : - else - echo "*** Could not run GLIB test program, checking why..." - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$LIBS $GLIB_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main () -{ - return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GLIB or finding the wrong" - echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB is incorrectly installed." -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GLIB_CFLAGS="" - GLIB_LIBS="" - GLIB_GENMARSHAL="" - GOBJECT_QUERY="" - GLIB_MKENUMS="" - GLIB_COMPILE_RESOURCES="" - as_fn_error $? "maybe you want the pygobject-2-4 branch?" "$LINENO" 5 - fi - - - - - - - rm -f conf.glibtest - -if test -n "$export_dynamic"; then - GLIB_LIBS=`echo $GLIB_LIBS | sed -e "s/$export_dynamic//"` -fi -PYTHON_BASENAME=`basename $PYTHON` - - - - EXP_VAR=DATADIR - FROM_VAR=$datadir - - prefix_save=$prefix - exec_prefix_save=$exec_prefix - - if test "x$prefix" = "xNONE"; then - prefix=$ac_default_prefix - fi - if test "x$exec_prefix" = "xNONE"; then - exec_prefix=$prefix - fi - - full_var="$FROM_VAR" - while true; do - new_full_var="`eval echo $full_var`" - if test "x$new_full_var"="x$full_var"; then break; fi - full_var=$new_full_var - done - - full_var=$new_full_var - DATADIR="$full_var" - - - prefix=$prefix_save - exec_prefix=$exec_prefix_save - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffi" >&5 -$as_echo_n "checking for ffi... " >&6; } - -# Check whether --with-ffi was given. -if test "${with_ffi+set}" = set; then : - withval=$with_ffi; with_libffi=$withval -else - with_libffi=auto -fi - -if test x"$with_libffi" = xno ; then - have_libffi=false -else - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FFI" >&5 -$as_echo_n "checking for FFI... " >&6; } - -if test -n "$FFI_CFLAGS"; then - pkg_cv_FFI_CFLAGS="$FFI_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libffi >= 3.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libffi >= 3.0") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_FFI_CFLAGS=`$PKG_CONFIG --cflags "libffi >= 3.0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$FFI_LIBS"; then - pkg_cv_FFI_LIBS="$FFI_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libffi >= 3.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libffi >= 3.0") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_FFI_LIBS=`$PKG_CONFIG --libs "libffi >= 3.0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - FFI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libffi >= 3.0" 2>&1` - else - FFI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libffi >= 3.0" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$FFI_PKG_ERRORS" >&5 - - have_libffi=no -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - have_libffi=no -else - FFI_CFLAGS=$pkg_cv_FFI_CFLAGS - FFI_LIBS=$pkg_cv_FFI_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_libffi=yes -fi -fi -if test x"$with_libffi" = xyes && test x"$have_libffi" = xno ; then - as_fn_error $? "ffi requested, but not found" "$LINENO" 5 -fi -if test x"$have_libffi" = xyes; then - LIBFFI_PC=libffi -fi - if test "$have_libffi" = "yes"; then - HAVE_LIBFFI_TRUE= - HAVE_LIBFFI_FALSE='#' -else - HAVE_LIBFFI_TRUE='#' - HAVE_LIBFFI_FALSE= -fi - - - - - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GIO" >&5 -$as_echo_n "checking for GIO... " >&6; } - -if test -n "$GIO_CFLAGS"; then - pkg_cv_GIO_CFLAGS="$GIO_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.35.9\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.35.9") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_GIO_CFLAGS=`$PKG_CONFIG --cflags "gio-2.0 >= 2.35.9" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$GIO_LIBS"; then - pkg_cv_GIO_LIBS="$GIO_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.35.9\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.35.9") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_GIO_LIBS=`$PKG_CONFIG --libs "gio-2.0 >= 2.35.9" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - GIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gio-2.0 >= 2.35.9" 2>&1` - else - GIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gio-2.0 >= 2.35.9" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$GIO_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (gio-2.0 >= 2.35.9) were not met: - -$GIO_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables GIO_CFLAGS -and GIO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables GIO_CFLAGS -and GIO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - GIO_CFLAGS=$pkg_cv_GIO_CFLAGS - GIO_LIBS=$pkg_cv_GIO_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -# Check whether --enable-cairo was given. -if test "${enable_cairo+set}" = set; then : - enableval=$enable_cairo; enable_cairo=$enableval -else - enable_cairo=yes -fi - - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GI" >&5 -$as_echo_n "checking for GI... " >&6; } - -if test -n "$GI_CFLAGS"; then - pkg_cv_GI_CFLAGS="$GI_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -\""; } >&5 - ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_GI_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$GI_LIBS"; then - pkg_cv_GI_LIBS="$GI_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -\""; } >&5 - ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_GI_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - GI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -" 2>&1` - else - GI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$GI_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (glib-2.0 >= 2.35.9 - gobject-introspection-1.0 >= 1.35.9 -) were not met: - -$GI_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables GI_CFLAGS -and GI_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables GI_CFLAGS -and GI_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - GI_CFLAGS=$pkg_cv_GI_CFLAGS - GI_LIBS=$pkg_cv_GI_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - -GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0) - - -if test "$enable_cairo" != no; then - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAIRO" >&5 -$as_echo_n "checking for CAIRO... " >&6; } - -if test -n "$CAIRO_CFLAGS"; then - pkg_cv_CAIRO_CFLAGS="$CAIRO_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo cairo-gobject\""; } >&5 - ($PKG_CONFIG --exists --print-errors "cairo cairo-gobject") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo cairo-gobject" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$CAIRO_LIBS"; then - pkg_cv_CAIRO_LIBS="$CAIRO_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo cairo-gobject\""; } >&5 - ($PKG_CONFIG --exists --print-errors "cairo cairo-gobject") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_CAIRO_LIBS=`$PKG_CONFIG --libs "cairo cairo-gobject" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - CAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cairo cairo-gobject" 2>&1` - else - CAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cairo cairo-gobject" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$CAIRO_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (cairo cairo-gobject) were not met: - -$CAIRO_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables CAIRO_CFLAGS -and CAIRO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables CAIRO_CFLAGS -and CAIRO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - CAIRO_CFLAGS=$pkg_cv_CAIRO_CFLAGS - CAIRO_LIBS=$pkg_cv_CAIRO_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - - if test $build_py3k = true; then - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYCAIRO" >&5 -$as_echo_n "checking for PYCAIRO... " >&6; } - -if test -n "$PYCAIRO_CFLAGS"; then - pkg_cv_PYCAIRO_CFLAGS="$PYCAIRO_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"py3cairo >= 1.10.0 - \""; } >&5 - ($PKG_CONFIG --exists --print-errors "py3cairo >= 1.10.0 - ") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PYCAIRO_CFLAGS=`$PKG_CONFIG --cflags "py3cairo >= 1.10.0 - " 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$PYCAIRO_LIBS"; then - pkg_cv_PYCAIRO_LIBS="$PYCAIRO_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"py3cairo >= 1.10.0 - \""; } >&5 - ($PKG_CONFIG --exists --print-errors "py3cairo >= 1.10.0 - ") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PYCAIRO_LIBS=`$PKG_CONFIG --libs "py3cairo >= 1.10.0 - " 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "py3cairo >= 1.10.0 - " 2>&1` - else - PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "py3cairo >= 1.10.0 - " 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$PYCAIRO_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (py3cairo >= 1.10.0 - ) were not met: - -$PYCAIRO_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables PYCAIRO_CFLAGS -and PYCAIRO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables PYCAIRO_CFLAGS -and PYCAIRO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - PYCAIRO_CFLAGS=$pkg_cv_PYCAIRO_CFLAGS - PYCAIRO_LIBS=$pkg_cv_PYCAIRO_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - else - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYCAIRO" >&5 -$as_echo_n "checking for PYCAIRO... " >&6; } - -if test -n "$PYCAIRO_CFLAGS"; then - pkg_cv_PYCAIRO_CFLAGS="$PYCAIRO_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pycairo >= 1.2.0 - \""; } >&5 - ($PKG_CONFIG --exists --print-errors "pycairo >= 1.2.0 - ") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PYCAIRO_CFLAGS=`$PKG_CONFIG --cflags "pycairo >= 1.2.0 - " 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$PYCAIRO_LIBS"; then - pkg_cv_PYCAIRO_LIBS="$PYCAIRO_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pycairo >= 1.2.0 - \""; } >&5 - ($PKG_CONFIG --exists --print-errors "pycairo >= 1.2.0 - ") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_PYCAIRO_LIBS=`$PKG_CONFIG --libs "pycairo >= 1.2.0 - " 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pycairo >= 1.2.0 - " 2>&1` - else - PYCAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pycairo >= 1.2.0 - " 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$PYCAIRO_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pycairo >= 1.2.0 - ) were not met: - -$PYCAIRO_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables PYCAIRO_CFLAGS -and PYCAIRO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables PYCAIRO_CFLAGS -and PYCAIRO_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - PYCAIRO_CFLAGS=$pkg_cv_PYCAIRO_CFLAGS - PYCAIRO_LIBS=$pkg_cv_PYCAIRO_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -fi - fi -fi - if test "$enable_cairo" = "yes"; then - ENABLE_CAIRO_TRUE= - ENABLE_CAIRO_FALSE='#' -else - ENABLE_CAIRO_TRUE='#' - ENABLE_CAIRO_FALSE= -fi - - -INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` -INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` - - - - -# compiler warnings, errors, required cflags, and code coverage support - - - # Check whether --enable-compile-warnings was given. -if test "${enable_compile_warnings+set}" = set; then : - enableval=$enable_compile_warnings; -else - enable_compile_warnings="maximum" -fi - - - if test "x$GCC" != xyes; then - enable_compile_warnings=no - fi - - warning_flags= - realsave_CFLAGS="$CFLAGS" - - base_warn_flags=" \ - -Wall \ - -Wstrict-prototypes \ - -Wnested-externs \ - " - - base_error_flags=" \ - -Werror=missing-prototypes \ - -Werror=implicit-function-declaration \ - -Werror=pointer-arith \ - -Werror=init-self \ - -Werror=format-security \ - -Werror=format=2 \ - -Werror=missing-include-dirs \ - " - - case "$enable_compile_warnings" in - no) - warning_flags= - ;; - minimum) - warning_flags="-Wall" - ;; - yes) - warning_flags="$base_warn_flags $base_error_flags" - ;; - maximum|error) - warning_flags="$base_warn_flags $base_error_flags" - ;; - *) - as_fn_error $? "Unknown argument '$enable_compile_warnings' to --enable-compile-warnings" "$LINENO" 5 - ;; - esac - - if test "$enable_compile_warnings" = "error" ; then - warning_flags="$warning_flags -Werror" - fi - - for option in $warning_flags; do - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $option" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands $option" >&5 -$as_echo_n "checking whether gcc understands $option... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - has_option=yes -else - has_option=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5 -$as_echo "$has_option" >&6; } - if test $has_option = yes; then - tested_warning_flags="$tested_warning_flags $option" - fi - unset has_option - unset save_CFLAGS - done - unset option - CFLAGS="$realsave_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking what warning flags to pass to the C compiler" >&5 -$as_echo_n "checking what warning flags to pass to the C compiler... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tested_warning_flags" >&5 -$as_echo "$tested_warning_flags" >&6; } - - # Check whether --enable-iso-c was given. -if test "${enable_iso_c+set}" = set; then : - enableval=$enable_iso_c; -else - enable_iso_c=no -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking what language compliance flags to pass to the C compiler" >&5 -$as_echo_n "checking what language compliance flags to pass to the C compiler... " >&6; } - complCFLAGS= - if test "x$enable_iso_c" != "xno"; then - if test "x$GCC" = "xyes"; then - case " $CFLAGS " in - *\ \ -ansi\ \ *) ;; - *) complCFLAGS="$complCFLAGS -ansi" ;; - esac - case " $CFLAGS " in - *\ \ -pedantic\ \ *) ;; - *) complCFLAGS="$complCFLAGS -pedantic" ;; - esac - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $complCFLAGS" >&5 -$as_echo "$complCFLAGS" >&6; } - - WARN_CFLAGS="$tested_warning_flags $complCFLAGS" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gnome code coverage support" >&5 -$as_echo_n "checking for Gnome code coverage support... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build with code coverage support" >&5 -$as_echo_n "checking whether to build with code coverage support... " >&6; } - # Check whether --enable-code-coverage was given. -if test "${enable_code_coverage+set}" = set; then : - enableval=$enable_code_coverage; -else - enable_code_coverage=no -fi - - if test x$enable_code_coverage = xyes; then - CODE_COVERAGE_ENABLED_TRUE= - CODE_COVERAGE_ENABLED_FALSE='#' -else - CODE_COVERAGE_ENABLED_TRUE='#' - CODE_COVERAGE_ENABLED_FALSE= -fi - - CODE_COVERAGE_ENABLED=$enable_code_coverage - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_code_coverage" >&5 -$as_echo "$enable_code_coverage" >&6; } - - if test "$enable_code_coverage" = "yes" ; then : - - if test "$GCC" = "no" ; then : - - as_fn_error $? "not compiling with gcc, which is required for gcov code coverage" "$LINENO" 5 - -fi - - # List of supported lcov versions. - lcov_version_list="1.6 1.7 1.8 1.9" - - # Extract the first word of "lcov", so it can be a program name with args. -set dummy lcov; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LCOV+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LCOV"; then - ac_cv_prog_LCOV="$LCOV" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_LCOV="lcov" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LCOV=$ac_cv_prog_LCOV -if test -n "$LCOV"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5 -$as_echo "$LCOV" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - # Extract the first word of "genhtml", so it can be a program name with args. -set dummy genhtml; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_GENHTML+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$GENHTML"; then - ac_cv_prog_GENHTML="$GENHTML" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_GENHTML="genhtml" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -GENHTML=$ac_cv_prog_GENHTML -if test -n "$GENHTML"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GENHTML" >&5 -$as_echo "$GENHTML" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - if test "$LCOV" ; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lcov version" >&5 -$as_echo_n "checking for lcov version... " >&6; } -if ${gnome_cv_lcov_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - - gnome_cv_lcov_version=invalid - lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` - for lcov_check_version in $lcov_version_list; do - if test "$lcov_version" = "$lcov_check_version"; then - gnome_cv_lcov_version="$lcov_check_version (ok)" - fi - done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gnome_cv_lcov_version" >&5 -$as_echo "$gnome_cv_lcov_version" >&6; } - -else - - lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" - as_fn_error $? "$lcov_msg" "$LINENO" 5 - -fi - - case $gnome_cv_lcov_version in - ""|invalid) - lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." - as_fn_error $? "$lcov_msg" "$LINENO" 5 - LCOV="exit 0;" - ;; - esac - - if test -z "$GENHTML" ; then : - - as_fn_error $? "Could not find genhtml from the lcov package" "$LINENO" 5 - -fi - - CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_LDFLAGS="-lgcov" - - - - -fi - -GNOME_CODE_COVERAGE_RULES=' -# Code coverage -# -# Optional: -# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. -# (Default: $(top_builddir)) -# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated -# by lcov for code coverage. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) -# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage -# reports to be created. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) -# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the lcov instance. -# (Default: empty) -# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml -# instance. (Default: empty) -# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore -# -# The generated report will be titled using the $(PACKAGE_NAME) and -# $(PACKAGE_VERSION). In order to add the current git hash to the title, -# use the git-version-gen script, available online. - -# Optional variables -CODE_COVERAGE_DIRECTORY ?= $(top_builddir) -CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info -CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage -CODE_COVERAGE_LCOV_OPTIONS ?= -CODE_COVERAGE_GENHTML_OPTIONS ?= -CODE_COVERAGE_IGNORE_PATTERN ?= - -code_coverage_quiet = $(code_coverage_quiet_$(V)) -code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) -code_coverage_quiet_0 = --quiet - -# Use recursive makes in order to ignore errors during check -check-code-coverage: -ifdef CODE_COVERAGE_ENABLED - -$(MAKE) $(AM_MAKEFLAGS) -k check - $(MAKE) $(AM_MAKEFLAGS) code-coverage-capture -else - @echo "Need to reconfigure with --enable-code-coverage" -endif - -# Capture code coverage data -code-coverage-capture: code-coverage-capture-hook -ifdef CODE_COVERAGE_ENABLED - $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS) - $(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" - -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp - LANG=C $(GENHTML) $(code_coverage_quiet) --prefix $(CODE_COVERAGE_DIRECTORY) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) - @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" -else - @echo "Need to reconfigure with --enable-code-coverage" -endif - -# Hook rule executed before code-coverage-capture, overridable by the user -code-coverage-capture-hook: - -clean: code-coverage-clean -code-coverage-clean: - -$(LCOV) --directory $(top_builddir) -z - -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -find . -name "*.gcda" -o -name "*.gcov" -delete - -GITIGNOREFILES ?= -GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -DISTCHECK_CONFIGURE_FLAGS ?= -DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage - -.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean -' - - - - - -if test "x$GCC" = "xyes"; then - -case " $CFLAGS " in -*[\ \ ]-Wall[\ \ ]*) - ;; -*) - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Wall" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -Wall" >&5 -$as_echo_n "checking whether $CC understands -Wall... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - jh_has_option=yes -else - jh_has_option=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jh_has_option" >&5 -$as_echo "$jh_has_option" >&6; } - if test $jh_has_option = no; then - CFLAGS="$save_CFLAGS" - fi - ;; -esac - -case " $CFLAGS " in -*[\ \ ]-Werror=unused-variable[\ \ ]*) - ;; -*) - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror=unused-variable" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -Werror=unused-variable" >&5 -$as_echo_n "checking whether $CC understands -Werror=unused-variable... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - jh_has_option=yes -else - jh_has_option=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jh_has_option" >&5 -$as_echo "$jh_has_option" >&6; } - if test $jh_has_option = no; then - CFLAGS="$save_CFLAGS" - fi - ;; -esac - -case " $CFLAGS " in -*[\ \ ]-fno-strict-aliasing[\ \ ]*) - ;; -*) - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-strict-aliasing" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -fno-strict-aliasing" >&5 -$as_echo_n "checking whether $CC understands -fno-strict-aliasing... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - jh_has_option=yes -else - jh_has_option=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jh_has_option" >&5 -$as_echo "$jh_has_option" >&6; } - if test $jh_has_option = no; then - CFLAGS="$save_CFLAGS" - fi - ;; -esac - - case $host_os in - solaris*) - ;; - *) - -case " $CFLAGS " in -*[\ \ ]-std=c9x[\ \ ]*) - ;; -*) - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -std=c9x" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -std=c9x" >&5 -$as_echo_n "checking whether $CC understands -std=c9x... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - jh_has_option=yes -else - jh_has_option=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $jh_has_option" >&5 -$as_echo "$jh_has_option" >&6; } - if test $jh_has_option = no; then - CFLAGS="$save_CFLAGS" - fi - ;; -esac - ;; - esac - -fi - -CFLAGS="$CFLAGS $WARN_CFLAGS $CODE_COVERAGE_CFLAGS" -LDFLAGS="$LDFLAGS $CODE_COVERAGE_CFLAGS" - -ac_config_files="$ac_config_files Makefile pygobject-3.0.pc pygobject-3.0-uninstalled.pc gi/Makefile gi/repository/Makefile gi/overrides/Makefile gi/_glib/Makefile gi/_gobject/Makefile examples/Makefile tests/Makefile pygtkcompat/Makefile PKG-INFO" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${PLATFORM_WIN32_TRUE}" && test -z "${PLATFORM_WIN32_FALSE}"; then - as_fn_error $? "conditional \"PLATFORM_WIN32\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then - as_fn_error $? "conditional \"OS_WIN32\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_LIBFFI_TRUE}" && test -z "${HAVE_LIBFFI_FALSE}"; then - as_fn_error $? "conditional \"HAVE_LIBFFI\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${ENABLE_CAIRO_TRUE}" && test -z "${ENABLE_CAIRO_FALSE}"; then - as_fn_error $? "conditional \"ENABLE_CAIRO\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${CODE_COVERAGE_ENABLED_TRUE}" && test -z "${CODE_COVERAGE_ENABLED_FALSE}"; then - as_fn_error $? "conditional \"CODE_COVERAGE_ENABLED\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by pygobject $as_me 3.9.92, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to . -pygobject home page: ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -pygobject config.status 3.9.92 -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in AS \ -DLLTOOL \ -OBJDUMP \ -SHELL \ -ECHO \ -PATH_SEPARATOR \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -deplibs_check_method \ -file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -sharedlib_from_linklib_cmd \ -AR \ -AR_FLAGS \ -archiver_list_spec \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -nm_file_list_spec \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ -lt_prog_compiler_wl \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -MANIFEST_TOOL \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_separator \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postlink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "pygobject-3.0.pc") CONFIG_FILES="$CONFIG_FILES pygobject-3.0.pc" ;; - "pygobject-3.0-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES pygobject-3.0-uninstalled.pc" ;; - "gi/Makefile") CONFIG_FILES="$CONFIG_FILES gi/Makefile" ;; - "gi/repository/Makefile") CONFIG_FILES="$CONFIG_FILES gi/repository/Makefile" ;; - "gi/overrides/Makefile") CONFIG_FILES="$CONFIG_FILES gi/overrides/Makefile" ;; - "gi/_glib/Makefile") CONFIG_FILES="$CONFIG_FILES gi/_glib/Makefile" ;; - "gi/_gobject/Makefile") CONFIG_FILES="$CONFIG_FILES gi/_gobject/Makefile" ;; - "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; - "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "pygtkcompat/Makefile") CONFIG_FILES="$CONFIG_FILES pygtkcompat/Makefile" ;; - "PKG-INFO") CONFIG_FILES="$CONFIG_FILES PKG-INFO" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="" - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Assembler program. -AS=$lt_AS - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Object dumper program. -OBJDUMP=$lt_OBJDUMP - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The PATH separator for the build system. -PATH_SEPARATOR=$lt_PATH_SEPARATOR - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - -# The archiver. -AR=$lt_AR - -# Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS - -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and in which our libraries should be installed. -lt_sysroot=$lt_sysroot - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - if test x"$xsi_shell" = xyes; then - sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ -func_dirname ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_basename ()$/,/^} # func_basename /c\ -func_basename ()\ -{\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ -func_dirname_and_basename ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ -func_stripname ()\ -{\ -\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ -\ # positional parameters, so assign one to ordinary parameter first.\ -\ func_stripname_result=${3}\ -\ func_stripname_result=${func_stripname_result#"${1}"}\ -\ func_stripname_result=${func_stripname_result%"${2}"}\ -} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ -func_split_long_opt ()\ -{\ -\ func_split_long_opt_name=${1%%=*}\ -\ func_split_long_opt_arg=${1#*=}\ -} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ -func_split_short_opt ()\ -{\ -\ func_split_short_opt_arg=${1#??}\ -\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ -} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ -func_lo2o ()\ -{\ -\ case ${1} in\ -\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ -\ *) func_lo2o_result=${1} ;;\ -\ esac\ -} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_xform ()$/,/^} # func_xform /c\ -func_xform ()\ -{\ - func_xform_result=${1%.*}.lo\ -} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_arith ()$/,/^} # func_arith /c\ -func_arith ()\ -{\ - func_arith_result=$(( $* ))\ -} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_len ()$/,/^} # func_len /c\ -func_len ()\ -{\ - func_len_result=${#1}\ -} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - -fi - -if test x"$lt_shell_append" = xyes; then - sed -e '/^func_append ()$/,/^} # func_append /c\ -func_append ()\ -{\ - eval "${1}+=\\${2}"\ -} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ -func_append_quoted ()\ -{\ -\ func_quote_for_eval "${2}"\ -\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ -} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 -$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} -fi - - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: - pygobject $VERSION - - Using python interpreter: $PYTHON - libffi support: $have_libffi - cairo support: $enable_cairo - thread support: $enable_thread - code coverage support: $enable_code_coverage -" >&5 -$as_echo " - pygobject $VERSION - - Using python interpreter: $PYTHON - libffi support: $have_libffi - cairo support: $enable_cairo - thread support: $enable_thread - code coverage support: $enable_code_coverage -" >&6; } - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index d0a41b8..0000000 --- a/configure.ac +++ /dev/null @@ -1,288 +0,0 @@ --*- mode: m4 -*- -AC_PREREQ([2.68]) - -# The version of python used is determined by the executable pointed to by the -# --with-python switch, or if that's not set, by the PYTHON environment -# variable. For instance if your system installs Python 3 as python3 to -# configure to compile pygobject under Python 3 you would do this: -# $ ./configure --with-python=python3 -# or -# $ PYTHON=python3 ./configure -# -# You can also build against a full interpreter path, such as -# $ ./configure --with-python=~/my-patched-python/python - -m4_define(python_min_ver, 2.7) -m4_define(python3_min_ver, 3.1) - -dnl the pygobject version number -m4_define(pygobject_major_version, 3) -m4_define(pygobject_minor_version, 9) -m4_define(pygobject_micro_version, 92) -m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version) - -dnl versions of packages we require ... -m4_define(introspection_required_version, 1.35.9) -m4_define(py2cairo_required_version, 1.2.0) -m4_define(py3cairo_required_version, 1.10.0) -m4_define(glib_required_version, 2.35.9) -m4_define(gio_required_version, 2.35.9) - -AC_INIT([pygobject],[pygobject_version], - [http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject], - [pygobject],[https://live.gnome.org/PyGObject/]) -AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .") -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR([gi/gimodule.c]) - -AC_DEFINE(PYGOBJECT_MAJOR_VERSION, pygobject_major_version, [pygobject major version]) -AC_SUBST(PYGOBJECT_MAJOR_VERSION, pygobject_major_version) -AC_DEFINE(PYGOBJECT_MINOR_VERSION, pygobject_minor_version, [pygobject minor version]) -AC_SUBST(PYGOBJECT_MINOR_VERSION, pygobject_minor_version) -AC_DEFINE(PYGOBJECT_MICRO_VERSION, pygobject_micro_version, [pygobject micro version]) -AC_SUBST(PYGOBJECT_MICRO_VERSION, pygobject_micro_version) - -AC_CONFIG_HEADERS(config.h) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)]) -AM_INIT_AUTOMAKE([1.11.1 foreign no-dist-gzip dist-xz]) - -dnl put the ACLOCAL flags in the makefile -ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" - -AC_CANONICAL_BUILD -AC_CANONICAL_HOST -AC_MSG_CHECKING([for some Win32 platform]) -case "$host" in - *-*-mingw*|*-*-cygwin*) - platform_win32=yes - ;; - *) - platform_win32=no - ;; -esac -AC_MSG_RESULT([$platform_win32]) -AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes") - -AC_MSG_CHECKING([for native Win32]) -case "$host" in - *-*-mingw*) - os_win32=yes - ;; - *) - os_win32=no - ;; -esac -AC_MSG_RESULT([$os_win32]) -AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") - -LT_PREREQ([2.2.6]) -LT_INIT([dlopen win32-dll disable-static]) - -AC_SEARCH_LIBS([strerror],[cposix]) -AC_PROG_CC -AM_PROG_CC_C_O - -# option to specify python interpreter to use; this just sets $PYTHON, so that -# we will fallback to reading $PYTHON if --with-python is not given, and -# python.m4 will get the expected input -AC_ARG_WITH(python, - AS_HELP_STRING([--with-python=PATH],[Path to Python interpreter; searches $PATH if only a program name is given; if not given, searches for a few standard names such as "python3" or "python2"]), - [PYTHON="$withval"], []) -if test x"$PYTHON" = xyes; then - AC_MSG_ERROR([--with-python option requires a path or program argument]) -fi -if test -n "$PYTHON" && ! which "$PYTHON"; then - AC_MSG_ERROR([Python interpreter $PYTHON does not exist]) -fi - -# check that we have the minimum version of python necessary to build -JD_PATH_PYTHON(python_min_ver) - -# check if we are building for python 3 -JD_PYTHON_CHECK_VERSION([$PYTHON], [3.0], - build_py3k=true, - build_py3k=false) - -# if building for python 3 make sure we have the minimum version supported -if test $build_py3k = true ; then - AC_MSG_CHECKING([for $PYTHON >=] python3_min_ver) - JD_PYTHON_CHECK_VERSION([$PYTHON], python3_min_ver, - [AC_MSG_RESULT(yes)], - [AC_MSG_ERROR(too old)]) -fi - -# - 'SO' for PyPy, CPython 2.7-3.2 -# - 'EXT_SUFFIX' for CPython3.3+ (http://bugs.python.org/issue16754) -# - fallback to '.so' -PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; get = distutils.sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"` -AC_SUBST(PYTHON_SO) - -AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found])) -if test "x$os_win32" = "xyes"; then - AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.])) -fi - -AC_MSG_CHECKING([for PySignal_SetWakeupFd in Python.h]) -old_CPPFLAGS=$CPPFLAGS -CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[PySignal_SetWakeupFd(0);]])], - [setwakeupfd_ok=yes],[setwakeupfd_ok=no]) -AC_MSG_RESULT($setwakeupfd_ok) -if test "x$setwakeupfd_ok" != xno; then - AC_DEFINE(HAVE_PYSIGNAL_SETWAKEUPFD, 1, - [Define to 1 if PySignal_SetWakeupFd is available]) -fi -CPPFLAGS=$old_CPPFLAGS - -PLATFORM=`$PYTHON -c "import sys; from distutils import util; sys.stdout.write(util.get_platform())"` -AC_SUBST(PLATFORM) - -AC_ARG_ENABLE(thread, - AS_HELP_STRING([--disable-thread],[Disable pygobject threading support]),, - enable_thread=yes) - -AM_CHECK_PYMOD(thread,,,enable_thread=check_for_py3_module) -if test "x$enable_thread" = xcheck_for_py3_module; then - dnl Python 3 uses the _thread module so check for that - AM_CHECK_PYMOD(_thread,,enable_thread=yes,enable_thread=no) -fi - -AC_MSG_CHECKING(whether to enable threading in pygobject) -if test "x$enable_thread" != xno; then - extra_mods=gthread - THREADING_CFLAGS= - AC_MSG_RESULT(yes) -else - extra_mods= - THREADING_CFLAGS="-DDISABLE_THREADING" - AC_MSG_RESULT(no) -fi -AC_SUBST(THREADING_CFLAGS) -CPPFLAGS="${CPPFLAGS} $THREADING_CFLAGS" - -dnl get rid of the -export-dynamic stuff from the configure flags ... -export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` - -dnl glib -AM_PATH_GLIB_2_0(glib_required_version,,[AC_MSG_ERROR(maybe you want the pygobject-2-4 branch?)],gobject $extra_mods) -if test -n "$export_dynamic"; then - GLIB_LIBS=`echo $GLIB_LIBS | sed -e "s/$export_dynamic//"` -fi -PYTHON_BASENAME=`basename $PYTHON` -AC_SUBST([PYTHON_BASENAME]) - -AS_AC_EXPAND(DATADIR, $datadir) - -dnl libffi -AC_MSG_CHECKING(for ffi) -AC_ARG_WITH(ffi, - AS_HELP_STRING([--without-ffi],[Disable libffi support]), - with_libffi=$withval, - with_libffi=auto) -if test x"$with_libffi" = xno ; then - have_libffi=false -else - PKG_CHECK_MODULES(FFI, libffi >= 3.0, have_libffi=yes, have_libffi=no) -fi -if test x"$with_libffi" = xyes && test x"$have_libffi" = xno ; then - AC_MSG_ERROR([ffi requested, but not found]) -fi -if test x"$have_libffi" = xyes; then - LIBFFI_PC=libffi -fi -AM_CONDITIONAL(HAVE_LIBFFI, test "$have_libffi" = "yes") -AC_SUBST(FFI_CFLAGS) -AC_SUBST(FFI_LIBS) -AC_SUBST(LIBFFI_PC) - -dnl gio -PKG_CHECK_MODULES(GIO, gio-2.0 >= gio_required_version) - -AC_ARG_ENABLE(cairo, - AS_HELP_STRING([--enable-cairo],[Enable Cairo bindings using introspection information]), - enable_cairo=$enableval, - enable_cairo=yes) - -PKG_CHECK_MODULES(GI, - glib-2.0 >= glib_required_version - gobject-introspection-1.0 >= introspection_required_version -) - -GI_DATADIR=$($PKG_CONFIG --variable=gidatadir gobject-introspection-1.0) -AC_SUBST(GI_DATADIR) - -if test "$enable_cairo" != no; then - PKG_CHECK_MODULES(CAIRO, cairo cairo-gobject) - - if test $build_py3k = true; then - PKG_CHECK_MODULES(PYCAIRO, - py3cairo >= py3cairo_required_version - ) - else - PKG_CHECK_MODULES(PYCAIRO, - pycairo >= py2cairo_required_version - ) - fi -fi -AM_CONDITIONAL(ENABLE_CAIRO, test "$enable_cairo" = "yes") - -INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` -INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` - -AC_SUBST(INTROSPECTION_SCANNER) -AC_SUBST(INTROSPECTION_COMPILER) - -# compiler warnings, errors, required cflags, and code coverage support -GNOME_COMPILE_WARNINGS([maximum]) -AC_MSG_CHECKING(for Gnome code coverage support) -m4_ifdef([GNOME_CODE_COVERAGE], - [AC_MSG_RESULT(yes) - GNOME_CODE_COVERAGE], - [AC_MSG_RESULT(no) - GNOME_CODE_COVERAGE_RULES='' - AC_SUBST([GNOME_CODE_COVERAGE_RULES]) - enable_code_coverage="no"]) - -if test "x$GCC" = "xyes"; then - JH_ADD_CFLAG([-Wall]) - JH_ADD_CFLAG([-Werror=unused-variable]) - JH_ADD_CFLAG([-fno-strict-aliasing]) - - case $host_os in - solaris*) - ;; - *) - JH_ADD_CFLAG([-std=c9x]) - ;; - esac - -fi - -CFLAGS="$CFLAGS $WARN_CFLAGS $CODE_COVERAGE_CFLAGS" -LDFLAGS="$LDFLAGS $CODE_COVERAGE_CFLAGS" - -AC_CONFIG_FILES( - Makefile - pygobject-3.0.pc - pygobject-3.0-uninstalled.pc - gi/Makefile - gi/repository/Makefile - gi/overrides/Makefile - gi/_glib/Makefile - gi/_gobject/Makefile - examples/Makefile - tests/Makefile - pygtkcompat/Makefile - PKG-INFO) -AC_OUTPUT - -AC_MSG_RESULT([ - pygobject $VERSION - - Using python interpreter: $PYTHON - libffi support: $have_libffi - cairo support: $enable_cairo - thread support: $enable_thread - code coverage support: $enable_code_coverage -]) - diff --git a/depcomp b/depcomp deleted file mode 100755 index 4ebd5b3..0000000 --- a/depcomp +++ /dev/null @@ -1,791 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2013-05-30.07; # UTC - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by 'PROGRAMS ARGS'. - object Object file output by 'PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputting dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -# Get the directory component of the given path, and save it in the -# global variables '$dir'. Note that this directory component will -# be either empty or ending with a '/' character. This is deliberate. -set_dir_from () -{ - case $1 in - */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; - *) dir=;; - esac -} - -# Get the suffix-stripped basename of the given path, and save it the -# global variable '$base'. -set_base_from () -{ - base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` -} - -# If no dependency file was actually created by the compiler invocation, -# we still have to create a dummy depfile, to avoid errors with the -# Makefile "include basename.Plo" scheme. -make_dummy_depfile () -{ - echo "#dummy" > "$depfile" -} - -# Factor out some common post-processing of the generated depfile. -# Requires the auxiliary global variable '$tmpdepfile' to be set. -aix_post_process_depfile () -{ - # If the compiler actually managed to produce a dependency file, - # post-process it. - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependency.h'. - # Do two passes, one to just change these to - # $object: dependency.h - # and one to simply output - # dependency.h: - # which is needed to avoid the deleted-header problem. - { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" - } > "$depfile" - rm -f "$tmpdepfile" - else - make_dummy_depfile - fi -} - -# A tabulation character. -tab=' ' -# A newline character. -nl=' -' -# Character ranges might be problematic outside the C locale. -# These definitions help. -upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ -lower=abcdefghijklmnopqrstuvwxyz -digits=0123456789 -alpha=${upper}${lower} - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Avoid interferences from the environment. -gccflag= dashmflag= - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp -fi - -if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 -fi - -if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. - gccflag=-qmakedep=gcc,-MF - depmode=gcc -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. -## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. -## (see the conditional assignment to $gccflag above). -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). Also, it might not be -## supported by the other compilers which use the 'gcc' depmode. -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The second -e expression handles DOS-style file names with drive - # letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the "deleted header file" problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. -## Some versions of gcc put a space before the ':'. On the theory -## that the space means something, we add a space to the output as -## well. hp depmode also adds that space, but also prefixes the VPATH -## to the object. Take care to not repeat it in the output. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like '#:fec' to the end of the - # dependency line. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ - | tr "$nl" ' ' >> "$depfile" - echo >> "$depfile" - # The second pass generates a dummy entry for each header file. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" - ;; - -xlc) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts '$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - aix_post_process_depfile - ;; - -tcc) - # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 - # FIXME: That version still under development at the moment of writing. - # Make that this statement remains true also for stable, released - # versions. - # It will wrap lines (doesn't matter whether long or short) with a - # trailing '\', as in: - # - # foo.o : \ - # foo.c \ - # foo.h \ - # - # It will put a trailing '\' even on the last line, and will use leading - # spaces rather than leading tabs (at least since its commit 0394caf7 - # "Emit spaces for -MD"). - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. - # We have to change lines of the first kind to '$object: \'. - sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" - # And for each line of the second kind, we have to emit a 'dep.h:' - # dummy dependency, to avoid the deleted-header problem. - sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -## The order of this option in the case statement is important, since the -## shell code in configure will try each of these formats in the order -## listed in this file. A plain '-MD' option would be understood by many -## compilers, so we must ensure this comes after the gcc and icc options. -pgcc) - # Portland's C compiler understands '-MD'. - # Will always output deps to 'file.d' where file is the root name of the - # source file under compilation, even if file resides in a subdirectory. - # The object file name does not affect the name of the '.d' file. - # pgcc 10.2 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\' : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - set_dir_from "$object" - # Use the source, not the object, to determine the base name, since - # that's sadly what pgcc will do too. - set_base_from "$source" - tmpdepfile=$base.d - - # For projects that build the same source file twice into different object - # files, the pgcc approach of using the *source* file root name can cause - # problems in parallel builds. Use a locking strategy to avoid stomping on - # the same $tmpdepfile. - lockdir=$base.d-lock - trap " - echo '$0: caught signal, cleaning up...' >&2 - rmdir '$lockdir' - exit 1 - " 1 2 13 15 - numtries=100 - i=$numtries - while test $i -gt 0; do - # mkdir is a portable test-and-set. - if mkdir "$lockdir" 2>/dev/null; then - # This process acquired the lock. - "$@" -MD - stat=$? - # Release the lock. - rmdir "$lockdir" - break - else - # If the lock is being held by a different process, wait - # until the winning process is done or we timeout. - while test -d "$lockdir" && test $i -gt 0; do - sleep 1 - i=`expr $i - 1` - done - fi - i=`expr $i - 1` - done - trap - 1 2 13 15 - if test $i -le 0; then - echo "$0: failed to acquire lock after $numtries attempts" >&2 - echo "$0: check lockdir '$lockdir'" >&2 - exit 1 - fi - - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" - # Add 'dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. - # Subdirectories are respected. - set_dir_from "$object" - set_base_from "$object" - - if test "$libtool" = yes; then - # Libtool generates 2 separate objects for the 2 libraries. These - # two compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir$base.o.d # libtool 1.5 - tmpdepfile2=$dir.libs/$base.o.d # Likewise. - tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - # Same post-processing that is required for AIX mode. - aix_post_process_depfile - ;; - -msvc7) - if test "$libtool" = yes; then - showIncludes=-Wc,-showIncludes - else - showIncludes=-showIncludes - fi - "$@" $showIncludes > "$tmpdepfile" - stat=$? - grep -v '^Note: including file: ' "$tmpdepfile" - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The first sed program below extracts the file names and escapes - # backslashes for cygpath. The second sed program outputs the file - # name when reading, but also accumulates all include files in the - # hold buffer in order to output them again at the end. This only - # works with sed implementations that can handle large buffers. - sed < "$tmpdepfile" -n ' -/^Note: including file: *\(.*\)/ { - s//\1/ - s/\\/\\\\/g - p -}' | $cygpath_u | sort -u | sed -n ' -s/ /\\ /g -s/\(.*\)/'"$tab"'\1 \\/p -s/.\(.*\) \\/\1:/ -H -$ { - s/.*/'"$tab"'/ - G - p -}' >> "$depfile" - echo >> "$depfile" # make sure the fragment doesn't end with a backslash - rm -f "$tmpdepfile" - ;; - -msvc7msys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for ':' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. - "$@" $dashmflag | - sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this sed invocation - # correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - # makedepend may prepend the VPATH from the source file name to the object. - # No need to regex-escape $object, excess matching of '.' is harmless. - sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process the last invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed '1,2d' "$tmpdepfile" \ - | tr ' ' "$nl" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E \ - | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - | sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" - echo "$tab" >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..bdba909 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,16 @@ +DIAS = $(wildcard images/*.dia) +DIA_SVGS = $(patsubst %.dia,%.svg,$(DIAS)) + +all: _build + +images/%.svg: images/%.dia + dia $< --export=$@ --filter=dia-svg + +_build: Makefile *.rst devguide/*.rst guide/*/*.rst guide/*.rst conf.py images/*.png $(DIA_SVGS) ../README.rst ../NEWS + python3 -m sphinx -b html . _build + +linkcheck: + python3 -m sphinx -b linkcheck -n . _build + +clean: + rm -R _build diff --git a/docs/bugs_repo.rst b/docs/bugs_repo.rst new file mode 100644 index 0000000..830c23f --- /dev/null +++ b/docs/bugs_repo.rst @@ -0,0 +1,31 @@ +========================== +Bug Tracker / Git / Source +========================== + +.. include:: icons.rst + +|bug-logo| Bug Tracker +---------------------- + +We use the GNOME GitLab issue tracker: + +* List of existing issues: https://gitlab.gnome.org/GNOME/pygobject/issues +* Create a new issue: https://gitlab.gnome.org/GNOME/pygobject/issues/new + + +|git-logo| Git Repo +------------------- + +PyGObject uses `Git `_ for source control and the git +repo is hosted on the `GNOME Gitlab instance `__: + +* https://gitlab.gnome.org/GNOME/pygobject +* ``git clone https://gitlab.gnome.org/GNOME/pygobject.git`` + + +|source-logo| Source Tarballs +----------------------------- + +Release tarballs of all releases can be found on the GNOME server: + +https://ftp.gnome.org/pub/GNOME/sources/pygobject diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 0000000..0e78f5e --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1,11 @@ +Changelog +========= + +Versions with an odd minor version are unstable releases (e.g. 3.27.x) while +versions with even minor version are stable releases (e.g. 3.28.x). This list +is sorted by release date. + +For more details see the GIT log: +https://gitlab.gnome.org/GNOME/pygobject/commits/master + +.. include:: ../NEWS diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..de5c4ce --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,59 @@ +extensions = [ + 'sphinx.ext.todo', + 'sphinx.ext.intersphinx', + 'sphinx.ext.extlinks', +] + +intersphinx_mapping = { + 'gtk': ('https://lazka.github.io/pgi-docs/Gtk-3.0', None), + 'gobject': ('https://lazka.github.io/pgi-docs/GObject-2.0', None), + 'glib': ('https://lazka.github.io/pgi-docs/GLib-2.0', None), + 'gdk': ('https://lazka.github.io/pgi-docs/Gdk-3.0', None), + 'gio': ('https://lazka.github.io/pgi-docs/Gio-2.0', None), + 'python': ('https://docs.python.org/3', None), + 'cairo': ('https://pycairo.readthedocs.io/en/latest', None), +} + +source_suffix = '.rst' +master_doc = 'index' +exclude_patterns = ['_build', 'README.rst'] + +pygments_style = 'tango' +html_theme = 'sphinx_rtd_theme' +html_show_copyright = False +html_favicon = "images/favicon.ico" +project = "PyGObject" +html_title = project + +html_context = { + 'extra_css_files': [ + 'https://quodlibet.github.io/fonts/font-mfizz.css', + '_static/extra.css', + ], + "display_gitlab": True, + "gitlab_user": "GNOME", + "gitlab_repo": "pygobject", + "gitlab_version": "master", + "conf_py_path": "/docs/", + "gitlab_host": "gitlab.gnome.org", +} + +html_static_path = [ + "extra.css", + "images/pygobject-small.svg", +] + +html_theme_options = { + "display_version": False, +} + +extlinks = { + 'bzbug': ('https://bugzilla.gnome.org/show_bug.cgi?id=%s', 'bz#%s'), + 'issue': ('https://gitlab.gnome.org/GNOME/pygobject/issues/%s', '#%s'), + 'commit': ('https://gitlab.gnome.org/GNOME/pygobject/commit/%s', '%s'), + 'mr': ( + 'https://gitlab.gnome.org/GNOME/pygobject/merge_requests/%s', '!%s'), + 'user': ('https://gitlab.gnome.org/%s', '%s'), +} + +suppress_warnings = ["image.nonlocal_uri"] diff --git a/docs/contact.rst b/docs/contact.rst new file mode 100644 index 0000000..211de81 --- /dev/null +++ b/docs/contact.rst @@ -0,0 +1,26 @@ +======= +Contact +======= + +Issue Tracker + If you have any questions, problems or want to give feedback please file + an issue in our `issue tracker + `__. + +IRC + For chatting with the community we have an IRC channel named + ``#python`` on ``irc.gnome.org``. Logs for the channel are available at + https://quodlibet.duckdns.org/irc/pygobject. + +Mailing List + If you want to start a discussion with the Python community that is part + of the GNOME project use the mailing list at + https://mail.gnome.org/mailman/listinfo/python-hackers-list. + +StackOverflow / StackExchange + If you have technical questions about PyGObject you can find answers on + `Stack Overflow `__. + When asking there please use the tag `PyGObject`. + +If you are unsure which communication channel to use **please use the issue +tracker**. diff --git a/docs/devguide/building_testing.rst b/docs/devguide/building_testing.rst new file mode 100644 index 0000000..4f4c075 --- /dev/null +++ b/docs/devguide/building_testing.rst @@ -0,0 +1,54 @@ +================== +Building & Testing +================== + +To pass extra arguments to pytest you can set "PYTEST_ADDOPTS": + +.. code:: shell + + # don't hide stdout + export PYTEST_ADDOPTS="-s" + python3 setup.py test + + +Using Setuptools +---------------- + +.. code:: shell + + # Build in-tree + python3 setup.py build_ext --inplace + + # Build in-tree including tests + python3 setup.py build_tests + + # Executing some code after the build + PYTHONPATH=. python3 foo.py + + # Running tests + python3 setup.py test + + # To test only a specific file/class/function:: + TEST_NAMES=test_gi python3 python3 setup.py test + TEST_NAMES=test_gi.TestUtf8 python3 setup.py test + TEST_NAMES=test_gi.TestUtf8.test_utf8_full_return python3 setup.py test + + # To display stdout and pytest verbose output: + PYGI_TEST_VERBOSE=yes python3 setup.py test + # or: + python3 setup.py test -s + + # using pytest directly + py.test-3 tests/test_gi.py + + # Running flake8 tests + python3 setup.py quality + + # Run under gdb + python3 setup.py test --gdb + + # Run under valgrind + python3 setup.py test --valgrind --valgrind-log-file=valgrind.log + + # Create a release tarball for GNOME + python3 setup.py sdist_gnome diff --git a/docs/devguide/dev_environ.rst b/docs/devguide/dev_environ.rst new file mode 100644 index 0000000..d78ab38 --- /dev/null +++ b/docs/devguide/dev_environ.rst @@ -0,0 +1,216 @@ +.. include:: ../icons.rst + +.. _devenv: + +################################## +Creating a Development Environment +################################## + +This describes how to setup a development environment for working on a project +that uses PyGObject, or for working on PyGObject itself. Please follow the +instructions on ":ref:`gettingstarted`" first, as they are a pre-requirement. + +.. _pipenv-setup: + +***************** +Environment Setup +***************** + +.. _install-dependencies: + +Install Dependencies +==================== +In order to compile Python and pip install pygobject, dependencies are need for +your operating system. + +=========================================== ======================================== ============================================== +|ubuntu-logo| :ref:`Ubuntu ` |fedora-logo| :ref:`Fedora ` |arch-logo| :ref:`Arch Linux ` +|windows-logo| :ref:`Windows ` |macosx-logo| :ref:`macOS ` |opensuse-logo| :ref:`openSUSE ` +=========================================== ======================================== ============================================== + +.. _ubuntu-dep: + +|ubuntu-logo| Ubuntu / |debian-logo| Debian +------------------------------------------- + +.. code:: console + + sudo apt-get install -y python3-venv python3-wheel python3-dev + sudo apt-get install -y libgirepository1.0-dev build-essential \ + libbz2-dev libreadline-dev libssl-dev zlib1g-dev libsqlite3-dev wget \ + curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libcairo2-dev + + +.. _fedora-dep: + +|fedora-logo| Fedora +-------------------- + +.. code:: console + + sudo dnf install -y python3-wheel + sudo dnf install -y gcc zlib-devel bzip2 bzip2-devel readline-devel \ + sqlite sqlite-devel openssl-devel tk-devel git python3-cairo-devel \ + cairo-gobject-devel gobject-introspection-devel + + +.. _arch-dep: + +|arch-logo| Arch Linux +---------------------- + +.. code:: console + + sudo pacman -S --noconfirm python-wheel + sudo pacman -S --noconfirm base-devel openssl zlib git gobject-introspection + + +.. _opensuse-dep: + +|opensuse-logo| openSUSE +------------------------ + +.. code:: console + + sudo zypper install -y python3-wheel gobject-introspection-devel \ + python3-cairo-devel openssl zlib git + sudo zypper install --type pattern devel_basis + + +.. _windows-dep: + +|windows-logo| Windows +---------------------- + +.. code:: console + + pacman -S --needed --noconfirm base-devel mingw-w64-x86_64-toolchain git \ + mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-cairo \ + mingw-w64-x86_64-gobject-introspection mingw-w64-x86_64-libffi + +.. _macosx-dep: + +|macosx-logo| macOS +------------------- + +With homebrew: + +.. code:: console + + brew update + brew install pyenv pipx + brew install pipx + pipx ensurepath + + +.. _install-pyenv: + +Install `pyenv`_ +================ + +`pyenv`_ lets you easily switch between multiple versions of Python. + +============================================= ========================================= +|linux-logo| :ref:`Linux ` |macosx-logo| :ref:`macOS ` +============================================= ========================================= + +.. _linux-pyenv: + +|linux-logo| Linux +------------------ + +.. code:: console + + curl https://pyenv.run | bash + exec $SHELL + pyenv install 3.11 + pyenv global 3.11 + + +.. _macosx-pyenv: + +|macosx-logo| macOS +------------------- + +.. code:: console + + pyenv install 3.11 + pyenv global 3.11 + + +.. _install-poetry: + +Install `Poetry`_ +================= + +`Poetry`_ is a tool for dependency management and packaging in Python, we'll install it +with `pipx`_ which installs Python CLI tools in to separate virtualenvs. + +============================================== ========================================== +|linux-logo| :ref:`Linux ` |macosx-logo| :ref:`macOS ` +|windows-logo| :ref:`Windows ` +============================================== ========================================== + +.. _linux-poetry: + +|linux-logo| Linux +------------------ + +.. code:: console + + python3 -m pip install --user pipx + python3 -m pipx ensurepath + pipx install poetry + + +.. _windows-poetry: + +|windows-logo| Windows +---------------------- + +.. code:: console + + python.exe -m pip install --user pipx + python.exe -m pipx ensurepath + pipx install poetry + + +.. _macosx-poetry: + +|macosx-logo| macOS +------------------- + +With homebrew: + +.. code:: console + + pipx install poetry + + +.. _projects-pygobject-dependencies: + + +***************** +Work on PyGObject +***************** + +.. _platform-ind-steps: + +Platform Independent Steps +========================== + + +If you are going to work on developing PyGObject itself, then do the following +additional steps: + +.. code:: console + + git clone https://gitlab.gnome.org/GNOME/pygobject.git + cd pygobject + poetry install + poetry shell + + +.. _pyenv: https://github.com/pyenv/pyenv +.. _pipx: https://pypa.github.io/pipx/ +.. _Poetry: https://python-poetry.org diff --git a/docs/devguide/index.rst b/docs/devguide/index.rst new file mode 100644 index 0000000..0458eda --- /dev/null +++ b/docs/devguide/index.rst @@ -0,0 +1,13 @@ +================= +Development Guide +================= + +.. toctree:: + :titlesonly: + :maxdepth: 1 + + overview + dev_environ + building_testing + style_guide + override_guidelines diff --git a/docs/devguide/override_guidelines.rst b/docs/devguide/override_guidelines.rst new file mode 100644 index 0000000..35f3f4b --- /dev/null +++ b/docs/devguide/override_guidelines.rst @@ -0,0 +1,90 @@ +========================== +Python Override Guidelines +========================== + +This document serves as a guide for developers creating new PyGObject +overrides or modifying existing ones. This document is not intended as hard +rules as there may always be pragmatic exceptions to what is listed here. It +is also a good idea to study the `Zen of Python by Tim Peters +`__. + +In general, overrides should be minimized and preference should always be +placed on updating the underlying API to be more bindable, adding features to +GI to support the requirement, or adding mechanical features to PyGObject +which can apply generically to all overrides (:bzbug:`721226` and +:bzbug:`640812`). + +If a GI feature or more bindable API for a library is in the works, it is a +good idea to avoid the temptation to add temporary short term workarounds in +overrides. The reason is this can creaste unnecessary conflicts when the +bindable API becomes a reality (:bzbug:`707280`). + +* Minimize class overrides when possible. + + *Reason*: Class overrides incur a load time performance penalty because + they require the classes GType and all of the Python method bindings to be + created. See :bzbug:`705810` + +* Prefer monkey patching methods on repository classes over inheritance. + + *Reason*: Class overrides add an additional level to the method + resolution order (mro) which has a performance penalty. Since overrides are + designed for specific repository library APIs, monkey patching is + reasonable because it is utilized in a controlled manner by the API + designer (as opposed to monkey patching a third-party library which is more + fragile). + +* Avoid overriding ``__init__`` + *Reason*: Sub-classing the overridden class then becomes challenging and + has the potential to cause bugs (see :bzbug:`711487` and reasoning + listed in https://wiki.gnome.org/Projects/PyGObject/InitializerDeprecations). + +* Unbindable functions which take variadic arguments are generally ok to add + Python implementations, but keep in mind the prior noted guidelines. A lot + of times adding bindable versions of the functions to the underlying library + which take a list is acceptable. For example: :bzbug:`706119`. Another + problem here is if an override is added, then later a bindable version of + the API is added which takes a list, there is a good chance we have to live + with the override forever which masks a working version implemented by GI. + +* Avoid side effects beyond the intended repositories API in function/method + overrides. + + *Reason*: This conflates the original API and adds a documentation burden + on the override maintainer. + +* Don't change function signatures from the original API and don't add default + values. + + *Reason*: This turns into a documentation discrepancy between the libraries + API and the Python version of the API. Default value work should focus on + bug :bzbug:`558620`, not cherry-picking individual Python functions and + adding defaults. + +* Avoid implicit side effects to the Python standard library (or anywhere). + + * Don't modify or use sys.argv + + *Reason*: sys.argv should only be explicitly controlled by application + developers. Otherwise it requires hacks to work around a module modifying + or using the developers command line args which they rightfully own. + + .. code:: python + + saved_argv = sys.argv.copy() + sys.argv = [] + from gi.repository import Gtk + sys.argv = saved_argv + + * Never set Pythons default encoding. + + *Reason*: Read or watch Ned Batchelders "`Pragmatic Unicode + `__" + +* For PyGTK compatibility APIs, add them to PyGTKCompat not overrides. +* Prefer adapter patterns over of inheritance and overrides. + + *Reason*: An adapter allows more flexibility and less dependency on + overrides. It allows application developers to use the raw GI API without + having to think about if a particular typelibs overrides have been installed + or not. diff --git a/docs/devguide/overview.rst b/docs/devguide/overview.rst new file mode 100644 index 0000000..a6b4e6d --- /dev/null +++ b/docs/devguide/overview.rst @@ -0,0 +1,16 @@ +======== +Overview +======== + + +See :doc:`/bugs_repo` for information on where to find the bug tracker and the +source code. + +Continuous Testing +------------------ + +The test suite gets regularly run on all supported platforms using +https://github.com/pygobject/pygobject-ci + +There is currently no integration with the git repo for this and the status +has to be checked manually. diff --git a/docs/devguide/style_guide.rst b/docs/devguide/style_guide.rst new file mode 100644 index 0000000..0cd01fd --- /dev/null +++ b/docs/devguide/style_guide.rst @@ -0,0 +1,101 @@ +================ +Style Guidelines +================ + +Python Code +----------- + +* Generally follow Python's `PEP8 + `__ style guidelines. We run the + pep8 command to verify this during unittest runs. + +* Break up logical blocks of related code with a newline. Specifically add a + blank newline after conditional or looping blocks. +* Don't comment what is obvious. Instead prefer meaningful names of functions + and variables: + + .. code:: python + + # Get the functions signal annotations <-- this comment is unnecessary + return_type, arg_types = get_signal_annotations(func) + +* Use comments to explain non-obvious blocks and conditionals, magic, + workarounds (with bug references), or generally complex pieces of code. + Good examples: + + .. code:: python + + # If a property was defined with a decorator, it may already have + # a name; if it was defined with an assignment (prop = Property(...)) + # we set the property's name to the member name + if not prop.name: + prop.name = name + + .. code:: python + + # Python causes MRO's to be calculated starting with the lowest + # base class and working towards the descendant, storing the result + # in __mro__ at each point. Therefore at this point we know that + # we already have our base class MRO's available to us, there is + # no need for us to (re)calculate them. + if hasattr(base, '__mro__'): + bases_of_subclasses += [list(base.__mro__)] + + +Python Doc Strings +------------------ + +* Doc strings should generally follow + `PEP257 `__ unless noted here. +* Use `reStructuredText (resST) `__ + annotations. +* Use three double quotes for doc strings (``"""``). +* Use a brief description on the same line as the triple quote. +* Include function parameter documentation (including types, returns, and + raises) between the brief description and the full description. Use a + newline with indentation for the parameters descriptions. + + .. code:: python + + def spam(amount): + """Creates a Spam object with the given amount. + + :param int amount: + The amount of spam. + :returns: + A new Spam instance with the given amount set. + :rtype: Spam + :raises ValueError: + If amount is not a numeric type. + + More complete description. + """ + +* For class documentation, use the classes doc string for an explanation of + what the class is used for and how it works, including Python examples. + Include ``__init__`` argument documentation after the brief description in + the classes doc string. The class ``__init__`` should generally be the first + method defined in a class putting it as close as possible (location wise) to + the class documentation. + + .. code:: python + + class Bacon(CookedFood): + """Bacon is a breakfast food. + + :param CookingType cooking_type: + Enum for the type of cooking to use. + :param float cooking_time: + Amount of time used to cook the Bacon in minutes. + + Use Bacon in combination with other breakfast foods for + a complete breakfast. For example, combine Bacon with + other items in a list to make a breakfast: + + .. code-block:: python + + breakfast = [Bacon(), Spam(), Spam(), Eggs()] + + """ + def __init__(self, cooking_type=CookingType.BAKE, cooking_time=15.0): + super(Bacon, self).__init__(cooking_type, cooking_time) diff --git a/docs/extra.css b/docs/extra.css new file mode 100644 index 0000000..3ae7bdb --- /dev/null +++ b/docs/extra.css @@ -0,0 +1,57 @@ +.wy-side-nav-search { + background-color: initial; +} + +.wy-nav-top { + background-color: #171A2F; +} + +.wy-side-nav-search input[type="text"] { + border-color: transparent; +} + +.wy-nav-content { + margin: initial; +} + +.wy-nav-side { + background-color: #171A2F; +} + +.rst-content div[role=navigation], footer { + font-size: 0.85em; + color: #999; +} + +.rst-content div[role=navigation] hr { + margin-top: 6px; +} + +footer hr { + margin-bottom: 6px; +} + +.rst-footer-buttons { + display: none; +} + +a.icon-home, a.icon-home:hover { + display: inline-block; + padding: 4px 4px 4px 21px; + background: transparent url(pygobject-small.svg) center left no-repeat; + background-size: 1.2em; + margin-top: 0.2em; + margin-bottom: 1em; +} + + +.fa-home::before, .icon-home::before { + content: ""; +} + +.wy-nav-top a { + margin: -2em; + background: transparent url(pygobject-small.svg) center left no-repeat; + background-size: 1.2em; + padding: 4px 4px 4px 24px; +} diff --git a/docs/further.rst b/docs/further.rst new file mode 100644 index 0000000..e28c129 --- /dev/null +++ b/docs/further.rst @@ -0,0 +1,13 @@ +================= +Further Resources +================= + +`GNOME Developer Documentation `__ + Tutorials for creating a GNOME application using PyGObject, GTK 4 and Libadwaita. + +`Python GTK 3 Tutorial `__ + Many examples showing how to build an application using PyGObject and GTK 3. + +`Python GI API Reference `__ + Auto generated API documentation for many libraries accessible through + PyGObject. diff --git a/docs/getting_started.rst b/docs/getting_started.rst new file mode 100644 index 0000000..01874ef --- /dev/null +++ b/docs/getting_started.rst @@ -0,0 +1,175 @@ +.. include:: icons.rst + +.. _gettingstarted: + +=============== +Getting Started +=============== + +To get things started we will try to run a very simple `GTK +`_ based GUI application using the :doc:`PyGObject ` provided +Python bindings. First create a small Python script called ``hello.py`` with +the following content and save it somewhere: + +.. code:: python + + import sys + + import gi + + gi.require_version("Gtk", "4.0") + from gi.repository import GLib, Gtk + + + class MyApplication(Gtk.Application): + def __init__(self): + super().__init__(application_id="com.example.MyGtkApplication") + GLib.set_application_name('My Gtk Application') + + def do_activate(self): + window = Gtk.ApplicationWindow(application=self, title="Hello World") + window.present() + + + app = MyApplication() + exit_status = app.run(sys.argv) + sys.exit(exit_status) + +Before we can run the example application we need to install PyGObject, GTK +and their dependencies. Follow the instructions for your platform below. + +======================================================= ==================================================== ========================================================== +|ubuntu-logo| :ref:`Ubuntu ` |fedora-logo| :ref:`Fedora ` |arch-logo| :ref:`Arch Linux ` +|windows-logo| :ref:`Windows ` |macosx-logo| :ref:`macOS ` |opensuse-logo| :ref:`openSUSE ` +======================================================= ==================================================== ========================================================== + +After running the example application have a look at the "`Python GTK 3 +Tutorial `__" for more examples +on how to create GTK apps and the "`PyGObject API Reference +`__" for API documentation for all supported +libraries. There are also typing stubs available here `PyGObject-stubs `_. + +.. _windows-getting-started: + +|windows-logo| Windows +---------------------- + +#) Go to http://www.msys2.org/ and download the x86_64 installer +#) Follow the instructions on the page for setting up the basic environment +#) Run ``C:\msys64\mingw64.exe`` - a terminal window should pop up +#) Execute ``pacman -Suy`` +#) Execute ``pacman -S mingw-w64-x86_64-gtk4 mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-gobject`` +#) To test that GTK is working you can run ``gtk4-demo`` +#) Copy the ``hello.py`` script you created to ``C:\msys64\home\`` +#) In the mingw32 terminal execute ``python3 hello.py`` - a window should appear. + +.. figure:: images/start_windows.png + :scale: 60% + + +.. _ubuntu-getting-started: + +|ubuntu-logo| Ubuntu / |debian-logo| Debian +------------------------------------------- + +Installing the system provided PyGObject: + #) Open a terminal + #) Execute ``sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-4.0`` + #) Change the directory to where your ``hello.py`` script can be found (e.g. ``cd Desktop``) + #) Run ``python3 hello.py`` + +Installing from PyPI with pip: + #) Open a terminal and enter your virtual environment + #) Execute ``sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0`` + to install the build dependencies and GTK + #) Execute ``pip3 install pycairo`` to build and install Pycairo + #) Execute ``pip3 install PyGObject`` to build and install PyGObject + #) Change the working directory to where your ``hello.py`` script can be found + #) Run ``python3 hello.py`` + +.. figure:: images/start_linux.png + :scale: 60% + + +.. _fedora-getting-started: + +|fedora-logo| Fedora +-------------------- + +Installing the system provided PyGObject: + #) Open a terminal + #) Execute ``sudo dnf install python3-gobject gtk4`` + #) Change the working directory to where your ``hello.py`` script can be found + #) Run ``python3 hello.py`` + +Installing from PyPI with pip: + #) Open a terminal and enter your virtual environment + #) Execute ``sudo dnf install gcc gobject-introspection-devel cairo-gobject-devel pkg-config python3-devel gtk4`` + to install the build dependencies and GTK + #) Execute ``pip3 install pycairo`` to build and install Pycairo + #) Execute ``pip3 install PyGObject`` to build and install PyGObject + #) Change the working directory to where your ``hello.py`` script can be found + #) Run ``python3 hello.py`` + + +.. _arch-getting-started: + +|arch-logo| Arch Linux +---------------------- + +Installing the system provided PyGObject: + #) Open a terminal + #) Execute ``sudo pacman -S python-gobject gtk4`` + #) Change the working directory to where your ``hello.py`` script can be found + #) Run ``python3 hello.py`` + +Installing from PyPI with pip: + #) Open a terminal and enter your virtual environment + #) Execute ``sudo pacman -S python cairo pkgconf gobject-introspection gtk4`` + to install the build dependencies and GTK + #) Execute ``pip3 install pycairo`` to build and install Pycairo + #) Execute ``pip3 install PyGObject`` to build and install PyGObject + #) Change the working directory to where your ``hello.py`` script can be found + #) Run ``python3 hello.py`` + + +.. _opensuse-getting-started: + +|opensuse-logo| openSUSE +------------------------ + +Installing the system provided PyGObject: + #) Open a terminal + #) Execute ``sudo zypper install python3-gobject python3-gobject-Gdk typelib-1_0-Gtk-4_0 libgtk-4-1`` + #) Change the directory to where your ``hello.py`` script can be found + #) Run ``python3 hello.py`` + +Installing from PyPI with pip: + #) Open a terminal and enter your virtual environment + #) Execute ``sudo zypper install cairo-devel pkg-config python3-devel gcc gobject-introspection-devel`` + to install the build dependencies and GTK + #) Execute ``pip3 install pycairo`` to build and install Pycairo + #) Execute ``pip3 install PyGObject`` to build and install PyGObject + #) Change the working directory to where your ``hello.py`` script can be found + #) Run ``python3 hello.py`` + + +.. _macosx-getting-started: + +|macosx-logo| macOS +------------------- + +#) Go to https://brew.sh/ and install homebrew +#) Open a terminal +#) Execute ``brew install pygobject3 gtk4`` +#) Change the working directory to where your ``hello.py`` script can be found +#) Run ``python3 hello.py`` + +.. figure:: images/start_macos.png + :scale: 70% + + +---- + +For more details on how to use a virtualenv with PyGObject, see the +":ref:`devenv`" page. diff --git a/docs/guide/api/api.rst b/docs/guide/api/api.rst new file mode 100644 index 0000000..c5e019f --- /dev/null +++ b/docs/guide/api/api.rst @@ -0,0 +1,75 @@ +================ +GI Documentation +================ + +This is the API provided by the toplevel "gi" package. + + +.. function:: gi.require_version(namespace, version) + + :param str namespace: The namespace + :param str version: The version of the namespace which should be loaded + :raises: :obj:`ValueError ` + + Ensures the namespace gets loaded with the given version. If the namespace + was already loaded with a different version or a different version was + required previously raises ValueError. + + :: + + import gi + gi.require_version('Gtk', '3.0') + + +.. function:: gi.require_foreign(namespace, symbol=None) + + :param str namespace: + Introspection namespace of the foreign module (e.g. "cairo") + :param symbol: + Optional symbol typename to ensure a converter exists. + :type symbol: :obj:`str` or :obj:`None` + :raises: :obj:`ImportError ` + + Ensure the given foreign marshaling module is available and loaded. + + Example: + + .. code-block:: python + + import gi + import cairo + gi.require_foreign('cairo') + gi.require_foreign('cairo', 'Surface') + + +.. function:: gi.check_version(version) + + :param tuple version: A version tuple + :raises: :obj:`ValueError ` + + Compares the passed in version tuple with the gi version and does nothing + if gi version is the same or newer. Otherwise raises ValueError. + + +.. function:: gi.get_required_version(namespace) + + :returns: The version successfully required previously by :func:`gi.require_version` or :obj:`None` + :rtype: str or :obj:`None` + + +.. data:: gi.version_info + :annotation: = (3, 18, 1) + + The version of PyGObject + + +.. class:: gi.PyGIDeprecationWarning + + The warning class used for deprecations in PyGObject and the included + Python overrides. It inherits from DeprecationWarning and is hidden + by default. + + +.. class:: gi.PyGIWarning + + Like :class:`gi.PyGIDeprecationWarning` but visible by default. diff --git a/docs/guide/api/basic_types.rst b/docs/guide/api/basic_types.rst new file mode 100644 index 0000000..6248f94 --- /dev/null +++ b/docs/guide/api/basic_types.rst @@ -0,0 +1,50 @@ +=========== +Basic Types +=========== + +PyGObject will automatically convert between C types and Python types. In +cases where it's appropriate it will use default Python types like :obj:`int`, +:obj:`list`, and :obj:`dict`. + + +Number Types +------------ + +All glib integer types get mapped to :obj:`int`, :obj:`long` and :obj:`float`. +Since the glib integer types are always range limited, conversions from Python +int/long can fail with :class:`OverflowError`: + +.. code:: pycon + + >>> GLib.random_int_range(0, 2**31-1) + 1684142898 + >>> GLib.random_int_range(0, 2**31) + Traceback (most recent call last): + File "", line 1, in + OverflowError: 2147483648 not in range -2147483648 to 2147483647 + >>> + + +Text Types +---------- + +In case you use Python 2 then text is utf-8 encoded :obj:`str`, in case of +Python 3 :obj:`str` is used. + + +Platform String Types +--------------------- + +* Windows + Python 2: utf-8 encoded :obj:`str` +* Windows + Python 3: :obj:`str` +* Unix + Python 2: :obj:`str` +* Unix + Python 3: :obj:`str` + + +Other Types +----------- + +* GList <-> :obj:`list` +* GSList <-> :obj:`list` +* GHashTable <-> :obj:`dict` +* arrays <-> :obj:`list` diff --git a/docs/guide/api/error_handling.rst b/docs/guide/api/error_handling.rst new file mode 100644 index 0000000..e392cca --- /dev/null +++ b/docs/guide/api/error_handling.rst @@ -0,0 +1,48 @@ +============== +Error Handling +============== + +GLib has its own method of handling errors using :obj:`GLib.Error`. These are +raised as Python exceptions, but with a few small differences. + +It's common in Python for exception subclasses to be used (e.g., +:obj:`ValueError` versus :obj:`IOError`) to distinguish different types of +errors. Libraries often define their own :obj:`Exception` subclasses, and +library users will handle these cases explicitly. + +In GLib-using libraries, errors are all :obj:`GLib.Error` instances, with no +subclassing for different error types. Instead, every :obj:`GLib.Error` +instance has attributes that distinguish types of error: + +* :attr:`GLib.Error.domain` is the error domain, usually a string that you can + convert to a ``GLib`` quark with :func:`GLib.quark_from_string` +* :attr:`GLib.Error.code` identifies a specific error within the domain +* :attr:`GLib.Error.message` is a human-readable description of the error + +Error domains are defined per-module, and you can get an error domain from +``*_error_quark`` functions on the relevant module. For example, IO errors +from ``Gio`` are in the domain returned by :func:`Gio.io_error_quark`, and +possible error code values are enumerated in :obj:`Gio.IOErrorEnum`. + +Once you've caught a :obj:`GLib.Error`, you can call +:meth:`GLib.Error.matches` to see whether it matches the specific error you +want to handle. + + +Examples +-------- + +Catching a specific error: + +.. code:: pycon + + >>> from gi.repository import GLib, Gio + >>> f = Gio.File.new_for_path('missing-path') + >>> try: + ... f.read() + ... except GLib.Error as err: + ... if err.matches(Gio.io_error_quark(), Gio.IOErrorEnum.NOT_FOUND): + ... print('File not found') + ... else: + ... raise + File not found diff --git a/docs/guide/api/flags_enums.rst b/docs/guide/api/flags_enums.rst new file mode 100644 index 0000000..0a90735 --- /dev/null +++ b/docs/guide/api/flags_enums.rst @@ -0,0 +1,39 @@ +============= +Flags & Enums +============= + +Flags are subclasses of :class:`GObject.GFlags` and represent bit fields where +some bits also have names: + +.. code:: pycon + + >>> Gtk.DialogFlags.MODAL + + >>> Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT + + >>> int(_) + 3 + >>> Gtk.DialogFlags(3) + + >>> isinstance(Gtk.DialogFlags.MODAL, Gtk.DialogFlags) + True + >>> + +Bitwise operations on them will produce a value of the same type. + + +Enums are subclasses of :class:`GObject.GEnum` and represent a list of named +constants: + +.. code:: pycon + + >>> Gtk.Align.CENTER + + >>> int(Gtk.Align.CENTER) + 3 + >>> int(Gtk.Align.END) + 2 + >>> Gtk.Align(1) + + >>> isinstance(Gtk.Align.CENTER, Gtk.Align) + True diff --git a/docs/guide/api/gobject.rst b/docs/guide/api/gobject.rst new file mode 100644 index 0000000..63aa051 --- /dev/null +++ b/docs/guide/api/gobject.rst @@ -0,0 +1,92 @@ +============== +GObject.Object +============== + +Compare to other types, :obj:`GObject.Object` has the best integration between +the GObject and Python type system. + +1) It is possible to subclass a :obj:`GObject.Object`. Subclassing + creates a new :obj:`GObject.GType` which is connected to the new Python + type. This means you can use it with API which takes :obj:`GObject.GType`. +2) The Python wrapper instance for a :obj:`GObject.Object` is always the same. + For the same C instance you will always get the same Python instance. + + +In addition :obj:`GObject.Object` has support for :any:`signals ` and +:any:`properties ` + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + + signals + properties + weakrefs + + +Examples +-------- + +Subclassing: + +.. code:: pycon + + >>> from gi.repository import GObject + >>> class A(GObject.Object): + ... pass + ... + >>> A() + <__main__.A object at 0x7f9113fc3280 (__main__+A at 0x559d9861acc0)> + >>> A.__gtype__ + + >>> A.__gtype__.name + '__main__+A' + >>> + +In case you want to specify the GType name we have to provide a +``__gtype_name__``: + +.. code:: pycon + + >>> from gi.repository import GObject + >>> class B(GObject.Object): + ... __gtype_name__ = "MyName" + ... + >>> B.__gtype__ + + >>> + +:obj:`GObject.Object` only supports single inheritance, this means you can +only subclass one :obj:`GObject.Object`, but multiple Python classes: + +.. code:: pycon + + >>> from gi.repository import GObject + >>> class MixinA(object): + ... pass + ... + >>> class MixinB(object): + ... pass + ... + >>> class MyClass(GObject.Object, MixinA, MixinB): + ... pass + ... + >>> instance = MyClass() + + +Here we can see how we create a :obj:`Gio.ListStore` for our new subclass and +that we get back the same Python instance we put into it: + +.. code:: pycon + + >>> from gi.repository import GObject, Gio + >>> class A(GObject.Object): + ... pass + ... + >>> store = Gio.ListStore.new(A) + >>> instance = A() + >>> store.append(instance) + >>> store.get_item(0) is instance + True + >>> diff --git a/docs/guide/api/index.rst b/docs/guide/api/index.rst new file mode 100644 index 0000000..41f17ab --- /dev/null +++ b/docs/guide/api/index.rst @@ -0,0 +1,13 @@ +============= +API Reference +============= + +.. toctree:: + :titlesonly: + :maxdepth: 1 + + api + basic_types + flags_enums + gobject + error_handling diff --git a/docs/guide/api/properties.rst b/docs/guide/api/properties.rst new file mode 100644 index 0000000..0241109 --- /dev/null +++ b/docs/guide/api/properties.rst @@ -0,0 +1,119 @@ +========== +Properties +========== + +Properties are part of a class and are defined through a +:obj:`GObject.ParamSpec`, which contains the type, name, value range and so +on. + +To find all the registered properties of a class you can use the +:meth:`GObject.Object.list_properties` class method. + +.. code:: pycon + + >>> Gio.Application.list_properties() + [, , , , , , , ] + >>> param = Gio.Application.list_properties()[0] + >>> param.name + 'application-id' + >>> param.owner_type + + >>> param.value_type + + >>> + +The :obj:`GObject.Object` contructor takes multiple properties as keyword +arguments. Property names usually contain "-" for seperating words. In Python +you can either use "-" or "_". In this case variable names don't allow "-", so +we use "_". + +.. code:: pycon + + >>> app = Gio.Application(application_id="foo.bar") + +To get and set the property value see :meth:`GObject.Object.get_property` and +:meth:`GObject.Object.set_property`. + +.. code:: pycon + + >>> app = Gio.Application(application_id="foo.bar") + >>> app + + >>> app.get_property("application_id") + 'foo.bar' + >>> app.set_property("application_id", "a.b") + >>> app.get_property("application-id") + 'a.b' + >>> + + +Each instance also has a ``props`` attribute which exposes all properties +as instance attributes: + +.. code:: pycon + + >>> from gi.repository import Gtk + >>> button = Gtk.Button(label="foo") + >>> button.props.label + 'foo' + >>> button.props.label = "bar" + >>> button.get_label() + 'bar' + >>> + + +To track changes of properties, :obj:`GObject.Object` has a special ``notify`` +signal with the property name as the detail string. Note that in this case you +have to give the real property name and replacing "-" with "_" wont work. + +.. code:: pycon + + >>> app = Gio.Application(application_id="foo.bar") + >>> def my_func(instance, param): + ... print("New value %r" % instance.get_property(param.name)) + ... + >>> app.connect("notify::application-id", my_func) + 11L + >>> app.set_property("application-id", "something.different") + New value 'something.different' + >>> + +You can define your own properties using the :obj:`GObject.Property` decorator, +which can be used similarly to the builtin Python :any:`property` decorator: + +.. function:: GObject.Property(type=None, default=None, nick='', blurb='', \ + flags=GObject.ParamFlags.READWRITE, minimum=None, maximum=None) + + :param GObject.GType type: Either a GType, a type with a GType or a + Python type which maps to a default GType + :param object default: A default value + :param str nick: Property nickname + :param str block: Short description + :param GObject.ParamFlags flags: Property configuration flags + :param object minimum: Minimum value, depends on the type + :param object maximum: Maximum value, depends on the type + + +.. code:: python + + class AnotherObject(GObject.Object): + value = 0 + + @GObject.Property + def prop_pyobj(self): + """Read only property.""" + + return object() + + @GObject.Property(type=int) + def prop_gint(self): + """Read-write integer property.""" + + return self.value + + @prop_gint.setter + def prop_gint(self, value): + self.value = value diff --git a/docs/guide/api/signals.rst b/docs/guide/api/signals.rst new file mode 100644 index 0000000..4353b21 --- /dev/null +++ b/docs/guide/api/signals.rst @@ -0,0 +1,94 @@ +======= +Signals +======= + +GObject signals are a system for registering callbacks for specific events. + +To find all signals of a class you can use the +:func:`GObject.signal_list_names` function: + + +.. code:: pycon + + >>> GObject.signal_list_names(Gio.Application) + ('activate', 'startup', 'shutdown', 'open', 'command-line', 'handle-local-options') + >>> + + +To connect to a signal, use :meth:`GObject.Object.connect`: + +.. code:: pycon + + >>> app = Gio.Application() + >>> def on_activate(instance): + ... print("Activated:", instance) + ... + >>> app.connect("activate", on_activate) + 17L + >>> app.run() + ('Activated:', ) + 0 + >>> + +It returns number which identifies the connection during its lifetime and which +can be used to modify the connection. + +For example it can be used to temporarily ignore signal emissions using +:meth:`GObject.Object.handler_block`: + +.. code:: pycon + + >>> app = Gio.Application(application_id="foo.bar") + >>> def on_change(*args): + ... print(args) + ... + >>> c = app.connect("notify::application-id", on_change) + >>> app.props.application_id = "foo.bar" + (, ) + >>> with app.handler_block(c): + ... app.props.application_id = "no.change" + ... + >>> app.props.application_id = "change.again" + (, ) + >>> + + +You can define your own signals using the :obj:`GObject.Signal` decorator: + + +.. function:: GObject.Signal(name='', flags=GObject.SignalFlags.RUN_FIRST, \ + return_type=None, arg_types=None, accumulator=None, accu_data=None) + + :param str name: The signal name + :param GObject.SignalFlags flags: Signal flags + :param GObject.GType return_type: Return type + :param list arg_types: List of :class:`GObject.GType` argument types + :param accumulator: Accumulator function + :type accumulator: :obj:`GObject.SignalAccumulator` + :param object accu_data: User data for the accumulator + + +.. code:: python + + class MyClass(GObject.Object): + + @GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, return_type=bool, + arg_types=(object,), + accumulator=GObject.signal_accumulator_true_handled) + def test(self, *args): + print("Handler", args) + + @GObject.Signal + def noarg_signal(self): + print("noarg_signal") + + instance = MyClass() + + def test_callback(inst, obj): + print "Handled", inst, obj + return True + + instance.connect("test", test_callback) + instance.emit("test", object()) + + instance.emit("noarg_signal") diff --git a/docs/guide/api/weakrefs.rst b/docs/guide/api/weakrefs.rst new file mode 100644 index 0000000..6ab9f28 --- /dev/null +++ b/docs/guide/api/weakrefs.rst @@ -0,0 +1,26 @@ +Weak References +=============== + +While Python has a builtin ``weakref`` module it only allows one to create +weak references to Python objects, but with PyGObject the Python object +"wrapping" a GObject and the GObject itself might not have the same lifetime. +The wrapper can get garbage collected and a new wrapper created again at a +later point. + +If you want to get notified when the underlying GObject gets finalized use +``GObject.Object.weak_ref``: + + +.. method:: GObject.Object.weak_ref(callback, *user_data) + + Registers a callback to be called when the underlying GObject gets + finalized. The callback will receive the give `user_data`. + + To unregister the callback call the ``unref()`` method of the returned + GObjectWeakRef object. + + :param callback: A callback which will be called when the object + is finalized + :type callback: :func:`callable` + :param user_data: User data that will be passed to the callback + :returns: GObjectWeakRef diff --git a/docs/guide/cairo_integration.rst b/docs/guide/cairo_integration.rst new file mode 100644 index 0000000..84ea3f3 --- /dev/null +++ b/docs/guide/cairo_integration.rst @@ -0,0 +1,39 @@ +================= +Cairo Integration +================= + +Despite `cairo `__ not being a GObject based +library, PyGObject provides special cairo integration through `pycairo +`__. Functions returning and taking cairo data +types get automatically converted to pycairo objects and vice versa. + +Some distros ship the PyGObject cairo support in a separate package. If you've +followed the instructions on ":ref:`gettingstarted`" you should have everything +installed. + +If your application requires the cairo integration you can use +:func:`gi.require_foreign`: + +.. code:: python + + try: + gi.require_foreign("cairo") + except ImportError: + print("No pycairo integration :(") + +Note that PyGObject currently does not support `cairocffi +`__, only pycairo. + + +Demo +---- + +The following example shows a :obj:`Gtk.Window` with a custom drawing in Python +using pycairo. + +.. figure:: images/cairo_integration.png + :scale: 75% + :align: center + +.. literalinclude:: code/cairo-demo.py + :linenos: diff --git a/docs/guide/code/cairo-demo.py b/docs/guide/code/cairo-demo.py new file mode 100755 index 0000000..17a01b8 --- /dev/null +++ b/docs/guide/code/cairo-demo.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +""" +Based on cairo-demo/X11/cairo-demo.c +""" + +import cairo +import gi + +gi.require_version('Gtk', '4.0') +from gi.repository import Gtk + +SIZE = 30 + + +class Application(Gtk.Application): + + def do_activate(self): + window = Gtk.ApplicationWindow(application=self, default_width=450, default_height=600) + + drawing_area = Gtk.DrawingArea() + drawing_area.set_draw_func(self.draw) + window.set_child(drawing_area) + + window.present() + + def triangle(self, ctx): + ctx.move_to(SIZE, 0) + ctx.rel_line_to(SIZE, 2 * SIZE) + ctx.rel_line_to(-2 * SIZE, 0) + ctx.close_path() + + def square(self, ctx): + ctx.move_to(0, 0) + ctx.rel_line_to(2 * SIZE, 0) + ctx.rel_line_to(0, 2 * SIZE) + ctx.rel_line_to(-2 * SIZE, 0) + ctx.close_path() + + def bowtie(self, ctx): + ctx.move_to(0, 0) + ctx.rel_line_to(2 * SIZE, 2 * SIZE) + ctx.rel_line_to(-2 * SIZE, 0) + ctx.rel_line_to(2 * SIZE, -2 * SIZE) + ctx.close_path() + + def inf(self, ctx): + ctx.move_to(0, SIZE) + ctx.rel_curve_to(0, SIZE, SIZE, SIZE, 2 * SIZE, 0) + ctx.rel_curve_to(SIZE, -SIZE, 2 * SIZE, -SIZE, 2 * SIZE, 0) + ctx.rel_curve_to(0, SIZE, -SIZE, SIZE, - 2 * SIZE, 0) + ctx.rel_curve_to(-SIZE, -SIZE, - 2 * SIZE, -SIZE, - 2 * SIZE, 0) + ctx.close_path() + + def draw_shapes(self, ctx, x, y, fill): + ctx.save() + + ctx.new_path() + ctx.translate(x + SIZE, y + SIZE) + self.bowtie(ctx) + if fill: + ctx.fill() + else: + ctx.stroke() + + ctx.new_path() + ctx.translate(3 * SIZE, 0) + self.square(ctx) + if fill: + ctx.fill() + else: + ctx.stroke() + + ctx.new_path() + ctx.translate(3 * SIZE, 0) + self.triangle(ctx) + if fill: + ctx.fill() + else: + ctx.stroke() + + ctx.new_path() + ctx.translate(3 * SIZE, 0) + self.inf(ctx) + if fill: + ctx.fill() + else: + ctx.stroke() + + ctx.restore() + + def fill_shapes(self, ctx, x, y): + self.draw_shapes(ctx, x, y, True) + + def stroke_shapes(self, ctx, x, y): + self.draw_shapes(ctx, x, y, False) + + def draw(self, da, ctx, width, height): + ctx.set_source_rgb(0, 0, 0) + + ctx.set_line_width(SIZE / 4) + ctx.set_tolerance(0.1) + + ctx.set_line_join(cairo.LINE_JOIN_ROUND) + ctx.set_dash([SIZE / 4.0, SIZE / 4.0], 0) + self.stroke_shapes(ctx, 0, 0) + + ctx.set_dash([], 0) + self.stroke_shapes(ctx, 0, 3 * SIZE) + + ctx.set_line_join(cairo.LINE_JOIN_BEVEL) + self.stroke_shapes(ctx, 0, 6 * SIZE) + + ctx.set_line_join(cairo.LINE_JOIN_MITER) + self.stroke_shapes(ctx, 0, 9 * SIZE) + + self.fill_shapes(ctx, 0, 12 * SIZE) + + ctx.set_line_join(cairo.LINE_JOIN_BEVEL) + self.fill_shapes(ctx, 0, 15 * SIZE) + ctx.set_source_rgb(1, 0, 0) + self.stroke_shapes(ctx, 0, 15 * SIZE) + + +app = Application() +app.run() diff --git a/docs/guide/debug_profile.rst b/docs/guide/debug_profile.rst new file mode 100644 index 0000000..6b43a80 --- /dev/null +++ b/docs/guide/debug_profile.rst @@ -0,0 +1,112 @@ +===================== +Debugging & Profiling +===================== + +Things can go wrong, these tools may help you find the cause. If you know any +more tricks please share them. + + +GObject Instance Count Leak Check +--------------------------------- + +Requires a development (only available in debug mode) version of glib. Jhbuild +recommended. + +:: + + jhbuild shell + GOBJECT_DEBUG=instance-count GTK_DEBUG=interactive ./quodlibet.py + +* In the GTK Inspector switch to the "Statistics" tab +* Sort by "Cumulative" and do the action which you suspect does leak or where + you want to make sure it doesn't repeatedly. Like for example opening + and closing a window or switching between media files to present. +* If something in the "Cumulative" column steadily increases there probably + is a leak. + +cProfile Performance Profiling +------------------------------ + +* https://docs.python.org/2/library/profile.html +* bundled with python + +:: + + python -m cProfile -s [sort_order] quodlibet.py > cprof.txt + + +where ``sort_order`` can one of the following: +calls, cumulative, file, line, module, name, nfl, pcalls, stdname, time + +Example output:: + + 885311 function calls (866204 primitive calls) in 12.110 seconds + + Ordered by: cumulative time + + ncalls tottime percall cumtime percall filename:lineno(function) + 1 0.002 0.002 12.112 12.112 quodlibet.py:11() + 1 0.007 0.007 12.026 12.026 quodlibet.py:25(main) + 19392/13067 0.151 0.000 4.342 0.000 __init__.py:639(__get__) + 1 0.003 0.003 4.232 4.232 quodlibetwindow.py:121(__init__) + 1 0.000 0.000 4.029 4.029 quodlibetwindow.py:549(select_browser) + 1 0.002 0.002 4.022 4.022 albums.py:346(__init__) + ... + ... + +SnakeViz - cProfile Based Visualization +--------------------------------------- + +* https://jiffyclub.github.io/snakeviz/ +* ``pip install snakeviz`` + +:: + + python -m cProfile -o prof.out quodlibet.py + snakeviz prof.out + + +Sysprof - System-wide Performance Profiler for Linux +---------------------------------------------------- + +* http://sysprof.com/ + +:: + + sysprof-cli -c "python quodlibet/quodlibet.py" + sysprof capture.syscap + +GDB +--- + +:: + + gdb --args python quodlibet/quodlibet.py + # type "run" and hit enter + + +Debugging Wayland Issues +------------------------ + +:: + + mutter --nested --wayland + # start your app, it should show up in the nested mutter + +:: + + weston + # start your app, it should show up in the nested weston + + +Debugging HiDPI Issue +--------------------- + +:: + + GDK_SCALE=2 ./quodlibet/quodlibet.py + +:: + + MUTTER_DEBUG_NUM_DUMMY_MONITORS=2 MUTTER_DEBUG_DUMMY_MONITOR_SCALES=1,2 mutter --nested --wayland + # start your app, it should show up in the nested mutter diff --git a/docs/guide/deploy.rst b/docs/guide/deploy.rst new file mode 100644 index 0000000..323ec72 --- /dev/null +++ b/docs/guide/deploy.rst @@ -0,0 +1,54 @@ +.. include:: ../icons.rst + +====================== +Application Deployment +====================== + +There is currently no nice deployment story, but it's not impossible. This is +a list of random notes and examples. + +|linux-logo| Linux +------------------ + +On Linux there is no single strategy. Quod Libet uses distutils, MyPaint uses +SCons. Gramps uses distutils. + +|macosx-logo| macOS +------------------- + +On OSX you can use `gtk-osx `__ which is +based on jhbuild and then `gtk-mac-bundler +`__ for packaging things up and +making libraries relocatable. With macOS bundles you generally have a startup +shell script which sets all the various env vars relative to the bundle, +similar to jhbuild. + +|windows-logo| Windows +---------------------- + +On Windows things are usually build to be relocatable by default, so no env +vars are needed. You can build/install through MSYS2, copy the bits you need +and you are done. For GUI application you'll also need an exe launcher that +links against the python dll. + +Example Deployments +------------------- + +* `Quod Libet `__ provides a Windows + installer based on MSYS2 and NSIS3. On macOS, jhbuild is used for building, + gtk.mac-bundler for packing things up and `dmgbuild + `__ for creating a dmg. distutis is + used for building/installing the application into the final environment. + Most of this is automated and scripts can be found in the git repo. + +* `MyPaint `__ provides a Windows installer based on + MSYS2 and Inno Setup. It uses SCons for building/installing the application. + +* `Passphraser `__ uses the Hello World + GTK template build system (see below). + +Other options +------------- + +* `PyInstaller `_ is a program that freezes (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, and more. PyInstaller's packager has built-in support for automatically including PyGObject dependencies with your application without requiring additional configuration. +* `Hello World GTK `_ is a template build system for distributing Python-based GTK applications on Windows, macOS, and Linux. First, an application directory is assembled using PyInstaller. Then, a different program is used to package the resulting directory. For Windows, NSIS3 is used. For macOS, the built-in hdiutil is used. For Linux, AppImageKit is used. diff --git a/docs/guide/faq.rst b/docs/guide/faq.rst new file mode 100644 index 0000000..48031b0 --- /dev/null +++ b/docs/guide/faq.rst @@ -0,0 +1,11 @@ +========================== +Frequently Asked Questions +========================== + +How can I use PyGObject with the official CPython builds on Windows? +-------------------------------------------------------------------- + +https://sourceforge.net/projects/pygobjectwin32 provides binaries which should +be ABI compatible with the official CPython binaries. I'd recommend using +msys2 if at all possible, since there are more people involved and it's easier +to fix/patch things yourself. diff --git a/docs/guide/gtk_template.rst b/docs/guide/gtk_template.rst new file mode 100644 index 0000000..2ba8324 --- /dev/null +++ b/docs/guide/gtk_template.rst @@ -0,0 +1,102 @@ +============ +Gtk.Template +============ + +A GtkWidget subclass can use a +`GtkBuilder UI Definition `__ +XML document as a template to create child widgets and set its own +properties, without creating a GtkBuilder instance. This is implemented +for Python by PyGObject with Gtk.Template. + +The subclass uses a ``@Gtk.Template`` decorator and declares a class +variable ``__gtype_name__`` with the value of the XML ``template`` +element ``class`` attribute. + +Child widgets are declared, typically with the same names as the XML +``object`` element ``id`` attributes, at the class level as instances +of ``Gtk.Template.Child``. + +Signal handler methods, typically with the same names as the XML ``signal`` +element ``handler`` attributes, use the ``@Gtk.Template.Callback`` decorator. + +``Gtk.Template()`` takes a mandatory keyword argument passing the XML document +or its location, either ``string``, ``filename`` or ``resource_path``. + +``Gtk.Template.Child()`` and ``Gtk.Template.Callback()`` optionally take +a ``name`` argument matching the value of the respective XML attribute, +in which case the Python attribute can have a different name. + +Examples +-------- + +.. code-block:: python + + xml = """\ + + + + """ + + @Gtk.Template(string=xml) + class Foo(Gtk.Box): + __gtype_name__ = "example1" + + hello_button = Gtk.Template.Child() + + @Gtk.Template.Callback() + def hello_button_clicked(self, *args): + pass + +Python attribute names that are different to the XML values: + +.. code-block:: python + + @Gtk.Template(string=xml) + class Foo(Gtk.Box): + __gtype_name__ = "example1" + + my_button = Gtk.Template.Child("hello_button") + + @Gtk.Template.Callback("hello_button_clicked") + def bar(self, *args): + pass + + +Subclasses that declare ``__gtype_name__`` can be used as objects in the XML: + +.. code-block:: python + + xml = """\ + + + + """ + + + class HelloButton(Gtk.Button): + __gtype_name__ = "ExampleButton" + + + @Gtk.Template(string=xml) + class Foo(Gtk.Box): + __gtype_name__ = "example3" + + hello_button = Gtk.Template.Child() + + @Gtk.Template.Callback() + def hello_button_clicked(self, *args): + pass diff --git a/docs/guide/images/cairo_integration.png b/docs/guide/images/cairo_integration.png new file mode 100644 index 0000000000000000000000000000000000000000..4726875486de57fd27b02baa288ecd0166fdacba GIT binary patch literal 24418 zcmeFZWn5I<+b?b+Cglod5Zp^M7&s#$nH%J!{t9>$xtIt?4)B%(#j8LDA zn=_Z*>WTRsQZ(%}UMGEkBCyhguFo5<8RzQ0qQ?-$&4=*JoP2Yd^*HAA5k;kZD*4TW zo}Rv5)a_`KulYT=5*oC+y4qh<&wa1e2_1zJ5l->@bS3$k5%=oDbQ&0ycV{0Z$_Ff% zWOynn8YMyj0gj=8to`%+R9dl^1bdPI_v#MiV`4)p{6u8+ovmh6DA;RHK-}h3oPi3MCs0lZ)$# z#-iHYQ}r&lH3x-l#l@0f*G=KKFSKJ^(;+L8=$K1OM9JSzU09V6x^LyboCj}QZa1*_ zq4y>5QEhLXomcIM28PphF&5R^xZfr_`<}kAI$*S5evUreAG)q&|Hiy!JHeon>Jh?ecPgyMJ}qxV}8^^MXuP?67$@>~GJu>CAMv zNcb5kpHyuUafZwapEOwI>`e4HC7{4UfMqd$9f8J&FjyNflX?@I05UIvoHYrBwUv=>8jCD4F4IUX=- zx4OLlkPpv6d)^Xi`MohhXMPq7>&ip^OK(in##FW4Lh|*+MRQ|cl8~8k=n2udX5CUq z0zopXyY~64;aDFkxfVeyWc#$$d_Ur?Jl(_h=S_ z-Usjeob~u>9q+swA<^2?c*>e?`RsRQQ=cld?m#=IV3P2fR0nb5BqqM<7(C*DxONoH zD}#nHx`#x@YZ8nP+k14WR&=?nHEu|L|dOb)M*8EGEsGgEZI2q7$kATHey%FOxp& z{Ic~eg196fw|_w)+Tm4HMRylTG{j3y{Ee?N8Z-mJ=eJouAR=&Jm$>SKhb8s1urf*ZEiRmErW6lMy}` z!{-3DJDnKxX=J{_$18VS((_}kLRST>MWWxmaP}<~zIZ~!Ck?@d3C1l}on9V4Dj5@I zw?W{nqfs_tQ;H8k2isE8G2*$wG3ZmoJqg6>yVjk_DNlcA%PaS`;QvL$`A@;;zrO5X zg~@)TzKL4Ws3ae-VW^ZM)b=NDlPLZiGXMQ6!22fTF{Fk)=cff94NrlAaoxl#N(5G5 zIC$^>*-Nx6RGv4zkaUSK?921xM&yrAde4MxE>8AhNYj57r;CR?TiJWieD>n@#AbjYJFAC84`r*R~apz=O;|0{tS`&VbD8 z!gfDibik-SkdqPtwHK3<3tjuJ!2@|r%3s!Dgmt&2xrq0H2tv0-gL}r)O(bPq2Kf;x z785n>qd@=>|D=DfrMd6s1e!jO?gYOtJUO0mi^1fEDQ^*%e@tb7Y8M+;XR8+*4jI*Lm!zW}o;4@&J1Avj zX2J_NOJT659JGU{z=i;ddprnxL=zDGvlz9ET)4n6K*(M*iMYdGI_eLjU6;c|u; zJ}=Ex$qRIvaak!@EGaE*4X5-8GCtajd0Dj9UL2nKsZg&Hsp|Ok?fhgXIf)n~?R@_y zZJm_&wb$S)w&#q`_e^i+mQeD~2`b zR3~Hot`QV-KjjgYj?;9l6G3YrUhQuERIO9k8heLwTI*r7mJPd*W6$SdzkBvEnZuEl z>_+18rjbisF^!vqWr|^B(;?jHs77;9YPyi`{+Kc1-VozY1_~>~Yp65(8W@4au5%lY zIhI`y*ZCSo_v%CNM};rfBRTpK&!gAOjyA_h%e8O?&sNFP z$ZA~=8D0g@(9#BBkj$i`CQ4(mR$P+VV_S!Z$#P_%`f$F4u6|k>z|&M7xy^=3!^-M9 zVsP|cqOx@Syj`aB2ZKs3vb$T>cC}w*&B%`Muh(AQtPBdGk-$&N=G z8?X;~I|z&(^fS|G)v>waj5BtsS9M>W9dZiUe0zUeal;LigJMF3;74b%C$SmasTE(0 zNFnEF(VH>#5)uFAeH)ij>fVV=y*zlVX0GK*MM!5&4!5VfexD=#_x2Xa#f91faN0w7 zi?oiN_L?7kYDp3CY4JFoHgnYxyyz(m_#kW6mlVOE8hh3c-hp;$6>3+%U3Tv%3BoD1 z8p@7)vg|~o zi1E25l>$w!tr|sk-+TKL-O<)!BMBYb(shFzZe#`&s3>oK;L_HKiW6jORI~RqZ9XCF zR(F1!r}I|Z|1l{`jjDx3ZowKeuEA}|#e%B^pV+!71lMPDlg~`@ko6zEi2~@93#q2m z<;YumWF0wzDtFT}g3f%#G4{TEspRn>(=hquxz{dyRk>uLYxDR-qtR2RX)f()m(xew z)bGdduzq&2_WiDtjpE)&Rhnz{65gCt7O_PwhnSywNK; zTcdOtzNJv>Xl>;C*|{&oZcbZG&!ar^#oIUfGbX0XF9rw7bW5!#M;`4oUVheuD6RRG z)CMavQMEoaON^w1ueLv=ckV-E?mm7pwxg-)+`~0WSB)LmspGUYQ69v9?A#W-#-2>j zj;~Ak#i%_LZDa4Zce&*#;owV_kVoRtN(kE$+eH+`ba4!cot;2eOewHFJRM#e+NcS_ zm@HCljL`|PC>Q%37~k1B5$%tWInUi*%c52Pz~`j;iiPdlj~{&O@(`S9DxCs3M?|=< z`3@5m`<|=)Ye@+-exiZb+#FG0HP?5d1g-ZXuoV4$9$>aGsn$JGQh5*2bzRHss=+IM zyAP^Pvz(ffz|VIBxywG^F|EkZQl#>ktgyDMsR?*I#nbwZO`cMw80raW4gr90x z7TlO_QhH5{6;i|g?Y`)+3W5GTD-;su=Z)vnI~gqJc6~x-HA^^-Qnv3J8a&7=+)WJ@ zwee~`_KdKDd0~Xd(xGYo*ll`1URIZ*91m@>jvbotqu1o_Xkxx@FCXO&AWq)2I<39K zUU56`TwBwzZqSb30_Se-)uQm#_k%cJOM~~J7IB^i{mZzi>1b^(S=i5Th;3k;M7g~3 z;e%+r(;~EN%&E#bN{U7qozH_ix{KRPGp2eza|O99T#poxmm7MVB+qWk(1{1hgWw&N*S9*59z4qI>}9?Z zcB?cgxml*mphqP^tK2yS<54C3$Imn`KO+UUtG*BBtHwJaOgYN1zh!bLyR;GpDloI% z!J2kE+!#F;B+;&Z=j(hlPWjX6Fx~`%p`tqRG;MY5tnd0lp51OaI6JvXK)>boIhCe$ z2_vI=!~-hHJ^v5Marvt0;z1u%r~SRe{Bl|2#UZ(9C_K3MY4PK8xhjky!wS&mD3_?G zvJa4s!j*5lVxo`lh!KtRV5Ljb$|VpUmd3g^MQq`w=ActydJ5_*Cy2>HP+lPk`9qIs zZ5}E_v5YZmag$K7-YyyaaQB+d^ZI<2dCB58;w!5?@{upUfBv zFeEM?FX$8xzZZT#%EQ4N`4Ymw?@R*~b&rE?OxX%h2PVJb`qllgJ%q%vjy0%`bFkPW z0?kn3p#ZccmqTQhBLFJfZyzWgLLA_Aee5-ASaT1a9gUjox=zpTbtOn&3L|nV=CPdh zyd)c5AZuIab$mMZ)j*V4^k1nN9h&}Eh;`)GU3@8Kt%?IU5^my47#xu_ zqni&h!rBB6BO{~5`HbiJmgdy={pFr|b2!${E1t5myD1ydxqJawB5PWLNsk}${-N*1YEQ&0O4!UnCFOyF;^z_)Xq{Z^` z$m54yn?OZCRNlL1rPx|HaIfPnsKMxo0{gjcAI^k$uJ{a|{LNIN8P*YXX1 zc{#SDO(p+POTeP^2od9gn5ABs5Pa1eJz`6vUbyb^Xfm=shYscfryG2M7lop=TG8@3 zu}LIbYrMpyHG%KVgexsFvtxZYkG3tCs6g9;RmZS^Eml+-LZj~ITPv9UBOE&el}{4R z(v3geb|ij&w54L2RyUnQ!z55)J^-6sX|0gawvUIFMH(p9a_cdO>OAeRj{P<1hnBWz zd^GlYqAaKQK-<-|hJF2r)$25E{UAbjPQ-c<*(-9m$WYc$(d5@fbI?ZZ1*6fU+|d1NI&i|F~S1Bfq#6 zY~LR{#$M7dYAmbbEzG7dNWatG}zmiiNwLk1i=$QYV6YPJK%SH^ya#)=L613ch$Tf3DcL? zt&^AjE{-Ohk@UZ(UcY|bStzwGQ7y_Z`SmOMbY#jy5V@t&zBqQ&=@}UR%81DeADj2V zoFM?!VHok~M7d=Um!)dE2Wi6H6$W>k{H_|imB%xaH37RF5#JZq^NNn_RbtJtBX#^h zJ#=vJIIa{{$5^}k*)sUuLVbd)$#>L&w1t5C6`16`@?#Ef3!8%+%s8e%hj_8|uyhn{BYi79rZh97R~^{?e^=~bUljrpa`@zV1WQWEJHmaQL8_%9-Y z=`|WJx85+rz3It)Il0h#?eesFkMCj%>YwtVvMFV?g^-Xq>=_!fOrVf3bn(LUa-0wY z#;bneoA#}s61A+xV)+u(!Wz{X#Ykc|qYO#YP*n$sac?>PjpV*A-XKcgL^PUy3S7`f zp_|v`HzJnJz&l&3a@%*K{_4y!tNjVTeLvl+jgf-P)xws~nGt*;z9NZi({~)~EfMBQ zNLhj4zaih4VgkiD6!xaE%D@T3MS zVPAllj@{w9N?R`~T!)s6Yxwtx^<;%KC);|eKN&{|2}gyPp55h{16;RjJq$IlKMTEn z^)r*SUnB*5wJZn%b3a=Xkv8_lqVSvPdit$-`r}wdyEI~~>AB))9RQ!QMbupn#Z^<> zCaoeYzdCMBAWV}<`R$Re%(BuQZ97wK@n(=w$1tmY;?v`;ibtV;(N(&5l& zK9+&5?SXh*aNmb`Po&W91dlwgoOZMvT4Z~ivdi%r{$cyo_)30Syud`Q3Y$qM?jT|8 zu<(TKnEvP{ZyDvpM<^3?FRe&vSF>+ z<7wjA3p(oq=@OAaB%Q$}qq!e^GXM^B~frj+M4O)^(HrubkArW!8KiHrm!Yf4Y zNNBDr44MTXb;8xkNPZI^!rRDdTMmc)<&~8HkSopk{QEb}VPZW=luznnWW;r4& zo4`9zo`a(6&7Z=e8mDo7U3Z>Wpt5B) zGZ++i?i$aEjUN{(g0hLC2~?$HpXY)GUg1(IqHV^Raqq~M=YxV}%!KOaOMe!ji(seV z0?l%4yOoAk$1o1bw=;Fsh9J4Nd45LX8TyS;`XQ;K>t0odHUwd51*G&{{$$nITWAfD z?OGo*-}zoAh;LF(46UFyOv{s8HYymQSc=3-yW0@d zZ>7%R$gH}hE=;|uj8OG?ut4NYu~=N_8DY4|-Pzgs@l0Lr5hX4qoG=EpJ{qjG#6MI} z<*a9|dWBWa2(;`I9u(g_7CSH;8VLh%%n8aQShRjL`DRcPp{hY?*yK;2ib~%c6x!<3 zgo%dFwWq=pr$M?ge0RdayI2m&lz?ZL(vnF8g-g=G0{aJwZG2qhd?n8At00gc;_Vt( zLQ1!xVjk=YYd?*qLplG91jktcPWDp-mvTLn(3!|=8m>N6tlJugwFO67>!mSA90I6W zCNR>~^hDK;peLHPRI^fX#Ax8<%F-mX5?qRiFz`*+$-8%$G>GT=;o3 zT;G5&r)o|}NO&Qf@JP4}>rtD=7VmkhAI1*ec*Dt?6H;;ugd`Kpe*WI&{FB?o`U%6K zrFv5UdMj=O&F-a&qrwSK9vsXy^|7_x7X$)^riaF?+l~%k<=Ioq@@G%*t1X%aZ^>eJMzP^e6!@yN%@CHMDs0%a}7Jf zo21{DOyuCKZ#%m8h^gnRvzr)N!~m-5J`CYlB4X-`pnH}&Q;1%VwhcuH`h4KxNWxqK#uo{x1nBL|qoCH2@a-m&mqcZ^bpn*&og2hr$FyaA@ z3s>wm^1h+>7=<`kGaUa~9-iV>5Th32WccO)3U2B$M`ST5TRaaPK4Ne%3eu|PtFyQs zZBjC*6+W@6bOmb%UTWGC3@27C)P__MruAl@JB;d>wLnLBK~RJr07}CgCs09@s8iE1 zP@(9IzX!!90gpwaL=13))xR6~`1mx8O&<@vv$2@J9gAWpDV0oOEevpEJLk_xgNeP?bH22siay8;BkDw!EKDcP+TKt@ z>NWOg@a&J~%0D#eVM6O0VsAydAF`jM8MX#0^=P$r{FwjlFT-F#3mS}soaGXe-Yy*XN6(aMIHk9|#b1_|BpXU0lM zETtoovatBgtS(i>t1ohRVM0f->B36=(dMrL6%6;XxnupI%8d=hNM<^X`8dum@F4u0 ziiS_IJJFv?f9!Dq)`k(JF_S6by*e*hd3gc>N2_CI)hg~ztaG=zGef|1i8En+QWsCn z%9^mui)McFY$6&Osqlg!)I1Y)xabX&(j#eAUdK(st{o$g*Mj|>(h93BhNTB8cfPa# z$dHZW5RdsaUTP*71S#}I+p2P8GV%Ns(SR0~oQQ5aRaK0eY6Vqt2&IB&J9;caK5uKx z&(ymyk!QdB{0!0_=CwMZ>=S@P8wgmo)@S}UE4`$J?Wm*Q82IG6{Q0Z-sPCmKlknJB zordD+wv7i4 zCA&^(Ghq7%cYevR*8kEP@5d8(J4a4h|0z$WwnDwu@#WNL8{bL`a+bUO4#7F-fK`%}?Y=Mtc#s^wvV838TJ(ZWRDcfYmn{eN4I#=xTot@`&?De(mjJ~fc?dp1- zy|gn@KmuR&MRx#|Y__h)G;TDDM(X$lC(|*t+i7vLbRxflmCzd?CaC_RAim(a=YPn>xucqymz!>!HIdReob%b*7pdMrPyvZ3c#^FSK$`2mmQw zSYj4t&aoIL0Q_>oSEJD#K#h>C z>QNsaxvnuk`G%Ek8Y0r_=D0moDYn!Zg>zKbTx~qD)r@8;;E}RL4@)-AF1be!b6DTV zOi}KA_~m6+sOHhp){fFqLu)jA&nD#FS1#<{Op7Po%Q}W@Jc0cWh;ms(0u>U^T1O>O5G5&=^~e0V4-n``RZ z_gvtqMRoD*{Pkm2?h1zz;+OL(hQ4bRWc)v^y}W`K+SAwfiXX*#qHJEDNG>@A)kj&6=xK(gYWBtfnk@dx0owi= z&fpjMbX307B&Z zFlq3JVOwIow>V}zk}IoinIL&nXY(Gz-9g6?V@oZDYvM*S&^FYS-kyph7?ZDj{Fyr z{m&TgO*{4zv6Zg}v!-H4-=M8C0B~P;*2zSoQql~BaB*g;lBYzqcaC>vSIj;20fA~= zKoZ!;E5zCfHBz&UVo*to77!4KhaPBZ^Zx*)>6Zouq_}VX+v9ERL640jw{5 zaw&+wD29fHvQ1hZKjw(E1pz4(zrW4A-+9KiH-Yc_NLIZs!TL;tM?7wEE=XBJ@6rnD zS>%z}Loxu@KRHx+%@+8unOn;Mr8`Mzva*C!_$sxd`-!>bXHmor+W-JUi-$E}8{R?n zBJoU)757PA)tfmGZ~=){zRP}lN`oCB zL)*h)HG$8!!ltRd5*Va)ez4=yC?iSfrW077GwJRZH(knA&iObnf}48JQ0WiZaHwKy zYl+t~-RR}jwUa?`*X-;5-DposkiV!-=O}lUYx(V?7Kr6K5&Zh}oUD$eFDBKa%s}pJ zn9`z@R$v7qx*An$-3nC>KL+VdRt*}^(Ncu1lgLU?3}!^%Z!IpeZfYW^<_;FEHXtGJYkmwMSTjF)5<#bfx>iPRfQLeA9mqDn=g#FFA`yN(2f-jhDweUU793NHpS zLqv>I2XEhv_{A3pY95?dS+e+`%;A`cQ@N>mrYXMGWB;O*iBDtNvpGe?>QfW`k!i66 zT6SZaWc`DgE?Non*bJ?mLXC`*sCt*og8%+8c}1P$DHa@hK&oCkhZQvm6hf%Poom#~ zbQEYJd)D-cD@90vjMjX7f&jw=b>P`6J<<}9VMGJKgOjx!RcO%ohT~N0yX15fBw{Vc~47AOCs~h;El+1 zgDB*yKjk{IrUoL~ov95VXQTtB;#1e*572{(27XhY+(%@0U%MV}9;BS`d`h)G)&s6<4v|HZiKaT_E5X{GIakg2gXa=KnwcWc}Hk)RIJPGIDZqLso>1i=rV|_rJ|4(AB= zuia@7ut?k!cs_)x_yTb}Whbvs-kV)JxkoB^68BApt$8s_xNtb;u>N=kPfgnvK6JL= zbb?N91weH3bgdoy$4BbB=lbH)kh_5AkhT8vGq$Ys|i>!br+>lICwV-6_ID8$TZNsLt`k+5{}tpQSqsI0+^W&IcAkYB&y}q>5@h zhGSVTNvLEpP`M&fyG;OXko$&dT))2rW+T2vM$r_zj4jh)5vSSf9evY;bp({j#P%bn;4Gh#EwEI*)Dz z@kqR#?Tb(?K)Sa4%#@*nMTwMn9~r75n+Wh2RU<8C7{uislRww)jQB{0 z(`m{*-GSNf$AO*^VIvG9@=aG7Wrk-W!X>dr4Nn_|Ud+GMuLtwlP1GB69aeTYJ6WTaqHXH-z?zikRDq zF3Hn1Joed|3zaF7)DUU8IaxW1+#1Sx)oK(bw7eRITSh$*35`@2%*9wv{exEx0bX@p z?tVRx2G1?ndAeM?^vmjnLN@*P zkVh>~qZPAra*if)O}a=zDl$>2al-?t04;F1K@v3N{ShyeRG{tmxq6{C-{O2?wq>Da zxzfSb`CC~I`d3-O1Jo`@n?!wv2ulN)Kq0A29Jx!zo90C`TG1ywHcW83c%*XTq9i0& zXVw{!<)&KYv_sbQz~U3l%NF1kso@^hUuX$P0|A!3Cv~#g&VK_41Ye~?2Y;u^*~pTHtgAYK)TUkB<0-E^i9C91T!d@QyjX?l2RLxm{qtsO{QQfUkPaYA9I}OJK4;xzBAn zt4_FPe9M6~!?EHf{@VWPFzDJ};5^Cyw4cUQ()z&KRMqANMMt1JeEJJTheyk47>pL` zq>n823QS7rI2s$O>AGYVte~rwpU(LlrzbsX{BE|H@MtuW`B7cu!NHMY*KC0n0Cd$KEnRH5ErKe`<+cHPLjeMhk(QV9iMj0p=9U{*F$C;RDr)}56CA}GsbO{<* zf4f!wk`7jBlAQ+t<>C59R=$15!(w&&9Hq>(k=u8bm8<0C6L?u_oOW#7tcL(eq|1vh zZ1e?1p#2E2{#DTr*+u+F3dqduSP57$*LKrCKR6r8zI(hrw5SI+9{ z*HC!}9&b)nzX<@U8||ixuicNbNnf09$FmocuMp3FD43urA=ZaRWkhlk@Z{p7Ny|64 zCTBA@J%X5n7N&{O^evwz$PDww_SClge1n^c$)T(RU@iaQp^_YfnXf5h=al1Qf%I&x zI&p!`bPc<3(Z^4ptY21#6O|d1ouvY-9cGg41Ez*+eZxOix#wZBhoj`sJEObm!#jFb zRvX4#pPTbqI(WT)(%(41Txf)4Ag=U4dwM&n%4kau6v;n~U_CRh;`;KA3Ai+|IgvF1i_zRhLrYTez( z_#{3#`HMaJMA_@_O&kf&MIa~u>q-LDtT4KU6U)@QhO<0KnDXq29n*yZcicOLPD z)8~D~z?lf0WILr3Ni>m!bgJmZ`KC*&nscw!NPVJFnoXADS>_@+@t$2PV}CQ4^|G41 zXcl`&1t3W6!zc~zTw`AVEkiWLjiopo?{9-}G;r~)!g_K-lLt51)>StW-d4B(+=F7w zPL7V;@YQlaaZ$qQCpix`vW%}c*#Du8TTbky`jn%xy0-xF)cTpBrNLe7=ZHl*7JVqyP%rT# z*KZ~}yGZ)eh)OtjG!>&>LmjX=e*18l6umZ8U1|vQ{u_PX@!4&%S_ysDX0a%MsY}dx zUc@On4mEYfriOHPs^ln9rx(z}&{{G|z@V--@)j0G7?8DI*H_WAQmiPw`hfPi905dt z#P252nI0#HRfblsgh(`pZ%U@Ro2DNsiW&Oe-@fZ!UHLagD=G?{B+a4Nsdqb$Efm9! z2+^AM9NW5m*UoTUg)B&BXQF)YkPsLjM9XZZCu~m@Xk{zkT1q@B3m8tjWnSxXex!sb z36O-}VCoUIVT`vbkg9R>@6GzdAAv?boEw$)X4cVy9<=8NYovpBNq2g_ zjvarJe@?$XT138YI0kfatbdW@j;^k*-AfXn?rniaI|Zmyeo-q*swf-=g{dA7$zw%t zS3s^D6g4oI`7i_s@;Jq8xwzgEcry3lxy$b$Lr|qbS$D#1lW=H5N$hY(i}Yx-WaF4n zFo=!oIP*ZB*RB=OccbnQjpl}HEKL7KV{ejXLqZIFZz%tHR-d@XL>ebStPT1t6WdSP zI|L;Xy7~zJ{xN^h_pot;Ve7lDV_#h#Cv7V6;9dJ-^V$?yx_Cf?+xT$bn7?-R(7-UG zBA^Ff8gArpG>^5P)D=!9Z*iFLqT}M|{}h3fX~A@Pg17Sn|qr_h%0PG#$1B9l zsM;5RpNm(3Vx1)9#_P(8huIU)!;?jvU9yur9EmlQ37Ds(mdD4BCm13gJ)~oWMbQ>^ z0d1-O{A@iEBbUj^zBKbjS-K@JC&wL4^L@s<#={?~k109?ad4pWiG&hVF*>lkLG9iWdYrX z7>X3G!@mCl&^3}|RMau7dZw~0J7dM^l2TIae(MtAa?vb06DLGOSgJ;A6Xkh(E=RH=783Mp0Rqe&a-)`S1-_rr1}ZEM0F#GybINh8Wh7MgiKrj? zWA|Xl-RF{M@YQgTW}eck+sd=baRBp%;Iry(j*HpEy+~AadM<_rC#2HQSiEyQ_ad=A*jB-0HS->o z{l*CMADnuN8rL9UV`_dH77pGHc6GK<*!GrT zG;*x*^5{-m>HEe@>(G&LeK7>+NQihw1^hm%zN`%F4~nIgrygK>`mr<5?X{DSKL3MZ zf9a%0rdDESpdJ#;XO2^VP6=FR2}vSXT2KLbLGYu1=K56ZLlZ}2D$mVH_y%Qv$;rXQ znds9opkS;-?fFX==J4?5uvY_RO#`&76QE%1w0=QYEk{1!kqJ4BzhbB4b4d0}BLJ_g z1b}ok@Z#N}gbDohm7f*fsQKw4MJsD!0~Feus6?{=*P8MT)q^DFvOoe!naCC-$jCjr z=^6((a5KSUSagE>dO@M^Yh^_d>plfO63x(ua30g51-)1l9U^lPJO*t;ay<_kOUIyt z^_b8ZkngMAB~2+NzNuQh&iKe&lnCXgWF>iOaI<30Ml^INy+Q65epx;nNG!lUo|W#;yzRTWX|;ECuGRA4 z?s>>QXd8h6bDUPbUSqGbJhyp2#XzH9>ZOZTV~S3Z%AD-F=a z3u|8<1pMhMxN*`{wE^BaWK1rRUq$d}%qa9qQba55B|R*lHGM*#EKuR{tPNU`V(e?y zn}84es1s*$h7DSBy)^BkyiVKs>h-Qsw%0BDSL}c=HaHJ%yYmm4{s&F}gQovM)Bm99 zf6(+lX!;*C{STV{2TlJUM$_M3=1R+My&HVVb4ml0s0TPb~YJ4MRDj*_LG60!2O+cwSXvXbq ztBQ=>{UA*TlU8^LKDQkd{s&}1l)SOK!lCwRi0&J77TAwJX5tJCzb&@|CgO? zb3@U8dq70_&`-OF*H1#s!ixPC@2z{CS{q^Y4CkvGP& z|2Sm)HCT=#5)KYs{h6$1BwV>Z=q5M5La#r9F~%49Y$nlhz^J28{Q=H?`=~0Bslnj8 zd?ElyE;9x6sv$6M8UFr7(AuBcccUMZ1QT&;cE_^oFzM8YJ>mVDTwHRC9hQ&9*}{U| zo+|23TnrC}SO&7a=ZFLjK!dk8K$^e~xPU<02Xvs;iB<879O>k-ypj_00H9~tf$g@~ zW_tE6xkQWpua1bD9Rg}?#kv6%XkB)D!W%lI?Z+V#4n>y(L*Bi<=^8fwnIQ$+{_^XW z@uEP|r%yPsC#i+NU6F(&Ok>vdbis#b=b@Vb7*CjQ#kQ(34^+ig!0T*I)DHvwjY@#u zoma1RY-weM2d=^P_I(os%;PTa!c_9r6^)IJk$?qd zAmnZaZ?|2D1#X`*ez+IF!cou64ag1%p0fmewNQq=6rsd@~MvR zgEpu+t*L%f+|*_cWvRbT1^^kDLfXIAu>npA*W>&-)9>HEGr|af3p%aavkl$4!t;_p zPytSqOCu7<7CWx5Q1Zu;08F`3c00q_ilTM9%}?niq|#*RNIL0c>evV$0COM1Q?S_q zxSgCN=+deu{=$OLC85}lAEChOM*T8D0Y6fzP5p4=m=2yDh^`U^e(jW%!f`&9=!Hxq z9p#qC4JCs--)YoyKbdEr1*&N}I$cn{EsVrwyd(|^`pFn>?t~3@wwvl05XY#u+x5V{ zOom$%TuJR_U@wEVauwvjj@PwYpn~ZiUnJYucuJuLW%TK9x3B(y0`++yOx2qtwCHN} z7DHR6`~>hgzze77$1e%4>&TrAG|wn5xgTyow2C%7Ke8@ty}#1Nr5yZHRTUqowdf8J z6z~o!h4y?lX6BdU=cP)S(uP3s!Xd*+z*$k{V!3f(Ly6XbVi-Q2Vxut+RNO#t4!uVh zV9%z;3MduXn{0@AzjU&T#HU#Uj@>vr9!OB8J~bx30GSUi>)y2gfxUa2yNkaS^ZK*w z?e1R<$svk66(oQf){WxO^{`mzqulYv;iw)fXw2pdy&Kw8%-?#)S_X1PC#nM`pMzwG znQ?QbzSi-W>FCss<2HG6fl6MqqwR}Hr5jnz?C%RrPnrIZ?~Gx6vk``CkFi+F-*)Tf zDiosAe_ut}eh@j0?q(8b(90$`|pvf zg2UJcm{q|aGWm*#n|9No7YGg$pIj4P@JEo%E5wvvz`u`y4%-!O*_%VZ+UjsqJE4*6 zB+B%R;15@u?jVsDQ?Y8;XzQRQ_s?TspsD$}oQJIJ0g}C( zBM9?^&l=_eaitU?1*Sdl&FnX(W{F5TMcDcw4D3wixi|0M?hefRAsiiba`Y2#yP|t= zQ#Y}dZ~8fbQLMCCg8b4avRFn+%J!MajP>8kdQ?7i|9=Hs6& z`Jicf!Iyw005~qB2^b^MOhk!H0@Q$nAWou$cqpZy0#Yh?wtF9r7M$18X;tL!_!yiW zd8q$dT9P7Xjf9vSy0KwQSb=WG--7?1F%R8&pdOz>MYZ=qJ3lT^Xw(Y7pqhBjeR$v= zGzolaORjQC-mV}&8*>vPxFiXfHR*r}X?Yx_1ejY5XB+A}<%?jXDCmT9<9_YtRAo{2 zeNxg2Z~hF%r-bu<$rGN+*PwqRj*#zN2JcPS<_Z92zTleFP@C4B5v?~60jKToeLg9) zb>^EH*Y9^M_BvhCNCR>uT8;q9;@nMsNWY|+fhedA@hRSo=*RcE+D~5c{P(!ZbT+Bd zpAxX@K0P~FV_qLAu&gb-@mW;u_d2#kzu>@F-nC=HHXHypgNVpTV}VelOY(D%VD4~R z+yZPU2ih>vy!hX`WV17$*8%dR#_RgU2Yxrw75NHl4DAF(GtXi)%AY~I zT_F1)U?1){9BFzBj}($t@uv4iQc{Y!LazG%lhtmzf{$;Ybbfc|M1e}|HpH{S+(4ha zKU?6&hWEYFX_mCS_fHEN9Yyn-ood>zm}W!MTPL1ee|haj|MJ?A@6EOgHAh^Mr#plF%_Zxin9*>|SgLiRh} zR5^xn$=Jy(S_}=I>p-VgQfl_ zIq#OnYDa+-&}1yOT#L_Pu@~s+B050IXF^qH#B$q=w~L?H1hePQbe|T1441 zx-|B}x0aN~)(a)1>?Ie-O}h2nM10%}*zV*vo2~sS(oyjuLHGm(G6_sOeRn)?^H z{rOlrsltEy&=Qk#Rq^zM4kJ%a{@&Bb*=gmxZXMX~zR1KVAQ*lq+y_bf>0q;M3uD_%?%+4tw z*Y+{_MHmS^nxeOpG-EY;X71G0ylyxlWwD~me%jUspV#xGocwmbr^|Am}E z34V9cp`=Eq9v8WDz+~sf#MS+%*zq!oeqY9EZJcwamEN6M*1Wyk zh<^Vm!2)pCUA&u82isu~<=$AQJRoggOw^1Q&cI!F>|JfpSz})m^>F`f?05Fw)N|vN z$H%4LcK`bRiX8<)#&=0(J2R zibLPSzLg~nxv1>zy?Xy+(=cDY`GaYL6*;s-g-|<>$u(UG6W;$($hpTez5j8%^QeU4 zB$suHWFAQ*l6H!0=Ae_5xhA48p;oRNr)D}fcOsWUX^qO#a+yNKWDL2Nm0XrvZgUyA zjV8a(M(6bV{qy_(`}jP*-|yq|`F`H7&-eL!TcPINcGc1%;;kNv?6OtS=ZZ{CvK05e zJmFTV$5Q6_=zw8V-X|GXhMz8_40mOEwDa(^rK$vZ{V@HybBbSSEKtivysc`qMSw^W z_>u#UN8S}mM`ji=c{bSzavbQ}atH0kF6mA0@$dk%ac4@Od*}hDkMnb=;#W!4-1S9! zz$_NRbgS%>Ces8h+})LV&4-`NDGb1ReS0x`Ogz?#nPF zT$knbz|=z6EGJTz4Z;T{18RYWQQhtNi|i+ldzzBAeZCV6DgK1S@$+#L)r+c;&w4gR zAc!rUhPC}?p-|axos%(opfiglJQ%UW zj+)|4{bn${{Uem!ls{)PUwRBZf4uT%h|Xlh3`VuH4_->)zqEZq#Zq(XLLAi^8>AJozGL1o zSDZBU1cz{!3IfJyVV9q5O-2`OCv|lUG`A;^PjP483hOQ>UG`b<+8m*Qhjy~TBp#pG_}BnS4Q}}?Gt{=> zss|~6ljpVnf2g^r)>sTGk~THt-C@R@WIlbp#4SzL?@t|s#YUEUK|Lls-52n9yBbiNz#_O5)!KkT&C#ZwdPbUP zEd)zV_Pm!qlfAFZ++v>;7g32Zct&Xfy;ti|ke{w@9VZY>ldo?#K$Hy`h2>v+?nHu= zxv4RQ0|S+wN)cbK6SHexMdb1gw)Tzfi1t-9t;@559|_xQjG!Y^i7oZmHZcp9v?LbJbUS)LpLjRj}#~M9}JEpdI)R&Ew{y&0SwY4iOqyh^X|c24MW_P z^kNcax%-SWP1OH@QQhqM9sdYo!%Oj5h5TD;sQoPQFwFt%>*Nm}{zt6yMK zAF$CcS^zc&;XD>6su-u!k%M&OSksc78vf+l{`3)CxTK$!NC~R}0isLCic~2>u>kPQ zS(V~1(e}-GlHJ)AX1D?L&c}zJYWGBV&uL8Ce8??+Z4P{}Cz>U${UBJl>X@jz!>Eq- z{8M)hST&?;E-sG-yMJCNG2y96ubj?_|0{@8dN7~2M!|_vh?b@R&t;GBZZT6*rWmw7 zUqWw1XR-Wnf?{#pM)(X^WEgUgAMz}ET;qFWN7TDXRjy0-D-LY7u10n_vb9i>K@wZ~wgjN|UNa=(dmi_Ra*X4X( z{ty1mglY_Z;`K4t91It$~>dFU(hG0W~t%x zd<-~a)Gf7}>s=ZL((Fp=lQivgMeK5zKB!h_&yzGfh#DT@=NEWBif2KO~JK zy^(LjS6Nx4rB6y}WE`z3jY!s|NOO*LHf5z`zRO!L#`pL60b~J+2~1qD=`KvlAkNUd zmO=zMu^hsq&0<5<^rwQLE1gl6xQW2fJ@+#WszD`XaG>W_*r>uI=W+OVrWuSs%_x_n z?B8Z9)X^%SwxWb7+}NCY-quLOoxGF=aXTku-WZDT?ha~eu*CVX2G=T#R+GJ4GP67J z4d40l!qFX9ohl}uuD#$;Q>q(`$`*frD2KHmBHnUXe52ayMP1A-QUU5WSp^jntw=oG z{dMTr^N9TAD?-=}VY`*s<%YkLw(VjBC+?-k$!y`l#U85AOItCa`hx+>nBC6(IT?p1 z5?c2MKUk2MQFhIhW52LSd#H1&YF7GCX>Vr7;*lUCpMqTP-o7OrH)SNODi*_1FNi^^ zbG?z{^>Wp8bEEu@5E)9F*)Ckj>gK2hh%u1aU0*tT+*8+a8_7@alWj5OztOv& zeZI_VWo|oU<5IjCNGbcix@;8ZtA~9~&*pTC~}l z+QSwI-pZOeGkiWa?v#k&DLuD?LgY{`Bn@*E4$R-ru_(aFv1kRpXGVj(z4MN}3AH$_ zaNbi|j*Mxxav@k9PapcS9c$vuiBcJ|CcIj8zgCe$dlGQJzzN13>4%GtgYx;GiSpW4 z(FBJkvxrK?`?bOvT134~!t)&M@NGFI@6>eLe>aif?)f98)k%h%CY5_n-bLT~YujK$ z+}pt((5H}LDI(u)t9*MI=snvGv_rKG2!vLW;=e}lv zef3*|-y#HPMWiMXoWO4l2&K#Q9gjwPsTosH786jsuu+D(UP68&NSp6trpP`Fl@E#v z2%{|mIoCvAC(=c5-k1mnkQ5Azd_$Cf{)>9!v<%j7gx3HgOw>&!Qy?GGVpzF6cJy3O z#cQ*D%ndcy>U!VQZa>&d1fbdJ_Hw7^It9N z98gkW#O+w7SY`Jb>M^nN7&z*U$4K-B)v88__B;k!VoMr}do`nCuFiBge)D4d=5FG8 z?0ld<#z;iJ;oF`$_4dc<&-?-|IMV*I>UH>TkSQ6~CJy4r*rN7rdSZVo9os65koX(m hhr|ErV2tIjsQMl$M3^E7ph^C^6Q-w4@{BKp{RenPR~i5S literal 0 HcmV?d00001 diff --git a/docs/guide/index.rst b/docs/guide/index.rst new file mode 100644 index 0000000..e4dba05 --- /dev/null +++ b/docs/guide/index.rst @@ -0,0 +1,18 @@ +========== +User Guide +========== + + +.. toctree:: + :titlesonly: + :maxdepth: 1 + + api/index + cairo_integration + gtk_template + threading + debug_profile + deploy + testing + porting + faq diff --git a/docs/guide/porting.rst b/docs/guide/porting.rst new file mode 100644 index 0000000..311ff58 --- /dev/null +++ b/docs/guide/porting.rst @@ -0,0 +1,109 @@ +============================ +Porting from Static Bindings +============================ + +Before PyGObject 3, bindings where not generated automatically through gobject +introspection and where provided as separate Python libraries like pygobject, +pygtk, pygst etc. We call them static bindings. + +If your code contains imports like ``import gtk``, ``import gst``, ``import +glib`` or ``import gobject`` you are using the old bindings and you should +upgrade. + +Note that using old and new bindings in the same process is not supported, you +have to switch everything at once. + + +Static Bindings Library Differences +----------------------------------- + +**pygtk** supported GTK 2.0 and Python 2 only. PyGObject supports GTK >=3.0 +and Python 2/3. If you port away from pygtk you also have to move to GTK 3.0 +at the same time. **pygtkcompat** described below can help you with that +transition. + +**pygst** supports GStreamer 0.10 and Python 2 only. Like with GTK you have +to move to PyGObject and GStreamer 1.0 at the same time. + +**pygobject 2** supports glib 2.0 and Python 2. The new bindings also support +glib 2.0 and Python 2/3. + + +General Porting Tips +-------------------- + +PyGObject contains a shell script which can help you with the many naming +differences between static and dynamic bindings: + +https://gitlab.gnome.org/GNOME/pygobject/raw/master/tools/pygi-convert.sh + +:: + + ./pygi-convert.sh mymodule.py + +It just does basic text replacement. It reduces the amount of naming changes +you have to make in the beginning, but nothing more. + +1) Run on a Python module +2) Check/Verify the changes made (e.g. using ``git diff``) +3) Finish porting the module by hand +4) Continue to the next module... + + +Porting Tips for GTK +-------------------- + +PyGObject does not support GTK 2.0. In order to use PyGObject, you'll need +to port your code to GTK 3.0 right away. + +For some general advice regarding the migration from GTK 2.0 to 3.0 see the +`offical migration guide +`__. If you +need to know how a C symbol is exposed in Python have a look at the `symbol +mapping listing `__. + + +Using the pygtkcompat Compatibility Layer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +PyGObject ships a compatibility layer for pygtk which partially emulates the +old interfaces: + +:: + + from gi import pygtkcompat + pygtkcompat.enable() + pygtkcompat.enable_gtk(version='3.0') + + import gtk + +``enable()`` has to be called once before the first ``gtk`` import. + +Note that pygtkcompat is just for helping you through the transition by +allowing you to port one module at a time. Only a limited subset of the +interfaces are emulated correctly and you should try to get rid of it in the +end. + + +Default Encoding Changes +^^^^^^^^^^^^^^^^^^^^^^^^ + +Importing ``gtk`` had the side effect of changing the default Python encoding +from ASCII to UTF-8 (check ``sys.getdefaultencoding()``) and that no longer +happens with PyGObject. Since text with pygtk is returned as utf-8 encoded +str, your code is likely depending auto-decoding in many places and you can +change it manually by doing: + +:: + + # Python 2 only + import sys + reload(sys) + sys.setdefaultencoding("utf-8") + # see if auto decoding works: + assert '\xc3\xb6' + u'' == u'\xf6' + +While this is not officially supported by Python I don't know of any +downsides. Once you are sure that you explicitly decode in all places or you +move to Python 3 where things are unicode by default you can remove this +again. diff --git a/docs/guide/testing.rst b/docs/guide/testing.rst new file mode 100644 index 0000000..cae4fc7 --- /dev/null +++ b/docs/guide/testing.rst @@ -0,0 +1,39 @@ +.. include:: ../icons.rst + +================================== +Testing and Continuous Integration +================================== + +To get automated tests of GTK code running on a headless server use Xvfb +(virtual framebuffer X server). It provides the ``xvfb-run -a`` command which +creates a temporary X server without the need for any real display hardware. + +:: + + xvfb-run -a python my_script.py + + +Continuous Integration using Travis CI / CircleCI +------------------------------------------------- + +Travis CI uses a rather old Ubuntu and thus the supported GTK is at 3.18 and +PyGObject is at 3.20. If that's enough for you then have a look at our Travis +CI example project: + + |github-logo| https://github.com/pygobject/pygobject-travis-ci-examples + + .. image:: https://travis-ci.org/pygobject/pygobject-travis-ci-examples.svg?branch=master + :target: https://travis-ci.org/pygobject/pygobject-travis-ci-examples + +To get newer PyGObject, GTK, etc. working on `Travis CI +`__ or `CircleCI `__ you can use +Docker with an image of your choosing. Have a look at our Docker example +project which runs tests on various Debian, Ubuntu and Fedora versions: + + |github-logo| https://github.com/pygobject/pygobject-travis-ci-docker-examples + + .. image:: https://travis-ci.org/pygobject/pygobject-travis-ci-docker-examples.svg?branch=master + :target: https://travis-ci.org/pygobject/pygobject-travis-ci-docker-examples + + .. image:: https://circleci.com/gh/pygobject/pygobject-travis-ci-docker-examples.svg?style=shield + :target: https://circleci.com/gh/pygobject/pygobject-travis-ci-docker-examples diff --git a/docs/guide/threading.rst b/docs/guide/threading.rst new file mode 100644 index 0000000..da3cd7f --- /dev/null +++ b/docs/guide/threading.rst @@ -0,0 +1,296 @@ +===================== +Threads & Concurrency +===================== + +Operations which could potentially block should not be executed in the main +loop. The main loop is in charge of input processing and drawing and +blocking it results in the user interface freezing. For the user this means +not getting any feedback and not being able to pause or abort the operation +which causes the problem. + +Such an operation might be: + +* Loading external resources like an image file on the web +* Searching the local file system +* Writing, reading and copying files +* Calculations where the runtime depends on some external factor + +The following examples show + +* how Python threads, running in parallel to GTK, can interact with the UI +* how to use and control asynchronous I/O operations in glib + + +Threads +------- + +The first example uses a Python thread to execute code in the background +while still showing feedback on the progress in a window. + +.. code:: python + + import threading + import time + import gi + + gi.require_version('Gtk', '4.0') + from gi.repository import GLib, Gtk, GObject + + + class Application(Gtk.Application): + + def do_activate(self): + window = Gtk.ApplicationWindow(application=self) + self.progress = Gtk.ProgressBar(show_text=True) + + window.set_child(self.progress) + window.present() + + thread = threading.Thread(target=self.example_target) + thread.daemon = True + thread.start() + + def update_progess(self, i): + self.progress.pulse() + self.progress.set_text(str(i)) + return False + + def example_target(self): + for i in range(50): + GLib.idle_add(self.update_progess, i) + time.sleep(0.2) + + + app = Application() + app.run() + + +The example shows a simple window containing a progress bar. After everything +is set up it constructs a Python thread, passes it a function to execute, +starts the thread and the GTK main loop. After the main loop is started it is +possible to see the window and interact with it. + +In the background ``example_target()`` gets executed and calls +:func:`GLib.idle_add` and :func:`time.sleep` in a loop. In this example +:func:`time.sleep` represents the blocking operation. :func:`GLib.idle_add` +takes the ``update_progess()`` function and arguments that will get passed to +the function and asks the main loop to schedule its execution in the main +thread. This is needed because GTK isn't thread safe; only one thread, the +main thread, is allowed to call GTK code at all times. + + +Threads: FAQ +------------ + +* I'm porting code from pygtk (GTK 2) to PyGObject (GTK 3). Has anything + changed regarding threads? + + Short answer: No. + + Long answer: ``gtk.gdk.threads_init()``, ``gtk.gdk.threads_enter()`` and + ``gtk.gdk.threads_leave()`` are now :func:`Gdk.threads_init`, + :func:`Gdk.threads_enter` and :func:`Gdk.threads_leave`. + ``gobject.threads_init()`` can be removed. + +* I'm using :func:`Gdk.threads_init` and want to get rid of it. What do I + need to do? + + * Remove any :func:`Gdk.threads_init()`, :func:`Gdk.threads_enter` and + :func:`Gdk.threads_leave` calls. In case they get executed in a thread, + move the GTK code into its own function and schedule it using + :func:`GLib.idle_add`. Be aware that the newly created function will be + executed some time later, so other stuff can happen in between. + + * Replace any call to ``Gdk.threads_add_*()`` with their GLib counterpart. + For example :func:`GLib.idle_add` instead of :func:`Gdk.threads_add_idle`. + +* What about signals and threads? + + Signals get executed in the context they are emitted from. In which context + the object is created or where ``connect()`` is called from doesn't matter. + In GStreamer, for example, some signals can be called from a different + thread, see the respective signal documentation for when this is the case. + In case you connect to such a signal you have to make sure to not call any + GTK code or use :func:`GLib.idle_add` accordingly. + +* What if I need to call GTK code in signal handlers emitted from a thread? + + In case you have a signal that is emitted from another thread and you need + to call GTK code during and not after signal handling, you can push the + operation with an :class:`threading.Event` object to the main loop and wait + in the signal handler until the operation gets scheduled and the result is + available. Be aware that if the signal is emitted from the main loop this + will deadlock. See the following example + + .. code:: python + + # [...] + + toggle_button = Gtk.ToggleButton() + + def signal_handler_in_thread(): + + def function_calling_gtk(event, result): + result.append(toggle_button.get_active()) + event.set() + + event = threading.Event() + result = [] + GLib.idle_add(function_calling_gtk, event, result) + event.wait() + toggle_button_is_active = result[0] + print(toggle_button_is_active) + + # [...] + +* What about the Python `GIL + `__ ? + + Similar to I/O operations in Python, all PyGObject calls release the + GIL during their execution and other Python threads can be executed + during that time. + + +Asynchronous Operations +----------------------- + +In addition to functions for blocking I/O glib also provides corresponding +asynchronous versions, usually with the same name plus a ``_async`` suffix. +These functions do the same operation as the synchronous ones but don't block +during their execution. Instead of blocking they execute the operation in the +background and call a callback once the operation is finished or got canceled. + +The following example shows how to download a web page and display the +source in a text field. In addition it's possible to abort the running +operation. + + +.. code:: python + + import time + import gi + + gi.require_version('Gtk', '4.0') + from gi.repository import Gio, GLib, Gtk + + + class DownloadWindow(Gtk.ApplicationWindow): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs, default_width=500, default_height=400, + title="Async I/O Example") + + self.cancellable = Gio.Cancellable() + + self.cancel_button = Gtk.Button(label="Cancel") + self.cancel_button.connect("clicked", self.on_cancel_clicked) + self.cancel_button.set_sensitive(False) + + self.start_button = Gtk.Button(label="Load") + self.start_button.connect("clicked", self.on_start_clicked) + + textview = Gtk.TextView(vexpand=True) + self.textbuffer = textview.get_buffer() + scrolled = Gtk.ScrolledWindow() + scrolled.set_child(textview) + + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6, + margin_start=12, margin_end=12, margin_top=12, margin_bottom=12) + box.append(self.start_button) + box.append(self.cancel_button) + box.append(scrolled) + + self.set_child(box) + + def append_text(self, text): + iter_ = self.textbuffer.get_end_iter() + self.textbuffer.insert(iter_, f"[{time.time()}] {text}\n") + + def on_start_clicked(self, button): + button.set_sensitive(False) + self.cancel_button.set_sensitive(True) + self.append_text("Start clicked...") + + file_ = Gio.File.new_for_uri( + "http://python-gtk-3-tutorial.readthedocs.org/") + file_.load_contents_async( + self.cancellable, self.on_ready_callback, None) + + def on_cancel_clicked(self, button): + self.append_text("Cancel clicked...") + self.cancellable.cancel() + + def on_ready_callback(self, source_object, result, user_data): + try: + succes, content, etag = source_object.load_contents_finish(result) + except GLib.GError as e: + self.append_text(f"Error: {e.message}") + else: + content_text = content[:100].decode("utf-8") + self.append_text(f"Got content: {content_text}...") + finally: + self.cancellable.reset() + self.cancel_button.set_sensitive(False) + self.start_button.set_sensitive(True) + + + class Application(Gtk.Application): + + def do_activate(self): + window = DownloadWindow(application=self) + window.present() + + + app = Application() + app.run() + + +The example uses the asynchronous version of :meth:`Gio.File.load_contents` to +load the content of an URI pointing to a web page, but first we look at the +simpler blocking alternative: + +We create a :class:`Gio.File` instance for our URI and call +:meth:`Gio.File.load_contents`, which, if it doesn't raise an error, returns +the content of the web page we wanted. + +.. code:: python + + file = Gio.File.new_for_uri("https://developer.gnome.org/documentation/tutorials/beginners.html") + try: + status, contents, etag_out = file.load_contents(None) + except GLib.GError: + print("Error!") + else: + print(contents) + +In the asynchronous variant we need two more things: + +* A :class:`Gio.Cancellable`, which we can use during the operation to + abort or cancel it. +* And a :func:`Gio.AsyncReadyCallback` callback function, which gets called + once the operation is finished and we can collect the result. + +The window contains two buttons for which we register ``clicked`` signal +handlers: + +* The ``on_start_clicked()`` signal handler calls + :meth:`Gio.File.load_contents_async` with a :class:`Gio.Cancellable` + and ``on_ready_callback()`` as :func:`Gio.AsyncReadyCallback`. +* The ``on_cancel_clicked()`` signal handler calls + :meth:`Gio.Cancellable.cancel` to cancel the running operation. + +Once the operation is finished, either because the result is available, an +error occurred or the operation was canceled, ``on_ready_callback()`` will be +called with the :class:`Gio.File` instance and a :class:`Gio.AsyncResult` +instance which holds the result. + +To get the result we now have to call :meth:`Gio.File.load_contents_finish` +which returns the same things as :meth:`Gio.File.load_contents` except in +this case the result is already there and it will return immediately +without blocking. + +After all this is done we call :meth:`Gio.Cancellable.reset` so the +:class:`Gio.Cancellable` can be re-used for new operations and we can click +the "Load" button again. This works since we made sure that only one +operation can be active at any time by deactivating the "Load" button using +:meth:`Gtk.Widget.set_sensitive`. diff --git a/docs/icons.rst b/docs/icons.rst new file mode 100644 index 0000000..6ccf5ce --- /dev/null +++ b/docs/icons.rst @@ -0,0 +1,52 @@ +.. |python-logo| raw:: html + + + + +.. |ubuntu-logo| raw:: html + + + +.. |debian-logo| raw:: html + + + +.. |fedora-logo| raw:: html + + + +.. |opensuse-logo| raw:: html + + + +.. |windows-logo| raw:: html + + + +.. |source-logo| raw:: html + + + +.. |arch-logo| raw:: html + + + +.. |macosx-logo| raw:: html + + + +.. |github-logo| raw:: html + + + +.. |git-logo| raw:: html + + + +.. |bug-logo| raw:: html + + + +.. |linux-logo| raw:: html + + diff --git a/docs/images/LICENSE b/docs/images/LICENSE new file mode 100644 index 0000000..7572a31 --- /dev/null +++ b/docs/images/LICENSE @@ -0,0 +1,3 @@ +pygobject.svg and pygobject-small.svg are based on the GTK logo, created by +Andreas Nilsson, licensed under CC BY-SA 3.0. For more info see +https://commons.wikimedia.org/wiki/File:GTK%2B_logo.svg diff --git a/docs/images/favicon.ico b/docs/images/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..905b2007daf0265451f9520a3fda2a16a45b8b51 GIT binary patch literal 34494 zcmeI52apv-8h~fX7|1FnSU6D2L^{l}%ZZ4Vpq3>jxLpJ}@HkFO3$v_MT0{w=RB4$J zj$oOJ13ZGLg+ya1;S^kRLPRAB()WL}+hf0Z6JOYU&wGE>|9Yn9?>}`<=jmrzMOJ;Q zSu;z*Vry7E%j$1gR_oSP_hTDd)-s7JF0Q(tEp)w`SXSrG)%P7OYg-%3DlM(LKjANy zHNBT*ogh4fR5(_}OJG^T=h>nvwC^+b(@0oN5ZofTEd-$%C)iL>18Eg_;)y4!Aw!0! zVZ(;0u3fv@ar&7n95448;Azvo^2#gfwbx!#3l}a_zyA8Gs;H>&{-~aK;tBQETW{Iv&pGEDb;%`{*w-yuwD3*ex^-)H;J^XZzkh$5=G0S9 zjg=mM1E-yKT1x5BZSUT_YQlsG3O}5C?zyq#i!;Z+@*GUZd|HSqqxBkKD@TGFHqO021nIw2J#E%l64RhCpo7WJ16 zQfG~-Q-xI#wes6dq?QQ|jfte`D(D9-<-vah#rm{xk)&@S=!V4-k-)ot{rc+IV~O$vcRJ(V^i{bLZ>JwWe!NL-S6|uf z3BCuzO%G)ME`t|AHMoG_mF+wn`kNzj2f!-|lnY>;vyxR$Sf%MX?4T71J=fw*h zy!?RAljs?<-g)PpYRQr%YW@24>dP;`R3CisfqLedXH@Ury_4v@czDG9UEeqAvuDp%^vAu@2E=*Qla#e2K8z6=_uqg2{dT)ZALX{&Zd0Fq_L-v=eQK|?0dbTu zH&DhS^Eu*(Bkb`wN-#F}=!XXJLY5n1$(O|Hp@$xFd~n%imj%glKTBEup@$yo^s8>V z=_W`1$dM!6GJ@`7$#2!Fm6|qfn&a<%`}Wy=qnBTP*^z(it+zVz#*Q7UHgDc+BlAr7 z%7u~TGhYI)Ffipm_Sj<%d4~=i+_JfkEdRw9Uvzj;2lVOFM|JMpS(TNQsSO)8IM1>n zAK%eO1L!;J{4%GRjpH+vE>pxdIM@CRQ<%Tgo^W;8sUh+NrA3o{*_}cNhU82k~m*v3&S#I#` ze+iLS`oOr4KKjThCSLWH@bv0`{WBF=UTH46=pwtlc<#C9>@^1u8v43!p#S|}!9d$G z@SMJ%SN~h0tqy|O)B)Lyae@FpkQYk@Gco>x2W4xdAiN7;ctF1>+byeUrL4g&x2(F^ zL}VaK%RRxWS}Q7-(3z)@Qn*#trojRfJWvB3C=wYZf|CU23$7Jhmt{l-vK|oZA($$# z)VfkI+wDde{}rM`r zboJF&tA73ZsWZn>KAqh@&lV>jRw$9{Ud5Y0}pJf(tHCJ9g|a#YVc$1^wH# zYo~tt>8B)p*}FqKMV|cd!w*T%iO2>0-Teplf(#ruFk#;m^*?i(m6eqVcGR~1>}}M0 z)U;x(_qfZnzNfx4p|J{di{_2Nb4`EunwNXOrrU;G)4ylWo(cZv zhV>w~-ugb*^k;9ZxxWSd8LQuTp#5SG(0lK_2Z;lj%t7FlL`Td9p*2EBfpAlQPeo z8+*WL3m9)Pw{^`m*C_VkLdTwB_DO?YYp%65e$h76LYVgWC6hX{Pk??E^GQ8=^l<91 z02x90ht6LG@Qornfrhc}r=Nc6ydU(<1NIi^v_bP%3p1%-7_ZAOzueJXUr@J&r2Dr# z_k+;+TS*wkKl1a^(o(Iq6Vhgf$OxLh?HQ6bjCZW()Wdwwq=ESg))Yc?D3RxWz}i5K zuX$0gGH1khq#{2ESIhID^$YCcJB(d|L40cC8S8PZDMkU-?{diobdS1zr|sjrQ1Yub zd~M2P&5Jd~RDiO^J3U2^daI_^uaQMvSSlD+-i4$91rMa=fvUDcUQ!!=4-ddj-lF}4 zC6={^u&pKERtYq%4&`KtO707x;}`8G?Kj(xqks3S+t2LNDiy2{boOaU#FPeADA5Hd zc%a~cf(PPwfb%W}3es*>|7K{qBgfN!P ztO4svGSi?P5W)Vb zark@9^(Gk^62bRx5$0Dj;UngL!hpV1WLd1~e)7pD2^N0+_1Ef+H{MX}>)o!l_g*ROhoCk8 zxH|dJV_O)+wm)ti#yY4Mux8buL4&w?8izhB_KQQ~=wQ=6|NQe_F0l8hr@}8{nw+uU z{8ry|1m_G!v?Ud~oUxzp%sCgt4NI3UO~tOLX>!JX^4RN~lK0<#KdLRM(ABv8^ldm( zg*~$F_HD(A74Ga;w4M1}{#k3~oMiS8vWM9O_JlDe;A}wlYkPfIGs&bSN8bMslg+i#xRqNX?g`+T&YwSWHiEG|$_xXVL6+D{o^OwYPj z)cHT=LHWND_qR^@YCk>zS-+$1pEz-%qJF1-q@T$8@1jME?6p$!e_EhtzF4E*xe?5z zXc{wQUR}$M5N2)uGlJ|mdS;8ZV83Kk2;ie^`9Ceb{GS%@5POX{Ti<+-BI=yC`OkS! ze2Z@abB|eA|Ctxjmucl?Tp502E$Y}9yyggP7)%p_I6P~F_T6{iHM8Ei-m+y&9Qo`K z4})?ch{Ll+XualIaRTQ?#n6}i@nOJ!cI^|4!#C@+oaeZ8>sBY28_NXQ zBc5yDzoFA#1<|np1rHQFQ1C#g2NF8eUN@DnXsA>LVUhe(tqsaPf55UvQ`riX*yj_- mH>WzZ&vTFy9SWiCpS1m;{i;LlcbyM9Uz~iZM6Tpp2>cJ4qE5R2 literal 0 HcmV?d00001 diff --git a/docs/images/logo.svg b/docs/images/logo.svg new file mode 100644 index 0000000..3f4ebde --- /dev/null +++ b/docs/images/logo.svg @@ -0,0 +1,266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + gi + + diff --git a/docs/images/overview.dia b/docs/images/overview.dia new file mode 100644 index 0000000000000000000000000000000000000000..08b02430c4823a0d4c6516a2c7e4fc00d0517fb2 GIT binary patch literal 1885 zcmV-j2cq~NiwFP!000021MOVPZreB%-RCO|cbm{6MNwqkq(BFlZZhZqGhG|BMcZm+ z$&lzI?qa@uC`ztvS@J`V)IsSYDWqK8LsGow9=`nH#G?0GukeaUBH91H%v+PS4ZjMa0#6mik@DNM2P>?kT0*=kn4}sLNE#%spcDWpG{JL<# z>%zsa3+E@JWfaSp`|=QS97TcPVTLN>m8g%COn9KW*s*HC`rfC$l+lUuPkE4>Q-SRE z&xpG;dS|ik9S`0;iwZB^TK(@&I(;S2z9;9SmyTXZ=6&6f_a{H`$AKs-y&uZf+^^el zU+e)oPi!A=*yA#9m5Ios!VylLL^NCZo=8q~=6#zAPxIVtaH`#lb`6`x^OI%3*T<_+ zG^+5$L+L9H3<$QpHrh2P$p3rs_G~udbf;J zv?lF9p4$_%TLqD-QB@xkabD6-TY1{c$tEvJFE2mexy4m=o;FuI-93A8c{lz?^3db4 z*SqU|ieCC#Ij+RG@7?#mSo>j6Y&_*mNr8h<)@_*U4g@G9rdnn`ei0kxRbibLID4mnI1jLKFMi4K)>>5Lg7kR3)7Hp~*RhMDU zu29&&*K!_(6_Y_nR9Mw;JPKtQTzbDZRRh~#ecylNYRKM8RC2*DI6k|UF}pP5VtPsRfvSfZFiPJ02XZ{K8$4eEhWR}FPcq^YUo-uP{44i85psM z(F{g2T&-rX8_zJ>fH=gyb%9L~cDkHlR7h5a1QpT{QQ+F@ngIlBBVU7bXr&3yQ4bEV z5ZnEj2?wJd&Q%YAKc4xq(7vO1Z8Sv38UhgjU1;A@fEi|vQ4vN(T&;@0ja38&khVH88#ib4GtrSJ+$A&q^#K52x45enBU z6r47M0)wueTkBpa;0%dwq=LS-f&1pALgOYhTES?AwzWcJ7AIayF0hQqEF%|;T==DO zVP^~UqpD$vWFU=qH8?-F@Q{voKq@55)<_s4dzkJCun^Lj)^=#!&8cBH5}|jnGyd#) zmTp#{4%7uB6xZA|twL_HES9J2tWB+M-r;s-)tDn5$I)~3Mq-2-x*i20oE;|yyPEjx zL7t?dnuy!u8Ogyr+5Dw9S8<%?P!+Z^(i@k1+rREmto#IjjSm#Co$QbQCs-9uGBzno1o6_u<$nUR{}x(65x$rzHUCK=R# zWUT#X?Y2qgllY-V5EWEI8&i#5z@W{7>pZeiNa;Z?23(~XhPKi&4rCgb)jpOaevD2N zO;r^SO>GOf4!+FPQllTjj+$<&S~RV3wkYi$$q_0zC`akv49We5BxltiIeVkR;ICvk z_V!pV9T6#7(=-Q(qi1_v+j+Y*XRCTa_Y}?LRoyo=G-qh;jnEwGg62+~%(Yrr%R;wM z{bF6OV>uco+cS%t^h`d)Z+iu+S;LvtE3YJ6T?pLl<+&cgx*Q{Hab*t;$ z<^mgkZO3NrfvHSQy8Par6v)y*79(tEy8u}jr*j^R)dju=jnGB|o_D4OSqSf(sd0^N zFuLJP-SAm{zq5e_Qmgt7VlFQXVKB!4 literal 0 HcmV?d00001 diff --git a/docs/images/overview.svg b/docs/images/overview.svg new file mode 100644 index 0000000..37d6e2c --- /dev/null +++ b/docs/images/overview.svg @@ -0,0 +1,72 @@ + + + + + + + + + + Python + + + + + + PyGObject + + + + + + libgirepository + + + + + + libglib + + + + + + libgobject + + + + + + + + + + + + + + + + + + + + + + libffi + + + + + + Gtk-3.0.typelib + + + + + + libgtk-3.so + + + + diff --git a/docs/images/pygobject-small.svg b/docs/images/pygobject-small.svg new file mode 100644 index 0000000..e6576e8 --- /dev/null +++ b/docs/images/pygobject-small.svg @@ -0,0 +1,193 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/pygobject.svg b/docs/images/pygobject.svg new file mode 100644 index 0000000..fbf88e1 --- /dev/null +++ b/docs/images/pygobject.svg @@ -0,0 +1,244 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/start_linux.png b/docs/images/start_linux.png new file mode 100644 index 0000000000000000000000000000000000000000..5a557ee4116a485023331f47d7e0c48684424956 GIT binary patch literal 9893 zcmdUV2UJtrx^7Se6e)WHg0$$~Dx1DhL8U7yB0`kjQ4x^7DWN6-3!orGMMY|`&`ang zK%ycbHS`i72mwM#2rUT^lDx$^=iPDJJLA54$9QABWMpKnHD~6W`PW~*|NH0j+vdhX zN2HH{Kp-KL8&@qrpaX^=5KoE#A8_Z(Sg8{5b@;Cv_Q4>KpxFM02b7*E1>EEhF)_Qw z|5H#*^pYZOuXhf(#dqJ-_$r9I|ITU7PXU3>oHe<6*(#hsojRN;KA&}AjeC>{fA&mP zDg64OtD@J$Bz}PoKU_;Nu573pe*jOJGP~8C)#HJb#atqq5l_juy=ae2Y`gkhMqT{R zpF9bFC^6wjTQ0E~mIOEapXbi!2g7i%gypiLva(3;qGel%-juVAwY9{d1}C+VQb$Qa zNww}$mu77(-!ajQ3jxW5fe;WV>9W23xJ`>goxdEFP?K2Z+;|ItpDLQuN2}yxac5uP^$9Pe@4_@{(8i+HNiGk2`v;IM;` zXnE;hYyGC`Ha85bUR6STT0!FcnOCGD)vq9P4yh%0s~gjZ&9k3HU?&K5KB+9dKRpUXtzJtnDu1RU?xYz7==K0BTq&_3zUQC?uyQMEyQQ<2ir5{bnY88Ql zc?BgU-B=`P%njJ43tOV=c;_u+F zS*>gLT0WY|#9w^aIl#e&uMgC7AI0CNyzjsB4y?8QHU9oi!rT5DpV6%Jx=#oDa#CH> zu1VJu(np^n8XVwvpev`)0aFi)E`}H9)yv5Tt!o|!_Q{Jyn`}>8EM0$ z(SR{g&#b`6kd+ZlmngWu?#|Ynib|5K#w6dW_(6`<(!sT_F3XC2{pxZ zSO)*s6iOtaN|NMB(~0oORXO+Ilj4vlKDQpZ;jb zW{txSPOvVvv8~&&Z;pg&QK~gQg)P_JIs|NvrnA)-?$J5){;Z$FNZuLe2vwKLQy#tP z5^mQ~d)ex)!#bDq{W7#F+)b@*WO&W2-B>phn7gbhdDvY4@>gfup>u74EFy! z|8)euBeQ_2}OXRS3YYW!O zb?Q2zYS5I$AkC5aLt~$K3a}|HQ4ukdX-uMX7aZ`F8t^v3irSCAX@@Oaxj9MKhIb5H zyf+jWxOSOetH|JKJ1Sf$a%)lE6BTj2+G|4Votm?>deg-!d%m1mKb!(&;~TG`n2_N_ zF#Ubk{OpdT%ZqVz@AIS#t=1S0`~KXsnSKm(MX&NcpeXBOA8zX(M6zoJ=W9-Z!_D>A*~1f_C}ML}*$}lMvM2pL zV{*%``r#d``TVImynf*154VrbjiJNy8J(n7*zpp_IyFb;dHmA3Y^1Ggl&Y2=LG}sq zVpCga*vucz7o6{b2_k~{V{c{`qE5klE?c<&tvrK54mqs*a zj}P5x8ExzQ0UY_`>pEd2cvFFHHrz5m8YN?YiC;L_$9Q9ngR>UeRXgQzngK4yvWe+T z21do9`rc17-QAOx$m(`d`B{-SokBSEdy$N!d{l%-9jE8b#s$YHx!0YY^gv<* z_{FC<;pgpuQ*}fJ?vRc6z{f4~%!`?9X$PD|XE207WJi4c7Q4e<-SXu+W{E5->hhc) z2fZnyBs9i#XS2O!b?#pcS)EiQ)cVP^AoZ0Nusb7a&fA18%cfiCW=5p!IaqiIW$ffM zv|FC0xTFNf@vuqru;b#R9u$MShFP|2LT|07VPEX4ADTcx+LS({N<`&fl6*O0)6rL~ z=8NusJ1FwqtZwpH%7(&5=SRcJQfiui7JWQF>{uUw48&SC?%m})KBP$`y`M4mRM>cI zOYVODYKJ&@W72!?Q*&q$O)0nS!USM#;4sHD_&F|6@HMijekQEOY*#>DiUHw)ZKD`MzQHxhX&A zJo6tYjGQ)2ZDk?B5@E?W1uo1~#j#e!Tnb82vnMjB6P|SsEK>bDn$~7b*T+Z@4^8o0 zU%Y!)YWt8^bke-C&4Z+Z6v9NKWvSMkrFSky6S+o+v?A_p$GQYn$6CsWpH1hqFBSUZ zK!CpJsZwG?tK}Zd)OuLB)Kzi5p^=$8D_Y&m3QmHnga7gwUFA7n2&&f8hAvA1?!C#{ z=%-$;8%Ie`uDTIQP1kd+3Z=@!xoXast9W@mw^f;d>uTHpbhh4#-uMM8n?k-EAB0Pl z3*vMnb@*K4?rIupv?SFv*?$V-K?N4W4P7 zXX5IJ#5JwuF^$IgTAc~{`CQz1mMXr@N~@JcB-BWZa|HU{Q);ygC(66N>3WITswave8bil}R=tg75q2X|jNDWYzhQx>s7|G+ zg`0lq1MTD#EQ`^R&78VchkMNrMx6JVe(im7AKv0|Ygb0p3WnToXDCmP*OL)qy%O>QN($*XncefP|yD9*NW&5n6ebg%vcjtaK_8r23KX56z!1 zDxVq4XT8b#iJ3$5#S0y8GM)Z}rJcE%th@1yastL|j_%cm2VK>VQL(EpSj`FgKC_;B zSga~#t!%GggV-EtJ=*uVUB|&j5u}&mnhIyabwIf%&bt$W?GG+F*EI_#kn`}*+)Y#6 z{mdhot8xl2q^&p3CTsgYICfV)YwK#rVxPVsETCz};|VP-&qQIDbw>X^J$|lkJSy__ z^ug$=T*9jj-&^j3o+$V%B)UOe(3GEobFDQvaQ@8SgKGp*c*Ag$Bq;u<%|DX!cv=$3 zTvU@mydVKXkWLF#{a;1a7(F$Xe9l(lATUA+1cYTP6A;L3KqjCG>pZCLP(7ylCn#rr zTnUux8m<EV9%Z@1~?TgSg0at`vNZI7VLkxQFk|MioF zbB=daXJWYD#US5*y!!o4F9o^g(Wo2dc-B^F))nflA7EYg>P#=aR26#*J^y`h z5xme%2~5eMf3We%5ah1OBxe-t z*)kGP_N-WbH{2B}-8ZIXkK{(AFiw{pj(tr-+d&rFM;>eo4%o-Y~3~oOZ~whG4RXLL(YMFV<{R z2i$kmRNn_9pQrh8-b2z3y$?o8>@_@lGq+d6a5A<|f!C7U8%W7IvoQySf5hP!1fSEX zOaN|G&fi+G7eI6X50mtWU;c;ubm)ZN_(rwYphq#Zzz4qU*o%f!eFC><;@bhs`XwF! z%r@BErn1_0`6v}WA!)0DT}>+wAwQg4MJat^c!KAyV~s(LTtAt;zVX^~I*sA_(Qid~ zeZth``8_ry$wvVfRfgG}L6XUv)cSR|L=wvr@`Jy)y*AzU$TgAXjrQ%{=@&?0KaAC= zR&E)CG$)dR`{iI{lRAeyFy4=2eb^yurUthxK-U|)7QXZ7@we0QurQ{?z|+HGL9GJ~ z6zZn^l(aOibX4m+KF-RWA0%GxZHyY6E>`boBiwV6(wHqA$BpLpQU@zZlED zikgX)4BF{?vjV8q>TIHVZ;kh`lFTUD6*rj?fKAiuMGbkY1Vo}DHW%EHwq;If6JgVE z9~ILXXd!B$s%j-W&$TH$kX{c2&j5P*&L)|RSbGAV6V_hLnY8!JvbNZfRQKd^*v0M6 zVN=kCKvJ7K5~98Id9s;FbR5t=U!4hHIHP0!pufqA?X<28 z0g>zb3Dc%ojc5$k0rgCSQ9I_Vl|HOF&N{;_7=lBDl?9Q~C!r}gYq#{{o8S&Od$mF{ zE^Bk8Rx>-GkdP_EoT$UAqOj{fCo23Xc@3QB#Zp646Yp2^njYt0C9>oOj;5oS#ZThMN|r%7JA`+ zjhHuZX+NRc7=l^N8GxJVD(f438(0zY7Pd2=+HQ7X>W!JDN{wK{+BZQr9GjsWk-c=x zE}hfm$_cXZ*~(RiE7tmszfLl(`)xyEf)e<_^`(E>=h68Vi%^+d1~vKHR&x}y*E=M% z6+;6=W^bU$S4Io9oe8x9vIP^GeN$#@oy&k~eLNU(apQy129Jih9)0L_-930$TIYv) z-Nb418+wLrL{P00ml41{=9wATX0F<`?=r?lcBxBL(0Oo!ll9)h>r_%oJNwVo^!2Lk zp(Or!By)bknw2uF72qTxHxb$;pYP~`!pwZx?hDX)Q1>+F2UC>g@ zH!|8gGW_fn^Zvr&FWWNJn~tzm}LGoRMwewg?D0Z2`T z)RvTZuO-f1sNT{s^?ZqVYgZZ}Rs3`9ZLbDP5^2}J@pC01n{UI5(>ibO-SEJ=Fl_4W z)Ngy#fM^-i-kd_%Za{$J1R9IO$F)(rcd6Z>pmZEkc2j-aFK?)p%se*=+m($y^@0(AWwk=PQ$X@g?}(L;MWsW3GDiw(Y6h;8`EHfL;Pw zyfJceaNMsVEit=@bzhgOE~$wZah{;P6|oO+{h3=nTxx`tCJB;k=2>0@54ji%on*kO zhox-n?bGDeEdSi$FmbMKlhf>}>DGLGdf`RJnA=LGtM|cRQqqMsN$gszG|$Hm5qSe-^ zT9|al`-@{j+`Foig?e2LOF4j*%j2jRXkgO(DbPm zBmtT}coD;0YDAac^gC!J<2%NLMwdDs&e=qvgLeSr@LonQGNcTEF%8P-rpmSzB_*XG6r181yi-h{ zjNv&LH0l&=mgL@na;h4ghqw$=Z`alcPdG5CUPe~l6Di7N^}jjxR%a(3Q!UcqEMx@q zLKpi^)&Xc<+Z81e-vBh;Hf0JPQ~8l}{M?yQAOx16vQsxOyBxmF8TUrQ`?naj^e)Ty zp_9={U1_MLPL*8DyV9~+gH}Hui?DTC)I2r<@6|viMwUlT?wUz7a9NAwVDOI7bV(2X zyZxvQGKw&OER?nQ6in2qJ@}<;81qJ&*I;|BNwb>DCcdSD%JV5dsAxIs zvU;AFch~?d#oI?*w1!ATY zQ@a#-9WpB`&&Hkr@u=#p30$tOUbAEcxSaSkCgzxE;`ii>zX9kJV=#Hx+Sd}T^M^hF%#>C9 z3F)t)7QA1Qd9!DKreH#bGrSQ4s^}Dm{v{yud?{o~$~mn_5s|sz{{n#X?FkafmGDpH z21EWb0HuHa>xnlQtHCOdo^(pB?Gb~eFCq-26I9?P>pH=B0Q*rcbAMB7mJgZd05M2u zhdd0GIT~(DP~a1hm)#`e(O6X#-ou85Vn_935hwRP7qP8+rg72Hhj^homm0bt%E1~mbXB(RI31&;R&`i1wUd`IA>+-=-9#BY211BCRTv0xs7n}UWlMlb(7 z1>!OL^Qgp?m+HDt<0NRxSCGK6{cD!8kB?j~sLjE-rpK=(bUXZ_6_ai2ikTsRRH0eZNBc z5SinkrEbCHHz3gxRKAH~oq|WC)aLNRI=-37h&M{v9}s^IKFqHH`QcDk!P?0v<^dBWFdK zXGRn2|3G`n8}WSDS6v@*K-^1 zf6?HKIPO!zfpmQIFLm=q*6=v2W$`&Gdax?46r#@#k&T|LuxHL$LOf^Y8kWv^-)d~8 zK}U{zet&8(_{#t~I&6iY zDLfX9lZ!;-;R}}I+QVc#)2txag_22(qRHX5(Z$6^eH2^rRRH=wM>*3;D!iKWf_%jJ zV^V#KJ_o(|Ki=P5z~gr%of-YoEz>X`mkwIRU;Q6TrmKvRVY_-&oR6)E(y*zQU!Rcr zO;TpVa5ybiX}(oPihnAQ(VanrQNcy|idcy{J(_iWt_=zx0Y@&Whq`2p`0Z2NG<|%) zV5r}O;(L#)LZW@2sZ+(aBe<2344+A@h>+Q*RLm^ILbZ2-J#TMNgZKK;ck)TGYpQ%0 zWlTdmWKpywSz21zwye8NPV>QIBHC*`8_Ro^Gd?3PHm$Ma*xt`Q1 ztyKrqmxT4^emZZsKzAm()Vi*?rjPd25o=rA3(RhsEwM5H&Ce4-Bj-Xw^K(w)Un{Ee3>#8+xS;X?v>u2I*W&yV8 z**+nfZ=SWm(*Pf-EdYul_Bs_7xY|dh&FgI|6PoN2dvyIFK2Wvp0Z|YT0{8hd5YUVP zsImxis>)kw{qc#G! zkqm0%AH0A=PS)R>=@LIML@H}+Q+|5=d;b3{aQ`b}@1I2Ye^VLz9|48`FV_3NsVx3G zsr|S9-+yntn5o>7l3OQZ;QQ$Bzf=YNf4I570nq<+y_k3Z*!I=`(zbbS`~v!i1@--D zupz*Z0E{4ze{(48ZoD5&y_Izou$wm`zs=8&f7PY)uo6JL)z6B@hX5j}^RnDc0YfiW zMPgVut=a}aV{xc&JbKVl$GYTo5-qv2vlC!N;l7jg8USV!cdYe&UQ|>>fi^gq&-9lt z6K8XP<0u&qCu;qG3bsDrYF|QQ*}1o6PW=sB>5fT)7mbr;j{|2cx-jC8_i^2!oSuve zo;)|UKb)pYE`0N&Cxa8P83AR!FX+fVNk-c3=M5C%$Lz zssm2dFcZZeTd3ZS%#0f@@#9x;F=Yk9YPzi1|0}p{gQpfZ2fEFwjlAy z2jlIpSc}@8vhDkioj-lN@0``bd*W_tT+VDEk0f$i4asU7T literal 0 HcmV?d00001 diff --git a/docs/images/start_macos.png b/docs/images/start_macos.png new file mode 100644 index 0000000000000000000000000000000000000000..8b35a95c595279013c07118b73ad2afaf080d9a9 GIT binary patch literal 13949 zcmbt)1yq|&w=ONESb^P~6>$7ZTiCpaqH-D8-7C;_jhHae_OPQY^uO zyWI3U=l=gWXRW)|S?eY%GVeR@?Ad!iGxN;e6ZKj{kpPbh4+8^(Kv_vn8w2CP0s6y= z^ALT-&N<}*{e$~f$q0;rLD=*6^B{$dkQ#jv8=|Z(kG+cZ1c(3e=r=t9^rgqvs)}+L z_kZ8t+KZDhFa+_G<)n3e7xuF7O{r(IQ1QQ>C1E`1dd}S&YNqD;(E_W|Ml^VRS@5z> zeL_9iwQX_1wIPFlxph`uPPn`3s;74!6 z7Umwi;1IpXz&%ObPkbEyeB_e?S3(c!+M|CM@o6)cZ{>0{1fH3wrl#gA1}vU*texNW z76rU*U54Pj=-D}~x$`8fihRGCL5P8YPZA~f%-i4ci@?(x1J;y5TiytnTy5x-lK|kG z4&&O|+SFQda&p~kd;22&(uj`_FzA>xp77Hb6BhTv`}@Dyr%fhgYG|{jG&eUxSOGt? zA7X@l4(;8finaIk{o<6VfY8nuQBcoGPA2KELmNs7x1PDLN29C78 zJ@9Wo+2T93DCmxS$IBZen_(U@V9UEpi$SiTt7ykb(a=2Y1ONiPn@v5NO)F<7Ss=cF zfq|Z$yh1_-`QwbMZTQ$%*UhHzPSp|Fv{9X8lMx0#Cfat8%h5B(PI{Yd++`b)fPxpT zZYI^763%YT6E{Md^DWPU ztRgwAczJmlczEM!*q_2#YamxF_a6pGW#7h$oT+eL^X8M|l-gLpZOgkPn!f1m)+WG1&VJ|a^x ztzY-HG;B%BPJEBPh^MYE{;`n0E@OR_c-ffPAB7N+Rd9cQ(RV`HV#?_-Xx0Kjj^)Zie7E3PL#Z73AFywg3K3xc>dF6q2|$JkJSoVlS;=9ZFL_ zp%oc#^*&ypNwHXEFzeG0l{l;Z)NxbzK28uQqWjvY^?SmY#j>F1hD&#I@JeQ3z21g@ zL}i=Ty2>JwFd4N&z&4|svhMV;Z{jX(sCnZmW&}V^L zQL@cevcmN**QToR0qSOVa}5Pf-A7&Q67yhoAMd!26|#4OZEWfzFfP8&ZiZ$RK7`?J z$lg7+I-UaFG6qa?ZCzPc4X*D@6PZWlUNJP^jo9`OqVvisGwaaeqgUS8S}f_yt97Eb ztc9O_%`{|{m%ozL+-=@vLz~%UdkoWy&q7kw|A-^IL9Mfr97Xn~hwN%#(mE>%QG{b! zpu}J~e8axViLTCLr=zq~Xgk8y`8abILJo=L~VRBPLt@ep*j<$A@S3 zcCa}f<|&V_j}1N-@V?ic+<^%eOz&4c)z_2{Y}0q4mk_W zlviq>| zl78ddsW86~Pz8T+Y{z&LCk=z;V_?FNX}xT&Gb;slevW~UA-EofhyBUzFV>4 z_X$10`EyOpFagX2z^M^w&vssi;AZ0Y5>7lS_PZtUEPK+C~l1np`4v z>HZeB$QM(hb~^?XV{ABiY*5~_vpK})s9ZMwwhGpfv@2NUcc-!rhbiOKJ<%QAsS5t> zpcrTg!jU(9ndxeNi(Ztc;yXLMu(XK9?AOfXhN!sOlgWd+qCjPG0uL`$r)W?{Wt<+_ z+a-G;FsIOmEGtfv)&|BtA4P|sU%zJCjMy~b#c?oI?`dDLP3j~&%J0=@r0hrS$4$nf z`~>$5bJJNZJ3O!GSg>c)d^19LDn^&r`$L;MdaCP*`8!=QHiEFQ|yp! z5{+JRDtvm>C_kx#U`>gR^i?TLN}X>8Z;7JX7*bSxcIP?^Br-LaIq2-opG~0D{%o4z z*g81GZ>_WFu|~tfbV90uV7`9GVy-S)o^zKe{zOA;ttK;rMI0CI`# zf)h(eVUv*##pqp+g zTgExFr(5{}@niwIz+gc2PQppToVMahjkiC)Jq_YKxd!d=jGhsQuG2`Lt$lf}& zVrGgfj`k23GHNK=`u zFfd052eb^O@q9PdlZKxK{P8xRVoVwH0xe%$2$Qi*BWmo1yivaZRjlB>ob+@SdvpC~ zV!6khk4h>}{o5-Y1nvQnlZUj)$kvaM>J~*I?McvwrUob*GXU(7*Jye+lPK%Wi|nqZ zwt}_c-w8_^vcF8#$4q%|Te3v+4W(rwceAw%?=xK1^1~59v8%R`dJ3L?mi_kI0{X7H zBXDnQYR^Gt9TGAltQN4Wy(aGDFx(kPNiQF9lweBw!jyVTS&k-MXAt1hyYg17hAC#ZU@nZ%^L%IxN2j@}*qoRG@uSwpSb z{^_L~3Fy3`)q0@sm?)1^k}XI1qEY9kGoi-B%x5A~Us6RNtor^V`)`Fyl!LAgx}RJC zm6L`X!)!Br!hW|3DKI`D+T7VaS^50vmi9o*{P(`-;*@*ILW7MCE)o=M_2qI;FS6^Q zXLWOVV}XAny#(7Er<+Bxm=QO?9_r1`Yzj}~a)F2{o7$E!oPaWQ-LY76Vk)($`Vbd8 zL`T}o9>`N~wo6?vx@&Wr20u%#`I*_sBfk-BNA*6@P{Z3i{cRIqCb9NI{FDX1e2uAt zML;(+rhB*xk^Zd~>e}xDo*OpX(jd|PT&nZd&5^ytGg{>%6iH*|P~0u(4c%jZQ8<6M zSk{o6&6#In!dn^}3ZCG%HmzA6ZN>!Cf+M^+E+{n*N!10a9{6>y` z%Xjbe%JjG(Zz~b4Dh5?Io`I86!I@0)@xZ(^qjs{4LC<&is`mVY^`_Rfu|{ewPz~i} z*ki$(&EE4{8!TtRa!YNoToWpiXCp@=JAgh7-W@dq|Gj#QQ)-xEn( zBnmY;m_3La54^9|+F6vBCHcOqZejm2F7_)P9-drC&aujI0ATPdfGxIK(ZNks^VSG? z)?yviw|A&wTSF(k_<=euYrvwTkR5N-uN`P%K9J@ZJ*pSCxR;`2XVsx$*$g~}GQ`FR zx^c~@EV;$&zD(}1Q}vtearJ3p(vFhJ{pkL5&qEXmr}Hd)crL4xJ~K0OfaGNzqmk5N zw}fq~2k=v=s~%%dTJ82`BYhhj{H^Wm3g_O>uh1>aD4o_fAC8C5%Cl=zwXhb{f@rHw z>V@h~pPBt!K+yCpJ&dE(PBde{VV~XcxN_URXb@=1k1%Zf?4xeWswdOs0R42QFZ_Mt zfwHWute2O7cTZQl8d&Yiuy>)LYH{2o&z^@NK(1WBh8>aloVt-D$UBucs7oq-WIF*m zT^1?=Xe2Gb;Nal!tYfo46hjIHnT0BDnN?G$Dir(37Rr_&JH#kSB$q-#K4eJ$)DW`lIb|?rLN|}_;~0#9l+mI$kN$iqo zr--iESE@L2`c3-OFGlF+HhKa-OHO0BNvtH*G0)UcA?juX%U(PUI_xN{=~x z#ik_iqBoVpYv=9_As=y7e7m3Ik#wGN2cF=D6{lPK=?t}dn@3+9KxpZ0x4O_WWQe1& z3h%ABVZmz`hQ*rveVxTFN=>VcTnGSZgO} zUGcrCKqdvna?L6oodf4g7!$=#oD|!<5%buzsOLIz_3}}3s@s|p4fmRRTyTv94~_7? zwZJch3DyVsqeJfeeUko`Mwvq!K~=Akrz9J8yh9|{1L973W=|R#vu%r%-h5gDEx+g2 z+dhLr7em0EH;1v%uJA^zi> zcQ%UO>n1y0ZuZ!4WmuJ>ESaWKiy*7NTBUj~0qc)P31xAZuU>9=#aV_s?6O$$7J0DR zjY9i*(Y+(+;J37QI9zD!VjH{c*J1uO+`aiyaah_MvfSOire8VhU$uR>jUBv}7JDh= z)#^m(JwEb$_vV-4yFVkxL*6D?43&ElZ;wk|-yy^IZ{x*I#@YpT&Klah6;nP!l=^Ck zW>9y1>UTi?%wRhaC55}_!G#Pb{7Z)nm(ohqsr&fqsKD&<=?bK`i@*d-v{3mbbZ{TCLo<%!@V`A|i6rKW6g{=ZFustMKe4d=_T6k<5M}{IoJUag53f zjXKki+tbBH_Z2kNBS3@kctj{hsrhvV$x(-os{zSv@8Ui)M`g}&luj13?PlpVXF2%V z!NP^Ez~>8YF`qlbC@Sb=J}m@1-fZiY>+gTIt%zDKOQml3b;=EOF9tWl+7x*+Zi{aP zQytvqE~8uG-6px-pE@r|UoDG0;w+rVI%~O)7?I1-9kYVFS=T^sOhUVLiUbirj zpwbih6>`_h6AGo<$^}H%Y5j`-m%#lGAw~2zmjKDj?bXqXD~hzz)2o{sr@TS9!4ARW z_DuJf;WT(%!Uxp6Ii~@&R0O#RG74We4i?(5o-5G25@zZ3ED1;kXhaG)dsY$=AAID7D?^nAvnRsd@VAAoe%b z8_$!wd+Hgt6ZL-csoT@b#fndRTUUZDPnv%jmJliD zJgFBngSQp6D6LTiqVB~t8`}9(YI%fE#zqF3->G{uoKJOz{2Cgp-S=S?sG!U*YA>66 zzZpzMRo+!xUuk|`%RV|PzdHZ3J^m1t~F4Y3_6^J=T&{Z zDS^43Z+m%C9N&q?aZHew(XDSvHUw|LroT$w-znNI%F27*XGF`YMEBfh@&AHdmLFRz z)XpGk2|16+OekMUNhF}>*h@GTgrJtWrvi$H*YgBl9H7G zgI9oVI4}{qR(P6oyX$aLDw9J>kRfX@mVf=D!l~u)bdIxM`E9AfcHFjRh|eOQJR~U( z@eTG>Z8;PI3@D?YOq14HI!j(wL_t@hPcQXE1D%FiCe&IKzUGN$uLNBbj%q}yBxvVFh>bTzys;+l}V&x9gX|pyL>HSvK_bSEPN^KKs{MjEZAJ%#!vG`^)yT4WC#Wi0SAV~!` zwThzuPi5!$Hzrr@)xdOYUfpMX7LZZ?fBBO zsA3h$Q<5=vj^)_PG z-2G$g<+{`R7pVYN>wkp(-0b4feFvjt^a}?@=yks|e~9(So+7z|n3JT;I&ElreqMx^ zS7yzF>SBTt$^q>m!^5%x7wvGeLX3Z$kDQ*K&YJm{wcNuR_VF=AHdGyQ;)a(g9+Qd4 zM?605Dm`GSlC>swE0|>P6k^Y*7;lkMhQ-ro0UguB!oqfUU5f1Jwsyl7-Uwy{p-2gC zqwjA<@1JB{aNQqqL2oj?r=@Zcq?cG2S6Gy!h|T*bO;J9BBXLhfO>@>~$S<@E!MJrc zt1%;&d7eDu{&TOzzv4sSQ1&1&D=@U6rnx_gn3DFZMh2+c(J73R>~bCM==7j`w0d%! z7)Pm)fzQdg@8@np096kvv*TM;pKLc69x6^h%iNEA3Q}Ur_&_FPeTG$XR5eN>zwTib z1;#U;TkwE@!U?s1Y-*K=;2}GGXJ2X_?&6W@sr3WZ^ZG6*Q5({ zg+wiM+^jONbt_)K`m(RH?kO_KM6S9)&u|_N0?1&qxP!xfEUmsprzgf3URTc6UKL`} z(Z6|XSvx;$U#nlL$C{#h$ex1l8wk%tiy^IQ{=$#%9C}yyLZrUgxV-2Cwm50JMqJgR zG{gXdpYEG9h=A}-VP5_eGA#a)jMpkTuZK?yjUEkSGlHRIfU-)2V06!0RQ%@4gI&F+ zHdzH^QIR-mgAq_;wFDql?(wDg?weh#KzfiLiz29%HV^$2R0(`q|><^3t1iy;-*8gCw_!>3ac2l{VWihTi_hu8DkwA{U zKuw=V{k(tYZkED`GLH8s)+M={4!S+NJ6Bk7eeNpka7zs^%e_=G^Io3W-NDnvDgh1< zmFtG3X>jYvFiBWwqy^m_=U6nj7#$QCa~`n0^OJmlvvhB(ZtLP!ZP;Y-qJL~gny~Hb zYkS$#s2;)`?K#Zb&f~6vxZyNcG57<#NQQf%`d(U}A!7+D6$+h0R~d=Qoo?je(w}8l37sK}ZOw-k4+3ExLA( zp_HKY0AuS_cTZ2aLOwAmiapyy=7}thA=|sUk=Is#oY;?$1W73(<*tZ1eh9he)T6d& z?{3OA^In7`DwHNGum9g?KawBdtX@s(jCwsWwioPi4Y@X132M$Yu_TZ0TjxR++}ElL z^->r|b{`GGP#ufoqo3lubNuXA&Mm~J;GY&0T07cN*X=ff@vn+f;n~|J1j)T%U93X13f^rNs*CD6*19e?8XTfTli1LqD~krSR=8~=?J`c$MZ%iDyae0v3ORk*%eaKkKcSO&~lZxW8 z<~X|+b&99^O#&;}yJA4%7bIJm4N{+76k-xDWOCydnYb@ld7f{FwSa(SD(m+b+%div zswcJ}Q+A1e)%R5v+Y;V&>^q;yrMqQHGB7~I`^FNk6j<~Gknl7rEto&>2ou%kzLD*7 z(WGCTQ7ytJ+J2XEm02;p9r+L2eHR<{*8y*WScFj`p+SiYFil)Q-d zxigF87j8&4*lXMGfCX6J#F(7)EL`;Bf`)8;WIHZv?b4&c%!Ce=&C_&gEz2a#<{_t- z7BF>(F$1^j%~|i1=lnL}>YDen0}GzVT=!#;`$?_}y%BbZ=SA0f$DQGEiB6)~afGO( z%&0o_I?olhK-QlPwx8&JIiswbB_M;K!}>(qIuaq19YayT6jN+-OviFf%9ZFeRfmCU zOBHl9-~W7%Y1am$gnlV>B15{bWt?Z8x>Lp+-$tZ2-)N^PrB`Y@>268fWE{x1Xme3h zA*jb&Gu@~bhispz`kXV?juhW*rPJQHU08IS?$)R+#t@00{q9(_2;9$pozY6ueSi3~ zvOdkl?+V*TxeqRR7`r8^78hi(K<;wVW;g5G-mxbnA`pGos2*1-d7dSCyEwbpqL``= zz4t_P@0{stiDaE{RBYWT=9t$jok@-ctvOq?-P{bVO!zHRED*+*NFGk{t&FgZ1$@B7 z2l#uB{=#Q6f!)pl_H$GFvM*U)FhSW)ej8Jip_+sN#2}^Q12OH4ywKiwCLKrQxGJSJcGMP>Nr@N_iD z6%lgV2j!0$GrB!gSU;&cY*IqXBIqb}wjN^jEM`uV&6ZUf>u*+n32c;Yzbgsce0?ZC z4=f!q2z58#Q;FZJx%V!SEFqFRze63&?ZO_49djB~HrWEk-jK=tA(~*C_+gC{5`MW? zhq2OjSAMK^rXGxh(z=>t52+pcz6^nF;dcY$7egA4M`$IEHip+%!d~oz%!aV&;DDZW@0{KC^yoHxDm<>&p+K&+Cu&V`_9cY0B~EM9ei4 z&=^*hr}c`HR}0@auk}CrEuE#YMZ%V-#$=AeU^h@;*VXQak7}FuB3aw>FP}+MD3&=> zDT-D5sLRV^m5X(;X;x{nB5~T z>(!|_s{Q`1i@CyRSh&y4hfUY>cse0flCyQz*-H~e(>mYNT* zQt=g2 zwE0(Os!R8y?%;p2kq0BK%07EeeR%k0oD3e6=s7lsC`(B)4=c}ENwMH6-gVgTav;bd zAo3+gkxnLs#(;S+GXeApY3AK+AaS4iF zo|I0QzaUDx4tA@ncd7@in7s}uis;>(+C;Arq3F;~ z^i8Yh{?&AUrSaa@6s2)tuTZ7UgoX{+35;GE>1c9?WEX~6Zq$ts)osT)Iq7to5_i+$ zYTjGbD9Hr2w7APbs%bo24^>B{vILb4%7~Sl)nv{4<9v(DE_cV~!r5Q9!)ZQ)vS-cw z3=WgePRE%{JU?sSD-JqWbgViQ-7-A+lmEeWG2qkil zMY2XWyEKZugz0k`HXd%i5R31+D-(NPHS!*exWN4pSZJ!$->Sgi??t?lhc$?v&6<-q za-~75Dp|F0Y;!cjOl9^lnHoeDEtzJ8#{zm!f<_a4i_z7TH8BExq`UpaEWyG6#)>>% zGIp1NF(1?L1scuhcMy1QxWdjuR%Wqsvh=Y1eYahQr#|R>!WXBPDJob;91o2t^hJQ| z4_R`;SD%btCUImk$wEtI4esdfOk1Xy4o)Pu-e1dc=WrfmYRP$i7?bv7F&B2{97}Y3 z6g&3dWAjAh3=e$HRQOQl&+WpSzx*5)ad1upU{U(^{t@v_Rmm4tK$+KrjJ|BIu(3|l zV*N*h_-(El!Ya>#u^wQ6pXPojvItk_fLTz$d*d==LdT@>dXQZ;n>$X#GT2e2jSm5w zc(Z$ter}?-Smg1?US^~=zUcjiNX(c>CCg8Akc+Fg>Xa6}Ux5bj_(+S`fY-;Q|KL>E zs15!6-N07%C5uam*~2vq9=Z?iY_l_XRD{zvYn5|NbWKN#QLTu`yhTKw(KDNVU=Zhj zn*09qK;uW!#^-3WTDoa-=HklEEOHoDi>%xZH`$t@?~~%MGi)nTT$2o^k6k+1o65K+ z(xG`@u_w%%J=Xy0TZO~;e(e3);TX2GhXiF{xOgy1R2p4xzOIh&}ukI@WnJb*B_NdQM>7 z1;zmkr;TB?(ID3*wP+O4_K5zH#b=}83o<1Q=31sPoqMReP$je#Wm%jXD30A@=!gd6 zJ(2?UTK@O4LS~~faqfG+Ph+x@^f%%o^8V~n2s$G*z>wX`oDq=?xS!mEgx9&?-ra}O z0=a#};e?wDn~CtDG;s=zZ^^!m2Uv9c;?K?$N}d<@9VVbXxioL8_LHo?aqG)~q*V;NaRU1B8Q4-p$03(Jn7T-~n%!MGw2ZZ4LzDs?ifB|znrNI2m{=iNhs z$ChAjA!*Rov=t42Aou-LEuTd@#iXtlom&_1F_^KCm-$Yx~tF->L$nWf)Fgu`(08T)o4NkplH0 zANGZQNsYl^TtIf2Ar(lodY)yV$Blp~?f9!G9nNPMJbL^Sk!&9BGY@m$H^*69OL~UW z{$Mb54InOfFM>0QJDNQ3P(bjELFP9#x+m<3zL31FfHF)$Z1C%V2wK;SYgtTm7f6>s z1ns!d$iBdkGZ&5wqJ=C~n!bP}yj&IAl3HqgfkiiglT|ygOS3ZmcOXz3+2Syid9J1% zbRjJ{86a?k$sCHYi$Wo$Y#8lY?`4v4!1K=EmM|yx!0R~~w8fT?f41axAlyQaw}wwg zf;P}&aZv7$)ioyF@dCv&jKrCNkGvd@xS}2-gH8wMd01AP1@L|>`I@R_eadTKkio{M zuZ!pR#HJ&z*9v5eLoc(rb4Iq5haVp45+)T;^=YT)m-M0~Ut&H^Cr@Ck=Z~g}!2w9^ ztj6S~;48h!`ox)^gaF~9-IQE^AdMCOUZmm&{rf191PSymyBnF<0u&`5R-IOt3yK`; z?5dG`Likz)t$xx6^<6V_3~ubSFW?XcY#D5%H)-dtW#^0(4uE}0mN1mR)c8N7{&`%| zi2m1TgKLkC-?lG}pj)nRwen6F25P?92p>ZqYE(zh4hxan80>X;PjWG7o?#RyPe=Uc zjR$!^jEMqIG$*PjqJ9JTrXhpCctDJS)W>}R34M=w0+l*Z*zZ|5V|BbnLGR|D$97QsLhn`~U3b|BvW@Z1UH7|6R}jUiyDI=O4}f zI_@8>rDPIq(79bH70Y_#*4Ea(-d@IM%HG~*=)~-_lfYlKS$fyk*Dda^4AO?=KS0OS zUnbAHRDAzFh(6!>S$Yti57rLN&Ia~wK0v(6dM<{AHcKd}rHc#uuH0WcYGcIrk$BVp zZOHNA-|v4({@Tz#2t*&S&#_{o!K;e~FB2No6@d?wlF`Eo z^N}3-%D-^_A8_7AgZRTEG-ShG{3m1++&l=r!a_w#GsmYj(Sm$wzWp;&Fu~}5ztGhc zDKH%M>e16wwj!wuA-N?%_?YxIKOw>&wsQ!WqlEqe5_ zr^x=X1Ue(zoYC<@WvA^i-akZ`Zvc#%KZw2T;_|4_tuYY+!^VGb*AYH5qsHnwMtJgm z9FuMVuy*N5HesxAyAW>jc0Dy>&M(-0qiowH|X1H>mA$BQW_*Hm#941CV z_znX>+AD3AKV%6{-%R7_);1aZHiSJA02bJ;1JAZo2#3&ziVYKR-c0{dZDy=X`XD*^ zyYazsh0AKp*x1nAk3)t77vk7lQoM)}`|fP)!w7v=x$sx$w@R|l$ldy6^eg$@|1$d~HV?Q~HV0gu< z{RVy{FQ2VLM>P`(%5F^feJQ{I;R zTDET(ni_7HgcoCDBcBY*k+augKdi8fk0JG!+F?&Qo;Urmmf#z>!TI#wvvq^dg6t9nNF<~#bqcDZdIv;!iRu-Hct@f#<< z16AKx0*ODtj07FTfMX!%2+S}MHW`QVXF2n@SD8^p`&~Y0DnhlPmaoX{16#~x?>H96 z>+|U(whNDo#?ls-C)xFZ_r!d8!}iVVB`XoUF1!ei$+{)B@#tj4Y5lzo2h5&m=cG#7 z|II!V-g_{ohdF!+VuT(b6HHdZ)5AykKLFz&t-;Se3po^Vhlx0Z18K6cE14arviP_a z2kqe6oQz44oVk}LhTCMTNI9X2mptQgh!TD}52rZ9>%?rjV!5lm@v0b9uer#A{ETw5)O1aP^#xVqI!4CPcjs28H9&s*Ixdl$DY5u)<2EO zgT$Z4fB1!CCyyBBF7;47$kK%Ca|Tw6cp^MLxAxP3aA$oJxzd5EDp_Daj|I4=#stl1 zi8SJMuO4zJ%YYGoT!9O|Ji^>WK*Ev6@UP-0)rMj$pfnjG>g;1XGhyn27#|SZ{>#;D z>)0VIycLh|j66D{w$U`u7TEvy8!NxeQDmnh`3$$iTIv|uBP0~`b2p|xekTO9X>(fF zaCX(dt8B*Ks`9N>oSGBk9Dpp5Vh!YZ!5t!G+{2UJsz1Nn|6KDBoH~PPCA@Wf+hx{t z;I;lRceHve0u>WY>R&P#A?p>U`k-rCSL^q9LDR_zngoh~*yUM2am8xbuK+e6pw(ug zUWel!e0gDQ%~HiyjPZZQ1W*s=3F^rVT={{qj;FfeG z4|5~!&VJt2;6PWKb8J7K$>#;fn}~?ephy11+Se%AkUvAn^avih{y(_)h82CzsswBD}Lw_bc>QfSRHe42L$Gyew;wanF?X>2>QHO&BiCV z7X0*FI-D?x$Jc=}q0-3zAV>?IpT^ZG({!~O{Ys1?*a!aXs*k+JPTDs+} zka?y-c=$cjCcUQdU!c)i2B&b0>2MA$cSe)Ki@`7TWN7y(a$Kw^#aa$%>~m^A;};J` zecXb}fy{(48Q$W(Sly57oeL&rp-5oQ^?5TBF&dhiM??l z7eAzb=|TZ-58rb(VC-Bz!Pd-VI{EE^u_?aObqOgsSmmJkb|^kWYc`bn5%}_5=T7zMxVHmh z>t%AQ=3SiXsRSPP+#cX(@Nc1g`%#Dz_XA%hV6`UuVQl`$ILz+XEhld*uzphBNj&es zbls!?lh)4GHt-~$b`Oc9q^8c-sj01njtEc@==35X+UY}jtkct_1~D-)TJloQdN==A zoOk<#gU@o6E^<&5$u3b9m*{?;>+loqSYMWCM_5wO)YGj!k8Bw<3hN%chNNCt` z7FS=cuQTcezvX-!ddVy5kf8C%f?T@kt6(GyVbqk9I@b+;N1c1j>~p9Yt3X;1gFE+g z1#3gCxu-Bk{w0~L-M(sb)AD{;*aHv?7Z*`81^0QF$jaVpcm?_8CV?4wsUC(ZdX`jx zpBo%RY%xYY0?E<#m57xMDmMXZ9+9dQWyIk;TIBp?g&T=lUv0%=O=C+@siy@=72kx| Y-O>trtGYZv^GFP3c@4P=8OwM72h{H*asU7T literal 0 HcmV?d00001 diff --git a/docs/images/start_windows.png b/docs/images/start_windows.png new file mode 100644 index 0000000000000000000000000000000000000000..db4ce3250406add52d4502828b0f0ec7c6e74d1b GIT binary patch literal 11454 zcmcI~2UJtrwst^K4#_F!O0(@bIJCcT^95J<57qinUkO z$OITVWUZ-o6SPPD_o_A<2?B{|-oANF&vTGC@<;UPwX_-6+QGrxM7>&Uyq?f}fekYH z+12My@3BV8avVPi9XFGG{`MXTn}6hw6o&85g?lG{CfqwXvlA;;$ZHAUC_{ygs$DXyQvjk&P1r6Sp~*@yGVY=8gku%wn< zhF=B1+!+)$&FqAf^RR4^qD`)d`G5%T(BlIj(5oExhEtT!?MVjWa&L0kbU7?!ubmP# z6{gq}0IQCC8m=0cyQq+pkJ1gY3F=vv1_m2-u4QeuhJy9=u_KSOYn(=bv4Hz%ZU0e| zv=VELv~yA(stUl^$+>|~hLK=*8xr9d@TlIx0b4|!rUQYZ!^P241%pR`WzT&fQvPcf zfuGM$gkd~R%cxb6$U|EfoP9wc9cjmF$l<*W;pHJ8bbrKP#-KRjVV3|CgaK3!dfdNg z5i2uYl%QW=I)96(O-z(~HytgDK9xTk!p5eaV(1b}&T@K+b@!wfp%FtHs2k)j#tmqi z%>A5xyqN=b%n^H&kr9pCA-W{k_*;A*+AWt7GfOyv&Aepe2)o>5xX0kL(YR8e{rf+gxuCS}f!=Uvo^gH@$$ zclLJncB{+G&6z_nw2cM|VCl$PE2=wb@uz7Tk|FZwW%4L`N&q`$Av}ke3QCS;wIRY1 zd%tw<^{fqr#!Qcp_}aSmNq5(X>VC|PleZ)=3;Jwr`TOC@oG8MR4Zg192S5Rrh0hLF z+oW@Gu9Y+oXABlOGTR!pn^uB#lTo3k9q&Nyry`6>|1zCQUP-C8zCoD}jY#kabxzqv zN$noy_tiQ1$b6*B`!HgwI4gSSo`v`W!!1Oo0N@r06^~Sx)6GV)h>UrijH;S9Zww7; zs`AU^dlhk*Rn$)n5|;#EcOsfX9(KGRmiF(RQtw1D%GXTSh&qcX%xohhre`E@f2LD7 zeTIlIJ}h}@cWZGghd4*}O2^0H!KULBx#vqwJtci4^-+Dyi|JAKrk+iPj;tJSmqogH zx2_k<qQ5Gj3dVHvYAkV6A8` zk3k;x+|1i{Lzg>mtLm%rD@^+p+80+``<011xx|$)7kdeuY$Otq;=yd?3n{ND5RBzj zbts>8;ot7?I9cWX#pQNhxs%bZSWle>e0gAv-U!z1-I*MuwVuP zanALGd3{FT7eG$nZVHrQj-Tk1%W*o|KJ+@LSV3N1~7VeuNB(S1Ju#KZt436?) z6>RPr&o&)KALDxj&9)G_L%qafjtT`^x%e+prACQI$GxYi(I7mCRTFALa_Nd5o7e33 z>EJI}ufg;M&HD{)!=(u$hNA*6s)m2WncY+Em2)Gu6N?dapnEyh1)P@`lf_AQ_0E@- zmp7GI3)zaWyEx#eoJ|J&kzmX03NKh|e;vIPBBj#NFt*J^Jz z|0sbAkvxD55P#bH9OjIJY4@ColUtz{21h#TJ#=tOd}rStLYISHx2f=DE$ZbtSHMeoIv!jOOO8rADj1ziV2mK^z$m z!|0#(xT$-s2Mf3Sx^)M`+V!krael<~$sPtp4blPPdgrAV?G@?{Sr=O6U_tCjGsQi- zJx>mQ=Sj$4B+m%VB{ZR{Nn6hxEj^O^6AwNx?B^JQU-38`K158RW`KgxGD%&3l@#&) z++)#hTCs51a@dEKdpyo`TG?wxH9YQG3$&>t4z;a2iJDp3nu|Rt=lcvBv{mV(g`mT5 zjj*miTxg%f*m_`@^T@fjA#YkRQ)whIzUmu&O=O;0t00yPkB;`44o=mLkpu8m18`58 zJsssAtIfGUn<7|1AOb0k94cb;N$hm>)^91$QGpC(Vmj+jgHD&%J{jh-$9hxKoDDOH z8YOz46KZMMn;(|uLrvb%;^;ni5>Ps>Ue7{xUlF~GzMRAa0@c4-?Z@rvS3DRvYi@2{ zf|%ACsP)0Nr7QVpSf-IlBf?u`B9b_SRcnr$yJQU%+~crDHh?gY%|Tb80O9@TGw2X7 zbwIUA&(bo3NA_X;rUv!b%n&fUrcmasNS@iFLe%AF&Y~BhHyZ_&1q4$c2B!M&QVL(4 zMFRw{TN9Wu4J;~Vor){aBw5$j(Bvz(ovVozx;iI-+71$cWChx9Z!Ed(to65**?*pB z;;@YCxA3{MOsT2aoXhJYQu(^tPSE2tpwjbnJP3SR=bmvSDEuk4`+ibsHKcN49RFF; ztJSWo+r6VI9hvWLE<8%gOj!qyp%t3D&H77YR}>Af6gYPUJp{mSdT zsKOl^MG?FMRfFR02BVfqDyG9843O-U_tx*|Z<}M`gapJep6hDo54YwxUftyJUE}#D z$%6HSamTt!_74O;6-Q<1`9Fjs1W$qjP~68MlgCcjW#-5dye_(^AxWO$wI}c2-;}XU zMiFGmC$8AOMiGp^!H)2ZFoKm_p|b`$Tum*Xc*dU>@L;ZXYr+SGwY}}b!|g5z{aLM2 z2Iv*dyhDhadYSg1We(QtT3u`IF+A3?>e7A%k|kGY=owOcT&t>_@W$BnO;!kat2k(A z0VVWY>q~A7uU3`&yUw=;`Qh~q&#VO4ABCI%^yYAeXR3|;O=IR!)x}skmGLn z3gs-mOV;kk!GnOWl!t+pz7Jn&C}oUySJXNxyQDxw*|V(39e@^HL8k`ybmQavS~^2y z+YR|t?07ZWjj@hR4dGUTNFRKwJoD{~+q>aVN~%~bkHM`-!83p&b9b$j&soQ-u^dS- zYxmNM4>z`l+6xHZ`vWc{8ynlKM-e9u3%;s$5yvO{nSLwU3Xev0U&nuKJpih&SEN&7 zbz6S7esK9!Z@zCM1!|AaKac(}$}KRIfeQ6;JU9)n4IbNeiO@MBux`1@zySL(#DB0O zi1i~KsIlj(m*c_O5?n&w77B<%6t@l}>u~Bpi-?e1GHu}d_G!nC`6BxE>)NWhxAjU+aNQM#zl5-Tn4eWp^AmvB#_Esbk{v zxJ4yH+CZ7S6t&{Q2+_|&>0U!7)^y}dw{|qL9p}(R3Th{Gc4~ReOvZzR%DlTQCkD`W z4zfe^Q&5B{CWxD{0Xl$Ay+9ok?Y%Ln58AXR6&`T=A~(I_a+Ee_-h_Y>x)q(k+FAX%K#v?4xDxP1vDt5JvZ?utn8WabJyB>_^nggVX%sA(-UU zfWout1*b4Kp3Jgzu?OZqeE0U@7oDKk!uhN=a=-8B%8NKaHg1?drOk3;y-12aC)Tct zY}zHd8zF#pV1wCC80Foz%HZJOhxLUb884a(hZ`!^WDf)%e+fRL55?@EYwHdHTUJJ( z&Z2YqV8*Ss!V#Fa4emm(m>}Wb?LKk^u?vZg%dOgF6sbb#Vjyc@PCEkfy)k_Ww$42y z3?qM2N-4acLN_82$Y-cLVaRw9KP1XVPf*T8!EG2rUSjZeQgk`7hZR_W+@}}8va*zL zs6HSJBRFQ(FOJM;UH4%+FS%ApaqAUjX=707{X6k@e0ym(8hf*Yo^iI4C(L*y~Jx#yA-rSRQ5T8hGg9;ZwHNawEJt^zMN*Tk0;`&f?T z062y@Q_gofg!O*kIb7mSgyue$1_a)CpbV-*Z8n&8V4!KrhRvz&F+9o+HNM{`GFot{ zaY%Tl->qBeu4&;ZKM?Z_7lendo8Mwq+5A!m~nqNiTHwjEmz z>RxMa=-$DmX~7>Mq2rh*g>>?8`W0Mq&Oq)?#iv!+Z}?f zUxWp3hD+Vik{P%DAbA@bJR;b-qm*8GH&S-O;alH%#geMZ6*%h z+*upw_2S*cG&27!3V!HTZJGO;@zx!M;42VznS{X%1hbIC<{+(C20_4!N6eY++Sm`CP7zbZrWxKd2bEDoHo-4&!_25#DS-3@QI zWTV)BbV<*5eWhmloNef$qyA{rc-rUj&Um3(NX~RaoS(}TZn9Nd{nv1e-E_I28)+l# zK5;giV8y=~J?#3(AYEnYpxkmPz6Gzn8}7Tzkr9V9)lOjHr&w`~NSJg|2DHyM3pF>b zqKKbe$_yeHSCq6bZjxBt_rg=37=Ek^E50(~WgIciGgikVWotE-9i>nwi~Ui_;7zsj0uU{Kb(kd0MNWicUN!iT;xRMDHHf!xhw%g0w&pDtY@M_Bs~^2y zUP!N@ojtFD@~HJO|1mWuLu?`+0_T$&5$U>s3ff3&V?W6eInOcmq9_jaf#i^cWT;7-f9i^8J6n$ z3OR~ppJG!=+$vNaUGiJ&%G&e7ikJ<7Svt(PXQy#b&ir?6Vk?hcPrm;IpVv;=8&*ok zfL$foe$miLTmHr0*>Ua^HMsSm1N=A5vQeRm96}Gp(mk}-n|1A-^EIqyntH-LWG=YP zQVfkCr6(;Vv`1%%&%}SL?4t6 zK-kw6s@#+ys?gr^XvU0;?50{swj|n`c_j$1w>0i}y~~ab;Inpo^~_~(gLasO*|8+{y;Z^kxrc-9*4E`K|xEHYpk ziB#LGk+sejoCt5fR5?)@LhKrO5Y&DwCMu$C@7P#J3)lL=1)zKqfjVoyTK8=hU!d_VBylJkJf+%wVewC1s@!MM*9`;DS__d6uKqwR zrv;>Y@V`Eq8n)tF@QStj89fW?;I!sFnU za((iRGH9Rh)RHAOxy_PK%M*^mXPdpdL&G%fZaNtP-c4~FeOVc`wQC0z8+Bfw2yoSmFB)zd=##dt-XJ;7?00y7?UPF%|Q&-e<|E=xLl*`Gn z_n#9;^8aR(10;0<8^_CGGdGOj*%u%Z}p=v zA@Q%O=Euy21uG8R5JcOG%|REcOwk&oOz}1`rw3LxbM503&$9$uW>nuyq7ozHkwu$m zMTv1D$~8UKCCSxw;3#Cs@||krqfUyCwih*fy;^GH(|szre9Eh(m^igKu=Q|Q<`Hyp z{cEN2$_x)YbcgB=&)Jc<#xIRlYGrfpejzHkVC8x02d@QXy8J5r( zw5ZQ~mG(dTr-`eGw-wdqH;ajz8&Ee&nP=%=I0v-F$|)?I&XBd~tRdZ$O3$!i?~Vw! z#-)r{abLT*?X9BK(B^CMd(y7CS6t?i{RZS7D&$(cn*1y@nKV$;GMC~nl;^UExsq&o z+C|7rtdcVKf!OC)C=FylT-Dc$__Y*5>bR`<-^i$LOdXI8K#~jAbCWhhLS%kinviyf z$v_b#dRPiascknN7MZUm)8HqtOM^$0{OwWiiS-ir`ym<*1HcM5HW|q5A>eyontFuW zswLDFrSd+7hpJ5wEJsag=bs1cnQ{Kx?3B(Ef=0rsYp?e~0e5vM0$66v$oUwuHW=y* z(qAr!&;N&?wRj~^?!+oPfFuFj-5`b@H7e)58lS4MKcnVmlb(kMN5FBbu9PCt={0I~ z0RefHJ_LLm1_}WOpy(kCz{f9-02!d^2j&1XfjJNc;DiCfa2$39eX=!qnb{=5|DhL) zlC>CRV`&v?vCLKQ$h@?0`n;oge<)UAcFK={osBHM(!Z8Jp%~R$;Pj$Zfkn!ovno}} zMO>xX&rd|h zg4|vtN&=@F-8}1EChMOS=?wTRS2_xg8<01QSBj0bjqDX;LckUhbO6KupZkB{BnCKv z!Q8-I&hoMrJYBLG=Q`}{($Bjtb9v{qC9Uwna?hK?#GXNM(PZ_)(5GoK8rr|!K%&-qEREPSOrg+lGSeg;oEz_ zAhA2rJ}QyLh{z~!CuACda^ow}JPn&<&-{wgjdE|kD=^GRXJgrSpz{r*LR_L)X312S zY=*eob~xgY_El@fGw7?(UNQ7)2;vP>myllHlC0?0#>Fx?TB&`SNustJpr@9w8eehFeXQpnCC`63NU;uV~iJ)iVrOY-t0qH5L6h)XU#ppoq=^y&ZlDBuR* ze;`QEQ!je&ixU&Bi+@a9%QL2gtR!_u8sCNn)km=Oj zQAYGvtjdw(qk^wkfrz^bPSK_U|Kp!2Qur4a%f)y1jKp34UF zGS72>8pGucsvkvI$^&lD$o68vsxE(miCyVdytM|eG?R~=3&Xo@{?wxUd@1hX70Z$rx=7`FT zY|&@X^yv!JR`3~$pdoEKi6YpJ_#exe&DQ~T21J@EgvK+s>U);FQ$g!R%i$-ssc{PF2dj{R( zb6tOVSNCp42Y#9iY$9>oIyaH(nr_ewz!8nI!=aq(P$}}}aoE*B6r(4JdL9X3U}`{l zxB1dNJc|yv51I5M)lkVxMSu&oA0HxZ6stH~+~)0o;p4o=Fg-3!Uo-5i#DXXcq=uHt zu|-B|#Xdzm-?xmOWB?Tt;>XNv6D>4;n} zvP=1~GeEv#Y}B&}rkGiMSB_C!c)qL$nKXqkGM9af$K-FhlD`!0{D_?Aw1!9x`O^IW znA<=xdQ(~M5qODt_fakmqVH{HKMG*RBh5X@G*ujj(RJ}s;Uxmf4zN8n{3e%gs#GPk z8Cx>(hr;~BOoilpza)XCTsGhY77$(Po;AUP-rJvLr710dj|=vKOY?+ap`h{}Bc~Ze z3jc50N<2Bdx`BQ8)rnK$5!@k|1;TLtC3p`J3@A7R^Wfpl$rZ0rM!Fl)=w(L_qbXTH z$-dBmu9TVsfW4LmeCs75!GeIjPQkqPv#|A?(+Wd<7>fQoTxh0}8d-qFc;LDAG}0lM zfS;C@h`?0x0p~pYFvJ0xM^Q_H1bXV^ej2|z30do`N&{RDm~oA!fM2UYcVmy@f856_ zn<~Pu`-EdCQ%3_hAPkLoy^s5Xf$woP_f*e&P<_T1%An){BzU0Cys&{1mj%!P=OL5+ z|8gUfdvzes6TeTif=ZPwP^bQ5zWPv1K6vp}@5bT8^^fPKVx#!AyCyDVeA4Kbn)lW! z>2ojetVTMIX8Wd)I5iRGT^gM$Mk9l^sG1cW_+);Y@d|kvKD^#bKMfQI4k#`4xlS@)# z!;DroQ5jPFDQnN;n_2BSn|eOK)8ldAD3FtL*avQe#R`aQ9=tk7FE%NWR-E>x|Su$PA)~d!=_MC`!V8; zfAZ`L1E|u**Jp(xgV-W%^1_I4wZ~$NsA)y=QjY-fwDfIF&FXxU+FMf{F44`+<;(Sp zd^uLo*%Q;ZxYG4=^2c3G>R*o8=hP`nW|9};&8r`` zMe-_S)%qdxEyph2neR)X>pg#zLo~h;F;;GX&gF-7A`$|DW+~uaYg6j9UMniTIqp;m zeS!o!@Eq748o$@w=|^9+MRv;{z_RaFbsc#L7JbB&uGj!UCpdo@|3wY9P~sTQ5_q3v z$cRZ#w=f>-zUbI5-IlBGcz>Wozx(6co1;&B>hg_>a|w{FpwzI;pzTSsj}8XP-+j?# zaD$UDE0>69qBgXtRw{6%c(lP~7klf{^Jw4=V_+b7gUAv%_2G}11~57yNgQPHOVR** z{lZ^{27QJB8)ebR|*$vGa&4nJNkR;^+Q5Tg(!!GFVnw@ z$jv)d+EA~~1&h29XuM`^;alTAutFMnfmq0i2jfu&W^8!Z$i-^DrFQ{KNHvWO6p2%4 zd%I>F9g1mLEHc0yW=cSr!2gY7wBW0u=~EXJwkM9AUDpT^KBX7(&cOL3-xQ)bz(uu* zOX5US-lfd%&8w;KQzhI9Lg=$NoXHNK#Glpmmv*efVU{!Jp+bSP$~=v!Q|gB1zdStbx59R z>Pc}$;Cl&rgBwC2m@f^!-yr$}t)olu<}@F@-Ui=+?{asas@qLGs1@dn7Pf;nk7f4WLuu+5KQ^5bu}s+LjY*-K*|eC zi|#pE&R(Wfq}j@GDsU`UX*X<=DWB-tJKUTSw(P@64=FG23P#bNY}Bi#6|F-b@vYBs zA&CZQ8?4(mxMACTFSMXiDZhLB_fkrL6(?*SyJnosOJg*(i+AfXP^`?YQX6F6T$%3s+eYCe1UJHlY1;@j5}j^(F+ ztMk-4N`+)Vk4Wn}fF|kJM=I>6wK+88L~SAV`TOUQwwn5Cdtbc&o(Q$&q@whFi~@ZA z-i`kKNYfD&qXF9Zos*xB`^cV(Rrec;Ut8K=iBNlCno9p;^ZWZuYA63sU;J;3(Yk7y zc>A0KHUv2TANAU@Y>;yQJvvR`wLiOoxw%sJK;<2Id3l@hW@h^b5B?$hys5`$aYwbz zmjHH~y^z=yM*?1CDT*l7Eo$u zL)Fe#34WR}>#dY&P1Mr{U+PleSJ`&8pT_~;|DL21kJ{`g@^=dQoGORV;O6GO--5Ra;b@ z{eEQf^O2@Bnrr_&GWlP)#^0K!`WN8O|L5CnpZ(QN)M)!BQvaU08b&=B8MJxPV{!@jn%B|$_hs)Go_#_>^! zf3RL`X?)3A;Gx(xy#l0u;8v-e9f3L5v8dJ{-H&W+T=mEvoGEJuTpy}ug^i4ilsNW_ z_1~TnO4YmCfr2!!>(Z1Wi1zmJDPRY)-`3h%UrYpAfUeEC;lk@0P3-$JNTPdk<9Ki1 z&WYZ)p?)~neMU?qIdy4*W=?BDIOgp=-Qe|wqH9!(T!kh<*iUJ?{`@=Zb&l>%B-K>E p82exXkYP^JsuCPF&{)0^#U&FwyM_6!t3_}{|jYliS+;g literal 0 HcmV?d00001 diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..1addb83 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,126 @@ +.. include:: icons.rst + +.. title:: Overview + +.. toctree:: + :hidden: + :titlesonly: + :maxdepth: 1 + + getting_started + changelog + bugs_repo + guide/index + devguide/index + packagingguide + maintguide + further + contact + +.. image:: images/pygobject.svg + :align: center + :width: 400px + :height: 98px + +| + +.. include:: ../README.rst + :start-after: | + :end-before: ---- + +If you want to write a Python application for `GNOME +`__ or a Python GUI application using GTK, then +PyGObject is the way to go. To get started, check out the "`GNOME Developer Documentation +`__". For more +information on specific libraries, check out the "`Python GI API +Reference `__". + +.. code:: python + + import sys + + import gi + + gi.require_version("Gtk", "4.0") + from gi.repository import GLib, Gtk + + + class MyApplication(Gtk.Application): + def __init__(self): + super().__init__(application_id="com.example.MyGtkApplication") + GLib.set_application_name("My Gtk Application") + + def do_activate(self): + window = Gtk.ApplicationWindow(application=self, title="Hello World") + window.present() + + + app = MyApplication() + exit_status = app.run(sys.argv) + sys.exit(exit_status) + + +How does it work? +----------------- + +.. figure:: images/overview.svg + :width: 600px + :height: 222px + :align: center + +PyGObject uses `glib `__, `gobject +`__, `girepository +`__, `libffi +`__ and other libraries to access the C +library (libgtk-4.so) in combination with the additional metadata from the +accompanying typelib file (Gtk-4.0.typelib) and dynamically provides a Python +interface based on that information. + + +Who Is Using PyGObject? +----------------------- + +* `Anaconda `__ - an installation program used by Fedora, RHEL and others +* `Apostrophe `__ - a Markdown editor +* `Blanket `__ - listen to different sounds +* `BleachBit `__ - delete unnecessary files from the system +* `Bottles `__ - run Windows software on Linux +* `Cambalache `__ - a user interface maker for GTK +* `D-Feet `__ - an easy to use D-Bus debugger +* `Deluge `__ - a BitTorrent client +* `Dialect `__ - a translation app +* `Drawing `__ - a drawing application +* `Feeds `__ - an RSS/Atom feed reader +* `Gajim `__ - a fully-featured XMPP client +* `Gaphor `__ - a simple modeling tool +* `Getting Things GNOME! `__ - a personal task organizer +* `Girens `__ - a Plex client for playing movies, TV shows and music from your Plex library +* `GNOME Music `__ - a music player for GNOME +* `GNOME Tweaks `__ - a tool to customize advanced GNOME options +* `Gramps `__ - a genealogy program +* `Komikku `__ - a manga reader +* `Lollypop `__ - a modern music player +* `Lutris `__ - a video game manager +* `Meld `__ - a visual diff and merge tool +* `Metadata Cleaner `__ - an application to view and clean metadata in files +* `MyPaint `__ - a nimble, distraction-free, and easy tool for digital painters +* `Nicotine+ `__ - a graphical client for the Soulseek peer-to-peer network +* `Orca `__ - a flexible and extensible screen reader +* `Paperwork `__ - a personal document manager +* `Pithos `__ - a Pandora Radio client +* `Pitivi `__ - a free and open source video editor +* `Plots `__ - a graph plotting app +* `Quod Libet `__ - a music library manager / player +* `Secrets `__ - a password manager +* `Setzer `__ - a LaTeX editor +* `Terminator `__ - The Robot Future of Terminals +* `Wike `__ - a Wikipedia reader + + +The following applications or libraries use PyGObject for optional features, +such as plugins or as optional backends: + +* `beets `__ - a music library manager and MusicBrainz tagger +* `gedit `_- a GNOME text editor +* `matplotlib `__ - a python 2D plotting library +* `Totem `__ - a video player for GNOME diff --git a/docs/maintguide.rst b/docs/maintguide.rst new file mode 100644 index 0000000..5715ab8 --- /dev/null +++ b/docs/maintguide.rst @@ -0,0 +1,34 @@ +================ +Maintainer Guide +================ + +Making a Release +---------------- + +#. Make sure setup.py has the right version number +#. Update NEWS file +#. Run ``python3 setup.py distcheck``, fix any issues and commit. +#. Commit NEWS as ``"release 3.X.Y"`` and push +#. Tag with: ``git tag -s 3.X.Y -m "release 3.X.Y"`` +#. Push tag with: ``git push origin 3.X.Y`` +#. In case of a stable release, upload to PyPI: + ``twine upload dist/PyGObject-3.X.Y.tar.gz`` +#. Commit post-release version bump to setup.py +#. Create GNOME tarball ``python3 setup.py sdist_gnome`` +#. Upload tarball: ``scp pygobject-3.X.Y.tar.xz user@master.gnome.org:`` +#. Install tarball: + ``ssh user@master.gnome.org 'ftpadmin install pygobject-3.X.Y.tar.xz'`` +#. In case the release happens on a stable branch copy the NEWS changes to + the master branch + + +Branching +--------- + +Each cycle after the feature freeze, we create a stable branch so development +can continue in the master branch unaffected by the freezes. + +#. Create the branch locally with: ``git checkout -b pygobject-3-2`` +#. Push new branch: ``git push origin pygobject-3-2`` +#. In master, update setup.py to what will be the next version number + (3.3.0) diff --git a/docs/packagingguide.rst b/docs/packagingguide.rst new file mode 100644 index 0000000..d953638 --- /dev/null +++ b/docs/packagingguide.rst @@ -0,0 +1,45 @@ +Packaging Guide +=============== + +Some notes on how to package PyGObject + +Source packages can be found at +https://download.gnome.org/sources/pygobject + +Existing Packages: + +* https://www.archlinux.org/packages/extra/x86_64/python-gobject +* https://tracker.debian.org/pkg/pygobject +* https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-pygobject + +Building:: + + python3 setup.py build + python3 setup.py test # if you want to run the test suite + python3 setup.py install --prefix="${PREFIX}" --root="${PKGDIR}" + +Runtime dependencies: + + * glib + * libgirepository (gobject-introspection) + * libffi + * Python 3 + + The overrides directory contains various files which includes various + Python imports mentioning gtk, gdk etc. They are only used when the + corresponding library is present, they are not direct dependencies. + +Build dependencies: + + * The runtime dependencies + * cairo (optional) + * pycairo (optional) + * pkg-config + * setuptools (optional) + +Test Suite dependencies: + + * The runtime dependencies + * GTK 4 (optional) + * pango (optional) + * pycairo (optional) diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..6564150 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,2 @@ +sphinx>=4.0,<5.0 +sphinx-rtd-theme>=0.5,<2.0 \ No newline at end of file diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index af9f3d7..0000000 --- a/examples/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST = properties.py signal.py option.py cairo-demo.py diff --git a/examples/Makefile.in b/examples/Makefile.in deleted file mode 100644 index 0c05343..0000000 --- a/examples/Makefile.in +++ /dev/null @@ -1,474 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = examples -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -EXTRA_DIST = properties.py signal.py option.py cairo-demo.py -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign examples/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/examples/cairo-demo.py b/examples/cairo-demo.py index 7b90ec3..ee33cdd 100755 --- a/examples/cairo-demo.py +++ b/examples/cairo-demo.py @@ -126,5 +126,6 @@ def main(): win.show_all() Gtk.main() + if __name__ == '__main__': main() diff --git a/examples/demo/demo.py b/examples/demo/demo.py new file mode 100755 index 0000000..6e26994 --- /dev/null +++ b/examples/demo/demo.py @@ -0,0 +1,363 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + + +import codecs +import os +import sys +import textwrap + +import gi +gi.require_version('Gtk', '3.0') +gi.require_version('Pango', '1.0') +gi.require_version('PangoCairo', '1.0') +gi.require_version('GdkPixbuf', '2.0') +gi.require_version('GtkSource', '4') + +from gi.repository import GLib, GObject, Pango, GdkPixbuf, Gtk, Gio + +try: + from gi.repository import GtkSource + GtkSource # PyFlakes +except ImportError: + GtkSource = None + + +DEMOROOTDIR = os.path.abspath(os.path.dirname(__file__)) +DEMOCODEDIR = os.path.join(DEMOROOTDIR, 'demos') +sys.path.insert(0, DEMOROOTDIR) + + +class Demo(GObject.GObject): + __gtype_name__ = 'GtkDemo' + + def __init__(self, title, module, filename): + super(Demo, self).__init__() + + self.title = title + self.module = module + self.filename = filename + + @classmethod + def new_from_file(cls, path): + relpath = os.path.relpath(path, DEMOROOTDIR) + packagename = os.path.dirname(relpath).replace(os.sep, '.') + modulename = os.path.basename(relpath)[0:-3] + + package = __import__(packagename, globals(), locals(), [modulename], 0) + module = getattr(package, modulename) + + try: + return cls(module.title, module, path) + except AttributeError as e: + raise AttributeError('(%s): %s' % (path, e.message)) + + +class DemoTreeStore(Gtk.TreeStore): + __gtype_name__ = 'GtkDemoTreeStore' + + def __init__(self, *args): + super(DemoTreeStore, self).__init__(str, Demo, Pango.Style) + + self._parent_nodes = {} + + for filename in self._list_dir(DEMOCODEDIR): + fullpath = os.path.join(DEMOCODEDIR, filename) + initfile = os.path.join(os.path.dirname(fullpath), '__init__.py') + + if fullpath != initfile and os.path.isfile(initfile) and fullpath.endswith('.py'): + parentname = os.path.dirname(os.path.relpath(fullpath, DEMOCODEDIR)) + + if parentname: + parent = self._get_parent_node(parentname) + else: + parent = None + + demo = Demo.new_from_file(fullpath) + self.append(parent, (demo.title, demo, Pango.Style.NORMAL)) + + def _list_dir(self, path): + demo_file_list = [] + + for filename in os.listdir(path): + fullpath = os.path.join(path, filename) + + if os.path.isdir(fullpath): + demo_file_list.extend(self._list_dir(fullpath)) + elif os.path.isfile(fullpath): + demo_file_list.append(fullpath) + + return sorted(demo_file_list, key=str.lower) + + def _get_parent_node(self, name): + if name not in self._parent_nodes.keys(): + node = self.append(None, (name, None, Pango.Style.NORMAL)) + self._parent_nodes[name] = node + + return self._parent_nodes[name] + + +class GtkDemoApp(Gtk.Application): + __gtype_name__ = 'GtkDemoWindow' + + def __init__(self): + super(GtkDemoApp, self).__init__(application_id='org.gnome.pygobject.gtkdemo') + + # Use a GResource to hold the CSS files. Resource bundles are created by + # the glib-compile-resources program shipped with Glib which takes an xml + # file that describes the bundle, and a set of files that the xml + # references. These are combined into a binary resource bundle. + base_path = os.path.abspath(os.path.dirname(__file__)) + resource_path = os.path.join(base_path, 'demos/data/demo.gresource') + resource = Gio.Resource.load(resource_path) + + # FIXME: method register() should be without the underscore + # FIXME: see https://bugzilla.gnome.org/show_bug.cgi?id=684319 + # Once the resource has been globally registered it can be used + # throughout the application. + resource._register() + + def on_activate(self, app): + self.window = Gtk.ApplicationWindow.new(self) + self.window.set_title('PyGObject GTK Code Demos') + self.window.set_default_size(600, 400) + self.setup_default_icon() + + self.header_bar = Gtk.HeaderBar(show_close_button=True, + subtitle='Foobar') + self.window.set_titlebar(self.header_bar) + + stack = Gtk.Stack(transition_type=Gtk.StackTransitionType.SLIDE_LEFT_RIGHT, + homogeneous=True) + switcher = Gtk.StackSwitcher(stack=stack, halign=Gtk.Align.CENTER) + + self.header_bar.set_custom_title(switcher) + + hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, + homogeneous=False, + spacing=0) + self.window.add(hbox) + + tree = self.create_tree() + hbox.pack_start(child=tree, expand=False, fill=False, padding=0) + hbox.pack_start(child=stack, expand=True, fill=True, padding=0) + + text_widget, info_buffer = self.create_text_view() + stack.add_titled(text_widget, name='info', title='Info') + + self.info_buffer = info_buffer + self.info_buffer.create_tag('title', font='Sans 18') + + text_widget, self.source_buffer = self.create_source_view() + stack.add_titled(text_widget, name='source', title='Source') + + self.window.show_all() + + self.selection_cb(self.tree_view.get_selection(), + self.tree_view.get_model()) + + def find_file(self, base=''): + dir = os.path.join(DEMOCODEDIR, 'data') + logo_file = os.path.join(dir, 'gtk-logo-rgb.gif') + base_file = os.path.join(dir, base) + + if (GLib.file_test(logo_file, GLib.FileTest.EXISTS) and + GLib.file_test(base_file, GLib.FileTest.EXISTS)): + return base_file + else: + filename = os.path.join(DEMOCODEDIR, base) + + if GLib.file_test(filename, GLib.FileTest.EXISTS): + return filename + + # can't find the file + raise IOError('Cannot find demo data file "%s"' % base) + + def setup_default_icon(self): + filename = self.find_file('gtk-logo-rgb.gif') + pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) + transparent = pixbuf.add_alpha(True, 0xff, 0xff, 0xff) + list = [] + list.append(transparent) + Gtk.Window.set_default_icon_list(list) + + def selection_cb(self, selection, model): + sel = selection.get_selected() + if sel == (): + return + + treeiter = sel[1] + title = model.get_value(treeiter, 0) + demo = model.get_value(treeiter, 1) + + if demo is None: + return + + # Split into paragraphs based on double newlines and use + # textwrap to strip out all other formatting whitespace + description = '' + for paragraph in demo.module.description.split('\n\n'): + description += '\n'.join(textwrap.wrap(paragraph, 99999)) + description += '\n\n' # Add paragraphs back in + + f = codecs.open(demo.filename, 'rU', 'utf-8') + code = f.read() + f.close() + + # output and style the title + (start, end) = self.info_buffer.get_bounds() + self.info_buffer.delete(start, end) + (start, end) = self.source_buffer.get_bounds() + self.source_buffer.delete(start, end) + + start = self.info_buffer.get_iter_at_offset(0) + end = start.copy() + self.info_buffer.insert(end, title) + start = end.copy() + start.backward_chars(len(title)) + self.info_buffer.apply_tag_by_name('title', start, end) + self.info_buffer.insert(end, '\n') + + # output the description + self.info_buffer.insert(end, description) + + # output the code + start = self.source_buffer.get_iter_at_offset(0) + end = start.copy() + self.source_buffer.insert(end, code) + + def row_activated_cb(self, view, path, col, store): + iter = store.get_iter(path) + demo = store.get_value(iter, 1) + + if demo is not None: + store.set_value(iter, 2, Pango.Style.ITALIC) + try: + demo.module.main(self) + finally: + store.set_value(iter, 2, Pango.Style.NORMAL) + + def create_tree(self): + tree_store = DemoTreeStore() + tree_view = Gtk.TreeView() + self.tree_view = tree_view + tree_view.set_model(tree_store) + selection = tree_view.get_selection() + selection.set_mode(Gtk.SelectionMode.BROWSE) + tree_view.set_size_request(200, -1) + + cell = Gtk.CellRendererText() + column = Gtk.TreeViewColumn(title='Widget (double click for demo)', + cell_renderer=cell, + text=0, + style=2) + + first_iter = tree_store.get_iter_first() + if first_iter is not None: + selection.select_iter(first_iter) + + selection.connect('changed', self.selection_cb, tree_store) + tree_view.connect('row_activated', self.row_activated_cb, tree_store) + + tree_view.append_column(column) + + tree_view.expand_all() + tree_view.set_headers_visible(False) + scrolled_window = Gtk.ScrolledWindow(hadjustment=None, + vadjustment=None) + scrolled_window.set_policy(Gtk.PolicyType.NEVER, + Gtk.PolicyType.AUTOMATIC) + + scrolled_window.add(tree_view) + + label = Gtk.Label(label='Widget (double click for demo)') + + box = Gtk.Notebook() + box.append_page(scrolled_window, label) + + tree_view.grab_focus() + + return box + + def create_scrolled_window(self): + scrolled_window = Gtk.ScrolledWindow(hadjustment=None, + vadjustment=None) + scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, + Gtk.PolicyType.AUTOMATIC) + scrolled_window.set_shadow_type(Gtk.ShadowType.IN) + return scrolled_window + + def create_text_view(self): + text_view = Gtk.TextView() + buffer = Gtk.TextBuffer() + + text_view.set_buffer(buffer) + text_view.set_editable(False) + text_view.set_cursor_visible(False) + + scrolled_window = self.create_scrolled_window() + scrolled_window.add(text_view) + + text_view.set_wrap_mode(Gtk.WrapMode.WORD) + text_view.set_pixels_above_lines(2) + text_view.set_pixels_below_lines(2) + + return scrolled_window, buffer + + def create_source_view(self): + font_desc = Pango.FontDescription('monospace 11') + + if GtkSource: + lang_mgr = GtkSource.LanguageManager() + lang = lang_mgr.get_language('python') + + buffer = GtkSource.Buffer() + buffer.set_language(lang) + buffer.set_highlight_syntax(True) + + view = GtkSource.View() + view.set_buffer(buffer) + view.set_show_line_numbers(True) + + scrolled_window = self.create_scrolled_window() + scrolled_window.add(view) + + else: + scrolled_window, buffer = self.create_text_view() + view = scrolled_window.get_child() + + view.modify_font(font_desc) + view.set_wrap_mode(Gtk.WrapMode.NONE) + return scrolled_window, buffer + + def run(self, argv): + self.connect('activate', self.on_activate) + return super(GtkDemoApp, self).run(argv) + + +def main(argv): + """Entry point for demo manager""" + app = GtkDemoApp() + return app.run(argv) + + +if __name__ == '__main__': + SystemExit(main(sys.argv)) diff --git a/examples/demo/demos/Css/__init__.py b/examples/demo/demos/Css/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/demo/demos/Css/css_accordion.py b/examples/demo/demos/Css/css_accordion.py new file mode 100644 index 0000000..2b7cddc --- /dev/null +++ b/examples/demo/demos/Css/css_accordion.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2013 Gian Mario Tagliaretti +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "CSS Accordion" +description = """ +A simple accordion demo written using CSS transitions and multiple backgrounds. +""" + + +from gi.repository import Gtk, Gio + + +class CSSAccordionApp: + def __init__(self): + window = Gtk.Window() + window.set_title('CSS Accordion') + window.set_default_size(600, 300) + window.set_border_width(10) + window.connect('destroy', Gtk.main_quit) + + hbox = Gtk.Box(homogeneous=False, spacing=2, + orientation=Gtk.Orientation.HORIZONTAL) + hbox.set_halign(Gtk.Align.CENTER) + hbox.set_valign(Gtk.Align.CENTER) + window.add(hbox) + + for label in ('This', 'Is', 'A', 'CSS', 'Accordion', ':-)'): + hbox.add(Gtk.Button(label=label)) + + bytes = Gio.resources_lookup_data("/css_accordion/css_accordion.css", 0) + + provider = Gtk.CssProvider() + provider.load_from_data(bytes.get_data()) + + self.apply_css(window, provider) + + window.show_all() + + def apply_css(self, widget, provider): + Gtk.StyleContext.add_provider(widget.get_style_context(), + provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + if isinstance(widget, Gtk.Container): + widget.forall(self.apply_css, provider) + + +def main(demoapp=None): + CSSAccordionApp() + Gtk.main() + + +if __name__ == '__main__': + import os + base_path = os.path.abspath(os.path.dirname(__file__)) + resource_path = os.path.join(base_path, '../data/demo.gresource') + resource = Gio.Resource.load(resource_path) + + # FIXME: method register() should be without the underscore + # FIXME: see https://bugzilla.gnome.org/show_bug.cgi?id=684319 + resource._register() + main() diff --git a/examples/demo/demos/Css/css_basics.py b/examples/demo/demos/Css/css_basics.py new file mode 100644 index 0000000..18c3d12 --- /dev/null +++ b/examples/demo/demos/Css/css_basics.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2013 Gian Mario Tagliaretti +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "CSS Basics" +description = """ +Gtk themes are written using CSS. Every widget is build of multiple items +that you can style very similarly to a regular website. +""" + +import os +from gi.repository import Gtk, Gdk, Pango, Gio, GLib + + +class CSSBasicsApp: + def __init__(self, demoapp): + self.demoapp = demoapp + #: Store the last successful parsing of the css so we can revert + #: this in case of an error. + self.last_good_text = '' + #: Set when we receive a parsing-error callback. This is needed + #: to handle logic after a parsing-error callback which does not raise + #: an exception with provider.load_from_data() + self.last_error_code = 0 + + self.window = Gtk.Window() + self.window.set_title('CSS Basics') + self.window.set_default_size(400, 300) + self.window.set_border_width(10) + self.window.connect('destroy', lambda w: Gtk.main_quit()) + + self.infobar = Gtk.InfoBar() + self.infolabel = Gtk.Label() + self.infobar.get_content_area().pack_start(self.infolabel, False, False, 0) + self.infobar.set_message_type(Gtk.MessageType.WARNING) + + scrolled = Gtk.ScrolledWindow() + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) + box.pack_start(scrolled, expand=True, fill=True, padding=0) + box.pack_start(self.infobar, expand=False, fill=True, padding=0) + self.window.add(box) + + provider = Gtk.CssProvider() + + buffer = Gtk.TextBuffer() + buffer.create_tag(tag_name="warning", underline=Pango.Underline.SINGLE) + buffer.create_tag(tag_name="error", underline=Pango.Underline.ERROR) + buffer.connect("changed", self.css_text_changed, provider) + + provider.connect("parsing-error", self.show_parsing_error, buffer) + + textview = Gtk.TextView() + textview.set_buffer(buffer) + scrolled.add(textview) + + bytes = Gio.resources_lookup_data("/css_basics/css_basics.css", 0) + buffer.set_text(bytes.get_data().decode('utf-8')) + + self.apply_css(self.window, provider) + self.window.show_all() + self.infobar.hide() + + def apply_css(self, widget, provider): + Gtk.StyleContext.add_provider(widget.get_style_context(), + provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + if isinstance(widget, Gtk.Container): + widget.forall(self.apply_css, provider) + + def show_parsing_error(self, provider, section, error, buffer): + start = buffer.get_iter_at_line_index(section.get_start_line(), + section.get_start_position()) + + end = buffer.get_iter_at_line_index(section.get_end_line(), + section.get_end_position()) + + if error.code == Gtk.CssProviderError.DEPRECATED: + tag_name = "warning" + else: + tag_name = "error" + self.last_error_code = error.code + + self.infolabel.set_text(error.message) + self.infobar.show_all() + + buffer.apply_tag_by_name(tag_name, start, end) + + def css_text_changed(self, buffer, provider): + start = buffer.get_start_iter() + end = buffer.get_end_iter() + buffer.remove_all_tags(start, end) + + text = buffer.get_text(start, end, False).encode('utf-8') + + # Ignore CSS errors as they are shown by highlighting + try: + provider.load_from_data(text) + except GLib.GError as e: + if e.domain != 'gtk-css-provider-error-quark': + raise e + + # If the parsing-error callback is ever run (even in the case of warnings) + # load the last good css text that ran without any warnings. Otherwise + # we may have a discrepancy in "last_good_text" vs the current buffer + # causing section.get_start_position() to give back an invalid position + # for the editor buffer. + if self.last_error_code: + provider.load_from_data(self.last_good_text) + self.last_error_code = 0 + else: + self.last_good_text = text + self.infobar.hide() + + Gtk.StyleContext.reset_widgets(Gdk.Screen.get_default()) + + +def main(demoapp=None): + CSSBasicsApp(demoapp) + Gtk.main() + + +if __name__ == '__main__': + base_path = os.path.abspath(os.path.dirname(__file__)) + resource_path = os.path.join(base_path, '../data/demo.gresource') + resource = Gio.Resource.load(resource_path) + + # FIXME: method register() should be without the underscore + # FIXME: see https://bugzilla.gnome.org/show_bug.cgi?id=684319 + resource._register() + main() diff --git a/examples/demo/demos/Css/css_multiplebgs.py b/examples/demo/demos/Css/css_multiplebgs.py new file mode 100644 index 0000000..9e1b011 --- /dev/null +++ b/examples/demo/demos/Css/css_multiplebgs.py @@ -0,0 +1,187 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2013 Gian Mario Tagliaretti +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "CSS Theming/Multiple Backgrounds" +description = """ +Gtk themes are written using CSS. Every widget is build of multiple items +that you can style very similarly to a regular website. +""" + +from gi.repository import Gtk, Gdk, Pango, Gio, GLib + + +class CSSMultiplebgsApp: + def __init__(self, demoapp): + self.demoapp = demoapp + #: Store the last successful parsing of the css so we can revert + #: this in case of an error. + self.last_good_text = '' + #: Set when we receive a parsing-error callback. This is needed + #: to handle logic after a parsing-error callback which does not raise + #: an exception with provider.load_from_data() + self.last_error_code = 0 + + self.window = Gtk.Window() + self.window.set_title('CSS Multiplebgs') + self.window.set_default_size(400, 300) + self.window.set_border_width(10) + self.window.connect('destroy', lambda w: Gtk.main_quit()) + + overlay = Gtk.Overlay() + overlay.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK | + Gdk.EventMask.LEAVE_NOTIFY_MASK | + Gdk.EventMask.POINTER_MOTION_MASK) + + self.infobar = Gtk.InfoBar() + self.infolabel = Gtk.Label() + self.infobar.get_content_area().pack_start(self.infolabel, False, False, 0) + self.infobar.set_message_type(Gtk.MessageType.WARNING) + + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) + box.pack_start(overlay, expand=True, fill=True, padding=0) + box.pack_start(self.infobar, expand=False, fill=True, padding=0) + self.window.add(box) + + canvas = Gtk.DrawingArea() + canvas.set_name("canvas") + canvas.connect("draw", self.drawing_area_draw) + overlay.add(canvas) + + button = Gtk.Button() + button.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK | + Gdk.EventMask.LEAVE_NOTIFY_MASK | + Gdk.EventMask.POINTER_MOTION_MASK) + button.set_name("bricks-button") + button.set_halign(Gtk.Align.CENTER) + button.set_valign(Gtk.Align.CENTER) + button.set_size_request(250, 84) + overlay.add_overlay(button) + + paned = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL) + overlay.add_overlay(paned) + + # We need a filler so we get a handle + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) + paned.add(box) + + buffer = Gtk.TextBuffer() + buffer.create_tag(tag_name="warning", underline=Pango.Underline.SINGLE) + buffer.create_tag(tag_name="error", underline=Pango.Underline.ERROR) + + provider = Gtk.CssProvider() + + buffer.connect("changed", self.css_text_changed, provider) + provider.connect("parsing-error", self.show_parsing_error, buffer) + + textview = Gtk.TextView() + textview.set_buffer(buffer) + + scrolled = Gtk.ScrolledWindow() + scrolled.add(textview) + paned.add(scrolled) + + bytes = Gio.resources_lookup_data("/css_multiplebgs/css_multiplebgs.css", 0) + buffer.set_text(bytes.get_data().decode('utf-8')) + + self.apply_css(self.window, provider) + self.window.show_all() + self.infobar.hide() + + def drawing_area_draw(self, widget, cairo_t): + context = widget.get_style_context() + Gtk.render_background(context, cairo_t, 0, 0, + widget.get_allocated_width(), + widget.get_allocated_height()) + + Gtk.render_frame(context, cairo_t, 0, 0, + widget.get_allocated_width(), + widget.get_allocated_height()) + + def apply_css(self, widget, provider): + Gtk.StyleContext.add_provider(widget.get_style_context(), + provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + if isinstance(widget, Gtk.Container): + widget.forall(self.apply_css, provider) + + def show_parsing_error(self, provider, section, error, buffer): + start = buffer.get_iter_at_line_index(section.get_start_line(), + section.get_start_position()) + + end = buffer.get_iter_at_line_index(section.get_end_line(), + section.get_end_position()) + + if error.code == Gtk.CssProviderError.DEPRECATED: + tag_name = "warning" + else: + tag_name = "error" + self.last_error_code = error.code + + self.infolabel.set_text(error.message) + self.infobar.show_all() + + buffer.apply_tag_by_name(tag_name, start, end) + + def css_text_changed(self, buffer, provider): + start = buffer.get_start_iter() + end = buffer.get_end_iter() + buffer.remove_all_tags(start, end) + + text = buffer.get_text(start, end, False).encode('utf-8') + + # Ignore CSS errors as they are shown by highlighting + try: + provider.load_from_data(text) + except GLib.GError as e: + if e.domain != 'gtk-css-provider-error-quark': + raise e + + # If the parsing-error callback is ever run (even in the case of warnings) + # load the last good css text that ran without any warnings. Otherwise + # we may have a discrepancy in "last_good_text" vs the current buffer + # causing section.get_start_position() to give back an invalid position + # for the editor buffer. + if self.last_error_code: + provider.load_from_data(self.last_good_text) + self.last_error_code = 0 + else: + self.last_good_text = text + self.infobar.hide() + + Gtk.StyleContext.reset_widgets(Gdk.Screen.get_default()) + + +def main(demoapp=None): + CSSMultiplebgsApp(demoapp) + Gtk.main() + + +if __name__ == '__main__': + import os + base_path = os.path.abspath(os.path.dirname(__file__)) + resource_path = os.path.join(base_path, '../data/demo.gresource') + resource = Gio.Resource.load(resource_path) + + # FIXME: method register() should be without the underscore + # FIXME: see https://bugzilla.gnome.org/show_bug.cgi?id=684319 + resource._register() + main() diff --git a/examples/demo/demos/Entry/__init__.py b/examples/demo/demos/Entry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/demo/demos/Entry/entry_buffer.py b/examples/demo/demos/Entry/entry_buffer.py new file mode 100644 index 0000000..f0c04a4 --- /dev/null +++ b/examples/demo/demos/Entry/entry_buffer.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Entry Buffer" +description = """ +Gtk.EntryBuffer provides the text content in a Gtk.Entry. +""" + + +from gi.repository import Gtk + + +class EntryBufferApp: + def __init__(self): + self.window = Gtk.Dialog(title='Gtk.EntryBuffer') + self.window.add_buttons(Gtk.STOCK_CLOSE, Gtk.ResponseType.NONE) + self.window.connect('response', self.destroy) + self.window.connect('destroy', lambda x: Gtk.main_quit()) + self.window.set_resizable(False) + + vbox = Gtk.VBox(homogeneous=False, spacing=0) + self.window.get_content_area().pack_start(vbox, True, True, 0) + vbox.set_border_width(5) + + label = Gtk.Label() + label.set_markup('Entries share a buffer. Typing in one is reflected in the other.') + vbox.pack_start(label, False, False, 0) + + # create a buffer + buffer = Gtk.EntryBuffer() + + # create our first entry + entry = Gtk.Entry(buffer=buffer) + vbox.pack_start(entry, False, False, 0) + + # create the second entry + entry = Gtk.Entry(buffer=buffer) + entry.set_visibility(False) + vbox.pack_start(entry, False, False, 0) + + self.window.show_all() + + def destroy(self, *args): + self.window.destroy() + Gtk.main_quit() + + +def main(demoapp=None): + EntryBufferApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/Entry/entry_completion.py b/examples/demo/demos/Entry/entry_completion.py new file mode 100644 index 0000000..107c45a --- /dev/null +++ b/examples/demo/demos/Entry/entry_completion.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Entry Completion" +description = """ +Gtk.EntryCompletion provides a mechanism for adding support for +completion in Gtk.Entry. +""" + + +from gi.repository import Gtk + + +class EntryBufferApp: + def __init__(self): + self.window = Gtk.Dialog(title='Gtk.EntryCompletion') + self.window.add_buttons(Gtk.STOCK_CLOSE, Gtk.ResponseType.NONE) + self.window.connect('response', self.destroy) + self.window.connect('destroy', lambda x: Gtk.main_quit()) + self.window.set_resizable(False) + + vbox = Gtk.VBox(homogeneous=False, spacing=0) + self.window.get_content_area().pack_start(vbox, True, True, 0) + vbox.set_border_width(5) + + label = Gtk.Label() + label.set_markup('Completion demo, try writing total or gnome for example.') + vbox.pack_start(label, False, False, 0) + + # create our entry + entry = Gtk.Entry() + vbox.pack_start(entry, False, False, 0) + + # create the completion object + completion = Gtk.EntryCompletion() + + # assign the completion to the entry + entry.set_completion(completion) + + # create tree model and use it as the completion model + completion_model = self.create_completion_model() + completion.set_model(completion_model) + + completion.set_text_column(0) + + self.window.show_all() + + def create_completion_model(self): + store = Gtk.ListStore(str) + + store.append(['GNOME']) + store.append(['total']) + store.append(['totally']) + + return store + + def destroy(self, *args): + self.window.destroy() + Gtk.main_quit() + + +def main(demoapp=None): + EntryBufferApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/Entry/search_entry.py b/examples/demo/demos/Entry/search_entry.py new file mode 100644 index 0000000..793b81a --- /dev/null +++ b/examples/demo/demos/Entry/search_entry.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Search Entry" +description = """GtkEntry allows to display icons and progress information. +This demo shows how to use these features in a search entry. +""" + +from gi.repository import Gtk, GObject + +(PIXBUF_COL, + TEXT_COL) = range(2) + + +class SearchboxApp: + def __init__(self, demoapp): + self.demoapp = demoapp + + self.window = Gtk.Dialog(title='Search Entry') + self.window.add_buttons(Gtk.STOCK_CLOSE, Gtk.ResponseType.NONE) + + self.window.connect('response', lambda x, y: self.window.destroy()) + self.window.connect('destroy', Gtk.main_quit) + + content_area = self.window.get_content_area() + + vbox = Gtk.VBox(spacing=5) + content_area.pack_start(vbox, True, True, 0) + vbox.set_border_width(5) + + label = Gtk.Label() + label.set_markup('Search entry demo') + vbox.pack_start(label, False, False, 0) + + hbox = Gtk.HBox(homogeneous=False, spacing=10) + hbox.set_border_width(0) + vbox.pack_start(hbox, True, True, 0) + + # Create our entry + entry = Gtk.Entry() + hbox.pack_start(entry, False, False, 0) + + # Create the find and cancel buttons + notebook = Gtk.Notebook() + self.notebook = notebook + notebook.set_show_tabs(False) + notebook.set_show_border(False) + hbox.pack_start(notebook, False, False, 0) + + find_button = Gtk.Button(label='Find') + find_button.connect('clicked', self.start_search, entry) + notebook.append_page(find_button, None) + find_button.show() + + cancel_button = Gtk.Button(label='Cancel') + cancel_button.connect('clicked', self.stop_search, entry) + notebook.append_page(cancel_button, None) + cancel_button.show() + + # Set up the search icon + self.search_by_name(None, entry) + + # Set up the clear icon + entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, + Gtk.STOCK_CLEAR) + self.text_changed_cb(entry, None, find_button) + + entry.connect('notify::text', self.text_changed_cb, find_button) + + entry.connect('activate', self.activate_cb) + + # Create the menu + menu = self.create_search_menu(entry) + entry.connect('icon-press', self.icon_press_cb, menu) + + # FIXME: this should take None for the detach callback + # but our callback implementation does not allow + # it yet, so we pass in a noop callback + menu.attach_to_widget(entry, self.detach) + + # add accessible alternatives for icon functionality + entry.connect('populate-popup', self.entry_populate_popup) + + self.window.show_all() + + def detach(self, *args): + pass + + def show_find_button(self): + self.notebook.set_current_page(0) + + def show_cancel_button(self): + self.notebook.set_current_page(1) + + def search_progress(self, entry): + entry.progress_pulse() + return True + + def search_progress_done(self, entry): + entry.set_progress_fraction(0.0) + + def finish_search(self, button, entry): + self.show_find_button() + GObject.source_remove(self.search_progress_id) + self.search_progress_done(entry) + self.search_progress_id = 0 + + return False + + def start_search_feedback(self, entry): + self.search_progress_id = GObject.timeout_add(100, + self.search_progress, + entry) + + return False + + def start_search(self, button, entry): + self.show_cancel_button() + self.search_progress_id = GObject.timeout_add_seconds(1, + self.start_search_feedback, + entry) + self.finish_search_id = GObject.timeout_add_seconds(15, + self.finish_search, + button) + + def stop_search(self, button, entry): + GObject.source_remove(self.finish_search_id) + self.finish_search(button, entry) + + def clear_entry_swapped(self, widget, entry): + self.clear_entry(entry) + + def clear_entry(self, entry): + entry.set_text('') + + def search_by_name(self, item, entry): + entry.set_icon_from_stock(Gtk.EntryIconPosition.PRIMARY, + Gtk.STOCK_FIND) + entry.set_icon_tooltip_text(Gtk.EntryIconPosition.PRIMARY, + 'Search by name\n' + + 'Click here to change the search type') + + def search_by_description(self, item, entry): + entry.set_icon_from_stock(Gtk.EntryIconPosition.PRIMARY, + Gtk.STOCK_EDIT) + entry.set_icon_tooltip_text(Gtk.EntryIconPosition.PRIMARY, + 'Search by description\n' + + 'Click here to change the search type') + + def search_by_file(self, item, entry): + entry.set_icon_from_stock(Gtk.EntryIconPosition.PRIMARY, + Gtk.STOCK_OPEN) + entry.set_icon_tooltip_text(Gtk.EntryIconPosition.PRIMARY, + 'Search by file name\n' + + 'Click here to change the search type') + + def create_search_menu(self, entry): + menu = Gtk.Menu() + + item = Gtk.ImageMenuItem.new_with_mnemonic('Search by _name') + image = Gtk.Image.new_from_stock(Gtk.STOCK_FIND, Gtk.IconSize.MENU) + item.set_image(image) + item.set_always_show_image(True) + item.connect('activate', self.search_by_name, entry) + menu.append(item) + + item = Gtk.ImageMenuItem.new_with_mnemonic('Search by _description') + image = Gtk.Image.new_from_stock(Gtk.STOCK_EDIT, Gtk.IconSize.MENU) + item.set_image(image) + item.set_always_show_image(True) + item.connect('activate', self.search_by_description, entry) + menu.append(item) + + item = Gtk.ImageMenuItem.new_with_mnemonic('Search by _file name') + image = Gtk.Image.new_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.MENU) + item.set_image(image) + item.set_always_show_image(True) + item.connect('activate', self.search_by_name, entry) + menu.append(item) + + menu.show_all() + + return menu + + def icon_press_cb(self, entry, position, event, menu): + if position == Gtk.EntryIconPosition.PRIMARY: + menu.popup(None, None, None, None, + event.button, event.time) + else: + self.clear_entry(entry) + + def text_changed_cb(self, entry, pspec, button): + has_text = entry.get_text_length() > 0 + entry.set_icon_sensitive(Gtk.EntryIconPosition.SECONDARY, has_text) + button.set_sensitive(has_text) + + def activate_cb(self, entry, button): + if self.search_progress_id != 0: + return + self.start_search(button, entry) + + def search_entry_destroyed(self, widget): + if self.finish_search_id != 0: + GObject.source_remove(self.finish_search_id) + if self.search_progress_id != 0: + GObject.source_remove(self.search_progress_id) + + self.window = None + + def entry_populate_popup(self, entry, menu): + has_text = entry.get_text_length() > 0 + + item = Gtk.SeparatorMenuItem() + item.show() + menu.append(item) + + item = Gtk.MenuItem.new_with_mnemonic("C_lear") + item.show() + item.connect('activate', self.clear_entry_swapped, entry) + menu.append(item) + item.set_sensitive(has_text) + + search_menu = self.create_search_menu(entry) + item = Gtk.MenuItem.new_with_label('Search by') + item.show() + item.set_submenu(search_menu) + menu.append(item) + + +def main(demoapp=None): + SearchboxApp(demoapp) + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/IconView/__init__.py b/examples/demo/demos/IconView/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/demo/demos/IconView/iconviewbasics.py b/examples/demo/demos/IconView/iconviewbasics.py new file mode 100644 index 0000000..8cb71a8 --- /dev/null +++ b/examples/demo/demos/IconView/iconviewbasics.py @@ -0,0 +1,221 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Icon View Basics" +description = """The GtkIconView widget is used to display and manipulate +icons. It uses a GtkTreeModel for data storage, so the list store example might +be helpful. We also use the Gio.File API to get the icons for each file type. +""" + + +import os + +from gi.repository import GLib, Gio, GdkPixbuf, Gtk + + +class IconViewApp: + (COL_PATH, + COL_DISPLAY_NAME, + COL_PIXBUF, + COL_IS_DIRECTORY, + NUM_COLS) = range(5) + + def __init__(self, demoapp): + self.pixbuf_lookup = {} + + self.demoapp = demoapp + + self.window = Gtk.Window() + self.window.set_title('Gtk.IconView demo') + self.window.set_default_size(650, 400) + self.window.connect('destroy', Gtk.main_quit) + + vbox = Gtk.VBox() + self.window.add(vbox) + + tool_bar = Gtk.Toolbar() + vbox.pack_start(tool_bar, False, False, 0) + + up_button = Gtk.ToolButton(stock_id=Gtk.STOCK_GO_UP) + up_button.set_is_important(True) + up_button.set_sensitive(False) + tool_bar.insert(up_button, -1) + + home_button = Gtk.ToolButton(stock_id=Gtk.STOCK_HOME) + home_button.set_is_important(True) + tool_bar.insert(home_button, -1) + + sw = Gtk.ScrolledWindow() + sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN) + sw.set_policy(Gtk.PolicyType.AUTOMATIC, + Gtk.PolicyType.AUTOMATIC) + + vbox.pack_start(sw, True, True, 0) + + # create the store and fill it with content + self.parent_dir = '/' + store = self.create_store() + self.fill_store(store) + + icon_view = Gtk.IconView(model=store) + icon_view.set_selection_mode(Gtk.SelectionMode.MULTIPLE) + sw.add(icon_view) + + # connect to the 'clicked' signal of the "Up" tool button + up_button.connect('clicked', self.up_clicked, store) + + # connect to the 'clicked' signal of the "home" tool button + home_button.connect('clicked', self.home_clicked, store) + + self.up_button = up_button + self.home_button = home_button + + # we now set which model columns that correspond to the text + # and pixbuf of each item + icon_view.set_text_column(self.COL_DISPLAY_NAME) + icon_view.set_pixbuf_column(self.COL_PIXBUF) + + # connect to the "item-activated" signal + icon_view.connect('item-activated', self.item_activated, store) + icon_view.grab_focus() + + self.window.show_all() + + def sort_func(self, store, a_iter, b_iter, user_data): + (a_name, a_is_dir) = store.get(a_iter, + self.COL_DISPLAY_NAME, + self.COL_IS_DIRECTORY) + + (b_name, b_is_dir) = store.get(b_iter, + self.COL_DISPLAY_NAME, + self.COL_IS_DIRECTORY) + + if a_name is None: + a_name = '' + + if b_name is None: + b_name = '' + + if (not a_is_dir) and b_is_dir: + return 1 + elif a_is_dir and (not b_is_dir): + return -1 + elif a_name > b_name: + return 1 + elif a_name < b_name: + return -1 + else: + return 0 + + def up_clicked(self, item, store): + self.parent_dir = os.path.split(self.parent_dir)[0] + self.fill_store(store) + # de-sensitize the up button if we are at the root + self.up_button.set_sensitive(self.parent_dir != '/') + + def home_clicked(self, item, store): + self.parent_dir = GLib.get_home_dir() + self.fill_store(store) + + # Sensitize the up button + self.up_button.set_sensitive(True) + + def item_activated(self, icon_view, tree_path, store): + iter_ = store.get_iter(tree_path) + (path, is_dir) = store.get(iter_, self.COL_PATH, self.COL_IS_DIRECTORY) + if not is_dir: + return + + self.parent_dir = path + self.fill_store(store) + + self.up_button.set_sensitive(True) + + def create_store(self): + store = Gtk.ListStore(str, str, GdkPixbuf.Pixbuf, bool) + + # set sort column and function + store.set_default_sort_func(self.sort_func) + store.set_sort_column_id(-1, Gtk.SortType.ASCENDING) + + return store + + def file_to_icon_pixbuf(self, path): + pixbuf = None + + # get the theme icon + f = Gio.file_new_for_path(path) + info = f.query_info(Gio.FILE_ATTRIBUTE_STANDARD_ICON, + Gio.FileQueryInfoFlags.NONE, + None) + gicon = info.get_icon() + + # check to see if it is an image format we support + for format in GdkPixbuf.Pixbuf.get_formats(): + for mime_type in format.get_mime_types(): + content_type = Gio.content_type_from_mime_type(mime_type) + if content_type is not None: + break + + format_gicon = Gio.content_type_get_icon(content_type) + if format_gicon.equal(gicon): + gicon = f.icon_new() + break + + if gicon in self.pixbuf_lookup: + return self.pixbuf_lookup[gicon] + + if isinstance(gicon, Gio.ThemedIcon): + names = gicon.get_names() + icon_theme = Gtk.IconTheme.get_default() + for name in names: + try: + pixbuf = icon_theme.load_icon(name, 64, 0) + break + except GLib.GError: + pass + + self.pixbuf_lookup[gicon] = pixbuf + + elif isinstance(gicon, Gio.FileIcon): + icon_file = gicon.get_file() + path = icon_file.get_path() + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(path, 72, 72) + self.pixbuf_lookup[gicon] = pixbuf + + return pixbuf + + def fill_store(self, store): + store.clear() + for name in os.listdir(self.parent_dir): + path = os.path.join(self.parent_dir, name) + is_dir = os.path.isdir(path) + pixbuf = self.file_to_icon_pixbuf(path) + store.append((path, name, pixbuf, is_dir)) + + +def main(demoapp=None): + IconViewApp(demoapp) + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/IconView/iconviewedit.py b/examples/demo/demos/IconView/iconviewedit.py new file mode 100644 index 0000000..85dfa93 --- /dev/null +++ b/examples/demo/demos/IconView/iconviewedit.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Editing and Drag-and-Drop" +description = """The GtkIconView widget supports Editing and Drag-and-Drop. +This example also demonstrates using the generic GtkCellLayout interface to set +up cell renderers in an icon view. +""" + +from gi.repository import Gtk, Gdk, GdkPixbuf + + +class IconviewEditApp: + COL_TEXT = 0 + NUM_COLS = 1 + + def __init__(self): + self.window = Gtk.Window() + self.window.set_title('Editing and Drag-and-Drop') + self.window.set_border_width(8) + self.window.connect('destroy', Gtk.main_quit) + + store = Gtk.ListStore(str) + colors = ['Red', 'Green', 'Blue', 'Yellow'] + store.clear() + for c in colors: + store.append([c]) + + icon_view = Gtk.IconView(model=store) + icon_view.set_selection_mode(Gtk.SelectionMode.SINGLE) + icon_view.set_item_orientation(Gtk.Orientation.HORIZONTAL) + icon_view.set_columns(2) + icon_view.set_reorderable(True) + + renderer = Gtk.CellRendererPixbuf() + icon_view.pack_start(renderer, True) + icon_view.set_cell_data_func(renderer, + self.set_cell_color, + None) + + renderer = Gtk.CellRendererText() + icon_view.pack_start(renderer, True) + renderer.props.editable = True + renderer.connect('edited', self.edited, icon_view) + icon_view.add_attribute(renderer, 'text', self.COL_TEXT) + + self.window.add(icon_view) + + self.window.show_all() + + def set_cell_color(self, cell_layout, cell, tree_model, iter_, icon_view): + + # FIXME return single element instead of tuple + text = tree_model.get(iter_, self.COL_TEXT)[0] + color = Gdk.color_parse(text) + pixel = 0 + if color is not None: + pixel = ((color.red >> 8) << 24 | + (color.green >> 8) << 16 | + (color.blue >> 8) << 8) + + pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, False, 8, 24, 24) + pixbuf.fill(pixel) + + cell.props.pixbuf = pixbuf + + def edited(self, cell, path_string, text, icon_view): + model = icon_view.get_model() + path = Gtk.TreePath(path_string) + + iter_ = model.get_iter(path) + model.set_row(iter_, [text]) + + +def main(demoapp=None): + IconviewEditApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/TreeView/__init__.py b/examples/demo/demos/TreeView/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/demo/demos/TreeView/liststore.py b/examples/demo/demos/TreeView/liststore.py new file mode 100644 index 0000000..4b3daa1 --- /dev/null +++ b/examples/demo/demos/TreeView/liststore.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "List Store" +description = """ +The GtkListStore is used to store data in list form, to be used later on by a +GtkTreeView to display it. This demo builds a simple GtkListStore and displays +it. See the Stock Browser demo for a more advanced example. +""" + + +from gi.repository import Gtk, GObject, GLib + + +class Bug: + def __init__(self, is_fixed, number, severity, description): + self.is_fixed = is_fixed + self.number = number + self.severity = severity + self.description = description + + +# initial data we use to fill in the store +data = [Bug(False, 60482, "Normal", "scrollable notebooks and hidden tabs"), + Bug(False, 60620, "Critical", "gdk_window_clear_area (gdkwindow-win32.c) is not thread-safe"), + Bug(False, 50214, "Major", "Xft support does not clean up correctly"), + Bug(True, 52877, "Major", "GtkFileSelection needs a refresh method. "), + Bug(False, 56070, "Normal", "Can't click button after setting in sensitive"), + Bug(True, 56355, "Normal", "GtkLabel - Not all changes propagate correctly"), + Bug(False, 50055, "Normal", "Rework width/height computations for TreeView"), + Bug(False, 58278, "Normal", "gtk_dialog_set_response_sensitive () doesn't work"), + Bug(False, 55767, "Normal", "Getters for all setters"), + Bug(False, 56925, "Normal", "Gtkcalender size"), + Bug(False, 56221, "Normal", "Selectable label needs right-click copy menu"), + Bug(True, 50939, "Normal", "Add shift clicking to GtkTextView"), + Bug(False, 6112, "Enhancement", "netscape-like collapsable toolbars"), + Bug(False, 1, "Normal", "First bug :=)")] + + +class ListStoreApp: + (COLUMN_FIXED, + COLUMN_NUMBER, + COLUMN_SEVERITY, + COLUMN_DESCRIPTION, + COLUMN_PULSE, + COLUMN_ICON, + COLUMN_ACTIVE, + COLUMN_SENSITIVE, + NUM_COLUMNS) = range(9) + + def __init__(self): + self.window = Gtk.Window() + self.window.set_title('Gtk.ListStore Demo') + self.window.connect('destroy', Gtk.main_quit) + + vbox = Gtk.VBox(spacing=8) + self.window.add(vbox) + + label = Gtk.Label(label='This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).') + vbox.pack_start(label, False, False, 0) + + sw = Gtk.ScrolledWindow() + sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN) + sw.set_policy(Gtk.PolicyType.NEVER, + Gtk.PolicyType.AUTOMATIC) + vbox.pack_start(sw, True, True, 0) + + self.create_model() + treeview = Gtk.TreeView(model=self.model) + treeview.set_rules_hint(True) + treeview.set_search_column(self.COLUMN_DESCRIPTION) + sw.add(treeview) + + self.add_columns(treeview) + + self.window.set_default_size(280, 250) + self.window.show_all() + + self.window.connect('delete-event', self.window_closed) + self.timeout = GLib.timeout_add(80, self.spinner_timeout) + + def window_closed(self, window, event): + if self.timeout != 0: + GLib.source_remove(self.timeout) + + def spinner_timeout(self): + if self.model is None: + return False + + iter_ = self.model.get_iter_first() + pulse = self.model.get(iter_, self.COLUMN_PULSE)[0] + if pulse == 999999999: + pulse = 0 + else: + pulse += 1 + + self.model.set_value(iter_, self.COLUMN_PULSE, pulse) + self.model.set_value(iter_, self.COLUMN_ACTIVE, True) + + return True + + def create_model(self): + self.model = Gtk.ListStore(bool, + GObject.TYPE_INT, + str, + str, + GObject.TYPE_INT, + str, + bool, + bool) + + col = 0 + for bug in data: + if col == 1 or col == 3: + icon_name = 'battery-critical-charging-symbolic' + else: + icon_name = '' + if col == 3: + is_sensitive = False + else: + is_sensitive = True + + self.model.append([bug.is_fixed, + bug.number, + bug.severity, + bug.description, + 0, + icon_name, + False, + is_sensitive]) + col += 1 + + def add_columns(self, treeview): + model = treeview.get_model() + + # column for is_fixed toggle + renderer = Gtk.CellRendererToggle() + renderer.connect('toggled', self.is_fixed_toggled, model) + + column = Gtk.TreeViewColumn("Fixed?", renderer, + active=self.COLUMN_FIXED) + column.set_fixed_width(50) + column.set_sizing(Gtk.TreeViewColumnSizing.FIXED) + treeview.append_column(column) + + # column for severities + renderer = Gtk.CellRendererText() + column = Gtk.TreeViewColumn("Severity", renderer, + text=self.COLUMN_SEVERITY) + column.set_sort_column_id(self.COLUMN_SEVERITY) + treeview.append_column(column) + + # column for description + renderer = Gtk.CellRendererText() + column = Gtk.TreeViewColumn("Description", renderer, + text=self.COLUMN_DESCRIPTION) + column.set_sort_column_id(self.COLUMN_DESCRIPTION) + treeview.append_column(column) + + # column for spinner + renderer = Gtk.CellRendererSpinner() + column = Gtk.TreeViewColumn("Spinning", renderer, + pulse=self.COLUMN_PULSE, + active=self.COLUMN_ACTIVE) + column.set_sort_column_id(self.COLUMN_PULSE) + treeview.append_column(column) + + # column for symbolic icon + renderer = Gtk.CellRendererPixbuf() + renderer.props.follow_state = True + column = Gtk.TreeViewColumn("Symbolic icon", renderer, + icon_name=self.COLUMN_ICON, + sensitive=self.COLUMN_SENSITIVE) + column.set_sort_column_id(self.COLUMN_ICON) + treeview.append_column(column) + + def is_fixed_toggled(self, cell, path_str, model): + # get toggled iter + iter_ = model.get_iter(path_str) + is_fixed = model.get_value(iter_, self.COLUMN_FIXED) + + # do something with value + is_fixed ^= 1 + + model.set_value(iter_, self.COLUMN_FIXED, is_fixed) + + +def main(demoapp=None): + ListStoreApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/TreeView/treemodel_filelist.py b/examples/demo/demos/TreeView/treemodel_filelist.py new file mode 100644 index 0000000..82e6d95 --- /dev/null +++ b/examples/demo/demos/TreeView/treemodel_filelist.py @@ -0,0 +1,235 @@ +#!/usr/bin/env python + +title = "File List (GenericTreeModel)" +description = """ +This is a file list demo which makes use of the GenericTreeModel python +implementation of the Gtk.TreeModel interface. This demo shows what methods +need to be overridden to provide a valid TreeModel to a TreeView. +""" + +import os +import stat +import time + +import pygtkcompat +pygtkcompat.enable() +pygtkcompat.enable_gtk('3.0') + +import gtk + + +folderxpm = [ + "17 16 7 1", + " c #000000", + ". c #808000", + "X c yellow", + "o c #808080", + "O c #c0c0c0", + "+ c white", + "@ c None", + "@@@@@@@@@@@@@@@@@", + "@@@@@@@@@@@@@@@@@", + "@@+XXXX.@@@@@@@@@", + "@+OOOOOO.@@@@@@@@", + "@+OXOXOXOXOXOXO. ", + "@+XOXOXOXOXOXOX. ", + "@+OXOXOXOXOXOXO. ", + "@+XOXOXOXOXOXOX. ", + "@+OXOXOXOXOXOXO. ", + "@+XOXOXOXOXOXOX. ", + "@+OXOXOXOXOXOXO. ", + "@+XOXOXOXOXOXOX. ", + "@+OOOOOOOOOOOOO. ", + "@ ", + "@@@@@@@@@@@@@@@@@", + "@@@@@@@@@@@@@@@@@" + ] +folderpb = gtk.gdk.pixbuf_new_from_xpm_data(folderxpm) + +filexpm = [ + "12 12 3 1", + " c #000000", + ". c #ffff04", + "X c #b2c0dc", + "X XXX", + "X ...... XXX", + "X ...... X", + "X . ... X", + "X ........ X", + "X . .... X", + "X ........ X", + "X . .. X", + "X ........ X", + "X . .. X", + "X ........ X", + "X X" + ] +filepb = gtk.gdk.pixbuf_new_from_xpm_data(filexpm) + + +class FileListModel(gtk.GenericTreeModel): + __gtype_name__ = 'DemoFileListModel' + + column_types = (gtk.gdk.Pixbuf, str, int, str, str) + column_names = ['Name', 'Size', 'Mode', 'Last Changed'] + + def __init__(self, dname=None): + gtk.GenericTreeModel.__init__(self) + self._sort_column_id = 0 + self._sort_order = gtk.SORT_ASCENDING + + if not dname: + self.dirname = os.path.expanduser('~') + else: + self.dirname = os.path.abspath(dname) + self.files = ['..'] + [f for f in os.listdir(self.dirname)] + return + + def get_pathname(self, path): + filename = self.files[path[0]] + return os.path.join(self.dirname, filename) + + def is_folder(self, path): + filename = self.files[path[0]] + pathname = os.path.join(self.dirname, filename) + filestat = os.stat(pathname) + if stat.S_ISDIR(filestat.st_mode): + return True + return False + + def get_column_names(self): + return self.column_names[:] + + # + # GenericTreeModel Implementation + # + def on_get_flags(self): + return 0 # gtk.TREE_MODEL_ITERS_PERSIST + + def on_get_n_columns(self): + return len(self.column_types) + + def on_get_column_type(self, n): + return self.column_types[n] + + def on_get_iter(self, path): + return self.files[path[0]] + + def on_get_path(self, rowref): + return self.files.index(rowref) + + def on_get_value(self, rowref, column): + fname = os.path.join(self.dirname, rowref) + try: + filestat = os.stat(fname) + except OSError: + return None + mode = filestat.st_mode + if column == 0: + if stat.S_ISDIR(mode): + return folderpb + else: + return filepb + elif column == 1: + return rowref + elif column == 2: + return filestat.st_size + elif column == 3: + return oct(stat.S_IMODE(mode)) + return time.ctime(filestat.st_mtime) + + def on_iter_next(self, rowref): + try: + i = self.files.index(rowref) + 1 + return self.files[i] + except IndexError: + return None + + def on_iter_children(self, rowref): + if rowref: + return None + return self.files[0] + + def on_iter_has_child(self, rowref): + return False + + def on_iter_n_children(self, rowref): + if rowref: + return 0 + return len(self.files) + + def on_iter_nth_child(self, rowref, n): + if rowref: + return None + try: + return self.files[n] + except IndexError: + return None + + def on_iter_parent(child): + return None + + +class GenericTreeModelExample: + def delete_event(self, widget, event, data=None): + gtk.main_quit() + return False + + def __init__(self): + # Create a new window + self.window = gtk.Window(type=gtk.WINDOW_TOPLEVEL) + + self.window.set_size_request(300, 200) + + self.window.connect("delete_event", self.delete_event) + + self.listmodel = FileListModel() + + # create the TreeView + self.treeview = gtk.TreeView() + + self.tvcolumns = [] + + # create the TreeViewColumns to display the data + for n, name in enumerate(self.listmodel.get_column_names()): + if n == 0: + cellpb = gtk.CellRendererPixbuf() + col = gtk.TreeViewColumn(name, cellpb, pixbuf=0) + cell = gtk.CellRendererText() + col.pack_start(cell, False) + col.add_attribute(cell, 'text', 1) + else: + cell = gtk.CellRendererText() + col = gtk.TreeViewColumn(name, cell, text=n + 1) + if n == 1: + cell.set_property('xalign', 1.0) + + self.treeview.append_column(col) + + self.treeview.connect('row-activated', self.open_file) + + self.scrolledwindow = gtk.ScrolledWindow() + self.scrolledwindow.add(self.treeview) + self.window.add(self.scrolledwindow) + self.treeview.set_model(self.listmodel) + self.window.set_title(self.listmodel.dirname) + self.window.show_all() + + def open_file(self, treeview, path, column): + model = treeview.get_model() + if model.is_folder(path): + pathname = model.get_pathname(path) + new_model = FileListModel(pathname) + self.window.set_title(new_model.dirname) + treeview.set_model(new_model) + return + + +def main(demoapp=None): + demo = GenericTreeModelExample() + demo + gtk.main() + + +if __name__ == "__main__": + main() diff --git a/examples/demo/demos/TreeView/treemodel_filetree.py b/examples/demo/demos/TreeView/treemodel_filetree.py new file mode 100644 index 0000000..eb8e2b9 --- /dev/null +++ b/examples/demo/demos/TreeView/treemodel_filetree.py @@ -0,0 +1,280 @@ +#!/usr/bin/env python + +title = "File Tree (GenericTreeModel)" +description = """ +This is a file list demo which makes use of the GenericTreeModel python +implementation of the Gtk.TreeModel interface. This demo shows what methods +need to be overridden to provide a valid TreeModel to a TreeView. +""" + +import os +import stat +import time +from collections import OrderedDict + +import pygtkcompat +pygtkcompat.enable_gtk('3.0') + +import gtk + + +folderxpm = [ + "17 16 7 1", + " c #000000", + ". c #808000", + "X c yellow", + "o c #808080", + "O c #c0c0c0", + "+ c white", + "@ c None", + "@@@@@@@@@@@@@@@@@", + "@@@@@@@@@@@@@@@@@", + "@@+XXXX.@@@@@@@@@", + "@+OOOOOO.@@@@@@@@", + "@+OXOXOXOXOXOXO. ", + "@+XOXOXOXOXOXOX. ", + "@+OXOXOXOXOXOXO. ", + "@+XOXOXOXOXOXOX. ", + "@+OXOXOXOXOXOXO. ", + "@+XOXOXOXOXOXOX. ", + "@+OXOXOXOXOXOXO. ", + "@+XOXOXOXOXOXOX. ", + "@+OOOOOOOOOOOOO. ", + "@ ", + "@@@@@@@@@@@@@@@@@", + "@@@@@@@@@@@@@@@@@" + ] +folderpb = gtk.gdk.pixbuf_new_from_xpm_data(folderxpm) + +filexpm = [ + "12 12 3 1", + " c #000000", + ". c #ffff04", + "X c #b2c0dc", + "X XXX", + "X ...... XXX", + "X ...... X", + "X . ... X", + "X ........ X", + "X . .... X", + "X ........ X", + "X . .. X", + "X ........ X", + "X . .. X", + "X ........ X", + "X X" + ] +filepb = gtk.gdk.pixbuf_new_from_xpm_data(filexpm) + + +class FileTreeModel(gtk.GenericTreeModel): + __gtype_name__ = 'DemoFileTreeModel' + + column_types = (gtk.gdk.Pixbuf, str, int, str, str) + column_names = ['Name', 'Size', 'Mode', 'Last Changed'] + + def __init__(self, dname=None): + gtk.GenericTreeModel.__init__(self) + if not dname: + self.dirname = os.path.expanduser('~') + else: + self.dirname = os.path.abspath(dname) + self.files = self.build_file_dict(self.dirname) + return + + def build_file_dict(self, dirname): + """ + :Returns: + A dictionary containing the files in the given dirname keyed by filename. + If the child filename is a sub-directory, the dict value is a dict. + Otherwise it will be None. + """ + d = OrderedDict() + for fname in os.listdir(dirname): + try: + filestat = os.stat(os.path.join(dirname, fname)) + except OSError: + d[fname] = None + else: + d[fname] = OrderedDict() if stat.S_ISDIR(filestat.st_mode) else None + + return d + + def get_node_from_treepath(self, path): + """ + :Returns: + The node stored at the given tree path in local storage. + """ + # TreePaths are a series of integer indices so just iterate through them + # and index values by each integer since we are using an OrderedDict + if path is None: + path = [] + node = self.files + for index in path: + node = list(node.values())[index] + return node + + def get_node_from_filepath(self, filepath): + """ + :Returns: + The node stored at the given file path in local storage. + """ + if not filepath: + return self.files + node = self.files + for key in filepath.split(os.path.sep): + node = node[key] + return node + + def get_column_names(self): + return self.column_names[:] + + # + # GenericTreeModel Implementation + # + + def on_get_flags(self): + return 0 + + def on_get_n_columns(self): + return len(self.column_types) + + def on_get_column_type(self, n): + return self.column_types[n] + + def on_get_path(self, relpath): + path = [] + node = self.files + for key in relpath.split(os.path.sep): + path.append(list(node.keys()).index(key)) + node = node[key] + return path + + def on_get_value(self, relpath, column): + fname = os.path.join(self.dirname, relpath) + try: + filestat = os.stat(fname) + except OSError: + return None + mode = filestat.st_mode + if column == 0: + if stat.S_ISDIR(mode): + return folderpb + else: + return filepb + elif column == 1: + return os.path.basename(relpath) + elif column == 2: + return filestat.st_size + elif column == 3: + return oct(stat.S_IMODE(mode)) + return time.ctime(filestat.st_mtime) + + def on_get_iter(self, path): + filepath = '' + value = self.files + for index in path: + filepath = os.path.join(filepath, list(value.keys())[index]) + value = list(value.values())[index] + return filepath + + def on_iter_next(self, filepath): + parent_path, child_path = os.path.split(filepath) + parent = self.get_node_from_filepath(parent_path) + + # Index of filepath within its parents child list + sibling_names = list(parent.keys()) + index = sibling_names.index(child_path) + try: + return os.path.join(parent_path, sibling_names[index + 1]) + except IndexError: + return None + + def on_iter_children(self, filepath): + if filepath: + children = list(self.get_node_from_filepath(filepath).keys()) + if children: + return os.path.join(filepath, children[0]) + elif self.files: + return list(self.files.keys())[0] + + return None + + def on_iter_has_child(self, filepath): + return bool(self.get_node_from_filepath(filepath)) + + def on_iter_n_children(self, filepath): + return len(self.get_node_from_filepath(filepath)) + + def on_iter_nth_child(self, filepath, n): + try: + child = list(self.get_node_from_filepath(filepath).keys())[n] + if filepath: + return os.path.join(filepath, child) + else: + return child + except IndexError: + return None + + def on_iter_parent(self, filepath): + return os.path.dirname(filepath) + + def on_ref_node(self, filepath): + value = self.get_node_from_filepath(filepath) + if value is not None: + value.update(self.build_file_dict(os.path.join(self.dirname, filepath))) + + def on_unref_node(self, filepath): + pass + + +class GenericTreeModelExample: + def delete_event(self, widget, event, data=None): + gtk.main_quit() + return False + + def __init__(self): + # Create a new window + self.window = gtk.Window(type=gtk.WINDOW_TOPLEVEL) + self.window.set_size_request(300, 200) + self.window.connect("delete_event", self.delete_event) + + self.listmodel = FileTreeModel() + + # create the TreeView + self.treeview = gtk.TreeView() + + # create the TreeViewColumns to display the data + column_names = self.listmodel.get_column_names() + self.tvcolumn = [None] * len(column_names) + cellpb = gtk.CellRendererPixbuf() + self.tvcolumn[0] = gtk.TreeViewColumn(column_names[0], + cellpb, pixbuf=0) + cell = gtk.CellRendererText() + self.tvcolumn[0].pack_start(cell, False) + self.tvcolumn[0].add_attribute(cell, 'text', 1) + self.treeview.append_column(self.tvcolumn[0]) + for n in range(1, len(column_names)): + cell = gtk.CellRendererText() + if n == 1: + cell.set_property('xalign', 1.0) + self.tvcolumn[n] = gtk.TreeViewColumn(column_names[n], + cell, text=n + 1) + self.treeview.append_column(self.tvcolumn[n]) + + self.scrolledwindow = gtk.ScrolledWindow() + self.scrolledwindow.add(self.treeview) + self.window.add(self.scrolledwindow) + self.treeview.set_model(self.listmodel) + self.window.set_title(self.listmodel.dirname) + self.window.show_all() + + +def main(demoapp=None): + demo = GenericTreeModelExample() + demo + gtk.main() + + +if __name__ == "__main__": + main() diff --git a/examples/demo/demos/TreeView/treemodel_large.py b/examples/demo/demos/TreeView/treemodel_large.py new file mode 100644 index 0000000..b129521 --- /dev/null +++ b/examples/demo/demos/TreeView/treemodel_large.py @@ -0,0 +1,143 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# pygobject - Python bindings for the GObject library +# Copyright (C) 2014 Simon Feltman +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +title = "Tree Model with Large Data" +description = """ +Implementation of the Gtk.TreeModel interface to create a custom model. +The demo uses a fake data store (it is not backed by a Python list) and is for +the purpose of showing how to override the TreeModel interfaces virtual methods. +""" + +from gi.repository import GObject +from gi.repository import GLib +from gi.repository import Gtk + + +class Model(GObject.Object, Gtk.TreeModel): + columns_types = (str, str) + item_count = 100000 + item_data = 'abcdefghijklmnopqrstuvwxyz' + + def __init__(self): + super(Model, self).__init__() + + def do_get_flags(self): + return Gtk.TreeModelFlags.LIST_ONLY + + def do_get_n_columns(self): + return len(self.columns_types) + + def do_get_column_type(self, n): + return self.columns_types[n] + + def do_get_iter(self, path): + # Return False and an empty iter when out of range + index = path.get_indices()[0] + if index < 0 or index >= self.item_count: + return False, None + + it = Gtk.TreeIter() + it.user_data = index + return True, it + + def do_get_path(self, it): + return Gtk.TreePath([it.user_data]) + + def do_get_value(self, it, column): + if column == 0: + return str(it.user_data) + elif column == 1: + return self.item_data + + def do_iter_next(self, it): + # Return False if there is not a next item + next = it.user_data + 1 + if next >= self.item_count: + return False + + # Set the iters data and return True + it.user_data = next + return True + + def do_iter_previous(self, it): + prev = it.user_data - 1 + if prev < 0: + return False + + it.user_data = prev + return True + + def do_iter_children(self, parent): + # If parent is None return the first item + if parent is None: + it = Gtk.TreeIter() + it.user_data = 0 + return True, it + return False, None + + def do_iter_has_child(self, it): + return it is None + + def do_iter_n_children(self, it): + # If iter is None, return the number of top level nodes + if it is None: + return self.item_count + return 0 + + def do_iter_nth_child(self, parent, n): + if parent is not None or n >= self.item_count: + return False, None + elif parent is None: + # If parent is None, return the nth iter + it = Gtk.TreeIter() + it.user_data = n + return True, it + + def do_iter_parent(self, child): + return False, None + + +def main(demoapp=None): + model = Model() + # Use fixed-height-mode to get better model load and display performance. + view = Gtk.TreeView(fixed_height_mode=True, headers_visible=False) + column = Gtk.TreeViewColumn() + column.props.sizing = Gtk.TreeViewColumnSizing.FIXED + + renderer1 = Gtk.CellRendererText() + renderer2 = Gtk.CellRendererText() + column.pack_start(renderer1, expand=True) + column.pack_start(renderer2, expand=True) + column.add_attribute(renderer1, 'text', 0) + column.add_attribute(renderer2, 'text', 1) + view.append_column(column) + + scrolled = Gtk.ScrolledWindow() + scrolled.add(view) + + window = Gtk.Window(title=title) + window.set_size_request(480, 640) + window.add(scrolled) + window.show_all() + GLib.timeout_add(10, lambda *args: view.set_model(model)) + return window + + +if __name__ == "__main__": + window = main() + window.connect('destroy', Gtk.main_quit) + Gtk.main() diff --git a/examples/demo/demos/__init__.py b/examples/demo/demos/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/demo/demos/appwindow.py b/examples/demo/demos/appwindow.py new file mode 100644 index 0000000..edac467 --- /dev/null +++ b/examples/demo/demos/appwindow.py @@ -0,0 +1,408 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Application main window" +description = """ +Demonstrates a typical application window with menubar, toolbar, statusbar. +""" + +import os + +from gi.repository import GdkPixbuf, Gtk + + +infobar = None +window = None +messagelabel = None +_demoapp = None + + +def widget_destroy(widget, button): + widget.destroy() + + +def activate_action(action, user_data=None): + global window + + name = action.get_name() + _type = type(action) + if name == 'DarkTheme': + value = action.get_active() + settings = Gtk.Settings.get_default() + settings.set_property('gtk-application-prefer-dark-theme', value) + return + + dialog = Gtk.MessageDialog(message_type=Gtk.MessageType.INFO, + buttons=Gtk.ButtonsType.CLOSE, + text='You activated action: "%s" of type %s' % (name, _type)) + + # FIXME: this should be done in the constructor + dialog.set_transient_for(window) + dialog.connect('response', widget_destroy) + dialog.show() + + +def activate_radio_action(action, current, user_data=None): + global infobar + global messagelabel + + name = current.get_name() + _type = type(current) + active = current.get_active() + value = current.get_current_value() + if active: + text = 'You activated radio action: "%s" of type %s.\n Current value: %d' % (name, _type, value) + messagelabel.set_text(text) + infobar.set_message_type(Gtk.MessageType(value)) + infobar.show() + + +def update_statusbar(buffer, statusbar): + statusbar.pop(0) + count = buffer.get_char_count() + + iter = buffer.get_iter_at_mark(buffer.get_insert()) + row = iter.get_line() + col = iter.get_line_offset() + msg = 'Cursor at row %d column %d - %d chars in document' % (row, col, count) + + statusbar.push(0, msg) + + +def mark_set_callback(buffer, new_location, mark, data): + update_statusbar(buffer, data) + + +def about_cb(widget, user_data=None): + global window + + authors = ['John (J5) Palmieri', + 'Tomeu Vizoso', + 'and many more...'] + + documentors = ['David Malcolm', + 'Zack Goldberg', + 'and many more...'] + + license = """ +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the Gnome Library; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. +""" + dirname = os.path.abspath(os.path.dirname(__file__)) + filename = os.path.join(dirname, 'data', 'gtk-logo-rgb.gif') + pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) + transparent = pixbuf.add_alpha(True, 0xff, 0xff, 0xff) + + about = Gtk.AboutDialog(parent=window, + program_name='GTK Code Demos', + version='0.1', + copyright='(C) 2010 The PyGI Team', + license=license, + website='http://live.gnome.org/PyGI', + comments='Program to demonstrate PyGI functions.', + authors=authors, + documenters=documentors, + logo=transparent, + title='About GTK Code Demos') + + about.connect('response', widget_destroy) + about.show() + + +action_entries = ( + ("FileMenu", None, "_File"), # name, stock id, label + ("OpenMenu", None, "_Open"), # name, stock id, label + ("PreferencesMenu", None, "_Preferences"), # name, stock id, label + ("ColorMenu", None, "_Color"), # name, stock id, label + ("ShapeMenu", None, "_Shape"), # name, stock id, label + ("HelpMenu", None, "_Help"), # name, stock id, label + ("New", Gtk.STOCK_NEW, # name, stock id + "_New", "N", # label, accelerator + "Create a new file", # tooltip + activate_action), + ("File1", None, # name, stock id + "File1", None, # label, accelerator + "Open first file", # tooltip + activate_action), + ("Save", Gtk.STOCK_SAVE, # name, stock id + "_Save", "S", # label, accelerator + "Save current file", # tooltip + activate_action), + ("SaveAs", Gtk.STOCK_SAVE, # name, stock id + "Save _As...", None, # label, accelerator + "Save to a file", # tooltip + activate_action), + ("Quit", Gtk.STOCK_QUIT, # name, stock id + "_Quit", "Q", # label, accelerator + "Quit", # tooltip + activate_action), + ("About", None, # name, stock id + "_About", "A", # label, accelerator + "About", # tooltip + about_cb), + ("Logo", "demo-gtk-logo", # name, stock id + None, None, # label, accelerator + "GTK", # tooltip + activate_action), +) + +toggle_action_entries = ( + ("Bold", Gtk.STOCK_BOLD, # name, stock id + "_Bold", "B", # label, accelerator + "Bold", # tooltip + activate_action, + True), # is_active + ("DarkTheme", None, # name, stock id + "_Prefer Dark Theme", None, # label, accelerator + "Prefer Dark Theme", # tooltip + activate_action, + False), # is_active +) + +(COLOR_RED, + COLOR_GREEN, + COLOR_BLUE) = range(3) + +color_action_entries = ( + ("Red", None, # name, stock id + "_Red", "R", # label, accelerator + "Blood", COLOR_RED), # tooltip, value + ("Green", None, # name, stock id + "_Green", "G", # label, accelerator + "Grass", COLOR_GREEN), # tooltip, value + ("Blue", None, # name, stock id + "_Blue", "B", # label, accelerator + "Sky", COLOR_BLUE), # tooltip, value +) + +(SHAPE_SQUARE, + SHAPE_RECTANGLE, + SHAPE_OVAL) = range(3) + +shape_action_entries = ( + ("Square", None, # name, stock id + "_Square", "S", # label, accelerator + "Square", SHAPE_SQUARE), # tooltip, value + ("Rectangle", None, # name, stock id + "_Rectangle", "R", # label, accelerator + "Rectangle", SHAPE_RECTANGLE), # tooltip, value + ("Oval", None, # name, stock id + "_Oval", "O", # label, accelerator + "Egg", SHAPE_OVAL), # tooltip, value +) + +ui_info = """ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""" + + +def _quit(*args): + Gtk.main_quit() + + +def register_stock_icons(): + """ + This function registers our custom toolbar icons, so they can be themed. + It's totally optional to do this, you could just manually insert icons + and have them not be themeable, especially if you never expect people + to theme your app. + """ + ''' + item = Gtk.StockItem() + item.stock_id = 'demo-gtk-logo' + item.label = '_GTK!' + item.modifier = 0 + item.keyval = 0 + item.translation_domain = None + + Gtk.stock_add(item, 1) + ''' + global _demoapp + + factory = Gtk.IconFactory() + factory.add_default() + + if _demoapp is None: + filename = os.path.join('data', 'gtk-logo-rgb.gif') + else: + filename = _demoapp.find_file('gtk-logo-rgb.gif') + + pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) + transparent = pixbuf.add_alpha(True, 0xff, 0xff, 0xff) + icon_set = Gtk.IconSet.new_from_pixbuf(transparent) + + factory.add('demo-gtk-logo', icon_set) + + +class ToolMenuAction(Gtk.Action): + __gtype_name__ = "GtkToolMenuAction" + + def do_create_tool_item(self): + return Gtk.MenuToolButton() + + +def main(demoapp=None): + global infobar + global window + global messagelabel + global _demoapp + + _demoapp = demoapp + + register_stock_icons() + + window = Gtk.Window() + window.set_title('Application Window') + window.set_icon_name('gtk-open') + window.connect_after('destroy', _quit) + table = Gtk.Table(n_rows=1, + n_columns=5, + homogeneous=False) + window.add(table) + + action_group = Gtk.ActionGroup(name='AppWindowActions') + open_action = ToolMenuAction(name='Open', + stock_id=Gtk.STOCK_OPEN, + label='_Open', + tooltip='Open a file') + + action_group.add_action(open_action) + action_group.add_actions(action_entries) + action_group.add_toggle_actions(toggle_action_entries) + action_group.add_radio_actions(color_action_entries, + COLOR_RED, + activate_radio_action) + action_group.add_radio_actions(shape_action_entries, + SHAPE_SQUARE, + activate_radio_action) + + merge = Gtk.UIManager() + merge.insert_action_group(action_group, 0) + window.add_accel_group(merge.get_accel_group()) + + merge.add_ui_from_string(ui_info) + + bar = merge.get_widget('/MenuBar') + bar.show() + table.attach(bar, 0, 1, 0, 1, + Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, + 0, 0, 0) + + bar = merge.get_widget('/ToolBar') + bar.show() + table.attach(bar, 0, 1, 1, 2, + Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, + 0, 0, 0) + + infobar = Gtk.InfoBar() + infobar.set_no_show_all(True) + messagelabel = Gtk.Label() + messagelabel.show() + infobar.get_content_area().pack_start(messagelabel, True, True, 0) + infobar.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK) + infobar.connect('response', lambda a, b: Gtk.Widget.hide(a)) + + table.attach(infobar, 0, 1, 2, 3, + Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, + 0, 0, 0) + + sw = Gtk.ScrolledWindow(hadjustment=None, + vadjustment=None) + sw.set_shadow_type(Gtk.ShadowType.IN) + table.attach(sw, 0, 1, 3, 4, + Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, + Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, + 0, 0) + + contents = Gtk.TextView() + contents.grab_focus() + sw.add(contents) + + # Create statusbar + statusbar = Gtk.Statusbar() + table.attach(statusbar, 0, 1, 4, 5, + Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, + 0, 0, 0) + + # show text widget info in the statusbar + buffer = contents.get_buffer() + buffer.connect('changed', update_statusbar, statusbar) + buffer.connect('mark_set', mark_set_callback, statusbar) + + update_statusbar(buffer, statusbar) + + window.set_default_size(200, 200) + window.show_all() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/assistant.py b/examples/demo/demos/assistant.py new file mode 100644 index 0000000..9e729e9 --- /dev/null +++ b/examples/demo/demos/assistant.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Assistant" +description = """ +Demonstrates a sample multistep assistant. Assistants are used to divide +an operation into several simpler sequential steps, and to guide the user +through these steps. +""" + + +from gi.repository import Gtk + + +class AssistantApp: + def __init__(self): + self.assistant = Gtk.Assistant() + self.assistant.set_default_size(-1, 300) + + self.create_page1() + self.create_page2() + self.create_page3() + + self.assistant.connect('cancel', self.on_close_cancel) + self.assistant.connect('close', self.on_close_cancel) + self.assistant.connect('apply', self.on_apply) + self.assistant.connect('prepare', self.on_prepare) + + self.assistant.show() + + def on_close_cancel(self, assistant): + assistant.destroy() + Gtk.main_quit() + + def on_apply(self, assistant): + # apply changes here; this is a fictional example so just do + # nothing here + pass + + def on_prepare(self, assistant, page): + current_page = assistant.get_current_page() + n_pages = assistant.get_n_pages() + title = 'Sample assistant (%d of %d)' % (current_page + 1, n_pages) + assistant.set_title(title) + + def on_entry_changed(self, widget): + page_number = self.assistant.get_current_page() + current_page = self.assistant.get_nth_page(page_number) + text = widget.get_text() + + if text: + self.assistant.set_page_complete(current_page, True) + else: + self.assistant.set_page_complete(current_page, False) + + def create_page1(self): + box = Gtk.HBox(homogeneous=False, + spacing=12) + box.set_border_width(12) + label = Gtk.Label(label='You must fill out this entry to continue:') + box.pack_start(label, False, False, 0) + + entry = Gtk.Entry() + box.pack_start(entry, True, True, 0) + entry.connect('changed', self.on_entry_changed) + + box.show_all() + self.assistant.append_page(box) + self.assistant.set_page_title(box, 'Page 1') + self.assistant.set_page_type(box, Gtk.AssistantPageType.INTRO) + + pixbuf = self.assistant.render_icon(Gtk.STOCK_DIALOG_INFO, + Gtk.IconSize.DIALOG, + None) + + self.assistant.set_page_header_image(box, pixbuf) + + def create_page2(self): + box = Gtk.VBox(homogeneous=False, + spacing=12) + box.set_border_width(12) + + checkbutton = Gtk.CheckButton(label='This is optional data, you may continue even if you do not check this') + box.pack_start(checkbutton, False, False, 0) + + box.show_all() + + self.assistant.append_page(box) + self.assistant.set_page_complete(box, True) + self.assistant.set_page_title(box, 'Page 2') + + pixbuf = self.assistant.render_icon(Gtk.STOCK_DIALOG_INFO, + Gtk.IconSize.DIALOG, + None) + self.assistant.set_page_header_image(box, pixbuf) + + def create_page3(self): + label = Gtk.Label(label='This is a confirmation page, press "Apply" to apply changes') + label.show() + self.assistant.append_page(label) + self.assistant.set_page_complete(label, True) + self.assistant.set_page_title(label, 'Confirmation') + self.assistant.set_page_type(label, Gtk.AssistantPageType.CONFIRM) + + pixbuf = self.assistant.render_icon(Gtk.STOCK_DIALOG_INFO, + Gtk.IconSize.DIALOG, + None) + self.assistant.set_page_header_image(label, pixbuf) + + +def main(demoapp=None): + AssistantApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/builder.py b/examples/demo/demos/builder.py new file mode 100644 index 0000000..47e09a4 --- /dev/null +++ b/examples/demo/demos/builder.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Builder" +description = """ +Demonstrates an interface loaded from a XML description. +""" + + +import os + +from gi.repository import Gtk + + +class BuilderApp: + def __init__(self, demoapp): + self.demoapp = demoapp + + self.builder = Gtk.Builder() + if demoapp is None: + filename = os.path.join('data', 'demo.ui') + else: + filename = demoapp.find_file('demo.ui') + + self.builder.add_from_file(filename) + self.builder.connect_signals(self) + + window = self.builder.get_object('window1') + window.connect('destroy', lambda x: Gtk.main_quit()) + window.show_all() + + def about_activate(self, action): + about_dlg = self.builder.get_object('aboutdialog1') + about_dlg.run() + about_dlg.hide() + + def quit_activate(self, action): + Gtk.main_quit() + + +def main(demoapp=None): + BuilderApp(demoapp) + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/button_box.py b/examples/demo/demos/button_box.py new file mode 100644 index 0000000..be94984 --- /dev/null +++ b/examples/demo/demos/button_box.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Button Boxes" +description = """ +The Button Box widgets are used to arrange buttons with padding. +""" + + +from gi.repository import Gtk + + +class ButtonBoxApp: + def __init__(self): + window = Gtk.Window() + window.set_title('Button Boxes') + window.connect('destroy', lambda x: Gtk.main_quit()) + window.set_border_width(10) + + main_vbox = Gtk.VBox(homogeneous=False, spacing=0) + window.add(main_vbox) + + frame_horz = Gtk.Frame(label='Horizontal Button Boxes') + main_vbox.pack_start(frame_horz, True, True, 10) + + vbox = Gtk.VBox(homogeneous=False, spacing=0) + vbox.set_border_width(10) + frame_horz.add(vbox) + + vbox.pack_start( + self.create_bbox(True, 'Spread', 40, Gtk.ButtonBoxStyle.SPREAD), + True, True, 0) + + vbox.pack_start( + self.create_bbox(True, 'Edge', 40, Gtk.ButtonBoxStyle.EDGE), + True, True, 5) + + vbox.pack_start( + self.create_bbox(True, 'Start', 40, Gtk.ButtonBoxStyle.START), + True, True, 5) + + vbox.pack_start( + self.create_bbox(True, 'End', 40, Gtk.ButtonBoxStyle.END), + True, True, 5) + + frame_vert = Gtk.Frame(label='Vertical Button Boxes') + main_vbox.pack_start(frame_vert, True, True, 10) + + hbox = Gtk.HBox(homogeneous=False, spacing=0) + hbox.set_border_width(10) + frame_vert.add(hbox) + + hbox.pack_start( + self.create_bbox(False, 'Spread', 30, Gtk.ButtonBoxStyle.SPREAD), + True, True, 0) + + hbox.pack_start( + self.create_bbox(False, 'Edge', 30, Gtk.ButtonBoxStyle.EDGE), + True, True, 5) + + hbox.pack_start( + self.create_bbox(False, 'Start', 30, Gtk.ButtonBoxStyle.START), + True, True, 5) + + hbox.pack_start( + self.create_bbox(False, 'End', 30, Gtk.ButtonBoxStyle.END), + True, True, 5) + + window.show_all() + + def create_bbox(self, is_horizontal, title, spacing, layout): + frame = Gtk.Frame(label=title) + + if is_horizontal: + bbox = Gtk.HButtonBox() + else: + bbox = Gtk.VButtonBox() + + bbox.set_border_width(5) + frame.add(bbox) + + bbox.set_layout(layout) + bbox.set_spacing(spacing) + + # FIXME: GtkButton consturctor should take a stock_id + button = Gtk.Button.new_from_stock(Gtk.STOCK_OK) + bbox.add(button) + + button = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL) + bbox.add(button) + + button = Gtk.Button.new_from_stock(Gtk.STOCK_HELP) + bbox.add(button) + + return frame + + +def main(demoapp=None): + ButtonBoxApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/clipboard.py b/examples/demo/demos/clipboard.py new file mode 100644 index 0000000..5a88828 --- /dev/null +++ b/examples/demo/demos/clipboard.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Clipboard" +description = """ +GtkClipboard is used for clipboard handling. This demo shows how to +copy and paste text to and from the clipboard. + +It also shows how to transfer images via the clipboard or via +drag-and-drop, and how to make clipboard contents persist after +the application exits. Clipboard persistence requires a clipboard +manager to run. +""" + + +from gi.repository import Gtk, Gdk + + +class ClipboardApp: + def __init__(self): + self.window = Gtk.Window() + self.window.set_title('Clipboard demo') + self.window.connect('destroy', lambda w: Gtk.main_quit()) + + vbox = Gtk.VBox(homogeneous=False, spacing=0) + vbox.set_border_width(8) + self.window.add(vbox) + + label = Gtk.Label(label='"Copy" will copy the text\nin the entry to the clipboard') + vbox.pack_start(label, False, False, 0) + + hbox = Gtk.HBox(homogeneous=False, spacing=4) + hbox.set_border_width(8) + vbox.pack_start(hbox, False, False, 0) + + # create first entry + entry = Gtk.Entry() + hbox.pack_start(entry, True, True, 0) + + # create button + button = Gtk.Button.new_from_stock(Gtk.STOCK_COPY) + hbox.pack_start(button, False, False, 0) + button.connect('clicked', self.copy_button_clicked, entry) + + label = Gtk.Label(label='"Paste" will paste the text from the clipboard to the entry') + vbox.pack_start(label, False, False, 0) + + hbox = Gtk.HBox(homogeneous=False, spacing=4) + hbox.set_border_width(8) + vbox.pack_start(hbox, False, False, 0) + + # create secondary entry + entry = Gtk.Entry() + hbox.pack_start(entry, True, True, 0) + # create button + button = Gtk.Button.new_from_stock(Gtk.STOCK_PASTE) + hbox.pack_start(button, False, False, 0) + button.connect('clicked', self.paste_button_clicked, entry) + + label = Gtk.Label(label='Images can be transferred via the clipboard, too') + vbox.pack_start(label, False, False, 0) + + hbox = Gtk.HBox(homogeneous=False, spacing=4) + hbox.set_border_width(8) + vbox.pack_start(hbox, False, False, 0) + + # create the first image + image = Gtk.Image(stock=Gtk.STOCK_DIALOG_WARNING, + icon_size=Gtk.IconSize.BUTTON) + + ebox = Gtk.EventBox() + ebox.add(image) + hbox.add(ebox) + + # make ebox a drag source + ebox.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, + None, Gdk.DragAction.COPY) + ebox.drag_source_add_image_targets() + ebox.connect('drag-begin', self.drag_begin, image) + ebox.connect('drag-data-get', self.drag_data_get, image) + + # accept drops on ebox + ebox.drag_dest_set(Gtk.DestDefaults.ALL, + None, Gdk.DragAction.COPY) + ebox.drag_dest_add_image_targets() + ebox.connect('drag-data-received', self.drag_data_received, image) + + # context menu on ebox + ebox.connect('button-press-event', self.button_press, image) + + # create the second image + image = Gtk.Image(stock=Gtk.STOCK_STOP, + icon_size=Gtk.IconSize.BUTTON) + + ebox = Gtk.EventBox() + ebox.add(image) + hbox.add(ebox) + + # make ebox a drag source + ebox.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, + None, Gdk.DragAction.COPY) + ebox.drag_source_add_image_targets() + ebox.connect('drag-begin', self.drag_begin, image) + ebox.connect('drag-data-get', self.drag_data_get, image) + + # accept drops on ebox + ebox.drag_dest_set(Gtk.DestDefaults.ALL, + None, Gdk.DragAction.COPY) + ebox.drag_dest_add_image_targets() + ebox.connect('drag-data-received', self.drag_data_received, image) + + # context menu on ebox + ebox.connect('button-press-event', self.button_press, image) + + # tell the clipboard manager to make data persistent + # FIXME: Allow sending strings a Atoms and convert in PyGI + atom = Gdk.atom_intern('CLIPBOARD', True) + clipboard = Gtk.Clipboard.get(atom) + clipboard.set_can_store(None) + + self.window.show_all() + + def copy_button_clicked(self, button, entry): + # get the default clipboard + atom = Gdk.atom_intern('CLIPBOARD', True) + clipboard = entry.get_clipboard(atom) + + # set the clipboard's text + # FIXME: don't require passing length argument + clipboard.set_text(entry.get_text(), -1) + + def paste_received(self, clipboard, text, entry): + if text is not None: + entry.set_text(text) + + def paste_button_clicked(self, button, entry): + # get the default clipboard + atom = Gdk.atom_intern('CLIPBOARD', True) + clipboard = entry.get_clipboard(atom) + + # set the clipboard's text + clipboard.request_text(self.paste_received, entry) + + def get_image_pixbuf(self, image): + # FIXME: We should hide storage types in an override + storage_type = image.get_storage_type() + if storage_type == Gtk.ImageType.PIXBUF: + return image.get_pixbuf() + elif storage_type == Gtk.ImageType.STOCK: + (stock_id, size) = image.get_stock() + return image.render_icon(stock_id, size, None) + + return None + + def drag_begin(self, widget, context, data): + pixbuf = self.get_image_pixbuf(data) + Gtk.drag_set_icon_pixbuf(context, pixbuf, -2, -2) + + def drag_data_get(self, widget, context, selection_data, info, time, data): + pixbuf = self.get_image_pixbuf(data) + selection_data.set_pixbuf(pixbuf) + + def drag_data_received(self, widget, context, x, y, selection_data, info, time, data): + if selection_data.get_length() > 0: + pixbuf = selection_data.get_pixbuf() + data.set_from_pixbuf(pixbuf) + + def copy_image(self, item, data): + # get the default clipboard + atom = Gdk.atom_intern('CLIPBOARD', True) + clipboard = Gtk.Clipboard.get(atom) + pixbuf = self.get_image_pixbuf(data) + + clipboard.set_image(pixbuf) + + def paste_image(self, item, data): + # get the default clipboard + atom = Gdk.atom_intern('CLIPBOARD', True) + clipboard = Gtk.Clipboard.get(atom) + pixbuf = clipboard.wait_for_image() + + if pixbuf is not None: + data.set_from_pixbuf(pixbuf) + + def button_press(self, widget, event, data): + if event.button != 3: + return False + + self.menu = Gtk.Menu() + + item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_COPY, None) + item.connect('activate', self.copy_image, data) + item.show() + self.menu.append(item) + + item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PASTE, None) + item.connect('activate', self.paste_image, data) + item.show() + self.menu.append(item) + + self.menu.popup(None, None, None, None, event.button, event.time) + + +def main(demoapp=None): + ClipboardApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/colorselector.py b/examples/demo/demos/colorselector.py new file mode 100644 index 0000000..d05ca52 --- /dev/null +++ b/examples/demo/demos/colorselector.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Color Selector" +description = """ + GtkColorSelection lets the user choose a color. GtkColorSelectionDialog is + a prebuilt dialog containing a GtkColorSelection. + """ + + +from gi.repository import Gtk, Gdk + + +class ColorSelectorApp: + def __init__(self): + # FIXME: we should allow Gdk.Color to be allocated without parameters + # Also color doesn't seem to work + self.color = Gdk.RGBA() + self.color.red = 0 + self.color.blue = 1 + self.color.green = 0 + self.color.alpha = 1 + + self.window = Gtk.Window() + self.window.set_title('Color Selection') + self.window.set_border_width(8) + self.window.connect('destroy', lambda w: Gtk.main_quit()) + + vbox = Gtk.VBox(homogeneous=False, + spacing=8) + vbox.set_border_width(8) + self.window.add(vbox) + + # create color swatch area + frame = Gtk.Frame() + frame.set_shadow_type(Gtk.ShadowType.IN) + vbox.pack_start(frame, True, True, 0) + + self.da = Gtk.DrawingArea() + self.da.connect('draw', self.draw_cb) + + # set a minimum size + self.da.set_size_request(200, 200) + # set the color + self.da.override_background_color(0, self.color) + frame.add(self.da) + + alignment = Gtk.Alignment(xalign=1.0, + yalign=0.5, + xscale=0.0, + yscale=0.0) + + button = Gtk.Button(label='_Change the above color', + use_underline=True) + alignment.add(button) + vbox.pack_start(alignment, False, False, 0) + + button.connect('clicked', self.change_color_cb) + + self.window.show_all() + + def draw_cb(self, widget, cairo_ctx): + style = widget.get_style_context() + bg_color = style.get_background_color(0) + Gdk.cairo_set_source_rgba(cairo_ctx, bg_color) + cairo_ctx.paint() + + return True + + def change_color_cb(self, button): + dialog = Gtk.ColorSelectionDialog(title='Changing color') + dialog.set_transient_for(self.window) + + colorsel = dialog.get_color_selection() + colorsel.set_previous_rgba(self.color) + colorsel.set_current_rgba(self.color) + colorsel.set_has_palette(True) + + response = dialog.run() + + if response == Gtk.ResponseType.OK: + self.color = colorsel.get_current_rgba() + self.da.override_background_color(0, self.color) + + dialog.destroy() + + +def main(demoapp=None): + ColorSelectorApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/combobox.py b/examples/demo/demos/combobox.py new file mode 100644 index 0000000..1215f16 --- /dev/null +++ b/examples/demo/demos/combobox.py @@ -0,0 +1,319 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Combo boxes" +description = """ +The ComboBox widget allows to select one option out of a list. +The ComboBoxEntry additionally allows the user to enter a value +that is not in the list of options. + +How the options are displayed is controlled by cell renderers. + """ + + +from gi.repository import Gtk, Gdk, GdkPixbuf, GLib, GObject + + +(PIXBUF_COL, + TEXT_COL) = range(2) + + +class MaskEntry(Gtk.Entry): + __gtype_name__ = 'MaskEntry' + + def __init__(self, mask=None): + self.mask = mask + super(MaskEntry, self).__init__() + + self.connect('changed', self.changed_cb) + + self.error_color = Gdk.RGBA() + self.error_color.red = 1.0 + self.error_color.green = 0.9 + self.error_color_blue = 0.9 + self.error_color.alpha = 1.0 + + # workaround since override_color doesn't accept None yet + style_ctx = self.get_style_context() + self.normal_color = style_ctx.get_color(0) + + def set_background(self): + if self.mask: + if not GLib.regex_match_simple(self.mask, + self.get_text(), 0, 0): + self.override_color(0, self.error_color) + return + + self.override_color(0, self.normal_color) + + def changed_cb(self, entry): + self.set_background() + + +class ComboboxApp: + def __init__(self, demoapp): + self.demoapp = demoapp + + self.window = Gtk.Window() + self.window.set_title('Combo boxes') + self.window.set_border_width(10) + self.window.connect('destroy', lambda w: Gtk.main_quit()) + + vbox = Gtk.VBox(homogeneous=False, spacing=2) + self.window.add(vbox) + + frame = Gtk.Frame(label='Some stock icons') + vbox.pack_start(frame, False, False, 0) + + box = Gtk.VBox(homogeneous=False, spacing=0) + box.set_border_width(5) + frame.add(box) + + model = self.create_stock_icon_store() + combo = Gtk.ComboBox(model=model) + box.add(combo) + + renderer = Gtk.CellRendererPixbuf() + combo.pack_start(renderer, False) + + # FIXME: override set_attributes + combo.add_attribute(renderer, 'pixbuf', PIXBUF_COL) + combo.set_cell_data_func(renderer, self.set_sensitive, None) + + renderer = Gtk.CellRendererText() + combo.pack_start(renderer, True) + combo.add_attribute(renderer, 'text', TEXT_COL) + combo.set_cell_data_func(renderer, self.set_sensitive, None) + + combo.set_row_separator_func(self.is_separator, None) + combo.set_active(0) + + # a combobox demonstrating trees + frame = Gtk.Frame(label='Where are we ?') + vbox.pack_start(frame, False, False, 0) + + box = Gtk.VBox(homogeneous=False, spacing=0) + box.set_border_width(5) + frame.add(box) + + model = self.create_capital_store() + combo = Gtk.ComboBox(model=model) + box.add(combo) + + renderer = Gtk.CellRendererText() + combo.pack_start(renderer, True) + combo.add_attribute(renderer, 'text', 0) + combo.set_cell_data_func(renderer, self.is_capital_sensistive, None) + + # FIXME: make new_from_indices work + # make constructor take list or string of indices + path = Gtk.TreePath.new_from_string('0:8') + treeiter = model.get_iter(path) + combo.set_active_iter(treeiter) + + # A GtkComboBoxEntry with validation. + + frame = Gtk.Frame(label='Editable') + vbox.pack_start(frame, False, False, 0) + + box = Gtk.VBox(homogeneous=False, spacing=0) + box.set_border_width(5) + frame.add(box) + + combo = Gtk.ComboBoxText.new_with_entry() + self.fill_combo_entry(combo) + box.add(combo) + + entry = MaskEntry(mask='^([0-9]*|One|Two|2\302\275|Three)$') + + Gtk.Container.remove(combo, combo.get_child()) + combo.add(entry) + + # A combobox with string IDs + + frame = Gtk.Frame(label='String IDs') + vbox.pack_start(frame, False, False, 0) + + box = Gtk.VBox(homogeneous=False, spacing=0) + box.set_border_width(5) + frame.add(box) + + # FIXME: model is not setup when constructing Gtk.ComboBoxText() + # so we call new() - Gtk should fix this to setup the model + # in __init__, not in the constructor + combo = Gtk.ComboBoxText.new() + combo.append('never', 'Not visible') + combo.append('when-active', 'Visible when active') + combo.append('always', 'Always visible') + box.add(combo) + + entry = Gtk.Entry() + + combo.bind_property('active-id', + entry, 'text', + GObject.BindingFlags.BIDIRECTIONAL) + + box.add(entry) + self.window.show_all() + + def strip_underscore(self, s): + return s.replace('_', '') + + def create_stock_icon_store(self): + stock_id = (Gtk.STOCK_DIALOG_WARNING, + Gtk.STOCK_STOP, + Gtk.STOCK_NEW, + Gtk.STOCK_CLEAR, + None, + Gtk.STOCK_OPEN) + + cellview = Gtk.CellView() + store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) + + for id in stock_id: + if id is not None: + pixbuf = cellview.render_icon(id, Gtk.IconSize.BUTTON, None) + item = Gtk.stock_lookup(id) + label = self.strip_underscore(item.label) + store.append((pixbuf, label)) + else: + store.append((None, 'separator')) + + return store + + def set_sensitive(self, cell_layout, cell, tree_model, treeiter, data): + """ + A GtkCellLayoutDataFunc that demonstrates how one can control + sensitivity of rows. This particular function does nothing + useful and just makes the second row insensitive. + """ + + path = tree_model.get_path(treeiter) + indices = path.get_indices() + + sensitive = not (indices[0] == 1) + + cell.set_property('sensitive', sensitive) + + def is_separator(self, model, treeiter, data): + """ + A GtkTreeViewRowSeparatorFunc that demonstrates how rows can be + rendered as separators. This particular function does nothing + useful and just turns the fourth row into a separator. + """ + + path = model.get_path(treeiter) + + indices = path.get_indices() + result = (indices[0] == 4) + + return result + + def create_capital_store(self): + capitals = ( + {'group': 'A - B', 'capital': None}, + {'group': None, 'capital': 'Albany'}, + {'group': None, 'capital': 'Annapolis'}, + {'group': None, 'capital': 'Atlanta'}, + {'group': None, 'capital': 'Augusta'}, + {'group': None, 'capital': 'Austin'}, + {'group': None, 'capital': 'Baton Rouge'}, + {'group': None, 'capital': 'Bismarck'}, + {'group': None, 'capital': 'Boise'}, + {'group': None, 'capital': 'Boston'}, + {'group': 'C - D', 'capital': None}, + {'group': None, 'capital': 'Carson City'}, + {'group': None, 'capital': 'Charleston'}, + {'group': None, 'capital': 'Cheyeene'}, + {'group': None, 'capital': 'Columbia'}, + {'group': None, 'capital': 'Columbus'}, + {'group': None, 'capital': 'Concord'}, + {'group': None, 'capital': 'Denver'}, + {'group': None, 'capital': 'Des Moines'}, + {'group': None, 'capital': 'Dover'}, + {'group': 'E - J', 'capital': None}, + {'group': None, 'capital': 'Frankfort'}, + {'group': None, 'capital': 'Harrisburg'}, + {'group': None, 'capital': 'Hartford'}, + {'group': None, 'capital': 'Helena'}, + {'group': None, 'capital': 'Honolulu'}, + {'group': None, 'capital': 'Indianapolis'}, + {'group': None, 'capital': 'Jackson'}, + {'group': None, 'capital': 'Jefferson City'}, + {'group': None, 'capital': 'Juneau'}, + {'group': 'K - O', 'capital': None}, + {'group': None, 'capital': 'Lansing'}, + {'group': None, 'capital': 'Lincon'}, + {'group': None, 'capital': 'Little Rock'}, + {'group': None, 'capital': 'Madison'}, + {'group': None, 'capital': 'Montgomery'}, + {'group': None, 'capital': 'Montpelier'}, + {'group': None, 'capital': 'Nashville'}, + {'group': None, 'capital': 'Oklahoma City'}, + {'group': None, 'capital': 'Olympia'}, + {'group': 'P - S', 'capital': None}, + {'group': None, 'capital': 'Phoenix'}, + {'group': None, 'capital': 'Pierre'}, + {'group': None, 'capital': 'Providence'}, + {'group': None, 'capital': 'Raleigh'}, + {'group': None, 'capital': 'Richmond'}, + {'group': None, 'capital': 'Sacramento'}, + {'group': None, 'capital': 'Salem'}, + {'group': None, 'capital': 'Salt Lake City'}, + {'group': None, 'capital': 'Santa Fe'}, + {'group': None, 'capital': 'Springfield'}, + {'group': None, 'capital': 'St. Paul'}, + {'group': 'T - Z', 'capital': None}, + {'group': None, 'capital': 'Tallahassee'}, + {'group': None, 'capital': 'Topeka'}, + {'group': None, 'capital': 'Trenton'} + ) + + parent = None + + store = Gtk.TreeStore(str) + + for item in capitals: + if item['group']: + parent = store.append(None, (item['group'],)) + elif item['capital']: + store.append(parent, (item['capital'],)) + + return store + + def is_capital_sensistive(self, cell_layout, cell, tree_model, treeiter, data): + sensitive = not tree_model.iter_has_child(treeiter) + cell.set_property('sensitive', sensitive) + + def fill_combo_entry(self, entry): + entry.append_text('One') + entry.append_text('Two') + entry.append_text('2\302\275') + entry.append_text('Three') + + +def main(demoapp=None): + ComboboxApp(demoapp) + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/data/alphatest.png b/examples/demo/demos/data/alphatest.png new file mode 100644 index 0000000000000000000000000000000000000000..eb5885f89c0b30780fa21d823224efe0286c76b2 GIT binary patch literal 26529 zcmeFZRao2I6EzwV+@VNtcbDQ4TuX7MK#Lc5EeTF>iWYZwX$u8{L!mguDNu@QaZ3*G z|GPQ&=i=Oa7kTpReUVINX02I!etQzDt)+s8O^FQv0PxgQ6?Fjsl;GzV9VYtoj(l{8 z%<~(nz1%A~0H7%`_(A8>^P2vhs_rWQz)cna@QelkE|~#UQ;s5|D zqlyfdY5>5VTTM|;-#_>5BN8dw&kjZ_u_B2N+av%0V;l=<__39H|J#Gg0O+C0IFCC2 zXM^GY^9o%YY#||yU5N$&I<&&+p1+kaJQRr#iqE(yfto&lJXpny;D4s*@CyPUfQ0rl zmH$~{6#;+(D0%+xs^tIeiR}$!C?@T5oOA(%5N^;h^uIu%e1MOLP4R-!`q2QWQw}(x z&w>4K9}|FCI1T*2tN&j-L7xHhg+D_|0Z%c5`vRbQf*T*d3^C0i8nLpnxg}tP?x7~P zeT1DOugmf_3(%MAooQCOwonOU^HQcOw}u7kuW|f z{0PgSH%8l+VC0XTjZGSqq90QTZyep;h5t5*IeOsU)6oD)qbn_n9fcmlZc>dFzx~E) z^$;+NDRxy@Mxcyt?0GwR2Cgi3SF>L{NAdpmY$p3N6!+HpUIX5`u;&mZC}ZsXdkJ~O zj>+-ZQxe4>r;`V9NmvcpDzXE=%={?K)r#puHcH_#Bg1_VDpiaKP>b{nV}`laIEZ{XKD`PbiwxP^j=rWMd=p zopnjoyT@V7VkAg_2@{F&Eqe2Q*)bDp(5oXH5(-n2ROCq`&?gWCRbteh%8qcWPSBx+ z)1Z=1?1D0W#>E=Yy=i6!XR&r5`e(VBxF?X|*hu7*H?Y_`SQSZ>MvL$p)~{_Z&9;B$ zMtT$gDq$B+urb4ZCQ1vxGH>$qpb=v>tSHdKdrL}iB?i4-4TJ^ao2os{osE=i%1ob|VtF75u z9U?eWDZU1xE{;DXCE)Sq!n)kthtTX6kumXD=nKEJg0Qxa&~43QRzvv_NrnOZg7T*R z@iAoU&s;$mUKkee9Z7-YLmm1o0b=GMM1_k@pbT*ml!js4{6mD{Ts-^a94T8{9DPGg zL9ZtjYP|)&WS}u?VvUG;L-ou>?9W^T5-$yZ&yL>Z(?c0e@s+TXbBPr&=;7!L! z{@Y0~Knt|NAZ7fQ;ABZI+GT?$Nbw$2j&nvr)LH}}^(#u4{4X%H&zuLr+qa@>?~Q5z znB6QiW}TDAeF&}#7XEzB*V=~emhxn;$OEXa%e%*}bm!9~Fs7YzdO*@y%P^VKwQk+Y zN|Xv=%4s9aeXNS4Fu-!D$f6hZNQTIlZwL*W6)7uYFdV<)OSuwM@k6epTNj2ggO^BKCuH=H!iJY34`h+$|)Dtem7ueSn!`1BEcsS;VVHbPB2 zV-Y;n5mOswK1hZdS2$kCr99LFE!iE=Fm^{^SpqTuz4>}U=V-ki8WT`r#SeohT2F#F zBN(`LbTaHWQQ^W2XuNwAn^+i&a!^)~aw%zcV=0Qda=f+@A;U-|1GDwn)cB`o8X?4b zF1CfHx3^JdR=1qbh@nZMSlj``Q1FJuFtM%__KPIPC*aoCWdj}mDzG{bz4+c(FU{m2 zNM5yqC>XI0(}9o^X31jcFHWKky%1%x@y8cl!jJ7iMg+Y>GO$S7U}8+Sgir4C(?_|} zfBKf3ZrPZ>E?er2Ms-c`T;Cxm&(Q6ROfugSq@Uj72_`g7>c`!V4_{41Cb1^sCkGP5 zC(BW~_s0=c-^exxCBKCI(w2mXBU7k?HrgIH%4wU$pMN|Q{7t2P_wN9VPI)u@X z1i)31lQFq=m{8P-foEWd4>o&twnUrf$)Izkx#uUXX`fSDk@Y#$?+w8B{_TcrHVO-}(vG#fC#i&3l3Uc9( zI2OfNT!ion%?+ob29%m70+S>pUG8SlJ(yzC;ueWi89u|Hyxsk2h&Hq}hfHRYB199k zG5&iRs=RHRt_Vfq3c>H`KS^&40sZMPf;m`!xYK%95=ezUkT*Y)8>{gP2BZEHotjwq zFDWqoON!yMX|tWiUr(>3>^3MnhhMrT*(&@B-K(ZVcc>u{sZUyycjqcd*#vwQ1uUiD zjGZAjDQKE;-JX>jgfLlDBRwU>8oQBrN1jqP+Bxx_z$G0S-FiYn;bC~fZe{B>ZdW+; z6jPSD0i^CW#rdV6s1HmgwJO95h>!8PohA2+_)uQ8`z-J1f&XE)u7B7N(vNK;zni#m zNU^bO`#@JA#pGQlZR5x6dRAb~!~9MN5pDZn;NIDIh<43UQX8PZ2&z(p`)}Dm-BLkD z@Qt4yQ)+=zm@>7=tWJMO!Tf^4D2K7HaAU|2p(9Q_XVc*u7AqsyFt!*gsupOMft7Vn z8f*T4@=5VO%CgufNm`==wV%*^vO;e^4|GIqSL!>ablD_8J)6uc1D4*y%EZ~2@so|LV9|z%{$10;e(_T0RI{ZQ7Zfpa z(brcf=M~5^;lUX21Pb|me9Si*)iNP3HG2opRfyEHZVPxWy6B#&7F$TCcgI8^`4l-6Z1^8xwqqCJHW}kX7Dh@h>?%+sA+OwC@1@sUrZNnJ2e&Q}k-s zS}X7%tzTTk$HW@BH^e{ZymwcaTTHwk!vVr6}bj(bDAM{JhneMJ|z{*py zMgZjMDCyyc;9r2~_Q*{-`UpqY%``gudbGDHo|)6(e{8j|$#hz~rd3KYLXn=8*KX{) zB3~bZLg$O5>puQRr=!s#7hNsD-vMys9Z{#-lU7OQ$td9omO%NvO5qB3;Ie+4yrkR5 zWp@9r;MdRS`W5!$N#!VRupOAm-S}N{OUg%+@;U0)|M~l^D#pt6Na3$1N#b#MJNJtf zF_~X?z{QW)i}yjdU>Tx69Y%()5$L79LU6-ixZwlzwH9?=YZ=DbSoS71cS{`o<`bO^ zFM$~qf%FhqWE_}X8=3Tli6%qz`3Qvxdaljd3KAncL4=EHVHAx*-d2DGcl`EWvbuhB z!D$nrTc%f)fXa6S$=;|5R0?LP$vI7`S(w6!+-P~ju9$Od7<1gi08`P45&x(0nM5rc zAG_&vO31mogX|W1GT;?$_}(EKnP?Bg(m6A5cpG1*&|(?hs0)}WhJ4{(6zx1}^Kug1 z`x@pKx|93vqzNl}8@R*8uTHAh#ioXMrv9=KLz2ECqb0#R zC^0f4-4>X=BXHDjgmFYm1@VovgBOD|MaDr*=jn(4pmtS7-coQ})>4b_4sw{{KQY=Z zsJF<_hw55BOMRiw$$Qh&kHNm*e@k~lxJMfA{(BwupbL*gT&Qj0jzYi#@=AL-06U8S zdGjd_+1ajxZ8a3s-M4`HKA$ZnpB$Na4LNif8&C z!Qk%0v4f3a!BG*vq&q11p>@gja7Oe65Zw&y40;EPg)LIm@HXUMz7iFt(}&!_hhvca z34>Vij2ci<)Dj%+Hqt3qB4cr^Y$Kb9R?TS?CU4x2C{nCN_{?*#fCY4$A|>ZzlR^St zI?K8E<8g+MPz6uPJ%r)w!n$&IBYr_{An7&zT~~`n4-n_c03!MlFqm@6VHZ{_7oC34 zSi@Y@JAg@J2D5#A#xWb88SC-MZNl5WFh5v%#Nn)N_2l!~OSc(=S z1okF0AO*=Y=t==8wjjO6UoEDHX^GbO{pfiIY@nv-T#rSLc-~Je_0}3woJ=9AaWEpC z`tbWC&8a{lgG8beS=CVjuWJ*{5(*Yr;!F8|U?wKdV|2}o!W;&OvW@6*CzgH_wegwT z(56;3G&S)>p}#j!&;l%nhi;t4- zTKllFO1~9p-A22krA4+y1M1Nc0uVlR+eZQ)?$R}9R2#6#&^!$ar@3#i&aCK`G?WT} z6Qqr@i`CUb8psa@^&^%@*=s7HkqA)cTs}H|OCpN*og~Ql-=(a#9qKef$-5e!izGbl zqq0HeGNrS!CeY7`7Dk3iL68IzE)xJR!9`BR3oru?hAJt_VjI0EL|F{UMDSD2`3{4t zjln?hPpCiM1>F(@lE?tBb}lNv_JR)CM3pRsf|ZP%>Z8?7R4}A1(toRsclHLa7LJ&N z@;o7;sSnWgfNt_oAr$X(;_rRhXw8REv`|j%QV;dI7a7QpHG2Exnc zoJ(Olo=r4K8k_tU(5yuF{d+QzuLsWJ@sw>5oED@IZX29OJzW%ow#e4zxy1IR4RGvX z4^4<~EYG=zD8u@l!tM$!C!#IncB?WT8u_Y9REt7Md41BP|7k z0Q4&o>>H0>>K*O&JbzO%| zC2{tM=JRSlgg}HY>3C=C!b?+J>~wU&B!kj|=~DuZB_1 z&*;MVf{XwqtmM5R#NXMlu-@NW@v_dNu>PHPgkFgBPgl!C;1lhU&xC#6d9EHab51%p zVZ(5}!PM{lm5LR*ypeX^D7T&i^PLvV%TWQ#Zp-Q}oMQj4iEz>0l5*MoBmg+fscY)|XBLK7@MbbTrnTSnF&d&2_dNDkZPrcl;*JScGZ=EH6@4 zox(HsIrZ|7dn>EW<3o-#bHw+R#w#{ZunX!>EJclGJ1;K${a3DaQ|SVKOLom;-O_}VGrO_u3Vf^}a{-5CKe+3$oMa{vNfue!tz%eekX zPH09z@9>_fc%!8C1@{p*>N)0{UU{PL&>NHCqY0*#RD;$gZNh%ymL;`+lcLt29{*{s zxb4Y&Y{u^wvD!N>_&&57sVlE6FH+ED7$E6P{6n?~_k%)p+k~*mmAG$Sb0IK>Q(ZuZ zSBK^dKarttceFf9(pS*fnD8udqadMKZo14~>ynGkBn^ANLn5t;n@oY?vCvF?&g{vD z?-Kdv!v~L>-wZezMLNW~+Ja=8Y88}OPT{_81Ycg+&%hML>492o=>hf)HZjC%{5*k_ zqIapz^8dKA0)rW7LLAGp#2l-@--3H)$mq@36dAloDz5F2A+AAF_j;{z3-DFZx&{ya z6kVPjXS}d=$HpfH>EZ11Kt`XBZ$Yv2wl4*_mB+mHmDa)wMh}+VWhHOw-ulvUrD4Vt zM&Dyl4wEnkyCHWm*+llGMp{0fFGL^-q2IZFInqZJ`I2w&Wi6V>@%Q@aA50}+#p3NV zTiMt`EN+vkIaMEVCAo%Te`|Qciq&y(6`f`e^Js=AzMZt3p72$B8{4)Z&A0vxOdd5onMbL;4W;+btm4sX9%9|eqiyewn~u+N zV&}$@_96_&Y?aRVy?mm1ES-iqgQV-pk)Go14zD#du(BuQw7d^k!|I`8PM28QcMWE} zOb`7IDOq52Z%OdUy$VWKj6|{yy^TP4r4T9C9eh6fW=w21W+N*`$wJb5H&6`-<|{*u z{lz;5{k0is|66&8?5>zmO5e!wLV%O|Wj~EonOghgnO0Y>AF}=?H}AXd6*K0sW6QWZ#L|jBLp2qF}$V zi`gQM*|$P7oT#!u-c0c3#JQ3*PRSm9Mwjr6VnB1o1|2+#wPHSC+$@EDWz&ZLs#+?P zCx5q}>o#$TL^5Qi!pnuN_57zs%@@n&p5FCYq! zZJ(}o-w6toDq2_v|COYBkhKYjF>G%3+={*#jzM<)+!)k@tHkzG>1x*?70BiLKXV`{ zHcKj};vB8^ar)_!dHCpsvI#$JpADKIH>r(B32tOK)dJ&OvrwRb?L2AxK7QQDJSKN^ zW@S_%Zq-~EX)G)O#gKJi1aE_#8Op#=H87rV5?g=N#l6U(e z)5}=R>~)j#Ly}GY77>i*qDhvzE63u;C)*%lxBCy4#AYh1G1%#)yhRmfYiU&+D?53g zcv%|9SSViL$2utdbyk$#M9hX!Tn^Rzs=>Lbcu2H#!K?Z=$=*WhvyEHSXJhkWmQG9b zQ;^rmm$*-KJs_P(p-LVZuVt)Fmoia3(iSu1(QiThc{xvtD#!~<89cYdCAWv=RqDE|UiQ4jEj#tFW zRW{t_f$#}o+ldWXZ~H@!+dp;7eRMSLyb5IY9iYiFHvR@wu~N(ff5YYeJAF$YuB+1v zheTCZ&j|Y**pE#ngc9}3`mH}5j|miq4Gz`~o}WrDl+yAraL%h7doEgZuDl-a()qE% zYpfL#Bfz=8ORv}s%aQKE#!hb4i~v&EoI1g^o4J-zC#gr@{X|#wstv_d*riE-adz8C z{H?IKRrS-pr(^?O&}u^t?)|>Ox#vrELvLSZGtfY9A8Xu`B+BS^LEe~DnPB=5OT^9D ztxxSM$x@R+PJ!Uj=3tU3tb7YbwU+!*z5Exq5#4qn%fQyDm)h7*Io zN-_xt4;6P)-Vf!F4=yugFAuiqH8{k2KVjp61YkAd+7QAZ+q;}W6Ai!QN@g|w$QmVV z2qTw1;HyR4jfa$lTV_>*;Z*2>^o3-g~ z3OGI{Pqqmz)eCPAQ;ynNt=#<27I2X)fB<{92!31z>l&sPjo75Z&Ts%Vp0uR4AOJ6p zAH?MW5W33wSL02v zTv5J3|Cx!%Ib9?3!NGiq+4)kgT9JJ8y<_>;Yut0bdFKAvrIMih`u3k~H|!K$(`EAI z4xFs0B%9w(i521!NSSpaf^WtrDh5gBKB?qxi5*QYNa z2@3a-66(oy^Mzai>$myAEz9-8uUVZuj+Y_nB&lzvzZ(X>%9jiQ@TsTIuX$Mss$(2D zzmA(KmwRdrC)p4@dvfW-gshXU(BlrkZ&1B2=Tzso;XsnK)>eK@X&SFaKzJjDIPs&s z?)3$lR*Hp>pd94#*_c37H@?Dyb5ODxi3|I+6A{d3><&N z6x8CbXT|#}WXxmK`KR4GZ*1Saj$D$BEadFWwh%r{kTrg&mA$4VvYNk9l~Ry+S8z(TNL$ zBE%V*mO}nE&F=dbHGcD8FVd-&XRCS2iLT-_)q1k{5&k%uEvG&Yp#z7Ws^UQ zrx8Cp2;4my7?fpCivFWlJyqFYUsDSF!Q&&N%_f2+@`2;prD^G}a;Wyb{Wl(o3Y!6$ z#@}|gg37I5i`)Xfk+A7Y8Z^3jDY-%{`6z;IW&5*QmkM2^WCXvC-3b^nYp=FEaOgKW zuF;iQMEcG);f%fO%&A=|z1*S)u6QIWC;QPKObCtnBDbBgTjCAwlJyIJDf-9i-Uh-D<%cd&%evEq@;4)=goucf-KYvY zw&gH>;T)-mU)v;6mKZZ=vJdsC{hYBQ3GNDF+uC-79{)dvGIEcA-~!cNb_cJ(LTehS;u5#3^7hlVk6agJ$&&ud9=1Lv`%O> zLOJnr_5pP2w2wl@hc(iCiS8OEiPNEHtdv?Xf|I%asi*~oR_fu#s9f33Y872e;GLGl z@w#U}wHy1tL-mEZ2aKPLkA*k+J(-Mh<)JMO1e6O~ol{HL*E73~;x!6GqeDvHWc=(3 zDU*~8Thb$FTo~jQ=f4T*l%pOC2RdjFAy&vR5WZ5V8#~Jh|CK#q6jCmJV1FYjE@TW} zUzl4iFUqm9D!!4aYj^T4RRha0b=4zQ+h*S+aE4Ff(G%q=H`w?qt1c+8Na)Qd2A|?` zY}RmyY;CwgYtgM#<{!+H?i!mM6gU=r>{r(}-o&|0KLuHyc+g>eO52y8iOutwOGo-s=n428!gmzR1W%;j>mPJ%A{7%r z`g+#xL#B>0y=jP1G?P-B!I_Fhiy$VqD~rz$+3+jmuo2+j#9vHnFnaMiE0~u=nKVrS zUhDzKS0${@fnBNM`nnBF|qdCaFD(AelY)54eK#Uiip2_kY-RLS`<%{^fptgQG2=7yjPHKcBBls-IAtD(a@FMRSt3L#>)$ z+BP77BEF`eQ!5Ygbe&vW+VhQL|Ea`Gs0N#AZWR6=uf2$ks7rg?Bm(tf%aW)&%r?e_ zDOlS)4i|r>xa7n7ELGp-kfGvc_!(I=Ax(B(u{QtY#HOR#S(p3MITvQ0M2P|-pL^Rh zh)-C*#A`=j)7tmx#UO{>MH;U5v>Mteq?*jyovC;Ul%dN{G^`~Pzs;#65KA;`LCUmh zTPPv*w+EGe7u)qYv8?XjQVdXPLXBbM@qM50vS38F{KR1OlcTup)-%Ozqbi?bR`CKp z-w#A*vMF9WGlHj_v8bvc4Vw)j(J9h=*jX&cqveb%{X(;Il`AR-cG&Vhir<$mermqQ zm*l1QN+yc_LmEF9%(hsI_hqDiVFZPWA3o9Vej(53Y_&IR%0`ekKby^OIwJb)n%A`o3F>yqkemCocyjnto-nhMV zPU;xoQ!M`?wtVzAeiqg`&74v3XPNmf=vk+eQZrzJulrr zB2Kk*ebcaQTKFJ{JrO4zA7X4>Y<}l7XkruMq_QHFe{&c_`$&wF`kj!5MOp^e_SHZ8 z!}L#s2;8a~mjw$Y!6fkl-Y@UoBUDhHtQY7Sj;xKFwCo0}R)BUK;v1gFdZ?imzXb}w zT&8lRRlQ))BDeP?aN?M*kYq$9hLs8HeJqlFP!k)&uF5ydIr2AGLGy#=3da{3v;p&3 zZI!T}jRYvBahhSy7(BAf=HF;Y5ZF{MqDnUXi;AjD&% zOPR;Az4cqp^^k=){^CC+1J>CxTB##~4@D4k`%O+XIxQ_t6u)n{*ytpddui0s#K-Bq ze~bH6yTtY74v`wR-~xZ^JYkm4)*&~)vpiL^IntQbNEJyLHx|3%3rrO)Cl(%xM4!&S zN{cppLGgLf{9@|e$7Wi!M;aNJe(``3Bk|zPCYK5+Wh(a-O>>qgafe!q3g$Rh(8dk( zcQ;1rn?% z&U8z|u#&=8uZ=1sFhk6WXM=FIE_8Gd)0a)JHHqQ;m_%AQY1GS##`1W0EDlniyR-8( zgg5&;0vlc-1Is74m1EkM3=etZ7&93(!?EOw=ViDa4kOhcf1Ff9ewbwLXRwNS2e`W3 z{e@sNJLAg4cJ<_c zb#BCWH2=6emHpKtp=ng;Y7e9)PRg~p5wWwV+S@VK;ksI8{x z($D+5bT7c!RCkhOot6c+!%GYUTWE&%HUE^=_h&&MzQ|B=xi43CYY& zM(f1>&Uye1?)rq2TTw|w5+Y^hx;wmfa7JO&MLfM-DT+&I=d)ncuWOXNxH6c5LsLJ; zOJ^3suG`|M_ad0?a{}c->)C)*o1(>t^u@<0^NWstkJw)`_N*j5ltz66;lu;A4Cc9?Wj|I@YHq z#NK)sD7Ct~Vq5aYjMZ~yAyiM_mogB`o@u#|!u&s0=KeB+)m*t8lJj-b&}?uC!(sT?J3)kGoG#g{7C?yihyGW$R_Sp;O*TULwSCy}y#?f-8cDY7 ztLM6Js}9$jL^SVfML zb55GV$yZh4FM`K@n5-{~%RdCH+^S<1Fx&!oqm8Hl4JYI3naZW@>Wkw0CYpEeyh@EO zJ?)%kGezvDhH+~Ijj9a&ae||G<#pKw2mzx${S~Jk8;3|Ib-70N>2(qg5&;RY3 zqCa5T3wzTWi)zJzn$SDybGN;zDW>wkUIFwfdsghYxC?dTL_HB4VO=<9p{u^EhQ|@X zJEO)*rwvf+WMs1IW1@Ssj>3>>G-_OKn*`jNJ3lm!+X3mZcH(*iX8LXO=T3uVZvS=Y z7?{{F8uVL;1uqVSf{H>jtx-azhoz|b(5q1~Mp3JhzSt$#e2j6I<$U;wU~A|ITm2i@ zd79IA-@G~3??1RvGQt5qEfa+&Kei{zyytqc+Z+&P$PU|}e)9CJ)}Tdup#2tD{(Cf4 zTChJlT%h2SPhXeQ`FWwfYXVwwj>N~!+E%Z>lNYp5T{fsYDrctt0WBt<#*PV4zjXoG z7k_NuB|q^yZH3VvN&m_fl*zfi24#M*^g|woow?!o z&T#7Q6ydUm^i4o@tn)lR9gPRnXGl~TxU`)tX&sI60TJdeCyad!wu8TC!o#Czz#EUm z;ap}-(J~-UbI6(nUMTauZuuY|=J~r$3$2@lO((1=9pJK3hr88xI}(@|yr`uuGyC&48p}MUlRPs4&gRb2j%$}17ZafWkN@^@thja-h_z1h7 zK?Z<@aZ9F!bI5ZAps`FGkVO`iu-6E3R=Z-T32nQ{crobsWn?h}mYO*F;_L5!=9kfH z7nWYaC6Ss*T7LOzuM{+by5#fRqGxJ3cUeVi#bGvxrDHl;>y z6Ixz^PW+6%LB+J&+1Od}zWE}On^Y{Ycbk-6jYaKWi@h5spwNJ1O! zr=}q!aaaJu!516H)`H^6MghW~VhC&?$EpxK8ZqL1kFscY^Fgstb#COPB zy!@kH)cC?r9N#Kj@o^S_!?z1}|5_h8;i^V7gW-71pMOqGIG@`4S2 z2JlA;?HY@x%sW|f0Ki_U0Ut(v9aH6RuWj2;zYKfbsBoZNy4ilkhSf+Hdlh*#6{F3_ zG3l#;=o!4=?el`J_!VQWk<+B&l}%~^vu`X+ZPMY=7#63sfv5Rp%p)&8h6t5%2^N50 zD=`*~bv;9$xJsKN3*STX!4tT}eO8V;N^IdK$e?84Ig-DYwyYaSq*KN=5anV)b zhgs*8IE3e3!IMJS-MprVpr{uRuf7FJA7fa=3U)2{Sufp?Io+Zh`b7wDM_a5PRug#> z7A}KT^l)8nB>TQ7Ia%0^iku%xh>^K@n0>O_@#l#fus*WR#@;x%K307bzxY6*4x^+WQqRx!DW+LD;vXQ~o7q z6R-xq|6unub1e`@GTEYkOO+S$^uBdG8Zc+Eg7@qkZ!#-NnG|psT5?uIT~;&!a}-47 z{R8z)N~J939$)2v+WQInhsPxRP`oz#=zKcLahb8059@!I$teyklxW=}++s-2&%(oV z;*5@x-@0QA*yPR9(#g?AU-&E_qv{>Gr=@B5UR8urIR~nj>CvZn$5koG{kD;&VEn@< zi1SxKe9Zd&bq+2k!-Ew*n&Pp9vmLjL{XBlXi zk9kr{qV->%Q>cmP*-Ne1i8}0H7~WnMG@k<;#*-Bz$fB?v@ot~xkT|l_o0>OuhR%qVG^Hc5QwNz=F_ze?aB#%^0!_vwh8uc``Bl z=k9v3L2G1Dk|$N^n8!s?wngaW=b}RF(m;n^0F51ogz#`bI5Zk{y$Q86%L%kl}{%E z!z7~$%idubTA_iX&>T33iQYbGc%+V5NVumkdK`@;{+=<*cqZXLlP11SRclEmD0T=G z%+~Q1X6eZ8P4Htk_&r8sgfR#8)T{N{&#DjHwV}et_`5!4A6UFR&!=MQ5e7kPM#E#} zAs+RD24)jo4Eb5nM31wIBG2Qjgr_%%=@1qC18;qbpyp+~UHusa_X`~*sL37XU#<7y;6y|A4b}6%CiwK;B=^&jtGwtnwqkMoNcM>@;$G-R zHCA{@8yNYI;Srf?U5?&?^0H`Q$!0@ViYkA_Y=bcLQZ_n$H;q|_&H33@_>!*10Fuz4#at~mI zO{2(o{?`=oZK9ml+Z%sO772}l6jQo)W)5m!{#sBc;p_0I`fFGIZ%sEBq0!#;yVh0L zjm^k{L+p$*Aveq<{xj#am{xTZFMB4?L)^_Z!{SGa2tCbvqaswBxw24g{H2!$SyCle zIztt&1^Qi4jX8A)afJ41m&62vrE)~wY0fU7P_d(!ALfM7pc?&`E=86MxWb>yIU($F z3{6$$D$(>d<-J)<0+h`~u3chdo0WtttW_5~{NkelE3K^!k)ibUFN*;+ zEJ4txqJkp~ek=r<=Ri_gG=TC4n#{j=nRXzZ1@$Ys18hok?9MiF6 zOrUg~WB_T^=|PJJ^rG6@b7fDE`W}{L1~cSDQWSX+#y47X05`8fCG}t%3FlUuP^J44Yi|^JCp<9lqH{`PWt(_pL-HTTfITm(-c=Ty z3Uf_4KFE!-BQqj@S~NOB;MOauvd+FgKh_JEdOuF!%hD2(B#+v6aaoQ|64F-DBt$~R9zk^4oBtt4D%YySOO z{AE$#Z#*8waL5IO^~aZ;&L2}MFB911odO)Ha?*jl6S+fLKZ>tsa?!2VAYCWkWYnG? z8nI3494eF&)m=q!N|~9I4AAQ+)lafzfnw_GJF3qnf2JdU(-RXy`b+jD3CjD7LN2l5 zXrJ_{hUSUX_bjweWOwA@^aQ3$zZoC@lL5W|ak!VV6-LI!VkD1$3*Ng%)C+gkZ^q3t zOfE@mx6>*zYB`D?q+k_u3N*GN%M?yWSa&xE9 zsz!2?MKwd{pGcn1EUoH!h)$PN=hk=PPpC#A{iqZ__ff+%tj`Ba-7!*`J+gZ4 z1ENCJ@hl7_hTX|>%TuD2MsG7+$rO0rm{)}rc44?lJ=Ap8=NDYt*(NU$_yq#}f*DOJ zk*IE_!ihhlM)yVmDZ>yJbS0%2Gx4MUx6K=F0pM}y`~Q@pFVnM9bV`6Tx55Q*;@pR^ zr}$AdY%p1^KQhsfouK!6|Lr2SY&>i_;ID5 z3=MD9#~RF_(Am`X*Pe6B%GJQIS&|9QmYj;v`Y>0gjti<)0n`_9?qS+3f4tUnTQ1F8 zyI;#AW2g4Q==`oc^yW0)z;zmP<%w=DatCo_&XT=eba88TeY+7mBzA~bw&TLpx2O5% z$0iY$%?G>j46|;z@9nHypso5HwEC)u=HCEwG!VPGkT9A1*lOdzK<&2hwDCH(9q{WV z1%o#44#&5{D$|OXw!Mx=IOn?C!k5c+fswqiK2kyu+v!Uk=uwQ-kG149d|??w5_8$X zI&={?JQr6v!S`P#3NoUfvqs=Q@hFVLXKkw@&woZBk`Ip8PC@ka$o%39gKwJB%q zlX-yf=<_ph8sw$2YdKjSwOrI-7m%OPXsGPJiXdE=AzDW2Zr*#r(YLpmUw!bJ5hU6M z9d0RH3S{wiDlH|AWreWg-@c-ee)D-b(C1zCG_YNx&{t)2IcMCkq(jCx=dLOEdh-Wy zq4=wEbY9BWL-@GZxCyuZy9+JHa7<anXVb&atp+)$1Dx9wP1}n*!hW$CvK%|EM!{ zWK3AML|b1~WW)#w<1+$K#!s4G3iI};-&geVYb+#XzOF>$t}=&JraSE{3dG>~d^N>& zs-Wvm`2H(yvr2d+5Ghqq(~_WVa3w(X>n+;jsZ10wk31odqCsa4Q8i8-p9$Z`kJtOwRdkDxg@2RL2zl2 zA9}3bNOjYEL;F)r)=lG=^U(PlBbk}ZCJbNDHpG*)`Gb*3yuP&@hQ6eK zeS=L#AkU)+s80n+(V}dvFA(v;xrxyCyO1Nm!J1UBV0713o37jVXEbv;aZ>~BHgxJ^ z4N59c)~`x>g#y*_{2kpC{Xkneq<8}4RHaZ@+is<$HO2O5TO#56HKWyA_#1^#Rf%|% zn?j>+oLcAdr`bp1qfQSS&IvEdY&PC)1)`gO{-pYuKurmJmR)1xcLJ3z03cpQBS|0% zP4MBK)l_#Ss5S;ol9IDQ#e^r1RZ%ESR%Jfy6U!eYQngNI(X}sh$~HbU1wXz|#y1v} zHT;VmV0L{1v0%kbwoOA49j0yaTuZ8u3sVojp9(!=e!lk`_#HVSo9Gts>nx!|_BnV$Jsa z??R20Fdft2nQsOAaJ=@mxxAanx_{uv1jNnbZ;O-crE0cbY$N-VOdvV5J7S*aO9b^wW0Z)A{=12OGzr%+qeayeoNk3wfSF zdiI5k?cWkdwXaq))ILO=q+?DXY z$a2!TSab@BTcmtlC|>vu^Oo=f^h-uz4fGFi`4>v(3sZuKO4Pz5^2Gax2@R4*WP1LOd?p!snFcO$g_xp$+(g?$=Tbz836#SOc8DNKAy3{VOioOo$GbEzkv^Oje)Ui_`u z?em6cm$f|5~;+@1ac}BERI#6YKZ5TVVZ+fv!GgWA-~A^PYV>r-b3Cq zTd|Oi|2>;#+8z_5KwbbHxn}p&lY_cZEN&8rJR@l<(IyGH9`Srb=}J`qol;3eJJCo> z*c(YNZyhFBlRFs7GYyhNr>2eP_Y>&Dixhv7ouTm^g3BWp)|YI-{Ystoq;wvy4&R|U zWrmY=oOLRv^nrV$ym@F{3i2`xV7SQAQ!C+{~^Ob00iO7MMx5X5f?H?mtMCd3hRlYun#$^gcuU-;IeJTCqWUeFUlk z7@Wh_*_0h5v>%p4F2D0B=fO0mR&ejQ>Y~Q(RIY2 zI@vP|hGNQ6BFcK^RvnHv{1}bT*jsIC+>8EB2y%FjMG~rk&UP`Dwg5#SWsB` zkPCA|+6Coay@k#@j?4=yWtV*EBW}HS;=|1J&P_(8tiu#0&f-Hn_e%`lM&yp6dX7aS z3pcfKE&1UYi~mn|XB`z~*Z2EjfT2@j=->4vS?hVv{I}6yawb0p=D_z&PgCw%1m}3+_=ok`)YOCNV*^tZwA{&P2Y|YXAa>bX)Ity<%ZrH~M z6YIo+L4l}Y*sk!4ksE{@mRy;H>U*v(7pJJt2|ZWT+RtDDaQSE~Tfqhon7@jRZ7c&M z#+x;b?EL^aw?t1m{+#-YTGCI?)h$U##c*BWUjQsMQIF#jy#iER>C_QvSd2Yh2Digc zlMDeb`2`EH`N+BNMMzvRY0b~jYE!|7*FbEJHb=5MMV%#Kh^5<)*UIKP zEK6GsFem-eg-~SVvB1kN>`LDligHzmYdP%osAwO9Q=Jb{TPV)_kgAI*+o_$QW;8R_ zXz(ztR4DtbRVpQR2PuPj?KL9l=`}*efK4AJePJV{6AQ?6-cFyn3H$Qy+qt&pM>Ha_ ztUsQI^Q}aO6QDqGpvTMi&q+ruvh_mQ?FGS-0jy~=Eg>w^j+}2tLN%)@o#rc=?ZZJ` zAr*4VHlp!j6<6dPA6Wq{{EQ!5B4pHIzf#vq%S$_hjAnw=J7^ zoJHVs+^U_EKu|NLeA_2>g({@`mMM z?Hex?nNh6sak9wCgUU3ugIJ!BFGf6X)kJibpj#VN^XV#^O-KZs+&%G z&0c}{#g8M0xG%PXkiC>o4q_>kQh`twI|sa_G<(>&LtX9DVPfVObP-%SUy~nXi!C!T z1Z+SeFs?&P4D#SV1WT^5CyNyueq$?)b|ILfqDq+p23&2foE$ z%(RV?L6m6R7tFUAcZ@O{PBk3#<1DG`1I5p$jAA#=V@nCJer|(U$fXj#Z8)C7E53%; z_G>(50ms@ip zkozF~NexaGS7I?Lp=SweebYq8oKIv0qhv0=$Lpf-6R6w%bEGUY)gfuim+dni98BBx zQBTHBqPp}?KG4ve-6!e12u`ph;t125fV@*V*yA8;hHuFUX|#cl^*JzPi3vluRWco~ z=TCWF$Oz(_%m6VOWgBt;Mp;WDXnqQ2)zM$IqI{u@YYtIEbb(i`q)>m=NTA!sbfxVj z?zOQIi^XC;JLth@%8AguRBaa@>9hwYNeasQ{Ou>HW>-`0crYL_UN;3762Ul?VPCb` z12kec_<{`e10NMTa>3$V!GP^xrKoLQ+p&{KM`O>H@r77BSd~@Fq-^)SZ4`@95|X*? z>{gk8VLwLT-&`4p6hLtI67E>d#StPwZk@O`?2}!S>VeY#0PRcq#=LEmTwa0=RNtp-9U>p;#E7*R6G5%)6#nkK4lSTdalh=G zC&|XPEd~f1aKqhoc-;Ty5Se1(zSo+gqoWI=V|7A7WElI+E>&fG%iKhwY9Tjd1x?YP zsv?4Mx6G_=5p)D7Xb%A87Tpnlq8xG#{3&h>Mq{0ZD*4@kjc6{)FvKO`Hb4_ZG55S3 z9Xq{$=y;Skf)PnXA0L)^6%XU8B)BC4Sr+>c2i!I=77bvAnkfgb>t0&Z0;Gq_ zM&a-;B$6rCghbG7uYqht!>^J-xodJ_WRfBAg#AU%O8XD+%3E%mMM+WykR9wmK86lh z4OsDKukF`*nt^U9*UtK}t`&3dA5W3`kVVXclqm;Zc!{IjfaSah;wMv3B&!bw-ycc| zTBNXhMT)J;cfDfV5LuU+6xoi4lRVM0phozQ$43*0-APC6O@nhX$8|Bvm^fl#XZt>I zVxD5F1rwGZ`4d;ruCl%)Bc8xkw!xe4C532se6s)U{0D8Wlg4~iFUUcPx!4we0cN3U zVm<1Ka>=vqiJ;H&hA&HJtO;#eb5$fKBB6>>`!H~!cB=&z#iXn!dG-og%$ml&A;WXo(Q|khwwK~` z`!4YGGDNN&I>EFNHmnrdwTuemy!>T62U;j6>tm@Ov>M~tu)iO@gVNvccr_-oV30p4 ziZcCrNkJr~H}l|A#B#ki)}m`e3un>J2o|W+{Ud8D`R`msPX%|9JVgluhjF&Icvl2h zf+JG)`j+|Yg4n~YhRy2}_SC|geS$j-!e8jVbov*BkMF)Z5+)ozex7*3pV|}2YCLMR zF1Jh)YZBG>01vv&>%~_3u!*MR%y_7}=p?LrT8mlE#%(2V!8+xyv&&c)r;_W*oUiU- zZq8|AC&vLwSg!AYErC^Kh}TpXL9d^>ej27X?|fM!4HG9ncug!#sP_5#>Bf9`{n;|d znS=7-%CqOX_(hI2`Lc|blr;mIDL6PwHfEm?9|kPWrsq&W+t%a9;a%4T(|8tZ|-owtZ64%^zz9W$RvP9$B=*aB2R> zW;#M`^$zJri`W4=J<9so=`r`n*k$bfSSvg#d@38 zc;l~(*FN2XCV<}`S@B@xQ5XbOqnYY_iO=C0a~{bfNyiZC3+H0;y{Yhg&B;(-3dU9s z1RjOVw4S#0uPW|nItsdigq>QBzkYGB(BePx4Sjsd_*o$S-Bp7%ZNm?<^RLiNsRA?! zBdTL+>MFft?xsm}rgQQ(l<8Uv;PDBJ2OtOC{i3VdN<~JTRbzZ5@a&O}lcp=QCCDRj zo{E$5WW!*5dbQk=iv!xF9=~t7SI?8rfcIdBtM6fi*Ul53n4}K@a>)%cr_ggx-vCBZ zCRb!dASyR5(V}zfe0sb54_635Fr^mdOk9fkqevI1t87;i2SDy|DmDN=;tE}@&?pxJ zfo`R0Nlf|_cV2yaDnE@Y_9v5ZqR7Ixcy!IsAvOQAI-F<{rLV&~&N5%3k7ay5Qz;tJ z&kZ=%`1UA6jedbI?oqduRXt<+6^a7)ja0ISJ8_|bd3%M~qIC-|&&A z#1>fa>WzoGCAz#{DJ+gww*AYh*)r+8a}ugg5!D-!OA-+21Vc8>ir?yH27AIHB{Y)t z05e&(1-Krm_5D>Hg#jdkCBT9Ww7#Ao5+W4jvj`K~tuN;?26T-9^YRW`i{Nmt!k%)x z9L?G}@79EQ=im{H5nIe%AOx`DtD(`g!LL?-mP8akD`lXoTqrd|A6EAp{mhEsl@s;m zBeAE#B=-2P(js%co>K_0=MDZ!wAi%|* z6i2~t)Wnr;=3#G^VhDG4_A~;PI6rC|T`)8^Xj*Uik+Zi~J*fXarFD7iVj+rom|NVE zZpq$w4s2nd6qr6$?P*?Y4!p>)cgL zCqgWe3BU@DxkX#IKb&laGBUQ1b3UK(Ki($m#y;bec<|R3oLxTK%Fv8&GL0IW?W|DN z8h(DDFZ-Cfk_==Xw;*cjQfqHo;f2B4ZirUS8fWszd5yfcE0tEmOu@m~WG6pXh4yk| ze4;_zT<3=?qx0>H_9h&g;W2LjKqdPYV=1_i&N?}k4#%qMe1m4;7X+}@VF_DpkM0Mf z*@^aCeZc0w*ofJOhbW8q6bp(!6IxoW2*CEMB&1oOvrTq0!YaD^X z?ky+$nS;C7CFpPxRJ?8T`uwBoN#b<<0{W@q2n8%(Vg?J0qgsJRPuIj8uFMar4ABd; z3iJteULH5R_It}x<61?Sov(Z(dp_B!58xXV;89dg+T-M{vXxMN*yQoW{F!!JVS2^- z+?&`;&c-tnd$tyx7d}SD=zEsdJQ<7DA*+*#ua;&{szBvm=vnaIbKnYDh0|C7eBRsO z7L$W+(ALWG_sMg{_r8^&;?oHwWZF*2mYKRJ32ER_QL%A-Uv>+5^kc z%q@hvDVO!xTW03QSPK`wf!rt^f}csGTnE3_Dq|&o##Xfj7p_6rfBsD0`S4+L&I2bM z_FRFR+_<%t(AcW%y0xKZ=I3$067|UbdwEtd>QVaOZ;=PX6cB917&71-rKp&Yq@6kT zoVW-d%FIWCSXV^8$WSNA6rvxHGm(l_NrzQbgpZ{f&DYq+%pFtvDE3*&wO zVEERJfz^TvW2h#%Wc395amIK8SrKQB4k=28k8=!6<<~d5KQCtKgKc1%BptnpyR z=9Huf@FQOgV+)C~(P&p5l|HUsVN!X5`NwWaagie7A9ckKpC?NL314M4KL{w^{^@e< zKKaAbPMg4Q{y1j-UQ2_b5lGjbO2o>6l=anD>BC3ie598;E*Y@(Ph}PidylG09#6)( zwLm4q+Yh##s^+Jxs~P02GZNfXDZ5;B06w1>@nB#O{1RO~Y0g3H)@*G2hZWH~&eG+_ zSXrN7Y(?!JRG(KcHk-=d9*a37qN}XIPD*yJ9Qtib$L+)yw;@e~pBqZU;7zHP@$tK) z-IA^|ftuQ){$d7xTR`20XLRt8i9@vyx%IuGGw1k=tFwG<s1NVP50=OU`YlNEB5HSY1f;kD=cqI4!BYDEDPPaMbF#p8mQheyt6WIdJ> z(kbfuRs+e;*TM0wdWqYC%+F>O5ftlGh>H1VM3N&Wo{c5>e$uTTmlDEQU#BXLlaazV z1OQ~tT8`9{5F(21MjcFa0micd-$fVDS^NSr8MQ2N%``}_*l<=%5iw^dE2X^-hvybD z=PVDVJ91oTRAgkUa5w@;S6Phh-Xn6Sn&GJuGg_2`1|cG=V5XF$*siryhV@f zvV9CZ@iZ%D<@uQZ^IX0DvO$x_vpFlf zU#l@JGW@aARNtCGVCFNk^No|lDrN^L6e^x%r4&=IRGt0h`}Zn(2_f)gP+nr5v)%nJ z>0PH~AwYmrA`pVnCZW+Tt*ZDR$GN3xXzN6W^b8w(LoNqbXEWi(!)AxeN;f>rDccGr zkj!e8KT(L{5Ob54-}Liy`H~^fR~l;28AfN4U#!AMW}lM@)`d;K`Q7pfbL<%ne=;ht z$g4}^6<+0cA+C=Y?}+LuZbW|AmQ{_5Lk6fKR=s8hTW$*MxWk++Fw#0E0!(yUa^Br2 zl<}a?H^E(Z0}ls}nCbR1E{O0Q<-6_BdX0&6M-GTgK%0e0^+_OoQ)zaH4>EM2`|W9R z&YwL&AppM`zQXsfzKkzIUi5mn>b<5sO{D&u^?2kh(<^5=WSc|E)j~)P>$#DV_qvle zMhcne4IoqjzeHQ0rzOj4>DLeGNU*3%99O0Kc?vW=1T{;4Os)z3{!XRd??O*A2Sc>i z(x{pclW@F|IDOwlaAG2%UtD5hVRty%%ps^B5U&~;%LsvoF7chL9KQGlikqn=UfJiO>`Fu=HHM_d4T)HKG%yoJp8eb7O4 z;Mhrx&6dt~V>%iNe)(2PM3x%u3M%DZV)s$NReu)W{86B{L+=mHMp-Rr*4M`c&EGz# zzi-=2_KSZsO~P+&B51Q{V)!g&gm3y_Q+VE zKct0XjtMN@gJ3}sg zG1V7$^FV2fk;>IKIX(Hsb=aW9&udb^T}TPeBltM{sA-5m^t~7FGN~nrtQC5peR}iy z?LhiQs$iT?hU9=CJ=izj z$oN+Edn%FnlJAEtzvSy2HDF10a?qtx66+@bhHzwN{|OPFH1TWEpeyUfjaRiv#wXb7JMTUml6Gc%VUe!FiX~QxvdZ0c|Wm z)ZNN?YZEKq={KT7{ghd+B}HwE||=c1*UrL%L4jYi96Ai3zf!>ip+Hmaar1zrGR=mpWo}#v&OBjj|B;Y z@Y@}bQVm*X&?ayYIlpmL-6IYY4PB=IPLrgskzyK4A07##!MTLM;8b50j*O%>)W!6^ zi!lW<)URt}(d5%IKKng3hwd~&__fvL*c$JwRkRsk|1%g9NXOh+!wlBmS3bjz9D^U?FH^cxGZ#*uVt?VKA*PW7xS( zSh0;M=}Y$cgd69~T`%|v{d^w?b;L1UL1@Z2`+GmBdQwxm3}zSyrhmgUNe`pN{$iOB zAhq<0i{}ILNLmA`{btNo2Ck!3A zW#frl`ItEO!t%E$q=Gt5IHguYOIL)Hfz>Gxm?tZC6zir`Lm2%;*?#?=37e4`Nqy&i z2RSgq_XDJ9G4d)%o%R}lNd^NLVYc8Xj0HAo#y=80{Z>*aKHw8(GlB^_3^*Z%YJt@? z^bB2%FA0hrj`LU_WlW7LYVEj;tAjoA^C_h~P#>_RDLSOpwB{ImUijn&e4pY#q%D@3 z9P2l<_KjnCA3q{Fp(!8(5?e|(iU*#X((&r+?KydWmdF<;&j?sw zq5=o?d4lg^k-Mm8<&IN6@zxPTn#Gj#F%6!7G#oHr{D-}qfb}I);bYwL`hsTtc(Bwb zh%#R)`Ezz-rq*p|TRi-0+_i8+`U1V!6k&uxAyp%C?j!66El3d4miF1$at3kz$_LB6 z{DnCZL;jrEM*1&sy^A?m6MR?Irun<9j|l?F|6Sz&A2vFXXKqc>Kl@)VmFVT|!Mdw@ z|0|f~!1;F*2#oumHX_HIJwxNoll)z-$E?FG!2g_k|5s=9KW|q5f4?&@U{8I1){Dlf QAAtEh(9l<}QMHNqFSy{dDF6Tf literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/apple-red.png b/examples/demo/demos/data/apple-red.png new file mode 100644 index 0000000000000000000000000000000000000000..b0a24e941859564debfe60122d4fb60ab32cacab GIT binary patch literal 3545 zcmV;~4JPu5P))6LaIJ+iKzrd0;HCr3YE43i3eB7ORFH#Qb3L91Ffq-o1{QOaT1pZf>SHD<2ZI4 z+cV>tbI#steV0C*Gr=*w#1vkteA3pQIqUZSukZWT`tP;iWqa9PwwLX6cK&&@mjj(& z<{06nRC?cs-+c>&kAx7f1fO!}ff(Z--o5RfW2b9#>+jz1r%jVTaPPl7{0ML>(Emk& zKGEXYD%`&H){m#U`ug1J?hRL6vv%!<%VuY~z4Uf>-+%ko+dg@^b|HkDzqjKjE3;qy z!VsTi=}d*UZ@q0@2x0rgM3vU9pU(3~2fKi|i#M+BOs}e|`6JD*zUsBV((L@NA3k(q zyZ8RyjaMx!F5mIk<9h%;0sQ2bMc^zR@TVrHE7q)=Xy%U$;-D{=4wj_avwL2SKHr4Z z=kx^9##YEiE@g;Lp!A_|EO04Li4g z_9f-v>Fkt^Z{K>`jUn>w4I5{CVZN2=nNDYJO>gnw{^jYIEaz6bON$v*2qA_Lh(Iut zN4|XL*S5TF%jO3k+OcajaLr1eZ@cNb8)qgvSBMlfLO67AVc!>T`HlNKTQ)l20N1_w zPyAd7oHDsm3U|$}>2iFbmGjP@s1H5U_sQv6mY18{4n;zU8RD)Gd|Qn1Vb!w6-To}b z>aD;3p?7}wvHQP&9C#SulOMhLwhIqdf7NZ|LMetur)Z(9n&F%O@neqNxAU?2ru^W6 z1JC^R&h4Ll>Rd_uj0gVUk8XWOr&E7rX0~G@y0muP)T(FqAMY5ByT5U7+vEdx-SRs(tg5-CiV;r<49tY#uplN3tU<(Bs+~dG zu-LYb>^N}jQ;+UBaNo~O-~%6j-{Pv-PIqo?@7UpkgKA-ZsBSEW5O#zRKXdoCdv<;F z`Zv7s^10cMPlVpv>QE32_kad=G$9{!@%68mncULpRMb^Xj1f-(1f0_y4`RL){jG6Tzd?$qX=`a1w z-~afg&6_v9=h7?xsaJJh)vKINtVk&kf}@oaiA0aY1YReqYP3egszSt&ENCw1uq7Ha zIkOZB!{iLDFmHvWW=LNO8uYnC^UeFe`S?@+b|wNZ%7JdLde6fA;AqK~-1&4$)j!<5 z?VjfVUcYhU#@jYs@!ejxyMDUUqwXfU4xKf#q=_kpi$|%bhzP_8F%qJpAwU(WiZa9r zro_6&+m?EwX0i#W6>_SnT ztbh6CJHPsOCs+L2H{bm1dDGMDC#Jg0Ua+3IjhmRg=4$e>V<3g&yLZzZdX|6_Lqu_6 z1Wy4mqe!9TA>Opez|dg}X0-0K6y}?jW0kQ`GL1GYWWi{tQsmHptG4ghwd;%?Fw8O{|~nR&3bv8s=Vo9lhB#mdfrV_*=y$&q(16bse+4^4K>QfPTK}!5^$B%aX zaL13HIJv?{u7BN)*REN;ZMxTG-NsF<-m-;yavEI8$Br?aKTO{L44$CsPNT_)aTNQh z3RpBu3`vf9!HXevBt!>ytO%&#AyA?rrdTKxGfIGzlo;Z=tA72;#m9F({qV{7&MM}v zJ8$*pJDm;_-3ex{*i6-_(WXy(=peD%L7qR1O>~%gc79-|RaKsFE$3!p}tOHfm z!BfDinwTP1fooyv@L=;f6S#Wy>>tNek-9armtKKa0WXC(6qcUdPiJlpkBMx89Y2o8 z0LI7zrcg5Cprzo^QFF}4hxY+{dV1} z2`S*y6O^STut3{iqONNC2Mm8|1XS=8DC&d|Fbt}Qx}hyEY;c%i z9q{OgLF_?k6QLvIVMVM?tuRhY;B7Zux2ftyk~^WQ>2!M7U_gI<0q-PQ$(RUWc%87J z5k!&72pC=zF+)*`7R<)6Z%)Yt4-nlLgh0V?bu5C0K&S(Hyd}D!Y7iXvQ;XKq61XXb=qx5YUl_Lc}W&5v&_&b79yB zspII95~mz1AnuQx6M^{)!~TmG6RJunElq!!IwsoSSjo5)f)yYl!NH8+c{IbK<75Rb zquth25fgF*k(KZgL_oCwfuaQwBd5r)DBf{~gFvdC;Qp;s;XLE#+_rbU#iy%^>Dg6G z&CJl7Sw)=!DoQSyL?DSmj3dA$Lu3?UreGtWYKoaK5F;1CaavVW9Vv!rrV*j9g{7qd zeK#6w7!DOfP)iH{{Qaj^pOXgw24??SVQ)#f5Q;$4P(mPSL5hG0)~UfG!IaS#3j_?o zMuN@_QKP7$K1yT}#l29>F$778;ZVsUSX69S80L`|MIvdc`?b?yJmW^TZ+Y;AMh&OX zwtWVJ;|%kVzO8gXS6mf>ktI`5a6?rIp`fbd5V2wuQQ9)3%`MGP zSZWF-6hsYAfmp$CZTGIzVLa=Jz!%>ATZg85oeS!^OD{$0x~6i&LZn+cMn#GasiHE$ z0B5A})f`kPJ|fjxKs=)sXmerEj>2bo*=R$d(M(?yDFYUc3$cn!O?1Ecj}Pv;`E>Zs zdSdo`)?0fW`F704Fh-Go&yr$Ox1J7#g9G5eQMC4S}LU7DrKXF#5xSx{(Jh ztr;p~g<3(|Ds2KoX{@-j%v(+D%6au?XT0qGUJ33QcKIEwsUDhnco0B89=AklldHk~vzGA_1)eCIOYq zpun&gF(`YUTMql4UDyD;8n_JT0V{%{0Lv=`x+`qXNaE4Gi<>XI@QH4SZ&J6Z(ij?` zZG<)&QVL>DtIqPk81`FQDfEY#)|Ej4r6sSdJP9HJ3m`Eww15mUxNvk(*s<%-iBU2I zTrvLpc}7R|&#e?rj$Lx56R`+%cRcyb!rmi`&u?10>Nit2q;~vKB2vhzw5`zOLN1xs zgw~u=3T+XLOsNy*idGe-MmDFI(X@hSMpaqN!u^l!KY9Ex#@J_cV0;8PutK0WE<9zH zpFm&|c*R1$x#7PL9{IHmGgC~~0Zq_kr-;(1p;j0cBTGRvBf&8nC3>HCHji1wq)fde`4>%8qCF_-sJ$-nc$BK1RT||X! z21#ieK~X{i4@O9lY>_HB?w}Z^235e-DC(#vdyn>cVCTM5jlB$P2Oej1&#)VK8W^kq ztHvI9DFj{#Tm@_a-UM7bJ=2?d{pIVq{QPMgCkq_y_j%y)gUt6E0A}YVx#ps^oIlfL zs$0{m9ID9Bj01-TJo?O07Uy4d1Lcgu<$J&rjN<;O@v}1fvI6X-S^{Q(S1?)?E&(nA zUIknWti5o<+HQbwVE@r`==MdRmw~;&E=IF_m{F|nW0bTR+Fd4;Epj`BA){ep71_4uKzQO&Ch!~5*c}9 zVhnZ~m>rW?a{|~r2DCCxIN`VU1Te#KSs6d`jAnXaT<^3Y{(rjOIiZhw{8Wr`r91w= z@YBuGPXIaA-st!@8-t8vf--)eX=VI{5jb7Hk)MXqiDGO;%bXYr=X|yF|Hl3oT#kpr T!37SN00000NkvXXu0mjf{xHB+ literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/background.jpg b/examples/demo/demos/data/background.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86c006aa466a0c5875a39087c9765b6eb79433be GIT binary patch literal 22219 zcmeIZS5#A96#scs=p7Q8lu)FDbm@d1qy-2_ReA?$QWX=5LO`li1ws!26%a!4hXw@c zN=K>)h=3GPik;y<53^>?!~FlVW}aqw?&G<4-*eac-o4M+dw@UD&5bo_B>FtGx_K);KVEnuhCZ-nXvqiuFprxj!p{Amxp`oFpqorqrF)=bQ zF!Hc-u)z3v1qJwd`S=i`a^eVK84*4{iOZ5Q@(Rkz%7WtR+G>hga!SgI|HBA~j*gCz zfsvbuiCa;KPe}3q@i?OZY_yH#_uIg10EAsg0jg)sA?&Ugh7-}xv8kYfDK+MsL=VqbjGhA%{*9m|Pq;R$XFhW4*tAelry1P;b6*Y5KaI9I5 z2$1NIcEbhonv&ypWy+^eEUxOg{R4~qR`L6GhJOMbscl5kD)IW}s{5pTqTgi1m5&X3W&dCpF_8UKy#g^(zW)mZ_CI?DL@`4>K(=a6|KSzI}lNNuI>| z8*lL!TQ2@Fwgw9q%T~U6_KfPiRtX+Fj%Mm}NiEHkpyerhg*3WU8&^=^>wJ6N7Sl?^ zvj1Qnp^&g7*^1PmjDi~4gHTcj$Z)qrih-DXPxQ3Xs3*ssESj(bx@?Dd=*BtD7(Z?& z8|$E3l9 z`iNq0A2~i=AnQA$t2T33yCC7BWhP(}J-a3DU`(bQqwE)>pRirDZ1$7@n$LR({! zBwOEvkq{$7#^G?(HgQgd4KbR=XUl%GQ^;)^Gn8`i9z;LhX3Is<*f0=tz}+NnXw8@w z)ZslgAV#9E6f??RZ^kCXQ^|Q~j|E-e1v6&Z4xX;fg9+X)a37JSCZ*quv;=S90 zF)}E=p-mh%K>}=)-LK9rVvVHt`5Xk{D{s>t85TmM@DDbUzsl~5NR%iNg-qGLA<4^3 zy=?aKrSv_29%qNR(W}3vK!)y*)6o@oO;iE|=fdoGvuxBFGx3i;{LPUS-YoO(nsZyI z^fO@8+3l*)XD-=?nf#8jOsHJvgB23kqatzC&{R{b+Pa8hWW9lx=!@LW?aJF%XFggD zTOT4445ad}Qe{Q-O_GEG&&$O!hCPH)D)Q1U@<;7!WO%>1A3aE*7U_yGzi-W%mYjAgTw4*_*T;Es9GoMLn|MOst8mcX9xPHxA?qnB6&adg@f7Hb@3jnN>UxTu`82jKvCc+)0g@X zFm^$FvwS>We{%U^%Zk*a+dBjrV^&rZ%Gx7UVK|KA5JteFzID$66*5TKuWH0v8aM}! z@t~Fs>%-V!CVP2kp3-6y!N4Wg&{;5zFsO(g-V;>mitl}Ey~jx>l`(s--jD5^W&yj!-_gG z+U5wWz<}BiGDTtNm+jJjmF%?EOZbr+!YgZvX;o5*upB{UhT!ofA-E^qc%$ILJoP3} z^(Y9?Dq04ziyuDbMbJ}q#?rKQLNgINS<^x;2ZrCPJGMeDKEDcnF3;Fcri#4Q96sOi zVJ3HcI_=_%KRX05DQ=lQ!@QONBc2SXodBvb!^E;!x?X2J`@oV$;M@a373=Ln9Zt0@ zq$&~AO0l_p=Dds)=ioPeEG0o+G%}diSOVLQ7u6(maE8qvo_ZnLBT_F zoV6JoC}qJRlMyy9d{j zYfodX$=kGcdUrSQ;K4+P&hfQkJKEF60U*q_kL_>8>*&HbInmKlLl!)}<|YEi{~I&T z2ts(>iXu3IHyrdh#Jj27BlH}ASY@i7UIz1$(%H_0uSaAMtI#0dE!!1zf#b+8jF;Z` zCvU$r=oFgmJP^R)2-o{+OvBLsI z%qp2vWe|Cli*BKmIhN2n(-X=iHT*)e#4p?w0ny$v5E}Y3pbpO8^p)TkC;?w!m|PjB zQF72wE{2wuaI2yjp9y&4?@W#`_$jN-pt}?_AU(B$D8MV8-pKH7$UsjeiW*Y%gV^{n zk!N1xn?r|D4!b5j`bmiF0D#D*$+Jqz*`IX+$BJt@bauk4ek)|`CO$U`roLqjZ zfSSsJ{>j{tQ1WoymrtQaRc~uxc80pA$r9#|Uy2OX{8#zeY5Vo7&cV0tWAXmMvQB1b zo`=D@^$!#1Fm%2{$u31gN8=-R>s8b=1=($$Iw)R&Pw1>1L9mB&&DbcewQS zU-zzf(fq4At999$c1-yk`MvKm{jogKU(myUcB+~pOSN0+HR40nPLk}*7iKwIKu%C* zslXXgi~iUzOqQRnhs{h5uZaQIEQ||Z#%frWd?a`0HQ#4B|F!#zMpv$x4^1P#lOzs`5~0zDwn%v> zF6VFo=f#lY4mB@3f~Sm8xq&vuxoBu*6$7H3KK>e+d#b z+uQil^%4pFaISkkhIF_2?}e$z6E@z-wy}cquy9}+UDrI7(B4@v-CoK3^3b)g?7fwr z_JI23J#b*jpI^a~E-ttCX=MVWqD`!)$&Jp2x>w#zUsdUE54u84gQLlFZJ6;41d4T7 z9p;2UE-vB$k?NaC3|FZrE)7!O_x&q|M6ryg6^!@9Px&_JuNFTdSPA&i23<0XNAiui zZB2TyC-}L|BNazuGbPUeGZ|UJ_@bTuR^Jv2be90tD`gsmOZQP5a!VwjF;{YtrZXP(qxUH6gO$a zDax?Tx}ZXVDy>cp0qJWOgVp(7x0`Q7p4cHzLBC6=A6WC4mKGB-uCPNT$A1u>FESryU@6(pSK&}+&AiQS1*V^ktIP?c zuU|qdAbnq%q<*o!N&D(2u+H`0z5`V$?PlV$j>{^1GN;PvqTHagwHOuSaaulZK|Cmx zT%A|?Y6R`8ppgAtnXx%lVI|!hYAbj`!lu&7QHC`3;Dr0dI!x%1>L|!fbz0#_Wh*$$ z3%7WSw=dm)Z+`E|@m-lMZq%nWyfCC_Ui&SWq+mv#RkVqJ^AhiH^F%S*>S#Z`Yoo7B zCs0yIEit+egQoUki1l!LtJ2h2*foD`owNA2t#kND*d*N7cjy4dQv!kxDg(|29D&oB zisP_P(@|7q3&dS%FY{7?V}vo-406Fks!BUQN^0NH!I1u_%QT^20h!OL_k@~r^R~^a zH^XK5i!Ne_(?yNnPu`sM1@-|`P(`L5HueiFd z7m_sTY#aLu?8d!W-OjyYrmfP}@%dtUC{@&w-}8_IJ1+*mWPQ42Ohks$J85w_7G-(! zubzcxfFL~DB<%AewhIAy9Yl6uu#_GzvmNrTy@|`YzM*har`bJg;O#HoaPB!cNwJ`3{FAut#Od?RQyz8>Tg8_J=%; zJ>z-cXJAzwf|peZG%08VDN+KM-DDi`!|KMLz)^-E7z#`$QbH*=LQ2u#%$O7u^irNj zkP%FMJE@eBO~^ZdZ3#%9K76M zaA=yax;+aT{>1S|g*UXp@tODDs#)UgQQvMPA_`H;R63QfKg=Tfkrd5&LK3<~-&pNE zFijV(09o(mV!pumEpy4Xy7FNPM1hq%3ieEipCloLNMjUf*53Nq;{g&kIAHAz#nHo+{~LlbyLSF2AwBrOyGqj`Mgv}bcpr1`i{3YJeXkFr7EuX6005;{~ zRgDxQd*#r*-oO+8XR5*2NR^u=!J)KSU}COl-tdm(ZN)wXuYnJ-KdKYTe-B^^_H|U7 zHTcIcfidzOYvXPg*!Xyf$BKowG<)e2>S{wu#u{8z>fEM|Lv;eovqIJxQtng4q$KN> zQ%^DtOE7IW*h)tE>Exy5MLc(?4Sx_&s-vx7bpo^%w$v*fDj5Gf50_IPLT6 zuwo<%XN;eqLC7w&>cR^5nM>XHo`mU6S=Z6GJygB60__lAdL2J~{#v^6`DJyC4B@M# zQ(f4NfJ!b3Y1rZUHt%d_!LnO>@aD(ILvvd6Q9{8_qyc8l>9~yG`DoGh3%{rB9CC{W zij1_{`cF+AUX9sCyjJcNLh}1Mp|gCbX`Sr7}aSf&ytAQFOxJ9-s^Kr*EMaU z@gf$?q09d4%G{HuVf$Z3sqd8>$HiOr6jAzP+|Pi8|9WoD#(AsulXJsnYb$HE!At|; zRseJFLmG+wrfQ_k~Oe&CC7b8}CP@6QX@zg?; zkoWp69BzW{*_Vu3l305PMY2XLjZu|1c3ov`vi)UJvMHLU-EN@pnQ9s*dJ5wKFZ%dj zFFdqk##^+k24~jc?XznQ&w!~e-%!~`FT=pnNtID?gx((ij)e9E^d9e@W=z<&BT$MH zoox@^XFZ)^f2TyVL-@$>mX@*an;l~s-sesfMfd?n*caQUODj@t4|nx5m$P)?DfgaF zU$BaO?1a`PdX|eNW|MrCQuqBjX&Vrm=0*(U{>;ZR`OhQRa&QW3fvk?-5Sx}SBve^= zrL>9~=`J@rAXp--;3W%-IzxFw;(28)-6p8J16NaJ>Ck{N0D`!6<~b`c7S7MaTmB)ugB+<_A0+@jVU44TDGUxtWUerVUMlgZ}x)s;&x624j3tZu}`no zweIp{FkZbY_@`l%%hk8mHptmuoIfBy>RL8pDO&Ukuq)Yg3;ejrgl{~sSf2AW+S3IM zq>MefZ4Jhz*s;=l@sk&Kebe60{Z9L{3lh^dfH0Y4QRY@m$}Ib!$*_2!_eyanqxNQ3 zRWr)W9TUU94G+s^wovC@MRTMR1|dsH3y(cXN0V3Rw1N(;F*g|n)(V4rGbNi0K{VQ< zxb%iY1twN1i>b+9fW4K9X=3~p*p`~Yr}!ty;wkfg1EmbWmd1z@;!$FH z@!w-K!UqPx=zhjeNOTNc`>J#F3XK}pku>LT zUDNtbtf8pSv^bRM;T-oCjjr2&>^1#~`G%nyE$XMu^zgT~)_!-;9!D(QgbLo`fXeI> zzbc}uS@2Rsw2POG^YF>9iC9rf+~HbfqJ*PpUfA;}aDJ+htnLa~b%Zsfw7&GoqwBjL4@v#b8?RX2#-0G(5_zJU3^G2{rH~PZUu<e88)Kr~w(~nIC{4-*~@53H; z+)9+**sC?;VKo5tRcih8ngJj8|ORc%$36i$;w^(YXuDOq{>2Azj z*Yo-KoH+#BxPMJN3&taN%*pw2(>iS7VxbFWKbht{A*>j(bSEBA`*rnZBhOPnQUC6( ztB{*Or10<}$o4dvSWiu@Ky8Y{u#*fKjq5g_v3bmk7vXGa?=BEL736$yN$fFV(F#cM z)`Dy+H_7zZiMb+8m7=U(e=12FRDI6?s~aI(HR(nfiNKHfnpR^?(OlE=F@@_H-f}wzQ4=UWCvQ+H@2WIwA{ zi~)Nc8qev)6Ro33x2`@CrJMoXD(Sw&Gl11dY5Qo4u8eN)8cF22alV-2!+s|d_9Oc} z@om=*Ze>~x-d!fCWA1k$Wiz>RuveD_BgCHP{>dMerSu6%Kdg(lzu_AHl6Wd8?1@jx zW`xDvTZ#-YUU+FYxu~vBSK1{g&i-w4^8h?p`0vg(}b6L;TkKatYCZ)ZXp1b+zf z;Cgv%(?ybtrlZpsIlX%EMaz+)*gXa7_`hxQc#L7phd4H$r*PL$IKGi(~l(9mx(nEVBd%@~HPF4wemsbLPX`9Ik zju#2hYySDNKOgF0`Es6_+qsh6V*qY~17uRRVtu_^x*+_vs-4wNKvfsr#tC3Uu=nqJ z;VxBqrI&ZPWzH&`3VpGk-f^`#HBAM%mqGH-1fgh=iaajDh!cW0Ac02lzm2;ZD!h=U z&=2OBVT)ALB*>7YrCnZos#yI{W+d)+vcvD3MkcE2x6Nv>D$|VF4YPy7VNo^he={Y* z?6jDVcx1EbbHjBst&=Ts#P|Ba-@)mW^Fq*d)8)6s9#|Tr8+6Qwd%(RBG)qNbt@ACY zV=fq#0Hu8zqZ8e)eDJU^#Pf!a>QqfFkSz6_-Mg-2kl~*G_r+_kP80k(sdA{Z(VQA! z9~J8`E{>mRbH8jUK+iiiaKUm%mz+`%J$=^`YYsT4KITJ&ab)i!Iv;gT{8e;8?5YtE zm{hmTpphqz6|;f`M{;$gaK+X2$M%}D{F-tg$7LNtZFR~mvBj%pGdq=CIcZpGNt+Ok-&F6UT`OmDd zuVQLM^=c&<6!h&{cFThv8_>oCkMF3=9pxUot7w-~0vf3gSM+czY9yK&b92&Mzi|fm z2bZItT^jHDJ;Tm+SH$<5UXz_I^?Ay8+=wMYU0g88Mk)85B)x8Y3~Uff%H|1vU1vm8 z70JHr;KaizcX$TaH?R(zBEQ41^=@3^A}<4|SwpZ@r2$#~8~qw$K--|q(j|N@5}L3& zkqSrm$v*emV7F3+Hl39H#wic^iNqD&9{Z)YYP00IosHmFnzl!C(-w<1HzNCTO)~u_ zmk?B`4!_IWEK0`Z?M=MX2z4fV|LtY&V|_Q6r6+IFd8{wV%b$$J7K}d_nG6iQDeie_ zw3MA1@{BH3yEZW@XAJkBSMXc$J&Q!D(E>%SDHkExWImi=$#qM8=}yD}+Zsu%Aa|8& z?4OvZ*{r>7@C$`mkAT%*4)btu z2J39%MzC6d8jQ`Szr{39%(p#&v7-@6ZL*NbCGTiYPXIOl9%rPr1F&4J=y)PY(VYgj z*-T~xDaIns02Pe0t8U_oIXA(4dH1eTKi{!vKd`wU{*#4BSchrS!vfS*(ENwvXc_?G zK&`k7?wLIUN-CW=A1x_`4UUWB(UVP!{-x74aIQ-);(>VNcmonO4)9>rD}tmh6e6B+ za3JfMD={3K*g+qMY`XG(A#cgVYRFKf;@cvJzy67&Cxp%eBmtW&<<-}t;D|2Bke6Y8 z@&50*->LAqUUBmWNmPW<`0Zwr8>yDDc|Vqb7uXE9)OlC!d$Gv|mT>Y#G6!UbP+Yuk znT`%JL4-85D$2O7|9xyPl(mohA_=mg$XS{sOfw>uK_(hA0#ifyNOMqNwqwV2xG0wP zPfr!AR7I+D)X<=4nIE0|p7sy0f9|;PvD~kRCrOl=j)5rzQoNJcNRVe!H1%}ArHN+o zP1STD8CaWt=mtDgA-FYWj&SH%W-Z1p@-G8#2l=j6@38j|bhx?im3)(}kSwg8UEQ%9 zSWE8|VqNy(V2!tc?uk5v#0)N$SuH$-G8D^r#nyJ{JJYIzb(LQ{O1>Jdw<6MyVH5fE zXPdwHu(jOz^o!Pnsm!|}hSAv;9{4_7Y(3C51(Jf~TsQ-2ZVc?JsCw|Y1-*^)4^Py? z(7b36rn?%9V5KR+OM0_mR@mbamHV#kxwuudoFKyR1V6>p{JssG;ppZcQ^$k{QlWwR zIKM;`4s~I9fd$e@aNlJ|{ixPAkW*LC%9f-EGq7q|#fb-TI?-)$X#lQ>VEZ8Hr2fi=J}75nic9oM0#l&5wucBZ7qvRB&J7aQOo5Ab2S0gm8Jg70 z2D=|E{Z6=TfbTp8=PlH`^T793w$~Q5$X}`B?F^`y6{!>a9dXa(AXdQ4-qGXfOOJyK zmb3422_*cLevp5hkBBWIgr-=BQCl9CN#@Rz`KE^_W*fBky>WzD* zyhw#W2Tm2|>Xh#S#loh9UFaLk##_-4DwKWtF+0{PrMjU9HsrC zOoTFIdUryaYNg7r~#^aEsyea8i8V}p$e&WI0)*M}1 z9cu$NCn2mMITh?W$LP9Q&5OF-LbB90R%ZZj)QR}9!l8*gH+bm;4-g$|S1FhL=T%C0 zS3w~H#tqcI9aADEC5+b*sYvm+aM(veTwulF-y@QuJ%9U;M%B+>HOINwSktcOA?Ms5 z$OQJ4TpDd>vyMKw+yNF#PXRf7C_oq+)4?iUtb0p1A zNi={YHrtzJuAa9bM#2+K8PAWSX8;~zKK3gs4m}JhK!iX~h_z(Ppiv|Q$)X%hP#wra z5i7Wxhs|dZ)F-)gdrEdN02Cpj{oh!`O)f!J+0>{Yu1{kQ=>%@{d*PIaBESE%`pBoE zAVZpj-R-!@?Z)Kxr$o)x(@SRxeWdwoXHYwOOK(hy*p1&pU> z46tW2pLT&gFT1(*$wD}B+fVKd{F)>VIYhnRY+8JJ-VfqpsDClR0^)iX-Tai@@1^3B zkyzeaZ>;ZDLOR2Km#z(z_b-9 z+7r)uOZsQ1MS_*U&11FD;?0ytvb#-}G~m|7!Gt%P`w26fR8&mI$Ti^5Br9xD;HFcw zwNrdEduRvWx=xJGh>PdMTXjC7 zlx#l>eWz`34Cva1CB_@y3%PY?tsPnU-XzG?oNq|v8|LNIf;P?nol&NCE?^T*Qs7*>F1f}P$)*>I>J({) z?G(blxxsqCse|UrvPkTcyEaCA1>+!FRZX1vK_Y8I1qGZt>llpkP#2bfJR^OI%^fBa zqTniBg-_=_3i;WihN|B22GVLYyxhEDR#`-Tl=SUdceR8|ku57tzf+cq&6ISU!e8$N zl<2C&b>{+};FhG&GXOp}-B6i6Yi&1@eDR(qGSbWS{2V`5`VLaNcT#gz+OcblCCn}! zw^ED_l3@s3QMGWR6U}=IYYI!jq1{X)@`ay14QEUbY`^ina`!8F>ho>nxd*Khuk&&u z-||TasPy-jyE(hpV$o`z_(NqoCCi)+TE2KKW>Ck2T9c+^=Ni!`+J!3&8+Ndl&JcyE^3ce?$waQ`?Ys6r&AsXeNlnUu_|ReA19Ocasc5kS|v~$ zHcV?FV#_WVazoWKV;8c}R@cu*3%z`!#NG|s-f?Rj{GZo=k8s++T?^)kD`0g5?Jqm1 zhkD*KZ6c>^_-w_0l8tVX@?t6~g{+BMcU00rLxOoo*J-d}k@o$-&_ec&Aa-3?J(Fy> z6LaFB;oS~e8+7PRJAR89k*c3=qd{jte*`BLxU#n|u%9Uyesr&8>~byV@ZG@N?*FFk zkt*F#9O?~;K>@2ZD^Rrvr7aUh3ok$l%uS+r2@;K_QQY;s{9`Z~_=EFWWF@_#w0cnL z0$!c`vdB_OXFND60~`2qD0`6;#0J+yY?t02=r8FIA(Uk(g3KNIoakhe2hlfGox zY;L#NEHh2hYhss4C7Ivu{kO|C6XwpAdOx0Cn}o@kOQu5B9-EZZ`{#FapNnEolsy!7 z>G237d0wyM4*v6w-GtF+3DU=2_E*gW4Mn*#pg8c&E@&$1mrX-{$v%8Pam=UkoZq&8|>Z2xT?73=JO{DN?&+d6NmMb=qINms>M zxwTN^bJV=pf|%Z|lB3>%T4<02dcIg;)_^fZ|v0HFbI$SUh8hJpON?h=~4_mX}oa!3~{*F z=HZY^$LFSrS$2gegffO+)-#^c9SG1LX8q2K4@~8G?YiY`7d41wixIG(hDw7?J@hhX z9%Q5>>RpZTm&Ml;ZVIo`cxi8nYIBMA{ zm_my-|7?hyvz;P`bgHHPn!D^coj!N-CAjjQ^|Z!4g&w$?T*tM$#>J1~ovw`5W|4oOrU zKPkZ_kNDtr=CoNQ^wom47e~k)ga}dW)#7qIQFLR#+UU`PDX8CHD~nLGlpf0g?%^kA3q20VtPEad@u?0%Ez;LrQ4=*5$YRBGI9WbRe3EO=_p{w))ngO((RR>?fr zs)OSY>5WMW0=>svEbYkO^hpbaPB#2PNmm`E?%9F3pIQ=Hdql3s-5TQ9%;QKqG2_hn zJ;RUkqcK>k%s2J90hqwao1kRA5(=0$n5D#HEkimt;YJCh2J@pf-J*?hE!(s@r_+{10}3E5hLspql%_LI80 zpylu|w$mpe&+56Jd`_S;Vy+?vZh>xie5o6QOuIw`)8#vsP%X16sxa3h*@w<$H`LQ)Kq0P|-{b3>~LJ&2S`&c1lsn&h;8 z6toy;eWkkiw!}xj2OxdOB~8%@XwoDgkyM#M(^qj`pp)oqOJr;uKKAx2Bw#`JjC;;E2_d9J1%7?v9y`pqoOA2Nz&|4;&< z zCR0R9CKYtz+E*Hn;Kf}L-$)9e08Lr5QtltwOZ$aM=X4*=616k4iM{Cc@?_b5?t8SAZ_Q zk~glf4L}5y)aFqnCIk}yHDmlw1^+iHp!!Kcn}s8*@EwelLyg8^cqqBw=k`*b1)fBb zT#f#wr_OizB~CRoJRR6KV0z z$tkl#<7_L%-9Nu?7IQkfYtQRosp`nItgQZ5pQSA z$d;Lk8?~o@(w~;M=~E;H25C^6mgb=>$O@^{z9u(eb1Ff?c{vBh`oye_{aX3#ezF>L z0wVUx#DnHHniX;-K+MMvb{E8$8|6`&5vtNJB-K?qu0Y=T;gSSdpvg0su(@p_nj5KQ z)A8rE+UiN&1)J!{XmFIL#~u8uHR1eD$V>l5ay}We6@VoaTpVZh#QZ=i@GgN+vQ!=h z0x`j}(qVVb0QIsRAMB&$ABwlisC@5v;Bi$pe$)<3q4|z$O&xN+X}AR{j67MM+VYqA zL^q(U8=kau~D|3y|4TSu{I`Who3jg`sT1v^S)0{{5QuCr4di&0znQG3f>l>0r2 zKZts39r8ghIG-i))){cHP}x}w&a$Fb82#$!BfBUM=)SY>`0yq;EUB~)GrQ1X|2#6? zW&JgVCGEWTB&{|tM=N?c2>0%Ns3e#46XZn$p9f?#~Msr7*qvQ38l%Vhu__Fb&;=Snhdmv%Ya=KJs3&pQmd6%k=ih7Fv%cT z2s!ep4dd3sy_L$>??&2nDAw`uPb45X2wuhW%E^nK+*qH;XlsiI`(8-e)W4QH zo^*`Po>&W3#USM<#GQT+pj=z&{V zr^8Lf4f>_CmOL|A0>awF<7NPHA64=1jXJ`T&e@tLB_saM-j;WX^un^AV--A%PkZpg zm(=yN$|m0sm((b5HSle_)3Fgd6QNZ5?NF0zs4_ z8mg1;sx9glrl?Wsp4}XW*j!9AqdZ!iZF; zav(#C*)^F1g>w~y&wG1}p`(olNZZ?xoPs)A%l>vYh0T^>0{RE5FpWDBtJ&k8T9j7X z@m=m%aOK&X%KSl#Li8WoOkdcMnNYf zpwZzIzHyWkUp7~2i42_(OmHB8NNKDji`!DS6U~R$bf$Y~6GaB{^n#!7HXD6Euy*q2 z-8YkJv;tGJ1(36e!sI_v7@bl8pSnTJU zyJtZ4N2@Y1{P|Y;?q$AacgmjLT-?`43axBRd3^`GclVU{^@XbrX+Q!S%66Z5Y`u3U8YtW!+Aw=$^6Z> z9_>w@s7m34#L?Ig2{;?)@qb0lBJr#J-csmfDXZd2L>{ej!jS{`#bRJZ1<~si~g# z=LqvLj>c{DaINjNv|kf60BW1AuZw1PV^^*+%JfP5u~LwD|6x&Xb+Xy`)flPx_i~d z^>P0Yuzv{HKLqR_0`?C9`-g!2L%{waVE+)Xe+bw=1neII_74I3hk*S>mR54*~m!fc->mR54*~m!fc-g==YzPsy8`|K^MN?%1pRtLrc`vThm!;@BJykCzX&(-ZjKj`jSJR|MB0{?4BbU! z6mUE6nUvzUfZbH}nE-jK0e1jy2*}ku?Iu zUPd)W-rasA(x+&}(EWPgb2;~n0=DrHCL*T-r08BI`S<4i0E0)6kQ-{-FV~e7ICqS5z!B5@`#9 z4P8Wb0DcUlZGWu;oad;%W!pHn_TM22RR`EFe; z2kv#0=WWl0@DXsVsxGZiW+c*91R1)B3?_d;Z4h=+ER8>SHua#YzT+t0+*6JZ7pv;5 z3gty2ZAWO2zOLteUUkDm2!&nie(_c!yDlgItQMHR`4MB0{6Lm%RK-aK~@{xqi^|M%v4cR}cKvpEu)`S}RtDg4_O8Zb%9|4}use6^G{?$=l#oqthz=5hd zw*py_NZS)+G^+YK@IuKpuXL0x1HPA2|1ZD?CE9-z*jrU+myi*ObQDE;$NN3*aqUM> z1|H2Qo0!+jCVSm4dgzeGB4967eYjx#NTeg_F?10bAR_yT$fU%*G>a=dthsOMQ3B9UeyB0B@)Qi}c^_$T1D?#1RL2IDvZ z9tXB|$o+w;o|)2Ef8b}pk#$AmRCRg*{euyab%1XGy8xfSrXP0!_o?c;&CnqdX*MD< z9M}XqP&SE`k&7S0w!mkr>LJO!(|}zBSc3ah*%Dw#mSc&CoC!?8de(DQ^(PfPOC%D> zAvwi4RaLjI`RrxjKJ0LrViB0O6yOP9s~nkQRCP{c)QvgJQ|M;dMA_IXPfsL^j)o`Fc7TjWPa?MfIg)LLE0VJmiw*fZAo_!SXA+P{TX!$aB z{CHWbbX=8C)ywKX0N51^_MjQpHL6O{3yVgxFBW|94~}+pKy0w*Ur zyyL0!65s~lZ%G`N9P+!cV41boYruvD^*ugCUiY^c{R)jb@46OPw@C&r zz%kg!qKwWj1K$ER$!KStjCywi{R-&)Wrr?& zPZ@fmbQdrYI2-t6&I1kr&c)_2tu*Yk>-!Bb@-E5`)zhxIWXuC`8@eX?tlels#};K9 zHBuYzp?81$rV4KW{XM^ni#_$5(B}+2;0LoCwjtjNBlfxeifu7eY3Mf=&|@JmC+D6^ z9Bt+qx&k*g($KLX?%jdUJTKt>MZkz0y+;Pf+r#s_@Le4Kw@xZgL5_RU4lrdg4)`C}4I;8B+3^j_ zw4KHS*r?YRR}|!M3iN1eVB12??wyNXhgQ^+_s0Tiin=&bYu$m@}}akM!Ei!7A)44-qzI3(cj{-VeC@bv(Bcb4qYx2m#-4!uI-y03+K z$mN{_ZzuX!B z)(xt<7~8M@eNJ1aI?7x+)U%0*OX7i!$)t6olCBg2|49gx{SOVRecLPFYV$u5lKt;1>wWzOhZm09PJz+tL)IdrFa>- zi1Y)dU|w9E#4>W`X+9+9fAd~&7nW_OLe3G9y{izEyx@1wxy?7$AK2gHPmb~~%q=>N zP-9CA&d|+4gat=kD;d#tB)$)N0dQ0!6=@K6sp{Jm$jN*2Kdh>^R?tpW2rwn-waT&; zu)3psmIj0kQ=8CE&be*JjL$<2ecR+HXBw`TKo%X_tLGZJh-{9z$95tiJ&lVzL;pcV z?NrHd;M(M{Ng1+?uA3se1veFJ(`9H`k%4=y;)}?d*m^-I9Xn6=>Cu0L9opzLrmO1I zie%*l=6JrMc8cIygV>Mkc!0j-Eoc=9Nb)LnvMsdDEJObg^U6#kt>@mCjBG+!be1g2 z^yp(mWQ)A3gnTDXLl==FDfZ@THE#o_S1512obpyi-?psg`qv1)NJZG0)K_NSUWxx@> zTU?&FvdAt~OI4MLh+KyarG5Cbs!sIQ%!aHJvBlCf24Y)o+iJ0ZnUx!QO}(t4@H#1< zxr}U{s{T<#UIac_S2hqE+57@PL{`HhucR>zb9Tz2W9R6ZhAtu-6Sn=(4txk4rK)#S zEO)4*%%?Zs9Sg?b!&9F3^`NTPi^x7?`!{Tktt0$HsBF@WuA3E@n{g3bFNoDdWU#8% zdWSg;J^6PA>7CO!R<0%NPWH=d8ogf>we-n3`cc^GZKv=qmLX&WlcjZj@~iYvDGXlCnL2GT+coznL8IDZz@yYuFJ@}jq|>gdSH9= zdnEszwXN1Y$9GNnI@Zu#bM!IIQlca`0VmfD^QvYs*$Z;RL}ZYvzTd$1y-?LhMC4zA z?_}K4g(cm%Iza5=obnO4Uk0vvSu9EMFwE`I)dC^jPVb~50OLgD4Pc`T8Qmkn`Iv8d z+Guu|hzw9w*UL1E=gA+%Gz^!a*RNEz8_R&Nsp{oTXzNW!nP9zoE4SEc`7X9olI6v? z3+~0mdR)&AX0Xo%$g8av(x%VQ9bh`?hJFy)FRew`VWjSt#p_sL&wBb{dOK5lXK++9 zHE0Q`hMu@Rw)5Wk9N)~2ta--ZRJs6WiK5w<&##>~34hSx|p^lm+h7Icn=GdQH#saJ93LH%h1~?YRppXXyf*(`e=)EcpCSj)EZb2gLdOwO!va5 zrJZ(d+jSAJLn9(1u=DLM9<2NS5oG^XUr*WM3o-ONRds3IXRAz){sQJk+G_5=hUwoc zv0q!7WCi%DoZC(p5tp+?(^1tAfTOXOWf}6qQ%y{IT_3)RyCb+%mlE*o~ zKDd3~_Xie=$WvHs!MCs#_MNbGj65bL(~WwH82W5%UBz`MC(B*hW#}6^%3Mq;Q0GK! zYqva(sFq#W(54xYT4w^oTNx$O_rfy3Hu8IUGNnyd6xgE!bl(jdg1g#xC2%;QfzSOj zN4u`5!>2py<;CDnO-_QntX)Y*d*$|{`nc{2e7UOMZKkigS|Go?h@DmNbKqdL)!nv7 z?PT29*dL;!P}N!3`Sqgpr;t8}F3S^SJF|d$UhFyrH{DV8jH;&YCM0WAuHR$F&C~ND z%v{>w_NM^HX~`9J5!pyY#)`-u$+bP4pUqg-E&^%d?dx|82}2 zGB`DFfF5J9`F9oH$A?(@-d+hUsc7h4BX2a>i4uL&CZFz*;d6b21&LhKqpf!xaz^LW z{ar@A%w!Wuy=jg%Pwup#yU!o=D-C#nUy+koK0}vvuouMAfVSQN_HUrE_XqwF%W+=h zyLb;dLL}V*$>!pZO$^)vpYk_(}h{)%G1F)6(;g}(; zhZ(}+$;!+2yw)YG5RsAC zVrP|9w!M~X=l~*e0o5facvMxh0`$9dcnsL4V4L$*HTaZOB+^&#P2liDipK`4C#bi8 zp0{ODBZtlki4}=dj+ddU9sT;n2U{f4kpvB) zRdpE_X|zZpfLcZa_aP3H7N2aY&-5mECP!!ibbWp0=O<3cqHOa z(+$0+VLJ)81@Nil+O+1sH^f2^y^4h(x*M3Ts;*Qykw_$i{|DHNe=WH#LOuWh002ov JPDHLkV1iW*x>f)H literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/brick2.png b/examples/demo/demos/data/brick2.png new file mode 100644 index 0000000000000000000000000000000000000000..cfcd079f87a7575e7c6186590575da913fb1d106 GIT binary patch literal 10713 zcmXY11zgkb^B;^F0!piZD2+%?x&$N!4pdsYMk7i|gU+Btro>25Bqc{9Fi}cI4PlHN zpui-RbR+&BzrX)puhr-IeD3bKyXT&J?tKZjO$}L@FEWEbAXb>s&AT8F%`Wh}l!*cO zK4?UCzI`l1mVo4fX9dfKz4 zYAx3{yi>cHy0PCeD7UqiONi1c2=A;4stR)K69 zU+RyE=4$5767fcWUDQ`{O}=Ur9>_o=)wkuH-AM0|MGif$v9{PURDcOre$Y_M#cvIU7XGS_x2`O>oU3QA~kqO)f%5w3=Y(TV&oB_65EWw;LD%^8Y*F?1Ym?R*khW- zEem~Qb~<|qlDofeNPEI?#E^B(+X`GO&2V&a^6h4ax(4f~*@6=F6?$1eq^ewZCv7CY znwFEZ9+QG@SJzR$?~E9rwZ7efw@aT2eX@`n6mTxOU}Vsbo74u$nYrp>2UeVng-4b& zZu$O?%^DTS#!rt+t7(_!Y@~N-IHqzoq49ZeMiTI>dvv?Mbk3#I$VG%FDComvP5{Ce zL;$ENzcWjxnD1&GXEJT;w*qY1eG{|pY09U=M~GU;zq z+T(w6)|-D&7ttIEJ~yPgVldGJ%+U%YX7T+ID?H(a4o}=|Kl!G&;egXQr0cQ z)&5YT-rD%65V#33t(+`5Mc__zQBf;ro#1E-lz{R*~(c}+T zt&Ji+k}u~54gDN5(jDG+jOCfUV1to*S%O=?Niu?s3AdKjUHJI73Cb1Td*;qs(Ddck?|HCyeOOz(6CJB zJfa#C6fOimQd0F);y%0kE$KAPu9kKpfyHu0AHKh|ufZCN)(C zf5%CdqPtn-{XCTZojfTKhw1;6l2|5Mm_xKe?(_~E7NgtWe+>cdq6$~}N9yuwsf7)- zo;Wb689i+TP$kA5# zp#NrAm1_*lP+GV3y^gii;mK8w2;!(}eIzm_u}JEFoWdcCP_Y~{6cEQb~Pr7?MB9}LI>1epw2AD>3i#-XLUZ^RM|R07lVO?&0CVm zL21LJ1<2TH9=ne5IQMZg`RA5mt-FevXGWgjz%M=de;wD7p^*+!-kc= zcLFB52$-l^$U!0J&ax0Jl}7#U#}V8d>cqadQ->1EaA=s=$ec~*m$uO#2GHw$1_vU{ z5N^&5v88~~mBKL^QFtHNb*QDsT#_Z9#fClXIJSY6yxH(&B8Udu7vTll!4hq?fz@7R z$dWxWxc&qYs<=(-GELCLT0qsiaLbaT!>K~9{Bn7R{(;Y-4>k9t;;L`%L$gHQALkB% z8`CX(488y>aw}X9aLX3lx-xR~2j$a)`GZF!U#tK^snAFq6>vEQ8DagyF;HZXR*cpV zR2_Q!TMByztAuJjz4kOI-kZCA+M6fve2v57^uIu4hwFw_TITw8bI*iaC)Mj26A!jE}{Zoaj7zD~^ za$bj5we2VvR`6~1&Lf6csqK!(@@$jVcrz2nX=X&D#I~Sw)mOL^+d9XCN6CP;FDc9Y zJb@>Q2E{oHUJKLQ_G^tYe7nA1#%JtExQNOJv6)W(;KZ)P!8Oq8D>JJItS(j5wYM}>{nDiJyMzl^v$!v!mdEyUfT~2G)N`-G?)+s% zyqQ;tE)@XAhC*IlAHbP{*)D6CX_rtn z(&dR6rCd@Ud9PzUIO@lsI6qTp&ODCio6;eWQ3YA5rr-8LxU?2eFYHyi8qx~FM~Ge6 zPL6u>Ha{~Goiq6*K^^17dxeWGODZyDz;R-{2ZQu}RT3{L&>8z8P;O9K|Jx5WfDl;Z zSgK+{p{=Mh^z`rKIy^Inn1@^xlfPRaWCejno>@SjGRBQVy6rQBv`&5#eaSAA6WPEs zwvQPDP}fE4=I;yuyM4LDAfpDO23VscJ}BP7Ngnf*3H%(55h-Ll5{aRjObK1hQu8=isM(M}?_kL{A> z-0Hmc*FHV5SCEoIA70zO9BA0PCSyjsfj|U-_-K7W_gD5}q4&Ydn-N=QuuBfrIdSu0 z0V@xxo)&{+MJyikeRC(p^ZU=TB{#&!C!+@$?7>kILRf!M?(*~2^w6Bt+d7_nq%X*` zCysL5hpd6wMSMAI#gfDbWCH{iWo}Rv;)GfzhZZ zJ0eu3M(6VYPsNhh7;c$Xi^1=VAI&GxIv9;IrxlHp5cz)EMmlOx;;YuP86CWbw z=ncq`#JdDZ)H}i*G;tJrsdmF+RR<=eEb#TMNc%o*h6q=hOz?@80iRU(*gbogSn{e5uD2J%_;V zyfI(HI798QxKJp@gh^Sb1k4$}l%Ul9D;mp+2#r!&8fn7$U4p7313{m8nYh7gb#mL1 zBwCUdbb1)~C*PKTsTZ-If05!X3e6e7b%2iqCew~qZf5Q&k=#kk>-N7|uc6AS@%eJB~m7@K#}X#r-`8k`?1R6S?=)4DYlf#na`b->6YpWHuj zLD;42E<3s*FgZjmq-6gV2T!A-w>L?Jqytsg$kDC-rb5c~D-XBmkI6Wt;Ws{3p0A*d zRlo${);AP)Glf3G-%`39a%eH)UcHy+D97}A#_bJSf6KZTQaLYYGixSSHJtOVQpoI7 zG?9?aCX|7$WShC6a@t;5%$~1m?Jodv5iLKW+-^gS1aqG{KQw_bG`-$p@g=qiz;By{mA_Ch` zf8SzmgLb^>={7H7ekb^>IEx9X&f5_)0q#khY?jTX!rZZpw8BtsZI5i z+=aZ2<0Hj|fXQy+i)>~Jmj|MNzR_f6T?!k5JiBKiI;*M6g5hlJtu(ZmX_2WJk;^wJ^X zQe>BP&@TWc`&H>pWp=ge+UgC+18dAZ&Il#$ASRdCHnV}Ev_B-2J8*Czi9>R7VK&$P zwhPfG*Lf~9c~%#=Yd?_!7hK^7$%hd{;qay~Y699poSa__mh8e=F?3{?wv5GtMOf9x zP?Za+7gSW$r6_(~lK%3`!d#k(=*23b!eRZ%lQ5UZjpg?gJ4Iaf8z84=?42G6j$IAt zte@hD2xa(7ws89GRqwqPvniXlsWL0YB)C4>4`0}QJ`K^2=wMyflc;W!aItvc?e=7&HGz*?(+>{lYyEoe<8os@s`0@y zi+mt=e~bt8CCySBQ+jUSFL&7-Uu#B-{_B(fo}c(dn}f8|BCI^|m1GSNb_4 z8pU@NvbDD!)vHvKK@9Fm@8$%FxGN~vg2?@fFLes7{<{l(Yn^#QFFqSlv`O`Sh{TiQ zUp8ci(5X+qy8Cwy@T#20BHp^gJgN3KkG|&&tkA&xFBVqAXNJE+u?Y#TWJ3(t6HSbQ zGvfPkJhT}pUW;t7SUC6aIn#ts9jhrm0`I?fC8*j76#S5@WIvQ>rztaB^~7(waZusD z1}o?gp=xatya`N*>@)z<_Emc!Q;T8X6-{t`q|DwFSDyljPT@!r)xJ3ec6+u6X{YJu zXhr*<^?O~enK`hP&Gy#BPxsUVB|(`tMKqd>=>)%s#yxz1l6aQp@78wxUBb^g3Ul~) z+Q>Kl=zBkZ?VAF&dIc!hJkGGhYvAYpGM7$4gJyCP_l1HXGYdT>s;(a$>tPqkMqI{u^MgFNxa=a;P+?0?9pq;pDFCg{s9 zW?RH3bL`N1dMe+AC&5;mz8?lf1^w95M+kirt9Rm#I;DgYEV77Kxtu;~RFJ5Qk962a<0)p>}1VZTU5iq^qSNCCMp8t2;Z^ zkdn!CNzIw>Owrs>lSb1Uc>1!bay<(nC5(gQ{*#qOf!vhqQ(}mp>pRG^Q=_ZH$Z-NS z{nK3B7|xFy27g17ultM^@IH>7#2_ zU)@PVj|nVZR|~iFXX4dn@7d)&ko!6r2Pf``S7+tGz&awcPA4ixrs zMoL5z-sPVF1)5ZlQEM-5v&5!0Upii!WoN~sxKOq)Mycd>RNhxVWUsu(eI|PdFx}_w zcbd~QnEfQm22WL7i)RX8Bd3`!WVO}a%!ATJgF&#c93pRgf#LNXJ!o6w@~?P#$gw3% zRxC-RfXq%9@@yNi{=TE{49MIqSU*U;9k8&3dZb%z zStfb#(J^u^JzZvK3~QiydtL*9Jn^fOh{!5>ogl??ozX?gE-$3stz%2Rzu{w+<>ssV zZyZC@+`@Ea7X=Xe9am2LpowSaWY!O(iAC#Dv%XgQ7br@|4UVdNWASj&+411Zs$ZjO zO3oJ^Bn@*UGNkXxkeYAS{$Pjd-WMwD-A9WT0%K;yhbf!4hx-RKw72YM9h3^Gj=S0E z@Kvo@$9CTM%Bvc86&kXFwhGL6^iyA7=blV(jZACXNK1FE(!=@Pm>t`Yq~LZAQX-zQ zy{fd4ZDl-yCrslK*UbgDoe6GyW~-X-0)Z2jKExB+_Dh5IqZIiUuv=b6)TRkGOzPl6 zur6tXM;cO;yA4_FTlW3$N~?!8V&}PpgC(>!I(!;6E5{5aV=&P!gxE;kEp`usRYCEO z&cWl&7i{$I`k}wIY6?8?M{BknZw7YN``Ru+3@fc1b|n$dbvb*nJ^N_SiyD@?1vh`A zvp2uoGp-ESqTK%{(k)%th}P7BE&i^)PrTO8dZKCo>Zr=1xrFBGwJBr}PdOLn$lS2eehA{GY@@r0rOGW+9`k;uzLWdLX_bG z9lsFyHLKqetlMxk0Y;H^NwZIWg7a&qTVN3tD@^TYwiuUO7ITewsdg^Od^2dT_6l2> zq}s-b3zW~Mw3(;-zKo1O(c;V(`swo|NIT+b@lxIEyg92o*WQnFk;YK11$KMcS!wP# z=D!_c_m6ZMSJJ7eO?K`}-s6?a>1 zXYbQH3y@|-tDR7RiPqe%6-Uy&BmEzl2lVajB6Tx&&7f_mt`F|Rj8^rVD%x4>m5f-b zvxuB;BHz@A>`kCmOz<$peZp1!t>(lxLcw~G34uS>#iCKTD*@l4FF8N8h~Ldwm&b`i zw3R*lVZVJ`!oR*8vA)HjuX+6QZ(H%DLcQPK2XLI9N22zn_Ivo-6^F;F5oaaTbe)P( z5(b&mad{$p)AhG+$#XGz!h56Orli4&pywE=ZnFZP;gsl~IJ-<0WER6LLo!Uh@zJCYNEOtEbI=C9h6O&4x!n32OLoNY6Tvohm0>qK3rpG3>O^GV7=c7R+yI|;b@c;Vi)u&Z&! zzI6O!@6(mta;@ zHgjtxSw~=8oFH5kH~Io|&Q>Q=;psz1`uy{oK)LaXhDmjoChA1BD-wX^KxV6CCKZTH z?J8}h)*s%*7y}*#tpbURjtouf*|cW82Y0&_Sew<~C4^<$j&goZoD%;-(MaX~CRW`W zG~rz8Go?Aa`KoSwk!LSwm%;^K^|wnNEOXw zM|f}AU%elD^DvI?%XL@7<;N(rRsFv^%8RENEz(DJEXtx#4}D9MZ?h4`0c~$JwU5<0 z(z4N5rE|6US2*$Wh97^znwirnTr^VSQ)wWp#JvWbWDKWd!qJ~2plfu^!$Fknq&jEq zt(zGvD2M<4=uT>y+x`{1-FuD8ab|6VA}`%j_D*(F=`)Trl5j00!UjvNu13TyRA!0IiqCJ|txY2)aX&QHWz0h-ESh6GB ztGcZ_Y~`y=`8-NH1{q$O7~afsc)tGSO6VK5z)#|PQFY^l0ulbt#G=WIQ&O}gMND*9 zT!s)oj325N`(oitRd9L4Hvzo(uFyDlw2S>fy6Unl;6!vkFLD&Nam=cPsOota`?edh-O<$mPK7bK&Hn$=95NYlRX-h^!l~o zXh0@A>aQM<-nzY{(Sm1VhLjmLuVdWem%hcw)~T(|(`voCTs)BmRK2+Z8Grg#^s2>g z8EHDbDrhd-zMnIPQLW@wUfukxo-|vN)ibT@YoKv{i_=JZTNY#GzfP#`P*Y2 zl#DXweY~tPR~H1C{&P*#=e~er^?}wH?h-@3=*Rq*(FR&?G)3Xk+b5zDO@{$Ie_wh; zrxbY(uA5;gq7=Su!>7N3^mn_MqAjF$SOoBzU%Ycl;vJHcu@w=Q)r7hJLJ)Zb}2)wl=UM5zy zOg`1VvFo$PprP9gkuI-VSpoZ)trC;FO+=|XcOqDgMT4K}8B)9(sFGL))Hf^LhhJXp zT9ZuRz4B8M-(g;UvYkZ*<^dv;Z_wCH(c*W7`O?1CcS`N8L(lw{MxEIGxmOT+zqU>| zI4w2Q3=gU+ri~2r*af%U69<-*6+%!Agu0}R*@@fW>@m;ejZYD2_^IKIThGImBmZP# zIIVCO7m5d%FpyZ`kESV=J>%zLnTV$jGBiAXYWcYlty!;%fEtu=;Y0*Ec8C4AGkYVo zz_hu=>$Nu)fpT3NA>8S0pWefAB}%hJ-N5IuM@MKL@FX4gMsu`hj_BL;&)FydDPCME zJI5i`H)?3W0};l-_Pm85tH^ac|DrgV0c!VLj=N2F>^I9&ILQR%YR2K4Ta<%azfGdD z?#Vg}LUWj-@|uaCEiQ@T@UyvZE2j)si79vy=M~z_?&P7*hO3o4d#T3w2CSyHZrNZw zD#kjjgvZYr(RqdcFi>qnLORfx=oyhsbT%8j~kNK+H_&YjIgFyex|`R45-)rfT=eL$@li!!QP zqmTUq>xzWe)<vZ?UZ%(PhP zF|NhbW?(CImE@qvO2%$S=j9hJf3rn2O1k*=AH;=O&CH%=5wp1u?m%F}9>PsOA*m03 zU8jjgJ5hK`p0K?)0zkT5U?f@%Nch?b&Ef%w4RjLDpcwj9m!qtVn>in618O zFl;PN`)3rj`&;b8ncLrZGHv^CJ^K3_2Ityu7~pph`wpb9biXagKPxm>_Hs+5nH#-WBVofTkD$8(fM-HZQ=Wgnu-xJg`5F!yeC>a24Q>eBX5h zy$-HL3($Q`U)rdJI2YMC(y=kJDPs<3Ipd|{6ceaTJ1m8uiEdbHfy6rjSE+w* zPJ0Z~&%IuXmb|2>b?dJ;^>3eb)^g(utzQqV$7oo3>Rb;Wq#)hcPIa=>{NJOoc+|H! zhh+p}DIOX>Sib3dZWx^8E{KZ$g3A!$SE;+cfKA^d*wr-+2}Mw5EYh70SouMPl3`n$w;U&gJ_YQo$N7$aJr_frig7Aicu?;OqS@{309i7fEc* z;H*b{HpRB6IOf?OLs+~0O9Ft;!YnO(rwaDDnae6J+K!FI$v2b&c;Q~n4~PSv%enLW zhQZVvZn>z)LUQg=u=gIz>AWfyPPf-#%JZ_WLWG;)aYufi4|p%kUdr zbJ*|9)3U#$5LSC+#}Mwc3(00p0DvrEWeX(r=WFg;Ze+?`QYl^3%D&eAYit8}EYUIo zSy+ULTdG)p|Mqy$FNt}2{%u#|b7=aZ9xs3z?$xLbiJT~Gz?6bOD`?w45i7(5lZv7M zc-D{&!kN@;;eo*338N=PR4yIlo)X*!?RguK0{$t+D6io`J^g_~c zQ_d_4&7-nKUN|5_$*r0|3X5tIZqEaAyZ0^w$#$8{K#FUn43N(QaErRMOpjT7i#eUe z2qzZ8y1NE+4|o8rEkJ%w%T|FI=I@}H2|zsMtw$5>5upq<-jte$e+xybXEy=VclLML zQ#D2PjQx}enjvsUM#+sNwDg%=lb|yTmuNE5cJJyP11P6&S}{i}O($r-w0$QkK$y#? zg|4}M>2#R>7F{Uq1S6tCyPmKvL;lV{{Rj06rHBNBpnTw5RzHFfsD0xaOkMH6)~tQ6 zYlUFl&g8e!KLcEEGT>B; zE4qLk!rp=R;=%iw!G>cxK=YPwfkDYk8=6Ri9jzxBynj0MratI@10_~KtpZA=3uKV< z9ILJGlg379jRR8+kf`K?m{6RYg-O4Q-MkYzL41!C0CAObC;k;TVuiT;T3X3A7eh5` z3X43m|C6e%L7@9VcEB`9&1;VZF~YDH7(*nfV1oG-qdA$bzL9dhpYqoF9jHvnVcYb5P(n;-&Q1D?uwUe-wbdzgf%G&yZ|uox$mzb(Q#;L`Xgi@?Y(L> z$RVnT_kY^k`b9=+VR2fz=PU0|24ABGkaYw6Q#j)y;0gzO`nrP7hzhV1V`Fjq8aN;P zk}>8QnOyt?Xq+JkQmz)BmBWP5FmkX(quUn(88pm{ei*{C@xgL{Kok=vv0WOVF{4Jh zMxaJ!FnP)e6vKREgg0m1-2!yVwYr9!0}82(TBb&uf^;9dHW3_G+a2g~g~~mz z(vs&H+$!W~>t3<9x`CCOgO#%f=(pzrP)1{&{oo?| z9SD@zzrA=siFpZsdx?OO__vn?C`p00{CX`I7br1!h(KPTWS}&m0f9bMV}nkC2UEua zT?d&0r9JS1<_j4xBr$ao0PX>l0l+(ES$+e92UDj4@H_!ZD_#(2%O}Yd(;rhmkLeGT z;lP{C)aHxnkEs)5=mKS^0SF`-NN^s*Kc-HO!2^_SMj%jA+5k2N52j8I;Q0iU6TnNi z%(_GXz%g|U{|i9bYzYE2xW;2)@L=i~cn45s*n>c1U!>eHbTM@dJRc~7TtT3c=tL0= z98)L3&;?3fK+`4Z56m$5F?9+6eibMm`hq~#ZVon%{I1S+KwBjh@CSGzZfL8M5nsfp zm<*z!atkOAfLD(YANX5za3vckaNU(4dW66eKxi8d{3deMFm?xlaF{VK)*JOBVeRl^}0&==t84S;$(`ww^2m;5L+(mdm=HR`=R)s zBvni(+9f%QouY}=Lc^cG$bY_aQobx#vZtReomaTFEjfL=y3c=UrE>l`LRZn) z47}-xZXuM|bbd@17eg`>qcWD5NII!%OYJJNfp|7s8#1Z4g8=y!VR?i64W3U~6&|D# ze^CKDDG&I2P#81RC3vtBEXTOe#ED_QGglK+o0<$_>(8@q>pS*CyG!jwW7mA6-~i`g z=OyVEJ{-RCj3%NAPfKjuwj=2I{OY)W$2i%(757WOExoo)a9rZR%B5q%tFr6IuiNEL ziAcFhv<24m2fx#Nh*BB5ca79cW#~KwGtTa6H`Y|IgS(;SILKE%pvBrZPQ&EJNT2E# z5wKe=;OdFkEn6cg7is(6y-3>>!M6Rr!D$I=6K0L8dHy6Tssk6jH*(Fp_S+hfEH`*r zrjVT6o@1czY5hqSRz*Oap1z?TuLz|B$vrYN6)#W_X^vBHF;3cielzTuQ&JP(0PwHbg-7TY*ZW1PxXwD3TBL#b1|)Z-Z+PIHp( zsQ{9IeJq%2#6;gN=?O)I2eqnS`=Q+0-BooR{7c*Sd104e=AOh-B)_iy@WksxaCYPanNZ&C3nl@4za~LV#ThyKy50yk z?PcMx#H}QaoJoq6{CQ*gufzej_5H~bRKJWPTXH@jiVI7onkiLm%~n?SJD$x#kuHL) z7Jc?+;5ZlFsAPyF09Kn^jAs&$s7sdRx25DEcbh)!>AjAyU z=-#2;D5a%FqD@428qsy6-;lfh4kwMQCL3kvWvMnPef`?f?<-KW{E92Wnj*P|8ck$b z#E7ub^VGKa6r%!Gb-i%F{VKYCpHZ-YIfy{(z1}MuHcAIZZ!CYT;Byn$Ub%;N&~<5% zHm=MJd@bU*hp7$=k|G^U(x(Dk_j?S!?n zTldYu2Yk8}SZsO3wOHb98G+Orm&-t!_TPoQj(m)ZJWLaA40bIkfJSIYcAwJ^ixpn` zND`%1DL@@Q8_}HAB(yu=kY*C`|(Jm0iB*x9gGD}4Dup{yz z-j1BSs`*~E-}6_+<#?Hfav9&9&@l7{<@C-=^2up}T$(5KhL2I~mx8l#+-<|mw|I_Y zhPV#M+L;$Nu`Q;?kcg3hnPcJ@>GcL$qgn_)KT>F<<3)6j0M0bFc&EKxdbFQ6&N1=A zG4v7teOV|eUeG<&1@2AM9?m#zU*Mg`6MLa=LWKqP`n>Nm(i0dS$pls2d^oi#`*di5 z2+LxO3r)%U=yqjvh|C)1I--$x&Jh49%Qcsgg*pnBRvFOytnQHZ4YIH@Kk)skU%bVS zM;a(qW>ZPZG(to&cJr%yCe!oAUTUjrA+J~EJZ1BB=>1-J&3oq}*>j~cmi(rA4-bdDhU%}wdq2Dgm^1m~9 zkqOH9^u^~@_^SsmqfU5f4c7%NJ#Mx8z8b#&4ea))(A@BrHZ4_$j#kr!apQU>pX*Kv zdjm+L6^#m>%&GIdLvIux`}dOzLWRipnTN^172KoW$hxZ1-{Xwr57QY^e{m(=ws*7~ zSL$9%k1~H`@agGZJNBI~)eHBgGHm2kXO<@y1y%edP)!A^EuDGelO{aACakBv9KVPx^zY z^ry;*@GtBKl9E@=HO8GD)n;*Cve5n3VKN1KM#N^^B_;JWws1+oarv#fOH{gMNj#C% zSHp(r*9`iBBr*c4vyv1L%{{!CxAWJPwZV+5j4VYfeN8WYfQe=sC)d*4H2s~h+nj?u z+kEhrxhq|wQ=U=}MO;(S`Dd@u-o5qR5<|=*)1P%7Z}Ow~q+@Q_Xp;2wbt{J9shjc8 zfAnH&KIez!s>e#>aNfIMX`H5`(|=3hRbj0`pSC`sAp2tVhYFgqhU|bu{4g@z)IRN= zdZ+g2US+bt@h@C<7fX_^(lU(~&0lN?hd-`w_X1y*i;0p|K2=m*)$4Rck9{eF&{ss4 zq=FmqBxv9RPBW)stlx{3~deNFv@ zh;Y+KWG@5vD+{%^hfoh+QI)s#i{e|GIFH{c4?!d__-Qr0%G!|T&a97yXB3{?R58bu zH#QVM&oFv~eO1NaEx0sCh|JyV!wZ}F1;j&sFauT1aUXdAA>+$JZ#`b`{A^U7#55Dh zd-Pk~j6EQI7>??Yw>^}AKQ3lHQqG6>$CRYfB&Xh`FckRueMNh>%kg591$Fgyr_{mCktL_R4gSQ-u-iDccHQ&O?-;htUPq=sUCXh(LL2EA z2tyP$%#HC+k-&$C`vyi@-bZjbj>xO)XTHPsv;9~u*U;4$Yo9{<)t7ceQQyV+$x$sM zG@A*krOfwuN@%2fke7p#wfekiuRIq*hVHV<72WBQu8xM7t>$Nbmi}A*Y^Ukf#Y1xK z-df+Khx*Liw}rZIy+z_VKIB6f`=J( zay461-x<*w`hhu+)uymW9M`65Gylkr(_lJ5#c29bKBS>qz(ER56Ua zKnive0e@}exW4r_0pPH{)+YhgW44%(v^yyxbh#p?JioYy9D5E(t}IS3l4*{?8| z9`HFw^6X|*SD%bq6kk{0IQJdYtrh#vyM+h#Q64@Q_g;LuXmtL**Jsn~d#(8|)4iO= zJt@kRS;4GjTdVw+ULBrN*q$0#=#0*i2yM&gdpb3}o&kPimf?&A;Yh#-09a)Xb-3Kfi-rcuy9?~Nn3YYwf z#F_NdS-~yu1NnowT%*EG!&N=CCM9U%vXH~}@ul|)wY9NtG8&YfID*|o*6b86Bwqoy zvs-2RX_$lNpD=%iVI@`+WIVqlXNCX$W+==qP1jx}wpk~1z~P+X;KzE>h0qbB0N3dXlfA?51= zr}qeGBRh1B;BRWnXm-=fJfmefI0j<;A}<`k;bv`~T%28IW6%W#V5+%(<;J`U+_6^n zaekuNNM9~}+-*DTwu71;YkFk{QTPA4n|)BXMjTLIIPH{M+IX9#<#l+v{)Ri+vU+f`Mt#+G zVswQ0MfQzBFLv^t$UoxmqOz5#4DmN#k;aplytx})n7hWo=BQUPZPVU8umwh$ zj-hw+KECGMYMzmw1iyO+Yv=86zV=A zDDxODS?vNx-L-@WR-UN&<}n@)eemzO(JSGg7`J?lIOj-f`{KO^8Vw9xl?fcDPADc} zNimm@OE%@-y=kV~9~m7?nG^99*e{r~x`>WOPzDZgWUf7#aSsf`i!dF?F7{?}Q=9*E zY^K(PvZaDFIXo8ES*yxw>}B5OA@d2bhEDk*In~3 zjXvj0E}tm%xEsP2B2aHdzWCDnfo%d&Mhb)hbH+%o3@6gN9mZIssDfaFYfbf+R!>Gg zu02SHEyQynAhT1FkB;gbnz`n1w^}YIsMzwrmtThKe!wYga18ZR4DXl^#VJepK9hX; z)g$`W*)O-B9UW4-a=MnzG2Yd>$6@OfBlo3YD7LG$lGNfWU58gX~;Bdis^v+l?MRq$9bOsayJD`_J^*`VBX<&>PB;?f6BU z`L!V#wa}Zak9vqBXd?6;CuJ2e9UoGPukd$;v$g3GmY}2MCk!fpoq~@(3~7ZYiFazo z)odQqU4Euz>Z93t5T~L3SxkMsel#GFxz$v%OOS4S%I9t6BrA8~0Rf!ZQ?8hUz=W+o z4wo!T-;~T*!6f#%ek|5<%W+IcT zs&TyH`8~|f)f877cX(;D_0w@%%jPc)BEQpAwQz4lho=dEo8sBRJLrV$;+6ccpJvCY zgYo>gGd_UlK}mW!T{6ioo0UfIK24T=j!~_BKW8-s>v?S-*HL(tTbbZ|T*QdHzs#zB zDQNfBp#SY+4Yq!AY9`9P=ZRNmsEH+8MV~~y01)zUPiF5CQc96W@g*kaKSvxp2ur1_SV$?w);TDobBB*(!8*H^cZCmL+= zippe7c@!f1_d^ECo;5>jXU*SPXHGunL!l`nJczY~wqwP(Ho4(4Ybw0hQ38>wFPpII z_%Hgf&FTyQA6m%})#7awd>N~nYms=TbiOI_0ZRiza!Fx{o>ZI$+x=65k?3H)dVVE& zV1o?=QPox{QL?-T0&#hITKRGdVD|Vh`-PZ2KpS^=3u`NP2OD<*5N7KRvu}!lIeEf8 z99-d0Ydd#-;5XN>JIgAXR(6ASzO&*T%m3r4p4UtcK}-sZY;J?m=z$YJBybU+!N}K zVFh@soNZZLyr6Dw4z@sN%(tHIP&XC;lLx>A00G+11hk!BI(7ju^( zK5PFo9%&XsGGApFGl-t2OFrfJMam>G@x>fmbD;yzk{VQU6fs1 zecjIdfXjxPMOaWs=wCQ_S?oPLTmhBCp;r6=RTocwC#V4M73M=-DDL)|QA8|N1G4lJy;qQZcs|E3Y{!oq6(PmT5tz}U2Lv;`cOg;i2g@}E%r)JsZA z3NYHQzVSEaJL`t=o1faw96}mUwKFhK`F=Mim$0CiE!2*eJAs$!U`2nH(b>T@;}f3v&vA71k#IQ&HREDm7Cuc+u> zNdCJH@Q1toVJ^7KAF%(}Zhvx#KM?;x?B`MOk4{4LtN;DQ@&4=`et_r?LT5;SmQ#$I@lS+*VE9Ff_jlo+ zPwYp+@so*v_4Tvt@n^rngq=SJ761k$mH+*L{S(zQ1i$#X(7$5LZxaxP^nV<_03^Z~ zW`CjeSBTi(33&$mkAf#aUFi~d;Fdbl~b z0{axdq%6PXbHC;!z(x=BEM@t9_5SDPA8XCCE@EP0f67&U%C>%6MO^(2Atq1xsr4V$ z5x}Mk918RJ#ZXM4w&^LFN@gOUx~B1Mo19&@y{;$6NZ1;{ts{YJI}-<&zOAr zI|6oIwzwDv>hEqbqM$86=AucY+%?oTSp0V@` z^hY%QnGlA~UlsyC%qS!%$j%}H%%uNpxL*e5?~8w!5KI{MZ?FIVE0qF!Nq^EO0Qps! zKXv&(qe*LP>p!dUU!Z@|;aT|neHZ-Cd$K>ax6ken;{bKcong%7*0UAr*{btLhf(ey zI0`DgcEX;&F5fFJ*G{}mtDmB*LI+Kd551D*bz`>!mZ-|oLo`X1%!9-n?| zcO-p3G(vW}gOYpp5f`Mwmcit*Nq!jb>I?fU)vzaDOe$;(N>?sAe(Jc@VG!1D==EOk zz4%+%;NZ07x8vh>^(D(`j=n7lrH8A#&E10Q%W1;_@|nIZCGI8e=Iv}Vewm0Eydmr% zd=5|)v@~=&mLLQB65gfGpg`(6nq)Qy7>}_ zWI?>MCUu5;PyIz-rFBJE4f}?c0!)=FlQJE4groo&Sy2B!(-%7{92)G*>&-@Ao4OFvp{ki1qi1oQy74HCZ>Vg zTSVskzQl&Anl?ZaTOxThHvvCUs4^CmH1OD#yzI^ZmgIaI!)QKa0VY0#(#8rRL>X>u z`i53^!y~rintD(}`267M7&SB6JJO)}G{p za__fs>lr}K9w~{6n{j=irPx$dRh2P_CK*K;7fVw!%sA}-6s*ew;Y7zbES_Ej|Tid`U zC%)86r~b1rJCOU!kyK}xBWM`MCOf;ZXDFWEUYZc#^zHH<#X&Pol@!7GrZIqJirlgB zG!&Mz%Wnks!kRr*SNRj3$25h0rK-|>DZ?h$=W)JAYF=%q7Ld^Z#G&`;NLGk0b#ww5 z8ev_~zj#KSKeJhDA?#p9-&cC`ATXru7VfPq!%&e_@>Z#NQ~4N$7O_fS-@t@DcVv3J z`Sm`Jgn`kQvD5%Cq?A4SzgLSaY3@B=2Q-v=cg=%oN9c_zc^>DXR#ea$kO9_) zf(n)o&%zz|K(r7VjR)HBGk(7h%71l+rBdvQXKF}RR2}A8TcK~D?}(TPz9=fBJh%=S z0GCX&8?z18EB3Q%5da$IZ@Ep?fMCKl#eVhV^Qt4ZVan(Vdt=d+tfZhIXIK}GBOAaC zfdo?s;3?L3G#6lAqHUUGC2HRX(faJ$$&0(`@v1k|dDzUx&y*5bz@C*lY7n;7-nE~L zXv%))3G_N-EphT!qLY{Q?y1kv^Hq|l{D#zFO-ZI2sRY{7xr6i(Q7AaQCE{Iqj#qq+ zNy?d$?s`V|d9yd`EnOP@un#_=8lAsU!s|OZ2Fcb~SM7d#M?Z1KVPtLBIQ%ge7U$015e&8nP7)dG=4PQ2LF2l&bO%3yRF)`9aB7 zKekVo_J(ma`q1Pl;BMrWUja@wSvJ1r-Us}YE^jGJKDf0el4ILHWI?1$COn>GHbm7y z5izOwT19gG2$72e3~ai*B+7%v$~b3!W4Zlj>cLYii=FYqHPxS%Gvb|{&YbOAq4oj^ z8{CoH^5wl@)6}w4R@M?TQDf>wM$X0PGg?V%gG9%C5##>;Z}v`gUIeY<^GDY;JF#vn z%=UJtyO)&erT3kt*U9m0!XOe9zI4;;|jM{J4vI_*0?yKGtOwnE##%A8S254ru2mjvV)rfKN9m z`g6RwM&GHj=-$H26-!-6uf(Soz(f}T6P1F^gi~+Mfg!P2GPhp!p{C+bOmkZl4}$Uc z)gx<&Q*hyNtDW8ezV?S&K!oW*P1(TKg)5bKPy`wWbazdfr4xcK2`rvNdb>3r8$t4( ztvV78vpc)6(czdtB8?S*(O#lXn$p+3av$a;wt;OmJ}igS6Om~}&2fM1jRjjX3a0Nn zxjqtcliTG9DOK4ONoLDFPV2#`Nzl8a_7)hC>%Pi>Th^miB*H#^Ie2|{dd~;#h-89^ zXK8T8JF^6Z`5AsOcV+9w=D=15m3ke2<3Zj;ipMvc@;-P-b>7;X4o+ z{KCn;bgbkLM0I#O@5Lbf;>~*|<3?$X525M2i|!P|-tCp5z=WdOO8QPeeobre zXx~q@TY-3mZ80Ts45JEb4k8f-%?pZjQjJF*kjxL0H+}Gfc{ZBw36YN&_UmYxj}yac zxHgzAOWtW&kgrhQ^@#?weMv&_>xot*yL*UPH?Ozc2D~9a{rSpn0mC)(;fwJZAad=I zFI33+5G`4R%>2Xx45@@<4I4m3`qBFo<>a|}+t)B`6x};MGVYhgD|O%#k-0P?@gjmA zsT1;+UH{m03Q!fB$l>`X-Z#IK#b=0Bl7*Bbb>p2cy_nPwZ3EG7_@cwYCC?>p-v`qr zk1itl@%Tq?_v5v--VqRCP_8Q&twz5Tz-hrDk9&52W&px3jZkGUcGrBs;UW8R8!8uT z3#%8Ks-gC>U2GRK2jfS%u8^*f7}nV%fijP{gc+E)zzjOkd*0`;2^l#`ywhwATgGa~ zE{fh50xs`|h_K6WGJixB9Xwtoa=_#hZ6f9z=zOHD%{iHjbrf zl;~$8NY7nic6!Bq7;#{!YiV zdL5!(x!;h){LauHCSpr!c*}PEq zP%{gm$_Iovj}StL_K zVD2CWY)6pG{7$fl3(nk{-#Q8Mvsr0s$h5cf{N0iVxj4aWdiNMU*rG!johHent3yMh z5#9KvI00N>q!T+$;RQoHk<{25igpa>w_)c_%mr!o$y`%%7*fe|xkvrNs)-;0x@sk! z7GZ=YVgl@+t~Sf-H{D-(edzE0dgmG>Q{$r@1u}XBr^&)~h{>AW3#OO!lrSet11w{yt z1k=0cY)!k^iEPxqhMmKY(^m(-gRgt8EA2lC5}IA_OB|jK5lcPr6W^9Iy&(C})kb%C z_&cO^Hl8nZ6#O~!#`EdGi~9%W2D8f|C9}y>kbDoZrrGta`$#(?lF;R&l+t*X-OOR? zWf~&ubP+{H&cSV$mX&1%&(rblL%+9Gl{t@yAUB`sE>~KLm>^MJB9)qi65u=>D&Nl$ z;!R6|NHUmLfcWRWS`_?}h)kF(=nWkq4bF0f;08Au8!ay~-izAIFlPMR4%^MRc;LV; zlG=r8#yMgdi94ECN!k%d+oI=IOqUvX5zk{HmJWKuU?uNWd>NJh_Xvr3_``z|L|Fq4?=IddCWW$LJW7msmsNIw4o9? z(zZ@?Ta{|XjnD7n&qxI&7+^mxsf!)zSQ1au%!f4Ty`6!dn{a}q8cygG;!5-j4LCVW z14Qt(7UInlst7h#v7PiQ!g*33PbQU(EXZ1>UpZK$I7EyNr;vja5yj*aS0zuIigPJ4 zqzs(|M8+E)23>^0+^J~uoyI+Qndb0&L@KY)an%5sLL;#_S z=f|P-rz+2cDpgS{kHW^P+o^UVW%jcWPSYOep@>l!vbxGeZ)z2Lu=c?Q9c*_f<)APf z(M@t43|Dnb9mOm_hAF0vwF_};Um*CB@{669salFGLjW2vb#x~E1!2V&!=zg^%WTKu zs#js+sfbne3vtXElG=k!Js|^k%txN8)bPzI6%@LH~ z4mn9DTA}dM?!f%@`@B9dR2Ql(a*wZ$GYptNS;kT6--#dMq=we#e2#@t?rL%Rl0#w3 zlr@e_>Pg7+N~&ZP>}Zi2E4H#j8E3{cGAW~vy1HxE(eyQ7?UPB{t*i0 zr9I*Nfx>a~LHX#?_XwiYZ3@5p#4&_ylPnG-t(AE%L%y@EK6l;sbAZ)^A<`lFDO4sw zUR6fa`PM3NX^3Koq`-5-Gy!1MdK}b+k{`L+qA!&^r7@STt+BJu%A@((GO|Y4G1Yhp zZ0rcqWP|qt_PwU{4dQpR|Flis235ls7;~fEu|2s)tw5kQFhzWP+K;@cnl-CuaaX&N zB6rF^$m;{j0Izw}gONR&ASf=s_*177X;!59wF33yD8nYZDYD{nTVVM{l{*}3x#2hA zY#T*Ip5##Zlzy%(1s8^Wj*7eyp~7{3%MLBys>r9Rb-DX)E41nUhS;+4XyM`jB$!I# z{&3f>`BljY`{xzVYYeHQcEF_2W-qqmzWr&nTXFr_*qTgC+D!WD@sZe!^GMrhcna|W zH58VKSED(x!h`e-JGZ0BJ}IX}T1i#YUaW33QO{r2Czy1keJjI^N&g@W5vX>nFwT0i zSy>Xq{eUi{lIZKz(_F=+HM`2I<5XT>a#Cg$#!w|swk=f{^x3w_y5Y_cfp_B1ic?Ch zmlv)Q-8HPdP30#}<4$N5+^Ex)6Ss+uw*?k1XilQkG>8%J_a-o2bcNkatzBuRt-^gC zoXpFNAR+Hzb}g-1@52a$8Rud~E)I7q$^gGPCBJ?k6o-vWW+1+JMv7iiN`~hE-pcJH zG{;IU7m1iH0cZ89j+}T~-K#0QE!M(jwOdVeN@8kpmwDidb4%42rJoo6_eDL6Z}wFV z%Ry@bach#3JcP_EA3L>XwjYfXsrogOttfMqHgZ|%-F1R9N1(L0$PP~~?!C<`6Zj@W z4?EvH%}LXAqkm^~>rjO7>vbDA4Auo{DE+dd?=&+ODN58-=+>|0Y<8%O$V?5o*(Ks3 z;!igdZLKr6sAVr5;tZ<+%^;srlP6W(rD4^F=&~`X`8Xd-p%>oddN5QG-)%P@y3**N zQ(ou!DES-|qC=%NRGx4WU6;IHAal7{7|2-j3Xw4BRwFc+p}bDibh(qtuZDA5I7MOIr%JMP z5rl6W^b?I@5o*=xv2?gVXj*$8t+LIQ)&qfdaa!0~UF5ykxX!<~8*st*E|-)>0(x?)I<@w#~-<_=T#r`8B56Q;~Bg2fd3TuoR7>I-)LYc`aJT8?V-2v2aSf@Z%a z1iWa`1yXR74(Bhg#HVAAu=bIls12!#AqtG4jAB<%8N;!8I7`%o)k)caa5@KnS}2#) zwVp!$TobNz3XSJFnAV2XXbvcPga@MB?#6RHjB~PS6nzo#wc>!-cQCH+17qOruS>hy zfUTYY3f2u#&$I9Py368fGoVP?aVNJu`qSDo5640uwNR>VURa9E%jES#o2!EZt2ov$ z>}c0d_U2HkF&n&T3y-m;l38;Mo;zVDPW>4L%WAtX6N_;z5+sII1!hz9LZd0Su%9fz|Rn)5&}CEpJKvqt-BKVHFDp|T!WywZ$&_x}7WQ(BDZ7zga@%2wF9v5yPAVS~em39qL@22gMs zh}JW#428{uhL&|9qQHO*3B>5@XFT4=K;qj*eP}xQ3HAP(A2d06O52Cm;GHeH=iV@> z{gteB)rnB)$=fFBcLiVOO#opQ-4Rw^7dNTlzvn<_j5V=3m6+~kP+N-atzxQxC0U)- zUsg`kv<6lZI{tcX;h7FBov0}s?}BfmD`Ih%Bvk#HDS_bST@^_~Qxst!xGnd&X&OO@ zQ{}3J6ZO-+y!T$tFscG)tGVO&lEQo^wk9}C<~*%af|*er(FPtm*%sK?OYO^Jk9d)B z0&LL4f;1Z1QEPcd88v*I>;9>1TP!~c|B0$_nwm0kIWQpNi z1>L8T*0~dzkiOHTZ~+DBXVahrb`KE5J9U&UG*ex4OIf6`W^O4|i0D`!BES*FmbpkV z+~WwV{FsycXxA?aYpW}U$O7#o4_gaXhjLEcudkgt8ALrg*vNWCF`#}ad~F$6=&nE zBrwYa+ikvl0vCxqH^slQA2^z`!ZYb;uuFd+9=1wZa(f_Di+ys?gGK6HKv~{}ti7mS z%1Hc#9e#A3O8FNG5hWLJR{Ji3GYe?b$=#0u{)_p}E?I?j(@8V&tV8qdlmx8>`APF8 zy3pb)vbTh*lik-db!b&%pNi6qL|FUBHLk`bSeGcH;8!OHR=E#QTYE8n56Pbt8woTJ z9BD<2qas&ynKvwlZ5VVG8=w(uJL%ywYAF8_%o4uv4Pn(H|&uTRXg(iF2e4jtiDpF$~Q#H+S}XL zik;UFTrezMR}%1Ri0xWuZ0&eWXZY}aKpB8NzBp$pqONp#EX@@5ZGqX*&}GEH_;lH+Vq#NV4a z7QJC!!ew@y9Kg1GkM>xh(hB*5Z%7huZ0_>3U^jY^&{miOo)SnGWx$F*Ww=@v`=VSQyyG{iRZTIZ=~$v zSu&v~*-I_rT_X)?tc#BL+WR_R5qGJYn)oXvZR?0M##-NXfoLqK))qC9nu=?XmL`u< zJ@bE7#8E%{qzr^ZOtw@3A{eg0QJa_?R49rt{Dam3_gM;h2GSH#XX^9ub8$k%ZxD%Be)(oB z__6sXjo6}quqm8?F!OZHkOVfS)X#NoK{u-i)oRV2s(hShGs9v0=)uTj?fm8W#LVRf zwkFOJ5%#m|Z+R~)>tRM!b!H2zQ|b+yt{!Xlw0 zkx}^qcCq{>-E5E=ExvpvS7LLboZ)0#o$}pVZNg-AGA|;$Q;a`Sy@?#-+&qwtrTM^7 z+U`DNnSWJpl)<3vS6h1J${YU(ZvX_K&Dc1b-ODE1w`=A?bQ*_q?3GR>vSgp%cMMHnXX5WPJZ*8N{KhP8 zl04eXeUF}f7iY~$7?^b^PNVlUL{d3bWpPk&9Lv-WSWx0tAhgz=2J!v6+_e__aAhm} z&nCmSOKvFj8aPTEy!nVdK-BwrsCO;d?9s~G%U;jOU0-wV1XK(TXRVz`UHMuztJV|| zANBO9`bXy^iumu!KzeKQ7)xF&rLso?e@(Q~CiL@%Ab|?$g=uX0CoH)`alo!OwJX6_ z$D(%W&<%}3RM3hx0muoof%92fE~KpvPQ8N&)L?tFK=QfBh8G`3}GqjK{bakD@r;o;;tj%ef@ zbMC2XXm{vaLa0pFuCI1a%X(Ph82`TKwB(`m%YDCCo{y(N5iRpiL(M|iLxju%yUAW% z&rjPkYL#ckqUGA~&S0H&Y_@$My&pU=a49Ka6qzx)&&F~ z2z4&{!#&z~eu>KLPyq?*R-&+kugmOrT$s#D_v8mqm+&*#Uu8TFRFi)u$F9Y*Mel&N3ttwU;Fs9DrH4{)o1=o;oO z0QH9&KVhBEAoNM(;RSWci|%5UzLpef4#MlMg07lWOgyBOUYsk05GSwJJwKX4&AB|y zh8(mQ^y!c;vHodfq}gglUh?%?V1&O%80$~-48Nf|SmvN2*ZuA}5V}qEfKOj$7JA?D zrR()|&H|2txy4h3tJ`;W@MV?ii1-Ri=I3$l=q!vzw`sB;Zr$`FyTvGiuXsi7CiH@^52 zlg-0g{C5k?`1x7T36G zuN8@cyU`QFjn59ASmn15;LRP8X>n72K#;{d? zm32U^q$3N%Hj^r;3{V$ma=QpCiGo>QX~z`5AG`obf;}+f$D)NxXQcTxBtOXk_Mlj^ zhWr+Tw-;2Y^@U$kbt zwGO3YT23lzAiZw%jou}8RR3h!^Wrh}h0&OPHp_YJq_*guH|h(; zv^%la`m2$04oU^xq47b6-g&feOIXWg#(h`m4b@ij$=98Xt@eRX%V4GArSWcfQ`JWU zo&HIre`qg`jwoY~B?r#>@*~@+8N%6KzF6=gL)b-ZErYZG`hBdjfETvpR?L3%Lb_`= zj->onz^Z^+6KDCQ)<52Ja;?Z=U0&%!(TY^wC-N^ZWs}uOW3{4N$1V}7G^4CBCV`Y{ zNK+Uk3c3Z9&pZL05W=|}%pm&fnWYIi#$l0;G4d609z{8xp-dqJj%z2TmZ}f}JCiHf z2;hVyja?vCYauBvm~Vi3Hnt9!O0Bsm4+OY_Hv-c$vgSS*!)my#96R?yybUHMPm@Pe zX!dRrL3*LAwO@&1?=D>`pT=P%3AoYk2P}f>PseQWp58K8(98TuXW zH@(F#dfs1Hg+y@3*%@&u-D%w^+$nec)^F$rcXBf}RMa8@GX(h>eRm_}#EQm6TM3S! z$gkJD?@eh^XZ9aCzG!xT>QRnh!hMzSd9|F#GRMdqmz;oHqH+(LDwHooEaI?si!=)~ z)E4H+!TorPDe|WCmBa5Ur~K{Rk!GZ1-$=PjO95LB3;I&9WjmcGCVSTNY08 z=q^$Ua#3@g7sCCRfiVtoOgd8ZxcOn(7yBaROs3QV+<}M^_2kiHxK@Ze|5LZ+4wq09 zs+y#Ji=~Bks44t_T%fbiQe=&7)Uqrh7My`f_ph`ik{h@4vn<@DD2flS z42nCQgildD8eYIH9b$dotF2SWPsHN_OFS@xokep`nmGDsom$`knajW!Na`|kRu4{dV&2s#1RqJ7raQ^ZC9K4_?OV#n zz$vF=TrOn;Rtso1ziBJLnU(rZJ#Jmo=hI%i>$qOnLj4xDhnS;&a15IV zNQ40=jSN1l0cu+1g~*7VUCr9H=gq>gjr!O_AnwQ;KDDJ|=?NJ~C4UE4+5b}mSBXiD zdLYA???XR^CPMgp=L7(+Rily)$)QK~Aa825_v7p)d8iL40++WOGu84Y8WE#d$d6TM zwd@By&#K&iG~^iodle#wxUTqub_3;A9ehYX`9VNbXRcxfBFzH}OIGx^TpNdo77&Av zFu<-v+7M=QBN$8#uWwj1y67cWmX%|da>i9-wQv@WhF_ZCEd^Yk>KWG*;D3l{0~z?y zcv!tge_)APQ4Rx(YKk*yYL(z~T=UC1yK1uYaOiQL3?$`x@;!ypMWZ{eL}m4y?trta zZmTE}JP}pxuL*nFttKn`lAs&ZeEkCAFq8){F7aXn_ntFMoO44A&C(jm-L&RxsSc?X zV+se(yr(`rB?=5d@ZlYWxnkcgl_uJc&!PLFz4fKVFnJ_OUg<)y%ZLXr9&oa**8f0@ zU>0zNy&Y90W=mKRjs-zYZqqVO2F_!GAl}9Q)!x~J$WcUbd{={s!4C)?JSb@xR9w=N zncdCC3@R8fyJ1O!Mll|A(=$^u({AtdFx``NT?~j`0ztecc*(_!f~y`p<)R{91j)fg z52EP7AS3|;LK4vbdsWq4HQjAuP9AzXyP2t1_3G8@>VDJp@!N|Zyp4r3n>(*fox8vG z+3Muh9rwL?=KL>%yPiC<@Z0>svlrqT47#?s^yt+|EX>$&Hy+-oetY`IrHPZf`FdHKl5oir@&x@U?7mk89VKzW-ART@mJPg1(+H?|7^$IqaxGYD7 zg!)L03Hu`AdKZNl5DjAmTo0+1vW25~Fp9wi0Y-zs9dxEg-C&I=8dPBrhRawnzpP;% zlJqhE!XhhuCWt^B;5K;eHZ`FSEQstMDbZt>16B!kw}3doXpR-9Cx8S&O8{@MI*#9m z#E+A%BUjQJsoAX#ejmQ`f~1JFB>CF(EzE|=jjN7mT19>tsRp|6g9a@l6 zi56vRk(V%4;wH{bT4M-T{dU~5>{CKAqqrzb3(HDNi%TncVR>#&ad9awEKO}@`v|Kt zit-vqS)`WYJj%#h%vMw(u3_3}lhYV2$+kmFLM-VLc7HQ3vB07@G)N;1Osmo+sZDjJP_~B! zu3`;Ys!e&Ga#J1=c*l0NDbAi=-l7EGTfia1Izyf^h4SUGkBHHAJEK0wV#^9sjR-u% zcteNiqkq^|6MSM>thr6ZASgAj8^m#UK3;ywZzG(#ov<~En4jRP#?|NspUI(aPQb8e z@!>EQO~fo$S>kp*bYY0oz@J9=GQOAb-S|RK#&_!iHbQtA-_!4DhFfkiaNlCKGQQI{ zZb@g$>xgB1PrgkVfmc6VS{^gxWqdE6-^=HB9#SadyLFQ=0$CZ~%lK}=D9Yz|^8vej zewPER|BvT)gS9M&=O<1R6a=r`YWjdiwwZfP6l@H`_dsIyoIVCo)Yvozo~y)bHYY7A z(_&_JW=;SN5RC$v?mQVb>$ym_4rk)2!(u>dv1*2zQ_ z64cyGl2;FA)`8|Mp#o-jbn^4F=lRJxGew*%LV4#gJefg6=1ag0zsu0aBx=m6N8V{?i6iWd z;&99@dSuWdryBhy9ZNO1sbd}}^xW+=5q?%pq;~~POh?;jsy3NsNvR9(~8X>O_E z97U%9>|C*)cpQ^K`_%W$vz-Na*Z0gY0JBoxL&q*hy>XZyZCp>3@VHZRYFYH(IA#kZ z+yA1IE@iHcjU|KiYg}<+?DX_BEXD6aGs*m$>Prm0nLaj=e%)NB0%BF_O*+V*{KnzZ z7Ko5iav)*jjjq(&bdV-~<4o@X{;pE@=&(QJf$?lo-d-*{JxhmUe#lb9)GZau)98?W z(YW&EeS`X3+VQFu8Coe&6W?@BjpAB6z+6go{%s$Hj4Pr+FmrT5`i&o}q}C`o%2Zu4 zI$x*!xKqgZCXH-#{9%OAo}Q1XZFQZi9GOHe5}E0EIyOI?rt zn1r%m%wq80Gk(|2)RabwILhr)4O5rOsG@$FO=fC%m`*t%5ZjeI + + + css_accordion.css + reset.css + + + css_basics.css + reset.css + + + css_multiplebgs.css + brick.png + brick2.png + cssview.css + reset.css + + diff --git a/examples/demo/demos/data/demo.ui b/examples/demo/demos/data/demo.ui new file mode 100644 index 0000000..57dd232 --- /dev/null +++ b/examples/demo/demos/data/demo.ui @@ -0,0 +1,258 @@ + + + + + + + + + + + + John + Doe + 25 + This is the John Doe row + + + Mary + Unknown + 50 + This is the Mary Unknown row + + + + + + + + + Copy + Copy selected object into the clipboard + gtk-copy + + + + + Cut + Cut selected object into the clipboard + gtk-cut + + + + + EditMenu + _Edit + + + + + FileMenu + _File + + + + + New + Create a new file + gtk-new + + + + + Open + Open a file + gtk-open + + + + + Paste + Paste object from the Clipboard + gtk-paste + + + + + Quit + Quit the program + gtk-quit + + + + + + Save + True + Save a file + gtk-save + + + + + SaveAs + Save with a different name + gtk-save-as + + + + + HelpMenu + _Help + + + + + About + gtk-about + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GtkBuilder demo + + + + + + 250 + 440 + GtkBuilder demo + + + True + + + True + + + The menubar + + + + + False + + + + + True + + + The toolbar + + + + + False + 1 + + + + + automatic + in + True + automatic + + + True + liststore1 + 3 + + + Name list + + A list of person with name, surname and age columns + + + + + + Name + + + + 0 + + + + + + + Surname + + + + 1 + + + + + + + Age + + + + 2 + + + + + + + + + + + + 2 + + + + + True + + + False + 3 + + + + + + diff --git a/examples/demo/demos/data/floppybuddy.gif b/examples/demo/demos/data/floppybuddy.gif new file mode 100644 index 0000000000000000000000000000000000000000..ac986c8ed34cc9be1bf2e3e7d0b1ede9d0828101 GIT binary patch literal 5216 zcmeH~X*3jW7rgwtm8XB6Knx{{n*3#0_*4Eb1(b3h_J#*&F*|TTQojZ5_{CPb+Js1q8udi=lU|?uy zXk=t$Y;0^|Vq$7)3WviH2*ia87tGAe%+1X$EG#T7Ev>AqE?&HN>Cz=@Yik=D8(Ujj zJ3Bjjd;80mFFQCmT)A?^(b4hh)vHcUPS>tob9Q!iadAN+k*=<;C=|-g%?*u4V=x$Z zcXuoni^JhOJUl!-J-xiV@OV6dKp+x{-rn9mK0YK8iA*L_C=_2`Un-UA=jZ3|?;j8l zaQ*uAz`($uprGL3;E<4z(9lr8^mJHQ*v*?a!^6XAG+IPNL}X-SR8&-Sbo8xTw_;*q zVq;_D;^N}t;}a4RZr{G0n3$N9ltib~@7%eQoSdAJl9HO5nwFN9o}QkOk-=av?%ut7 z@7}%4%*?E;to!%xXJ=>U%)Y6ciK|7H$CmOeS+{>nt^JtGKwhq@<*@ zw6v_Oth~IuqN1X*va+hGs=B(mrly9?X4lr%K79DFuCA`WzW&jpM-2@Pjg5^>O-;?s z&5s{Hu4^4>X=!O~ZEb67Yj1Dw=;-L|?Ck35diwNfcXxMBPtUVw&z?Vj-rL*z;>C-; zzP|qc{+BOb4h#$o4i3J0_3HKO*F!@?!^6XG-ni6&8*Vfk7*Vlji__49E@$=`;U%!6+{{4G%b8~BJOLl9w zg^`W50nExs4XVlwoaY9}{@~dS0^9(o{5u?GfO7yo{$Bu~fV62vc1t+FDCFwXik!A6 z;iHIqrj@xJu@a{|#-CQ^b=?LV#7M)d++YADYu43nQbBhFz#`KFerNW1ngFVYCmXT9 zFH0}{`>&#vLQ}w=*iGpeH7w$RT0F^6Sy&IkrJ4t2Ggw8IWsYpB;Yf-etNJq8gV$qq zVYt?-LsKqMe0HSRZ*V|^nT)qDS8nKht9{^jb`yVZZg1ea%0QTr`-bm9t)&-Tp#6gy zLG&`$#@IumagEK2LdD7RvvUyyhNo$U!WP8HBAv1u?`8nhqDzvHH=rcLOp1yXzPCH1&A^3hhgYlAta~DoxVFCTK19L&EYyO zBAdE^i(#Z9avu~H>OhK;i$v-;Fv!^t1H~0tti;lq!*jxA^&CcWO4CfnHn03Il+>=_ANp8zg0gUpv#;PbFVt%N%hD*4-1V`ko*W)IW^G^J zRQP+Nk++i=sueK*o1Wr6;maeAeebd;SaaX+m3+S44Xz_tFzLI)Lnqo&ciK=mbD27B z@r0%{75%3ryTVf6yCo+Lxi|q8)+f#63k_XwDHcjx4FQoPUWWT;P)Fkcuc8Oy6>|M$ zBe!7u`w~6a#%}RSM>3}AT$=OKhE~m5@(5dcdVT`ahdfFEnkA7C<;v77=LGc`uCm}$r78C9LY@nBU#D2oZ~+8(izyR(pEmTt1PT8JyRT_~lzD_SSlRe)gsF$*^$Ht;YZ0OMM9D6E)X$Df-{ zu%AL`e6AnNot28IV*f}%t+&dRUswuh7pY|v?v_^UIlc6yP1r=G(gp|w$ZpbYusAZ< z1a1t*;JnaaKO`B9B$Ls2S1+_1*fjubV2Gq{C-~tg*gshYL;{&Y@KBo$=*m58jK;5z$7$* zvb~(`&~(R(cf5GVi@RiYy!e0c;?Muhi~pt#3xfVsf+FJa+dv1qdJ$2c+dA&$1tt(F zV5GM<8c71<2!HgQ3`UXANXoXk|EUnU{RgX1$p1P!5%V8C9-#XVog%QT literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/gnome-applets.png b/examples/demo/demos/data/gnome-applets.png new file mode 100644 index 0000000000000000000000000000000000000000..8d3549e97c0898e6bb22bf67d87c7165df8cf3e5 GIT binary patch literal 3090 zcmV+t4DIuYP)000McNliru z&;$evC>@pts)_&r3y(=eK~#9!?V4GP9M^S*zuK$2r@Lq4kfNj!IU3TIWNV>K(Ut^B zra;q@MzRejP#^eTyi!hr?xtN#C<|D1d7xg&9Nmn2Ls+)IVOX9Y_O z_qY6#b^u%vCKs$oAO#X(`TZ>?aw7!f0&rEBR=8IRV{^bU5EU#Zlm2fK$Y)(CfHs8b z1h!70?bd{b8z=FUpjhxWO(Rs$uthgk~9)0vEe#S z;Mn$Bvt>=Mu5Z45`n~txm|a*|7Vq=LGvh*h{EvA+E`ZO0m!Ev>bNj#cm8ZXX``*1@ zlO%~O%Se)#D2fS!0N?lVJQvTgv0V?_c34~A_{rH1KKju|7w0bmZowPLP6#O1IrAn^ z1}ZOq|GR(u{KWAe?cP0dzhRazj1s!8qw5-qs-P+=vMeDXkx3F#mO_@Hs`96X2K!$e z?60}A3o9QKVqr&8Qnmpv7i3ccDu4gCKlrPA@BPHLD}6Q9ER`vh${41JZWySlhN@~^ z@KQGvvJBERB~4>92Q%r30H*+b%%63C^a=d=HJfAjM9#>V!2qg3vr zR4P-hlqr=<=%$Hb=%}iSEXltE9wd@9A&Fz+I3bE-k~jvWhX(8AfyI^06FViLY%}|6 zKKnoT{&)Z6z=6B}yj-bLDwQc!DwN7)%u)rzG*LAjMNyDs8L}?;BIRCepeZu4tfHt2vMf_6o8KE5u8kGauyiX3{7&{ccJ%RY zX_{`zvWlXpXqtwm8yH3j!z@uMSIL7})4SlivCtha%LwlZ4 zyP2w7Cr-L5ktC`6GFf`DQr7Pfa=l?M$lImQCmwxxB1Rw7Bh6AIMPqrbNhnwNaC#Q2<6zkyt`}16)4wV*-3@y|-lkYntJTUQ zX_|BcGKsnY7)3;3KoEEYzK7>_2z-wq@QA{IDC&+&)0iZQNz;ThO-Ygj$8mY#g%^1I z=yBFJFVnGIR86B&EaMU+)CC{--IdmN9bBh##eCPn_k9At zOCk(Iq9`Vgy4lETHPJMkfqIRXUV4c;M#qWbn4zIzT+hD;=r4Fd+KC6QkVuncPZ)&+ zK|mOU1ip*!dw7n6>)5!qh261mZ41}2@f-)=_XvEqJ3a^qqmU>Jn46nteSM8HXWpY; z?`Pt<=crZ(@LZcL%?5x0pmL)bN!_mcjH1x=J@3j2E6ZKJX_^v6A*!m8*Fw3x0^h}R zJv`6tddl+%f&j<$NaB$Hc~eRqGPq`Slv&@w#4@ij$`9GE}rL#_z3B%nE0N{{QLsH zIdzgS448QCIno4FRZW0FpeAIbU2ib=dZ4%!yZr z+;P|b5C8CmKRWc|fBqL1X6E^`?;K%eWrd&p=j)8#xtC8I7$ZqiR@XKtmrO3V+E|uF z+p-CQknsZtc;?y9v$8bLhf^Q0w7h_AJB*IrP8bBNEMDTs=O5vX*I!HXidU5FhQJnG zYx}8evl1IqQ&Ved=70U!iRW2bUgZl%pW?Q?d-;cd{3jZh+f1FC#`AnO8cjAfTl7_H zJn+DSJo?yU9RJc685(W=Y=ST(2xIo_8pbp=*48&UcKn&_ANf3nrgTuo(R*RYWrS?7dJyc6r72+)5k@gV7!U*jK@bwfF=-N0GEJg5rN34q^t|lc^z3ZQ{`cy{#KgW= zUw!pXV5ZRNkZyKElh;Fr?}v&6rM`-JpX-OnvclTx3g^zBCk{QDjRuz0!tS*3Js&>| z@dE$Ks_X|LaU3JdG9|;Ludk0vrN+?U0B@aocYS$vbE(;EUKkx69a~#ltA=6ts~ZXA z>)BG4o2^c#S~2fzwcC5L3??VvC5l4GQv4vqG&SNRCW^(Z`vGwj6D0|fB%!GaeU%FJ zTAf<8il&=fx-?^*K70NGU;`b?vSvm`Mh-O^jf=nqK_Dn>c5Zr8ZvcJGmTk$zcfNCa za=^AbsH#GL{{TVYp=&CtB9kNuX_6ubucPS(OUtYFFW;J+ z&cOqg<2Z}eYIUU5YK;LWfkq*avzsN5d!YnWJGSS_5(gzo(p6QaTCHIk8mcPOS1F_G zI+bz-(=h3)l&RP13=Ixat5&JjYG}Hiz4i9#=Bdf488O2-fez4awOVfhPXoUNJ}$Ig zZYYS0?ZHU&a9Y3yupUOqMil$mr`2X#%?)#1S*Sy5FfBg@)tE1h55i00;(-18Ua6h8rY9xcO}Q1!;^3Pp%g9pPN-6V~b}W7Lzx5vq5|{5;E|V z05@IeLWc#=IdHEanLv1Psvw(U5a*W1#&3Z?1>O+P-VuS`-P)%`{eG%&29USXdkMJ0 z)`0_pbYlww#hCDbHQ+AbVc^YML4bn3>%e`$FA8PH)d=Kf=M7@uT#tl`=8E4(z**qy zz|X`)?U+EW#WwIH@Y5|k&>IIuFSJE0ythRhb2 zE&|yTi=81BzT&1lD`cZhV7JInR)Lta1^7ID{u}T^(RQ(S>Vaa(eMqFf*+M2NdSNRW zIYR$?fRB2>=YbyeGWtt3zpayZjNpf?tJWz-U0nkjte6~J%Rsh$xD;IbHd z!xHKRAB+6_pvW9~3e~q*)P8THB$~NV;kRMo@b7AE_S2&E(%1=sBA7*y>fFLYrWInK zcy^ri#KHnl6^mNbbDn&)MQc;ojwO^|iCFUU{M~yl9A4#^H54)`2|)2q4#9Uq00C&9 z$VzEX{nLBMU9?zaq3l}a@~t>0-tJlih6}Dw3%ZxKSw}KKWXA{HJM};g)b7!GZ;J^{-^A8I0{v^{jQ{`u07*qoM6N<$g3f*DLI3~& literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/gnome-calendar.png b/examples/demo/demos/data/gnome-calendar.png new file mode 100644 index 0000000000000000000000000000000000000000..889f329ae5febbc3980ebeb945939f22368d7aab GIT binary patch literal 2755 zcmV;!3Ox0RP)LD)9$o8?N0lDZsHSelm4Ut z5VtU>6Fc<(5`gHyc)iJe;s%E68-cJtCc{Ms4%*Cku?dCr%|LVn;CJ8orcz3ywIWm@ z^*~Wq3WY!j3t;wtRLi=_6S`FX#36w%;vFJk-4|u#xa1t z`rKjRg^JbG7Lm$r<8y}&b(truSicPbVMw4td=+x{*Po+MD3D5}C|)U2uhfxJw!9y- zfB@73)$;n9M3zdFPM$>0ml|FN}Ba7pd#>O|$DRKnB za1ikL7rrE3Jbak`?(T<-@m;_cARXD>Q4aV@p_C$%%y4<~GL@AI?y5_zR-<06Z}7Mb zB#!OG%7}&loCgo!1Pw!-2O9S~Q6AWkd;CeH)5xW6&tr@0GJX6wpV`{2fAr2fzW{Ou zfCiRg zWPw#+&QM5q6oEj6gsL%;V>=DvIi})79yKFPoS8r_eL(L1JV%cnWj` zPXy2Wj0X=r*r1WqqL~aNp66lD&!Z}3RNm@Q_^fEv z!w{v6(Xo;lc`aVkckkQHgp?GgC9gmB7}E0a#AThB%XpjIQi zZ~@PCab1^6p@3YT7wewXz)r)mW#fG}deZ7Z8VEm71WGlNGpZQzr7D&q~o|L$Yi(CjnQ_p`(^lS<6J)gqZgK?dJl4KyT1E1T?7-2h-cz z%ie*#tgWr#q|;b6pXKFc*6bllEd}bpwr$&}t2#aB&r_|}xq9^~ z%2Mpyy_0-k;hsIqbSg!8VS%}o70v?L?kvMY!we1#66gRS1X`nw35l53ZIIZ(|?{?UI&u+T9x=1B$_T9gagP%Rf$j}h=i|2Xx)mN!|9!svvL=a+a z=_bD;&%nR{=~NmK`CW@RAFNmsTQ|#r>!P5AMr*WVJEEcEBu=-}C~86DH$X0%Yep%P z%wXF#N!w=c&|Y%691AD@O5gA>$KQB^U5`A%NA3zUSFY0E+smFkd&uQ-SXRrY3DNYY zXak{dHWTaiWY$`v^u`^ANQ_A-H%JTu1H_b9tu>iUhSk{_db3&PM@N}HcaAe-V;ryh zWV2a@b`3E&Fi5&9O>Mo_qJlug>`|NTPIM9hrL`7;Qhe{3C-ulfkKFEFlKAP5U*YLP z50UThXL@v$CD&zCYnH>1tev1*t1>k^g*CsC(Tz!12&03-*scVfXrU(iltQojigMlO z#Jk6I+gpfgMU%Q(5Nd^EC%CK2VQVVQuHj)ZdFm8PuFF()U4K;d@B^Q)y2d4MovHD& zfNpFYC|2@&xi@_yL1y>deU5yv#3gt*CMCxpg?Iu>ss1Uh>A=SS{irC4P0!UZO) z>w3aTlk|NO2_e#{q_z{5Xe-|WwAL;9N4hs23EfEqG{9T$9?t?jzz$&09JiXqwGAXq zsk38c&IhVr+`oVOo+n1W{n2~xF+MkU`Ilp3?*iL^Uh|%^5o?|?E?Tf$1D4FvF)-uB zfv8SaWZK*q0PAMJx;b_MDPw$ejJ7=zkpqrA`sfQYV`EIt%#@B5i@!1BMG`qQ5_#GP zwJ-v1dc^>f=6XE_M0FB@_?!@xhdQtpGd${1BqAWzQwI;;SD%|3zBD_#^84}e9~Rfv zYG!#DnlUQCq*0oYSo34uGw+i$i+0QS+lfHbYB4WGhQ^~{$ADO085ucTDVO=%l`F50 zmr66n_%1W%s?qo}z=|0&qJ|%%P2IdV>bFfH(FP=F1E*pyv*UfeQkfr{nfb$CCMQn< z+s(SxGM-%ouEun}YD>~~5OMnGmQL$z%Y4Hk-}FRGqu8!JZ56%AxsJWaGJ{3{YHh-+E0(mYrU1+v&sU9c?K5pWvhC;k zwzt>Y^oNSQu>GTiwMo=;tfG`md0a5pR9lY4o7!YcUH!LTXmnd%w0{~3Z}64IjZtC6 zP)Ob6)6>n4ANx15_A#wkc@0c5>RWvD(|p33Xj{+T>cd{g?LQ#Ip01hj#P$FH002ov JPDHLkV1jV$NvHq- literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/gnome-foot.png b/examples/demo/demos/data/gnome-foot.png new file mode 100644 index 0000000000000000000000000000000000000000..04766585175baf1d68a0f1584dc31c1abd3315b8 GIT binary patch literal 2916 zcmV-q3!C(bP)BMI#j0#0NUW%FWY=v} zAZeR4P7okLouGyTv?z)MZtMUJn*NJj%L#0>wd_3Pr{Xwv+$xqMB~nCLBuz@@iqGXf zxVzl<%}Otx#3f(P~MwGa4qAWA6|0fdc@z-z)eB?!T}5#v6AZO(x=h5ejmD z)xRZn?4x^j-2s5_>F)ZJBrA-iwNWV-;FvnvnogCr#+a7KHqok8A;}Vywn{C_0e}#IVF0rm2C30IOExApytEGdMX?&tuZ+0wY3z&TK0$I!!i04rP zzyxpzz#;&8)xaNpbbjO=7uRUX-Pl_rzll&yS6ci~-mt3c*JJ)O|)P z0PX`22N2~rZvS;VxBqBlXmB>t5n5sx=4AkP0uVP6+a)!>|C6^3GYm7-YPDc0&EYNa z=(7Qi`=oA|4*+<|caR2v82~K+IB?*=>1ZTUcWq;5E}J8(tA$*>*_v&%Wb3MeX9*ds zl}lu5>MYF_N+^^n+kKYr1@LQMdL97!;?I7%C!R?C?X}llb8DodBc;eKrme_idi*zb zaW!Ah7gkSBo=bn{#Q4EjNZ^zln%=@7*L9(g?X?9j1c6*dRxA()@*&Y(UeYVhMB+8#=Ru- zuTQ>_KlR)3DV`&{vxOqj4HE!5Izr;js;19B^x%WBPwe~nOV>fycL#Veq`D9YtKLb-2KDDBY&pIEy%4pSxlcp zt6n9|dKHvX5>F&x>Kfq~;Pk{aGT8#Mt7YQ%$kPA{o5egcGd=yyty{PLeY3U}`q+)5 z^AA7v_&?4qWgm4tPyN9o4}ZA7ukS04Z4sUi;==L*@+*t5EgLMyk&bW}x~36b(~ykE zNMCmf$HynvHLm*>yE(z^;fKC=Lsu&CZPU;rwY3u0sFttm*^)doG&ryWfHgckd=EUA zvuvA|3M;5p%3v9mM50k}97kQp0Ur#~L^6p=wTi`+JS17Um@)v=HmzZwc;b)~aCIlZ z^8t>4&MmE=SgwX+(eOWrqHuRC8u*+)+#l`<1w5$J3+IBRdQ0R9EQ1;1%G4Lk*qYqaEV_)OgeU_dvl=R_eWTc%EuoxLJ_+XK)9Fa_XI07w51*2%lk|D}B1^V8xH0KWndwjHMx2}gSCwW`Yp z1x^q}REl|+h7Qm3z_SddXXoGpw*egXGf)~p5r6@JJ^aJRKa|?ibsGWQDN8Ms3i;*n z@$nZAJ#{1vz}l!y3jWL1{0EAvhIL&twYJO&VhFD5QqOaVq9}AZw@ONt`Z|j*`!bmW z-~hmpXP>@l`_Q&W`UbA~kZI_|v29S#0}luFQt$oyZ@u})|9SlMy#S;QKS=>VdTv2( zw^fBwbeM)t!_iJCQj<0t4b+Rm8 zVCWhg$3d;$V2kDI7la@`Wti4Mf8{n7JOHy=tLLs680c{v8@6R35a5X@itrEH)R)NY zTLGlg>BM4sCZsA7QeC|O0a;tk!?rD2F0LY5C}BR6gK62H0r147;={WIZ{@PNiR-T$ z*&}vD08lU-2gkM%4vAn{2CnNFZ*R=Q&pek`n$;(7``9gCZp#v}OoJM_4nY*LoLNDp zP=smO0Fd$z?2XNsn7Q*y%dhIXMh#6Rk{;qNgi`!M+|M27~?Ne;>HzmwtKT zpI$xr`ZFxY(Vl@p(iu;XRC1auPEs2z*sIQrp{Z=sT`K8Rvpa13O4(uEm>1306DP+;NA64|lQa+rkVG;`MNPmBqXE?GO%jPlKKtoU-FY(~ ziX8Q*x3J>_*R$Qd{e7`me0OhOZ~w~tEVXP4w&P-Hr2yl9`sD-wbyM8NFC$whJvlTu z@W-HFdU|_dTNYti7U7N%1fEAw6iH_+zU|uWBYzzT@CXV5`uh8jNOhrJEkkX~;J5&a zr4n6O$zS9Jz{ET8`YV|dd%vBSKEAeAnO9W}wrzvuSTHOL&!aTj8ACjg0v{C6s#mG5 zsbE<;qWR!Nd!TLyTJgV@nQqMdO>qA?hT2G_QUAc|O7S^%XKpdQI&GW68h z8O&#L7w2059`olxSLJ3zFIQ_b9LN2UN4<=Z<=sY84q@GVgYt_C>H6M{Sy zf;;2eC;+K~#9!?U~!FA6FH}KYM0QPC^L1q#-m>qAePfgx+4X4+_@WQ~0fF|R_@qzPCQ$m+7K+76p>1L`T8t(+(jMbAX|y&u_mki6H+wA~_GQ+d z-<;DQDTyFw4#RKGo;`ckcU`_~?KQA->>NAC|K0IbKtICygF7j#8yM5K&%ePxuPowl zVS)oq;+ZEDPzg6SH#S*czsWbh@jZ6U@A}$!G=BDf2H@GH;DN8aclFsDhvD<;W)vap1tc96kEr0}GcHe+)bUEZ%Vo{Qmr}dF#x}(M1G_0#{Ygx<*i7 zuY)_?fAEtmue{HxlP_}mt+#K7%wGq7x-Eb=-+Ya;=Uzor5HDFs7h^$DoPwZ1culbY zH*Zcje(VvH33uJSFUL^!wRjyLgXos+WE{uCI;(3Nj7AgI*EU&RU1c&JbNSEjaq77j z3b_YeXnAFowY7CbG@gR0QdL!O8i_H004`Vw7>~xFaOPKUP}lR+bwyP0i}@d{@TD(* zfzN*C7>_;nMZ6z(ft?YQ4|U_Rg>HSmx_;w7tgI{{BC`QlUAckxKKOs|kr00_TEGQ% z!a1&9`4_dD=UY#Fo8!kG<~Qelj;KdbRG@8JR713g2uK)LBD+Zdp(=PE+%=Ggf(oto z;W=PoVR1GWx^!uQmtXqDOg^~(zPow;h37ba>|w54dk3#A5|t+!l%Rl!4_faDuLLWL z4@96U_}1fq*8A*=L7{#&09UVGnTM5E@(O{Jrk23-I?suN#^N&Bm#}7Y9Gq-13 zUsY9_W}ee$Ug~l}PIe*Mou(M7A{~Qj$m)Wls-lou(bPil&KhwJ=LAtlAggwoRh2R;t44QGGsm9fwM6WiaV*UfW4TlXL?%qJV2^4D!2O4g zaQSb4>I6lM&=R$!h>%SyVnGcHFIISShBaggphP-OiBxCJ1HRqpgb_tu)bx~)o%Zt> z^t363_B#PFiU}G=$%^PSPXr@f68$g$*<3wA`&!KuE5@Ceo>zkD#w7lq=~O#y2lokd z?R}tS?`I5RRSbY_gi5}jC{d+1w=2c_V`3~RfoHSe$x2-uboXWg5K_5B;mW}6l23R^ zVWk0}r6p|ui-`v^$Uy)xS9ob>bRqA%G8$`UtNm#g6FL?NE*9s=G=L=3^gM~=AYD0+ z6#I@31u&URXxlc|`$0PtKv0QXE}ih%m5c?Y=Qa}DOr#ql(=c(4_FPAEe9UG66dzN+ z4Or{Tq%u46|5hL=C|1OREnUzGpDm%1*BLOt7D1d`h#}!aW<;fM4Nd!JLxb4hR+B3r zyApk7%E?PISj>AUiuq{(RjO4)lJB{!nJk!0)2j7x8jm^>jSp#`8)bT`V zpC=*Sm?OfS0!P@gzV& zcd-nfavyrh%fv_gbCGqx)H*rdQqr<6CjHoTz^E|;bI~-2Z$tVv4<~wLC?{Z&TquSH zgqNZMB~vg{iLWC8i6BEiM!NmLUSI=gtp($+V?WcwYNN8z_b)mKopouq7ml|6A!cBUaRt+F2%4XdL0KMYS)>0`JAh}rF6gjmP zn2Yk(2|yh|IO1NkqdyA1mLl6uXJ868>d`GjELLW3%UHxlLTc}sJkTWKY0Q4n*^b6g z-4kAB%7<(LE4)mB%)-U(rNox}u<#nUl%4B1Tq52N{}Sh`Sp!2N-rP?; z#x`oajoP08o3<8`o^MThpqzQ3>wO?mbL|GcJGfi;=+bYfCYdAxN}$9Iv{)*mRW~4X z|3!lzNqT_neC<8k|8+*GO%&Faq7!4u!IxLPm%4%Wa{rr)-lDeI2Eg<_YpeG4&ardc a`te`)P0QNbN7q9D0000-Z=iFN@JloW?x2*kv-1@_$2g)^QzckZ3BQ&7?? zjbz`scYGfI^FQazHNba(EQG7OyZh<-_3M8E`hiYh5p@i?ckiC)qfjWwe2ikTC}U$| za`fm?U#a!Ldq65y0e{@ObxTAKOsh39!S zIC-8&cXu}%H-5_TZHlu9M0rlz=a=MH0IV_dy@l~Sq1h7H}E zI&})*dtj+gvCSrg;*@AaX!qKxptgBmp(96*P%IV^QNE#Bv7(DTd-ei+3;X~SfJ*a! z6Q-VZE`h`ML(|FJDeBm!nwxhg|L%+pp-`Z` zy**KI*ZoGUUtKG+pCOe>QK?h_n4X^I;ll@{(`oYgJfowxICkt9z%JkqVA9G$E{wZ^ z&%|<6=m6t-z$&F`^CDH|@x03Ho+=CV^nAwjbe`VcFX`#&@wYemADWXa_cp8?U>uZ+ zDyWpIc>tP>HNpM1wzkMqn{|P_m0#EMV{T2Cqo`h;txOwvi z>2$gdSVZqBRlR(-`_S+_FEn3OM%4^d-K#W(WET5@Vk09Xbar+odB7%^-O8qmP0xhg z?(&Q>JQDp~Upf7EV`4zqv1142a@nE`R#+rsT!*4WDA;ANfJUqH{r!7*@nR|-LLzYE z#tjxNS`-TzlQDEy_{6D2ly^dW)ieujlw0Ys8}H@BJAC}kLS;yB|%8I ze*HQvEv=gSRY-s;( z;>C+KNT9JoIBA*g*WnUep2ke^knyWdvsx8_bLWQX>ROo`#CmYr`CRJikM%;#UMGpO z#I{3{dRR!YYu7Fcg&CtHa6i)akW)djsphDKbQAY1=xtAkujVkRwHNnzGk?n)pb2KxGT zlh02Z&=6;LWh>#(=aL9x_?GZ%l_&!dSsUj5 z@R}$AL}96~8yY&p>eXwL8=7d_X!3Hjt+ct{*0{TvCF)HZYt;cEfd2k|UcP)$vqqGY z#nG9$-#FNc!?3}`DYP%gp+kdYvwtVoLL(!;vUF)iODJw8(cSOYHtz0CLQ00~CR6Ar zgwCEl!O5>OJG)bn=R zo*$CWAwrpW-@g6ia!)PRa=U%5g4^Q7wQq3nYsSa_N^a`UpFc-e*9z;K<0wpU9241k zXcx=45?ffA)2DxC-MWvHJrI=BBrt|MiMcH;b)PddauO8k$OZ-mn4Fw&)c)ek*mFJE zsaNpBhrdaN5D3G=L#$l6+JH>75x2R&k>HEME`EJo5OVdYN$+Leg~b~gDS-R;?*qcX zz#*PI$y%C}c=~(W7O$NnH8q7Gl+9-C9+;e*WM*cDv9aH0Pfk42=`;&v+`aoJ*=&|q zuU=ULZ^8UusLtz0U>nsF`?P=B_c`!B(4wCJF2EtcYv3s`;hz&j_2|9@NdFHM@PHCf l1S(BhFfU}mZHg#>e*v~bp87x$A7ual002ovPDHLkV1jN%Ztnm9 literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/gnome-gimp.png b/examples/demo/demos/data/gnome-gimp.png new file mode 100644 index 0000000000000000000000000000000000000000..f6bbc6d36c241ca25f6e43e1b8a8aa01a2e326cd GIT binary patch literal 3410 zcmV-Y4XyHtP)2Y#=s>A(iT? zRn#PXsA~HoQR%;=>O)n-pQ04fAN-(yNCBy7B%`##Euy4AZ8^lkvaypG`8l3pW;`C> zxvz82J!d~wf1G`Xi?Qo*OC%z(HCyN0JNNGUeQSMd?X}kdJ|CZt&&RLypkGm}+_@2- zb<{VHt?G4za4dl<=h6ra^!JEsEbz0RL}+;Vz|d`*#(uvX6-SB4vD5zi5UIiQSpNL!lf)=GuOLKcBrIu3vKq@_S)2ijq{J~eBd_oWfB*+&+_(bFp-~n(g zfg6pB4tQs9pf`H_OZR@;5%iFhQb?(grkNlh0N~N0fpS+|PeOU564CLWpPt+E$o9vR zG#x7h{_f=~2Hl^ZJa>`}69AV#viyx?sE*zp0PfABt2X`Smv{Yx+=5fL-< zK!0EDj$79~skIK3Wm6aK zuvu#ZtqquYWYx&fjzSPbm*%S#DHTBEP!3RZ#l<3MB9vB+4BhhR&aK~kV8@-`Di(vs zwAO)C5?Y&%xuV%`rml#jaN}D_|RHl?{9w{w`{x}#ZrV?^)lZ0j~|H>$KNfxj)8Urv><57 z&`Lua4Xw2Wo`YuwKnyToz~=0^=?~6N%v=B=us8_-Gnkpdb~F1}43O)(>%%bodK5)p zb6xjdW_Fo*+VfoTZ~ywEw}cx!`1afH(56kBuzJlH{Gf#M=g#1dzVYW6Ubz<9Ftpb2 zg96rXxQ&)ATZt3LehOnamxa{Gq(qiUWKto^6w)kzt(5AJ;cBfp``*zH4ryZ=1hfFe z0P37yTQ(yp0A|qxp6A`XVZ(;+ZQi{3At6L@Vq$`)rl!6Y$MHWs{>ZjV^+tT>{{8#$ z;)^e0U|;}y_UyqIx89F6YsZjEjs5%f;qc+Z7#|rg5Wp;no-QZdk4 zTksM}=XwV-hy)y0aFS$|pB(<#`ql~-tfeje?1o0%DDnxMCT8D4vBKjJv10|yS^ z*s){$>Z`9pN{Lph1q06pskW1$m4Z?VQYt8;!3+p!uGW&qv7eniC#8}A83Hme5&%gq zXHGko??|XapzL|x{ZSNog+c-CcDv&havUd`oT8fGvXB&m`|kDs}u zlvW@p0BsOr01Yr2RyrL5pYTABlyYctauSCQ9YUkg!0hZSgb)bB5WZi;(W6ID4g)M3 z8O5Ok|AmQjzd)-#hvC&5ao>ZFVe8hdT&vaa)KgEP(P*IEZlhAUjAnfv+U9lDncBcG zz-$1{BlGmxsZ=Vh2#^4^E$|uxbpTB;w>VEK9Rl2)g_M-CJv}`QW=57}Xti1>l}d=B zh@vP0IU48Box;rYIk=7k;Rt|$i8CiKwr&HSe)?%Br2qg@N>r;0ID6`Su+E^AUi5<2 z48sNt1119U*x*)@W)@fmASR#zpk`;2a~WmVlF%G8pRL#H4-*l5--qw}2*Z$~C_)s4 za3IlW#!%Xa=lk#+0pSP`0dMU80m^+V;00xPet@*y!qkORNRt>!YqVNzw6hGx#sS;Z zNw(UWuhdnV$rwNaLeplP1prlm8_bBWkPlz!flOZgEud$#wpC z@X9N}e~f_Ex>~7Jo*Nk%38N?)55uq!g%L_&2}xW-v%Ub3S(JfR3PC}GnQTdrr$}S# znzqbvxzYfUhrz)zddm@}nhhAuc{MUov@nYG?91fH~`pj{cPe z|B2HcUF%>Cz}viW^wCV|-wS;2zAVcINC?ju12&Af)rRbp0YacuETU8@ptmIub=ch zZ=tWRPhProX~AZms|~&u0U{!ofPjI4An>+3LTu^jDeX#AwO(r-u`%Sh9)+bMN?{S@ za)@#mqQ9>PQ52z23}B4L`STMze|bSyD)rXf{6dnZvaxD;AMd$ubLo*Cw+^lt>M6QH zpw@HOMRv<8jvqgcGiT1IG)yi+}Ns?x@dZX2hTZz`DBZJgRqO(a=zp!z2 z@vGz8*KWUm_f5AwxcAmZqk+lENgO?T6qA#a+1aya|G8SNzBw{7^5d6Ydg;R@6F}aJ zbO8zoD1s1y(aS(T!2MwK0~iD_$iM)A5I_le`=irV=>(p#nIy6KzRrxA)p!Enq7B@+ z7hZVbf${P2K`G_dmtTJQmgk>;{*K|{VGIusPrmlrYipN6;A4FnB6tA#0Ez&I03tBT z0D1xR0qEoWz678E!0$@WjKvNDGNQ%GvSHI?v#We)*i_oGUTOijvs5a*WeH$-c=+CZ z`}V!t-2uGbk<#S#_hR;11Y>`svvWq)@&)7#F6Sx)Bs1Dw--|8i%zCWU@u>Yw6TpR5 zt2JJ!RQ@^$f~~&qKMUZ#?sQ5^=$6qH?GVp`?Eo%z0r$JQ5ZwfH7x7LUq}Cg${oDY6 z<(7!o<%Jf2*1*8P`qisf|KafPuzCIU*MF-+f|l6w`$QwEi;UN0b@wX0QSPeWWmi1N zuGh*MVZhEoyOyy8n|5EgYzfJwN{G8QkZx;gyGYhWitzFFBCha4Hxb=+-#Ft{CELOtJ>4T9C@h$?d9v_?pGs4HCgs`k&X6WcPRZ z8voZ;GIjepwXxP|_XIX>I;901d^&@dIG4Isw?sQ9F?~fsFrU@OtaL@&ovtW8bys!z onSM@8SMkiJ@fhp#@u`mg0rxOzf&WiZ(EtDd07*qoM6N<$f&eCui^qxHIm=vo z25T+jxd@#pc1J_vB;n28+i0!X4Tm@f);JnV^IshFqhJ265qRazS63Ei=2wIeCv=uA zr>P>*3Os@5c|;RSW-TU5FvSjB(?0m2gmjoO3%;}Uw~ z@`V!z=9a$T3vWf63}Y>6nqo|bHU@)3dLB|r5FXZ93}CEbG#*U}j3*(RJKHz`2!W6i zPfA+NHr1fUXgnrO^`WIBbNBCT?0);E37ot9=CNZ3jy^7gSjkL=vv%(f&SI?DD^6!H z#-cJsmSt$2g0nblaSpUeiF#dBmNFVgWH!a~B_fc>K+s~!}c>cii#+qeoEf>z6qqn_9Y77VmKxQ&BYq8eiReTl>AI4$x2!jv+9+`8b z)*w8GkRH*c5;m_W*gpMp6I=#8MzWn>Y_uIVu;u(D3 zM|vK@^YC)HRDytJvq`mDAqadroedTi=QwciAdR^>#^W)!-1%X!7NiHBKuRC{6yKM4 zl>ikhHV0kiTeAqDJ=3PqY92mt{J>9cU*7(w_aY$Q?P9EwW4@G+fA%v!&zl#{?R6Au z@uW`>1PCFh1OdVmL{Wqv1k`JFW@cJ!Zfvo%xWMkt4!gZR3)LD@Y0jT{iKU>*Vylf1 zpwf)grf8Eg3`cAa`;5X7z0oeiXoRhJ_l8&dfBaqqymw8Dl*fb+jD`b(ARq_=r0=7( zA`C;KC_-xu4w{W7J3BqLx?P-gG@1?8)~*m#Dx^BalOAy#lV%x9b91y1WLLTzcRoLM z+nwBfbeUSM#w3Z^9B$Je53o|;)ha)D@T0f=;SGBsYwg-^{>HB@KmXjbd-9QTugl;_ z5`|7v0^djal6JF6rBY!y3JC(A%nE+^zLWI(BPMZ7k|g+2vbZqA*2ZOy-Ex$V+;ca^ z8lq^zBu-c#_PMaT#ih-4lvX54p|vL69e=L>>iSo5ST0}hO~5&~(%srT{n^ia65p2u zet_po0x1!mhc%WsNtjGxvMi-qtGFNa_uYA%-e7<+ zhHACK?92@F3v<*e75Z_=x6b_=Z*8ohQjOLrc6;;_!*ksi_K|R~*Dv^QNSyxm-#@+b zTaSKm%GOwiwFV&sQc7yoDv46Wal%iX`e_yq96>3?WHLc1MUo`Mc@~OewOYY*3g^H% zN3~kv;DIF;=I2;koM&-ij)9u+-{dyx{kd(`1ttpppyf)#qmAuv~%usx4X6S z*q0vV;>EY|r9}EZQhIv;V!JxPoMc4{^9krxXgS#eD>czmxG_KYuXPu z=T?Bz-}u|F^YqhyM-+|-0v~G~S(cF`3BUMDzlw8$BuS>A2ZI4=nlc;?84LzQQA8Mq zD5VGjpRJ7!&Ox;rFgr8D(IbaAetenZx8AZxW^R_Tj`{o_{SMvHfONHYcYLwm0ZdN7 zT$7a$LOki5TmHn){M_R|e(Dn|&;9d1^5P56asE56(P%b!;K5I_ynK8LTq%W=65scU zqKGWZ7>~zPDix%Z7-LXMA%sV(RYxE|!1hj`NgNY~AZ8^AJMdoI`7kbAsV;#M0sdjYflo`B@eh7Pxi!7G~OQ>Wv!DU-%BMU0wwt zu#+X|FjX9K3R4Ns$wK(SxLeOrvr`LrL z2qC6_x7M<>v`DwRMSn0vcpi;B2vT}Pnc}aXeV(tq^ejSnSeyyBfTie|yoOKURC!^=>P3@B9C^Dhcp5e=~3}Xz|TH5XAURJE5KOUjFmVa4) zo3k6M81^iP8LO{GFI@fupj94KfW7G*nH1i`+UPyYoP$b|1SutHnogrGr6kKToO8vX zWM?#DeYB19zA@fB?`pMWEmBuV}poKFcz! zwWR_T7-RB%gPH0cm=g7zz^_%X!htWa9%RCe^zP)%EbKRzS5x!oMj3 zX_`KgW!V&DA&)Q&X}8;Gtx-x%2}mjP8L(FeNff6>X6s29Z>L&E$!^riCTbH1bAYv6 zDwP~~EhpjUM)byOpxf=9NYnIWnx+&aigxMyK53d#&Wd{~Mx#NNWyEoe)*3106m+>hj4@LJ z#g_@^+&s`O*<_m+X$y;m&G)rJjNf{=Od;wmR>Oug*yAA@Ph`@L}_KWCBDW|4Q6`PQJA5au^nx@lj zsdH{R|HEiz3Tv9=rjn!Fesv3uh-e!+(c_l7=~DDnM@|cam;Wy zq|@n4Yod@&0bWX}FI~D6l{D_>Me6786Z<+*v5M@t8_9rt=%I(cSrlibQlZ!D(eL-C za*E@a(P+fQix+9P+tc|_NT{$FaU5^&({@mPPhpw!8qoRC3HoRwz7{*_&C2L2O~ zS6+GLiDJ@LDiyZ3w@H$OD2nKIyR5CPQLoq0TEC->dY;E%Ft~K~?AdcUm^fbv5S7l0 z>k63U*L0~v86cC_0KCwmUm7HpXP$Xx{r>y!ze`GaTb5<4uC7ik!_})-an8|bG~Urp zd%a%g_19m2qtoeZ=OB_2i6jRa=R_vJ7}(9N#V9{c@}&VSueXJkimdX~Q%{|lpP%ow zTCGF1T5aL{`SSpTVMvx`G#U-M-R}C;t5>hQ{PN4Mudc3cD5b`w2p6EE99)!x9_7bj zX^l(Zi~pO7Ys`RGM7}gFo4^b(3oHV&r%s*vSQv&?=Uny07hhb<@2`}ySRPEaq-9-_ zM{$fwgu>Dq<<}LEh-=J1(G`kuUU-vMPGT-UZ|19BYK^j##WHA zD*-Efev)4=z>CrcEB4)=mWG$P?hjkl~o literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/gnome-gsame.png b/examples/demo/demos/data/gnome-gsame.png new file mode 100644 index 0000000000000000000000000000000000000000..01c061151f69e9e80cdcc29f4190f50dce809fca GIT binary patch literal 4263 zcmV;Y5LoYtP)?dB=a}oLhTU@6+AWGt;x$9y7sVFt*tjD`qi9#ufny z2qENwNJ*4DM2Yf5c#a}PilRg)CQ&3Fj6?z$85B?mjt$=MGMmSq&C@+SJ>Au{-F-Xf z*}2E|Lse`udiQU|Eo*jH#+Qvm$kcb;#5@9B--pKHW_ zFxTAJGuP?Xt2U5Xo|-K2V%JSq8*<_wKk-}lKk%+Q-tU*VYOle`G4ZOjoDvvQtbE)0 z)d2k21CJhh{`~N-Z&|KMjX6p8j?MA4nA3yTkNo#GZ03n4C#&H~D zj8P@7Hwr?hfmvXx^tq#W-YMR7N>XDR@s`pL0DR*oXOB42`Mr1S@}$-4pgP5SQ$UUo zg6WAi&ku7t>n^G$=?<+3Qk*ae?)$_&A9?aS-~Ijtzyo?xN`w&n!=K#$p?pHxac zB!n0O^}qSkd+)sKgSUNodTR2BswlLoqP;*QX^csSjp>l(P< zN12qwX`yN$D=q54yX%$t8<+06`@#SC`I)aj{LG0$m8ME|F;*p0a<}>_0OaXGqcw3V z>E?ns6daj1WGW-phV{&nIu13N^VTK7x1RQS@@xQB;6{olm(xnA<*$6{!?*6-F|*I> zu2}3Yj2=<7O>i^Jd9|mjE~%Y=!S`EW%6&o{lqhc9n=cKML~2_ zNGJj1RYtsY>pg$zRB8=rE!L!%Jmu(4M;z{GmK;kKr}W(vKaBX%vmW1lYDC~i2$PZ- z&|28rb~$r5F3s*z!WW_f(l55I?3fFS*(f$gcu0|F(~Q(UEEnn`84BVH4hYs3Z1H8l=eDCN-X)TuYCATl9T9jj_cV-e)&Y8@ol zFvgOiE$p42o?P4V;*6dmnz*E|wVeZc-Di!w1gIoIby@SpqRt1iuYH$ufYu z-f`f2p*J|@haO=V(sM&z9ta#Pd7N_QT*RX%T;^*YSKJ&SoL6E>L*#b2xkj91gh@)8 zYO+M5Q;p6t$U-2;>I9`DY@U)Ci?tT=6cfkjT!XEmQ-?Us&`H8ghnD6_k-S!l)D=Ko zWdo1>@ZYoFIQp(LqmlpdJWZNe8nbpK5F`OlKRe(D#}lGV(DhP+6cE1%j8OKD~eV{h^dBUx(%IrPNR}xvj~%ALdP*Wa>Z*#3-wMADI2{EAv8A_kN7&4ozQ13Tskm58t(5RDXL%cB{9{MCn zj+Kf*0G=NaNkzAt(2XMUfnUEyM(d2d)2ouX|NP+(n-F_-d=8gqq zyCZCECly(N<}B64eN+|?pj(rKz6;GZPIH1pI%1@1__>wGUb=LlX+IzLEE?b;NmUx zCjc=r$Zkf~2ndqiFCtNF$kLoJGKfkQD17+jZHHmr^?dd-Gs3sPZU~K>GoqbMlM@}kOYCN6(cu{x77pV@A_4_ zP>Fa`M7wd|2#Xb4Yg21&VvMPbb95m@?m#@>sH zYi-S1D~&Ni2w{yenGiy{Ny1dE({9x(%+@56jXJe<181^@YE+0baHb^nC}Wr>)yF9VRp#!yrf*P@$P=dY3l)CAxG80IyEwt_Beo#5<*G$XaXjg6LETkq9BG zfLQGXy@d}Pnc9DFsWmm-VP5dPoJE*4gUwB1=^~A#)r{$f1~*QzIw7mo z=*1a=_zK;AyhNl8QRL?iDuN7%$3+@H?o9fBZWb#(>4+`SFQUL3Z)kwX;CYUG% z5_657%`1{S{?h8H4KKPfvbDKkluh)#fZi}*YZ!`;ed=@U-M^10j96X0%y2Y935nR4Zh8CbBFeNfLrEzzclxBo>=n12+nTZmC-r783A*NL~-X z(YN3FhabB0&X4y715TVc&Fab}2K_!-8*%X9!O!kq-g9?}>wYQG>Ixxxg|2pip%7vy zgmC8<=8t4L6G*|#><-~5hcrpCc}BHTMG8r^TBT8|1Cl-a4;?O4wpwt$TErz@E0uWV zI`WpAzYql>NfeQ0DM^yx`97ZSGxA)T&GtuupN-vUDPvUDS}BAWry65Npa%U>(ChWv z^?E?N)uz?z(C@7>a!0tnOP*__5EyGnbxxjzNkMR>)NT~l%Y|OKq*6BrVL+$dq2C|k zxh_!@qIHgxlFszhy}-W~8;)I_J9c#i-O^gCgb)ZJRIl58YNb*8(9+^gq*7EXRii&+?u-eLt{K5>uw0218j_?bah#BZv0YiYcrplrVbLY1 z6k-hvpX~`D5~WmDsZ>(OadIhT9tPpD&eX(bw9(UPnv$nEBX1dO)bIABN4zB#HJ%N%Gd=$Q8rU2;cKe6b9zX`jwOG>+3HW zW5xz1O5uJ~ zqO~z6jvsp_%k$hC8*d9{uMa@r2PVt%huqO%C5e;SG|Otk;o$Vk7cTth^7{HIAw;L- zMw7x5xrO%$fiwsL({8sZ2fZ}S&bj^G<4W4Q<1lXeUO<**LMH)nlEz^W`lnxf;WBl|HO4LW8y19b6if=m>x{sv7)tB}_7`hs(W9vq#1DbXz{|je;*hX3tpQ+RVL<@& z`+e1HHWy~+=Kpx2)4rots~+u--1CF2Zm-|(Umh1sj^j+{dA?rke+4)ToGZ@iz1}IM zEF$0>umtP_77GB?!hH^aP2f_o`Je!hU1#1^FS>2>1w-}}Lyno!fWsEL-!GW53S1mZ z!FinkY(a=y8WrWm{rJ0Ih}SPo8h;ss#@@>Jr3(m>G`;;k!>r$U(dcyX&#_TXOuJEq_p>& z@>c_~4Gg9E?yvOsfs(XkDRC>ee9ZsFedn5%`(AU;{{a-%F$2)SVdek;002ov JPDHLkV1n+!DZT&z literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/gnu-keys.png b/examples/demo/demos/data/gnu-keys.png new file mode 100644 index 0000000000000000000000000000000000000000..58a33770e67e60817ddbd85faeee8534d6f896fe GIT binary patch literal 3852 zcmV+n5A*PeP)bv}`GN9l?A6^rQ#YXL9 zBIUe`&wop_zjWcMwaZn@a!f1f&9_qNb=C9cR1xy6iFM8i)pS@@%dk~=(5E)uES9O5a*iDvF^5Y+;GDUNGTCQ5HJJ8<8c`u z8*N{;^8H)-`}@BQ$iG&=JMlnPC>&gS!{1)N?z+FZW^yPHHlz!Iph-u22hZ-@#peI` z9?5uuGq0Uv=^aZM7#iT!y|1Du3IM7qNF?HX@t)5q@l?DtXc*T6KjmG>g7OaTx%}%7 ze`Wp0Zo6fUt{R4^hX|ShqFFhdYigo+`ZP+WmtyDvw*F)*S6+D~)z#Ik|A+NxLc`Dv znwy%q`|i)s)YeQO6d;lvnOn1bVddNX>74nq-$`tLG6P0_e*TB9zwU!8_aCU$CQr&o z(+rG25LMHuuBzhrkp>=o;6Xgs!^h_fU-$x!;~)??ZiZ8*PxAGzZX}&aF}#K)?mS?3Zho$a4aIcRG$%NY8_CJdo-Kr0rs?WfS$Xl<-rj-ERKgkol7RQ-0N>UF zs-o81d*8j=zx1zPnid<5ak#FIfMy&6?f z(KVG#n;v7&?q89WlSNi`1kaUtj!Pnups%Ozm3fP+ZVU#4l`rqEyYc1^-}r%&@{(yw zmMr!)HRLp%YZ}=1>OL!DS*_1K`&?~Lch4~J3ee6Uc;{^e6c-i$*H3=>laDW)zfcQ= z0;ob|U|^7a`}cC-z#+=YiYYCf!K~R81OovKGXMx;!^3R-(T~|%yO(Jtg=m^aDw!me zOk;+1tW<`EW2X|qQ1HO?;*yFxK6QKHr@wcQUAz8=!NCEhl}*J^HTnl)B$IKZ>(kbJo^;w`;pLaH_WEm_ z(z0?rniXYibc|m;{~|{ZA7#_#$H>jiM>lk&9IqNp(=bib_oUbRSb* zhEa&%osBJms#=}8>VLDMwCp)k6x6N|-YXl&rf;d(~KM##wv zGddE(_atLuVm5P%}SvXQ6eV^f>7`NZ~ zamvc3Vdy5BYG4{cG)?8;zQb(Tuz_pVT!W@-3=a*n^XZ+`zFN!1Z)`+WRdijarKO3D zU;7$;gMAuOOb!GCH(pFY=|?{LkupV9P<0jX>F?{~`0*3e*Vp6uE-S8DO7XNpdV6~L z{=aW#BsNM#MJ0id35q-JF5f2<4A9@*%c|AyXU>B8NY6vp4YDFxn0kOfFi2ltFGI0G zjvYP5p+kq*xpOB=mMme@W19#B1K76Bkt22d+kN+A1azhrOeGOdvUth7U0uvwP{n177BRJ`fb2*Ps;W~^Silu4ufQ-&+M3&FXl&r6mv)m# z#i^*6iDSD+6qYW#0@KiGX=%oBEV8O9QB?)u!|k_!g4fQT;nltS$j!^;p+_EK*34N1 zgFyhEczhc>ckU!RH;Zs6gr+K(0fUz2ma2<+pcweUjPe=p%gfK5c;n3nGrhD3gaT3$A4?F- z3etAAHTG8hfB-%-y>wd5hEIOH?1ML6FJ{arqpP!*uRXYto}NAyE?mUmzz}!b`AH1J zpslTq;lW`hO`3!+eN;^&J1ZN3&(R~t_~fTQMNv@^0)e6`%%3}-70Z|7dXmnLPPT7< ziexHDX=xe0GJb9v9PH=I_kEe}-YzOCXA+5I5sQtH$=GO`il!?_Pik*2p@?DVi|_o$ z4L4k|a#@9*QKqcl`TKq!k!oRaMR55O5ShfPkb+9apq?-f*OP17d^~zP;u|ZOMU_amc?sv(~ z$wd+NUhk}G(0(( z!jUYpv$NU#(r&`xFsiEJX_`dyq8vX_&+y0)0W*Myhv#}I zLP7Wf1UR_lu$T=Pz1JZqi6~{p4!3I ztv@E36J<)_LV_%s;Y{N zmq8%F0UsY<`uP4ETV+!-@I4P-j*GNy2O(5ESE4E^nY81FB9UFYpa0GM8bEe-c2Q+@ zDhx7K8pn2!z7KNTtOy_5cKn}i``KaNr?sTCM2|+J zQO9xq=*VsdMx#d5%@U!hd3zyF<4{MrcI*x;sZ_I>kTezMpr01e*CIGRa z5xKwi;PLkJ7ankJ_t@_R15{L0ESp_DTPTY1`?{3gcr%Uyz8J4lMT}q1I2lr@6prhX z$v8N!hv!Lxrh%#|7@CeEK-CoD@dUFg%U_H}qrV0o>h9|P;?-AN{oFmDy{DYH=&ov%D zJ;-<`b=3F$e|c*AQ(wCFnrlz2S+(YH-Jv=wJ{FgnHohMSO#$i4-tIp4nH{^@4(_Yl zzGV4=J5M#9JN)L7dwnCjHZL!4!vhaIuz1~V>+((0jHZ$)e0&_&!S&ofs#R50>Fl_` zYiAnhXm2CqIM|sCmSvMprEwgKGpAbGTrcy9lMQEIeoME43Cso7RL`lty0Wrzc|pNc zTTx~F!2W~5w)3sejg2O@Wi0zQTx6>Ex&Q^p13r@z%~|l|jwdHoR8&-%0W+FRC*RU+ zs;bi0*GqlcnfKLgV&j8p}(faveym<}|n zifHwupL)B6Z$3(Bz(U~8)oWJI-TL^}YE@IinM?-H^WGptRaLsXJE=c*(Ch5%R289N zSr&H2;mDz5J!eigJsOXXJ@zL8|EqcPX;cDTz{_ndZQa`*-&Pn51vAr2rmNBHXaFDK z%W)B^qSDvjLvMGtl1wHr41Ue$QYb#bR{!V9m&(C8+ zBY!l*c`tY;vrz@e0agOHtX;dd>dLFGoLO30>Wz#IS$p>EQGWZIR~k}@j9wRcfY8v83m4OcSIuL-zE~t_IE$LOI+d-m$<}x%>M%FJJcl2=&FJM O0000x4NZZI4Rubck?rb~m)Dp;<&B@mK@` z4aFrH8`^rAg}80o=3udfYUn`H@x^P~nK1KpHbXDoDlC27sXDr5Oh*ENL?CWLspBvx zJ)>>an^Wg)V@7$RLx$?UmfL!_q%Y82bMG!bC#b72oGaExUraunW8rqiX`3g72pX$v z&V7BoIXIZ0LopAiw+L^lIM+#G>TckU(JVk3p6Iae@s9X|Hi7+;TfOVtf>JvwQ94Sw zZKax<>9+A66s@pdAATD7CnyWKUYM~lQFX-0^&H#osuXHB$0=^VjEV?ax}OuaEc7zkm1fUWV=hE`Fr&jI=*wy0F85X+RveV|&#!mJ_mSKa%^NJbIQIAau zXHtmjlXLUV%g(QEzqjjiQgS2Nq%xmgow0lDXkKh((re*Ci887(Pc<*xbo!6Fi0(tq z4Ni5=T<_TJ9Rd9f6W$44wz*8BHnaZ9Q4!NZsJVW_sDmzF-@{OcZ^qEcqMy)ZUa@cv zA?SNKI;!obRv0@t9dkbQsKK8fqFt;PlGLME1 zey3=sB+e=G(5}2B4}Nu0TT-#_f1dyUumJwU|H}e^T?1fP9WSY5P>5AC< zcsF=mY8fe^ZHSw>eW`WqIOtlev$d;j`~(pp;b!^^SSQzqPB5_tAOQ>+^M*;22yzfW zfRdY-H3&yz;y!RgB{@P2xxhngo#T?PM6rTyOZcW+iQ10*l@*v9R>i=q6daVnid1>= zrJokk4B=|V+a+E$E+a}5i?EQiPmw4@uV~&)BkZ6-Da}0UOwGfb0-=^g!VJWLVem>$ z{7#;r*X<1Um;-u>E<_(ESLr%JoLhr2X!W=+E9JuP%J)R;eT(brTD-yax$KEV`DUR6CS6_BELkV-MjXUm2JkTX}A02sW8^) zWCMmy&aevm_ULr%<0k^wx}lGQ5I^_=)A|uBcDrW0I^b z%$fz{TosRvQ-sEHRJ|?Ox`le#CNKCF)}LI}jP9S*FLu3uaAZ$=eojFt!s!#TOf(C= zs3fqOg~IE0v^Mec6wfeTTL_J%>gV-IpR4xNK3Zkx70sw><&Kb7)f=w^I+5)){#?}n zF}l4BXUmRC=UC^sYHU+TD0npmk5T@WSR~AApXE*XyM$hHE1cVQa5}-ow|o&#h_!D| zu*;*h9O6i5rJWuDh+@y_z`c z(yq5XHvDE)kad2#>rZPozPA7tur=%o&!}$WHPB4xD>Av*ds)BUqBnM<#P3sLe8e7tXpK>{gc8LLj#J3nH~yqCyx)M zg%WeOoN?{>%fo3w=5l`7Rc+Q=v+;?;B=|+>YEZOfa_&quk~%+U?V{$=drfx;@Em7R zFT~tatTnhsso3*1d(vFzPzP4w7c;lJ1+(i4!VypJ9ZEOuXG}^i6yJO5faFG8Us)_H zEE0TZIIt7@5J2>)17yE|fA-9Tlg5!ytiKplr!OeAnhyQBG7@bW)nPFW-udqGxVdvd z4D(iD54}!due*{CS+n-jEQSKv?{26$cYo4g-K?GBMiwm?Kif4SrtQVLjW+r{7ZQCrjyY9?VGVak~ z&WHX14Uth(c`JcABBPn`@^`_^UYQF3TP~)=fIXM8VQ;X<3L1@X}^tQidx=0p?tXrEt^)yWbxo z8)J&@CK-s=VgCy8@>D8vxFT?|h`UsPpMuka6nk-#WQ^0@98$vVNL~I4Tb-SR#Ro)v zQ1bB5{XH7@?yTf{ua}3>heV}~y(p^~GF)>QL}%Sbxx8CJY9a?K53b2v*WKmkU<52> z(1KgsA<)Z8lh)nnYx==@CPY+R%5ZBiNIoMiz>Srm}y?0?%tx`cFO!b*fXgEVqr2eI-cEwt1usTfog{ z=i&(lCg{w&po@~|>;j#fC(bRg;s{+T|2)0L8p)LijcUIoL9RarJ0jC-RiMwp8~=k@ zZh>+rw-rcUP-fb;H0vslh?h9do6yjT?w6B*JjVhk11o0Eg<^#9jRvT(iGmT$$c&1v#C zGz5yVa6L&ebQ3*9JQ^j`nv@kXE9V6!#ku@Cqo?q6*rTPlM2%8u9yoaw)+mlI`lJ&P zBkt5Znm&x!HC%9ZON%^1a%*Sn>Vko+Iq)m~o~rYt&80aAbxcd&;qZy=2Dc?U@7rA} z`t+`}$Jv!Gc63SnrS$eJT3^*)4A(|qKx^?~Ufy2@HN0pH_n~~)X5P*vzNBz76LO() zganCAn7{d^YeNDbWgR;(y96i{r0vw%YOiZ zTC6N;Rf_p-7XIM7k;lODeWN)>6<6K{J<5y53!|}@J>XTodV86KzTBa2K5whT}^luI8 z^hsAfaZiN3RF*ogpTGIb(A@Upzq+OmKg)Amu>AAtwL2P}XciZ)R>BcJ?8z9vto1p@ z9%89KlD>WJkNB{YL&} z&F76$LLlXQ5OEnEJXd(QHJxBD!x@bdiUZ-@0`!0}`IwAOm8Io(;QXaH=@O<|f=&=; zX9#fXpVIqWoo@`{stzFCS+HZlaHfEm5-q@EaRVR$lEd$V(JwtS{Z5B9f?078?i9F} z&w-anv5B1613-)m_Rvd4h@JT8KqaC{2J9!pmjmI2}47LFKDBXy1J3@)FEp;j)8Ny|OCu37~JlINV1X1 z768TNiRRewDmhVHcz9OqWhgH(lw*B7!{#}hrxNm3GQ#k2VTvMib`jm_7`r-u@KRc0 zHHex~1n0^NvzGyNIl@(eALEqxNbx@j&#D2sP2V})1(A$Ev`r~2?WZktw#i3v_|^AcM_F)?v#*d8o(Mfx8LO!6h% zOIB8PKCW}BuIig-_F4}ykB3umjy?N96tduKLHW{c0s%)gv`&62J<-~I_zjMFM^XDQ zuz~j}!CP}ZRYpvbVG3|ZkAfjp6dkKB-$Vr_d!lyv_`)1|MCx{fu|`@I)f{(MQ!!gL8+P}}WEn1!(R zoMr|Yd4C1D2^TRT$es7c^@$=?zu*(FzynSH83``Vn)HN%O_ZHX7BsHH(qFA)FZ|tF z%!-?U5QSbHkb+PkATm74SK08}V&d-D$iRYw0qQF;di`o9%}WxlrK7hTY^Oxs z0Uo>y6!rX%5^L5rAtgEI(F~<1mDMxJDX&2LAsNU){t|d$>L7Mn|>Y|T8 z&z}5eTQuqBG~Gc;7?L9IL!|Pbt^F$}^gM&_KW*E-@iVITp;)REp18rV*jyW%%{uV+Ay~wl z;PMsZoXW}8?pj?J#9K}+-3K97oKhJl+{}bM7jy}XLSC(4O2|FZAa9h?E>3*nx8U%1 zVMq7lsn5eAJ&Vkl5NS)Dp6v?v%h`mt3c4qUU}6qkbtmz{V?%=du|4e$=HUWav3_QK z1)3Tou1&^KZ9xLPgw~wDPfIHT#8aCEU2s3#(KR>H3+Q+g6^p9Y%Mx6bcplv~9^;@m zG6A-TY-;b+58RrrZcQ85Qdfzm169_sM^-R#P+wnsV*j1G@vtmD?*c>8yIPg3+j5Gc z+0>A0G$7A^7}%zo7f0N41HF`1AD);EuD^pEc=C-1w>V8S2{Pn#oIQ+yfP>el*BIa+ z!4KyEL9Yc!Dj_~c+TWg1r+e4cp0_U}{X|uV*kQWlY&bl|x@)2vA0xJ9K+2|r*xV8H zQF39E1LkuiH1a)|53&udn_6Sq7FxtTdpn4sTA_*)MoV}|?B&2KBG7?jkP&C5tLZfc zuBG!zaxi~M@@BkDS!ZY!hF+WETp+I28*oj>pwYHPqWFwn3n+!9V}+yW*WlQj*TDh4 zJsWhwe`&`%^AU40QMZ;A)w*qyh?bCUc^9}56{qFLTvseXcTA%F6VdxnDZ!<;L+j|KuL!->V$ zU(pD>eIAIr<7r z7W91^$P!ucuZ+Sc-NXy4H#5ZdF126Qt9Uq2tH4bWGZ}pFV=5>4#?5TGeof=Pmt44y;>p5q*%E*zlHr_G7)XZg-@LAn z1q#1KR!dI@9mC`S3x`jS{P$Bthh*g$cV8SjV`qx^v4S*pBK)#^{)~+Dl>N7;=TBvf z?3~eW;zrIw=mD=2;R?lsQ7xMlfZ@WOrIBibr2S%az7)M8r>J{>{|KHhx_Kyo}r$ia^)XuD(4VD$p+w> z6zx*wUw&~h$9kF}ho!{5V2p~*_Tm)xRkf_WQT}VM2m7Zoundwyk&#}BYw-Wcp`L@_ z6c&P^9GFoG)d-NPhKT0_?-|F;sn%HhO||zNcmCY-%M6x zzX1}MtqhjLhG)t9IZoeO;$MtAyQD?)V;_7+&Y!1%2)$I;3J~9A#OA)MeGq5)R~Od( z!FQMxwsU}P{yVz8eAVal^@(iQh$y%$nH)x5O-qA)l8$FvyQ(64Q(l*~tKj~8Kt>7h zesWlH4(u~D{*u8)L`2E~bko``^zmQ6h&jLx8Ac}+`2jd|`nIb|-R>n8*bY-Jviir_ zhJ1A;;3*t4b{y*kq8@5BSBg<=GP>j_>`&I3svo{;{y5uO`Q_hhfZtHgh6ABAZtuLr zttev`@L#X{Ew~kHSne9GNzv~oF}>xz(B65kJ=$T8j{XZSxFgDl*gVahOTHyKo2o&Z zu3@6aq=)I}j0f|>Cz;3Ax&K@V!(en%%dQMh2+Bd~hd$rB!1JRmD&q}ezXcdhbq~j} zD1}bAaUpSb;>zCUL86vJ(n^h=%eG5BNB#-(jbwY=$5Wj}aQWAd3pY_MB8!9vd;CU9 qE#qf<#1GCipWNI-IiksG!>q6RqiMUAOg--Dg@~I4jdmcg>Hh%S)S%S> literal 0 HcmV?d00001 diff --git a/examples/demo/demos/data/reset.css b/examples/demo/demos/data/reset.css new file mode 100644 index 0000000..1c27a8e --- /dev/null +++ b/examples/demo/demos/data/reset.css @@ -0,0 +1,68 @@ +/* @import this colorsheet to get the default values for every property. + * This is useful when writing special CSS tests that should not be + * inluenced by themes - not even the default ones. + * Keep in mind that the output will be very ugly and not look like + * anything GTK. + * Also, when adding new style properties, please add them here. + */ + +* { + color: inherit; + font-size: inherit; + background-color: initial; + font-family: inherit; + font-style: inherit; + font-variant: inherit; + font-weight: inherit; + text-shadow: inherit; + icon-shadow: inherit; + box-shadow: initial; + margin-top: initial; + margin-left: initial; + margin-bottom: initial; + margin-right: initial; + padding-top: initial; + padding-left: initial; + padding-bottom: initial; + padding-right: initial; + border-top-style: initial; + border-top-width: initial; + border-left-style: initial; + border-left-width: initial; + border-bottom-style: initial; + border-bottom-width: initial; + border-right-style: initial; + border-right-width: initial; + border-top-left-radius: initial; + border-top-right-radius: initial; + border-bottom-right-radius: initial; + border-bottom-left-radius: initial; + outline-style: initial; + outline-width: initial; + outline-offset: initial; + background-clip: initial; + background-origin: initial; + background-size: initial; + background-position: initial; + border-top-color: initial; + border-right-color: initial; + border-bottom-color: initial; + border-left-color: initial; + outline-color: initial; + background-repeat: initial; + background-image: initial; + border-image-source: initial; + border-image-repeat: initial; + border-image-slice: initial; + border-image-width: initial; + transition-property: initial; + transition-duration: initial; + transition-timing-function: initial; + transition-delay: initial; + engine: initial; + gtk-key-bindings: initial; + + -GtkWidget-focus-line-width: 0; + -GtkWidget-focus-padding: 0; + -GtkNotebook-initial-gap: 0; +} diff --git a/examples/demo/demos/dialogs.py b/examples/demo/demos/dialogs.py new file mode 100644 index 0000000..47d6822 --- /dev/null +++ b/examples/demo/demos/dialogs.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Dialog and Message Boxes" +description = """ +Dialog widgets are used to pop up a transient window for user feedback. +""" + +from gi.repository import Gtk + + +class DialogsApp: + def __init__(self): + self.dialog_counter = 1 + + self.window = Gtk.Window(title="Dialogs") + self.window.set_border_width(8) + self.window.connect('destroy', Gtk.main_quit) + + frame = Gtk.Frame(label="Dialogs") + self.window.add(frame) + + vbox = Gtk.VBox(spacing=8) + vbox.set_border_width(8) + frame.add(vbox) + + # Standard message dialog + hbox = Gtk.HBox(spacing=8) + vbox.pack_start(hbox, False, False, 0) + button = Gtk.Button.new_with_mnemonic("_Message Dialog") + + button.connect('clicked', + self._message_dialog_clicked) + hbox.pack_start(button, False, False, 0) + + vbox.pack_start(Gtk.HSeparator(), + False, False, 0) + + # Interactive dialog + hbox = Gtk.HBox(spacing=8) + vbox.pack_start(hbox, False, False, 0) + vbox2 = Gtk.VBox(spacing=0) + button = Gtk.Button.new_with_mnemonic("_Interactive Dialog") + + button.connect('clicked', + self._interactive_dialog_clicked) + hbox.pack_start(vbox2, False, False, 0) + vbox2.pack_start(button, False, False, 0) + + table = Gtk.Table(n_rows=2, n_columns=2, homogeneous=False) + table.set_row_spacings(4) + table.set_col_spacings(4) + hbox.pack_start(table, False, False, 0) + + label = Gtk.Label.new_with_mnemonic("_Entry 1") + table.attach_defaults(label, 0, 1, 0, 1) + + self.entry1 = Gtk.Entry() + table.attach_defaults(self.entry1, 1, 2, 0, 1) + label.set_mnemonic_widget(self.entry1) + + label = Gtk.Label.new_with_mnemonic("E_ntry 2") + + table.attach_defaults(label, 0, 1, 1, 2) + + self.entry2 = Gtk.Entry() + table.attach_defaults(self.entry2, 1, 2, 1, 2) + label.set_mnemonic_widget(self.entry2) + + self.window.show_all() + + def _interactive_dialog_clicked(self, button): + dialog = Gtk.Dialog(title='Interactive Dialog', + transient_for=self.window, + modal=True, + destroy_with_parent=True) + dialog.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK, + "_Non-stock Button", Gtk.ResponseType.CANCEL) + + content_area = dialog.get_content_area() + hbox = Gtk.HBox(spacing=8) + hbox.set_border_width(8) + content_area.pack_start(hbox, False, False, 0) + + stock = Gtk.Image(stock=Gtk.STOCK_DIALOG_QUESTION, + icon_size=Gtk.IconSize.DIALOG) + + hbox.pack_start(stock, False, False, 0) + + table = Gtk.Table(n_rows=2, n_columns=2, homogeneous=False) + table.set_row_spacings(4) + table.set_col_spacings(4) + hbox.pack_start(table, True, True, 0) + label = Gtk.Label.new_with_mnemonic("_Entry 1") + table.attach_defaults(label, 0, 1, 0, 1) + local_entry1 = Gtk.Entry() + local_entry1.set_text(self.entry1.get_text()) + table.attach_defaults(local_entry1, 1, 2, 0, 1) + label.set_mnemonic_widget(local_entry1) + + label = Gtk.Label.new_with_mnemonic("E_ntry 2") + table.attach_defaults(label, 0, 1, 1, 2) + + local_entry2 = Gtk.Entry() + local_entry2.set_text(self.entry2.get_text()) + table.attach_defaults(local_entry2, 1, 2, 1, 2) + label.set_mnemonic_widget(local_entry2) + + hbox.show_all() + + response = dialog.run() + if response == Gtk.ResponseType.OK: + self.entry1.set_text(local_entry1.get_text()) + self.entry2.set_text(local_entry2.get_text()) + + dialog.destroy() + + def _message_dialog_clicked(self, button): + dialog = Gtk.MessageDialog(transient_for=self.window, + modal=True, + destroy_with_parent=True, + message_type=Gtk.MessageType.INFO, + buttons=Gtk.ButtonsType.OK, + text="This message box has been popped up the following\nnumber of times:") + dialog.format_secondary_text('%d' % self.dialog_counter) + dialog.run() + + self.dialog_counter += 1 + dialog.destroy() + + +def main(demoapp=None): + DialogsApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/drawingarea.py b/examples/demo/demos/drawingarea.py new file mode 100644 index 0000000..b04c41d --- /dev/null +++ b/examples/demo/demos/drawingarea.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Drawing Area" +description = """ +GtkDrawingArea is a blank area where you can draw custom displays +of various kinds. + +This demo has two drawing areas. The checkerboard area shows +how you can just draw something; all you have to do is write +a signal handler for expose_event, as shown here. + +The "scribble" area is a bit more advanced, and shows how to handle +events such as button presses and mouse motion. Click the mouse +and drag in the scribble area to draw squiggles. Resize the window +to clear the area. +""" + + +import cairo + +from gi.repository import Gtk, Gdk + + +class DrawingAreaApp: + def __init__(self): + self.sureface = None + + window = Gtk.Window() + window.set_title(title) + window.connect('destroy', lambda x: Gtk.main_quit()) + window.set_border_width(8) + + vbox = Gtk.VBox(homogeneous=False, spacing=8) + window.add(vbox) + + # create checkerboard area + label = Gtk.Label() + label.set_markup('Checkerboard pattern') + vbox.pack_start(label, False, False, 0) + + frame = Gtk.Frame() + frame.set_shadow_type(Gtk.ShadowType.IN) + vbox.pack_start(frame, True, True, 0) + + da = Gtk.DrawingArea() + da.set_size_request(100, 100) + frame.add(da) + da.connect('draw', self.checkerboard_draw_event) + + # create scribble area + label = Gtk.Label() + label.set_markup('Scribble area') + vbox.pack_start(label, False, False, 0) + + frame = Gtk.Frame() + frame.set_shadow_type(Gtk.ShadowType.IN) + vbox.pack_start(frame, True, True, 0) + + da = Gtk.DrawingArea() + da.set_size_request(100, 100) + frame.add(da) + da.connect('draw', self.scribble_draw_event) + da.connect('configure-event', self.scribble_configure_event) + + # event signals + da.connect('motion-notify-event', self.scribble_motion_notify_event) + da.connect('button-press-event', self.scribble_button_press_event) + + # Ask to receive events the drawing area doesn't normally + # subscribe to + da.set_events(da.get_events() | + Gdk.EventMask.LEAVE_NOTIFY_MASK | + Gdk.EventMask.BUTTON_PRESS_MASK | + Gdk.EventMask.POINTER_MOTION_MASK | + Gdk.EventMask.POINTER_MOTION_HINT_MASK) + + window.show_all() + + def checkerboard_draw_event(self, da, cairo_ctx): + + # At the start of a draw handler, a clip region has been set on + # the Cairo context, and the contents have been cleared to the + # widget's background color. The docs for + # gdk_window_begin_paint_region() give more details on how this + # works. + check_size = 10 + spacing = 2 + + xcount = 0 + i = spacing + width = da.get_allocated_width() + height = da.get_allocated_height() + + while i < width: + j = spacing + ycount = xcount % 2 # start with even/odd depending on row + while j < height: + if ycount % 2: + cairo_ctx.set_source_rgb(0.45777, 0, 0.45777) + else: + cairo_ctx.set_source_rgb(1, 1, 1) + # If we're outside the clip this will do nothing. + cairo_ctx.rectangle(i, j, + check_size, + check_size) + cairo_ctx.fill() + + j += check_size + spacing + ycount += 1 + + i += check_size + spacing + xcount += 1 + + return True + + def scribble_draw_event(self, da, cairo_ctx): + + cairo_ctx.set_source_surface(self.surface, 0, 0) + cairo_ctx.paint() + + return False + + def draw_brush(self, widget, x, y): + update_rect = Gdk.Rectangle() + update_rect.x = x - 3 + update_rect.y = y - 3 + update_rect.width = 6 + update_rect.height = 6 + + # paint to the surface where we store our state + cairo_ctx = cairo.Context(self.surface) + + Gdk.cairo_rectangle(cairo_ctx, update_rect) + cairo_ctx.fill() + + widget.get_window().invalidate_rect(update_rect, False) + + def scribble_configure_event(self, da, event): + + allocation = da.get_allocation() + self.surface = da.get_window().create_similar_surface(cairo.CONTENT_COLOR, + allocation.width, + allocation.height) + + cairo_ctx = cairo.Context(self.surface) + cairo_ctx.set_source_rgb(1, 1, 1) + cairo_ctx.paint() + + return True + + def scribble_motion_notify_event(self, da, event): + if self.surface is None: # paranoia check, in case we haven't gotten a configure event + return False + + # This call is very important; it requests the next motion event. + # If you don't call gdk_window_get_pointer() you'll only get + # a single motion event. The reason is that we specified + # GDK_POINTER_MOTION_HINT_MASK to gtk_widget_set_events(). + # If we hadn't specified that, we could just use event->x, event->y + # as the pointer location. But we'd also get deluged in events. + # By requesting the next event as we handle the current one, + # we avoid getting a huge number of events faster than we + # can cope. + + (window, x, y, state) = event.window.get_pointer() + + if state & Gdk.ModifierType.BUTTON1_MASK: + self.draw_brush(da, x, y) + + return True + + def scribble_button_press_event(self, da, event): + if self.surface is None: # paranoia check, in case we haven't gotten a configure event + return False + + if event.button == 1: + self.draw_brush(da, event.x, event.y) + + return True + + +def main(demoapp=None): + DrawingAreaApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/expander.py b/examples/demo/demos/expander.py new file mode 100644 index 0000000..0ec149e --- /dev/null +++ b/examples/demo/demos/expander.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Expander" +description = """ +GtkExpander allows to provide additional content that is initially hidden. +This is also known as "disclosure triangle". +""" + +from gi.repository import Gtk + + +class ExpanderApp: + def __init__(self): + self.window = Gtk.Dialog(title="GtkExpander") + self.window.add_buttons(Gtk.STOCK_CLOSE, Gtk.ResponseType.NONE) + self.window.set_resizable(False) + self.window.connect('response', lambda window, x: window.destroy()) + self.window.connect('destroy', Gtk.main_quit) + + content_area = self.window.get_content_area() + vbox = Gtk.VBox(spacing=5) + content_area.pack_start(vbox, True, True, 0) + vbox.set_border_width(5) + + label = Gtk.Label(label='Expander demo. Click on the triangle for details.') + vbox.pack_start(label, True, True, 0) + + expander = Gtk.Expander(label='Details') + vbox.pack_start(expander, False, False, 0) + + label = Gtk.Label(label='Details can be shown or hidden') + expander.add(label) + + self.window.show_all() + + +def main(demoapp=None): + ExpanderApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/flowbox.py b/examples/demo/demos/flowbox.py new file mode 100755 index 0000000..0485b7c --- /dev/null +++ b/examples/demo/demos/flowbox.py @@ -0,0 +1,752 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2014 Gian Mario Tagliaretti +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "FlowBox" +description = """ +A FlowBox allows flexible and responsive grids which reflow as needed and +support sorting and filtering. The children of a GtkFlowBox are regular widgets. +""" + +from gi.repository import Gtk, Gdk + + +class FlowBoxApp: + def __init__(self): + window = Gtk.Window() + window.connect('destroy', lambda x: Gtk.main_quit()) + window.set_border_width(10) + window.set_default_size(600, 400) + + header = Gtk.HeaderBar(title="Flow Box") + header.set_subtitle("Sample FlowBox app") + header.props.show_close_button = True + + window.set_titlebar(header) + + scrolled = Gtk.ScrolledWindow() + scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) + + flowbox = Gtk.FlowBox() + flowbox.set_valign(Gtk.Align.START) + flowbox.set_max_children_per_line(30) + flowbox.set_selection_mode(Gtk.SelectionMode.NONE) + + self.create_flowbox(flowbox) + + scrolled.add(flowbox) + + window.add(scrolled) + window.show_all() + + def color_swatch_new(self, str_color): + rgba = Gdk.RGBA() + rgba.parse(str_color) + + text_rgba = Gdk.RGBA() # default is white + if max(rgba.red, rgba.green, rgba.blue) > 0.6: + text_rgba.parse('black') + + label = Gtk.Label(label=str_color) + label.override_background_color(0, rgba) + label.override_color(0, text_rgba) + return label + + def create_flowbox(self, flowbox): + colors = [ + 'AliceBlue', + 'AntiqueWhite', + 'AntiqueWhite1', + 'AntiqueWhite2', + 'AntiqueWhite3', + 'AntiqueWhite4', + 'aqua', + 'aquamarine', + 'aquamarine1', + 'aquamarine2', + 'aquamarine3', + 'aquamarine4', + 'azure', + 'azure1', + 'azure2', + 'azure3', + 'azure4', + 'beige', + 'bisque', + 'bisque1', + 'bisque2', + 'bisque3', + 'bisque4', + 'black', + 'BlanchedAlmond', + 'blue', + 'blue1', + 'blue2', + 'blue3', + 'blue4', + 'BlueViolet', + 'brown', + 'brown1', + 'brown2', + 'brown3', + 'brown4', + 'burlywood', + 'burlywood1', + 'burlywood2', + 'burlywood3', + 'burlywood4', + 'CadetBlue', + 'CadetBlue1', + 'CadetBlue2', + 'CadetBlue3', + 'CadetBlue4', + 'chartreuse', + 'chartreuse1', + 'chartreuse2', + 'chartreuse3', + 'chartreuse4', + 'chocolate', + 'chocolate1', + 'chocolate2', + 'chocolate3', + 'chocolate4', + 'coral', + 'coral1', + 'coral2', + 'coral3', + 'coral4', + 'CornflowerBlue', + 'cornsilk', + 'cornsilk1', + 'cornsilk2', + 'cornsilk3', + 'cornsilk4', + 'crimson', + 'cyan', + 'cyan1', + 'cyan2', + 'cyan3', + 'cyan4', + 'DarkBlue', + 'DarkCyan', + 'DarkGoldenrod', + 'DarkGoldenrod1', + 'DarkGoldenrod2', + 'DarkGoldenrod3', + 'DarkGoldenrod4', + 'DarkGray', + 'DarkGreen', + 'DarkGrey', + 'DarkKhaki', + 'DarkMagenta', + 'DarkOliveGreen', + 'DarkOliveGreen1', + 'DarkOliveGreen2', + 'DarkOliveGreen3', + 'DarkOliveGreen4', + 'DarkOrange', + 'DarkOrange1', + 'DarkOrange2', + 'DarkOrange3', + 'DarkOrange4', + 'DarkOrchid', + 'DarkOrchid1', + 'DarkOrchid2', + 'DarkOrchid3', + 'DarkOrchid4', + 'DarkRed', + 'DarkSalmon', + 'DarkSeaGreen', + 'DarkSeaGreen1', + 'DarkSeaGreen2', + 'DarkSeaGreen3', + 'DarkSeaGreen4', + 'DarkSlateBlue', + 'DarkSlateGray', + 'DarkSlateGray1', + 'DarkSlateGray2', + 'DarkSlateGray3', + 'DarkSlateGray4', + 'DarkSlateGrey', + 'DarkTurquoise', + 'DarkViolet', + 'DeepPink', + 'DeepPink1', + 'DeepPink2', + 'DeepPink3', + 'DeepPink4', + 'DeepSkyBlue', + 'DeepSkyBlue1', + 'DeepSkyBlue2', + 'DeepSkyBlue3', + 'DeepSkyBlue4', + 'DimGray', + 'DimGrey', + 'DodgerBlue', + 'DodgerBlue1', + 'DodgerBlue2', + 'DodgerBlue3', + 'DodgerBlue4', + 'firebrick', + 'firebrick1', + 'firebrick2', + 'firebrick3', + 'firebrick4', + 'FloralWhite', + 'ForestGreen', + 'fuchsia', + 'gainsboro', + 'GhostWhite', + 'gold', + 'gold1', + 'gold2', + 'gold3', + 'gold4', + 'goldenrod', + 'goldenrod1', + 'goldenrod2', + 'goldenrod3', + 'goldenrod4', + 'gray', + 'gray0', + 'gray1', + 'gray2', + 'gray3', + 'gray4', + 'gray5', + 'gray6', + 'gray7', + 'gray8', + 'gray9', + 'gray10', + 'gray11', + 'gray12', + 'gray13', + 'gray14', + 'gray15', + 'gray16', + 'gray17', + 'gray18', + 'gray19', + 'gray20', + 'gray21', + 'gray22', + 'gray23', + 'gray24', + 'gray25', + 'gray26', + 'gray27', + 'gray28', + 'gray29', + 'gray30', + 'gray31', + 'gray32', + 'gray33', + 'gray34', + 'gray35', + 'gray36', + 'gray37', + 'gray38', + 'gray39', + 'gray40', + 'gray41', + 'gray42', + 'gray43', + 'gray44', + 'gray45', + 'gray46', + 'gray47', + 'gray48', + 'gray49', + 'gray50', + 'gray51', + 'gray52', + 'gray53', + 'gray54', + 'gray55', + 'gray56', + 'gray57', + 'gray58', + 'gray59', + 'gray60', + 'gray61', + 'gray62', + 'gray63', + 'gray64', + 'gray65', + 'gray66', + 'gray67', + 'gray68', + 'gray69', + 'gray70', + 'gray71', + 'gray72', + 'gray73', + 'gray74', + 'gray75', + 'gray76', + 'gray77', + 'gray78', + 'gray79', + 'gray80', + 'gray81', + 'gray82', + 'gray83', + 'gray84', + 'gray85', + 'gray86', + 'gray87', + 'gray88', + 'gray89', + 'gray90', + 'gray91', + 'gray92', + 'gray93', + 'gray94', + 'gray95', + 'gray96', + 'gray97', + 'gray98', + 'gray99', + 'gray100', + 'green', + 'green1', + 'green2', + 'green3', + 'green4', + 'GreenYellow', + 'grey', + 'grey0', + 'grey1', + 'grey2', + 'grey3', + 'grey4', + 'grey5', + 'grey6', + 'grey7', + 'grey8', + 'grey9', + 'grey10', + 'grey11', + 'grey12', + 'grey13', + 'grey14', + 'grey15', + 'grey16', + 'grey17', + 'grey18', + 'grey19', + 'grey20', + 'grey21', + 'grey22', + 'grey23', + 'grey24', + 'grey25', + 'grey26', + 'grey27', + 'grey28', + 'grey29', + 'grey30', + 'grey31', + 'grey32', + 'grey33', + 'grey34', + 'grey35', + 'grey36', + 'grey37', + 'grey38', + 'grey39', + 'grey40', + 'grey41', + 'grey42', + 'grey43', + 'grey44', + 'grey45', + 'grey46', + 'grey47', + 'grey48', + 'grey49', + 'grey50', + 'grey51', + 'grey52', + 'grey53', + 'grey54', + 'grey55', + 'grey56', + 'grey57', + 'grey58', + 'grey59', + 'grey60', + 'grey61', + 'grey62', + 'grey63', + 'grey64', + 'grey65', + 'grey66', + 'grey67', + 'grey68', + 'grey69', + 'grey70', + 'grey71', + 'grey72', + 'grey73', + 'grey74', + 'grey75', + 'grey76', + 'grey77', + 'grey78', + 'grey79', + 'grey80', + 'grey81', + 'grey82', + 'grey83', + 'grey84', + 'grey85', + 'grey86', + 'grey87', + 'grey88', + 'grey89', + 'grey90', + 'grey91', + 'grey92', + 'grey93', + 'grey94', + 'grey95', + 'grey96', + 'grey97', + 'grey98', + 'grey99', + 'grey100', + 'honeydew', + 'honeydew1', + 'honeydew2', + 'honeydew3', + 'honeydew4', + 'HotPink', + 'HotPink1', + 'HotPink2', + 'HotPink3', + 'HotPink4', + 'IndianRed', + 'IndianRed1', + 'IndianRed2', + 'IndianRed3', + 'IndianRed4', + 'indigo', + 'ivory', + 'ivory1', + 'ivory2', + 'ivory3', + 'ivory4', + 'khaki', + 'khaki1', + 'khaki2', + 'khaki3', + 'khaki4', + 'lavender', + 'LavenderBlush', + 'LavenderBlush1', + 'LavenderBlush2', + 'LavenderBlush3', + 'LavenderBlush4', + 'LawnGreen', + 'LemonChiffon', + 'LemonChiffon1', + 'LemonChiffon2', + 'LemonChiffon3', + 'LemonChiffon4', + 'LightBlue', + 'LightBlue1', + 'LightBlue2', + 'LightBlue3', + 'LightBlue4', + 'LightCoral', + 'LightCyan', + 'LightCyan1', + 'LightCyan2', + 'LightCyan3', + 'LightCyan4', + 'LightGoldenrod', + 'LightGoldenrod1', + 'LightGoldenrod2', + 'LightGoldenrod3', + 'LightGoldenrod4', + 'LightGoldenrodYellow', + 'LightGray', + 'LightGreen', + 'LightGrey', + 'LightPink', + 'LightPink1', + 'LightPink2', + 'LightPink3', + 'LightPink4', + 'LightSalmon', + 'LightSalmon1', + 'LightSalmon2', + 'LightSalmon3', + 'LightSalmon4', + 'LightSeaGreen', + 'LightSkyBlue', + 'LightSkyBlue1', + 'LightSkyBlue2', + 'LightSkyBlue3', + 'LightSkyBlue4', + 'LightSlateBlue', + 'LightSlateGray', + 'LightSlateGrey', + 'LightSteelBlue', + 'LightSteelBlue1', + 'LightSteelBlue2', + 'LightSteelBlue3', + 'LightSteelBlue4', + 'LightYellow', + 'LightYellow1', + 'LightYellow2', + 'LightYellow3', + 'LightYellow4', + 'lime', + 'LimeGreen', + 'linen', + 'magenta', + 'magenta1', + 'magenta2', + 'magenta3', + 'magenta4', + 'maroon', + 'maroon1', + 'maroon2', + 'maroon3', + 'maroon4', + 'MediumAquamarine', + 'MediumBlue', + 'MediumOrchid', + 'MediumOrchid1', + 'MediumOrchid2', + 'MediumOrchid3', + 'MediumOrchid4', + 'MediumPurple', + 'MediumPurple1', + 'MediumPurple2', + 'MediumPurple3', + 'MediumPurple4', + 'MediumSeaGreen', + 'MediumSlateBlue', + 'MediumSpringGreen', + 'MediumTurquoise', + 'MediumVioletRed', + 'MidnightBlue', + 'MintCream', + 'MistyRose', + 'MistyRose1', + 'MistyRose2', + 'MistyRose3', + 'MistyRose4', + 'moccasin', + 'NavajoWhite', + 'NavajoWhite1', + 'NavajoWhite2', + 'NavajoWhite3', + 'NavajoWhite4', + 'navy', + 'NavyBlue', + 'OldLace', + 'olive', + 'OliveDrab', + 'OliveDrab1', + 'OliveDrab2', + 'OliveDrab3', + 'OliveDrab4', + 'orange', + 'orange1', + 'orange2', + 'orange3', + 'orange4', + 'OrangeRed', + 'OrangeRed1', + 'OrangeRed2', + 'OrangeRed3', + 'OrangeRed4', + 'orchid', + 'orchid1', + 'orchid2', + 'orchid3', + 'orchid4', + 'PaleGoldenrod', + 'PaleGreen', + 'PaleGreen1', + 'PaleGreen2', + 'PaleGreen3', + 'PaleGreen4', + 'PaleTurquoise', + 'PaleTurquoise1', + 'PaleTurquoise2', + 'PaleTurquoise3', + 'PaleTurquoise4', + 'PaleVioletRed', + 'PaleVioletRed1', + 'PaleVioletRed2', + 'PaleVioletRed3', + 'PaleVioletRed4', + 'PapayaWhip', + 'PeachPuff', + 'PeachPuff1', + 'PeachPuff2', + 'PeachPuff3', + 'PeachPuff4', + 'peru', + 'pink', + 'pink1', + 'pink2', + 'pink3', + 'pink4', + 'plum', + 'plum1', + 'plum2', + 'plum3', + 'plum4', + 'PowderBlue', + 'purple', + 'purple1', + 'purple2', + 'purple3', + 'purple4', + 'red', + 'red1', + 'red2', + 'red3', + 'red4', + 'RosyBrown', + 'RosyBrown1', + 'RosyBrown2', + 'RosyBrown3', + 'RosyBrown4', + 'RoyalBlue', + 'RoyalBlue1', + 'RoyalBlue2', + 'RoyalBlue3', + 'RoyalBlue4', + 'SaddleBrown', + 'salmon', + 'salmon1', + 'salmon2', + 'salmon3', + 'salmon4', + 'SandyBrown', + 'SeaGreen', + 'SeaGreen1', + 'SeaGreen2', + 'SeaGreen3', + 'SeaGreen4', + 'seashell', + 'seashell1', + 'seashell2', + 'seashell3', + 'seashell4', + 'sienna', + 'sienna1', + 'sienna2', + 'sienna3', + 'sienna4', + 'silver', + 'SkyBlue', + 'SkyBlue1', + 'SkyBlue2', + 'SkyBlue3', + 'SkyBlue4', + 'SlateBlue', + 'SlateBlue1', + 'SlateBlue2', + 'SlateBlue3', + 'SlateBlue4', + 'SlateGray', + 'SlateGray1', + 'SlateGray2', + 'SlateGray3', + 'SlateGray4', + 'SlateGrey', + 'snow', + 'snow1', + 'snow2', + 'snow3', + 'snow4', + 'SpringGreen', + 'SpringGreen1', + 'SpringGreen2', + 'SpringGreen3', + 'SpringGreen4', + 'SteelBlue', + 'SteelBlue1', + 'SteelBlue2', + 'SteelBlue3', + 'SteelBlue4', + 'tan', + 'tan1', + 'tan2', + 'tan3', + 'tan4', + 'teal', + 'thistle', + 'thistle1', + 'thistle2', + 'thistle3', + 'thistle4', + 'tomato', + 'tomato1', + 'tomato2', + 'tomato3', + 'tomato4', + 'turquoise', + 'turquoise1', + 'turquoise2', + 'turquoise3', + 'turquoise4', + 'violet', + 'VioletRed', + 'VioletRed1', + 'VioletRed2', + 'VioletRed3', + 'VioletRed4', + 'wheat', + 'wheat1', + 'wheat2', + 'wheat3', + 'wheat4', + 'white', + 'WhiteSmoke', + 'yellow', + 'yellow1', + 'yellow2', + 'yellow3', + 'yellow4', + 'YellowGreen', + ] + + for color in colors: + button = self.color_swatch_new(color) + flowbox.add(button) + + +def main(demoapp=None): + FlowBoxApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/images.py b/examples/demo/demos/images.py new file mode 100644 index 0000000..80c99af --- /dev/null +++ b/examples/demo/demos/images.py @@ -0,0 +1,305 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Images" +description = """GtkImage is used to display an image; the image can be in a +number of formats. Typically, you load an image into a GdkPixbuf, then display +the pixbuf. This demo code shows some of the more obscure cases, in the simple +case a call to gtk_image_new_from_file() is all you need. +""" + +import os +from os import path + +from gi.repository import Gtk, Gdk, GdkPixbuf, GLib, Gio, GObject + + +class ImagesApp: + def __init__(self): + self.pixbuf_loader = None + self.image_stream = None + + self.window = Gtk.Window(title="Images") + self.window.connect('destroy', self.cleanup_cb) + self.window.set_border_width(8) + + vbox = Gtk.VBox(spacing=8) + vbox.set_border_width(8) + self.window.add(vbox) + + label = Gtk.Label() + label.set_markup('Image loaded from file') + vbox.pack_start(label, False, False, 0) + + frame = Gtk.Frame() + frame.set_shadow_type(Gtk.ShadowType.IN) + + # The alignment keeps the frame from growing when users resize + # the window + align = Gtk.Alignment(xalign=0.5, + yalign=0.5, + xscale=0, + yscale=0) + align.add(frame) + vbox.pack_start(align, False, False, 0) + + self.base_path = os.path.abspath(os.path.dirname(__file__)) + self.base_path = os.path.join(self.base_path, 'data') + filename = os.path.join(self.base_path, 'gtk-logo-rgb.gif') + pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) + transparent = pixbuf.add_alpha(True, 0xff, 0xff, 0xff) + image = Gtk.Image.new_from_pixbuf(transparent) + frame.add(image) + + # Animation + + label = Gtk.Label() + label.set_markup('Animation loaded from file') + vbox.pack_start(label, False, False, 0) + + frame = Gtk.Frame() + frame.set_shadow_type(Gtk.ShadowType.IN) + + # The alignment keeps the frame from growing when users resize + # the window + align = Gtk.Alignment(xalign=0.5, + yalign=0.5, + xscale=0, + yscale=0) + align.add(frame) + vbox.pack_start(align, False, False, 0) + + img_path = path.join(self.base_path, 'floppybuddy.gif') + image = Gtk.Image.new_from_file(img_path) + frame.add(image) + + # Symbolic icon + + label = Gtk.Label() + label.set_markup('Symbolic themed icon') + vbox.pack_start(label, False, False, 0) + + frame = Gtk.Frame() + frame.set_shadow_type(Gtk.ShadowType.IN) + + # The alignment keeps the frame from growing when users resize + # the window + align = Gtk.Alignment(xalign=0.5, + yalign=0.5, + xscale=0, + yscale=0) + align.add(frame) + vbox.pack_start(align, False, False, 0) + + gicon = Gio.ThemedIcon.new_with_default_fallbacks('battery-caution-charging-symbolic') + image = Gtk.Image.new_from_gicon(gicon, Gtk.IconSize.DIALOG) + frame.add(image) + + # progressive + + label = Gtk.Label() + label.set_markup('Progressive image loading') + vbox.pack_start(label, False, False, 0) + + frame = Gtk.Frame() + frame.set_shadow_type(Gtk.ShadowType.IN) + + # The alignment keeps the frame from growing when users resize + # the window + align = Gtk.Alignment(xalign=0.5, + yalign=0.5, + xscale=0, + yscale=0) + align.add(frame) + vbox.pack_start(align, False, False, 0) + + image = Gtk.Image.new_from_pixbuf(None) + frame.add(image) + + self.start_progressive_loading(image) + + # Sensistivity control + button = Gtk.ToggleButton.new_with_mnemonic('_Insensitive') + button.connect('toggled', self.toggle_sensitivity_cb, vbox) + vbox.pack_start(button, False, False, 0) + + self.window.show_all() + + def toggle_sensitivity_cb(self, button, container): + widget_list = container.get_children() + for w in widget_list: + if w != button: + w.set_sensitive(not button.get_active()) + + return True + + def progressive_timeout(self, image): + # This shows off fully-paranoid error handling, so looks scary. + # You could factor out the error handling code into a nice separate + # function to make things nicer. + + if self.image_stream: + try: + buf = self.image_stream.read(256) + except IOError as e: + dialog = Gtk.MessageDialog(self.window, + Gtk.DialogFlags.DESTROY_WITH_PARENT, + Gtk.MessageType.ERROR, + Gtk.ButtonsType.CLOSE, + "Failure reading image file 'alphatest.png': %s" % (str(e), )) + + self.image_stream.close() + self.image_stream = None + self.load_timeout = 0 + + dialog.show() + dialog.connect('response', lambda x, y: dialog.destroy()) + + return False # uninstall the timeout + + try: + self.pixbuf_loader.write(buf) + + except GObject.GError as e: + dialog = Gtk.MessageDialog(self.window, + Gtk.DialogFlags.DESTROY_WITH_PARENT, + Gtk.MessageType.ERROR, + Gtk.ButtonsType.CLOSE, + e.message) + + self.image_stream.close() + self.image_stream = None + self.load_timeout = 0 + + dialog.show() + dialog.connect('response', lambda x, y: dialog.destroy()) + + return False # uninstall the timeout + + if len(buf) < 256: # eof + self.image_stream.close() + self.image_stream = None + + # Errors can happen on close, e.g. if the image + # file was truncated we'll know on close that + # it was incomplete. + try: + self.pixbuf_loader.close() + except GObject.GError as e: + dialog = Gtk.MessageDialog(self.window, + Gtk.DialogFlags.DESTROY_WITH_PARENT, + Gtk.MessageType.ERROR, + Gtk.ButtonsType.CLOSE, + 'Failed to load image: %s' % e.message) + + self.load_timeout = 0 + + dialog.show() + dialog.connect('response', lambda x, y: dialog.destroy()) + + return False # uninstall the timeout + else: + img_path = path.join(self.base_path, 'alphatest.png') + try: + self.image_stream = open(img_path, 'rb') + except IOError as e: + dialog = Gtk.MessageDialog(self.window, + Gtk.DialogFlags.DESTROY_WITH_PARENT, + Gtk.MessageType.ERROR, + Gtk.ButtonsType.CLOSE, + str(e)) + self.load_timeout = 0 + dialog.show() + dialog.connect('response', lambda x, y: dialog.destroy()) + + return False # uninstall the timeout + + if self.pixbuf_loader: + try: + self.pixbuf_loader.close() + except GObject.GError: + pass + self.pixbuf_loader = None + + self.pixbuf_loader = GdkPixbuf.PixbufLoader() + + self.pixbuf_loader.connect('area-prepared', + self.progressive_prepared_callback, + image) + + self.pixbuf_loader.connect('area-updated', + self.progressive_updated_callback, + image) + # leave timeout installed + return True + + def progressive_prepared_callback(self, loader, image): + pixbuf = loader.get_pixbuf() + # Avoid displaying random memory contents, since the pixbuf + # isn't filled in yet. + pixbuf.fill(0xaaaaaaff) + image.set_from_pixbuf(pixbuf) + + def progressive_updated_callback(self, loader, x, y, width, height, image): + # We know the pixbuf inside the GtkImage has changed, but the image + # itself doesn't know this; so queue a redraw. If we wanted to be + # really efficient, we could use a drawing area or something + # instead of a GtkImage, so we could control the exact position of + # the pixbuf on the display, then we could queue a draw for only + # the updated area of the image. + image.queue_draw() + + def start_progressive_loading(self, image): + # This is obviously totally contrived (we slow down loading + # on purpose to show how incremental loading works). + # The real purpose of incremental loading is the case where + # you are reading data from a slow source such as the network. + # The timeout simply simulates a slow data source by inserting + # pauses in the reading process. + + self.load_timeout = Gdk.threads_add_timeout(150, + GLib.PRIORITY_DEFAULT_IDLE, + self.progressive_timeout, + image) + + def cleanup_cb(self, widget): + if self.load_timeout: + GLib.source_remove(self.load_timeout) + + if self.pixbuf_loader: + try: + self.pixbuf_loader.close() + except GObject.GError: + pass + + if self.image_stream: + self.image_stream.close() + + Gtk.main_quit() + + +def main(demoapp=None): + ImagesApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/infobars.py b/examples/demo/demos/infobars.py new file mode 100644 index 0000000..b8a1dc7 --- /dev/null +++ b/examples/demo/demos/infobars.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Info Bars" +description = """ +Info bar widgets are used to report important messages to the user. +""" + +from gi.repository import Gtk + + +class InfobarApp: + def __init__(self): + self.window = Gtk.Window() + self.window.set_title('Info Bars') + self.window.set_border_width(8) + self.window.connect('destroy', Gtk.main_quit) + + vbox = Gtk.VBox(spacing=0) + self.window.add(vbox) + + bar = Gtk.InfoBar() + vbox.pack_start(bar, False, False, 0) + bar.set_message_type(Gtk.MessageType.INFO) + label = Gtk.Label(label='This is an info bar with message type Gtk.MessageType.INFO') + bar.get_content_area().pack_start(label, False, False, 0) + + bar = Gtk.InfoBar() + vbox.pack_start(bar, False, False, 0) + bar.set_message_type(Gtk.MessageType.WARNING) + label = Gtk.Label(label='This is an info bar with message type Gtk.MessageType.WARNING') + bar.get_content_area().pack_start(label, False, False, 0) + + bar = Gtk.InfoBar() + bar.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK) + bar.connect('response', self.on_bar_response) + vbox.pack_start(bar, False, False, 0) + bar.set_message_type(Gtk.MessageType.QUESTION) + label = Gtk.Label(label='This is an info bar with message type Gtk.MessageType.QUESTION') + bar.get_content_area().pack_start(label, False, False, 0) + + bar = Gtk.InfoBar() + vbox.pack_start(bar, False, False, 0) + bar.set_message_type(Gtk.MessageType.ERROR) + label = Gtk.Label(label='This is an info bar with message type Gtk.MessageType.ERROR') + bar.get_content_area().pack_start(label, False, False, 0) + + bar = Gtk.InfoBar() + vbox.pack_start(bar, False, False, 0) + bar.set_message_type(Gtk.MessageType.OTHER) + label = Gtk.Label(label='This is an info bar with message type Gtk.MessageType.OTHER') + bar.get_content_area().pack_start(label, False, False, 0) + + frame = Gtk.Frame(label="Info bars") + vbox.pack_start(frame, False, False, 8) + + vbox2 = Gtk.VBox(spacing=8) + vbox2.set_border_width(8) + frame.add(vbox2) + + # Standard message dialog + label = Gtk.Label(label='An example of different info bars') + vbox2.pack_start(label, False, False, 0) + + self.window.show_all() + + def on_bar_response(self, info_bar, response_id): + dialog = Gtk.MessageDialog(transient_for=self.window, + modal=True, + destroy_with_parent=True, + message_type=Gtk.MessageType.INFO, + buttons=Gtk.ButtonsType.OK, + text='You clicked on an info bar') + dialog.format_secondary_text('Your response has id %d' % response_id) + dialog.run() + dialog.destroy() + + +def main(demoapp=None): + InfobarApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/links.py b/examples/demo/demos/links.py new file mode 100644 index 0000000..c6d331d --- /dev/null +++ b/examples/demo/demos/links.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Links" +description = """ +GtkLabel can show hyperlinks. The default action is to call gtk_show_uri() on +their URI, but it is possible to override this with a custom handler. +""" + +from gi.repository import Gtk + + +class LinksApp: + def __init__(self): + self.window = Gtk.Window() + self.window.set_title('Links') + self.window.set_border_width(12) + self.window.connect('destroy', Gtk.main_quit) + + label = Gtk.Label(label="""Some text may be marked up +as hyperlinks, which can be clicked +or activated via keynav""") + + label.set_use_markup(True) + label.connect("activate-link", self.activate_link) + self.window.add(label) + label.show() + + self.window.show() + + def activate_link(self, label, uri): + if uri == 'keynav': + parent = label.get_toplevel() + markup = """The term keynav is a shorthand for +keyboard navigation and refers to the process of using +a program (exclusively) via keyboard input.""" + dialog = Gtk.MessageDialog(transient_for=parent, + destroy_with_parent=True, + message_type=Gtk.MessageType.INFO, + buttons=Gtk.ButtonsType.OK, + text=markup, + use_markup=True) + dialog.present() + dialog.connect('response', self.response_cb) + + return True + + def response_cb(self, dialog, response_id): + dialog.destroy() + + +def main(demoapp=None): + LinksApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/menus.py b/examples/demo/demos/menus.py new file mode 100644 index 0000000..7cf2e57 --- /dev/null +++ b/examples/demo/demos/menus.py @@ -0,0 +1,134 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Menus" +description = """There are several widgets involved in displaying menus. The +GtkMenuBar widget is a menu bar, which normally appears horizontally at the top +of an application, but can also be layed out vertically. The GtkMenu widget is +the actual menu that pops up. Both GtkMenuBar and GtkMenu are subclasses of +GtkMenuShell; a GtkMenuShell contains menu items (GtkMenuItem). Each menu item +contains text and/or images and can be selected by the user. There are several +kinds of menu item, including plain GtkMenuItem, GtkCheckMenuItem which can be +checked/unchecked, GtkRadioMenuItem which is a check menu item that's in a +mutually exclusive group, GtkSeparatorMenuItem which is a separator bar, +GtkTearoffMenuItem which allows a GtkMenu to be torn off, and GtkImageMenuItem +which can place a GtkImage or other widget next to the menu text. A GtkMenuItem +can have a submenu, which is simply a GtkMenu to pop up when the menu item is +selected. Typically, all menu items in a menu bar have submenus. GtkUIManager +provides a higher-level interface for creating menu bars and menus; while you +can construct menus manually, most people don't do that. There's a separate demo +for GtkUIManager. +""" + +from gi.repository import Gtk + + +class MenusApp: + def __init__(self): + self.window = Gtk.Window() + self.window.set_title('Menus') + self.window.connect('destroy', Gtk.main_quit) + + accel_group = Gtk.AccelGroup() + self.window.add_accel_group(accel_group) + self.window.set_border_width(0) + + box = Gtk.HBox() + self.window.add(box) + + box1 = Gtk.VBox() + box.add(box1) + + menubar = Gtk.MenuBar() + box1.pack_start(menubar, False, True, 0) + + menuitem = Gtk.MenuItem(label='test\nline2') + menuitem.set_submenu(self.create_menu(3, True)) + menubar.append(menuitem) + + menuitem = Gtk.MenuItem(label='foo') + menuitem.set_submenu(self.create_menu(4, True)) + menuitem.set_right_justified(True) + menubar.append(menuitem) + + box2 = Gtk.VBox(spacing=10) + box2.set_border_width(10) + box1.pack_start(box2, False, True, 0) + + button = Gtk.Button(label='Flip') + button.connect('clicked', self.change_orientation, menubar) + box2.pack_start(button, True, True, 0) + + button = Gtk.Button(label='Close') + button.connect('clicked', lambda x: self.window.destroy()) + box2.pack_start(button, True, True, 0) + button.set_can_default(True) + + self.window.show_all() + + def create_menu(self, depth, tearoff): + if depth < 1: + return None + + menu = Gtk.Menu() + + if tearoff: + menuitem = Gtk.TearoffMenuItem() + menu.append(menuitem) + + i = 0 + j = 1 + while i < 5: + label = 'item %2d - %d' % (depth, j) + # we should be adding this to a group but the group API + # isn't bindable - we need something more like the + # Gtk.RadioAction API + menuitem = Gtk.RadioMenuItem(label=label) + menu.append(menuitem) + + if i == 3: + menuitem.set_sensitive(False) + + menuitem.set_submenu(self.create_menu(depth - 1, True)) + + i += 1 + j += 1 + + return menu + + def change_orientation(self, button, menubar): + parent = menubar.get_parent() + orientation = parent.get_orientation() + parent.set_orientation(1 - orientation) + + if orientation == Gtk.Orientation.VERTICAL: + menubar.props.pack_direction = Gtk.PackDirection.TTB + else: + menubar.props.pack_direction = Gtk.PackDirection.LTR + + +def main(demoapp=None): + MenusApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/pickers.py b/examples/demo/demos/pickers.py new file mode 100644 index 0000000..d8a9c75 --- /dev/null +++ b/examples/demo/demos/pickers.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Pickers" +description = """These widgets are mainly intended for use in preference +dialogs. They allow to select colors, fonts, files and directories. +""" + +from gi.repository import Gtk + + +class PickersApp: + def __init__(self): + self.window = Gtk.Window(title='Pickers') + self.window.connect('destroy', Gtk.main_quit) + self.window.set_border_width(10) + + table = Gtk.Table(n_rows=4, n_columns=2, homogeneous=False) + table.set_col_spacing(0, 10) + table.set_row_spacings(3) + self.window.add(table) + table.set_border_width(10) + + label = Gtk.Label(label='Color:') + label.set_alignment(0.0, 0.5) + picker = Gtk.ColorButton() + table.attach_defaults(label, 0, 1, 0, 1) + table.attach_defaults(picker, 1, 2, 0, 1) + + label = Gtk.Label(label='Font:') + label.set_alignment(0.0, 0.5) + picker = Gtk.FontButton() + table.attach_defaults(label, 0, 1, 1, 2) + table.attach_defaults(picker, 1, 2, 1, 2) + + label = Gtk.Label(label='File:') + label.set_alignment(0.0, 0.5) + picker = Gtk.FileChooserButton.new('Pick a File', + Gtk.FileChooserAction.OPEN) + table.attach_defaults(label, 0, 1, 2, 3) + table.attach_defaults(picker, 1, 2, 2, 3) + + label = Gtk.Label(label='Folder:') + label.set_alignment(0.0, 0.5) + picker = Gtk.FileChooserButton.new('Pick a Folder', + Gtk.FileChooserAction.SELECT_FOLDER) + table.attach_defaults(label, 0, 1, 3, 4) + table.attach_defaults(picker, 1, 2, 3, 4) + + self.window.show_all() + + +def main(demoapp=None): + PickersApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/pixbuf.py b/examples/demo/demos/pixbuf.py new file mode 100644 index 0000000..c213584 --- /dev/null +++ b/examples/demo/demos/pixbuf.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Pixbufs" +description = """A GdkPixbuf represents an image, normally in RGB or RGBA +format. Pixbufs are normally used to load files from disk and perform image +scaling. It also shows off how to use GtkDrawingArea to do a simple animation. +Look at the Image demo for additional pixbuf usage examples. +""" + +from gi.repository import Gtk, Gdk, GdkPixbuf, GLib +import os +import math + + +class PixbufApp: + FRAME_DELAY = 50 + BACKGROUND_NAME = "background.jpg" + CYCLE_LEN = 60 + + def __init__(self): + self.background_width = 0 + self.background_height = 0 + self.background_pixbuf = None + self.frame = None + self.frame_num = 0 + self.pixbufs = [] + self.image_names = [ + "apple-red.png", + "gnome-applets.png", + "gnome-calendar.png", + "gnome-foot.png", + "gnome-gmush.png", + "gnome-gimp.png", + "gnome-gsame.png", + "gnu-keys.png" + ] + + self.window = Gtk.Window(title="Pixbufs") + self.window.set_resizable(False) + self.window.connect('destroy', self.cleanup_cb) + + try: + self.load_pixbufs() + except GLib.Error as e: + dialog = Gtk.MessageDialog(None, + 0, + Gtk.MessageType.ERROR, + Gtk.ButtonsType.CLOSE, + e.message) + + dialog.run() + dialog.destroy() + Gtk.main_quit() + + self.window.set_size_request(self.background_width, + self.background_height) + self.frame = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, + False, + 8, + self.background_width, + self.background_height) + self.da = Gtk.DrawingArea() + self.da.connect('draw', self.draw_cb) + self.window.add(self.da) + self.timeout_id = GLib.timeout_add(self.FRAME_DELAY, self.timeout_cb) + self.window.show_all() + + def load_pixbufs(self): + base_path = os.path.abspath(os.path.dirname(__file__)) + base_path = os.path.join(base_path, 'data') + img_path = os.path.join(base_path, self.BACKGROUND_NAME) + self.background_pixbuf = GdkPixbuf.Pixbuf.new_from_file(img_path) + self.background_height = self.background_pixbuf.get_height() + self.background_width = self.background_pixbuf.get_width() + + for img_name in self.image_names: + img_path = os.path.join(base_path, img_name) + self.pixbufs.append(GdkPixbuf.Pixbuf.new_from_file(img_path)) + + def draw_cb(self, da, cairo_ctx): + Gdk.cairo_set_source_pixbuf(cairo_ctx, self.frame, 0, 0) + cairo_ctx.paint() + + return True + + def timeout_cb(self): + self.background_pixbuf.copy_area(0, 0, + self.background_width, + self.background_height, + self.frame, + 0, 0) + + f = float(self.frame_num % self.CYCLE_LEN) / self.CYCLE_LEN + + xmid = self.background_width / 2.0 + ymid = self.background_height / 2.0 + radius = min(xmid, ymid) / 2.0 + + r1 = Gdk.Rectangle() + r2 = Gdk.Rectangle() + + i = 0 + for pb in self.pixbufs: + i += 1 + ang = 2.0 * math.pi * i / len(self.pixbufs) - f * 2.0 * math.pi + + iw = pb.get_width() + ih = pb.get_height() + + r = radius + (radius / 3.0) * math.sin(f * 2.0 * math.pi) + + xpos = math.floor(xmid + r * math.cos(ang) - iw / 2.0 + 0.5) + ypos = math.floor(ymid + r * math.sin(ang) - ih / 2.0 + 0.5) + + if i & 1: + k = math.sin(f * 2.0 * math.pi) + else: + k = math.cos(f * 2.0 * math.pi) + + k = 2.0 * k * k + k = max(0.25, k) + + r1.x = xpos + r1.y = ypos + r1.width = iw * k + r1.height = ih * k + + r2.x = 0 + r2.y = 0 + r2.width = self.background_width + r2.height = self.background_height + + success, dest = Gdk.rectangle_intersect(r1, r2) + if success: + alpha = 0 + if i & 1: + alpha = max(127, math.fabs(255 * math.sin(f * 2.0 * math.pi))) + else: + alpha = max(127, math.fabs(255 * math.cos(f * 2.0 * math.pi))) + + pb.composite(self.frame, + dest.x, dest.y, + dest.width, dest.height, + xpos, ypos, + k, k, + GdkPixbuf.InterpType.NEAREST, + alpha) + + self.da.queue_draw() + + self.frame_num += 1 + return True + + def cleanup_cb(self, widget): + GLib.source_remove(self.timeout_id) + Gtk.main_quit() + + +def main(demoapp=None): + PixbufApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/printing.py b/examples/demo/demos/printing.py new file mode 100644 index 0000000..a87bd6f --- /dev/null +++ b/examples/demo/demos/printing.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Printing" +description = """ +GtkPrintOperation offers a simple API to support printing in a cross-platform way. +""" + +from gi.repository import Gtk, GLib, Pango, PangoCairo +import math +import os + + +class PrintingApp: + HEADER_HEIGHT = 10 * 72 / 25.4 + HEADER_GAP = 3 * 72 / 25.4 + + def __init__(self): + self.operation = Gtk.PrintOperation() + print_data = {'filename': os.path.abspath(__file__), + 'font_size': 12.0, + 'lines_per_page': 0, + 'lines': None, + 'num_lines': 0, + 'num_pages': 0 + } + + self.operation.connect('begin-print', self.begin_print, print_data) + self.operation.connect('draw-page', self.draw_page, print_data) + self.operation.connect('end-print', self.end_print, print_data) + + self.operation.set_use_full_page(False) + self.operation.set_unit(Gtk.Unit.POINTS) + self.operation.set_embed_page_setup(True) + + settings = Gtk.PrintSettings() + + dir = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOCUMENTS) + if dir is None: + dir = GLib.get_home_dir() + if settings.get(Gtk.PRINT_SETTINGS_OUTPUT_FILE_FORMAT) == 'ps': + ext = '.ps' + elif settings.get(Gtk.PRINT_SETTINGS_OUTPUT_FILE_FORMAT) == 'svg': + ext = '.svg' + else: + ext = '.pdf' + + uri = "file://%s/gtk-demo%s" % (dir, ext) + settings.set(Gtk.PRINT_SETTINGS_OUTPUT_URI, uri) + self.operation.set_print_settings(settings) + + def run(self, parent=None): + result = self.operation.run(Gtk.PrintOperationAction.PRINT_DIALOG, parent) + + if result == Gtk.PrintOperationResult.ERROR: + message = self.operation.get_error() + + dialog = Gtk.MessageDialog(parent, + 0, + Gtk.MessageType.ERROR, + Gtk.ButtonsType.CLOSE, + message) + + dialog.run() + dialog.destroy() + + Gtk.main_quit() + + def begin_print(self, operation, print_ctx, print_data): + height = print_ctx.get_height() - self.HEADER_HEIGHT - self.HEADER_GAP + print_data['lines_per_page'] = \ + math.floor(height / print_data['font_size']) + + file_path = print_data['filename'] + if not os.path.isfile(file_path): + file_path = os.path.join('demos', file_path) + if not os.path.isfile(file_path): + raise Exception("file not found: %s" % (file_path, )) + + # in reality you should most likely not read the entire + # file into a buffer + source_file = open(file_path, 'r') + s = source_file.read() + print_data['lines'] = s.split('\n') + + print_data['num_lines'] = len(print_data['lines']) + print_data['num_pages'] = \ + (print_data['num_lines'] - 1) / print_data['lines_per_page'] + 1 + + operation.set_n_pages(print_data['num_pages']) + + def draw_page(self, operation, print_ctx, page_num, print_data): + cr = print_ctx.get_cairo_context() + width = print_ctx.get_width() + + cr.rectangle(0, 0, width, self.HEADER_HEIGHT) + cr.set_source_rgb(0.8, 0.8, 0.8) + cr.fill_preserve() + + cr.set_source_rgb(0, 0, 0) + cr.set_line_width(1) + cr.stroke() + + layout = print_ctx.create_pango_layout() + desc = Pango.FontDescription('sans 14') + layout.set_font_description(desc) + + layout.set_text(print_data['filename'], -1) + (text_width, text_height) = layout.get_pixel_size() + + if text_width > width: + layout.set_width(width) + layout.set_ellipsize(Pango.EllipsizeMode.START) + (text_width, text_height) = layout.get_pixel_size() + + cr.move_to((width - text_width) / 2, + (self.HEADER_HEIGHT - text_height) / 2) + PangoCairo.show_layout(cr, layout) + + page_str = "%d/%d" % (page_num + 1, print_data['num_pages']) + layout.set_text(page_str, -1) + + layout.set_width(-1) + (text_width, text_height) = layout.get_pixel_size() + cr.move_to(width - text_width - 4, + (self.HEADER_HEIGHT - text_height) / 2) + PangoCairo.show_layout(cr, layout) + + layout = print_ctx.create_pango_layout() + + desc = Pango.FontDescription('monospace') + desc.set_size(print_data['font_size'] * Pango.SCALE) + layout.set_font_description(desc) + + cr.move_to(0, self.HEADER_HEIGHT + self.HEADER_GAP) + lines_pp = int(print_data['lines_per_page']) + num_lines = print_data['num_lines'] + data_lines = print_data['lines'] + font_size = print_data['font_size'] + line = page_num * lines_pp + + for i in range(lines_pp): + if line >= num_lines: + break + + layout.set_text(data_lines[line], -1) + PangoCairo.show_layout(cr, layout) + cr.rel_move_to(0, font_size) + line += 1 + + def end_print(self, operation, print_ctx, print_data): + pass + + +def main(demoapp=None): + app = PrintingApp() + GLib.idle_add(app.run, demoapp.window) + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/rotatedtext.py b/examples/demo/demos/rotatedtext.py new file mode 100644 index 0000000..4dac189 --- /dev/null +++ b/examples/demo/demos/rotatedtext.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +title = "Rotated Text" +description = """This demo shows how to use PangoCairo to draw rotated and +transformed text. The right pane shows a rotated GtkLabel widget. In both +cases, a custom PangoCairo shape renderer is installed to draw a red heard using +cairo drawing operations instead of the Unicode heart character. +""" + +from gi.repository import Gtk, Pango, PangoCairo, Gdk +import cairo +import math + + +UTF8_TEXT = u"I ♥ GTK" +HEART = u"♥" +BYTES_TEXT = UTF8_TEXT.encode("utf-8") +BYTES_HEART = HEART.encode("utf-8") + + +class RotatedTextApp: + RADIUS = 150 + N_WORDS = 5 + FONT = "Serif 18" + + def __init__(self): + + white = Gdk.RGBA() + white.red = 1.0 + white.green = 1.0 + white.blue = 1.0 + white.alpha = 1.0 + + self.window = Gtk.Window(title="Rotated Text") + self.window.set_default_size(4 * self.RADIUS, 2 * self.RADIUS) + self.window.connect('destroy', Gtk.main_quit) + + box = Gtk.HBox() + box.set_homogeneous(True) + self.window.add(box) + + # add a drawing area + da = Gtk.DrawingArea() + box.add(da) + + # override the background color from the theme + da.override_background_color(0, white) + + da.connect('draw', self.rotated_text_draw) + + label = Gtk.Label(label=UTF8_TEXT) + box.add(label) + label.set_angle(45) + + # Setup some fancy stuff on the label + layout = label.get_layout() + + PangoCairo.context_set_shape_renderer(layout.get_context(), + self.fancy_shape_renderer, + None) + attrs = self.create_fancy_attr_list_for_layout(layout) + label.set_attributes(attrs) + + self.window.show_all() + + def fancy_shape_renderer(self, cairo_ctx, attr, do_path): + x, y = cairo_ctx.get_current_point() + cairo_ctx.translate(x, y) + + cairo_ctx.scale(float(attr.inc_rect.width) / Pango.SCALE, + float(attr.inc_rect.height) / Pango.SCALE) + + if int(attr.data) == 0x2665: # U+2665 BLACK HEART SUIT + cairo_ctx.move_to(0.5, 0.0) + cairo_ctx.line_to(0.9, -0.4) + cairo_ctx.curve_to(1.1, -0.8, 0.5, -0.9, 0.5, -0.5) + cairo_ctx.curve_to(0.5, -0.9, -0.1, -0.8, 0.1, -0.4) + cairo_ctx.close_path() + + if not do_path: + cairo_ctx.set_source_rgb(1.0, 0.0, 0.0) + cairo_ctx.fill() + + def create_fancy_attr_list_for_layout(self, layout): + pango_ctx = layout.get_context() + metrics = pango_ctx.get_metrics(layout.get_font_description(), + None) + ascent = metrics.get_ascent() + + logical_rect = Pango.Rectangle() + logical_rect.x = 0 + logical_rect.width = ascent + logical_rect.y = -ascent + logical_rect.height = ascent + + # Set fancy shape attributes for all hearts + attrs = Pango.AttrList() + + # FIXME: attr_shape_new_with_data isn't introspectable + ''' + ink_rect = logical_rect + p = BYTES_TEXT.find(BYTES_HEART) + while (p != -1): + attr = Pango.attr_shape_new_with_data(ink_rect, + logical_rect, + ord(HEART), + None) + attr.start_index = p + attr.end_index = p + len(BYTES_HEART) + p = UTF8_TEXT.find(HEART, attr.end_index) + + attrs.insert(attr) + ''' + return attrs + + def rotated_text_draw(self, da, cairo_ctx): + # Create a cairo context and set up a transformation matrix so that the user + # space coordinates for the centered square where we draw are [-RADIUS, RADIUS], + # [-RADIUS, RADIUS]. + # We first center, then change the scale. + width = da.get_allocated_width() + height = da.get_allocated_height() + device_radius = min(width, height) / 2.0 + cairo_ctx.translate( + device_radius + (width - 2 * device_radius) / 2, + device_radius + (height - 2 * device_radius) / 2) + cairo_ctx.scale(device_radius / self.RADIUS, + device_radius / self.RADIUS) + + # Create a subtle gradient source and use it. + pattern = cairo.LinearGradient(-self.RADIUS, -self.RADIUS, self.RADIUS, self.RADIUS) + pattern.add_color_stop_rgb(0.0, 0.5, 0.0, 0.0) + pattern.add_color_stop_rgb(1.0, 0.0, 0.0, 0.5) + cairo_ctx.set_source(pattern) + + # Create a PangoContext and set up our shape renderer + context = da.create_pango_context() + PangoCairo.context_set_shape_renderer(context, + self.fancy_shape_renderer, + None) + + # Create a PangoLayout, set the text, font, and attributes */ + layout = Pango.Layout(context=context) + layout.set_text(UTF8_TEXT, -1) + desc = Pango.FontDescription(self.FONT) + layout.set_font_description(desc) + + attrs = self.create_fancy_attr_list_for_layout(layout) + layout.set_attributes(attrs) + + # Draw the layout N_WORDS times in a circle */ + for i in range(self.N_WORDS): + # Inform Pango to re-layout the text with the new transformation matrix + PangoCairo.update_layout(cairo_ctx, layout) + + width, height = layout.get_pixel_size() + cairo_ctx.move_to(-width / 2, -self.RADIUS * 0.9) + PangoCairo.show_layout(cairo_ctx, layout) + + # Rotate for the next turn + cairo_ctx.rotate(math.pi * 2 / self.N_WORDS) + + return False + + +def main(demoapp=None): + RotatedTextApp() + Gtk.main() + + +if __name__ == '__main__': + main() diff --git a/examples/demo/demos/test.py b/examples/demo/demos/test.py new file mode 100644 index 0000000..4bd7684 --- /dev/null +++ b/examples/demo/demos/test.py @@ -0,0 +1,16 @@ +title = "Test Demo" +description = "Dude this is a test" + + +from gi.repository import Gtk + + +def _quit(*args): + Gtk.main_quit() + + +def main(demoapp=None): + window = Gtk.Window() + window.connect_after('destroy', _quit) + window.show_all() + Gtk.main() diff --git a/examples/properties.py b/examples/properties.py index 465b3c3..257e80a 100644 --- a/examples/properties.py +++ b/examples/properties.py @@ -13,20 +13,21 @@ class MyObject(GObject.GObject): def readonly(self): return 'readonly' + GObject.type_register(MyObject) -print "MyObject properties: ", list(MyObject.props) +print("MyObject properties: ", list(MyObject.props)) obj = MyObject() -print "obj.foo ==", obj.foo +print("obj.foo ==", obj.foo) obj.foo = 'spam' -print "obj.foo = spam" +print("obj.foo = spam") -print "obj.foo == ", obj.foo +print("obj.foo == ", obj.foo) -print "obj.boolprop == ", obj.boolprop +print("obj.boolprop == ", obj.boolprop) -print obj.readonly +print(obj.readonly) obj.readonly = 'does-not-work' diff --git a/gi/Makefile.am b/gi/Makefile.am deleted file mode 100644 index fc11ff8..0000000 --- a/gi/Makefile.am +++ /dev/null @@ -1,133 +0,0 @@ -SUBDIRS = \ - repository \ - overrides \ - _glib \ - _gobject - -extension_cppflags = \ - $(PYTHON_INCLUDES) \ - -DPY_SSIZE_T_CLEAN - -extension_ldflags = \ - -module \ - -avoid-version \ - -shrext $(PYTHON_SO) - -if OS_WIN32 -# Windows requires Python modules to be explicitly linked to libpython. -# Extension modules are shared libaries (.dll), but need to be -# called .pyd for Python to load it as an extension module. -extension_libadd = \ - $(PYTHON_LIBS) - -extension_ldflags += \ - -no-undefined -endif - -pygidir = $(pyexecdir)/gi - -pygi_PYTHON = \ - __init__.py \ - types.py \ - module.py \ - importer.py \ - pygtkcompat.py \ - docstring.py - -pygi_LTLIBRARIES = _gi.la - -_gi_la_SOURCES = \ - pygi-repository.c \ - pygi-repository.h \ - pygi-info.c \ - pygi-info.h \ - pygi-foreign.c \ - pygi-foreign.h \ - pygi-struct.c \ - pygi-struct.h \ - pygi-source.c \ - pygi-source.h \ - pygi-argument.c \ - pygi-argument.h \ - pygi-type.c \ - pygi-type.h \ - pygi-boxed.c \ - pygi-boxed.h \ - pygi-closure.c \ - pygi-closure.h \ - pygi-ccallback.c \ - pygi-ccallback.h \ - pygi.h \ - pygi-private.h \ - pygi-property.c \ - pygi-property.h \ - pygi-signal-closure.c \ - pygi-signal-closure.h \ - pygobject-external.h \ - gimodule.c \ - pygi-invoke.c \ - pygi-invoke.h \ - pygi-invoke-state-struct.h \ - pygi-cache.h \ - pygi-cache.c \ - pygi-marshal-from-py.c \ - pygi-marshal-from-py.h \ - pygi-marshal-to-py.c \ - pygi-marshal-to-py.h \ - pygi-marshal-cleanup.c \ - pygi-marshal-cleanup.h -_gi_la_CFLAGS = \ - $(GI_CFLAGS) -_gi_la_CPPFLAGS = \ - $(extension_cppflags) \ - -I$(top_srcdir)/gi/_glib \ - -I$(top_srcdir)/gi/_gobject -_gi_la_LIBADD = \ - $(extension_libadd) \ - $(GI_LIBS) \ - $(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la -_gi_la_LDFLAGS = \ - $(extension_ldflags) \ - -export-symbols-regex "init_gi|PyInit__gi" - -if ENABLE_CAIRO -pygi_LTLIBRARIES += _gi_cairo.la -endif - -_gi_cairo_la_SOURCES = \ - pygi-foreign-cairo.c -_gi_cairo_la_CFLAGS = \ - $(GI_CFLAGS) \ - $(PYCAIRO_CFLAGS) -_gi_cairo_la_CPPFLAGS = \ - $(extension_cppflags) \ - -I$(top_srcdir)/gi/_glib \ - -I$(top_srcdir)/gi/_gobject -_gi_cairo_la_LIBADD = \ - $(extension_libadd) \ - $(GI_LIBS) \ - $(PYCAIRO_LIBS) -_gi_cairo_la_LDFLAGS = \ - $(extension_ldflags) \ - -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo" - - -# This is to ensure we have a symlink to the .so in the -# build directory, which the Python interpreter can load -# directly without having to know how to parse .la files. -%$(PYTHON_SO): %.la - $(LN_S) -f .libs/$@ $@ - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygi_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks - -check-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -clean-local: - rm -f $(LTLIBRARIES:.la=$(PYTHON_SO)) diff --git a/gi/Makefile.in b/gi/Makefile.in deleted file mode 100644 index abc8c4e..0000000 --- a/gi/Makefile.in +++ /dev/null @@ -1,1154 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@OS_WIN32_TRUE@am__append_1 = \ -@OS_WIN32_TRUE@ -no-undefined - -@ENABLE_CAIRO_TRUE@am__append_2 = _gi_cairo.la -subdir = gi -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp $(pygi_PYTHON) $(top_srcdir)/py-compile -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(pygidir)" "$(DESTDIR)$(pygidir)" -LTLIBRARIES = $(pygi_LTLIBRARIES) -am__DEPENDENCIES_1 = -@OS_WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la -am__gi_la_OBJECTS = _gi_la-pygi-repository.lo _gi_la-pygi-info.lo \ - _gi_la-pygi-foreign.lo _gi_la-pygi-struct.lo \ - _gi_la-pygi-source.lo _gi_la-pygi-argument.lo \ - _gi_la-pygi-type.lo _gi_la-pygi-boxed.lo \ - _gi_la-pygi-closure.lo _gi_la-pygi-ccallback.lo \ - _gi_la-pygi-property.lo _gi_la-pygi-signal-closure.lo \ - _gi_la-gimodule.lo _gi_la-pygi-invoke.lo _gi_la-pygi-cache.lo \ - _gi_la-pygi-marshal-from-py.lo _gi_la-pygi-marshal-to-py.lo \ - _gi_la-pygi-marshal-cleanup.lo -_gi_la_OBJECTS = $(am__gi_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -_gi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gi_la_CFLAGS) $(CFLAGS) \ - $(_gi_la_LDFLAGS) $(LDFLAGS) -o $@ -_gi_cairo_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -am__gi_cairo_la_OBJECTS = _gi_cairo_la-pygi-foreign-cairo.lo -_gi_cairo_la_OBJECTS = $(am__gi_cairo_la_OBJECTS) -_gi_cairo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gi_cairo_la_CFLAGS) \ - $(CFLAGS) $(_gi_cairo_la_LDFLAGS) $(LDFLAGS) -o $@ -@ENABLE_CAIRO_TRUE@am__gi_cairo_la_rpath = -rpath $(pygidir) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(_gi_la_SOURCES) $(_gi_cairo_la_SOURCES) -DIST_SOURCES = $(_gi_la_SOURCES) $(_gi_cairo_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) -am__pep3147_tweak = \ - sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' -py_compile = $(top_srcdir)/py-compile -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = \ - repository \ - overrides \ - _glib \ - _gobject - -extension_cppflags = \ - $(PYTHON_INCLUDES) \ - -DPY_SSIZE_T_CLEAN - -extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \ - $(am__append_1) - -# Windows requires Python modules to be explicitly linked to libpython. -# Extension modules are shared libaries (.dll), but need to be -# called .pyd for Python to load it as an extension module. -@OS_WIN32_TRUE@extension_libadd = \ -@OS_WIN32_TRUE@ $(PYTHON_LIBS) - -pygidir = $(pyexecdir)/gi -pygi_PYTHON = \ - __init__.py \ - types.py \ - module.py \ - importer.py \ - pygtkcompat.py \ - docstring.py - -pygi_LTLIBRARIES = _gi.la $(am__append_2) -_gi_la_SOURCES = \ - pygi-repository.c \ - pygi-repository.h \ - pygi-info.c \ - pygi-info.h \ - pygi-foreign.c \ - pygi-foreign.h \ - pygi-struct.c \ - pygi-struct.h \ - pygi-source.c \ - pygi-source.h \ - pygi-argument.c \ - pygi-argument.h \ - pygi-type.c \ - pygi-type.h \ - pygi-boxed.c \ - pygi-boxed.h \ - pygi-closure.c \ - pygi-closure.h \ - pygi-ccallback.c \ - pygi-ccallback.h \ - pygi.h \ - pygi-private.h \ - pygi-property.c \ - pygi-property.h \ - pygi-signal-closure.c \ - pygi-signal-closure.h \ - pygobject-external.h \ - gimodule.c \ - pygi-invoke.c \ - pygi-invoke.h \ - pygi-invoke-state-struct.h \ - pygi-cache.h \ - pygi-cache.c \ - pygi-marshal-from-py.c \ - pygi-marshal-from-py.h \ - pygi-marshal-to-py.c \ - pygi-marshal-to-py.h \ - pygi-marshal-cleanup.c \ - pygi-marshal-cleanup.h - -_gi_la_CFLAGS = \ - $(GI_CFLAGS) - -_gi_la_CPPFLAGS = \ - $(extension_cppflags) \ - -I$(top_srcdir)/gi/_glib \ - -I$(top_srcdir)/gi/_gobject - -_gi_la_LIBADD = \ - $(extension_libadd) \ - $(GI_LIBS) \ - $(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la - -_gi_la_LDFLAGS = \ - $(extension_ldflags) \ - -export-symbols-regex "init_gi|PyInit__gi" - -_gi_cairo_la_SOURCES = \ - pygi-foreign-cairo.c - -_gi_cairo_la_CFLAGS = \ - $(GI_CFLAGS) \ - $(PYCAIRO_CFLAGS) - -_gi_cairo_la_CPPFLAGS = \ - $(extension_cppflags) \ - -I$(top_srcdir)/gi/_glib \ - -I$(top_srcdir)/gi/_gobject - -_gi_cairo_la_LIBADD = \ - $(extension_libadd) \ - $(GI_LIBS) \ - $(PYCAIRO_LIBS) - -_gi_cairo_la_LDFLAGS = \ - $(extension_ldflags) \ - -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo" - -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gi/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign gi/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -install-pygiLTLIBRARIES: $(pygi_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(pygi_LTLIBRARIES)'; test -n "$(pygidir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(pygidir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pygidir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pygidir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pygidir)"; \ - } - -uninstall-pygiLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(pygi_LTLIBRARIES)'; test -n "$(pygidir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pygidir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pygidir)/$$f"; \ - done - -clean-pygiLTLIBRARIES: - -test -z "$(pygi_LTLIBRARIES)" || rm -f $(pygi_LTLIBRARIES) - @list='$(pygi_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -_gi.la: $(_gi_la_OBJECTS) $(_gi_la_DEPENDENCIES) $(EXTRA__gi_la_DEPENDENCIES) - $(AM_V_CCLD)$(_gi_la_LINK) -rpath $(pygidir) $(_gi_la_OBJECTS) $(_gi_la_LIBADD) $(LIBS) - -_gi_cairo.la: $(_gi_cairo_la_OBJECTS) $(_gi_cairo_la_DEPENDENCIES) $(EXTRA__gi_cairo_la_DEPENDENCIES) - $(AM_V_CCLD)$(_gi_cairo_la_LINK) $(am__gi_cairo_la_rpath) $(_gi_cairo_la_OBJECTS) $(_gi_cairo_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_cairo_la-pygi-foreign-cairo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-gimodule.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-argument.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-boxed.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-cache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-ccallback.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-closure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-foreign.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-info.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-invoke.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-marshal-cleanup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-marshal-from-py.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-marshal-to-py.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-property.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-repository.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-signal-closure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-source.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-struct.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gi_la-pygi-type.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -_gi_la-pygi-repository.lo: pygi-repository.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-repository.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-repository.Tpo -c -o _gi_la-pygi-repository.lo `test -f 'pygi-repository.c' || echo '$(srcdir)/'`pygi-repository.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-repository.Tpo $(DEPDIR)/_gi_la-pygi-repository.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-repository.c' object='_gi_la-pygi-repository.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-repository.lo `test -f 'pygi-repository.c' || echo '$(srcdir)/'`pygi-repository.c - -_gi_la-pygi-info.lo: pygi-info.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-info.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-info.Tpo -c -o _gi_la-pygi-info.lo `test -f 'pygi-info.c' || echo '$(srcdir)/'`pygi-info.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-info.Tpo $(DEPDIR)/_gi_la-pygi-info.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-info.c' object='_gi_la-pygi-info.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-info.lo `test -f 'pygi-info.c' || echo '$(srcdir)/'`pygi-info.c - -_gi_la-pygi-foreign.lo: pygi-foreign.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-foreign.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-foreign.Tpo -c -o _gi_la-pygi-foreign.lo `test -f 'pygi-foreign.c' || echo '$(srcdir)/'`pygi-foreign.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-foreign.Tpo $(DEPDIR)/_gi_la-pygi-foreign.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-foreign.c' object='_gi_la-pygi-foreign.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-foreign.lo `test -f 'pygi-foreign.c' || echo '$(srcdir)/'`pygi-foreign.c - -_gi_la-pygi-struct.lo: pygi-struct.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-struct.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-struct.Tpo -c -o _gi_la-pygi-struct.lo `test -f 'pygi-struct.c' || echo '$(srcdir)/'`pygi-struct.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-struct.Tpo $(DEPDIR)/_gi_la-pygi-struct.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-struct.c' object='_gi_la-pygi-struct.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-struct.lo `test -f 'pygi-struct.c' || echo '$(srcdir)/'`pygi-struct.c - -_gi_la-pygi-source.lo: pygi-source.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-source.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-source.Tpo -c -o _gi_la-pygi-source.lo `test -f 'pygi-source.c' || echo '$(srcdir)/'`pygi-source.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-source.Tpo $(DEPDIR)/_gi_la-pygi-source.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-source.c' object='_gi_la-pygi-source.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-source.lo `test -f 'pygi-source.c' || echo '$(srcdir)/'`pygi-source.c - -_gi_la-pygi-argument.lo: pygi-argument.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-argument.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-argument.Tpo -c -o _gi_la-pygi-argument.lo `test -f 'pygi-argument.c' || echo '$(srcdir)/'`pygi-argument.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-argument.Tpo $(DEPDIR)/_gi_la-pygi-argument.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-argument.c' object='_gi_la-pygi-argument.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-argument.lo `test -f 'pygi-argument.c' || echo '$(srcdir)/'`pygi-argument.c - -_gi_la-pygi-type.lo: pygi-type.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-type.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-type.Tpo -c -o _gi_la-pygi-type.lo `test -f 'pygi-type.c' || echo '$(srcdir)/'`pygi-type.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-type.Tpo $(DEPDIR)/_gi_la-pygi-type.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-type.c' object='_gi_la-pygi-type.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-type.lo `test -f 'pygi-type.c' || echo '$(srcdir)/'`pygi-type.c - -_gi_la-pygi-boxed.lo: pygi-boxed.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-boxed.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-boxed.Tpo -c -o _gi_la-pygi-boxed.lo `test -f 'pygi-boxed.c' || echo '$(srcdir)/'`pygi-boxed.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-boxed.Tpo $(DEPDIR)/_gi_la-pygi-boxed.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-boxed.c' object='_gi_la-pygi-boxed.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-boxed.lo `test -f 'pygi-boxed.c' || echo '$(srcdir)/'`pygi-boxed.c - -_gi_la-pygi-closure.lo: pygi-closure.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-closure.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-closure.Tpo -c -o _gi_la-pygi-closure.lo `test -f 'pygi-closure.c' || echo '$(srcdir)/'`pygi-closure.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-closure.Tpo $(DEPDIR)/_gi_la-pygi-closure.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-closure.c' object='_gi_la-pygi-closure.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-closure.lo `test -f 'pygi-closure.c' || echo '$(srcdir)/'`pygi-closure.c - -_gi_la-pygi-ccallback.lo: pygi-ccallback.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-ccallback.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-ccallback.Tpo -c -o _gi_la-pygi-ccallback.lo `test -f 'pygi-ccallback.c' || echo '$(srcdir)/'`pygi-ccallback.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-ccallback.Tpo $(DEPDIR)/_gi_la-pygi-ccallback.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-ccallback.c' object='_gi_la-pygi-ccallback.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-ccallback.lo `test -f 'pygi-ccallback.c' || echo '$(srcdir)/'`pygi-ccallback.c - -_gi_la-pygi-property.lo: pygi-property.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-property.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-property.Tpo -c -o _gi_la-pygi-property.lo `test -f 'pygi-property.c' || echo '$(srcdir)/'`pygi-property.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-property.Tpo $(DEPDIR)/_gi_la-pygi-property.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-property.c' object='_gi_la-pygi-property.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-property.lo `test -f 'pygi-property.c' || echo '$(srcdir)/'`pygi-property.c - -_gi_la-pygi-signal-closure.lo: pygi-signal-closure.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-signal-closure.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-signal-closure.Tpo -c -o _gi_la-pygi-signal-closure.lo `test -f 'pygi-signal-closure.c' || echo '$(srcdir)/'`pygi-signal-closure.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-signal-closure.Tpo $(DEPDIR)/_gi_la-pygi-signal-closure.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-signal-closure.c' object='_gi_la-pygi-signal-closure.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-signal-closure.lo `test -f 'pygi-signal-closure.c' || echo '$(srcdir)/'`pygi-signal-closure.c - -_gi_la-gimodule.lo: gimodule.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-gimodule.lo -MD -MP -MF $(DEPDIR)/_gi_la-gimodule.Tpo -c -o _gi_la-gimodule.lo `test -f 'gimodule.c' || echo '$(srcdir)/'`gimodule.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-gimodule.Tpo $(DEPDIR)/_gi_la-gimodule.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gimodule.c' object='_gi_la-gimodule.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-gimodule.lo `test -f 'gimodule.c' || echo '$(srcdir)/'`gimodule.c - -_gi_la-pygi-invoke.lo: pygi-invoke.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-invoke.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-invoke.Tpo -c -o _gi_la-pygi-invoke.lo `test -f 'pygi-invoke.c' || echo '$(srcdir)/'`pygi-invoke.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-invoke.Tpo $(DEPDIR)/_gi_la-pygi-invoke.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-invoke.c' object='_gi_la-pygi-invoke.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-invoke.lo `test -f 'pygi-invoke.c' || echo '$(srcdir)/'`pygi-invoke.c - -_gi_la-pygi-cache.lo: pygi-cache.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-cache.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-cache.Tpo -c -o _gi_la-pygi-cache.lo `test -f 'pygi-cache.c' || echo '$(srcdir)/'`pygi-cache.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-cache.Tpo $(DEPDIR)/_gi_la-pygi-cache.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-cache.c' object='_gi_la-pygi-cache.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-cache.lo `test -f 'pygi-cache.c' || echo '$(srcdir)/'`pygi-cache.c - -_gi_la-pygi-marshal-from-py.lo: pygi-marshal-from-py.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-marshal-from-py.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-marshal-from-py.Tpo -c -o _gi_la-pygi-marshal-from-py.lo `test -f 'pygi-marshal-from-py.c' || echo '$(srcdir)/'`pygi-marshal-from-py.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-marshal-from-py.Tpo $(DEPDIR)/_gi_la-pygi-marshal-from-py.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-marshal-from-py.c' object='_gi_la-pygi-marshal-from-py.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-marshal-from-py.lo `test -f 'pygi-marshal-from-py.c' || echo '$(srcdir)/'`pygi-marshal-from-py.c - -_gi_la-pygi-marshal-to-py.lo: pygi-marshal-to-py.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-marshal-to-py.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-marshal-to-py.Tpo -c -o _gi_la-pygi-marshal-to-py.lo `test -f 'pygi-marshal-to-py.c' || echo '$(srcdir)/'`pygi-marshal-to-py.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-marshal-to-py.Tpo $(DEPDIR)/_gi_la-pygi-marshal-to-py.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-marshal-to-py.c' object='_gi_la-pygi-marshal-to-py.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-marshal-to-py.lo `test -f 'pygi-marshal-to-py.c' || echo '$(srcdir)/'`pygi-marshal-to-py.c - -_gi_la-pygi-marshal-cleanup.lo: pygi-marshal-cleanup.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -MT _gi_la-pygi-marshal-cleanup.lo -MD -MP -MF $(DEPDIR)/_gi_la-pygi-marshal-cleanup.Tpo -c -o _gi_la-pygi-marshal-cleanup.lo `test -f 'pygi-marshal-cleanup.c' || echo '$(srcdir)/'`pygi-marshal-cleanup.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_la-pygi-marshal-cleanup.Tpo $(DEPDIR)/_gi_la-pygi-marshal-cleanup.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-marshal-cleanup.c' object='_gi_la-pygi-marshal-cleanup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_la_CPPFLAGS) $(CPPFLAGS) $(_gi_la_CFLAGS) $(CFLAGS) -c -o _gi_la-pygi-marshal-cleanup.lo `test -f 'pygi-marshal-cleanup.c' || echo '$(srcdir)/'`pygi-marshal-cleanup.c - -_gi_cairo_la-pygi-foreign-cairo.lo: pygi-foreign-cairo.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_cairo_la_CPPFLAGS) $(CPPFLAGS) $(_gi_cairo_la_CFLAGS) $(CFLAGS) -MT _gi_cairo_la-pygi-foreign-cairo.lo -MD -MP -MF $(DEPDIR)/_gi_cairo_la-pygi-foreign-cairo.Tpo -c -o _gi_cairo_la-pygi-foreign-cairo.lo `test -f 'pygi-foreign-cairo.c' || echo '$(srcdir)/'`pygi-foreign-cairo.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gi_cairo_la-pygi-foreign-cairo.Tpo $(DEPDIR)/_gi_cairo_la-pygi-foreign-cairo.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygi-foreign-cairo.c' object='_gi_cairo_la-pygi-foreign-cairo.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_gi_cairo_la_CPPFLAGS) $(CPPFLAGS) $(_gi_cairo_la_CFLAGS) $(CFLAGS) -c -o _gi_cairo_la-pygi-foreign-cairo.lo `test -f 'pygi-foreign-cairo.c' || echo '$(srcdir)/'`pygi-foreign-cairo.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-pygiPYTHON: $(pygi_PYTHON) - @$(NORMAL_INSTALL) - @list='$(pygi_PYTHON)'; dlist=; list2=; test -n "$(pygidir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pygidir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pygidir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ - if test -f $$b$$p; then \ - $(am__strip_dir) \ - dlist="$$dlist $$f"; \ - list2="$$list2 $$b$$p"; \ - else :; fi; \ - done; \ - for file in $$list2; do echo $$file; done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pygidir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pygidir)" || exit $$?; \ - done || exit $$?; \ - if test -n "$$dlist"; then \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygidir)" $$dlist; \ - else :; fi - -uninstall-pygiPYTHON: - @$(NORMAL_UNINSTALL) - @list='$(pygi_PYTHON)'; test -n "$(pygidir)" || list=; \ - py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$py_files" || exit 0; \ - dir='$(DESTDIR)$(pygidir)'; \ - pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ - pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ - py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ - echo "$$py_files_pep3147";\ - pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ - pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ - st=0; \ - for files in \ - "$$py_files" \ - "$$pyc_files" \ - "$$pyo_files" \ - "$$pyc_files_pep3147" \ - "$$pyo_files_pep3147" \ - ; do \ - $(am__uninstall_files_from_dir) || st=$$?; \ - done; \ - exit $$st - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-recursive -all-am: Makefile $(LTLIBRARIES) all-local -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(pygidir)" "$(DESTDIR)$(pygidir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-local \ - clean-pygiLTLIBRARIES mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-pygiLTLIBRARIES install-pygiPYTHON - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-pygiLTLIBRARIES uninstall-pygiPYTHON - -.MAKE: $(am__recursive_targets) check-am install-am install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ - check check-am check-local clean clean-generic clean-libtool \ - clean-local clean-pygiLTLIBRARIES cscopelist-am ctags ctags-am \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-pygiLTLIBRARIES \ - install-pygiPYTHON install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-pygiLTLIBRARIES \ - uninstall-pygiPYTHON - - -# This is to ensure we have a symlink to the .so in the -# build directory, which the Python interpreter can load -# directly without having to know how to parse .la files. -%$(PYTHON_SO): %.la - $(LN_S) -f .libs/$@ $@ - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygi_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks - -check-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -clean-local: - rm -f $(LTLIBRARIES:.la=$(PYTHON_SO)) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/gi/__init__.py b/gi/__init__.py index 0645d44..3454790 100644 --- a/gi/__init__.py +++ b/gi/__init__.py @@ -18,32 +18,63 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -from __future__ import absolute_import - # support overrides in different directories than our gi module from pkgutil import extend_path __path__ = extend_path(__path__, __name__) +import sys +import os +import importlib +import types + +_static_binding_error = ('When using gi.repository you must not import static ' + 'modules like "gobject". Please change all occurrences ' + 'of "import gobject" to "from gi.repository import GObject". ' + 'See: https://bugzilla.gnome.org/show_bug.cgi?id=709183') + +# we can't have pygobject 2 loaded at the same time we load the internal _gobject +if 'gobject' in sys.modules: + raise ImportError(_static_binding_error) + + +from . import _gi from ._gi import _API from ._gi import Repository from ._gi import PyGIDeprecationWarning - -# Force loading the GObject typelib so we have available the wrappers for -# base classes such as GInitiallyUnowned -import gi._gobject -gi # pyflakes +from ._gi import PyGIWarning _API = _API # pyflakes PyGIDeprecationWarning = PyGIDeprecationWarning - -import os +PyGIWarning = PyGIWarning _versions = {} _overridesdir = os.path.join(os.path.dirname(__file__), 'overrides') -version_info = gi._gobject.pygobject_version[:] +# Needed for compatibility with "pygobject.h"/pygobject_init() +_gobject = types.ModuleType("gi._gobject") +sys.modules[_gobject.__name__] = _gobject +_gobject._PyGObject_API = _gi._PyGObject_API +_gobject.pygobject_version = _gi.pygobject_version + +version_info = _gi.pygobject_version[:] __version__ = "{0}.{1}.{2}".format(*version_info) +_gi.register_foreign() + + +class _DummyStaticModule(types.ModuleType): + __path__ = None + + def __getattr__(self, name): + raise AttributeError(_static_binding_error) + + +sys.modules['glib'] = _DummyStaticModule('glib', _static_binding_error) +sys.modules['gobject'] = _DummyStaticModule('gobject', _static_binding_error) +sys.modules['gio'] = _DummyStaticModule('gio', _static_binding_error) +sys.modules['gtk'] = _DummyStaticModule('gtk', _static_binding_error) +sys.modules['gtk.gdk'] = _DummyStaticModule('gtk.gdk', _static_binding_error) + def check_version(version): if isinstance(version, str): @@ -59,8 +90,27 @@ def check_version(version): def require_version(namespace, version): + """ Ensures the correct versions are loaded when importing `gi` modules. + + :param namespace: The name of module to require. + :type namespace: str + :param version: The version of module to require. + :type version: str + :raises ValueError: If module/version is already loaded, already required, or unavailable. + + :Example: + + .. code-block:: python + + import gi + gi.require_version('Gtk', '3.0') + + """ repository = Repository.get_default() + if not isinstance(version, str): + raise ValueError('Namespace version needs to be a string.') + if namespace in repository.get_loaded_namespaces(): loaded_version = repository.get_version(namespace) if loaded_version != version: @@ -82,5 +132,48 @@ def require_version(namespace, version): _versions[namespace] = version +def require_versions(requires): + """ Utility function for consolidating multiple `gi.require_version()` calls. + + :param requires: The names and versions of modules to require. + :type requires: dict + + :Example: + + .. code-block:: python + + import gi + gi.require_versions({'Gtk': '3.0', 'GLib': '2.0', 'Gio': '2.0'}) + """ + for module_name, module_version in requires.items(): + require_version(module_name, module_version) + + def get_required_version(namespace): return _versions.get(namespace, None) + + +def require_foreign(namespace, symbol=None): + """Ensure the given foreign marshaling module is available and loaded. + + :param str namespace: + Introspection namespace of the foreign module (e.g. "cairo") + :param symbol: + Optional symbol typename to ensure a converter exists. + :type symbol: str or None + :raises: ImportError + + :Example: + + .. code-block:: python + + import gi + import cairo + gi.require_foreign('cairo') + + """ + try: + _gi.require_foreign(namespace, symbol) + except Exception as e: + raise ImportError(str(e)) + importlib.import_module('gi.repository', namespace) diff --git a/gi/_constants.py b/gi/_constants.py new file mode 100644 index 0000000..6fca96b --- /dev/null +++ b/gi/_constants.py @@ -0,0 +1,47 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# pygobject - Python bindings for the GObject library +# Copyright (C) 2006-2007 Johan Dahlin +# +# gi/_constants.py: GObject type constants +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +from . import _gi + +TYPE_INVALID = _gi.TYPE_INVALID +TYPE_NONE = _gi.GType.from_name('void') +TYPE_INTERFACE = _gi.GType.from_name('GInterface') +TYPE_CHAR = _gi.GType.from_name('gchar') +TYPE_UCHAR = _gi.GType.from_name('guchar') +TYPE_BOOLEAN = _gi.GType.from_name('gboolean') +TYPE_INT = _gi.GType.from_name('gint') +TYPE_UINT = _gi.GType.from_name('guint') +TYPE_LONG = _gi.GType.from_name('glong') +TYPE_ULONG = _gi.GType.from_name('gulong') +TYPE_INT64 = _gi.GType.from_name('gint64') +TYPE_UINT64 = _gi.GType.from_name('guint64') +TYPE_ENUM = _gi.GType.from_name('GEnum') +TYPE_FLAGS = _gi.GType.from_name('GFlags') +TYPE_FLOAT = _gi.GType.from_name('gfloat') +TYPE_DOUBLE = _gi.GType.from_name('gdouble') +TYPE_STRING = _gi.GType.from_name('gchararray') +TYPE_POINTER = _gi.GType.from_name('gpointer') +TYPE_BOXED = _gi.GType.from_name('GBoxed') +TYPE_PARAM = _gi.GType.from_name('GParam') +TYPE_OBJECT = _gi.GType.from_name('GObject') +TYPE_PYOBJECT = _gi.GType.from_name('PyObject') +TYPE_GTYPE = _gi.GType.from_name('GType') +TYPE_STRV = _gi.GType.from_name('GStrv') +TYPE_VARIANT = _gi.GType.from_name('GVariant') +TYPE_UNICHAR = TYPE_UINT diff --git a/gi/_error.py b/gi/_error.py new file mode 100644 index 0000000..6440ef7 --- /dev/null +++ b/gi/_error.py @@ -0,0 +1,55 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2014 Simon Feltman +# +# _error.py: GError Python implementation +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + + +# NOTE: This file should not have any dependencies on introspection libs +# like gi.repository.GLib because it would cause a circular dependency. +# Developers wanting to use the GError class in their applications should +# use gi.repository.GLib.GError + + +class GError(RuntimeError): + def __init__(self, message='unknown error', domain='pygi-error', code=0): + super(GError, self).__init__(message) + self.message = message + self.domain = domain + self.code = code + + def __str__(self): + return "%s: %s (%d)" % (self.domain, self.message, self.code) + + def __repr__(self): + return "%s.%s('%s', '%s', %d)" % ( + GError.__module__.rsplit(".", 1)[-1], GError.__name__, + self.message, self.domain, self.code) + + def copy(self): + return GError(self.message, self.domain, self.code) + + def matches(self, domain, code): + """Placeholder that will be monkey patched in GLib overrides.""" + raise NotImplementedError + + @staticmethod + def new_literal(domain, message, code): + """Placeholder that will be monkey patched in GLib overrides.""" + raise NotImplementedError diff --git a/gi/_glib/Makefile.am b/gi/_glib/Makefile.am deleted file mode 100644 index 774b7e1..0000000 --- a/gi/_glib/Makefile.am +++ /dev/null @@ -1,91 +0,0 @@ -AUTOMAKE_OPTIONS = 1.7 - -extension_cppflags = \ - $(PYTHON_INCLUDES) \ - -DPY_SSIZE_T_CLEAN - -extension_ldflags = \ - -module \ - -avoid-version \ - -shrext $(PYTHON_SO) - -if OS_WIN32 -# Windows requires Python modules to be explicitly linked to libpython. -# Extension modules are shared libaries (.dll), but need to be -# called .pyd for Python to load it as an extension module. -extension_libadd = \ - $(PYTHON_LIBS) - -extension_ldflags += \ - -no-undefined -endif - - -pyglibdir = $(pyexecdir)/gi/_glib - -pyglib_PYTHON = \ - __init__.py \ - option.py - -lib_LTLIBRARIES = libpyglib-gi-2.0-@PYTHON_BASENAME@.la - -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_SOURCES = \ - pyglib.c \ - pyglib.h \ - pyglib-private.h \ - pyglib-python-compat.h -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CPPFLAGS = \ - $(extension_cppflags) -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CFLAGS = \ - $(GLIB_CFLAGS) -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LIBADD = \ - $(extension_libadd) \ - $(FFI_LIBS) \ - $(GLIB_LIBS) - -if OS_WIN32 -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LDFLAGS = \ - -no-undefined -endif - -pyglib_LTLIBRARIES = _glib.la - -_glib_la_SOURCES = \ - glibmodule.c \ - pygoptioncontext.c \ - pygoptioncontext.h \ - pygoptiongroup.c \ - pygoptiongroup.h \ - pygspawn.c \ - pygspawn.h -_glib_la_CFLAGS = \ - $(GLIB_CFLAGS) -_glib_la_CPPFLAGS = \ - $(extension_cppflags) -_glib_la_LIBADD = \ - $(extension_libadd) \ - $(GLIB_LIBS) \ - libpyglib-gi-2.0-@PYTHON_BASENAME@.la -_glib_la_LDFLAGS = \ - $(extension_ldflags) \ - -export-symbols-regex "_glib|PyInit__glib" - -if PLATFORM_WIN32 -_glib_la_CFLAGS += -DPLATFORM_WIN32 -endif - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pyglib_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - - -all: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -check-local: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -clean-local: - rm -f $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) -%$(PYTHON_SO): %.la - $(LN_S) -f .libs/$@ $@ diff --git a/gi/_glib/Makefile.in b/gi/_glib/Makefile.in deleted file mode 100644 index b08e8f1..0000000 --- a/gi/_glib/Makefile.in +++ /dev/null @@ -1,915 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@OS_WIN32_TRUE@am__append_1 = \ -@OS_WIN32_TRUE@ -no-undefined - -@PLATFORM_WIN32_TRUE@am__append_2 = -DPLATFORM_WIN32 -subdir = gi/_glib -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp $(pyglib_PYTHON) \ - $(top_srcdir)/py-compile -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pyglibdir)" \ - "$(DESTDIR)$(pyglibdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) $(pyglib_LTLIBRARIES) -am__DEPENDENCIES_1 = -@OS_WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -_glib_la_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - libpyglib-gi-2.0-@PYTHON_BASENAME@.la -am__glib_la_OBJECTS = _glib_la-glibmodule.lo \ - _glib_la-pygoptioncontext.lo _glib_la-pygoptiongroup.lo \ - _glib_la-pygspawn.lo -_glib_la_OBJECTS = $(am__glib_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -_glib_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_glib_la_CFLAGS) \ - $(CFLAGS) $(_glib_la_LDFLAGS) $(LDFLAGS) -o $@ -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_DEPENDENCIES = \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am_libpyglib_gi_2_0_@PYTHON_BASENAME@_la_OBJECTS = \ - libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.lo -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_OBJECTS = \ - $(am_libpyglib_gi_2_0_@PYTHON_BASENAME@_la_OBJECTS) -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LINK = $(LIBTOOL) $(AM_V_lt) \ - --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ - $(CCLD) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CFLAGS) \ - $(CFLAGS) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(_glib_la_SOURCES) \ - $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_SOURCES) -DIST_SOURCES = $(_glib_la_SOURCES) \ - $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) -am__pep3147_tweak = \ - sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' -py_compile = $(top_srcdir)/py-compile -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.7 -extension_cppflags = \ - $(PYTHON_INCLUDES) \ - -DPY_SSIZE_T_CLEAN - -extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \ - $(am__append_1) - -# Windows requires Python modules to be explicitly linked to libpython. -# Extension modules are shared libaries (.dll), but need to be -# called .pyd for Python to load it as an extension module. -@OS_WIN32_TRUE@extension_libadd = \ -@OS_WIN32_TRUE@ $(PYTHON_LIBS) - -pyglibdir = $(pyexecdir)/gi/_glib -pyglib_PYTHON = \ - __init__.py \ - option.py - -lib_LTLIBRARIES = libpyglib-gi-2.0-@PYTHON_BASENAME@.la -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_SOURCES = \ - pyglib.c \ - pyglib.h \ - pyglib-private.h \ - pyglib-python-compat.h - -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CPPFLAGS = \ - $(extension_cppflags) - -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CFLAGS = \ - $(GLIB_CFLAGS) - -libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LIBADD = \ - $(extension_libadd) \ - $(FFI_LIBS) \ - $(GLIB_LIBS) - -@OS_WIN32_TRUE@libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LDFLAGS = \ -@OS_WIN32_TRUE@ -no-undefined - -pyglib_LTLIBRARIES = _glib.la -_glib_la_SOURCES = \ - glibmodule.c \ - pygoptioncontext.c \ - pygoptioncontext.h \ - pygoptiongroup.c \ - pygoptiongroup.h \ - pygspawn.c \ - pygspawn.h - -_glib_la_CFLAGS = $(GLIB_CFLAGS) $(am__append_2) -_glib_la_CPPFLAGS = \ - $(extension_cppflags) - -_glib_la_LIBADD = \ - $(extension_libadd) \ - $(GLIB_LIBS) \ - libpyglib-gi-2.0-@PYTHON_BASENAME@.la - -_glib_la_LDFLAGS = \ - $(extension_ldflags) \ - -export-symbols-regex "_glib|PyInit__glib" - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gi/_glib/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign gi/_glib/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -install-pyglibLTLIBRARIES: $(pyglib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(pyglib_LTLIBRARIES)'; test -n "$(pyglibdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(pyglibdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pyglibdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pyglibdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pyglibdir)"; \ - } - -uninstall-pyglibLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(pyglib_LTLIBRARIES)'; test -n "$(pyglibdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pyglibdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pyglibdir)/$$f"; \ - done - -clean-pyglibLTLIBRARIES: - -test -z "$(pyglib_LTLIBRARIES)" || rm -f $(pyglib_LTLIBRARIES) - @list='$(pyglib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -_glib.la: $(_glib_la_OBJECTS) $(_glib_la_DEPENDENCIES) $(EXTRA__glib_la_DEPENDENCIES) - $(AM_V_CCLD)$(_glib_la_LINK) -rpath $(pyglibdir) $(_glib_la_OBJECTS) $(_glib_la_LIBADD) $(LIBS) - -libpyglib-gi-2.0-@PYTHON_BASENAME@.la: $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_OBJECTS) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_DEPENDENCIES) $(EXTRA_libpyglib_gi_2_0_@PYTHON_BASENAME@_la_DEPENDENCIES) - $(AM_V_CCLD)$(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LINK) -rpath $(libdir) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_OBJECTS) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-glibmodule.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygoptioncontext.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygoptiongroup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygspawn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -_glib_la-glibmodule.lo: glibmodule.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-glibmodule.lo -MD -MP -MF $(DEPDIR)/_glib_la-glibmodule.Tpo -c -o _glib_la-glibmodule.lo `test -f 'glibmodule.c' || echo '$(srcdir)/'`glibmodule.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_glib_la-glibmodule.Tpo $(DEPDIR)/_glib_la-glibmodule.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='glibmodule.c' object='_glib_la-glibmodule.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-glibmodule.lo `test -f 'glibmodule.c' || echo '$(srcdir)/'`glibmodule.c - -_glib_la-pygoptioncontext.lo: pygoptioncontext.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygoptioncontext.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygoptioncontext.Tpo -c -o _glib_la-pygoptioncontext.lo `test -f 'pygoptioncontext.c' || echo '$(srcdir)/'`pygoptioncontext.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_glib_la-pygoptioncontext.Tpo $(DEPDIR)/_glib_la-pygoptioncontext.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygoptioncontext.c' object='_glib_la-pygoptioncontext.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygoptioncontext.lo `test -f 'pygoptioncontext.c' || echo '$(srcdir)/'`pygoptioncontext.c - -_glib_la-pygoptiongroup.lo: pygoptiongroup.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygoptiongroup.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygoptiongroup.Tpo -c -o _glib_la-pygoptiongroup.lo `test -f 'pygoptiongroup.c' || echo '$(srcdir)/'`pygoptiongroup.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_glib_la-pygoptiongroup.Tpo $(DEPDIR)/_glib_la-pygoptiongroup.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygoptiongroup.c' object='_glib_la-pygoptiongroup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygoptiongroup.lo `test -f 'pygoptiongroup.c' || echo '$(srcdir)/'`pygoptiongroup.c - -_glib_la-pygspawn.lo: pygspawn.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygspawn.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygspawn.Tpo -c -o _glib_la-pygspawn.lo `test -f 'pygspawn.c' || echo '$(srcdir)/'`pygspawn.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_glib_la-pygspawn.Tpo $(DEPDIR)/_glib_la-pygspawn.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygspawn.c' object='_glib_la-pygspawn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygspawn.lo `test -f 'pygspawn.c' || echo '$(srcdir)/'`pygspawn.c - -libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.lo: pyglib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CPPFLAGS) $(CPPFLAGS) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CFLAGS) $(CFLAGS) -MT libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.lo -MD -MP -MF $(DEPDIR)/libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.Tpo -c -o libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.lo `test -f 'pyglib.c' || echo '$(srcdir)/'`pyglib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.Tpo $(DEPDIR)/libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pyglib.c' object='libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CPPFLAGS) $(CPPFLAGS) $(libpyglib_gi_2_0_@PYTHON_BASENAME@_la_CFLAGS) $(CFLAGS) -c -o libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.lo `test -f 'pyglib.c' || echo '$(srcdir)/'`pyglib.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-pyglibPYTHON: $(pyglib_PYTHON) - @$(NORMAL_INSTALL) - @list='$(pyglib_PYTHON)'; dlist=; list2=; test -n "$(pyglibdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pyglibdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pyglibdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ - if test -f $$b$$p; then \ - $(am__strip_dir) \ - dlist="$$dlist $$f"; \ - list2="$$list2 $$b$$p"; \ - else :; fi; \ - done; \ - for file in $$list2; do echo $$file; done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pyglibdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pyglibdir)" || exit $$?; \ - done || exit $$?; \ - if test -n "$$dlist"; then \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pyglibdir)" $$dlist; \ - else :; fi - -uninstall-pyglibPYTHON: - @$(NORMAL_UNINSTALL) - @list='$(pyglib_PYTHON)'; test -n "$(pyglibdir)" || list=; \ - py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$py_files" || exit 0; \ - dir='$(DESTDIR)$(pyglibdir)'; \ - pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ - pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ - py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ - echo "$$py_files_pep3147";\ - pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ - pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ - st=0; \ - for files in \ - "$$py_files" \ - "$$pyc_files" \ - "$$pyo_files" \ - "$$pyc_files_pep3147" \ - "$$pyo_files_pep3147" \ - ; do \ - $(am__uninstall_files_from_dir) || st=$$?; \ - done; \ - exit $$st - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pyglibdir)" "$(DESTDIR)$(pyglibdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ - clean-pyglibLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-pyglibLTLIBRARIES install-pyglibPYTHON - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-libLTLIBRARIES uninstall-pyglibLTLIBRARIES \ - uninstall-pyglibPYTHON - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ - clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ - clean-pyglibLTLIBRARIES cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-pyglibLTLIBRARIES \ - install-pyglibPYTHON install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES \ - uninstall-pyglibLTLIBRARIES uninstall-pyglibPYTHON - - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pyglib_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -check-local: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -clean-local: - rm -f $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) -%$(PYTHON_SO): %.la - $(LN_S) -f .libs/$@ $@ - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/gi/_glib/__init__.py b/gi/_glib/__init__.py deleted file mode 100644 index 0b9df9a..0000000 --- a/gi/_glib/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -# pygobject - Python bindings for the GObject library -# Copyright (C) 2006-2012 Johan Dahlin -# -# glib/__init__.py: initialisation file for glib module -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA - -from . import _glib - -# Internal API -_PyGLib_API = _glib._PyGLib_API diff --git a/gi/_glib/glibmodule.c b/gi/_glib/glibmodule.c deleted file mode 100644 index d08d4fb..0000000 --- a/gi/_glib/glibmodule.c +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; c-set-style: python; c-basic-offset: 4 -*- - * pyglib - Python bindings for GLib toolkit. - * Copyright (C) 1998-2003 James Henstridge - * 2004-2008 Johan Dahlin - * - * glibmodule.c: wrapper for the glib library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include "pyglib.h" -#include "pyglib-private.h" -#include "pygoptioncontext.h" -#include "pygoptiongroup.h" -#include "pygspawn.h" - -/* ---------------- glib module functions -------------------- */ - -static PyMethodDef _glib_functions[] = { - { "spawn_async", - (PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS, - "spawn_async(argv, envp=None, working_directory=None,\n" - " flags=0, child_setup=None, user_data=None,\n" - " standard_input=None, standard_output=None,\n" - " standard_error=None) -> (pid, stdin, stdout, stderr)\n" - "Execute a child program asynchronously within a glib.MainLoop()\n" - "See the reference manual for a complete reference." }, - { NULL, NULL, 0 } -}; - -/* ----------------- glib module initialisation -------------- */ - -static struct _PyGLib_Functions pyglib_api = { - FALSE, /* threads_enabled */ - NULL, /* gerror_exception */ - NULL, /* block_threads */ - NULL, /* unblock_threads */ - NULL, /* pyg_main_context_new */ - pyg_option_context_new, - pyg_option_group_new, -}; - -static void -pyglib_register_api(PyObject *d) -{ - PyObject *o; - - /* for addon libraries ... */ - PyDict_SetItemString(d, "_PyGLib_API", - o=PYGLIB_CPointer_WrapPointer(&pyglib_api,"gi._glib._PyGLib_API")); - Py_DECREF(o); - - pyglib_init_internal(o); -} - -static void -pyglib_register_error(PyObject *d) -{ - PyObject *dict; - PyObject *gerror_class; - dict = PyDict_New(); - /* This is a hack to work around the deprecation warning of - * BaseException.message in Python 2.6+. - * GError has also an "message" attribute. - */ - PyDict_SetItemString(dict, "message", Py_None); - gerror_class = PyErr_NewException("gi._glib.GError", PyExc_RuntimeError, dict); - Py_DECREF(dict); - - PyDict_SetItemString(d, "GError", gerror_class); - pyglib_api.gerror_exception = gerror_class; -} - -PYGLIB_MODULE_START(_glib, "_glib") -{ - PyObject *d = PyModule_GetDict(module); - - pyglib_register_api(d); - pyglib_register_error(d); - pyglib_spawn_register_types(d); - pyglib_option_context_register_types(d); - pyglib_option_group_register_types(d); -} -PYGLIB_MODULE_END diff --git a/gi/_glib/pyglib-private.h b/gi/_glib/pyglib-private.h deleted file mode 100644 index 183184f..0000000 --- a/gi/_glib/pyglib-private.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pyglib - Python bindings for GLib toolkit. - * Copyright (C) 1998-2003 James Henstridge - * 2004-2008 Johan Dahlin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGLIB_PRIVATE_H__ -#define __PYGLIB_PRIVATE_H__ - -#include -#include - -#include - -G_BEGIN_DECLS - -struct _PyGLib_Functions { - gboolean threads_enabled; - PyObject *gerror_exception; - PyGLibThreadBlockFunc block_threads; - PyGLibThreadBlockFunc unblock_threads; - PyObject* (*main_context_new)(GMainContext *context); - PyObject* (*option_context_new)(GOptionContext *context); - PyObject* (*option_group_new)(GOptionGroup *group); -}; - -gboolean _pyglib_handler_marshal(gpointer user_data); -void _pyglib_destroy_notify(gpointer user_data); - -G_END_DECLS - -#endif /* __PYGLIB_PRIVATE_H__ */ - - diff --git a/gi/_glib/pyglib-python-compat.h b/gi/_glib/pyglib-python-compat.h deleted file mode 100644 index 7b4c595..0000000 --- a/gi/_glib/pyglib-python-compat.h +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pyglib - Python bindings for GLib toolkit. - * Copyright (C) 2008 Johan Dahlin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGLIB_PYTHON_COMPAT_H__ -#define __PYGLIB_PYTHON_COMPAT_H__ - -# define PYGLIB_CPointer_Check PyCapsule_CheckExact -# define PYGLIB_CPointer_WrapPointer(ptr, typename) \ - PyCapsule_New(ptr, typename, NULL) -# define PYGLIB_CPointer_GetPointer(obj, typename) \ - PyCapsule_GetPointer(obj, typename) -# define PYGLIB_CPointer_Import(module, symbol) \ - PyCapsule_Import(##module##.##symbol##, FALSE) - -#if PY_VERSION_HEX < 0x03000000 - -#define PYGLIB_INIT_FUNCTION(modname, fullpkgname, functions) \ -static int _pyglib_init_##modname(PyObject *module); \ -void init##modname(void) \ -{ \ - PyObject *module = Py_InitModule(fullpkgname, functions); \ - _pyglib_init_##modname(module); \ -} \ -static int _pyglib_init_##modname(PyObject *module) - -#else - -#define PYGLIB_INIT_FUNCTION(modname, fullpkgname, functions) \ -static struct PyModuleDef _##modname##module = { \ - PyModuleDef_HEAD_INIT, \ - fullpkgname, \ - NULL, \ - -1, \ - functions, \ - NULL, \ - NULL, \ - NULL, \ - NULL \ -}; \ -static int _pyglib_init_##modname(PyObject *module); \ -PyObject *PyInit_##modname(void) \ -{ \ - PyObject *module = PyModule_Create(&_##modname##module); \ - if (module == NULL) \ - return NULL; \ - if (_pyglib_init_##modname(module) != 0 ) {\ - Py_DECREF(module); \ - return NULL; \ - } \ - return module; \ -} \ -static int _pyglib_init_##modname(PyObject *module) - -#endif - -/* Compilation on Python 2.x */ -#if PY_VERSION_HEX < 0x03000000 -#define PYGLIB_MODULE_ERROR_RETURN - -#define RO READONLY - -#define PYGLIB_PyBaseString_Check(ob) (PyString_Check(ob) || PyUnicode_Check(ob)) - -#define PYGLIB_PyUnicode_Check PyString_Check -#define PYGLIB_PyUnicode_AsString PyString_AsString -#define PYGLIB_PyUnicode_AsStringAndSize PyString_AsStringAndSize -#define PYGLIB_PyUnicode_FromString PyString_FromString -#define PYGLIB_PyUnicode_FromStringAndSize PyString_FromStringAndSize -#define PYGLIB_PyUnicode_FromFormat PyString_FromFormat -#define PYGLIB_PyUnicode_AS_STRING PyString_AS_STRING -#define PYGLIB_PyUnicode_GET_SIZE PyString_GET_SIZE -#define PYGLIB_PyUnicode_Type PyString_Type -#define PYGLIB_PyUnicode_InternFromString PyString_InternFromString -#define PYGLIB_PyUnicode_InternInPlace PyString_InternInPlace - -#define PYGLIB_PyBytes_FromString PyString_FromString -#define PYGLIB_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define PYGLIB_PyBytes_Resize _PyString_Resize -#define PYGLIB_PyBytes_AsString PyString_AsString -#define PYGLIB_PyBytes_Size PyString_Size -#define PYGLIB_PyBytes_Check PyString_Check - -#define PYGLIB_PyLong_Check PyInt_Check -#define PYGLIB_PyLong_FromLong PyInt_FromLong -#define PYGLIB_PyLong_FromSsize_t PyInt_FromSsize_t -#define PYGLIB_PyLong_FromSize_t PyInt_FromSize_t -#define PYGLIB_PyLong_AsLong PyInt_AsLong -#define PYGLIB_PyLongObject PyIntObject -#define PYGLIB_PyLong_Type PyInt_Type -#define PYGLIB_PyLong_AS_LONG PyInt_AS_LONG -#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) - -/* Python 2.7 lacks a PyInt_FromUnsignedLong function; use signed longs, and - * rely on PyInt_AsUnsignedLong() to interpret them correctly */ -#define PYGLIB_PyLong_FromUnsignedLong PyInt_FromLong -#define PYGLIB_PyLong_AsUnsignedLong(o) PyInt_AsUnsignedLongMask((PyObject*)(o)) - -#define PYGLIB_PyNumber_Long PyNumber_Int - -#ifndef PyVarObject_HEAD_INIT -#define PyVarObject_HEAD_INIT(base, size) \ - PyObject_HEAD_INIT(base) \ - size, -#endif - -#define PYGLIB_MODULE_START(symbol, modname) \ -DL_EXPORT(void) init##symbol(void); \ -DL_EXPORT(void) init##symbol(void) \ -{ \ - PyObject *module; \ - module = Py_InitModule(modname, symbol##_functions); -#define PYGLIB_MODULE_END } -#define PYGLIB_DEFINE_TYPE(typename, symbol, csymbol) \ -PyTypeObject symbol = { \ - PyObject_HEAD_INIT(NULL) \ - 0, \ - typename, \ - sizeof(csymbol), \ - 0, \ -}; -#define PYGLIB_REGISTER_TYPE(d, type, name) \ - if (!type.tp_alloc) \ - type.tp_alloc = PyType_GenericAlloc; \ - if (!type.tp_new) \ - type.tp_new = PyType_GenericNew; \ - if (PyType_Ready(&type)) \ - return; \ - PyDict_SetItemString(d, name, (PyObject *)&type); - -#else - -#define PYGLIB_MODULE_ERROR_RETURN 0 - -#define PYGLIB_MODULE_START(symbol, modname) \ - static struct PyModuleDef _##symbol##module = { \ - PyModuleDef_HEAD_INIT, \ - modname, \ - NULL, \ - -1, \ - symbol##_functions, \ - NULL, \ - NULL, \ - NULL, \ - NULL \ -}; \ -PyMODINIT_FUNC PyInit_##symbol(void); \ -PyMODINIT_FUNC PyInit_##symbol(void) \ -{ \ - PyObject *module; \ - module = PyModule_Create(&_##symbol##module); -#define PYGLIB_MODULE_END return module; } -#define PYGLIB_DEFINE_TYPE(typename, symbol, csymbol) \ -PyTypeObject symbol = { \ - PyVarObject_HEAD_INIT(NULL, 0) \ - typename, \ - sizeof(csymbol) \ -}; -#define PYGLIB_REGISTER_TYPE(d, type, name) \ - if (!type.tp_alloc) \ - type.tp_alloc = PyType_GenericAlloc; \ - if (!type.tp_new) \ - type.tp_new = PyType_GenericNew; \ - if (PyType_Ready(&type)) \ - return; \ - PyDict_SetItemString(d, name, (PyObject *)&type); - -#define PYGLIB_PyBaseString_Check PyUnicode_Check - -#define PYGLIB_PyUnicode_Check PyUnicode_Check -#define PYGLIB_PyUnicode_AsString _PyUnicode_AsString -#define PYGLIB_PyUnicode_AsStringAndSize(obj, buf, size) \ - (((*(buf) = _PyUnicode_AsStringAndSize(obj, size)) != NULL) ? 0 : -1) -#define PYGLIB_PyUnicode_FromString PyUnicode_FromString -#define PYGLIB_PyUnicode_FromStringAndSize PyUnicode_FromStringAndSize -#define PYGLIB_PyUnicode_FromFormat PyUnicode_FromFormat -#define PYGLIB_PyUnicode_GET_SIZE PyUnicode_GET_SIZE -#define PYGLIB_PyUnicode_Resize PyUnicode_Resize -#define PYGLIB_PyUnicode_Type PyUnicode_Type -#define PYGLIB_PyUnicode_InternFromString PyUnicode_InternFromString -#define PYGLIB_PyUnicode_InternInPlace PyUnicode_InternInPlace - -#define PYGLIB_PyLong_Check PyLong_Check -#define PYGLIB_PyLong_FromLong PyLong_FromLong -#define PYGLIB_PyLong_AsLong PyLong_AsLong -#define PYGLIB_PyLong_AS_LONG(o) PyLong_AS_LONG((PyObject*)(o)) -#define PYGLIB_PyLongObject PyLongObject -#define PYGLIB_PyLong_Type PyLong_Type - -#define PYGLIB_PyLong_FromUnsignedLong PyLong_FromUnsignedLong -#define PYGLIB_PyLong_AsUnsignedLong(o) PyLong_AsUnsignedLongMask((PyObject*)(o)) - -#define PYGLIB_PyBytes_FromString PyBytes_FromString -#define PYGLIB_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define PYGLIB_PyBytes_Resize(o, len) _PyBytes_Resize(o, len) -#define PYGLIB_PyBytes_AsString PyBytes_AsString -#define PYGLIB_PyBytes_Size PyBytes_Size -#define PYGLIB_PyBytes_Check PyBytes_Check - -#define PYGLIB_PyNumber_Long PyNumber_Long - -#endif - -#endif /* __PYGLIB_PYTHON_COMPAT_H__ */ diff --git a/gi/_glib/pyglib.c b/gi/_glib/pyglib.c deleted file mode 100644 index 9753a52..0000000 --- a/gi/_glib/pyglib.c +++ /dev/null @@ -1,475 +0,0 @@ -/* -*- Mode: C; c-set-style: python; c-basic-offset: 4 -*- - * pyglib - Python bindings for GLib toolkit. - * Copyright (C) 1998-2003 James Henstridge - * 2004-2008 Johan Dahlin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include "pyglib.h" -#include "pyglib-private.h" -#include "pygoptioncontext.h" -#include "pygoptiongroup.h" - -static struct _PyGLib_Functions *_PyGLib_API; -static PyObject *exception_table = NULL; - -void -pyglib_init(void) -{ - PyObject *glib, *cobject; - - glib = PyImport_ImportModule("gi._glib"); - if (!glib) { - if (PyErr_Occurred()) { - PyObject *type, *value, *traceback; - PyObject *py_orig_exc; - PyErr_Fetch(&type, &value, &traceback); - py_orig_exc = PyObject_Repr(value); - Py_XDECREF(type); - Py_XDECREF(value); - Py_XDECREF(traceback); - PyErr_Format(PyExc_ImportError, - "could not import gi._glib (error was: %s)", - PYGLIB_PyUnicode_AsString(py_orig_exc)); - Py_DECREF(py_orig_exc); - } else { - PyErr_SetString(PyExc_ImportError, - "could not import gi._glib (no error given)"); - } - return; - } - - cobject = PyObject_GetAttrString(glib, "_PyGLib_API"); - if (cobject && PYGLIB_CPointer_Check(cobject)) - _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(cobject, "gi._glib._PyGLib_API"); - else { - PyErr_SetString(PyExc_ImportError, - "could not import gi._glib (could not find _PyGLib_API object)"); - Py_DECREF(glib); - return; - } -} - -void -pyglib_init_internal(PyObject *api) -{ - _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(api, "gi._glib._PyGLib_API"); -} - -/** - * pyglib_error_marshal: - * @error: a pointer to the GError. - * - * Checks to see if @error has been set. If @error has been set, then a - * GLib.GError Python exception object is returned (but not raised). - * - * Returns: a GLib.GError Python exception object, or NULL. - */ -PyObject * -pyglib_error_marshal (GError **error) -{ - PyGILState_STATE state; - PyObject *exc_type; - PyObject *exc_instance; - PyObject *d; - - g_return_val_if_fail(error != NULL, NULL); - - if (*error == NULL) - return NULL; - - state = pyglib_gil_state_ensure(); - - exc_type = _PyGLib_API->gerror_exception; - if (exception_table != NULL) - { - PyObject *item; - item = PyDict_GetItem(exception_table, PYGLIB_PyLong_FromLong((*error)->domain)); - if (item != NULL) - exc_type = item; - } - - exc_instance = PyObject_CallFunction(exc_type, "z", (*error)->message); - - if ((*error)->domain) { - PyObject_SetAttrString(exc_instance, "domain", - d=PYGLIB_PyUnicode_FromString(g_quark_to_string((*error)->domain))); - Py_DECREF(d); - } - else - PyObject_SetAttrString(exc_instance, "domain", Py_None); - - PyObject_SetAttrString(exc_instance, "code", - d=PYGLIB_PyLong_FromLong((*error)->code)); - Py_DECREF(d); - - if ((*error)->message) { - PyObject_SetAttrString(exc_instance, "message", - d=PYGLIB_PyUnicode_FromString((*error)->message)); - Py_DECREF(d); - } else { - PyObject_SetAttrString(exc_instance, "message", Py_None); - } - - pyglib_gil_state_release(state); - - return exc_instance; -} - -/** - * pyglib_error_check: - * @error: a pointer to the GError. - * - * Checks to see if the GError has been set. If the error has been - * set, then the glib.GError Python exception will be raised, and - * the GError cleared. - * - * Returns: True if an error was set. - */ -gboolean -pyglib_error_check(GError **error) -{ - PyGILState_STATE state; - PyObject *exc_instance; - - g_return_val_if_fail(error != NULL, FALSE); - if (*error == NULL) - return FALSE; - - state = pyglib_gil_state_ensure(); - - exc_instance = pyglib_error_marshal (error); - PyErr_SetObject(_PyGLib_API->gerror_exception, exc_instance); - Py_DECREF(exc_instance); - g_clear_error(error); - - pyglib_gil_state_release(state); - - return TRUE; -} - -/** - * pyglib_gerror_exception_check: - * @error: a standard GLib GError ** output parameter - * - * Checks to see if a GError exception has been raised, and if so - * translates the python exception to a standard GLib GError. If the - * raised exception is not a GError then PyErr_Print() is called. - * - * Returns: 0 if no exception has been raised, -1 if it is a - * valid glib.GError, -2 otherwise. - */ -gboolean -pyglib_gerror_exception_check(GError **error) -{ - PyObject *type, *value, *traceback; - PyObject *py_message, *py_domain, *py_code; - const char *bad_gerror_message; - - PyErr_Fetch(&type, &value, &traceback); - if (type == NULL) - return 0; - PyErr_NormalizeException(&type, &value, &traceback); - if (value == NULL) { - PyErr_Restore(type, value, traceback); - PyErr_Print(); - return -2; - } - if (!value || - !PyErr_GivenExceptionMatches(type, - (PyObject *) _PyGLib_API->gerror_exception)) { - PyErr_Restore(type, value, traceback); - PyErr_Print(); - return -2; - } - Py_DECREF(type); - Py_XDECREF(traceback); - - py_message = PyObject_GetAttrString(value, "message"); - if (!py_message || !PYGLIB_PyUnicode_Check(py_message)) { - bad_gerror_message = "gi._glib.GError instances must have a 'message' string attribute"; - Py_XDECREF(py_message); - goto bad_gerror; - } - - py_domain = PyObject_GetAttrString(value, "domain"); - if (!py_domain || !PYGLIB_PyUnicode_Check(py_domain)) { - bad_gerror_message = "gi._glib.GError instances must have a 'domain' string attribute"; - Py_DECREF(py_message); - Py_XDECREF(py_domain); - goto bad_gerror; - } - - py_code = PyObject_GetAttrString(value, "code"); - if (!py_code || !PYGLIB_PyLong_Check(py_code)) { - bad_gerror_message = "gi._glib.GError instances must have a 'code' int attribute"; - Py_DECREF(py_message); - Py_DECREF(py_domain); - Py_XDECREF(py_code); - goto bad_gerror; - } - - g_set_error(error, g_quark_from_string(PYGLIB_PyUnicode_AsString(py_domain)), - PYGLIB_PyLong_AsLong(py_code), "%s", PYGLIB_PyUnicode_AsString(py_message)); - - Py_DECREF(py_message); - Py_DECREF(py_code); - Py_DECREF(py_domain); - return -1; - -bad_gerror: - Py_DECREF(value); - g_set_error(error, g_quark_from_static_string("pyglib"), 0, "%s", bad_gerror_message); - PyErr_SetString(PyExc_ValueError, bad_gerror_message); - PyErr_Print(); - return -2; -} - -/** - * pyglib_register_exception_for_domain: - * @name: name of the exception - * @error_domain: error domain - * - * Registers a new glib.GError exception subclass called #name for - * a specific #domain. This exception will be raised when a GError - * of the same domain is passed in to pyglib_error_check(). - * - * Returns: the new exception - */ -PyObject * -pyglib_register_exception_for_domain(gchar *name, - gint error_domain) -{ - PyObject *exception; - - exception = PyErr_NewException(name, _PyGLib_API->gerror_exception, NULL); - - if (exception_table == NULL) - exception_table = PyDict_New(); - - PyDict_SetItem(exception_table, - PYGLIB_PyLong_FromLong(error_domain), - exception); - - return exception; -} - -/** - * pyg_option_group_transfer_group: - * @group: a GOptionGroup wrapper - * - * This is used to transfer the GOptionGroup to a GOptionContext. After this - * is called, the calle must handle the release of the GOptionGroup. - * - * When #NULL is returned, the GOptionGroup was already transfered. - * - * Returns: Either #NULL or the wrapped GOptionGroup. - */ -GOptionGroup * -pyglib_option_group_transfer_group(PyObject *obj) -{ - PyGOptionGroup *self = (PyGOptionGroup*)obj; - - if (self->is_in_context) - return NULL; - - self->is_in_context = TRUE; - - /* Here we increase the reference count of the PyGOptionGroup, because now - * the GOptionContext holds an reference to us (it is the userdata passed - * to g_option_group_new(). - * - * The GOptionGroup is freed with the GOptionContext. - * - * We set it here because if we would do this in the init method we would - * hold two references and the PyGOptionGroup would never be freed. - */ - Py_INCREF(self); - - return self->group; -} - -/** - * pyglib_option_group_new: - * @group: a GOptionGroup - * - * The returned GOptionGroup can't be used to set any hooks, translation domains - * or add entries. It's only intend is, to use for GOptionContext.add_group(). - * - * Returns: the GOptionGroup wrapper. - */ -PyObject * -pyglib_option_group_new (GOptionGroup *group) -{ - return _PyGLib_API->option_group_new(group); -} - -/** - * pyglib_option_context_new: - * @context: a GOptionContext - * - * Returns: A new GOptionContext wrapper. - */ -PyObject * -pyglib_option_context_new (GOptionContext *context) -{ - return _PyGLib_API->option_context_new(context); -} - - -/****** Private *****/ - -/** - * _pyglib_destroy_notify: - * @user_data: a PyObject pointer. - * - * A function that can be used as a GDestroyNotify callback that will - * call Py_DECREF on the data. - */ -void -_pyglib_destroy_notify(gpointer user_data) -{ - PyObject *obj = (PyObject *)user_data; - PyGILState_STATE state; - - g_return_if_fail (_PyGLib_API != NULL); - - state = pyglib_gil_state_ensure(); - Py_DECREF(obj); - pyglib_gil_state_release(state); -} - -gboolean -_pyglib_handler_marshal(gpointer user_data) -{ - PyObject *tuple, *ret; - gboolean res; - PyGILState_STATE state; - - g_return_val_if_fail(user_data != NULL, FALSE); - - state = pyglib_gil_state_ensure(); - - tuple = (PyObject *)user_data; - ret = PyObject_CallObject(PyTuple_GetItem(tuple, 0), - PyTuple_GetItem(tuple, 1)); - if (!ret) { - PyErr_Print(); - res = FALSE; - } else { - res = PyObject_IsTrue(ret); - Py_DECREF(ret); - } - - pyglib_gil_state_release(state); - - return res; -} - -PyObject* -_pyglib_generic_ptr_richcompare(void* a, void *b, int op) -{ - PyObject *res; - - switch (op) { - - case Py_EQ: - res = (a == b) ? Py_True : Py_False; - break; - - case Py_NE: - res = (a != b) ? Py_True : Py_False; - break; - - case Py_LT: - res = (a < b) ? Py_True : Py_False; - break; - - case Py_LE: - res = (a <= b) ? Py_True : Py_False; - break; - - case Py_GT: - res = (a > b) ? Py_True : Py_False; - break; - - case Py_GE: - res = (a >= b) ? Py_True : Py_False; - break; - - default: - res = Py_NotImplemented; - break; - } - - Py_INCREF(res); - return res; -} - -PyObject* -_pyglib_generic_long_richcompare(long a, long b, int op) -{ - PyObject *res; - - switch (op) { - - case Py_EQ: - res = (a == b) ? Py_True : Py_False; - Py_INCREF(res); - break; - - case Py_NE: - res = (a != b) ? Py_True : Py_False; - Py_INCREF(res); - break; - - - case Py_LT: - res = (a < b) ? Py_True : Py_False; - Py_INCREF(res); - break; - - case Py_LE: - res = (a <= b) ? Py_True : Py_False; - Py_INCREF(res); - break; - - case Py_GT: - res = (a > b) ? Py_True : Py_False; - Py_INCREF(res); - break; - - case Py_GE: - res = (a >= b) ? Py_True : Py_False; - Py_INCREF(res); - break; - - default: - res = Py_NotImplemented; - Py_INCREF(res); - break; - } - - return res; -} - diff --git a/gi/_glib/pyglib.h b/gi/_glib/pyglib.h deleted file mode 100644 index 1c62f1d..0000000 --- a/gi/_glib/pyglib.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pyglib - Python bindings for GLib toolkit. - * Copyright (C) 1998-2003 James Henstridge - * 2004-2008 Johan Dahlin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGLIB_H__ -#define __PYGLIB_H__ - -#include - -#include - -G_BEGIN_DECLS - -typedef void (*PyGLibThreadsEnabledFunc) (void); -typedef void (*PyGLibThreadBlockFunc) (void); - -void pyglib_init(void); -void pyglib_init_internal(PyObject *api); - -#ifdef DISABLE_THREADING -# define pyglib_gil_state_ensure() PyGILState_LOCKED -# define pyglib_gil_state_release(state) state -#else -# define pyglib_gil_state_ensure PyGILState_Ensure -# define pyglib_gil_state_release PyGILState_Release -#endif - -/* Deprecated, only available for API compatibility. */ -#define pyg_set_thread_block_funcs(a, b) -#define pyglib_block_threads() -#define pyglib_unblock_threads() - -gboolean pyglib_error_check(GError **error); -PyObject *pyglib_error_marshal (GError **error); -gboolean pyglib_gerror_exception_check(GError **error); -PyObject *pyglib_register_exception_for_domain(gchar *name, - gint error_domain); -PyObject * pyglib_option_context_new(GOptionContext *context); -PyObject * pyglib_option_group_new(GOptionGroup *group); -GOptionGroup * pyglib_option_group_transfer_group(PyObject *self); - -/* Private: for gobject <-> glib interaction only. */ -PyObject* _pyglib_generic_ptr_richcompare(void* a, void *b, int op); -PyObject* _pyglib_generic_long_richcompare(long a, long b, int op); - - -#define PYGLIB_REGISTER_TYPE(d, type, name) \ - if (!type.tp_alloc) \ - type.tp_alloc = PyType_GenericAlloc; \ - if (!type.tp_new) \ - type.tp_new = PyType_GenericNew; \ - if (PyType_Ready(&type)) \ - return; \ - PyDict_SetItemString(d, name, (PyObject *)&type); - - -G_END_DECLS - -#endif /* __PYGLIB_H__ */ - diff --git a/gi/_gobject/Makefile.am b/gi/_gobject/Makefile.am deleted file mode 100644 index 5059ea7..0000000 --- a/gi/_gobject/Makefile.am +++ /dev/null @@ -1,87 +0,0 @@ -AUTOMAKE_OPTIONS = 1.7 -PLATFORM_VERSION = 3.0 - -pkgincludedir = $(includedir)/pygobject-$(PLATFORM_VERSION) -pkginclude_HEADERS = pygobject.h - -extension_cppflags = \ - $(PYTHON_INCLUDES) \ - -DPY_SSIZE_T_CLEAN - -extension_ldflags = \ - -module \ - -avoid-version \ - -shrext $(PYTHON_SO) - -if OS_WIN32 -# Windows requires Python modules to be explicitly linked to libpython. -# Extension modules are shared libaries (.dll), but need to be -# called .pyd for Python to load it as an extension module. -extension_libadd = \ - $(PYTHON_LIBS) - -extension_ldflags += \ - -no-undefined -endif - -pygobjectdir = $(pyexecdir)/gi/_gobject - -pygobject_PYTHON = \ - __init__.py \ - constants.py \ - propertyhelper.py \ - signalhelper.py - -pygobject_LTLIBRARIES = _gobject.la - -_gobject_la_SOURCES = \ - gobjectmodule.c \ - pygboxed.c \ - pygboxed.h \ - pygenum.c \ - pygenum.h \ - pygflags.c \ - pygflags.h \ - pyginterface.c \ - pyginterface.h \ - pygobject.c \ - pygobject.h \ - pygobject-private.h \ - pygparamspec.c \ - pygparamspec.h \ - pygpointer.c \ - pygpointer.h \ - pygtype.c \ - pygtype.h -_gobject_la_CFLAGS = \ - $(extension_cppflags) \ - -I$(top_srcdir)/gi/_glib \ - -I$(top_srcdir)/gi \ - $(GLIB_CFLAGS) \ - $(GI_CFLAGS) -_gi_la_CPPFLAGS = \ - $(extension_cppflags) -_gobject_la_LIBADD = \ - $(extension_libadd) \ - $(GLIB_LIBS) \ - $(GI_LIBS) \ - $(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la -_gobject_la_LDFLAGS = \ - $(extension_ldflags) \ - -export-symbols-regex "_gobject|PyInit__gobject" - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygobject_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - - -all: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -check-local: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -clean-local: - rm -f $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) -%$(PYTHON_SO): %.la - $(LN_S) -f .libs/$@ $@ diff --git a/gi/_gobject/Makefile.in b/gi/_gobject/Makefile.in deleted file mode 100644 index b057108..0000000 --- a/gi/_gobject/Makefile.in +++ /dev/null @@ -1,923 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@OS_WIN32_TRUE@am__append_1 = \ -@OS_WIN32_TRUE@ -no-undefined - -subdir = gi/_gobject -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp $(pygobject_PYTHON) \ - $(top_srcdir)/py-compile $(pkginclude_HEADERS) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(pygobjectdir)" \ - "$(DESTDIR)$(pygobjectdir)" "$(DESTDIR)$(pkgincludedir)" -LTLIBRARIES = $(pygobject_LTLIBRARIES) -am__DEPENDENCIES_1 = -@OS_WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -_gobject_la_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) \ - $(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la -am__gobject_la_OBJECTS = _gobject_la-gobjectmodule.lo \ - _gobject_la-pygboxed.lo _gobject_la-pygenum.lo \ - _gobject_la-pygflags.lo _gobject_la-pyginterface.lo \ - _gobject_la-pygobject.lo _gobject_la-pygparamspec.lo \ - _gobject_la-pygpointer.lo _gobject_la-pygtype.lo -_gobject_la_OBJECTS = $(am__gobject_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -_gobject_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gobject_la_CFLAGS) \ - $(CFLAGS) $(_gobject_la_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(_gobject_la_SOURCES) -DIST_SOURCES = $(_gobject_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) -am__pep3147_tweak = \ - sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' -py_compile = $(top_srcdir)/py-compile -HEADERS = $(pkginclude_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -pkgincludedir = $(includedir)/pygobject-$(PLATFORM_VERSION) -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = 1.7 -PLATFORM_VERSION = 3.0 -pkginclude_HEADERS = pygobject.h -extension_cppflags = \ - $(PYTHON_INCLUDES) \ - -DPY_SSIZE_T_CLEAN - -extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \ - $(am__append_1) - -# Windows requires Python modules to be explicitly linked to libpython. -# Extension modules are shared libaries (.dll), but need to be -# called .pyd for Python to load it as an extension module. -@OS_WIN32_TRUE@extension_libadd = \ -@OS_WIN32_TRUE@ $(PYTHON_LIBS) - -pygobjectdir = $(pyexecdir)/gi/_gobject -pygobject_PYTHON = \ - __init__.py \ - constants.py \ - propertyhelper.py \ - signalhelper.py - -pygobject_LTLIBRARIES = _gobject.la -_gobject_la_SOURCES = \ - gobjectmodule.c \ - pygboxed.c \ - pygboxed.h \ - pygenum.c \ - pygenum.h \ - pygflags.c \ - pygflags.h \ - pyginterface.c \ - pyginterface.h \ - pygobject.c \ - pygobject.h \ - pygobject-private.h \ - pygparamspec.c \ - pygparamspec.h \ - pygpointer.c \ - pygpointer.h \ - pygtype.c \ - pygtype.h - -_gobject_la_CFLAGS = \ - $(extension_cppflags) \ - -I$(top_srcdir)/gi/_glib \ - -I$(top_srcdir)/gi \ - $(GLIB_CFLAGS) \ - $(GI_CFLAGS) - -_gi_la_CPPFLAGS = \ - $(extension_cppflags) - -_gobject_la_LIBADD = \ - $(extension_libadd) \ - $(GLIB_LIBS) \ - $(GI_LIBS) \ - $(top_builddir)/gi/_glib/libpyglib-gi-2.0-@PYTHON_BASENAME@.la - -_gobject_la_LDFLAGS = \ - $(extension_ldflags) \ - -export-symbols-regex "_gobject|PyInit__gobject" - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gi/_gobject/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign gi/_gobject/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -install-pygobjectLTLIBRARIES: $(pygobject_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(pygobject_LTLIBRARIES)'; test -n "$(pygobjectdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(pygobjectdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pygobjectdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pygobjectdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pygobjectdir)"; \ - } - -uninstall-pygobjectLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(pygobject_LTLIBRARIES)'; test -n "$(pygobjectdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pygobjectdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pygobjectdir)/$$f"; \ - done - -clean-pygobjectLTLIBRARIES: - -test -z "$(pygobject_LTLIBRARIES)" || rm -f $(pygobject_LTLIBRARIES) - @list='$(pygobject_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -_gobject.la: $(_gobject_la_OBJECTS) $(_gobject_la_DEPENDENCIES) $(EXTRA__gobject_la_DEPENDENCIES) - $(AM_V_CCLD)$(_gobject_la_LINK) -rpath $(pygobjectdir) $(_gobject_la_OBJECTS) $(_gobject_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-gobjectmodule.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-pygboxed.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-pygenum.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-pygflags.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-pyginterface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-pygobject.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-pygparamspec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-pygpointer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gobject_la-pygtype.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -_gobject_la-gobjectmodule.lo: gobjectmodule.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-gobjectmodule.lo -MD -MP -MF $(DEPDIR)/_gobject_la-gobjectmodule.Tpo -c -o _gobject_la-gobjectmodule.lo `test -f 'gobjectmodule.c' || echo '$(srcdir)/'`gobjectmodule.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-gobjectmodule.Tpo $(DEPDIR)/_gobject_la-gobjectmodule.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gobjectmodule.c' object='_gobject_la-gobjectmodule.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-gobjectmodule.lo `test -f 'gobjectmodule.c' || echo '$(srcdir)/'`gobjectmodule.c - -_gobject_la-pygboxed.lo: pygboxed.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-pygboxed.lo -MD -MP -MF $(DEPDIR)/_gobject_la-pygboxed.Tpo -c -o _gobject_la-pygboxed.lo `test -f 'pygboxed.c' || echo '$(srcdir)/'`pygboxed.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-pygboxed.Tpo $(DEPDIR)/_gobject_la-pygboxed.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygboxed.c' object='_gobject_la-pygboxed.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-pygboxed.lo `test -f 'pygboxed.c' || echo '$(srcdir)/'`pygboxed.c - -_gobject_la-pygenum.lo: pygenum.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-pygenum.lo -MD -MP -MF $(DEPDIR)/_gobject_la-pygenum.Tpo -c -o _gobject_la-pygenum.lo `test -f 'pygenum.c' || echo '$(srcdir)/'`pygenum.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-pygenum.Tpo $(DEPDIR)/_gobject_la-pygenum.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygenum.c' object='_gobject_la-pygenum.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-pygenum.lo `test -f 'pygenum.c' || echo '$(srcdir)/'`pygenum.c - -_gobject_la-pygflags.lo: pygflags.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-pygflags.lo -MD -MP -MF $(DEPDIR)/_gobject_la-pygflags.Tpo -c -o _gobject_la-pygflags.lo `test -f 'pygflags.c' || echo '$(srcdir)/'`pygflags.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-pygflags.Tpo $(DEPDIR)/_gobject_la-pygflags.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygflags.c' object='_gobject_la-pygflags.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-pygflags.lo `test -f 'pygflags.c' || echo '$(srcdir)/'`pygflags.c - -_gobject_la-pyginterface.lo: pyginterface.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-pyginterface.lo -MD -MP -MF $(DEPDIR)/_gobject_la-pyginterface.Tpo -c -o _gobject_la-pyginterface.lo `test -f 'pyginterface.c' || echo '$(srcdir)/'`pyginterface.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-pyginterface.Tpo $(DEPDIR)/_gobject_la-pyginterface.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pyginterface.c' object='_gobject_la-pyginterface.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-pyginterface.lo `test -f 'pyginterface.c' || echo '$(srcdir)/'`pyginterface.c - -_gobject_la-pygobject.lo: pygobject.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-pygobject.lo -MD -MP -MF $(DEPDIR)/_gobject_la-pygobject.Tpo -c -o _gobject_la-pygobject.lo `test -f 'pygobject.c' || echo '$(srcdir)/'`pygobject.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-pygobject.Tpo $(DEPDIR)/_gobject_la-pygobject.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygobject.c' object='_gobject_la-pygobject.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-pygobject.lo `test -f 'pygobject.c' || echo '$(srcdir)/'`pygobject.c - -_gobject_la-pygparamspec.lo: pygparamspec.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-pygparamspec.lo -MD -MP -MF $(DEPDIR)/_gobject_la-pygparamspec.Tpo -c -o _gobject_la-pygparamspec.lo `test -f 'pygparamspec.c' || echo '$(srcdir)/'`pygparamspec.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-pygparamspec.Tpo $(DEPDIR)/_gobject_la-pygparamspec.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygparamspec.c' object='_gobject_la-pygparamspec.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-pygparamspec.lo `test -f 'pygparamspec.c' || echo '$(srcdir)/'`pygparamspec.c - -_gobject_la-pygpointer.lo: pygpointer.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-pygpointer.lo -MD -MP -MF $(DEPDIR)/_gobject_la-pygpointer.Tpo -c -o _gobject_la-pygpointer.lo `test -f 'pygpointer.c' || echo '$(srcdir)/'`pygpointer.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-pygpointer.Tpo $(DEPDIR)/_gobject_la-pygpointer.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygpointer.c' object='_gobject_la-pygpointer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-pygpointer.lo `test -f 'pygpointer.c' || echo '$(srcdir)/'`pygpointer.c - -_gobject_la-pygtype.lo: pygtype.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-pygtype.lo -MD -MP -MF $(DEPDIR)/_gobject_la-pygtype.Tpo -c -o _gobject_la-pygtype.lo `test -f 'pygtype.c' || echo '$(srcdir)/'`pygtype.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_gobject_la-pygtype.Tpo $(DEPDIR)/_gobject_la-pygtype.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pygtype.c' object='_gobject_la-pygtype.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-pygtype.lo `test -f 'pygtype.c' || echo '$(srcdir)/'`pygtype.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-pygobjectPYTHON: $(pygobject_PYTHON) - @$(NORMAL_INSTALL) - @list='$(pygobject_PYTHON)'; dlist=; list2=; test -n "$(pygobjectdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pygobjectdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pygobjectdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ - if test -f $$b$$p; then \ - $(am__strip_dir) \ - dlist="$$dlist $$f"; \ - list2="$$list2 $$b$$p"; \ - else :; fi; \ - done; \ - for file in $$list2; do echo $$file; done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pygobjectdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pygobjectdir)" || exit $$?; \ - done || exit $$?; \ - if test -n "$$dlist"; then \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygobjectdir)" $$dlist; \ - else :; fi - -uninstall-pygobjectPYTHON: - @$(NORMAL_UNINSTALL) - @list='$(pygobject_PYTHON)'; test -n "$(pygobjectdir)" || list=; \ - py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$py_files" || exit 0; \ - dir='$(DESTDIR)$(pygobjectdir)'; \ - pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ - pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ - py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ - echo "$$py_files_pep3147";\ - pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ - pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ - st=0; \ - for files in \ - "$$py_files" \ - "$$pyc_files" \ - "$$pyo_files" \ - "$$pyc_files_pep3147" \ - "$$pyo_files_pep3147" \ - ; do \ - $(am__uninstall_files_from_dir) || st=$$?; \ - done; \ - exit $$st -install-pkgincludeHEADERS: $(pkginclude_HEADERS) - @$(NORMAL_INSTALL) - @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ - done - -uninstall-pkgincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(pygobjectdir)" "$(DESTDIR)$(pygobjectdir)" "$(DESTDIR)$(pkgincludedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local \ - clean-pygobjectLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-pkgincludeHEADERS \ - install-pygobjectLTLIBRARIES install-pygobjectPYTHON - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-pkgincludeHEADERS \ - uninstall-pygobjectLTLIBRARIES uninstall-pygobjectPYTHON - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ - clean-generic clean-libtool clean-local \ - clean-pygobjectLTLIBRARIES cscopelist-am ctags ctags-am \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-pkgincludeHEADERS install-ps install-ps-am \ - install-pygobjectLTLIBRARIES install-pygobjectPYTHON \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-pkgincludeHEADERS uninstall-pygobjectLTLIBRARIES \ - uninstall-pygobjectPYTHON - - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygobject_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -check-local: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks -clean-local: - rm -f $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) -%$(PYTHON_SO): %.la - $(LN_S) -f .libs/$@ $@ - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/gi/_gobject/__init__.py b/gi/_gobject/__init__.py deleted file mode 100644 index d3ea0e0..0000000 --- a/gi/_gobject/__init__.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -# pygobject - Python bindings for the GObject library -# Copyright (C) 2006-2012 Johan Dahlin -# -# gobject/__init__.py: initialisation file for gobject module -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA - -# this can go when things are a little further along - -import sys - -# we can't have pygobject 2 loaded at the same time we load the internal _gobject -if 'gobject' in sys.modules: - raise ImportError('When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".') - -from . import _gobject -from . import propertyhelper -from . import signalhelper - -GObject = _gobject.GObject -GType = _gobject.GType -_PyGObject_API = _gobject._PyGObject_API -pygobject_version = _gobject.pygobject_version - - -class GObjectMeta(type): - "Metaclass for automatically registering GObject classes" - def __init__(cls, name, bases, dict_): - type.__init__(cls, name, bases, dict_) - propertyhelper.install_properties(cls) - signalhelper.install_signals(cls) - cls._type_register(cls.__dict__) - - def _type_register(cls, namespace): - ## don't register the class if already registered - if '__gtype__' in namespace: - return - - # Do not register a new GType for the overrides, as this would sort of - # defeat the purpose of overrides... - if cls.__module__.startswith('gi.overrides.'): - return - - _gobject.type_register(cls, namespace.get('__gtype_name__')) - -_gobject._install_metaclass(GObjectMeta) diff --git a/gi/_gobject/constants.py b/gi/_gobject/constants.py deleted file mode 100644 index 9565a66..0000000 --- a/gi/_gobject/constants.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -# pygobject - Python bindings for the GObject library -# Copyright (C) 2006-2007 Johan Dahlin -# -# gobject/constants.py: GObject type constants -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA - -from . import _gobject - -TYPE_INVALID = _gobject.TYPE_INVALID -TYPE_NONE = _gobject.type_from_name('void') -TYPE_INTERFACE = _gobject.type_from_name('GInterface') -TYPE_CHAR = _gobject.type_from_name('gchar') -TYPE_UCHAR = _gobject.type_from_name('guchar') -TYPE_BOOLEAN = _gobject.type_from_name('gboolean') -TYPE_INT = _gobject.type_from_name('gint') -TYPE_UINT = _gobject.type_from_name('guint') -TYPE_LONG = _gobject.type_from_name('glong') -TYPE_ULONG = _gobject.type_from_name('gulong') -TYPE_INT64 = _gobject.type_from_name('gint64') -TYPE_UINT64 = _gobject.type_from_name('guint64') -TYPE_ENUM = _gobject.type_from_name('GEnum') -TYPE_FLAGS = _gobject.type_from_name('GFlags') -TYPE_FLOAT = _gobject.type_from_name('gfloat') -TYPE_DOUBLE = _gobject.type_from_name('gdouble') -TYPE_STRING = _gobject.type_from_name('gchararray') -TYPE_POINTER = _gobject.type_from_name('gpointer') -TYPE_BOXED = _gobject.type_from_name('GBoxed') -TYPE_PARAM = _gobject.type_from_name('GParam') -TYPE_OBJECT = _gobject.type_from_name('GObject') -TYPE_PYOBJECT = _gobject.type_from_name('PyObject') -TYPE_GTYPE = _gobject.type_from_name('GType') -TYPE_STRV = _gobject.type_from_name('GStrv') -TYPE_VARIANT = _gobject.type_from_name('GVariant') -TYPE_UNICHAR = TYPE_UINT diff --git a/gi/_gobject/gobjectmodule.c b/gi/_gobject/gobjectmodule.c deleted file mode 100644 index ac37904..0000000 --- a/gi/_gobject/gobjectmodule.c +++ /dev/null @@ -1,2220 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pygtk- Python bindings for the GTK toolkit. - * Copyright (C) 1998-2003 James Henstridge - * - * gobjectmodule.c: wrapper for the gobject library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include "pygobject-private.h" -#include "pygboxed.h" -#include "pygenum.h" -#include "pygflags.h" -#include "pyginterface.h" -#include "pygparamspec.h" -#include "pygpointer.h" -#include "pygtype.h" - -static GHashTable *log_handlers = NULL; -static gboolean log_handlers_disabled = FALSE; - -static void pyg_flags_add_constants(PyObject *module, GType flags_type, - const gchar *strip_prefix); - - -/* -------------- GDK threading hooks ---------------------------- */ - -/** - * pyg_set_thread_block_funcs: - * Deprecated, only available for ABI compatibility. - */ -static void -_pyg_set_thread_block_funcs (PyGThreadBlockFunc block_threads_func, - PyGThreadBlockFunc unblock_threads_func) -{ - PyGILState_STATE state = pyglib_gil_state_ensure (); - PyErr_Warn (PyExc_DeprecationWarning, - "Using pyg_set_thread_block_funcs is not longer needed. " - "PyGObject always uses Py_BLOCK/UNBLOCK_THREADS."); - pyglib_gil_state_release (state); -} - -/** - * pyg_destroy_notify: - * @user_data: a PyObject pointer. - * - * A function that can be used as a GDestroyNotify callback that will - * call Py_DECREF on the data. - */ -void -pyg_destroy_notify(gpointer user_data) -{ - PyObject *obj = (PyObject *)user_data; - PyGILState_STATE state; - - state = pyglib_gil_state_ensure(); - Py_DECREF(obj); - pyglib_gil_state_release(state); -} - - -/* ---------------- gobject module functions -------------------- */ - -static PyObject * -pyg_type_name (PyObject *self, PyObject *args) -{ - PyObject *gtype; - GType type; - const gchar *name; - -#if 0 - if (PyErr_Warn(PyExc_DeprecationWarning, - "gobject.type_name is deprecated; " - "use GType.name instead")) - return NULL; -#endif - - if (!PyArg_ParseTuple(args, "O:gobject.type_name", >ype)) - return NULL; - if ((type = pyg_type_from_object(gtype)) == 0) - return NULL; - name = g_type_name(type); - if (name) - return PYGLIB_PyUnicode_FromString(name); - PyErr_SetString(PyExc_RuntimeError, "unknown typecode"); - return NULL; -} - -static PyObject * -pyg_type_from_name (PyObject *self, PyObject *args) -{ - const gchar *name; - GType type; - PyObject *repr = NULL; -#if 0 - if (PyErr_Warn(PyExc_DeprecationWarning, - "gobject.type_from_name is deprecated; " - "use GType.from_name instead")) - return NULL; -#endif - if (!PyArg_ParseTuple(args, "s:gobject.type_from_name", &name)) - return NULL; - type = g_type_from_name(name); - if (type != 0) - return pyg_type_wrapper_new(type); - repr = PyObject_Repr((PyObject*)self); - PyErr_Format(PyExc_RuntimeError, "%s: unknown type name: %s", - PYGLIB_PyUnicode_AsString(repr), - name); - Py_DECREF(repr); - return NULL; -} - -static PyObject * -pyg_type_is_a (PyObject *self, PyObject *args) -{ - PyObject *gtype, *gparent; - GType type, parent; -#if 0 - if (PyErr_Warn(PyExc_DeprecationWarning, - "gobject.type_is_a is deprecated; " - "use GType.is_a instead")) - return NULL; -#endif - if (!PyArg_ParseTuple(args, "OO:gobject.type_is_a", >ype, &gparent)) - return NULL; - if ((type = pyg_type_from_object(gtype)) == 0) - return NULL; - if ((parent = pyg_type_from_object(gparent)) == 0) - return NULL; - return PyBool_FromLong(g_type_is_a(type, parent)); -} - -static void -pyg_object_set_property (GObject *object, guint property_id, - const GValue *value, GParamSpec *pspec) -{ - PyObject *object_wrapper, *retval; - PyObject *py_pspec, *py_value; - PyGILState_STATE state; - - state = pyglib_gil_state_ensure(); - - object_wrapper = pygobject_new(object); - - if (object_wrapper == NULL) { - pyglib_gil_state_release(state); - return; - } - - py_pspec = pyg_param_spec_new(pspec); - py_value = pyg_value_as_pyobject (value, TRUE); - - retval = PyObject_CallMethod(object_wrapper, "do_set_property", - "OO", py_pspec, py_value); - if (retval) { - Py_DECREF(retval); - } else { - PyErr_Print(); - } - - Py_DECREF(object_wrapper); - Py_DECREF(py_pspec); - Py_DECREF(py_value); - - pyglib_gil_state_release(state); -} - -static void -pyg_object_get_property (GObject *object, guint property_id, - GValue *value, GParamSpec *pspec) -{ - PyObject *object_wrapper, *retval; - PyObject *py_pspec; - PyGILState_STATE state; - - state = pyglib_gil_state_ensure(); - - object_wrapper = pygobject_new(object); - - if (object_wrapper == NULL) { - pyglib_gil_state_release(state); - return; - } - - py_pspec = pyg_param_spec_new(pspec); - retval = PyObject_CallMethod(object_wrapper, "do_get_property", - "O", py_pspec); - if (retval == NULL || pyg_value_from_pyobject(value, retval) < 0) { - PyErr_Print(); - } - Py_DECREF(object_wrapper); - Py_DECREF(py_pspec); - Py_XDECREF(retval); - - pyglib_gil_state_release(state); -} - -typedef struct _PyGSignalAccumulatorData { - PyObject *callable; - PyObject *user_data; -} PyGSignalAccumulatorData; - -static gboolean -_pyg_signal_accumulator(GSignalInvocationHint *ihint, - GValue *return_accu, - const GValue *handler_return, - gpointer _data) -{ - PyObject *py_ihint, *py_return_accu, *py_handler_return, *py_detail; - PyObject *py_retval; - gboolean retval = FALSE; - PyGSignalAccumulatorData *data = _data; - PyGILState_STATE state; - - state = pyglib_gil_state_ensure(); - if (ihint->detail) - py_detail = PYGLIB_PyUnicode_FromString(g_quark_to_string(ihint->detail)); - else { - Py_INCREF(Py_None); - py_detail = Py_None; - } - - py_ihint = Py_BuildValue("lNi", (long int) ihint->signal_id, - py_detail, ihint->run_type); - py_handler_return = pyg_value_as_pyobject(handler_return, TRUE); - py_return_accu = pyg_value_as_pyobject(return_accu, FALSE); - if (data->user_data) - py_retval = PyObject_CallFunction(data->callable, "NNNO", py_ihint, - py_return_accu, py_handler_return, - data->user_data); - else - py_retval = PyObject_CallFunction(data->callable, "NNN", py_ihint, - py_return_accu, py_handler_return); - if (!py_retval) - PyErr_Print(); - else { - if (!PyTuple_Check(py_retval) || PyTuple_Size(py_retval) != 2) { - PyErr_SetString(PyExc_TypeError, "accumulator function must return" - " a (bool, object) tuple"); - PyErr_Print(); - } else { - retval = PyObject_IsTrue(PyTuple_GET_ITEM(py_retval, 0)); - if (pyg_value_from_pyobject(return_accu, PyTuple_GET_ITEM(py_retval, 1))) { - PyErr_Print(); - } - } - Py_DECREF(py_retval); - } - pyglib_gil_state_release(state); - return retval; -} - -static gboolean -create_signal (GType instance_type, const gchar *signal_name, PyObject *tuple) -{ - GSignalFlags signal_flags; - PyObject *py_return_type, *py_param_types; - GType return_type; - guint n_params, i; - GType *param_types; - guint signal_id; - GSignalAccumulator accumulator = NULL; - PyGSignalAccumulatorData *accum_data = NULL; - PyObject *py_accum = NULL, *py_accum_data = NULL; - - if (!PyArg_ParseTuple(tuple, "iOO|OO", &signal_flags, &py_return_type, - &py_param_types, &py_accum, &py_accum_data)) - { - gchar buf[128]; - - PyErr_Clear(); - g_snprintf(buf, sizeof(buf), - "value for __gsignals__['%s'] not in correct format", signal_name); - PyErr_SetString(PyExc_TypeError, buf); - return FALSE; - } - - if (py_accum && py_accum != Py_None && !PyCallable_Check(py_accum)) - { - gchar buf[128]; - - g_snprintf(buf, sizeof(buf), - "accumulator for __gsignals__['%s'] must be callable", signal_name); - PyErr_SetString(PyExc_TypeError, buf); - return FALSE; - } - - return_type = pyg_type_from_object(py_return_type); - if (!return_type) - return FALSE; - if (!PySequence_Check(py_param_types)) { - gchar buf[128]; - - g_snprintf(buf, sizeof(buf), - "third element of __gsignals__['%s'] tuple must be a sequence", signal_name); - PyErr_SetString(PyExc_TypeError, buf); - return FALSE; - } - n_params = PySequence_Length(py_param_types); - param_types = g_new(GType, n_params); - for (i = 0; i < n_params; i++) { - PyObject *item = PySequence_GetItem(py_param_types, i); - - param_types[i] = pyg_type_from_object(item); - if (param_types[i] == 0) { - Py_DECREF(item); - g_free(param_types); - return FALSE; - } - Py_DECREF(item); - } - - if (py_accum != NULL && py_accum != Py_None) { - accum_data = g_new(PyGSignalAccumulatorData, 1); - accum_data->callable = py_accum; - Py_INCREF(py_accum); - accum_data->user_data = py_accum_data; - Py_XINCREF(py_accum_data); - accumulator = _pyg_signal_accumulator; - } - - signal_id = g_signal_newv(signal_name, instance_type, signal_flags, - pyg_signal_class_closure_get(), - accumulator, accum_data, - gi_cclosure_marshal_generic, - return_type, n_params, param_types); - g_free(param_types); - - if (signal_id == 0) { - gchar buf[128]; - - g_snprintf(buf, sizeof(buf), "could not create signal for %s", - signal_name); - PyErr_SetString(PyExc_RuntimeError, buf); - return FALSE; - } - return TRUE; -} - -static gboolean -override_signal(GType instance_type, const gchar *signal_name) -{ - guint signal_id; - - signal_id = g_signal_lookup(signal_name, instance_type); - if (!signal_id) { - gchar buf[128]; - - g_snprintf(buf, sizeof(buf), "could not look up %s", signal_name); - PyErr_SetString(PyExc_TypeError, buf); - return FALSE; - } - g_signal_override_class_closure(signal_id, instance_type, - pyg_signal_class_closure_get()); - return TRUE; -} - -static PyObject * -add_signals (GObjectClass *klass, PyObject *signals) -{ - gboolean ret = TRUE; - Py_ssize_t pos = 0; - PyObject *key, *value, *overridden_signals = NULL; - GType instance_type = G_OBJECT_CLASS_TYPE (klass); - - overridden_signals = PyDict_New(); - while (PyDict_Next(signals, &pos, &key, &value)) { - const gchar *signal_name; - gchar *signal_name_canon, *c; - - if (!PYGLIB_PyUnicode_Check(key)) { - PyErr_SetString(PyExc_TypeError, - "__gsignals__ keys must be strings"); - ret = FALSE; - break; - } - signal_name = PYGLIB_PyUnicode_AsString (key); - - if (value == Py_None || - (PYGLIB_PyUnicode_Check(value) && - !strcmp(PYGLIB_PyUnicode_AsString(value), "override"))) - { - /* canonicalize signal name, replacing '-' with '_' */ - signal_name_canon = g_strdup(signal_name); - for (c = signal_name_canon; *c; ++c) - if (*c == '-') - *c = '_'; - if (PyDict_SetItemString(overridden_signals, - signal_name_canon, key)) { - g_free(signal_name_canon); - ret = FALSE; - break; - } - g_free(signal_name_canon); - - ret = override_signal(instance_type, signal_name); - } else { - ret = create_signal(instance_type, signal_name, value); - } - - if (!ret) - break; - } - if (ret) - return overridden_signals; - else { - Py_XDECREF(overridden_signals); - return NULL; - } -} - -static GParamSpec * -create_property (const gchar *prop_name, - GType prop_type, - const gchar *nick, - const gchar *blurb, - PyObject *args, - GParamFlags flags) -{ - GParamSpec *pspec = NULL; - - switch (G_TYPE_FUNDAMENTAL(prop_type)) { - case G_TYPE_CHAR: - { - gchar minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "ccc", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_char (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_UCHAR: - { - gchar minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "ccc", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_uchar (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_BOOLEAN: - { - gboolean default_value; - - if (!PyArg_ParseTuple(args, "i", &default_value)) - return NULL; - pspec = g_param_spec_boolean (prop_name, nick, blurb, - default_value, flags); - } - break; - case G_TYPE_INT: - { - gint minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "iii", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_int (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_UINT: - { - guint minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "III", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_uint (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_LONG: - { - glong minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "lll", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_long (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_ULONG: - { - gulong minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "kkk", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_ulong (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_INT64: - { - gint64 minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "LLL", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_int64 (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_UINT64: - { - guint64 minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "KKK", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_uint64 (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_ENUM: - { - gint default_value; - PyObject *pydefault; - - if (!PyArg_ParseTuple(args, "O", &pydefault)) - return NULL; - - if (pyg_enum_get_value(prop_type, pydefault, - (gint *)&default_value)) - return NULL; - - pspec = g_param_spec_enum (prop_name, nick, blurb, - prop_type, default_value, flags); - } - break; - case G_TYPE_FLAGS: - { - guint default_value; - PyObject *pydefault; - - if (!PyArg_ParseTuple(args, "O", &pydefault)) - return NULL; - - if (pyg_flags_get_value(prop_type, pydefault, - &default_value)) - return NULL; - - pspec = g_param_spec_flags (prop_name, nick, blurb, - prop_type, default_value, flags); - } - break; - case G_TYPE_FLOAT: - { - gfloat minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "fff", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_float (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_DOUBLE: - { - gdouble minimum, maximum, default_value; - - if (!PyArg_ParseTuple(args, "ddd", &minimum, &maximum, - &default_value)) - return NULL; - pspec = g_param_spec_double (prop_name, nick, blurb, minimum, - maximum, default_value, flags); - } - break; - case G_TYPE_STRING: - { - const gchar *default_value; - - if (!PyArg_ParseTuple(args, "z", &default_value)) - return NULL; - pspec = g_param_spec_string (prop_name, nick, blurb, - default_value, flags); - } - break; - case G_TYPE_PARAM: - if (!PyArg_ParseTuple(args, "")) - return NULL; - pspec = g_param_spec_param (prop_name, nick, blurb, prop_type, flags); - break; - case G_TYPE_BOXED: - if (!PyArg_ParseTuple(args, "")) - return NULL; - pspec = g_param_spec_boxed (prop_name, nick, blurb, prop_type, flags); - break; - case G_TYPE_POINTER: - if (!PyArg_ParseTuple(args, "")) - return NULL; - if (prop_type == G_TYPE_GTYPE) - pspec = g_param_spec_gtype (prop_name, nick, blurb, G_TYPE_NONE, flags); - else - pspec = g_param_spec_pointer (prop_name, nick, blurb, flags); - break; - case G_TYPE_OBJECT: - case G_TYPE_INTERFACE: - if (!PyArg_ParseTuple(args, "")) - return NULL; - pspec = g_param_spec_object (prop_name, nick, blurb, prop_type, flags); - break; - case G_TYPE_VARIANT: - { - PyObject *pydefault; - GVariant *default_value = NULL; - - if (!PyArg_ParseTuple(args, "O", &pydefault)) - return NULL; - if (pydefault != Py_None) - default_value = pyg_boxed_get (pydefault, GVariant); - pspec = g_param_spec_variant (prop_name, nick, blurb, G_VARIANT_TYPE_ANY, default_value, flags); - } - break; - default: - /* unhandled pspec type ... */ - break; - } - - if (!pspec) { - char buf[128]; - - g_snprintf(buf, sizeof(buf), "could not create param spec for type %s", - g_type_name(prop_type)); - PyErr_SetString(PyExc_TypeError, buf); - return NULL; - } - - return pspec; -} - -static GParamSpec * -pyg_param_spec_from_object (PyObject *tuple) -{ - gint val_length; - const gchar *prop_name; - GType prop_type; - const gchar *nick, *blurb; - PyObject *slice, *item, *py_prop_type; - GParamSpec *pspec; - - val_length = PyTuple_Size(tuple); - if (val_length < 4) { - PyErr_SetString(PyExc_TypeError, - "paramspec tuples must be at least 4 elements long"); - return NULL; - } - - slice = PySequence_GetSlice(tuple, 0, 4); - if (!slice) { - return NULL; - } - - if (!PyArg_ParseTuple(slice, "sOzz", &prop_name, &py_prop_type, &nick, &blurb)) { - Py_DECREF(slice); - return NULL; - } - - Py_DECREF(slice); - - prop_type = pyg_type_from_object(py_prop_type); - if (!prop_type) { - return NULL; - } - - item = PyTuple_GetItem(tuple, val_length-1); - if (!PYGLIB_PyLong_Check(item)) { - PyErr_SetString(PyExc_TypeError, - "last element in tuple must be an int"); - return NULL; - } - - /* slice is the extra items in the tuple */ - slice = PySequence_GetSlice(tuple, 4, val_length-1); - pspec = create_property(prop_name, prop_type, - nick, blurb, slice, - PYGLIB_PyLong_AsLong(item)); - - return pspec; -} - -static gboolean -add_properties (GObjectClass *klass, PyObject *properties) -{ - gboolean ret = TRUE; - Py_ssize_t pos = 0; - PyObject *key, *value; - - while (PyDict_Next(properties, &pos, &key, &value)) { - const gchar *prop_name; - GType prop_type; - const gchar *nick, *blurb; - GParamFlags flags; - gint val_length; - PyObject *slice, *item, *py_prop_type; - GParamSpec *pspec; - - /* values are of format (type,nick,blurb, type_specific_args, flags) */ - - if (!PYGLIB_PyUnicode_Check(key)) { - PyErr_SetString(PyExc_TypeError, - "__gproperties__ keys must be strings"); - ret = FALSE; - break; - } - prop_name = PYGLIB_PyUnicode_AsString (key); - - if (!PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__gproperties__ values must be tuples"); - ret = FALSE; - break; - } - val_length = PyTuple_Size(value); - if (val_length < 4) { - PyErr_SetString(PyExc_TypeError, - "__gproperties__ values must be at least 4 elements long"); - ret = FALSE; - break; - } - - slice = PySequence_GetSlice(value, 0, 3); - if (!slice) { - ret = FALSE; - break; - } - if (!PyArg_ParseTuple(slice, "Ozz", &py_prop_type, &nick, &blurb)) { - Py_DECREF(slice); - ret = FALSE; - break; - } - Py_DECREF(slice); - prop_type = pyg_type_from_object(py_prop_type); - if (!prop_type) { - ret = FALSE; - break; - } - item = PyTuple_GetItem(value, val_length-1); - if (!PYGLIB_PyLong_Check(item)) { - PyErr_SetString(PyExc_TypeError, - "last element in __gproperties__ value tuple must be an int"); - ret = FALSE; - break; - } - flags = PYGLIB_PyLong_AsLong(item); - - /* slice is the extra items in the tuple */ - slice = PySequence_GetSlice(value, 3, val_length-1); - pspec = create_property(prop_name, prop_type, nick, blurb, - slice, flags); - Py_DECREF(slice); - - if (pspec) { - g_object_class_install_property(klass, 1, pspec); - } else { - PyObject *type, *value, *traceback; - ret = FALSE; - PyErr_Fetch(&type, &value, &traceback); - if (PYGLIB_PyUnicode_Check(value)) { - char msg[256]; - g_snprintf(msg, 256, - "%s (while registering property '%s' for GType '%s')", - PYGLIB_PyUnicode_AsString(value), - prop_name, G_OBJECT_CLASS_NAME(klass)); - Py_DECREF(value); - value = PYGLIB_PyUnicode_FromString(msg); - } - PyErr_Restore(type, value, traceback); - break; - } - } - - return ret; -} - -static void -pyg_object_class_init(GObjectClass *class, PyObject *py_class) -{ - PyObject *gproperties, *gsignals, *overridden_signals; - PyObject *class_dict = ((PyTypeObject*) py_class)->tp_dict; - - class->set_property = pyg_object_set_property; - class->get_property = pyg_object_get_property; - - /* install signals */ - /* we look this up in the instance dictionary, so we don't - * accidentally get a parent type's __gsignals__ attribute. */ - gsignals = PyDict_GetItemString(class_dict, "__gsignals__"); - if (gsignals) { - if (!PyDict_Check(gsignals)) { - PyErr_SetString(PyExc_TypeError, - "__gsignals__ attribute not a dict!"); - return; - } - if (!(overridden_signals = add_signals(class, gsignals))) { - return; - } - if (PyDict_SetItemString(class_dict, "__gsignals__", - overridden_signals)) { - return; - } - Py_DECREF(overridden_signals); - - PyDict_DelItemString(class_dict, "__gsignals__"); - } else { - PyErr_Clear(); - } - - /* install properties */ - /* we look this up in the instance dictionary, so we don't - * accidentally get a parent type's __gproperties__ attribute. */ - gproperties = PyDict_GetItemString(class_dict, "__gproperties__"); - if (gproperties) { - if (!PyDict_Check(gproperties)) { - PyErr_SetString(PyExc_TypeError, - "__gproperties__ attribute not a dict!"); - return; - } - if (!add_properties(class, gproperties)) { - return; - } - PyDict_DelItemString(class_dict, "__gproperties__"); - /* Borrowed reference. Py_DECREF(gproperties); */ - } else { - PyErr_Clear(); - } -} - -static void -pyg_register_class_init(GType gtype, PyGClassInitFunc class_init) -{ - GSList *list; - - list = g_type_get_qdata(gtype, pygobject_class_init_key); - list = g_slist_prepend(list, class_init); - g_type_set_qdata(gtype, pygobject_class_init_key, list); -} - -static int -pyg_run_class_init(GType gtype, gpointer gclass, PyTypeObject *pyclass) -{ - GSList *list; - PyGClassInitFunc class_init; - GType parent_type; - int rv; - - parent_type = g_type_parent(gtype); - if (parent_type) { - rv = pyg_run_class_init(parent_type, gclass, pyclass); - if (rv) - return rv; - } - - list = g_type_get_qdata(gtype, pygobject_class_init_key); - for (; list; list = list->next) { - class_init = list->data; - rv = class_init(gclass, pyclass); - if (rv) - return rv; - } - - return 0; -} - -static PyObject * -_wrap_pyg_type_register(PyObject *self, PyObject *args) -{ - PyTypeObject *class; - char *type_name = NULL; - - if (!PyArg_ParseTuple(args, "O!|z:gobject.type_register", - &PyType_Type, &class, &type_name)) - return NULL; - if (!PyType_IsSubtype(class, &PyGObject_Type)) { - PyErr_SetString(PyExc_TypeError, - "argument must be a GObject subclass"); - return NULL; - } - - /* Check if type already registered */ - if (pyg_type_from_object((PyObject *) class) == - pyg_type_from_object((PyObject *) class->tp_base)) - { - if (pyg_type_register(class, type_name)) - return NULL; - } - - Py_INCREF(class); - return (PyObject *) class; -} - -static char * -get_type_name_for_class(PyTypeObject *class) -{ - gint i, name_serial; - char name_serial_str[16]; - PyObject *module; - char *type_name = NULL; - - /* make name for new GType */ - name_serial = 1; - /* give up after 1000 tries, just in case.. */ - while (name_serial < 1000) - { - g_free(type_name); - snprintf(name_serial_str, 16, "-v%i", name_serial); - module = PyObject_GetAttrString((PyObject *)class, "__module__"); - if (module && PYGLIB_PyUnicode_Check(module)) { - type_name = g_strconcat(PYGLIB_PyUnicode_AsString(module), ".", - class->tp_name, - name_serial > 1 ? name_serial_str : NULL, - NULL); - Py_DECREF(module); - } else { - if (module) - Py_DECREF(module); - else - PyErr_Clear(); - type_name = g_strconcat(class->tp_name, - name_serial > 1 ? name_serial_str : NULL, - NULL); - } - /* convert '.' in type name to '+', which isn't banned (grumble) */ - for (i = 0; type_name[i] != '\0'; i++) - if (type_name[i] == '.') - type_name[i] = '+'; - if (g_type_from_name(type_name) == 0) - break; /* we now have a unique name */ - ++name_serial; - } - - return type_name; -} - - -static GPrivate pygobject_construction_wrapper; - -static inline void -pygobject_init_wrapper_set(PyObject *wrapper) -{ - g_private_set(&pygobject_construction_wrapper, wrapper); -} - -static inline PyObject * -pygobject_init_wrapper_get(void) -{ - return (PyObject *) g_private_get(&pygobject_construction_wrapper); -} - -int -pygobject_constructv(PyGObject *self, - guint n_parameters, - GParameter *parameters) -{ - if (self->obj == NULL) { - GObject *obj; - pygobject_init_wrapper_set((PyObject *) self); - obj = g_object_newv(pyg_type_from_object((PyObject *) self), - n_parameters, parameters); - - if (g_object_is_floating (obj)) - self->private_flags.flags |= PYGOBJECT_GOBJECT_WAS_FLOATING; - pygobject_sink (obj); - - pygobject_init_wrapper_set(NULL); - if (self->obj == NULL) { - self->obj = obj; - pygobject_register_wrapper((PyObject *) self); - } - } else { - int i; - for (i = 0; i < n_parameters; ++i) - g_object_set_property(self->obj, - parameters[i].name, - ¶meters[i].value); - } - return 0; -} - -static void -pygobject__g_instance_init(GTypeInstance *instance, - gpointer g_class) -{ - GObject *object = (GObject *) instance; - PyObject *wrapper, *args, *kwargs; - - wrapper = g_object_get_qdata(object, pygobject_wrapper_key); - if (wrapper == NULL) { - wrapper = pygobject_init_wrapper_get(); - if (wrapper && ((PyGObject *) wrapper)->obj == NULL) { - ((PyGObject *) wrapper)->obj = object; - pygobject_register_wrapper(wrapper); - } - } - pygobject_init_wrapper_set(NULL); - if (wrapper == NULL) { - /* this looks like a python object created through - * g_object_new -> we have no python wrapper, so create it - * now */ - PyGILState_STATE state; - state = pyglib_gil_state_ensure(); - wrapper = pygobject_new_full(object, - /*steal=*/ FALSE, - g_class); - - /* float the wrapper ref here because we are going to orphan it - * so we don't destroy the wrapper. The next call to pygobject_new_full - * will take the ref */ - pygobject_ref_float ((PyGObject *) wrapper); - args = PyTuple_New(0); - kwargs = PyDict_New(); - if (Py_TYPE(wrapper)->tp_init(wrapper, args, kwargs)) - PyErr_Print(); - - Py_DECREF(args); - Py_DECREF(kwargs); - pyglib_gil_state_release(state); - } -} - - -/* This implementation is bad, see bug 566571 for an example why. - * Instead of scanning explicitly declared bases for interfaces, we - * should automatically initialize all implemented interfaces to - * prevent bugs like that one. However, this will lead to - * performance degradation as each virtual method in derived classes - * will round-trip through do_*() stuff, *even* if it is not - * overriden. We need to teach codegen to retain parent method - * instead of setting virtual to *_proxy_do_*() if corresponding - * do_*() is not overriden. Ok, that was a messy explanation. - */ -static void -pyg_type_add_interfaces(PyTypeObject *class, GType instance_type, - PyObject *bases, - GType *parent_interfaces, guint n_parent_interfaces) -{ - int i; - - if (!bases) { - g_warning("type has no bases"); - return; - } - - for (i = 0; i < PyTuple_GET_SIZE(bases); ++i) { - PyObject *base = PyTuple_GET_ITEM(bases, i); - GType itype; - const GInterfaceInfo *iinfo; - GInterfaceInfo iinfo_copy; - - /* 'base' can also be a PyClassObject, see bug #566571. */ - if (!PyType_Check(base)) - continue; - - if (!PyType_IsSubtype((PyTypeObject*) base, &PyGInterface_Type)) - continue; - - itype = pyg_type_from_object(base); - - /* Happens for _implementations_ of an interface. */ - if (!G_TYPE_IS_INTERFACE(itype)) - continue; - - iinfo = pyg_lookup_interface_info(itype); - if (!iinfo) { - gchar *error; - error = g_strdup_printf("Interface type %s " - "has no Python implementation support", - ((PyTypeObject *) base)->tp_name); - PyErr_Warn(PyExc_RuntimeWarning, error); - g_free(error); - continue; - } - - iinfo_copy = *iinfo; - iinfo_copy.interface_data = class; - g_type_add_interface_static(instance_type, itype, &iinfo_copy); - } -} - -int -pyg_type_register(PyTypeObject *class, const char *type_name) -{ - PyObject *gtype; - GType parent_type, instance_type; - GType *parent_interfaces; - guint n_parent_interfaces; - GTypeQuery query; - gpointer gclass; - GTypeInfo type_info = { - 0, /* class_size */ - - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - - (GClassInitFunc) pyg_object_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - - 0, /* instance_size */ - 0, /* n_preallocs */ - (GInstanceInitFunc) pygobject__g_instance_init - }; - gchar *new_type_name; - - /* find the GType of the parent */ - parent_type = pyg_type_from_object((PyObject *)class); - if (!parent_type) - return -1; - - parent_interfaces = g_type_interfaces(parent_type, &n_parent_interfaces); - - if (type_name) - /* care is taken below not to free this */ - new_type_name = (gchar *) type_name; - else - new_type_name = get_type_name_for_class(class); - - /* set class_data that will be passed to the class_init function. */ - type_info.class_data = class; - - /* fill in missing values of GTypeInfo struct */ - g_type_query(parent_type, &query); - type_info.class_size = query.class_size; - type_info.instance_size = query.instance_size; - - /* create new typecode */ - instance_type = g_type_register_static(parent_type, new_type_name, - &type_info, 0); - if (instance_type == 0) { - PyErr_Format(PyExc_RuntimeError, - "could not create new GType: %s (subclass of %s)", - new_type_name, - g_type_name(parent_type)); - - if (type_name == NULL) - g_free(new_type_name); - - return -1; - } - - if (type_name == NULL) - g_free(new_type_name); - - /* store pointer to the class with the GType */ - Py_INCREF(class); - g_type_set_qdata(instance_type, g_quark_from_string("PyGObject::class"), - class); - - /* Mark this GType as a custom python type */ - g_type_set_qdata(instance_type, pygobject_custom_key, - GINT_TO_POINTER (1)); - - /* set new value of __gtype__ on class */ - gtype = pyg_type_wrapper_new(instance_type); - PyObject_SetAttrString((PyObject *)class, "__gtype__", gtype); - Py_DECREF(gtype); - - /* if no __doc__, set it to the auto doc descriptor */ - if (PyDict_GetItemString(class->tp_dict, "__doc__") == NULL) { - PyDict_SetItemString(class->tp_dict, "__doc__", - pyg_object_descr_doc_get()); - } - - /* - * Note, all interfaces need to be registered before the first - * g_type_class_ref(), see bug #686149. - * - * See also comment above pyg_type_add_interfaces(). - */ - pyg_type_add_interfaces(class, instance_type, class->tp_bases, - parent_interfaces, n_parent_interfaces); - - - gclass = g_type_class_ref(instance_type); - if (PyErr_Occurred() != NULL) { - g_type_class_unref(gclass); - g_free(parent_interfaces); - return -1; - } - - if (pyg_run_class_init(instance_type, gclass, class)) { - g_type_class_unref(gclass); - g_free(parent_interfaces); - return -1; - } - g_type_class_unref(gclass); - g_free(parent_interfaces); - - if (PyErr_Occurred() != NULL) - return -1; - return 0; -} - -static PyObject * -pyg_signal_new(PyObject *self, PyObject *args) -{ - gchar *signal_name; - PyObject *py_type; - GSignalFlags signal_flags; - GType return_type; - PyObject *py_return_type, *py_param_types; - - GType instance_type = 0; - Py_ssize_t n_params, i; - GType *param_types; - - guint signal_id; - - if (!PyArg_ParseTuple(args, "sOiOO:gobject.signal_new", &signal_name, - &py_type, &signal_flags, &py_return_type, - &py_param_types)) - return NULL; - - instance_type = pyg_type_from_object(py_type); - if (!instance_type) - return NULL; - if (!(G_TYPE_IS_INSTANTIATABLE(instance_type) || G_TYPE_IS_INTERFACE(instance_type))) { - PyErr_SetString(PyExc_TypeError, - "argument 2 must be an object type or interface type"); - return NULL; - } - - return_type = pyg_type_from_object(py_return_type); - if (!return_type) - return NULL; - - if (!PySequence_Check(py_param_types)) { - PyErr_SetString(PyExc_TypeError, - "argument 5 must be a sequence of GType codes"); - return NULL; - } - n_params = PySequence_Length(py_param_types); - param_types = g_new(GType, n_params); - for (i = 0; i < n_params; i++) { - PyObject *item = PySequence_GetItem(py_param_types, i); - - param_types[i] = pyg_type_from_object(item); - if (param_types[i] == 0) { - PyErr_Clear(); - Py_DECREF(item); - PyErr_SetString(PyExc_TypeError, - "argument 5 must be a sequence of GType codes"); - g_free(param_types); - return NULL; - } - Py_DECREF(item); - } - - signal_id = g_signal_newv(signal_name, instance_type, signal_flags, - pyg_signal_class_closure_get(), - (GSignalAccumulator)0, NULL, - (GSignalCMarshaller)0, - return_type, n_params, param_types); - g_free(param_types); - if (signal_id != 0) - return PYGLIB_PyLong_FromLong(signal_id); - PyErr_SetString(PyExc_RuntimeError, "could not create signal"); - return NULL; -} - -static PyObject * -pyg_signal_query (PyObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist1[] = { "name", "type", NULL }; - static char *kwlist2[] = { "signal_id", NULL }; - PyObject *py_query, *params_list, *py_itype; - GObjectClass *class = NULL; - GType itype; - gchar *signal_name; - guint i; - GSignalQuery query; - guint id; - gpointer iface = NULL; - - if (PyArg_ParseTupleAndKeywords(args, kwargs, "sO:gobject.signal_query", - kwlist1, &signal_name, &py_itype)) { - if ((itype = pyg_type_from_object(py_itype)) == 0) - return NULL; - - if (G_TYPE_IS_INSTANTIATABLE(itype)) { - class = g_type_class_ref(itype); - if (!class) { - PyErr_SetString(PyExc_RuntimeError, - "could not get a reference to type class"); - return NULL; - } - } else if (!G_TYPE_IS_INTERFACE(itype)) { - PyErr_SetString(PyExc_TypeError, - "type must be instantiable or an interface"); - return NULL; - } else { - iface = g_type_default_interface_ref(itype); - } - id = g_signal_lookup(signal_name, itype); - } else { - PyErr_Clear(); - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "i:gobject.signal_query", - kwlist2, &id)) { - PyErr_Clear(); - PyErr_SetString(PyExc_TypeError, - "Usage: one of:\n" - " gobject.signal_query(name, type)\n" - " gobject.signal_query(signal_id)"); - - return NULL; - } - } - - g_signal_query(id, &query); - - if (query.signal_id == 0) { - Py_INCREF(Py_None); - py_query = Py_None; - goto done; - } - py_query = PyTuple_New(6); - if (py_query == NULL) { - goto done; - } - params_list = PyTuple_New(query.n_params); - if (params_list == NULL) { - Py_DECREF(py_query); - py_query = NULL; - goto done; - } - - PyTuple_SET_ITEM(py_query, 0, PYGLIB_PyLong_FromLong(query.signal_id)); - PyTuple_SET_ITEM(py_query, 1, PYGLIB_PyUnicode_FromString(query.signal_name)); - PyTuple_SET_ITEM(py_query, 2, pyg_type_wrapper_new(query.itype)); - PyTuple_SET_ITEM(py_query, 3, PYGLIB_PyLong_FromLong(query.signal_flags)); - PyTuple_SET_ITEM(py_query, 4, pyg_type_wrapper_new(query.return_type)); - for (i = 0; i < query.n_params; i++) { - PyTuple_SET_ITEM(params_list, i, - pyg_type_wrapper_new(query.param_types[i])); - } - PyTuple_SET_ITEM(py_query, 5, params_list); - - done: - if (class) - g_type_class_unref(class); - if (iface) - g_type_default_interface_unref(iface); - - return py_query; -} - -static PyObject * -pyg_object_class_list_properties (PyObject *self, PyObject *args) -{ - GParamSpec **specs; - PyObject *py_itype, *list; - GType itype; - GObjectClass *class = NULL; - gpointer iface = NULL; - guint nprops; - guint i; - - if (!PyArg_ParseTuple(args, "O:gobject.list_properties", - &py_itype)) - return NULL; - if ((itype = pyg_type_from_object(py_itype)) == 0) - return NULL; - - if (G_TYPE_IS_INTERFACE(itype)) { - iface = g_type_default_interface_ref(itype); - if (!iface) { - PyErr_SetString(PyExc_RuntimeError, - "could not get a reference to interface type"); - return NULL; - } - specs = g_object_interface_list_properties(iface, &nprops); - } else if (g_type_is_a(itype, G_TYPE_OBJECT)) { - class = g_type_class_ref(itype); - if (!class) { - PyErr_SetString(PyExc_RuntimeError, - "could not get a reference to type class"); - return NULL; - } - specs = g_object_class_list_properties(class, &nprops); - } else { - PyErr_SetString(PyExc_TypeError, - "type must be derived from GObject or an interface"); - return NULL; - } - - list = PyTuple_New(nprops); - if (list == NULL) { - g_free(specs); - g_type_class_unref(class); - return NULL; - } - for (i = 0; i < nprops; i++) { - PyTuple_SetItem(list, i, pyg_param_spec_new(specs[i])); - } - g_free(specs); - if (class) - g_type_class_unref(class); - else - g_type_default_interface_unref(iface); - - return list; -} - -static PyObject * -pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs) -{ - PyObject *pytype; - GType type; - GObject *obj = NULL; - GObjectClass *class; - guint n_params = 0, i; - GParameter *params = NULL; - - if (!PyArg_ParseTuple (args, "O:gobject.new", &pytype)) { - return NULL; - } - - if ((type = pyg_type_from_object (pytype)) == 0) - return NULL; - - if (G_TYPE_IS_ABSTRACT(type)) { - PyErr_Format(PyExc_TypeError, "cannot create instance of abstract " - "(non-instantiable) type `%s'", g_type_name(type)); - return NULL; - } - - if ((class = g_type_class_ref (type)) == NULL) { - PyErr_SetString(PyExc_TypeError, - "could not get a reference to type class"); - return NULL; - } - - if (!pygobject_prepare_construct_properties (class, kwargs, &n_params, ¶ms)) - goto cleanup; - - obj = g_object_newv(type, n_params, params); - if (!obj) - PyErr_SetString (PyExc_RuntimeError, "could not create object"); - - cleanup: - for (i = 0; i < n_params; i++) { - g_free((gchar *) params[i].name); - g_value_unset(¶ms[i].value); - } - g_free(params); - g_type_class_unref(class); - - if (obj) { - pygobject_sink (obj); - self = (PyGObject *) pygobject_new((GObject *)obj); - g_object_unref(obj); - } else - self = NULL; - - return (PyObject *) self; -} - -gboolean -pyg_handler_marshal(gpointer user_data) -{ - PyObject *tuple, *ret; - gboolean res; - PyGILState_STATE state; - - g_return_val_if_fail(user_data != NULL, FALSE); - - state = pyglib_gil_state_ensure(); - - tuple = (PyObject *)user_data; - ret = PyObject_CallObject(PyTuple_GetItem(tuple, 0), - PyTuple_GetItem(tuple, 1)); - if (!ret) { - PyErr_Print(); - res = FALSE; - } else { - res = PyObject_IsTrue(ret); - Py_DECREF(ret); - } - - pyglib_gil_state_release(state); - - return res; -} - -static int -pygobject_gil_state_ensure (void) -{ - return pyglib_gil_state_ensure (); -} - -static void -pygobject_gil_state_release (int flag) -{ - pyglib_gil_state_release(flag); -} - -/* Only for backwards compatibility */ -static int -pygobject_enable_threads(void) -{ - return 0; -} - -static PyObject * -pyg_signal_accumulator_true_handled(PyObject *unused, PyObject *args) -{ - PyErr_SetString(PyExc_TypeError, - "signal_accumulator_true_handled can only" - " be used as accumulator argument when registering signals"); - return NULL; -} - -static gboolean -marshal_emission_hook(GSignalInvocationHint *ihint, - guint n_param_values, - const GValue *param_values, - gpointer user_data) -{ - PyGILState_STATE state; - gboolean retval = FALSE; - PyObject *func, *args; - PyObject *retobj; - PyObject *params; - guint i; - - state = pyglib_gil_state_ensure(); - - /* construct Python tuple for the parameter values */ - params = PyTuple_New(n_param_values); - - for (i = 0; i < n_param_values; i++) { - PyObject *item = pyg_value_as_pyobject(¶m_values[i], FALSE); - - /* error condition */ - if (!item) { - goto out; - } - PyTuple_SetItem(params, i, item); - } - - args = (PyObject *)user_data; - func = PyTuple_GetItem(args, 0); - args = PySequence_Concat(params, PyTuple_GetItem(args, 1)); - Py_DECREF(params); - - /* params passed to function may have extra arguments */ - - retobj = PyObject_CallObject(func, args); - Py_DECREF(args); - if (retobj == NULL) { - PyErr_Print(); - } - - retval = (retobj == Py_True ? TRUE : FALSE); - Py_XDECREF(retobj); -out: - pyglib_gil_state_release(state); - return retval; -} - -static PyObject * -pyg_add_emission_hook(PyGObject *self, PyObject *args) -{ - PyObject *first, *callback, *extra_args, *data, *repr; - gchar *name; - gulong hook_id; - guint sigid; - Py_ssize_t len; - GQuark detail = 0; - GType gtype; - PyObject *pygtype; - - len = PyTuple_Size(args); - if (len < 3) { - PyErr_SetString(PyExc_TypeError, - "gobject.add_emission_hook requires at least 3 arguments"); - return NULL; - } - first = PySequence_GetSlice(args, 0, 3); - if (!PyArg_ParseTuple(first, "OsO:add_emission_hook", - &pygtype, &name, &callback)) { - Py_DECREF(first); - return NULL; - } - Py_DECREF(first); - - if ((gtype = pyg_type_from_object(pygtype)) == 0) { - return NULL; - } - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "third argument must be callable"); - return NULL; - } - - if (!g_signal_parse_name(name, gtype, &sigid, &detail, TRUE)) { - repr = PyObject_Repr((PyObject*)self); - PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", - PYGLIB_PyUnicode_AsString(repr), - name); - Py_DECREF(repr); - return NULL; - } - extra_args = PySequence_GetSlice(args, 3, len); - if (extra_args == NULL) - return NULL; - - data = Py_BuildValue("(ON)", callback, extra_args); - if (data == NULL) - return NULL; - - hook_id = g_signal_add_emission_hook(sigid, detail, - marshal_emission_hook, - data, - (GDestroyNotify)pyg_destroy_notify); - - return PyLong_FromUnsignedLong(hook_id); -} - -static PyObject * -pyg__install_metaclass(PyObject *dummy, PyTypeObject *metaclass) -{ - Py_INCREF(metaclass); - PyGObject_MetaType = metaclass; - Py_INCREF(metaclass); - - Py_TYPE(&PyGObject_Type) = metaclass; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -pyg__gvalue_get(PyObject *module, PyObject *pygvalue) -{ - if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) { - PyErr_SetString (PyExc_TypeError, "Expected GValue argument."); - return NULL; - } - - return pyg_value_as_pyobject (pyg_boxed_get(pygvalue, GValue), - /*copy_boxed=*/ TRUE); -} - -static PyObject * -pyg__gvalue_set(PyObject *module, PyObject *args) -{ - PyObject *pygvalue; - PyObject *pyobject; - - if (!PyArg_ParseTuple (args, "OO:_gobject._gvalue_set", - &pygvalue, &pyobject)) - return NULL; - - if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) { - PyErr_SetString (PyExc_TypeError, "Expected GValue argument."); - return NULL; - } - - if (pyg_value_from_pyobject_with_error (pyg_boxed_get (pygvalue, GValue), - pyobject) == -1) - return NULL; - - Py_RETURN_NONE; -} - -static PyMethodDef _gobject_functions[] = { - { "type_name", pyg_type_name, METH_VARARGS }, - { "type_from_name", pyg_type_from_name, METH_VARARGS }, - { "type_is_a", pyg_type_is_a, METH_VARARGS }, - { "type_register", _wrap_pyg_type_register, METH_VARARGS }, - { "signal_new", pyg_signal_new, METH_VARARGS }, - { "signal_query", - (PyCFunction)pyg_signal_query, METH_VARARGS|METH_KEYWORDS }, - { "list_properties", - pyg_object_class_list_properties, METH_VARARGS }, - { "new", - (PyCFunction)pyg_object_new, METH_VARARGS|METH_KEYWORDS }, - { "signal_accumulator_true_handled", - (PyCFunction)pyg_signal_accumulator_true_handled, METH_VARARGS }, - { "add_emission_hook", - (PyCFunction)pyg_add_emission_hook, METH_VARARGS }, - { "_install_metaclass", - (PyCFunction)pyg__install_metaclass, METH_O }, - { "_gvalue_get", - (PyCFunction)pyg__gvalue_get, METH_O }, - { "_gvalue_set", - (PyCFunction)pyg__gvalue_set, METH_VARARGS }, - - { NULL, NULL, 0 } -}; - - -/* ----------------- Constant extraction ------------------------ */ - -/** - * pyg_constant_strip_prefix: - * @name: the constant name. - * @strip_prefix: the prefix to strip. - * - * Advances the pointer @name by strlen(@strip_prefix) characters. If - * the resulting name does not start with a letter or underscore, the - * @name pointer will be rewound. This is to ensure that the - * resulting name is a valid identifier. Hence the returned string is - * a pointer into the string @name. - * - * Returns: the stripped constant name. - */ -const gchar * -pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix) -{ - gint prefix_len; - guint i; - - prefix_len = strlen(strip_prefix); - - /* Check so name starts with strip_prefix, if it doesn't: - * return the rest of the part which doesn't match - */ - for (i = 0; i < prefix_len; i++) { - if (name[i] != strip_prefix[i] && name[i] != '_') { - return &name[i]; - } - } - - /* strip off prefix from value name, while keeping it a valid - * identifier */ - for (i = prefix_len; i >= 0; i--) { - if (g_ascii_isalpha(name[i]) || name[i] == '_') { - return &name[i]; - } - } - return name; -} - -/** - * pyg_enum_add_constants: - * @module: a Python module - * @enum_type: the GType of the enumeration. - * @strip_prefix: the prefix to strip from the constant names. - * - * Adds constants to the given Python module for each value name of - * the enumeration. A prefix will be stripped from each enum name. - */ -static void -pyg_enum_add_constants(PyObject *module, GType enum_type, - const gchar *strip_prefix) -{ - GEnumClass *eclass; - guint i; - - if (!G_TYPE_IS_ENUM(enum_type)) { - if (G_TYPE_IS_FLAGS(enum_type)) /* See bug #136204 */ - pyg_flags_add_constants(module, enum_type, strip_prefix); - else - g_warning("`%s' is not an enum type", g_type_name(enum_type)); - return; - } - g_return_if_fail (strip_prefix != NULL); - - eclass = G_ENUM_CLASS(g_type_class_ref(enum_type)); - - for (i = 0; i < eclass->n_values; i++) { - const gchar *name = eclass->values[i].value_name; - gint value = eclass->values[i].value; - - PyModule_AddIntConstant(module, - (char*) pyg_constant_strip_prefix(name, strip_prefix), - (long) value); - } - - g_type_class_unref(eclass); -} - -/** - * pyg_flags_add_constants: - * @module: a Python module - * @flags_type: the GType of the flags type. - * @strip_prefix: the prefix to strip from the constant names. - * - * Adds constants to the given Python module for each value name of - * the flags set. A prefix will be stripped from each flag name. - */ -static void -pyg_flags_add_constants(PyObject *module, GType flags_type, - const gchar *strip_prefix) -{ - GFlagsClass *fclass; - guint i; - - if (!G_TYPE_IS_FLAGS(flags_type)) { - if (G_TYPE_IS_ENUM(flags_type)) /* See bug #136204 */ - pyg_enum_add_constants(module, flags_type, strip_prefix); - else - g_warning("`%s' is not an flags type", g_type_name(flags_type)); - return; - } - g_return_if_fail (strip_prefix != NULL); - - fclass = G_FLAGS_CLASS(g_type_class_ref(flags_type)); - - for (i = 0; i < fclass->n_values; i++) { - const gchar *name = fclass->values[i].value_name; - guint value = fclass->values[i].value; - - PyModule_AddIntConstant(module, - (char*) pyg_constant_strip_prefix(name, strip_prefix), - (long) value); - } - - g_type_class_unref(fclass); -} - -/** - * pyg_error_check: - * @error: a pointer to the GError. - * - * Checks to see if the GError has been set. If the error has been - * set, then the gobject.GError Python exception will be raised, and - * the GError cleared. - * - * Returns: True if an error was set. - * - * Deprecated: Since 2.16, use pyglib_error_check instead. - */ -gboolean -pyg_error_check(GError **error) -{ -#if 0 - if (PyErr_Warn(PyExc_DeprecationWarning, - "pyg_error_check is deprecated, use " - "pyglib_error_check instead")) - return NULL; -#endif - return pyglib_error_check(error); -} - -/** - * pyg_gerror_exception_check: - * @error: a standard GLib GError ** output parameter - * - * Checks to see if a GError exception has been raised, and if so - * translates the python exception to a standard GLib GError. If the - * raised exception is not a GError then PyErr_Print() is called. - * - * Returns: 0 if no exception has been raised, -1 if it is a - * valid gobject.GError, -2 otherwise. - * - * Deprecated: Since 2.16, use pyglib_gerror_exception_check instead. - */ -gboolean -pyg_gerror_exception_check(GError **error) -{ -#if 0 - if (PyErr_Warn(PyExc_DeprecationWarning, - "pyg_gerror_exception_check is deprecated, use " - "pyglib_gerror_exception_check instead")) - return NULL; -#endif - return pyglib_gerror_exception_check(error); -} - -/** - * pyg_parse_constructor_args: helper function for PyGObject constructors - * @obj_type: GType of the GObject, for parameter introspection - * @arg_names: %NULL-terminated array of constructor argument names - * @prop_names: %NULL-terminated array of property names, with direct - * correspondence to @arg_names - * @params: GParameter array where parameters will be placed; length - * of this array must be at least equal to the number of - * arguments/properties - * @nparams: output parameter to contain actual number of arguments found - * @py_args: array of PyObject* containing the actual constructor arguments - * - * Parses an array of PyObject's and creates a GParameter array - * - * Return value: %TRUE if all is successful, otherwise %FALSE and - * python exception set. - **/ -static gboolean -pyg_parse_constructor_args(GType obj_type, - char **arg_names, - char **prop_names, - GParameter *params, - guint *nparams, - PyObject **py_args) -{ - guint arg_i, param_i; - GObjectClass *oclass; - - oclass = g_type_class_ref(obj_type); - g_return_val_if_fail(oclass, FALSE); - - for (param_i = arg_i = 0; arg_names[arg_i]; ++arg_i) { - GParamSpec *spec; - if (!py_args[arg_i]) - continue; - spec = g_object_class_find_property(oclass, prop_names[arg_i]); - params[param_i].name = prop_names[arg_i]; - g_value_init(¶ms[param_i].value, spec->value_type); - if (pyg_value_from_pyobject(¶ms[param_i].value, py_args[arg_i]) == -1) { - int i; - PyErr_Format(PyExc_TypeError, "could not convert parameter '%s' of type '%s'", - arg_names[arg_i], g_type_name(spec->value_type)); - g_type_class_unref(oclass); - for (i = 0; i < param_i; ++i) - g_value_unset(¶ms[i].value); - return FALSE; - } - ++param_i; - } - g_type_class_unref(oclass); - *nparams = param_i; - return TRUE; -} - -PyObject * -pyg_integer_richcompare(PyObject *v, PyObject *w, int op) -{ - PyObject *result; - gboolean t; - - switch (op) { - case Py_EQ: t = PYGLIB_PyLong_AS_LONG(v) == PYGLIB_PyLong_AS_LONG(w); break; - case Py_NE: t = PYGLIB_PyLong_AS_LONG(v) != PYGLIB_PyLong_AS_LONG(w); break; - case Py_LE: t = PYGLIB_PyLong_AS_LONG(v) <= PYGLIB_PyLong_AS_LONG(w); break; - case Py_GE: t = PYGLIB_PyLong_AS_LONG(v) >= PYGLIB_PyLong_AS_LONG(w); break; - case Py_LT: t = PYGLIB_PyLong_AS_LONG(v) < PYGLIB_PyLong_AS_LONG(w); break; - case Py_GT: t = PYGLIB_PyLong_AS_LONG(v) > PYGLIB_PyLong_AS_LONG(w); break; - default: g_assert_not_reached(); - } - - result = t ? Py_True : Py_False; - Py_INCREF(result); - return result; -} - -static void -_log_func(const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer user_data) -{ - if (G_LIKELY(Py_IsInitialized())) - { - PyGILState_STATE state; - PyObject* warning = user_data; - - state = pyglib_gil_state_ensure(); - PyErr_Warn(warning, (char *) message); - pyglib_gil_state_release(state); - } else - g_log_default_handler(log_domain, log_level, message, user_data); -} - -static void -add_warning_redirection(const char *domain, - PyObject *warning) -{ - g_return_if_fail(domain != NULL); - g_return_if_fail(warning != NULL); - - if (!log_handlers_disabled) - { - guint handler; - gpointer old_handler; - - if (!log_handlers) - log_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - if ((old_handler = g_hash_table_lookup(log_handlers, domain))) - g_log_remove_handler(domain, GPOINTER_TO_UINT(old_handler)); - - handler = g_log_set_handler(domain, G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING, - _log_func, warning); - g_hash_table_insert(log_handlers, g_strdup(domain), GUINT_TO_POINTER(handler)); - } -} - -static void -remove_handler(gpointer domain, - gpointer handler, - gpointer unused) -{ - g_log_remove_handler(domain, GPOINTER_TO_UINT(handler)); -} - -static void -disable_warning_redirections(void) -{ - log_handlers_disabled = TRUE; - - if (log_handlers) - { - g_hash_table_foreach(log_handlers, remove_handler, NULL); - g_hash_table_destroy(log_handlers); - log_handlers = NULL; - } -} - -/* ----------------- gobject module initialisation -------------- */ - -struct _PyGObject_Functions pygobject_api_functions = { - pygobject_register_class, - pygobject_register_wrapper, - pygobject_lookup_class, - pygobject_new, - - pyg_closure_new, - pygobject_watch_closure, - pyg_destroy_notify, - - pyg_type_from_object, - pyg_type_wrapper_new, - pyg_enum_get_value, - pyg_flags_get_value, - pyg_register_gtype_custom, - pyg_value_from_pyobject, - pyg_value_as_pyobject, - - pyg_register_interface, - - &PyGBoxed_Type, - pyg_register_boxed, - pyg_boxed_new, - - &PyGPointer_Type, - pyg_register_pointer, - pyg_pointer_new, - - pyg_enum_add_constants, - pyg_flags_add_constants, - - pyg_constant_strip_prefix, - - pyg_error_check, - - _pyg_set_thread_block_funcs, - (PyGThreadBlockFunc)0, /* block_threads */ - (PyGThreadBlockFunc)0, /* unblock_threads */ - - &PyGParamSpec_Type, - pyg_param_spec_new, - pyg_param_spec_from_object, - - pyg_pyobj_to_unichar_conv, - pyg_parse_constructor_args, - pyg_param_gvalue_as_pyobject, - pyg_param_gvalue_from_pyobject, - - &PyGEnum_Type, - pyg_enum_add, - pyg_enum_from_gtype, - - &PyGFlags_Type, - pyg_flags_add, - pyg_flags_from_gtype, - - /* threads_enabled */ -#ifdef DISABLE_THREADING - FALSE, -#else - TRUE, -#endif - - pygobject_enable_threads, - pygobject_gil_state_ensure, - pygobject_gil_state_release, - pyg_register_class_init, - pyg_register_interface_info, - - pyg_closure_set_exception_handler, - - add_warning_redirection, - disable_warning_redirections, - - NULL, /* previously type_register_custom */ - - pyg_gerror_exception_check, - - pyglib_option_group_new, - pyg_type_from_object_strict, - - pygobject_new_full, - &PyGObject_Type, - - pyg_value_from_pyobject_with_error -}; - -/* for addon libraries ... */ -static void -pygobject_register_api(PyObject *d) -{ - PyObject *api; - - api = PYGLIB_CPointer_WrapPointer(&pygobject_api_functions, "gobject._PyGObject_API"); - PyDict_SetItemString(d, "_PyGObject_API", api); - Py_DECREF(api); -} - -/* some constants */ -static void -pygobject_register_constants(PyObject *m) -{ - /* PyFloat_ return a new ref, and add object takes the ref */ - PyModule_AddObject(m, "G_MINFLOAT", PyFloat_FromDouble(G_MINFLOAT)); - PyModule_AddObject(m, "G_MAXFLOAT", PyFloat_FromDouble(G_MAXFLOAT)); - PyModule_AddObject(m, "G_MINDOUBLE", PyFloat_FromDouble(G_MINDOUBLE)); - PyModule_AddObject(m, "G_MAXDOUBLE", PyFloat_FromDouble(G_MAXDOUBLE)); - PyModule_AddIntConstant(m, "G_MINSHORT", G_MINSHORT); - PyModule_AddIntConstant(m, "G_MAXSHORT", G_MAXSHORT); - PyModule_AddIntConstant(m, "G_MAXUSHORT", G_MAXUSHORT); - PyModule_AddIntConstant(m, "G_MININT", G_MININT); - PyModule_AddIntConstant(m, "G_MAXINT", G_MAXINT); - PyModule_AddObject(m, "G_MAXUINT", PyLong_FromUnsignedLong(G_MAXUINT)); - PyModule_AddObject(m, "G_MINLONG", PyLong_FromLong(G_MINLONG)); - PyModule_AddObject(m, "G_MAXLONG", PyLong_FromLong(G_MAXLONG)); - PyModule_AddObject(m, "G_MAXULONG", PyLong_FromUnsignedLong(G_MAXULONG)); - PyModule_AddObject(m, "G_MAXSIZE", PyLong_FromSize_t(G_MAXSIZE)); - PyModule_AddObject(m, "G_MAXSSIZE", PyLong_FromSsize_t(G_MAXSSIZE)); - PyModule_AddObject(m, "G_MINSSIZE", PyLong_FromSsize_t(G_MINSSIZE)); - PyModule_AddObject(m, "G_MINOFFSET", PyLong_FromLongLong(G_MINOFFSET)); - PyModule_AddObject(m, "G_MAXOFFSET", PyLong_FromLongLong(G_MAXOFFSET)); - - PyModule_AddIntConstant(m, "SIGNAL_RUN_FIRST", G_SIGNAL_RUN_FIRST); - PyModule_AddIntConstant(m, "PARAM_READWRITE", G_PARAM_READWRITE); - - /* The rest of the types are set in __init__.py */ - PyModule_AddObject(m, "TYPE_INVALID", pyg_type_wrapper_new(G_TYPE_INVALID)); - PyModule_AddObject(m, "TYPE_GSTRING", pyg_type_wrapper_new(G_TYPE_GSTRING)); -} - -/* features */ -static void -pygobject_register_features(PyObject *d) -{ - PyObject *features; - - features = PyDict_New(); - PyDict_SetItemString(features, "generic-c-marshaller", Py_True); - PyDict_SetItemString(d, "features", features); - Py_DECREF(features); -} - -static void -pygobject_register_version_tuples(PyObject *d) -{ - PyObject *tuple; - - /* pygobject version */ - tuple = Py_BuildValue ("(iii)", - PYGOBJECT_MAJOR_VERSION, - PYGOBJECT_MINOR_VERSION, - PYGOBJECT_MICRO_VERSION); - PyDict_SetItemString(d, "pygobject_version", tuple); -} - -static void -pygobject_register_warnings(PyObject *d) -{ - PyObject *warning; - - warning = PyErr_NewException("gobject.Warning", PyExc_Warning, NULL); - PyDict_SetItemString(d, "Warning", warning); - add_warning_redirection("GLib", warning); - add_warning_redirection("GLib-GObject", warning); - add_warning_redirection("GThread", warning); -} - - -PYGLIB_MODULE_START(_gobject, "_gobject") -{ - PyObject *d; - - pyglib_init(); - - d = PyModule_GetDict(module); - pygobject_register_api(d); - pygobject_register_constants(module); - pygobject_register_features(d); - pygobject_register_version_tuples(d); - pygobject_register_warnings(d); - pygobject_type_register_types(d); - pygobject_object_register_types(d); - pygobject_interface_register_types(d); - pygobject_paramspec_register_types(d); - pygobject_boxed_register_types(d); - pygobject_pointer_register_types(d); - pygobject_enum_register_types(d); - pygobject_flags_register_types(d); -} -PYGLIB_MODULE_END diff --git a/gi/_gobject/pygflags.h b/gi/_gobject/pygflags.h deleted file mode 100644 index e93265c..0000000 --- a/gi/_gobject/pygflags.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pygtk- Python bindings for the GTK toolkit. - * Copyright (C) 1998-2003 James Henstridge - * 2004-2008 Johan Dahlin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGOBJECT_FLAGS_H__ -#define __PYGOBJECT_FLAGS_H__ - -void pygobject_flags_register_types(PyObject *d); - -#endif /* __PYGOBJECT_FLAGS_H__ */ diff --git a/gi/_gobject/pygobject-private.h b/gi/_gobject/pygobject-private.h deleted file mode 100644 index 294b0f6..0000000 --- a/gi/_gobject/pygobject-private.h +++ /dev/null @@ -1,204 +0,0 @@ -#ifndef _PYGOBJECT_PRIVATE_H_ -#define _PYGOBJECT_PRIVATE_H_ - -#ifdef _PYGOBJECT_H_ -# error "include pygobject.h or pygobject-private.h, but not both" -#endif - -#define _INSIDE_PYGOBJECT_ -#include "pygobject.h" - -#include "pyglib-python-compat.h" - -#define PYGOBJECT_REGISTER_GTYPE(d, type, name, gtype) \ - { \ - PyObject *o; \ - PYGLIB_REGISTER_TYPE(d, type, name); \ - PyDict_SetItemString(type.tp_dict, "__gtype__", \ - o=pyg_type_wrapper_new(gtype)); \ - Py_DECREF(o); \ -} - -/* from gobjectmodule.c */ -extern struct _PyGObject_Functions pygobject_api_functions; - - -#ifndef Py_CLEAR /* since Python 2.4 */ -# define Py_CLEAR(op) \ - do { \ - if (op) { \ - PyObject *tmp = (PyObject *)(op); \ - (op) = NULL; \ - Py_DECREF(tmp); \ - } \ - } while (0) -#endif - -extern GType PY_TYPE_OBJECT; - -extern GQuark pygboxed_type_key; -extern GQuark pygboxed_marshal_key; -extern GQuark pygenum_class_key; -extern GQuark pygflags_class_key; -extern GQuark pyginterface_type_key; -extern GQuark pyginterface_info_key; -extern GQuark pygobject_class_init_key; -extern GQuark pygobject_class_key; -extern GQuark pygobject_wrapper_key; -extern GQuark pygpointer_class_key; -extern GQuark pygobject_has_updated_constructor_key; -extern GQuark pygobject_instance_data_key; -extern GQuark pygobject_custom_key; - -void pygobject_data_free (PyGObjectData *data); -void pyg_destroy_notify (gpointer user_data); -gboolean pyg_handler_marshal (gpointer user_data); -gboolean pyg_error_check (GError **error); -int pygobject_constructv (PyGObject *self, - guint n_parameters, - GParameter *parameters); - -PyObject *pyg_integer_richcompare(PyObject *v, - PyObject *w, - int op); - -gboolean pyg_gerror_exception_check(GError **error); - -void pygobject_ref_float(PyGObject *self); -void pygobject_ref_sink(PyGObject *self); - -/* from pygtype.h */ -extern PyTypeObject PyGTypeWrapper_Type; - -PyObject *pyg_type_wrapper_new (GType type); -GType pyg_type_from_object_strict (PyObject *obj, gboolean strict); -GType pyg_type_from_object (PyObject *obj); - -gint pyg_enum_get_value (GType enum_type, PyObject *obj, gint *val); -gint pyg_flags_get_value (GType flag_type, PyObject *obj, guint *val); -int pyg_pyobj_to_unichar_conv (PyObject* py_obj, void* ptr); - -typedef PyObject *(* fromvaluefunc)(const GValue *value); -typedef int (*tovaluefunc)(GValue *value, PyObject *obj); - -void pyg_register_gtype_custom(GType gtype, - fromvaluefunc from_func, - tovaluefunc to_func); -int pyg_value_from_pyobject(GValue *value, PyObject *obj); -int pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj); -PyObject *pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed); -int pyg_param_gvalue_from_pyobject(GValue* value, - PyObject* py_obj, - const GParamSpec* pspec); -PyObject *pyg_param_gvalue_as_pyobject(const GValue* gvalue, - gboolean copy_boxed, - const GParamSpec* pspec); - -GClosure *pyg_closure_new(PyObject *callback, PyObject *extra_args, PyObject *swap_data); -void pyg_closure_set_exception_handler(GClosure *closure, - PyClosureExceptionHandler handler); -GClosure *pyg_signal_class_closure_get(void); -GClosure *gclosure_from_pyfunc(PyGObject *object, PyObject *func); - -PyObject *pyg_object_descr_doc_get(void); -void pygobject_object_register_types(PyObject *d); - -extern PyTypeObject *PyGObject_MetaType; - -/* from pygobject.h */ -extern PyTypeObject PyGObject_Type; -extern PyTypeObject PyGProps_Type; -extern PyTypeObject PyGPropsDescr_Type; -extern PyTypeObject PyGPropsIter_Type; - - /* Data that belongs to the GObject instance, not the Python wrapper */ -struct _PyGObjectData { - PyTypeObject *type; /* wrapper type for this instance */ - GSList *closures; -}; - -void pygobject_register_class (PyObject *dict, - const gchar *type_name, - GType gtype, PyTypeObject *type, - PyObject *bases); -void pygobject_register_wrapper (PyObject *self); -PyObject * pygobject_new (GObject *obj); -PyObject * pygobject_new_full (GObject *obj, gboolean steal, gpointer g_class); -void pygobject_sink (GObject *obj); -PyTypeObject *pygobject_lookup_class (GType gtype); -void pygobject_watch_closure (PyObject *self, GClosure *closure); -int pyg_type_register (PyTypeObject *class, - const gchar *type_name); - -/* from pygboxed.c */ -extern PyTypeObject PyGBoxed_Type; - -void pyg_register_boxed (PyObject *dict, const gchar *class_name, - GType boxed_type, PyTypeObject *type); -PyObject * pyg_boxed_new (GType boxed_type, gpointer boxed, - gboolean copy_boxed, gboolean own_ref); - -extern PyTypeObject PyGPointer_Type; - -void pyg_register_pointer (PyObject *dict, const gchar *class_name, - GType pointer_type, PyTypeObject *type); -PyObject * pyg_pointer_new (GType pointer_type, gpointer pointer); - -const gchar * pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix); - -/* pygflags */ -typedef struct { - PYGLIB_PyLongObject parent; - int zero_pad; /* must always be 0 */ - GType gtype; -} PyGFlags; - -extern PyTypeObject PyGFlags_Type; - -#define PyGFlags_Check(x) (PyObject_IsInstance((PyObject *)x, (PyObject *)&PyGFlags_Type) && g_type_is_a(((PyGFlags*)x)->gtype, G_TYPE_FLAGS)) - -extern PyObject * pyg_flags_add (PyObject * module, - const char * type_name, - const char * strip_prefix, - GType gtype); -extern PyObject * pyg_flags_from_gtype (GType gtype, - guint value); - -/* pygenum */ -#define PyGEnum_Check(x) (PyObject_IsInstance((PyObject *)x, (PyObject *)&PyGEnum_Type) && g_type_is_a(((PyGFlags*)x)->gtype, G_TYPE_ENUM)) - -typedef struct { - PYGLIB_PyLongObject parent; - int zero_pad; /* must always be 0 */ - GType gtype; -} PyGEnum; - -extern PyTypeObject PyGEnum_Type; - -extern PyObject * pyg_enum_add (PyObject * module, - const char * type_name, - const char * strip_prefix, - GType gtype); -extern PyObject * pyg_enum_from_gtype (GType gtype, - int value); - -/* pygtype.c */ -extern gboolean pyg_gtype_is_custom (GType gtype); - -/* pygobject.c */ -extern PyTypeObject PyGObjectWeakRef_Type; - -static inline PyGObjectData * -pyg_object_peek_inst_data(GObject *obj) -{ - return ((PyGObjectData *) - g_object_get_qdata(obj, pygobject_instance_data_key)); -} - -gboolean pygobject_prepare_construct_properties (GObjectClass *class, - PyObject *kwargs, - guint *n_params, - GParameter **params); - - -#endif diff --git a/gi/_gobject/pygparamspec.c b/gi/_gobject/pygparamspec.c deleted file mode 100644 index 94f1dbb..0000000 --- a/gi/_gobject/pygparamspec.c +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pygtk- Python bindings for the GTK toolkit. - * Copyright (C) 1998-2003 James Henstridge - * Copyright (C) 2004 Johan Dahlin - * - * pygenum.c: GEnum and GFlag wrappers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "pygobject-private.h" -#include "pygparamspec.h" - -PYGLIB_DEFINE_TYPE("gobject.GParamSpec", PyGParamSpec_Type, PyGParamSpec); - -static PyObject* -pyg_param_spec_richcompare(PyObject *self, PyObject *other, int op) -{ - if (Py_TYPE(self) == Py_TYPE(other) && Py_TYPE(self) == &PyGParamSpec_Type) - return _pyglib_generic_ptr_richcompare(((PyGParamSpec*)self)->pspec, - ((PyGParamSpec*)other)->pspec, - op); - else { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } -} - -static long -pyg_param_spec_hash(PyGParamSpec *self) -{ - return (long)self->pspec; -} - -static PyObject * -pyg_param_spec_repr(PyGParamSpec *self) -{ - char buf[80]; - - g_snprintf(buf, sizeof(buf), "<%s '%s'>", - G_PARAM_SPEC_TYPE_NAME(self->pspec), - g_param_spec_get_name(self->pspec)); - return PYGLIB_PyUnicode_FromString(buf); -} - -static void -pyg_param_spec_dealloc(PyGParamSpec *self) -{ - g_param_spec_unref(self->pspec); - PyObject_DEL(self); -} - - -static PyObject * -pygenum_from_pspec(GParamSpec *pspec) -{ - PyObject *pyclass; - GParamSpecEnum *enum_pspec; - GType enum_type; - - enum_pspec = G_PARAM_SPEC_ENUM(pspec); - enum_type = G_ENUM_CLASS_TYPE(enum_pspec->enum_class); - pyclass = (PyObject*)g_type_get_qdata(enum_type, pygenum_class_key); - if (pyclass == NULL) { - pyclass = pyg_enum_add(NULL, g_type_name(enum_type), NULL, enum_type); - if (pyclass == NULL) - pyclass = Py_None; - } - - Py_INCREF(pyclass); - return pyclass; -} - -static PyObject * -pygflags_from_pspec(GParamSpec *pspec) -{ - PyObject *pyclass; - GParamSpecFlags *flag_pspec; - GType flag_type; - - flag_pspec = G_PARAM_SPEC_FLAGS(pspec); - flag_type = G_FLAGS_CLASS_TYPE(flag_pspec->flags_class); - pyclass = (PyObject*)g_type_get_qdata(flag_type, pygflags_class_key); - if (pyclass == NULL) { - pyclass = pyg_flags_add(NULL, g_type_name(flag_type), NULL, flag_type); - if (pyclass == NULL) - pyclass = Py_None; - } - Py_INCREF(pyclass); - return pyclass; -} - -static PyObject * -pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) -{ - GParamSpec *pspec; - - pspec = self->pspec; - - /* common attributes */ - if (!strcmp(attr, "__gtype__")) { - return pyg_type_wrapper_new(G_PARAM_SPEC_TYPE(pspec)); - } else if (!strcmp(attr, "name")) { - return Py_BuildValue("s", g_param_spec_get_name(pspec)); - } else if (!strcmp(attr, "nick")) { - return Py_BuildValue("s", g_param_spec_get_nick(pspec)); - } else if (!strcmp(attr, "blurb") || !strcmp(attr, "__doc__")) { - return Py_BuildValue("s", g_param_spec_get_blurb(pspec)); - } else if (!strcmp(attr, "flags")) { - return PYGLIB_PyLong_FromLong(pspec->flags); - } else if (!strcmp(attr, "value_type")) { - return pyg_type_wrapper_new(pspec->value_type); - } else if (!strcmp(attr, "owner_type")) { - return pyg_type_wrapper_new(pspec->owner_type); - } - - if (G_IS_PARAM_SPEC_CHAR(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", "flags", - "maximum", "minimum", "name", "nick", - "owner_type", "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PYGLIB_PyUnicode_FromFormat( - "%c", G_PARAM_SPEC_CHAR(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_CHAR(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_CHAR(pspec)->maximum); - } - } else if (G_IS_PARAM_SPEC_UCHAR(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "maximum", "minimum", - "name", "nick", "owner_type", - "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PYGLIB_PyUnicode_FromFormat( - "%c", G_PARAM_SPEC_UCHAR(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_UCHAR(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_UCHAR(pspec)->maximum); - } - } else if (G_IS_PARAM_SPEC_BOOLEAN(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "name", "nick", "owner_type", - "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PyBool_FromLong(G_PARAM_SPEC_BOOLEAN(pspec)->default_value); - } - } else if (G_IS_PARAM_SPEC_INT(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "maximum", "minimum", "name", - "nick", "owner_type", "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->maximum); - } - } else if (G_IS_PARAM_SPEC_UINT(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "maximum", "minimum", - "name", "nick", "owner_type", - "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PyLong_FromUnsignedLong(G_PARAM_SPEC_UINT(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PyLong_FromUnsignedLong(G_PARAM_SPEC_UINT(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PyLong_FromUnsignedLong(G_PARAM_SPEC_UINT(pspec)->maximum); - } - } else if (G_IS_PARAM_SPEC_LONG(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "maximum", "minimum", "name", - "nick", "owner_type", "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PyLong_FromLong(G_PARAM_SPEC_LONG(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PyLong_FromLong(G_PARAM_SPEC_LONG(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PyLong_FromLong(G_PARAM_SPEC_LONG(pspec)->maximum); - } - } else if (G_IS_PARAM_SPEC_ULONG(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "maximum", "minimum", "name", - "nick", "owner_type", "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PyLong_FromUnsignedLong(G_PARAM_SPEC_ULONG(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PyLong_FromUnsignedLong(G_PARAM_SPEC_ULONG(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PyLong_FromUnsignedLong(G_PARAM_SPEC_ULONG(pspec)->maximum); - } - } else if (G_IS_PARAM_SPEC_INT64(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "maximum", "minimum", "name", - "nick", "owner_type", "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PyLong_FromLongLong(G_PARAM_SPEC_INT64(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PyLong_FromLongLong(G_PARAM_SPEC_INT64(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PyLong_FromLongLong(G_PARAM_SPEC_INT64(pspec)->maximum); - } - } else if (G_IS_PARAM_SPEC_UINT64(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "maximum", "minimum", - "name", "nick", "owner_type", - "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PyLong_FromUnsignedLongLong(G_PARAM_SPEC_UINT64(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PyLong_FromUnsignedLongLong(G_PARAM_SPEC_UINT64(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PyLong_FromUnsignedLongLong(G_PARAM_SPEC_UINT64(pspec)->maximum); - } - } else if (G_IS_PARAM_SPEC_UNICHAR(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[sssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "name", "nick", "owner_type", - "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PYGLIB_PyUnicode_FromFormat( - "%c", G_PARAM_SPEC_UNICHAR(pspec)->default_value); - } - } else if (G_IS_PARAM_SPEC_ENUM(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[ssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", "enum_class", - "flags", "name", "nick", "owner_type", - "value_type"); - } else if (!strcmp(attr, "default_value")) { - return pyg_enum_from_gtype( - pspec->value_type, G_PARAM_SPEC_ENUM(pspec)->default_value); - } else if (!strcmp(attr, "enum_class")) { - return pygenum_from_pspec(pspec); - } - } else if (G_IS_PARAM_SPEC_FLAGS(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[ssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", - "flags", "flags_class", "name", "nick", - "owner_type", "value_type"); - } else if (!strcmp(attr, "default_value")) { - return pyg_flags_from_gtype( - pspec->value_type, G_PARAM_SPEC_FLAGS(pspec)->default_value); - } else if (!strcmp(attr, "flags_class")) { - return pygflags_from_pspec(pspec); - } - } else if (G_IS_PARAM_SPEC_FLOAT(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[ssssssssssss]", "__doc__", "__gtype__", - "blurb", "epsilon", - "flags", "maximum", "minimum", "name", "nick", "owner_type", - "value_type", - "default_value"); - } else if (!strcmp(attr, "default_value")) { - return PyFloat_FromDouble(G_PARAM_SPEC_FLOAT(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PyFloat_FromDouble(G_PARAM_SPEC_FLOAT(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PyFloat_FromDouble(G_PARAM_SPEC_FLOAT(pspec)->maximum); - } else if (!strcmp(attr, "epsilon")) { - return PyFloat_FromDouble(G_PARAM_SPEC_FLOAT(pspec)->epsilon); - } - } else if (G_IS_PARAM_SPEC_DOUBLE(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[ssssssssssss]", "__doc__", "__gtype__", - "blurb", "default_value", "epsilon", - "flags", "maximum", "minimum", "name", "nick", - "owner_type", "value_type"); - } else if (!strcmp(attr, "default_value")) { - return PyFloat_FromDouble( - G_PARAM_SPEC_DOUBLE(pspec)->default_value); - } else if (!strcmp(attr, "minimum")) { - return PyFloat_FromDouble(G_PARAM_SPEC_DOUBLE(pspec)->minimum); - } else if (!strcmp(attr, "maximum")) { - return PyFloat_FromDouble(G_PARAM_SPEC_DOUBLE(pspec)->maximum); - } else if (!strcmp(attr, "epsilon")) { - return PyFloat_FromDouble(G_PARAM_SPEC_DOUBLE(pspec)->epsilon); - } - } else if (G_IS_PARAM_SPEC_STRING(pspec)) { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[ssssssssssssss]", "__doc__", "__gtype__", - "blurb", "cset_first", "cset_nth", "default_value", - "ensure_non_null", "flags", "name", "nick", - "null_fold_if_empty", "owner_type", "substitutor", - "value_type"); - } else if (!strcmp(attr, "default_value")) { - return Py_BuildValue( - "s", G_PARAM_SPEC_STRING(pspec)->default_value); - } else if (!strcmp(attr, "cset_first")) { - return Py_BuildValue( - "s", G_PARAM_SPEC_STRING(pspec)->cset_first); - } else if (!strcmp(attr, "cset_nth")) { - return Py_BuildValue( - "s", G_PARAM_SPEC_STRING(pspec)->cset_nth); - } else if (!strcmp(attr, "substitutor")) { - return Py_BuildValue( - "c", G_PARAM_SPEC_STRING(pspec)->substitutor); - } else if (!strcmp(attr, "null_fold_if_empty")) { - return PyBool_FromLong( - G_PARAM_SPEC_STRING(pspec)->null_fold_if_empty); - } else if (!strcmp(attr, "ensure_non_null")) { - return PyBool_FromLong( - G_PARAM_SPEC_STRING(pspec)->ensure_non_null); - } - } else { - if (!strcmp(attr, "__members__")) { - return Py_BuildValue("[ssssssss]", "__doc__", "__gtype__", "blurb", - "flags", "name", "nick", - "owner_type", "value_type"); - - /* This is actually not what's exported by GObjects paramspecs, - * But we exported this in earlier versions, so it's better to keep it here - * compatibility. But don't add it in __members__, to "hide" it. - */ - } else if (!strcmp(attr, "default_value")) { - /* XXX: Raise deprecation warning */ - Py_INCREF(Py_None); - return Py_None; - } - } - - PyErr_SetString(PyExc_AttributeError, attr); - return NULL; -} - -/** - * pyg_param_spec_new: - * @pspec: a GParamSpec. - * - * Creates a wrapper for a GParamSpec. - * - * Returns: the GParamSpec wrapper. - */ -PyObject * -pyg_param_spec_new(GParamSpec *pspec) -{ - PyGParamSpec *self; - - self = (PyGParamSpec *)PyObject_NEW(PyGParamSpec, - &PyGParamSpec_Type); - if (self == NULL) - return NULL; - - self->pspec = g_param_spec_ref(pspec); - return (PyObject *)self; -} - -void -pygobject_paramspec_register_types(PyObject *d) -{ - Py_TYPE(&PyGParamSpec_Type) = &PyType_Type; - PyGParamSpec_Type.tp_dealloc = (destructor)pyg_param_spec_dealloc; - PyGParamSpec_Type.tp_getattr = (getattrfunc)pyg_param_spec_getattr; - PyGParamSpec_Type.tp_richcompare = pyg_param_spec_richcompare; - PyGParamSpec_Type.tp_flags = Py_TPFLAGS_DEFAULT; - PyGParamSpec_Type.tp_repr = (reprfunc)pyg_param_spec_repr; - PyGParamSpec_Type.tp_hash = (hashfunc)pyg_param_spec_hash; - - - if (PyType_Ready(&PyGParamSpec_Type)) - return; - PyDict_SetItemString(d, "GParamSpec", (PyObject *)&PyGParamSpec_Type); -} diff --git a/gi/_gobject/pygtype.c b/gi/_gobject/pygtype.c deleted file mode 100644 index 9dc1153..0000000 --- a/gi/_gobject/pygtype.c +++ /dev/null @@ -1,1927 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pygtk- Python bindings for the GTK toolkit. - * Copyright (C) 1998-2003 James Henstridge - * - * pygtype.c: glue code to wrap the GType code. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "pygobject-private.h" -#include "pygparamspec.h" -#include "pygtype.h" - -/* -------------- __gtype__ objects ---------------------------- */ - -typedef struct { - PyObject_HEAD - GType type; -} PyGTypeWrapper; - -PYGLIB_DEFINE_TYPE("gobject.GType", PyGTypeWrapper_Type, PyGTypeWrapper); - -static PyObject* -pyg_type_wrapper_richcompare(PyObject *self, PyObject *other, int op) -{ - if (Py_TYPE(self) == Py_TYPE(other) && Py_TYPE(self) == &PyGTypeWrapper_Type) - return _pyglib_generic_long_richcompare(((PyGTypeWrapper*)self)->type, - ((PyGTypeWrapper*)other)->type, - op); - else { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } -} - -static long -pyg_type_wrapper_hash(PyGTypeWrapper *self) -{ - return (long)self->type; -} - -static PyObject * -pyg_type_wrapper_repr(PyGTypeWrapper *self) -{ - char buf[80]; - const gchar *name = g_type_name(self->type); - - g_snprintf(buf, sizeof(buf), "", - name?name:"invalid", (unsigned long int) self->type); - return PYGLIB_PyUnicode_FromString(buf); -} - -static void -pyg_type_wrapper_dealloc(PyGTypeWrapper *self) -{ - PyObject_DEL(self); -} - -static GQuark -_pyg_type_key(GType type) { - GQuark key; - - if (g_type_is_a(type, G_TYPE_INTERFACE)) { - key = pyginterface_type_key; - } else if (g_type_is_a(type, G_TYPE_ENUM)) { - key = pygenum_class_key; - } else if (g_type_is_a(type, G_TYPE_FLAGS)) { - key = pygflags_class_key; - } else if (g_type_is_a(type, G_TYPE_POINTER)) { - key = pygpointer_class_key; - } else if (g_type_is_a(type, G_TYPE_BOXED)) { - key = pygboxed_type_key; - } else { - key = pygobject_class_key; - } - - return key; -} - -static PyObject * -_wrap_g_type_wrapper__get_pytype(PyGTypeWrapper *self, void *closure) -{ - GQuark key; - PyObject *py_type; - - key = _pyg_type_key(self->type); - - py_type = g_type_get_qdata(self->type, key); - if (!py_type) - py_type = Py_None; - - Py_INCREF(py_type); - return py_type; -} - -static int -_wrap_g_type_wrapper__set_pytype(PyGTypeWrapper *self, PyObject* value, void *closure) -{ - GQuark key; - PyObject *py_type; - - key = _pyg_type_key(self->type); - - py_type = g_type_get_qdata(self->type, key); - Py_CLEAR(py_type); - if (value == Py_None) - g_type_set_qdata(self->type, key, NULL); - else if (PyType_Check(value)) { - Py_INCREF(value); - g_type_set_qdata(self->type, key, value); - } else { - PyErr_SetString(PyExc_TypeError, "Value must be None or a type object"); - return -1; - } - - return 0; -} - -static PyObject * -_wrap_g_type_wrapper__get_name(PyGTypeWrapper *self, void *closure) -{ - const char *name = g_type_name(self->type); - return PYGLIB_PyUnicode_FromString(name ? name : "invalid"); -} - -static PyObject * -_wrap_g_type_wrapper__get_parent(PyGTypeWrapper *self, void *closure) -{ - return pyg_type_wrapper_new(g_type_parent(self->type)); -} - -static PyObject * -_wrap_g_type_wrapper__get_fundamental(PyGTypeWrapper *self, void *closure) -{ - return pyg_type_wrapper_new(g_type_fundamental(self->type)); -} - -static PyObject * -_wrap_g_type_wrapper__get_children(PyGTypeWrapper *self, void *closure) -{ - guint n_children, i; - GType *children; - PyObject *retval; - - children = g_type_children(self->type, &n_children); - - retval = PyList_New(n_children); - for (i = 0; i < n_children; i++) - PyList_SetItem(retval, i, pyg_type_wrapper_new(children[i])); - g_free(children); - - return retval; -} - -static PyObject * -_wrap_g_type_wrapper__get_interfaces(PyGTypeWrapper *self, void *closure) -{ - guint n_interfaces, i; - GType *interfaces; - PyObject *retval; - - interfaces = g_type_interfaces(self->type, &n_interfaces); - - retval = PyList_New(n_interfaces); - for (i = 0; i < n_interfaces; i++) - PyList_SetItem(retval, i, pyg_type_wrapper_new(interfaces[i])); - g_free(interfaces); - - return retval; -} - -static PyObject * -_wrap_g_type_wrapper__get_depth(PyGTypeWrapper *self, void *closure) -{ - return PYGLIB_PyLong_FromLong(g_type_depth(self->type)); -} - -static PyGetSetDef _PyGTypeWrapper_getsets[] = { - { "pytype", (getter)_wrap_g_type_wrapper__get_pytype, (setter)_wrap_g_type_wrapper__set_pytype }, - { "name", (getter)_wrap_g_type_wrapper__get_name, (setter)0 }, - { "fundamental", (getter)_wrap_g_type_wrapper__get_fundamental, (setter)0 }, - { "parent", (getter)_wrap_g_type_wrapper__get_parent, (setter)0 }, - { "children", (getter)_wrap_g_type_wrapper__get_children, (setter)0 }, - { "interfaces", (getter)_wrap_g_type_wrapper__get_interfaces, (setter)0 }, - { "depth", (getter)_wrap_g_type_wrapper__get_depth, (setter)0 }, - { NULL, (getter)0, (setter)0 } -}; - -static PyObject* -_wrap_g_type_is_interface(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_IS_INTERFACE(self->type)); -} - -static PyObject* -_wrap_g_type_is_classed(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_IS_CLASSED(self->type)); -} - -static PyObject* -_wrap_g_type_is_instantiatable(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_IS_INSTANTIATABLE(self->type)); -} - -static PyObject* -_wrap_g_type_is_derivable(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_IS_DERIVABLE(self->type)); -} - -static PyObject* -_wrap_g_type_is_deep_derivable(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_IS_DEEP_DERIVABLE(self->type)); -} - -static PyObject* -_wrap_g_type_is_abstract(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_IS_ABSTRACT(self->type)); -} - -static PyObject* -_wrap_g_type_is_value_abstract(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_IS_VALUE_ABSTRACT(self->type)); -} - -static PyObject* -_wrap_g_type_is_value_type(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_IS_VALUE_TYPE(self->type)); -} - -static PyObject* -_wrap_g_type_has_value_table(PyGTypeWrapper *self) -{ - return PyBool_FromLong(G_TYPE_HAS_VALUE_TABLE(self->type)); -} - -static PyObject* -_wrap_g_type_from_name(PyGTypeWrapper *_, PyObject *args) -{ - char *type_name; - GType type; - - if (!PyArg_ParseTuple(args, "s:GType.from_name", &type_name)) - return NULL; - - type = g_type_from_name(type_name); - if (type == 0) { - PyErr_SetString(PyExc_RuntimeError, "unknown type name"); - return NULL; - } - - return pyg_type_wrapper_new(type); -} - -static PyObject* -_wrap_g_type_is_a(PyGTypeWrapper *self, PyObject *args) -{ - PyObject *gparent; - GType parent; - - if (!PyArg_ParseTuple(args, "O:GType.is_a", &gparent)) - return NULL; - else if ((parent = pyg_type_from_object(gparent)) == 0) - return NULL; - - return PyBool_FromLong(g_type_is_a(self->type, parent)); -} - -static PyMethodDef _PyGTypeWrapper_methods[] = { - { "is_interface", (PyCFunction)_wrap_g_type_is_interface, METH_NOARGS }, - { "is_classed", (PyCFunction)_wrap_g_type_is_classed, METH_NOARGS }, - { "is_instantiatable", (PyCFunction)_wrap_g_type_is_instantiatable, METH_NOARGS }, - { "is_derivable", (PyCFunction)_wrap_g_type_is_derivable, METH_NOARGS }, - { "is_deep_derivable", (PyCFunction)_wrap_g_type_is_deep_derivable, METH_NOARGS }, - { "is_abstract", (PyCFunction)_wrap_g_type_is_abstract, METH_NOARGS }, - { "is_value_abstract", (PyCFunction)_wrap_g_type_is_value_abstract, METH_NOARGS }, - { "is_value_type", (PyCFunction)_wrap_g_type_is_value_type, METH_NOARGS }, - { "has_value_table", (PyCFunction)_wrap_g_type_has_value_table, METH_NOARGS }, - { "from_name", (PyCFunction)_wrap_g_type_from_name, METH_VARARGS | METH_STATIC }, - { "is_a", (PyCFunction)_wrap_g_type_is_a, METH_VARARGS }, - { NULL, 0, 0 } -}; - -static int -pyg_type_wrapper_init(PyGTypeWrapper *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = { "object", NULL }; - PyObject *py_object; - GType type; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "O:GType.__init__", - kwlist, &py_object)) - return -1; - - if (!(type = pyg_type_from_object(py_object))) - return -1; - - self->type = type; - - return 0; -} - -/** - * pyg_type_wrapper_new: - * type: a GType - * - * Creates a Python wrapper for a GType. - * - * Returns: the Python wrapper. - */ -PyObject * -pyg_type_wrapper_new(GType type) -{ - PyGTypeWrapper *self; - - self = (PyGTypeWrapper *)PyObject_NEW(PyGTypeWrapper, - &PyGTypeWrapper_Type); - if (self == NULL) - return NULL; - - self->type = type; - return (PyObject *)self; -} - -/** - * pyg_type_from_object_strict: - * obj: a Python object - * strict: if set to TRUE, raises an exception if it can't perform the - * conversion - * - * converts a python object to a GType. If strict is set, raises an - * exception if it can't perform the conversion, otherwise returns - * PY_TYPE_OBJECT. - * - * Returns: the corresponding GType, or 0 on error. - */ - -GType -pyg_type_from_object_strict(PyObject *obj, gboolean strict) -{ - PyObject *gtype; - GType type; - - /* NULL check */ - if (!obj) { - PyErr_SetString(PyExc_TypeError, "can't get type from NULL object"); - return 0; - } - - /* map some standard types to primitive GTypes ... */ - if (obj == Py_None) - return G_TYPE_NONE; - if (PyType_Check(obj)) { - PyTypeObject *tp = (PyTypeObject *)obj; - - if (tp == &PYGLIB_PyLong_Type) - return G_TYPE_INT; - else if (tp == &PyBool_Type) - return G_TYPE_BOOLEAN; - else if (tp == &PyLong_Type) - return G_TYPE_LONG; - else if (tp == &PyFloat_Type) - return G_TYPE_DOUBLE; - else if (tp == &PYGLIB_PyUnicode_Type) - return G_TYPE_STRING; - else if (tp == &PyBaseObject_Type) - return PY_TYPE_OBJECT; - } - - if (Py_TYPE(obj) == &PyGTypeWrapper_Type) { - return ((PyGTypeWrapper *)obj)->type; - } - - /* handle strings */ - if (PYGLIB_PyUnicode_Check(obj)) { - gchar *name = PYGLIB_PyUnicode_AsString(obj); - - type = g_type_from_name(name); - if (type != 0) { - return type; - } - } - - /* finally, look for a __gtype__ attribute on the object */ - gtype = PyObject_GetAttrString(obj, "__gtype__"); - - if (gtype) { - if (Py_TYPE(gtype) == &PyGTypeWrapper_Type) { - type = ((PyGTypeWrapper *)gtype)->type; - Py_DECREF(gtype); - return type; - } - Py_DECREF(gtype); - } - - PyErr_Clear(); - - /* Some API like those that take GValues can hold a python object as - * a pointer. This is potentially dangerous becuase everything is - * passed in as a PyObject so we can't actually type check it. Only - * fallback to PY_TYPE_OBJECT if strict checking is disabled - */ - if (!strict) - return PY_TYPE_OBJECT; - - PyErr_SetString(PyExc_TypeError, "could not get typecode from object"); - return 0; -} - -/** - * pyg_type_from_object: - * obj: a Python object - * - * converts a python object to a GType. Raises an exception if it - * can't perform the conversion. - * - * Returns: the corresponding GType, or 0 on error. - */ -GType -pyg_type_from_object(PyObject *obj) -{ - /* Legacy call always defaults to strict type checking */ - return pyg_type_from_object_strict(obj, TRUE); -} - -/* -------------- GValue marshalling ------------------ */ - -/** - * pyg_enum_get_value: - * @enum_type: the GType of the flag. - * @obj: a Python object representing the flag value - * @val: a pointer to the location to store the integer representation of the flag. - * - * Converts a Python object to the integer equivalent. The conversion - * will depend on the type of the Python object. If the object is an - * integer, it is passed through directly. If it is a string, it will - * be treated as a full or short enum name as defined in the GType. - * - * Returns: 0 on success or -1 on failure - */ -gint -pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val) -{ - GEnumClass *eclass = NULL; - gint res = -1; - - g_return_val_if_fail(val != NULL, -1); - if (!obj) { - *val = 0; - res = 0; - } else if (PYGLIB_PyLong_Check(obj)) { - *val = PYGLIB_PyLong_AsLong(obj); - res = 0; - - if (PyObject_TypeCheck(obj, &PyGEnum_Type) && ((PyGEnum *) obj)->gtype != enum_type) { - g_warning("expected enumeration type %s, but got %s instead", - g_type_name(enum_type), - g_type_name(((PyGEnum *) obj)->gtype)); - } - /* Dumb code duplication, but probably not worth it to have yet another macro. */ - } else if (PyLong_Check(obj)) { - *val = PyLong_AsLong(obj); - res = 0; - - if (PyObject_TypeCheck(obj, &PyGEnum_Type) && ((PyGEnum *) obj)->gtype != enum_type) { - g_warning("expected enumeration type %s, but got %s instead", - g_type_name(enum_type), - g_type_name(((PyGEnum *) obj)->gtype)); - } - } else if (PYGLIB_PyUnicode_Check(obj)) { - GEnumValue *info; - char *str = PYGLIB_PyUnicode_AsString(obj); - - if (enum_type != G_TYPE_NONE) - eclass = G_ENUM_CLASS(g_type_class_ref(enum_type)); - else { - PyErr_SetString(PyExc_TypeError, "could not convert string to enum because there is no GType associated to look up the value"); - res = -1; - } - info = g_enum_get_value_by_name(eclass, str); - g_type_class_unref(eclass); - - if (!info) - info = g_enum_get_value_by_nick(eclass, str); - if (info) { - *val = info->value; - res = 0; - } else { - PyErr_SetString(PyExc_TypeError, "could not convert string"); - res = -1; - } - } else { - PyErr_SetString(PyExc_TypeError,"enum values must be strings or ints"); - res = -1; - } - return res; -} - -/** - * pyg_flags_get_value: - * @flag_type: the GType of the flag. - * @obj: a Python object representing the flag value - * @val: a pointer to the location to store the integer representation of the flag. - * - * Converts a Python object to the integer equivalent. The conversion - * will depend on the type of the Python object. If the object is an - * integer, it is passed through directly. If it is a string, it will - * be treated as a full or short flag name as defined in the GType. - * If it is a tuple, then the items are treated as strings and ORed - * together. - * - * Returns: 0 on success or -1 on failure - */ -gint -pyg_flags_get_value(GType flag_type, PyObject *obj, guint *val) -{ - GFlagsClass *fclass = NULL; - gint res = -1; - - g_return_val_if_fail(val != NULL, -1); - if (!obj) { - *val = 0; - res = 0; - } else if (PYGLIB_PyLong_Check(obj)) { - *val = PYGLIB_PyLong_AsUnsignedLong(obj); - res = 0; - } else if (PyLong_Check(obj)) { - *val = PyLong_AsLongLong(obj); - res = 0; - } else if (PYGLIB_PyUnicode_Check(obj)) { - GFlagsValue *info; - char *str = PYGLIB_PyUnicode_AsString(obj); - - if (flag_type != G_TYPE_NONE) - fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type)); - else { - PyErr_SetString(PyExc_TypeError, "could not convert string to flag because there is no GType associated to look up the value"); - res = -1; - } - info = g_flags_get_value_by_name(fclass, str); - g_type_class_unref(fclass); - - if (!info) - info = g_flags_get_value_by_nick(fclass, str); - if (info) { - *val = info->value; - res = 0; - } else { - PyErr_SetString(PyExc_TypeError, "could not convert string"); - res = -1; - } - } else if (PyTuple_Check(obj)) { - int i, len; - - len = PyTuple_Size(obj); - *val = 0; - res = 0; - - if (flag_type != G_TYPE_NONE) - fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type)); - else { - PyErr_SetString(PyExc_TypeError, "could not convert string to flag because there is no GType associated to look up the value"); - res = -1; - } - - for (i = 0; i < len; i++) { - PyObject *item = PyTuple_GetItem(obj, i); - char *str = PYGLIB_PyUnicode_AsString(item); - GFlagsValue *info = g_flags_get_value_by_name(fclass, str); - - if (!info) - info = g_flags_get_value_by_nick(fclass, str); - if (info) { - *val |= info->value; - } else { - PyErr_SetString(PyExc_TypeError, "could not convert string"); - res = -1; - break; - } - } - g_type_class_unref(fclass); - } else { - PyErr_SetString(PyExc_TypeError, - "flag values must be strings, ints, longs, or tuples"); - res = -1; - } - return res; -} - -typedef struct { - fromvaluefunc fromvalue; - tovaluefunc tovalue; -} PyGTypeMarshal; -static GQuark pyg_type_marshal_key = 0; - -static PyGTypeMarshal * -pyg_type_lookup(GType type) -{ - GType ptype = type; - PyGTypeMarshal *tm = NULL; - - /* recursively lookup types */ - while (ptype) { - if ((tm = g_type_get_qdata(ptype, pyg_type_marshal_key)) != NULL) - break; - ptype = g_type_parent(ptype); - } - return tm; -} - -/** - * pyg_register_gtype_custom: - * @gtype: the GType for the new type - * @from_func: a function to convert GValues to Python objects - * @to_func: a function to convert Python objects to GValues - * - * In order to handle specific conversion of gboxed types or new - * fundamental types, you may use this function to register conversion - * handlers. - */ - -void -pyg_register_gtype_custom(GType gtype, - fromvaluefunc from_func, - tovaluefunc to_func) -{ - PyGTypeMarshal *tm; - - if (!pyg_type_marshal_key) - pyg_type_marshal_key = g_quark_from_static_string("PyGType::marshal"); - - tm = g_new(PyGTypeMarshal, 1); - tm->fromvalue = from_func; - tm->tovalue = to_func; - g_type_set_qdata(gtype, pyg_type_marshal_key, tm); -} - -static int -pyg_value_array_from_pyobject(GValue *value, - PyObject *obj, - const GParamSpecValueArray *pspec) -{ - int len; - GValueArray *value_array; - int i; - - len = PySequence_Length(obj); - if (len == -1) { - PyErr_Clear(); - return -1; - } - - if (pspec && pspec->fixed_n_elements > 0 && len != pspec->fixed_n_elements) - return -1; - - value_array = g_value_array_new(len); - - for (i = 0; i < len; ++i) { - PyObject *item = PySequence_GetItem(obj, i); - GType type; - GValue item_value = { 0, }; - int status; - - if (! item) { - PyErr_Clear(); - g_value_array_free(value_array); - return -1; - } - - if (pspec && pspec->element_spec) - type = G_PARAM_SPEC_VALUE_TYPE(pspec->element_spec); - else if (item == Py_None) - type = G_TYPE_POINTER; /* store None as NULL */ - else { - type = pyg_type_from_object((PyObject*)Py_TYPE(item)); - if (! type) { - PyErr_Clear(); - g_value_array_free(value_array); - Py_DECREF(item); - return -1; - } - } - - g_value_init(&item_value, type); - status = (pspec && pspec->element_spec) - ? pyg_param_gvalue_from_pyobject(&item_value, item, pspec->element_spec) - : pyg_value_from_pyobject(&item_value, item); - Py_DECREF(item); - - if (status == -1) { - g_value_array_free(value_array); - g_value_unset(&item_value); - return -1; - } - - g_value_array_append(value_array, &item_value); - g_value_unset(&item_value); - } - - g_value_take_boxed(value, value_array); - return 0; -} - -static int -pyg_array_from_pyobject(GValue *value, - PyObject *obj) -{ - int len; - GArray *array; - int i; - - len = PySequence_Length(obj); - if (len == -1) { - PyErr_Clear(); - return -1; - } - - array = g_array_new(FALSE, TRUE, sizeof(GValue)); - - for (i = 0; i < len; ++i) { - PyObject *item = PySequence_GetItem(obj, i); - GType type; - GValue item_value = { 0, }; - int status; - - if (! item) { - PyErr_Clear(); - g_array_free(array, FALSE); - return -1; - } - - if (item == Py_None) - type = G_TYPE_POINTER; /* store None as NULL */ - else { - type = pyg_type_from_object((PyObject*)Py_TYPE(item)); - if (! type) { - PyErr_Clear(); - g_array_free(array, FALSE); - Py_DECREF(item); - return -1; - } - } - - g_value_init(&item_value, type); - status = pyg_value_from_pyobject(&item_value, item); - Py_DECREF(item); - - if (status == -1) { - g_array_free(array, FALSE); - g_value_unset(&item_value); - return -1; - } - - g_array_append_val(array, item_value); - } - - g_value_take_boxed(value, array); - return 0; -} - -/** - * pyg_value_from_pyobject_with_error: - * @value: the GValue object to store the converted value in. - * @obj: the Python object to convert. - * - * This function converts a Python object and stores the result in a - * GValue. The GValue must be initialised in advance with - * g_value_init(). If the Python object can't be converted to the - * type of the GValue, then an error is returned. - * - * Returns: 0 on success, -1 on error. - */ -int -pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj) -{ - PyObject *tmp; - GType value_type = G_VALUE_TYPE(value); - - switch (G_TYPE_FUNDAMENTAL(value_type)) { - case G_TYPE_INTERFACE: - /* we only handle interface types that have a GObject prereq */ - if (g_type_is_a(value_type, G_TYPE_OBJECT)) { - if (obj == Py_None) - g_value_set_object(value, NULL); - else { - if (!PyObject_TypeCheck(obj, &PyGObject_Type)) { - PyErr_SetString(PyExc_TypeError, "GObject is required"); - return -1; - } - if (!G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), - value_type)) { - PyErr_SetString(PyExc_TypeError, "Invalid GObject type for assignment"); - return -1; - } - g_value_set_object(value, pygobject_get(obj)); - } - } else { - PyErr_SetString(PyExc_TypeError, "Unsupported conversion"); - return -1; - } - break; - case G_TYPE_CHAR: - if (PYGLIB_PyLong_Check(obj)) { - glong val; - val = PYGLIB_PyLong_AsLong(obj); - if (val >= -128 && val <= 127) - g_value_set_schar(value, (gchar) val); - else - return -1; - } -#if PY_VERSION_HEX < 0x03000000 - else if (PyString_Check(obj)) { - g_value_set_schar(value, PyString_AsString(obj)[0]); - } -#endif - else if (PyUnicode_Check(obj)) { - tmp = PyUnicode_AsUTF8String(obj); - g_value_set_schar(value, PYGLIB_PyBytes_AsString(tmp)[0]); - Py_DECREF(tmp); - } else { - PyErr_SetString(PyExc_TypeError, "Cannot convert to TYPE_CHAR"); - return -1; - } - - break; - case G_TYPE_UCHAR: - if (PYGLIB_PyLong_Check(obj)) { - glong val; - val = PYGLIB_PyLong_AsLong(obj); - if (val >= 0 && val <= 255) - g_value_set_uchar(value, (guchar) val); - else - return -1; -#if PY_VERSION_HEX < 0x03000000 - } else if (PyString_Check(obj)) { - g_value_set_uchar(value, PyString_AsString(obj)[0]); -#endif - } else if (PyUnicode_Check(obj)) { - tmp = PyUnicode_AsUTF8String(obj); - g_value_set_uchar(value, PYGLIB_PyBytes_AsString(tmp)[0]); - Py_DECREF(tmp); - } else { - PyErr_Clear(); - return -1; - } - break; - case G_TYPE_BOOLEAN: - g_value_set_boolean(value, PyObject_IsTrue(obj)); - break; - case G_TYPE_INT: - g_value_set_int(value, PYGLIB_PyLong_AsLong(obj)); - break; - case G_TYPE_UINT: - { - if (PYGLIB_PyLong_Check(obj)) { - guint val; - - /* check that number is not negative */ - if (PyLong_AsLongLong(obj) < 0) - return -1; - - val = PyLong_AsUnsignedLong(obj); - if (val <= G_MAXUINT) - g_value_set_uint(value, val); - else - return -1; - } else { - g_value_set_uint(value, PyLong_AsUnsignedLong(obj)); - } - } - break; - case G_TYPE_LONG: - g_value_set_long(value, PYGLIB_PyLong_AsLong(obj)); - break; - case G_TYPE_ULONG: -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) { - long val; - - val = PYGLIB_PyLong_AsLong(obj); - if (val < 0) { - PyErr_SetString(PyExc_OverflowError, "negative value not allowed for uint64 property"); - return -1; - } - g_value_set_ulong(value, (gulong)val); - } else -#endif - if (PyLong_Check(obj)) - g_value_set_ulong(value, PyLong_AsUnsignedLong(obj)); - else - return -1; - break; - case G_TYPE_INT64: - g_value_set_int64(value, PyLong_AsLongLong(obj)); - break; - case G_TYPE_UINT64: -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) { - long v = PyInt_AsLong(obj); - if (v < 0) { - PyErr_SetString(PyExc_OverflowError, "negative value not allowed for uint64 property"); - return -1; - } - g_value_set_uint64(value, v); - } else -#endif - if (PyLong_Check(obj)) - g_value_set_uint64(value, PyLong_AsUnsignedLongLong(obj)); - else - return -1; - break; - case G_TYPE_ENUM: - { - gint val = 0; - if (pyg_enum_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { - return -1; - } - g_value_set_enum(value, val); - } - break; - case G_TYPE_FLAGS: - { - guint val = 0; - if (pyg_flags_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { - return -1; - } - g_value_set_flags(value, val); - } - break; - case G_TYPE_FLOAT: - g_value_set_float(value, PyFloat_AsDouble(obj)); - break; - case G_TYPE_DOUBLE: - g_value_set_double(value, PyFloat_AsDouble(obj)); - break; - case G_TYPE_STRING: - if (obj == Py_None) { - g_value_set_string(value, NULL); - } else { - PyObject* tmp_str = PyObject_Str(obj); - if (tmp_str == NULL) { - PyErr_Clear(); - if (PyUnicode_Check(obj)) { - tmp = PyUnicode_AsUTF8String(obj); - g_value_set_string(value, PYGLIB_PyBytes_AsString(tmp)); - Py_DECREF(tmp); - } else { - PyErr_SetString(PyExc_TypeError, "Expected string"); - return -1; - } - } else { -#if PY_VERSION_HEX < 0x03000000 - g_value_set_string(value, PyString_AsString(tmp_str)); -#else - tmp = PyUnicode_AsUTF8String(tmp_str); - g_value_set_string(value, PyBytes_AsString(tmp)); - Py_DECREF(tmp); -#endif - } - Py_XDECREF(tmp_str); - } - break; - case G_TYPE_POINTER: - if (obj == Py_None) - g_value_set_pointer(value, NULL); - else if (PyObject_TypeCheck(obj, &PyGPointer_Type) && - G_VALUE_HOLDS(value, ((PyGPointer *)obj)->gtype)) - g_value_set_pointer(value, pyg_pointer_get(obj, gpointer)); - else if (PYGLIB_CPointer_Check(obj)) - g_value_set_pointer(value, PYGLIB_CPointer_GetPointer(obj, NULL)); - else if (G_VALUE_HOLDS_GTYPE (value)) - g_value_set_gtype (value, pyg_type_from_object (obj)); - else { - PyErr_SetString(PyExc_TypeError, "Expected pointer"); - return -1; - } - break; - case G_TYPE_BOXED: { - PyGTypeMarshal *bm; - - if (obj == Py_None) - g_value_set_boxed(value, NULL); - else if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) - g_value_set_boxed(value, obj); - else if (PyObject_TypeCheck(obj, &PyGBoxed_Type) && - G_VALUE_HOLDS(value, ((PyGBoxed *)obj)->gtype)) - g_value_set_boxed(value, pyg_boxed_get(obj, gpointer)); - else if (G_VALUE_HOLDS(value, G_TYPE_VALUE)) { - GType type; - GValue *n_value; - - type = pyg_type_from_object((PyObject*)Py_TYPE(obj)); - if (G_UNLIKELY (! type)) { - return -1; - } - n_value = g_new0 (GValue, 1); - g_value_init (n_value, type); - g_value_take_boxed (value, n_value); - return pyg_value_from_pyobject_with_error (n_value, obj); - } - else if (PySequence_Check(obj) && - G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY)) - return pyg_value_array_from_pyobject(value, obj, NULL); - else if (PySequence_Check(obj) && - G_VALUE_HOLDS(value, G_TYPE_ARRAY)) - return pyg_array_from_pyobject(value, obj); - else if (PYGLIB_PyUnicode_Check(obj) && - G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { - GString *string; - char *buffer; - Py_ssize_t len; - if (PYGLIB_PyUnicode_AsStringAndSize(obj, &buffer, &len)) - return -1; - string = g_string_new_len(buffer, len); - g_value_set_boxed(value, string); - g_string_free (string, TRUE); - break; - } - else if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) - return bm->tovalue(value, obj); - else if (PYGLIB_CPointer_Check(obj)) - g_value_set_boxed(value, PYGLIB_CPointer_GetPointer(obj, NULL)); - else { - PyErr_SetString(PyExc_TypeError, "Expected Boxed"); - return -1; - } - break; - } - case G_TYPE_PARAM: - /* we need to support both the wrapped _gobject.GParamSpec and the GI - * GObject.ParamSpec */ - if (G_IS_PARAM_SPEC (pygobject_get (obj))) - g_value_set_param(value, G_PARAM_SPEC (pygobject_get (obj))); - else if (PyGParamSpec_Check(obj)) - g_value_set_param(value, PYGLIB_CPointer_GetPointer(obj, NULL)); - else { - PyErr_SetString(PyExc_TypeError, "Expected ParamSpec"); - return -1; - } - break; - case G_TYPE_OBJECT: - if (obj == Py_None) { - g_value_set_object(value, NULL); - } else if (PyObject_TypeCheck(obj, &PyGObject_Type) && - G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), - G_VALUE_TYPE(value))) { - g_value_set_object(value, pygobject_get(obj)); - } else { - PyErr_SetString(PyExc_TypeError, "Expected GObject"); - return -1; - } - break; - case G_TYPE_VARIANT: - { - if (obj == Py_None) - g_value_set_variant(value, NULL); - else if (pyg_type_from_object_strict(obj, FALSE) == G_TYPE_VARIANT) - g_value_set_variant(value, pyg_boxed_get(obj, GVariant)); - else { - PyErr_SetString(PyExc_TypeError, "Expected Variant"); - return -1; - } - break; - } - default: - { - PyGTypeMarshal *bm; - if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) { - return bm->tovalue(value, obj); - } else { - PyErr_SetString(PyExc_TypeError, "Unknown value type"); - return -1; - } - break; - } - } - - /* If an error occurred, unset the GValue but don't clear the Python error. */ - if (PyErr_Occurred()) { - g_value_unset(value); - return -1; - } - - return 0; -} - -/** - * pyg_value_from_pyobject: - * @value: the GValue object to store the converted value in. - * @obj: the Python object to convert. - * - * Same basic function as pyg_value_from_pyobject_with_error but clears - * any Python errors before returning. - * - * Returns: 0 on success, -1 on error. - */ -int -pyg_value_from_pyobject(GValue *value, PyObject *obj) -{ - int res = pyg_value_from_pyobject_with_error (value, obj); - - if (PyErr_Occurred()) { - PyErr_Clear(); - return -1; - } - return res; -} - -/** - * pyg_value_as_pyobject: - * @value: the GValue object. - * @copy_boxed: true if boxed values should be copied. - * - * This function creates/returns a Python wrapper object that - * represents the GValue passed as an argument. - * - * Returns: a PyObject representing the value. - */ -PyObject * -pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) -{ - gchar buf[128]; - - switch (G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value))) { - case G_TYPE_INTERFACE: - if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT)) - return pygobject_new(g_value_get_object(value)); - else - break; - case G_TYPE_CHAR: { - gint8 val = g_value_get_schar(value); - return PYGLIB_PyUnicode_FromStringAndSize((char *)&val, 1); - } - case G_TYPE_UCHAR: { - guint8 val = g_value_get_uchar(value); - return PYGLIB_PyBytes_FromStringAndSize((char *)&val, 1); - } - case G_TYPE_BOOLEAN: { - return PyBool_FromLong(g_value_get_boolean(value)); - } - case G_TYPE_INT: - return PYGLIB_PyLong_FromLong(g_value_get_int(value)); - case G_TYPE_UINT: - { - /* in Python, the Int object is backed by a long. If a - long can hold the whole value of an unsigned int, use - an Int. Otherwise, use a Long object to avoid overflow. - This matches the ULongArg behavior in codegen/argtypes.h */ -#if (G_MAXUINT <= G_MAXLONG) - return PYGLIB_PyLong_FromLong((glong) g_value_get_uint(value)); -#else - return PyLong_FromUnsignedLong((gulong) g_value_get_uint(value)); -#endif - } - case G_TYPE_LONG: - return PYGLIB_PyLong_FromLong(g_value_get_long(value)); - case G_TYPE_ULONG: - { - gulong val = g_value_get_ulong(value); - - if (val <= G_MAXLONG) - return PYGLIB_PyLong_FromLong((glong) val); - else - return PyLong_FromUnsignedLong(val); - } - case G_TYPE_INT64: - { - gint64 val = g_value_get_int64(value); - - if (G_MINLONG <= val && val <= G_MAXLONG) - return PYGLIB_PyLong_FromLong((glong) val); - else - return PyLong_FromLongLong(val); - } - case G_TYPE_UINT64: - { - guint64 val = g_value_get_uint64(value); - - if (val <= G_MAXLONG) - return PYGLIB_PyLong_FromLong((glong) val); - else - return PyLong_FromUnsignedLongLong(val); - } - case G_TYPE_ENUM: - return pyg_enum_from_gtype(G_VALUE_TYPE(value), g_value_get_enum(value)); - case G_TYPE_FLAGS: - return pyg_flags_from_gtype(G_VALUE_TYPE(value), g_value_get_flags(value)); - case G_TYPE_FLOAT: - return PyFloat_FromDouble(g_value_get_float(value)); - case G_TYPE_DOUBLE: - return PyFloat_FromDouble(g_value_get_double(value)); - case G_TYPE_STRING: - { - const gchar *str = g_value_get_string(value); - - if (str) - return PYGLIB_PyUnicode_FromString(str); - Py_INCREF(Py_None); - return Py_None; - } - case G_TYPE_POINTER: - if (G_VALUE_HOLDS_GTYPE (value)) - return pyg_type_wrapper_new (g_value_get_gtype (value)); - else - return pyg_pointer_new(G_VALUE_TYPE(value), - g_value_get_pointer(value)); - case G_TYPE_BOXED: { - PyGTypeMarshal *bm; - - if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) { - PyObject *ret = (PyObject *)g_value_dup_boxed(value); - if (ret == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return ret; - } else if (G_VALUE_HOLDS(value, G_TYPE_VALUE)) { - GValue *n_value = g_value_get_boxed (value); - return pyg_value_as_pyobject(n_value, copy_boxed); - } else if (G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY)) { - GValueArray *array = (GValueArray *) g_value_get_boxed(value); - PyObject *ret = PyList_New(array->n_values); - int i; - for (i = 0; i < array->n_values; ++i) - PyList_SET_ITEM(ret, i, pyg_value_as_pyobject - (array->values + i, copy_boxed)); - return ret; - } else if (G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { - GString *string = (GString *) g_value_get_boxed(value); - PyObject *ret = PYGLIB_PyUnicode_FromStringAndSize(string->str, string->len); - return ret; - } - bm = pyg_type_lookup(G_VALUE_TYPE(value)); - if (bm) { - return bm->fromvalue(value); - } else { - if (copy_boxed) - return pyg_boxed_new(G_VALUE_TYPE(value), - g_value_get_boxed(value), TRUE, TRUE); - else - return pyg_boxed_new(G_VALUE_TYPE(value), - g_value_get_boxed(value),FALSE,FALSE); - } - } - case G_TYPE_PARAM: - return pyg_param_spec_new(g_value_get_param(value)); - case G_TYPE_OBJECT: - return pygobject_new(g_value_get_object(value)); - case G_TYPE_VARIANT: - { - GVariant *v = g_value_get_variant(value); - if (v == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return pyg_boxed_new(G_TYPE_VARIANT, g_variant_ref(v), FALSE, FALSE); - } - default: - { - PyGTypeMarshal *bm; - if ((bm = pyg_type_lookup(G_VALUE_TYPE(value)))) - return bm->fromvalue(value); - break; - } - } - g_snprintf(buf, sizeof(buf), "unknown type %s", - g_type_name(G_VALUE_TYPE(value))); - PyErr_SetString(PyExc_TypeError, buf); - return NULL; -} - -/* -------------- PyGClosure ----------------- */ - -static void -pyg_closure_invalidate(gpointer data, GClosure *closure) -{ - PyGClosure *pc = (PyGClosure *)closure; - PyGILState_STATE state; - - state = pyglib_gil_state_ensure(); - Py_XDECREF(pc->callback); - Py_XDECREF(pc->extra_args); - Py_XDECREF(pc->swap_data); - pyglib_gil_state_release(state); - - pc->callback = NULL; - pc->extra_args = NULL; - pc->swap_data = NULL; -} - -static void -pyg_closure_marshal(GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - PyGILState_STATE state; - PyGClosure *pc = (PyGClosure *)closure; - PyObject *params, *ret; - guint i; - - state = pyglib_gil_state_ensure(); - - /* construct Python tuple for the parameter values */ - params = PyTuple_New(n_param_values); - for (i = 0; i < n_param_values; i++) { - /* swap in a different initial data for connect_object() */ - if (i == 0 && G_CCLOSURE_SWAP_DATA(closure)) { - g_return_if_fail(pc->swap_data != NULL); - Py_INCREF(pc->swap_data); - PyTuple_SetItem(params, 0, pc->swap_data); - } else { - PyObject *item = pyg_value_as_pyobject(¶m_values[i], FALSE); - - /* error condition */ - if (!item) { - goto out; - } - PyTuple_SetItem(params, i, item); - } - } - /* params passed to function may have extra arguments */ - if (pc->extra_args) { - PyObject *tuple = params; - params = PySequence_Concat(tuple, pc->extra_args); - Py_DECREF(tuple); - } - ret = PyObject_CallObject(pc->callback, params); - if (ret == NULL) { - if (pc->exception_handler) - pc->exception_handler(return_value, n_param_values, param_values); - else - PyErr_Print(); - goto out; - } - - if (G_IS_VALUE(return_value) && pyg_value_from_pyobject(return_value, ret) != 0) { - /* If we already have an exception set, use that, otherwise set a - * generic one */ - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, - "can't convert return value to desired type"); - - if (pc->exception_handler) - pc->exception_handler(return_value, n_param_values, param_values); - else - PyErr_Print(); - } - Py_DECREF(ret); - - out: - Py_DECREF(params); - pyglib_gil_state_release(state); -} - -/** - * pyg_closure_new: - * callback: a Python callable object - * extra_args: a tuple of extra arguments, or None/NULL. - * swap_data: an alternative python object to pass first. - * - * Creates a GClosure wrapping a Python callable and optionally a set - * of additional function arguments. This is needed to attach python - * handlers to signals, for instance. - * - * Returns: the new closure. - */ -GClosure * -pyg_closure_new(PyObject *callback, PyObject *extra_args, PyObject *swap_data) -{ - GClosure *closure; - - g_return_val_if_fail(callback != NULL, NULL); - closure = g_closure_new_simple(sizeof(PyGClosure), NULL); - g_closure_add_invalidate_notifier(closure, NULL, pyg_closure_invalidate); - g_closure_set_marshal(closure, pyg_closure_marshal); - Py_INCREF(callback); - ((PyGClosure *)closure)->callback = callback; - if (extra_args && extra_args != Py_None) { - Py_INCREF(extra_args); - if (!PyTuple_Check(extra_args)) { - PyObject *tmp = PyTuple_New(1); - PyTuple_SetItem(tmp, 0, extra_args); - extra_args = tmp; - } - ((PyGClosure *)closure)->extra_args = extra_args; - } - if (swap_data) { - Py_INCREF(swap_data); - ((PyGClosure *)closure)->swap_data = swap_data; - closure->derivative_flag = TRUE; - } - return closure; -} - -/** - * pyg_closure_set_exception_handler: - * @closure: a closure created with pyg_closure_new() - * @handler: the handler to call when an exception occurs or NULL for none - * - * Sets the handler to call when an exception occurs during closure invocation. - * The handler is responsible for providing a proper return value to the - * closure invocation. If @handler is %NULL, the default handler will be used. - * The default handler prints the exception to stderr and doesn't touch the - * closure's return value. - */ -void -pyg_closure_set_exception_handler(GClosure *closure, - PyClosureExceptionHandler handler) -{ - PyGClosure *pygclosure; - - g_return_if_fail(closure != NULL); - - pygclosure = (PyGClosure *)closure; - pygclosure->exception_handler = handler; -} -/* -------------- PySignalClassClosure ----------------- */ -/* a closure used for the `class closure' of a signal. As this gets - * all the info from the first argument to the closure and the - * invocation hint, we can have a single closure that handles all - * class closure cases. We call a method by the name of the signal - * with "do_" prepended. - * - * We also remove the first argument from the * param list, as it is - * the instance object, which is passed * implicitly to the method - * object. */ - -static void -pyg_signal_class_closure_marshal(GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - PyGILState_STATE state; - GObject *object; - PyObject *object_wrapper; - GSignalInvocationHint *hint = (GSignalInvocationHint *)invocation_hint; - gchar *method_name, *tmp; - PyObject *method; - PyObject *params, *ret; - guint i, len; - - state = pyglib_gil_state_ensure(); - - g_return_if_fail(invocation_hint != NULL); - /* get the object passed as the first argument to the closure */ - object = g_value_get_object(¶m_values[0]); - g_return_if_fail(object != NULL && G_IS_OBJECT(object)); - - /* get the wrapper for this object */ - object_wrapper = pygobject_new(object); - g_return_if_fail(object_wrapper != NULL); - - /* construct method name for this class closure */ - method_name = g_strconcat("do_", g_signal_name(hint->signal_id), NULL); - - /* convert dashes to underscores. For some reason, g_signal_name - * seems to convert all the underscores in the signal name to - dashes??? */ - for (tmp = method_name; *tmp != '\0'; tmp++) - if (*tmp == '-') *tmp = '_'; - - method = PyObject_GetAttrString(object_wrapper, method_name); - g_free(method_name); - - if (!method) { - PyErr_Clear(); - Py_DECREF(object_wrapper); - pyglib_gil_state_release(state); - return; - } - Py_DECREF(object_wrapper); - - /* construct Python tuple for the parameter values; don't copy boxed values - initially because we'll check after the call to see if a copy is needed. */ - params = PyTuple_New(n_param_values - 1); - for (i = 1; i < n_param_values; i++) { - PyObject *item = pyg_value_as_pyobject(¶m_values[i], FALSE); - - /* error condition */ - if (!item) { - Py_DECREF(params); - pyglib_gil_state_release(state); - return; - } - PyTuple_SetItem(params, i - 1, item); - } - - ret = PyObject_CallObject(method, params); - - /* Copy boxed values if others ref them, this needs to be done regardless of - exception status. */ - len = PyTuple_Size(params); - for (i = 0; i < len; i++) { - PyObject *item = PyTuple_GetItem(params, i); - if (item != NULL && PyObject_TypeCheck(item, &PyGBoxed_Type) - && item->ob_refcnt != 1) { - PyGBoxed* boxed_item = (PyGBoxed*)item; - if (!boxed_item->free_on_dealloc) { - boxed_item->boxed = g_boxed_copy(boxed_item->gtype, boxed_item->boxed); - boxed_item->free_on_dealloc = TRUE; - } - } - } - - if (ret == NULL) { - PyErr_Print(); - Py_DECREF(method); - Py_DECREF(params); - pyglib_gil_state_release(state); - return; - } - Py_DECREF(method); - Py_DECREF(params); - if (G_IS_VALUE(return_value)) - pyg_value_from_pyobject(return_value, ret); - Py_DECREF(ret); - pyglib_gil_state_release(state); -} - -/** - * pyg_signal_class_closure_get: - * - * Returns the GClosure used for the class closure of signals. When - * called, it will invoke the method do_signalname (for the signal - * "signalname"). - * - * Returns: the closure. - */ -GClosure * -pyg_signal_class_closure_get(void) -{ - static GClosure *closure; - - if (closure == NULL) { - closure = g_closure_new_simple(sizeof(GClosure), NULL); - g_closure_set_marshal(closure, pyg_signal_class_closure_marshal); - - g_closure_ref(closure); - g_closure_sink(closure); - } - return closure; -} - -GClosure * -gclosure_from_pyfunc(PyGObject *object, PyObject *func) -{ - GSList *l; - PyGObjectData *inst_data; - inst_data = pyg_object_peek_inst_data(object->obj); - if (inst_data) { - for (l = inst_data->closures; l; l = l->next) { - PyGClosure *pyclosure = l->data; - int res = PyObject_RichCompareBool(pyclosure->callback, func, Py_EQ); - if (res == -1) { - PyErr_Clear(); // Is there anything else to do? - } else if (res) { - return (GClosure*)pyclosure; - } - } - } - return NULL; -} - -/* ----- __doc__ descriptor for GObject and GInterface ----- */ - -static void -object_doc_dealloc(PyObject *self) -{ - PyObject_FREE(self); -} - -/* append information about signals of a particular gtype */ -static void -add_signal_docs(GType gtype, GString *string) -{ - GTypeClass *class = NULL; - guint *signal_ids, n_ids = 0, i; - - if (G_TYPE_IS_CLASSED(gtype)) - class = g_type_class_ref(gtype); - signal_ids = g_signal_list_ids(gtype, &n_ids); - - if (n_ids > 0) { - g_string_append_printf(string, "Signals from %s:\n", - g_type_name(gtype)); - - for (i = 0; i < n_ids; i++) { - GSignalQuery query; - guint j; - - g_signal_query(signal_ids[i], &query); - - g_string_append(string, " "); - g_string_append(string, query.signal_name); - g_string_append(string, " ("); - for (j = 0; j < query.n_params; j++) { - g_string_append(string, g_type_name(query.param_types[j])); - if (j != query.n_params - 1) - g_string_append(string, ", "); - } - g_string_append(string, ")"); - if (query.return_type && query.return_type != G_TYPE_NONE) { - g_string_append(string, " -> "); - g_string_append(string, g_type_name(query.return_type)); - } - g_string_append(string, "\n"); - } - g_free(signal_ids); - g_string_append(string, "\n"); - } - if (class) - g_type_class_unref(class); -} - -static void -add_property_docs(GType gtype, GString *string) -{ - GObjectClass *class; - GParamSpec **props; - guint n_props = 0, i; - gboolean has_prop = FALSE; - G_CONST_RETURN gchar *blurb=NULL; - - class = g_type_class_ref(gtype); - props = g_object_class_list_properties(class, &n_props); - - for (i = 0; i < n_props; i++) { - if (props[i]->owner_type != gtype) - continue; /* these are from a parent type */ - - /* print out the heading first */ - if (!has_prop) { - g_string_append_printf(string, "Properties from %s:\n", - g_type_name(gtype)); - has_prop = TRUE; - } - g_string_append_printf(string, " %s -> %s: %s\n", - g_param_spec_get_name(props[i]), - g_type_name(props[i]->value_type), - g_param_spec_get_nick(props[i])); - - /* g_string_append_printf crashes on win32 if the third - argument is NULL. */ - blurb=g_param_spec_get_blurb(props[i]); - if (blurb) - g_string_append_printf(string, " %s\n",blurb); - } - g_free(props); - if (has_prop) - g_string_append(string, "\n"); - g_type_class_unref(class); -} - -static PyObject * -object_doc_descr_get(PyObject *self, PyObject *obj, PyObject *type) -{ - GType gtype = 0; - GString *string; - PyObject *pystring; - - if (obj && pygobject_check(obj, &PyGObject_Type)) { - gtype = G_OBJECT_TYPE(pygobject_get(obj)); - if (!gtype) - PyErr_SetString(PyExc_RuntimeError, "could not get object type"); - } else { - gtype = pyg_type_from_object(type); - } - if (!gtype) - return NULL; - - string = g_string_new_len(NULL, 512); - - if (g_type_is_a(gtype, G_TYPE_INTERFACE)) - g_string_append_printf(string, "Interface %s\n\n", g_type_name(gtype)); - else if (g_type_is_a(gtype, G_TYPE_OBJECT)) - g_string_append_printf(string, "Object %s\n\n", g_type_name(gtype)); - else - g_string_append_printf(string, "%s\n\n", g_type_name(gtype)); - - if (((PyTypeObject *) type)->tp_doc) - g_string_append_printf(string, "%s\n\n", ((PyTypeObject *) type)->tp_doc); - - if (g_type_is_a(gtype, G_TYPE_OBJECT)) { - GType parent = G_TYPE_OBJECT; - GArray *parents = g_array_new(FALSE, FALSE, sizeof(GType)); - int iparent; - - while (parent) { - g_array_append_val(parents, parent); - parent = g_type_next_base(gtype, parent); - } - - for (iparent = parents->len - 1; iparent >= 0; --iparent) { - GType *interfaces; - guint n_interfaces, i; - - parent = g_array_index(parents, GType, iparent); - add_signal_docs(parent, string); - add_property_docs(parent, string); - - /* add docs for implemented interfaces */ - interfaces = g_type_interfaces(parent, &n_interfaces); - for (i = 0; i < n_interfaces; i++) - add_signal_docs(interfaces[i], string); - g_free(interfaces); - } - g_array_free(parents, TRUE); - } - - pystring = PYGLIB_PyUnicode_FromStringAndSize(string->str, string->len); - g_string_free(string, TRUE); - return pystring; -} - -PYGLIB_DEFINE_TYPE("gobject.GObject.__doc__", PyGObjectDoc_Type, PyObject); - -/** - * pyg_object_descr_doc_get: - * - * Returns an object intended to be the __doc__ attribute of GObject - * wrappers. When read in the context of the object it will return - * some documentation about the signals and properties of the object. - * - * Returns: the descriptor. - */ -PyObject * -pyg_object_descr_doc_get(void) -{ - static PyObject *doc_descr = NULL; - - if (!doc_descr) { - Py_TYPE(&PyGObjectDoc_Type) = &PyType_Type; - if (PyType_Ready(&PyGObjectDoc_Type)) - return NULL; - - doc_descr = PyObject_NEW(PyObject, &PyGObjectDoc_Type); - if (doc_descr == NULL) - return NULL; - } - return doc_descr; -} - - -/** - * pyg_pyobj_to_unichar_conv: - * - * Converts PyObject value to a unichar and write result to memory - * pointed to by ptr. Follows the calling convention of a ParseArgs - * converter (O& format specifier) so it may be used to convert function - * arguments. - * - * Returns: 1 if the conversion succeeds and 0 otherwise. If the conversion - * did not succeesd, a Python exception is raised - */ -int pyg_pyobj_to_unichar_conv(PyObject* py_obj, void* ptr) -{ - gunichar* u = ptr; - const Py_UNICODE* uni_buffer; - PyObject* tmp_uni = NULL; - - if (PyUnicode_Check(py_obj)) { - tmp_uni = py_obj; - Py_INCREF(tmp_uni); - } - else { - tmp_uni = PyUnicode_FromObject(py_obj); - if (tmp_uni == NULL) - goto failure; - } - - if ( PyUnicode_GetSize(tmp_uni) != 1) { - PyErr_SetString(PyExc_ValueError, "unicode character value must be 1 character uniode string"); - goto failure; - } - uni_buffer = PyUnicode_AsUnicode(tmp_uni); - if ( uni_buffer == NULL) - goto failure; - *u = uni_buffer[0]; - - Py_DECREF(tmp_uni); - return 1; - - failure: - Py_XDECREF(tmp_uni); - return 0; -} - - -int -pyg_param_gvalue_from_pyobject(GValue* value, - PyObject* py_obj, - const GParamSpec* pspec) -{ - if (G_IS_PARAM_SPEC_UNICHAR(pspec)) { - gunichar u; - - if (!pyg_pyobj_to_unichar_conv(py_obj, &u)) { - PyErr_Clear(); - return -1; - } - g_value_set_uint(value, u); - return 0; - } - else if (G_IS_PARAM_SPEC_VALUE_ARRAY(pspec)) - return pyg_value_array_from_pyobject(value, py_obj, - G_PARAM_SPEC_VALUE_ARRAY(pspec)); - else { - return pyg_value_from_pyobject(value, py_obj); - } -} - -PyObject* -pyg_param_gvalue_as_pyobject(const GValue* gvalue, - gboolean copy_boxed, - const GParamSpec* pspec) -{ - if (G_IS_PARAM_SPEC_UNICHAR(pspec)) { - gunichar u; - Py_UNICODE uni_buffer[2] = { 0, 0 }; - - u = g_value_get_uint(gvalue); - uni_buffer[0] = u; - return PyUnicode_FromUnicode(uni_buffer, 1); - } - else { - return pyg_value_as_pyobject(gvalue, copy_boxed); - } -} - -gboolean -pyg_gtype_is_custom(GType gtype) -{ - return g_type_get_qdata (gtype, pygobject_custom_key) != NULL; -} - -static PyObject * -_pyg_strv_from_gvalue(const GValue *value) -{ - gchar **argv = (gchar **) g_value_get_boxed(value); - int argc = 0, i; - PyObject *py_argv; - - if (argv) { - while (argv[argc]) - argc++; - } - py_argv = PyList_New(argc); - for (i = 0; i < argc; ++i) - PyList_SET_ITEM(py_argv, i, PYGLIB_PyUnicode_FromString(argv[i])); - return py_argv; -} - -static int -_pyg_strv_to_gvalue(GValue *value, PyObject *obj) -{ - Py_ssize_t argc, i; - gchar **argv; - - if (!(PyTuple_Check(obj) || PyList_Check(obj))) - return -1; - - argc = PySequence_Length(obj); - for (i = 0; i < argc; ++i) - if (!PYGLIB_PyUnicode_Check(PySequence_Fast_GET_ITEM(obj, i))) - return -1; - argv = g_new(gchar *, argc + 1); - for (i = 0; i < argc; ++i) - argv[i] = g_strdup(PYGLIB_PyUnicode_AsString(PySequence_Fast_GET_ITEM(obj, i))); - argv[i] = NULL; - g_value_take_boxed(value, argv); - return 0; -} - -void -pygobject_type_register_types(PyObject *d) -{ - PyGTypeWrapper_Type.tp_dealloc = (destructor)pyg_type_wrapper_dealloc; - PyGTypeWrapper_Type.tp_richcompare = pyg_type_wrapper_richcompare; - PyGTypeWrapper_Type.tp_repr = (reprfunc)pyg_type_wrapper_repr; - PyGTypeWrapper_Type.tp_hash = (hashfunc)pyg_type_wrapper_hash; - PyGTypeWrapper_Type.tp_flags = Py_TPFLAGS_DEFAULT; - PyGTypeWrapper_Type.tp_methods = _PyGTypeWrapper_methods; - PyGTypeWrapper_Type.tp_getset = _PyGTypeWrapper_getsets; - PyGTypeWrapper_Type.tp_init = (initproc)pyg_type_wrapper_init; - PYGLIB_REGISTER_TYPE(d, PyGTypeWrapper_Type, "GType"); - - /* This type lazily registered in pyg_object_descr_doc_get */ - PyGObjectDoc_Type.tp_dealloc = (destructor)object_doc_dealloc; - PyGObjectDoc_Type.tp_flags = Py_TPFLAGS_DEFAULT; - PyGObjectDoc_Type.tp_descr_get = (descrgetfunc)object_doc_descr_get; - - pyg_register_gtype_custom(G_TYPE_STRV, - _pyg_strv_from_gvalue, - _pyg_strv_to_gvalue); -} diff --git a/gi/_gobject/pygtype.h b/gi/_gobject/pygtype.h deleted file mode 100644 index 2f9e7ad..0000000 --- a/gi/_gobject/pygtype.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * pygtk- Python bindings for the GTK toolkit. - * Copyright (C) 1998-2003 James Henstridge - * 2004-2008 Johan Dahlin - * pyginterface.c: wrapper for the gobject library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGOBJECT_TYPE_H__ -#define __PYGOBJECT_TYPE_H__ - -void pygobject_type_register_types(PyObject *d); - -#endif /* __PYGOBJECT_TYPE_H__ */ diff --git a/gi/_gtktemplate.py b/gi/_gtktemplate.py new file mode 100644 index 0000000..f253887 --- /dev/null +++ b/gi/_gtktemplate.py @@ -0,0 +1,307 @@ +# Copyright 2015 Dustin Spicuzza +# 2018 Nikita Churaev +# 2018 Christoph Reiter +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +import os +from collections import abc +from functools import partial + +from gi.repository import GLib, GObject, Gio + + +def _extract_handler_and_args(obj_or_map, handler_name): + handler = None + if isinstance(obj_or_map, abc.Mapping): + handler = obj_or_map.get(handler_name, None) + else: + handler = getattr(obj_or_map, handler_name, None) + + if handler is None: + raise AttributeError('Handler %s not found' % handler_name) + + args = () + if isinstance(handler, abc.Sequence): + if len(handler) == 0: + raise TypeError("Handler %s tuple can not be empty" % handler) + args = handler[1:] + handler = handler[0] + + elif not callable(handler): + raise TypeError('Handler %s is not a method, function or tuple' % handler) + + return handler, args + + +def define_builder_scope(): + from gi.repository import Gtk + + class BuilderScope(GObject.GObject, Gtk.BuilderScope): + + def __init__(self, scope_object=None): + super().__init__() + self._scope_object = scope_object + + def do_create_closure(self, builder, func_name, flags, obj): + current_object = builder.get_current_object() or self._scope_object + + if not self._scope_object: + current_object = builder.get_current_object() + if func_name not in current_object.__gtktemplate_methods__: + return None + + current_object.__gtktemplate_handlers__.add(func_name) + handler_name = current_object.__gtktemplate_methods__[func_name] + else: + current_object = self._scope_object + handler_name = func_name + + swapped = int(flags & Gtk.BuilderClosureFlags.SWAPPED) + if swapped: + raise RuntimeError( + "%r not supported" % GObject.ConnectFlags.SWAPPED) + return None + + handler, args = _extract_handler_and_args(current_object, handler_name) + + if obj: + p = partial(handler, *args, swap_data=obj) + else: + p = partial(handler, *args) + + p.__gtk_template__ = True + return p + + return BuilderScope + + +def connect_func(builder, obj, signal_name, handler_name, + connect_object, flags, cls): + + if handler_name not in cls.__gtktemplate_methods__: + return + + method_name = cls.__gtktemplate_methods__[handler_name] + template_inst = builder.get_object(cls.__gtype_name__) + template_inst.__gtktemplate_handlers__.add(handler_name) + handler = getattr(template_inst, method_name) + + after = int(flags & GObject.ConnectFlags.AFTER) + swapped = int(flags & GObject.ConnectFlags.SWAPPED) + if swapped: + raise RuntimeError( + "%r not supported" % GObject.ConnectFlags.SWAPPED) + + if connect_object is not None: + if after: + func = obj.connect_object_after + else: + func = obj.connect_object + func(signal_name, handler, connect_object) + else: + if after: + func = obj.connect_after + else: + func = obj.connect + func(signal_name, handler) + + +def register_template(cls): + from gi.repository import Gtk + + bound_methods = {} + bound_widgets = {} + + for attr_name, obj in list(cls.__dict__.items()): + if isinstance(obj, CallThing): + setattr(cls, attr_name, obj._func) + handler_name = obj._name + if handler_name is None: + handler_name = attr_name + + if handler_name in bound_methods: + old_attr_name = bound_methods[handler_name] + raise RuntimeError( + "Error while exposing handler %r as %r, " + "already available as %r" % ( + handler_name, attr_name, old_attr_name)) + else: + bound_methods[handler_name] = attr_name + elif isinstance(obj, Child): + widget_name = obj._name + if widget_name is None: + widget_name = attr_name + + if widget_name in bound_widgets: + old_attr_name = bound_widgets[widget_name] + raise RuntimeError( + "Error while exposing child %r as %r, " + "already available as %r" % ( + widget_name, attr_name, old_attr_name)) + else: + bound_widgets[widget_name] = attr_name + cls.bind_template_child_full(widget_name, obj._internal, 0) + + cls.__gtktemplate_methods__ = bound_methods + cls.__gtktemplate_widgets__ = bound_widgets + + if Gtk._version == "4.0": + BuilderScope = define_builder_scope() + cls.set_template_scope(BuilderScope()) + else: + cls.set_connect_func(connect_func, cls) + + base_init_template = cls.init_template + cls.__dontuse_ginstance_init__ = \ + lambda s: init_template(s, cls, base_init_template) + # To make this file work with older PyGObject we expose our init code + # as init_template() but make it a noop when we call it ourselves first + cls.init_template = cls.__dontuse_ginstance_init__ + + +def init_template(self, cls, base_init_template): + self.init_template = lambda: None + + if self.__class__ is not cls: + raise TypeError( + "Inheritance from classes with @Gtk.Template decorators " + "is not allowed at this time") + + self.__gtktemplate_handlers__ = set() + + base_init_template(self) + + for widget_name, attr_name in self.__gtktemplate_widgets__.items(): + self.__dict__[attr_name] = self.get_template_child(cls, widget_name) + + for handler_name, attr_name in self.__gtktemplate_methods__.items(): + if handler_name not in self.__gtktemplate_handlers__: + raise RuntimeError( + "Handler '%s' was declared with @Gtk.Template.Callback " + "but was not present in template" % handler_name) + + +class Child(object): + + def __init__(self, name=None, **kwargs): + self._name = name + self._internal = kwargs.pop("internal", False) + if kwargs: + raise TypeError("Unhandled arguments: %r" % kwargs) + + +class CallThing(object): + + def __init__(self, name, func): + self._name = name + self._func = func + + +class Callback(object): + + def __init__(self, name=None): + self._name = name + + def __call__(self, func): + return CallThing(self._name, func) + + +def validate_resource_path(path): + """Raises GLib.Error in case the resource doesn't exist""" + + try: + Gio.resources_get_info(path, Gio.ResourceLookupFlags.NONE) + except GLib.Error: + # resources_get_info() doesn't handle overlays but we keep using it + # as a fast path. + # https://gitlab.gnome.org/GNOME/pygobject/issues/230 + Gio.resources_lookup_data(path, Gio.ResourceLookupFlags.NONE) + + +class Template(object): + + def __init__(self, **kwargs): + self.string = None + self.filename = None + self.resource_path = None + if "string" in kwargs: + self.string = kwargs.pop("string") + elif "filename" in kwargs: + self.filename = kwargs.pop("filename") + elif "resource_path" in kwargs: + self.resource_path = kwargs.pop("resource_path") + else: + raise TypeError( + "Requires one of the following arguments: " + "string, filename, resource_path") + + if kwargs: + raise TypeError("Unhandled keyword arguments %r" % kwargs) + + @classmethod + def from_file(cls, filename): + return cls(filename=filename) + + @classmethod + def from_string(cls, string): + return cls(string=string) + + @classmethod + def from_resource(cls, resource_path): + return cls(resource_path=resource_path) + + Callback = Callback + + Child = Child + + def __call__(self, cls): + from gi.repository import Gtk + + if not isinstance(cls, type) or not issubclass(cls, Gtk.Widget): + raise TypeError("Can only use @Gtk.Template on Widgets") + + if "__gtype_name__" not in cls.__dict__: + raise TypeError( + "%r does not have a __gtype_name__. Set it to the name " + "of the class in your template" % cls.__name__) + + if hasattr(cls, "__gtktemplate_methods__"): + raise TypeError("Cannot nest template classes") + + if self.string is not None: + data = self.string + if not isinstance(data, bytes): + data = data.encode("utf-8") + bytes_ = GLib.Bytes.new(data) + cls.set_template(bytes_) + register_template(cls) + return cls + elif self.resource_path is not None: + validate_resource_path(self.resource_path) + cls.set_template_from_resource(self.resource_path) + register_template(cls) + return cls + else: + assert self.filename is not None + file_ = Gio.File.new_for_path(os.fspath(self.filename)) + bytes_ = GLib.Bytes.new(file_.load_contents()[1]) + cls.set_template(bytes_) + register_template(cls) + return cls + + +__all__ = ["Template"] diff --git a/gi/_glib/option.py b/gi/_option.py similarity index 78% rename from gi/_glib/option.py rename to gi/_option.py index 54e802f..2fa54d8 100644 --- a/gi/_glib/option.py +++ b/gi/_option.py @@ -15,9 +15,7 @@ # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA +# License along with this library; if not, see . """GOption command line parser @@ -33,16 +31,10 @@ import sys import optparse from optparse import OptParseError, OptionError, OptionValueError, \ BadOptionError, OptionConflictError -from ..module import get_introspection_module +from .module import get_introspection_module -if sys.version_info >= (3, 0): - _basestring = str - _bytes = lambda s: s.encode() -else: - _basestring = basestring - _bytes = str - -from gi._glib import _glib +from gi import _gi +from gi._error import GError GLib = get_introspection_module('GLib') OPTION_CONTEXT_ERROR_QUARK = GLib.quark_to_string(GLib.option_error_quark()) @@ -70,17 +62,20 @@ class Option(optparse.Option): filename The supplied arguments are read as filename, GOption parses this type in with the GLib filename encoding. - Attributes: - optional_arg This does not need a arguement, but it can be supplied. - hidden The help list does not show this option - in_main This option apears in the main group, this should only - be used for backwards compatibility. + :ivar optional_arg: + This does not need a arguement, but it can be supplied. + :ivar hidden: + The help list does not show this option + :ivar in_main: + This option apears in the main group, this should only + be used for backwards compatibility. Use Option.REMAINING as option name to get all positional arguments. - NOTE: Every argument to an option is passed as utf-8 coded string, the only - exception are options which use the 'filename' type, its arguments - are passed as strings in the GLib filename encoding. + .. NOTE:: + Every argument to an option is passed as utf-8 coded string, the only + exception are options which use the 'filename' type, its arguments + are passed as strings in the GLib filename encoding. For further help, see optparse.Option. """ @@ -135,28 +130,36 @@ class Option(optparse.Option): flags |= GLib.OptionFlags.FILENAME for (long_name, short_name) in zip(self._long_opts, self._short_opts): - yield (long_name[2:], _bytes(short_name[1]), flags, self.help, self.metavar) + short_bytes = short_name[1] + if not isinstance(short_bytes, bytes): + short_bytes = short_bytes.encode("utf-8") + yield (long_name[2:], short_bytes, flags, self.help, self.metavar) for long_name in self._long_opts[len(self._short_opts):]: - yield (long_name[2:], _bytes('\0'), flags, self.help, self.metavar) + yield (long_name[2:], b'\0', flags, self.help, self.metavar) class OptionGroup(optparse.OptionGroup): """A group of command line options. - Arguements: - name: The groups name, used to create the - --help-{name} option - description: Shown as title of the groups help view - help_description: Shown as help to the --help-{name} option - option_list: The options used in this group, must be option.Option() - defaults: A dicitionary of default values - translation_domain: Sets the translation domain for gettext(). - - NOTE: This OptionGroup does not exactly map the optparse.OptionGroup - interface. There is no parser object to supply, but it is possible - to set default values and option_lists. Also the default values and - values are not shared with the OptionParser. + :param str name: + The groups name, used to create the --help-{name} option + :param str description: + Shown as title of the groups help view + :param str help_description: + Shown as help to the --help-{name} option + :param list option_list: + The options used in this group, must be option.Option() + :param dict defaults: + A dicitionary of default values + :param translation_domain: + Sets the translation domain for gettext(). + + .. NOTE:: + This OptionGroup does not exactly map the optparse.OptionGroup + interface. There is no parser object to supply, but it is possible + to set default values and option_lists. Also the default values and + values are not shared with the OptionParser. To pass a OptionGroup into a function which expects a GOptionGroup (e.g. gnome_program_init() ). OptionGroup.get_option_group() can be used. @@ -196,14 +199,14 @@ class OptionGroup(optparse.OptionGroup): opt.process(option_name, option_value, self.values, parser) except OptionValueError: error = sys.exc_info()[1] - gerror = _glib.GError(str(error)) + gerror = GError(str(error)) gerror.domain = OPTION_CONTEXT_ERROR_QUARK gerror.code = GLib.OptionError.BAD_VALUE gerror.message = str(error) raise gerror - group = _glib.OptionGroup(self.name, self.description, - self.help_description, callback) + group = _gi.OptionGroup(self.name, self.description, + self.help_description, callback) if self.translation_domain: group.set_translation_domain(self.translation_domain) @@ -226,7 +229,7 @@ class OptionGroup(optparse.OptionGroup): def set_values_to_defaults(self): for option in self.option_list: default = self.defaults.get(option.dest) - if isinstance(default, _basestring): + if isinstance(default, str): opt_str = option.get_opt_string() self.defaults[option.dest] = option.check_value( opt_str, default) @@ -236,15 +239,16 @@ class OptionGroup(optparse.OptionGroup): class OptionParser(optparse.OptionParser): """Command line parser with GOption support. - NOTE: The OptionParser interface is not the exactly the same as the - optparse.OptionParser interface. Especially the usage parameter - is only used to show the metavar of the arguements. + :param bool help_enabled: + The --help, --help-all and --help-{group} options are enabled (default). + :param bool ignore_unknown_options: + Do not throw a exception when a option is not knwon, the option + will be in the result list. - Attribues: - help_enabled: The --help, --help-all and --help-{group} - options are enabled (default). - ignore_unknown_options: Do not throw a exception when a option is not - knwon, the option will be in the result list. + .. NOTE:: + The OptionParser interface is not the exactly the same as the + optparse.OptionParser interface. Especially the usage parameter + is only used to show the metavar of the arguements. OptionParser.add_option_group() does not only accept OptionGroup instances but also glib.OptionGroup, which is returned by gtk_get_option_group(). @@ -277,12 +281,12 @@ class OptionParser(optparse.OptionParser): parameter_string = self.usage + " - " + self.description else: parameter_string = self.usage - context = _glib.OptionContext(parameter_string) + context = _gi.OptionContext(parameter_string) context.set_help_enabled(self.help_enabled) context.set_ignore_unknown_options(self.ignore_unknown_options) for option_group in self.option_groups: - if isinstance(option_group, _glib.OptionGroup): + if isinstance(option_group, _gi.OptionGroup): g_group = option_group else: g_group = option_group.get_option_group(self) @@ -295,7 +299,7 @@ class OptionParser(optparse.OptionParser): opt = self._short_opt[option_name] opt.process(option_name, option_value, values, self) - main_group = _glib.OptionGroup(None, None, None, callback) + main_group = _gi.OptionGroup(None, None, None, callback) main_entries = [] for option in self.option_list: main_entries.extend(option._to_goptionentries()) @@ -305,7 +309,7 @@ class OptionParser(optparse.OptionParser): return context def add_option_group(self, *args, **kwargs): - if isinstance(args[0], _basestring): + if isinstance(args[0], str): optparse.OptionParser.add_option_group(self, OptionGroup(self, *args, **kwargs)) return @@ -315,7 +319,7 @@ class OptionParser(optparse.OptionParser): args[0].parser = self if args[0].parser is not self: raise ValueError("invalid OptionGroup (wrong parser)") - if isinstance(args[0], _glib.OptionGroup): + if isinstance(args[0], _gi.OptionGroup): self.option_groups.append(args[0]) return optparse.OptionParser.add_option_group(self, *args, **kwargs) @@ -336,11 +340,10 @@ class OptionParser(optparse.OptionParser): rargs[:] = context.parse([sys.argv[0]] + rargs)[1:] def parse_args(self, args=None, values=None): - old_args = args or [] try: options, args = optparse.OptionParser.parse_args( self, args, values) - except _glib.GError: + except GError: error = sys.exc_info()[1] if error.domain != OPTION_CONTEXT_ERROR_QUARK: raise @@ -357,7 +360,7 @@ class OptionParser(optparse.OptionParser): for key, value in group.values.__dict__.items(): options.ensure_value(key, value) - args = args[2:-len(old_args)] return options, args + make_option = Option diff --git a/gi/_ossighelper.py b/gi/_ossighelper.py new file mode 100644 index 0000000..fba24e6 --- /dev/null +++ b/gi/_ossighelper.py @@ -0,0 +1,239 @@ +# Copyright 2017 Christoph Reiter +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +from __future__ import print_function + +import os +import socket +import signal +import threading +from contextlib import closing, contextmanager + +from . import _gi + + +def ensure_socket_not_inheritable(sock): + """Ensures that the socket is not inherited by child processes + + Raises: + EnvironmentError + NotImplementedError: With Python <3.4 on Windows + """ + + if hasattr(sock, "set_inheritable"): + sock.set_inheritable(False) + else: + try: + import fcntl + except ImportError: + raise NotImplementedError( + "Not implemented for older Python on Windows") + else: + fd = sock.fileno() + flags = fcntl.fcntl(fd, fcntl.F_GETFD) + fcntl.fcntl(fd, fcntl.F_SETFD, flags | fcntl.FD_CLOEXEC) + + +_wakeup_fd_is_active = False +"""Since we can't check if set_wakeup_fd() is already used for nested event +loops without introducing a race condition we keep track of it globally. +""" + + +@contextmanager +def wakeup_on_signal(): + """A decorator for functions which create a glib event loop to keep + Python signal handlers working while the event loop is idling. + + In case an OS signal is received will wake the default event loop up + shortly so that any registered Python signal handlers registered through + signal.signal() can run. + + In case the wrapped function is not called from the main thread it will be + called as is and it will not wake up the default loop for signals. + """ + + global _wakeup_fd_is_active + + if _wakeup_fd_is_active: + yield + return + + from gi.repository import GLib + + read_socket, write_socket = socket.socketpair() + with closing(read_socket), closing(write_socket): + + for sock in [read_socket, write_socket]: + sock.setblocking(False) + ensure_socket_not_inheritable(sock) + + try: + orig_fd = signal.set_wakeup_fd(write_socket.fileno()) + except ValueError: + # Raised in case this is not the main thread -> give up. + yield + return + else: + _wakeup_fd_is_active = True + + def signal_notify(source, condition): + if condition & GLib.IO_IN: + try: + return bool(read_socket.recv(1)) + except EnvironmentError as e: + print(e) + return False + return True + else: + return False + + try: + if os.name == "nt": + channel = GLib.IOChannel.win32_new_socket( + read_socket.fileno()) + else: + channel = GLib.IOChannel.unix_new(read_socket.fileno()) + + source_id = GLib.io_add_watch( + channel, + GLib.PRIORITY_DEFAULT, + (GLib.IOCondition.IN | GLib.IOCondition.HUP | + GLib.IOCondition.NVAL | GLib.IOCondition.ERR), + signal_notify) + try: + yield + finally: + GLib.source_remove(source_id) + finally: + write_fd = signal.set_wakeup_fd(orig_fd) + if write_fd != write_socket.fileno(): + # Someone has called set_wakeup_fd while func() was active, + # so let's re-revert again. + signal.set_wakeup_fd(write_fd) + _wakeup_fd_is_active = False + + +PyOS_getsig = _gi.pyos_getsig + +# We save the signal pointer so we can detect if glib has changed the +# signal handler behind Python's back (GLib.unix_signal_add) +if signal.getsignal(signal.SIGINT) is signal.default_int_handler: + startup_sigint_ptr = PyOS_getsig(signal.SIGINT) +else: + # Something has set the handler before import, we can't get a ptr + # for the default handler so make sure the pointer will never match. + startup_sigint_ptr = -1 + + +def sigint_handler_is_default(): + """Returns if on SIGINT the default Python handler would be called""" + + return (signal.getsignal(signal.SIGINT) is signal.default_int_handler and + PyOS_getsig(signal.SIGINT) == startup_sigint_ptr) + + +@contextmanager +def sigint_handler_set_and_restore_default(handler): + """Context manager for saving/restoring the SIGINT handler default state. + + Will only restore the default handler again if the handler is not changed + while the context is active. + """ + + assert sigint_handler_is_default() + + signal.signal(signal.SIGINT, handler) + sig_ptr = PyOS_getsig(signal.SIGINT) + try: + yield + finally: + if signal.getsignal(signal.SIGINT) is handler and \ + PyOS_getsig(signal.SIGINT) == sig_ptr: + signal.signal(signal.SIGINT, signal.default_int_handler) + + +def is_main_thread(): + """Returns True in case the function is called from the main thread""" + + return threading.current_thread().name == "MainThread" + + +_callback_stack = [] +_sigint_called = False + + +@contextmanager +def register_sigint_fallback(callback): + """Installs a SIGINT signal handler in case the default Python one is + active which calls 'callback' in case the signal occurs. + + Only does something if called from the main thread. + + In case of nested context managers the signal handler will be only + installed once and the callbacks will be called in the reverse order + of their registration. + + The old signal handler will be restored in case no signal handler is + registered while the context is active. + """ + + # To handle multiple levels of event loops we need to call the last + # callback first, wait until the inner most event loop returns control + # and only then call the next callback, and so on... until we + # reach the outer most which manages the signal handler and raises + # in the end + + global _callback_stack, _sigint_called + + if not is_main_thread(): + yield + return + + if not sigint_handler_is_default(): + if _callback_stack: + # This is an inner event loop, append our callback + # to the stack so the parent context can call it. + _callback_stack.append(callback) + try: + yield + finally: + cb = _callback_stack.pop() + if _sigint_called: + cb() + else: + # There is a signal handler set by the user, just do nothing + yield + return + + _sigint_called = False + + def sigint_handler(sig_num, frame): + global _callback_stack, _sigint_called + + if _sigint_called: + return + _sigint_called = True + _callback_stack.pop()() + + _callback_stack.append(callback) + try: + with sigint_handler_set_and_restore_default(sigint_handler): + yield + finally: + if _sigint_called: + signal.default_int_handler(signal.SIGINT, None) + else: + _callback_stack.pop() diff --git a/gi/_gobject/propertyhelper.py b/gi/_propertyhelper.py similarity index 78% rename from gi/_gobject/propertyhelper.py rename to gi/_propertyhelper.py index c9400df..def34b2 100644 --- a/gi/_gobject/propertyhelper.py +++ b/gi/_propertyhelper.py @@ -2,7 +2,7 @@ # pygobject - Python bindings for the GObject library # Copyright (C) 2007 Johan Dahlin # -# gobject/propertyhelper.py: GObject property wrapper/helper +# gi/_propertyhelper.py: GObject property wrapper/helper # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -15,67 +15,83 @@ # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA +# License along with this library; if not, see . -import sys - -from . import _gobject - -from .constants import \ +from . import _gi +from ._constants import \ TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, \ TYPE_BOOLEAN, TYPE_INT, TYPE_UINT, TYPE_LONG, \ TYPE_ULONG, TYPE_INT64, TYPE_UINT64, TYPE_ENUM, TYPE_FLAGS, \ TYPE_FLOAT, TYPE_DOUBLE, TYPE_STRING, \ TYPE_POINTER, TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, \ TYPE_PYOBJECT, TYPE_GTYPE, TYPE_STRV, TYPE_VARIANT -from ._gobject import \ - G_MAXFLOAT, G_MAXDOUBLE, \ - G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \ - G_MAXULONG -if sys.version_info >= (3, 0): - _basestring = str - _long = int -else: - _basestring = basestring - _long = long +G_MAXFLOAT = _gi.G_MAXFLOAT +G_MAXDOUBLE = _gi.G_MAXDOUBLE +G_MININT = _gi.G_MININT +G_MAXINT = _gi.G_MAXINT +G_MAXUINT = _gi.G_MAXUINT +G_MINLONG = _gi.G_MINLONG +G_MAXLONG = _gi.G_MAXLONG +G_MAXULONG = _gi.G_MAXULONG class Property(object): - """ - Creates a new property which in conjunction with GObject subclass will - create a property proxy: - - class MyObject(GObject.GObject): - ... prop = GObject.Property(type=str) + """Creates a new Property which when used in conjunction with + GObject subclass will create a Python property accessor for the + GObject ParamSpec. + + :param callable getter: + getter to get the value of the property + :param callable setter: + setter to set the value of the property + :param type type: + type of property + :param default: + default value, must match the property type. + :param str nick: + short description + :param str blurb: + long description + :param GObject.ParamFlags flags: + parameter flags + :keyword minimum: + minimum allowed value (int, float, long only) + :keyword maximum: + maximum allowed value (int, float, long only) + + .. code-block:: python + + class MyObject(GObject.Object): + prop = GObject.Property(type=str) obj = MyObject() obj.prop = 'value' obj.prop # now is 'value' - The API is similar to the builtin property: + The API is similar to the builtin :py:func:`property`: + + .. code-block:: python - class AnotherObject(GObject.GObject): - @GObject.Property - def prop(self): - '''Read only property.''' - return ... + class AnotherObject(GObject.Object): + value = 0 - @GObject.Property(type=int) - def propInt(self): - '''Read-write integer property.''' - return ... + @GObject.Property + def prop(self): + 'Read only property.' + return 1 - @propInt.setter - def propInt(self, value): - ... + @GObject.Property(type=int) + def propInt(self): + 'Read-write integer property.' + return self.value + + @propInt.setter + def propInt(self, value): + self.value = value """ _type_from_pytype_lookup = { - # Put long_ first in case long_ and int are the same so int clobbers long_ - _long: TYPE_LONG, int: TYPE_INT, bool: TYPE_BOOLEAN, float: TYPE_DOUBLE, @@ -123,31 +139,8 @@ class Property(object): return "" def __init__(self, getter=None, setter=None, type=None, default=None, - nick='', blurb='', flags=_gobject.PARAM_READWRITE, + nick='', blurb='', flags=_gi.PARAM_READWRITE, minimum=None, maximum=None): - """ - @param getter: getter to get the value of the property - @type getter: callable - @param setter: setter to set the value of the property - @type setter: callable - @param type: type of property - @type type: type - @param default: default value - @param nick: short description - @type nick: string - @param blurb: long description - @type blurb: string - @param flags: parameter flags, one of: - - gobject.PARAM_READABLE - - gobject.PARAM_READWRITE - - gobject.PARAM_WRITABLE - - gobject.PARAM_CONSTRUCT - - gobject.PARAM_CONSTRUCT_ONLY - - gobject.PARAM_LAX_VALIDATION - @keyword minimum: minimum allowed value (int, float, long only) - @keyword maximum: maximum allowed value (int, float, long only) - """ - self.name = None if type is None: @@ -156,11 +149,11 @@ class Property(object): self.default = self._get_default(default) self._check_default() - if not isinstance(nick, _basestring): + if not isinstance(nick, str): raise TypeError("nick must be a string") self.nick = nick - if not isinstance(blurb, _basestring): + if not isinstance(blurb, str): raise TypeError("blurb must be a string") self.blurb = blurb # Always clobber __doc__ with blurb even if blurb is empty because @@ -204,14 +197,14 @@ class Property(object): def __repr__(self): return '' % ( self.name or '(uninitialized)', - _gobject.type_name(self.type)) + self.type.name) def __get__(self, instance, klass): if instance is None: return self self._exc = None - value = instance.get_property(self.name) + value = self.fget(instance) if self._exc: exc = self._exc self._exc = None @@ -257,11 +250,11 @@ class Property(object): if type_ in self._type_from_pytype_lookup: return self._type_from_pytype_lookup[type_] elif (isinstance(type_, type) and - issubclass(type_, (_gobject.GObject, - _gobject.GEnum, - _gobject.GFlags, - _gobject.GBoxed, - _gobject.GInterface))): + issubclass(type_, (_gi.GObject, + _gi.GEnum, + _gi.GFlags, + _gi.GBoxed, + _gi.GInterface))): return type_.__gtype__ elif type_ in (TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG, @@ -290,24 +283,24 @@ class Property(object): elif ptype == TYPE_GTYPE: if default is not None: raise TypeError("GType types does not have default values") - elif _gobject.type_is_a(ptype, TYPE_ENUM): + elif ptype.is_a(TYPE_ENUM): if default is None: raise TypeError("enum properties needs a default value") - elif not _gobject.type_is_a(default, ptype): + elif not _gi.GType(default).is_a(ptype): raise TypeError("enum value %s must be an instance of %r" % (default, ptype)) - elif _gobject.type_is_a(ptype, TYPE_FLAGS): - if not _gobject.type_is_a(default, ptype): + elif ptype.is_a(TYPE_FLAGS): + if not _gi.GType(default).is_a(ptype): raise TypeError("flags value %s must be an instance of %r" % (default, ptype)) - elif _gobject.type_is_a(ptype, TYPE_STRV) and default is not None: + elif ptype.is_a(TYPE_STRV) and default is not None: if not isinstance(default, list): raise TypeError("Strv value %s must be a list" % repr(default)) for val in default: if type(val) not in (str, bytes): raise TypeError("Strv value %s must contain only strings" % str(default)) - elif _gobject.type_is_a(ptype, TYPE_VARIANT) and default is not None: - if not hasattr(default, '__gtype__') or not _gobject.type_is_a(default, TYPE_VARIANT): + elif ptype.is_a(TYPE_VARIANT) and default is not None: + if not hasattr(default, '__gtype__') or not _gi.GType(default).is_a(TYPE_VARIANT): raise TypeError("variant value %s must be an instance of %r" % (default, ptype)) @@ -398,9 +391,7 @@ def install_properties(cls): def obj_get_property(self, pspec): name = pspec.name.replace('-', '_') - prop = getattr(cls, name, None) - if prop: - return prop.fget(self) + return getattr(self, name, None) cls.do_get_property = obj_get_property def obj_set_property(self, pspec, value): diff --git a/gi/_gobject/signalhelper.py b/gi/_signalhelper.py similarity index 69% rename from gi/_gobject/signalhelper.py rename to gi/_signalhelper.py index b630158..8a1f0a4 100644 --- a/gi/_gobject/signalhelper.py +++ b/gi/_signalhelper.py @@ -2,7 +2,7 @@ # pygobject - Python bindings for the GObject library # Copyright (C) 2012 Simon Feltman # -# gobject/signalhelper.py: GObject signal binding decorator object +# gi/_signalhelper.py: GObject signal binding decorator object # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -15,52 +15,60 @@ # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA +# License along with this library; if not, see . -import sys -import inspect - -from . import _gobject - -# Callable went away in python 3.0 and came back in 3.2. -# Use versioning to figure out when to define it, otherwise we have to deal with -# the complexity of using __builtin__ or builtin between python versions to -# check if callable exists which PyFlakes will also complain about. -if (3, 0) <= sys.version_info < (3, 2): - def callable(fn): - return hasattr(fn, '__call__') +from . import _gi class Signal(str): - """ - Object which gives a nice API for creating and binding signals. - - Example: - class Spam(GObject.GObject): - velocity = 0 - - @GObject.Signal - def pushed(self): - self.velocity += 1 - - @GObject.Signal(flags=GObject.SignalFlags.RUN_LAST) - def pulled(self): - self.velocity -= 1 - - stomped = GObject.Signal('stomped', arg_types=(int,)) - - @GObject.Signal - def annotated_signal(self, a:int, b:str): - "Python3 annotation support for parameter types. - - def on_pushed(obj): - print(obj) - - spam = Spam() - spam.pushed.connect(on_pushed) - spam.pushed.emit() + """Object which gives a nice API for creating and binding signals. + + :param name: + Name of signal or callable closure when used as a decorator. + :type name: str or callable + :param callable func: + Callable closure method. + :param GObject.SignalFlags flags: + Flags specifying when to run closure. + :param type return_type: + Return type of the Signal. + :param list arg_types: + List of argument types specifying the signals function signature + :param str doc: + Documentation of signal object. + :param callable accumulator: + Accumulator method with the signature: + func(ihint, return_accu, handler_return, accu_data) -> boolean + :param object accu_data: + User data passed to the accumulator. + + :Example: + + .. code-block:: python + + class Spam(GObject.Object): + velocity = 0 + + @GObject.Signal + def pushed(self): + self.velocity += 1 + + @GObject.Signal(flags=GObject.SignalFlags.RUN_LAST) + def pulled(self): + self.velocity -= 1 + + stomped = GObject.Signal('stomped', arg_types=(int,)) + + @GObject.Signal + def annotated_signal(self, a:int, b:str): + "Python3 annotation support for parameter types. + + def on_pushed(obj): + print(obj) + + spam = Spam() + spam.pushed.connect(on_pushed) + spam.pushed.emit() """ class BoundSignal(str): """ @@ -83,12 +91,12 @@ class Signal(str): return self.signal.func(self.gobj, *args, **kargs) def connect(self, callback, *args, **kargs): - """Same as GObject.GObject.connect except there is no need to specify + """Same as GObject.Object.connect except there is no need to specify the signal name.""" return self.gobj.connect(self, callback, *args, **kargs) def connect_detailed(self, callback, detail, *args, **kargs): - """Same as GObject.GObject.connect except there is no need to specify + """Same as GObject.Object.connect except there is no need to specify the signal name. In addition concats "::" to the signal name when connecting; for use with notifications like "notify" when a property changes. @@ -96,11 +104,11 @@ class Signal(str): return self.gobj.connect(self + '::' + detail, callback, *args, **kargs) def disconnect(self, handler_id): - """Same as GObject.GObject.disconnect.""" - self.instance.disconnect(handler_id) + """Same as GObject.Object.disconnect.""" + self.gobj.disconnect(handler_id) def emit(self, *args, **kargs): - """Same as GObject.GObject.emit except there is no need to specify + """Same as GObject.Object.emit except there is no need to specify the signal name.""" return self.gobj.emit(str(self), *args, **kargs) @@ -109,32 +117,11 @@ class Signal(str): name = name.__name__ return str.__new__(cls, name) - def __init__(self, name='', func=None, flags=_gobject.SIGNAL_RUN_FIRST, + def __init__(self, name='', func=None, flags=_gi.SIGNAL_RUN_FIRST, return_type=None, arg_types=None, doc='', accumulator=None, accu_data=None): - """ - @param name: name of signal or closure method when used as direct decorator. - @type name: string or callable - @param func: closure method. - @type func: callable - @param flags: flags specifying when to run closure - @type flags: GObject.SignalFlags - @param return_type: return type - @type return_type: type - @param arg_types: list of argument types specifying the signals function signature - @type arg_types: None - @param doc: documentation of signal object - @type doc: string - @param accumulator: accumulator method with the signature: - func(ihint, return_accu, handler_return, accu_data) -> boolean - @type accumulator: function - @param accu_data: user data passed to the accumulator - @type accu_data: object - """ - if func and not name: - name = func.__name__ - elif callable(name): + if func is None and callable(name): func = name - name = func.__name__ + if func and not doc: doc = func.__doc__ @@ -165,7 +152,7 @@ class Signal(str): # If obj is a GObject, than we call this signal as a closure otherwise # it is used as a re-application of a decorator. - if isinstance(obj, _gobject.GObject): + if isinstance(obj, _gi.GObject): self.func(obj, *args, **kargs) else: # If self is already an allocated name, use it otherwise create a new named @@ -181,8 +168,7 @@ class Signal(str): def copy(self, newName=None): """Returns a renamed copy of the Signal.""" - if newName is None: - newName = self.name + return type(self)(name=newName, func=self.func, flags=self.flags, return_type=self.return_type, arg_types=self.arg_types, doc=self.__doc__, accumulator=self.accumulator, accu_data=self.accu_data) @@ -193,14 +179,17 @@ class Signal(str): class SignalOverride(Signal): - """Specialized sub-class of signal which can be used as a decorator for overriding + """Specialized sub-class of Signal which can be used as a decorator for overriding existing signals on GObjects. - Example: - class MyWidget(Gtk.Widget): - @GObject.SignalOverride - def configure_event(self): - pass + :Example: + + .. code-block:: python + + class MyWidget(Gtk.Widget): + @GObject.SignalOverride + def configure_event(self): + pass """ def get_signal_args(self): """Returns the string 'override'.""" @@ -217,6 +206,8 @@ def get_signal_annotations(func): return_type = None if hasattr(func, '__annotations__'): + # import inspect only when needed because it takes ~10 msec to load + import inspect spec = inspect.getfullargspec(func) arg_types = tuple(spec.annotations[arg] for arg in spec.args if arg in spec.annotations) diff --git a/gi/docstring.py b/gi/docstring.py index 713bb6e..08bcef9 100644 --- a/gi/docstring.py +++ b/gi/docstring.py @@ -23,9 +23,11 @@ from ._gi import \ VFuncInfo, \ FunctionInfo, \ - DIRECTION_IN, \ - DIRECTION_OUT, \ - DIRECTION_INOUT + CallableInfo, \ + ObjectInfo, \ + StructInfo, \ + Direction, \ + TypeTag #: Module storage for currently registered doc string generator function. @@ -35,21 +37,26 @@ _generate_doc_string_func = None def set_doc_string_generator(func): """Set doc string generator function - :Parameters: - func : callable - Function which takes a GIInfoStruct and returns - documentation for it. + :param callable func: + Callable which takes a GIInfoStruct and returns documentation for it. """ global _generate_doc_string_func _generate_doc_string_func = func def get_doc_string_generator(): + """Returns the currently registered doc string generator.""" return _generate_doc_string_func def generate_doc_string(info): - """Generator a doc string given a GIInfoStruct + """Generate a doc string given a GIInfoStruct. + + :param gi.types.BaseInfo info: + GI info instance to generate documentation for. + :returns: + Generated documentation as a string. + :rtype: str This passes the info struct to the currently registered doc string generator and returns the result. @@ -57,50 +64,142 @@ def generate_doc_string(info): return _generate_doc_string_func(info) -def split_function_info_args(info): - """Split a functions args into a tuple of two lists. - - Note that args marked as DIRECTION_INOUT will be in both lists. - - :Returns: - Tuple of (in_args, out_args) - """ - in_args = [] - out_args = [] - for arg in info.get_arguments(): - direction = arg.get_direction() - if direction in (DIRECTION_IN, DIRECTION_INOUT): - in_args.append(arg) - if direction in (DIRECTION_OUT, DIRECTION_INOUT): - out_args.append(arg) - return (in_args, out_args) - - -def _generate_callable_info_function_signature(info): - """Default doc string generator""" - in_args, out_args = split_function_info_args(info) +_type_tag_to_py_type = {TypeTag.BOOLEAN: bool, + TypeTag.INT8: int, + TypeTag.UINT8: int, + TypeTag.INT16: int, + TypeTag.UINT16: int, + TypeTag.INT32: int, + TypeTag.UINT32: int, + TypeTag.INT64: int, + TypeTag.UINT64: int, + TypeTag.FLOAT: float, + TypeTag.DOUBLE: float, + TypeTag.GLIST: list, + TypeTag.GSLIST: list, + TypeTag.ARRAY: list, + TypeTag.GHASH: dict, + TypeTag.UTF8: str, + TypeTag.FILENAME: str, + TypeTag.UNICHAR: str, + TypeTag.INTERFACE: None, + TypeTag.GTYPE: None, + TypeTag.ERROR: None, + TypeTag.VOID: None, + } + + +def _get_pytype_hint(gi_type): + type_tag = gi_type.get_tag() + py_type = _type_tag_to_py_type.get(type_tag, None) + + if py_type and hasattr(py_type, '__name__'): + return py_type.__name__ + elif type_tag == TypeTag.INTERFACE: + iface = gi_type.get_interface() + + info_name = iface.get_name() + if not info_name: + return gi_type.get_tag_as_string() + + return '%s.%s' % (iface.get_namespace(), info_name) + + return gi_type.get_tag_as_string() + + +def _generate_callable_info_doc(info): in_args_strs = [] if isinstance(info, VFuncInfo): in_args_strs = ['self'] elif isinstance(info, FunctionInfo): if info.is_method(): in_args_strs = ['self'] - elif info.is_constructor(): - in_args_strs = ['cls'] - for arg in in_args: - argstr = arg.get_name() + ':' + arg.get_pytype_hint() - if arg.is_optional(): + args = info.get_arguments() + hint_blacklist = ('void',) + + # Build lists of indices prior to adding the docs because it is possible + # the index retrieved comes before input arguments being used. + ignore_indices = {info.get_return_type().get_array_length()} + user_data_indices = set() + for arg in args: + ignore_indices.add(arg.get_destroy()) + ignore_indices.add(arg.get_type().get_array_length()) + user_data_indices.add(arg.get_closure()) + + # Build input argument strings + for i, arg in enumerate(args): + if arg.get_direction() == Direction.OUT: + continue # skip exclusively output args + if i in ignore_indices: + continue + argstr = arg.get_name() + hint = _get_pytype_hint(arg.get_type()) + if hint not in hint_blacklist: + argstr += ':' + hint + if arg.may_be_null() or i in user_data_indices: + # allow-none or user_data from a closure + argstr += '=None' + elif arg.is_optional(): argstr += '=' in_args_strs.append(argstr) in_args_str = ', '.join(in_args_strs) - if out_args: - out_args_str = ', '.join(arg.get_name() + ':' + arg.get_pytype_hint() - for arg in out_args) - return '%s(%s) -> %s' % (info.get_name(), in_args_str, out_args_str) + # Build return + output argument strings + out_args_strs = [] + return_hint = _get_pytype_hint(info.get_return_type()) + if not info.skip_return() and return_hint and return_hint not in hint_blacklist: + argstr = return_hint + if info.may_return_null(): + argstr += ' or None' + out_args_strs.append(argstr) + + for i, arg in enumerate(args): + if arg.get_direction() == Direction.IN: + continue # skip exclusively input args + if i in ignore_indices: + continue + argstr = arg.get_name() + hint = _get_pytype_hint(arg.get_type()) + if hint not in hint_blacklist: + argstr += ':' + hint + out_args_strs.append(argstr) + + if out_args_strs: + return '%s(%s) -> %s' % (info.__name__, in_args_str, ', '.join(out_args_strs)) + else: + return '%s(%s)' % (info.__name__, in_args_str) + + +def _generate_class_info_doc(info): + header = '\n:Constructors:\n\n::\n\n' # start with \n to avoid auto indent of other lines + doc = '' + + if isinstance(info, StructInfo): + # Don't show default constructor for disguised (0 length) structs + if info.get_size() > 0: + doc += ' ' + info.get_name() + '()\n' else: - return '%s(%s)' % (info.get_name(), in_args_str) + doc += ' ' + info.get_name() + '(**properties)\n' + + for method_info in info.get_methods(): + if method_info.is_constructor(): + doc += ' ' + _generate_callable_info_doc(method_info) + '\n' + + if doc: + return header + doc + else: + return '' + + +def _generate_doc_dispatch(info): + if isinstance(info, (ObjectInfo, StructInfo)): + return _generate_class_info_doc(info) + + elif isinstance(info, CallableInfo): + return _generate_callable_info_doc(info) + + return '' -set_doc_string_generator(_generate_callable_info_function_signature) +set_doc_string_generator(_generate_doc_dispatch) diff --git a/gi/gimodule.c b/gi/gimodule.c index 12dfb36..9bc86be 100644 --- a/gi/gimodule.c +++ b/gi/gimodule.c @@ -21,14 +21,1469 @@ * USA */ -#include "pygi-private.h" -#include "pygi.h" -#include "pyglib.h" +#include +#include + +#include "config.h" +#include "pyginterface.h" +#include "pygi-repository.h" +#include "pygi-type.h" +#include "pygenum.h" +#include "pygboxed.h" +#include "pygflags.h" +#include "pygi-error.h" +#include "pygi-foreign.h" +#include "pygi-resulttuple.h" +#include "pygi-source.h" +#include "pygi-ccallback.h" +#include "pygi-closure.h" +#include "pygi-type.h" +#include "pygi-boxed.h" +#include "pygi-info.h" +#include "pygi-struct.h" +#include "pygobject-object.h" +#include "pygoptioncontext.h" +#include "pygoptiongroup.h" +#include "pygspawn.h" +#include "pygparamspec.h" +#include "pygpointer.h" +#include "pygobject-internal.h" +#include "pygi-value.h" +#include "pygi-property.h" +#include "pygi-util.h" +#include "gimodule.h" +#include "pygi-basictype.h" + +PyObject *PyGIWarning; +PyObject *PyGIDeprecationWarning; +PyObject *_PyGIDefaultArgPlaceholder; + +/* Returns a new flag/enum type or %NULL */ +static PyObject * +flags_enum_from_gtype (GType g_type, + PyObject * (add_func) (PyObject *, const char *, + const char *, GType)) +{ + PyObject *new_type; + GIRepository *repository; + GIBaseInfo *info; + const gchar *type_name; + + repository = g_irepository_get_default (); + info = g_irepository_find_by_gtype (repository, g_type); + if (info != NULL) { + type_name = g_base_info_get_name (info); + new_type = add_func (NULL, type_name, NULL, g_type); + g_base_info_unref (info); + } else { + type_name = g_type_name (g_type); + new_type = add_func (NULL, type_name, NULL, g_type); + } + + return new_type; +} + +static void pyg_flags_add_constants(PyObject *module, GType flags_type, + const gchar *strip_prefix); + +/** + * pyg_enum_add_constants: + * @module: a Python module + * @enum_type: the GType of the enumeration. + * @strip_prefix: the prefix to strip from the constant names. + * + * Adds constants to the given Python module for each value name of + * the enumeration. A prefix will be stripped from each enum name. + */ +static void +pyg_enum_add_constants(PyObject *module, GType enum_type, + const gchar *strip_prefix) +{ + GEnumClass *eclass; + guint i; + + if (!G_TYPE_IS_ENUM(enum_type)) { + if (G_TYPE_IS_FLAGS(enum_type)) /* See bug #136204 */ + pyg_flags_add_constants(module, enum_type, strip_prefix); + else + g_warning("`%s' is not an enum type", g_type_name(enum_type)); + return; + } + g_return_if_fail (strip_prefix != NULL); + + eclass = G_ENUM_CLASS(g_type_class_ref(enum_type)); + + for (i = 0; i < eclass->n_values; i++) { + const gchar *name = eclass->values[i].value_name; + gint value = eclass->values[i].value; + + PyModule_AddIntConstant(module, + (char*) pyg_constant_strip_prefix(name, strip_prefix), + (long) value); + } + + g_type_class_unref(eclass); +} + +/** + * pyg_flags_add_constants: + * @module: a Python module + * @flags_type: the GType of the flags type. + * @strip_prefix: the prefix to strip from the constant names. + * + * Adds constants to the given Python module for each value name of + * the flags set. A prefix will be stripped from each flag name. + */ +static void +pyg_flags_add_constants(PyObject *module, GType flags_type, + const gchar *strip_prefix) +{ + GFlagsClass *fclass; + guint i; + + if (!G_TYPE_IS_FLAGS(flags_type)) { + if (G_TYPE_IS_ENUM(flags_type)) /* See bug #136204 */ + pyg_enum_add_constants(module, flags_type, strip_prefix); + else + g_warning("`%s' is not an flags type", g_type_name(flags_type)); + return; + } + g_return_if_fail (strip_prefix != NULL); + + fclass = G_FLAGS_CLASS(g_type_class_ref(flags_type)); + + for (i = 0; i < fclass->n_values; i++) { + const gchar *name = fclass->values[i].value_name; + guint value = fclass->values[i].value; + + PyModule_AddIntConstant(module, + (char*) pyg_constant_strip_prefix(name, strip_prefix), + (long) value); + } + + g_type_class_unref(fclass); +} + +/** + * pyg_set_thread_block_funcs: + * Deprecated, only available for ABI compatibility. + */ +static void +_pyg_set_thread_block_funcs (PyGThreadBlockFunc block_threads_func, + PyGThreadBlockFunc unblock_threads_func) +{ + PyGILState_STATE state = PyGILState_Ensure (); + PyErr_Warn (PyExc_DeprecationWarning, + "Using pyg_set_thread_block_funcs is not longer needed. " + "PyGObject always uses Py_BLOCK/UNBLOCK_THREADS."); + PyGILState_Release (state); +} + +static GParamSpec * +create_property (const gchar *prop_name, + GType prop_type, + const gchar *nick, + const gchar *blurb, + PyObject *args, + GParamFlags flags) +{ + GParamSpec *pspec = NULL; + + switch (G_TYPE_FUNDAMENTAL(prop_type)) { + case G_TYPE_CHAR: + { + gchar minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "ccc", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_char (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_UCHAR: + { + gchar minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "ccc", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_uchar (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_BOOLEAN: + { + gboolean default_value; + + if (!PyArg_ParseTuple(args, "i", &default_value)) + return NULL; + pspec = g_param_spec_boolean (prop_name, nick, blurb, + default_value, flags); + } + break; + case G_TYPE_INT: + { + gint minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "iii", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_int (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_UINT: + { + guint minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "III", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_uint (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_LONG: + { + glong minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "lll", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_long (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_ULONG: + { + gulong minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "kkk", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_ulong (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_INT64: + { + gint64 minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "LLL", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_int64 (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_UINT64: + { + guint64 minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "KKK", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_uint64 (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_ENUM: + { + gint default_value; + PyObject *pydefault; + + if (!PyArg_ParseTuple(args, "O", &pydefault)) + return NULL; + + if (pyg_enum_get_value(prop_type, pydefault, + (gint *)&default_value)) + return NULL; + + pspec = g_param_spec_enum (prop_name, nick, blurb, + prop_type, default_value, flags); + } + break; + case G_TYPE_FLAGS: + { + guint default_value; + PyObject *pydefault; + + if (!PyArg_ParseTuple(args, "O", &pydefault)) + return NULL; + + if (pyg_flags_get_value(prop_type, pydefault, + &default_value)) + return NULL; + + pspec = g_param_spec_flags (prop_name, nick, blurb, + prop_type, default_value, flags); + } + break; + case G_TYPE_FLOAT: + { + gfloat minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "fff", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_float (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_DOUBLE: + { + gdouble minimum, maximum, default_value; + + if (!PyArg_ParseTuple(args, "ddd", &minimum, &maximum, + &default_value)) + return NULL; + pspec = g_param_spec_double (prop_name, nick, blurb, minimum, + maximum, default_value, flags); + } + break; + case G_TYPE_STRING: + { + const gchar *default_value; + + if (!PyArg_ParseTuple(args, "z", &default_value)) + return NULL; + pspec = g_param_spec_string (prop_name, nick, blurb, + default_value, flags); + } + break; + case G_TYPE_PARAM: + if (!PyArg_ParseTuple(args, "")) + return NULL; + pspec = g_param_spec_param (prop_name, nick, blurb, prop_type, flags); + break; + case G_TYPE_BOXED: + if (!PyArg_ParseTuple(args, "")) + return NULL; + pspec = g_param_spec_boxed (prop_name, nick, blurb, prop_type, flags); + break; + case G_TYPE_POINTER: + if (!PyArg_ParseTuple(args, "")) + return NULL; + if (prop_type == G_TYPE_GTYPE) + pspec = g_param_spec_gtype (prop_name, nick, blurb, G_TYPE_NONE, flags); + else + pspec = g_param_spec_pointer (prop_name, nick, blurb, flags); + break; + case G_TYPE_OBJECT: + case G_TYPE_INTERFACE: + if (!PyArg_ParseTuple(args, "")) + return NULL; + pspec = g_param_spec_object (prop_name, nick, blurb, prop_type, flags); + break; + case G_TYPE_VARIANT: + { + PyObject *pydefault; + GVariant *default_value = NULL; + + if (!PyArg_ParseTuple(args, "O", &pydefault)) + return NULL; + if (pydefault != Py_None) + default_value = pyg_boxed_get (pydefault, GVariant); + pspec = g_param_spec_variant (prop_name, nick, blurb, G_VARIANT_TYPE_ANY, default_value, flags); + } + break; + default: + /* unhandled pspec type ... */ + break; + } + + if (!pspec) { + char buf[128]; + + g_snprintf(buf, sizeof(buf), "could not create param spec for type %s", + g_type_name(prop_type)); + PyErr_SetString(PyExc_TypeError, buf); + return NULL; + } + + return pspec; +} + +static GParamSpec * +pyg_param_spec_from_object (PyObject *tuple) +{ + Py_ssize_t val_length; + const gchar *prop_name; + GType prop_type; + const gchar *nick, *blurb; + PyObject *slice, *item, *py_prop_type; + GParamSpec *pspec; + gint intvalue; + + val_length = PyTuple_Size(tuple); + if (val_length < 4) { + PyErr_SetString(PyExc_TypeError, + "paramspec tuples must be at least 4 elements long"); + return NULL; + } + + slice = PySequence_GetSlice(tuple, 0, 4); + if (!slice) { + return NULL; + } + + if (!PyArg_ParseTuple(slice, "sOzz", &prop_name, &py_prop_type, &nick, &blurb)) { + Py_DECREF(slice); + return NULL; + } + + Py_DECREF(slice); + + prop_type = pyg_type_from_object(py_prop_type); + if (!prop_type) { + return NULL; + } + + item = PyTuple_GetItem(tuple, val_length-1); + if (!PyLong_Check (item)) { + PyErr_SetString(PyExc_TypeError, + "last element in tuple must be an int"); + return NULL; + } + + if (!pygi_gint_from_py (item, &intvalue)) + return NULL; + + /* slice is the extra items in the tuple */ + slice = PySequence_GetSlice(tuple, 4, val_length-1); + pspec = create_property(prop_name, prop_type, + nick, blurb, slice, + intvalue); + + return pspec; +} + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +/** + * pyg_parse_constructor_args: helper function for PyGObject constructors + * @obj_type: GType of the GObject, for parameter introspection + * @arg_names: %NULL-terminated array of constructor argument names + * @prop_names: %NULL-terminated array of property names, with direct + * correspondence to @arg_names + * @params: GParameter array where parameters will be placed; length + * of this array must be at least equal to the number of + * arguments/properties + * @nparams: output parameter to contain actual number of arguments found + * @py_args: array of PyObject* containing the actual constructor arguments + * + * Parses an array of PyObject's and creates a GParameter array + * + * Return value: %TRUE if all is successful, otherwise %FALSE and + * python exception set. + **/ +static gboolean +pyg_parse_constructor_args(GType obj_type, + char **arg_names, + char **prop_names, + GParameter *params, + guint *nparams, + PyObject **py_args) +{ + guint arg_i, param_i; + GObjectClass *oclass; + + oclass = g_type_class_ref(obj_type); + g_return_val_if_fail(oclass, FALSE); + + for (param_i = arg_i = 0; arg_names[arg_i]; ++arg_i) { + GParamSpec *spec; + if (!py_args[arg_i]) + continue; + spec = g_object_class_find_property(oclass, prop_names[arg_i]); + params[param_i].name = prop_names[arg_i]; + g_value_init(¶ms[param_i].value, spec->value_type); + if (pyg_value_from_pyobject(¶ms[param_i].value, py_args[arg_i]) == -1) { + guint i; + PyErr_Format(PyExc_TypeError, "could not convert parameter '%s' of type '%s'", + arg_names[arg_i], g_type_name(spec->value_type)); + g_type_class_unref(oclass); + for (i = 0; i < param_i; ++i) + g_value_unset(¶ms[i].value); + return FALSE; + } + ++param_i; + } + g_type_class_unref(oclass); + *nparams = param_i; + return TRUE; +} + +G_GNUC_END_IGNORE_DEPRECATIONS + +/* Only for backwards compatibility */ +static int +pygobject_enable_threads(void) +{ + return 0; +} + +static int +pygobject_gil_state_ensure (void) +{ + return PyGILState_Ensure (); +} + +static void +pygobject_gil_state_release (int flag) +{ + PyGILState_Release(flag); +} + +static void +pyg_register_class_init(GType gtype, PyGClassInitFunc class_init) +{ + GSList *list; + + list = g_type_get_qdata(gtype, pygobject_class_init_key); + list = g_slist_prepend(list, class_init); + g_type_set_qdata(gtype, pygobject_class_init_key, list); +} + +static gboolean +add_properties (GObjectClass *klass, PyObject *properties) +{ + gboolean ret = TRUE; + Py_ssize_t pos = 0; + PyObject *key, *value; + + while (PyDict_Next(properties, &pos, &key, &value)) { + const gchar *prop_name; + GType prop_type; + const gchar *nick, *blurb; + GParamFlags flags; + Py_ssize_t val_length; + PyObject *slice, *item, *py_prop_type; + GParamSpec *pspec; + + /* values are of format (type,nick,blurb, type_specific_args, flags) */ + + if (!PyUnicode_Check(key)) { + PyErr_SetString(PyExc_TypeError, + "__gproperties__ keys must be strings"); + ret = FALSE; + break; + } + prop_name = PyUnicode_AsUTF8 (key); + + if (!PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__gproperties__ values must be tuples"); + ret = FALSE; + break; + } + val_length = PyTuple_Size(value); + if (val_length < 4) { + PyErr_SetString(PyExc_TypeError, + "__gproperties__ values must be at least 4 elements long"); + ret = FALSE; + break; + } + + slice = PySequence_GetSlice(value, 0, 3); + if (!slice) { + ret = FALSE; + break; + } + if (!PyArg_ParseTuple(slice, "Ozz", &py_prop_type, &nick, &blurb)) { + Py_DECREF(slice); + ret = FALSE; + break; + } + Py_DECREF(slice); + prop_type = pyg_type_from_object(py_prop_type); + if (!prop_type) { + ret = FALSE; + break; + } + item = PyTuple_GetItem(value, val_length-1); + if (!PyLong_Check (item)) { + PyErr_SetString(PyExc_TypeError, + "last element in __gproperties__ value tuple must be an int"); + ret = FALSE; + break; + } + if (!pygi_gint_from_py (item, &flags)) { + ret = FALSE; + break; + } + + /* slice is the extra items in the tuple */ + slice = PySequence_GetSlice(value, 3, val_length-1); + pspec = create_property(prop_name, prop_type, nick, blurb, + slice, flags); + Py_DECREF(slice); + + if (pspec) { + g_object_class_install_property(klass, 1, pspec); + } else { + PyObject *type, *pvalue, *traceback; + ret = FALSE; + PyErr_Fetch(&type, &pvalue, &traceback); + if (PyUnicode_Check(pvalue)) { + char msg[256]; + g_snprintf(msg, 256, + "%s (while registering property '%s' for GType '%s')", + PyUnicode_AsUTF8 (pvalue), + prop_name, G_OBJECT_CLASS_NAME(klass)); + Py_DECREF(pvalue); + value = PyUnicode_FromString (msg); + } + PyErr_Restore(type, pvalue, traceback); + break; + } + } + + return ret; +} + +static gboolean +override_signal(GType instance_type, const gchar *signal_name) +{ + guint signal_id; + + signal_id = g_signal_lookup(signal_name, instance_type); + if (!signal_id) { + gchar buf[128]; + + g_snprintf(buf, sizeof(buf), "could not look up %s", signal_name); + PyErr_SetString(PyExc_TypeError, buf); + return FALSE; + } + g_signal_override_class_closure(signal_id, instance_type, + pyg_signal_class_closure_get()); + return TRUE; +} + +typedef struct _PyGSignalAccumulatorData { + PyObject *callable; + PyObject *user_data; +} PyGSignalAccumulatorData; + + +static gboolean +_pyg_signal_accumulator(GSignalInvocationHint *ihint, + GValue *return_accu, + const GValue *handler_return, + gpointer _data) +{ + PyObject *py_ihint, *py_return_accu, *py_handler_return, *py_detail; + PyObject *py_retval; + gboolean retval = FALSE; + PyGSignalAccumulatorData *data = _data; + PyGILState_STATE state; + + state = PyGILState_Ensure(); + if (ihint->detail) + py_detail = PyUnicode_FromString (g_quark_to_string(ihint->detail)); + else { + Py_INCREF(Py_None); + py_detail = Py_None; + } + + py_ihint = Py_BuildValue("lNi", (long int) ihint->signal_id, + py_detail, ihint->run_type); + py_handler_return = pyg_value_as_pyobject(handler_return, TRUE); + py_return_accu = pyg_value_as_pyobject(return_accu, FALSE); + if (data->user_data) + py_retval = PyObject_CallFunction(data->callable, "NNNO", py_ihint, + py_return_accu, py_handler_return, + data->user_data); + else + py_retval = PyObject_CallFunction(data->callable, "NNN", py_ihint, + py_return_accu, py_handler_return); + if (!py_retval) + PyErr_Print(); + else { + if (!PyTuple_Check(py_retval) || PyTuple_Size(py_retval) != 2) { + PyErr_SetString(PyExc_TypeError, "accumulator function must return" + " a (bool, object) tuple"); + PyErr_Print(); + } else { + retval = PyObject_IsTrue(PyTuple_GET_ITEM(py_retval, 0)); + if (pyg_value_from_pyobject(return_accu, PyTuple_GET_ITEM(py_retval, 1))) { + PyErr_Print(); + } + } + Py_DECREF(py_retval); + } + PyGILState_Release(state); + return retval; +} + +static gboolean +create_signal (GType instance_type, const gchar *signal_name, PyObject *tuple) +{ + GSignalFlags signal_flags; + PyObject *py_return_type, *py_param_types; + GType return_type; + guint n_params, i; + Py_ssize_t py_n_params; + GType *param_types; + guint signal_id; + GSignalAccumulator accumulator = NULL; + PyGSignalAccumulatorData *accum_data = NULL; + PyObject *py_accum = NULL, *py_accum_data = NULL; + + if (!PyArg_ParseTuple(tuple, "iOO|OO", &signal_flags, &py_return_type, + &py_param_types, &py_accum, &py_accum_data)) + { + gchar buf[128]; + + PyErr_Clear(); + g_snprintf(buf, sizeof(buf), + "value for __gsignals__['%s'] not in correct format", signal_name); + PyErr_SetString(PyExc_TypeError, buf); + return FALSE; + } + + if (py_accum && py_accum != Py_None && !PyCallable_Check(py_accum)) + { + gchar buf[128]; + + g_snprintf(buf, sizeof(buf), + "accumulator for __gsignals__['%s'] must be callable", signal_name); + PyErr_SetString(PyExc_TypeError, buf); + return FALSE; + } + + return_type = pyg_type_from_object(py_return_type); + if (!return_type) + return FALSE; + if (!PySequence_Check(py_param_types)) { + gchar buf[128]; + + g_snprintf(buf, sizeof(buf), + "third element of __gsignals__['%s'] tuple must be a sequence", signal_name); + PyErr_SetString(PyExc_TypeError, buf); + return FALSE; + } + py_n_params = PySequence_Length(py_param_types); + if (py_n_params < 0) + return FALSE; + + if (!pygi_guint_from_pyssize (py_n_params, &n_params)) + return FALSE; + + param_types = g_new(GType, n_params); + for (i = 0; i < n_params; i++) { + PyObject *item = PySequence_GetItem(py_param_types, i); + + param_types[i] = pyg_type_from_object(item); + if (param_types[i] == 0) { + Py_DECREF(item); + g_free(param_types); + return FALSE; + } + Py_DECREF(item); + } + + if (py_accum != NULL && py_accum != Py_None) { + accum_data = g_new(PyGSignalAccumulatorData, 1); + accum_data->callable = py_accum; + Py_INCREF(py_accum); + accum_data->user_data = py_accum_data; + Py_XINCREF(py_accum_data); + accumulator = _pyg_signal_accumulator; + } + + signal_id = g_signal_newv(signal_name, instance_type, signal_flags, + pyg_signal_class_closure_get(), + accumulator, accum_data, + gi_cclosure_marshal_generic, + return_type, n_params, param_types); + g_free(param_types); + + if (signal_id == 0) { + gchar buf[128]; + + g_snprintf(buf, sizeof(buf), "could not create signal for %s", + signal_name); + PyErr_SetString(PyExc_RuntimeError, buf); + return FALSE; + } + return TRUE; +} + + +static PyObject * +add_signals (GObjectClass *klass, PyObject *signals) +{ + gboolean ret = TRUE; + Py_ssize_t pos = 0; + PyObject *key, *value, *overridden_signals = NULL; + GType instance_type = G_OBJECT_CLASS_TYPE (klass); + + overridden_signals = PyDict_New(); + while (PyDict_Next(signals, &pos, &key, &value)) { + const gchar *signal_name; + gchar *signal_name_canon, *c; + + if (!PyUnicode_Check(key)) { + PyErr_SetString(PyExc_TypeError, + "__gsignals__ keys must be strings"); + ret = FALSE; + break; + } + signal_name = PyUnicode_AsUTF8 (key); + + if (value == Py_None || + (PyUnicode_Check(value) && + !strcmp(PyUnicode_AsUTF8 (value), "override"))) + { + /* canonicalize signal name, replacing '-' with '_' */ + signal_name_canon = g_strdup(signal_name); + for (c = signal_name_canon; *c; ++c) + if (*c == '-') + *c = '_'; + if (PyDict_SetItemString(overridden_signals, + signal_name_canon, key)) { + g_free(signal_name_canon); + ret = FALSE; + break; + } + g_free(signal_name_canon); + + ret = override_signal(instance_type, signal_name); + } else { + ret = create_signal(instance_type, signal_name, value); + } + + if (!ret) + break; + } + if (ret) + return overridden_signals; + else { + Py_XDECREF(overridden_signals); + return NULL; + } +} + +static void +pyg_object_get_property (GObject *object, guint property_id, + GValue *value, GParamSpec *pspec) +{ + PyObject *object_wrapper, *retval; + PyGILState_STATE state; + + state = PyGILState_Ensure(); + + object_wrapper = g_object_get_qdata(object, pygobject_wrapper_key); + + if (object_wrapper) + Py_INCREF (object_wrapper); + else + object_wrapper = pygobject_new(object); + + if (object_wrapper == NULL) { + PyGILState_Release(state); + return; + } + + retval = pygi_call_do_get_property (object_wrapper, pspec); + if (retval && pyg_value_from_pyobject (value, retval) < 0) { + PyErr_Print(); + } + Py_DECREF(object_wrapper); + Py_XDECREF(retval); + + PyGILState_Release(state); +} + +static void +pyg_object_set_property (GObject *object, guint property_id, + const GValue *value, GParamSpec *pspec) +{ + PyObject *object_wrapper, *retval; + PyObject *py_pspec, *py_value; + PyGILState_STATE state; + + state = PyGILState_Ensure(); + + object_wrapper = g_object_get_qdata(object, pygobject_wrapper_key); + + if (object_wrapper) + Py_INCREF (object_wrapper); + else + object_wrapper = pygobject_new(object); + + if (object_wrapper == NULL) { + PyGILState_Release(state); + return; + } + + py_pspec = pyg_param_spec_new(pspec); + py_value = pyg_value_as_pyobject (value, TRUE); + + retval = PyObject_CallMethod(object_wrapper, "do_set_property", + "OO", py_pspec, py_value); + if (retval) { + Py_DECREF(retval); + } else { + PyErr_Print(); + } + + Py_DECREF(object_wrapper); + Py_DECREF(py_pspec); + Py_DECREF(py_value); + + PyGILState_Release(state); +} + +static void +pyg_object_class_init(GObjectClass *class, PyObject *py_class) +{ + PyObject *gproperties, *gsignals, *overridden_signals; + PyObject *class_dict = ((PyTypeObject*) py_class)->tp_dict; + + class->set_property = pyg_object_set_property; + class->get_property = pyg_object_get_property; + + /* install signals */ + /* we look this up in the instance dictionary, so we don't + * accidentally get a parent type's __gsignals__ attribute. */ + gsignals = PyDict_GetItemString(class_dict, "__gsignals__"); + if (gsignals) { + if (!PyDict_Check(gsignals)) { + PyErr_SetString(PyExc_TypeError, + "__gsignals__ attribute not a dict!"); + return; + } + if (!(overridden_signals = add_signals(class, gsignals))) { + return; + } + if (PyDict_SetItemString(class_dict, "__gsignals__", + overridden_signals)) { + return; + } + Py_DECREF(overridden_signals); + + PyDict_DelItemString(class_dict, "__gsignals__"); + } else { + PyErr_Clear(); + } + + /* install properties */ + /* we look this up in the instance dictionary, so we don't + * accidentally get a parent type's __gproperties__ attribute. */ + gproperties = PyDict_GetItemString(class_dict, "__gproperties__"); + if (gproperties) { + if (!PyDict_Check(gproperties)) { + PyErr_SetString(PyExc_TypeError, + "__gproperties__ attribute not a dict!"); + return; + } + if (!add_properties(class, gproperties)) { + return; + } + PyDict_DelItemString(class_dict, "__gproperties__"); + /* Borrowed reference. Py_DECREF(gproperties); */ + } else { + PyErr_Clear(); + } +} + +static GPrivate pygobject_construction_wrapper; + +static inline void +pygobject_init_wrapper_set(PyObject *wrapper) +{ + g_private_set(&pygobject_construction_wrapper, wrapper); +} + +static inline PyObject * +pygobject_init_wrapper_get(void) +{ + return (PyObject *) g_private_get(&pygobject_construction_wrapper); +} + +/** + * Like g_object_new_with_properties() but also works with older glib versions. + */ +GObject * +pygobject_object_new_with_properties(GType object_type, + guint n_properties, + const char *names[], + const GValue values[]) +{ + GObject *obj; + +#if GLIB_CHECK_VERSION(2, 54, 0) + obj = g_object_new_with_properties(object_type, n_properties, names, values); +#else + { + GParameter *parameters; + uint i; + + parameters = g_new(GParameter, n_properties); + for (i = 0; i < n_properties; i++) { + parameters[i].name = names[i]; + parameters[i].value = values[i]; + } + obj = g_object_newv(object_type, n_properties, parameters); + g_free(parameters); + } +#endif + + return obj; +} + +int +pygobject_constructv (PyGObject *self, + guint n_properties, + const char *names[], + const GValue values[]) +{ + GObject *obj; + + g_assert (self->obj == NULL); + pygobject_init_wrapper_set((PyObject *) self); + + obj = pygobject_object_new_with_properties(pyg_type_from_object((PyObject *) self), + n_properties, + names, + values); + + if (g_object_is_floating (obj)) + self->private_flags.flags |= PYGOBJECT_GOBJECT_WAS_FLOATING; + pygobject_sink (obj); + + pygobject_init_wrapper_set(NULL); + self->obj = obj; + pygobject_register_wrapper((PyObject *) self); + + return 0; +} + +static void +pygobject__g_instance_init(GTypeInstance *instance, + gpointer g_class) +{ + GObject *object; + PyObject *wrapper, *result; + PyGILState_STATE state; + gboolean needs_init = FALSE; + + g_return_if_fail(G_IS_OBJECT(instance)); + + object = (GObject *) instance; + + wrapper = g_object_get_qdata(object, pygobject_wrapper_key); + if (wrapper == NULL) { + wrapper = pygobject_init_wrapper_get(); + if (wrapper && ((PyGObject *) wrapper)->obj == NULL) { + ((PyGObject *) wrapper)->obj = object; + pygobject_register_wrapper(wrapper); + } + } + pygobject_init_wrapper_set(NULL); + + state = PyGILState_Ensure(); + + if (wrapper == NULL) { + /* this looks like a python object created through + * g_object_new -> we have no python wrapper, so create it + * now */ + + if (g_object_is_floating (object)) { + g_object_ref (object); + wrapper = pygobject_new_full(object, + /*steal=*/ TRUE, + g_class); + g_object_force_floating (object); + } else { + wrapper = pygobject_new_full(object, + /*steal=*/ FALSE, + g_class); + } + + /* float the wrapper ref here because we are going to orphan it + * so we don't destroy the wrapper. The next call to pygobject_new_full + * will take the ref */ + pygobject_ref_float ((PyGObject *) wrapper); + + needs_init = TRUE; + } + + /* XXX: used for Gtk.Template */ + if (PyObject_HasAttrString ((PyObject*) Py_TYPE (wrapper), "__dontuse_ginstance_init__")) { + result = PyObject_CallMethod (wrapper, "__dontuse_ginstance_init__", NULL); + if (result == NULL) + PyErr_Print (); + else + Py_DECREF (result); + } + + if (needs_init) { + result = PyObject_CallMethod (wrapper, "__init__", NULL); + if (result == NULL) + PyErr_Print (); + else + Py_DECREF (result); + } + + PyGILState_Release(state); +} + +/* This implementation is bad, see bug 566571 for an example why. + * Instead of scanning explicitly declared bases for interfaces, we + * should automatically initialize all implemented interfaces to + * prevent bugs like that one. However, this will lead to + * performance degradation as each virtual method in derived classes + * will round-trip through do_*() stuff, *even* if it is not + * overriden. We need to teach codegen to retain parent method + * instead of setting virtual to *_proxy_do_*() if corresponding + * do_*() is not overriden. Ok, that was a messy explanation. + */ +static void +pyg_type_add_interfaces(PyTypeObject *class, GType instance_type, + PyObject *bases, + GType *parent_interfaces, guint n_parent_interfaces) +{ + int i; + + if (!bases) { + g_warning("type has no bases"); + return; + } + + for (i = 0; i < PyTuple_GET_SIZE(bases); ++i) { + PyObject *base = PyTuple_GET_ITEM(bases, i); + GType itype; + const GInterfaceInfo *iinfo; + GInterfaceInfo iinfo_copy; + + /* 'base' can also be a PyClassObject, see bug #566571. */ + if (!PyType_Check(base)) + continue; + + if (!PyType_IsSubtype((PyTypeObject*) base, &PyGInterface_Type)) + continue; + + itype = pyg_type_from_object(base); + + /* Happens for _implementations_ of an interface. */ + if (!G_TYPE_IS_INTERFACE(itype)) + continue; + + iinfo = pyg_lookup_interface_info(itype); + if (!iinfo) { + gchar *error; + error = g_strdup_printf("Interface type %s " + "has no Python implementation support", + ((PyTypeObject *) base)->tp_name); + PyErr_Warn(PyExc_RuntimeWarning, error); + g_free(error); + continue; + } + + iinfo_copy = *iinfo; + iinfo_copy.interface_data = class; + g_type_add_interface_static(instance_type, itype, &iinfo_copy); + } +} + +static int +pyg_run_class_init(GType gtype, gpointer gclass, PyTypeObject *pyclass) +{ + GSList *list; + PyGClassInitFunc class_init; + GType parent_type; + int rv; + + parent_type = g_type_parent(gtype); + if (parent_type) { + rv = pyg_run_class_init(parent_type, gclass, pyclass); + if (rv) + return rv; + } + + list = g_type_get_qdata(gtype, pygobject_class_init_key); + for (; list; list = list->next) { + class_init = list->data; + rv = class_init(gclass, pyclass); + if (rv) + return rv; + } + + return 0; +} + +static char * +get_type_name_for_class(PyTypeObject *class) +{ + gint i, name_serial; + char name_serial_str[16]; + PyObject *module; + char *type_name = NULL; + + /* make name for new GType */ + name_serial = 1; + /* give up after 1000 tries, just in case.. */ + while (name_serial < 1000) + { + g_free(type_name); + g_snprintf(name_serial_str, 16, "-v%i", name_serial); + module = PyObject_GetAttrString((PyObject *)class, "__module__"); + if (module && PyUnicode_Check (module)) { + type_name = g_strconcat(PyUnicode_AsUTF8 (module), ".", + class->tp_name, + name_serial > 1 ? name_serial_str : NULL, + NULL); + Py_DECREF(module); + } else { + if (module) + Py_DECREF(module); + else + PyErr_Clear(); + type_name = g_strconcat(class->tp_name, + name_serial > 1 ? name_serial_str : NULL, + NULL); + } + /* convert '.' in type name to '+', which isn't banned (grumble) */ + for (i = 0; type_name[i] != '\0'; i++) + if (type_name[i] == '.') + type_name[i] = '+'; + if (g_type_from_name(type_name) == 0) + break; /* we now have a unique name */ + ++name_serial; + } + + return type_name; +} + +static int +pyg_type_register(PyTypeObject *class, const char *type_name) +{ + PyObject *gtype; + GType parent_type, instance_type; + GType *parent_interfaces; + guint n_parent_interfaces; + GTypeQuery query; + gpointer gclass; + GTypeInfo type_info = { + 0, /* class_size */ + + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + + (GClassInitFunc) pyg_object_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + + 0, /* instance_size */ + 0, /* n_preallocs */ + (GInstanceInitFunc) pygobject__g_instance_init + }; + gchar *new_type_name; + + /* find the GType of the parent */ + parent_type = pyg_type_from_object((PyObject *)class); + if (!parent_type) + return -1; + + parent_interfaces = g_type_interfaces(parent_type, &n_parent_interfaces); + + if (type_name) + /* care is taken below not to free this */ + new_type_name = (gchar *) type_name; + else + new_type_name = get_type_name_for_class(class); + + /* set class_data that will be passed to the class_init function. */ + type_info.class_data = class; + + /* fill in missing values of GTypeInfo struct */ + g_type_query(parent_type, &query); + type_info.class_size = (guint16)query.class_size; + type_info.instance_size = (guint16)query.instance_size; + + /* create new typecode */ + instance_type = g_type_register_static(parent_type, new_type_name, + &type_info, 0); + if (instance_type == 0) { + PyErr_Format(PyExc_RuntimeError, + "could not create new GType: %s (subclass of %s)", + new_type_name, + g_type_name(parent_type)); + + if (type_name == NULL) + g_free(new_type_name); + + return -1; + } + + if (type_name == NULL) + g_free(new_type_name); + + /* store pointer to the class with the GType */ + Py_INCREF(class); + g_type_set_qdata(instance_type, pygobject_class_key, + class); + + /* Mark this GType as a custom python type */ + g_type_set_qdata(instance_type, pygobject_custom_key, + GINT_TO_POINTER (1)); + + /* set new value of __gtype__ on class */ + gtype = pyg_type_wrapper_new(instance_type); + PyObject_SetAttrString((PyObject *)class, "__gtype__", gtype); + Py_DECREF(gtype); + + /* if no __doc__, set it to the auto doc descriptor */ + if (PyDict_GetItemString(class->tp_dict, "__doc__") == NULL) { + PyDict_SetItemString(class->tp_dict, "__doc__", + pyg_object_descr_doc_get()); + } + + /* + * Note, all interfaces need to be registered before the first + * g_type_class_ref(), see bug #686149. + * + * See also comment above pyg_type_add_interfaces(). + */ + pyg_type_add_interfaces(class, instance_type, class->tp_bases, + parent_interfaces, n_parent_interfaces); + + + gclass = g_type_class_ref(instance_type); + if (PyErr_Occurred() != NULL) { + g_type_class_unref(gclass); + g_free(parent_interfaces); + return -1; + } -#include -#include + if (pyg_run_class_init(instance_type, gclass, class)) { + g_type_class_unref(gclass); + g_free(parent_interfaces); + return -1; + } + g_type_class_unref(gclass); + g_free(parent_interfaces); -PyObject *PyGIDeprecationWarning; + if (PyErr_Occurred() != NULL) + return -1; + return 0; +} + +static PyObject * +_wrap_pyg_type_register(PyObject *self, PyObject *args) +{ + PyTypeObject *class; + char *type_name = NULL; + + if (!PyArg_ParseTuple(args, "O!|z:gobject.type_register", + &PyType_Type, &class, &type_name)) + return NULL; + if (!PyType_IsSubtype(class, &PyGObject_Type)) { + PyErr_SetString(PyExc_TypeError, + "argument must be a GObject subclass"); + return NULL; + } + + /* Check if type already registered */ + if (pyg_type_from_object((PyObject *) class) == + pyg_type_from_object((PyObject *) class->tp_base)) + { + if (pyg_type_register(class, type_name)) + return NULL; + } + + Py_INCREF(class); + return (PyObject *) class; +} + +static GHashTable *log_handlers = NULL; +static gboolean log_handlers_disabled = FALSE; + +static void +remove_handler(gpointer domain, + gpointer handler, + gpointer unused) +{ + g_log_remove_handler(domain, GPOINTER_TO_UINT(handler)); +} + +static void +_log_func(const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data) +{ + if (G_LIKELY(Py_IsInitialized())) + { + PyGILState_STATE state; + PyObject* warning = user_data; + + state = PyGILState_Ensure(); + PyErr_Warn(warning, (char *) message); + PyGILState_Release(state); + } else + g_log_default_handler(log_domain, log_level, message, user_data); +} + +static void +add_warning_redirection(const char *domain, + PyObject *warning) +{ + g_return_if_fail(domain != NULL); + g_return_if_fail(warning != NULL); + + if (!log_handlers_disabled) + { + guint handler; + gpointer old_handler; + + if (!log_handlers) + log_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + + if ((old_handler = g_hash_table_lookup(log_handlers, domain))) + g_log_remove_handler(domain, GPOINTER_TO_UINT(old_handler)); + + handler = g_log_set_handler(domain, G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING, + _log_func, warning); + g_hash_table_insert(log_handlers, g_strdup(domain), GUINT_TO_POINTER(handler)); + } +} + +static void +disable_warning_redirections(void) +{ + log_handlers_disabled = TRUE; + + if (log_handlers) + { + g_hash_table_foreach(log_handlers, remove_handler, NULL); + g_hash_table_destroy(log_handlers); + log_handlers = NULL; + } +} + +/** + * Returns 0 on success, or -1 and sets an exception. + */ +static int +pygi_register_warnings(PyObject *d) +{ + PyObject *warning; + + warning = PyErr_NewException("gobject.Warning", PyExc_Warning, NULL); + if (warning == NULL) + return -1; + PyDict_SetItemString(d, "Warning", warning); + add_warning_redirection("GLib", warning); + add_warning_redirection("GLib-GObject", warning); + add_warning_redirection("GThread", warning); + + return 0; +} static PyObject * _wrap_pyg_enum_add (PyObject *self, @@ -50,7 +1505,7 @@ _wrap_pyg_enum_add (PyObject *self, return NULL; } - return pyg_enum_add (NULL, g_type_name (g_type), NULL, g_type); + return flags_enum_from_gtype (g_type, pyg_enum_add); } static PyObject * @@ -102,7 +1557,7 @@ _wrap_pyg_enum_register_new_gtype_and_add (PyObject *self, enum_value = &g_enum_values[i]; enum_value->value_nick = g_strdup (name); - enum_value->value = g_value_info_get_value (value_info); + enum_value->value = (gint)g_value_info_get_value (value_info); if (c_identifier == NULL) { enum_value->value_name = enum_value->value_nick; @@ -146,7 +1601,7 @@ _wrap_pyg_enum_register_new_gtype_and_add (PyObject *self, } g_free (full_name); - return pyg_enum_add (NULL, g_type_name (g_type), NULL, g_type); + return pyg_enum_add (NULL, type_name, NULL, g_type); } static PyObject * @@ -169,7 +1624,7 @@ _wrap_pyg_flags_add (PyObject *self, return NULL; } - return pyg_flags_add (NULL, g_type_name (g_type), NULL, g_type); + return flags_enum_from_gtype (g_type, pyg_flags_add); } static PyObject * @@ -221,7 +1676,7 @@ _wrap_pyg_flags_register_new_gtype_and_add (PyObject *self, flags_value = &g_flags_values[i]; flags_value->value_nick = g_strdup (name); - flags_value->value = g_value_info_get_value (value_info); + flags_value->value = (guint)g_value_info_get_value (value_info); if (c_identifier == NULL) { flags_value->value_name = flags_value->value_nick; @@ -265,13 +1720,13 @@ _wrap_pyg_flags_register_new_gtype_and_add (PyObject *self, } g_free (full_name); - return pyg_flags_add (NULL, g_type_name (g_type), NULL, g_type); + return pyg_flags_add (NULL, type_name, NULL, g_type); } static void initialize_interface (GTypeInterface *iface, PyTypeObject *pytype) { - // pygobject prints a warning if interface_init is NULL + /* pygobject prints a warning if interface_init is NULL */ } static PyObject * @@ -296,6 +1751,7 @@ _wrap_pyg_register_interface_info (PyObject *self, PyObject *args) info->interface_init = (GInterfaceInitFunc) initialize_interface; pyg_register_interface_info (g_type, info); + g_free (info); Py_RETURN_NONE; } @@ -308,11 +1764,11 @@ find_vfunc_info (GIBaseInfo *vfunc_info, GIFieldInfo **field_info_ret) { GType ancestor_g_type = 0; - int length, i; GIBaseInfo *ancestor_info; GIStructInfo *struct_info; gpointer implementor_class = NULL; gboolean is_interface = FALSE; + GIFieldInfo *field_info; ancestor_info = g_base_info_get_container (vfunc_info); is_interface = g_base_info_get_type (ancestor_info) == GI_INFO_TYPE_INTERFACE; @@ -343,28 +1799,18 @@ find_vfunc_info (GIBaseInfo *vfunc_info, *implementor_class_ret = implementor_class; - length = g_struct_info_get_n_fields (struct_info); - for (i = 0; i < length; i++) { - GIFieldInfo *field_info; + field_info = g_struct_info_find_field (struct_info, + g_base_info_get_name ( (GIBaseInfo*) vfunc_info)); + if (field_info != NULL) { GITypeInfo *type_info; - field_info = g_struct_info_get_field (struct_info, i); - - if (strcmp (g_base_info_get_name ( (GIBaseInfo*) field_info), - g_base_info_get_name ( (GIBaseInfo*) vfunc_info)) != 0) { - g_base_info_unref (field_info); - continue; - } - type_info = g_field_info_get_type (field_info); if (g_type_info_get_tag (type_info) == GI_TYPE_TAG_INTERFACE) { - g_base_info_unref (type_info); *field_info_ret = field_info; - break; + } else { + g_base_info_unref (field_info); } - g_base_info_unref (type_info); - g_base_info_unref (field_info); } g_base_info_unref (struct_info); @@ -382,6 +1828,7 @@ _wrap_pyg_hook_up_vfunc_implementation (PyObject *self, PyObject *args) GIFieldInfo *field_info = NULL; gpointer *method_ptr = NULL; PyGICClosure *closure = NULL; + PyGIClosureCache *cache = NULL; if (!PyArg_ParseTuple (args, "O!O!O:hook_up_vfunc_implementation", &PyGIBaseInfo_Type, &py_info, @@ -408,10 +1855,15 @@ _wrap_pyg_hook_up_vfunc_implementation (PyObject *self, PyObject *args) offset = g_field_info_get_offset (field_info); method_ptr = G_STRUCT_MEMBER_P (implementor_vtable, offset); - closure = _pygi_make_native_closure ( (GICallableInfo*) callback_info, + cache = pygi_closure_cache_new (callback_info); + closure = _pygi_make_native_closure ( (GICallableInfo*) callback_info, cache, GI_SCOPE_TYPE_NOTIFIED, py_function, NULL); +#if GI_CHECK_VERSION (1, 72, 0) + *method_ptr = g_callable_info_get_closure_native_address (callback_info, closure->closure); +#else *method_ptr = closure->closure; +#endif g_base_info_unref (interface_info); g_base_info_unref (type_info); @@ -465,43 +1917,6 @@ _wrap_pyg_has_vfunc_implementation (PyObject *self, PyObject *args) #endif static PyObject * -_wrap_pyg_variant_new_tuple (PyObject *self, PyObject *args) -{ - PyObject *py_values; - GVariant **values = NULL; - GVariant *variant = NULL; - PyObject *py_variant = NULL; - PyObject *py_type; - gssize i; - - if (!PyArg_ParseTuple (args, "O!:variant_new_tuple", - &PyTuple_Type, &py_values)) { - return NULL; - } - - py_type = _pygi_type_import_by_name ("GLib", "Variant"); - - values = g_newa (GVariant*, PyTuple_Size (py_values)); - - for (i = 0; i < PyTuple_Size (py_values); i++) { - PyObject *value = PyTuple_GET_ITEM (py_values, i); - - if (!PyObject_IsInstance (value, py_type)) { - PyErr_Format (PyExc_TypeError, "argument %" G_GSSIZE_FORMAT " is not a GLib.Variant", i); - return NULL; - } - - values[i] = (GVariant *) ( (PyGPointer *) value)->pointer; - } - - variant = g_variant_new_tuple (values, PyTuple_Size (py_values)); - - py_variant = _pygi_struct_new ( (PyTypeObject *) py_type, variant, FALSE); - - return py_variant; -} - -static PyObject * _wrap_pyg_variant_type_from_string (PyObject *self, PyObject *args) { char *type_string; @@ -513,19 +1928,13 @@ _wrap_pyg_variant_type_from_string (PyObject *self, PyObject *args) return NULL; } - py_type = _pygi_type_import_by_name ("GLib", "VariantType"); + py_type = pygi_type_import_by_name ("GLib", "VariantType"); - py_variant = _pygi_boxed_new ( (PyTypeObject *) py_type, type_string, FALSE, 0); + py_variant = pygi_boxed_new ( (PyTypeObject *) py_type, type_string, FALSE, 0); return py_variant; } -static PyObject * -_wrap_pyg_source_new (PyObject *self, PyObject *args) -{ - return pyg_source_new (); -} - #define CHUNK_SIZE 8192 static PyObject* @@ -545,50 +1954,50 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs) PyErr_SetString(PyExc_TypeError, "first argument is not a GLib.IOChannel"); return NULL; } - + if (max_count == 0) - return PYGLIB_PyBytes_FromString(""); + return PyBytes_FromString (""); iochannel = pyg_boxed_get (py_iochannel, GIOChannel); while (status == G_IO_STATUS_NORMAL - && (max_count == -1 || total_read < max_count)) { + && (max_count == -1 || total_read < (gsize)max_count)) { gsize single_read; char* buf; gsize buf_size; - - if (max_count == -1) + + if (max_count == -1) buf_size = CHUNK_SIZE; else { buf_size = max_count - total_read; if (buf_size > CHUNK_SIZE) buf_size = CHUNK_SIZE; } - + if ( ret_obj == NULL ) { - ret_obj = PYGLIB_PyBytes_FromStringAndSize((char *)NULL, buf_size); + ret_obj = PyBytes_FromStringAndSize ((char *)NULL, buf_size); if (ret_obj == NULL) goto failure; } - else if (buf_size + total_read > PYGLIB_PyBytes_Size(ret_obj)) { - if (PYGLIB_PyBytes_Resize(&ret_obj, buf_size + total_read) == -1) + else if (buf_size + total_read > (gsize)PyBytes_Size (ret_obj)) { + if (_PyBytes_Resize (&ret_obj, buf_size + total_read) == -1) goto failure; } - - buf = PYGLIB_PyBytes_AsString(ret_obj) + total_read; + + buf = PyBytes_AsString (ret_obj) + total_read; Py_BEGIN_ALLOW_THREADS; status = g_io_channel_read_chars (iochannel, buf, buf_size, &single_read, &error); Py_END_ALLOW_THREADS; - if (pyglib_error_check(&error)) + if (pygi_error_check (&error)) goto failure; - + total_read += single_read; } - - if ( total_read != PYGLIB_PyBytes_Size(ret_obj) ) { - if (PYGLIB_PyBytes_Resize(&ret_obj, total_read) == -1) + + if ( total_read != (gsize)PyBytes_Size (ret_obj) ) { + if (_PyBytes_Resize (&ret_obj, total_read) == -1) goto failure; } @@ -599,8 +2008,314 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs) return NULL; } +static gboolean +marshal_emission_hook(GSignalInvocationHint *ihint, + guint n_param_values, + const GValue *param_values, + gpointer user_data) +{ + PyGILState_STATE state; + gboolean retval = FALSE; + PyObject *func, *args; + PyObject *retobj; + PyObject *params; + guint i; + + state = PyGILState_Ensure(); + + /* construct Python tuple for the parameter values */ + params = PyTuple_New(n_param_values); + + for (i = 0; i < n_param_values; i++) { + PyObject *item = pyg_value_as_pyobject(¶m_values[i], FALSE); + + /* error condition */ + if (!item) { + goto out; + } + PyTuple_SetItem(params, i, item); + } + + args = (PyObject *)user_data; + func = PyTuple_GetItem(args, 0); + args = PySequence_Concat(params, PyTuple_GetItem(args, 1)); + Py_DECREF(params); + + /* params passed to function may have extra arguments */ + + retobj = PyObject_CallObject(func, args); + Py_DECREF(args); + if (retobj == NULL) { + PyErr_Print(); + } + + retval = (retobj == Py_True ? TRUE : FALSE); + Py_XDECREF(retobj); +out: + PyGILState_Release(state); + return retval; +} + +/** + * pyg_destroy_notify: + * @user_data: a PyObject pointer. + * + * A function that can be used as a GDestroyNotify callback that will + * call Py_DECREF on the data. + */ +static void +pyg_destroy_notify(gpointer user_data) +{ + PyObject *obj = (PyObject *)user_data; + PyGILState_STATE state; + + state = PyGILState_Ensure(); + Py_DECREF(obj); + PyGILState_Release(state); +} + +static PyObject * +pyg_add_emission_hook(PyGObject *self, PyObject *args) +{ + PyObject *first, *callback, *extra_args, *data, *repr; + gchar *name; + gulong hook_id; + guint sigid; + Py_ssize_t len; + GQuark detail = 0; + GType gtype; + PyObject *pygtype; + + len = PyTuple_Size(args); + if (len < 3) { + PyErr_SetString(PyExc_TypeError, + "gobject.add_emission_hook requires at least 3 arguments"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 3); + if (!PyArg_ParseTuple(first, "OsO:add_emission_hook", + &pygtype, &name, &callback)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + + if ((gtype = pyg_type_from_object(pygtype)) == 0) { + return NULL; + } + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "third argument must be callable"); + return NULL; + } + + if (!g_signal_parse_name(name, gtype, &sigid, &detail, TRUE)) { + repr = PyObject_Repr((PyObject*)self); + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + PyUnicode_AsUTF8 (repr), + name); + Py_DECREF(repr); + return NULL; + } + extra_args = PySequence_GetSlice(args, 3, len); + if (extra_args == NULL) + return NULL; + + data = Py_BuildValue("(ON)", callback, extra_args); + if (data == NULL) + return NULL; + + hook_id = g_signal_add_emission_hook(sigid, detail, + marshal_emission_hook, + data, + (GDestroyNotify)pyg_destroy_notify); + + return pygi_gulong_to_py (hook_id); +} + +static PyObject * +pyg_signal_new(PyObject *self, PyObject *args) +{ + gchar *signal_name; + PyObject *py_type; + GSignalFlags signal_flags; + GType return_type; + PyObject *py_return_type, *py_param_types; + + GType instance_type = 0; + Py_ssize_t py_n_params; + guint n_params, i; + GType *param_types; + + guint signal_id; + + if (!PyArg_ParseTuple(args, "sOiOO:gobject.signal_new", &signal_name, + &py_type, &signal_flags, &py_return_type, + &py_param_types)) + return NULL; + + instance_type = pyg_type_from_object(py_type); + if (!instance_type) + return NULL; + if (!(G_TYPE_IS_INSTANTIATABLE(instance_type) || G_TYPE_IS_INTERFACE(instance_type))) { + PyErr_SetString(PyExc_TypeError, + "argument 2 must be an object type or interface type"); + return NULL; + } + + return_type = pyg_type_from_object(py_return_type); + if (!return_type) + return NULL; + + if (!PySequence_Check(py_param_types)) { + PyErr_SetString(PyExc_TypeError, + "argument 5 must be a sequence of GType codes"); + return NULL; + } + + py_n_params = PySequence_Length(py_param_types); + if (py_n_params < 0) + return FALSE; + + if (!pygi_guint_from_pyssize (py_n_params, &n_params)) + return FALSE; + + param_types = g_new(GType, n_params); + for (i = 0; i < n_params; i++) { + PyObject *item = PySequence_GetItem(py_param_types, i); + + param_types[i] = pyg_type_from_object(item); + if (param_types[i] == 0) { + PyErr_Clear(); + Py_DECREF(item); + PyErr_SetString(PyExc_TypeError, + "argument 5 must be a sequence of GType codes"); + g_free(param_types); + return NULL; + } + Py_DECREF(item); + } + + signal_id = g_signal_newv(signal_name, instance_type, signal_flags, + pyg_signal_class_closure_get(), + (GSignalAccumulator)0, NULL, + (GSignalCMarshaller)0, + return_type, n_params, param_types); + g_free(param_types); + if (signal_id != 0) + return pygi_guint_to_py (signal_id); + PyErr_SetString(PyExc_RuntimeError, "could not create signal"); + return NULL; +} + +static PyObject * +pyg_object_class_list_properties (PyObject *self, PyObject *args) +{ + GParamSpec **specs; + PyObject *py_itype, *list; + GType itype; + GObjectClass *class = NULL; + gpointer iface = NULL; + guint nprops; + guint i; + + if (!PyArg_ParseTuple(args, "O:gobject.list_properties", + &py_itype)) + return NULL; + if ((itype = pyg_type_from_object(py_itype)) == 0) + return NULL; + + if (G_TYPE_IS_INTERFACE(itype)) { + iface = g_type_default_interface_ref(itype); + if (!iface) { + PyErr_SetString(PyExc_RuntimeError, + "could not get a reference to interface type"); + return NULL; + } + specs = g_object_interface_list_properties(iface, &nprops); + } else if (g_type_is_a(itype, G_TYPE_OBJECT)) { + class = g_type_class_ref(itype); + if (!class) { + PyErr_SetString(PyExc_RuntimeError, + "could not get a reference to type class"); + return NULL; + } + specs = g_object_class_list_properties(class, &nprops); + } else { + PyErr_SetString(PyExc_TypeError, + "type must be derived from GObject or an interface"); + return NULL; + } + + list = PyTuple_New(nprops); + if (list == NULL) { + g_free(specs); + g_type_class_unref(class); + return NULL; + } + for (i = 0; i < nprops; i++) { + PyTuple_SetItem(list, i, pyg_param_spec_new(specs[i])); + } + g_free(specs); + if (class) + g_type_class_unref(class); + else + g_type_default_interface_unref(iface); + + return list; +} + +static PyObject * +pyg__install_metaclass(PyObject *dummy, PyTypeObject *metaclass) +{ + Py_INCREF(metaclass); + PyGObject_MetaType = metaclass; + Py_INCREF(metaclass); + + Py_SET_TYPE(&PyGObject_Type, metaclass); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +_wrap_pyig_pyos_getsig (PyObject *self, PyObject *args) +{ + int sig_num; + + if (!PyArg_ParseTuple (args, "i:pyos_getsig", &sig_num)) + return NULL; + + return PyLong_FromVoidPtr ((void *)(PyOS_getsig (sig_num))); +} + +static PyObject * +_wrap_pygobject_new_full (PyObject *self, PyObject *args) +{ + PyObject *ptr_value, *long_value; + PyObject *steal; + GObject *obj; + + if (!PyArg_ParseTuple (args, "OO", &ptr_value, &steal)) + return NULL; + + long_value = PyNumber_Long (ptr_value); + if (!long_value) { + PyErr_SetString (PyExc_TypeError, "first argument must be an integer"); + return NULL; + } + obj = PyLong_AsVoidPtr (long_value); + Py_DECREF (long_value); + + if (!G_IS_OBJECT (obj)) { + PyErr_SetString (PyExc_TypeError, "pointer is not a GObject"); + return NULL; + } + + return pygobject_new_full (obj, PyObject_IsTrue (steal), NULL); +} static PyMethodDef _gi_functions[] = { + { "pygobject_new_full", (PyCFunction) _wrap_pygobject_new_full, METH_VARARGS }, { "enum_add", (PyCFunction) _wrap_pyg_enum_add, METH_VARARGS | METH_KEYWORDS }, { "enum_register_new_gtype_and_add", (PyCFunction) _wrap_pyg_enum_register_new_gtype_and_add, METH_VARARGS | METH_KEYWORDS }, { "flags_add", (PyCFunction) _wrap_pyg_flags_add, METH_VARARGS | METH_KEYWORDS }, @@ -608,61 +2323,309 @@ static PyMethodDef _gi_functions[] = { { "register_interface_info", (PyCFunction) _wrap_pyg_register_interface_info, METH_VARARGS }, { "hook_up_vfunc_implementation", (PyCFunction) _wrap_pyg_hook_up_vfunc_implementation, METH_VARARGS }, - { "variant_new_tuple", (PyCFunction) _wrap_pyg_variant_new_tuple, METH_VARARGS }, { "variant_type_from_string", (PyCFunction) _wrap_pyg_variant_type_from_string, METH_VARARGS }, - { "source_new", (PyCFunction) _wrap_pyg_source_new, METH_NOARGS }, - { "source_set_callback", (PyCFunction) pyg_source_set_callback, METH_VARARGS }, + { "source_new", (PyCFunction) pygi_source_new, METH_NOARGS }, + { "pyos_getsig", (PyCFunction) _wrap_pyig_pyos_getsig, METH_VARARGS }, + { "source_set_callback", (PyCFunction) pygi_source_set_callback, METH_VARARGS }, { "io_channel_read", (PyCFunction) pyg_channel_read, METH_VARARGS }, + { "require_foreign", (PyCFunction) pygi_require_foreign, METH_VARARGS | METH_KEYWORDS }, + { "register_foreign", (PyCFunction) pygi_register_foreign, METH_NOARGS }, + { "spawn_async", + (PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS, + "spawn_async(argv, envp=None, working_directory=None,\n" + " flags=0, child_setup=None, user_data=None,\n" + " standard_input=None, standard_output=None,\n" + " standard_error=None) -> (pid, stdin, stdout, stderr)\n" + "\n" + "Execute a child program asynchronously within a glib.MainLoop()\n" + "See the reference manual for a complete reference.\n" }, + { "type_register", _wrap_pyg_type_register, METH_VARARGS }, + { "signal_new", pyg_signal_new, METH_VARARGS }, + { "list_properties", + pyg_object_class_list_properties, METH_VARARGS }, + { "new", + (PyCFunction)pyg_object_new, METH_VARARGS|METH_KEYWORDS }, + { "add_emission_hook", + (PyCFunction)pyg_add_emission_hook, METH_VARARGS }, + { "_install_metaclass", + (PyCFunction)pyg__install_metaclass, METH_O }, + { "_gvalue_get", + (PyCFunction)pyg__gvalue_get, METH_O }, + { "_gvalue_get_type", + (PyCFunction)pyg__gvalue_get_type, METH_O }, + { "_gvalue_set", + (PyCFunction)pyg__gvalue_set, METH_VARARGS }, { NULL, NULL, 0 } }; static struct PyGI_API CAPI = { - pygi_type_import_by_g_type_real, - pygi_get_property_value_real, - pygi_set_property_value_real, - pygi_signal_closure_new_real, - pygi_register_foreign_struct_real, + pygi_register_foreign_struct, +}; + +struct _PyGObject_Functions pygobject_api_functions = { + pygobject_register_class, + pygobject_register_wrapper, + pygobject_lookup_class, + pygobject_new, + + pyg_closure_new, + pygobject_watch_closure, + pyg_destroy_notify, + + pyg_type_from_object, + pyg_type_wrapper_new, + pyg_enum_get_value, + pyg_flags_get_value, + pyg_register_gtype_custom, + pyg_value_from_pyobject, + pyg_value_as_pyobject, + + pyg_register_interface, + + &PyGBoxed_Type, + pygi_register_gboxed, + pygi_gboxed_new, + + &PyGPointer_Type, + pyg_register_pointer, + pyg_pointer_new, + + pyg_enum_add_constants, + pyg_flags_add_constants, + + pyg_constant_strip_prefix, + + pygi_error_check, + + _pyg_set_thread_block_funcs, + (PyGThreadBlockFunc)0, /* block_threads */ + (PyGThreadBlockFunc)0, /* unblock_threads */ + + &PyGParamSpec_Type, + pyg_param_spec_new, + pyg_param_spec_from_object, + + pyg_pyobj_to_unichar_conv, + pyg_parse_constructor_args, + pyg_param_gvalue_as_pyobject, + pyg_param_gvalue_from_pyobject, + + &PyGEnum_Type, + pyg_enum_add, + pyg_enum_from_gtype, + + &PyGFlags_Type, + pyg_flags_add, + pyg_flags_from_gtype, + + TRUE, /* threads_enabled */ + + pygobject_enable_threads, + pygobject_gil_state_ensure, + pygobject_gil_state_release, + pyg_register_class_init, + pyg_register_interface_info, + + pyg_closure_set_exception_handler, + + add_warning_redirection, + disable_warning_redirections, + + NULL, /* previously type_register_custom */ + + pygi_gerror_exception_check, + + pyg_option_group_new, + pyg_type_from_object_strict, + + pygobject_new_full, + &PyGObject_Type, + + pyg_value_from_pyobject_with_error }; -PYGLIB_MODULE_START(_gi, "_gi") +/** + * Returns 0 on success, or -1 and sets an exception. + */ +static int +pygi_register_api(PyObject *d) { PyObject *api; - if (pygobject_init (-1, -1, -1) == NULL) { - return PYGLIB_MODULE_ERROR_RETURN; - } + api = PyCapsule_New (&pygobject_api_functions, "gobject._PyGObject_API", NULL); + if (api == NULL) + return -1; + PyDict_SetItemString(d, "_PyGObject_API", api); + Py_DECREF(api); + return 0; +} - if (_pygobject_import() < 0) { - return PYGLIB_MODULE_ERROR_RETURN; - } +/** + * Returns 0 on success, or -1 and sets an exception. + */ +static int +pygi_register_constants(PyObject *m) +{ + /* PyFloat_ return a new ref, and add object takes the ref */ + PyModule_AddObject(m, "G_MINFLOAT", pygi_gfloat_to_py (G_MINFLOAT)); + PyModule_AddObject(m, "G_MAXFLOAT", pygi_gfloat_to_py (G_MAXFLOAT)); + PyModule_AddObject(m, "G_MINDOUBLE", pygi_gdouble_to_py (G_MINDOUBLE)); + PyModule_AddObject(m, "G_MAXDOUBLE", pygi_gdouble_to_py (G_MAXDOUBLE)); + PyModule_AddIntConstant(m, "G_MINSHORT", G_MINSHORT); + PyModule_AddIntConstant(m, "G_MAXSHORT", G_MAXSHORT); + PyModule_AddIntConstant(m, "G_MAXUSHORT", G_MAXUSHORT); + PyModule_AddIntConstant(m, "G_MININT", G_MININT); + PyModule_AddIntConstant(m, "G_MAXINT", G_MAXINT); + PyModule_AddObject(m, "G_MAXUINT", pygi_guint_to_py (G_MAXUINT)); + PyModule_AddObject(m, "G_MINLONG", pygi_glong_to_py (G_MINLONG)); + PyModule_AddObject(m, "G_MAXLONG", pygi_glong_to_py (G_MAXLONG)); + PyModule_AddObject(m, "G_MAXULONG", pygi_gulong_to_py (G_MAXULONG)); + PyModule_AddObject(m, "G_MAXSIZE", pygi_gsize_to_py (G_MAXSIZE)); + PyModule_AddObject(m, "G_MAXSSIZE", pygi_gssize_to_py (G_MAXSSIZE)); + PyModule_AddObject(m, "G_MINSSIZE", pygi_gssize_to_py (G_MINSSIZE)); + PyModule_AddObject(m, "G_MINOFFSET", pygi_gint64_to_py (G_MINOFFSET)); + PyModule_AddObject(m, "G_MAXOFFSET", pygi_gint64_to_py (G_MAXOFFSET)); + + PyModule_AddIntConstant(m, "SIGNAL_RUN_FIRST", G_SIGNAL_RUN_FIRST); + PyModule_AddIntConstant(m, "PARAM_READWRITE", G_PARAM_READWRITE); + + /* The rest of the types are set in __init__.py */ + PyModule_AddObject(m, "TYPE_INVALID", pyg_type_wrapper_new(G_TYPE_INVALID)); + PyModule_AddObject(m, "TYPE_GSTRING", pyg_type_wrapper_new(G_TYPE_GSTRING)); + + return 0; +} + +/** + * Returns 0 on success, or -1 and sets an exception. + */ +static int +pygi_register_version_tuples(PyObject *d) +{ + PyObject *tuple; + + /* pygobject version */ + tuple = Py_BuildValue ("(iii)", + PYGOBJECT_MAJOR_VERSION, + PYGOBJECT_MINOR_VERSION, + PYGOBJECT_MICRO_VERSION); + PyDict_SetItemString(d, "pygobject_version", tuple); + Py_DECREF (tuple); + return 0; +} - _pygi_repository_register_types (module); - _pygi_info_register_types (module); - _pygi_struct_register_types (module); - _pygi_boxed_register_types (module); - _pygi_ccallback_register_types (module); - _pygi_argument_init(); +static struct PyModuleDef __gimodule = { + PyModuleDef_HEAD_INIT, + "_gi", + NULL, + -1, + _gi_functions, + NULL, + NULL, + NULL, + NULL +}; - /* Use RuntimeWarning as the base class of PyGIDeprecationWarning - * for unstable (odd minor version) and use DeprecationWarning for - * stable (even minor version). This is so PyGObject deprecations - * behave the same as regular Python deprecations in stable releases. - */ -#if PYGOBJECT_MINOR_VERSION % 2 - PyGIDeprecationWarning = PyErr_NewException("gi.PyGIDeprecationWarning", - PyExc_RuntimeWarning, NULL); +#ifdef __GNUC__ +#define PYGI_MODINIT_FUNC __attribute__((visibility("default"))) PyMODINIT_FUNC #else +#define PYGI_MODINIT_FUNC PyMODINIT_FUNC +#endif + +PYGI_MODINIT_FUNC PyInit__gi(void); + +PYGI_MODINIT_FUNC PyInit__gi(void) { + PyObject *module; + PyObject *api; + module = PyModule_Create(&__gimodule); + PyObject *module_dict = PyModule_GetDict (module); + +#if PY_VERSION_HEX < 0x03090000 || defined(PYPY_VERSION) + /* Deprecated since 3.9 */ + /* Except in PyPy it's still not a no-op: https://foss.heptapod.net/pypy/pypy/-/issues/3691 */ + + /* Always enable Python threads since we cannot predict which GI repositories + * might accept Python callbacks run within non-Python threads or might trigger + * toggle ref notifications. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=709223 + */ + PyEval_InitThreads (); +#endif + + PyModule_AddStringConstant(module, "__package__", "gi._gi"); + + if (pygi_foreign_init () < 0) + return NULL; + if (pygi_error_register_types (module) < 0) + return NULL; + if (pygi_repository_register_types (module) < 0) + return NULL; + if (pygi_info_register_types (module) < 0) + return NULL; + if (pygi_type_register_types (module_dict) < 0) + return NULL; + if (pygi_pointer_register_types (module_dict) < 0) + return NULL; + if (pygi_struct_register_types (module) < 0) + return NULL; + if (pygi_gboxed_register_types (module_dict) < 0) + return NULL; + if (pygi_boxed_register_types (module) < 0) + return NULL; + if (pygi_ccallback_register_types (module) < 0) + return NULL; + if (pygi_resulttuple_register_types (module) < 0) + return NULL; + + if (pygi_spawn_register_types (module_dict) < 0) + return NULL; + if (pygi_option_context_register_types (module_dict) < 0) + return NULL; + if (pygi_option_group_register_types (module_dict) < 0) + return NULL; + + if (pygi_register_api (module_dict) < 0) + return NULL; + if (pygi_register_constants (module) < 0) + return NULL; + if (pygi_register_version_tuples (module_dict) < 0) + return NULL; + if (pygi_register_warnings (module_dict) < 0) + return NULL; + if (pyi_object_register_types (module_dict) < 0) + return NULL; + if (pygi_interface_register_types (module_dict) < 0) + return NULL; + if (pygi_paramspec_register_types (module_dict) < 0) + return NULL; + if (pygi_enum_register_types (module_dict) < 0) + return NULL; + if (pygi_flags_register_types (module_dict) < 0) + return NULL; + + PyGIWarning = PyErr_NewException ("gi.PyGIWarning", PyExc_Warning, NULL); + if (PyGIWarning == NULL) + return NULL; + PyGIDeprecationWarning = PyErr_NewException("gi.PyGIDeprecationWarning", PyExc_DeprecationWarning, NULL); -#endif + + /* Place holder object used to fill in "from Python" argument lists + * for values not supplied by the caller but support a GI default. + */ + _PyGIDefaultArgPlaceholder = PyList_New(0); + + Py_INCREF (PyGIWarning); + PyModule_AddObject (module, "PyGIWarning", PyGIWarning); Py_INCREF(PyGIDeprecationWarning); PyModule_AddObject(module, "PyGIDeprecationWarning", PyGIDeprecationWarning); - api = PYGLIB_CPointer_WrapPointer ( (void *) &CAPI, "gi._API"); + api = PyCapsule_New ( (void *) &CAPI, "gi._API", NULL); if (api == NULL) { - return PYGLIB_MODULE_ERROR_RETURN; + return NULL; } PyModule_AddObject (module, "_API", api); + + return module; } -PYGLIB_MODULE_END diff --git a/gi/gimodule.h b/gi/gimodule.h new file mode 100644 index 0000000..b9274bc --- /dev/null +++ b/gi/gimodule.h @@ -0,0 +1,17 @@ +#ifndef _PYGOBJECT_GIMODULE_H_ +#define _PYGOBJECT_GIMODULE_H_ + +#include "pygobject-internal.h" + +int pygobject_constructv (PyGObject *self, + guint n_properties, + const char *names[], + const GValue values[]); + +GObject * +pygobject_object_new_with_properties(GType object_type, + guint n_properties, + const char *names[], + const GValue values[]); + +#endif /*_PYGOBJECT_GIMODULE_H_*/ diff --git a/gi/importer.py b/gi/importer.py index aa95cf6..73d0c5c 100644 --- a/gi/importer.py +++ b/gi/importer.py @@ -2,6 +2,7 @@ # vim: tabstop=4 shiftwidth=4 expandtab # # Copyright (C) 2005-2009 Johan Dahlin +# 2015 Christoph Reiter # # importer.py: dynamic importer for introspected libraries. # @@ -20,18 +21,85 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -from __future__ import absolute_import -import logging import sys +import warnings +import importlib +from contextlib import contextmanager -from ._gi import Repository -from .module import DynamicModule +import gi +from ._gi import Repository, RepositoryError +from ._gi import PyGIWarning +from .module import get_introspection_module +from .overrides import load_overrides repository = Repository.get_default() + +# only for backwards compatibility modules = {} +@contextmanager +def _check_require_version(namespace, stacklevel): + """A context manager which tries to give helpful warnings + about missing gi.require_version() which could potentially + break code if only an older version than expected is installed + or a new version gets introduced. + + :: + + with _check_require_version("Gtk", stacklevel): + load_namespace_and_overrides() + """ + + was_loaded = repository.is_registered(namespace) + + yield + + if was_loaded: + # it was loaded before by another import which depended on this + # namespace or by C code like libpeas + return + + if namespace in ("GLib", "GObject", "Gio"): + # part of glib (we have bigger problems if versions change there) + return + + if gi.get_required_version(namespace) is not None: + # the version was forced using require_version() + return + + version = repository.get_version(namespace) + warnings.warn( + "%(namespace)s was imported without specifying a version first. " + "Use gi.require_version('%(namespace)s', '%(version)s') before " + "import to ensure that the right version gets loaded." + % {"namespace": namespace, "version": version}, + PyGIWarning, stacklevel=stacklevel) + + +def get_import_stacklevel(import_hook): + """Returns the stacklevel value for warnings.warn() for when the warning + gets emitted by an imported module, but the warning should point at the + code doing the import. + + Pass import_hook=True if the warning gets generated by an import hook + (warn() gets called in load_module(), see PEP302) + """ + + py_version = sys.version_info[:2] + if py_version <= (3, 2): + # 2.7 included + return 4 if import_hook else 2 + elif py_version == (3, 3): + return 8 if import_hook else 10 + elif py_version == (3, 4): + return 10 if import_hook else 8 + else: + # fixed again in 3.5+, see https://bugs.python.org/issue24305 + return 4 if import_hook else 2 + + class DynamicImporter(object): # Note: see PEP302 for the Importer Protocol implemented below. @@ -39,32 +107,47 @@ class DynamicImporter(object): def __init__(self, path): self.path = path - def find_module(self, fullname, path=None): + def _find_module_check(self, fullname): if not fullname.startswith(self.path): - return + return False path, namespace = fullname.rsplit('.', 1) - if path != self.path: - return - - if not repository.enumerate_versions(namespace): - logging.error('Could not find any typelib for %s', namespace) - return None - else: - return self + return path == self.path - def load_module(self, fullname): - if fullname in sys.modules: - return sys.modules[fullname] + def find_spec(self, fullname, path=None, target=None): + if self._find_module_check(fullname): + return importlib.util.spec_from_loader(fullname, self) - path, namespace = fullname.rsplit('.', 1) - dynamic_module = DynamicModule(namespace) - modules[namespace] = dynamic_module - - dynamic_module.__file__ = '<%s>' % fullname - dynamic_module.__loader__ = self + def find_module(self, fullname, path=None): + if self._find_module_check(fullname): + return self - sys.modules[fullname] = dynamic_module - dynamic_module._load() + def create_module(self, spec): + path, namespace = spec.name.rsplit('.', 1) + + # is_registered() is faster than enumerate_versions() and + # in the common case of a namespace getting loaded before its + # dependencies, is_registered() returns True for all dependencies. + if not repository.is_registered(namespace) and not \ + repository.enumerate_versions(namespace): + raise ImportError('cannot import name %s, ' + 'introspection typelib not found' % namespace) + + stacklevel = get_import_stacklevel(import_hook=True) + with _check_require_version(namespace, stacklevel=stacklevel): + try: + introspection_module = get_introspection_module(namespace) + except RepositoryError as e: + raise ImportError(e) + # Import all dependencies first so their init functions + # (gdk_init, ..) in overrides get called. + # https://bugzilla.gnome.org/show_bug.cgi?id=656314 + for dep in repository.get_immediate_dependencies(namespace): + importlib.import_module('gi.repository.' + dep.split("-")[0]) + dynamic_module = load_overrides(introspection_module) return dynamic_module + + def exec_module(self, fullname): + # “exec” the module and consequently populate the module’s namespace + pass diff --git a/gi/meson.build b/gi/meson.build new file mode 100644 index 0000000..8edf832 --- /dev/null +++ b/gi/meson.build @@ -0,0 +1,91 @@ +sources = [ + 'pygboxed.c', + 'pygenum.c', + 'pygflags.c', + 'pyginterface.c', + 'pygobject-object.c', + 'pygparamspec.c', + 'pygpointer.c', + 'pygoptioncontext.c', + 'pygoptiongroup.c', + 'pygspawn.c', + 'gimodule.c', + 'pygi-repository.c', + 'pygi-info.c', + 'pygi-foreign.c', + 'pygi-struct.c', + 'pygi-source.c', + 'pygi-argument.c', + 'pygi-resulttuple.c', + 'pygi-type.c', + 'pygi-boxed.c', + 'pygi-closure.c', + 'pygi-ccallback.c', + 'pygi-util.c', + 'pygi-property.c', + 'pygi-signal-closure.c', + 'pygi-invoke.c', + 'pygi-cache.c', + 'pygi-marshal-cleanup.c', + 'pygi-basictype.c', + 'pygi-list.c', + 'pygi-array.c', + 'pygi-error.c', + 'pygi-object.c', + 'pygi-value.c', + 'pygi-enum-marshal.c', + 'pygi-struct-marshal.c', + 'pygi-hashtable.c'] + +headers = [ + 'pygobject.h' +] + +install_headers(headers, subdir : 'pygobject-@0@'.format(platform_version)) + +python_sources = [ + '_constants.py', + 'docstring.py', + '_error.py', + '_gtktemplate.py', + 'importer.py', + '__init__.py', + 'module.py', + '_option.py', + '_ossighelper.py', + '_propertyhelper.py', + 'pygtkcompat.py', + '_signalhelper.py', + 'types.py', +] + +python.install_sources(python_sources, + pure : false, + subdir : 'gi' +) + +# https://github.com/mesonbuild/meson/issues/4117 +if host_machine.system() == 'windows' + python_ext_dep = python_dep +else + python_ext_dep = python_dep.partial_dependency(compile_args: true) +endif + +giext = python.extension_module('_gi', sources, + dependencies : [python_ext_dep, glib_dep, gi_dep, ffi_dep], + include_directories: include_directories('..'), + install: true, + subdir : 'gi', + c_args: pyext_c_args + main_c_args +) + +if cairo_dep.found() + gicairoext = python.extension_module('_gi_cairo', ['pygi-foreign-cairo.c'], + dependencies : [python_ext_dep, glib_dep, gi_dep, ffi_dep, pycairo_dep, cairo_dep, cairo_gobject_dep], + install: true, + subdir : 'gi', + c_args: pyext_c_args + main_c_args) +endif + +subdir('overrides') +subdir('repository') diff --git a/gi/module.py b/gi/module.py index 71f8ac5..93b8e6a 100644 --- a/gi/module.py +++ b/gi/module.py @@ -20,22 +20,10 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -from __future__ import absolute_import - -import sys -import types import importlib - -_have_py3 = (sys.version_info[0] >= 3) - -try: - maketrans = ''.maketrans -except AttributeError: - # fallback for Python 2 - from string import maketrans +from threading import Lock import gi -from .overrides import registry from ._gi import \ Repository, \ @@ -54,16 +42,13 @@ from ._gi import \ enum_add, \ enum_register_new_gtype_and_add, \ flags_add, \ - flags_register_new_gtype_and_add + flags_register_new_gtype_and_add, \ + GInterface from .types import \ GObjectMeta, \ StructMeta -from ._gobject._gobject import \ - GInterface, \ - GObject - -from ._gobject.constants import \ +from ._constants import \ TYPE_NONE, \ TYPE_BOXED, \ TYPE_POINTER, \ @@ -81,10 +66,16 @@ def get_parent_for_object(object_info): parent_object_info = object_info.get_parent() if not parent_object_info: - # Special case GObject.Object as being derived from the static GObject. - if object_info.get_namespace() == 'GObject' and object_info.get_name() == 'Object': - return GObject - + # If we reach the end of the introspection info class hierarchy, look + # for an existing wrapper on the GType and use it as a base for the + # new introspection wrapper. This allows static C wrappers already + # registered with the GType to be used as the introspection base + # (_gi.GObject for example) + gtype = object_info.get_g_type() + if gtype and gtype.pytype: + return gtype.pytype + + # Otherwise use builtins.object as the base return object namespace = parent_object_info.get_namespace() @@ -114,19 +105,21 @@ class IntrospectionModule(object): These members are then cached on this introspection module. """ def __init__(self, namespace, version=None): + """Might raise gi._gi.RepositoryError""" + repository.require(namespace, version) self._namespace = namespace self._version = version self.__name__ = 'gi.repository.' + namespace - self.__path__ = repository.get_typelib_path(self._namespace) - if _have_py3: - # get_typelib_path() delivers bytes, not a string - self.__path__ = self.__path__.decode('UTF-8') + path = repository.get_typelib_path(self._namespace) + self.__path__ = [path] if self._version is None: self._version = repository.get_version(self._namespace) + self._lock = Lock() + def __getattr__(self, name): info = repository.find_by_name(self._namespace, name) if not info: @@ -135,37 +128,41 @@ class IntrospectionModule(object): if isinstance(info, EnumInfo): g_type = info.get_g_type() - wrapper = g_type.pytype - if wrapper is None: - if info.is_flags(): - if g_type.is_a(TYPE_FLAGS): - wrapper = flags_add(g_type) - else: - assert g_type == TYPE_NONE - wrapper = flags_register_new_gtype_and_add(info) - else: - if g_type.is_a(TYPE_ENUM): - wrapper = enum_add(g_type) - else: - assert g_type == TYPE_NONE - wrapper = enum_register_new_gtype_and_add(info) - - wrapper.__info__ = info - wrapper.__module__ = 'gi.repository.' + info.get_namespace() - - # Don't use upper() here to avoid locale specific - # identifier conversion (e. g. in Turkish 'i'.upper() == 'i') - # see https://bugzilla.gnome.org/show_bug.cgi?id=649165 - ascii_upper_trans = maketrans( - 'abcdefgjhijklmnopqrstuvwxyz', - 'ABCDEFGJHIJKLMNOPQRSTUVWXYZ') - for value_info in info.get_values(): - value_name = value_info.get_name_unescaped().translate(ascii_upper_trans) - setattr(wrapper, value_name, wrapper(value_info.get_value())) + with self._lock: + wrapper = g_type.pytype - if g_type != TYPE_NONE: - g_type.pytype = wrapper + if wrapper is None: + if info.is_flags(): + if g_type.is_a(TYPE_FLAGS): + wrapper = flags_add(g_type) + else: + assert g_type == TYPE_NONE + wrapper = flags_register_new_gtype_and_add(info) + else: + if g_type.is_a(TYPE_ENUM): + wrapper = enum_add(g_type) + else: + assert g_type == TYPE_NONE + wrapper = enum_register_new_gtype_and_add(info) + + wrapper.__info__ = info + wrapper.__module__ = 'gi.repository.' + info.get_namespace() + + # Don't use upper() here to avoid locale specific + # identifier conversion (e. g. in Turkish 'i'.upper() == 'i') + # see https://bugzilla.gnome.org/show_bug.cgi?id=649165 + ascii_upper_trans = ''.maketrans( + 'abcdefgjhijklmnopqrstuvwxyz', + 'ABCDEFGJHIJKLMNOPQRSTUVWXYZ') + for value_info in info.get_values(): + value_name = value_info.get_name_unescaped().translate(ascii_upper_trans) + setattr(wrapper, value_name, wrapper(value_info.get_value())) + for method_info in info.get_methods(): + setattr(wrapper, method_info.__name__, method_info) + + if g_type != TYPE_NONE: + g_type.pytype = wrapper elif isinstance(info, RegisteredTypeInfo): g_type = info.get_g_type() @@ -196,27 +193,28 @@ class IntrospectionModule(object): else: raise NotImplementedError(info) - # Check if there is already a Python wrapper that is not a parent class - # of the wrapper being created. If it is a parent, it is ok to clobber - # g_type.pytype with a new child class wrapper of the existing parent. - # Note that the return here never occurs under normal circumstances due - # to caching on the __dict__ itself. - if g_type != TYPE_NONE: - type_ = g_type.pytype - if type_ is not None and type_ not in bases: - self.__dict__[name] = type_ - return type_ - - dict_ = { - '__info__': info, - '__module__': 'gi.repository.' + self._namespace, - '__gtype__': g_type - } - wrapper = metaclass(name, bases, dict_) - - # Register the new Python wrapper. - if g_type != TYPE_NONE: - g_type.pytype = wrapper + with self._lock: + # Check if there is already a Python wrapper that is not a parent class + # of the wrapper being created. If it is a parent, it is ok to clobber + # g_type.pytype with a new child class wrapper of the existing parent. + # Note that the return here never occurs under normal circumstances due + # to caching on the __dict__ itself. + if g_type != TYPE_NONE: + type_ = g_type.pytype + if type_ is not None and type_ not in bases: + self.__dict__[name] = type_ + return type_ + + dict_ = { + '__info__': info, + '__module__': 'gi.repository.' + self._namespace, + '__gtype__': g_type + } + wrapper = metaclass(name, bases, dict_) + + # Register the new Python wrapper. + if g_type != TYPE_NONE: + g_type.pytype = wrapper elif isinstance(info, FunctionInfo): wrapper = info @@ -233,9 +231,6 @@ class IntrospectionModule(object): def __repr__(self): path = repository.get_typelib_path(self._namespace) - if _have_py3: - # get_typelib_path() delivers bytes, not a string - path = path.decode('UTF-8') return "" % (self._namespace, path) def __dir__(self): @@ -258,6 +253,8 @@ def get_introspection_module(namespace): """ :Returns: An object directly wrapping the gi module without overrides. + + Might raise gi._gi.RepositoryError """ if namespace in _introspection_modules: return _introspection_modules[namespace] @@ -266,69 +263,3 @@ def get_introspection_module(namespace): module = IntrospectionModule(namespace, version) _introspection_modules[namespace] = module return module - - -class DynamicModule(types.ModuleType): - """A module composed of an IntrospectionModule and an overrides module. - - DynamicModule wraps up an IntrospectionModule and an overrides module - into a single accessible module. This is what is returned from statements - like "from gi.repository import Foo". Accessing attributes on a DynamicModule - will first look overrides (or the gi.overrides.registry cache) and then - in the introspection module if it was not found as an override. - """ - def __init__(self, namespace): - self._namespace = namespace - self._introspection_module = None - self._overrides_module = None - self.__path__ = None - - def _load(self): - self._introspection_module = get_introspection_module(self._namespace) - try: - self._overrides_module = importlib.import_module('gi.overrides.' + self._namespace) - except ImportError: - self._overrides_module = None - - self.__path__ = repository.get_typelib_path(self._namespace) - if _have_py3: - # get_typelib_path() delivers bytes, not a string - self.__path__ = self.__path__.decode('UTF-8') - - def __getattr__(self, name): - if self._overrides_module is not None: - override_exports = getattr(self._overrides_module, '__all__', ()) - if name in override_exports: - return getattr(self._overrides_module, name, None) - else: - # check the registry just in case the module hasn't loaded yet - # TODO: Only gtypes are registered in the registry right now - # but it would be nice to register all overrides and - # get rid of the module imports. We might actually see a - # speedup. - key = '%s.%s' % (self._namespace, name) - if key in registry: - return registry[key] - - return getattr(self._introspection_module, name) - - def __dir__(self): - # Python's default dir() is just dir(self.__class__) + self.__dict__.keys() - result = set(dir(self.__class__)) - result.update(self.__dict__.keys()) - - result.update(dir(self._introspection_module)) - override_exports = getattr(self._overrides_module, '__all__', ()) - result.update(override_exports) - return list(result) - - def __repr__(self): - path = repository.get_typelib_path(self._namespace) - if _have_py3: - # get_typelib_path() delivers bytes, not a string - path = path.decode('UTF-8') - - return "<%s.%s %r from %r>" % (self.__class__.__module__, - self.__class__.__name__, - self._namespace, - path) diff --git a/gi/overrides/GIMarshallingTests.py b/gi/overrides/GIMarshallingTests.py index cc967b4..e9f8e33 100644 --- a/gi/overrides/GIMarshallingTests.py +++ b/gi/overrides/GIMarshallingTests.py @@ -41,6 +41,7 @@ class OverridesStruct(GIMarshallingTests.OverridesStruct): def method(self): return GIMarshallingTests.OverridesStruct.method(self) / 7 + OverridesStruct = override(OverridesStruct) __all__.append('OverridesStruct') @@ -53,18 +54,19 @@ class OverridesObject(GIMarshallingTests.OverridesObject): def __init__(self, long_): GIMarshallingTests.OverridesObject.__init__(self) # FIXME: doesn't work yet - #self.long_ = long_ + # self.long_ = long_ @classmethod def new(cls, long_): self = GIMarshallingTests.OverridesObject.new() # FIXME: doesn't work yet - #self.long_ = long_ + # self.long_ = long_ return self def method(self): """Overridden doc string.""" return GIMarshallingTests.OverridesObject.method(self) / 7 + OverridesObject = override(OverridesObject) __all__.append('OverridesObject') diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py index f4b1ef5..78d309b 100644 --- a/gi/overrides/GLib.py +++ b/gi/overrides/GLib.py @@ -19,41 +19,67 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -import signal import warnings import sys +import socket +from .._ossighelper import wakeup_on_signal, register_sigint_fallback from ..module import get_introspection_module -from .._gi import (variant_new_tuple, variant_type_from_string, source_new, +from .._gi import (variant_type_from_string, source_new, source_set_callback, io_channel_read) -from ..overrides import override, deprecated +from ..overrides import override, deprecated, deprecated_attr from gi import PyGIDeprecationWarning, version_info GLib = get_introspection_module('GLib') __all__ = [] -from gi._glib import option +from gi import _option as option option # pyflakes __all__.append('option') # Types and functions still needed from static bindings -from gi._glib import _glib -GError = _glib.GError -OptionContext = _glib.OptionContext -OptionGroup = _glib.OptionGroup -Pid = _glib.Pid -spawn_async = _glib.spawn_async +from gi import _gi +from gi._error import GError + +Error = GError +OptionContext = _gi.OptionContext +OptionGroup = _gi.OptionGroup +Pid = _gi.Pid +spawn_async = _gi.spawn_async def threads_init(): - warnings.warn('threads_init no longer needs to be called. ' - 'See: https://bugzilla.gnome.org/show_bug.cgi?id=686914', - PyGIDeprecationWarning) + warnings.warn('Since version 3.11, calling threads_init is no longer needed. ' + 'See: https://wiki.gnome.org/PyGObject/Threading', + PyGIDeprecationWarning, stacklevel=2) + + +def gerror_matches(self, domain, code): + # Handle cases where self.domain was set to an integer for compatibility + # with the introspected GLib.Error. + if isinstance(self.domain, str): + self_domain_quark = GLib.quark_from_string(self.domain) + else: + self_domain_quark = self.domain + return (self_domain_quark, self.code) == (domain, code) + +def gerror_new_literal(domain, message, code): + domain_quark = GLib.quark_to_string(domain) + return GError(message, domain_quark, code) -__all__ += ['GError', 'OptionContext', 'OptionGroup', 'Pid', + +# Monkey patch methods that rely on GLib introspection to be loaded at runtime. +Error.__name__ = 'Error' +Error.__module__ = 'gi.repository.GLib' +Error.__gtype__ = GLib.Error.__gtype__ +Error.matches = gerror_matches +Error.new_literal = staticmethod(gerror_new_literal) + + +__all__ += ['GError', 'Error', 'OptionContext', 'OptionGroup', 'Pid', 'spawn_async', 'threads_init'] @@ -76,132 +102,77 @@ class _VariantCreator(object): 'v': GLib.Variant.new_variant, } - def _create(self, format, args): - '''Create a GVariant object from given format and argument list. + def _create(self, format, value): + """Create a GVariant object from given format and a value that matches + the format. This method recursively calls itself for complex structures (arrays, dictionaries, boxed). - Return a tuple (variant, rest_format, rest_args) with the generated - GVariant, the remainder of the format string, and the remainder of the - arguments. - - If args is None, then this won't actually consume any arguments, and - just parse the format string and generate empty GVariant structures. - This is required for creating empty dictionaries or arrays. - ''' - # leaves (simple types) - constructor = self._LEAF_CONSTRUCTORS.get(format[0]) - if constructor: - if args is not None: - if not args: - raise TypeError('not enough arguments for GVariant format string') - v = constructor(args[0]) - return (v, format[1:], args[1:]) - else: - return (None, format[1:], None) - - if format[0] == '(': - return self._create_tuple(format, args) - - if format.startswith('a{'): - return self._create_dict(format, args) - - if format[0] == 'a': - return self._create_array(format, args) - - raise NotImplementedError('cannot handle GVariant type ' + format) - - def _create_tuple(self, format, args): - '''Handle the case where the outermost type of format is a tuple.''' - - format = format[1:] # eat the '(' - if args is None: - # empty value: we need to call _create() to parse the subtype - rest_format = format - while rest_format: - if rest_format.startswith(')'): - break - rest_format = self._create(rest_format, None)[1] - else: - raise TypeError('tuple type string not closed with )') - - rest_format = rest_format[1:] # eat the ) - return (None, rest_format, None) - else: - if not args or not isinstance(args[0], tuple): - raise TypeError('expected tuple argument') - - builder = GLib.VariantBuilder.new(variant_type_from_string('r')) - for i in range(len(args[0])): - if format.startswith(')'): - raise TypeError('too many arguments for tuple signature') - - (v, format, _) = self._create(format, args[0][i:]) - builder.add_value(v) - args = args[1:] - if not format.startswith(')'): - raise TypeError('tuple type string not closed with )') - - rest_format = format[1:] # eat the ) - return (builder.end(), rest_format, args) - - def _create_dict(self, format, args): - '''Handle the case where the outermost type of format is a dict.''' - - builder = None - if args is None or not args[0]: - # empty value: we need to call _create() to parse the subtype, - # and specify the element type precisely - rest_format = self._create(format[2:], None)[1] - rest_format = self._create(rest_format, None)[1] - if not rest_format.startswith('}'): - raise TypeError('dictionary type string not closed with }') - rest_format = rest_format[1:] # eat the } - element_type = format[:len(format) - len(rest_format)] - builder = GLib.VariantBuilder.new(variant_type_from_string(element_type)) - else: - builder = GLib.VariantBuilder.new(variant_type_from_string('a{?*}')) - for k, v in args[0].items(): - (key_v, rest_format, _) = self._create(format[2:], [k]) - (val_v, rest_format, _) = self._create(rest_format, [v]) - - if not rest_format.startswith('}'): - raise TypeError('dictionary type string not closed with }') - rest_format = rest_format[1:] # eat the } - - entry = GLib.VariantBuilder.new(variant_type_from_string('{?*}')) - entry.add_value(key_v) - entry.add_value(val_v) - builder.add_value(entry.end()) - - if args is not None: - args = args[1:] - return (builder.end(), rest_format, args) - - def _create_array(self, format, args): - '''Handle the case where the outermost type of format is an array.''' - - builder = None - if args is None or not args[0]: - # empty value: we need to call _create() to parse the subtype, - # and specify the element type precisely - rest_format = self._create(format[1:], None)[1] - element_type = format[:len(format) - len(rest_format)] - builder = GLib.VariantBuilder.new(variant_type_from_string(element_type)) + Returns the generated GVariant. + + If value is None it will generate an empty GVariant container type. + """ + gvtype = GLib.VariantType(format) + if format in self._LEAF_CONSTRUCTORS: + return self._LEAF_CONSTRUCTORS[format](value) + + # Since we discarded all leaf types, this must be a container + builder = GLib.VariantBuilder.new(gvtype) + if value is None: + return builder.end() + + if gvtype.is_maybe(): + builder.add_value(self._create(gvtype.element().dup_string(), value)) + return builder.end() + + try: + iter(value) + except TypeError: + raise TypeError("Could not create array, tuple or dictionary entry from non iterable value %s %s" % + (format, value)) + + if gvtype.is_tuple() and gvtype.n_items() != len(value): + raise TypeError("Tuple mismatches value's number of elements %s %s" % (format, value)) + if gvtype.is_dict_entry() and len(value) != 2: + raise TypeError("Dictionary entries must have two elements %s %s" % (format, value)) + + if gvtype.is_array(): + element_type = gvtype.element().dup_string() + if isinstance(value, dict): + value = value.items() + for i in value: + builder.add_value(self._create(element_type, i)) else: - builder = GLib.VariantBuilder.new(variant_type_from_string('a*')) - for i in range(len(args[0])): - (v, rest_format, _) = self._create(format[1:], args[0][i:]) - builder.add_value(v) - if args is not None: - args = args[1:] - return (builder.end(), rest_format, args) + remainer_format = format[1:] + for i in value: + dup = variant_type_from_string(remainer_format).dup_string() + builder.add_value(self._create(dup, i)) + remainer_format = remainer_format[len(dup):] + + return builder.end() + + +LEAF_ACCESSORS = { + 'b': 'get_boolean', + 'y': 'get_byte', + 'n': 'get_int16', + 'q': 'get_uint16', + 'i': 'get_int32', + 'u': 'get_uint32', + 'x': 'get_int64', + 't': 'get_uint64', + 'h': 'get_handle', + 'd': 'get_double', + 's': 'get_string', + 'o': 'get_string', # object path + 'g': 'get_string', # signature +} class Variant(GLib.Variant): def __new__(cls, format_string, value): - '''Create a GVariant from a native Python object. + """Create a GVariant from a native Python object. format_string is a standard GVariant type signature, value is a Python object whose structure has to match the signature. @@ -211,16 +182,29 @@ class Variant(GLib.Variant): GLib.Variant('(is)', (1, 'hello')) GLib.Variant('(asa{sv})', ([], {'foo': GLib.Variant('b', True), 'bar': GLib.Variant('i', 2)})) - ''' + """ + if not GLib.VariantType.string_is_valid(format_string): + raise TypeError("Invalid GVariant format string '%s'", format_string) creator = _VariantCreator() - (v, rest_format, _) = creator._create(format_string, [value]) - if rest_format: - raise TypeError('invalid remaining format string: "%s"' % rest_format) + v = creator._create(format_string, value) v.format_string = format_string return v + @staticmethod + def new_tuple(*elements): + return GLib.Variant.new_tuple(elements) + def __del__(self): - self.unref() + try: + self.unref() + except ImportError: + # Calling unref will cause gi and gi.repository.GLib to be + # imported. However, if the program is exiting, then these + # modules have likely been removed from sys.modules and will + # raise an exception. Assume that's the case for ImportError + # and ignore the exception since everything will be cleaned + # up, anyways. + pass def __str__(self): return self.print_(True) @@ -251,37 +235,22 @@ class Variant(GLib.Variant): return hash((self.get_type_string(), self.unpack())) def unpack(self): - '''Decompose a GVariant into a native Python object.''' - - LEAF_ACCESSORS = { - 'b': self.get_boolean, - 'y': self.get_byte, - 'n': self.get_int16, - 'q': self.get_uint16, - 'i': self.get_int32, - 'u': self.get_uint32, - 'x': self.get_int64, - 't': self.get_uint64, - 'h': self.get_handle, - 'd': self.get_double, - 's': self.get_string, - 'o': self.get_string, # object path - 'g': self.get_string, # signature - } + """Decompose a GVariant into a native Python object.""" + + type_string = self.get_type_string() # simple values - la = LEAF_ACCESSORS.get(self.get_type_string()) + la = LEAF_ACCESSORS.get(type_string) if la: - return la() + return getattr(self, la)() # tuple - if self.get_type_string().startswith('('): - res = [self.get_child_value(i).unpack() - for i in range(self.n_children())] - return tuple(res) + if type_string.startswith('('): + return tuple(self.get_child_value(i).unpack() + for i in range(self.n_children())) # dictionary - if self.get_type_string().startswith('a{'): + if type_string.startswith('a{'): res = {} for i in range(self.n_children()): v = self.get_child_value(i) @@ -289,31 +258,32 @@ class Variant(GLib.Variant): return res # array - if self.get_type_string().startswith('a'): + if type_string.startswith('a'): return [self.get_child_value(i).unpack() for i in range(self.n_children())] # variant (just unbox transparently) - if self.get_type_string().startswith('v'): + if type_string.startswith('v'): return self.get_variant().unpack() # maybe - if self.get_type_string().startswith('m'): - m = self.get_maybe() - return m.unpack() if m else None + if type_string.startswith('m'): + if not self.n_children(): + return None + return self.get_child_value(0).unpack() - raise NotImplementedError('unsupported GVariant type ' + self.get_type_string()) + raise NotImplementedError('unsupported GVariant type ' + type_string) @classmethod def split_signature(klass, signature): - '''Return a list of the element signatures of the topmost signature tuple. + """Return a list of the element signatures of the topmost signature tuple. If the signature is not a tuple, it returns one element with the entire signature. If the signature is an empty tuple, the result is []. This is useful for e. g. iterating over method parameters which are passed as a single Variant. - ''' + """ if signature == '()': return [] @@ -416,15 +386,12 @@ class Variant(GLib.Variant): # Array, dict, tuple if self.get_type_string().startswith('a') or self.get_type_string().startswith('('): return self.n_children() != 0 - if self.get_type_string() in ['v']: - # unpack works recursively, hence bool also works recursively - return bool(self.unpack()) - # Everything else is True - return True + # unpack works recursively, hence bool also works recursively + return bool(self.unpack()) def keys(self): if not self.get_type_string().startswith('a{'): - return TypeError, 'GVariant type %s is not a dictionary' % self.get_type_string() + raise TypeError('GVariant type %s is not a dictionary' % self.get_type_string()) res = [] for i in range(self.n_children()): @@ -433,16 +400,11 @@ class Variant(GLib.Variant): return res -@classmethod -def new_tuple(cls, *elements): - return variant_new_tuple(elements) - - def get_string(self): value, length = GLib.Variant.get_string(self) return value -setattr(Variant, 'new_tuple', new_tuple) + setattr(Variant, 'get_string', get_string) __all__.append('Variant') @@ -453,14 +415,18 @@ def markup_escape_text(text, length=-1): return GLib.markup_escape_text(text.decode('UTF-8'), length) else: return GLib.markup_escape_text(text, length) + + __all__.append('markup_escape_text') # backwards compatible names from old static bindings for n in ['DESKTOP', 'DOCUMENTS', 'DOWNLOAD', 'MUSIC', 'PICTURES', 'PUBLIC_SHARE', 'TEMPLATES', 'VIDEOS']: - globals()['USER_DIRECTORY_' + n] = getattr(GLib.UserDirectory, 'DIRECTORY_' + n) - __all__.append('USER_DIRECTORY_' + n) + attr = 'USER_DIRECTORY_' + n + deprecated_attr("GLib", attr, "GLib.UserDirectory.DIRECTORY_" + n) + globals()[attr] = getattr(GLib.UserDirectory, 'DIRECTORY_' + n) + __all__.append(attr) for n in ['ERR', 'HUP', 'IN', 'NVAL', 'OUT', 'PRI']: globals()['IO_' + n] = getattr(GLib.IOCondition, n) @@ -468,30 +434,53 @@ for n in ['ERR', 'HUP', 'IN', 'NVAL', 'OUT', 'PRI']: for n in ['APPEND', 'GET_MASK', 'IS_READABLE', 'IS_SEEKABLE', 'MASK', 'NONBLOCK', 'SET_MASK']: - globals()['IO_FLAG_' + n] = getattr(GLib.IOFlags, n) - __all__.append('IO_FLAG_' + n) + attr = 'IO_FLAG_' + n + deprecated_attr("GLib", attr, "GLib.IOFlags." + n) + globals()[attr] = getattr(GLib.IOFlags, n) + __all__.append(attr) + # spelling for the win IO_FLAG_IS_WRITEABLE = GLib.IOFlags.IS_WRITABLE +deprecated_attr("GLib", "IO_FLAG_IS_WRITEABLE", "GLib.IOFlags.IS_WRITABLE") __all__.append('IO_FLAG_IS_WRITEABLE') for n in ['AGAIN', 'EOF', 'ERROR', 'NORMAL']: - globals()['IO_STATUS_' + n] = getattr(GLib.IOStatus, n) - __all__.append('IO_STATUS_' + n) + attr = 'IO_STATUS_' + n + globals()[attr] = getattr(GLib.IOStatus, n) + deprecated_attr("GLib", attr, "GLib.IOStatus." + n) + __all__.append(attr) for n in ['CHILD_INHERITS_STDIN', 'DO_NOT_REAP_CHILD', 'FILE_AND_ARGV_ZERO', 'LEAVE_DESCRIPTORS_OPEN', 'SEARCH_PATH', 'STDERR_TO_DEV_NULL', 'STDOUT_TO_DEV_NULL']: - globals()['SPAWN_' + n] = getattr(GLib.SpawnFlags, n) - __all__.append('SPAWN_' + n) + attr = 'SPAWN_' + n + globals()[attr] = getattr(GLib.SpawnFlags, n) + deprecated_attr("GLib", attr, "GLib.SpawnFlags." + n) + __all__.append(attr) for n in ['HIDDEN', 'IN_MAIN', 'REVERSE', 'NO_ARG', 'FILENAME', 'OPTIONAL_ARG', 'NOALIAS']: - globals()['OPTION_FLAG_' + n] = getattr(GLib.OptionFlags, n) - __all__.append('OPTION_FLAG_' + n) + attr = 'OPTION_FLAG_' + n + globals()[attr] = getattr(GLib.OptionFlags, n) + deprecated_attr("GLib", attr, "GLib.OptionFlags." + n) + __all__.append(attr) for n in ['UNKNOWN_OPTION', 'BAD_VALUE', 'FAILED']: - globals()['OPTION_ERROR_' + n] = getattr(GLib.OptionError, n) - __all__.append('OPTION_ERROR_' + n) + attr = 'OPTION_ERROR_' + n + deprecated_attr("GLib", attr, "GLib.OptionError." + n) + globals()[attr] = getattr(GLib.OptionError, n) + __all__.append(attr) + + +# these are not currently exported in GLib gir, presumably because they are +# platform dependent; so get them from our static bindings +for name in ['G_MINFLOAT', 'G_MAXFLOAT', 'G_MINDOUBLE', 'G_MAXDOUBLE', + 'G_MINSHORT', 'G_MAXSHORT', 'G_MAXUSHORT', 'G_MININT', 'G_MAXINT', + 'G_MAXUINT', 'G_MINLONG', 'G_MAXLONG', 'G_MAXULONG', 'G_MAXSIZE', + 'G_MINSSIZE', 'G_MAXSSIZE', 'G_MINOFFSET', 'G_MAXOFFSET']: + attr = name.split("_", 1)[-1] + globals()[attr] = getattr(_gi, name) + __all__.append(attr) class MainLoop(GLib.MainLoop): @@ -499,28 +488,14 @@ class MainLoop(GLib.MainLoop): def __new__(cls, context=None): return GLib.MainLoop.new(context, False) - # Retain classic pygobject behaviour of quitting main loops on SIGINT def __init__(self, context=None): - def _handler(loop): - loop.quit() - loop._quit_by_sigint = True - if sys.platform != 'win32': - # compatibility shim, keep around until we depend on glib 2.36 - if hasattr(GLib, 'unix_signal_add'): - fn = GLib.unix_signal_add - else: - fn = GLib.unix_signal_add_full - self._signal_source = fn(GLib.PRIORITY_DEFAULT, signal.SIGINT, _handler, self) - - def __del__(self): - if hasattr(self, '_signal_source'): - GLib.source_remove(self._signal_source) + pass def run(self): - super(MainLoop, self).run() - if hasattr(self, '_quit_by_sigint'): - # caught by _main_loop_sigint_handler() - raise KeyboardInterrupt + with register_sigint_fallback(self.quit): + with wakeup_on_signal(): + super(MainLoop, self).run() + MainLoop = override(MainLoop) __all__.append('MainLoop') @@ -531,31 +506,34 @@ class MainContext(GLib.MainContext): def iteration(self, may_block=True): return super(MainContext, self).iteration(may_block) + MainContext = override(MainContext) __all__.append('MainContext') class Source(GLib.Source): def __new__(cls, *args, **kwargs): - # use our custom pyg_source_new() here as g_source_new() is not + # use our custom pygi_source_new() here as g_source_new() is not # bindable source = source_new() source.__class__ = cls setattr(source, '__pygi_custom_source', True) return source + def __init__(self, *args, **kwargs): + return super(Source, self).__init__() + def __del__(self): if hasattr(self, '__pygi_custom_source'): - self.unref() - - # Backwards compatible API for optional arguments - def attach(self, context=None): - id = super(Source, self).attach(context) - return id + self.destroy() + # XXX: We have to unref the underlying source while the Python + # wrapper is still valid, so the source can call into the + # wrapper methods for the finalized callback. + self._clear_boxed() def set_callback(self, fn, user_data=None): if hasattr(self, '__pygi_custom_source'): - # use our custom pyg_source_set_callback() if for a GSource object + # use our custom pygi_source_set_callback() if for a GSource object # with custom functions source_set_callback(self, fn, user_data) else: @@ -586,6 +564,7 @@ class Source(GLib.Source): can_recurse = property(__get_can_recurse, __set_can_recurse) + Source = override(Source) __all__.append('Source') @@ -601,6 +580,7 @@ class Idle(Source): if priority != GLib.PRIORITY_DEFAULT: self.set_priority(priority) + __all__.append('Idle') @@ -614,63 +594,48 @@ class Timeout(Source): if priority != GLib.PRIORITY_DEFAULT: self.set_priority(priority) -__all__.append('Timeout') - -def user_data_varargs_shim(callback, user_data, cb_num_args=0): - '''Adjust callback and user_data varargs for PyGTK backwards compatibility - - GLib only accepts exactly one user_data argument, but older pygtk - traditionally accepted zero or more for some specific functions. For "one - argument", use the actual user-supplied callback for efficiency; for all - others, rewire it to accept zero or more than one. - - Return the adjusted callback and the real user data to pass to GLib. - ''' - if len(user_data) == 1: - return (callback, user_data[0]) - - if cb_num_args == 0: - return (lambda data: callback(*data), user_data) - if cb_num_args == 2: - return (lambda a1, a2, data: callback(a1, a2, *data), user_data) - raise NotImplementedError('%i number of callback arguments not supported' % cb_num_args) +__all__.append('Timeout') # backwards compatible API def idle_add(function, *user_data, **kwargs): - (fn, data) = user_data_varargs_shim(function, user_data) priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT_IDLE) - return GLib.idle_add(priority, fn, data) + return GLib.idle_add(priority, function, *user_data) + __all__.append('idle_add') def timeout_add(interval, function, *user_data, **kwargs): - (fn, data) = user_data_varargs_shim(function, user_data) priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) - return GLib.timeout_add(priority, interval, fn, data) + return GLib.timeout_add(priority, interval, function, *user_data) + __all__.append('timeout_add') def timeout_add_seconds(interval, function, *user_data, **kwargs): - (fn, data) = user_data_varargs_shim(function, user_data) priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) - return GLib.timeout_add_seconds(priority, interval, fn, data) + return GLib.timeout_add_seconds(priority, interval, function, *user_data) + __all__.append('timeout_add_seconds') -# The real GLib API is io_add_watch(IOChannel, priority, condition, callback, -# user_data). This needs to take into account several historical APIs: +# The GI GLib API uses g_io_add_watch_full renamed to g_io_add_watch with +# a signature of (channel, priority, condition, func, user_data). +# Prior to PyGObject 3.8, this function was statically bound with an API closer to the +# non-full version with a signature of: (fd, condition, func, *user_data) +# We need to support this until we are okay with breaking API in a way which is +# not backwards compatible. +# +# This needs to take into account several historical APIs: # - calling with an fd as first argument # - calling with a Python file object as first argument (we keep this one as # it's really convenient and does not change the number of arguments) # - calling without a priority as second argument -# and the usual "call without or multiple user_data", in which case the -# callback gets the same user data arguments. -def io_add_watch(channel, priority_, condition, *cb_and_user_data, **kwargs): +def _io_add_watch_get_args(channel, priority_, condition, *cb_and_user_data, **kwargs): if not isinstance(priority_, int) or isinstance(priority_, GLib.IOCondition): warnings.warn('Calling io_add_watch without priority as second argument is deprecated', PyGIDeprecationWarning) @@ -694,23 +659,33 @@ def io_add_watch(channel, priority_, condition, *cb_and_user_data, **kwargs): callback = cb_and_user_data[0] user_data = cb_and_user_data[1:] - (func, user_data) = user_data_varargs_shim(callback, user_data, 2) - # backwards compatibility: Allow calling with fd if isinstance(channel, int): - func_fdtransform = lambda _, cond, data: func(channel, cond, data) + func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data) real_channel = GLib.IOChannel.unix_new(channel) + elif isinstance(channel, socket.socket) and sys.platform == 'win32': + func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data) + real_channel = GLib.IOChannel.win32_new_socket(channel.fileno()) elif hasattr(channel, 'fileno'): # backwards compatibility: Allow calling with Python file - func_fdtransform = lambda _, cond, data: func(channel, cond, data) + func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data) real_channel = GLib.IOChannel.unix_new(channel.fileno()) else: assert isinstance(channel, GLib.IOChannel) - func_fdtransform = func + func_fdtransform = callback real_channel = channel - return GLib.io_add_watch(real_channel, priority_, condition, - func_fdtransform, user_data) + return real_channel, priority_, condition, func_fdtransform, user_data + + +__all__.append('_io_add_watch_get_args') + + +def io_add_watch(*args, **kwargs): + """io_add_watch(channel, priority, condition, func, *user_data) -> event_source_id""" + channel, priority, condition, func, user_data = _io_add_watch_get_args(*args, **kwargs) + return GLib.io_add_watch(channel, priority, condition, func, *user_data) + __all__.append('io_add_watch') @@ -726,6 +701,9 @@ class IOChannel(GLib.IOChannel): return GLib.IOChannel.win32_new_fd(hwnd) raise TypeError('either a valid file descriptor, file name, or window handle must be supplied') + def __init__(self, *args, **kwargs): + return super(IOChannel, self).__init__() + def read(self, max_count=-1): return io_channel_read(self, max_count) @@ -790,6 +768,7 @@ class IOChannel(GLib.IOChannel): # Python 2.x compatibility next = __next__ + IOChannel = override(IOChannel) __all__.append('IOChannel') @@ -804,18 +783,19 @@ class PollFD(GLib.PollFD): self.fd = fd self.events = events + PollFD = override(PollFD) __all__.append('PollFD') -# The real GLib API is child_watch_add(priority, pid, callback, data). -# The old static bindings had the following API which we still need to support -# for a while: -# child_watch_add(pid, callback, data=None, priority=GLib.PRIORITY_DEFAULT) -# and the usual "call without user_data", in which case the callback does not -# get an user_data either. -def child_watch_add(priority_or_pid, pid_or_callback, *args, **kwargs): - _unspecified = object() +# The GI GLib API uses g_child_watch_add_full renamed to g_child_watch_add with +# a signature of (priority, pid, callback, data). +# Prior to PyGObject 3.8, this function was statically bound with an API closer to the +# non-full version with a signature of: (pid, callback, data=None, priority=GLib.PRIORITY_DEFAULT) +# We need to support this until we are okay with breaking API in a way which is +# not backwards compatible. +def _child_watch_add_get_args(priority_or_pid, pid_or_callback, *args, **kwargs): + user_data = [] if callable(pid_or_callback): warnings.warn('Calling child_watch_add without priority as first argument is deprecated', @@ -823,35 +803,44 @@ def child_watch_add(priority_or_pid, pid_or_callback, *args, **kwargs): pid = priority_or_pid callback = pid_or_callback if len(args) == 0: - user_data = kwargs.get('data', _unspecified) priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) elif len(args) == 1: - user_data = args[0] + user_data = args priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) elif len(args) == 2: - user_data = args[0] + user_data = [args[0]] priority = args[1] else: raise TypeError('expected at most 4 positional arguments') else: priority = priority_or_pid pid = pid_or_callback - if len(args) == 0 or not callable(args[0]): - raise TypeError('expected callback as third argument') - callback = args[0] - if len(args) == 1: - user_data = kwargs.get('data', _unspecified) + if 'function' in kwargs: + callback = kwargs['function'] + user_data = args + elif len(args) > 0 and callable(args[0]): + callback = args[0] + user_data = args[1:] else: - user_data = args[1] + raise TypeError('expected callback as third argument') + + if 'data' in kwargs: + if user_data: + raise TypeError('got multiple values for "data" argument') + user_data = (kwargs['data'],) + + return priority, pid, callback, user_data - if user_data is _unspecified: - # we have to call the callback without the user_data argument - func = lambda pid, status, data: callback(pid, status) - user_data = None - else: - func = callback - return GLib.child_watch_add(priority, pid, func, user_data) +# we need this to be accessible for unit testing +__all__.append('_child_watch_add_get_args') + + +def child_watch_add(*args, **kwargs): + """child_watch_add(priority, pid, function, *data)""" + priority, pid, function, data = _child_watch_add_get_args(*args, **kwargs) + return GLib.child_watch_add(priority, pid, function, *data) + __all__.append('child_watch_add') @@ -859,6 +848,7 @@ __all__.append('child_watch_add') def get_current_time(): return GLib.get_real_time() * 0.000001 + get_current_time = deprecated(get_current_time, 'GLib.get_real_time()') __all__.append('get_current_time') @@ -869,21 +859,22 @@ __all__.append('get_current_time') def filename_from_utf8(utf8string, len=-1): return GLib.filename_from_utf8(utf8string, len)[0] -__all__.append('filename_from_utf8') +__all__.append('filename_from_utf8') -# backwards compatible API for renamed function -if not hasattr(GLib, 'unix_signal_add_full'): - def add_full_compat(*args): - warnings.warn('GLib.unix_signal_add_full() was renamed to GLib.unix_signal_add()', - PyGIDeprecationWarning) - return GLib.unix_signal_add(*args) - GLib.unix_signal_add_full = add_full_compat +if hasattr(GLib, "unix_signal_add"): + unix_signal_add_full = GLib.unix_signal_add + __all__.append('unix_signal_add_full') + deprecated_attr("GLib", "unix_signal_add_full", "GLib.unix_signal_add") # obsolete constants for backwards compatibility glib_version = (GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION) __all__.append('glib_version') +deprecated_attr("GLib", "glib_version", + "(GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION)") + pyglib_version = version_info __all__.append('pyglib_version') +deprecated_attr("GLib", "pyglib_version", "gi.version_info") diff --git a/gi/overrides/GObject.py b/gi/overrides/GObject.py index b3aad47..823c0b0 100644 --- a/gi/overrides/GObject.py +++ b/gi/overrides/GObject.py @@ -21,28 +21,26 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -import sys -import warnings import functools +import warnings from collections import namedtuple -import gi.overrides import gi.module -from gi.overrides import override +from gi.overrides import override, deprecated_attr from gi.repository import GLib from gi import PyGIDeprecationWarning +from gi import _propertyhelper as propertyhelper +from gi import _signalhelper as signalhelper +from gi import _gi -from gi._gobject import _gobject -from gi._gobject import propertyhelper -from gi._gobject import signalhelper GObjectModule = gi.module.get_introspection_module('GObject') __all__ = [] -from gi._glib import option -sys.modules['gi._gobject.option'] = option +from gi import _option as option +option = option # API aliases for backwards compatibility @@ -56,10 +54,11 @@ for name in ['markup_escape_text', 'get_application_name', 'idle_add', 'timeout_add', 'timeout_add_seconds', 'io_add_watch', 'child_watch_add', 'get_current_time', 'spawn_async']: - globals()[name] = gi.overrides.deprecated(getattr(GLib, name), 'GLib.' + name) + globals()[name] = getattr(GLib, name) + deprecated_attr("GObject", name, "GLib." + name) __all__.append(name) -# constants are also deprecated, but cannot mark them as such +# deprecated constants for name in ['PRIORITY_DEFAULT', 'PRIORITY_DEFAULT_IDLE', 'PRIORITY_HIGH', 'PRIORITY_HIGH_IDLE', 'PRIORITY_LOW', 'IO_IN', 'IO_OUT', 'IO_PRI', 'IO_ERR', 'IO_HUP', 'IO_NVAL', @@ -77,25 +76,21 @@ for name in ['PRIORITY_DEFAULT', 'PRIORITY_DEFAULT_IDLE', 'PRIORITY_HIGH', 'OPTION_FLAG_NOALIAS', 'OPTION_ERROR_UNKNOWN_OPTION', 'OPTION_ERROR_BAD_VALUE', 'OPTION_ERROR_FAILED', 'OPTION_REMAINING', 'glib_version']: - globals()[name] = getattr(GLib, name) + with warnings.catch_warnings(): + # TODO: this uses deprecated Glib attributes, silence for now + warnings.simplefilter('ignore', PyGIDeprecationWarning) + globals()[name] = getattr(GLib, name) + deprecated_attr("GObject", name, "GLib." + name) __all__.append(name) -G_MININT8 = GLib.MININT8 -G_MAXINT8 = GLib.MAXINT8 -G_MAXUINT8 = GLib.MAXUINT8 -G_MININT16 = GLib.MININT16 -G_MAXINT16 = GLib.MAXINT16 -G_MAXUINT16 = GLib.MAXUINT16 -G_MININT32 = GLib.MININT32 -G_MAXINT32 = GLib.MAXINT32 -G_MAXUINT32 = GLib.MAXUINT32 -G_MININT64 = GLib.MININT64 -G_MAXINT64 = GLib.MAXINT64 -G_MAXUINT64 = GLib.MAXUINT64 -__all__ += ['G_MININT8', 'G_MAXINT8', 'G_MAXUINT8', 'G_MININT16', - 'G_MAXINT16', 'G_MAXUINT16', 'G_MININT32', 'G_MAXINT32', - 'G_MAXUINT32', 'G_MININT64', 'G_MAXINT64', 'G_MAXUINT64'] +for name in ['G_MININT8', 'G_MAXINT8', 'G_MAXUINT8', 'G_MININT16', + 'G_MAXINT16', 'G_MAXUINT16', 'G_MININT32', 'G_MAXINT32', + 'G_MAXUINT32', 'G_MININT64', 'G_MAXINT64', 'G_MAXUINT64']: + new_name = name.split("_", 1)[-1] + globals()[name] = getattr(GLib, new_name) + deprecated_attr("GObject", name, "GLib." + new_name) + __all__.append(name) # these are not currently exported in GLib gir, presumably because they are # platform dependent; so get them from our static bindings @@ -103,7 +98,9 @@ for name in ['G_MINFLOAT', 'G_MAXFLOAT', 'G_MINDOUBLE', 'G_MAXDOUBLE', 'G_MINSHORT', 'G_MAXSHORT', 'G_MAXUSHORT', 'G_MININT', 'G_MAXINT', 'G_MAXUINT', 'G_MINLONG', 'G_MAXLONG', 'G_MAXULONG', 'G_MAXSIZE', 'G_MINSSIZE', 'G_MAXSSIZE', 'G_MINOFFSET', 'G_MAXOFFSET']: - globals()[name] = getattr(_gobject, name) + new_name = name.split("_", 1)[-1] + globals()[name] = getattr(GLib, new_name) + deprecated_attr("GObject", name, "GLib." + new_name) __all__.append(name) @@ -145,69 +142,64 @@ __all__ += ['TYPE_INVALID', 'TYPE_NONE', 'TYPE_INTERFACE', 'TYPE_CHAR', # Deprecated, use GLib directly -Pid = GLib.Pid -GError = GLib.GError -OptionGroup = GLib.OptionGroup -OptionContext = GLib.OptionContext -__all__ += ['Pid', 'GError', 'OptionGroup', 'OptionContext'] +for name in ['Pid', 'GError', 'OptionGroup', 'OptionContext']: + globals()[name] = getattr(GLib, name) + deprecated_attr("GObject", name, "GLib." + name) + __all__.append(name) # Deprecated, use: GObject.ParamFlags.* directly -PARAM_CONSTRUCT = GObjectModule.ParamFlags.CONSTRUCT -PARAM_CONSTRUCT_ONLY = GObjectModule.ParamFlags.CONSTRUCT_ONLY -PARAM_LAX_VALIDATION = GObjectModule.ParamFlags.LAX_VALIDATION -PARAM_READABLE = GObjectModule.ParamFlags.READABLE -PARAM_WRITABLE = GObjectModule.ParamFlags.WRITABLE +for name in ['PARAM_CONSTRUCT', 'PARAM_CONSTRUCT_ONLY', 'PARAM_LAX_VALIDATION', + 'PARAM_READABLE', 'PARAM_WRITABLE']: + new_name = name.split("_", 1)[-1] + globals()[name] = getattr(GObjectModule.ParamFlags, new_name) + deprecated_attr("GObject", name, "GObject.ParamFlags." + new_name) + __all__.append(name) + # PARAM_READWRITE should come from the gi module but cannot due to: -# https://bugzilla.gnome.org/show_bug.cgi?id=687615 -PARAM_READWRITE = PARAM_READABLE | PARAM_WRITABLE -__all__ += ['PARAM_CONSTRUCT', 'PARAM_CONSTRUCT_ONLY', 'PARAM_LAX_VALIDATION', - 'PARAM_READABLE', 'PARAM_WRITABLE', 'PARAM_READWRITE'] +# https://gitlab.gnome.org/GNOME/gobject-introspection/issues/75 +PARAM_READWRITE = GObjectModule.ParamFlags.READABLE | \ + GObjectModule.ParamFlags.WRITABLE +deprecated_attr("GObject", "PARAM_READWRITE", "GObject.ParamFlags.READWRITE") +__all__.append("PARAM_READWRITE") # Deprecated, use: GObject.SignalFlags.* directly -SIGNAL_ACTION = GObjectModule.SignalFlags.ACTION -SIGNAL_DETAILED = GObjectModule.SignalFlags.DETAILED -SIGNAL_NO_HOOKS = GObjectModule.SignalFlags.NO_HOOKS -SIGNAL_NO_RECURSE = GObjectModule.SignalFlags.NO_RECURSE -SIGNAL_RUN_CLEANUP = GObjectModule.SignalFlags.RUN_CLEANUP -SIGNAL_RUN_FIRST = GObjectModule.SignalFlags.RUN_FIRST -SIGNAL_RUN_LAST = GObjectModule.SignalFlags.RUN_LAST -__all__ += ['SIGNAL_ACTION', 'SIGNAL_DETAILED', 'SIGNAL_NO_HOOKS', - 'SIGNAL_NO_RECURSE', 'SIGNAL_RUN_CLEANUP', 'SIGNAL_RUN_FIRST', - 'SIGNAL_RUN_LAST'] - +for name in ['SIGNAL_ACTION', 'SIGNAL_DETAILED', 'SIGNAL_NO_HOOKS', + 'SIGNAL_NO_RECURSE', 'SIGNAL_RUN_CLEANUP', 'SIGNAL_RUN_FIRST', + 'SIGNAL_RUN_LAST']: + new_name = name.split("_", 1)[-1] + globals()[name] = getattr(GObjectModule.SignalFlags, new_name) + deprecated_attr("GObject", name, "GObject.SignalFlags." + new_name) + __all__.append(name) # Static types -GBoxed = _gobject.GBoxed -GEnum = _gobject.GEnum -GFlags = _gobject.GFlags -GInterface = _gobject.GInterface -GObject = _gobject.GObject -GObjectWeakRef = _gobject.GObjectWeakRef -GParamSpec = _gobject.GParamSpec -GPointer = _gobject.GPointer -GType = _gobject.GType -Warning = _gobject.Warning +GBoxed = _gi.GBoxed +GEnum = _gi.GEnum +GFlags = _gi.GFlags +GInterface = _gi.GInterface +GObject = _gi.GObject +GObjectWeakRef = _gi.GObjectWeakRef +GParamSpec = _gi.GParamSpec +GPointer = _gi.GPointer +GType = _gi.GType +Warning = _gi.Warning __all__ += ['GBoxed', 'GEnum', 'GFlags', 'GInterface', 'GObject', 'GObjectWeakRef', 'GParamSpec', 'GPointer', 'GType', 'Warning'] -features = _gobject.features -list_properties = _gobject.list_properties -new = _gobject.new -pygobject_version = _gobject.pygobject_version +features = {'generic-c-marshaller': True} +list_properties = _gi.list_properties +new = _gi.new +pygobject_version = _gi.pygobject_version threads_init = GLib.threads_init -type_register = _gobject.type_register +type_register = _gi.type_register __all__ += ['features', 'list_properties', 'new', 'pygobject_version', 'threads_init', 'type_register'] class Value(GObjectModule.Value): - def __new__(cls, *args, **kwargs): - return GObjectModule.Value.__new__(cls) - def __init__(self, value_type=None, py_value=None): GObjectModule.Value.__init__(self) if value_type is not None: @@ -215,136 +207,91 @@ class Value(GObjectModule.Value): if py_value is not None: self.set_value(py_value) - def __del__(self): - if self._free_on_dealloc and self.g_type != TYPE_INVALID: - self.unset() + @property + def __g_type(self): + # XXX: This is the same as self.g_type, but the field marshalling + # code is currently very slow. + return _gi._gvalue_get_type(self) def set_boxed(self, boxed): + if not self.__g_type.is_a(TYPE_BOXED): + warnings.warn('Calling set_boxed() on a non-boxed type deprecated', + PyGIDeprecationWarning, stacklevel=2) # Workaround the introspection marshalers inability to know # these methods should be marshaling boxed types. This is because # the type information is stored on the GValue. - _gobject._gvalue_set(self, boxed) + _gi._gvalue_set(self, boxed) def get_boxed(self): - return _gobject._gvalue_get(self) + if not self.__g_type.is_a(TYPE_BOXED): + warnings.warn('Calling get_boxed() on a non-boxed type deprecated', + PyGIDeprecationWarning, stacklevel=2) + return _gi._gvalue_get(self) def set_value(self, py_value): - gtype = self.g_type + gtype = self.__g_type - if gtype == _gobject.TYPE_INVALID: - raise TypeError("GObject.Value needs to be initialized first") - elif gtype == TYPE_BOOLEAN: - self.set_boolean(py_value) - elif gtype == TYPE_CHAR: + if gtype == TYPE_CHAR: self.set_char(py_value) elif gtype == TYPE_UCHAR: self.set_uchar(py_value) - elif gtype == TYPE_INT: - self.set_int(py_value) - elif gtype == TYPE_UINT: - self.set_uint(py_value) - elif gtype == TYPE_LONG: - self.set_long(py_value) - elif gtype == TYPE_ULONG: - self.set_ulong(py_value) - elif gtype == TYPE_INT64: - self.set_int64(py_value) - elif gtype == TYPE_UINT64: - self.set_uint64(py_value) - elif gtype == TYPE_FLOAT: - self.set_float(py_value) - elif gtype == TYPE_DOUBLE: - self.set_double(py_value) elif gtype == TYPE_STRING: - if isinstance(py_value, str): - py_value = str(py_value) - elif sys.version_info < (3, 0): - if isinstance(py_value, unicode): - py_value = py_value.encode('UTF-8') - else: - raise ValueError("Expected string or unicode but got %s%s" % - (py_value, type(py_value))) - else: - raise ValueError("Expected string but got %s%s" % - (py_value, type(py_value))) - self.set_string(py_value) + if not isinstance(py_value, str) and py_value is not None: + raise TypeError("Expected string but got %s%s" % + (py_value, type(py_value))) + _gi._gvalue_set(self, py_value) elif gtype == TYPE_PARAM: self.set_param(py_value) - elif gtype.is_a(TYPE_ENUM): - self.set_enum(py_value) elif gtype.is_a(TYPE_FLAGS): self.set_flags(py_value) - elif gtype.is_a(TYPE_BOXED): - self.set_boxed(py_value) elif gtype == TYPE_POINTER: self.set_pointer(py_value) - elif gtype.is_a(TYPE_OBJECT): - self.set_object(py_value) - elif gtype == TYPE_UNICHAR: - self.set_uint(int(py_value)) - # elif gtype == TYPE_OVERRIDE: - # pass elif gtype == TYPE_GTYPE: self.set_gtype(py_value) elif gtype == TYPE_VARIANT: self.set_variant(py_value) - elif gtype == TYPE_PYOBJECT: - self.set_boxed(py_value) else: - raise TypeError("Unknown value type %s" % gtype) + # Fall back to _gvalue_set which handles some more cases + # like fundamentals for which a converter is registered + try: + _gi._gvalue_set(self, py_value) + except TypeError: + if gtype == TYPE_INVALID: + raise TypeError("GObject.Value needs to be initialized first") + raise def get_value(self): - gtype = self.g_type + gtype = self.__g_type - if gtype == TYPE_BOOLEAN: - return self.get_boolean() - elif gtype == TYPE_CHAR: + if gtype == TYPE_CHAR: return self.get_char() elif gtype == TYPE_UCHAR: return self.get_uchar() - elif gtype == TYPE_INT: - return self.get_int() - elif gtype == TYPE_UINT: - return self.get_uint() - elif gtype == TYPE_LONG: - return self.get_long() - elif gtype == TYPE_ULONG: - return self.get_ulong() - elif gtype == TYPE_INT64: - return self.get_int64() - elif gtype == TYPE_UINT64: - return self.get_uint64() - elif gtype == TYPE_FLOAT: - return self.get_float() - elif gtype == TYPE_DOUBLE: - return self.get_double() - elif gtype == TYPE_STRING: - return self.get_string() elif gtype == TYPE_PARAM: return self.get_param() elif gtype.is_a(TYPE_ENUM): return self.get_enum() elif gtype.is_a(TYPE_FLAGS): return self.get_flags() - elif gtype.is_a(TYPE_BOXED): - return self.get_boxed() elif gtype == TYPE_POINTER: return self.get_pointer() - elif gtype.is_a(TYPE_OBJECT): - return self.get_object() - elif gtype == TYPE_UNICHAR: - return self.get_uint() elif gtype == TYPE_GTYPE: return self.get_gtype() elif gtype == TYPE_VARIANT: - return self.get_variant() - elif gtype == TYPE_PYOBJECT: - pass + # get_variant was missing annotations + # https://gitlab.gnome.org/GNOME/glib/merge_requests/492 + return self.dup_variant() else: - return None + try: + return _gi._gvalue_get(self) + except TypeError: + if gtype == TYPE_INVALID: + return None + raise def __repr__(self): - return '' % (self.g_type.name, self.get_value()) + return '' % (self.__g_type.name, self.get_value()) + Value = override(Value) __all__.append('Value') @@ -356,6 +303,7 @@ def type_from_name(name): raise RuntimeError('unknown type name: %s' % name) return type_ + __all__.append('type_from_name') @@ -365,6 +313,7 @@ def type_parent(type_): raise RuntimeError('no parent for type') return parent + __all__.append('type_parent') @@ -379,6 +328,7 @@ def signal_list_ids(type_): _validate_type_for_signal_method(type_) return GObjectModule.signal_list_ids(type_) + __all__.append('signal_list_ids') @@ -386,6 +336,7 @@ def signal_list_names(type_): ids = signal_list_ids(type_) return tuple(GObjectModule.signal_name(i) for i in ids) + __all__.append('signal_list_names') @@ -393,51 +344,40 @@ def signal_lookup(name, type_): _validate_type_for_signal_method(type_) return GObjectModule.signal_lookup(name, type_) + __all__.append('signal_lookup') +SignalQuery = namedtuple('SignalQuery', + ['signal_id', + 'signal_name', + 'itype', + 'signal_flags', + 'return_type', + # n_params', + 'param_types']) + + def signal_query(id_or_name, type_=None): - SignalQuery = namedtuple('SignalQuery', - ['signal_id', - 'signal_name', - 'itype', - 'signal_flags', - 'return_type', - # n_params', - 'param_types']) - - # signal_query needs to use a static method until the following bugs are fixed: - # https://bugzilla.gnome.org/show_bug.cgi?id=687550 - # https://bugzilla.gnome.org/show_bug.cgi?id=687545 - # https://bugzilla.gnome.org/show_bug.cgi?id=687541 if type_ is not None: id_or_name = signal_lookup(id_or_name, type_) - res = _gobject.signal_query(id_or_name) - if res is None: - return None - - # Return a named tuple which allows indexing like the static bindings - # along with field like access of the gi struct. - # Note however that the n_params was not returned from the static bindings. - return SignalQuery(*res) - -__all__.append('signal_query') + res = GObjectModule.signal_query(id_or_name) + assert res is not None + if res.signal_id == 0: + return None -# Check needed for glib versions which annotate signal related methods -# with a void pointer instead of GObject.Object. -# See: https://bugzilla.gnome.org/show_bug.cgi?id=685387 -_is_first_signal_arg_void = GObjectModule.signal_stop_emission.get_arguments()[0].get_pytype_hint() == 'void' + # Return a named tuple to allows indexing which is compatible with the + # static bindings along with field like access of the gi struct. + # Note however that the n_params was not returned from the static bindings + # so we must skip over it. + return SignalQuery(res.signal_id, res.signal_name, res.itype, + res.signal_flags, res.return_type, + tuple(res.param_types)) -def _get_instance_for_signal(obj): - if not _is_first_signal_arg_void: - return obj - elif isinstance(obj, GObjectModule.Object): - return obj.__gpointer__ - else: - raise TypeError('Unsupported object "%s" for signal function' % obj) +__all__.append('signal_query') class _HandlerBlockManager(object): @@ -449,75 +389,43 @@ class _HandlerBlockManager(object): pass def __exit__(self, exc_type, exc_value, traceback): - signal_handler_unblock(self.obj, self.handler_id) + GObjectModule.signal_handler_unblock(self.obj, self.handler_id) def signal_handler_block(obj, handler_id): - """Blocks the signal handler from being invoked until handler_unblock() is called. + """Blocks the signal handler from being invoked until + handler_unblock() is called. - Returns a context manager which optionally can be used to - automatically unblock the handler: + :param GObject.Object obj: + Object instance to block handlers for. + :param int handler_id: + Id of signal to block. + :returns: + A context manager which optionally can be used to + automatically unblock the handler: - with GObject.signal_handler_block(obj, id): - pass + .. code-block:: python + + with GObject.signal_handler_block(obj, id): + pass """ - GObjectModule.signal_handler_block(_get_instance_for_signal(obj), handler_id) + GObjectModule.signal_handler_block(obj, handler_id) return _HandlerBlockManager(obj, handler_id) -__all__.append('signal_handler_block') - -if _is_first_signal_arg_void: - # The following functions wrap GI functions but coerce the first arg into - # something compatible with gpointer - - def _wrap_signal_func(func): - @functools.wraps(func) - def wrapper(obj, *args, **kwargs): - return func(_get_instance_for_signal(obj), *args, **kwargs) - return wrapper - - signal_handler_unblock = _wrap_signal_func(GObjectModule.signal_handler_unblock) - signal_handler_disconnect = _wrap_signal_func(GObjectModule.signal_handler_disconnect) - signal_handler_is_connected = _wrap_signal_func(GObjectModule.signal_handler_is_connected) - signal_stop_emission = _wrap_signal_func(GObjectModule.signal_stop_emission) - signal_stop_emission_by_name = _wrap_signal_func(GObjectModule.signal_stop_emission_by_name) - signal_has_handler_pending = _wrap_signal_func(GObjectModule.signal_has_handler_pending) - signal_get_invocation_hint = _wrap_signal_func(GObjectModule.signal_get_invocation_hint) - signal_connect_closure = _wrap_signal_func(GObjectModule.signal_connect_closure) - signal_connect_closure_by_id = _wrap_signal_func(GObjectModule.signal_connect_closure_by_id) - signal_handler_find = _wrap_signal_func(GObjectModule.signal_handler_find) - signal_handlers_destroy = _wrap_signal_func(GObjectModule.signal_handlers_destroy) - signal_handlers_block_matched = _wrap_signal_func(GObjectModule.signal_handlers_block_matched) - signal_handlers_unblock_matched = _wrap_signal_func(GObjectModule.signal_handlers_unblock_matched) - signal_handlers_disconnect_matched = _wrap_signal_func(GObjectModule.signal_handlers_disconnect_matched) - - __all__ += ['signal_handler_unblock', - 'signal_handler_disconnect', 'signal_handler_is_connected', - 'signal_stop_emission', 'signal_stop_emission_by_name', - 'signal_has_handler_pending', 'signal_get_invocation_hint', - 'signal_connect_closure', 'signal_connect_closure_by_id', - 'signal_handler_find', 'signal_handlers_destroy', - 'signal_handlers_block_matched', 'signal_handlers_unblock_matched', - 'signal_handlers_disconnect_matched'] -else: - # First signal arg is GObject.Object but we need these as globals for - # our GObject.Object class override below - signal_handler_disconnect = GObjectModule.signal_handler_disconnect - signal_handler_unblock = GObjectModule.signal_handler_unblock - signal_handler_disconnect = GObjectModule.signal_handler_disconnect - signal_handler_is_connected = GObjectModule.signal_handler_is_connected - signal_stop_emission_by_name = GObjectModule.signal_stop_emission_by_name +__all__.append('signal_handler_block') def signal_parse_name(detailed_signal, itype, force_detail_quark): """Parse a detailed signal name into (signal_id, detail). - :Raises ValueError: - If the given signal is unknown. - - :Returns: + :param str detailed_signal: + Signal name which can include detail. + For example: "notify:prop_name" + :returns: Tuple of (signal_id, detail) + :raises ValueError: + If the given signal is unknown. """ res, signal_id, detail = GObjectModule.signal_parse_name(detailed_signal, itype, force_detail_quark) @@ -526,6 +434,7 @@ def signal_parse_name(detailed_signal, itype, force_detail_quark): else: raise ValueError('%s: unknown signal name: %s' % (itype, detailed_signal)) + __all__.append('signal_parse_name') @@ -533,6 +442,7 @@ def remove_emission_hook(obj, detailed_signal, hook_id): signal_id, detail = signal_parse_name(detailed_signal, obj, True) GObjectModule.signal_remove_emission_hook(signal_id, hook_id) + __all__.append('remove_emission_hook') @@ -543,6 +453,7 @@ def signal_accumulator_first_wins(ihint, return_accu, handler_return, user_data= # Stop emission but return the result of the last handler return (False, handler_return) + __all__.append('signal_accumulator_first_wins') @@ -550,13 +461,14 @@ def signal_accumulator_true_handled(ihint, return_accu, handler_return, user_dat # Stop emission if the last handler returns True return (not handler_return, handler_return) + __all__.append('signal_accumulator_true_handled') # Statically bound signal functions which need to clobber GI (for now) -add_emission_hook = _gobject.add_emission_hook -signal_new = _gobject.signal_new +add_emission_hook = _gi.add_emission_hook +signal_new = _gi.signal_new __all__ += ['add_emission_hook', 'signal_new'] @@ -608,7 +520,6 @@ class Object(GObjectModule.Object): interface_install_property = _unsupported_method interface_list_properties = _unsupported_method notify_by_pspec = _unsupported_method - run_dispose = _unsupported_method watch_closure = _unsupported_method # Make all reference management methods private but still accessible. @@ -624,49 +535,89 @@ class Object(GObjectModule.Object): # The following methods are static APIs which need to leap frog the # gi methods until we verify the gi methods can replace them. - get_property = _gobject.GObject.get_property - get_properties = _gobject.GObject.get_properties - set_property = _gobject.GObject.set_property - set_properties = _gobject.GObject.set_properties - bind_property = _gobject.GObject.bind_property - connect = _gobject.GObject.connect - connect_after = _gobject.GObject.connect_after - connect_object = _gobject.GObject.connect_object - connect_object_after = _gobject.GObject.connect_object_after - disconnect_by_func = _gobject.GObject.disconnect_by_func - handler_block_by_func = _gobject.GObject.handler_block_by_func - handler_unblock_by_func = _gobject.GObject.handler_unblock_by_func - emit = _gobject.GObject.emit - chain = _gobject.GObject.chain - weak_ref = _gobject.GObject.weak_ref - __copy__ = _gobject.GObject.__copy__ - __deepcopy__ = _gobject.GObject.__deepcopy__ + get_property = _gi.GObject.get_property + get_properties = _gi.GObject.get_properties + set_property = _gi.GObject.set_property + set_properties = _gi.GObject.set_properties + bind_property = _gi.GObject.bind_property + connect = _gi.GObject.connect + connect_after = _gi.GObject.connect_after + connect_object = _gi.GObject.connect_object + connect_object_after = _gi.GObject.connect_object_after + disconnect_by_func = _gi.GObject.disconnect_by_func + handler_block_by_func = _gi.GObject.handler_block_by_func + handler_unblock_by_func = _gi.GObject.handler_unblock_by_func + emit = _gi.GObject.emit + chain = _gi.GObject.chain + weak_ref = _gi.GObject.weak_ref + __copy__ = _gi.GObject.__copy__ + __deepcopy__ = _gi.GObject.__deepcopy__ def freeze_notify(self): """Freezes the object's property-changed notification queue. + :returns: + A context manager which optionally can be used to + automatically thaw notifications. + This will freeze the object so that "notify" signals are blocked until the thaw_notify() method is called. - Returns a context manager which optionally can be used to - automatically thaw notifications: + .. code-block:: python - with obj.freeze_notify(): - pass + with obj.freeze_notify(): + pass """ super(Object, self).freeze_notify() return _FreezeNotifyManager(self) + def connect_data(self, detailed_signal, handler, *data, **kwargs): + """Connect a callback to the given signal with optional user data. + + :param str detailed_signal: + A detailed signal to connect to. + :param callable handler: + Callback handler to connect to the signal. + :param *data: + Variable data which is passed through to the signal handler. + :param GObject.ConnectFlags connect_flags: + Flags used for connection options. + :returns: + A signal id which can be used with disconnect. + """ + flags = kwargs.get('connect_flags', 0) + if flags & GObjectModule.ConnectFlags.AFTER: + connect_func = _gi.GObject.connect_after + else: + connect_func = _gi.GObject.connect + + if flags & GObjectModule.ConnectFlags.SWAPPED: + if len(data) != 1: + raise ValueError('Using GObject.ConnectFlags.SWAPPED requires exactly ' + 'one argument for user data, got: %s' % [data]) + + def new_handler(obj, *args): + # Swap obj with the last element in args which will be the user + # data passed to the connect function. + args = list(args) + swap = args.pop() + args = args + [obj] + return handler(swap, *args) + else: + new_handler = handler + + return connect_func(self, detailed_signal, new_handler, *data) + # # Aliases # - disconnect = _signalmethod(signal_handler_disconnect) - handler_block = _signalmethod(signal_handler_block) - handler_unblock = _signalmethod(signal_handler_unblock) - handler_disconnect = _signalmethod(signal_handler_disconnect) - handler_is_connected = _signalmethod(signal_handler_is_connected) - stop_emission_by_name = _signalmethod(signal_stop_emission_by_name) + handler_block = signal_handler_block + handler_unblock = _signalmethod(GObjectModule.signal_handler_unblock) + disconnect = _signalmethod(GObjectModule.signal_handler_disconnect) + handler_disconnect = _signalmethod(GObjectModule.signal_handler_disconnect) + handler_is_connected = _signalmethod(GObjectModule.signal_handler_is_connected) + stop_emission_by_name = _signalmethod(GObjectModule.signal_stop_emission_by_name) # # Deprecated Methods @@ -675,7 +626,7 @@ class Object(GObjectModule.Object): def stop_emission(self, detailed_signal): """Deprecated, please use stop_emission_by_name.""" warnings.warn(self.stop_emission.__doc__, PyGIDeprecationWarning, stacklevel=2) - return signal_stop_emission_by_name(self, detailed_signal) + return self.stop_emission_by_name(detailed_signal) emit_stop_by_name = stop_emission @@ -685,10 +636,34 @@ GObject = Object __all__ += ['Object', 'GObject'] +class Binding(GObjectModule.Binding): + def __call__(self): + warnings.warn('Using parentheses (binding()) to retrieve the Binding object is no ' + 'longer needed because the binding is returned directly from "bind_property.', + PyGIDeprecationWarning, stacklevel=2) + return self + + def unbind(self): + # Fixed in newer glib + if (GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION) >= (2, 57, 3): + return super(Binding, self).unbind() + + if hasattr(self, '_unbound'): + raise ValueError('binding has already been cleared out') + else: + setattr(self, '_unbound', True) + super(Binding, self).unbind() + + +Binding = override(Binding) +__all__.append('Binding') + + Property = propertyhelper.Property Signal = signalhelper.Signal SignalOverride = signalhelper.SignalOverride # Deprecated naming "property" available for backwards compatibility. # Keep this at the end of the file to avoid clobbering the builtin. property = Property +deprecated_attr("GObject", "property", "GObject.Property") __all__ += ['Property', 'Signal', 'SignalOverride', 'property'] diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py index 14edc70..73f309f 100644 --- a/gi/overrides/Gdk.py +++ b/gi/overrides/Gdk.py @@ -19,60 +19,80 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA +import sys +import warnings + from ..overrides import override, strip_boolean_result from ..module import get_introspection_module - -import sys +from gi import PyGIDeprecationWarning, require_version Gdk = get_introspection_module('Gdk') +GDK2 = Gdk._version == '2.0' +GDK3 = Gdk._version == '3.0' +GDK4 = Gdk._version == '4.0' __all__ = [] -class Color(Gdk.Color): - MAX_VALUE = 65535 +# https://bugzilla.gnome.org/show_bug.cgi?id=673396 +try: + require_version("GdkX11", Gdk._version) + from gi.repository import GdkX11 + GdkX11 # pyflakes +except (ValueError, ImportError): + pass - def __init__(self, red, green, blue): - Gdk.Color.__init__(self) - self.red = red - self.green = green - self.blue = blue +if GDK2 or GDK3: + # Gdk.Color was deprecated since 3.14 and dropped in Gtk-4.0 + class Color(Gdk.Color): + MAX_VALUE = 65535 + + def __init__(self, red, green, blue): + Gdk.Color.__init__(self) + self.red = red + self.green = green + self.blue = blue - def __new__(cls, *args, **kwargs): - return Gdk.Color.__new__(cls) + def __eq__(self, other): + if not isinstance(other, Gdk.Color): + return False + return self.equal(other) - def __eq__(self, other): - return self.equal(other) + # This is required (even when __eq__ is defined) in order + # for != operator to work as expected + def __ne__(self, other): + return not self == other - def __repr__(self): - return '' % (self.red, self.green, self.blue) + def __repr__(self): + return 'Gdk.Color(red=%d, green=%d, blue=%d)' % (self.red, self.green, self.blue) - red_float = property(fget=lambda self: self.red / float(self.MAX_VALUE), - fset=lambda self, v: setattr(self, 'red', int(v * self.MAX_VALUE))) + red_float = property(fget=lambda self: self.red / float(self.MAX_VALUE), + fset=lambda self, v: setattr(self, 'red', int(v * self.MAX_VALUE))) - green_float = property(fget=lambda self: self.green / float(self.MAX_VALUE), - fset=lambda self, v: setattr(self, 'green', int(v * self.MAX_VALUE))) + green_float = property(fget=lambda self: self.green / float(self.MAX_VALUE), + fset=lambda self, v: setattr(self, 'green', int(v * self.MAX_VALUE))) - blue_float = property(fget=lambda self: self.blue / float(self.MAX_VALUE), - fset=lambda self, v: setattr(self, 'blue', int(v * self.MAX_VALUE))) + blue_float = property(fget=lambda self: self.blue / float(self.MAX_VALUE), + fset=lambda self, v: setattr(self, 'blue', int(v * self.MAX_VALUE))) - def to_floats(self): - """Return (red_float, green_float, blue_float) triple.""" + def to_floats(self): + """Return (red_float, green_float, blue_float) triple.""" - return (self.red_float, self.green_float, self.blue_float) + return (self.red_float, self.green_float, self.blue_float) - @staticmethod - def from_floats(red, green, blue): - """Return a new Color object from red/green/blue values from 0.0 to 1.0.""" + @staticmethod + def from_floats(red, green, blue): + """Return a new Color object from red/green/blue values from 0.0 to 1.0.""" - return Color(int(red * Color.MAX_VALUE), - int(green * Color.MAX_VALUE), - int(blue * Color.MAX_VALUE)) + return Color(int(red * Color.MAX_VALUE), + int(green * Color.MAX_VALUE), + int(blue * Color.MAX_VALUE)) -Color = override(Color) -__all__.append('Color') + Color = override(Color) + __all__.append('Color') -if Gdk._version == '3.0': +if GDK3: + # Introduced since Gtk-3.0 class RGBA(Gdk.RGBA): def __init__(self, red=1.0, green=1.0, blue=1.0, alpha=1.0): Gdk.RGBA.__init__(self) @@ -81,14 +101,18 @@ if Gdk._version == '3.0': self.blue = blue self.alpha = alpha - def __new__(cls, *args, **kwargs): - return Gdk.RGBA.__new__(cls) - def __eq__(self, other): + if not isinstance(other, Gdk.RGBA): + return False return self.equal(other) + # This is required (even when __eq__ is defined) in order + # for != operator to work as expected + def __ne__(self, other): + return not self == other + def __repr__(self): - return '' % (self.red, self.green, self.blue, self.alpha) + return 'Gdk.RGBA(red=%f, green=%f, blue=%f, alpha=%f)' % (self.red, self.green, self.blue, self.alpha) def __iter__(self): """Iterator which allows easy conversion to tuple and list types.""" @@ -114,7 +138,7 @@ if Gdk._version == '3.0': RGBA = override(RGBA) __all__.append('RGBA') -if Gdk._version == '2.0': +if GDK2: class Rectangle(Gdk.Rectangle): def __init__(self, x, y, width, height): @@ -124,28 +148,37 @@ if Gdk._version == '2.0': self.width = width self.height = height - def __new__(cls, *args, **kwargs): - return Gdk.Rectangle.__new__(cls) - def __repr__(self): - return '' % (self.x, self.y, self.height, self.width) + return 'Gdk.Rectangle(x=%d, y=%d, width=%d, height=%d)' % (self.x, self.y, self.height, self.width) Rectangle = override(Rectangle) __all__.append('Rectangle') -else: - from gi.repository import cairo as _cairo - Rectangle = _cairo.RectangleInt - - __all__.append('Rectangle') - -if Gdk._version == '2.0': +elif GDK3: + # Newer GTK/gobject-introspection (3.17.x) include GdkRectangle in the + # typelib. See https://bugzilla.gnome.org/show_bug.cgi?id=748832 and + # https://bugzilla.gnome.org/show_bug.cgi?id=748833 + if not hasattr(Gdk, 'Rectangle'): + from gi.repository import cairo as _cairo + Rectangle = _cairo.RectangleInt + + __all__.append('Rectangle') + else: + # https://bugzilla.gnome.org/show_bug.cgi?id=756364 + # These methods used to be functions, keep aliases for backwards compat + rectangle_intersect = Gdk.Rectangle.intersect + rectangle_union = Gdk.Rectangle.union + + __all__.append('rectangle_intersect') + __all__.append('rectangle_union') + +if GDK2: class Drawable(Gdk.Drawable): def cairo_create(self): return Gdk.cairo_create(self) Drawable = override(Drawable) __all__.append('Drawable') -else: +elif GDK3: class Window(Gdk.Window): def __new__(cls, parent, attributes, attributes_mask): # Gdk.Window had to be made abstract, @@ -161,195 +194,243 @@ else: Window = override(Window) __all__.append('Window') -Gdk.EventType._2BUTTON_PRESS = getattr(Gdk.EventType, "2BUTTON_PRESS") -Gdk.EventType._3BUTTON_PRESS = getattr(Gdk.EventType, "3BUTTON_PRESS") - - -class Event(Gdk.Event): - _UNION_MEMBERS = { - Gdk.EventType.DELETE: 'any', - Gdk.EventType.DESTROY: 'any', - Gdk.EventType.EXPOSE: 'expose', - Gdk.EventType.MOTION_NOTIFY: 'motion', - Gdk.EventType.BUTTON_PRESS: 'button', - Gdk.EventType._2BUTTON_PRESS: 'button', - Gdk.EventType._3BUTTON_PRESS: 'button', - Gdk.EventType.BUTTON_RELEASE: 'button', - Gdk.EventType.KEY_PRESS: 'key', - Gdk.EventType.KEY_RELEASE: 'key', - Gdk.EventType.ENTER_NOTIFY: 'crossing', - Gdk.EventType.LEAVE_NOTIFY: 'crossing', - Gdk.EventType.FOCUS_CHANGE: 'focus_change', - Gdk.EventType.CONFIGURE: 'configure', - Gdk.EventType.MAP: 'any', - Gdk.EventType.UNMAP: 'any', - Gdk.EventType.PROPERTY_NOTIFY: 'property', - Gdk.EventType.SELECTION_CLEAR: 'selection', - Gdk.EventType.SELECTION_REQUEST: 'selection', - Gdk.EventType.SELECTION_NOTIFY: 'selection', - Gdk.EventType.PROXIMITY_IN: 'proximity', - Gdk.EventType.PROXIMITY_OUT: 'proximity', - Gdk.EventType.DRAG_ENTER: 'dnd', - Gdk.EventType.DRAG_LEAVE: 'dnd', - Gdk.EventType.DRAG_MOTION: 'dnd', - Gdk.EventType.DRAG_STATUS: 'dnd', - Gdk.EventType.DROP_START: 'dnd', - Gdk.EventType.DROP_FINISHED: 'dnd', - Gdk.EventType.CLIENT_EVENT: 'client', - Gdk.EventType.VISIBILITY_NOTIFY: 'visibility', - } - - if Gdk._version == '2.0': - _UNION_MEMBERS[Gdk.EventType.NO_EXPOSE] = 'no_expose' - - def __new__(cls, *args, **kwargs): - return Gdk.Event.__new__(cls) - - def __getattr__(self, name): - real_event = getattr(self, '_UNION_MEMBERS').get(self.type) - if real_event: - return getattr(getattr(self, real_event), name) - else: - raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name)) - -Event = override(Event) -__all__.append('Event') - -# manually bind GdkEvent members to GdkEvent - -modname = globals()['__name__'] -module = sys.modules[modname] - -# right now we can't get the type_info from the -# field info so manually list the class names -event_member_classes = ['EventAny', - 'EventExpose', - 'EventVisibility', - 'EventMotion', - 'EventButton', - 'EventScroll', - 'EventKey', - 'EventCrossing', - 'EventFocus', - 'EventConfigure', - 'EventProperty', - 'EventSelection', - 'EventOwnerChange', - 'EventProximity', - 'EventDND', - 'EventWindowState', - 'EventSetting', - 'EventGrabBroken'] - -if Gdk._version == '2.0': - event_member_classes.append('EventNoExpose') - -# whitelist all methods that have a success return we want to mask -gsuccess_mask_funcs = ['get_state', - 'get_axis', - 'get_coords', - 'get_root_coords'] - - -for event_class in event_member_classes: - override_class = type(event_class, (getattr(Gdk, event_class),), {}) - # add the event methods - for method_info in Gdk.Event.__info__.get_methods(): - name = method_info.get_name() - event_method = getattr(Gdk.Event, name) - # python2 we need to use the __func__ attr to avoid internal - # instance checks - event_method = getattr(event_method, '__func__', event_method) - - # use the _gsuccess_mask decorator if this method is whitelisted - if name in gsuccess_mask_funcs: - event_method = strip_boolean_result(event_method) - setattr(override_class, name, event_method) - - setattr(module, event_class, override_class) - __all__.append(event_class) - -# end GdkEvent overrides - - -class DragContext(Gdk.DragContext): - def finish(self, success, del_, time): - Gtk = get_introspection_module('Gtk') - Gtk.drag_finish(self, success, del_, time) - -DragContext = override(DragContext) -__all__.append('DragContext') - - -class Cursor(Gdk.Cursor): - def __new__(cls, *args, **kwds): - arg_len = len(args) - kwd_len = len(kwds) - total_len = arg_len + kwd_len - - def _new(cursor_type): - return cls.new(cursor_type) - - def _new_for_display(display, cursor_type): - return cls.new_for_display(display, cursor_type) - - def _new_from_pixbuf(display, pixbuf, x, y): - return cls.new_from_pixbuf(display, pixbuf, x, y) - - def _new_from_pixmap(source, mask, fg, bg, x, y): - return cls.new_from_pixmap(source, mask, fg, bg, x, y) - - _constructor = None - if total_len == 1: - _constructor = _new - elif total_len == 2: - _constructor = _new_for_display - elif total_len == 4: - _constructor = _new_from_pixbuf - elif total_len == 6: - if Gdk._version != '2.0': - # pixmaps don't exist in Gdk 3.0 - raise ValueError("Wrong number of parameters") - _constructor = _new_from_pixmap - else: - raise ValueError("Wrong number of parameters") - - return _constructor(*args, **kwds) - - def __init__(self, *args, **kwargs): - Gdk.Cursor.__init__(self) - -Cursor = override(Cursor) -__all__.append('Cursor') - -color_parse = strip_boolean_result(Gdk.color_parse) -__all__.append('color_parse') +if GDK2 or GDK3: + Gdk.EventType._2BUTTON_PRESS = getattr(Gdk.EventType, "2BUTTON_PRESS") + Gdk.EventType._3BUTTON_PRESS = getattr(Gdk.EventType, "3BUTTON_PRESS") + + class Event(Gdk.Event): + _UNION_MEMBERS = { + Gdk.EventType.DELETE: 'any', + Gdk.EventType.DESTROY: 'any', + Gdk.EventType.MOTION_NOTIFY: 'motion', + Gdk.EventType.BUTTON_PRESS: 'button', + Gdk.EventType.BUTTON_RELEASE: 'button', + Gdk.EventType.KEY_PRESS: 'key', + Gdk.EventType.KEY_RELEASE: 'key', + Gdk.EventType.ENTER_NOTIFY: 'crossing', + Gdk.EventType.LEAVE_NOTIFY: 'crossing', + Gdk.EventType.FOCUS_CHANGE: 'focus_change', + Gdk.EventType.CONFIGURE: 'configure', + Gdk.EventType.PROXIMITY_IN: 'proximity', + Gdk.EventType.PROXIMITY_OUT: 'proximity', + Gdk.EventType.DRAG_ENTER: 'dnd', + Gdk.EventType.DRAG_LEAVE: 'dnd', + Gdk.EventType.DRAG_MOTION: 'dnd', + Gdk.EventType.DROP_START: 'dnd', + Gdk.EventType._2BUTTON_PRESS: 'button', + Gdk.EventType._3BUTTON_PRESS: 'button', + Gdk.EventType.PROPERTY_NOTIFY: 'property', + Gdk.EventType.SELECTION_CLEAR: 'selection', + Gdk.EventType.SELECTION_REQUEST: 'selection', + Gdk.EventType.SELECTION_NOTIFY: 'selection', + Gdk.EventType.DRAG_STATUS: 'dnd', + Gdk.EventType.DROP_FINISHED: 'dnd', + Gdk.EventType.CLIENT_EVENT: 'client', + Gdk.EventType.VISIBILITY_NOTIFY: 'visibility', + Gdk.EventType.SCROLL: 'scroll', + Gdk.EventType.EXPOSE: 'expose', + Gdk.EventType.MAP: 'any', + Gdk.EventType.UNMAP: 'any', + } + + if GDK2: + _UNION_MEMBERS[Gdk.EventType.NO_EXPOSE] = 'no_expose' + + if hasattr(Gdk.EventType, 'TOUCH_BEGIN'): + _UNION_MEMBERS.update( + { + Gdk.EventType.TOUCH_BEGIN: 'touch', + Gdk.EventType.TOUCH_UPDATE: 'touch', + Gdk.EventType.TOUCH_END: 'touch', + Gdk.EventType.TOUCH_CANCEL: 'touch', + }) + + def __getattr__(self, name): + real_event = getattr(self, '_UNION_MEMBERS').get(self.type) + if real_event: + return getattr(getattr(self, real_event), name) + else: + raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name)) + + def __setattr__(self, name, value): + real_event = getattr(self, '_UNION_MEMBERS').get(self.type) + if real_event: + setattr(getattr(self, real_event), name, value) + else: + Gdk.Event.__setattr__(self, name, value) + def __repr__(self): + base_repr = Gdk.Event.__repr__(self).strip("><") + return "<%s type=%r>" % (base_repr, self.type) + + Event = override(Event) + __all__.append('Event') + + # manually bind GdkEvent members to GdkEvent + + modname = globals()['__name__'] + module = sys.modules[modname] + + # right now we can't get the type_info from the + # field info so manually list the class names + event_member_classes = ['EventAny', + 'EventExpose', + 'EventMotion', + 'EventButton', + 'EventScroll', + 'EventKey', + 'EventCrossing', + 'EventFocus', + 'EventConfigure', + 'EventProximity', + 'EventDND', + 'EventSetting', + 'EventGrabBroken', + 'EventVisibility', + 'EventProperty', + 'EventSelection', + 'EventOwnerChange', + 'EventWindowState', + 'EventVisibility'] + + if GDK2: + event_member_classes.append('EventNoExpose') + + if hasattr(Gdk, 'EventTouch'): + event_member_classes.append('EventTouch') + + # whitelist all methods that have a success return we want to mask + gsuccess_mask_funcs = ['get_state', + 'get_axis', + 'get_coords', + 'get_root_coords'] + + for event_class in event_member_classes: + override_class = type(event_class, (getattr(Gdk, event_class),), {}) + # add the event methods + for method_info in Gdk.Event.__info__.get_methods(): + name = method_info.get_name() + event_method = getattr(Gdk.Event, name) + + # use the _gsuccess_mask decorator if this method is whitelisted + if name in gsuccess_mask_funcs: + event_method = strip_boolean_result(event_method) + setattr(override_class, name, event_method) + + setattr(module, event_class, override_class) + __all__.append(event_class) + + # end GdkEvent overrides + + class DragContext(Gdk.DragContext): + def finish(self, success, del_, time): + Gtk = get_introspection_module('Gtk') + Gtk.drag_finish(self, success, del_, time) + + DragContext = override(DragContext) + __all__.append('DragContext') + + class Cursor(Gdk.Cursor): + + def __new__(cls, *args, **kwds): + arg_len = len(args) + kwd_len = len(kwds) + total_len = arg_len + kwd_len + + if total_len == 1: + # Since g_object_newv (super.__new__) does not seem valid for + # direct use with GdkCursor, we must assume usage of at least + # one of the C constructors to be valid. + return cls.new(*args, **kwds) + + elif total_len == 2: + warnings.warn('Calling "Gdk.Cursor(display, cursor_type)" has been deprecated. ' + 'Please use Gdk.Cursor.new_for_display(display, cursor_type). ' + 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', + PyGIDeprecationWarning) + return cls.new_for_display(*args, **kwds) + + elif total_len == 4: + warnings.warn('Calling "Gdk.Cursor(display, pixbuf, x, y)" has been deprecated. ' + 'Please use Gdk.Cursor.new_from_pixbuf(display, pixbuf, x, y). ' + 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', + PyGIDeprecationWarning) + return cls.new_from_pixbuf(*args, **kwds) + + elif total_len == 6: + if not GDK2: + # pixmaps don't exist in Gdk 3.0 + raise ValueError("Wrong number of parameters") + + warnings.warn('Calling "Gdk.Cursor(source, mask, fg, bg, x, y)" has been deprecated. ' + 'Please use Gdk.Cursor.new_from_pixmap(source, mask, fg, bg, x, y). ' + 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', + PyGIDeprecationWarning) + return cls.new_from_pixmap(*args, **kwds) + + else: + raise ValueError("Wrong number of parameters") -# Note, we cannot override the entire class as Gdk.Atom has no gtype, so just -# hack some individual methods -def _gdk_atom_str(atom): - n = atom.name() - if n: - return n - # fall back to atom index - return 'Gdk.Atom<%i>' % hash(atom) + Cursor = override(Cursor) + __all__.append('Cursor') + + # Gdk.Color was deprecated since 3.14 and dropped in Gtk-4.0 + color_parse = strip_boolean_result(Gdk.color_parse) + __all__.append('color_parse') + + # Note, we cannot override the entire class as Gdk.Atom has no gtype, so just + # hack some individual methods + def _gdk_atom_str(atom): + n = atom.name() + if n: + return n + # fall back to atom index + return 'Gdk.Atom<%i>' % hash(atom) + + def _gdk_atom_repr(atom): + n = atom.name() + if n: + return 'Gdk.Atom.intern("%s", False)' % n + # fall back to atom index + return '' % hash(atom) + + Gdk.Atom.__str__ = _gdk_atom_str + Gdk.Atom.__repr__ = _gdk_atom_repr + + +if GDK4: + from gi.repository import Gio + + class FileList(Gdk.FileList): + + if hasattr(Gdk.FileList, "new_from_list"): + def __new__(cls, files): + files_list = [] + if isinstance(files, (tuple, list)): + for f in files: + if isinstance(f, Gio.File): + files_list.append(f) + else: + raise TypeError('Constructor requires a list or tuple of Gio.File instances') + else: + raise TypeError('Constructor requires a list or tuple of Gio.File instances') + return Gdk.FileList.new_from_list(files) + def __iter__(self): + return iter(self.get_files()) -def _gdk_atom_repr(atom): - n = atom.name() - if n: - return 'Gdk.Atom<%s>' % n - # fall back to atom index - return 'Gdk.Atom<%i>' % hash(atom) + def __len__(self): + return len(self.get_files()) + def __getitem__(self, index): + return self.get_files()[index] -Gdk.Atom.__str__ = _gdk_atom_str -Gdk.Atom.__repr__ = _gdk_atom_repr + FileList = override(FileList) + __all__.append('FileList') # constants -if Gdk._version >= '3.0': +if GDK3: SELECTION_PRIMARY = Gdk.atom_intern('PRIMARY', True) __all__.append('SELECTION_PRIMARY') @@ -398,6 +479,6 @@ if Gdk._version >= '3.0': SELECTION_TYPE_STRING = Gdk.atom_intern('STRING', True) __all__.append('SELECTION_TYPE_STRING') -import sys - -initialized, argv = Gdk.init_check(sys.argv) +if GDK2 or GDK3: + import sys + initialized, argv = Gdk.init_check(sys.argv) diff --git a/gi/overrides/GdkPixbuf.py b/gi/overrides/GdkPixbuf.py new file mode 100644 index 0000000..0f6cd75 --- /dev/null +++ b/gi/overrides/GdkPixbuf.py @@ -0,0 +1,53 @@ +# Copyright 2018 Christoph Reiter +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +import warnings + +from gi import PyGIDeprecationWarning +from gi.repository import GLib + +from ..overrides import override +from ..module import get_introspection_module + + +GdkPixbuf = get_introspection_module('GdkPixbuf') +__all__ = [] + + +@override +class Pixbuf(GdkPixbuf.Pixbuf): + + @classmethod + def new_from_data( + cls, data, colorspace, has_alpha, bits_per_sample, + width, height, rowstride, + destroy_fn=None, *destroy_fn_data): + + if destroy_fn is not None: + w = PyGIDeprecationWarning("destroy_fn argument deprecated") + warnings.warn(w) + if destroy_fn_data: + w = PyGIDeprecationWarning("destroy_fn_data argument deprecated") + warnings.warn(w) + + data = GLib.Bytes.new(data) + return cls.new_from_bytes( + data, colorspace, has_alpha, bits_per_sample, + width, height, rowstride) + + +__all__.append('Pixbuf') diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py index 6ecd1c4..c807fe0 100644 --- a/gi/overrides/Gio.py +++ b/gi/overrides/Gio.py @@ -18,8 +18,12 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -from ..overrides import override +import warnings + +from .._ossighelper import wakeup_on_signal, register_sigint_fallback +from ..overrides import override, deprecated_init, wrap_list_store_sort_func from ..module import get_introspection_module +from gi import PyGIWarning from gi.repository import GLib @@ -30,6 +34,171 @@ Gio = get_introspection_module('Gio') __all__ = [] +class Application(Gio.Application): + + def run(self, *args, **kwargs): + with register_sigint_fallback(self.quit): + with wakeup_on_signal(): + return Gio.Application.run(self, *args, **kwargs) + + +Application = override(Application) +__all__.append('Application') + + +def _warn_init(cls, instead=None): + + def new_init(self, *args, **kwargs): + super(cls, self).__init__(*args, **kwargs) + name = cls.__module__.rsplit(".", 1)[-1] + "." + cls.__name__ + if instead: + warnings.warn( + ("%s shouldn't be instantiated directly, " + "use %s instead." % (name, instead)), + PyGIWarning, stacklevel=2) + else: + warnings.warn( + "%s shouldn't be instantiated directly." % (name,), + PyGIWarning, stacklevel=2) + + return new_init + + +@override +class VolumeMonitor(Gio.VolumeMonitor): + # https://bugzilla.gnome.org/show_bug.cgi?id=744690 + __init__ = _warn_init(Gio.VolumeMonitor, "Gio.VolumeMonitor.get()") + + +__all__.append('VolumeMonitor') + + +@override +class DBusAnnotationInfo(Gio.DBusAnnotationInfo): + __init__ = _warn_init(Gio.DBusAnnotationInfo) + + +__all__.append('DBusAnnotationInfo') + + +@override +class DBusArgInfo(Gio.DBusArgInfo): + __init__ = _warn_init(Gio.DBusArgInfo) + + +__all__.append('DBusArgInfo') + + +@override +class DBusMethodInfo(Gio.DBusMethodInfo): + __init__ = _warn_init(Gio.DBusMethodInfo) + + +__all__.append('DBusMethodInfo') + + +@override +class DBusSignalInfo(Gio.DBusSignalInfo): + __init__ = _warn_init(Gio.DBusSignalInfo) + + +__all__.append('DBusSignalInfo') + + +@override +class DBusInterfaceInfo(Gio.DBusInterfaceInfo): + __init__ = _warn_init(Gio.DBusInterfaceInfo) + + +__all__.append('DBusInterfaceInfo') + + +@override +class DBusNodeInfo(Gio.DBusNodeInfo): + __init__ = _warn_init(Gio.DBusNodeInfo) + + +__all__.append('DBusNodeInfo') + + +class ActionMap(Gio.ActionMap): + def add_action_entries(self, entries, user_data=None): + """ + The add_action_entries() method is a convenience function for creating + multiple Gio.SimpleAction instances and adding them to a Gio.ActionMap. + Each action is constructed as per one entry. + + :param list entries: + List of entry tuples for add_action() method. The entry tuple can + vary in size with the following information: + + * The name of the action. Must be specified. + * The callback to connect to the "activate" signal of the + action. Since GLib 2.40, this can be None for stateful + actions, in which case the default handler is used. For + boolean-stated actions with no parameter, this is a toggle. + For other state types (and parameter type equal to the state + type) this will be a function that just calls change_state + (which you should provide). + * The type of the parameter that must be passed to the activate + function for this action, given as a single GLib.Variant type + string (or None for no parameter) + * The initial state for this action, given in GLib.Variant text + format. The state is parsed with no extra type information, so + type tags must be added to the string if they are necessary. + Stateless actions should give None here. + * The callback to connect to the "change-state" signal of the + action. All stateful actions should provide a handler here; + stateless actions should not. + + :param user_data: + The user data for signal connections, or None + """ + try: + iter(entries) + except (TypeError): + raise TypeError('entries must be iterable') + + def _process_action(name, activate=None, parameter_type=None, + state=None, change_state=None): + if parameter_type: + if not GLib.VariantType.string_is_valid(parameter_type): + raise TypeError("The type string '%s' given as the " + "parameter type for action '%s' is " + "not a valid GVariant type string. " % + (parameter_type, name)) + variant_parameter = GLib.VariantType.new(parameter_type) + else: + variant_parameter = None + + if state is not None: + # stateful action + variant_state = GLib.Variant.parse(None, state, None, None) + action = Gio.SimpleAction.new_stateful(name, variant_parameter, + variant_state) + if change_state is not None: + action.connect('change-state', change_state, user_data) + else: + # stateless action + if change_state is not None: + raise ValueError("Stateless action '%s' should give " + "None for 'change_state', not '%s'." % + (name, change_state)) + action = Gio.SimpleAction(name=name, parameter_type=variant_parameter) + + if activate is not None: + action.connect('activate', activate, user_data) + self.add_action(action) + + for entry in entries: + # using inner function above since entries can leave out optional arguments + _process_action(*entry) + + +ActionMap = override(ActionMap) +__all__.append('ActionMap') + + class FileEnumerator(Gio.FileEnumerator): def __iter__(self): return self @@ -63,8 +232,8 @@ __all__.append('MenuItem') class Settings(Gio.Settings): '''Provide dictionary-like access to GLib.Settings.''' - def __init__(self, schema, path=None, backend=None, **kwargs): - Gio.Settings.__init__(self, schema=schema, backend=backend, path=path, **kwargs) + __init__ = deprecated_init(Gio.Settings.__init__, + arg_names=('schema', 'path', 'backend')) def __contains__(self, key): return key in self.list_keys() @@ -72,6 +241,10 @@ class Settings(Gio.Settings): def __len__(self): return len(self.list_keys()) + def __iter__(self): + for key in self.list_keys(): + yield key + def __bool__(self): # for "if mysettings" we don't want a dictionary-like test here, just # if the object isn't None @@ -82,14 +255,14 @@ class Settings(Gio.Settings): def __getitem__(self, key): # get_value() aborts the program on an unknown key - if not key in self: + if key not in self: raise KeyError('unknown key: %r' % (key,)) return self.get_value(key).unpack() def __setitem__(self, key, value): # set_value() aborts the program on an unknown key - if not key in self: + if key not in self: raise KeyError('unknown key: %r' % (key,)) # determine type string of this key @@ -108,6 +281,13 @@ class Settings(Gio.Settings): allowed = v.unpack() if value not in allowed: raise ValueError('value %s is not an allowed enum (%s)' % (value, allowed)) + elif type_ == 'range': + tuple_ = v.get_child_value(0) + type_str = tuple_.get_child_value(0).get_type_string() + min_, max_ = tuple_.unpack() + if value < min_ or value > max_: + raise ValueError( + 'value %s not in range (%s - %s)' % (value, min_, max_)) else: raise NotImplementedError('Cannot handle allowed type range class ' + str(type_)) @@ -116,6 +296,7 @@ class Settings(Gio.Settings): def keys(self): return self.list_keys() + Settings = override(Settings) __all__.append('Settings') @@ -235,5 +416,135 @@ class DBusProxy(Gio.DBusProxy): def __getattr__(self, name): return _DBusProxyMethodCall(self, name) + DBusProxy = override(DBusProxy) __all__.append('DBusProxy') + + +class ListModel(Gio.ListModel): + + def __getitem__(self, key): + if isinstance(key, slice): + return [self.get_item(i) for i in range(*key.indices(len(self)))] + elif isinstance(key, int): + if key < 0: + key += len(self) + if key < 0: + raise IndexError + ret = self.get_item(key) + if ret is None: + raise IndexError + return ret + else: + raise TypeError + + def __contains__(self, item): + pytype = self.get_item_type().pytype + if not isinstance(item, pytype): + raise TypeError( + "Expected type %s.%s" % (pytype.__module__, pytype.__name__)) + for i in self: + if i == item: + return True + return False + + def __len__(self): + return self.get_n_items() + + def __iter__(self): + for i in range(len(self)): + yield self.get_item(i) + + +ListModel = override(ListModel) +__all__.append('ListModel') + + +if (GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION) < (2, 57, 1): + # The "additions" functionality in splice() was broken in older glib + # https://bugzilla.gnome.org/show_bug.cgi?id=795307 + # This is a slower fallback which emits a signal per added item + def _list_store_splice(self, position, n_removals, additions): + self.splice(position, n_removals, []) + for v in reversed(additions): + self.insert(position, v) +else: + def _list_store_splice(self, position, n_removals, additions): + self.splice(position, n_removals, additions) + + +class ListStore(Gio.ListStore): + + def sort(self, compare_func, *user_data): + compare_func = wrap_list_store_sort_func(compare_func) + return super(ListStore, self).sort(compare_func, *user_data) + + def insert_sorted(self, item, compare_func, *user_data): + compare_func = wrap_list_store_sort_func(compare_func) + return super(ListStore, self).insert_sorted( + item, compare_func, *user_data) + + def __delitem__(self, key): + if isinstance(key, slice): + start, stop, step = key.indices(len(self)) + if step == 1: + _list_store_splice(self, start, max(stop - start, 0), []) + elif step == -1: + _list_store_splice(self, stop + 1, max(start - stop, 0), []) + else: + for i in sorted(range(start, stop, step), reverse=True): + self.remove(i) + elif isinstance(key, int): + if key < 0: + key += len(self) + if key < 0 or key >= len(self): + raise IndexError + self.remove(key) + else: + raise TypeError + + def __setitem__(self, key, value): + if isinstance(key, slice): + pytype = self.get_item_type().pytype + valuelist = [] + for v in value: + if not isinstance(v, pytype): + raise TypeError( + "Expected type %s.%s" % ( + pytype.__module__, pytype.__name__)) + valuelist.append(v) + + start, stop, step = key.indices(len(self)) + if step == 1: + _list_store_splice( + self, start, max(stop - start, 0), valuelist) + else: + indices = list(range(start, stop, step)) + if len(indices) != len(valuelist): + raise ValueError + + if step == -1: + _list_store_splice( + self, stop + 1, max(start - stop, 0), valuelist[::-1]) + else: + for i, v in zip(indices, valuelist): + _list_store_splice(self, i, 1, [v]) + elif isinstance(key, int): + if key < 0: + key += len(self) + if key < 0 or key >= len(self): + raise IndexError + + pytype = self.get_item_type().pytype + if not isinstance(value, pytype): + raise TypeError( + "Expected type %s.%s" % ( + pytype.__module__, pytype.__name__)) + + _list_store_splice(self, key, 1, [value]) + else: + raise TypeError + + +ListStore = override(ListStore) +__all__.append('ListStore') diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py index 5899596..f75da7b 100644 --- a/gi/overrides/Gtk.py +++ b/gi/overrides/Gtk.py @@ -19,96 +19,177 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -import collections import sys +import warnings + from gi.repository import GObject -from ..overrides import override, strip_boolean_result +from .._ossighelper import wakeup_on_signal, register_sigint_fallback +from .._gtktemplate import Template, _extract_handler_and_args +from ..overrides import (override, strip_boolean_result, deprecated_init, + wrap_list_store_sort_func) from ..module import get_introspection_module from gi import PyGIDeprecationWarning -if sys.version_info >= (3, 0): - _basestring = str - _callable = lambda c: hasattr(c, '__call__') -else: - _basestring = basestring - _callable = callable Gtk = get_introspection_module('Gtk') +GTK3 = Gtk._version == '3.0' +GTK4 = Gtk._version == '4.0' __all__ = [] -if Gtk._version == '2.0': - import warnings - warn_msg = "You have imported the Gtk 2.0 module. Because Gtk 2.0 \ -was not designed for use with introspection some of the \ -interfaces and API will fail. As such this is not supported \ -by the pygobject development team and we encourage you to \ -port your app to Gtk 3 or greater. PyGTK is the recomended \ -python module to use with Gtk 2.0" - warnings.warn(warn_msg, RuntimeWarning) +Template = Template +__all__.append('Template') + +# Exposed for unit-testing. +_extract_handler_and_args = _extract_handler_and_args +__all__.append('_extract_handler_and_args') + + +class PyGTKDeprecationWarning(PyGIDeprecationWarning): + pass + + +__all__.append('PyGTKDeprecationWarning') + + +if GTK3: + def _construct_target_list(targets): + """Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) + + The list can also contain existing TargetEntry items in which case the existing entry + is re-used in the return list. + """ + target_entries = [] + for entry in targets: + if not isinstance(entry, Gtk.TargetEntry): + entry = Gtk.TargetEntry.new(*entry) + target_entries.append(entry) + return target_entries + + __all__.append('_construct_target_list') + + +def _builder_connect_callback(builder, gobj, signal_name, handler_name, connect_obj, flags, obj_or_map): + handler, args = _extract_handler_and_args(obj_or_map, handler_name) + + after = flags & GObject.ConnectFlags.AFTER + if connect_obj is not None: + if after: + gobj.connect_object_after(signal_name, handler, connect_obj, *args) + else: + gobj.connect_object(signal_name, handler, connect_obj, *args) + else: + if after: + gobj.connect_after(signal_name, handler, *args) + else: + gobj.connect(signal_name, handler, *args) -def _construct_target_list(targets): - """Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) +class _FreezeNotifyManager(object): + def __init__(self, obj): + self.obj = obj - The list can also contain existing TargetEntry items in which case the existing entry - is re-used in the return list. - """ - target_entries = [] - for entry in targets: - if not isinstance(entry, Gtk.TargetEntry): - entry = Gtk.TargetEntry.new(*entry) - target_entries.append(entry) - return target_entries + def __enter__(self): + pass -__all__.append('_construct_target_list') + def __exit__(self, exc_type, exc_value, traceback): + self.obj.thaw_child_notify() class Widget(Gtk.Widget): translate_coordinates = strip_boolean_result(Gtk.Widget.translate_coordinates) - def render_icon(self, stock_id, size, detail=None): - return super(Widget, self).render_icon(stock_id, size, detail) - - def drag_dest_set_target_list(self, target_list): - if not isinstance(target_list, Gtk.TargetList): - target_list = Gtk.TargetList.new(_construct_target_list(target_list)) - super(Widget, self).drag_dest_set_target_list(target_list) + if GTK4: + def __contains__(self, child): + return child in list(self) + + def __iter__(self): + child = self.get_first_child() + while child: + yield child + child = child.get_next_sibling() + + if GTK3: + def freeze_child_notify(self): + super(Widget, self).freeze_child_notify() + return _FreezeNotifyManager(self) + + if GTK3: + def drag_dest_set_target_list(self, target_list): + if (target_list is not None) and (not isinstance(target_list, Gtk.TargetList)): + target_list = Gtk.TargetList.new(_construct_target_list(target_list)) + super(Widget, self).drag_dest_set_target_list(target_list) + + if GTK3: + def drag_source_set_target_list(self, target_list): + if (target_list is not None) and (not isinstance(target_list, Gtk.TargetList)): + target_list = Gtk.TargetList.new(_construct_target_list(target_list)) + super(Widget, self).drag_source_set_target_list(target_list) + + if GTK3: + def style_get_property(self, property_name, value=None): + if value is None: + prop = self.find_style_property(property_name) + if prop is None: + raise ValueError('Class "%s" does not contain style property "%s"' % + (self, property_name)) + value = GObject.Value(prop.value_type) - def drag_source_set_target_list(self, target_list): - if not isinstance(target_list, Gtk.TargetList): - target_list = Gtk.TargetList.new(_construct_target_list(target_list)) - super(Widget, self).drag_source_set_target_list(target_list) + Gtk.Widget.style_get_property(self, property_name, value) + return value.get_value() Widget = override(Widget) __all__.append('Widget') -class Container(Gtk.Container, Widget): +if GTK3: + class Container(Gtk.Container, Widget): - def __len__(self): - return len(self.get_children()) + def __len__(self): + return len(self.get_children()) - def __contains__(self, child): - return child in self.get_children() + def __contains__(self, child): + return child in self.get_children() - def __iter__(self): - return iter(self.get_children()) + def __iter__(self): + return iter(self.get_children()) - def __bool__(self): - return True + def __bool__(self): + return True + + # alias for Python 2.x object protocol + __nonzero__ = __bool__ + + def child_get_property(self, child, property_name, value=None): + if value is None: + prop = self.find_child_property(property_name) + if prop is None: + raise ValueError('Class "%s" does not contain child property "%s"' % + (self, property_name)) + value = GObject.Value(prop.value_type) + + Gtk.Container.child_get_property(self, child, property_name, value) + return value.get_value() - # alias for Python 2.x object protocol - __nonzero__ = __bool__ + def child_get(self, child, *prop_names): + """Returns a list of child property values for the given names.""" + return [self.child_get_property(child, name) for name in prop_names] - get_focus_chain = strip_boolean_result(Gtk.Container.get_focus_chain) + def child_set(self, child, **kwargs): + """Set a child properties on the given child to key/value pairs.""" + for name, value in kwargs.items(): + name = name.replace('_', '-') + self.child_set_property(child, name, value) + get_focus_chain = strip_boolean_result(Gtk.Container.get_focus_chain) -Container = override(Container) -__all__.append('Container') + Container = override(Container) + __all__.append('Container') +else: + Container = object class Editable(Gtk.Editable): @@ -123,306 +204,288 @@ Editable = override(Editable) __all__.append("Editable") -class Action(Gtk.Action): - def __init__(self, name, label, tooltip, stock_id, **kwds): - Gtk.Action.__init__(self, name=name, label=label, tooltip=tooltip, stock_id=stock_id, **kwds) +if GTK3: + class Action(Gtk.Action): + __init__ = deprecated_init(Gtk.Action.__init__, + arg_names=('name', 'label', 'tooltip', 'stock_id'), + category=PyGTKDeprecationWarning) + + Action = override(Action) + __all__.append("Action") + + class RadioAction(Gtk.RadioAction): + __init__ = deprecated_init(Gtk.RadioAction.__init__, + arg_names=('name', 'label', 'tooltip', 'stock_id', 'value'), + category=PyGTKDeprecationWarning) + + RadioAction = override(RadioAction) + __all__.append("RadioAction") + + class ActionGroup(Gtk.ActionGroup): + __init__ = deprecated_init(Gtk.ActionGroup.__init__, + arg_names=('name',), + category=PyGTKDeprecationWarning) + + def add_actions(self, entries, user_data=None): + """ + The add_actions() method is a convenience method that creates a number + of gtk.Action objects based on the information in the list of action + entry tuples contained in entries and adds them to the action group. + The entry tuples can vary in size from one to six items with the + following information: + + * The name of the action. Must be specified. + * The stock id for the action. Optional with a default value of None + if a label is specified. + * The label for the action. This field should typically be marked + for translation, see the set_translation_domain() method. Optional + with a default value of None if a stock id is specified. + * The accelerator for the action, in the format understood by the + gtk.accelerator_parse() function. Optional with a default value of + None. + * The tooltip for the action. This field should typically be marked + for translation, see the set_translation_domain() method. Optional + with a default value of None. + * The callback function invoked when the action is activated. + Optional with a default value of None. + + The "activate" signals of the actions are connected to the callbacks and + their accel paths are set to /group-name/action-name. + """ + try: + iter(entries) + except (TypeError): + raise TypeError('entries must be iterable') + + def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None): + action = Action(name=name, label=label, tooltip=tooltip, stock_id=stock_id) + if callback is not None: + if user_data is None: + action.connect('activate', callback) + else: + action.connect('activate', callback, user_data) + + self.add_action_with_accel(action, accelerator) + + for e in entries: + # using inner function above since entries can leave out optional arguments + _process_action(*e) + + def add_toggle_actions(self, entries, user_data=None): + """ + The add_toggle_actions() method is a convenience method that creates a + number of gtk.ToggleAction objects based on the information in the list + of action entry tuples contained in entries and adds them to the action + group. The toggle action entry tuples can vary in size from one to seven + items with the following information: + + * The name of the action. Must be specified. + * The stock id for the action. Optional with a default value of None + if a label is specified. + * The label for the action. This field should typically be marked + for translation, see the set_translation_domain() method. Optional + with a default value of None if a stock id is specified. + * The accelerator for the action, in the format understood by the + gtk.accelerator_parse() function. Optional with a default value of + None. + * The tooltip for the action. This field should typically be marked + for translation, see the set_translation_domain() method. Optional + with a default value of None. + * The callback function invoked when the action is activated. + Optional with a default value of None. + * A flag indicating whether the toggle action is active. Optional + with a default value of False. + + The "activate" signals of the actions are connected to the callbacks and + their accel paths are set to /group-name/action-name. + """ -Action = override(Action) -__all__.append("Action") + try: + iter(entries) + except (TypeError): + raise TypeError('entries must be iterable') + + def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None, is_active=False): + action = Gtk.ToggleAction(name=name, label=label, tooltip=tooltip, stock_id=stock_id) + action.set_active(is_active) + if callback is not None: + if user_data is None: + action.connect('activate', callback) + else: + action.connect('activate', callback, user_data) + + self.add_action_with_accel(action, accelerator) + + for e in entries: + # using inner function above since entries can leave out optional arguments + _process_action(*e) + + def add_radio_actions(self, entries, value=None, on_change=None, user_data=None): + """ + The add_radio_actions() method is a convenience method that creates a + number of gtk.RadioAction objects based on the information in the list + of action entry tuples contained in entries and adds them to the action + group. The entry tuples can vary in size from one to six items with the + following information: + + * The name of the action. Must be specified. + * The stock id for the action. Optional with a default value of None + if a label is specified. + * The label for the action. This field should typically be marked + for translation, see the set_translation_domain() method. Optional + with a default value of None if a stock id is specified. + * The accelerator for the action, in the format understood by the + gtk.accelerator_parse() function. Optional with a default value of + None. + * The tooltip for the action. This field should typically be marked + for translation, see the set_translation_domain() method. Optional + with a default value of None. + * The value to set on the radio action. Optional with a default + value of 0. Should be specified in applications. + + The value parameter specifies the radio action that should be set + active. The "changed" signal of the first radio action is connected to + the on_change callback (if specified and not None) and the accel paths + of the actions are set to /group-name/action-name. + """ + try: + iter(entries) + except (TypeError): + raise TypeError('entries must be iterable') + first_action = None -class RadioAction(Gtk.RadioAction): - def __init__(self, name, label, tooltip, stock_id, value, **kwds): - Gtk.RadioAction.__init__(self, name=name, label=label, tooltip=tooltip, stock_id=stock_id, value=value, **kwds) + def _process_action(group_source, name, stock_id=None, label=None, accelerator=None, tooltip=None, entry_value=0): + action = RadioAction(name=name, label=label, tooltip=tooltip, stock_id=stock_id, value=entry_value) -RadioAction = override(RadioAction) -__all__.append("RadioAction") + if GTK3: + action.join_group(group_source) + if value == entry_value: + action.set_active(True) -class ActionGroup(Gtk.ActionGroup): - def __init__(self, name, **kwds): - super(ActionGroup, self).__init__(name=name, **kwds) + self.add_action_with_accel(action, accelerator) + return action - def add_actions(self, entries, user_data=None): - """ - The add_actions() method is a convenience method that creates a number - of gtk.Action objects based on the information in the list of action - entry tuples contained in entries and adds them to the action group. - The entry tuples can vary in size from one to six items with the - following information: - - * The name of the action. Must be specified. - * The stock id for the action. Optional with a default value of None - if a label is specified. - * The label for the action. This field should typically be marked - for translation, see the set_translation_domain() method. Optional - with a default value of None if a stock id is specified. - * The accelerator for the action, in the format understood by the - gtk.accelerator_parse() function. Optional with a default value of - None. - * The tooltip for the action. This field should typically be marked - for translation, see the set_translation_domain() method. Optional - with a default value of None. - * The callback function invoked when the action is activated. - Optional with a default value of None. - - The "activate" signals of the actions are connected to the callbacks and - their accel paths are set to /group-name/action-name. - """ - try: - iter(entries) - except (TypeError): - raise TypeError('entries must be iterable') + for e in entries: + # using inner function above since entries can leave out optional arguments + action = _process_action(first_action, *e) + if first_action is None: + first_action = action - def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None): - action = Action(name, label, tooltip, stock_id) - if callback is not None: + if first_action is not None and on_change is not None: if user_data is None: - action.connect('activate', callback) + first_action.connect('changed', on_change) else: - action.connect('activate', callback, user_data) + first_action.connect('changed', on_change, user_data) - self.add_action_with_accel(action, accelerator) + ActionGroup = override(ActionGroup) + __all__.append('ActionGroup') - for e in entries: - # using inner function above since entries can leave out optional arguments - _process_action(*e) + class UIManager(Gtk.UIManager): + def add_ui_from_string(self, buffer): + if not isinstance(buffer, str): + raise TypeError('buffer must be a string') - def add_toggle_actions(self, entries, user_data=None): - """ - The add_toggle_actions() method is a convenience method that creates a - number of gtk.ToggleAction objects based on the information in the list - of action entry tuples contained in entries and adds them to the action - group. The toggle action entry tuples can vary in size from one to seven - items with the following information: - - * The name of the action. Must be specified. - * The stock id for the action. Optional with a default value of None - if a label is specified. - * The label for the action. This field should typically be marked - for translation, see the set_translation_domain() method. Optional - with a default value of None if a stock id is specified. - * The accelerator for the action, in the format understood by the - gtk.accelerator_parse() function. Optional with a default value of - None. - * The tooltip for the action. This field should typically be marked - for translation, see the set_translation_domain() method. Optional - with a default value of None. - * The callback function invoked when the action is activated. - Optional with a default value of None. - * A flag indicating whether the toggle action is active. Optional - with a default value of False. - - The "activate" signals of the actions are connected to the callbacks and - their accel paths are set to /group-name/action-name. - """ + length = _get_utf8_length(buffer) - try: - iter(entries) - except (TypeError): - raise TypeError('entries must be iterable') - - def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None, is_active=False): - action = Gtk.ToggleAction(name, label, tooltip, stock_id) - action.set_active(is_active) - if callback is not None: - if user_data is None: - action.connect('activate', callback) - else: - action.connect('activate', callback, user_data) + return Gtk.UIManager.add_ui_from_string(self, buffer, length) - self.add_action_with_accel(action, accelerator) + def insert_action_group(self, buffer, length=-1): + return Gtk.UIManager.insert_action_group(self, buffer, length) - for e in entries: - # using inner function above since entries can leave out optional arguments - _process_action(*e) - - def add_radio_actions(self, entries, value=None, on_change=None, user_data=None): - """ - The add_radio_actions() method is a convenience method that creates a - number of gtk.RadioAction objects based on the information in the list - of action entry tuples contained in entries and adds them to the action - group. The entry tuples can vary in size from one to six items with the - following information: - - * The name of the action. Must be specified. - * The stock id for the action. Optional with a default value of None - if a label is specified. - * The label for the action. This field should typically be marked - for translation, see the set_translation_domain() method. Optional - with a default value of None if a stock id is specified. - * The accelerator for the action, in the format understood by the - gtk.accelerator_parse() function. Optional with a default value of - None. - * The tooltip for the action. This field should typically be marked - for translation, see the set_translation_domain() method. Optional - with a default value of None. - * The value to set on the radio action. Optional with a default - value of 0. Should be specified in applications. - - The value parameter specifies the radio action that should be set - active. The "changed" signal of the first radio action is connected to - the on_change callback (if specified and not None) and the accel paths - of the actions are set to /group-name/action-name. - """ - try: - iter(entries) - except (TypeError): - raise TypeError('entries must be iterable') - - first_action = None - - def _process_action(group_source, name, stock_id=None, label=None, accelerator=None, tooltip=None, entry_value=0): - action = RadioAction(name, label, tooltip, stock_id, entry_value) - - # FIXME: join_group is a patch to Gtk+ 3.0 - # otherwise we can't effectively add radio actions to a - # group. Should we depend on 3.0 and error out here - # or should we offer the functionality via a compat - # C module? - if hasattr(action, 'join_group'): - action.join_group(group_source) - - if value == entry_value: - action.set_active(True) - - self.add_action_with_accel(action, accelerator) - return action - - for e in entries: - # using inner function above since entries can leave out optional arguments - action = _process_action(first_action, *e) - if first_action is None: - first_action = action - - if first_action is not None and on_change is not None: - if user_data is None: - first_action.connect('changed', on_change) - else: - first_action.connect('changed', on_change, user_data) - -ActionGroup = override(ActionGroup) -__all__.append('ActionGroup') - - -class UIManager(Gtk.UIManager): - def add_ui_from_string(self, buffer): - if not isinstance(buffer, _basestring): - raise TypeError('buffer must be a string') - - length = len(buffer.encode('UTF-8')) - - return Gtk.UIManager.add_ui_from_string(self, buffer, length) - - def insert_action_group(self, buffer, length=-1): - return Gtk.UIManager.insert_action_group(self, buffer, length) - -UIManager = override(UIManager) -__all__.append('UIManager') + UIManager = override(UIManager) + __all__.append('UIManager') class ComboBox(Gtk.ComboBox, Container): get_active_iter = strip_boolean_result(Gtk.ComboBox.get_active_iter) + ComboBox = override(ComboBox) __all__.append('ComboBox') -class Box(Gtk.Box): - def __init__(self, homogeneous=False, spacing=0, **kwds): - super(Box, self).__init__(**kwds) - self.set_homogeneous(homogeneous) - self.set_spacing(spacing) +if GTK3: + class Box(Gtk.Box): + __init__ = deprecated_init(Gtk.Box.__init__, + arg_names=('homogeneous', 'spacing'), + category=PyGTKDeprecationWarning) -Box = override(Box) -__all__.append('Box') + Box = override(Box) + __all__.append('Box') -class SizeGroup(Gtk.SizeGroup): - def __init__(self, mode=Gtk.SizeGroupMode.VERTICAL): - super(SizeGroup, self).__init__(mode=mode) +if GTK3: + class SizeGroup(Gtk.SizeGroup): + __init__ = deprecated_init(Gtk.SizeGroup.__init__, + arg_names=('mode',), + deprecated_defaults={'mode': Gtk.SizeGroupMode.VERTICAL}, + category=PyGTKDeprecationWarning) -SizeGroup = override(SizeGroup) -__all__.append('SizeGroup') + SizeGroup = override(SizeGroup) + __all__.append('SizeGroup') -class MenuItem(Gtk.MenuItem): - def __init__(self, label=None, **kwds): - if label: - super(MenuItem, self).__init__(label=label, **kwds) - else: - super(MenuItem, self).__init__(**kwds) - -MenuItem = override(MenuItem) -__all__.append('MenuItem') +if GTK3: + class MenuItem(Gtk.MenuItem): + __init__ = deprecated_init(Gtk.MenuItem.__init__, + arg_names=('label',), + category=PyGTKDeprecationWarning) + MenuItem = override(MenuItem) + __all__.append('MenuItem') -class Builder(Gtk.Builder): - @staticmethod - def _extract_handler_and_args(obj_or_map, handler_name): - handler = None - if isinstance(obj_or_map, collections.Mapping): - handler = obj_or_map.get(handler_name, None) - else: - handler = getattr(obj_or_map, handler_name, None) - if handler is None: - raise AttributeError('Handler %s not found' % handler_name) +def _get_utf8_length(string): + assert isinstance(string, str) + if not isinstance(string, bytes): + string = string.encode("utf-8") + return len(string) - args = () - if isinstance(handler, collections.Sequence): - if len(handler) == 0: - raise TypeError("Handler %s tuple can not be empty" % handler) - args = handler[1:] - handler = handler[0] - elif not _callable(handler): - raise TypeError('Handler %s is not a method, function or tuple' % handler) +class Builder(Gtk.Builder): + if GTK4: + from .._gtktemplate import define_builder_scope + BuilderScope = define_builder_scope() - return handler, args + def __init__(self, scope_object_or_map=None): + super(Builder, self).__init__() + if scope_object_or_map: + self.set_scope(Builder.BuilderScope(scope_object_or_map)) - def connect_signals(self, obj_or_map): - """Connect signals specified by this builder to a name, handler mapping. + else: + def connect_signals(self, obj_or_map): + """Connect signals specified by this builder to a name, handler mapping. - Connect signal, name, and handler sets specified in the builder with - the given mapping "obj_or_map". The handler/value aspect of the mapping - can also contain a tuple in the form of (handler [,arg1 [,argN]]) - allowing for extra arguments to be passed to the handler. For example: - builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)}) - """ - def _full_callback(builder, gobj, signal_name, handler_name, connect_obj, flags, obj_or_map): - handler, args = self._extract_handler_and_args(obj_or_map, handler_name) + Connect signal, name, and handler sets specified in the builder with + the given mapping "obj_or_map". The handler/value aspect of the mapping + can also contain a tuple in the form of (handler [,arg1 [,argN]]) + allowing for extra arguments to be passed to the handler. For example: - after = flags & GObject.ConnectFlags.AFTER - if connect_obj is not None: - if after: - gobj.connect_object_after(signal_name, handler, connect_obj, *args) - else: - gobj.connect_object(signal_name, handler, connect_obj, *args) - else: - if after: - gobj.connect_after(signal_name, handler, *args) - else: - gobj.connect(signal_name, handler, *args) + .. code-block:: python - self.connect_signals_full(_full_callback, obj_or_map) + builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)}) + """ + self.connect_signals_full(_builder_connect_callback, obj_or_map) def add_from_string(self, buffer): - if not isinstance(buffer, _basestring): + if not isinstance(buffer, str): raise TypeError('buffer must be a string') - length = len(buffer) + length = _get_utf8_length(buffer) return Gtk.Builder.add_from_string(self, buffer, length) def add_objects_from_string(self, buffer, object_ids): - if not isinstance(buffer, _basestring): + if not isinstance(buffer, str): raise TypeError('buffer must be a string') - length = len(buffer) + length = _get_utf8_length(buffer) return Gtk.Builder.add_objects_from_string(self, buffer, length, object_ids) + Builder = override(Builder) __all__.append('Builder') @@ -430,61 +493,88 @@ __all__.append('Builder') # NOTE: This must come before any other Window/Dialog subclassing, to ensure # that we have a correct inheritance hierarchy. +if GTK4: + _window_init = Gtk.Window.__init__ +else: + _window_init = deprecated_init(Gtk.Window.__init__, + arg_names=('type',), + category=PyGTKDeprecationWarning, + stacklevel=3) + class Window(Gtk.Window): - def __init__(self, type=Gtk.WindowType.TOPLEVEL, **kwds): + def __init__(self, *args, **kwargs): if not initialized: - raise RuntimeError("Gtk couldn't be initialized") + raise RuntimeError( + "Gtk couldn't be initialized. " + "Use Gtk.init_check() if you want to handle this case.") + _window_init(self, *args, **kwargs) - # type is a construct-only property; if it is already set (e. g. by - # GtkBuilder), do not try to set it again and just ignore it - try: - self.get_property('type') - Gtk.Window.__init__(self, **kwds) - except TypeError: - Gtk.Window.__init__(self, type=type, **kwds) Window = override(Window) __all__.append('Window') class Dialog(Gtk.Dialog, Container): + if GTK3: + _old_arg_names = ('title', 'parent', 'flags', 'buttons', '_buttons_property') + _init = deprecated_init(Gtk.Dialog.__init__, + arg_names=('title', 'transient_for', 'flags', + 'add_buttons', 'buttons'), + ignore=('flags', 'add_buttons'), + deprecated_aliases={'transient_for': 'parent', + 'buttons': '_buttons_property'}, + category=PyGTKDeprecationWarning) + + def __init__(self, *args, **kwargs): + + new_kwargs = kwargs.copy() + old_kwargs = dict(zip(self._old_arg_names, args)) + old_kwargs.update(kwargs) + + # Increment the warning stacklevel for sub-classes which implement their own __init__. + stacklevel = 2 + if self.__class__ != Dialog and self.__class__.__init__ != Dialog.__init__: + stacklevel += 1 + + # buttons was overloaded by PyGtk but is needed for Gtk.MessageDialog + # as a pass through, so type check the argument and give a deprecation + # when it is not of type Gtk.ButtonsType + add_buttons = old_kwargs.get('buttons', None) + if add_buttons is not None and not isinstance(add_buttons, Gtk.ButtonsType): + warnings.warn('The "buttons" argument must be a Gtk.ButtonsType enum value. ' + 'Please use the "add_buttons" method for adding buttons. ' + 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', + PyGTKDeprecationWarning, stacklevel=stacklevel) + new_kwargs.pop('buttons', None) + else: + add_buttons = None + + flags = old_kwargs.get('flags', 0) + if flags: + warnings.warn('The "flags" argument for dialog construction is deprecated. ' + 'Please use initializer keywords: modal=True and/or destroy_with_parent=True. ' + 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', + PyGTKDeprecationWarning, stacklevel=stacklevel) + + if flags & Gtk.DialogFlags.MODAL: + new_kwargs['modal'] = True + + if flags & Gtk.DialogFlags.DESTROY_WITH_PARENT: + new_kwargs['destroy_with_parent'] = True + + self._init(*args, **new_kwargs) - def __init__(self, - title=None, - parent=None, - flags=0, - buttons=None, - _buttons_property=None, - **kwds): - - # buttons is overloaded by PyGtk so we have to do the same here - # this breaks some subclasses of Dialog so add a _buttons_property - # keyword to work around this - if _buttons_property is not None: - kwds['buttons'] = _buttons_property - - Gtk.Dialog.__init__(self, **kwds) - if title: - self.set_title(title) - if parent: - self.set_transient_for(parent) - if flags & Gtk.DialogFlags.MODAL: - self.set_modal(True) - if flags & Gtk.DialogFlags.DESTROY_WITH_PARENT: - self.set_destroy_with_parent(True) - - # NO_SEPARATOR has been removed from Gtk 3 - if hasattr(Gtk.DialogFlags, "NO_SEPARATOR") and (flags & Gtk.DialogFlags.NO_SEPARATOR): - self.set_has_separator(False) - import warnings - warnings.warn("Gtk.DialogFlags.NO_SEPARATOR has been depricated since Gtk+-3.0", PyGIDeprecationWarning) - - if buttons is not None: - self.add_buttons(*buttons) - - action_area = property(lambda dialog: dialog.get_action_area()) - vbox = property(lambda dialog: dialog.get_content_area()) + if add_buttons: + self.add_buttons(*add_buttons) + + def run(self, *args, **kwargs): + with register_sigint_fallback(self.destroy): + with wakeup_on_signal(): + return Gtk.Dialog.run(self, *args, **kwargs) + + action_area = property(lambda dialog: dialog.get_action_area()) + vbox = property(lambda dialog: dialog.get_content_area()) def add_buttons(self, *args): """ @@ -494,148 +584,120 @@ class Dialog(Gtk.Dialog, Container): pairs - button text (or stock ID) and a response ID integer are passed individually. For example: - dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE) + .. code-block:: python + + dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE) will add "Open" and "Close" buttons to dialog. """ def _button(b): while b: - t, r = b[0:2] + try: + t, r = b[0:2] + except ValueError: + raise ValueError('Must pass an even number of arguments') b = b[2:] yield t, r - try: - for text, response in _button(args): - self.add_button(text, response) - except (IndexError): - raise TypeError('Must pass an even number of arguments') + for text, response in _button(args): + self.add_button(text, response) + Dialog = override(Dialog) __all__.append('Dialog') -class MessageDialog(Gtk.MessageDialog, Dialog): - def __init__(self, - parent=None, - flags=0, - message_type=Gtk.MessageType.INFO, - buttons=Gtk.ButtonsType.NONE, - message_format=None, - **kwds): +if GTK3: + class MessageDialog(Gtk.MessageDialog, Dialog): + __init__ = deprecated_init(Gtk.MessageDialog.__init__, + arg_names=('parent', 'flags', 'message_type', + 'buttons', 'message_format'), + deprecated_aliases={'text': 'message_format', + 'message_type': 'type'}, + category=PyGTKDeprecationWarning) - if message_format: - kwds['text'] = message_format + def format_secondary_text(self, message_format): + self.set_property('secondary-use-markup', False) + self.set_property('secondary-text', message_format) - # type keyword is used for backwards compat with PyGTK - if 'type' in kwds: - import warnings - warnings.warn("The use of the keyword type as a parameter of the Gtk.MessageDialog constructor has been depricated. Please use message_type instead.", PyGIDeprecationWarning) - message_type = kwds.pop('type') + def format_secondary_markup(self, message_format): + self.set_property('secondary-use-markup', True) + self.set_property('secondary-text', message_format) - Gtk.MessageDialog.__init__(self, - _buttons_property=buttons, - message_type=message_type, - parent=parent, - flags=flags, - **kwds) + MessageDialog = override(MessageDialog) + __all__.append('MessageDialog') - def format_secondary_text(self, message_format): - self.set_property('secondary-use-markup', False) - self.set_property('secondary-text', message_format) - def format_secondary_markup(self, message_format): - self.set_property('secondary-use-markup', True) - self.set_property('secondary-text', message_format) +if GTK3: + class ColorSelectionDialog(Gtk.ColorSelectionDialog): + __init__ = deprecated_init(Gtk.ColorSelectionDialog.__init__, + arg_names=('title',), + category=PyGTKDeprecationWarning) -MessageDialog = override(MessageDialog) -__all__.append('MessageDialog') + ColorSelectionDialog = override(ColorSelectionDialog) + __all__.append('ColorSelectionDialog') + class FileChooserDialog(Gtk.FileChooserDialog): + __init__ = deprecated_init(Gtk.FileChooserDialog.__init__, + arg_names=('title', 'parent', 'action', 'buttons'), + category=PyGTKDeprecationWarning) -class AboutDialog(Gtk.AboutDialog): - def __init__(self, **kwds): - Gtk.AboutDialog.__init__(self, **kwds) + FileChooserDialog = override(FileChooserDialog) + __all__.append('FileChooserDialog') -AboutDialog = override(AboutDialog) -__all__.append('AboutDialog') +if GTK3: + class FontSelectionDialog(Gtk.FontSelectionDialog): + __init__ = deprecated_init(Gtk.FontSelectionDialog.__init__, + arg_names=('title',), + category=PyGTKDeprecationWarning) -class ColorSelectionDialog(Gtk.ColorSelectionDialog): - def __init__(self, title=None, **kwds): - Gtk.ColorSelectionDialog.__init__(self, title=title, **kwds) + FontSelectionDialog = override(FontSelectionDialog) + __all__.append('FontSelectionDialog') -ColorSelectionDialog = override(ColorSelectionDialog) -__all__.append('ColorSelectionDialog') +if GTK3: + class RecentChooserDialog(Gtk.RecentChooserDialog): + # Note, the "manager" keyword must work across the entire 3.x series because + # "recent_manager" is not backwards compatible with PyGObject versions prior to 3.10. + __init__ = deprecated_init(Gtk.RecentChooserDialog.__init__, + arg_names=('title', 'parent', 'recent_manager', 'buttons'), + deprecated_aliases={'recent_manager': 'manager'}, + category=PyGTKDeprecationWarning) -class FileChooserDialog(Gtk.FileChooserDialog): - def __init__(self, - title=None, - parent=None, - action=Gtk.FileChooserAction.OPEN, - buttons=None, - **kwds): - Gtk.FileChooserDialog.__init__(self, - action=action, - title=title, - parent=parent, - buttons=buttons, - **kwds) -FileChooserDialog = override(FileChooserDialog) -__all__.append('FileChooserDialog') - - -class FontSelectionDialog(Gtk.FontSelectionDialog): - def __init__(self, title=None, **kwds): - Gtk.FontSelectionDialog.__init__(self, title=title, **kwds) - -FontSelectionDialog = override(FontSelectionDialog) -__all__.append('FontSelectionDialog') - - -class RecentChooserDialog(Gtk.RecentChooserDialog): - def __init__(self, - title=None, - parent=None, - manager=None, - buttons=None, - **kwds): - - Gtk.RecentChooserDialog.__init__(self, - recent_manager=manager, - title=title, - parent=parent, - buttons=buttons, - **kwds) - -RecentChooserDialog = override(RecentChooserDialog) -__all__.append('RecentChooserDialog') + RecentChooserDialog = override(RecentChooserDialog) + __all__.append('RecentChooserDialog') class IconView(Gtk.IconView): - - def __init__(self, model=None, **kwds): - Gtk.IconView.__init__(self, model=model, **kwds) + if GTK3: + __init__ = deprecated_init(Gtk.IconView.__init__, + arg_names=('model',), + category=PyGTKDeprecationWarning) get_item_at_pos = strip_boolean_result(Gtk.IconView.get_item_at_pos) get_visible_range = strip_boolean_result(Gtk.IconView.get_visible_range) get_dest_item_at_pos = strip_boolean_result(Gtk.IconView.get_dest_item_at_pos) + IconView = override(IconView) __all__.append('IconView') -class ToolButton(Gtk.ToolButton): - - def __init__(self, stock_id=None, **kwds): - Gtk.ToolButton.__init__(self, stock_id=stock_id, **kwds) +if GTK3: + class ToolButton(Gtk.ToolButton): + __init__ = deprecated_init(Gtk.ToolButton.__init__, + arg_names=('stock_id',), + category=PyGTKDeprecationWarning) -ToolButton = override(ToolButton) -__all__.append('ToolButton') + ToolButton = override(ToolButton) + __all__.append('ToolButton') class IMContext(Gtk.IMContext): get_surrounding = strip_boolean_result(Gtk.IMContext.get_surrounding) + IMContext = override(IMContext) __all__.append('IMContext') @@ -643,42 +705,39 @@ __all__.append('IMContext') class RecentInfo(Gtk.RecentInfo): get_application_info = strip_boolean_result(Gtk.RecentInfo.get_application_info) + RecentInfo = override(RecentInfo) __all__.append('RecentInfo') class TextBuffer(Gtk.TextBuffer): - def _get_or_create_tag_table(self): - table = self.get_tag_table() - if table is None: - table = Gtk.TextTagTable() - self.set_tag_table(table) - - return table def create_tag(self, tag_name=None, **properties): - """ - @tag_name: name of the new tag, or None - @properties: keyword list of properties and their values + """Creates a tag and adds it to the tag table of the TextBuffer. + + :param str tag_name: + Name of the new tag, or None + :param **properties: + Keyword list of properties and their values - Creates a tag and adds it to the tag table of the TextBuffer. - Equivalent to creating a Gtk.TextTag and then adding the + This is equivalent to creating a Gtk.TextTag and then adding the tag to the buffer's tag table. The returned tag is owned by the buffer's tag table. - If @tag_name is None, the tag is anonymous. + If ``tag_name`` is None, the tag is anonymous. - If @tag_name is not None, a tag called @tag_name must not already + If ``tag_name`` is not None, a tag called ``tag_name`` must not already exist in the tag table for this buffer. Properties are passed as a keyword list of names and values (e.g. - foreground = 'DodgerBlue', weight = Pango.Weight.BOLD) + foreground='DodgerBlue', weight=Pango.Weight.BOLD) - Return value: a new tag + :returns: + A new tag. """ tag = Gtk.TextTag(name=tag_name, **properties) - self._get_or_create_tag_table().add(tag) + self.get_tag_table().add(tag) return tag def create_mark(self, mark_name, where, left_gravity=False): @@ -688,7 +747,7 @@ class TextBuffer(Gtk.TextBuffer): Gtk.TextBuffer.set_text(self, text, length) def insert(self, iter, text, length=-1): - if not isinstance(text, _basestring): + if not isinstance(text, str): raise TypeError('text must be a string, not %s' % type(text)) Gtk.TextBuffer.insert(self, iter, text, length) @@ -706,9 +765,6 @@ class TextBuffer(Gtk.TextBuffer): self.apply_tag(tag, start, iter) def insert_with_tags_by_name(self, iter, text, *tags): - if not tags: - return - tag_objs = [] for tag in tags: @@ -720,30 +776,22 @@ class TextBuffer(Gtk.TextBuffer): self.insert_with_tags(iter, text, *tag_objs) def insert_at_cursor(self, text, length=-1): - if not isinstance(text, _basestring): + if not isinstance(text, str): raise TypeError('text must be a string, not %s' % type(text)) Gtk.TextBuffer.insert_at_cursor(self, text, length) get_selection_bounds = strip_boolean_result(Gtk.TextBuffer.get_selection_bounds, fail_ret=()) + TextBuffer = override(TextBuffer) __all__.append('TextBuffer') class TextIter(Gtk.TextIter): - forward_search = strip_boolean_result(Gtk.TextIter.forward_search) backward_search = strip_boolean_result(Gtk.TextIter.backward_search) - def begins_tag(self, tag=None): - return super(TextIter, self).begins_tag(tag) - - def ends_tag(self, tag=None): - return super(TextIter, self).ends_tag(tag) - - def toggles_tag(self, tag=None): - return super(TextIter, self).toggles_tag(tag) TextIter = override(TextIter) __all__.append('TextIter') @@ -756,8 +804,9 @@ class TreeModel(Gtk.TreeModel): def __bool__(self): return True - # alias for Python 2.x object protocol - __nonzero__ = __bool__ + if GTK3: + # alias for Python 2.x object protocol + __nonzero__ = __bool__ def _getiter(self, key): if isinstance(key, Gtk.TreeIter): @@ -766,11 +815,7 @@ class TreeModel(Gtk.TreeModel): index = len(self) + key if index < 0: raise IndexError("row index is out of bounds: %d" % key) - try: - aiter = self.get_iter(index) - except ValueError: - raise IndexError("could not find tree path '%s'" % key) - return aiter + return self.get_iter(index) else: try: aiter = self.get_iter(key) @@ -778,6 +823,13 @@ class TreeModel(Gtk.TreeModel): raise IndexError("could not find tree path '%s'" % key) return aiter + def sort_new_with_model(self): + super_object = super(TreeModel, self) + if hasattr(super_object, "sort_new_with_model"): + return super_object.sort_new_with_model() + else: + return TreeModelSort.new_with_model(self) + def _coerce_path(self, path): if isinstance(path, Gtk.TreePath): return path @@ -848,11 +900,7 @@ class TreeModel(Gtk.TreeModel): def set_row(self, treeiter, row): converted_row, columns = self._convert_row(row) for column in columns: - value = row[column] - if value is None: - continue # None means skip this row - - self.set_value(treeiter, column, value) + self.set_value(treeiter, column, row[column]) def _convert_value(self, column, value): '''Convert value to a GObject.Value of the expected type''' @@ -876,9 +924,6 @@ class TreeModel(Gtk.TreeModel): return tuple(values) - def filter_new(self, root=None): - return super(TreeModel, self).filter_new(root) - # # Signals supporting python iterables as tree paths # @@ -914,16 +959,24 @@ class TreeSortable(Gtk.TreeSortable, ): def set_default_sort_func(self, sort_func, user_data=None): super(TreeSortable, self).set_default_sort_func(sort_func, user_data) + TreeSortable = override(TreeSortable) __all__.append('TreeSortable') -class TreeModelSort(Gtk.TreeModelSort): - def __init__(self, model, **kwds): - Gtk.TreeModelSort.__init__(self, model=model, **kwds) +if GTK3: + class TreeModelSort(Gtk.TreeModelSort): + __init__ = deprecated_init(Gtk.TreeModelSort.__init__, + arg_names=('model',), + category=PyGTKDeprecationWarning) -TreeModelSort = override(TreeModelSort) -__all__.append('TreeModelSort') + if not hasattr(Gtk.TreeModelSort, "new_with_model"): + @classmethod + def new_with_model(self, child_model): + return TreeModel.sort_new_with_model(child_model) + + TreeModelSort = override(TreeModelSort) + __all__.append('TreeModelSort') class ListStore(Gtk.ListStore, TreeModel, TreeSortable): @@ -931,10 +984,17 @@ class ListStore(Gtk.ListStore, TreeModel, TreeSortable): Gtk.ListStore.__init__(self) self.set_column_types(column_types) + # insert_with_valuesv got renamed to insert_with_values with 4.1.0 + # https://gitlab.gnome.org/GNOME/gtk/-/commit/a1216599ff6b39bca3e9 + if not hasattr(Gtk.ListStore, "insert_with_valuesv"): + insert_with_valuesv = Gtk.ListStore.insert_with_values + elif not hasattr(Gtk.ListStore, "insert_with_values"): + insert_with_values = Gtk.ListStore.insert_with_valuesv + def _do_insert(self, position, row): if row is not None: row, columns = self._convert_row(row) - treeiter = self.insert_with_valuesv(position, columns, row) + treeiter = self.insert_with_values(position, columns, row) else: treeiter = Gtk.ListStore.insert(self, position) @@ -954,58 +1014,59 @@ class ListStore(Gtk.ListStore, TreeModel, TreeSortable): def insert(self, position, row=None): return self._do_insert(position, row) - # FIXME: sends two signals; check if this can use an atomic - # insert_with_valuesv() - def insert_before(self, sibling, row=None): - treeiter = Gtk.ListStore.insert_before(self, sibling) - if row is not None: - self.set_row(treeiter, row) - - return treeiter + if sibling is None: + position = -1 + else: + position = self.get_path(sibling).get_indices()[-1] + return self._do_insert(position, row) - # FIXME: sends two signals; check if this can use an atomic - # insert_with_valuesv() + return Gtk.ListStore.insert_before(self, sibling) def insert_after(self, sibling, row=None): - treeiter = Gtk.ListStore.insert_after(self, sibling) - if row is not None: - self.set_row(treeiter, row) + if sibling is None: + position = 0 + else: + position = self.get_path(sibling).get_indices()[-1] + 1 + return self._do_insert(position, row) - return treeiter + return Gtk.ListStore.insert_after(self, sibling) def set_value(self, treeiter, column, value): value = self._convert_value(column, value) Gtk.ListStore.set_value(self, treeiter, column, value) def set(self, treeiter, *args): - - def _set_lists(columns, values): - if len(columns) != len(values): + def _set_lists(cols, vals): + if len(cols) != len(vals): raise TypeError('The number of columns do not match the number of values') - for col_num, val in zip(columns, values): + + columns = [] + values = [] + for col_num, value in zip(cols, vals): if not isinstance(col_num, int): raise TypeError('TypeError: Expected integer argument for column.') - self.set_value(treeiter, col_num, val) + + columns.append(col_num) + values.append(self._convert_value(col_num, value)) + + Gtk.ListStore.set(self, treeiter, columns, values) if args: if isinstance(args[0], int): - columns = args[::2] - values = args[1::2] - _set_lists(columns, values) + _set_lists(args[::2], args[1::2]) elif isinstance(args[0], (tuple, list)): if len(args) != 2: raise TypeError('Too many arguments') _set_lists(args[0], args[1]) elif isinstance(args[0], dict): - columns = args[0].keys() - values = args[0].values() - _set_lists(columns, values) + _set_lists(list(args[0]), args[0].values()) else: raise TypeError('Argument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.') + ListStore = override(ListStore) __all__.append('ListStore') @@ -1021,8 +1082,8 @@ class TreeModelRow(object): elif isinstance(iter_or_path, Gtk.TreeIter): self.iter = iter_or_path else: - raise TypeError("expected Gtk.TreeIter or Gtk.TreePath, \ - %s found" % type(iter_or_path).__name__) + raise TypeError("expected Gtk.TreeIter or Gtk.TreePath, " + "%s found" % type(iter_or_path).__name__) @property def path(self): @@ -1068,8 +1129,11 @@ class TreeModelRow(object): for i in range(start, stop, step): alist.append(self.model.get_value(self.iter, i)) return alist + elif isinstance(key, tuple): + return [self[k] for k in key] else: - raise TypeError("indices must be integers, not %s" % type(key).__name__) + raise TypeError("indices must be integers, slice or tuple, not %s" + % type(key).__name__) def __setitem__(self, key, value): if isinstance(key, int): @@ -1088,8 +1152,16 @@ class TreeModelRow(object): for i, v in enumerate(indexList): self.model.set_value(self.iter, v, value[i]) + elif isinstance(key, tuple): + if len(key) != len(value): + raise ValueError( + "attempt to assign sequence of size %d to sequence of size %d" + % (len(value), len(key))) + for k, v in zip(key, value): + self[k] = v else: - raise TypeError("index must be an integer or slice, not %s" % type(key).__name__) + raise TypeError("indices must be an integer, slice or tuple, not %s" + % type(key).__name__) def _convert_negative_index(self, index): new_index = self.model.get_n_columns() + index @@ -1101,6 +1173,7 @@ class TreeModelRow(object): child_iter = self.model.iter_children(self.iter) return TreeModelRowIter(self.model, child_iter) + __all__.append('TreeModelRow') @@ -1117,12 +1190,14 @@ class TreeModelRowIter(object): self.iter = self.model.iter_next(self.iter) return row - # alias for Python 2.x object protocol - next = __next__ + if GTK3: + # alias for Python 2.x object protocol + next = __next__ def __iter__(self): return self + __all__.append('TreeModelRowIter') @@ -1131,7 +1206,7 @@ class TreePath(Gtk.TreePath): def __new__(cls, path=0): if isinstance(path, int): path = str(path) - elif not isinstance(path, _basestring): + elif not isinstance(path, str): path = ":".join(str(val) for val in path) if len(path) == 0: @@ -1141,17 +1216,20 @@ class TreePath(Gtk.TreePath): except TypeError: raise TypeError("could not parse subscript '%s' as a tree path" % path) + def __init__(self, *args, **kwargs): + super(TreePath, self).__init__() + def __str__(self): - return self.to_string() + return self.to_string() or "" def __lt__(self, other): - return not other is None and self.compare(other) < 0 + return other is not None and self.compare(other) < 0 def __le__(self, other): - return not other is None and self.compare(other) <= 0 + return other is not None and self.compare(other) <= 0 def __eq__(self, other): - return not other is None and self.compare(other) == 0 + return other is not None and self.compare(other) == 0 def __ne__(self, other): return other is None or self.compare(other) != 0 @@ -1171,12 +1249,12 @@ class TreePath(Gtk.TreePath): def __getitem__(self, index): return self.get_indices()[index] + TreePath = override(TreePath) __all__.append('TreePath') class TreeStore(Gtk.TreeStore, TreeModel, TreeSortable): - def __init__(self, *column_types): Gtk.TreeStore.__init__(self) self.set_column_types(column_types) @@ -1199,83 +1277,89 @@ class TreeStore(Gtk.TreeStore, TreeModel, TreeSortable): def insert(self, parent, position, row=None): return self._do_insert(parent, position, row) - # FIXME: sends two signals; check if this can use an atomic - # insert_with_valuesv() - def insert_before(self, parent, sibling, row=None): - treeiter = Gtk.TreeStore.insert_before(self, parent, sibling) - if row is not None: - self.set_row(treeiter, row) - - return treeiter + if sibling is None: + position = -1 + else: + if parent is None: + parent = self.iter_parent(sibling) + position = self.get_path(sibling).get_indices()[-1] + return self._do_insert(parent, position, row) - # FIXME: sends two signals; check if this can use an atomic - # insert_with_valuesv() + return Gtk.TreeStore.insert_before(self, parent, sibling) def insert_after(self, parent, sibling, row=None): - treeiter = Gtk.TreeStore.insert_after(self, parent, sibling) - if row is not None: - self.set_row(treeiter, row) + if sibling is None: + position = 0 + else: + if parent is None: + parent = self.iter_parent(sibling) + position = self.get_path(sibling).get_indices()[-1] + 1 + return self._do_insert(parent, position, row) - return treeiter + return Gtk.TreeStore.insert_after(self, parent, sibling) def set_value(self, treeiter, column, value): value = self._convert_value(column, value) Gtk.TreeStore.set_value(self, treeiter, column, value) def set(self, treeiter, *args): - - def _set_lists(columns, values): - if len(columns) != len(values): + def _set_lists(cols, vals): + if len(cols) != len(vals): raise TypeError('The number of columns do not match the number of values') - for col_num, val in zip(columns, values): + + columns = [] + values = [] + for col_num, value in zip(cols, vals): if not isinstance(col_num, int): raise TypeError('TypeError: Expected integer argument for column.') - self.set_value(treeiter, col_num, val) + + columns.append(col_num) + values.append(self._convert_value(col_num, value)) + + Gtk.TreeStore.set(self, treeiter, columns, values) if args: if isinstance(args[0], int): - columns = args[::2] - values = args[1::2] - _set_lists(columns, values) + _set_lists(args[::2], args[1::2]) elif isinstance(args[0], (tuple, list)): if len(args) != 2: raise TypeError('Too many arguments') _set_lists(args[0], args[1]) elif isinstance(args[0], dict): - columns = args[0].keys() - values = args[0].values() - _set_lists(columns, values) + _set_lists(args[0].keys(), args[0].values()) else: raise TypeError('Argument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.') + TreeStore = override(TreeStore) __all__.append('TreeStore') class TreeView(Gtk.TreeView, Container): - - def __init__(self, model=None): - Gtk.TreeView.__init__(self) - if model: - self.set_model(model) + if GTK3: + __init__ = deprecated_init(Gtk.TreeView.__init__, + arg_names=('model',), + category=PyGTKDeprecationWarning) get_path_at_pos = strip_boolean_result(Gtk.TreeView.get_path_at_pos) get_visible_range = strip_boolean_result(Gtk.TreeView.get_visible_range) get_dest_row_at_pos = strip_boolean_result(Gtk.TreeView.get_dest_row_at_pos) - def enable_model_drag_source(self, start_button_mask, targets, actions): - target_entries = _construct_target_list(targets) - super(TreeView, self).enable_model_drag_source(start_button_mask, - target_entries, - actions) + if GTK3: + def enable_model_drag_source(self, start_button_mask, targets, actions): + target_entries = _construct_target_list(targets) + super(TreeView, self).enable_model_drag_source(start_button_mask, + target_entries, + actions) - def enable_model_drag_dest(self, targets, actions): - target_entries = _construct_target_list(targets) - super(TreeView, self).enable_model_drag_dest(target_entries, - actions) + if GTK3: + def enable_model_drag_dest(self, targets, actions): + target_entries = _construct_target_list(targets) + super(TreeView, self).enable_model_drag_dest(target_entries, + actions) def scroll_to_cell(self, path, column=None, use_align=False, row_align=0.0, col_align=0.0): if not isinstance(path, Gtk.TreePath): @@ -1299,6 +1383,7 @@ class TreeView(Gtk.TreeView, Container): self.insert_column(column, position) column.set_attributes(cell, **kwargs) + TreeView = override(TreeView) __all__.append('TreeView') @@ -1355,140 +1440,183 @@ TreeSelection = override(TreeSelection) __all__.append('TreeSelection') -class Button(Gtk.Button, Container): - def __init__(self, label=None, stock=None, use_stock=False, use_underline=False, **kwds): - if stock: - label = stock - use_stock = True - use_underline = True - Gtk.Button.__init__(self, label=label, use_stock=use_stock, - use_underline=use_underline, **kwds) -Button = override(Button) -__all__.append('Button') +if GTK3: + class Button(Gtk.Button, Container): + _init = deprecated_init(Gtk.Button.__init__, + arg_names=('label', 'stock', 'use_stock', 'use_underline'), + ignore=('stock',), + category=PyGTKDeprecationWarning, + stacklevel=3) + + def __init__(self, *args, **kwargs): + # Doubly deprecated initializer, the stock keyword is non-standard. + # Simply give a warning that stock items are deprecated even though + # we want to deprecate the non-standard keyword as well here from + # the overrides. + if 'stock' in kwargs and kwargs['stock']: + warnings.warn('Stock items are deprecated. ' + 'Please use: Gtk.Button.new_with_mnemonic(label)', + PyGTKDeprecationWarning, stacklevel=2) + new_kwargs = kwargs.copy() + new_kwargs['label'] = new_kwargs['stock'] + new_kwargs['use_stock'] = True + new_kwargs['use_underline'] = True + del new_kwargs['stock'] + Gtk.Button.__init__(self, **new_kwargs) + else: + self._init(*args, **kwargs) + if hasattr(Gtk.Widget, "set_focus_on_click"): + def set_focus_on_click(self, *args, **kwargs): + # Gtk.Widget.set_focus_on_click should be used instead but it's + # no obvious how because of the shadowed method, so override here + return Gtk.Widget.set_focus_on_click(self, *args, **kwargs) -class LinkButton(Gtk.LinkButton): - def __init__(self, uri, label=None, **kwds): - Gtk.LinkButton.__init__(self, uri=uri, label=label, **kwds) + if hasattr(Gtk.Widget, "get_focus_on_click"): + def get_focus_on_click(self, *args, **kwargs): + # Gtk.Widget.get_focus_on_click should be used instead but it's + # no obvious how because of the shadowed method, so override here + return Gtk.Widget.get_focus_on_click(self, *args, **kwargs) -LinkButton = override(LinkButton) -__all__.append('LinkButton') + Button = override(Button) + __all__.append('Button') + class LinkButton(Gtk.LinkButton): + __init__ = deprecated_init(Gtk.LinkButton.__init__, + arg_names=('uri', 'label'), + category=PyGTKDeprecationWarning) -class Label(Gtk.Label): - def __init__(self, label=None, **kwds): - Gtk.Label.__init__(self, label=label, **kwds) + LinkButton = override(LinkButton) + __all__.append('LinkButton') -Label = override(Label) -__all__.append('Label') + class Label(Gtk.Label): + __init__ = deprecated_init(Gtk.Label.__init__, + arg_names=('label',), + category=PyGTKDeprecationWarning) + Label = override(Label) + __all__.append('Label') -class Adjustment(Gtk.Adjustment): - def __init__(self, *args, **kwds): - arg_names = ('value', 'lower', 'upper', - 'step_increment', 'page_increment', 'page_size') - new_args = dict(zip(arg_names, args)) - new_args.update(kwds) - - # PyGTK compatiblity - if 'page_incr' in new_args: - new_args['page_increment'] = new_args.pop('page_incr') - if 'step_incr' in new_args: - new_args['step_increment'] = new_args.pop('step_incr') - Gtk.Adjustment.__init__(self, **new_args) - - # The value property is set between lower and (upper - page_size). - # Just in case lower, upper or page_size was still 0 when value - # was set, we set it again here. - if 'value' in new_args: - self.set_value(new_args['value']) -Adjustment = override(Adjustment) -__all__.append('Adjustment') - - -class Table(Gtk.Table, Container): - def __init__(self, rows=1, columns=1, homogeneous=False, **kwds): - if 'n_rows' in kwds: - rows = kwds.pop('n_rows') +class Adjustment(Gtk.Adjustment): + if GTK3: + _init = deprecated_init(Gtk.Adjustment.__init__, + arg_names=('value', 'lower', 'upper', + 'step_increment', 'page_increment', 'page_size'), + deprecated_aliases={'page_increment': 'page_incr', + 'step_increment': 'step_incr'}, + category=PyGTKDeprecationWarning, + stacklevel=3) + + def __init__(self, *args, **kwargs): + if GTK3: + self._init(*args, **kwargs) + # The value property is set between lower and (upper - page_size). + # Just in case lower, upper or page_size was still 0 when value + # was set, we set it again here. + if 'value' in kwargs: + self.set_value(kwargs['value']) + elif len(args) >= 1: + self.set_value(args[0]) + else: + Gtk.Adjustment.__init__(self, *args, **kwargs) - if 'n_columns' in kwds: - columns = kwds.pop('n_columns') + # The value property is set between lower and (upper - page_size). + # Just in case lower, upper or page_size was still 0 when value + # was set, we set it again here. + if 'value' in kwargs: + self.set_value(kwargs['value']) - Gtk.Table.__init__(self, n_rows=rows, n_columns=columns, homogeneous=homogeneous, **kwds) - def attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, xpadding=0, ypadding=0): - Gtk.Table.attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding) +Adjustment = override(Adjustment) +__all__.append('Adjustment') -Table = override(Table) -__all__.append('Table') +if GTK3: + class Table(Gtk.Table, Container): + __init__ = deprecated_init(Gtk.Table.__init__, + arg_names=('n_rows', 'n_columns', 'homogeneous'), + deprecated_aliases={'n_rows': 'rows', 'n_columns': 'columns'}, + category=PyGTKDeprecationWarning) -class ScrolledWindow(Gtk.ScrolledWindow): - def __init__(self, hadjustment=None, vadjustment=None, **kwds): - Gtk.ScrolledWindow.__init__(self, hadjustment=hadjustment, vadjustment=vadjustment, **kwds) + def attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, xpadding=0, ypadding=0): + Gtk.Table.attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding) -ScrolledWindow = override(ScrolledWindow) -__all__.append('ScrolledWindow') + Table = override(Table) + __all__.append('Table') + class ScrolledWindow(Gtk.ScrolledWindow): + __init__ = deprecated_init(Gtk.ScrolledWindow.__init__, + arg_names=('hadjustment', 'vadjustment'), + category=PyGTKDeprecationWarning) -class HScrollbar(Gtk.HScrollbar): - def __init__(self, adjustment=None, **kwds): - Gtk.HScrollbar.__init__(self, adjustment=adjustment, **kwds) + ScrolledWindow = override(ScrolledWindow) + __all__.append('ScrolledWindow') -HScrollbar = override(HScrollbar) -__all__.append('HScrollbar') +if GTK3: + class HScrollbar(Gtk.HScrollbar): + __init__ = deprecated_init(Gtk.HScrollbar.__init__, + arg_names=('adjustment',), + category=PyGTKDeprecationWarning) -class VScrollbar(Gtk.VScrollbar): - def __init__(self, adjustment=None, **kwds): - Gtk.VScrollbar.__init__(self, adjustment=adjustment, **kwds) + HScrollbar = override(HScrollbar) + __all__.append('HScrollbar') -VScrollbar = override(VScrollbar) -__all__.append('VScrollbar') + class VScrollbar(Gtk.VScrollbar): + __init__ = deprecated_init(Gtk.VScrollbar.__init__, + arg_names=('adjustment',), + category=PyGTKDeprecationWarning) + VScrollbar = override(VScrollbar) + __all__.append('VScrollbar') -class Paned(Gtk.Paned): - def pack1(self, child, resize=False, shrink=True): - super(Paned, self).pack1(child, resize, shrink) - def pack2(self, child, resize=True, shrink=True): - super(Paned, self).pack2(child, resize, shrink) +if GTK3: + class Paned(Gtk.Paned): + def pack1(self, child, resize=False, shrink=True): + super(Paned, self).pack1(child, resize, shrink) -Paned = override(Paned) -__all__.append('Paned') + def pack2(self, child, resize=True, shrink=True): + super(Paned, self).pack2(child, resize, shrink) + Paned = override(Paned) + __all__.append('Paned') -class Arrow(Gtk.Arrow): - def __init__(self, arrow_type, shadow_type, **kwds): - Gtk.Arrow.__init__(self, arrow_type=arrow_type, - shadow_type=shadow_type, - **kwds) -Arrow = override(Arrow) -__all__.append('Arrow') +if GTK3: + class Arrow(Gtk.Arrow): + __init__ = deprecated_init(Gtk.Arrow.__init__, + arg_names=('arrow_type', 'shadow_type'), + category=PyGTKDeprecationWarning) + Arrow = override(Arrow) + __all__.append('Arrow') -class IconSet(Gtk.IconSet): - def __new__(cls, pixbuf=None): - if pixbuf is not None: - iconset = Gtk.IconSet.new_from_pixbuf(pixbuf) - else: - iconset = Gtk.IconSet.__new__(cls) - return iconset + class IconSet(Gtk.IconSet): + def __new__(cls, pixbuf=None): + if pixbuf is not None: + warnings.warn('Gtk.IconSet(pixbuf) has been deprecated. Please use: ' + 'Gtk.IconSet.new_from_pixbuf(pixbuf)', + PyGTKDeprecationWarning, stacklevel=2) + iconset = Gtk.IconSet.new_from_pixbuf(pixbuf) + else: + iconset = Gtk.IconSet.__new__(cls) + return iconset -IconSet = override(IconSet) -__all__.append('IconSet') + def __init__(self, *args, **kwargs): + return super(IconSet, self).__init__() + IconSet = override(IconSet) + __all__.append('IconSet') -class Viewport(Gtk.Viewport): - def __init__(self, hadjustment=None, vadjustment=None, **kwds): - Gtk.Viewport.__init__(self, hadjustment=hadjustment, - vadjustment=vadjustment, - **kwds) + class Viewport(Gtk.Viewport): + __init__ = deprecated_init(Gtk.Viewport.__init__, + arg_names=('hadjustment', 'vadjustment'), + category=PyGTKDeprecationWarning) -Viewport = override(Viewport) -__all__.append('Viewport') + Viewport = override(Viewport) + __all__.append('Viewport') class TreeModelFilter(Gtk.TreeModelFilter): @@ -1500,25 +1628,78 @@ class TreeModelFilter(Gtk.TreeModelFilter): iter = self.convert_iter_to_child_iter(iter) self.get_model().set_value(iter, column, value) + TreeModelFilter = override(TreeModelFilter) __all__.append('TreeModelFilter') -if Gtk._version != '2.0': + +class CssProvider(Gtk.CssProvider): + def load_from_data(self, text, length=-1): + if (Gtk.get_major_version(), Gtk.get_minor_version()) >= (4, 9): + if isinstance(text, bytes): + text = text.decode("utf-8") + super(CssProvider, self).load_from_data(text, length) + else: + if isinstance(text, str): + text = text.encode("utf-8") + super(CssProvider, self).load_from_data(text) + + +CssProvider = override(CssProvider) +__all__.append("CssProvider") + +if GTK4: + class CustomSorter(Gtk.CustomSorter): + + @classmethod + def new(cls, sort_func, user_data=None): + if sort_func is not None: + compare_func = wrap_list_store_sort_func(sort_func) + else: + compare_func = None + + return Gtk.CustomSorter.new(compare_func, user_data) + + def set_sort_func(self, sort_func, user_data=None): + if sort_func is not None: + compare_func = wrap_list_store_sort_func(sort_func) + else: + compare_func = None + + return super(CustomSorter, self).set_sort_func(compare_func, user_data) + + CustomSorter = override(CustomSorter) + __all__.append("CustomSorter") + +if GTK3: class Menu(Gtk.Menu): def popup(self, parent_menu_shell, parent_menu_item, func, data, button, activate_time): self.popup_for_device(None, parent_menu_shell, parent_menu_item, func, data, button, activate_time) Menu = override(Menu) __all__.append('Menu') -_Gtk_main_quit = Gtk.main_quit +if GTK3: + _Gtk_main_quit = Gtk.main_quit + + @override(Gtk.main_quit) + def main_quit(*args): + _Gtk_main_quit() + _Gtk_main = Gtk.main -@override(Gtk.main_quit) -def main_quit(*args): - _Gtk_main_quit() + @override(Gtk.main) + def main(*args, **kwargs): + with register_sigint_fallback(Gtk.main_quit): + with wakeup_on_signal(): + return _Gtk_main(*args, **kwargs) -stock_lookup = strip_boolean_result(Gtk.stock_lookup) -__all__.append('stock_lookup') -initialized, argv = Gtk.init_check(sys.argv) -sys.argv = list(argv) +if GTK3: + stock_lookup = strip_boolean_result(Gtk.stock_lookup) + __all__.append('stock_lookup') + +if GTK4: + initialized = Gtk.init_check() +else: + initialized, argv = Gtk.init_check(sys.argv) + sys.argv = list(argv) diff --git a/gi/overrides/Makefile.am b/gi/overrides/Makefile.am deleted file mode 100644 index e69c91c..0000000 --- a/gi/overrides/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -pygioverridesdir = $(pyexecdir)/gi/overrides - -pygioverrides_PYTHON = \ - GLib.py \ - Gtk.py \ - Gdk.py \ - GObject.py \ - Gio.py \ - GIMarshallingTests.py \ - Pango.py \ - keysyms.py \ - __init__.py - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygioverrides_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: build_pylinks -check-local: build_pylinks diff --git a/gi/overrides/Makefile.in b/gi/overrides/Makefile.in deleted file mode 100644 index 7b2d5ab..0000000 --- a/gi/overrides/Makefile.in +++ /dev/null @@ -1,582 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = gi/overrides -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(pygioverrides_PYTHON) $(top_srcdir)/py-compile -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) -am__installdirs = "$(DESTDIR)$(pygioverridesdir)" -am__pep3147_tweak = \ - sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' -py_compile = $(top_srcdir)/py-compile -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -pygioverridesdir = $(pyexecdir)/gi/overrides -pygioverrides_PYTHON = \ - GLib.py \ - Gtk.py \ - Gdk.py \ - GObject.py \ - Gio.py \ - GIMarshallingTests.py \ - Pango.py \ - keysyms.py \ - __init__.py - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gi/overrides/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign gi/overrides/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-pygioverridesPYTHON: $(pygioverrides_PYTHON) - @$(NORMAL_INSTALL) - @list='$(pygioverrides_PYTHON)'; dlist=; list2=; test -n "$(pygioverridesdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pygioverridesdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pygioverridesdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ - if test -f $$b$$p; then \ - $(am__strip_dir) \ - dlist="$$dlist $$f"; \ - list2="$$list2 $$b$$p"; \ - else :; fi; \ - done; \ - for file in $$list2; do echo $$file; done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pygioverridesdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pygioverridesdir)" || exit $$?; \ - done || exit $$?; \ - if test -n "$$dlist"; then \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygioverridesdir)" $$dlist; \ - else :; fi - -uninstall-pygioverridesPYTHON: - @$(NORMAL_UNINSTALL) - @list='$(pygioverrides_PYTHON)'; test -n "$(pygioverridesdir)" || list=; \ - py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$py_files" || exit 0; \ - dir='$(DESTDIR)$(pygioverridesdir)'; \ - pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ - pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ - py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ - echo "$$py_files_pep3147";\ - pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ - pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ - st=0; \ - for files in \ - "$$py_files" \ - "$$pyc_files" \ - "$$pyo_files" \ - "$$pyc_files_pep3147" \ - "$$pyo_files_pep3147" \ - ; do \ - $(am__uninstall_files_from_dir) || st=$$?; \ - done; \ - exit $$st -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-am -all-am: Makefile all-local -installdirs: - for dir in "$(DESTDIR)$(pygioverridesdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-pygioverridesPYTHON - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-pygioverridesPYTHON - -.MAKE: check-am install-am install-strip - -.PHONY: all all-am all-local check check-am check-local clean \ - clean-generic clean-libtool cscopelist-am ctags-am distclean \ - distclean-generic distclean-libtool distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-pygioverridesPYTHON \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am uninstall-pygioverridesPYTHON - - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygioverrides_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: build_pylinks -check-local: build_pylinks - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/gi/overrides/Pango.py b/gi/overrides/Pango.py index 15d5edc..7d0d8cf 100644 --- a/gi/overrides/Pango.py +++ b/gi/overrides/Pango.py @@ -26,15 +26,6 @@ Pango = get_introspection_module('Pango') __all__ = [] -class Context(Pango.Context): - - def get_metrics(self, desc, language=None): - return super(Context, self).get_metrics(desc, language) - -Context = override(Context) -__all__.append('Context') - - class FontDescription(Pango.FontDescription): def __new__(cls, string=None): @@ -43,6 +34,10 @@ class FontDescription(Pango.FontDescription): else: return Pango.FontDescription.__new__(cls) + def __init__(self, *args, **kwargs): + return super(FontDescription, self).__init__() + + FontDescription = override(FontDescription) __all__.append('FontDescription') @@ -52,13 +47,12 @@ class Layout(Pango.Layout): def __new__(cls, context): return Pango.Layout.new(context) - def __init__(self, context, **kwds): - # simply discard 'context', since it was set by - # __new__ and it is not a PangoLayout property - super(Layout, self).__init__(**kwds) - def set_markup(self, text, length=-1): super(Layout, self).set_markup(text, length) + def set_text(self, text, length=-1): + super(Layout, self).set_text(text, length) + + Layout = override(Layout) __all__.append('Layout') diff --git a/gi/overrides/__init__.py b/gi/overrides/__init__.py index 8aa9731..37dfbbe 100644 --- a/gi/overrides/__init__.py +++ b/gi/overrides/__init__.py @@ -1,10 +1,13 @@ +import functools import types import warnings -import functools +import importlib +import sys +from pkgutil import get_loader from gi import PyGIDeprecationWarning -from gi._gi import CallableInfo -from gi._gobject.constants import \ +from gi._gi import CallableInfo, pygobject_new_full +from gi._constants import \ TYPE_NONE, \ TYPE_INVALID @@ -12,76 +15,200 @@ from gi._gobject.constants import \ from pkgutil import extend_path __path__ = extend_path(__path__, __name__) -registry = None +# namespace -> (attr, replacement) +_deprecated_attrs = {} + + +class OverridesProxyModule(types.ModuleType): + """Wraps a introspection module and contains all overrides""" + + def __init__(self, introspection_module): + super(OverridesProxyModule, self).__init__( + introspection_module.__name__) + self._introspection_module = introspection_module + + def __getattr__(self, name): + return getattr(self._introspection_module, name) + + def __dir__(self): + result = set(dir(self.__class__)) + result.update(self.__dict__.keys()) + result.update(dir(self._introspection_module)) + return sorted(result) + + def __repr__(self): + return "<%s %r>" % (type(self).__name__, self._introspection_module) + + +class _DeprecatedAttribute(object): + """A deprecation descriptor for OverridesProxyModule subclasses. + + Emits a PyGIDeprecationWarning on every access and tries to act as a + normal instance attribute (can be replaced and deleted). + """ + + def __init__(self, namespace, attr, value, replacement): + self._attr = attr + self._value = value + self._warning = PyGIDeprecationWarning( + '%s.%s is deprecated; use %s instead' % ( + namespace, attr, replacement)) + + def __get__(self, instance, owner): + if instance is None: + raise AttributeError(self._attr) + warnings.warn(self._warning, stacklevel=2) + return self._value + + def __set__(self, instance, value): + attr = self._attr + # delete the descriptor, then set the instance value + delattr(type(instance), attr) + setattr(instance, attr, value) + + def __delete__(self, instance): + # delete the descriptor + delattr(type(instance), self._attr) + + +def load_overrides(introspection_module): + """Loads overrides for an introspection module. + + Either returns the same module again in case there are no overrides or a + proxy module including overrides. Doesn't cache the result. + """ -class _Registry(dict): - def __setitem__(self, key, value): - '''We do checks here to make sure only submodules of the override - module are added. Key and value should be the same object and come - from the gi.override module. + namespace = introspection_module.__name__.rsplit(".", 1)[-1] + module_key = 'gi.repository.' + namespace - We add the override to the dict as "override_module.name". For instance - if we were overriding Gtk.Button you would retrive it as such: - registry['Gtk.Button'] - ''' - if not key == value: - raise KeyError('You have tried to modify the registry. This should only be done by the override decorator') + # We use sys.modules so overrides can import from gi.repository + # but restore everything at the end so this doesn't have any side effects + has_old = module_key in sys.modules + old_module = sys.modules.get(module_key) + # Create a new sub type, so we can separate descriptors like + # _DeprecatedAttribute for each namespace. + proxy_type = type(namespace + "ProxyModule", (OverridesProxyModule, ), {}) + + proxy = proxy_type(introspection_module) + sys.modules[module_key] = proxy + + # backwards compat: + # gedit uses gi.importer.modules['Gedit']._introspection_module + from ..importer import modules + assert hasattr(proxy, "_introspection_module") + modules[namespace] = proxy + + try: + override_package_name = 'gi.overrides.' + namespace + + # http://bugs.python.org/issue14710 try: - info = getattr(value, '__info__') + override_loader = get_loader(override_package_name) + except AttributeError: - raise TypeError('Can not override a type %s, which is not in a gobject introspection typelib' % value.__name__) + override_loader = None - if not value.__module__.startswith('gi.overrides'): - raise KeyError('You have tried to modify the registry outside of the overrides module. ' - 'This is not allowed (%s, %s)' % (value, value.__module__)) + # Avoid checking for an ImportError, an override might + # depend on a missing module thus causing an ImportError + if override_loader is None: + return introspection_module - g_type = info.get_g_type() - assert g_type != TYPE_NONE - if g_type != TYPE_INVALID: - g_type.pytype = value - - # strip gi.overrides from module name - module = value.__module__[13:] - key = "%s.%s" % (module, value.__name__) - super(_Registry, self).__setitem__(key, value) - - def register(self, override_class): - self[override_class] = override_class - - -class overridefunc(object): - '''decorator for overriding a function''' - def __init__(self, func): - if not isinstance(func, CallableInfo): - raise TypeError("func must be a gi function, got %s" % func) - from ..importer import modules - module_name = func.__module__.rsplit('.', 1)[-1] - self.module = modules[module_name]._introspection_module - - def __call__(self, func): - def wrapper(*args, **kwargs): - return func(*args, **kwargs) - wrapper.__name__ = func.__name__ - wrapper.__doc__ = func.__doc__ - setattr(self.module, func.__name__, wrapper) - return wrapper + override_mod = importlib.import_module(override_package_name) -registry = _Registry() + finally: + del modules[namespace] + del sys.modules[module_key] + if has_old: + sys.modules[module_key] = old_module + + # backwards compat: for gst-python/gstmodule.c, + # which tries to access Gst.Fraction through + # Gst._overrides_module.Fraction. We assign the proxy instead as that + # contains all overridden classes like Fraction during import anyway and + # there is no need to keep the real override module alive. + proxy._overrides_module = proxy + + override_all = [] + if hasattr(override_mod, "__all__"): + override_all = override_mod.__all__ + + for var in override_all: + try: + item = getattr(override_mod, var) + except (AttributeError, TypeError): + # Gedit puts a non-string in __all__, so catch TypeError here + continue + setattr(proxy, var, item) + + # Replace deprecated module level attributes with a descriptor + # which emits a warning when accessed. + for attr, replacement in _deprecated_attrs.pop(namespace, []): + try: + value = getattr(proxy, attr) + except AttributeError: + raise AssertionError( + "%s was set deprecated but wasn't added to __all__" % attr) + delattr(proxy, attr) + deprecated_attr = _DeprecatedAttribute( + namespace, attr, value, replacement) + setattr(proxy_type, attr, deprecated_attr) + + return proxy def override(type_): - '''Decorator for registering an override''' - if isinstance(type_, (types.FunctionType, CallableInfo)): - return overridefunc(type_) + """Decorator for registering an override. + + Other than objects added to __all__, these can get referenced in the same + override module via the gi.repository module (get_parent_for_object() does + for example), so they have to be added to the module immediately. + """ + + if isinstance(type_, CallableInfo): + func = type_ + namespace = func.__module__.rsplit('.', 1)[-1] + module = sys.modules["gi.repository." + namespace] + + def wrapper(func): + setattr(module, func.__name__, func) + return func + + return wrapper + elif isinstance(type_, types.FunctionType): + raise TypeError("func must be a gi function, got %s" % type_) else: - registry.register(type_) + try: + info = getattr(type_, '__info__') + except AttributeError: + raise TypeError( + 'Can not override a type %s, which is not in a gobject ' + 'introspection typelib' % type_.__name__) + + if not type_.__module__.startswith('gi.overrides'): + raise KeyError( + 'You have tried override outside of the overrides module. ' + 'This is not allowed (%s, %s)' % (type_, type_.__module__)) + + g_type = info.get_g_type() + assert g_type != TYPE_NONE + if g_type != TYPE_INVALID: + g_type.pytype = type_ + + namespace = type_.__module__.rsplit(".", 1)[-1] + module = sys.modules["gi.repository." + namespace] + setattr(module, type_.__name__, type_) + return type_ +overridefunc = override +"""Deprecated""" + + def deprecated(fn, replacement): - '''Decorator for marking methods and classes as deprecated''' + """Decorator for marking methods and classes as deprecated""" @functools.wraps(fn) def wrapped(*args, **kwargs): warnings.warn('%s is deprecated; use %s instead' % (fn.__name__, replacement), @@ -90,13 +217,117 @@ def deprecated(fn, replacement): return wrapped +def deprecated_attr(namespace, attr, replacement): + """Marks a module level attribute as deprecated. Accessing it will emit + a PyGIDeprecationWarning warning. + + e.g. for ``deprecated_attr("GObject", "STATUS_FOO", "GLib.Status.FOO")`` + accessing GObject.STATUS_FOO will emit: + + "GObject.STATUS_FOO is deprecated; use GLib.Status.FOO instead" + + :param str namespace: + The namespace of the override this is called in. + :param str namespace: + The attribute name (which gets added to __all__). + :param str replacement: + The replacement text which will be included in the warning. + """ + + _deprecated_attrs.setdefault(namespace, []).append((attr, replacement)) + + +def deprecated_init(super_init_func, arg_names, ignore=tuple(), + deprecated_aliases={}, deprecated_defaults={}, + category=PyGIDeprecationWarning, + stacklevel=2): + """Wrapper for deprecating GObject based __init__ methods which specify + defaults already available or non-standard defaults. + + :param callable super_init_func: + Initializer to wrap. + :param list arg_names: + Ordered argument name list. + :param list ignore: + List of argument names to ignore when calling the wrapped function. + This is useful for function which take a non-standard keyword that is munged elsewhere. + :param dict deprecated_aliases: + Dictionary mapping a keyword alias to the actual g_object_newv keyword. + :param dict deprecated_defaults: + Dictionary of non-standard defaults that will be used when the + keyword is not explicitly passed. + :param Exception category: + Exception category of the error. + :param int stacklevel: + Stack level for the deprecation passed on to warnings.warn + :returns: Wrapped version of ``super_init_func`` which gives a deprecation + warning when non-keyword args or aliases are used. + :rtype: callable + """ + # We use a list of argument names to maintain order of the arguments + # being deprecated. This allows calls with positional arguments to + # continue working but with a deprecation message. + def new_init(self, *args, **kwargs): + """Initializer for a GObject based classes with support for property + sets through the use of explicit keyword arguments. + """ + # Print warnings for calls with positional arguments. + if args: + warnings.warn('Using positional arguments with the GObject constructor has been deprecated. ' + 'Please specify keyword(s) for "%s" or use a class specific constructor. ' + 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations' % + ', '.join(arg_names[:len(args)]), + category, stacklevel=stacklevel) + new_kwargs = dict(zip(arg_names, args)) + else: + new_kwargs = {} + new_kwargs.update(kwargs) + + # Print warnings for alias usage and transfer them into the new key. + aliases_used = [] + for key, alias in deprecated_aliases.items(): + if alias in new_kwargs: + new_kwargs[key] = new_kwargs.pop(alias) + aliases_used.append(key) + + if aliases_used: + warnings.warn('The keyword(s) "%s" have been deprecated in favor of "%s" respectively. ' + 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations' % + (', '.join(deprecated_aliases[k] for k in sorted(aliases_used)), + ', '.join(sorted(aliases_used))), + category, stacklevel=stacklevel) + + # Print warnings for defaults different than what is already provided by the property + defaults_used = [] + for key, value in deprecated_defaults.items(): + if key not in new_kwargs: + new_kwargs[key] = deprecated_defaults[key] + defaults_used.append(key) + + if defaults_used: + warnings.warn('Initializer is relying on deprecated non-standard ' + 'defaults. Please update to explicitly use: %s ' + 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations' % + ', '.join('%s=%s' % (k, deprecated_defaults[k]) for k in sorted(defaults_used)), + category, stacklevel=stacklevel) + + # Remove keywords that should be ignored. + for key in ignore: + if key in new_kwargs: + new_kwargs.pop(key) + + return super_init_func(self, **new_kwargs) + + return new_init + + def strip_boolean_result(method, exc_type=None, exc_str=None, fail_ret=None): - '''Translate method's return value for stripping off success flag. + """Translate method's return value for stripping off success flag. There are a lot of methods which return a "success" boolean and have several out arguments. Translate such a method to return the out arguments on success and None on failure. - ''' + """ @functools.wraps(method) def wrapped(*args, **kwargs): ret = method(*args, **kwargs) @@ -110,3 +341,13 @@ def strip_boolean_result(method, exc_type=None, exc_str=None, fail_ret=None): raise exc_type(exc_str or 'call failed') return fail_ret return wrapped + + +def wrap_list_store_sort_func(func): + + def wrap(a, b, *user_data): + a = pygobject_new_full(a, False) + b = pygobject_new_full(b, False) + return func(a, b, *user_data) + + return wrap diff --git a/gi/overrides/keysyms.py b/gi/overrides/keysyms.py index 35ee8eb..07ce277 100644 --- a/gi/overrides/keysyms.py +++ b/gi/overrides/keysyms.py @@ -15,1485 +15,39 @@ # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA +# License along with this library; if not, see . -VoidSymbol = 0xFFFFFF -BackSpace = 0xFF08 -Tab = 0xFF09 -Linefeed = 0xFF0A -Clear = 0xFF0B -Return = 0xFF0D -Pause = 0xFF13 -Scroll_Lock = 0xFF14 -Sys_Req = 0xFF15 -Escape = 0xFF1B -Delete = 0xFFFF -Multi_key = 0xFF20 -Codeinput = 0xFF37 -SingleCandidate = 0xFF3C -MultipleCandidate = 0xFF3D -PreviousCandidate = 0xFF3E -Kanji = 0xFF21 -Muhenkan = 0xFF22 -Henkan_Mode = 0xFF23 -Henkan = 0xFF23 -Romaji = 0xFF24 -Hiragana = 0xFF25 -Katakana = 0xFF26 -Hiragana_Katakana = 0xFF27 -Zenkaku = 0xFF28 -Hankaku = 0xFF29 -Zenkaku_Hankaku = 0xFF2A -Touroku = 0xFF2B -Massyo = 0xFF2C -Kana_Lock = 0xFF2D -Kana_Shift = 0xFF2E -Eisu_Shift = 0xFF2F -Eisu_toggle = 0xFF30 -Kanji_Bangou = 0xFF37 -Zen_Koho = 0xFF3D -Mae_Koho = 0xFF3E -Home = 0xFF50 -Left = 0xFF51 -Up = 0xFF52 -Right = 0xFF53 -Down = 0xFF54 -Prior = 0xFF55 -Page_Up = 0xFF55 -Next = 0xFF56 -Page_Down = 0xFF56 -End = 0xFF57 -Begin = 0xFF58 -Select = 0xFF60 -Print = 0xFF61 -Execute = 0xFF62 -Insert = 0xFF63 -Undo = 0xFF65 -Redo = 0xFF66 -Menu = 0xFF67 -Find = 0xFF68 -Cancel = 0xFF69 -Help = 0xFF6A -Break = 0xFF6B -Mode_switch = 0xFF7E -script_switch = 0xFF7E -Num_Lock = 0xFF7F -KP_Space = 0xFF80 -KP_Tab = 0xFF89 -KP_Enter = 0xFF8D -KP_F1 = 0xFF91 -KP_F2 = 0xFF92 -KP_F3 = 0xFF93 -KP_F4 = 0xFF94 -KP_Home = 0xFF95 -KP_Left = 0xFF96 -KP_Up = 0xFF97 -KP_Right = 0xFF98 -KP_Down = 0xFF99 -KP_Prior = 0xFF9A -KP_Page_Up = 0xFF9A -KP_Next = 0xFF9B -KP_Page_Down = 0xFF9B -KP_End = 0xFF9C -KP_Begin = 0xFF9D -KP_Insert = 0xFF9E -KP_Delete = 0xFF9F -KP_Equal = 0xFFBD -KP_Multiply = 0xFFAA -KP_Add = 0xFFAB -KP_Separator = 0xFFAC -KP_Subtract = 0xFFAD -KP_Decimal = 0xFFAE -KP_Divide = 0xFFAF -KP_0 = 0xFFB0 -KP_1 = 0xFFB1 -KP_2 = 0xFFB2 -KP_3 = 0xFFB3 -KP_4 = 0xFFB4 -KP_5 = 0xFFB5 -KP_6 = 0xFFB6 -KP_7 = 0xFFB7 -KP_8 = 0xFFB8 -KP_9 = 0xFFB9 -F1 = 0xFFBE -F2 = 0xFFBF -F3 = 0xFFC0 -F4 = 0xFFC1 -F5 = 0xFFC2 -F6 = 0xFFC3 -F7 = 0xFFC4 -F8 = 0xFFC5 -F9 = 0xFFC6 -F10 = 0xFFC7 -F11 = 0xFFC8 -L1 = 0xFFC8 -F12 = 0xFFC9 -L2 = 0xFFC9 -F13 = 0xFFCA -L3 = 0xFFCA -F14 = 0xFFCB -L4 = 0xFFCB -F15 = 0xFFCC -L5 = 0xFFCC -F16 = 0xFFCD -L6 = 0xFFCD -F17 = 0xFFCE -L7 = 0xFFCE -F18 = 0xFFCF -L8 = 0xFFCF -F19 = 0xFFD0 -L9 = 0xFFD0 -F20 = 0xFFD1 -L10 = 0xFFD1 -F21 = 0xFFD2 -R1 = 0xFFD2 -F22 = 0xFFD3 -R2 = 0xFFD3 -F23 = 0xFFD4 -R3 = 0xFFD4 -F24 = 0xFFD5 -R4 = 0xFFD5 -F25 = 0xFFD6 -R5 = 0xFFD6 -F26 = 0xFFD7 -R6 = 0xFFD7 -F27 = 0xFFD8 -R7 = 0xFFD8 -F28 = 0xFFD9 -R8 = 0xFFD9 -F29 = 0xFFDA -R9 = 0xFFDA -F30 = 0xFFDB -R10 = 0xFFDB -F31 = 0xFFDC -R11 = 0xFFDC -F32 = 0xFFDD -R12 = 0xFFDD -F33 = 0xFFDE -R13 = 0xFFDE -F34 = 0xFFDF -R14 = 0xFFDF -F35 = 0xFFE0 -R15 = 0xFFE0 -Shift_L = 0xFFE1 -Shift_R = 0xFFE2 -Control_L = 0xFFE3 -Control_R = 0xFFE4 -Caps_Lock = 0xFFE5 -Shift_Lock = 0xFFE6 -Meta_L = 0xFFE7 -Meta_R = 0xFFE8 -Alt_L = 0xFFE9 -Alt_R = 0xFFEA -Super_L = 0xFFEB -Super_R = 0xFFEC -Hyper_L = 0xFFED -Hyper_R = 0xFFEE -ISO_Lock = 0xFE01 -ISO_Level2_Latch = 0xFE02 -ISO_Level3_Shift = 0xFE03 -ISO_Level3_Latch = 0xFE04 -ISO_Level3_Lock = 0xFE05 -ISO_Group_Shift = 0xFF7E -ISO_Group_Latch = 0xFE06 -ISO_Group_Lock = 0xFE07 -ISO_Next_Group = 0xFE08 -ISO_Next_Group_Lock = 0xFE09 -ISO_Prev_Group = 0xFE0A -ISO_Prev_Group_Lock = 0xFE0B -ISO_First_Group = 0xFE0C -ISO_First_Group_Lock = 0xFE0D -ISO_Last_Group = 0xFE0E -ISO_Last_Group_Lock = 0xFE0F -ISO_Left_Tab = 0xFE20 -ISO_Move_Line_Up = 0xFE21 -ISO_Move_Line_Down = 0xFE22 -ISO_Partial_Line_Up = 0xFE23 -ISO_Partial_Line_Down = 0xFE24 -ISO_Partial_Space_Left = 0xFE25 -ISO_Partial_Space_Right = 0xFE26 -ISO_Set_Margin_Left = 0xFE27 -ISO_Set_Margin_Right = 0xFE28 -ISO_Release_Margin_Left = 0xFE29 -ISO_Release_Margin_Right = 0xFE2A -ISO_Release_Both_Margins = 0xFE2B -ISO_Fast_Cursor_Left = 0xFE2C -ISO_Fast_Cursor_Right = 0xFE2D -ISO_Fast_Cursor_Up = 0xFE2E -ISO_Fast_Cursor_Down = 0xFE2F -ISO_Continuous_Underline = 0xFE30 -ISO_Discontinuous_Underline = 0xFE31 -ISO_Emphasize = 0xFE32 -ISO_Center_Object = 0xFE33 -ISO_Enter = 0xFE34 -dead_grave = 0xFE50 -dead_acute = 0xFE51 -dead_circumflex = 0xFE52 -dead_tilde = 0xFE53 -dead_macron = 0xFE54 -dead_breve = 0xFE55 -dead_abovedot = 0xFE56 -dead_diaeresis = 0xFE57 -dead_abovering = 0xFE58 -dead_doubleacute = 0xFE59 -dead_caron = 0xFE5A -dead_cedilla = 0xFE5B -dead_ogonek = 0xFE5C -dead_iota = 0xFE5D -dead_voiced_sound = 0xFE5E -dead_semivoiced_sound = 0xFE5F -dead_belowdot = 0xFE60 -First_Virtual_Screen = 0xFED0 -Prev_Virtual_Screen = 0xFED1 -Next_Virtual_Screen = 0xFED2 -Last_Virtual_Screen = 0xFED4 -Terminate_Server = 0xFED5 -AccessX_Enable = 0xFE70 -AccessX_Feedback_Enable = 0xFE71 -RepeatKeys_Enable = 0xFE72 -SlowKeys_Enable = 0xFE73 -BounceKeys_Enable = 0xFE74 -StickyKeys_Enable = 0xFE75 -MouseKeys_Enable = 0xFE76 -MouseKeys_Accel_Enable = 0xFE77 -Overlay1_Enable = 0xFE78 -Overlay2_Enable = 0xFE79 -AudibleBell_Enable = 0xFE7A -Pointer_Left = 0xFEE0 -Pointer_Right = 0xFEE1 -Pointer_Up = 0xFEE2 -Pointer_Down = 0xFEE3 -Pointer_UpLeft = 0xFEE4 -Pointer_UpRight = 0xFEE5 -Pointer_DownLeft = 0xFEE6 -Pointer_DownRight = 0xFEE7 -Pointer_Button_Dflt = 0xFEE8 -Pointer_Button1 = 0xFEE9 -Pointer_Button2 = 0xFEEA -Pointer_Button3 = 0xFEEB -Pointer_Button4 = 0xFEEC -Pointer_Button5 = 0xFEED -Pointer_DblClick_Dflt = 0xFEEE -Pointer_DblClick1 = 0xFEEF -Pointer_DblClick2 = 0xFEF0 -Pointer_DblClick3 = 0xFEF1 -Pointer_DblClick4 = 0xFEF2 -Pointer_DblClick5 = 0xFEF3 -Pointer_Drag_Dflt = 0xFEF4 -Pointer_Drag1 = 0xFEF5 -Pointer_Drag2 = 0xFEF6 -Pointer_Drag3 = 0xFEF7 -Pointer_Drag4 = 0xFEF8 -Pointer_Drag5 = 0xFEFD -Pointer_EnableKeys = 0xFEF9 -Pointer_Accelerate = 0xFEFA -Pointer_DfltBtnNext = 0xFEFB -Pointer_DfltBtnPrev = 0xFEFC -_3270_Duplicate = 0xFD01 -_3270_FieldMark = 0xFD02 -_3270_Right2 = 0xFD03 -_3270_Left2 = 0xFD04 -_3270_BackTab = 0xFD05 -_3270_EraseEOF = 0xFD06 -_3270_EraseInput = 0xFD07 -_3270_Reset = 0xFD08 -_3270_Quit = 0xFD09 -_3270_PA1 = 0xFD0A -_3270_PA2 = 0xFD0B -_3270_PA3 = 0xFD0C -_3270_Test = 0xFD0D -_3270_Attn = 0xFD0E -_3270_CursorBlink = 0xFD0F -_3270_AltCursor = 0xFD10 -_3270_KeyClick = 0xFD11 -_3270_Jump = 0xFD12 -_3270_Ident = 0xFD13 -_3270_Rule = 0xFD14 -_3270_Copy = 0xFD15 -_3270_Play = 0xFD16 -_3270_Setup = 0xFD17 -_3270_Record = 0xFD18 -_3270_ChangeScreen = 0xFD19 -_3270_DeleteWord = 0xFD1A -_3270_ExSelect = 0xFD1B -_3270_CursorSelect = 0xFD1C -_3270_PrintScreen = 0xFD1D -_3270_Enter = 0xFD1E -space = 0x020 -exclam = 0x021 -quotedbl = 0x022 -numbersign = 0x023 -dollar = 0x024 -percent = 0x025 -ampersand = 0x026 -apostrophe = 0x027 -quoteright = 0x027 -parenleft = 0x028 -parenright = 0x029 -asterisk = 0x02a -plus = 0x02b -comma = 0x02c -minus = 0x02d -period = 0x02e -slash = 0x02f -_0 = 0x030 -_1 = 0x031 -_2 = 0x032 -_3 = 0x033 -_4 = 0x034 -_5 = 0x035 -_6 = 0x036 -_7 = 0x037 -_8 = 0x038 -_9 = 0x039 -colon = 0x03a -semicolon = 0x03b -less = 0x03c -equal = 0x03d -greater = 0x03e -question = 0x03f -at = 0x040 -A = 0x041 -B = 0x042 -C = 0x043 -D = 0x044 -E = 0x045 -F = 0x046 -G = 0x047 -H = 0x048 -I = 0x049 -J = 0x04a -K = 0x04b -L = 0x04c -M = 0x04d -N = 0x04e -O = 0x04f -P = 0x050 -Q = 0x051 -R = 0x052 -S = 0x053 -T = 0x054 -U = 0x055 -V = 0x056 -W = 0x057 -X = 0x058 -Y = 0x059 -Z = 0x05a -bracketleft = 0x05b -backslash = 0x05c -bracketright = 0x05d -asciicircum = 0x05e -underscore = 0x05f -grave = 0x060 -quoteleft = 0x060 -a = 0x061 -b = 0x062 -c = 0x063 -d = 0x064 -e = 0x065 -f = 0x066 -g = 0x067 -h = 0x068 -i = 0x069 -j = 0x06a -k = 0x06b -l = 0x06c -m = 0x06d -n = 0x06e -o = 0x06f -p = 0x070 -q = 0x071 -r = 0x072 -s = 0x073 -t = 0x074 -u = 0x075 -v = 0x076 -w = 0x077 -x = 0x078 -y = 0x079 -z = 0x07a -braceleft = 0x07b -bar = 0x07c -braceright = 0x07d -asciitilde = 0x07e -nobreakspace = 0x0a0 -exclamdown = 0x0a1 -cent = 0x0a2 -sterling = 0x0a3 -currency = 0x0a4 -yen = 0x0a5 -brokenbar = 0x0a6 -section = 0x0a7 -diaeresis = 0x0a8 -copyright = 0x0a9 -ordfeminine = 0x0aa -guillemotleft = 0x0ab -notsign = 0x0ac -hyphen = 0x0ad -registered = 0x0ae -macron = 0x0af -degree = 0x0b0 -plusminus = 0x0b1 -twosuperior = 0x0b2 -threesuperior = 0x0b3 -acute = 0x0b4 -mu = 0x0b5 -paragraph = 0x0b6 -periodcentered = 0x0b7 -cedilla = 0x0b8 -onesuperior = 0x0b9 -masculine = 0x0ba -guillemotright = 0x0bb -onequarter = 0x0bc -onehalf = 0x0bd -threequarters = 0x0be -questiondown = 0x0bf -Agrave = 0x0c0 -Aacute = 0x0c1 -Acircumflex = 0x0c2 -Atilde = 0x0c3 -Adiaeresis = 0x0c4 -Aring = 0x0c5 -AE = 0x0c6 -Ccedilla = 0x0c7 -Egrave = 0x0c8 -Eacute = 0x0c9 -Ecircumflex = 0x0ca -Ediaeresis = 0x0cb -Igrave = 0x0cc -Iacute = 0x0cd -Icircumflex = 0x0ce -Idiaeresis = 0x0cf -ETH = 0x0d0 -Eth = 0x0d0 -Ntilde = 0x0d1 -Ograve = 0x0d2 -Oacute = 0x0d3 -Ocircumflex = 0x0d4 -Otilde = 0x0d5 -Odiaeresis = 0x0d6 -multiply = 0x0d7 -Ooblique = 0x0d8 -Ugrave = 0x0d9 -Uacute = 0x0da -Ucircumflex = 0x0db -Udiaeresis = 0x0dc -Yacute = 0x0dd -THORN = 0x0de -Thorn = 0x0de -ssharp = 0x0df -agrave = 0x0e0 -aacute = 0x0e1 -acircumflex = 0x0e2 -atilde = 0x0e3 -adiaeresis = 0x0e4 -aring = 0x0e5 -ae = 0x0e6 -ccedilla = 0x0e7 -egrave = 0x0e8 -eacute = 0x0e9 -ecircumflex = 0x0ea -ediaeresis = 0x0eb -igrave = 0x0ec -iacute = 0x0ed -icircumflex = 0x0ee -idiaeresis = 0x0ef -eth = 0x0f0 -ntilde = 0x0f1 -ograve = 0x0f2 -oacute = 0x0f3 -ocircumflex = 0x0f4 -otilde = 0x0f5 -odiaeresis = 0x0f6 -division = 0x0f7 -oslash = 0x0f8 -ugrave = 0x0f9 -uacute = 0x0fa -ucircumflex = 0x0fb -udiaeresis = 0x0fc -yacute = 0x0fd -thorn = 0x0fe -ydiaeresis = 0x0ff -Aogonek = 0x1a1 -breve = 0x1a2 -Lstroke = 0x1a3 -Lcaron = 0x1a5 -Sacute = 0x1a6 -Scaron = 0x1a9 -Scedilla = 0x1aa -Tcaron = 0x1ab -Zacute = 0x1ac -Zcaron = 0x1ae -Zabovedot = 0x1af -aogonek = 0x1b1 -ogonek = 0x1b2 -lstroke = 0x1b3 -lcaron = 0x1b5 -sacute = 0x1b6 -caron = 0x1b7 -scaron = 0x1b9 -scedilla = 0x1ba -tcaron = 0x1bb -zacute = 0x1bc -doubleacute = 0x1bd -zcaron = 0x1be -zabovedot = 0x1bf -Racute = 0x1c0 -Abreve = 0x1c3 -Lacute = 0x1c5 -Cacute = 0x1c6 -Ccaron = 0x1c8 -Eogonek = 0x1ca -Ecaron = 0x1cc -Dcaron = 0x1cf -Dstroke = 0x1d0 -Nacute = 0x1d1 -Ncaron = 0x1d2 -Odoubleacute = 0x1d5 -Rcaron = 0x1d8 -Uring = 0x1d9 -Udoubleacute = 0x1db -Tcedilla = 0x1de -racute = 0x1e0 -abreve = 0x1e3 -lacute = 0x1e5 -cacute = 0x1e6 -ccaron = 0x1e8 -eogonek = 0x1ea -ecaron = 0x1ec -dcaron = 0x1ef -dstroke = 0x1f0 -nacute = 0x1f1 -ncaron = 0x1f2 -odoubleacute = 0x1f5 -udoubleacute = 0x1fb -rcaron = 0x1f8 -uring = 0x1f9 -tcedilla = 0x1fe -abovedot = 0x1ff -Hstroke = 0x2a1 -Hcircumflex = 0x2a6 -Iabovedot = 0x2a9 -Gbreve = 0x2ab -Jcircumflex = 0x2ac -hstroke = 0x2b1 -hcircumflex = 0x2b6 -idotless = 0x2b9 -gbreve = 0x2bb -jcircumflex = 0x2bc -Cabovedot = 0x2c5 -Ccircumflex = 0x2c6 -Gabovedot = 0x2d5 -Gcircumflex = 0x2d8 -Ubreve = 0x2dd -Scircumflex = 0x2de -cabovedot = 0x2e5 -ccircumflex = 0x2e6 -gabovedot = 0x2f5 -gcircumflex = 0x2f8 -ubreve = 0x2fd -scircumflex = 0x2fe -kra = 0x3a2 -kappa = 0x3a2 -Rcedilla = 0x3a3 -Itilde = 0x3a5 -Lcedilla = 0x3a6 -Emacron = 0x3aa -Gcedilla = 0x3ab -Tslash = 0x3ac -rcedilla = 0x3b3 -itilde = 0x3b5 -lcedilla = 0x3b6 -emacron = 0x3ba -gcedilla = 0x3bb -tslash = 0x3bc -ENG = 0x3bd -eng = 0x3bf -Amacron = 0x3c0 -Iogonek = 0x3c7 -Eabovedot = 0x3cc -Imacron = 0x3cf -Ncedilla = 0x3d1 -Omacron = 0x3d2 -Kcedilla = 0x3d3 -Uogonek = 0x3d9 -Utilde = 0x3dd -Umacron = 0x3de -amacron = 0x3e0 -iogonek = 0x3e7 -eabovedot = 0x3ec -imacron = 0x3ef -ncedilla = 0x3f1 -omacron = 0x3f2 -kcedilla = 0x3f3 -uogonek = 0x3f9 -utilde = 0x3fd -umacron = 0x3fe -OE = 0x13bc -oe = 0x13bd -Ydiaeresis = 0x13be -overline = 0x47e -kana_fullstop = 0x4a1 -kana_openingbracket = 0x4a2 -kana_closingbracket = 0x4a3 -kana_comma = 0x4a4 -kana_conjunctive = 0x4a5 -kana_middledot = 0x4a5 -kana_WO = 0x4a6 -kana_a = 0x4a7 -kana_i = 0x4a8 -kana_u = 0x4a9 -kana_e = 0x4aa -kana_o = 0x4ab -kana_ya = 0x4ac -kana_yu = 0x4ad -kana_yo = 0x4ae -kana_tsu = 0x4af -kana_tu = 0x4af -prolongedsound = 0x4b0 -kana_A = 0x4b1 -kana_I = 0x4b2 -kana_U = 0x4b3 -kana_E = 0x4b4 -kana_O = 0x4b5 -kana_KA = 0x4b6 -kana_KI = 0x4b7 -kana_KU = 0x4b8 -kana_KE = 0x4b9 -kana_KO = 0x4ba -kana_SA = 0x4bb -kana_SHI = 0x4bc -kana_SU = 0x4bd -kana_SE = 0x4be -kana_SO = 0x4bf -kana_TA = 0x4c0 -kana_CHI = 0x4c1 -kana_TI = 0x4c1 -kana_TSU = 0x4c2 -kana_TU = 0x4c2 -kana_TE = 0x4c3 -kana_TO = 0x4c4 -kana_NA = 0x4c5 -kana_NI = 0x4c6 -kana_NU = 0x4c7 -kana_NE = 0x4c8 -kana_NO = 0x4c9 -kana_HA = 0x4ca -kana_HI = 0x4cb -kana_FU = 0x4cc -kana_HU = 0x4cc -kana_HE = 0x4cd -kana_HO = 0x4ce -kana_MA = 0x4cf -kana_MI = 0x4d0 -kana_MU = 0x4d1 -kana_ME = 0x4d2 -kana_MO = 0x4d3 -kana_YA = 0x4d4 -kana_YU = 0x4d5 -kana_YO = 0x4d6 -kana_RA = 0x4d7 -kana_RI = 0x4d8 -kana_RU = 0x4d9 -kana_RE = 0x4da -kana_RO = 0x4db -kana_WA = 0x4dc -kana_N = 0x4dd -voicedsound = 0x4de -semivoicedsound = 0x4df -kana_switch = 0xFF7E -Arabic_comma = 0x5ac -Arabic_semicolon = 0x5bb -Arabic_question_mark = 0x5bf -Arabic_hamza = 0x5c1 -Arabic_maddaonalef = 0x5c2 -Arabic_hamzaonalef = 0x5c3 -Arabic_hamzaonwaw = 0x5c4 -Arabic_hamzaunderalef = 0x5c5 -Arabic_hamzaonyeh = 0x5c6 -Arabic_alef = 0x5c7 -Arabic_beh = 0x5c8 -Arabic_tehmarbuta = 0x5c9 -Arabic_teh = 0x5ca -Arabic_theh = 0x5cb -Arabic_jeem = 0x5cc -Arabic_hah = 0x5cd -Arabic_khah = 0x5ce -Arabic_dal = 0x5cf -Arabic_thal = 0x5d0 -Arabic_ra = 0x5d1 -Arabic_zain = 0x5d2 -Arabic_seen = 0x5d3 -Arabic_sheen = 0x5d4 -Arabic_sad = 0x5d5 -Arabic_dad = 0x5d6 -Arabic_tah = 0x5d7 -Arabic_zah = 0x5d8 -Arabic_ain = 0x5d9 -Arabic_ghain = 0x5da -Arabic_tatweel = 0x5e0 -Arabic_feh = 0x5e1 -Arabic_qaf = 0x5e2 -Arabic_kaf = 0x5e3 -Arabic_lam = 0x5e4 -Arabic_meem = 0x5e5 -Arabic_noon = 0x5e6 -Arabic_ha = 0x5e7 -Arabic_heh = 0x5e7 -Arabic_waw = 0x5e8 -Arabic_alefmaksura = 0x5e9 -Arabic_yeh = 0x5ea -Arabic_fathatan = 0x5eb -Arabic_dammatan = 0x5ec -Arabic_kasratan = 0x5ed -Arabic_fatha = 0x5ee -Arabic_damma = 0x5ef -Arabic_kasra = 0x5f0 -Arabic_shadda = 0x5f1 -Arabic_sukun = 0x5f2 -Arabic_switch = 0xFF7E -Serbian_dje = 0x6a1 -Macedonia_gje = 0x6a2 -Cyrillic_io = 0x6a3 -Ukrainian_ie = 0x6a4 -Ukranian_je = 0x6a4 -Macedonia_dse = 0x6a5 -Ukrainian_i = 0x6a6 -Ukranian_i = 0x6a6 -Ukrainian_yi = 0x6a7 -Ukranian_yi = 0x6a7 -Cyrillic_je = 0x6a8 -Serbian_je = 0x6a8 -Cyrillic_lje = 0x6a9 -Serbian_lje = 0x6a9 -Cyrillic_nje = 0x6aa -Serbian_nje = 0x6aa -Serbian_tshe = 0x6ab -Macedonia_kje = 0x6ac -Ukrainian_ghe_with_upturn = 0x6ad -Byelorussian_shortu = 0x6ae -Cyrillic_dzhe = 0x6af -Serbian_dze = 0x6af -numerosign = 0x6b0 -Serbian_DJE = 0x6b1 -Macedonia_GJE = 0x6b2 -Cyrillic_IO = 0x6b3 -Ukrainian_IE = 0x6b4 -Ukranian_JE = 0x6b4 -Macedonia_DSE = 0x6b5 -Ukrainian_I = 0x6b6 -Ukranian_I = 0x6b6 -Ukrainian_YI = 0x6b7 -Ukranian_YI = 0x6b7 -Cyrillic_JE = 0x6b8 -Serbian_JE = 0x6b8 -Cyrillic_LJE = 0x6b9 -Serbian_LJE = 0x6b9 -Cyrillic_NJE = 0x6ba -Serbian_NJE = 0x6ba -Serbian_TSHE = 0x6bb -Macedonia_KJE = 0x6bc -Ukrainian_GHE_WITH_UPTURN = 0x6bd -Byelorussian_SHORTU = 0x6be -Cyrillic_DZHE = 0x6bf -Serbian_DZE = 0x6bf -Cyrillic_yu = 0x6c0 -Cyrillic_a = 0x6c1 -Cyrillic_be = 0x6c2 -Cyrillic_tse = 0x6c3 -Cyrillic_de = 0x6c4 -Cyrillic_ie = 0x6c5 -Cyrillic_ef = 0x6c6 -Cyrillic_ghe = 0x6c7 -Cyrillic_ha = 0x6c8 -Cyrillic_i = 0x6c9 -Cyrillic_shorti = 0x6ca -Cyrillic_ka = 0x6cb -Cyrillic_el = 0x6cc -Cyrillic_em = 0x6cd -Cyrillic_en = 0x6ce -Cyrillic_o = 0x6cf -Cyrillic_pe = 0x6d0 -Cyrillic_ya = 0x6d1 -Cyrillic_er = 0x6d2 -Cyrillic_es = 0x6d3 -Cyrillic_te = 0x6d4 -Cyrillic_u = 0x6d5 -Cyrillic_zhe = 0x6d6 -Cyrillic_ve = 0x6d7 -Cyrillic_softsign = 0x6d8 -Cyrillic_yeru = 0x6d9 -Cyrillic_ze = 0x6da -Cyrillic_sha = 0x6db -Cyrillic_e = 0x6dc -Cyrillic_shcha = 0x6dd -Cyrillic_che = 0x6de -Cyrillic_hardsign = 0x6df -Cyrillic_YU = 0x6e0 -Cyrillic_A = 0x6e1 -Cyrillic_BE = 0x6e2 -Cyrillic_TSE = 0x6e3 -Cyrillic_DE = 0x6e4 -Cyrillic_IE = 0x6e5 -Cyrillic_EF = 0x6e6 -Cyrillic_GHE = 0x6e7 -Cyrillic_HA = 0x6e8 -Cyrillic_I = 0x6e9 -Cyrillic_SHORTI = 0x6ea -Cyrillic_KA = 0x6eb -Cyrillic_EL = 0x6ec -Cyrillic_EM = 0x6ed -Cyrillic_EN = 0x6ee -Cyrillic_O = 0x6ef -Cyrillic_PE = 0x6f0 -Cyrillic_YA = 0x6f1 -Cyrillic_ER = 0x6f2 -Cyrillic_ES = 0x6f3 -Cyrillic_TE = 0x6f4 -Cyrillic_U = 0x6f5 -Cyrillic_ZHE = 0x6f6 -Cyrillic_VE = 0x6f7 -Cyrillic_SOFTSIGN = 0x6f8 -Cyrillic_YERU = 0x6f9 -Cyrillic_ZE = 0x6fa -Cyrillic_SHA = 0x6fb -Cyrillic_E = 0x6fc -Cyrillic_SHCHA = 0x6fd -Cyrillic_CHE = 0x6fe -Cyrillic_HARDSIGN = 0x6ff -Greek_ALPHAaccent = 0x7a1 -Greek_EPSILONaccent = 0x7a2 -Greek_ETAaccent = 0x7a3 -Greek_IOTAaccent = 0x7a4 -Greek_IOTAdiaeresis = 0x7a5 -Greek_OMICRONaccent = 0x7a7 -Greek_UPSILONaccent = 0x7a8 -Greek_UPSILONdieresis = 0x7a9 -Greek_OMEGAaccent = 0x7ab -Greek_accentdieresis = 0x7ae -Greek_horizbar = 0x7af -Greek_alphaaccent = 0x7b1 -Greek_epsilonaccent = 0x7b2 -Greek_etaaccent = 0x7b3 -Greek_iotaaccent = 0x7b4 -Greek_iotadieresis = 0x7b5 -Greek_iotaaccentdieresis = 0x7b6 -Greek_omicronaccent = 0x7b7 -Greek_upsilonaccent = 0x7b8 -Greek_upsilondieresis = 0x7b9 -Greek_upsilonaccentdieresis = 0x7ba -Greek_omegaaccent = 0x7bb -Greek_ALPHA = 0x7c1 -Greek_BETA = 0x7c2 -Greek_GAMMA = 0x7c3 -Greek_DELTA = 0x7c4 -Greek_EPSILON = 0x7c5 -Greek_ZETA = 0x7c6 -Greek_ETA = 0x7c7 -Greek_THETA = 0x7c8 -Greek_IOTA = 0x7c9 -Greek_KAPPA = 0x7ca -Greek_LAMDA = 0x7cb -Greek_LAMBDA = 0x7cb -Greek_MU = 0x7cc -Greek_NU = 0x7cd -Greek_XI = 0x7ce -Greek_OMICRON = 0x7cf -Greek_PI = 0x7d0 -Greek_RHO = 0x7d1 -Greek_SIGMA = 0x7d2 -Greek_TAU = 0x7d4 -Greek_UPSILON = 0x7d5 -Greek_PHI = 0x7d6 -Greek_CHI = 0x7d7 -Greek_PSI = 0x7d8 -Greek_OMEGA = 0x7d9 -Greek_alpha = 0x7e1 -Greek_beta = 0x7e2 -Greek_gamma = 0x7e3 -Greek_delta = 0x7e4 -Greek_epsilon = 0x7e5 -Greek_zeta = 0x7e6 -Greek_eta = 0x7e7 -Greek_theta = 0x7e8 -Greek_iota = 0x7e9 -Greek_kappa = 0x7ea -Greek_lamda = 0x7eb -Greek_lambda = 0x7eb -Greek_mu = 0x7ec -Greek_nu = 0x7ed -Greek_xi = 0x7ee -Greek_omicron = 0x7ef -Greek_pi = 0x7f0 -Greek_rho = 0x7f1 -Greek_sigma = 0x7f2 -Greek_finalsmallsigma = 0x7f3 -Greek_tau = 0x7f4 -Greek_upsilon = 0x7f5 -Greek_phi = 0x7f6 -Greek_chi = 0x7f7 -Greek_psi = 0x7f8 -Greek_omega = 0x7f9 -Greek_switch = 0xFF7E -leftradical = 0x8a1 -topleftradical = 0x8a2 -horizconnector = 0x8a3 -topintegral = 0x8a4 -botintegral = 0x8a5 -vertconnector = 0x8a6 -topleftsqbracket = 0x8a7 -botleftsqbracket = 0x8a8 -toprightsqbracket = 0x8a9 -botrightsqbracket = 0x8aa -topleftparens = 0x8ab -botleftparens = 0x8ac -toprightparens = 0x8ad -botrightparens = 0x8ae -leftmiddlecurlybrace = 0x8af -rightmiddlecurlybrace = 0x8b0 -topleftsummation = 0x8b1 -botleftsummation = 0x8b2 -topvertsummationconnector = 0x8b3 -botvertsummationconnector = 0x8b4 -toprightsummation = 0x8b5 -botrightsummation = 0x8b6 -rightmiddlesummation = 0x8b7 -lessthanequal = 0x8bc -notequal = 0x8bd -greaterthanequal = 0x8be -integral = 0x8bf -therefore = 0x8c0 -variation = 0x8c1 -infinity = 0x8c2 -nabla = 0x8c5 -approximate = 0x8c8 -similarequal = 0x8c9 -ifonlyif = 0x8cd -implies = 0x8ce -identical = 0x8cf -radical = 0x8d6 -includedin = 0x8da -includes = 0x8db -intersection = 0x8dc -union = 0x8dd -logicaland = 0x8de -logicalor = 0x8df -partialderivative = 0x8ef -function = 0x8f6 -leftarrow = 0x8fb -uparrow = 0x8fc -rightarrow = 0x8fd -downarrow = 0x8fe -blank = 0x9df -soliddiamond = 0x9e0 -checkerboard = 0x9e1 -ht = 0x9e2 -ff = 0x9e3 -cr = 0x9e4 -lf = 0x9e5 -nl = 0x9e8 -vt = 0x9e9 -lowrightcorner = 0x9ea -uprightcorner = 0x9eb -upleftcorner = 0x9ec -lowleftcorner = 0x9ed -crossinglines = 0x9ee -horizlinescan1 = 0x9ef -horizlinescan3 = 0x9f0 -horizlinescan5 = 0x9f1 -horizlinescan7 = 0x9f2 -horizlinescan9 = 0x9f3 -leftt = 0x9f4 -rightt = 0x9f5 -bott = 0x9f6 -topt = 0x9f7 -vertbar = 0x9f8 -emspace = 0xaa1 -enspace = 0xaa2 -em3space = 0xaa3 -em4space = 0xaa4 -digitspace = 0xaa5 -punctspace = 0xaa6 -thinspace = 0xaa7 -hairspace = 0xaa8 -emdash = 0xaa9 -endash = 0xaaa -signifblank = 0xaac -ellipsis = 0xaae -doubbaselinedot = 0xaaf -onethird = 0xab0 -twothirds = 0xab1 -onefifth = 0xab2 -twofifths = 0xab3 -threefifths = 0xab4 -fourfifths = 0xab5 -onesixth = 0xab6 -fivesixths = 0xab7 -careof = 0xab8 -figdash = 0xabb -leftanglebracket = 0xabc -decimalpoint = 0xabd -rightanglebracket = 0xabe -marker = 0xabf -oneeighth = 0xac3 -threeeighths = 0xac4 -fiveeighths = 0xac5 -seveneighths = 0xac6 -trademark = 0xac9 -signaturemark = 0xaca -trademarkincircle = 0xacb -leftopentriangle = 0xacc -rightopentriangle = 0xacd -emopencircle = 0xace -emopenrectangle = 0xacf -leftsinglequotemark = 0xad0 -rightsinglequotemark = 0xad1 -leftdoublequotemark = 0xad2 -rightdoublequotemark = 0xad3 -prescription = 0xad4 -minutes = 0xad6 -seconds = 0xad7 -latincross = 0xad9 -hexagram = 0xada -filledrectbullet = 0xadb -filledlefttribullet = 0xadc -filledrighttribullet = 0xadd -emfilledcircle = 0xade -emfilledrect = 0xadf -enopencircbullet = 0xae0 -enopensquarebullet = 0xae1 -openrectbullet = 0xae2 -opentribulletup = 0xae3 -opentribulletdown = 0xae4 -openstar = 0xae5 -enfilledcircbullet = 0xae6 -enfilledsqbullet = 0xae7 -filledtribulletup = 0xae8 -filledtribulletdown = 0xae9 -leftpointer = 0xaea -rightpointer = 0xaeb -club = 0xaec -diamond = 0xaed -heart = 0xaee -maltesecross = 0xaf0 -dagger = 0xaf1 -doubledagger = 0xaf2 -checkmark = 0xaf3 -ballotcross = 0xaf4 -musicalsharp = 0xaf5 -musicalflat = 0xaf6 -malesymbol = 0xaf7 -femalesymbol = 0xaf8 -telephone = 0xaf9 -telephonerecorder = 0xafa -phonographcopyright = 0xafb -caret = 0xafc -singlelowquotemark = 0xafd -doublelowquotemark = 0xafe -cursor = 0xaff -leftcaret = 0xba3 -rightcaret = 0xba6 -downcaret = 0xba8 -upcaret = 0xba9 -overbar = 0xbc0 -downtack = 0xbc2 -upshoe = 0xbc3 -downstile = 0xbc4 -underbar = 0xbc6 -jot = 0xbca -quad = 0xbcc -uptack = 0xbce -circle = 0xbcf -upstile = 0xbd3 -downshoe = 0xbd6 -rightshoe = 0xbd8 -leftshoe = 0xbda -lefttack = 0xbdc -righttack = 0xbfc -hebrew_doublelowline = 0xcdf -hebrew_aleph = 0xce0 -hebrew_bet = 0xce1 -hebrew_beth = 0xce1 -hebrew_gimel = 0xce2 -hebrew_gimmel = 0xce2 -hebrew_dalet = 0xce3 -hebrew_daleth = 0xce3 -hebrew_he = 0xce4 -hebrew_waw = 0xce5 -hebrew_zain = 0xce6 -hebrew_zayin = 0xce6 -hebrew_chet = 0xce7 -hebrew_het = 0xce7 -hebrew_tet = 0xce8 -hebrew_teth = 0xce8 -hebrew_yod = 0xce9 -hebrew_finalkaph = 0xcea -hebrew_kaph = 0xceb -hebrew_lamed = 0xcec -hebrew_finalmem = 0xced -hebrew_mem = 0xcee -hebrew_finalnun = 0xcef -hebrew_nun = 0xcf0 -hebrew_samech = 0xcf1 -hebrew_samekh = 0xcf1 -hebrew_ayin = 0xcf2 -hebrew_finalpe = 0xcf3 -hebrew_pe = 0xcf4 -hebrew_finalzade = 0xcf5 -hebrew_finalzadi = 0xcf5 -hebrew_zade = 0xcf6 -hebrew_zadi = 0xcf6 -hebrew_qoph = 0xcf7 -hebrew_kuf = 0xcf7 -hebrew_resh = 0xcf8 -hebrew_shin = 0xcf9 -hebrew_taw = 0xcfa -hebrew_taf = 0xcfa -Hebrew_switch = 0xFF7E -Thai_kokai = 0xda1 -Thai_khokhai = 0xda2 -Thai_khokhuat = 0xda3 -Thai_khokhwai = 0xda4 -Thai_khokhon = 0xda5 -Thai_khorakhang = 0xda6 -Thai_ngongu = 0xda7 -Thai_chochan = 0xda8 -Thai_choching = 0xda9 -Thai_chochang = 0xdaa -Thai_soso = 0xdab -Thai_chochoe = 0xdac -Thai_yoying = 0xdad -Thai_dochada = 0xdae -Thai_topatak = 0xdaf -Thai_thothan = 0xdb0 -Thai_thonangmontho = 0xdb1 -Thai_thophuthao = 0xdb2 -Thai_nonen = 0xdb3 -Thai_dodek = 0xdb4 -Thai_totao = 0xdb5 -Thai_thothung = 0xdb6 -Thai_thothahan = 0xdb7 -Thai_thothong = 0xdb8 -Thai_nonu = 0xdb9 -Thai_bobaimai = 0xdba -Thai_popla = 0xdbb -Thai_phophung = 0xdbc -Thai_fofa = 0xdbd -Thai_phophan = 0xdbe -Thai_fofan = 0xdbf -Thai_phosamphao = 0xdc0 -Thai_moma = 0xdc1 -Thai_yoyak = 0xdc2 -Thai_rorua = 0xdc3 -Thai_ru = 0xdc4 -Thai_loling = 0xdc5 -Thai_lu = 0xdc6 -Thai_wowaen = 0xdc7 -Thai_sosala = 0xdc8 -Thai_sorusi = 0xdc9 -Thai_sosua = 0xdca -Thai_hohip = 0xdcb -Thai_lochula = 0xdcc -Thai_oang = 0xdcd -Thai_honokhuk = 0xdce -Thai_paiyannoi = 0xdcf -Thai_saraa = 0xdd0 -Thai_maihanakat = 0xdd1 -Thai_saraaa = 0xdd2 -Thai_saraam = 0xdd3 -Thai_sarai = 0xdd4 -Thai_saraii = 0xdd5 -Thai_saraue = 0xdd6 -Thai_sarauee = 0xdd7 -Thai_sarau = 0xdd8 -Thai_sarauu = 0xdd9 -Thai_phinthu = 0xdda -Thai_maihanakat_maitho = 0xdde -Thai_baht = 0xddf -Thai_sarae = 0xde0 -Thai_saraae = 0xde1 -Thai_sarao = 0xde2 -Thai_saraaimaimuan = 0xde3 -Thai_saraaimaimalai = 0xde4 -Thai_lakkhangyao = 0xde5 -Thai_maiyamok = 0xde6 -Thai_maitaikhu = 0xde7 -Thai_maiek = 0xde8 -Thai_maitho = 0xde9 -Thai_maitri = 0xdea -Thai_maichattawa = 0xdeb -Thai_thanthakhat = 0xdec -Thai_nikhahit = 0xded -Thai_leksun = 0xdf0 -Thai_leknung = 0xdf1 -Thai_leksong = 0xdf2 -Thai_leksam = 0xdf3 -Thai_leksi = 0xdf4 -Thai_lekha = 0xdf5 -Thai_lekhok = 0xdf6 -Thai_lekchet = 0xdf7 -Thai_lekpaet = 0xdf8 -Thai_lekkao = 0xdf9 -Hangul = 0xff31 -Hangul_Start = 0xff32 -Hangul_End = 0xff33 -Hangul_Hanja = 0xff34 -Hangul_Jamo = 0xff35 -Hangul_Romaja = 0xff36 -Hangul_Codeinput = 0xff37 -Hangul_Jeonja = 0xff38 -Hangul_Banja = 0xff39 -Hangul_PreHanja = 0xff3a -Hangul_PostHanja = 0xff3b -Hangul_SingleCandidate = 0xff3c -Hangul_MultipleCandidate = 0xff3d -Hangul_PreviousCandidate = 0xff3e -Hangul_Special = 0xff3f -Hangul_switch = 0xFF7E -Hangul_Kiyeog = 0xea1 -Hangul_SsangKiyeog = 0xea2 -Hangul_KiyeogSios = 0xea3 -Hangul_Nieun = 0xea4 -Hangul_NieunJieuj = 0xea5 -Hangul_NieunHieuh = 0xea6 -Hangul_Dikeud = 0xea7 -Hangul_SsangDikeud = 0xea8 -Hangul_Rieul = 0xea9 -Hangul_RieulKiyeog = 0xeaa -Hangul_RieulMieum = 0xeab -Hangul_RieulPieub = 0xeac -Hangul_RieulSios = 0xead -Hangul_RieulTieut = 0xeae -Hangul_RieulPhieuf = 0xeaf -Hangul_RieulHieuh = 0xeb0 -Hangul_Mieum = 0xeb1 -Hangul_Pieub = 0xeb2 -Hangul_SsangPieub = 0xeb3 -Hangul_PieubSios = 0xeb4 -Hangul_Sios = 0xeb5 -Hangul_SsangSios = 0xeb6 -Hangul_Ieung = 0xeb7 -Hangul_Jieuj = 0xeb8 -Hangul_SsangJieuj = 0xeb9 -Hangul_Cieuc = 0xeba -Hangul_Khieuq = 0xebb -Hangul_Tieut = 0xebc -Hangul_Phieuf = 0xebd -Hangul_Hieuh = 0xebe -Hangul_A = 0xebf -Hangul_AE = 0xec0 -Hangul_YA = 0xec1 -Hangul_YAE = 0xec2 -Hangul_EO = 0xec3 -Hangul_E = 0xec4 -Hangul_YEO = 0xec5 -Hangul_YE = 0xec6 -Hangul_O = 0xec7 -Hangul_WA = 0xec8 -Hangul_WAE = 0xec9 -Hangul_OE = 0xeca -Hangul_YO = 0xecb -Hangul_U = 0xecc -Hangul_WEO = 0xecd -Hangul_WE = 0xece -Hangul_WI = 0xecf -Hangul_YU = 0xed0 -Hangul_EU = 0xed1 -Hangul_YI = 0xed2 -Hangul_I = 0xed3 -Hangul_J_Kiyeog = 0xed4 -Hangul_J_SsangKiyeog = 0xed5 -Hangul_J_KiyeogSios = 0xed6 -Hangul_J_Nieun = 0xed7 -Hangul_J_NieunJieuj = 0xed8 -Hangul_J_NieunHieuh = 0xed9 -Hangul_J_Dikeud = 0xeda -Hangul_J_Rieul = 0xedb -Hangul_J_RieulKiyeog = 0xedc -Hangul_J_RieulMieum = 0xedd -Hangul_J_RieulPieub = 0xede -Hangul_J_RieulSios = 0xedf -Hangul_J_RieulTieut = 0xee0 -Hangul_J_RieulPhieuf = 0xee1 -Hangul_J_RieulHieuh = 0xee2 -Hangul_J_Mieum = 0xee3 -Hangul_J_Pieub = 0xee4 -Hangul_J_PieubSios = 0xee5 -Hangul_J_Sios = 0xee6 -Hangul_J_SsangSios = 0xee7 -Hangul_J_Ieung = 0xee8 -Hangul_J_Jieuj = 0xee9 -Hangul_J_Cieuc = 0xeea -Hangul_J_Khieuq = 0xeeb -Hangul_J_Tieut = 0xeec -Hangul_J_Phieuf = 0xeed -Hangul_J_Hieuh = 0xeee -Hangul_RieulYeorinHieuh = 0xeef -Hangul_SunkyeongeumMieum = 0xef0 -Hangul_SunkyeongeumPieub = 0xef1 -Hangul_PanSios = 0xef2 -Hangul_KkogjiDalrinIeung = 0xef3 -Hangul_SunkyeongeumPhieuf = 0xef4 -Hangul_YeorinHieuh = 0xef5 -Hangul_AraeA = 0xef6 -Hangul_AraeAE = 0xef7 -Hangul_J_PanSios = 0xef8 -Hangul_J_KkogjiDalrinIeung = 0xef9 -Hangul_J_YeorinHieuh = 0xefa -Korean_Won = 0xeff +import sys +import warnings + +from ..module import get_introspection_module + +Gdk = get_introspection_module('Gdk') + +warnings.warn('keysyms has been deprecated. Please use Gdk.KEY_ instead.', + RuntimeWarning) + +_modname = globals()['__name__'] +_keysyms = sys.modules[_modname] + +for name in dir(Gdk): + if name.startswith('KEY_'): + target = name[4:] + if target[0] in '0123456789': + target = '_' + target + value = getattr(Gdk, name) + setattr(_keysyms, target, value) + + +# Not found in Gdk but left for compatibility. Armenian_eternity = 0x14a1 Armenian_section_sign = 0x14a2 -Armenian_full_stop = 0x14a3 -Armenian_verjaket = 0x14a3 -Armenian_parenright = 0x14a4 Armenian_parenleft = 0x14a5 Armenian_guillemotright = 0x14a6 Armenian_guillemotleft = 0x14a7 Armenian_em_dash = 0x14a8 Armenian_dot = 0x14a9 Armenian_mijaket = 0x14a9 -Armenian_separation_mark = 0x14aa -Armenian_but = 0x14aa Armenian_comma = 0x14ab Armenian_en_dash = 0x14ac -Armenian_hyphen = 0x14ad -Armenian_yentamna = 0x14ad Armenian_ellipsis = 0x14ae -Armenian_exclam = 0x14af -Armenian_amanak = 0x14af -Armenian_accent = 0x14b0 -Armenian_shesht = 0x14b0 -Armenian_question = 0x14b1 -Armenian_paruyk = 0x14b1 -Armenian_AYB = 0x14b2 -Armenian_ayb = 0x14b3 -Armenian_BEN = 0x14b4 -Armenian_ben = 0x14b5 -Armenian_GIM = 0x14b6 -Armenian_gim = 0x14b7 -Armenian_DA = 0x14b8 -Armenian_da = 0x14b9 -Armenian_YECH = 0x14ba -Armenian_yech = 0x14bb -Armenian_ZA = 0x14bc -Armenian_za = 0x14bd -Armenian_E = 0x14be -Armenian_e = 0x14bf -Armenian_AT = 0x14c0 -Armenian_at = 0x14c1 -Armenian_TO = 0x14c2 -Armenian_to = 0x14c3 -Armenian_ZHE = 0x14c4 -Armenian_zhe = 0x14c5 -Armenian_INI = 0x14c6 -Armenian_ini = 0x14c7 -Armenian_LYUN = 0x14c8 -Armenian_lyun = 0x14c9 -Armenian_KHE = 0x14ca -Armenian_khe = 0x14cb -Armenian_TSA = 0x14cc -Armenian_tsa = 0x14cd -Armenian_KEN = 0x14ce -Armenian_ken = 0x14cf -Armenian_HO = 0x14d0 -Armenian_ho = 0x14d1 -Armenian_DZA = 0x14d2 -Armenian_dza = 0x14d3 -Armenian_GHAT = 0x14d4 -Armenian_ghat = 0x14d5 -Armenian_TCHE = 0x14d6 -Armenian_tche = 0x14d7 -Armenian_MEN = 0x14d8 -Armenian_men = 0x14d9 -Armenian_HI = 0x14da -Armenian_hi = 0x14db -Armenian_NU = 0x14dc -Armenian_nu = 0x14dd -Armenian_SHA = 0x14de -Armenian_sha = 0x14df -Armenian_VO = 0x14e0 -Armenian_vo = 0x14e1 -Armenian_CHA = 0x14e2 -Armenian_cha = 0x14e3 -Armenian_PE = 0x14e4 -Armenian_pe = 0x14e5 -Armenian_JE = 0x14e6 -Armenian_je = 0x14e7 -Armenian_RA = 0x14e8 -Armenian_ra = 0x14e9 -Armenian_SE = 0x14ea -Armenian_se = 0x14eb -Armenian_VEV = 0x14ec -Armenian_vev = 0x14ed -Armenian_TYUN = 0x14ee -Armenian_tyun = 0x14ef -Armenian_RE = 0x14f0 -Armenian_re = 0x14f1 -Armenian_TSO = 0x14f2 -Armenian_tso = 0x14f3 -Armenian_VYUN = 0x14f4 -Armenian_vyun = 0x14f5 -Armenian_PYUR = 0x14f6 -Armenian_pyur = 0x14f7 -Armenian_KE = 0x14f8 -Armenian_ke = 0x14f9 -Armenian_O = 0x14fa -Armenian_o = 0x14fb -Armenian_FE = 0x14fc -Armenian_fe = 0x14fd -Armenian_apostrophe = 0x14fe -Armenian_ligature_ew = 0x14ff -Georgian_an = 0x15d0 -Georgian_ban = 0x15d1 -Georgian_gan = 0x15d2 -Georgian_don = 0x15d3 -Georgian_en = 0x15d4 -Georgian_vin = 0x15d5 -Georgian_zen = 0x15d6 -Georgian_tan = 0x15d7 -Georgian_in = 0x15d8 -Georgian_kan = 0x15d9 -Georgian_las = 0x15da -Georgian_man = 0x15db -Georgian_nar = 0x15dc -Georgian_on = 0x15dd -Georgian_par = 0x15de -Georgian_zhar = 0x15df -Georgian_rae = 0x15e0 -Georgian_san = 0x15e1 -Georgian_tar = 0x15e2 -Georgian_un = 0x15e3 -Georgian_phar = 0x15e4 -Georgian_khar = 0x15e5 -Georgian_ghan = 0x15e6 -Georgian_qar = 0x15e7 -Georgian_shin = 0x15e8 -Georgian_chin = 0x15e9 -Georgian_can = 0x15ea -Georgian_jil = 0x15eb -Georgian_cil = 0x15ec -Georgian_char = 0x15ed -Georgian_xan = 0x15ee -Georgian_jhan = 0x15ef -Georgian_hae = 0x15f0 -Georgian_he = 0x15f1 -Georgian_hie = 0x15f2 -Georgian_we = 0x15f3 -Georgian_har = 0x15f4 -Georgian_hoe = 0x15f5 -Georgian_fi = 0x15f6 -EcuSign = 0x20a0 -ColonSign = 0x20a1 -CruzeiroSign = 0x20a2 -FFrancSign = 0x20a3 -LiraSign = 0x20a4 -MillSign = 0x20a5 -NairaSign = 0x20a6 -PesetaSign = 0x20a7 -RupeeSign = 0x20a8 -WonSign = 0x20a9 -NewSheqelSign = 0x20aa -DongSign = 0x20ab -EuroSign = 0x20ac diff --git a/gi/overrides/meson.build b/gi/overrides/meson.build new file mode 100644 index 0000000..6ff073f --- /dev/null +++ b/gi/overrides/meson.build @@ -0,0 +1,15 @@ +python_sources = [ + 'GLib.py', + 'Gtk.py', + 'Gdk.py', + 'GdkPixbuf.py', + 'GObject.py', + 'Gio.py', + 'GIMarshallingTests.py', + 'Pango.py', + 'keysyms.py', + '__init__.py'] + +python.install_sources(python_sources, + subdir : join_paths('gi', 'overrides') +) diff --git a/gi/_gobject/pygboxed.c b/gi/pygboxed.c similarity index 52% rename from gi/_gobject/pygboxed.c rename to gi/pygboxed.c index 541e77b..595f815 100644 --- a/gi/_gobject/pygboxed.c +++ b/gi/pygboxed.c @@ -15,78 +15,95 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include -#include -#include "pygobject-private.h" -#include "pygboxed.h" +#include +#include -#include "pygi.h" +#include "pygboxed.h" +#include "pygi-type.h" +#include "pygi-type.h" +#include "pygi-util.h" GQuark pygboxed_type_key; -GQuark pygboxed_marshal_key; -PYGLIB_DEFINE_TYPE("gobject.GBoxed", PyGBoxed_Type, PyGBoxed); +PYGI_DEFINE_TYPE("gobject.GBoxed", PyGBoxed_Type, PyGBoxed); static void -pyg_boxed_dealloc(PyGBoxed *self) +gboxed_dealloc(PyGBoxed *self) { - if (self->free_on_dealloc && self->boxed) { - PyGILState_STATE state = pyglib_gil_state_ensure(); - g_boxed_free(self->gtype, self->boxed); - pyglib_gil_state_release(state); + if (self->free_on_dealloc && pyg_boxed_get_ptr (self)) { + PyGILState_STATE state = PyGILState_Ensure(); + g_boxed_free (self->gtype, pyg_boxed_get_ptr (self)); + PyGILState_Release(state); } Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject* -pyg_boxed_richcompare(PyObject *self, PyObject *other, int op) +gboxed_richcompare(PyObject *self, PyObject *other, int op) { if (Py_TYPE(self) == Py_TYPE(other) && PyObject_IsInstance(self, (PyObject*)&PyGBoxed_Type)) - return _pyglib_generic_ptr_richcompare(((PyGBoxed*)self)->boxed, - ((PyGBoxed*)other)->boxed, - op); + return pyg_ptr_richcompare (pyg_boxed_get_ptr (self), + pyg_boxed_get_ptr (other), + op); else { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } } - -static long -pyg_boxed_hash(PyGBoxed *self) +static Py_hash_t +gboxed_hash(PyGBoxed *self) { - return (long)self->boxed; + return (Py_hash_t)(gintptr)(pyg_boxed_get_ptr (self)); } static PyObject * -pyg_boxed_repr(PyGBoxed *self) +gboxed_repr(PyGBoxed *boxed) { - gchar buf[128]; + PyObject *module, *repr, *self = (PyObject *)boxed; + gchar *module_str, *namespace; + + module = PyObject_GetAttrString (self, "__module__"); + if (module == NULL) + return NULL; + + if (!PyUnicode_Check (module)) { + Py_DECREF (module); + return NULL; + } + + module_str = PyUnicode_AsUTF8 (module); + namespace = g_strrstr (module_str, "."); + if (namespace == NULL) { + namespace = module_str; + } else { + namespace += 1; + } - g_snprintf(buf, sizeof(buf), "<%s at 0x%lx>", g_type_name(self->gtype), - (long)self->boxed); - return PYGLIB_PyUnicode_FromString(buf); + repr = PyUnicode_FromFormat ("<%s.%s object at %p (%s at %p)>", + namespace, Py_TYPE (self)->tp_name, + self, g_type_name (boxed->gtype), + pyg_boxed_get_ptr (boxed)); + Py_DECREF (module); + return repr; } static int -pyg_boxed_init(PyGBoxed *self, PyObject *args, PyObject *kwargs) +gboxed_init(PyGBoxed *self, PyObject *args, PyObject *kwargs) { gchar buf[512]; if (!PyArg_ParseTuple(args, ":GBoxed.__init__")) return -1; - self->boxed = NULL; + pyg_boxed_set_ptr (self, NULL); self->gtype = 0; self->free_on_dealloc = FALSE; @@ -97,27 +114,25 @@ pyg_boxed_init(PyGBoxed *self, PyObject *args, PyObject *kwargs) } static void -pyg_boxed_free(PyObject *op) +gboxed_free(PyObject *op) { PyObject_FREE(op); } static PyObject * -pyg_boxed_copy(PyGBoxed *self) +gboxed_copy(PyGBoxed *self) { - return pyg_boxed_new (self->gtype, self->boxed, TRUE, TRUE); + return pygi_gboxed_new (self->gtype, pyg_boxed_get_ptr (self), TRUE, TRUE); } - - static PyMethodDef pygboxed_methods[] = { - { "copy", (PyCFunction) pyg_boxed_copy, METH_NOARGS }, + { "copy", (PyCFunction) gboxed_copy, METH_NOARGS }, { NULL, NULL, 0 } }; /** - * pyg_register_boxed: + * pygi_register_gboxed: * @dict: the module dictionary to store the wrapper class. * @class_name: the Python name for the wrapper class. * @boxed_type: the GType of the boxed type being wrapped. @@ -128,8 +143,8 @@ static PyMethodDef pygboxed_methods[] = { * will be stored in the provided module dictionary. */ void -pyg_register_boxed(PyObject *dict, const gchar *class_name, - GType boxed_type, PyTypeObject *type) +pygi_register_gboxed (PyObject *dict, const gchar *class_name, + GType boxed_type, PyTypeObject *type) { PyObject *o; @@ -137,9 +152,10 @@ pyg_register_boxed(PyObject *dict, const gchar *class_name, g_return_if_fail(class_name != NULL); g_return_if_fail(boxed_type != 0); - if (!type->tp_dealloc) type->tp_dealloc = (destructor)pyg_boxed_dealloc; + if (!type->tp_dealloc) type->tp_dealloc = (destructor)gboxed_dealloc; - Py_TYPE(type) = &PyType_Type; + Py_SET_TYPE(type, &PyType_Type); + g_assert (Py_TYPE (&PyGBoxed_Type) != NULL); type->tp_base = &PyGBoxed_Type; if (PyType_Ready(type) < 0) { @@ -157,7 +173,7 @@ pyg_register_boxed(PyObject *dict, const gchar *class_name, } /** - * pyg_boxed_new: + * pygi_gboxed_new: * @boxed_type: the GType of the boxed value. * @boxed: the boxed value. * @copy_boxed: whether the new boxed wrapper should hold a copy of the value. @@ -169,11 +185,11 @@ pyg_register_boxed(PyObject *dict, const gchar *class_name, * wrapper will be freed when the wrapper is deallocated. If * @copy_boxed is True, then @own_ref must also be True. * - * Returns: the boxed wrapper. + * Returns: the boxed wrapper or %NULL and sets an exception. */ PyObject * -pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed, - gboolean own_ref) +pygi_gboxed_new (GType boxed_type, gpointer boxed, gboolean copy_boxed, + gboolean own_ref) { PyGILState_STATE state; PyGBoxed *self; @@ -182,11 +198,11 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed, g_return_val_if_fail(boxed_type != 0, NULL); g_return_val_if_fail(!copy_boxed || (copy_boxed && own_ref), NULL); - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); if (!boxed) { Py_INCREF(Py_None); - pyglib_gil_state_release(state); + PyGILState_Release(state); return Py_None; } @@ -198,38 +214,58 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed, if (!tp) tp = (PyTypeObject *)&PyGBoxed_Type; /* fallback */ + if (!PyType_IsSubtype (tp, &PyGBoxed_Type)) { + PyErr_Format (PyExc_RuntimeError, "%s isn't a GBoxed", tp->tp_name); + PyGILState_Release (state); + return NULL; + } + self = (PyGBoxed *)tp->tp_alloc(tp, 0); if (self == NULL) { - pyglib_gil_state_release(state); + PyGILState_Release(state); return NULL; } if (copy_boxed) boxed = g_boxed_copy(boxed_type, boxed); - self->boxed = boxed; + pyg_boxed_set_ptr (self, boxed); self->gtype = boxed_type; self->free_on_dealloc = own_ref; - pyglib_gil_state_release(state); + PyGILState_Release(state); return (PyObject *)self; } -void -pygobject_boxed_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_gboxed_register_types(PyObject *d) { + PyObject *pygtype; + pygboxed_type_key = g_quark_from_static_string("PyGBoxed::class"); - pygboxed_marshal_key = g_quark_from_static_string("PyGBoxed::marshal"); - PyGBoxed_Type.tp_dealloc = (destructor)pyg_boxed_dealloc; - PyGBoxed_Type.tp_richcompare = pyg_boxed_richcompare; - PyGBoxed_Type.tp_repr = (reprfunc)pyg_boxed_repr; + PyGBoxed_Type.tp_dealloc = (destructor)gboxed_dealloc; + PyGBoxed_Type.tp_richcompare = gboxed_richcompare; + PyGBoxed_Type.tp_repr = (reprfunc)gboxed_repr; PyGBoxed_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; PyGBoxed_Type.tp_methods = pygboxed_methods; - PyGBoxed_Type.tp_init = (initproc)pyg_boxed_init; - PyGBoxed_Type.tp_free = (freefunc)pyg_boxed_free; - PyGBoxed_Type.tp_hash = (hashfunc)pyg_boxed_hash; - - PYGOBJECT_REGISTER_GTYPE(d, PyGBoxed_Type, "GBoxed", G_TYPE_BOXED); + PyGBoxed_Type.tp_init = (initproc)gboxed_init; + PyGBoxed_Type.tp_free = (freefunc)gboxed_free; + PyGBoxed_Type.tp_hash = (hashfunc)gboxed_hash; + PyGBoxed_Type.tp_alloc = PyType_GenericAlloc; + PyGBoxed_Type.tp_new = PyType_GenericNew; + if (PyType_Ready(&PyGBoxed_Type)) + return -1; + + pygtype = pyg_type_wrapper_new (G_TYPE_POINTER); + PyDict_SetItemString (PyGBoxed_Type.tp_dict, "__gtype__", pygtype); + Py_DECREF (pygtype); + + PyDict_SetItemString(d, "GBoxed", (PyObject *)&PyGBoxed_Type); + + return 0; } diff --git a/gi/_gobject/pygboxed.h b/gi/pygboxed.h similarity index 64% rename from gi/_gobject/pygboxed.h rename to gi/pygboxed.h index 8433b9d..c1b80bf 100644 --- a/gi/_gobject/pygboxed.h +++ b/gi/pygboxed.h @@ -14,14 +14,21 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGOBJECT_BOXED_H__ #define __PYGOBJECT_BOXED_H__ -void pygobject_boxed_register_types(PyObject *d); +extern GQuark pygboxed_type_key; + +extern PyTypeObject PyGBoxed_Type; + +void pygi_register_gboxed (PyObject *dict, const gchar *class_name, + GType boxed_type, PyTypeObject *type); +PyObject * pygi_gboxed_new (GType boxed_type, gpointer boxed, + gboolean copy_boxed, gboolean own_ref); + +int pygi_gboxed_register_types(PyObject *d); #endif /* __PYGOBJECT_BOXED_H__ */ diff --git a/gi/_gobject/pygenum.c b/gi/pygenum.c similarity index 73% rename from gi/_gobject/pygenum.c rename to gi/pygenum.c index 89e3a06..37495e8 100644 --- a/gi/_gobject/pygenum.c +++ b/gi/pygenum.c @@ -16,31 +16,28 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "pygobject-private.h" -#include "pygi.h" +#include +#include "pygi-type.h" +#include "pygi-util.h" +#include "pygi-type.h" +#include "pygi-basictype.h" #include "pygenum.h" +#include "pygboxed.h" GQuark pygenum_class_key; -PYGLIB_DEFINE_TYPE("gobject.GEnum", PyGEnum_Type, PyGEnum); +PYGI_DEFINE_TYPE("gobject.GEnum", PyGEnum_Type, PyGEnum); static PyObject * pyg_enum_val_new(PyObject* subclass, GType gtype, PyObject *intval) { PyObject *args, *item; args = Py_BuildValue("(O)", intval); - item = (&PYGLIB_PyLong_Type)->tp_new((PyTypeObject*)subclass, args, NULL); + item = (&PyLong_Type)->tp_new((PyTypeObject*)subclass, args, NULL); Py_DECREF(args); if (!item) return NULL; @@ -54,7 +51,7 @@ pyg_enum_richcompare(PyGEnum *self, PyObject *other, int op) { static char warning[256]; - if (!PYGLIB_PyLong_Check(other)) { + if (!PyLong_Check (other)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } @@ -72,29 +69,50 @@ pyg_enum_richcompare(PyGEnum *self, PyObject *other, int op) static PyObject * pyg_enum_repr(PyGEnum *self) { - GEnumClass *enum_class; - const char *value; - guint index; - static char tmp[256]; - long l; + PyObject *module; + GEnumClass *enum_class; + const char *value; + guint index; + char *namespace, *module_str; + static char tmp[256]; + long l; + + module = PyObject_GetAttrString ((PyObject *)self, "__module__"); + if (module == NULL) + return NULL; - enum_class = g_type_class_ref(self->gtype); - g_assert(G_IS_ENUM_CLASS(enum_class)); + if (!PyUnicode_Check (module)) { + Py_DECREF (module); + return NULL; + } - l = PYGLIB_PyLong_AS_LONG(self); - for (index = 0; index < enum_class->n_values; index++) - if (l == enum_class->values[index].value) - break; + enum_class = g_type_class_ref(self->gtype); + g_assert(G_IS_ENUM_CLASS(enum_class)); - value = enum_class->values[index].value_name; - if (value) - sprintf(tmp, "", value, g_type_name(self->gtype)); - else - sprintf(tmp, "", PYGLIB_PyLong_AS_LONG(self), g_type_name(self->gtype)); + l = PyLong_AS_LONG ((PyObject*)self); + for (index = 0; index < enum_class->n_values; index++) + if (l == enum_class->values[index].value) + break; - g_type_class_unref(enum_class); + module_str = PyUnicode_AsUTF8 (module); + namespace = g_strrstr (module_str, "."); + if (namespace == NULL) { + namespace = module_str; + } else { + namespace += 1; + } - return PYGLIB_PyUnicode_FromString(tmp); + value = enum_class->values[index].value_name; + if (value) + sprintf(tmp, "", value, + namespace, Py_TYPE (self)->tp_name); + else + sprintf(tmp, "", PyLong_AS_LONG ((PyObject*)self), + namespace, Py_TYPE (self)->tp_name); + Py_DECREF (module); + g_type_class_unref(enum_class); + + return PyUnicode_FromString (tmp); } static PyObject * @@ -143,7 +161,7 @@ pyg_enum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) * values might not have been that good", but we need to keep * backward compatibility. */ - if (!PyDict_Check(values) || PyDict_Size(values) > eclass->n_values) { + if (!PyDict_Check(values) || (gsize)PyDict_Size(values) > eclass->n_values) { PyErr_SetString(PyExc_TypeError, "__enum_values__ badly formed"); Py_DECREF(values); g_type_class_unref(eclass); @@ -152,7 +170,7 @@ pyg_enum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) g_type_class_unref(eclass); - intvalue = PYGLIB_PyLong_FromLong(value); + intvalue = PyLong_FromLong(value); ret = PyDict_GetItem(values, intvalue); Py_DECREF(intvalue); Py_DECREF(values); @@ -182,11 +200,11 @@ pyg_enum_from_gtype (GType gtype, int value) if (!pyclass) pyclass = pyg_enum_add(NULL, g_type_name(gtype), NULL, gtype); if (!pyclass) - return PYGLIB_PyLong_FromLong(value); + return PyLong_FromLong(value); values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, "__enum_values__"); - intvalue = PYGLIB_PyLong_FromLong(value); + intvalue = PyLong_FromLong(value); retval = PyDict_GetItem(values, intvalue); if (retval) { Py_INCREF(retval); @@ -213,7 +231,7 @@ pyg_enum_add (PyObject * module, PyGILState_STATE state; PyObject *instance_dict, *stub, *values, *o; GEnumClass *eclass; - int i; + guint i; g_return_val_if_fail(typename != NULL, NULL); if (!g_type_is_a (gtype, G_TYPE_ENUM)) { @@ -222,7 +240,7 @@ pyg_enum_add (PyObject * module, return NULL; } - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); /* Create a new type derived from GEnum. This is the same as: * >>> stub = type(typename, (GEnum,), {}) @@ -234,17 +252,16 @@ pyg_enum_add (PyObject * module, Py_DECREF(instance_dict); if (!stub) { PyErr_SetString(PyExc_RuntimeError, "can't create const"); - pyglib_gil_state_release(state); + PyGILState_Release(state); return NULL; } ((PyTypeObject *)stub)->tp_flags &= ~Py_TPFLAGS_BASETYPE; - ((PyTypeObject *)stub)->tp_new = pyg_enum_new; if (module) PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict, "__module__", - PYGLIB_PyUnicode_FromString(PyModule_GetName(module))); + PyUnicode_FromString (PyModule_GetName(module))); g_type_set_qdata(gtype, pygenum_class_key, stub); @@ -265,7 +282,7 @@ pyg_enum_add (PyObject * module, for (i = 0; i < eclass->n_values; i++) { PyObject *item, *intval; - intval = PYGLIB_PyLong_FromLong(eclass->values[i].value); + intval = PyLong_FromLong(eclass->values[i].value); item = pyg_enum_val_new(stub, gtype, intval); PyDict_SetItem(values, intval, item); Py_DECREF(intval); @@ -287,7 +304,7 @@ pyg_enum_add (PyObject * module, g_type_class_unref(eclass); - pyglib_gil_state_release(state); + PyGILState_Release(state); return stub; } @@ -297,7 +314,7 @@ pyg_enum_reduce(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, ":GEnum.__reduce__")) return NULL; - return Py_BuildValue("(O(i)O)", Py_TYPE(self), PYGLIB_PyLong_AsLong(self), + return Py_BuildValue("(O(i)O)", Py_TYPE(self), PyLong_AsLong (self), PyObject_GetAttrString(self, "__dict__")); } @@ -307,13 +324,17 @@ pyg_enum_get_value_name(PyGEnum *self, void *closure) GEnumClass *enum_class; GEnumValue *enum_value; PyObject *retval; + gint intvalue; + + if (!pygi_gint_from_py ((PyObject*) self, &intvalue)) + return NULL; enum_class = g_type_class_ref(self->gtype); g_assert(G_IS_ENUM_CLASS(enum_class)); - enum_value = g_enum_get_value(enum_class, PYGLIB_PyLong_AS_LONG(self)); + enum_value = g_enum_get_value(enum_class, intvalue); - retval = PYGLIB_PyUnicode_FromString(enum_value->value_name); + retval = pygi_utf8_to_py (enum_value->value_name); g_type_class_unref(enum_class); return retval; @@ -325,13 +346,18 @@ pyg_enum_get_value_nick(PyGEnum *self, void *closure) GEnumClass *enum_class; GEnumValue *enum_value; PyObject *retval; + gint intvalue; + + if (!pygi_gint_from_py ((PyObject*) self, &intvalue)) + return NULL; enum_class = g_type_class_ref(self->gtype); g_assert(G_IS_ENUM_CLASS(enum_class)); - enum_value = g_enum_get_value(enum_class, PYGLIB_PyLong_AS_LONG(self)); + enum_value = g_enum_get_value(enum_class, intvalue); + + retval = pygi_utf8_to_py (enum_value->value_nick); - retval = PYGLIB_PyUnicode_FromString(enum_value->value_nick); g_type_class_unref(enum_class); return retval; @@ -349,23 +375,34 @@ static PyGetSetDef pyg_enum_getsets[] = { { NULL, 0, 0 } }; -void -pygobject_enum_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_enum_register_types(PyObject *d) { + PyObject *pygtype; + pygenum_class_key = g_quark_from_static_string("PyGEnum::class"); - PyGEnum_Type.tp_base = &PYGLIB_PyLong_Type; -#if PY_VERSION_HEX < 0x03000000 + PyGEnum_Type.tp_base = &PyLong_Type; PyGEnum_Type.tp_new = pyg_enum_new; -#else - PyGEnum_Type.tp_new = PyLong_Type.tp_new; PyGEnum_Type.tp_hash = PyLong_Type.tp_hash; -#endif PyGEnum_Type.tp_repr = (reprfunc)pyg_enum_repr; PyGEnum_Type.tp_str = (reprfunc)pyg_enum_repr; PyGEnum_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; PyGEnum_Type.tp_richcompare = (richcmpfunc)pyg_enum_richcompare; PyGEnum_Type.tp_methods = pyg_enum_methods; PyGEnum_Type.tp_getset = pyg_enum_getsets; - PYGOBJECT_REGISTER_GTYPE(d, PyGEnum_Type, "GEnum", G_TYPE_ENUM); + PyGEnum_Type.tp_alloc = PyType_GenericAlloc; + if (PyType_Ready(&PyGEnum_Type)) + return -1; + + pygtype = pyg_type_wrapper_new (G_TYPE_ENUM); + PyDict_SetItemString (PyGEnum_Type.tp_dict, "__gtype__", pygtype); + Py_DECREF (pygtype); + + PyDict_SetItemString(d, "GEnum", (PyObject *)&PyGEnum_Type); + + return 0; } diff --git a/gi/pygenum.h b/gi/pygenum.h new file mode 100644 index 0000000..5b46d35 --- /dev/null +++ b/gi/pygenum.h @@ -0,0 +1,47 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * 2004-2008 Johan Dahlin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGOBJECT_ENUM_H__ +#define __PYGOBJECT_ENUM_H__ + +extern GQuark pygenum_class_key; + +#define PyGEnum_Check(x) (PyObject_IsInstance((PyObject *)x, (PyObject *)&PyGEnum_Type) && g_type_is_a(((PyGFlags*)x)->gtype, G_TYPE_ENUM)) + +typedef struct { + PyLongObject parent; + int zero_pad; /* must always be 0 */ + GType gtype; +} PyGEnum; + +extern PyTypeObject PyGEnum_Type; + +PyObject * pyg_enum_add (PyObject * module, + const char * type_name, + const char * strip_prefix, + GType gtype); + +PyObject * pyg_enum_from_gtype (GType gtype, + int value); + +gint pyg_enum_get_value (GType enum_type, PyObject *obj, gint *val); + +int pygi_enum_register_types(PyObject *d); + +#endif /* __PYGOBJECT_ENUM_H__ */ diff --git a/gi/_gobject/pygflags.c b/gi/pygflags.c similarity index 74% rename from gi/_gobject/pygflags.c rename to gi/pygflags.c index bdeaae7..df1280f 100644 --- a/gi/_gobject/pygflags.c +++ b/gi/pygflags.c @@ -16,24 +16,20 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include -#include -#include "pygobject-private.h" +#include "pygi-type.h" +#include "pygi-util.h" +#include "pygi-type.h" #include "pygflags.h" - -#include "pygi.h" +#include "pygboxed.h" GQuark pygflags_class_key; -PYGLIB_DEFINE_TYPE("gobject.GFlags", PyGFlags_Type, PyGFlags); +PYGI_DEFINE_TYPE("gobject.GFlags", PyGFlags_Type, PyGFlags); static PyObject * pyg_flags_val_new(PyObject* subclass, GType gtype, PyObject *intval) @@ -41,7 +37,7 @@ pyg_flags_val_new(PyObject* subclass, GType gtype, PyObject *intval) PyObject *args, *item; args = Py_BuildValue("(O)", intval); g_assert(PyObject_IsSubclass(subclass, (PyObject*) &PyGFlags_Type)); - item = PYGLIB_PyLong_Type.tp_new((PyTypeObject*)subclass, args, NULL); + item = PyLong_Type.tp_new((PyTypeObject*)subclass, args, NULL); Py_DECREF(args); if (!item) return NULL; @@ -55,7 +51,7 @@ pyg_flags_richcompare(PyGFlags *self, PyObject *other, int op) { static char warning[256]; - if (!PYGLIB_PyLong_Check(other)) { + if (!PyLong_Check (other)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } @@ -75,7 +71,7 @@ generate_repr(GType gtype, guint value) { GFlagsClass *flags_class; char *retval = NULL, *tmp; - int i; + guint i; flags_class = g_type_class_ref(gtype); g_assert(G_IS_FLAGS_CLASS(flags_class)); @@ -106,20 +102,42 @@ generate_repr(GType gtype, guint value) static PyObject * pyg_flags_repr(PyGFlags *self) { - char *tmp, *retval; - PyObject *pyretval; + char *tmp, *retval, *module_str, *namespace; + PyObject *pyretval, *module; + + tmp = generate_repr(self->gtype, (guint)PyLong_AsUnsignedLongMask ((PyObject*)self)); + + module = PyObject_GetAttrString ((PyObject *)self, "__module__"); + if (module == NULL) { + g_free (tmp); + return NULL; + } - tmp = generate_repr(self->gtype, PYGLIB_PyLong_AsUnsignedLong(self)); + if (!PyUnicode_Check (module)) { + g_free (tmp); + Py_DECREF (module); + return NULL; + } + + module_str = PyUnicode_AsUTF8 (module); + namespace = g_strrstr (module_str, "."); + if (namespace == NULL) { + namespace = module_str; + } else { + namespace += 1; + } if (tmp) - retval = g_strdup_printf("", tmp, - g_type_name(self->gtype)); + retval = g_strdup_printf("", tmp, + namespace, Py_TYPE (self)->tp_name); else - retval = g_strdup_printf("", PYGLIB_PyLong_AsUnsignedLong(self), - g_type_name(self->gtype)); + retval = g_strdup_printf("", + PyLong_AsUnsignedLongMask ((PyObject*)self), + namespace, Py_TYPE (self)->tp_name); g_free(tmp); + Py_DECREF (module); - pyretval = PYGLIB_PyUnicode_FromString(retval); + pyretval = PyUnicode_FromString (retval); g_free(retval); return pyretval; @@ -168,7 +186,7 @@ pyg_flags_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) g_type_class_unref(eclass); - pyint = PYGLIB_PyLong_FromUnsignedLong(value); + pyint = PyLong_FromUnsignedLong (value); ret = PyDict_GetItem(values, pyint); if (!ret) { PyErr_Clear(); @@ -191,7 +209,7 @@ pyg_flags_from_gtype (GType gtype, guint value) PyObject *pyclass, *values, *retval, *pyint; if (PyErr_Occurred()) - return PYGLIB_PyLong_FromUnsignedLong(0); + return PyLong_FromUnsignedLong (0); g_return_val_if_fail(gtype != G_TYPE_INVALID, NULL); @@ -206,11 +224,11 @@ pyg_flags_from_gtype (GType gtype, guint value) if (!pyclass) pyclass = pyg_flags_add(NULL, g_type_name(gtype), NULL, gtype); if (!pyclass) - return PYGLIB_PyLong_FromUnsignedLong(value); + return PyLong_FromUnsignedLong (value); values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, "__flags_values__"); - pyint = PYGLIB_PyLong_FromUnsignedLong(value); + pyint = PyLong_FromUnsignedLong (value); retval = PyDict_GetItem(values, pyint); if (!retval) { PyErr_Clear(); @@ -238,7 +256,7 @@ pyg_flags_add (PyObject * module, PyGILState_STATE state; PyObject *instance_dict, *stub, *values, *o; GFlagsClass *eclass; - int i; + guint i; g_return_val_if_fail(typename != NULL, NULL); if (!g_type_is_a(gtype, G_TYPE_FLAGS)) { @@ -247,7 +265,7 @@ pyg_flags_add (PyObject * module, return NULL; } - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); /* Create a new type derived from GFlags. This is the same as: * >>> stub = type(typename, (GFlags,), {}) @@ -259,17 +277,16 @@ pyg_flags_add (PyObject * module, Py_DECREF(instance_dict); if (!stub) { PyErr_SetString(PyExc_RuntimeError, "can't create GFlags subtype"); - pyglib_gil_state_release(state); + PyGILState_Release(state); return NULL; } ((PyTypeObject *)stub)->tp_flags &= ~Py_TPFLAGS_BASETYPE; - ((PyTypeObject *)stub)->tp_new = pyg_flags_new; if (module) { PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict, "__module__", - PYGLIB_PyUnicode_FromString(PyModule_GetName(module))); + PyUnicode_FromString (PyModule_GetName(module))); /* Add it to the module name space */ PyModule_AddObject(module, (char*)typename, stub); @@ -288,7 +305,7 @@ pyg_flags_add (PyObject * module, for (i = 0; i < eclass->n_values; i++) { PyObject *item, *intval; - intval = PYGLIB_PyLong_FromUnsignedLong(eclass->values[i].value); + intval = PyLong_FromUnsignedLong (eclass->values[i].value); g_assert(PyErr_Occurred() == NULL); item = pyg_flags_val_new(stub, gtype, intval); PyDict_SetItem(values, intval, item); @@ -311,7 +328,7 @@ pyg_flags_add (PyObject * module, g_type_class_unref(eclass); - pyglib_gil_state_release(state); + PyGILState_Release(state); return stub; } @@ -320,32 +337,32 @@ static PyObject * pyg_flags_and(PyGFlags *a, PyGFlags *b) { if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) - return PYGLIB_PyLong_Type.tp_as_number->nb_and((PyObject*)a, + return PyLong_Type.tp_as_number->nb_and((PyObject*)a, (PyObject*)b); return pyg_flags_from_gtype(a->gtype, - PYGLIB_PyLong_AsUnsignedLong(a) & PYGLIB_PyLong_AsUnsignedLong(b)); + (guint)(PyLong_AsUnsignedLongMask ((PyObject*)a) & PyLong_AsUnsignedLongMask ((PyObject*)b))); } static PyObject * pyg_flags_or(PyGFlags *a, PyGFlags *b) { if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) - return PYGLIB_PyLong_Type.tp_as_number->nb_or((PyObject*)a, + return PyLong_Type.tp_as_number->nb_or((PyObject*)a, (PyObject*)b); - return pyg_flags_from_gtype(a->gtype, PYGLIB_PyLong_AsUnsignedLong(a) | PYGLIB_PyLong_AsUnsignedLong(b)); + return pyg_flags_from_gtype(a->gtype, (guint)(PyLong_AsUnsignedLongMask ((PyObject*)a) | PyLong_AsUnsignedLongMask ((PyObject*)b))); } static PyObject * pyg_flags_xor(PyGFlags *a, PyGFlags *b) { if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) - return PYGLIB_PyLong_Type.tp_as_number->nb_xor((PyObject*)a, + return PyLong_Type.tp_as_number->nb_xor((PyObject*)a, (PyObject*)b); return pyg_flags_from_gtype(a->gtype, - PYGLIB_PyLong_AsUnsignedLong(a) ^ PYGLIB_PyLong_AsUnsignedLong(b)); + (guint)(PyLong_AsUnsignedLongMask ((PyObject*)a) ^ PyLong_AsUnsignedLongMask ((PyObject*)b))); } @@ -368,9 +385,9 @@ pyg_flags_get_first_value_name(PyGFlags *self, void *closure) flags_class = g_type_class_ref(self->gtype); g_assert(G_IS_FLAGS_CLASS(flags_class)); - flags_value = g_flags_get_first_value(flags_class, PYGLIB_PyLong_AsUnsignedLong(self)); + flags_value = g_flags_get_first_value(flags_class, (guint)PyLong_AsUnsignedLongMask ((PyObject*)self)); if (flags_value) - retval = PYGLIB_PyUnicode_FromString(flags_value->value_name); + retval = PyUnicode_FromString (flags_value->value_name); else { retval = Py_None; Py_INCREF(Py_None); @@ -390,9 +407,9 @@ pyg_flags_get_first_value_nick(PyGFlags *self, void *closure) flags_class = g_type_class_ref(self->gtype); g_assert(G_IS_FLAGS_CLASS(flags_class)); - flags_value = g_flags_get_first_value(flags_class, PYGLIB_PyLong_AsUnsignedLong(self)); + flags_value = g_flags_get_first_value(flags_class, (guint)PyLong_AsUnsignedLongMask ((PyObject*)self)); if (flags_value) - retval = PYGLIB_PyUnicode_FromString(flags_value->value_nick); + retval = PyUnicode_FromString (flags_value->value_nick); else { retval = Py_None; Py_INCREF(Py_None); @@ -407,15 +424,21 @@ pyg_flags_get_value_names(PyGFlags *self, void *closure) { GFlagsClass *flags_class; PyObject *retval; - int i; + guint i; flags_class = g_type_class_ref(self->gtype); g_assert(G_IS_FLAGS_CLASS(flags_class)); retval = PyList_New(0); - for (i = 0; i < flags_class->n_values; i++) - if ((PYGLIB_PyLong_AsUnsignedLong(self) & flags_class->values[i].value) == flags_class->values[i].value) - PyList_Append(retval, PYGLIB_PyUnicode_FromString(flags_class->values[i].value_name)); + for (i = 0; i < flags_class->n_values; i++) { + PyObject *value_name; + + if ((PyLong_AsUnsignedLongMask ((PyObject*)self) & flags_class->values[i].value) == flags_class->values[i].value) { + value_name = PyUnicode_FromString (flags_class->values[i].value_name); + PyList_Append (retval, value_name); + Py_DECREF (value_name); + } + } g_type_class_unref(flags_class); @@ -427,15 +450,15 @@ pyg_flags_get_value_nicks(PyGFlags *self, void *closure) { GFlagsClass *flags_class; PyObject *retval; - int i; + guint i; flags_class = g_type_class_ref(self->gtype); g_assert(G_IS_FLAGS_CLASS(flags_class)); retval = PyList_New(0); for (i = 0; i < flags_class->n_values; i++) - if ((PYGLIB_PyLong_AsUnsignedLong(self) & flags_class->values[i].value) == flags_class->values[i].value) { - PyObject *py_nick = PYGLIB_PyUnicode_FromString(flags_class->values[i].value_nick); + if ((PyLong_AsUnsignedLongMask ((PyObject*)self) & flags_class->values[i].value) == flags_class->values[i].value) { + PyObject *py_nick = PyUnicode_FromString (flags_class->values[i].value_nick); PyList_Append(retval, py_nick); Py_DECREF (py_nick); } @@ -459,9 +482,6 @@ static PyNumberMethods pyg_flags_as_number = { (binaryfunc)pyg_flags_warn, /* nb_multiply */ (binaryfunc)pyg_flags_warn, /* nb_divide */ (binaryfunc)pyg_flags_warn, /* nb_remainder */ -#if PY_VERSION_HEX < 0x03000000 - (binaryfunc)pyg_flags_warn, /* nb_divmod */ -#endif (ternaryfunc)pyg_flags_warn, /* nb_power */ 0, /* nb_negative */ 0, /* nb_positive */ @@ -475,23 +495,34 @@ static PyNumberMethods pyg_flags_as_number = { (binaryfunc)pyg_flags_or, /* nb_or */ }; -void -pygobject_flags_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_flags_register_types(PyObject *d) { + PyObject *pygtype; + pygflags_class_key = g_quark_from_static_string("PyGFlags::class"); - PyGFlags_Type.tp_base = &PYGLIB_PyLong_Type; -#if PY_VERSION_HEX < 0x03000000 + PyGFlags_Type.tp_base = &PyLong_Type; PyGFlags_Type.tp_new = pyg_flags_new; -#else - PyGFlags_Type.tp_new = PyLong_Type.tp_new; - PyGFlags_Type.tp_hash = PyLong_Type.tp_hash; -#endif + PyGFlags_Type.tp_hash = PyLong_Type.tp_hash; PyGFlags_Type.tp_repr = (reprfunc)pyg_flags_repr; PyGFlags_Type.tp_as_number = &pyg_flags_as_number; PyGFlags_Type.tp_str = (reprfunc)pyg_flags_repr; PyGFlags_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; PyGFlags_Type.tp_richcompare = (richcmpfunc)pyg_flags_richcompare; PyGFlags_Type.tp_getset = pyg_flags_getsets; - PYGOBJECT_REGISTER_GTYPE(d, PyGFlags_Type, "GFlags", G_TYPE_FLAGS); + PyGFlags_Type.tp_alloc = PyType_GenericAlloc; + if (PyType_Ready(&PyGFlags_Type)) + return -1; + + pygtype = pyg_type_wrapper_new (G_TYPE_FLAGS); + PyDict_SetItemString (PyGFlags_Type.tp_dict, "__gtype__", pygtype); + Py_DECREF (pygtype); + + PyDict_SetItemString(d, "GFlags", (PyObject *)&PyGFlags_Type); + + return 0; } diff --git a/gi/pygflags.h b/gi/pygflags.h new file mode 100644 index 0000000..7cff7f2 --- /dev/null +++ b/gi/pygflags.h @@ -0,0 +1,46 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * 2004-2008 Johan Dahlin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGOBJECT_FLAGS_H__ +#define __PYGOBJECT_FLAGS_H__ + +extern GQuark pygflags_class_key; + +typedef struct { + PyLongObject parent; + int zero_pad; /* must always be 0 */ + GType gtype; +} PyGFlags; + +extern PyTypeObject PyGFlags_Type; + +#define PyGFlags_Check(x) (PyObject_IsInstance((PyObject *)x, (PyObject *)&PyGFlags_Type) && g_type_is_a(((PyGFlags*)x)->gtype, G_TYPE_FLAGS)) + +extern PyObject * pyg_flags_add (PyObject * module, + const char * type_name, + const char * strip_prefix, + GType gtype); +extern PyObject * pyg_flags_from_gtype (GType gtype, + guint value); + +gint pyg_flags_get_value (GType flag_type, PyObject *obj, guint *val); + +int pygi_flags_register_types(PyObject *d); + +#endif /* __PYGOBJECT_FLAGS_H__ */ diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c index 7d8a837..c5c5bea 100644 --- a/gi/pygi-argument.c +++ b/gi/pygi-argument.c @@ -16,29 +16,35 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" +#include #include #include -#include -#include -#include -#include +#include "pygobject-internal.h" -#include "pygi-marshal-from-py.h" -#include "pygi-marshal-to-py.h" +#include +#include +#include "pygi-argument.h" +#include "pygi-info.h" +#include "pygi-value.h" +#include "pygi-basictype.h" +#include "pygi-object.h" +#include "pygi-struct-marshal.h" +#include "pygi-error.h" +#include "pygi-foreign.h" +#include "pygi-type.h" +#include "pygi-util.h" -static gboolean -gi_argument_to_gssize (GIArgument *arg_in, - GITypeTag type_tag, - gssize *gssize_out) + +gboolean +pygi_argument_to_gssize (GIArgument *arg_in, + GITypeTag type_tag, + gssize *gssize_out) { switch (type_tag) { case GI_TYPE_TAG_INT8: @@ -60,10 +66,22 @@ gi_argument_to_gssize (GIArgument *arg_in, *gssize_out = arg_in->v_uint32; return TRUE; case GI_TYPE_TAG_INT64: - *gssize_out = arg_in->v_int64; + if (arg_in->v_int64 > G_MAXSSIZE || arg_in->v_int64 < G_MINSSIZE) { + PyErr_Format (PyExc_TypeError, + "Unable to marshal %s to gssize", + g_type_tag_to_string(type_tag)); + return FALSE; + } + *gssize_out = (gssize)arg_in->v_int64; return TRUE; case GI_TYPE_TAG_UINT64: - *gssize_out = arg_in->v_uint64; + if (arg_in->v_uint64 > G_MAXSSIZE) { + PyErr_Format (PyExc_TypeError, + "Unable to marshal %s to gssize", + g_type_tag_to_string(type_tag)); + return FALSE; + } + *gssize_out = (gssize)arg_in->v_uint64; return TRUE; default: PyErr_Format (PyExc_TypeError, @@ -73,32 +91,59 @@ gi_argument_to_gssize (GIArgument *arg_in, } } +static GITypeTag +_pygi_get_storage_type (GITypeInfo *type_info) +{ + GITypeTag type_tag = g_type_info_get_tag (type_info); + + if (type_tag == GI_TYPE_TAG_INTERFACE) { + GIBaseInfo *interface = g_type_info_get_interface (type_info); + switch (g_base_info_get_type (interface)) { + case GI_INFO_TYPE_ENUM: + case GI_INFO_TYPE_FLAGS: + type_tag = g_enum_info_get_storage_type ((GIEnumInfo *)interface); + break; + default: + /* FIXME: we might have something to do for other types */ + break; + } + g_base_info_unref (interface); + } + return type_tag; +} + void _pygi_hash_pointer_to_arg (GIArgument *arg, - GITypeTag type_tag) + GITypeInfo *type_info) { + GITypeTag type_tag = _pygi_get_storage_type (type_info); + switch (type_tag) { case GI_TYPE_TAG_INT8: - arg->v_int8 = GPOINTER_TO_INT (arg->v_pointer); + arg->v_int8 = (gint8)GPOINTER_TO_INT (arg->v_pointer); break; case GI_TYPE_TAG_INT16: - arg->v_int16 = GPOINTER_TO_INT (arg->v_pointer); + arg->v_int16 = (gint16)GPOINTER_TO_INT (arg->v_pointer); break; case GI_TYPE_TAG_INT32: - arg->v_int32 = GPOINTER_TO_INT (arg->v_pointer); + arg->v_int32 = (gint32)GPOINTER_TO_INT (arg->v_pointer); break; case GI_TYPE_TAG_UINT8: - arg->v_uint8 = GPOINTER_TO_UINT (arg->v_pointer); + arg->v_uint8 = (guint8)GPOINTER_TO_UINT (arg->v_pointer); break; case GI_TYPE_TAG_UINT16: - arg->v_uint16 = GPOINTER_TO_UINT (arg->v_pointer); + arg->v_uint16 = (guint16)GPOINTER_TO_UINT (arg->v_pointer); break; case GI_TYPE_TAG_UINT32: - arg->v_uint32 = GPOINTER_TO_UINT (arg->v_pointer); + arg->v_uint32 = (guint32)GPOINTER_TO_UINT (arg->v_pointer); + break; + case GI_TYPE_TAG_GTYPE: + arg->v_size = GPOINTER_TO_SIZE (arg->v_pointer); break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_INTERFACE: + case GI_TYPE_TAG_ARRAY: break; default: g_critical ("Unsupported type %s", g_type_tag_to_string(type_tag)); @@ -107,8 +152,10 @@ _pygi_hash_pointer_to_arg (GIArgument *arg, gpointer _pygi_arg_to_hash_pointer (const GIArgument *arg, - GITypeTag type_tag) + GITypeInfo *type_info) { + GITypeTag type_tag = _pygi_get_storage_type (type_info); + switch (type_tag) { case GI_TYPE_TAG_INT8: return GINT_TO_POINTER (arg->v_int8); @@ -122,9 +169,12 @@ _pygi_arg_to_hash_pointer (const GIArgument *arg, return GINT_TO_POINTER (arg->v_int32); case GI_TYPE_TAG_UINT32: return GINT_TO_POINTER (arg->v_uint32); + case GI_TYPE_TAG_GTYPE: + return GSIZE_TO_POINTER (arg->v_size); case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: case GI_TYPE_TAG_INTERFACE: + case GI_TYPE_TAG_ARRAY: return arg->v_pointer; default: g_critical ("Unsupported type %s", g_type_tag_to_string(type_tag)); @@ -132,642 +182,49 @@ _pygi_arg_to_hash_pointer (const GIArgument *arg, } } -static void -_pygi_g_type_tag_py_bounds (GITypeTag type_tag, - PyObject **lower, - PyObject **upper) -{ - switch (type_tag) { - case GI_TYPE_TAG_INT8: - *lower = PYGLIB_PyLong_FromLong (-128); - *upper = PYGLIB_PyLong_FromLong (127); - break; - case GI_TYPE_TAG_UINT8: - *upper = PYGLIB_PyLong_FromLong (255); - *lower = PYGLIB_PyLong_FromLong (0); - break; - case GI_TYPE_TAG_INT16: - *lower = PYGLIB_PyLong_FromLong (-32768); - *upper = PYGLIB_PyLong_FromLong (32767); - break; - case GI_TYPE_TAG_UINT16: - *upper = PYGLIB_PyLong_FromLong (65535); - *lower = PYGLIB_PyLong_FromLong (0); - break; - case GI_TYPE_TAG_INT32: - *lower = PYGLIB_PyLong_FromLong (G_MININT32); - *upper = PYGLIB_PyLong_FromLong (G_MAXINT32); - break; - case GI_TYPE_TAG_UINT32: - /* Note: On 32-bit archs, this number doesn't fit in a long. */ - *upper = PyLong_FromLongLong (G_MAXUINT32); - *lower = PYGLIB_PyLong_FromLong (0); - break; - case GI_TYPE_TAG_INT64: - /* Note: On 32-bit archs, these numbers don't fit in a long. */ - *lower = PyLong_FromLongLong (G_MININT64); - *upper = PyLong_FromLongLong (G_MAXINT64); - break; - case GI_TYPE_TAG_UINT64: - *upper = PyLong_FromUnsignedLongLong (G_MAXUINT64); - *lower = PYGLIB_PyLong_FromLong (0); - break; - case GI_TYPE_TAG_FLOAT: - *upper = PyFloat_FromDouble (G_MAXFLOAT); - *lower = PyFloat_FromDouble (-G_MAXFLOAT); - break; - case GI_TYPE_TAG_DOUBLE: - *upper = PyFloat_FromDouble (G_MAXDOUBLE); - *lower = PyFloat_FromDouble (-G_MAXDOUBLE); - break; - default: - PyErr_SetString (PyExc_TypeError, "Non-numeric type tag"); - *lower = *upper = NULL; - return; - } -} - -gint -_pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info, - gboolean is_instance, - PyObject *object) -{ - gint retval; - - GType g_type; - PyObject *py_type; - gchar *type_name_expected = NULL; - GIInfoType interface_type; - - interface_type = g_base_info_get_type (info); - if ( (interface_type == GI_INFO_TYPE_STRUCT) && - (g_struct_info_is_foreign ( (GIStructInfo*) info))) { - /* TODO: Could we check is the correct foreign type? */ - return 1; - } - - g_type = g_registered_type_info_get_g_type (info); - if (g_type != G_TYPE_NONE) { - py_type = _pygi_type_get_from_g_type (g_type); - } else { - py_type = _pygi_type_import_by_gi_info ( (GIBaseInfo *) info); - } - - if (py_type == NULL) { - return 0; - } - - g_assert (PyType_Check (py_type)); - - if (is_instance) { - retval = PyObject_IsInstance (object, py_type); - if (!retval) { - type_name_expected = _pygi_g_base_info_get_fullname ( - (GIBaseInfo *) info); - } - } else { - if (!PyObject_Type (py_type)) { - type_name_expected = "type"; - retval = 0; - } else if (!PyType_IsSubtype ( (PyTypeObject *) object, - (PyTypeObject *) py_type)) { - type_name_expected = _pygi_g_base_info_get_fullname ( - (GIBaseInfo *) info); - retval = 0; - } else { - retval = 1; - } - } - - Py_DECREF (py_type); - - if (!retval) { - PyTypeObject *object_type; - if (type_name_expected == NULL) { - return -1; - } - - object_type = (PyTypeObject *) PyObject_Type (object); - if (object_type == NULL) { - return -1; - } - - PyErr_Format (PyExc_TypeError, "Must be %s, not %s", - type_name_expected, object_type->tp_name); - - g_free (type_name_expected); - } - - return retval; -} - -gint -_pygi_g_type_interface_check_object (GIBaseInfo *info, - PyObject *object) -{ - gint retval = 1; - GIInfoType info_type; - - info_type = g_base_info_get_type (info); - switch (info_type) { - case GI_INFO_TYPE_CALLBACK: - if (!PyCallable_Check (object)) { - PyErr_Format (PyExc_TypeError, "Must be callable, not %s", - object->ob_type->tp_name); - retval = 0; - } - break; - case GI_INFO_TYPE_ENUM: - retval = 0; - if (PyNumber_Check (object)) { - PyObject *number = PYGLIB_PyNumber_Long (object); - if (number == NULL) - PyErr_Clear(); - else { - glong value = PYGLIB_PyLong_AsLong (number); - int i; - for (i = 0; i < g_enum_info_get_n_values (info); i++) { - GIValueInfo *value_info = g_enum_info_get_value (info, i); - glong enum_value = g_value_info_get_value (value_info); - g_base_info_unref (value_info); - if (value == enum_value) { - retval = 1; - break; - } - } - } - } - if (retval < 1) - retval = _pygi_g_registered_type_info_check_object ( - (GIRegisteredTypeInfo *) info, TRUE, object); - break; - case GI_INFO_TYPE_FLAGS: - if (PyNumber_Check (object)) { - /* Accept 0 as a valid flag value */ - PyObject *number = PYGLIB_PyNumber_Long (object); - if (number == NULL) - PyErr_Clear(); - else { - long value = PYGLIB_PyLong_AsLong (number); - if (value == 0) - break; - else if (value == -1) - PyErr_Clear(); - } - } - retval = _pygi_g_registered_type_info_check_object ( - (GIRegisteredTypeInfo *) info, TRUE, object); - break; - case GI_INFO_TYPE_STRUCT: - { - GType type; - - /* Handle special cases. */ - type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); - if (g_type_is_a (type, G_TYPE_CLOSURE)) { - if (!(PyCallable_Check (object) || - pyg_type_from_object_strict (object, FALSE) == G_TYPE_CLOSURE)) { - PyErr_Format (PyExc_TypeError, "Must be callable, not %s", - object->ob_type->tp_name); - retval = 0; - } - break; - } else if (g_type_is_a (type, G_TYPE_VALUE)) { - /* we can't check g_values because we don't have - * enough context so just pass them through */ - break; - } - - /* Fallback. */ - } - case GI_INFO_TYPE_BOXED: - case GI_INFO_TYPE_INTERFACE: - case GI_INFO_TYPE_OBJECT: - retval = _pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) info, TRUE, object); - break; - case GI_INFO_TYPE_UNION: - - - retval = _pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) info, TRUE, object); - - /* If not the same type then check to see if the object's type - * is the same as one of the union's members - */ - if (retval == 0) { - gint i; - gint n_fields; - - n_fields = g_union_info_get_n_fields ( (GIUnionInfo *) info); - - for (i = 0; i < n_fields; i++) { - gint member_retval; - GIFieldInfo *field_info; - GITypeInfo *field_type_info; - - field_info = - g_union_info_get_field ( (GIUnionInfo *) info, i); - field_type_info = g_field_info_get_type (field_info); - - member_retval = _pygi_g_type_info_check_object( - field_type_info, - object, - TRUE); - - g_base_info_unref ( ( GIBaseInfo *) field_type_info); - g_base_info_unref ( ( GIBaseInfo *) field_info); - - if (member_retval == 1) { - retval = member_retval; - break; - } - } - } - - break; - default: - g_assert_not_reached(); - } - - return retval; -} - -gint -_pygi_g_type_info_check_object (GITypeInfo *type_info, - PyObject *object, - gboolean allow_none) +/** + * _pygi_argument_array_length_marshal: + * @length_arg_index: Index of length argument in the callables args list. + * @user_data1: (type Array(GValue)): Array of GValue arguments to retrieve length + * @user_data2: (type GICallableInfo): Callable info to get the argument from. + * + * Generic marshalling policy for array length arguments in callables. + * + * Returns: The length of the array or -1 on failure. + */ +gssize +_pygi_argument_array_length_marshal (gsize length_arg_index, + void *user_data1, + void *user_data2) { - GITypeTag type_tag; - gint retval = 1; - - if (allow_none && object == Py_None) { - return retval; - } - - type_tag = g_type_info_get_tag (type_info); - - switch (type_tag) { - case GI_TYPE_TAG_VOID: - /* No check; VOID means undefined type */ - break; - case GI_TYPE_TAG_BOOLEAN: - /* No check; every Python object has a truth value. */ - break; - case GI_TYPE_TAG_UINT8: - case GI_TYPE_TAG_INT8: - /* (U)INT8 types can be characters */ - if (PYGLIB_PyBytes_Check(object)) { - if (PYGLIB_PyBytes_Size(object) != 1) { - PyErr_Format (PyExc_TypeError, "Must be a single character"); - retval = 0; - break; - } - - break; - } - case GI_TYPE_TAG_INT16: - case GI_TYPE_TAG_UINT16: - case GI_TYPE_TAG_INT32: - case GI_TYPE_TAG_UINT32: - case GI_TYPE_TAG_INT64: - case GI_TYPE_TAG_UINT64: - case GI_TYPE_TAG_FLOAT: - case GI_TYPE_TAG_DOUBLE: - { - PyObject *number, *lower, *upper; - - if (!PyNumber_Check (object)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - object->ob_type->tp_name); - retval = 0; - break; - } - - if (type_tag == GI_TYPE_TAG_FLOAT || type_tag == GI_TYPE_TAG_DOUBLE) { - number = PyNumber_Float (object); - } else { - number = PYGLIB_PyNumber_Long (object); - } - - _pygi_g_type_tag_py_bounds (type_tag, &lower, &upper); - - if (lower == NULL || upper == NULL || number == NULL) { - retval = -1; - goto check_number_release; - } - - /* Check bounds */ - if (PyObject_RichCompareBool (lower, number, Py_GT) - || PyObject_RichCompareBool (upper, number, Py_LT)) { - PyObject *lower_str; - PyObject *upper_str; - - if (PyErr_Occurred()) { - retval = -1; - goto check_number_release; - } - - lower_str = PyObject_Str (lower); - upper_str = PyObject_Str (upper); - if (lower_str == NULL || upper_str == NULL) { - retval = -1; - goto check_number_error_release; - } - -#if PY_VERSION_HEX < 0x03000000 - PyErr_Format (PyExc_ValueError, "Must range from %s to %s", - PyString_AS_STRING (lower_str), - PyString_AS_STRING (upper_str)); -#else - { - PyObject *lower_pybytes_obj; - PyObject *upper_pybytes_obj; - - lower_pybytes_obj = PyUnicode_AsUTF8String (lower_str); - if (!lower_pybytes_obj) { - goto utf8_fail; - } - - upper_pybytes_obj = PyUnicode_AsUTF8String (upper_str); - if (!upper_pybytes_obj) { - Py_DECREF(lower_pybytes_obj); - goto utf8_fail; - } - - PyErr_Format (PyExc_ValueError, "Must range from %s to %s", - PyBytes_AsString (lower_pybytes_obj), - PyBytes_AsString (upper_pybytes_obj)); - Py_DECREF (lower_pybytes_obj); - Py_DECREF (upper_pybytes_obj); - } -utf8_fail: -#endif - retval = 0; - -check_number_error_release: - Py_XDECREF (lower_str); - Py_XDECREF (upper_str); - } - -check_number_release: - Py_XDECREF (number); - Py_XDECREF (lower); - Py_XDECREF (upper); - break; - } - case GI_TYPE_TAG_GTYPE: - { - if (pyg_type_from_object (object) == 0) { - PyErr_Format (PyExc_TypeError, "Must be gobject.GType, not %s", - object->ob_type->tp_name); - retval = 0; - } - break; - } - case GI_TYPE_TAG_UNICHAR: - { - Py_ssize_t size; - if (PyUnicode_Check (object)) { - size = PyUnicode_GET_SIZE (object); -#if PY_VERSION_HEX < 0x03000000 - } else if (PyString_Check (object)) { - PyObject *pyuni = PyUnicode_FromEncodedObject (object, "UTF-8", "strict"); - size = PyUnicode_GET_SIZE (pyuni); - Py_DECREF(pyuni); -#endif - } else { - PyErr_Format (PyExc_TypeError, "Must be string, not %s", - object->ob_type->tp_name); - retval = 0; - break; - } - - if (size != 1) { - PyErr_Format (PyExc_TypeError, "Must be a one character string, not %" G_GINT64_FORMAT " characters", - (gint64)size); - retval = 0; - break; - } - - break; - } - case GI_TYPE_TAG_UTF8: - case GI_TYPE_TAG_FILENAME: - if (!PYGLIB_PyBaseString_Check (object) ) { - PyErr_Format (PyExc_TypeError, "Must be string, not %s", - object->ob_type->tp_name); - retval = 0; - } - break; - case GI_TYPE_TAG_ARRAY: - { - gssize fixed_size; - Py_ssize_t length; - GITypeInfo *item_type_info; - Py_ssize_t i; - - if (!PySequence_Check (object)) { - PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", - object->ob_type->tp_name); - retval = 0; - break; - } - - length = PySequence_Length (object); - if (length < 0) { - retval = -1; - break; - } - - fixed_size = g_type_info_get_array_fixed_size (type_info); - if (fixed_size >= 0 && length != fixed_size) { - PyErr_Format (PyExc_ValueError, "Must contain %zd items, not %zd", - fixed_size, length); - retval = 0; - break; - } - - item_type_info = g_type_info_get_param_type (type_info, 0); - g_assert (item_type_info != NULL); - - /* FIXME: This is insain. We really should only check the first - * object and perhaps have a debugging mode. Large arrays - * will cause apps to slow to a crawl. - */ - for (i = 0; i < length; i++) { - PyObject *item; - - item = PySequence_GetItem (object, i); - if (item == NULL) { - retval = -1; - break; - } - - retval = _pygi_g_type_info_check_object (item_type_info, item, TRUE); - - Py_DECREF (item); - - if (retval < 0) { - break; - } - if (!retval) { - _PyGI_ERROR_PREFIX ("Item %zd: ", i); - break; - } - } - - g_base_info_unref ( (GIBaseInfo *) item_type_info); - - break; - } - case GI_TYPE_TAG_INTERFACE: - { - GIBaseInfo *info; - - info = g_type_info_get_interface (type_info); - g_assert (info != NULL); - - retval = _pygi_g_type_interface_check_object(info, object); - - g_base_info_unref (info); - break; - } - case GI_TYPE_TAG_GLIST: - case GI_TYPE_TAG_GSLIST: - { - Py_ssize_t length; - GITypeInfo *item_type_info; - Py_ssize_t i; - - if (!PySequence_Check (object)) { - PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", - object->ob_type->tp_name); - retval = 0; - break; - } - - length = PySequence_Length (object); - if (length < 0) { - retval = -1; - break; - } - - item_type_info = g_type_info_get_param_type (type_info, 0); - g_assert (item_type_info != NULL); - - for (i = 0; i < length; i++) { - PyObject *item; - - item = PySequence_GetItem (object, i); - if (item == NULL) { - retval = -1; - break; - } - - retval = _pygi_g_type_info_check_object (item_type_info, item, TRUE); - - Py_DECREF (item); - - if (retval < 0) { - break; - } - if (!retval) { - _PyGI_ERROR_PREFIX ("Item %zd: ", i); - break; - } - } - - g_base_info_unref ( (GIBaseInfo *) item_type_info); - break; - } - case GI_TYPE_TAG_GHASH: - { - Py_ssize_t length; - PyObject *keys; - PyObject *values; - GITypeInfo *key_type_info; - GITypeInfo *value_type_info; - Py_ssize_t i; - - keys = PyMapping_Keys (object); - if (keys == NULL) { - PyErr_Format (PyExc_TypeError, "Must be mapping, not %s", - object->ob_type->tp_name); - retval = 0; - break; - } - - length = PyMapping_Length (object); - if (length < 0) { - Py_DECREF (keys); - retval = -1; - break; - } - - values = PyMapping_Values (object); - if (values == NULL) { - retval = -1; - Py_DECREF (keys); - break; - } - - key_type_info = g_type_info_get_param_type (type_info, 0); - g_assert (key_type_info != NULL); - - value_type_info = g_type_info_get_param_type (type_info, 1); - g_assert (value_type_info != NULL); - - for (i = 0; i < length; i++) { - PyObject *key; - PyObject *value; - - key = PyList_GET_ITEM (keys, i); - value = PyList_GET_ITEM (values, i); - - retval = _pygi_g_type_info_check_object (key_type_info, key, TRUE); - if (retval < 0) { - break; - } - if (!retval) { - _PyGI_ERROR_PREFIX ("Key %zd :", i); - break; - } - - retval = _pygi_g_type_info_check_object (value_type_info, value, TRUE); - if (retval < 0) { - break; - } - if (!retval) { - _PyGI_ERROR_PREFIX ("Value %zd :", i); - break; - } - } - - g_base_info_unref ( (GIBaseInfo *) key_type_info); - g_base_info_unref ( (GIBaseInfo *) value_type_info); - Py_DECREF (values); - Py_DECREF (keys); - break; - } - case GI_TYPE_TAG_ERROR: - PyErr_SetString (PyExc_NotImplementedError, "Error marshalling is not supported yet"); - /* TODO */ - break; + GIArgInfo length_arg_info; + GITypeInfo length_type_info; + GIArgument length_arg; + gssize array_len = -1; + GValue *values = (GValue *)user_data1; + GICallableInfo *callable_info = (GICallableInfo *)user_data2; + + g_callable_info_load_arg (callable_info, (gint)length_arg_index, &length_arg_info); + g_arg_info_load_type (&length_arg_info, &length_type_info); + + length_arg = _pygi_argument_from_g_value (&(values[length_arg_index]), + &length_type_info); + if (!pygi_argument_to_gssize (&length_arg, + g_type_info_get_tag (&length_type_info), + &array_len)) { + return -1; } - return retval; + return array_len; } /** * _pygi_argument_to_array * @arg: The argument to convert - * @args: Arguments to method invocation, possibly contaning the array length. - * Set to %NULL if this is not for a method call or @args_values is - * specified. - * @args_values: GValue Arguments to method invocation, possibly contaning the - * array length. Set to %NULL if this is not for a method call or - * @args is specified. - * @callable_info: Info on the callable, if this a method call; otherwise %NULL + * @array_length_policy: Closure for marshalling the array length argument when needed. + * @user_data1: Generic user data passed to the array_length_policy. + * @user_data2: Generic user data passed to the array_length_policy. * @type_info: The type info for @arg * @out_free_array: A return location for a gboolean that indicates whether * or not the wrapped GArray should be freed @@ -784,9 +241,9 @@ check_number_release: */ GArray * _pygi_argument_to_array (GIArgument *arg, - GIArgument *args[], - const GValue *args_values, - GICallableInfo *callable_info, + PyGIArgArrayLengthPolicy array_length_policy, + void *user_data1, + void *user_data2, GITypeInfo *type_info, gboolean *out_free_array) { @@ -812,52 +269,46 @@ _pygi_argument_to_array (GIArgument *arg, g_base_info_unref ( (GIBaseInfo *) item_type_info); if (is_zero_terminated) { - length = g_strv_length (arg->v_pointer); + if (item_size == sizeof(gpointer)) + length = g_strv_length ((gchar **)arg->v_pointer); + else if (item_size == 1) + length = strlen ((gchar*)arg->v_pointer); + else if (item_size == sizeof(int)) + for (length = 0; *(((int*)arg->v_pointer) + length); length++); + else if (item_size == sizeof(short)) + for (length = 0; *(((short*)arg->v_pointer) + length); length++); + else + g_assert_not_reached (); } else { length = g_type_info_get_array_fixed_size (type_info); if (length < 0) { gint length_arg_pos; - GIArgInfo length_arg_info; - GITypeInfo length_type_info; - if (G_UNLIKELY (args == NULL && args_values == NULL)) { + if (G_UNLIKELY (array_length_policy == NULL)) { g_critical ("Unable to determine array length for %p", arg->v_pointer); - g_array = g_array_new (is_zero_terminated, FALSE, item_size); + g_array = g_array_new (is_zero_terminated, FALSE, (guint)item_size); *out_free_array = TRUE; return g_array; } length_arg_pos = g_type_info_get_array_length (type_info); g_assert (length_arg_pos >= 0); - g_assert (callable_info); - g_callable_info_load_arg (callable_info, length_arg_pos, &length_arg_info); - g_arg_info_load_type (&length_arg_info, &length_type_info); - - if (args != NULL) { - if (!gi_argument_to_gssize (args[length_arg_pos], - g_type_info_get_tag (&length_type_info), - &length)) - return NULL; - } else { - /* get it from args_values */ - GIArgument length_arg = _pygi_argument_from_g_value (&(args_values[length_arg_pos]), - &length_type_info); - if (!gi_argument_to_gssize (&length_arg, - g_type_info_get_tag (&length_type_info), - &length)) - return NULL; + + length = array_length_policy (length_arg_pos, user_data1, user_data2); + if (length < 0) { + return NULL; } } } g_assert (length >= 0); - g_array = g_array_new (is_zero_terminated, FALSE, item_size); + g_array = g_array_new (is_zero_terminated, FALSE, (guint)item_size); g_free (g_array->data); g_array->data = arg->v_pointer; - g_array->len = length; + g_array->len = (guint)length; *out_free_array = TRUE; break; case GI_ARRAY_TYPE_ARRAY: @@ -894,25 +345,21 @@ _pygi_argument_from_object (PyObject *object, { GIArgument arg; GITypeTag type_tag; + gpointer cleanup_data = NULL; memset(&arg, 0, sizeof(GIArgument)); type_tag = g_type_info_get_tag (type_info); - if (_pygi_marshal_from_py_basic_type (object, &arg, type_tag, transfer) || - PyErr_Occurred()) { - return arg; - } - switch (type_tag) { case GI_TYPE_TAG_ARRAY: { - Py_ssize_t length; + Py_ssize_t py_length; + guint length, i; gboolean is_zero_terminated; GITypeInfo *item_type_info; gsize item_size; GArray *array; GITransfer item_transfer; - Py_ssize_t i; if (object == Py_None) { arg.v_pointer = NULL; @@ -921,18 +368,17 @@ _pygi_argument_from_object (PyObject *object, /* Note, strings are sequences, but we cannot accept them here */ if (!PySequence_Check (object) || -#if PY_VERSION_HEX < 0x03000000 - PyString_Check (object) || -#endif PyUnicode_Check (object)) { PyErr_SetString (PyExc_TypeError, "expected sequence"); break; } - length = PySequence_Length (object); - if (length < 0) { + py_length = PySequence_Length (object); + if (py_length < 0) + break; + + if (!pygi_guint_from_pyssize (py_length, &length)) break; - } is_zero_terminated = g_type_info_is_zero_terminated (type_info); item_type_info = g_type_info_get_param_type (type_info, 0); @@ -943,7 +389,7 @@ _pygi_argument_from_object (PyObject *object, else item_size = sizeof (GIArgument); - array = g_array_sized_new (is_zero_terminated, FALSE, item_size, length); + array = g_array_sized_new (is_zero_terminated, FALSE, (guint)item_size, length); if (array == NULL) { g_base_info_unref ( (GIBaseInfo *) item_type_info); PyErr_NoMemory(); @@ -951,9 +397,9 @@ _pygi_argument_from_object (PyObject *object, } if (g_type_info_get_tag (item_type_info) == GI_TYPE_TAG_UINT8 && - PYGLIB_PyBytes_Check(object)) { + PyBytes_Check (object)) { - memcpy(array->data, PYGLIB_PyBytes_AsString(object), length); + memcpy(array->data, PyBytes_AsString (object), length); array->len = length; goto array_success; } @@ -987,7 +433,7 @@ array_item_error: GI_TRANSFER_NOTHING, GI_DIRECTION_IN); array = NULL; - _PyGI_ERROR_PREFIX ("Item %zd: ", i); + _PyGI_ERROR_PREFIX ("Item %u: ", i); break; } @@ -1016,9 +462,11 @@ array_success: { GType g_type; PyObject *py_type; + gboolean is_foreign = (info_type == GI_INFO_TYPE_STRUCT) && + (g_struct_info_is_foreign ((GIStructInfo *) info)); g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); - py_type = _pygi_type_import_by_gi_info ( (GIBaseInfo *) info); + py_type = pygi_type_import_by_gi_info ( (GIBaseInfo *) info); /* Note for G_TYPE_VALUE g_type: * This will currently leak the GValue that is allocated and @@ -1027,40 +475,44 @@ array_success: * Further re-factoring is needed to fix this leak. * See: https://bugzilla.gnome.org/show_bug.cgi?id=693405 */ - _pygi_marshal_from_py_interface_struct (object, - &arg, - NULL, /*arg_name*/ - info, /*interface_info*/ - type_info, - g_type, - py_type, - transfer, - FALSE, /*copy_reference*/ - g_struct_info_is_foreign (info)); + pygi_arg_struct_from_py_marshal (object, + &arg, + NULL, /*arg_name*/ + info, /*interface_info*/ + g_type, + py_type, + transfer, + FALSE, /*copy_reference*/ + is_foreign, + g_type_info_is_pointer (type_info)); Py_DECREF (py_type); break; } case GI_INFO_TYPE_ENUM: - case GI_INFO_TYPE_FLAGS: { - PyObject *int_; + GType g_type; - int_ = PYGLIB_PyNumber_Long (object); - if (int_ == NULL) { + g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); + if (pyg_enum_get_value(g_type, object, &arg.v_int) < 0) break; - } - arg.v_int = PYGLIB_PyLong_AsLong (int_); + break; + } + case GI_INFO_TYPE_FLAGS: + { + GType g_type; - Py_DECREF (int_); + g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); + if (pyg_flags_get_value(g_type, object, &arg.v_uint) < 0) + break; break; } case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_OBJECT: /* An error within this call will result in a NULL arg */ - _pygi_marshal_from_py_gobject_out_arg (object, &arg, transfer); + pygi_arg_gobject_out_arg_from_py (object, &arg, transfer); break; default: @@ -1218,7 +670,7 @@ list_item_error: } g_hash_table_insert (hash_table, key.v_pointer, - _pygi_arg_to_hash_pointer (&value, g_type_info_get_tag (value_type_info))); + _pygi_arg_to_hash_pointer (&value, value_type_info)); continue; hash_table_item_error: @@ -1245,7 +697,9 @@ hash_table_release: /* TODO */ break; default: - g_assert_not_reached (); + /* Ignores cleanup data for now. */ + pygi_marshal_from_py_basic_type (object, &arg, type_tag, transfer, &cleanup_data); + break; } return arg; @@ -1272,9 +726,6 @@ _pygi_argument_to_object (GIArgument *arg, PyObject *object = NULL; type_tag = g_type_info_get_tag (type_info); - object = _pygi_marshal_to_py_basic_type (arg, type_tag, transfer); - if (object) - return object; switch (type_tag) { case GI_TYPE_TAG_VOID: @@ -1314,7 +765,7 @@ _pygi_argument_to_object (GIArgument *arg, if (item_type_tag == GI_TYPE_TAG_UINT8) { /* Return as a byte array */ - object = PYGLIB_PyBytes_FromStringAndSize (array->data, array->len); + object = PyBytes_FromStringAndSize (array->data, array->len); } else { object = PyList_New (array->len); if (object == NULL) { @@ -1362,21 +813,23 @@ _pygi_argument_to_object (GIArgument *arg, { PyObject *py_type; GType g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); + gboolean is_foreign = (info_type == GI_INFO_TYPE_STRUCT) && + (g_struct_info_is_foreign ((GIStructInfo *) info)); /* Special case variant and none to force loading from py module. */ if (g_type == G_TYPE_VARIANT || g_type == G_TYPE_NONE) { - py_type = _pygi_type_import_by_gi_info (info); + py_type = pygi_type_import_by_gi_info (info); } else { - py_type = _pygi_type_get_from_g_type (g_type); + py_type = pygi_type_get_from_g_type (g_type); } - object = _pygi_marshal_to_py_interface_struct (arg, - info, /*interface_info*/ - g_type, - py_type, - transfer, - FALSE, /*is_allocated*/ - g_struct_info_is_foreign (info)); + object = pygi_arg_struct_to_py_marshal (arg, + info, /*interface_info*/ + g_type, + py_type, + transfer, + FALSE, /*is_allocated*/ + is_foreign); Py_XDECREF (py_type); break; @@ -1390,14 +843,14 @@ _pygi_argument_to_object (GIArgument *arg, if (type == G_TYPE_NONE) { /* An enum with a GType of None is an enum without GType */ - PyObject *py_type = _pygi_type_import_by_gi_info (info); + PyObject *py_type = pygi_type_import_by_gi_info (info); PyObject *py_args = NULL; if (!py_type) return NULL; py_args = PyTuple_New (1); - if (PyTuple_SetItem (py_args, 0, PyLong_FromLong (arg->v_int)) != 0) { + if (PyTuple_SetItem (py_args, 0, pygi_gint_to_py (arg->v_int)) != 0) { Py_DECREF (py_args); Py_DECREF (py_type); return NULL; @@ -1418,26 +871,7 @@ _pygi_argument_to_object (GIArgument *arg, } case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_OBJECT: - /* HACK: - * The following hack is to work around GTK+ sending signals which - * contain floating widgets in them. This assumes control of how - * references are added by the PyGObject wrapper and avoids the sink - * behavior by explicitly passing GI_TRANSFER_EVERYTHING as the transfer - * mode and then re-forcing the object as floating afterwards. - * - * This can be deleted once the following ticket is fixed: - * https://bugzilla.gnome.org/show_bug.cgi?id=693400 - */ - if (arg->v_pointer && - !G_IS_PARAM_SPEC (arg->v_pointer) && - transfer == GI_TRANSFER_NOTHING && - g_object_is_floating (arg->v_pointer)) { - g_object_ref (arg->v_pointer); - object = _pygi_marshal_to_py_object (arg, GI_TRANSFER_EVERYTHING); - g_object_force_floating (arg->v_pointer); - } else { - object = _pygi_marshal_to_py_object (arg, transfer); - } + object = pygi_arg_gobject_to_py_called_from_c (arg, transfer); break; default: @@ -1529,7 +963,7 @@ _pygi_argument_to_object (GIArgument *arg, break; } - _pygi_hash_pointer_to_arg (&value, g_type_info_get_tag (value_type_info)); + _pygi_hash_pointer_to_arg (&value, value_type_info); py_value = _pygi_argument_to_object (&value, value_type_info, item_transfer); if (py_value == NULL) { Py_DECREF (py_key); @@ -1556,12 +990,12 @@ _pygi_argument_to_object (GIArgument *arg, GError *error = (GError *) arg->v_pointer; if (error != NULL && transfer == GI_TRANSFER_NOTHING) { /* If we have not been transferred the ownership we must copy - * the error, because pyglib_error_check() is going to free it. + * the error, because pygi_error_check() is going to free it. */ error = g_error_copy (error); } - if (pyglib_error_check (&error)) { + if (pygi_error_check (&error)) { PyObject *err_type; PyObject *err_value; PyObject *err_trace; @@ -1578,138 +1012,13 @@ _pygi_argument_to_object (GIArgument *arg, } default: { - g_assert_not_reached(); + object = pygi_marshal_to_py_basic_type (arg, type_tag, transfer); } } return object; } - -GIArgument -_pygi_argument_from_g_value(const GValue *value, - GITypeInfo *type_info) -{ - GIArgument arg = { 0, }; - - GITypeTag type_tag = g_type_info_get_tag (type_info); - - /* For the long handling: long can be equivalent to - int32 or int64, depending on the architecture, but - gi doesn't tell us (and same for ulong) - */ - switch (type_tag) { - case GI_TYPE_TAG_BOOLEAN: - arg.v_boolean = g_value_get_boolean (value); - break; - case GI_TYPE_TAG_INT8: - case GI_TYPE_TAG_INT16: - case GI_TYPE_TAG_INT32: - if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_LONG)) - arg.v_int = g_value_get_long (value); - else - arg.v_int = g_value_get_int (value); - break; - case GI_TYPE_TAG_INT64: - if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_LONG)) - arg.v_int64 = g_value_get_long (value); - else - arg.v_int64 = g_value_get_int64 (value); - break; - case GI_TYPE_TAG_UINT8: - case GI_TYPE_TAG_UINT16: - case GI_TYPE_TAG_UINT32: - if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_ULONG)) - arg.v_uint = g_value_get_ulong (value); - else - arg.v_uint = g_value_get_uint (value); - break; - case GI_TYPE_TAG_UINT64: - if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_ULONG)) - arg.v_uint64 = g_value_get_ulong (value); - else - arg.v_uint64 = g_value_get_uint64 (value); - break; - case GI_TYPE_TAG_UNICHAR: - arg.v_uint32 = g_value_get_schar (value); - break; - case GI_TYPE_TAG_FLOAT: - arg.v_float = g_value_get_float (value); - break; - case GI_TYPE_TAG_DOUBLE: - arg.v_double = g_value_get_double (value); - break; - case GI_TYPE_TAG_GTYPE: - arg.v_long = g_value_get_gtype (value); - break; - case GI_TYPE_TAG_UTF8: - case GI_TYPE_TAG_FILENAME: - arg.v_string = g_value_dup_string (value); - break; - case GI_TYPE_TAG_GLIST: - case GI_TYPE_TAG_GSLIST: - arg.v_pointer = g_value_get_pointer (value); - break; - case GI_TYPE_TAG_ARRAY: - case GI_TYPE_TAG_GHASH: - if (G_VALUE_HOLDS_BOXED (value)) - arg.v_pointer = g_value_get_boxed (value); - else - /* e. g. GSettings::change-event */ - arg.v_pointer = g_value_get_pointer (value); - break; - case GI_TYPE_TAG_INTERFACE: - { - GIBaseInfo *info; - GIInfoType info_type; - - info = g_type_info_get_interface (type_info); - info_type = g_base_info_get_type (info); - - g_base_info_unref (info); - - switch (info_type) { - case GI_INFO_TYPE_FLAGS: - arg.v_uint = g_value_get_flags (value); - break; - case GI_INFO_TYPE_ENUM: - arg.v_int = g_value_get_enum (value); - break; - case GI_INFO_TYPE_INTERFACE: - case GI_INFO_TYPE_OBJECT: - if (G_VALUE_HOLDS_PARAM (value)) - arg.v_pointer = g_value_get_param (value); - else - arg.v_pointer = g_value_get_object (value); - break; - case GI_INFO_TYPE_BOXED: - case GI_INFO_TYPE_STRUCT: - case GI_INFO_TYPE_UNION: - if (G_VALUE_HOLDS(value, G_TYPE_BOXED)) { - arg.v_pointer = g_value_get_boxed (value); - } else if (G_VALUE_HOLDS(value, G_TYPE_VARIANT)) { - arg.v_pointer = g_value_get_variant (value); - } else { - arg.v_pointer = g_value_get_pointer (value); - } - break; - default: - g_warning("Converting of type '%s' is not implemented", g_info_type_to_string(info_type)); - g_assert_not_reached(); - } - break; - } - case GI_TYPE_TAG_ERROR: - arg.v_pointer = g_value_get_boxed (value); - break; - case GI_TYPE_TAG_VOID: - arg.v_pointer = g_value_get_pointer (value); - break; - } - - return arg; -} - void _pygi_argument_release (GIArgument *arg, GITypeInfo *type_info, @@ -1770,9 +1079,9 @@ _pygi_argument_release (GIArgument *arg, /* Free the items */ for (i = 0; i < array->len; i++) { - GIArgument *item; - item = &_g_array_index (array, GIArgument, i); - _pygi_argument_release (item, item_type_info, item_transfer, direction); + GIArgument item; + memcpy (&item, array->data + (g_array_get_element_size (array) * i), sizeof (GIArgument)); + _pygi_argument_release (&item, item_type_info, item_transfer, direction); } g_base_info_unref ( (GIBaseInfo *) item_type_info); @@ -1827,7 +1136,8 @@ _pygi_argument_release (GIArgument *arg, if (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING) { g_closure_unref (arg->v_pointer); } - } else if (g_struct_info_is_foreign ( (GIStructInfo*) info)) { + } else if (info_type == GI_INFO_TYPE_STRUCT && + g_struct_info_is_foreign ((GIStructInfo*) info)) { if (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_EVERYTHING) { pygi_struct_foreign_release (info, arg->v_pointer); } @@ -1972,13 +1282,8 @@ _pygi_argument_release (GIArgument *arg, g_slice_free (GError *, arg->v_pointer); break; } + default: + break; } } -void -_pygi_argument_init (void) -{ - PyDateTime_IMPORT; - _pygobject_import(); -} - diff --git a/gi/pygi-argument.h b/gi/pygi-argument.h index ed88214..2e889dd 100644 --- a/gi/pygi-argument.h +++ b/gi/pygi-argument.h @@ -14,9 +14,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_ARGUMENT_H__ @@ -30,28 +28,24 @@ G_BEGIN_DECLS /* Private */ -gpointer _pygi_arg_to_hash_pointer (const GIArgument *arg, - GITypeTag type_tag); - -void _pygi_hash_pointer_to_arg (GIArgument *arg, - GITypeTag type_tag); - -gint _pygi_g_type_interface_check_object (GIBaseInfo *info, - PyObject *object); +typedef gssize (*PyGIArgArrayLengthPolicy) (gsize item_index, + void *user_data1, + void *user_data2); -gint _pygi_g_type_info_check_object (GITypeInfo *type_info, - PyObject *object, - gboolean allow_none); +gssize _pygi_argument_array_length_marshal (gsize length_arg_index, + void *user_data1, + void *user_data2); -gint _pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info, - gboolean is_instance, - PyObject *object); +gpointer _pygi_arg_to_hash_pointer (const GIArgument *arg, + GITypeInfo *type_info); +void _pygi_hash_pointer_to_arg (GIArgument *arg, + GITypeInfo *type_info); GArray* _pygi_argument_to_array (GIArgument *arg, - GIArgument *args[], - const GValue *args_values, - GICallableInfo *callable_info, + PyGIArgArrayLengthPolicy array_length_policy, + void *user_data1, + void *user_data2, GITypeInfo *type_info, gboolean *out_free_array); @@ -63,15 +57,14 @@ PyObject* _pygi_argument_to_object (GIArgument *arg, GITypeInfo *type_info, GITransfer transfer); -GIArgument _pygi_argument_from_g_value(const GValue *value, - GITypeInfo *type_info); - void _pygi_argument_release (GIArgument *arg, GITypeInfo *type_info, GITransfer transfer, GIDirection direction); -void _pygi_argument_init (void); +gboolean pygi_argument_to_gssize (GIArgument *arg_in, + GITypeTag type_tag, + gssize *gssize_out); G_END_DECLS diff --git a/gi/pygi-array.c b/gi/pygi-array.c new file mode 100644 index 0000000..d5b817f --- /dev/null +++ b/gi/pygi-array.c @@ -0,0 +1,978 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include + +#include "pygi-array.h" +#include "pygi-info.h" +#include "pygi-marshal-cleanup.h" +#include "pygi-basictype.h" +#include "pygi-util.h" + +/* Needed for _pygi_marshal_cleanup_from_py_interface_struct_gvalue hack */ +#include "pygi-struct-marshal.h" + +/* + * GArray to Python + */ + +static gboolean +gi_argument_from_py_ssize_t (GIArgument *arg_out, + Py_ssize_t size_in, + GITypeTag type_tag) +{ + switch (type_tag) { + case GI_TYPE_TAG_VOID: + case GI_TYPE_TAG_BOOLEAN: + goto unhandled_type; + + case GI_TYPE_TAG_INT8: + if (size_in >= G_MININT8 && size_in <= G_MAXINT8) { + arg_out->v_int8 = (gint8)size_in; + return TRUE; + } else { + goto overflow; + } + + case GI_TYPE_TAG_UINT8: + if (size_in >= 0 && size_in <= G_MAXUINT8) { + arg_out->v_uint8 = (guint8)size_in; + return TRUE; + } else { + goto overflow; + } + + case GI_TYPE_TAG_INT16: + if (size_in >= G_MININT16 && size_in <= G_MAXINT16) { + arg_out->v_int16 = (gint16)size_in; + return TRUE; + } else { + goto overflow; + } + + case GI_TYPE_TAG_UINT16: + if (size_in >= 0 && size_in <= G_MAXUINT16) { + arg_out->v_uint16 = (guint16)size_in; + return TRUE; + } else { + goto overflow; + } + + /* Ranges assume two's complement */ + case GI_TYPE_TAG_INT32: + if (size_in >= G_MININT32 && size_in <= G_MAXINT32) { + arg_out->v_int32 = (gint32)size_in; + return TRUE; + } else { + goto overflow; + } + + case GI_TYPE_TAG_UINT32: + if (size_in >= 0 && (gsize)size_in <= G_MAXUINT32) { + arg_out->v_uint32 = (guint32)size_in; + return TRUE; + } else { + goto overflow; + } + + case GI_TYPE_TAG_INT64: + arg_out->v_int64 = size_in; + return TRUE; + + case GI_TYPE_TAG_UINT64: + if (size_in >= 0) { + arg_out->v_uint64 = size_in; + return TRUE; + } else { + goto overflow; + } + + case GI_TYPE_TAG_FLOAT: + case GI_TYPE_TAG_DOUBLE: + case GI_TYPE_TAG_GTYPE: + case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: + case GI_TYPE_TAG_ARRAY: + case GI_TYPE_TAG_INTERFACE: + case GI_TYPE_TAG_GLIST: + case GI_TYPE_TAG_GSLIST: + case GI_TYPE_TAG_GHASH: + case GI_TYPE_TAG_ERROR: + case GI_TYPE_TAG_UNICHAR: + default: + goto unhandled_type; + } + + overflow: + PyErr_Format (PyExc_OverflowError, + "Unable to marshal C Py_ssize_t %zd to %s", + size_in, + g_type_tag_to_string (type_tag)); + return FALSE; + + unhandled_type: + PyErr_Format (PyExc_TypeError, + "Unable to marshal C Py_ssize_t %zd to %s", + size_in, + g_type_tag_to_string (type_tag)); + return FALSE; +} + +static gboolean +gi_argument_to_gsize (GIArgument *arg_in, + gsize *gsize_out, + GITypeTag type_tag) +{ + switch (type_tag) { + case GI_TYPE_TAG_INT8: + *gsize_out = arg_in->v_int8; + return TRUE; + case GI_TYPE_TAG_UINT8: + *gsize_out = arg_in->v_uint8; + return TRUE; + case GI_TYPE_TAG_INT16: + *gsize_out = arg_in->v_int16; + return TRUE; + case GI_TYPE_TAG_UINT16: + *gsize_out = arg_in->v_uint16; + return TRUE; + case GI_TYPE_TAG_INT32: + *gsize_out = arg_in->v_int32; + return TRUE; + case GI_TYPE_TAG_UINT32: + *gsize_out = arg_in->v_uint32; + return TRUE; + case GI_TYPE_TAG_INT64: + if (arg_in->v_uint64 > G_MAXSIZE) { + PyErr_Format (PyExc_TypeError, + "Unable to marshal %s to gsize", + g_type_tag_to_string (type_tag)); + return FALSE; + } + *gsize_out = (gsize)arg_in->v_int64; + return TRUE; + case GI_TYPE_TAG_UINT64: + if (arg_in->v_uint64 > G_MAXSIZE) { + PyErr_Format (PyExc_TypeError, + "Unable to marshal %s to gsize", + g_type_tag_to_string (type_tag)); + return FALSE; + } + *gsize_out = (gsize)arg_in->v_uint64; + return TRUE; + default: + PyErr_Format (PyExc_TypeError, + "Unable to marshal %s to gsize", + g_type_tag_to_string (type_tag)); + return FALSE; + } +} + +static gboolean +_pygi_marshal_from_py_array (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyGIMarshalFromPyFunc from_py_marshaller; + guint i = 0; + gsize success_count = 0; + Py_ssize_t py_length; + guint length; + guint item_size; + gboolean is_ptr_array; + GArray *array_ = NULL; + PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; + PyGIArgGArray *array_cache = (PyGIArgGArray *)arg_cache; + GITransfer cleanup_transfer = arg_cache->transfer; + + + if (py_arg == Py_None) { + arg->v_pointer = NULL; + return TRUE; + } + + if (!PySequence_Check (py_arg)) { + PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + py_length = PySequence_Length (py_arg); + if (py_length < 0) + return FALSE; + + if (!pygi_guint_from_pyssize (py_length, &length)) + return FALSE; + + if (array_cache->fixed_size >= 0 && + (guint)array_cache->fixed_size != length) { + PyErr_Format (PyExc_ValueError, "Must contain %zd items, not %u", + array_cache->fixed_size, length); + + return FALSE; + } + + item_size = (guint)array_cache->item_size; + is_ptr_array = (array_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY); + if (is_ptr_array) { + array_ = (GArray *)g_ptr_array_sized_new (length); + } else { + array_ = g_array_sized_new (array_cache->is_zero_terminated, + TRUE, + item_size, + length); + } + + if (array_ == NULL) { + PyErr_NoMemory (); + return FALSE; + } + + if (sequence_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8 && + PyBytes_Check (py_arg)) { + gchar *data = PyBytes_AsString (py_arg); + + /* Avoid making a copy if the data + * is not transferred to the C function + * and cannot not be modified by it. + */ + if (array_cache->array_type == GI_ARRAY_TYPE_C && + arg_cache->transfer == GI_TRANSFER_NOTHING && + !array_cache->is_zero_terminated) { + g_free (array_->data); + array_->data = data; + cleanup_transfer = GI_TRANSFER_EVERYTHING; + } else { + memcpy (array_->data, data, length); + } + array_->len = length; + if (array_cache->is_zero_terminated) { + /* If array_ has been created with zero_termination, space for the + * terminator is properly allocated, so we're not off-by-one here. */ + array_->data[length] = '\0'; + } + goto array_success; + } + + from_py_marshaller = sequence_cache->item_cache->from_py_marshaller; + for (i = 0, success_count = 0; i < length; i++) { + GIArgument item = {0}; + gpointer item_cleanup_data = NULL; + PyObject *py_item = PySequence_GetItem (py_arg, i); + if (py_item == NULL) + goto err; + + if (!from_py_marshaller ( state, + callable_cache, + sequence_cache->item_cache, + py_item, + &item, + &item_cleanup_data)) { + Py_DECREF (py_item); + goto err; + } + Py_DECREF (py_item); + + if (item_cleanup_data != NULL && item_cleanup_data != item.v_pointer) { + /* We only support one level of data discrepancy between an items + * data and its cleanup data. This is because we only track a single + * extra cleanup data pointer per-argument and cannot track the entire + * array of items differing data and cleanup_data. + * For example, this would fail if trying to marshal an array of + * callback closures marked with SCOPE call type where the cleanup data + * is different from the items v_pointer, likewise an array of arrays. + */ + PyErr_SetString(PyExc_RuntimeError, "Cannot cleanup item data for array due to " + "the items data its cleanup data being different."); + goto err; + } + + /* FIXME: it is much more efficent to have seperate marshaller + * for ptr arrays than doing the evaluation + * and casting each loop iteration + */ + if (is_ptr_array) { + g_ptr_array_add((GPtrArray *)array_, item.v_pointer); + } else if (sequence_cache->item_cache->is_pointer) { + /* if the item is a pointer, simply copy the pointer */ + g_assert (item_size == sizeof (item.v_pointer)); + g_array_insert_val (array_, i, item); + } else if (sequence_cache->item_cache->type_tag == GI_TYPE_TAG_INTERFACE) { + /* Special case handling of flat arrays of gvalue/boxed/struct */ + PyGIInterfaceCache *item_iface_cache = (PyGIInterfaceCache *) sequence_cache->item_cache; + GIBaseInfo *base_info = (GIBaseInfo *) item_iface_cache->interface_info; + GIInfoType info_type = g_base_info_get_type (base_info); + + switch (info_type) { + case GI_INFO_TYPE_UNION: + case GI_INFO_TYPE_STRUCT: + { + PyGIArgCache *item_arg_cache = (PyGIArgCache *)item_iface_cache; + PyGIMarshalCleanupFunc from_py_cleanup = item_arg_cache->from_py_cleanup; + + if (g_type_is_a (item_iface_cache->g_type, G_TYPE_VALUE)) { + /* Special case GValue flat arrays to properly init and copy the contents. */ + GValue* dest = (GValue*)(void*)(array_->data + (i * item_size)); + if (item.v_pointer != NULL) { + memset (dest, 0, item_size); + g_value_init (dest, G_VALUE_TYPE ((GValue*) item.v_pointer)); + g_value_copy ((GValue*) item.v_pointer, dest); + } + /* Manually increment the length because we are manually setting the memory. */ + array_->len++; + + } else { + /* Handles flat arrays of boxed or struct types. */ + g_array_insert_vals (array_, i, item.v_pointer, 1); + } + + /* Cleanup any memory left by the per-item marshaler because + * _pygi_marshal_cleanup_from_py_array will not know about this + * due to "item" being a temporarily marshaled value done on the stack. + */ + if (from_py_cleanup) + from_py_cleanup (state, item_arg_cache, py_item, item_cleanup_data, TRUE); + + break; + } + default: + g_array_insert_val (array_, i, item); + } + } else { + /* default value copy of a simple type */ + g_array_insert_val (array_, i, item); + } + + success_count++; + } + goto array_success; + +err: + if (sequence_cache->item_cache->from_py_cleanup != NULL) { + gsize j; + PyGIMarshalCleanupFunc cleanup_func = + sequence_cache->item_cache->from_py_cleanup; + + /* Only attempt per item cleanup on pointer items */ + if (sequence_cache->item_cache->is_pointer) { + for(j = 0; j < success_count; j++) { + PyObject *py_seq_item = PySequence_GetItem (py_arg, j); + cleanup_func (state, + sequence_cache->item_cache, + py_seq_item, + is_ptr_array ? + g_ptr_array_index ((GPtrArray *)array_, j) : + g_array_index (array_, gpointer, j), + TRUE); + Py_DECREF (py_seq_item); + } + } + } + + if (is_ptr_array) + g_ptr_array_free ( ( GPtrArray *)array_, TRUE); + else + g_array_free (array_, TRUE); + _PyGI_ERROR_PREFIX ("Item %u: ", i); + return FALSE; + +array_success: + if (array_cache->len_arg_index >= 0) { + /* we have an child arg to handle */ + PyGIArgCache *child_cache = + _pygi_callable_cache_get_arg (callable_cache, (guint)array_cache->len_arg_index); + + if (!gi_argument_from_py_ssize_t (&state->args[child_cache->c_arg_index].arg_value, + length, + child_cache->type_tag)) { + goto err; + } + } + + if (array_cache->array_type == GI_ARRAY_TYPE_C) { + /* In the case of GI_ARRAY_C, we give the data directly as the argument + * but keep the array_ wrapper as cleanup data so we don't have to find + * it's length again. + */ + arg->v_pointer = array_->data; + + if (cleanup_transfer == GI_TRANSFER_EVERYTHING) { + g_array_free (array_, FALSE); + *cleanup_data = NULL; + } else { + *cleanup_data = array_; + } + } else { + arg->v_pointer = array_; + + if (cleanup_transfer == GI_TRANSFER_NOTHING) { + /* Free everything in cleanup. */ + *cleanup_data = array_; + } else if (cleanup_transfer == GI_TRANSFER_CONTAINER) { + /* Make a shallow copy so we can free the elements later in cleanup + * because it is possible invoke will free the list before our cleanup. */ + *cleanup_data = is_ptr_array ? + (gpointer)g_ptr_array_ref ((GPtrArray *)array_) : + (gpointer)g_array_ref (array_); + } else { /* GI_TRANSFER_EVERYTHING */ + /* No cleanup, everything is given to the callee. */ + *cleanup_data = NULL; + } + } + + return TRUE; +} + +static void +_pygi_marshal_cleanup_from_py_array (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + if (was_processed) { + GArray *array_ = NULL; + GPtrArray *ptr_array_ = NULL; + PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; + PyGIArgGArray *array_cache = (PyGIArgGArray *)arg_cache; + + if (array_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) { + ptr_array_ = (GPtrArray *) data; + } else { + array_ = (GArray *) data; + } + + /* clean up items first */ + if (sequence_cache->item_cache->from_py_cleanup != NULL) { + gsize i; + guint len; + PyGIMarshalCleanupFunc cleanup_func = + sequence_cache->item_cache->from_py_cleanup; + + g_assert (array_ || ptr_array_); + len = (array_ != NULL) ? array_->len : ptr_array_->len; + + for (i = 0; i < len; i++) { + gpointer item; + PyObject *py_item = NULL; + + /* case 1: GPtrArray */ + if (ptr_array_ != NULL) + item = g_ptr_array_index (ptr_array_, i); + /* case 2: C array or GArray with object pointers */ + else if (sequence_cache->item_cache->is_pointer) + item = g_array_index (array_, gpointer, i); + /* case 3: C array or GArray with simple types or structs */ + else { + item = array_->data + i * array_cache->item_size; + /* special-case hack: GValue array items do not get slice + * allocated in _pygi_marshal_from_py_array(), so we must + * not try to deallocate it as a slice and thus + * short-circuit cleanup_func. */ + if (cleanup_func == pygi_arg_gvalue_from_py_cleanup) { + g_value_unset ((GValue*) item); + continue; + } + } + + py_item = PySequence_GetItem (py_arg, i); + cleanup_func (state, sequence_cache->item_cache, py_item, item, TRUE); + Py_XDECREF (py_item); + } + } + + /* Only free the array when we didn't transfer ownership */ + if (array_cache->array_type == GI_ARRAY_TYPE_C) { + /* always free the GArray wrapper created in from_py marshaling and + * passed back as cleanup_data + */ + g_array_free (array_, arg_cache->transfer == GI_TRANSFER_NOTHING); + } else { + if (array_ != NULL) + g_array_unref (array_); + else + g_ptr_array_unref (ptr_array_); + } + } +} + +/* + * GArray from Python + */ +static PyObject * +_pygi_marshal_to_py_array (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + GArray *array_; + PyObject *py_obj = NULL; + PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; + PyGIArgGArray *array_cache = (PyGIArgGArray *)arg_cache; + guint processed_items = 0; + + /* GArrays make it easier to iterate over arrays + * with different element sizes but requires that + * we allocate a GArray if the argument was a C array + */ + if (array_cache->array_type == GI_ARRAY_TYPE_C) { + gsize len; + if (array_cache->fixed_size >= 0) { + g_assert(arg->v_pointer != NULL); + len = array_cache->fixed_size; + } else if (array_cache->is_zero_terminated) { + if (arg->v_pointer == NULL) { + len = 0; + } else if (array_cache->item_size == 1) { + len = strlen (arg->v_pointer); + } else if (array_cache->item_size == sizeof(gpointer)) { + len = g_strv_length ((gchar **)arg->v_pointer); + } else if (array_cache->item_size == sizeof(int)) { + for (len = 0; *(((int*)arg->v_pointer) + len); len++); + } else if (array_cache->item_size == sizeof(short)) { + for (len = 0; *(((short*)arg->v_pointer) + len); len++); + } else { + g_assert_not_reached (); + } + } else { + GIArgument *len_arg = &state->args[array_cache->len_arg_index].arg_value; + PyGIArgCache *sub_cache = _pygi_callable_cache_get_arg (callable_cache, + (guint)array_cache->len_arg_index); + + if (!gi_argument_to_gsize (len_arg, &len, sub_cache->type_tag)) { + return NULL; + } + } + + array_ = g_array_new (FALSE, + FALSE, + (guint)array_cache->item_size); + if (array_ == NULL) { + PyErr_NoMemory (); + + if (arg_cache->transfer == GI_TRANSFER_EVERYTHING && arg->v_pointer != NULL) + g_free (arg->v_pointer); + + return NULL; + } + + if (array_->data != NULL) + g_free (array_->data); + array_->data = arg->v_pointer; + array_->len = (guint)len; + } else { + array_ = arg->v_pointer; + } + + if (seq_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8) { + if (arg->v_pointer == NULL) { + py_obj = PyBytes_FromString (""); + } else { + py_obj = PyBytes_FromStringAndSize (array_->data, array_->len); + } + } else { + if (arg->v_pointer == NULL) { + py_obj = PyList_New (0); + } else { + guint i; + + gsize item_size; + PyGIMarshalToPyFunc item_to_py_marshaller; + PyGIArgCache *item_arg_cache; + GPtrArray *item_cleanups; + + py_obj = PyList_New (array_->len); + if (py_obj == NULL) + goto err; + + item_cleanups = g_ptr_array_sized_new (array_->len); + *cleanup_data = item_cleanups; + + item_arg_cache = seq_cache->item_cache; + item_to_py_marshaller = item_arg_cache->to_py_marshaller; + + item_size = g_array_get_element_size (array_); + + for (i = 0; i < array_->len; i++) { + GIArgument item_arg = {0}; + PyObject *py_item; + gpointer item_cleanup_data = NULL; + + /* If we are receiving an array of pointers, simply assign the pointer + * and move on, letting the per-item marshaler deal with the + * various transfer modes and ref counts (e.g. g_variant_ref_sink). + */ + if (array_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) { + item_arg.v_pointer = g_ptr_array_index ( ( GPtrArray *)array_, i); + + } else if (item_arg_cache->is_pointer) { + item_arg.v_pointer = g_array_index (array_, gpointer, i); + + } else if (item_arg_cache->type_tag == GI_TYPE_TAG_INTERFACE) { + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *) item_arg_cache; + + /* FIXME: This probably doesn't work with boxed types or gvalues. + * See fx. _pygi_marshal_from_py_array() */ + switch (g_base_info_get_type (iface_cache->interface_info)) { + case GI_INFO_TYPE_STRUCT: + if (arg_cache->transfer == GI_TRANSFER_EVERYTHING && + !g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) { + /* array elements are structs */ + gpointer *_struct = g_malloc (item_size); + memcpy (_struct, array_->data + i * item_size, + item_size); + item_arg.v_pointer = _struct; + } else { + item_arg.v_pointer = array_->data + i * item_size; + } + break; + case GI_INFO_TYPE_ENUM: + memcpy (&item_arg, array_->data + i * item_size, item_size); + break; + default: + item_arg.v_pointer = g_array_index (array_, gpointer, i); + break; + } + } else { + memcpy (&item_arg, array_->data + i * item_size, item_size); + } + + py_item = item_to_py_marshaller ( state, + callable_cache, + item_arg_cache, + &item_arg, + &item_cleanup_data); + + g_ptr_array_index (item_cleanups, i) = item_cleanup_data; + + if (py_item == NULL) { + Py_CLEAR (py_obj); + + if (array_cache->array_type == GI_ARRAY_TYPE_C) + g_array_unref (array_); + + g_ptr_array_unref (item_cleanups); + + goto err; + } + PyList_SET_ITEM (py_obj, i, py_item); + processed_items++; + } + } + } + + if (array_cache->array_type == GI_ARRAY_TYPE_C) + g_array_free (array_, FALSE); + + return py_obj; + +err: + if (array_cache->array_type == GI_ARRAY_TYPE_C) { + g_array_free (array_, arg_cache->transfer == GI_TRANSFER_EVERYTHING); + } else { + /* clean up unprocessed items */ + if (seq_cache->item_cache->to_py_cleanup != NULL) { + guint j; + PyGIMarshalToPyCleanupFunc cleanup_func = seq_cache->item_cache->to_py_cleanup; + for (j = processed_items; j < array_->len; j++) { + cleanup_func (state, + seq_cache->item_cache, + NULL, + g_array_index (array_, gpointer, j), + FALSE); + } + } + + if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) + g_array_free (array_, TRUE); + } + + return NULL; +} + +static GArray* +_wrap_c_array (PyGIInvokeState *state, + PyGIArgGArray *array_cache, + gpointer data) +{ + GArray *array_; + gsize len = 0; + + if (array_cache->fixed_size >= 0) { + len = array_cache->fixed_size; + } else if (array_cache->is_zero_terminated) { + if (array_cache->item_size == sizeof(gpointer)) + len = g_strv_length ((gchar **)data); + else if (array_cache->item_size == 1) + len = strlen ((gchar*)data); + else if (array_cache->item_size == sizeof(int)) + for (len = 0; *(((int*)data) + len); len++); + else if (array_cache->item_size == sizeof(short)) + for (len = 0; *(((short*)data) + len); len++); + else + g_assert_not_reached (); + } else if (array_cache->len_arg_index >= 0) { + GIArgument *len_arg = &state->args[array_cache->len_arg_index].arg_value; + len = len_arg->v_long; + } + + array_ = g_array_new (FALSE, + FALSE, + (guint)array_cache->item_size); + + if (array_ == NULL) + return NULL; + + g_free (array_->data); + array_->data = data; + array_->len = (guint)len; + + return array_; +} + +static void +_pygi_marshal_cleanup_to_py_array (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed) +{ + GArray *array_ = NULL; + GPtrArray *ptr_array_ = NULL; + PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; + PyGIArgGArray *array_cache = (PyGIArgGArray *)arg_cache; + gboolean free_array = FALSE; + gboolean free_array_full = TRUE; + + if (arg_cache->transfer == GI_TRANSFER_EVERYTHING || + arg_cache->transfer == GI_TRANSFER_CONTAINER) { + free_array = TRUE; + } + + /* If this isn't a garray create one to help process variable sized + array elements */ + if (array_cache->array_type == GI_ARRAY_TYPE_C) { + array_ = _wrap_c_array (state, array_cache, data); + + if (array_ == NULL) + return; + + free_array = TRUE; + free_array_full = arg_cache->transfer != GI_TRANSFER_NOTHING; + } else if (array_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) { + ptr_array_ = (GPtrArray *) data; + } else { + array_ = (GArray *) data; + } + + if (sequence_cache->item_cache->to_py_cleanup != NULL) { + GPtrArray *item_cleanups = (GPtrArray *) cleanup_data; + gsize i; + guint len; + PyGIMarshalToPyCleanupFunc cleanup_func = sequence_cache->item_cache->to_py_cleanup; + + g_assert (array_ || ptr_array_); + len = (array_ != NULL) ? array_->len : ptr_array_->len; + + for (i = 0; i < len; i++) { + cleanup_func (state, + sequence_cache->item_cache, + g_ptr_array_index(item_cleanups, i), + (array_ != NULL) ? g_array_index (array_, gpointer, i) : g_ptr_array_index (ptr_array_, i), + was_processed); + } + } + + if (cleanup_data) + g_ptr_array_unref ((GPtrArray *) cleanup_data); + + if (free_array) { + if (array_ != NULL) + g_array_free (array_, free_array_full); + else + g_ptr_array_free (ptr_array_, free_array_full); + } +} + +static void +_array_cache_free_func (PyGIArgGArray *cache) +{ + if (cache != NULL) { + pygi_arg_cache_free (((PyGISequenceCache *)cache)->item_cache); + g_slice_free (PyGIArgGArray, cache); + } +} + +PyGIArgCache* +pygi_arg_garray_len_arg_setup (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + PyGICallableCache *callable_cache, + PyGIDirection direction, + gssize arg_index, + gssize *py_arg_index) +{ + PyGIArgGArray *seq_cache = (PyGIArgGArray *)arg_cache; + + /* attempt len_arg_index setup for the first time */ + if (seq_cache->len_arg_index < 0) { + seq_cache->len_arg_index = g_type_info_get_array_length (type_info); + + /* offset by self arg for methods and vfuncs */ + if (seq_cache->len_arg_index >= 0 && callable_cache != NULL) { + seq_cache->len_arg_index += callable_cache->args_offset; + } + } + + if (seq_cache->len_arg_index >= 0) { + PyGIArgCache *child_cache = NULL; + + child_cache = _pygi_callable_cache_get_arg (callable_cache, + (guint)seq_cache->len_arg_index); + if (child_cache == NULL) { + child_cache = pygi_arg_cache_alloc (); + } else { + /* If the "length" arg cache already exists (the length comes before + * the array in the argument list), remove it from the to_py_args list + * because it does not belong in "to python" return tuple. The length + * will implicitly be a part of the returned Python list. + */ + if (direction & PYGI_DIRECTION_TO_PYTHON) { + callable_cache->to_py_args = + g_slist_remove (callable_cache->to_py_args, child_cache); + } + + /* This is a case where the arg cache already exists and has been + * setup by another array argument sharing the same length argument. + * See: gi_marshalling_tests_multi_array_key_value_in + */ + if (child_cache->meta_type == PYGI_META_ARG_TYPE_CHILD) + return child_cache; + } + + /* There is a length argument for this array, so increment the number + * of "to python" child arguments when applicable. + */ + if (direction & PYGI_DIRECTION_TO_PYTHON) + callable_cache->n_to_py_child_args++; + + child_cache->meta_type = PYGI_META_ARG_TYPE_CHILD; + child_cache->direction = direction; + child_cache->to_py_marshaller = pygi_marshal_to_py_basic_type_cache_adapter; + child_cache->from_py_marshaller = pygi_marshal_from_py_basic_type_cache_adapter; + child_cache->py_arg_index = -1; + + /* ugly edge case code: + * + * When the length comes before the array parameter we need to update + * indexes of arguments after the index argument. + */ + if (seq_cache->len_arg_index < arg_index && direction & PYGI_DIRECTION_FROM_PYTHON) { + guint i; + (*py_arg_index) -= 1; + callable_cache->n_py_args -= 1; + + for (i = (guint)seq_cache->len_arg_index + 1; + (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) { + PyGIArgCache *update_cache = _pygi_callable_cache_get_arg (callable_cache, i); + if (update_cache == NULL) + break; + + update_cache->py_arg_index -= 1; + } + } + + _pygi_callable_cache_set_arg (callable_cache, (guint)seq_cache->len_arg_index, child_cache); + return child_cache; + } + + return NULL; +} + +static gboolean +pygi_arg_garray_setup (PyGIArgGArray *sc, + GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) +{ + GITypeInfo *item_type_info; + PyGIArgCache *arg_cache = (PyGIArgCache *)sc; + + if (!pygi_arg_sequence_setup ((PyGISequenceCache *)sc, + type_info, + arg_info, + transfer, + direction, + callable_cache)) { + return FALSE; + } + + ((PyGIArgCache *)sc)->destroy_notify = (GDestroyNotify)_array_cache_free_func; + sc->array_type = g_type_info_get_array_type (type_info); + sc->is_zero_terminated = g_type_info_is_zero_terminated (type_info); + sc->fixed_size = g_type_info_get_array_fixed_size (type_info); + sc->len_arg_index = -1; /* setup by pygi_arg_garray_len_arg_setup */ + + item_type_info = g_type_info_get_param_type (type_info, 0); + sc->item_size = _pygi_g_type_info_size (item_type_info); + g_base_info_unref ( (GIBaseInfo *)item_type_info); + + if (direction & PYGI_DIRECTION_FROM_PYTHON) { + arg_cache->from_py_marshaller = _pygi_marshal_from_py_array; + arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_array; + } + + if (direction & PYGI_DIRECTION_TO_PYTHON) { + arg_cache->to_py_marshaller = _pygi_marshal_to_py_array; + arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_array; + } + + return TRUE; +} + +PyGIArgCache * +pygi_arg_garray_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) +{ + PyGIArgGArray *array_cache = g_slice_new0 (PyGIArgGArray); + if (array_cache == NULL) + return NULL; + + if (!pygi_arg_garray_setup (array_cache, + type_info, + arg_info, + transfer, + direction, + callable_cache)) { + pygi_arg_cache_free ( (PyGIArgCache *)array_cache); + return NULL; + } + + return (PyGIArgCache *)array_cache; +} diff --git a/gi/pygi-array.h b/gi/pygi-array.h new file mode 100644 index 0000000..718c7cd --- /dev/null +++ b/gi/pygi-array.h @@ -0,0 +1,43 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_ARRAY_H__ +#define __PYGI_ARRAY_H__ + +#include +#include "pygi-cache.h" + +G_BEGIN_DECLS + +PyGIArgCache *pygi_arg_garray_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache); + +PyGIArgCache *pygi_arg_garray_len_arg_setup (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + PyGICallableCache *callable_cache, + PyGIDirection direction, + gssize arg_index, + gssize *py_arg_index); + +G_END_DECLS + +#endif /*__PYGI_ARRAY_H__*/ diff --git a/gi/pygi-basictype.c b/gi/pygi-basictype.c new file mode 100644 index 0000000..82f8a85 --- /dev/null +++ b/gi/pygi-basictype.c @@ -0,0 +1,1338 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include + +#include "pygi-type.h" +#include "pygi-basictype.h" +#include "pygi-argument.h" +#include "pygi-util.h" + +#if defined(G_OS_WIN32) +#include +static gboolean +pygi_isfinite (gdouble value) { + return _finite (value); +} +#else +#include +static gboolean +pygi_isfinite (gdouble value) { + return isfinite (value); +} +#endif + +static gboolean +pygi_gpointer_from_py (PyObject *py_arg, gpointer *result) +{ + void* temp; + + if (py_arg == Py_None) { + *result = NULL; + return TRUE; + } else if (PyCapsule_CheckExact (py_arg)) { + temp = PyCapsule_GetPointer (py_arg, NULL); + if (temp == NULL) + return FALSE; + *result = temp; + return TRUE; + } else if (PyLong_Check(py_arg)) { + temp = PyLong_AsVoidPtr (py_arg); + if (PyErr_Occurred ()) + return FALSE; + *result = temp; + return TRUE; + } else { + PyErr_SetString(PyExc_ValueError, + "Pointer arguments are restricted to integers, capsules, and None. " + "See: https://bugzilla.gnome.org/show_bug.cgi?id=683599"); + return FALSE; + } +} + +static gboolean +marshal_from_py_void (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + g_warn_if_fail (arg_cache->transfer == GI_TRANSFER_NOTHING); + + if (pygi_gpointer_from_py (py_arg, &(arg->v_pointer))) { + *cleanup_data = arg->v_pointer; + return TRUE; + } + + return FALSE; +} + +PyObject * +pygi_gsize_to_py (gsize value) +{ + return PyLong_FromSize_t (value); +} + +PyObject * +pygi_gssize_to_py (gssize value) +{ + return PyLong_FromSsize_t (value); +} + +static PyObject * +base_float_checks (PyObject *object) +{ + if (!PyNumber_Check (object)) { + PyErr_Format (PyExc_TypeError, "Must be number, not %s", + Py_TYPE (object)->tp_name); + return NULL; + } + + return PyNumber_Float (object); +} + +gboolean +pygi_gdouble_from_py (PyObject *py_arg, gdouble *result) +{ + PyObject *py_float; + gdouble temp; + + py_float = base_float_checks (py_arg); + if (py_float == NULL) + return FALSE; + + temp = PyFloat_AsDouble (py_float); + Py_DECREF (py_float); + + if (PyErr_Occurred ()) + return FALSE; + + *result = temp; + + return TRUE; +} + +PyObject * +pygi_gdouble_to_py (gdouble value) +{ + return PyFloat_FromDouble (value); +} + +gboolean +pygi_gfloat_from_py (PyObject *py_arg, gfloat *result) +{ + gdouble double_; + PyObject *py_float; + + py_float = base_float_checks (py_arg); + if (py_float == NULL) + return FALSE; + + double_ = PyFloat_AsDouble (py_float); + if (PyErr_Occurred ()) { + Py_DECREF (py_float); + return FALSE; + } + + if (pygi_isfinite (double_) && (double_ < -G_MAXFLOAT || double_ > G_MAXFLOAT)) { + PyObject *min, *max; + + min = pygi_gfloat_to_py (-G_MAXFLOAT); + max = pygi_gfloat_to_py (G_MAXFLOAT); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %S to %S", + py_float, min, max); + Py_DECREF (min); + Py_DECREF (max); + Py_DECREF (py_float); + return FALSE; + } + + Py_DECREF (py_float); + *result = (gfloat)double_; + + return TRUE; +} + +PyObject * +pygi_gfloat_to_py (gfloat value) +{ + return PyFloat_FromDouble (value); +} + +gboolean +pygi_gunichar_from_py (PyObject *py_arg, gunichar *result) +{ + Py_ssize_t size; + gchar *string_; + + if (py_arg == Py_None) { + *result = 0; + return FALSE; + } + + if (PyUnicode_Check (py_arg)) { + PyObject *py_bytes; + + size = PyUnicode_GET_LENGTH (py_arg); + py_bytes = PyUnicode_AsUTF8String (py_arg); + if (!py_bytes) + return FALSE; + + string_ = g_strdup(PyBytes_AsString (py_bytes)); + Py_DECREF (py_bytes); + } else { + PyErr_Format (PyExc_TypeError, "Must be string, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + if (size != 1) { + PyErr_Format (PyExc_TypeError, "Must be a one character string, not %lld characters", + (long long) size); + g_free (string_); + return FALSE; + } + + *result = g_utf8_get_char (string_); + g_free (string_); + + return TRUE; +} + +static PyObject * +pygi_gunichar_to_py (gunichar value) +{ + PyObject *py_obj = NULL; + + /* Preserve the bidirectional mapping between 0 and "" */ + if (value == 0) { + py_obj = PyUnicode_FromString (""); + } else if (g_unichar_validate (value)) { + gchar utf8[6]; + gint bytes; + + bytes = g_unichar_to_utf8 (value, utf8); + py_obj = PyUnicode_FromStringAndSize ((char*)utf8, bytes); + } else { + /* TODO: Convert the error to an exception. */ + PyErr_Format (PyExc_TypeError, + "Invalid unicode codepoint %" G_GUINT32_FORMAT, + value); + } + + return py_obj; +} + +static gboolean +pygi_gtype_from_py (PyObject *py_arg, GType *type) +{ + GType temp = pyg_type_from_object (py_arg); + + if (temp == 0) { + if (!PyErr_Occurred ()) { + PyErr_SetString (PyExc_ValueError, "Invalid GType"); + return FALSE; + } + PyErr_Format (PyExc_TypeError, "Must be GObject.GType, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + *type = temp; + + return TRUE; +} + +gboolean +pygi_utf8_from_py (PyObject *py_arg, gchar **result) +{ + gchar *string_; + + if (py_arg == Py_None) { + *result = NULL; + return TRUE; + } + + if (PyUnicode_Check (py_arg)) { + PyObject *pystr_obj = PyUnicode_AsUTF8String (py_arg); + if (!pystr_obj) + return FALSE; + + string_ = g_strdup (PyBytes_AsString (pystr_obj)); + Py_DECREF (pystr_obj); + } + else { + PyErr_Format (PyExc_TypeError, "Must be string, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + *result = string_; + return TRUE; +} + +G_GNUC_UNUSED +static gboolean +filename_from_py_unix (PyObject *py_arg, gchar **result) +{ + gchar *filename; + + if (py_arg == Py_None) { + *result = NULL; + return TRUE; + } + + if (PyBytes_Check (py_arg)) { + char *buffer; + + if (PyBytes_AsStringAndSize (py_arg, &buffer, NULL) == -1) + return FALSE; + + filename = g_strdup (buffer); + } else if (PyUnicode_Check (py_arg)) { + PyObject *bytes; + char *buffer; + + bytes = PyUnicode_EncodeFSDefault (py_arg); + + if (!bytes) + return FALSE; + + if (PyBytes_AsStringAndSize (bytes, &buffer, NULL) == -1) { + Py_DECREF (bytes); + return FALSE; + } + + filename = g_strdup (buffer); + Py_DECREF (bytes); + } else { + PyErr_Format (PyExc_TypeError, "Must be bytes, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + *result = filename; + return TRUE; +} + +G_GNUC_UNUSED +static gboolean +filename_from_py_win32 (PyObject *py_arg, gchar **result) +{ + gchar *filename; + + if (py_arg == Py_None) { + *result = NULL; + return TRUE; + } + + if (PyBytes_Check (py_arg)) { + PyObject *uni_arg; + gboolean temp_result; + char *buffer; + + if (PyBytes_AsStringAndSize (py_arg, &buffer, NULL) == -1) + return FALSE; + + uni_arg = PyUnicode_DecodeFSDefault (buffer); + if (!uni_arg) + return FALSE; + temp_result = filename_from_py_win32 (uni_arg, result); + Py_DECREF (uni_arg); + return temp_result; + } else if (PyUnicode_Check (py_arg)) { + PyObject *bytes, *temp_uni; + char *buffer; + + /* The roundtrip merges lone surrogates, so we get the same output as + * with Py 2. Requires 3.4+ because of https://bugs.python.org/issue27971 + * Separated lone surrogates can occur when concatenating two paths. + */ + bytes = PyUnicode_AsEncodedString (py_arg, "utf-16-le", "surrogatepass"); + if (!bytes) + return FALSE; + temp_uni = PyUnicode_FromEncodedObject (bytes, "utf-16-le", "surrogatepass"); + Py_DECREF (bytes); + if (!temp_uni) + return FALSE; + /* glib uses utf-8, so encode to that and allow surrogates so we can + * represent all possible path values + */ + bytes = PyUnicode_AsEncodedString (temp_uni, "utf-8", "surrogatepass"); + Py_DECREF (temp_uni); + if (!bytes) + return FALSE; + + if (PyBytes_AsStringAndSize (bytes, &buffer, NULL) == -1) { + Py_DECREF (bytes); + return FALSE; + } + + filename = g_strdup (buffer); + Py_DECREF (bytes); + } else { + PyErr_Format (PyExc_TypeError, "Must be str, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + *result = filename; + return TRUE; +} + +static gboolean +pygi_filename_from_py (PyObject *py_arg, gchar **result) +{ +#ifdef G_OS_WIN32 + return filename_from_py_win32 (py_arg, result); +#else + return filename_from_py_unix (py_arg, result); +#endif +} + +static PyObject * +base_number_checks (PyObject *object) +{ + PyObject *number; + + if (!PyNumber_Check (object)) { + PyErr_Format (PyExc_TypeError, "Must be number, not %s", + Py_TYPE (object)->tp_name); + return NULL; + } + + number = PyNumber_Long (object); + + if (number == NULL) { + PyErr_SetString (PyExc_TypeError, "expected int argument"); + return NULL; + } + + return number; +} + +gboolean +pygi_gboolean_from_py (PyObject *object, gboolean *result) +{ + int value = PyObject_IsTrue (object); + if (value == -1) + return FALSE; + *result = (gboolean)value; + return TRUE; +} + +PyObject * +pygi_gboolean_to_py (gboolean value) +{ + return PyBool_FromLong (value); +} + +/* A super set of pygi_gint8_from_py (also handles unicode) */ +gboolean +pygi_gschar_from_py (PyObject *object, gint8 *result) +{ + if (PyUnicode_Check (object)) { + gunichar uni; + PyObject *temp; + gboolean status; + + if (!pygi_gunichar_from_py (object, &uni)) + return FALSE; + + temp = pygi_guint32_to_py (uni); + status = pygi_gint8_from_py (temp, result); + Py_DECREF (temp); + return status; + } else { + /* pygi_gint8_from_py handles numbers and bytes */ + return pygi_gint8_from_py (object, result); + } + + return FALSE; +} + +/* A super set of pygi_guint8_from_py (also handles unicode) */ +gboolean +pygi_guchar_from_py (PyObject *object, guchar *result) +{ + if (PyUnicode_Check (object)) { + gunichar uni; + PyObject *temp; + gboolean status; + gint8 codepoint; + + if (!pygi_gunichar_from_py (object, &uni)) + return FALSE; + + temp = pygi_guint32_to_py (uni); + status = pygi_gint8_from_py (temp, &codepoint); + Py_DECREF (temp); + if (status) + *result = (guchar)codepoint; + return status; + } else { + /* pygi_guint8_from_py handles numbers and bytes */ + return pygi_guint8_from_py (object, result); + } +} + +gboolean +pygi_gint_from_py (PyObject *object, gint *result) +{ + long long_value; + PyObject *number; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLong (number); + if (PyErr_Occurred ()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value < G_MININT || long_value > G_MAXINT) { + goto overflow; + } + + Py_DECREF (number); + *result = (gint)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %d to %d", + number, (int)G_MININT, (int)G_MAXINT); + Py_DECREF (number); + return FALSE; +} + +PyObject * +pygi_gint_to_py (gint value) +{ + return PyLong_FromLong (value); +} + +gboolean +pygi_guint_from_py (PyObject *object, guint *result) +{ + unsigned long long_value; + PyObject *number; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsUnsignedLong (number); + if (PyErr_Occurred ()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value > G_MAXUINT) { + goto overflow; + } + + Py_DECREF (number); + *result = (gint)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %lu", + number, (long)0, (unsigned long)G_MAXUINT); + Py_DECREF (number); + return FALSE; +} + +PyObject * +pygi_guint_to_py (guint value) +{ +#if (G_MAXUINT <= LONG_MAX) + return PyLong_FromLong ((long) value); +#else + if (value <= LONG_MAX) + return PyLong_FromLong ((long) value); + return PyLong_FromUnsignedLong (value); +#endif +} + +gboolean +pygi_glong_from_py (PyObject *object, glong *result) +{ + long long_value; + PyObject *number; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLong (number); + if (long_value == -1 && PyErr_Occurred ()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } + + Py_DECREF (number); + *result = (glong)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %ld", + number, (long)G_MINLONG, (long)G_MAXLONG); + Py_DECREF (number); + return FALSE; +} + +PyObject * +pygi_glong_to_py (glong value) +{ + return PyLong_FromLong (value); +} + +gboolean +pygi_gulong_from_py (PyObject *object, gulong *result) +{ + unsigned long long_value; + PyObject *number; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsUnsignedLong (number); + if (PyErr_Occurred ()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } + + Py_DECREF (number); + *result = (gulong)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %lu", + number, (long)0, (unsigned long)G_MAXULONG); + Py_DECREF (number); + return FALSE; +} + +PyObject * +pygi_gulong_to_py (gulong value) +{ + if (value <= LONG_MAX) + return PyLong_FromLong ((long) value); + else + return PyLong_FromUnsignedLong (value); +} + +gboolean +pygi_gint8_from_py (PyObject *object, gint8 *result) +{ + long long_value; + PyObject *number; + + if (PyBytes_Check (object)) { + if (PyBytes_Size (object) != 1) { + PyErr_Format (PyExc_TypeError, "Must be a single character"); + return FALSE; + } + + *result = (gint8)(PyBytes_AsString (object)[0]); + return TRUE; + } + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLong (number); + if (long_value == -1 && PyErr_Occurred()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value < G_MININT8 || long_value > G_MAXINT8) { + goto overflow; + } + + Py_DECREF (number); + *result = (gint8)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %ld", + number, (long)G_MININT8, (long)G_MAXINT8); + Py_DECREF (number); + return FALSE; +} + +PyObject * +pygi_gint8_to_py (gint8 value) +{ + return PyLong_FromLong (value); +} + +gboolean +pygi_guint8_from_py (PyObject *object, guint8 *result) +{ + long long_value; + PyObject *number; + + if (PyBytes_Check (object)) { + if (PyBytes_Size (object) != 1) { + PyErr_Format (PyExc_TypeError, "Must be a single character"); + return FALSE; + } + + *result = (guint8)(PyBytes_AsString (object)[0]); + return TRUE; + } + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLong (number); + if (long_value == -1 && PyErr_Occurred()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value < 0 || long_value > G_MAXUINT8) { + goto overflow; + } + + Py_DECREF (number); + *result = (guint8)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %ld", + number, (long)0, (long)G_MAXUINT8); + Py_DECREF (number); + return FALSE; +} + +PyObject * +pygi_guint8_to_py (guint8 value) +{ + return PyLong_FromLong (value); +} + +static gboolean +pygi_gint16_from_py (PyObject *object, gint16 *result) +{ + long long_value; + PyObject *number; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLong (number); + if (long_value == -1 && PyErr_Occurred()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value < G_MININT16 || long_value > G_MAXINT16) { + goto overflow; + } + + Py_DECREF (number); + *result = (gint16)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %ld", + number, (long)G_MININT16, (long)G_MAXINT16); + Py_DECREF (number); + return FALSE; +} + +static PyObject * +pygi_gint16_to_py (gint16 value) +{ + return PyLong_FromLong (value); +} + +static gboolean +pygi_guint16_from_py (PyObject *object, guint16 *result) +{ + long long_value; + PyObject *number; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLong (number); + if (long_value == -1 && PyErr_Occurred()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value < 0 || long_value > G_MAXUINT16) { + goto overflow; + } + + Py_DECREF (number); + *result = (guint16)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %ld", + number, (long)0, (long)G_MAXUINT16); + Py_DECREF (number); + return FALSE; +} + +static PyObject * +pygi_guint16_to_py (guint16 value) +{ + return PyLong_FromLong (value); +} + +static gboolean +pygi_gint32_from_py (PyObject *object, gint32 *result) +{ + long long_value; + PyObject *number; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLong (number); + if (long_value == -1 && PyErr_Occurred()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value < G_MININT32 || long_value > G_MAXINT32) { + goto overflow; + } + + Py_DECREF (number); + *result = (gint32)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %ld", + number, (long)G_MININT32, (long)G_MAXINT32); + Py_DECREF (number); + return FALSE; +} + +static PyObject * +pygi_gint32_to_py (gint32 value) +{ + return PyLong_FromLong (value); +} + +static gboolean +pygi_guint32_from_py (PyObject *object, guint32 *result) +{ + long long long_value; + PyObject *number; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLongLong (number); + if (PyErr_Occurred ()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value < 0 || long_value > G_MAXUINT32) { + goto overflow; + } + + Py_DECREF (number); + *result = (guint32)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %lu", + number, (long)0, (unsigned long)G_MAXUINT32); + Py_DECREF (number); + return FALSE; +} + +PyObject * +pygi_guint32_to_py (guint32 value) +{ +#if (G_MAXUINT <= LONG_MAX) + return PyLong_FromLong (value); +#else + if (value <= LONG_MAX) + return PyLong_FromLong((long) value); + else + return PyLong_FromLongLong (value); +#endif +} + +gboolean +pygi_gint64_from_py (PyObject *object, gint64 *result) +{ + long long long_value; + PyObject *number, *min, *max; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsLongLong (number); + if (PyErr_Occurred ()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value < G_MININT64 || long_value > G_MAXINT64) { + goto overflow; + } + + Py_DECREF (number); + *result = (gint64)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + min = pygi_gint64_to_py (G_MININT64); + max = pygi_gint64_to_py (G_MAXINT64); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %S to %S", + number, min, max); + Py_DECREF (number); + Py_DECREF (min); + Py_DECREF (max); + return FALSE; +} + +PyObject * +pygi_gint64_to_py (gint64 value) +{ + if (LONG_MIN <= value && value <= LONG_MAX) + return PyLong_FromLong((long) value); + else + return PyLong_FromLongLong (value); +} + +gboolean +pygi_guint64_from_py (PyObject *object, guint64 *result) +{ + unsigned long long long_value; + PyObject *number, *max; + + number = base_number_checks (object); + if (number == NULL) + return FALSE; + + long_value = PyLong_AsUnsignedLongLong (number); + if (PyErr_Occurred ()) { + if (PyErr_ExceptionMatches (PyExc_OverflowError)) + goto overflow; + Py_DECREF (number); + return FALSE; + } else if (long_value > G_MAXUINT64) { + goto overflow; + } + + Py_DECREF (number); + *result = (guint64)long_value; + return TRUE; + +overflow: + PyErr_Clear (); + max = pygi_guint64_to_py (G_MAXUINT64); + PyErr_Format ( + PyExc_OverflowError, "%S not in range %ld to %S", + number, (long)0, max); + Py_DECREF (number); + Py_DECREF (max); + return FALSE; +} + +PyObject * +pygi_guint64_to_py (guint64 value) +{ + if (value <= LONG_MAX) + return PyLong_FromLong((long) value); + else + return PyLong_FromUnsignedLongLong (value); +} + +gboolean +pygi_marshal_from_py_basic_type (PyObject *object, /* in */ + GIArgument *arg, /* out */ + GITypeTag type_tag, + GITransfer transfer, + gpointer *cleanup_data /* out */) +{ + switch (type_tag) { + case GI_TYPE_TAG_VOID: + g_warn_if_fail (transfer == GI_TRANSFER_NOTHING); + if (pygi_gpointer_from_py (object, &(arg->v_pointer))) { + *cleanup_data = arg->v_pointer; + return TRUE; + } + return FALSE; + + case GI_TYPE_TAG_INT8: + return pygi_gint8_from_py (object, &(arg->v_int8)); + + case GI_TYPE_TAG_UINT8: + return pygi_guint8_from_py (object, &(arg->v_uint8)); + + case GI_TYPE_TAG_INT16: + return pygi_gint16_from_py (object, &(arg->v_int16)); + + case GI_TYPE_TAG_UINT16: + return pygi_guint16_from_py (object, &(arg->v_uint16)); + + case GI_TYPE_TAG_INT32: + return pygi_gint32_from_py (object, &(arg->v_int32)); + + case GI_TYPE_TAG_UINT32: + return pygi_guint32_from_py (object, &(arg->v_uint32)); + + case GI_TYPE_TAG_INT64: + return pygi_gint64_from_py (object, &(arg->v_int64)); + + case GI_TYPE_TAG_UINT64: + return pygi_guint64_from_py (object, &(arg->v_uint64)); + + case GI_TYPE_TAG_BOOLEAN: + return pygi_gboolean_from_py (object, &(arg->v_boolean)); + + case GI_TYPE_TAG_FLOAT: + return pygi_gfloat_from_py (object, &(arg->v_float)); + + case GI_TYPE_TAG_DOUBLE: + return pygi_gdouble_from_py (object, &(arg->v_double)); + + case GI_TYPE_TAG_GTYPE: + return pygi_gtype_from_py (object, &(arg->v_size)); + + case GI_TYPE_TAG_UNICHAR: + return pygi_gunichar_from_py (object, &(arg->v_uint32)); + + case GI_TYPE_TAG_UTF8: + if (pygi_utf8_from_py (object, &(arg->v_string))) { + *cleanup_data = arg->v_string; + return TRUE; + } + return FALSE; + + case GI_TYPE_TAG_FILENAME: + if (pygi_filename_from_py (object, &(arg->v_string))) { + *cleanup_data = arg->v_string; + return TRUE; + } + return FALSE; + + default: + PyErr_Format (PyExc_TypeError, "Type tag %d not supported", + type_tag); + return FALSE; + } + + return TRUE; +} + +gboolean +pygi_marshal_from_py_basic_type_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + return pygi_marshal_from_py_basic_type (py_arg, + arg, + arg_cache->type_tag, + arg_cache->transfer, + cleanup_data); +} + +static void +marshal_cleanup_from_py_utf8 (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + /* We strdup strings so free unless ownership is transferred to C. */ + if (was_processed && arg_cache->transfer == GI_TRANSFER_NOTHING) + g_free (data); +} + +static PyObject * +marshal_to_py_void (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + if (arg_cache->is_pointer) { + return PyLong_FromVoidPtr (arg->v_pointer); + } + Py_RETURN_NONE; +} + +PyObject * +pygi_utf8_to_py (gchar *value) +{ + if (value == NULL) { + Py_RETURN_NONE; + } + + return PyUnicode_FromString (value); +} + +PyObject * +pygi_filename_to_py (gchar *value) +{ + PyObject *py_obj; + + if (value == NULL) { + Py_RETURN_NONE; + } + +#ifdef G_OS_WIN32 + py_obj = PyUnicode_DecodeUTF8 (value, strlen(value), + "surrogatepass"); +#else + py_obj = PyUnicode_DecodeFSDefault (value); +#endif + + return py_obj; +} + +/** + * pygi_marshal_to_py_basic_type: + * @arg: The argument to convert to an object. + * @type_tag: Type tag for @arg + * @transfer: Transfer annotation + * + * Convert the given argument to a Python object. This function + * is restricted to simple types that only require the GITypeTag + * and GITransfer. For a more complete conversion routine, use: + * _pygi_argument_to_object. + * + * Returns: A PyObject representing @arg or NULL if it cannot convert + * the argument. + */ +PyObject * +pygi_marshal_to_py_basic_type (GIArgument *arg, + GITypeTag type_tag, + GITransfer transfer) +{ + switch (type_tag) { + case GI_TYPE_TAG_BOOLEAN: + return pygi_gboolean_to_py (arg->v_boolean); + + case GI_TYPE_TAG_INT8: + return pygi_gint8_to_py (arg->v_int8); + + case GI_TYPE_TAG_UINT8: + return pygi_guint8_to_py (arg->v_uint8); + + case GI_TYPE_TAG_INT16: + return pygi_gint16_to_py (arg->v_int16); + + case GI_TYPE_TAG_UINT16: + return pygi_guint16_to_py (arg->v_uint16); + + case GI_TYPE_TAG_INT32: + return pygi_gint32_to_py (arg->v_int32); + + case GI_TYPE_TAG_UINT32: + return pygi_guint32_to_py (arg->v_uint32); + + case GI_TYPE_TAG_INT64: + return pygi_gint64_to_py (arg->v_int64); + + case GI_TYPE_TAG_UINT64: + return pygi_guint64_to_py (arg->v_uint64); + + case GI_TYPE_TAG_FLOAT: + return pygi_gfloat_to_py (arg->v_float); + + case GI_TYPE_TAG_DOUBLE: + return pygi_gdouble_to_py (arg->v_double); + + case GI_TYPE_TAG_GTYPE: + return pyg_type_wrapper_new ( (GType) arg->v_size); + + case GI_TYPE_TAG_UNICHAR: + return pygi_gunichar_to_py (arg->v_uint32); + + case GI_TYPE_TAG_UTF8: + return pygi_utf8_to_py (arg->v_string); + + case GI_TYPE_TAG_FILENAME: + return pygi_filename_to_py (arg->v_string); + + default: + PyErr_Format (PyExc_TypeError, "Type tag %d not supported", + type_tag); + return NULL; + } +} + +PyObject * +pygi_marshal_to_py_basic_type_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + return pygi_marshal_to_py_basic_type (arg, + arg_cache->type_tag, + arg_cache->transfer); +} + +static void +marshal_cleanup_to_py_utf8 (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed) +{ + /* Python copies the string so we need to free it + if the interface is transfering ownership, + whether or not it has been processed yet */ + if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) + g_free (data); +} + +static gboolean +arg_basic_type_setup_from_info (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction) +{ + GITypeTag type_tag = g_type_info_get_tag (type_info); + + if (!pygi_arg_base_setup (arg_cache, type_info, arg_info, transfer, direction)) + return FALSE; + + switch (type_tag) { + case GI_TYPE_TAG_VOID: + if (direction & PYGI_DIRECTION_FROM_PYTHON) + arg_cache->from_py_marshaller = marshal_from_py_void; + + if (direction & PYGI_DIRECTION_TO_PYTHON) + arg_cache->to_py_marshaller = marshal_to_py_void; + + break; + case GI_TYPE_TAG_BOOLEAN: + arg_cache->allow_none = TRUE; + /* fall through */ + case GI_TYPE_TAG_INT8: + case GI_TYPE_TAG_UINT8: + case GI_TYPE_TAG_INT16: + case GI_TYPE_TAG_UINT16: + case GI_TYPE_TAG_INT32: + case GI_TYPE_TAG_UINT32: + case GI_TYPE_TAG_INT64: + case GI_TYPE_TAG_UINT64: + case GI_TYPE_TAG_FLOAT: + case GI_TYPE_TAG_DOUBLE: + case GI_TYPE_TAG_UNICHAR: + case GI_TYPE_TAG_GTYPE: + if (direction & PYGI_DIRECTION_FROM_PYTHON) + arg_cache->from_py_marshaller = pygi_marshal_from_py_basic_type_cache_adapter; + + if (direction & PYGI_DIRECTION_TO_PYTHON) + arg_cache->to_py_marshaller = pygi_marshal_to_py_basic_type_cache_adapter; + + break; + case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: + if (direction & PYGI_DIRECTION_FROM_PYTHON) { + arg_cache->from_py_marshaller = pygi_marshal_from_py_basic_type_cache_adapter; + arg_cache->from_py_cleanup = marshal_cleanup_from_py_utf8; + } + + if (direction & PYGI_DIRECTION_TO_PYTHON) { + arg_cache->to_py_marshaller = pygi_marshal_to_py_basic_type_cache_adapter; + arg_cache->to_py_cleanup = marshal_cleanup_to_py_utf8; + } + + break; + default: + g_assert_not_reached (); + } + + return TRUE; +} + +PyGIArgCache * +pygi_arg_basic_type_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction) +{ + gboolean res = FALSE; + PyGIArgCache *arg_cache = pygi_arg_cache_alloc (); + + res = arg_basic_type_setup_from_info (arg_cache, + type_info, + arg_info, + transfer, + direction); + if (res) { + return arg_cache; + } else { + pygi_arg_cache_free (arg_cache); + return NULL; + } +} diff --git a/gi/pygi-basictype.h b/gi/pygi-basictype.h new file mode 100644 index 0000000..04d520a --- /dev/null +++ b/gi/pygi-basictype.h @@ -0,0 +1,89 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_ARG_BASICTYPE_H__ +#define __PYGI_ARG_BASICTYPE_H__ + +#include +#include "pygi-cache.h" + +G_BEGIN_DECLS + +gboolean pygi_marshal_from_py_basic_type (PyObject *object, /* in */ + GIArgument *arg, /* out */ + GITypeTag type_tag, + GITransfer transfer, + gpointer *cleanup_data); +gboolean pygi_marshal_from_py_basic_type_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data); + +PyObject *pygi_marshal_to_py_basic_type (GIArgument *arg, /* in */ + GITypeTag type_tag, + GITransfer transfer); +PyObject *pygi_marshal_to_py_basic_type_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data); + +PyGIArgCache *pygi_arg_basic_type_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction); + +PyObject *pygi_gint64_to_py (gint64 value); +PyObject *pygi_guint64_to_py (guint64 value); +PyObject *pygi_gfloat_to_py (gfloat value); +PyObject *pygi_gdouble_to_py (gdouble value); +PyObject *pygi_gboolean_to_py (gboolean value); +PyObject *pygi_gint8_to_py (gint8 value); +PyObject *pygi_guint8_to_py (guint8 value); +PyObject *pygi_utf8_to_py (gchar *value); +PyObject *pygi_gint_to_py (gint value); +PyObject *pygi_glong_to_py (glong value); +PyObject *pygi_guint_to_py (guint value); +PyObject *pygi_gulong_to_py (gulong value); +PyObject *pygi_filename_to_py (gchar *value); +PyObject *pygi_gsize_to_py (gsize value); +PyObject *pygi_gssize_to_py (gssize value); +PyObject *pygi_guint32_to_py (guint32 value); + +gboolean pygi_gboolean_from_py (PyObject *object, gboolean *result); +gboolean pygi_gint64_from_py (PyObject *object, gint64 *result); +gboolean pygi_guint64_from_py (PyObject *object, guint64 *result); +gboolean pygi_gfloat_from_py (PyObject *py_arg, gfloat *result); +gboolean pygi_gdouble_from_py (PyObject *py_arg, gdouble *result); +gboolean pygi_utf8_from_py (PyObject *py_arg, gchar **result); +gboolean pygi_glong_from_py (PyObject *object, glong *result); +gboolean pygi_gulong_from_py (PyObject *object, gulong *result); +gboolean pygi_gint_from_py (PyObject *object, gint *result); +gboolean pygi_guint_from_py (PyObject *object, guint *result); +gboolean pygi_gunichar_from_py (PyObject *py_arg, gunichar *result); +gboolean pygi_gint8_from_py (PyObject *object, gint8 *result); +gboolean pygi_gschar_from_py (PyObject *object, gint8 *result); +gboolean pygi_guint8_from_py (PyObject *object, guint8 *result); +gboolean pygi_guchar_from_py (PyObject *object, guchar *result); + +G_END_DECLS + +#endif /*__PYGI_ARG_BASICTYPE_H__*/ diff --git a/gi/pygi-boxed.c b/gi/pygi-boxed.c index 5bf2c19..9deb62a 100644 --- a/gi/pygi-boxed.c +++ b/gi/pygi-boxed.c @@ -16,38 +16,66 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" +#include "pygi-boxed.h" +#include "pygi-info.h" +#include "pygboxed.h" +#include "pygi-type.h" +#include "pygi-basictype.h" +#include "pygi-util.h" -#include #include -#include + +struct _PyGIBoxed { + PyGBoxed base; + gboolean slice_allocated; + gsize size; +}; static void -_boxed_dealloc (PyGIBoxed *self) +boxed_clear (PyGIBoxed *self) { - GType g_type; + gpointer boxed = pyg_boxed_get_ptr (self); + GType g_type = ((PyGBoxed *)self)->gtype; - if ( ( (PyGBoxed *) self)->free_on_dealloc) { + if ( ( (PyGBoxed *) self)->free_on_dealloc && boxed != NULL) { if (self->slice_allocated) { - g_slice_free1 (self->size, ( (PyGBoxed *) self)->boxed); + if (g_type && g_type_is_a (g_type, G_TYPE_VALUE)) + g_value_unset (boxed); + g_slice_free1 (self->size, boxed); + self->slice_allocated = FALSE; + self->size = 0; } else { - g_type = pyg_type_from_object ( (PyObject *) self); - g_boxed_free (g_type, ( (PyGBoxed *) self)->boxed); + g_boxed_free (g_type, boxed); } } + pyg_boxed_set_ptr (self, NULL); +} - Py_TYPE( (PyGObject *) self)->tp_free ( (PyObject *) self); +static PyObject * +boxed_clear_wrapper (PyGIBoxed *self) +{ + boxed_clear (self); + + Py_RETURN_NONE; +} + + +static void +boxed_dealloc (PyGIBoxed *self) +{ + boxed_clear (self); + + Py_TYPE (self)->tp_free ((PyObject *)self); } void * -_pygi_boxed_alloc (GIBaseInfo *info, gsize *size_out) +pygi_boxed_alloc (GIBaseInfo *info, gsize *size_out) { - gsize size; + gpointer boxed = NULL; + gsize size = 0; switch (g_base_info_get_type (info)) { case GI_INFO_TYPE_UNION: @@ -64,28 +92,33 @@ _pygi_boxed_alloc (GIBaseInfo *info, gsize *size_out) return NULL; } + if (size == 0) { + PyErr_Format (PyExc_TypeError, + "boxed cannot be created directly; try using a constructor, see: help(%s.%s)", + g_base_info_get_namespace (info), + g_base_info_get_name (info)); + return NULL; + } + if( size_out != NULL) *size_out = size; - return g_slice_alloc0 (size); + boxed = g_slice_alloc0 (size); + if (boxed == NULL) + PyErr_NoMemory(); + return boxed; } static PyObject * -_boxed_new (PyTypeObject *type, +boxed_new (PyTypeObject *type, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = { NULL }; - GIBaseInfo *info; gsize size = 0; gpointer boxed; PyGIBoxed *self = NULL; - if (!PyArg_ParseTupleAndKeywords (args, kwargs, "", kwlist)) { - return NULL; - } - info = _pygi_object_get_gi_info ( (PyObject *) type, &PyGIBaseInfo_Type); if (info == NULL) { if (PyErr_ExceptionMatches (PyExc_AttributeError)) { @@ -94,13 +127,12 @@ _boxed_new (PyTypeObject *type, return NULL; } - boxed = _pygi_boxed_alloc (info, &size); + boxed = pygi_boxed_alloc (info, &size); if (boxed == NULL) { - PyErr_NoMemory(); goto out; } - self = (PyGIBoxed *) _pygi_boxed_new (type, boxed, TRUE, size); + self = (PyGIBoxed *) pygi_boxed_new (type, boxed, TRUE, size); if (self == NULL) { g_slice_free1 (size, boxed); goto out; @@ -116,21 +148,30 @@ out: } static int -_boxed_init (PyObject *self, +boxed_init (PyObject *self, PyObject *args, PyObject *kwargs) { + static char *kwlist[] = { NULL }; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, "", kwlist)) { + PyErr_Clear (); + PyErr_Warn (PyExc_DeprecationWarning, + "Passing arguments to gi.types.Boxed.__init__() is deprecated. " + "All arguments passed will be ignored."); + } + /* Don't call PyGBoxed's init, which raises an exception. */ return 0; } -PYGLIB_DEFINE_TYPE("gi.Boxed", PyGIBoxed_Type, PyGIBoxed); +PYGI_DEFINE_TYPE("gi.Boxed", PyGIBoxed_Type, PyGIBoxed); PyObject * -_pygi_boxed_new (PyTypeObject *type, - gpointer boxed, - gboolean free_on_dealloc, - gsize allocated_slice) +pygi_boxed_new (PyTypeObject *type, + gpointer boxed, + gboolean free_on_dealloc, + gsize allocated_slice) { PyGIBoxed *self; @@ -149,8 +190,8 @@ _pygi_boxed_new (PyTypeObject *type, } ( (PyGBoxed *) self)->gtype = pyg_type_from_object ( (PyObject *) type); - ( (PyGBoxed *) self)->boxed = boxed; ( (PyGBoxed *) self)->free_on_dealloc = free_on_dealloc; + pyg_boxed_set_ptr (self, boxed); if (allocated_slice > 0) { self->size = allocated_slice; self->slice_allocated = TRUE; @@ -162,30 +203,57 @@ _pygi_boxed_new (PyTypeObject *type, return (PyObject *) self; } -static PyObject * -_pygi_boxed_get_free_on_dealloc(PyGIBoxed *self, void *closure) +/** + * pygi_boxed_copy_in_place: + * + * Replace the boxed pointer held by this wrapper with a boxed copy + * freeing the previously held pointer (when free_on_dealloc is TRUE). + * This can be used in cases where Python is passed a reference which + * it does not own and the wrapper is held by the Python program + * longer than the duration of a callback it was passed to. + */ +void +pygi_boxed_copy_in_place (PyGIBoxed *self) { - return PyBool_FromLong( ((PyGBoxed *)self)->free_on_dealloc ); + PyGBoxed *pygboxed = (PyGBoxed *)self; + gpointer ptr = pyg_boxed_get_ptr (self); + gpointer copy = NULL; + + if (ptr) + copy = g_boxed_copy (pygboxed->gtype, ptr); + + boxed_clear (self); + pyg_boxed_set_ptr (pygboxed, copy); + pygboxed->free_on_dealloc = TRUE; } -static PyGetSetDef pygi_boxed_getsets[] = { - { "_free_on_dealloc", (getter)_pygi_boxed_get_free_on_dealloc, (setter)0 }, - { NULL, 0, 0 } +static PyMethodDef boxed_methods[] = { + { "_clear_boxed", (PyCFunction)boxed_clear_wrapper, METH_NOARGS }, + { NULL, NULL, 0 } }; -void -_pygi_boxed_register_types (PyObject *m) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_boxed_register_types (PyObject *m) { - Py_TYPE(&PyGIBoxed_Type) = &PyType_Type; + Py_SET_TYPE(&PyGIBoxed_Type, &PyType_Type); + g_assert (Py_TYPE (&PyGBoxed_Type) != NULL); PyGIBoxed_Type.tp_base = &PyGBoxed_Type; - PyGIBoxed_Type.tp_new = (newfunc) _boxed_new; - PyGIBoxed_Type.tp_init = (initproc) _boxed_init; - PyGIBoxed_Type.tp_dealloc = (destructor) _boxed_dealloc; + PyGIBoxed_Type.tp_new = (newfunc) boxed_new; + PyGIBoxed_Type.tp_init = (initproc) boxed_init; + PyGIBoxed_Type.tp_dealloc = (destructor) boxed_dealloc; PyGIBoxed_Type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE); - PyGIBoxed_Type.tp_getset = pygi_boxed_getsets; + PyGIBoxed_Type.tp_methods = boxed_methods; - if (PyType_Ready (&PyGIBoxed_Type)) - return; - if (PyModule_AddObject (m, "Boxed", (PyObject *) &PyGIBoxed_Type)) - return; + if (PyType_Ready (&PyGIBoxed_Type) < 0) + return -1; + Py_INCREF ((PyObject *) &PyGIBoxed_Type); + if (PyModule_AddObject (m, "Boxed", (PyObject *) &PyGIBoxed_Type) < 0) { + Py_DECREF ((PyObject *) &PyGIBoxed_Type); + return -1; + } + + return 0; } diff --git a/gi/pygi-boxed.h b/gi/pygi-boxed.h index 38ac928..18c4448 100644 --- a/gi/pygi-boxed.h +++ b/gi/pygi-boxed.h @@ -14,29 +14,32 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_BOXED_H__ #define __PYGI_BOXED_H__ #include +#include +#include "pygobject-internal.h" G_BEGIN_DECLS +typedef struct _PyGIBoxed PyGIBoxed; + extern PyTypeObject PyGIBoxed_Type; -PyObject * _pygi_boxed_new (PyTypeObject *type, - gpointer boxed, - gboolean free_on_dealloc, - gsize allocated_slice); +PyObject * pygi_boxed_new (PyTypeObject *type, + gpointer boxed, + gboolean free_on_dealloc, + gsize allocated_slice); + +void * pygi_boxed_alloc (GIBaseInfo *info, gsize *size); -void * _pygi_boxed_alloc (GIBaseInfo *info, - gsize *size); +void pygi_boxed_copy_in_place (PyGIBoxed *self); -void _pygi_boxed_register_types (PyObject *m); +int pygi_boxed_register_types (PyObject *m); G_END_DECLS diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c index 2f807f8..c6630de 100644 --- a/gi/pygi-cache.c +++ b/gi/pygi-cache.c @@ -2,6 +2,7 @@ * vim: tabstop=4 shiftwidth=4 expandtab * * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2013 Simon Feltman * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,37 +15,99 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ +#include +#include + +#include "pygi-type.h" #include "pygi-info.h" #include "pygi-cache.h" -#include "pygi-marshal-to-py.h" -#include "pygi-marshal-from-py.h" #include "pygi-marshal-cleanup.h" #include "pygi-type.h" -#include +#include "pygi-hashtable.h" +#include "pygi-basictype.h" +#include "pygi-list.h" +#include "pygi-array.h" +#include "pygi-closure.h" +#include "pygi-error.h" +#include "pygi-object.h" +#include "pygi-struct-marshal.h" +#include "pygi-enum-marshal.h" +#include "pygi-resulttuple.h" +#include "pygi-invoke.h" + + +/* _arg_info_default_value + * info: + * arg: (out): GIArgument to fill in with default value. + * + * This is currently a place holder API which only supports "allow-none" pointer args. + * Once defaults are part of the GI API, we can replace this with: g_arg_info_default_value + * https://bugzilla.gnome.org/show_bug.cgi?id=558620 + * + * Returns: TRUE if the given argument supports a default value and was filled in. + */ +static gboolean +_arg_info_default_value (GIArgInfo *info, GIArgument *arg) +{ + if (g_arg_info_may_be_null (info)) { + arg->v_pointer = NULL; + return TRUE; + } + return FALSE; +} -PyGIArgCache * _arg_cache_new (GITypeInfo *type_info, - PyGICallableCache *callable_cache, - GIArgInfo *arg_info, - GITransfer transfer, - PyGIDirection direction, - gssize c_arg_index, - gssize py_arg_index); - -PyGIArgCache * _arg_cache_new_for_interface (GIInterfaceInfo *iface_info, - PyGICallableCache *callable_cache, - GIArgInfo *arg_info, - GITransfer transfer, - PyGIDirection direction, - gssize c_arg_index, - gssize py_arg_index); -/* cleanup */ -static void -_pygi_arg_cache_free (PyGIArgCache *cache) +/* pygi_arg_base_setup: + * arg_cache: argument cache to initialize + * type_info: source for type related attributes to cache + * arg_info: (allow-none): source for argument related attributes to cache + * transfer: transfer mode to store in the argument cache + * direction: marshaling direction to store in the cache + * + * Initializer for PyGIArgCache + * + * Returns: TRUE on success and FALSE on failure + */ +gboolean +pygi_arg_base_setup (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction) +{ + arg_cache->direction = direction; + arg_cache->transfer = transfer; + arg_cache->py_arg_index = -1; + arg_cache->c_arg_index = -1; + + if (type_info != NULL) { + arg_cache->is_pointer = g_type_info_is_pointer (type_info); + arg_cache->type_tag = g_type_info_get_tag (type_info); + g_base_info_ref ( (GIBaseInfo *) type_info); + arg_cache->type_info = type_info; + } + + if (arg_info != NULL) { + if (!arg_cache->has_default) { + /* It is possible has_default was set somewhere else */ + arg_cache->has_default = _arg_info_default_value (arg_info, + &arg_cache->default_value); + } + arg_cache->arg_name = g_base_info_get_name ((GIBaseInfo *) arg_info); + arg_cache->allow_none = g_arg_info_may_be_null (arg_info); + + if (arg_cache->type_tag == GI_TYPE_TAG_INTERFACE || arg_cache->type_tag == GI_TYPE_TAG_ARRAY) + arg_cache->is_caller_allocates = g_arg_info_is_caller_allocates (arg_info); + else + arg_cache->is_caller_allocates = FALSE; + } + return TRUE; +} + +void +pygi_arg_cache_free (PyGIArgCache *cache) { if (cache == NULL) return; @@ -57,6 +120,8 @@ _pygi_arg_cache_free (PyGIArgCache *cache) g_slice_free (PyGIArgCache, cache); } +/* PyGIInterfaceCache */ + static void _interface_cache_free_func (PyGIInterfaceCache *cache) { @@ -70,1136 +135,1050 @@ _interface_cache_free_func (PyGIInterfaceCache *cache) } } -static void -_hash_cache_free_func (PyGIHashCache *cache) +/* pygi_arg_interface_setup: + * arg_cache: argument cache to initialize + * type_info: source for type related attributes to cache + * arg_info: (allow-none): source for argument related attributes to cache + * transfer: transfer mode to store in the argument cache + * direction: marshaling direction to store in the cache + * iface_info: interface info to cache + * + * Initializer for PyGIInterfaceCache + * + * Returns: TRUE on success and FALSE on failure + */ +gboolean +pygi_arg_interface_setup (PyGIInterfaceCache *iface_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info) { - if (cache != NULL) { - _pygi_arg_cache_free (cache->key_cache); - _pygi_arg_cache_free (cache->value_cache); - g_slice_free (PyGIHashCache, cache); + if (!pygi_arg_base_setup ((PyGIArgCache *)iface_cache, + type_info, + arg_info, + transfer, + direction)) { + return FALSE; } -} -static void -_sequence_cache_free_func (PyGISequenceCache *cache) -{ - if (cache != NULL) { - _pygi_arg_cache_free (cache->item_cache); - g_slice_free (PyGISequenceCache, cache); - } -} + ( (PyGIArgCache *)iface_cache)->destroy_notify = (GDestroyNotify)_interface_cache_free_func; -static void -_callback_cache_free_func (PyGICallbackCache *cache) -{ - if (cache != NULL) { - if (cache->interface_info != NULL) - g_base_info_unref ( (GIBaseInfo *)cache->interface_info); + g_base_info_ref ( (GIBaseInfo *)iface_info); + iface_cache->interface_info = iface_info; + iface_cache->arg_cache.type_tag = GI_TYPE_TAG_INTERFACE; + iface_cache->type_name = _pygi_g_base_info_get_fullname (iface_info); + iface_cache->g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *)iface_info); + iface_cache->py_type = pygi_type_import_by_gi_info ( (GIBaseInfo *) iface_info); - g_slice_free (PyGICallbackCache, cache); + if (iface_cache->py_type == NULL) { + return FALSE; } + + return TRUE; } -void -_pygi_callable_cache_free (PyGICallableCache *cache) +PyGIArgCache * +pygi_arg_interface_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info) { - gssize i; - - if (cache == NULL) - return; - - g_slist_free (cache->to_py_args); - g_slist_free (cache->arg_name_list); - g_hash_table_destroy (cache->arg_name_hash); + PyGIInterfaceCache *ic; - for (i = 0; i < cache->n_args; i++) { - PyGIArgCache *tmp = cache->args_cache[i]; - _pygi_arg_cache_free (tmp); + ic = g_slice_new0 (PyGIInterfaceCache); + if (!pygi_arg_interface_setup (ic, + type_info, + arg_info, + transfer, + direction, + iface_info)) { + pygi_arg_cache_free ((PyGIArgCache *)ic); + return NULL; } - if (cache->return_cache != NULL) - _pygi_arg_cache_free (cache->return_cache); - g_slice_free1 (cache->n_args * sizeof (PyGIArgCache *), cache->args_cache); - g_slice_free (PyGICallableCache, cache); + return (PyGIArgCache *)ic; } -/* cache generation */ +/* PyGISequenceCache */ -static PyGIInterfaceCache * -_interface_cache_new (GIInterfaceInfo *iface_info) +static void +_sequence_cache_free_func (PyGISequenceCache *cache) { - PyGIInterfaceCache *ic; - - ic = g_slice_new0 (PyGIInterfaceCache); - ( (PyGIArgCache *)ic)->destroy_notify = (GDestroyNotify)_interface_cache_free_func; - ic->g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *)iface_info); - ic->py_type = _pygi_type_import_by_gi_info ( (GIBaseInfo *) iface_info); - - if (ic->py_type == NULL) - return NULL; - - ic->type_name = _pygi_g_base_info_get_fullname (iface_info); - return ic; + if (cache != NULL) { + pygi_arg_cache_free (cache->item_cache); + g_slice_free (PyGISequenceCache, cache); + } } -static PyGISequenceCache * -_sequence_cache_new (GITypeInfo *type_info, - GIDirection direction, - GITransfer transfer, - gssize child_offset) +/* pygi_arg_sequence_setup: + * sc: sequence cache to initialize + * type_info: source for type related attributes to cache + * arg_info: (allow-none): source for argument related attributes to cache + * transfer: transfer mode to store in the argument cache + * direction: marshaling direction to store in the cache + * iface_info: interface info to cache + * + * Initializer for PyGISequenceCache used for holding list and array argument + * caches. + * + * Returns: TRUE on success and FALSE on failure + */ +gboolean +pygi_arg_sequence_setup (PyGISequenceCache *sc, + GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) { - PyGISequenceCache *sc; GITypeInfo *item_type_info; GITransfer item_transfer; - sc = g_slice_new0 (PyGISequenceCache); - ( (PyGIArgCache *)sc)->destroy_notify = (GDestroyNotify)_sequence_cache_free_func; - - sc->is_zero_terminated = g_type_info_is_zero_terminated (type_info); - sc->fixed_size = g_type_info_get_array_fixed_size (type_info); - sc->len_arg_index = g_type_info_get_array_length (type_info); - if (sc->len_arg_index >= 0) - sc->len_arg_index += child_offset; + if (!pygi_arg_base_setup ((PyGIArgCache *)sc, + type_info, + arg_info, + transfer, + direction)) { + return FALSE; + } + sc->arg_cache.destroy_notify = (GDestroyNotify)_sequence_cache_free_func; item_type_info = g_type_info_get_param_type (type_info, 0); - item_transfer = transfer == GI_TRANSFER_CONTAINER ? GI_TRANSFER_NOTHING : transfer; - sc->item_cache = _arg_cache_new (item_type_info, - NULL, - NULL, - item_transfer, - direction, - 0, 0); - - if (sc->item_cache == NULL) { - _pygi_arg_cache_free ( (PyGIArgCache *)sc); - return NULL; - } + sc->item_cache = pygi_arg_cache_new (item_type_info, + NULL, + item_transfer, + direction, + callable_cache, + 0, 0); - sc->item_size = _pygi_g_type_info_size (item_type_info); g_base_info_unref ( (GIBaseInfo *)item_type_info); - return sc; -} -static PyGIHashCache * -_hash_cache_new (GITypeInfo *type_info, - GIDirection direction, - GITransfer transfer) -{ - PyGIHashCache *hc; - GITypeInfo *key_type_info; - GITypeInfo *value_type_info; - GITransfer item_transfer; - - hc = g_slice_new0 (PyGIHashCache); - ( (PyGIArgCache *)hc)->destroy_notify = (GDestroyNotify)_hash_cache_free_func; - key_type_info = g_type_info_get_param_type (type_info, 0); - value_type_info = g_type_info_get_param_type (type_info, 1); - - item_transfer = - transfer == GI_TRANSFER_CONTAINER ? GI_TRANSFER_NOTHING : transfer; - - hc->key_cache = _arg_cache_new (key_type_info, - NULL, - NULL, - item_transfer, - direction, - 0, 0); - - if (hc->key_cache == NULL) { - _pygi_arg_cache_free ( (PyGIArgCache *)hc); - return NULL; - } - - hc->value_cache = _arg_cache_new (value_type_info, - NULL, - NULL, - item_transfer, - direction, - 0, 0); - - if (hc->value_cache == NULL) { - _pygi_arg_cache_free ( (PyGIArgCache *)hc); - return NULL; + if (sc->item_cache == NULL) { + return FALSE; } - g_base_info_unref( (GIBaseInfo *)key_type_info); - g_base_info_unref( (GIBaseInfo *)value_type_info); - - return hc; + return TRUE; } -static PyGICallbackCache * -_callback_cache_new (GIArgInfo *arg_info, - GIInterfaceInfo *iface_info, - gssize child_offset) +PyGIArgCache * +pygi_arg_cache_alloc (void) { - PyGICallbackCache *cc; - - cc = g_slice_new0 (PyGICallbackCache); - ( (PyGIArgCache *)cc)->destroy_notify = (GDestroyNotify)_callback_cache_free_func; - - cc->user_data_index = g_arg_info_get_closure (arg_info); - if (cc->user_data_index != -1) - cc->user_data_index += child_offset; - cc->destroy_notify_index = g_arg_info_get_destroy (arg_info); - if (cc->destroy_notify_index != -1) - cc->destroy_notify_index += child_offset; - cc->scope = g_arg_info_get_scope (arg_info); - g_base_info_ref( (GIBaseInfo *)iface_info); - cc->interface_info = iface_info; - return cc; + return g_slice_new0 (PyGIArgCache); } static PyGIArgCache * -_arg_cache_alloc (void) +_arg_cache_new_for_interface (GIInterfaceInfo *iface_info, + GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) { - return g_slice_new0 (PyGIArgCache); -} + GIInfoType info_type; -static void -_arg_cache_from_py_basic_type_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_basic_type_cache_adapter; -} + info_type = g_base_info_get_type ( (GIBaseInfo *)iface_info); -static void -_arg_cache_to_py_basic_type_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_basic_type_cache_adapter; -} + switch (info_type) { + case GI_INFO_TYPE_CALLBACK: + return pygi_arg_callback_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info, + callable_cache); + case GI_INFO_TYPE_OBJECT: + case GI_INFO_TYPE_INTERFACE: + return pygi_arg_gobject_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info, + callable_cache); + case GI_INFO_TYPE_BOXED: + case GI_INFO_TYPE_STRUCT: + case GI_INFO_TYPE_UNION: + return pygi_arg_struct_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info); + case GI_INFO_TYPE_ENUM: + return pygi_arg_enum_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info); + case GI_INFO_TYPE_FLAGS: + return pygi_arg_flags_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info); + default: + g_assert_not_reached (); + } -static void -_arg_cache_from_py_void_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_void; + return NULL; } -static void -_arg_cache_to_py_void_setup (PyGIArgCache *arg_cache) +PyGIArgCache * +pygi_arg_cache_new (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache, + gssize c_arg_index, + gssize py_arg_index) { - arg_cache->to_py_marshaller = _pygi_marshal_to_py_void; -} + PyGIArgCache *arg_cache = NULL; + GITypeTag type_tag; -static void -_arg_cache_from_py_utf8_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_basic_type_cache_adapter; - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_utf8; -} + type_tag = g_type_info_get_tag (type_info); -static void -_arg_cache_to_py_utf8_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_basic_type_cache_adapter; - arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_utf8; -} + switch (type_tag) { + case GI_TYPE_TAG_VOID: + case GI_TYPE_TAG_BOOLEAN: + case GI_TYPE_TAG_INT8: + case GI_TYPE_TAG_UINT8: + case GI_TYPE_TAG_INT16: + case GI_TYPE_TAG_UINT16: + case GI_TYPE_TAG_INT32: + case GI_TYPE_TAG_UINT32: + case GI_TYPE_TAG_INT64: + case GI_TYPE_TAG_UINT64: + case GI_TYPE_TAG_FLOAT: + case GI_TYPE_TAG_DOUBLE: + case GI_TYPE_TAG_UNICHAR: + case GI_TYPE_TAG_GTYPE: + case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: + arg_cache = pygi_arg_basic_type_new_from_info (type_info, + arg_info, + transfer, + direction); + break; -static gboolean -_arg_cache_from_py_array_setup (PyGIArgCache *arg_cache, - PyGICallableCache *callable_cache, - GITypeInfo *type_info, - GITransfer transfer, - PyGIDirection direction, - gssize arg_index) -{ - PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; - seq_cache->array_type = g_type_info_get_array_type (type_info); + case GI_TYPE_TAG_ARRAY: + { + arg_cache = pygi_arg_garray_new_from_info (type_info, + arg_info, + transfer, + direction, + callable_cache); + if (arg_cache == NULL) + return NULL; + + pygi_arg_garray_len_arg_setup (arg_cache, + type_info, + callable_cache, + direction, + c_arg_index, + &py_arg_index); + } + break; - arg_cache->from_py_marshaller = _pygi_marshal_from_py_array; + case GI_TYPE_TAG_GLIST: + arg_cache = pygi_arg_glist_new_from_info (type_info, + arg_info, + transfer, + direction, + callable_cache); + break; - if (seq_cache->len_arg_index >= 0) { - PyGIArgCache *child_cache = - callable_cache->args_cache[seq_cache->len_arg_index]; + case GI_TYPE_TAG_GSLIST: + arg_cache = pygi_arg_gslist_new_from_info (type_info, + arg_info, + transfer, + direction, + callable_cache); + break; - if (child_cache == NULL) { - child_cache = _arg_cache_alloc (); - } else if (child_cache->meta_type == PYGI_META_ARG_TYPE_CHILD || - child_cache->meta_type == PYGI_META_ARG_TYPE_CHILD_NEEDS_UPDATE) { - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_array; - return TRUE; - } + case GI_TYPE_TAG_GHASH: + arg_cache = pygi_arg_hash_table_new_from_info (type_info, + arg_info, + transfer, + direction, + callable_cache); + break; - if (seq_cache->len_arg_index < arg_index) - child_cache->meta_type = PYGI_META_ARG_TYPE_CHILD_NEEDS_UPDATE; - else - child_cache->meta_type = PYGI_META_ARG_TYPE_CHILD; + case GI_TYPE_TAG_INTERFACE: + { + GIInterfaceInfo *interface_info = g_type_info_get_interface (type_info); + arg_cache = _arg_cache_new_for_interface (interface_info, + type_info, + arg_info, + transfer, + direction, + callable_cache); - child_cache->direction = direction; - child_cache->to_py_marshaller = NULL; - child_cache->from_py_marshaller = NULL; + g_base_info_unref ( (GIBaseInfo *)interface_info); + } + break; - callable_cache->args_cache[seq_cache->len_arg_index] = child_cache; + case GI_TYPE_TAG_ERROR: + arg_cache = pygi_arg_gerror_new_from_info (type_info, + arg_info, + transfer, + direction); + break; + default: + break; } - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_array; - - return TRUE; -} - -static gboolean -_arg_cache_to_py_array_setup (PyGIArgCache *arg_cache, - PyGICallableCache *callable_cache, - GITypeInfo *type_info, - GITransfer transfer, - PyGIDirection direction, - gssize arg_index) -{ - PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; - arg_cache->to_py_marshaller = _pygi_marshal_to_py_array; - arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_array; - - seq_cache->array_type = g_type_info_get_array_type (type_info); - - if (seq_cache->len_arg_index >= 0) { - PyGIArgCache *child_cache = callable_cache->args_cache[seq_cache->len_arg_index]; - if (seq_cache->len_arg_index < arg_index) - callable_cache->n_to_py_child_args++; - - if (child_cache != NULL) { - callable_cache->to_py_args = - g_slist_remove (callable_cache->to_py_args, child_cache); - - if (child_cache->meta_type == PYGI_META_ARG_TYPE_CHILD || - child_cache->meta_type == PYGI_META_ARG_TYPE_CHILD_NEEDS_UPDATE) - return TRUE; - } else { - child_cache = _arg_cache_alloc (); - } - - child_cache->meta_type = PYGI_META_ARG_TYPE_CHILD; - child_cache->direction = direction; - child_cache->to_py_marshaller = NULL; - child_cache->from_py_marshaller = NULL; - - callable_cache->args_cache[seq_cache->len_arg_index] = child_cache; + if (arg_cache != NULL) { + arg_cache->py_arg_index = py_arg_index; + arg_cache->c_arg_index = c_arg_index; } - return TRUE; + return arg_cache; } -static void -_arg_cache_from_py_glist_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_glist; - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_glist; -} +/* PyGICallableCache */ -static void -_arg_cache_to_py_glist_setup (PyGIArgCache *arg_cache, - GITransfer transfer) +static PyGIDirection +_pygi_get_direction (PyGICallableCache *callable_cache, GIDirection gi_direction) { - arg_cache->to_py_marshaller = _pygi_marshal_to_py_glist; - arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_glist; + /* For vfuncs and callbacks our marshalling directions are reversed */ + if (gi_direction == GI_DIRECTION_INOUT) { + return PYGI_DIRECTION_BIDIRECTIONAL; + } else if (gi_direction == GI_DIRECTION_IN) { + if (callable_cache->calling_context != PYGI_CALLING_CONTEXT_IS_FROM_PY) + return PYGI_DIRECTION_TO_PYTHON; + return PYGI_DIRECTION_FROM_PYTHON; + } else { + if (callable_cache->calling_context != PYGI_CALLING_CONTEXT_IS_FROM_PY) + return PYGI_DIRECTION_FROM_PYTHON; + return PYGI_DIRECTION_TO_PYTHON; + } } -static void -_arg_cache_from_py_gslist_setup (PyGIArgCache *arg_cache, - GITransfer transfer) +/* Generate the cache for the callable's arguments */ +static gboolean +_callable_cache_generate_args_cache_real (PyGICallableCache *callable_cache, + GICallableInfo *callable_info) { - arg_cache->from_py_marshaller = _pygi_marshal_from_py_gslist; - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_glist; -} + gint i; + guint arg_index; + GITypeInfo *return_info; + GITransfer return_transfer; + PyGIArgCache *return_cache; + PyGIDirection return_direction; + gssize last_explicit_arg_index; + PyObject *tuple_names; + GSList *arg_cache_item; + PyTypeObject* resulttuple_type; -static void -_arg_cache_to_py_gslist_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_gslist; - arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_glist; -} + /* Return arguments are always considered out */ + return_direction = _pygi_get_direction (callable_cache, GI_DIRECTION_OUT); -static void -_arg_cache_from_py_ghash_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_ghash; - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_ghash; -} + /* cache the return arg */ + return_info = + g_callable_info_get_return_type (callable_info); + return_transfer = + g_callable_info_get_caller_owns (callable_info); + return_cache = + pygi_arg_cache_new (return_info, + NULL, + return_transfer, + return_direction, + callable_cache, + -1, + -1); + if (return_cache == NULL) + return FALSE; -static void -_arg_cache_to_py_ghash_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_ghash; - arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_ghash; -} + return_cache->is_skipped = g_callable_info_skip_return (callable_info); + callable_cache->return_cache = return_cache; + g_base_info_unref (return_info); -static void -_arg_cache_from_py_gerror_setup (PyGIArgCache *arg_cache) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_gerror; - arg_cache->meta_type = PYGI_META_ARG_TYPE_CHILD; -} + callable_cache->user_data_index = -1; -static void -_arg_cache_to_py_gerror_setup (PyGIArgCache *arg_cache) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_gerror; - arg_cache->meta_type = PYGI_META_ARG_TYPE_CHILD; -} + for (i = 0, arg_index = (guint)callable_cache->args_offset; + arg_index < _pygi_callable_cache_args_len (callable_cache); + i++, arg_index++) { + PyGIArgCache *arg_cache = NULL; + GIArgInfo *arg_info; + PyGIDirection direction; -static void -_arg_cache_from_py_interface_union_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct_cache_adapter; -} + arg_info = g_callable_info_get_arg (callable_info, i); -static void -_arg_cache_to_py_interface_union_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct_cache_adapter; -} + /* This only happens when dealing with callbacks */ + if (g_arg_info_get_closure (arg_info) == i) { + callable_cache->user_data_index = i; -static void -_arg_cache_from_py_interface_struct_setup (PyGIArgCache *arg_cache, - GIInterfaceInfo *iface_info, - GITransfer transfer) -{ - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info); - arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_struct_cache_adapter; - - if (iface_cache->g_type == G_TYPE_VALUE) - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_struct_gvalue; - else if (iface_cache->is_foreign) - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_struct_foreign; -} + arg_cache = pygi_arg_cache_alloc (); + _pygi_callable_cache_set_arg (callable_cache, arg_index, arg_cache); -static void -_arg_cache_to_py_interface_struct_setup (PyGIArgCache *arg_cache, - GIInterfaceInfo *iface_info, - GITransfer transfer) -{ - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info); - arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_struct_cache_adapter; + direction = _pygi_get_direction (callable_cache, GI_DIRECTION_IN); + arg_cache->direction = direction; + arg_cache->meta_type = PYGI_META_ARG_TYPE_CLOSURE; + arg_cache->c_arg_index = i; + arg_cache->is_pointer = TRUE; - if (iface_cache->is_foreign) - arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_struct_foreign; -} + } else { + GITypeInfo *type_info; + + direction = _pygi_get_direction (callable_cache, + g_arg_info_get_direction (arg_info)); + type_info = g_arg_info_get_type (arg_info); + + /* must be an child arg filled in by its owner + * and continue + * fill in it's c_arg_index, add to the in count + */ + arg_cache = _pygi_callable_cache_get_arg (callable_cache, arg_index); + if (arg_cache != NULL) { + /* ensure c_arg_index always aligns with callable_cache->args_cache + * and all of the various PyGIInvokeState arrays. */ + arg_cache->c_arg_index = arg_index; + + if (arg_cache->meta_type == PYGI_META_ARG_TYPE_CHILD_WITH_PYARG) { + arg_cache->py_arg_index = callable_cache->n_py_args; + callable_cache->n_py_args++; + } -static void -_arg_cache_from_py_interface_object_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_object; - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_object; -} + if (direction & PYGI_DIRECTION_TO_PYTHON) { + callable_cache->n_to_py_args++; + } -static void -_arg_cache_to_py_interface_object_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_object_cache_adapter; - arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_object; -} + arg_cache->type_tag = g_type_info_get_tag (type_info); -static void -_arg_cache_from_py_interface_callback_setup (PyGIArgCache *arg_cache, - PyGICallableCache *callable_cache) -{ - PyGICallbackCache *callback_cache = (PyGICallbackCache *)arg_cache; - if (callback_cache->user_data_index >= 0) { - PyGIArgCache *user_data_arg_cache = _arg_cache_alloc (); - user_data_arg_cache->meta_type = PYGI_META_ARG_TYPE_CHILD_WITH_PYARG; - user_data_arg_cache->direction = PYGI_DIRECTION_FROM_PYTHON; - callable_cache->args_cache[callback_cache->user_data_index] = user_data_arg_cache; - } + } else { + GITransfer transfer; + gssize py_arg_index = -1; - if (callback_cache->destroy_notify_index >= 0) { - PyGIArgCache *destroy_arg_cache = _arg_cache_alloc (); - destroy_arg_cache->meta_type = PYGI_META_ARG_TYPE_CHILD; - destroy_arg_cache->direction = PYGI_DIRECTION_FROM_PYTHON; - callable_cache->args_cache[callback_cache->destroy_notify_index] = destroy_arg_cache; - } - arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_callback; - arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_callback; -} + transfer = g_arg_info_get_ownership_transfer (arg_info); -static void -_arg_cache_to_py_interface_callback_setup (void) -{ - PyErr_Format(PyExc_NotImplementedError, - "Callback returns are not supported"); -} + if (direction & PYGI_DIRECTION_FROM_PYTHON) { + py_arg_index = callable_cache->n_py_args; + callable_cache->n_py_args++; + } -static void -_arg_cache_from_py_interface_enum_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_enum; -} + arg_cache = + pygi_arg_cache_new (type_info, + arg_info, + transfer, + direction, + callable_cache, + arg_index, + py_arg_index); + + if (arg_cache == NULL) { + g_base_info_unref( (GIBaseInfo *)type_info); + g_base_info_unref( (GIBaseInfo *)arg_info); + return FALSE; + } -static void -_arg_cache_to_py_interface_enum_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_enum; -} -static void -_arg_cache_from_py_interface_flags_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_flags; -} + if (direction & PYGI_DIRECTION_TO_PYTHON) { + callable_cache->n_to_py_args++; -static void -_arg_cache_to_py_interface_flags_setup (PyGIArgCache *arg_cache, - GITransfer transfer) -{ - arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_flags; -} + callable_cache->to_py_args = + g_slist_append (callable_cache->to_py_args, arg_cache); + } -PyGIArgCache * -_arg_cache_new_for_interface (GIInterfaceInfo *iface_info, - PyGICallableCache *callable_cache, - GIArgInfo *arg_info, - GITransfer transfer, - PyGIDirection direction, - gssize c_arg_index, - gssize py_arg_index) -{ - PyGIInterfaceCache *iface_cache = NULL; - PyGIArgCache *arg_cache = NULL; - gssize child_offset = 0; - GIInfoType info_type; + _pygi_callable_cache_set_arg (callable_cache, arg_index, arg_cache); + } - if (callable_cache != NULL) - child_offset = - (callable_cache->function_type == PYGI_FUNCTION_TYPE_METHOD || - callable_cache->function_type == PYGI_FUNCTION_TYPE_VFUNC) ? 1: 0; + g_base_info_unref (type_info); + } - info_type = g_base_info_get_type ( (GIBaseInfo *)iface_info); + /* Ensure arguments always have a name when available */ + arg_cache->arg_name = g_base_info_get_name ((GIBaseInfo *) arg_info); - /* Callbacks are special cased */ - if (info_type != GI_INFO_TYPE_CALLBACK) { - iface_cache = _interface_cache_new (iface_info); + g_base_info_unref ( (GIBaseInfo *)arg_info); - arg_cache = (PyGIArgCache *)iface_cache; - if (arg_cache == NULL) - return NULL; } - switch (info_type) { - case GI_INFO_TYPE_UNION: - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_interface_union_setup (arg_cache, transfer); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_interface_union_setup (arg_cache, transfer); - - break; - case GI_INFO_TYPE_BOXED: - case GI_INFO_TYPE_STRUCT: - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_interface_struct_setup (arg_cache, - iface_info, - transfer); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_interface_struct_setup (arg_cache, - iface_info, - transfer); - break; - case GI_INFO_TYPE_OBJECT: - case GI_INFO_TYPE_INTERFACE: - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_interface_object_setup (arg_cache, transfer); - - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_interface_object_setup (arg_cache, transfer); - - break; - case GI_INFO_TYPE_CALLBACK: - { - PyGICallbackCache *callback_cache; + if (callable_cache->arg_name_hash == NULL) { + callable_cache->arg_name_hash = g_hash_table_new (g_str_hash, g_str_equal); + } else { + g_hash_table_remove_all (callable_cache->arg_name_hash); + } + callable_cache->n_py_required_args = 0; + callable_cache->user_data_varargs_index = -1; - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) { - _arg_cache_to_py_interface_callback_setup (); - return NULL; - } + last_explicit_arg_index = -1; - callback_cache = - _callback_cache_new (arg_info, - iface_info, - child_offset); + /* Reverse loop through all the arguments to setup arg_name_list/hash + * and find the number of required arguments */ + for (i=(_pygi_callable_cache_args_len (callable_cache))-1; i >= 0; i--) { + PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (callable_cache, i); - arg_cache = (PyGIArgCache *)callback_cache; - if (arg_cache == NULL) - return NULL; + if (arg_cache->meta_type != PYGI_META_ARG_TYPE_CHILD && + arg_cache->meta_type != PYGI_META_ARG_TYPE_CLOSURE && + arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON) { - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_interface_callback_setup (arg_cache, callable_cache); + /* Setup arg_name_list and arg_name_hash */ + gpointer arg_name = (gpointer)arg_cache->arg_name; + callable_cache->arg_name_list = g_slist_prepend (callable_cache->arg_name_list, + arg_name); + if (arg_name != NULL) { + g_hash_table_insert (callable_cache->arg_name_hash, + arg_name, + GINT_TO_POINTER(i)); + } - break; + /* The first tail argument without a default will force all the preceding + * argument defaults off. This limits support of default args to the + * tail of an args list. + */ + if (callable_cache->n_py_required_args > 0) { + arg_cache->has_default = FALSE; + callable_cache->n_py_required_args += 1; + } else if (!arg_cache->has_default) { + callable_cache->n_py_required_args += 1; } - case GI_INFO_TYPE_ENUM: - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_interface_enum_setup (arg_cache, transfer); - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_interface_enum_setup (arg_cache, transfer); + if (last_explicit_arg_index == -1) { + last_explicit_arg_index = i; - break; - case GI_INFO_TYPE_FLAGS: - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_interface_flags_setup (arg_cache, transfer); + /* If the last "from python" argument in the args list is a child + * with pyarg (currently only callback user_data). Set it to eat + * variable args in the callable cache. + */ + if (arg_cache->meta_type == PYGI_META_ARG_TYPE_CHILD_WITH_PYARG) + callable_cache->user_data_varargs_index = i; + } + } + } - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_interface_flags_setup (arg_cache, transfer); + if (!return_cache->is_skipped && return_cache->type_tag != GI_TYPE_TAG_VOID) { + callable_cache->has_return = TRUE; + } - break; - default: - g_assert_not_reached (); + tuple_names = PyList_New (0); + if (callable_cache->has_return) { + PyList_Append (tuple_names, Py_None); } - if (arg_cache != NULL) { - arg_cache->direction = direction; - arg_cache->transfer = transfer; - arg_cache->type_tag = GI_TYPE_TAG_INTERFACE; - arg_cache->py_arg_index = py_arg_index; - arg_cache->c_arg_index = c_arg_index; + arg_cache_item = callable_cache->to_py_args; + while (arg_cache_item) { + const gchar *arg_name = ((PyGIArgCache *)arg_cache_item->data)->arg_name; + PyObject *arg_string = PyUnicode_FromString (arg_name); + PyList_Append (tuple_names, arg_string); + Py_DECREF (arg_string); + arg_cache_item = arg_cache_item->next; + } - if (iface_cache != NULL) { - g_base_info_ref ( (GIBaseInfo *)iface_info); - iface_cache->interface_info = iface_info; + /* No need to create a tuple type if there aren't multiple values */ + if (PyList_Size (tuple_names) > 1) { + resulttuple_type = pygi_resulttuple_new_type (tuple_names); + if (resulttuple_type == NULL) { + Py_DECREF (tuple_names); + return FALSE; + } else { + callable_cache->resulttuple_type = resulttuple_type; } } + Py_DECREF (tuple_names); - return arg_cache; + return TRUE; } -PyGIArgCache * -_arg_cache_new (GITypeInfo *type_info, - PyGICallableCache *callable_cache, - GIArgInfo *arg_info, - GITransfer transfer, - PyGIDirection direction, - gssize c_arg_index, - gssize py_arg_index) +static void +_callable_cache_deinit_real (PyGICallableCache *cache) { - PyGIArgCache *arg_cache = NULL; - gssize child_offset = 0; - GITypeTag type_tag; + g_clear_pointer (&cache->to_py_args, g_slist_free); + g_clear_pointer (&cache->arg_name_list, g_slist_free); + g_clear_pointer (&cache->arg_name_hash, g_hash_table_unref); + g_clear_pointer (&cache->args_cache, g_ptr_array_unref); + Py_CLEAR (cache->resulttuple_type); - type_tag = g_type_info_get_tag (type_info); + g_clear_pointer (&cache->return_cache, pygi_arg_cache_free); +} - if (callable_cache != NULL) - child_offset = - (callable_cache->function_type == PYGI_FUNCTION_TYPE_METHOD || - callable_cache->function_type == PYGI_FUNCTION_TYPE_VFUNC) ? 1: 0; +static gboolean +_callable_cache_init (PyGICallableCache *cache, + GICallableInfo *callable_info) +{ + gint n_args; + GIBaseInfo *container; + + if (cache->deinit == NULL) + cache->deinit = _callable_cache_deinit_real; + + if (cache->generate_args_cache == NULL) + cache->generate_args_cache = _callable_cache_generate_args_cache_real; + + cache->name = g_base_info_get_name ((GIBaseInfo *) callable_info); + cache->namespace = g_base_info_get_namespace ((GIBaseInfo *) callable_info); + container = g_base_info_get_container ((GIBaseInfo *) callable_info); + cache->container_name = NULL; + /* https://bugzilla.gnome.org/show_bug.cgi?id=709456 */ + if (container != NULL && g_base_info_get_type (container) != GI_INFO_TYPE_TYPE) { + cache->container_name = g_base_info_get_name (container); + } + cache->throws = g_callable_info_can_throw_gerror ((GIBaseInfo *) callable_info); - switch (type_tag) { - case GI_TYPE_TAG_VOID: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; + if (g_base_info_is_deprecated (callable_info)) { + const gchar *deprecated = g_base_info_get_attribute (callable_info, "deprecated"); + gchar *warning; + gchar *full_name = pygi_callable_cache_get_full_name (cache); + if (deprecated != NULL) + warning = g_strdup_printf ("%s is deprecated: %s", + full_name, + deprecated); + else + warning = g_strdup_printf ("%s is deprecated", + full_name); + g_free (full_name); + PyErr_WarnEx (PyExc_DeprecationWarning, warning, 0); + g_free (warning); + } - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_void_setup (arg_cache); + n_args = (gint)cache->args_offset + g_callable_info_get_n_args (callable_info); - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_void_setup (arg_cache); + if (n_args >= 0) { + cache->args_cache = g_ptr_array_new_full (n_args, (GDestroyNotify) pygi_arg_cache_free); + g_ptr_array_set_size (cache->args_cache, n_args); + } - break; - case GI_TYPE_TAG_BOOLEAN: - case GI_TYPE_TAG_INT8: - case GI_TYPE_TAG_UINT8: - case GI_TYPE_TAG_INT16: - case GI_TYPE_TAG_UINT16: - case GI_TYPE_TAG_INT32: - case GI_TYPE_TAG_UINT32: - case GI_TYPE_TAG_INT64: - case GI_TYPE_TAG_UINT64: - case GI_TYPE_TAG_FLOAT: - case GI_TYPE_TAG_DOUBLE: - case GI_TYPE_TAG_UNICHAR: - case GI_TYPE_TAG_GTYPE: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; + if (!cache->generate_args_cache (cache, callable_info)) { + _callable_cache_deinit_real (cache); + return FALSE; + } - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_basic_type_setup (arg_cache); + return TRUE; +} - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_basic_type_setup (arg_cache); +gchar * +pygi_callable_cache_get_full_name (PyGICallableCache *cache) +{ + if (cache->container_name != NULL) { + return g_strjoin (".", + cache->namespace, + cache->container_name, + cache->name, + NULL); + } else { + return g_strjoin (".", + cache->namespace, + cache->name, + NULL); + } +} - break; - case GI_TYPE_TAG_UTF8: - case GI_TYPE_TAG_FILENAME: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; +void +pygi_callable_cache_free (PyGICallableCache *cache) +{ + cache->deinit (cache); + g_free (cache); +} - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_utf8_setup (arg_cache, transfer); +/* PyGIFunctionCache */ - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_utf8_setup (arg_cache, transfer); +static PyObject * +_function_cache_invoke_real (PyGIFunctionCache *function_cache, + PyGIInvokeState *state, + PyObject *py_args, + PyObject *py_kwargs) +{ + return pygi_invoke_c_callable (function_cache, state, + py_args, py_kwargs); +} - break; - case GI_TYPE_TAG_ARRAY: - { - PyGISequenceCache *seq_cache = - _sequence_cache_new (type_info, - direction, - transfer, - child_offset); +static void +_function_cache_deinit_real (PyGICallableCache *callable_cache) +{ + g_function_invoker_destroy (&((PyGIFunctionCache *) callable_cache)->invoker); - arg_cache = (PyGIArgCache *)seq_cache; - if (arg_cache == NULL) - break; + _callable_cache_deinit_real (callable_cache); +} - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_array_setup (arg_cache, - callable_cache, - type_info, - transfer, - direction, - c_arg_index); +static gboolean +_function_cache_init (PyGIFunctionCache *function_cache, + GICallableInfo *callable_info) +{ + PyGICallableCache *callable_cache = (PyGICallableCache *) function_cache; + GIFunctionInvoker *invoker = &function_cache->invoker; + GError *error = NULL; - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_array_setup (arg_cache, - callable_cache, - type_info, - transfer, - direction, - c_arg_index); - - /* ugly edge case code: - * - * length can come before the array parameter which means we - * need to update indexes if this happens - */ - if (seq_cache->len_arg_index > -1 && - callable_cache->args_cache[seq_cache->len_arg_index]->meta_type == PYGI_META_ARG_TYPE_CHILD_NEEDS_UPDATE) { - gssize i; - PyGIArgCache *child_cache = - callable_cache->args_cache[seq_cache->len_arg_index]; - - child_cache->meta_type = PYGI_META_ARG_TYPE_CHILD; - py_arg_index -= 1; - callable_cache->n_py_args -= 1; - - for (i = seq_cache->len_arg_index + 1; - i < callable_cache->n_args; - i++) { - PyGIArgCache *update_cache = callable_cache->args_cache[i]; - if (update_cache == NULL) - break; - - update_cache->py_arg_index -= 1; - } - } - - break; - } - case GI_TYPE_TAG_GLIST: - { - PyGISequenceCache *seq_cache = - _sequence_cache_new (type_info, - direction, - transfer, - child_offset); + callable_cache->calling_context = PYGI_CALLING_CONTEXT_IS_FROM_PY; - arg_cache = (PyGIArgCache *)seq_cache; - if (arg_cache == NULL) - break; + if (callable_cache->deinit == NULL) + callable_cache->deinit = _function_cache_deinit_real; - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_glist_setup (arg_cache, transfer); + if (function_cache->invoke == NULL) + function_cache->invoke = _function_cache_invoke_real; - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_glist_setup (arg_cache, transfer); + if (!_callable_cache_init (callable_cache, callable_info)) + return FALSE; + /* Set by PyGICCallbackCache and PyGIVFuncCache */ + if (invoker->native_address == NULL) { + if (g_function_info_prep_invoker ((GIFunctionInfo *) callable_info, + invoker, + &error)) { + return TRUE; + } + } else { + if (g_function_invoker_new_for_address (invoker->native_address, + (GIFunctionInfo *) callable_info, + invoker, + &error)) { + return TRUE; + } + } - break; - } - case GI_TYPE_TAG_GSLIST: - { - PyGISequenceCache *seq_cache = - _sequence_cache_new (type_info, - direction, - transfer, - child_offset); + if (!pygi_error_check (&error)) { + PyErr_Format (PyExc_RuntimeError, + "unknown error creating invoker for %s", + g_base_info_get_name ((GIBaseInfo *) callable_info)); + } - arg_cache = (PyGIArgCache *)seq_cache; - if (arg_cache == NULL) - break; + _callable_cache_deinit_real (callable_cache); + return FALSE; +} - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_gslist_setup (arg_cache, transfer); +PyGIFunctionCache * +pygi_function_cache_new (GICallableInfo *info) +{ + PyGIFunctionCache *function_cache; - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_gslist_setup (arg_cache, transfer); + function_cache = g_new0 (PyGIFunctionCache, 1); - break; - } - case GI_TYPE_TAG_GHASH: - arg_cache = - (PyGIArgCache *)_hash_cache_new (type_info, - direction, - transfer); + if (!_function_cache_init (function_cache, info)) { + g_free (function_cache); + return NULL; + } - if (arg_cache == NULL) - break; + return function_cache; +} - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_ghash_setup (arg_cache); +PyObject * +pygi_function_cache_invoke (PyGIFunctionCache *function_cache, + PyObject *py_args, + PyObject *py_kwargs) +{ + PyGIInvokeState state = { 0, }; - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) { - _arg_cache_to_py_ghash_setup (arg_cache); - } + return function_cache->invoke (function_cache, &state, + py_args, py_kwargs); +} - break; - case GI_TYPE_TAG_INTERFACE: - { - GIInterfaceInfo *interface_info = g_type_info_get_interface (type_info); - arg_cache = _arg_cache_new_for_interface (interface_info, - callable_cache, - arg_info, - transfer, - direction, - c_arg_index, - py_arg_index); +/* PyGICCallbackCache */ - g_base_info_unref ( (GIBaseInfo *)interface_info); - break; - } - case GI_TYPE_TAG_ERROR: - arg_cache = _arg_cache_alloc (); - if (arg_cache == NULL) - break; +PyGIFunctionCache * +pygi_ccallback_cache_new (GICallableInfo *info, + GCallback function_ptr) +{ + PyGICCallbackCache *ccallback_cache; + PyGIFunctionCache *function_cache; - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_from_py_gerror_setup (arg_cache); + ccallback_cache = g_new0 (PyGICCallbackCache, 1); + function_cache = (PyGIFunctionCache *) ccallback_cache; - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) - _arg_cache_to_py_gerror_setup (arg_cache); + function_cache->invoker.native_address = function_ptr; - break; - } + if (!_function_cache_init (function_cache, info)) { + g_free (ccallback_cache); + return NULL; + } - if (arg_cache != NULL) { - arg_cache->direction = direction; - arg_cache->transfer = transfer; - arg_cache->type_tag = type_tag; - arg_cache->py_arg_index = py_arg_index; - arg_cache->c_arg_index = c_arg_index; - arg_cache->is_pointer = g_type_info_is_pointer (type_info); - g_base_info_ref ( (GIBaseInfo *) type_info); - arg_cache->type_info = type_info; - } + return function_cache; +} - return arg_cache; +PyObject * +pygi_ccallback_cache_invoke (PyGICCallbackCache *ccallback_cache, + PyObject *py_args, + PyObject *py_kwargs, + gpointer user_data) +{ + PyGIFunctionCache *function_cache = (PyGIFunctionCache *) ccallback_cache; + PyGIInvokeState state = { 0, }; + + state.user_data = user_data; + + return function_cache->invoke (function_cache, &state, + py_args, py_kwargs); } -static void -_arg_name_list_generate (PyGICallableCache *callable_cache) +/* PyGIConstructorCache */ + +static PyObject * +_constructor_cache_invoke_real (PyGIFunctionCache *function_cache, + PyGIInvokeState *state, + PyObject *py_args, + PyObject *py_kwargs) { - GSList * arg_name_list = NULL; - int i; + PyGICallableCache *cache = (PyGICallableCache *) function_cache; + PyObject *constructor_class; + PyObject *ret; + + constructor_class = PyTuple_GetItem (py_args, 0); + if (constructor_class == NULL) { + gchar *full_name = pygi_callable_cache_get_full_name (cache); + PyErr_Clear (); + PyErr_Format (PyExc_TypeError, + "Constructors require the class to be passed in as an argument, " + "No arguments passed to the %s constructor.", + full_name); + g_free (full_name); - if (callable_cache->arg_name_hash == NULL) { - callable_cache->arg_name_hash = g_hash_table_new (g_str_hash, g_str_equal); - } else { - g_hash_table_remove_all (callable_cache->arg_name_hash); + return FALSE; } - for (i=0; i < callable_cache->n_args; i++) { - PyGIArgCache *arg_cache = NULL; - - arg_cache = callable_cache->args_cache[i]; + py_args = PyTuple_GetSlice (py_args, 1, PyTuple_Size (py_args)); + ret = _function_cache_invoke_real (function_cache, state, + py_args, py_kwargs); + Py_DECREF (py_args); - if (arg_cache->meta_type != PYGI_META_ARG_TYPE_CHILD && - arg_cache->meta_type != PYGI_META_ARG_TYPE_CLOSURE && - (arg_cache->direction == PYGI_DIRECTION_FROM_PYTHON || - arg_cache->direction == PYGI_DIRECTION_BIDIRECTIONAL)) { + if (ret == NULL || cache->return_cache->is_skipped) + return ret; - gpointer arg_name = (gpointer)arg_cache->arg_name; + if (ret != Py_None) { + if (!PyTuple_Check (ret)) + return ret; - arg_name_list = g_slist_prepend (arg_name_list, arg_name); - if (arg_name != NULL) { - g_hash_table_insert (callable_cache->arg_name_hash, arg_name, arg_name); - } - } + if (PyTuple_GET_ITEM (ret, 0) != Py_None) + return ret; } - callable_cache->arg_name_list = g_slist_reverse (arg_name_list); + PyErr_SetString (PyExc_TypeError, "constructor returned NULL"); + + Py_DECREF (ret); + return NULL; } -/* Generate the cache for the callable's arguments */ -static gboolean -_args_cache_generate (GICallableInfo *callable_info, - PyGICallableCache *callable_cache) +PyGIFunctionCache * +pygi_constructor_cache_new (GICallableInfo *info) { - gssize arg_index = 0; - gssize i; - GITypeInfo *return_info; - GITransfer return_transfer; - PyGIArgCache *return_cache; - PyGIDirection return_direction; + PyGIConstructorCache *constructor_cache; + PyGIFunctionCache *function_cache; - /* determine if we are marshalling the return to or from python */ - if (callable_cache->function_type == PYGI_FUNCTION_TYPE_CALLBACK) - return_direction = PYGI_DIRECTION_FROM_PYTHON; - else - return_direction = PYGI_DIRECTION_TO_PYTHON; - - /* cache the return arg */ - return_info = - g_callable_info_get_return_type (callable_info); - return_transfer = - g_callable_info_get_caller_owns (callable_info); - return_cache = - _arg_cache_new (return_info, - callable_cache, - NULL, - return_transfer, - return_direction, - -1, - -1); - if (return_cache == NULL) - return FALSE; + constructor_cache = g_new0 (PyGIConstructorCache, 1); + function_cache = (PyGIFunctionCache *) constructor_cache; - return_cache->is_skipped = g_callable_info_skip_return (callable_info); - callable_cache->return_cache = return_cache; - g_base_info_unref (return_info); + function_cache->invoke = _constructor_cache_invoke_real; - /* first arg is the instance */ - if (callable_cache->function_type == PYGI_FUNCTION_TYPE_METHOD || - callable_cache->function_type == PYGI_FUNCTION_TYPE_VFUNC) { - GIInterfaceInfo *interface_info; - PyGIArgCache *instance_cache; - PyGIDirection instance_direction; + if (!_function_cache_init (function_cache, info)) { + g_free (constructor_cache); + return NULL; + } - instance_direction = PYGI_DIRECTION_FROM_PYTHON; + return function_cache; +} +/* PyGIFunctionWithInstanceCache */ - interface_info = g_base_info_get_container ( (GIBaseInfo *)callable_info); +static gboolean +_function_with_instance_cache_generate_args_cache_real (PyGICallableCache *callable_cache, + GICallableInfo *callable_info) +{ + GIInterfaceInfo *interface_info; + PyGIArgCache *instance_cache; + GITransfer transfer; - instance_cache = - _arg_cache_new_for_interface (interface_info, - callable_cache, - NULL, - GI_TRANSFER_NOTHING, - instance_direction, - arg_index, - 0); + interface_info = g_base_info_get_container ((GIBaseInfo *) callable_info); + transfer = g_callable_info_get_instance_ownership_transfer (callable_info); - /* FIXME: marshal interfaces from_py */ - instance_cache->from_py_marshaller = _pygi_marshal_from_py_interface_instance; - g_base_info_unref ( (GIBaseInfo *)interface_info); + instance_cache = + _arg_cache_new_for_interface (interface_info, + NULL, + NULL, + transfer, + PYGI_DIRECTION_FROM_PYTHON, + callable_cache); - if (instance_cache == NULL) - return FALSE; + if (instance_cache == NULL) + return FALSE; - callable_cache->args_cache[arg_index] = instance_cache; + /* Because we are not supplied a GITypeInfo for instance arguments, + * assume some defaults. */ + instance_cache->is_pointer = TRUE; + instance_cache->py_arg_index = 0; + instance_cache->c_arg_index = 0; - arg_index++; - callable_cache->n_from_py_args++; - callable_cache->n_py_args++; - } + _pygi_callable_cache_set_arg (callable_cache, 0, instance_cache); + callable_cache->n_py_args++; - for (i=0; arg_index < callable_cache->n_args; arg_index++, i++) { - PyGIArgCache *arg_cache = NULL; - GIArgInfo *arg_info; - GITypeInfo *type_info; - GIDirection gi_direction; - PyGIDirection direction; - GITransfer transfer; - GITypeTag type_tag; - gboolean is_caller_allocates = FALSE; - gssize py_arg_index = -1; + return _callable_cache_generate_args_cache_real (callable_cache, + callable_info); +} - arg_info = g_callable_info_get_arg (callable_info, i); +static gboolean +_function_with_instance_cache_init (PyGIFunctionWithInstanceCache *fwi_cache, + GICallableInfo *info) +{ + PyGICallableCache *callable_cache = (PyGICallableCache *) fwi_cache; - if (g_arg_info_get_closure (arg_info) == i) { + callable_cache->args_offset += 1; + callable_cache->generate_args_cache = _function_with_instance_cache_generate_args_cache_real; - arg_cache = _arg_cache_alloc (); - callable_cache->args_cache[arg_index] = arg_cache; + return _function_cache_init ((PyGIFunctionCache *) fwi_cache, info); +} - arg_cache->arg_name = g_base_info_get_name ((GIBaseInfo *) arg_info); - arg_cache->direction = PYGI_DIRECTION_FROM_PYTHON; - arg_cache->meta_type = PYGI_META_ARG_TYPE_CLOSURE; - arg_cache->c_arg_index = i; +/* PyGIMethodCache */ - callable_cache->n_from_py_args++; +PyGIFunctionCache * +pygi_method_cache_new (GICallableInfo *info) +{ + PyGIMethodCache *method_cache; + PyGIFunctionWithInstanceCache *fwi_cache; - g_base_info_unref ( (GIBaseInfo *)arg_info); + method_cache = g_new0 (PyGIMethodCache, 1); + fwi_cache = (PyGIFunctionWithInstanceCache *) method_cache; - continue; - } + if (!_function_with_instance_cache_init (fwi_cache, info)) { + g_free (method_cache); + return NULL; + } - /* For vfuncs and callbacks our marshalling directions - are reversed */ - gi_direction = g_arg_info_get_direction (arg_info); - if (gi_direction == GI_DIRECTION_INOUT) { - direction = PYGI_DIRECTION_BIDIRECTIONAL; - } else if (gi_direction == GI_DIRECTION_IN) { - direction = PYGI_DIRECTION_FROM_PYTHON; - if (callable_cache->function_type == PYGI_FUNCTION_TYPE_CALLBACK) - direction = PYGI_DIRECTION_TO_PYTHON; - } else { - direction = PYGI_DIRECTION_TO_PYTHON; - if (callable_cache->function_type == PYGI_FUNCTION_TYPE_CALLBACK) - direction = PYGI_DIRECTION_FROM_PYTHON; - } + return (PyGIFunctionCache *) method_cache; +} - transfer = g_arg_info_get_ownership_transfer (arg_info); - type_info = g_arg_info_get_type (arg_info); - type_tag = g_type_info_get_tag (type_info); - - if (type_tag == GI_TYPE_TAG_INTERFACE || type_tag == GI_TYPE_TAG_ARRAY) - is_caller_allocates = g_arg_info_is_caller_allocates (arg_info); - - /* must be an child arg filled in by its owner - * and continue - * fill in it's c_arg_index, add to the in count - */ - if (callable_cache->args_cache[arg_index] != NULL) { - arg_cache = callable_cache->args_cache[arg_index]; - if (arg_cache->meta_type == PYGI_META_ARG_TYPE_CHILD_WITH_PYARG) { - arg_cache->py_arg_index = callable_cache->n_py_args; - callable_cache->n_py_args++; - } +/* PyGIVFuncCache */ - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) { - arg_cache->c_arg_index = callable_cache->n_from_py_args; - callable_cache->n_from_py_args++; - } +static PyObject * +_vfunc_cache_invoke_real (PyGIFunctionCache *function_cache, + PyGIInvokeState *state, + PyObject *py_args, + PyObject *py_kwargs) +{ + PyGIVFuncCache *vfunc_cache = (PyGIVFuncCache *) function_cache; + PyObject *py_gtype; + GType implementor_gtype; + GError *error = NULL; + PyObject *ret; + + py_gtype = PyTuple_GetItem (py_args, 0); + if (py_gtype == NULL) { + PyErr_SetString (PyExc_TypeError, + "need the GType of the implementor class"); + return FALSE; + } - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) { - callable_cache->n_to_py_args++; - callable_cache->n_to_py_child_args++; - } + implementor_gtype = pyg_type_from_object (py_gtype); + if (implementor_gtype == G_TYPE_INVALID) + return FALSE; - arg_cache->type_tag = g_type_info_get_tag (type_info); + /* vfunc addresses are pulled into the state at call time and cannot be + * cached because the call site can specify a different portion of the + * class hierarchy. e.g. Object.do_func vs. SubObject.do_func might + * retrieve a different vfunc address but GI gives us the same vfunc info. + */ + state->function_ptr = g_vfunc_info_get_address ((GIVFuncInfo *) vfunc_cache->info, + implementor_gtype, + &error); + if (pygi_error_check (&error)) { + return FALSE; + } - g_base_info_unref (type_info); - g_base_info_unref ( (GIBaseInfo *)arg_info); - continue; - } + py_args = PyTuple_GetSlice (py_args, 1, PyTuple_Size (py_args)); + ret = _function_cache_invoke_real (function_cache, state, + py_args, py_kwargs); + Py_DECREF (py_args); - if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) { - py_arg_index = callable_cache->n_py_args; - callable_cache->n_from_py_args++; - callable_cache->n_py_args++; - } + return ret; +} - arg_cache = - _arg_cache_new (type_info, - callable_cache, - arg_info, - transfer, - direction, - arg_index, - py_arg_index); +static void +_vfunc_cache_deinit_real (PyGICallableCache *callable_cache) +{ + g_base_info_unref (((PyGIVFuncCache *) callable_cache)->info); - if (arg_cache == NULL) - goto arg_err; + _function_cache_deinit_real (callable_cache); +} - arg_cache->arg_name = g_base_info_get_name ((GIBaseInfo *) arg_info); - arg_cache->allow_none = g_arg_info_may_be_null(arg_info); - arg_cache->is_caller_allocates = is_caller_allocates; +PyGIFunctionCache * +pygi_vfunc_cache_new (GICallableInfo *info) +{ + PyGIVFuncCache *vfunc_cache; + PyGIFunctionCache *function_cache; + PyGIFunctionWithInstanceCache *fwi_cache; - if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL) { - callable_cache->n_to_py_args++; + vfunc_cache = g_new0 (PyGIVFuncCache, 1); + function_cache = (PyGIFunctionCache *) vfunc_cache; + fwi_cache = (PyGIFunctionWithInstanceCache *) vfunc_cache; - if (arg_cache == NULL) - goto arg_err; + ((PyGICallableCache *) vfunc_cache)->deinit = _vfunc_cache_deinit_real; - callable_cache->to_py_args = - g_slist_append (callable_cache->to_py_args, arg_cache); - } + /* This must be non-NULL for _function_cache_init() to create the + * invoker, the real address will be set in _vfunc_cache_invoke_real(). + */ + function_cache->invoker.native_address = (gpointer) 0xdeadbeef; - callable_cache->args_cache[arg_index] = arg_cache; - g_base_info_unref( (GIBaseInfo *)type_info); - g_base_info_unref( (GIBaseInfo *)arg_info); + function_cache->invoke = _vfunc_cache_invoke_real; - continue; -arg_err: - g_base_info_unref( (GIBaseInfo *)type_info); - g_base_info_unref( (GIBaseInfo *)arg_info); - return FALSE; + if (!_function_with_instance_cache_init (fwi_cache, info)) { + g_free (vfunc_cache); + return NULL; } - _arg_name_list_generate (callable_cache); + /* Required by _vfunc_cache_invoke_real() */ + vfunc_cache->info = g_base_info_ref ((GIBaseInfo *) info); - return TRUE; + return function_cache; } -PyGICallableCache * -_pygi_callable_cache_new (GICallableInfo *callable_info, gboolean is_ccallback) -{ - PyGICallableCache *cache; - GIInfoType type = g_base_info_get_type ( (GIBaseInfo *)callable_info); +/* PyGIClosureCache */ - cache = g_slice_new0 (PyGICallableCache); +PyGIClosureCache * +pygi_closure_cache_new (GICallableInfo *info) +{ + gssize i; + PyGIClosureCache *closure_cache; + PyGICallableCache *callable_cache; - if (cache == NULL) - return NULL; + closure_cache = g_new0 (PyGIClosureCache, 1); + callable_cache = (PyGICallableCache *) closure_cache; - cache->name = g_base_info_get_name ((GIBaseInfo *)callable_info); + callable_cache->calling_context = PYGI_CALLING_CONTEXT_IS_FROM_C; - if (g_base_info_is_deprecated (callable_info)) { - const gchar *deprecated = g_base_info_get_attribute (callable_info, "deprecated"); - gchar *warning; - if (deprecated != NULL) - warning = g_strdup_printf ("%s.%s is deprecated: %s", - g_base_info_get_namespace (callable_info), cache->name, - deprecated); - else - warning = g_strdup_printf ("%s.%s is deprecated", - g_base_info_get_namespace (callable_info), cache->name); - PyErr_WarnEx(PyExc_DeprecationWarning, warning, 0); - g_free (warning); + if (!_callable_cache_init (callable_cache, info)) { + g_free (closure_cache); + return NULL; } - if (type == GI_INFO_TYPE_FUNCTION) { - GIFunctionInfoFlags flags; + /* For backwards compatibility closures include the array's length. + * + * See: https://bugzilla.gnome.org/show_bug.cgi?id=652115 + */ + for (i = 0; (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) { + PyGIArgCache *arg_cache; + PyGIArgGArray *garray_cache; + PyGIArgCache *len_arg_cache; + + arg_cache = g_ptr_array_index (callable_cache->args_cache, i); + if (arg_cache->type_tag != GI_TYPE_TAG_ARRAY) + continue; - flags = g_function_info_get_flags ( (GIFunctionInfo *)callable_info); + garray_cache = (PyGIArgGArray *) arg_cache; + if (garray_cache->len_arg_index == -1) + continue; - if (flags & GI_FUNCTION_IS_CONSTRUCTOR) - cache->function_type = PYGI_FUNCTION_TYPE_CONSTRUCTOR; - else if (flags & GI_FUNCTION_IS_METHOD) - cache->function_type = PYGI_FUNCTION_TYPE_METHOD; - } else if (type == GI_INFO_TYPE_VFUNC) { - cache->function_type = PYGI_FUNCTION_TYPE_VFUNC; - } else if (type == GI_INFO_TYPE_CALLBACK) { - if (is_ccallback) - cache->function_type = PYGI_FUNCTION_TYPE_CCALLBACK; - else - cache->function_type = PYGI_FUNCTION_TYPE_CALLBACK; - } else { - cache->function_type = PYGI_FUNCTION_TYPE_METHOD; + len_arg_cache = g_ptr_array_index (callable_cache->args_cache, + garray_cache->len_arg_index); + len_arg_cache->meta_type = PYGI_META_ARG_TYPE_PARENT; } - cache->n_args = g_callable_info_get_n_args (callable_info); + /* Prevent guessing multiple user data arguments. + * This is required because some versions of GI + * do not recognize user_data/data arguments correctly. + */ + if (callable_cache->user_data_index == -1) { + for (i = 0; (gsize)i < _pygi_callable_cache_args_len (callable_cache); i++) { + PyGIArgCache *arg_cache; - /* if we are a method or vfunc make sure the instance parameter is counted */ - if (cache->function_type == PYGI_FUNCTION_TYPE_METHOD || - cache->function_type == PYGI_FUNCTION_TYPE_VFUNC) - cache->n_args++; + arg_cache = g_ptr_array_index (callable_cache->args_cache, i); - if (cache->n_args > 0) - cache->args_cache = g_slice_alloc0 (cache->n_args * sizeof (PyGIArgCache *)); + if (arg_cache->direction == PYGI_DIRECTION_TO_PYTHON && + arg_cache->type_tag == GI_TYPE_TAG_VOID && + arg_cache->is_pointer) { - if (!_args_cache_generate (callable_info, cache)) - goto err; + callable_cache->user_data_index = i; + break; + } + } + } - return cache; -err: - _pygi_callable_cache_free (cache); - return NULL; + return closure_cache; } diff --git a/gi/pygi-cache.h b/gi/pygi-cache.h index 6e5e0ab..fc5a616 100644 --- a/gi/pygi-cache.h +++ b/gi/pygi-cache.h @@ -2,6 +2,7 @@ * vim: tabstop=4 shiftwidth=4 expandtab * * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2013 Simon Feltman * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +15,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_CACHE_H__ @@ -24,30 +23,48 @@ #include #include +#include #include "pygi-invoke-state-struct.h" G_BEGIN_DECLS -typedef struct _PyGICallableCache PyGICallableCache; typedef struct _PyGIArgCache PyGIArgCache; +typedef struct _PyGICallableCache PyGICallableCache; +typedef struct _PyGIFunctionCache PyGIFunctionCache; +typedef struct _PyGIVFuncCache PyGIVFuncCache; + +typedef PyGIFunctionCache PyGICCallbackCache; +typedef PyGIFunctionCache PyGIConstructorCache; +typedef PyGIFunctionCache PyGIFunctionWithInstanceCache; +typedef PyGIFunctionCache PyGIMethodCache; +typedef PyGICallableCache PyGIClosureCache; typedef gboolean (*PyGIMarshalFromPyFunc) (PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, PyObject *py_arg, - GIArgument *arg); + GIArgument *arg, + gpointer *cleanup_data); typedef PyObject *(*PyGIMarshalToPyFunc) (PyGIInvokeState *state, PyGICallableCache *callable_cache, PyGIArgCache *arg_cache, - GIArgument *arg); + GIArgument *arg, + gpointer *cleanup_data); typedef void (*PyGIMarshalCleanupFunc) (PyGIInvokeState *state, PyGIArgCache *arg_cache, + PyObject *py_arg, gpointer data, gboolean was_processed); +typedef void (*PyGIMarshalToPyCleanupFunc) (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed); + /* Argument meta types denote how we process the argument: * - PYGI_META_ARG_TYPE_PARENT - parents may or may not have children * but are always processed via the normal marshaller for their @@ -56,10 +73,6 @@ typedef void (*PyGIMarshalCleanupFunc) (PyGIInvokeState *state, * - PYGI_META_ARG_TYPE_CHILD - Children without python argument are * ignored by the marshallers and handled directly by their parents * marshaller. - * - PYGI_META_ARG_TYPE_CHILD_NEEDS_UPDATE -Sometimes children arguments - * come before the parent. In these cases they need to be flagged - * so that the argument list counts must be updated for the cache to - * be valid * - Children with pyargs (PYGI_META_ARG_TYPE_CHILD_WITH_PYARG) are processed * the same as other child args but also have an index into the * python parameters passed to the invoker @@ -67,38 +80,29 @@ typedef void (*PyGIMarshalCleanupFunc) (PyGIInvokeState *state, typedef enum { PYGI_META_ARG_TYPE_PARENT, PYGI_META_ARG_TYPE_CHILD, - PYGI_META_ARG_TYPE_CHILD_NEEDS_UPDATE, PYGI_META_ARG_TYPE_CHILD_WITH_PYARG, PYGI_META_ARG_TYPE_CLOSURE, } PyGIMetaArgType; /* - * GI determines function types via a combination of flags and info classes. - * Since for branching purposes they are mutually exclusive, the - * PyGIFunctionType enum consolidates them into one enumeration for ease of - * branching and debugging. + * Argument direction types denotes how we marshal, + * e.g. to Python or from Python or both. */ typedef enum { - PYGI_FUNCTION_TYPE_FUNCTION, - PYGI_FUNCTION_TYPE_METHOD, - PYGI_FUNCTION_TYPE_CONSTRUCTOR, - PYGI_FUNCTION_TYPE_VFUNC, - PYGI_FUNCTION_TYPE_CALLBACK, - PYGI_FUNCTION_TYPE_CCALLBACK, - } PyGIFunctionType; + PYGI_DIRECTION_TO_PYTHON = 1 << 0, + PYGI_DIRECTION_FROM_PYTHON = 1 << 1, + PYGI_DIRECTION_BIDIRECTIONAL = PYGI_DIRECTION_TO_PYTHON | PYGI_DIRECTION_FROM_PYTHON + } PyGIDirection; /* * In PyGI IN and OUT arguments mean different things depending on the context - * of the callable (e.g. is it a callback that is being called from C or a - * function that is being called from python). We don't as much care if the - * parameter is an IN or OUT C parameter, than we do if the parameter is being - * marshalled into Python or from Python. + * of the callable, e.g. is it a callback that is being called from C or a + * function that is being called from Python. */ typedef enum { - PYGI_DIRECTION_TO_PYTHON, - PYGI_DIRECTION_FROM_PYTHON, - PYGI_DIRECTION_BIDIRECTIONAL - } PyGIDirection; + PYGI_CALLING_CONTEXT_IS_FROM_C, + PYGI_CALLING_CONTEXT_IS_FROM_PY +} PyGICallingContext; struct _PyGIArgCache @@ -110,6 +114,7 @@ struct _PyGIArgCache gboolean is_caller_allocates; gboolean is_skipped; gboolean allow_none; + gboolean has_default; PyGIDirection direction; GITransfer transfer; @@ -120,24 +125,32 @@ struct _PyGIArgCache PyGIMarshalToPyFunc to_py_marshaller; PyGIMarshalCleanupFunc from_py_cleanup; - PyGIMarshalCleanupFunc to_py_cleanup; + PyGIMarshalToPyCleanupFunc to_py_cleanup; GDestroyNotify destroy_notify; gssize c_arg_index; gssize py_arg_index; + + /* Set when has_default is true. */ + GIArgument default_value; }; typedef struct _PyGISequenceCache { PyGIArgCache arg_cache; + PyGIArgCache *item_cache; +} PyGISequenceCache; + +typedef struct _PyGIArgGArray +{ + PyGISequenceCache seq_cache; gssize fixed_size; gssize len_arg_index; gboolean is_zero_terminated; gsize item_size; GIArrayType array_type; - PyGIArgCache *item_cache; -} PyGISequenceCache; +} PyGIArgGArray; typedef struct _PyGIInterfaceCache { @@ -149,48 +162,174 @@ typedef struct _PyGIInterfaceCache gchar *type_name; } PyGIInterfaceCache; -typedef struct _PyGIHashCache -{ - PyGIArgCache arg_cache; - PyGIArgCache *key_cache; - PyGIArgCache *value_cache; -} PyGIHashCache; - -typedef struct _PyGICallbackCache -{ - PyGIArgCache arg_cache; - gssize user_data_index; - gssize destroy_notify_index; - GIScopeType scope; - GIInterfaceInfo *interface_info; -} PyGICallbackCache; - struct _PyGICallableCache { const gchar *name; + const gchar *container_name; + const gchar *namespace; - PyGIFunctionType function_type; + PyGICallingContext calling_context; PyGIArgCache *return_cache; - PyGIArgCache **args_cache; + GPtrArray *args_cache; GSList *to_py_args; GSList *arg_name_list; /* for keyword arg matching */ GHashTable *arg_name_hash; + gboolean throws; + + /* Index of user_data arg passed to a callable. */ + gssize user_data_index; + + /* Index of user_data arg that can eat variable args passed to a callable. */ + gssize user_data_varargs_index; - /* counts */ - gssize n_from_py_args; + /* Number of args already added */ + gssize args_offset; + + /* Number of out args passed to g_function_info_invoke. + * This is used for the length of PyGIInvokeState.out_values */ gssize n_to_py_args; + + /* If the callable return value gets used */ + gboolean has_return; + + /* The type used for returning multiple values or NULL */ + PyTypeObject* resulttuple_type; + + /* Number of out args for g_function_info_invoke that will be skipped + * when marshaling to Python due to them being implicitly available + * (list/array length). + */ gssize n_to_py_child_args; - gssize n_args; + /* Number of Python arguments expected for invoking the gi function. */ gssize n_py_args; + + /* Minimum number of args required to call the callable from Python. + * This count does not include args with defaults. */ + gssize n_py_required_args; + + void (*deinit) (PyGICallableCache *callable_cache); + + gboolean (*generate_args_cache) (PyGICallableCache *callable_cache, + GICallableInfo *callable_info); +}; + +struct _PyGIFunctionCache { + PyGICallableCache callable_cache; + + /* An invoker with ffi_cif already setup */ + GIFunctionInvoker invoker; + + PyObject *(*invoke) (PyGIFunctionCache *function_cache, + PyGIInvokeState *state, + PyObject *py_args, + PyObject *py_kwargs); +} ; + +struct _PyGIVFuncCache { + PyGIFunctionWithInstanceCache fwi_cache; + + GIBaseInfo *info; }; -void _pygi_arg_cache_clear (PyGIArgCache *cache); -void _pygi_callable_cache_free (PyGICallableCache *cache); -PyGICallableCache *_pygi_callable_cache_new (GICallableInfo *callable_info, - gboolean is_ccallback); +gboolean +pygi_arg_base_setup (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction); + +gboolean +pygi_arg_interface_setup (PyGIInterfaceCache *iface_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info); + +gboolean +pygi_arg_sequence_setup (PyGISequenceCache *sc, + GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache); + +PyGIArgCache * +pygi_arg_interface_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be NULL for return arguments */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info); + +PyGIArgCache * +pygi_arg_cache_alloc (void); + +PyGIArgCache * +pygi_arg_cache_new (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache, + /* will be removed */ + gssize c_arg_index, + gssize py_arg_index); + +void +pygi_arg_cache_free (PyGIArgCache *cache); + +void +pygi_callable_cache_free (PyGICallableCache *cache); + +gchar * +pygi_callable_cache_get_full_name (PyGICallableCache *cache); + +PyGIFunctionCache * +pygi_function_cache_new (GICallableInfo *info); + +PyObject * +pygi_function_cache_invoke (PyGIFunctionCache *function_cache, + PyObject *py_args, + PyObject *py_kwargs); + +PyGIFunctionCache * +pygi_ccallback_cache_new (GICallableInfo *info, + GCallback function_ptr); + +PyObject * +pygi_ccallback_cache_invoke (PyGIFunctionCache *function_cache, + PyObject *py_args, + PyObject *py_kwargs, + gpointer user_data); + +PyGIFunctionCache * +pygi_constructor_cache_new (GICallableInfo *info); + +PyGIFunctionCache * +pygi_method_cache_new (GICallableInfo *info); + +PyGIFunctionCache * +pygi_vfunc_cache_new (GICallableInfo *info); + +PyGIClosureCache * +pygi_closure_cache_new (GICallableInfo *info); + +inline static guint +_pygi_callable_cache_args_len (PyGICallableCache *cache) { + return ((cache)->args_cache)->len; +} + +inline static PyGIArgCache * +_pygi_callable_cache_get_arg (PyGICallableCache *cache, guint index) { + return (PyGIArgCache *) g_ptr_array_index (cache->args_cache, index); +} + +inline static void +_pygi_callable_cache_set_arg (PyGICallableCache *cache, guint index, PyGIArgCache *arg_cache) { + cache->args_cache->pdata[index] = arg_cache; +} G_END_DECLS diff --git a/gi/pygi-ccallback.c b/gi/pygi-ccallback.c index 82777fb..db12f49 100644 --- a/gi/pygi-ccallback.c +++ b/gi/pygi-ccallback.c @@ -16,16 +16,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" +#include "pygi-util.h" +#include "pygi-ccallback.h" -#include #include -#include static PyObject * @@ -34,21 +31,20 @@ _ccallback_call(PyGICCallback *self, PyObject *args, PyObject *kwargs) PyObject *result; if (self->cache == NULL) { - self->cache = _pygi_callable_cache_new (self->info, TRUE); + self->cache = (PyGICCallbackCache *)pygi_ccallback_cache_new (self->info, + self->callback); if (self->cache == NULL) return NULL; } - result = pygi_callable_info_invoke( (GIBaseInfo *) self->info, - args, - kwargs, - self->cache, - self->callback, - self->user_data); + result = pygi_ccallback_cache_invoke (self->cache, + args, + kwargs, + self->user_data); return result; } -PYGLIB_DEFINE_TYPE("gi.CCallback", PyGICCallback_Type, PyGICCallback); +PYGI_DEFINE_TYPE("gi.CCallback", PyGICCallback_Type, PyGICCallback); PyObject * _pygi_ccallback_new (GCallback callback, @@ -81,19 +77,33 @@ static void _ccallback_dealloc (PyGICCallback *self) { g_base_info_unref ( (GIBaseInfo *)self->info); + + if (self->cache != NULL) { + pygi_callable_cache_free ( (PyGICallableCache *)self->cache); + } + + Py_TYPE (self)->tp_free ((PyObject *)self); } -void -_pygi_ccallback_register_types (PyObject *m) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_ccallback_register_types (PyObject *m) { - Py_TYPE(&PyGICCallback_Type) = &PyType_Type; + Py_SET_TYPE(&PyGICCallback_Type, &PyType_Type); PyGICCallback_Type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE); PyGICCallback_Type.tp_dealloc = (destructor) _ccallback_dealloc; PyGICCallback_Type.tp_call = (ternaryfunc) _ccallback_call; - if (PyType_Ready (&PyGICCallback_Type)) - return; - if (PyModule_AddObject (m, "CCallback", (PyObject *) &PyGICCallback_Type)) - return; + if (PyType_Ready (&PyGICCallback_Type) < 0) + return -1; + Py_INCREF ((PyObject *) &PyGICCallback_Type); + if (PyModule_AddObject (m, "CCallback", (PyObject *) &PyGICCallback_Type) < 0) { + Py_INCREF ((PyObject *) &PyGICCallback_Type); + return -1; + } + + return 0; } diff --git a/gi/pygi-ccallback.h b/gi/pygi-ccallback.h index c796092..7b8439d 100644 --- a/gi/pygi-ccallback.h +++ b/gi/pygi-ccallback.h @@ -14,18 +14,27 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_CCLOSURE_H__ #define __PYGI_CCLOSURE_H__ #include +#include "pygi-cache.h" G_BEGIN_DECLS +typedef struct { + PyObject_HEAD + GCallback callback; + GIFunctionInfo *info; + gpointer user_data; + GIScopeType scope; + GDestroyNotify destroy_notify_func; + PyGICCallbackCache *cache; +} PyGICCallback; + extern PyTypeObject PyGICCallback_Type; PyObject * _pygi_ccallback_new (GCallback callback, @@ -34,7 +43,7 @@ PyObject * _pygi_ccallback_new (GCallback callback, GIFunctionInfo *info, GDestroyNotify destroy_notify); -void _pygi_ccallback_register_types (PyObject *m); +int pygi_ccallback_register_types (PyObject *m); G_END_DECLS diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c index 2f5548a..4e19c5e 100644 --- a/gi/pygi-closure.c +++ b/gi/pygi-closure.c @@ -14,12 +14,27 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" +#include "pygi-closure.h" +#include "pygi-error.h" +#include "pygi-marshal-cleanup.h" +#include "pygi-invoke.h" +#include "pygi-ccallback.h" +#include "pygi-info.h" + +extern PyObject *_PyGIDefaultArgPlaceholder; + +typedef struct _PyGICallbackCache +{ + PyGIArgCache arg_cache; + gssize user_data_index; + gssize destroy_notify_index; + GIScopeType scope; + GIInterfaceInfo *interface_info; + PyGIClosureCache *closure_cache; +} PyGICallbackCache; /* This maintains a list of closures which can be free'd whenever as they have been called. We will free them on the next @@ -28,493 +43,494 @@ static GSList* async_free_list; static void -_pygi_closure_assign_pyobj_to_retval (gpointer retval, PyObject *object, - GITypeInfo *type_info, - GITransfer transfer) +_pygi_closure_assign_pyobj_to_retval (gpointer retval, + GIArgument *arg, + PyGIArgCache *arg_cache) { - GIArgument arg = _pygi_argument_from_object (object, type_info, transfer); - GITypeTag type_tag; - if (PyErr_Occurred ()) - return; - - type_tag = g_type_info_get_tag (type_info); - if (retval == NULL) return; - switch (type_tag) { + switch (arg_cache->type_tag) { case GI_TYPE_TAG_BOOLEAN: - *((ffi_sarg *) retval) = arg.v_boolean; + *((ffi_sarg *) retval) = arg->v_boolean; break; case GI_TYPE_TAG_INT8: - *((ffi_sarg *) retval) = arg.v_int8; + *((ffi_sarg *) retval) = arg->v_int8; break; case GI_TYPE_TAG_UINT8: - *((ffi_arg *) retval) = arg.v_uint8; + *((ffi_arg *) retval) = arg->v_uint8; break; case GI_TYPE_TAG_INT16: - *((ffi_sarg *) retval) = arg.v_int16; + *((ffi_sarg *) retval) = arg->v_int16; break; case GI_TYPE_TAG_UINT16: - *((ffi_arg *) retval) = arg.v_uint16; + *((ffi_arg *) retval) = arg->v_uint16; break; case GI_TYPE_TAG_INT32: - *((ffi_sarg *) retval) = arg.v_int32; + *((ffi_sarg *) retval) = arg->v_int32; break; case GI_TYPE_TAG_UINT32: - *((ffi_arg *) retval) = arg.v_uint32; + *((ffi_arg *) retval) = arg->v_uint32; break; case GI_TYPE_TAG_INT64: - *((ffi_sarg *) retval) = arg.v_int64; + *((ffi_sarg *) retval) = arg->v_int64; break; case GI_TYPE_TAG_UINT64: - *((ffi_arg *) retval) = arg.v_uint64; + *((ffi_arg *) retval) = arg->v_uint64; break; case GI_TYPE_TAG_FLOAT: - *((gfloat *) retval) = arg.v_float; + *((gfloat *) retval) = arg->v_float; break; case GI_TYPE_TAG_DOUBLE: - *((gdouble *) retval) = arg.v_double; + *((gdouble *) retval) = arg->v_double; break; case GI_TYPE_TAG_GTYPE: - *((ffi_arg *) retval) = arg.v_ulong; + *((ffi_arg *) retval) = arg->v_size; break; case GI_TYPE_TAG_UNICHAR: - *((ffi_arg *) retval) = arg.v_uint32; + *((ffi_arg *) retval) = arg->v_uint32; break; case GI_TYPE_TAG_INTERFACE: { - GIBaseInfo* interface_info; - GIInfoType interface_type; + GIBaseInfo *interface_info; - interface_info = g_type_info_get_interface(type_info); - interface_type = g_base_info_get_type(interface_info); + interface_info = ((PyGIInterfaceCache *) arg_cache)->interface_info; - switch (interface_type) { + switch (g_base_info_get_type (interface_info)) { case GI_INFO_TYPE_ENUM: - *(ffi_sarg *) retval = arg.v_int; + *(ffi_sarg *) retval = arg->v_int; break; case GI_INFO_TYPE_FLAGS: - *(ffi_arg *) retval = arg.v_uint; + *(ffi_arg *) retval = arg->v_uint; break; default: - *(ffi_arg *) retval = (ffi_arg) arg.v_pointer; + *(ffi_arg *) retval = (ffi_arg) arg->v_pointer; break; } - g_base_info_unref (interface_info); break; } default: - *(ffi_arg *) retval = (ffi_arg) arg.v_pointer; + *(ffi_arg *) retval = (ffi_arg) arg->v_pointer; break; } } static void -_pygi_closure_clear_retval (GICallableInfo *callable_info, gpointer retval) -{ - GITypeInfo return_type_info; - GITypeTag return_type_tag; - - g_callable_info_load_return_type (callable_info, &return_type_info); - return_type_tag = g_type_info_get_tag (&return_type_info); - if (return_type_tag != GI_TYPE_TAG_VOID) { - *((ffi_arg *) retval) = 0; - } -} - -static void -_pygi_closure_assign_pyobj_to_out_argument (gpointer out_arg, PyObject *object, - GITypeInfo *type_info, - GITransfer transfer) +_pygi_closure_assign_pyobj_to_out_argument (gpointer out_arg, + GIArgument *arg, + PyGIArgCache *arg_cache) { - GIArgument arg = _pygi_argument_from_object (object, type_info, transfer); - GITypeTag type_tag = g_type_info_get_tag (type_info); - if (out_arg == NULL) return; - switch (type_tag) { + switch (arg_cache->type_tag) { case GI_TYPE_TAG_BOOLEAN: - *((gboolean *) out_arg) = arg.v_boolean; + *((gboolean *) out_arg) = arg->v_boolean; break; case GI_TYPE_TAG_INT8: - *((gint8 *) out_arg) = arg.v_int8; + *((gint8 *) out_arg) = arg->v_int8; break; case GI_TYPE_TAG_UINT8: - *((guint8 *) out_arg) = arg.v_uint8; + *((guint8 *) out_arg) = arg->v_uint8; break; case GI_TYPE_TAG_INT16: - *((gint16 *) out_arg) = arg.v_int16; + *((gint16 *) out_arg) = arg->v_int16; break; case GI_TYPE_TAG_UINT16: - *((guint16 *) out_arg) = arg.v_uint16; + *((guint16 *) out_arg) = arg->v_uint16; break; case GI_TYPE_TAG_INT32: - *((gint32 *) out_arg) = arg.v_int32; + *((gint32 *) out_arg) = arg->v_int32; break; case GI_TYPE_TAG_UINT32: - *((guint32 *) out_arg) = arg.v_uint32; + *((guint32 *) out_arg) = arg->v_uint32; break; case GI_TYPE_TAG_INT64: - *((gint64 *) out_arg) = arg.v_int64; + *((gint64 *) out_arg) = arg->v_int64; break; case GI_TYPE_TAG_UINT64: - *((glong *) out_arg) = arg.v_uint64; + *((guint64 *) out_arg) = arg->v_uint64; break; case GI_TYPE_TAG_FLOAT: - *((gfloat *) out_arg) = arg.v_float; + *((gfloat *) out_arg) = arg->v_float; break; case GI_TYPE_TAG_DOUBLE: - *((gdouble *) out_arg) = arg.v_double; + *((gdouble *) out_arg) = arg->v_double; break; case GI_TYPE_TAG_GTYPE: - *((gulong *) out_arg) = arg.v_ulong; + *((GType *) out_arg) = arg->v_size; break; case GI_TYPE_TAG_UNICHAR: - *((guint32 *) out_arg) = arg.v_uint32; + *((guint32 *) out_arg) = arg->v_uint32; break; case GI_TYPE_TAG_INTERFACE: { - GIBaseInfo *interface; - GIInfoType interface_type; + GIBaseInfo *interface_info; - interface = g_type_info_get_interface (type_info); - interface_type = g_base_info_get_type (interface); + interface_info = ((PyGIInterfaceCache *) arg_cache)->interface_info; - switch (interface_type) { + switch (g_base_info_get_type (interface_info)) { case GI_INFO_TYPE_ENUM: - *(gint *) out_arg = arg.v_int; + *(gint *) out_arg = arg->v_int; break; case GI_INFO_TYPE_FLAGS: - *(guint *) out_arg = arg.v_uint; + *(guint *) out_arg = arg->v_uint; break; case GI_INFO_TYPE_STRUCT: - if (!g_type_info_is_pointer (type_info)) { - if (object != Py_None) { - gsize item_size = _pygi_g_type_info_size (type_info); - memcpy (out_arg, arg.v_pointer, item_size); + if (!arg_cache->is_pointer) { + if (arg->v_pointer != NULL) { + gsize item_size = _pygi_g_type_info_size (arg_cache->type_info); + memcpy (out_arg, arg->v_pointer, item_size); } break; } - - /* Fall through if pointer */ + *((gpointer *) out_arg) = arg->v_pointer; + break; default: - *((gpointer *) out_arg) = arg.v_pointer; + *((gpointer *) out_arg) = arg->v_pointer; break; } - - g_base_info_unref (interface); break; } default: - *((gpointer *) out_arg) = arg.v_pointer; + *((gpointer *) out_arg) = arg->v_pointer; break; } } -static GIArgument * -_pygi_closure_convert_ffi_arguments (GICallableInfo *callable_info, void **args) +static void +_pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state, + PyGICallableCache *cache, + void **args) { - gint num_args, i; - GIArgInfo arg_info; - GITypeInfo arg_type; - GITypeTag tag; - GIDirection direction; - GIArgument *g_args; - - num_args = g_callable_info_get_n_args (callable_info); - g_args = g_new0 (GIArgument, num_args); - - for (i = 0; i < num_args; i++) { - g_callable_info_load_arg (callable_info, i, &arg_info); - g_arg_info_load_type (&arg_info, &arg_type); - tag = g_type_info_get_tag (&arg_type); - direction = g_arg_info_get_direction (&arg_info); - - if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) { - g_args[i].v_pointer = * (gpointer *) args[i]; + guint i; + + for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) { + PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i); + gpointer arg_pointer; + + if (arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON) { + state[i].arg_value.v_pointer = * (gpointer *) args[i]; + + if (state[i].arg_value.v_pointer == NULL) + continue; + + state[i].arg_pointer.v_pointer = state[i].arg_value.v_pointer; + arg_pointer = state[i].arg_value.v_pointer; } else { - switch (tag) { - case GI_TYPE_TAG_BOOLEAN: - g_args[i].v_boolean = * (gboolean *) args[i]; - break; - case GI_TYPE_TAG_INT8: - g_args[i].v_int8 = * (gint8 *) args[i]; - break; - case GI_TYPE_TAG_UINT8: - g_args[i].v_uint8 = * (guint8 *) args[i]; - break; - case GI_TYPE_TAG_INT16: - g_args[i].v_int16 = * (gint16 *) args[i]; - break; - case GI_TYPE_TAG_UINT16: - g_args[i].v_uint16 = * (guint16 *) args[i]; - break; - case GI_TYPE_TAG_INT32: - g_args[i].v_int32 = * (gint32 *) args[i]; - break; - case GI_TYPE_TAG_UINT32: - g_args[i].v_uint32 = * (guint32 *) args[i]; - break; - case GI_TYPE_TAG_INT64: - g_args[i].v_int64 = * (glong *) args[i]; - break; - case GI_TYPE_TAG_UINT64: - g_args[i].v_uint64 = * (glong *) args[i]; - break; - case GI_TYPE_TAG_FLOAT: - g_args[i].v_float = * (gfloat *) args[i]; - break; - case GI_TYPE_TAG_DOUBLE: - g_args[i].v_double = * (gdouble *) args[i]; - break; - case GI_TYPE_TAG_UTF8: - g_args[i].v_string = * (gchar **) args[i]; - break; - case GI_TYPE_TAG_INTERFACE: - { - GIBaseInfo *interface; - GIInfoType interface_type; - - interface = g_type_info_get_interface (&arg_type); - interface_type = g_base_info_get_type (interface); - - if (interface_type == GI_INFO_TYPE_OBJECT || - interface_type == GI_INFO_TYPE_INTERFACE) { - g_args[i].v_pointer = * (gpointer *) args[i]; - g_base_info_unref (interface); - break; - } else if (interface_type == GI_INFO_TYPE_ENUM || - interface_type == GI_INFO_TYPE_FLAGS) { - g_args[i].v_uint = * (guint *) args[i]; - g_base_info_unref (interface); - break; - } else if (interface_type == GI_INFO_TYPE_STRUCT || - interface_type == GI_INFO_TYPE_CALLBACK) { - g_args[i].v_pointer = * (gpointer *) args[i]; - g_base_info_unref (interface); - break; - } + arg_pointer = args[i]; + } + + switch (arg_cache->type_tag) { + case GI_TYPE_TAG_BOOLEAN: + state[i].arg_value.v_boolean = * (gboolean *) arg_pointer; + break; + case GI_TYPE_TAG_INT8: + state[i].arg_value.v_int8 = * (gint8 *) arg_pointer; + break; + case GI_TYPE_TAG_UINT8: + state[i].arg_value.v_uint8 = * (guint8 *) arg_pointer; + break; + case GI_TYPE_TAG_INT16: + state[i].arg_value.v_int16 = * (gint16 *) arg_pointer; + break; + case GI_TYPE_TAG_UINT16: + state[i].arg_value.v_uint16 = * (guint16 *) arg_pointer; + break; + case GI_TYPE_TAG_INT32: + state[i].arg_value.v_int32 = * (gint32 *) arg_pointer; + break; + case GI_TYPE_TAG_UINT32: + state[i].arg_value.v_uint32 = * (guint32 *) arg_pointer; + break; + case GI_TYPE_TAG_INT64: + state[i].arg_value.v_int64 = * (gint64 *) arg_pointer; + break; + case GI_TYPE_TAG_UINT64: + state[i].arg_value.v_uint64 = * (guint64 *) arg_pointer; + break; + case GI_TYPE_TAG_FLOAT: + state[i].arg_value.v_float = * (gfloat *) arg_pointer; + break; + case GI_TYPE_TAG_DOUBLE: + state[i].arg_value.v_double = * (gdouble *) arg_pointer; + break; + case GI_TYPE_TAG_UTF8: + state[i].arg_value.v_string = * (gchar **) arg_pointer; + break; + case GI_TYPE_TAG_INTERFACE: + { + GIBaseInfo *interface; + GIInfoType interface_type; + + interface = ((PyGIInterfaceCache *) arg_cache)->interface_info; + interface_type = g_base_info_get_type (interface); - g_base_info_unref (interface); + if (interface_type == GI_INFO_TYPE_ENUM) { + state[i].arg_value.v_int = * (gint *) arg_pointer; + } else if (interface_type == GI_INFO_TYPE_FLAGS) { + state[i].arg_value.v_uint = * (guint *) arg_pointer; + } else { + state[i].arg_value.v_pointer = * (gpointer *) arg_pointer; } - case GI_TYPE_TAG_ERROR: - case GI_TYPE_TAG_GHASH: - case GI_TYPE_TAG_GLIST: - case GI_TYPE_TAG_GSLIST: - case GI_TYPE_TAG_ARRAY: - case GI_TYPE_TAG_VOID: - g_args[i].v_pointer = * (gpointer *) args[i]; - break; - default: - g_warning ("Unhandled type tag %s", g_type_tag_to_string (tag)); - g_args[i].v_pointer = 0; + break; } + case GI_TYPE_TAG_UNICHAR: + state[i].arg_value.v_uint32 = * (guint32 *) arg_pointer; + break; + case GI_TYPE_TAG_ERROR: + case GI_TYPE_TAG_GHASH: + case GI_TYPE_TAG_GLIST: + case GI_TYPE_TAG_GSLIST: + case GI_TYPE_TAG_ARRAY: + case GI_TYPE_TAG_VOID: + state[i].arg_value.v_pointer = * (gpointer *) arg_pointer; + break; + default: + g_warning ("Unhandled type tag %s", + g_type_tag_to_string (arg_cache->type_tag)); + state[i].arg_value.v_pointer = 0; } } - return g_args; + + if (cache->throws) { + gssize error_index = _pygi_callable_cache_args_len (cache); + + state[error_index].arg_value.v_pointer = * (gpointer *) args[error_index]; + } } static gboolean -_pygi_closure_convert_arguments (GICallableInfo *callable_info, void **args, - void *user_data, PyObject **py_args, - GIArgument **out_args) +_invoke_state_init_from_cache (PyGIInvokeState *state, + PyGIClosureCache *closure_cache, + void **args) { - int n_args = g_callable_info_get_n_args (callable_info); - int n_in_args = 0; - int n_out_args = 0; - int i; - int user_data_arg = -1; - int destroy_notify_arg = -1; - - GIArgument *g_args = NULL; - - *py_args = NULL; - *py_args = PyTuple_New (n_args); - if (*py_args == NULL) - goto error; - - *out_args = NULL; - *out_args = g_new0 (GIArgument, n_args); - g_args = _pygi_closure_convert_ffi_arguments (callable_info, args); - - for (i = 0; i < n_args; i++) { - GIArgInfo arg_info; - GIDirection direction; - - /* Special case callbacks and skip over userdata and Destroy Notify */ - if (i == user_data_arg || i == destroy_notify_arg) - continue; - - g_callable_info_load_arg (callable_info, i, &arg_info); - direction = g_arg_info_get_direction (&arg_info); - - if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) { - GITypeInfo arg_type; - GITypeTag arg_tag; - GITransfer transfer; - PyObject *value; - GIArgument *arg; - gboolean free_array; + PyGICallableCache *cache = (PyGICallableCache *) closure_cache; + + state->n_args = _pygi_callable_cache_args_len (cache); + state->n_py_in_args = state->n_args; + + /* Increment after setting the number of Python input args */ + if (cache->throws) { + state->n_args++; + } + + state->py_in_args = PyTuple_New (state->n_py_in_args); + if (state->py_in_args == NULL) { + PyErr_NoMemory (); + return FALSE; + } + + state->args = NULL; + state->error = NULL; + + if (!_pygi_invoke_arg_state_init (state)) { + return FALSE; + } + + state->ffi_args = NULL; + + _pygi_closure_convert_ffi_arguments (state->args, cache, args); + return TRUE; +} + +static void +_invoke_state_clear (PyGIInvokeState *state) +{ + _pygi_invoke_arg_state_free (state); + Py_XDECREF (state->py_in_args); +} + +static gboolean +_pygi_closure_convert_arguments (PyGIInvokeState *state, + PyGIClosureCache *closure_cache) +{ + PyGICallableCache *cache = (PyGICallableCache *) closure_cache; + gssize n_in_args = 0; + gssize i; - g_arg_info_load_type (&arg_info, &arg_type); - arg_tag = g_type_info_get_tag (&arg_type); - transfer = g_arg_info_get_ownership_transfer (&arg_info); - free_array = FALSE; + for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) { + PyGIArgCache *arg_cache; - if (direction == GI_DIRECTION_IN && arg_tag == GI_TYPE_TAG_VOID && - g_type_info_is_pointer (&arg_type)) { + arg_cache = g_ptr_array_index (cache->args_cache, i); + + if (arg_cache->direction & PYGI_DIRECTION_TO_PYTHON) { + PyObject *value; - if (user_data == NULL) { + if (cache->user_data_index == i) { + if (state->user_data == NULL) { + /* user_data can be NULL for connect functions which don't accept + * user_data or as the default for user_data in the middle of function + * arguments. + */ Py_INCREF (Py_None); value = Py_None; } else { - value = user_data; - Py_INCREF (value); + /* Extend the callbacks args with user_data as variable args. */ + gssize j, user_data_len; + PyObject *py_user_data = state->user_data; + + if (!PyTuple_Check (py_user_data)) { + PyErr_SetString (PyExc_TypeError, "expected tuple for callback user_data"); + return FALSE; + } + + user_data_len = PyTuple_Size (py_user_data); + _PyTuple_Resize (&state->py_in_args, + state->n_py_in_args + user_data_len - 1); + + for (j = 0; j < user_data_len; j++, n_in_args++) { + value = PyTuple_GetItem (py_user_data, j); + Py_INCREF (value); + PyTuple_SET_ITEM (state->py_in_args, n_in_args, value); + } + /* We can assume user_data args are never going to be inout, + * so just continue here. + */ + continue; } - } else if (direction == GI_DIRECTION_IN && - arg_tag == GI_TYPE_TAG_INTERFACE) { - /* Handle callbacks as a special case */ - GIBaseInfo *info; - GIInfoType info_type; - - info = g_type_info_get_interface (&arg_type); - info_type = g_base_info_get_type (info); - - arg = (GIArgument*) &g_args[i]; - - if (info_type == GI_INFO_TYPE_CALLBACK) { - gpointer user_data = NULL; - GDestroyNotify destroy_notify = NULL; - GIScopeType scope = g_arg_info_get_scope(&arg_info); - - user_data_arg = g_arg_info_get_closure(&arg_info); - destroy_notify_arg = g_arg_info_get_destroy(&arg_info); - - if (user_data_arg != -1) - user_data = g_args[user_data_arg].v_pointer; - - if (destroy_notify_arg != -1) - user_data = (GDestroyNotify) g_args[destroy_notify_arg].v_pointer; - - value = _pygi_ccallback_new(arg->v_pointer, - user_data, - scope, - (GIFunctionInfo *) info, - destroy_notify); - } else - value = _pygi_argument_to_object (arg, &arg_type, transfer); - - g_base_info_unref (info); - if (value == NULL) - goto error; + } else if (arg_cache->meta_type != PYGI_META_ARG_TYPE_PARENT) { + continue; } else { - if (direction == GI_DIRECTION_IN) - arg = (GIArgument*) &g_args[i]; - else - arg = (GIArgument*) g_args[i].v_pointer; - - if (g_type_info_get_tag (&arg_type) == GI_TYPE_TAG_ARRAY) - arg->v_pointer = _pygi_argument_to_array (arg, (GIArgument **) args, NULL, - callable_info, &arg_type, &free_array); - - value = _pygi_argument_to_object (arg, &arg_type, transfer); - - if (free_array) - g_array_free (arg->v_pointer, FALSE); - - if (value == NULL) - goto error; + gpointer cleanup_data = NULL; + + value = arg_cache->to_py_marshaller (state, + cache, + arg_cache, + &state->args[i].arg_value, + &cleanup_data); + state->args[i].to_py_arg_cleanup_data = cleanup_data; + + if (value == NULL) { + pygi_marshal_cleanup_args_to_py_parameter_fail (state, + cache, + i); + return FALSE; + } } - PyTuple_SET_ITEM (*py_args, n_in_args, value); - n_in_args++; - } - if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) { - (*out_args) [n_out_args] = g_args[i]; - n_out_args++; + PyTuple_SET_ITEM (state->py_in_args, n_in_args, value); + n_in_args++; } - } - if (_PyTuple_Resize (py_args, n_in_args) == -1) - goto error; + if (_PyTuple_Resize (&state->py_in_args, n_in_args) == -1) + return FALSE; - g_free (g_args); return TRUE; - -error: - Py_CLEAR (*py_args); - g_free (*out_args); - *out_args = NULL; - g_free (g_args); - - return FALSE; } -static void -_pygi_closure_set_out_arguments (GICallableInfo *callable_info, - PyObject *py_retval, GIArgument *out_args, +static gboolean +_pygi_closure_set_out_arguments (PyGIInvokeState *state, + PyGICallableCache *cache, + PyObject *py_retval, void *resp) { - int n_args, i, i_py_retval, i_out_args; - GITypeInfo return_type_info; - GITypeTag return_type_tag; - - i_py_retval = 0; - g_callable_info_load_return_type (callable_info, &return_type_info); - return_type_tag = g_type_info_get_tag (&return_type_info); - if (return_type_tag != GI_TYPE_TAG_VOID) { - GITransfer transfer = g_callable_info_get_caller_owns (callable_info); + gssize i; + gssize i_py_retval = 0; + gboolean success; + + if (cache->return_cache->type_tag != GI_TYPE_TAG_VOID) { + PyObject *item = py_retval; + if (PyTuple_Check (py_retval)) { - PyObject *item = PyTuple_GET_ITEM (py_retval, 0); - _pygi_closure_assign_pyobj_to_retval (resp, item, - &return_type_info, transfer); - } else { - _pygi_closure_assign_pyobj_to_retval (resp, py_retval, - &return_type_info, transfer); + item = PyTuple_GET_ITEM (py_retval, 0); + } + + success = cache->return_cache->from_py_marshaller (state, + cache, + cache->return_cache, + item, + &state->return_arg, + &state->args[0].arg_cleanup_data); + + if (!success) { + pygi_marshal_cleanup_args_return_fail (state, + cache); + return FALSE; } + + _pygi_closure_assign_pyobj_to_retval (resp, &state->return_arg, + cache->return_cache); i_py_retval++; } - i_out_args = 0; - n_args = g_callable_info_get_n_args (callable_info); - for (i = 0; i < n_args; i++) { - GIArgInfo arg_info; - GITypeInfo type_info; - GIDirection direction; - g_callable_info_load_arg (callable_info, i, &arg_info); - g_arg_info_load_type (&arg_info, &type_info); - direction = g_arg_info_get_direction (&arg_info); - - if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) { - GITransfer transfer = g_arg_info_get_ownership_transfer (&arg_info); - - if (g_type_info_get_tag (&type_info) == GI_TYPE_TAG_ERROR) { - /* TODO: check if an exception has been set and convert it to a GError */ - out_args[i_out_args].v_pointer = NULL; - i_out_args++; + for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) { + PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i); + + if (arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON) { + PyObject *item = py_retval; + + if (arg_cache->type_tag == GI_TYPE_TAG_ERROR) { + * (GError **) state->args[i].arg_pointer.v_pointer = NULL; continue; } if (PyTuple_Check (py_retval)) { - PyObject *item = PyTuple_GET_ITEM (py_retval, i_py_retval); - _pygi_closure_assign_pyobj_to_out_argument ( - out_args[i_out_args].v_pointer, item, &type_info, transfer); - } else if (i_py_retval == 0) { - _pygi_closure_assign_pyobj_to_out_argument ( - out_args[i_out_args].v_pointer, py_retval, &type_info, - transfer); - } else - g_assert_not_reached(); - - i_out_args++; + item = PyTuple_GET_ITEM (py_retval, i_py_retval); + } else if (i_py_retval != 0) { + pygi_marshal_cleanup_args_to_py_parameter_fail (state, + cache, + i_py_retval); + return FALSE; + } + + success = arg_cache->from_py_marshaller (state, + cache, + arg_cache, + item, + &state->args[i].arg_value, + &state->args[i_py_retval].arg_cleanup_data); + + if (!success) { + pygi_marshal_cleanup_args_to_py_parameter_fail (state, + cache, + i_py_retval); + return FALSE; + } + + _pygi_closure_assign_pyobj_to_out_argument (state->args[i].arg_pointer.v_pointer, + &state->args[i].arg_value, arg_cache); + i_py_retval++; } } + + return TRUE; +} + +static void +_pygi_closure_clear_retvals (PyGIInvokeState *state, + PyGICallableCache *cache, + gpointer resp) +{ + gsize i; + GIArgument arg = { 0, }; + + if (cache->return_cache->type_tag != GI_TYPE_TAG_VOID) { + _pygi_closure_assign_pyobj_to_retval (resp, &arg, + cache->return_cache); + } + + for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) { + PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i); + + if (arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON) { + _pygi_closure_assign_pyobj_to_out_argument (state->args[i].arg_pointer.v_pointer, + &arg, arg_cache); + } + } + + if (cache->throws) { + gssize error_index = state->n_args - 1; + GError **error = (GError **) state->args[error_index].arg_value.v_pointer; + + if (error != NULL) { + pygi_gerror_exception_check (error); + } + } } static void @@ -534,43 +550,56 @@ _pygi_closure_handle (ffi_cif *cif, void **args, void *data) { - PyGILState_STATE state; + PyGILState_STATE py_state; PyGICClosure *closure = data; PyObject *retval; - PyObject *py_args; - GIArgument *out_args = NULL; + gboolean success; + PyGIInvokeState state = { 0, }; + + /* Ignore closures when Python is not initialized. This can happen in cases + * where calling Python implemented vfuncs can happen at shutdown time. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=722562 */ + if (!Py_IsInitialized()) { + return; + } /* Lock the GIL as we are coming into this code without the lock and we may be executing python code */ - state = PyGILState_Ensure(); + py_state = PyGILState_Ensure (); + + if (closure->cache == NULL) + goto end; + + state.user_data = closure->user_data; - if (!_pygi_closure_convert_arguments ( (GICallableInfo *) closure->info, args, - closure->user_data, - &py_args, &out_args)) { - if (PyErr_Occurred ()) - PyErr_Print(); + _invoke_state_init_from_cache (&state, closure->cache, args); + + if (!_pygi_closure_convert_arguments (&state, closure->cache)) { + _pygi_closure_clear_retvals (&state, closure->cache, result); goto end; } - retval = PyObject_CallObject ( (PyObject *) closure->function, py_args); - Py_DECREF (py_args); + retval = PyObject_CallObject ( (PyObject *) closure->function, state.py_in_args); if (retval == NULL) { - _pygi_closure_clear_retval (closure->info, result); - PyErr_Print(); + _pygi_closure_clear_retvals (&state, closure->cache, result); goto end; } - _pygi_closure_set_out_arguments (closure->info, retval, out_args, result); - if (PyErr_Occurred ()) { - _pygi_closure_clear_retval (closure->info, result); - PyErr_Print(); + pygi_marshal_cleanup_args_to_py_marshal_success (&state, closure->cache); + success = _pygi_closure_set_out_arguments (&state, closure->cache, retval, result); + + if (!success) { + pygi_marshal_cleanup_args_from_py_marshal_success (&state, closure->cache); + _pygi_closure_clear_retvals (&state, closure->cache, result); } Py_DECREF (retval); end: - g_free (out_args); + + if (PyErr_Occurred ()) + PyErr_Print (); /* Now that the closure has finished we can make a decision about how to free it. Scope call gets free'd at the end of wrap_g_function_info_invoke. @@ -591,23 +620,31 @@ end: async_free_list = g_slist_prepend (async_free_list, closure); break; default: - g_error ("Invalid scope reached inside %s. Possibly a bad annotation?", - g_base_info_get_name (closure->info)); + /* Handle new scopes added by gobject-introspection */ + g_critical ("Unknown scope reached inside %s. Please file an issue " + "at https://gitlab.gnome.org/GNOME/pygobject/issues/new", + g_base_info_get_name (closure->info)); } - PyGILState_Release (state); + _invoke_state_clear (&state); + PyGILState_Release (py_state); } -void _pygi_invoke_closure_free (gpointer data) +void _pygi_invoke_closure_free (PyGICClosure* invoke_closure) { - PyGICClosure* invoke_closure = (PyGICClosure *) data; - +#if GI_CHECK_VERSION (1, 72, 0) + g_callable_info_destroy_closure (invoke_closure->info, + invoke_closure->closure); +#else g_callable_info_free_closure (invoke_closure->info, invoke_closure->closure); +#endif if (invoke_closure->info) g_base_info_unref ( (GIBaseInfo*) invoke_closure->info); + invoke_closure->cache = NULL; + _pygi_invoke_closure_clear_py_data(invoke_closure); g_slice_free (PyGICClosure, invoke_closure); @@ -616,9 +653,10 @@ void _pygi_invoke_closure_free (gpointer data) PyGICClosure* _pygi_make_native_closure (GICallableInfo* info, + PyGIClosureCache *cache, GIScopeType scope, PyObject *py_function, - gpointer py_user_data) + PyObject *py_user_data) { PyGICClosure *closure; ffi_closure *fficlosure; @@ -631,14 +669,22 @@ _pygi_make_native_closure (GICallableInfo* info, closure = g_slice_new0 (PyGICClosure); closure->info = (GICallableInfo *) g_base_info_ref ( (GIBaseInfo *) info); closure->function = py_function; - closure->user_data = py_user_data ? py_user_data : Py_None; + closure->user_data = py_user_data; + closure->cache = cache; Py_INCREF (py_function); - Py_INCREF (closure->user_data); + Py_XINCREF (closure->user_data); +#if GI_CHECK_VERSION (1, 72, 0) + fficlosure = + g_callable_info_create_closure (info, &closure->cif, _pygi_closure_handle, + closure); +#else fficlosure = g_callable_info_prepare_closure (info, &closure->cif, _pygi_closure_handle, closure); +#endif + closure->closure = fficlosure; /* Give the closure the information it needs to determine when @@ -647,3 +693,285 @@ _pygi_make_native_closure (GICallableInfo* info, return closure; } + +/* _pygi_destroy_notify_dummy: + * + * Dummy method used in the occasion when a method has a GDestroyNotify + * argument without user data. + */ +static void +_pygi_destroy_notify_dummy (gpointer data) { +} + +static gboolean +_pygi_marshal_from_py_interface_callback (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + GICallableInfo *callable_info; + PyGICClosure *closure; + PyGIArgCache *user_data_cache = NULL; + PyGIArgCache *destroy_cache = NULL; + PyGICallbackCache *callback_cache; + PyObject *py_user_data = NULL; + + callback_cache = (PyGICallbackCache *)arg_cache; + + if (callback_cache->user_data_index > 0) { + user_data_cache = _pygi_callable_cache_get_arg (callable_cache, (guint)callback_cache->user_data_index); + if (user_data_cache->py_arg_index < state->n_py_in_args) { + /* py_user_data is a borrowed reference. */ + py_user_data = PyTuple_GetItem (state->py_in_args, user_data_cache->py_arg_index); + if (!py_user_data) + return FALSE; + /* NULL out user_data if it was not supplied and the default arg placeholder + * was used instead. + */ + if (py_user_data == _PyGIDefaultArgPlaceholder) { + py_user_data = NULL; + } else if (callable_cache->user_data_varargs_index < 0) { + /* For non-variable length user data, place the user data in a + * single item tuple which is concatenated to the callbacks arguments. + * This allows callback input arg marshaling to always expect a + * tuple for user data. Note the + */ + py_user_data = Py_BuildValue("(O)", py_user_data, NULL); + } else { + /* increment the ref borrowed from PyTuple_GetItem above */ + Py_INCREF (py_user_data); + } + } + } + + if (py_arg == Py_None) { + return TRUE; + } + + if (!PyCallable_Check (py_arg)) { + PyErr_Format (PyExc_TypeError, + "Callback needs to be a function or method not %s", + Py_TYPE (py_arg)->tp_name); + + return FALSE; + } + + callable_info = (GICallableInfo *)callback_cache->interface_info; + + closure = _pygi_make_native_closure ( + callable_info, callback_cache->closure_cache, callback_cache->scope, + py_arg, py_user_data); + +#if GI_CHECK_VERSION (1, 72, 0) + if (closure->closure != NULL) + arg->v_pointer = g_callable_info_get_closure_native_address (callable_info, closure->closure); + else + arg->v_pointer = NULL; +#else + arg->v_pointer = closure->closure; +#endif + + /* always decref the user data as _pygi_make_native_closure adds its own ref */ + Py_XDECREF (py_user_data); + + /* The PyGICClosure instance is used as user data passed into the C function. + * The return trip to python will marshal this back and pull the python user data out. + */ + if (user_data_cache != NULL) { + state->args[user_data_cache->c_arg_index].arg_value.v_pointer = closure; + } + + /* Setup a GDestroyNotify callback if this method supports it along with + * a user data field. The user data field is a requirement in order + * free resources and ref counts associated with this arguments closure. + * In case a user data field is not available, show a warning giving + * explicit information and setup a dummy notification to avoid a crash + * later on in _pygi_destroy_notify_callback_closure. + */ + if (callback_cache->destroy_notify_index > 0) { + destroy_cache = _pygi_callable_cache_get_arg (callable_cache, (guint)callback_cache->destroy_notify_index); + } + + if (destroy_cache) { + if (user_data_cache != NULL) { + state->args[destroy_cache->c_arg_index].arg_value.v_pointer = _pygi_invoke_closure_free; + } else { + char *full_name = pygi_callable_cache_get_full_name (callable_cache); + gchar *msg = g_strdup_printf("Callables passed to %s will leak references because " + "the method does not support a user_data argument. " + "See: https://bugzilla.gnome.org/show_bug.cgi?id=685598", + full_name); + g_free (full_name); + if (PyErr_WarnEx(PyExc_RuntimeWarning, msg, 2)) { + g_free(msg); + _pygi_invoke_closure_free(closure); + return FALSE; + } + g_free(msg); + state->args[destroy_cache->c_arg_index].arg_value.v_pointer = _pygi_destroy_notify_dummy; + } + } + + /* Use the PyGIClosure as data passed to cleanup for GI_SCOPE_TYPE_CALL. */ + *cleanup_data = closure; + + return TRUE; +} + +static PyObject * +_pygi_marshal_to_py_interface_callback (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *arg_cleanup_data) +{ + PyGICallbackCache *callback_cache = (PyGICallbackCache *) arg_cache; + gssize user_data_index; + gssize destroy_notify_index; + gpointer user_data = NULL; + GDestroyNotify destroy_notify = NULL; + + user_data_index = callback_cache->user_data_index; + destroy_notify_index = callback_cache->destroy_notify_index; + + if (user_data_index != -1) + user_data = state->args[user_data_index].arg_value.v_pointer; + + if (destroy_notify_index != -1) + destroy_notify = state->args[destroy_notify_index].arg_value.v_pointer; + + return _pygi_ccallback_new (arg->v_pointer, + user_data, + callback_cache->scope, + (GIFunctionInfo *) callback_cache->interface_info, + destroy_notify); +} + +static void +_callback_cache_free_func (PyGICallbackCache *cache) +{ + if (cache != NULL) { + if (cache->interface_info != NULL) + g_base_info_unref ( (GIBaseInfo *)cache->interface_info); + + if (cache->closure_cache != NULL) { + pygi_callable_cache_free ((PyGICallableCache *) cache->closure_cache); + cache->closure_cache = NULL; + } + + g_slice_free (PyGICallbackCache, cache); + } +} + +static void +_pygi_marshal_cleanup_from_py_interface_callback (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + PyGICallbackCache *callback_cache = (PyGICallbackCache *)arg_cache; + + if (was_processed && callback_cache->scope == GI_SCOPE_TYPE_CALL) { + _pygi_invoke_closure_free (data); + } +} + +static gboolean +pygi_arg_callback_setup_from_info (PyGICallbackCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info, + PyGICallableCache *callable_cache) +{ + PyGIArgCache *cache = (PyGIArgCache *)arg_cache; + gssize child_offset = 0; + + if (!pygi_arg_base_setup ((PyGIArgCache *)arg_cache, + type_info, + arg_info, + transfer, + direction)) { + return FALSE; + } + + if (callable_cache != NULL) + child_offset = callable_cache->args_offset; + + ( (PyGIArgCache *)arg_cache)->destroy_notify = (GDestroyNotify)_callback_cache_free_func; + + arg_cache->user_data_index = g_arg_info_get_closure (arg_info); + if (arg_cache->user_data_index != -1) + arg_cache->user_data_index += child_offset; + + arg_cache->destroy_notify_index = g_arg_info_get_destroy (arg_info); + if (arg_cache->destroy_notify_index != -1) + arg_cache->destroy_notify_index += child_offset; + + if (arg_cache->user_data_index >= 0) { + PyGIArgCache *user_data_arg_cache = pygi_arg_cache_alloc (); + user_data_arg_cache->meta_type = PYGI_META_ARG_TYPE_CHILD_WITH_PYARG; + user_data_arg_cache->direction = direction; + user_data_arg_cache->has_default = TRUE; /* always allow user data with a NULL default. */ + _pygi_callable_cache_set_arg (callable_cache, (guint)arg_cache->user_data_index, + user_data_arg_cache); + } + + if (arg_cache->destroy_notify_index >= 0) { + PyGIArgCache *destroy_arg_cache = pygi_arg_cache_alloc (); + destroy_arg_cache->meta_type = PYGI_META_ARG_TYPE_CHILD; + destroy_arg_cache->direction = direction; + _pygi_callable_cache_set_arg (callable_cache, (guint)arg_cache->destroy_notify_index, + destroy_arg_cache); + } + + arg_cache->scope = g_arg_info_get_scope (arg_info); + g_base_info_ref( (GIBaseInfo *)iface_info); + arg_cache->interface_info = iface_info; + + if (direction & PYGI_DIRECTION_FROM_PYTHON) { + arg_cache->closure_cache = pygi_closure_cache_new (arg_cache->interface_info); + cache->from_py_marshaller = _pygi_marshal_from_py_interface_callback; + cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_callback; + } + + if (direction & PYGI_DIRECTION_TO_PYTHON) { + cache->to_py_marshaller = _pygi_marshal_to_py_interface_callback; + } + + return TRUE; +} + +PyGIArgCache * +pygi_arg_callback_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info, + PyGICallableCache *callable_cache) +{ + gboolean res = FALSE; + PyGICallbackCache *callback_cache; + + callback_cache = g_slice_new0 (PyGICallbackCache); + if (callback_cache == NULL) + return NULL; + + res = pygi_arg_callback_setup_from_info (callback_cache, + type_info, + arg_info, + transfer, + direction, + iface_info, + callable_cache); + if (res) { + return (PyGIArgCache *)callback_cache; + } else { + pygi_arg_cache_free ((PyGIArgCache *)callback_cache); + return NULL; + } +} diff --git a/gi/pygi-closure.h b/gi/pygi-closure.h index 6f98339..8a52b86 100644 --- a/gi/pygi-closure.h +++ b/gi/pygi-closure.h @@ -12,9 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_CLOSURE_H__ @@ -24,6 +22,8 @@ #include #include +#include "pygi-cache.h" + G_BEGIN_DECLS @@ -40,17 +40,27 @@ typedef struct _PyGICClosure GIScopeType scope; PyObject* user_data; + + PyGIClosureCache *cache; } PyGICClosure; void _pygi_closure_handle (ffi_cif *cif, void *result, void **args, void *userdata); -void _pygi_invoke_closure_free (gpointer user_data); +void _pygi_invoke_closure_free (PyGICClosure* invoke_closure); PyGICClosure* _pygi_make_native_closure (GICallableInfo* info, + PyGIClosureCache *cache, GIScopeType scope, PyObject *function, - gpointer user_data); + PyObject *user_data); + +PyGIArgCache *pygi_arg_callback_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info, + PyGICallableCache *callable_cache); G_END_DECLS diff --git a/gi/pygi-enum-marshal.c b/gi/pygi-enum-marshal.c new file mode 100644 index 0000000..15a489d --- /dev/null +++ b/gi/pygi-enum-marshal.c @@ -0,0 +1,407 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include + +#include "pygi-enum-marshal.h" +#include "pygi-type.h" +#include "pygenum.h" +#include "pygflags.h" + +static gboolean +gi_argument_from_c_long (GIArgument *arg_out, + long c_long_in, + GITypeTag type_tag) +{ + switch (type_tag) { + case GI_TYPE_TAG_INT8: + arg_out->v_int8 = (gint8)c_long_in; + return TRUE; + case GI_TYPE_TAG_UINT8: + arg_out->v_uint8 = (guint8)c_long_in; + return TRUE; + case GI_TYPE_TAG_INT16: + arg_out->v_int16 = (gint16)c_long_in; + return TRUE; + case GI_TYPE_TAG_UINT16: + arg_out->v_uint16 = (guint16)c_long_in; + return TRUE; + case GI_TYPE_TAG_INT32: + arg_out->v_int32 = (gint32)c_long_in; + return TRUE; + case GI_TYPE_TAG_UINT32: + arg_out->v_uint32 = (guint32)c_long_in; + return TRUE; + case GI_TYPE_TAG_INT64: + arg_out->v_int64 = (gint64)c_long_in; + return TRUE; + case GI_TYPE_TAG_UINT64: + arg_out->v_uint64 = (guint64)c_long_in; + return TRUE; + default: + PyErr_Format (PyExc_TypeError, + "Unable to marshal C long %ld to %s", + c_long_in, + g_type_tag_to_string (type_tag)); + return FALSE; + } +} + +static gboolean +gi_argument_to_c_long (GIArgument *arg_in, + long *c_long_out, + GITypeTag type_tag) +{ + switch (type_tag) { + case GI_TYPE_TAG_INT8: + *c_long_out = arg_in->v_int8; + return TRUE; + case GI_TYPE_TAG_UINT8: + *c_long_out = arg_in->v_uint8; + return TRUE; + case GI_TYPE_TAG_INT16: + *c_long_out = arg_in->v_int16; + return TRUE; + case GI_TYPE_TAG_UINT16: + *c_long_out = arg_in->v_uint16; + return TRUE; + case GI_TYPE_TAG_INT32: + *c_long_out = arg_in->v_int32; + return TRUE; + case GI_TYPE_TAG_UINT32: + *c_long_out = arg_in->v_uint32; + return TRUE; + case GI_TYPE_TAG_INT64: + if (arg_in->v_int64 > G_MAXLONG || arg_in->v_int64 < G_MINLONG) { + PyErr_Format (PyExc_TypeError, + "Unable to marshal %s to C long", + g_type_tag_to_string(type_tag)); + return FALSE; + } + *c_long_out = (glong)arg_in->v_int64; + return TRUE; + case GI_TYPE_TAG_UINT64: + if (arg_in->v_uint64 > G_MAXLONG) { + PyErr_Format (PyExc_TypeError, + "Unable to marshal %s to C long", + g_type_tag_to_string(type_tag)); + return FALSE; + } + *c_long_out = (glong)arg_in->v_uint64; + return TRUE; + default: + PyErr_Format (PyExc_TypeError, + "Unable to marshal %s to C long", + g_type_tag_to_string (type_tag)); + return FALSE; + } +} + +static gboolean +_pygi_marshal_from_py_interface_enum (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyObject *py_long; + long c_long; + gint is_instance; + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + GIBaseInfo *interface = NULL; + + is_instance = PyObject_IsInstance (py_arg, iface_cache->py_type); + + py_long = PyNumber_Long (py_arg); + if (py_long == NULL) { + PyErr_Clear(); + goto err; + } + + c_long = PyLong_AsLong (py_long); + Py_DECREF (py_long); + + /* Write c_long into arg */ + interface = g_type_info_get_interface (arg_cache->type_info); + assert(g_base_info_get_type (interface) == GI_INFO_TYPE_ENUM); + if (!gi_argument_from_c_long(arg, + c_long, + g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { + g_assert_not_reached(); + g_base_info_unref (interface); + return FALSE; + } + + /* If this is not an instance of the Enum type that we want + * we need to check if the value is equivilant to one of the + * Enum's memebers */ + if (!is_instance) { + int i; + gboolean is_found = FALSE; + + for (i = 0; i < g_enum_info_get_n_values (iface_cache->interface_info); i++) { + GIValueInfo *value_info = + g_enum_info_get_value (iface_cache->interface_info, i); + gint64 enum_value = g_value_info_get_value (value_info); + g_base_info_unref ( (GIBaseInfo *)value_info); + if (c_long == enum_value) { + is_found = TRUE; + break; + } + } + + if (!is_found) + goto err; + } + + g_base_info_unref (interface); + return TRUE; + +err: + if (interface) + g_base_info_unref (interface); + PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s", + iface_cache->type_name, Py_TYPE (py_arg)->tp_name); + return FALSE; +} + +static gboolean +_pygi_marshal_from_py_interface_flags (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyObject *py_long; + unsigned long c_ulong; + gint is_instance; + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + GIBaseInfo *interface; + + is_instance = PyObject_IsInstance (py_arg, iface_cache->py_type); + + py_long = PyNumber_Long (py_arg); + if (py_long == NULL) { + PyErr_Clear (); + goto err; + } + + c_ulong = PyLong_AsUnsignedLongMask (py_long); + Py_DECREF (py_long); + + /* only 0 or argument of type Flag is allowed */ + if (!is_instance && c_ulong != 0) + goto err; + + /* Write c_long into arg */ + interface = g_type_info_get_interface (arg_cache->type_info); + g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_FLAGS); + if (!gi_argument_from_c_long(arg, c_ulong, + g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { + g_base_info_unref (interface); + return FALSE; + } + + g_base_info_unref (interface); + return TRUE; + +err: + PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s", + iface_cache->type_name, Py_TYPE (py_arg)->tp_name); + return FALSE; + +} + +static PyObject * +_pygi_marshal_to_py_interface_enum (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyObject *py_obj = NULL; + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + GIBaseInfo *interface; + long c_long; + + interface = g_type_info_get_interface (arg_cache->type_info); + g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_ENUM); + + if (!gi_argument_to_c_long(arg, &c_long, + g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { + return NULL; + } + + if (iface_cache->g_type == G_TYPE_NONE) { + py_obj = PyObject_CallFunction (iface_cache->py_type, "l", c_long); + } else { + py_obj = pyg_enum_from_gtype (iface_cache->g_type, (gint)c_long); + } + g_base_info_unref (interface); + return py_obj; +} + +static PyObject * +_pygi_marshal_to_py_interface_flags (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyObject *py_obj = NULL; + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + GIBaseInfo *interface; + long c_long; + + interface = g_type_info_get_interface (arg_cache->type_info); + g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_FLAGS); + + if (!gi_argument_to_c_long(arg, &c_long, + g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { + g_base_info_unref (interface); + return NULL; + } + + g_base_info_unref (interface); + if (iface_cache->g_type == G_TYPE_NONE) { + /* An enum with a GType of None is an enum without GType */ + + PyObject *py_type = pygi_type_import_by_gi_info (iface_cache->interface_info); + PyObject *py_args = NULL; + + if (!py_type) + return NULL; + + py_args = PyTuple_New (1); + if (PyTuple_SetItem (py_args, 0, PyLong_FromLong (c_long)) != 0) { + Py_DECREF (py_args); + Py_DECREF (py_type); + return NULL; + } + + py_obj = PyObject_CallFunction (py_type, "l", c_long); + + Py_DECREF (py_args); + Py_DECREF (py_type); + } else { + py_obj = pyg_flags_from_gtype (iface_cache->g_type, (guint)c_long); + } + + return py_obj; +} + +static gboolean +pygi_arg_enum_setup_from_info (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction) +{ + if (direction & PYGI_DIRECTION_FROM_PYTHON) + arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_enum; + + if (direction & PYGI_DIRECTION_TO_PYTHON) + arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_enum; + + return TRUE; +} + + +PyGIArgCache * +pygi_arg_enum_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info) +{ + gboolean res = FALSE; + PyGIArgCache *cache = NULL; + + cache = pygi_arg_interface_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info); + if (cache == NULL) + return NULL; + + res = pygi_arg_enum_setup_from_info (cache, + type_info, + arg_info, + transfer, + direction); + if (res) { + return cache; + } else { + pygi_arg_cache_free (cache); + return NULL; + } +} + +static gboolean +pygi_arg_flags_setup_from_info (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction) +{ + if (direction & PYGI_DIRECTION_FROM_PYTHON) + arg_cache->from_py_marshaller = _pygi_marshal_from_py_interface_flags; + + if (direction & PYGI_DIRECTION_TO_PYTHON) + arg_cache->to_py_marshaller = _pygi_marshal_to_py_interface_flags; + + return TRUE; +} + + +PyGIArgCache * +pygi_arg_flags_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info) +{ + gboolean res = FALSE; + PyGIArgCache *cache = NULL; + + cache = pygi_arg_interface_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info); + if (cache == NULL) + return NULL; + + res = pygi_arg_flags_setup_from_info (cache, + type_info, + arg_info, + transfer, + direction); + if (res) { + return cache; + } else { + pygi_arg_cache_free (cache); + return NULL; + } +} diff --git a/gi/pygi-enum-marshal.h b/gi/pygi-enum-marshal.h new file mode 100644 index 0000000..2fdcbc4 --- /dev/null +++ b/gi/pygi-enum-marshal.h @@ -0,0 +1,42 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_ENUM_MARSHAL_H__ +#define __PYGI_ENUM_MARSHAL_H__ + +#include +#include "pygi-cache.h" + +G_BEGIN_DECLS + +PyGIArgCache *pygi_arg_enum_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info); + +PyGIArgCache *pygi_arg_flags_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info); + +G_END_DECLS + +#endif /*__PYGI_ENUM_MARSHAL_H__*/ diff --git a/gi/pygi-error.c b/gi/pygi-error.c new file mode 100644 index 0000000..de6b7c1 --- /dev/null +++ b/gi/pygi-error.c @@ -0,0 +1,374 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 1998-2003 James Henstridge + * 2004-2008 Johan Dahlin + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include "pygi-error.h" +#include "pygi-type.h" +#include "pygi-util.h" +#include "pygi-basictype.h" + + +PyObject *PyGError = NULL; + +/** + * pygi_error_marshal_to_py: + * @error: a pointer to the GError. + * + * Checks to see if @error has been set. If @error has been set, then a + * GLib.GError Python exception object is returned (but not raised). + * If not error is set returns Py_None. + * + * Returns: a GLib.GError Python exception object, or Py_None, + * or NULL and sets an error if creating the exception object fails. + */ +PyObject * +pygi_error_marshal_to_py (GError **error) +{ + PyGILState_STATE state; + PyObject *exc_type; + PyObject *exc_instance; + const char *domain = NULL; + + g_return_val_if_fail(error != NULL, NULL); + + if (*error == NULL) + Py_RETURN_NONE; + + state = PyGILState_Ensure(); + + exc_type = PyGError; + + if ((*error)->domain) { + domain = g_quark_to_string ((*error)->domain); + } + + exc_instance = PyObject_CallFunction (exc_type, "ssi", + (*error)->message, + domain, + (*error)->code); + + PyGILState_Release(state); + + return exc_instance; +} + +/** + * pygi_error_check: + * @error: a pointer to the GError. + * + * Checks to see if the GError has been set. If the error has been + * set, then the glib.GError Python exception will be raised, and + * the GError cleared. + * + * Returns: True if an error was set. + */ +gboolean +pygi_error_check (GError **error) +{ + PyGILState_STATE state; + PyObject *exc_instance; + + g_return_val_if_fail(error != NULL, FALSE); + if (*error == NULL) + return FALSE; + + state = PyGILState_Ensure(); + + exc_instance = pygi_error_marshal_to_py (error); + if (exc_instance != NULL) { + PyErr_SetObject(PyGError, exc_instance); + Py_DECREF(exc_instance); + } else { + PyErr_Print (); + PyErr_SetString (PyExc_RuntimeError, "Converting the GError failed"); + } + g_clear_error(error); + + PyGILState_Release(state); + + return TRUE; +} + +/** + * pygi_error_marshal_from_py: + * @pyerr: A Python exception instance. + * @error: a standard GLib GError ** output parameter + * + * Converts from a Python implemented GError into a GError. + * + * Returns: TRUE if the conversion was successful, otherwise a Python exception + * is set and FALSE is returned. + */ +gboolean +pygi_error_marshal_from_py (PyObject *pyerr, GError **error) +{ + gint code; + gchar *message = NULL; + gchar *domain = NULL; + gboolean res = FALSE; + PyObject *py_message = NULL, + *py_domain = NULL, + *py_code = NULL; + + if (PyObject_IsInstance (pyerr, PyGError) != 1) { + PyErr_Format (PyExc_TypeError, "Must be GLib.Error, not %s", + Py_TYPE (pyerr)->tp_name); + return FALSE; + } + + py_message = PyObject_GetAttrString (pyerr, "message"); + if (!py_message) { + PyErr_SetString (PyExc_ValueError, + "GLib.Error instances must have a 'message' string attribute"); + goto cleanup; + } + + if (!pygi_utf8_from_py (py_message, &message)) + goto cleanup; + + py_domain = PyObject_GetAttrString (pyerr, "domain"); + if (!py_domain) { + PyErr_SetString (PyExc_ValueError, + "GLib.Error instances must have a 'domain' string attribute"); + goto cleanup; + } + + if (!pygi_utf8_from_py (py_domain, &domain)) + goto cleanup; + + py_code = PyObject_GetAttrString (pyerr, "code"); + if (!py_code) { + PyErr_SetString (PyExc_ValueError, + "GLib.Error instances must have a 'code' int attribute"); + goto cleanup; + } + + if (!pygi_gint_from_py (py_code, &code)) + goto cleanup; + + res = TRUE; + g_set_error_literal (error, + g_quark_from_string (domain), + code, + message); + +cleanup: + g_free (message); + g_free (domain); + Py_XDECREF (py_message); + Py_XDECREF (py_code); + Py_XDECREF (py_domain); + return res; +} + +/** + * pygi_gerror_exception_check: + * @error: a standard GLib GError ** output parameter + * + * Checks to see if a GError exception has been raised, and if so + * translates the python exception to a standard GLib GError. If the + * raised exception is not a GError then PyErr_Print() is called. + * + * Returns: 0 if no exception has been raised, -1 if it is a + * valid glib.GError, -2 otherwise. + */ +gboolean +pygi_gerror_exception_check (GError **error) +{ + int res = -1; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (type == NULL) + return 0; + PyErr_NormalizeException(&type, &value, &traceback); + if (value == NULL) { + PyErr_Restore(type, value, traceback); + PyErr_Print(); + return -2; + } + if (!value || + !PyErr_GivenExceptionMatches(type, + (PyObject *) PyGError)) { + PyErr_Restore(type, value, traceback); + PyErr_Print(); + return -2; + } + Py_DECREF(type); + Py_XDECREF(traceback); + + if (!pygi_error_marshal_from_py (value, error)) { + PyErr_Print(); + res = -2; + } + + Py_DECREF(value); + return res; + +} + +static gboolean +_pygi_marshal_from_py_gerror (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + GError *error = NULL; + if (pygi_error_marshal_from_py (py_arg, &error)) { + arg->v_pointer = error; + *cleanup_data = error; + return TRUE; + } else { + return FALSE; + } +} + + +static void +_pygi_marshal_from_py_gerror_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + if (was_processed) { + g_error_free ((GError *)data); + } +} + +static PyObject * +_pygi_marshal_to_py_gerror (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + GError *error = arg->v_pointer; + PyObject *py_obj = NULL; + + py_obj = pygi_error_marshal_to_py (&error); + + if (arg_cache->transfer == GI_TRANSFER_EVERYTHING && error != NULL) { + g_error_free (error); + } + + return py_obj; +} + +static gboolean +pygi_arg_gerror_setup_from_info (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction) +{ + if (!pygi_arg_base_setup (arg_cache, type_info, arg_info, transfer, direction)) { + return FALSE; + } + + if (direction & PYGI_DIRECTION_FROM_PYTHON) { + arg_cache->from_py_marshaller = _pygi_marshal_from_py_gerror; + + /* Assign cleanup function if we manage memory after call completion. */ + if (arg_cache->transfer == GI_TRANSFER_NOTHING) { + arg_cache->from_py_cleanup = _pygi_marshal_from_py_gerror_cleanup; + } + } + + if (direction & PYGI_DIRECTION_TO_PYTHON) { + arg_cache->to_py_marshaller = _pygi_marshal_to_py_gerror; + arg_cache->meta_type = PYGI_META_ARG_TYPE_PARENT; + } + + return TRUE; +} + +PyGIArgCache * +pygi_arg_gerror_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction) +{ + gboolean res = FALSE; + PyGIArgCache *arg_cache; + + arg_cache = pygi_arg_cache_alloc (); + + res = pygi_arg_gerror_setup_from_info (arg_cache, + type_info, + arg_info, + transfer, + direction); + if (res) { + return arg_cache; + } else { + pygi_arg_cache_free (arg_cache); + return NULL; + } +} + +static PyObject * +pygerror_from_gvalue (const GValue *value) +{ + GError *gerror = (GError *) g_value_get_boxed (value); + PyObject *pyerr = pygi_error_marshal_to_py (&gerror); + return pyerr; +} + +static int +pygerror_to_gvalue (GValue *value, PyObject *pyerror) +{ + GError *gerror = NULL; + + if (pygi_error_marshal_from_py (pyerror, &gerror)) { + g_value_take_boxed (value, gerror); + return 0; + } + + return -1; +} + +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_error_register_types (PyObject *module) +{ + PyObject *error_module = PyImport_ImportModule ("gi._error"); + if (!error_module) { + return -1; + } + + /* Stash a reference to the Python implemented gi._error.GError. */ + PyGError = PyObject_GetAttrString (error_module, "GError"); + Py_DECREF (error_module); + if (PyGError == NULL) + return -1; + + pyg_register_gtype_custom (G_TYPE_ERROR, + pygerror_from_gvalue, + pygerror_to_gvalue); + + return 0; +} + diff --git a/gi/pygi-error.h b/gi/pygi-error.h new file mode 100644 index 0000000..3e6c414 --- /dev/null +++ b/gi/pygi-error.h @@ -0,0 +1,50 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 1998-2003 James Henstridge + * 2004-2008 Johan Dahlin + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_ERROR_H__ +#define __PYGI_ERROR_H__ + +#include +#include "pygi-cache.h" + +G_BEGIN_DECLS + +extern PyObject *PyGError; + +gboolean pygi_error_check (GError **error); + +PyObject* pygi_error_marshal_to_py (GError **error); + +gboolean pygi_error_marshal_from_py (PyObject *pyerr, + GError **error); + +gboolean pygi_gerror_exception_check (GError **error); + +PyGIArgCache* pygi_arg_gerror_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction); + +int pygi_error_register_types (PyObject *module); + +G_END_DECLS + +#endif /*__PYGI_ERROR_H__*/ diff --git a/gi/pygi-foreign-api.h b/gi/pygi-foreign-api.h new file mode 100644 index 0000000..9367518 --- /dev/null +++ b/gi/pygi-foreign-api.h @@ -0,0 +1,85 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2005-2009 Johan Dahlin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_FOREIGN_API_H__ +#define __PYGI_FOREIGN_API_H__ + +#include +#include + +typedef PyObject * (*PyGIArgOverrideToGIArgumentFunc) (PyObject *value, + GIInterfaceInfo *interface_info, + GITransfer transfer, + GIArgument *arg); +typedef PyObject * (*PyGIArgOverrideFromGIArgumentFunc) (GIInterfaceInfo *interface_info, + GITransfer transfer, + gpointer data); +typedef PyObject * (*PyGIArgOverrideReleaseFunc) (GITypeInfo *type_info, + gpointer struct_); + + +struct PyGI_API { + void (*register_foreign_struct) (const char* namespace_, + const char* name, + PyGIArgOverrideToGIArgumentFunc to_func, + PyGIArgOverrideFromGIArgumentFunc from_func, + PyGIArgOverrideReleaseFunc release_func); +}; + + +#ifndef _INSIDE_PYGOBJECT_ + +static struct PyGI_API *PyGI_API = NULL; + +static int +_pygi_import (void) +{ + if (PyGI_API != NULL) { + return 1; + } + PyGI_API = (struct PyGI_API*) PyCapsule_Import("gi._API", FALSE); + if (PyGI_API == NULL) { + return -1; + } + + return 0; +} + + +static inline PyObject * +pygi_register_foreign_struct (const char* namespace_, + const char* name, + PyGIArgOverrideToGIArgumentFunc to_func, + PyGIArgOverrideFromGIArgumentFunc from_func, + PyGIArgOverrideReleaseFunc release_func) +{ + if (_pygi_import() < 0) { + return NULL; + } + PyGI_API->register_foreign_struct(namespace_, + name, + to_func, + from_func, + release_func); + Py_RETURN_NONE; +} + +#endif /* _INSIDE_PYGOBJECT_ */ + +#endif /* __PYGI_FOREIGN_API_H__ */ diff --git a/gi/pygi-foreign-cairo.c b/gi/pygi-foreign-cairo.c index 3fe6a39..aa01157 100644 --- a/gi/pygi-foreign-cairo.c +++ b/gi/pygi-foreign-cairo.c @@ -21,20 +21,21 @@ * IN THE SOFTWARE. */ -#include #include +#include +#include -#if PY_VERSION_HEX < 0x03000000 -#include -static Pycairo_CAPI_t *Pycairo_CAPI; -#else -#include -#endif - +#include -#include "pygi-foreign.h" +/* Limit includes from PyGI to APIs which do not have link dependencies + * (pygobject.h and pygi-foreign-api.h) since _gi_cairo is built as a separate + * shared library that interacts with PyGI through a PyCapsule API at runtime. + */ +#include -#include +/* + * cairo_t marshaling + */ static PyObject * cairo_context_to_arg (PyObject *value, @@ -44,27 +45,37 @@ cairo_context_to_arg (PyObject *value, { cairo_t *cr; - g_assert (transfer == GI_TRANSFER_NOTHING); + if (!PyObject_TypeCheck (value, &PycairoContext_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Context"); + return NULL; + } cr = PycairoContext_GET (value); if (!cr) { return NULL; } + if (transfer != GI_TRANSFER_NOTHING) + cr = cairo_reference (cr); + arg->v_pointer = cr; Py_RETURN_NONE; } static PyObject * -cairo_context_from_arg (GIInterfaceInfo *interface_info, gpointer data) +cairo_context_from_arg (GIInterfaceInfo *interface_info, + GITransfer transfer, + gpointer data) { cairo_t *context = (cairo_t*) data; - cairo_reference (context); + if (transfer == GI_TRANSFER_NOTHING) + cairo_reference (context); return PycairoContext_FromContext (context, &PycairoContext_Type, NULL); } + static PyObject * cairo_context_release (GIBaseInfo *base_info, gpointer struct_) @@ -73,6 +84,43 @@ cairo_context_release (GIBaseInfo *base_info, Py_RETURN_NONE; } +static int +cairo_context_to_gvalue (GValue *value, PyObject *obj) +{ + cairo_t *cr; + + if (!PyObject_TypeCheck (obj, &PycairoContext_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Context"); + return -1; + } + + cr = PycairoContext_GET (obj); + if (!cr) { + return -1; + } + + /* PycairoContext_GET returns a borrowed reference, use set_boxed + * to add new ref to the context which will be managed by the GValue. */ + g_value_set_boxed (value, cr); + return 0; +} + +static PyObject * +cairo_context_from_gvalue (const GValue *value) +{ + /* PycairoContext_FromContext steals a ref, so we dup it out of the GValue. */ + cairo_t *cr = g_value_dup_boxed (value); + if (!cr) { + Py_RETURN_NONE; + } + + return PycairoContext_FromContext (cr, &PycairoContext_Type, NULL); +} + + +/* + * cairo_surface_t marshaling + */ static PyObject * cairo_surface_to_arg (PyObject *value, @@ -82,7 +130,10 @@ cairo_surface_to_arg (PyObject *value, { cairo_surface_t *surface; - g_assert (transfer == GI_TRANSFER_NOTHING); + if (!PyObject_TypeCheck (value, &PycairoSurface_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Surface"); + return NULL; + } surface = ( (PycairoSurface*) value)->surface; if (!surface) { @@ -90,16 +141,22 @@ cairo_surface_to_arg (PyObject *value, return NULL; } + if (transfer != GI_TRANSFER_NOTHING) + surface = cairo_surface_reference (surface); + arg->v_pointer = surface; Py_RETURN_NONE; } static PyObject * -cairo_surface_from_arg (GIInterfaceInfo *interface_info, gpointer data) +cairo_surface_from_arg (GIInterfaceInfo *interface_info, + GITransfer transfer, + gpointer data) { cairo_surface_t *surface = (cairo_surface_t*) data; - cairo_surface_reference (surface); + if (transfer == GI_TRANSFER_NOTHING) + cairo_surface_reference (surface); return PycairoSurface_FromSurface (surface, NULL); } @@ -112,6 +169,59 @@ cairo_surface_release (GIBaseInfo *base_info, Py_RETURN_NONE; } +static int +cairo_surface_to_gvalue (GValue *value, PyObject *obj) +{ + cairo_surface_t *surface; + + if (!PyObject_TypeCheck (obj, &PycairoSurface_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Surface"); + return -1; + } + + surface = ((PycairoSurface*) obj)->surface; + if (!surface) { + return -1; + } + + /* surface is a borrowed reference, use set_boxed + * to add new ref to the context which will be managed by the GValue. */ + g_value_set_boxed (value, surface); + return 0; +} + +static PyObject * +cairo_surface_from_gvalue (const GValue *value) +{ + /* PycairoSurface_FromSurface steals a ref, so we dup it out of the GValue. */ + cairo_surface_t *surface = g_value_dup_boxed (value); + if (!surface) { + Py_RETURN_NONE; + } + + return PycairoSurface_FromSurface (surface, NULL); +} + + +/* + * cairo_path_t marshaling + */ + +static cairo_path_t * +_cairo_path_copy (cairo_path_t *path) { + cairo_t *cr; + cairo_surface_t *surface; + cairo_path_t *copy; + + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 0, 0); + cr = cairo_create (surface); + cairo_append_path (cr, path); + copy = cairo_copy_path (cr); + cairo_destroy (cr); + cairo_surface_destroy (surface); + + return copy; +} static PyObject * cairo_path_to_arg (PyObject *value, @@ -121,7 +231,10 @@ cairo_path_to_arg (PyObject *value, { cairo_path_t *path; - g_assert (transfer == GI_TRANSFER_NOTHING); + if (!PyObject_TypeCheck (value, &PycairoPath_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Path"); + return NULL; + } path = ( (PycairoPath*) value)->path; if (!path) { @@ -129,15 +242,25 @@ cairo_path_to_arg (PyObject *value, return NULL; } + if (transfer != GI_TRANSFER_NOTHING) + path = _cairo_path_copy (path); + arg->v_pointer = path; Py_RETURN_NONE; } static PyObject * -cairo_path_from_arg (GIInterfaceInfo *interface_info, gpointer data) +cairo_path_from_arg (GIInterfaceInfo *interface_info, + GITransfer transfer, + gpointer data) { cairo_path_t *path = (cairo_path_t*) data; + if (transfer == GI_TRANSFER_NOTHING) { + PyErr_SetString(PyExc_TypeError, "Unsupported annotation (transfer none) for cairo.Path return"); + return NULL; + } + return PycairoPath_FromPath (path); } @@ -149,6 +272,46 @@ cairo_path_release (GIBaseInfo *base_info, Py_RETURN_NONE; } + +/* + * cairo_font_face_t marshaling + */ + +static int +cairo_font_face_to_gvalue (GValue *value, PyObject *obj) +{ + cairo_font_face_t *font_face; + + if (!PyObject_TypeCheck (obj, &PycairoFontFace_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.FontFace"); + return -1; + } + + font_face = ((PycairoFontFace*) obj)->font_face; + if (!font_face) { + return -1; + } + + g_value_set_boxed (value, font_face); + return 0; +} + +static PyObject * +cairo_font_face_from_gvalue (const GValue *value) +{ + cairo_font_face_t *font_face = g_value_dup_boxed (value); + if (!font_face) { + Py_RETURN_NONE; + } + + return PycairoFontFace_FromFontFace (font_face); +} + + +/* + * cairo_font_options_t marshaling + */ + static PyObject * cairo_font_options_to_arg (PyObject *value, GIInterfaceInfo *interface_info, @@ -157,7 +320,10 @@ cairo_font_options_to_arg (PyObject *value, { cairo_font_options_t *font_options; - g_assert (transfer == GI_TRANSFER_NOTHING); + if (!PyObject_TypeCheck (value, &PycairoFontOptions_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.FontOptions"); + return NULL; + } font_options = ( (PycairoFontOptions*) value)->font_options; if (!font_options) { @@ -165,16 +331,24 @@ cairo_font_options_to_arg (PyObject *value, return NULL; } + if (transfer != GI_TRANSFER_NOTHING) + font_options = cairo_font_options_copy (font_options); + arg->v_pointer = font_options; Py_RETURN_NONE; } static PyObject * -cairo_font_options_from_arg (GIInterfaceInfo *interface_info, gpointer data) +cairo_font_options_from_arg (GIInterfaceInfo *interface_info, + GITransfer transfer, + gpointer data) { cairo_font_options_t *font_options = (cairo_font_options_t*) data; - return PycairoFontOptions_FromFontOptions (cairo_font_options_copy (font_options)); + if (transfer == GI_TRANSFER_NOTHING) + font_options = cairo_font_options_copy (font_options); + + return PycairoFontOptions_FromFontOptions (font_options); } static PyObject * @@ -185,17 +359,297 @@ cairo_font_options_release (GIBaseInfo *base_info, Py_RETURN_NONE; } -static PyMethodDef _gi_cairo_functions[] = { {0,} }; -PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo") + +/* + * scaled_font_t marshaling + */ + +static int +cairo_scaled_font_to_gvalue (GValue *value, PyObject *obj) +{ + cairo_scaled_font_t *scaled_font; + + if (!PyObject_TypeCheck (obj, &PycairoScaledFont_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.ScaledFont"); + return -1; + } + + scaled_font = ((PycairoScaledFont*) obj)->scaled_font; + if (!scaled_font) { + return -1; + } + + /* scaled_font is a borrowed reference, use set_boxed + * to add new ref to the context which will be managed by the GValue. */ + g_value_set_boxed (value, scaled_font); + return 0; +} + +static PyObject * +cairo_scaled_font_from_gvalue (const GValue *value) +{ + /* PycairoScaledFont_FromScaledFont steals a ref, so we dup it out of the GValue. */ + cairo_scaled_font_t *scaled_font = g_value_dup_boxed (value); + if (!scaled_font) { + Py_RETURN_NONE; + } + + return PycairoScaledFont_FromScaledFont (scaled_font); +} + + +/* + * cairo_pattern_t marshaling + */ + +static PyObject * +cairo_pattern_to_arg (PyObject *value, + GIInterfaceInfo *interface_info, + GITransfer transfer, + GIArgument *arg) +{ + cairo_pattern_t *pattern; + + if (!PyObject_TypeCheck (value, &PycairoPattern_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Pattern"); + return NULL; + } + + pattern = ((PycairoPattern*) value)->pattern; + if (!pattern) { + PyErr_SetString (PyExc_ValueError, "Pattern instance wrapping a NULL pattern"); + return NULL; + } + + if (transfer != GI_TRANSFER_NOTHING) + pattern = cairo_pattern_reference (pattern); + + arg->v_pointer = pattern; + Py_RETURN_NONE; +} + +static PyObject * +cairo_pattern_from_arg (GIInterfaceInfo *interface_info, + GITransfer transfer, + gpointer data) +{ + cairo_pattern_t *pattern = (cairo_pattern_t*) data; + + if (transfer == GI_TRANSFER_NOTHING) + pattern = cairo_pattern_reference (pattern); + + return PycairoPattern_FromPattern (pattern, NULL); +} + +static PyObject * +cairo_pattern_release (GIBaseInfo *base_info, + gpointer struct_) +{ + cairo_pattern_destroy ( (cairo_pattern_t*) struct_); + Py_RETURN_NONE; +} + +static int +cairo_pattern_to_gvalue (GValue *value, PyObject *obj) +{ + cairo_pattern_t *pattern; + + if (!PyObject_TypeCheck (obj, &PycairoPattern_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Pattern"); + return -1; + } + + pattern = ((PycairoPattern*) obj)->pattern; + if (!pattern) { + return -1; + } + + /* pattern is a borrowed reference, use set_boxed + * to add new ref to the context which will be managed by the GValue. */ + g_value_set_boxed (value, pattern); + return 0; +} + +static PyObject * +cairo_pattern_from_gvalue (const GValue *value) { -#if PY_VERSION_HEX < 0x03000000 - Pycairo_IMPORT; + /* PycairoPattern_FromPattern steals a ref, so we dup it out of the GValue. */ + cairo_pattern_t *pattern = g_value_dup_boxed (value); + if (!pattern) { + Py_RETURN_NONE; + } + + return PycairoPattern_FromPattern (pattern, NULL); +} + +static PyObject * +cairo_region_to_arg (PyObject *value, + GIInterfaceInfo *interface_info, + GITransfer transfer, + GIArgument *arg) +{ + cairo_region_t *region; + + if (!PyObject_TypeCheck (value, &PycairoRegion_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Region"); + return NULL; + } + + region = ( (PycairoRegion*) value)->region; + if (!region) { + PyErr_SetString (PyExc_ValueError, "Region instance wrapping a NULL region"); + return NULL; + } + + if (transfer != GI_TRANSFER_NOTHING) + region = cairo_region_copy (region); + + arg->v_pointer = region; + Py_RETURN_NONE; +} + +static PyObject * +cairo_region_from_arg (GIInterfaceInfo *interface_info, + GITransfer transfer, + gpointer data) +{ + cairo_region_t *region = (cairo_region_t*) data; + + if (transfer == GI_TRANSFER_NOTHING) + cairo_region_reference (region); + + return PycairoRegion_FromRegion (region); +} + +static PyObject * +cairo_region_release (GIBaseInfo *base_info, + gpointer struct_) +{ + cairo_region_destroy ( (cairo_region_t*) struct_); + Py_RETURN_NONE; +} + +static PyObject * +cairo_matrix_from_arg (GIInterfaceInfo *interface_info, + GITransfer transfer, + gpointer data) +{ + cairo_matrix_t *matrix = (cairo_matrix_t*) data; + + if (transfer != GI_TRANSFER_NOTHING) { + PyErr_SetString(PyExc_TypeError, "Unsupported annotation (transfer full) for cairo.Matrix"); + return NULL; + } + + if (matrix == NULL) { + /* NULL in case of caller-allocates */ + cairo_matrix_t temp = {0}; + return PycairoMatrix_FromMatrix (&temp); + } + + return PycairoMatrix_FromMatrix (matrix); +} + +static PyObject * +cairo_matrix_to_arg (PyObject *value, + GIInterfaceInfo *interface_info, + GITransfer transfer, + GIArgument *arg) +{ + cairo_matrix_t *matrix; + + if (!PyObject_TypeCheck (value, &PycairoMatrix_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Matrix"); + return NULL; + } + + matrix = &(( (PycairoMatrix*) value)->matrix); + + arg->v_pointer = matrix; + Py_RETURN_NONE; +} + +static PyObject * +cairo_matrix_release (GIBaseInfo *base_info, + gpointer struct_) +{ + Py_RETURN_NONE; +} + +static int +cairo_matrix_to_gvalue (GValue *value, PyObject *obj) +{ + cairo_matrix_t *matrix; + + if (!PyObject_TypeCheck (obj, &PycairoMatrix_Type)) { + PyErr_SetString (PyExc_TypeError, "Expected cairo.Matrix"); + return -1; + } + + matrix = &(( (PycairoMatrix*) obj)->matrix); + if (!matrix) { + return -1; + } + + g_value_set_boxed (value, matrix); + return 0; +} + +static PyObject * +cairo_matrix_from_gvalue (const GValue *value) +{ + cairo_matrix_t *matrix = g_value_get_boxed(value); + if (!matrix) { + Py_RETURN_NONE; + } + + return PycairoMatrix_FromMatrix (matrix); +} + +#ifdef __GNUC__ +#define PYGI_MODINIT_FUNC __attribute__((visibility("default"))) PyMODINIT_FUNC #else - import_cairo(); +#define PYGI_MODINIT_FUNC PyMODINIT_FUNC #endif +static PyMethodDef _gi_cairo_functions[] = { {0,} }; + +static struct PyModuleDef __gi_cairomodule = { + PyModuleDef_HEAD_INIT, + "_gi_cairo", + NULL, + -1, + _gi_cairo_functions, + NULL, + NULL, + NULL, + NULL +}; + +PYGI_MODINIT_FUNC PyInit__gi_cairo (void); + +PYGI_MODINIT_FUNC PyInit__gi_cairo (void) +{ + PyObject *module; + module = PyModule_Create (&__gi_cairomodule); + + PyObject *gobject_mod; + + import_cairo(); + if (Pycairo_CAPI == NULL) - return PYGLIB_MODULE_ERROR_RETURN; + return NULL; + + gobject_mod = pygobject_init (3, 13, 2); + if (gobject_mod == NULL) + return NULL; + Py_DECREF (gobject_mod); + + pygi_register_foreign_struct ("cairo", + "Matrix", + cairo_matrix_to_arg, + cairo_matrix_from_arg, + cairo_matrix_release); pygi_register_foreign_struct ("cairo", "Context", @@ -220,5 +674,42 @@ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo") cairo_font_options_to_arg, cairo_font_options_from_arg, cairo_font_options_release); -} -PYGLIB_MODULE_END; + + pygi_register_foreign_struct ("cairo", + "Pattern", + cairo_pattern_to_arg, + cairo_pattern_from_arg, + cairo_pattern_release); + + pygi_register_foreign_struct ("cairo", + "Region", + cairo_region_to_arg, + cairo_region_from_arg, + cairo_region_release); + + pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_MATRIX, + cairo_matrix_from_gvalue, + cairo_matrix_to_gvalue); + + pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_CONTEXT, + cairo_context_from_gvalue, + cairo_context_to_gvalue); + + pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_SURFACE, + cairo_surface_from_gvalue, + cairo_surface_to_gvalue); + + pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_FONT_FACE, + cairo_font_face_from_gvalue, + cairo_font_face_to_gvalue); + + pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_SCALED_FONT, + cairo_scaled_font_from_gvalue, + cairo_scaled_font_to_gvalue); + + pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_PATTERN, + cairo_pattern_from_gvalue, + cairo_pattern_to_gvalue); + + return module; +} \ No newline at end of file diff --git a/gi/pygi-foreign.c b/gi/pygi-foreign.c index 7537399..80a19f7 100644 --- a/gi/pygi-foreign.c +++ b/gi/pygi-foreign.c @@ -22,11 +22,9 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include -#include "pygobject.h" +#include "pygobject-internal.h" #include "pygi-foreign.h" #include @@ -50,7 +48,7 @@ init_foreign_structs (void) static PyGIForeignStruct * do_lookup (const gchar *namespace, const gchar *name) { - gint i; + guint i; for (i = 0; i < foreign_structs->len; i++) { PyGIForeignStruct *foreign_struct = \ g_ptr_array_index (foreign_structs, i); @@ -63,24 +61,24 @@ do_lookup (const gchar *namespace, const gchar *name) return NULL; } +static PyObject * +pygi_struct_foreign_load_module (const char *namespace) +{ + gchar *module_name = g_strconcat ("gi._gi_", namespace, NULL); + PyObject *module = PyImport_ImportModule (module_name); + g_free (module_name); + return module; +} + static PyGIForeignStruct * -pygi_struct_foreign_lookup (GIBaseInfo *base_info) +pygi_struct_foreign_lookup_by_name (const char *namespace, const char *name) { PyGIForeignStruct *result; - const gchar *namespace = g_base_info_get_namespace (base_info); - const gchar *name = g_base_info_get_name (base_info); - - if (foreign_structs == NULL) { - init_foreign_structs (); - } result = do_lookup (namespace, name); if (result == NULL) { - gchar *module_name = g_strconcat ("gi._gi_", namespace, NULL); - PyObject *module = PyImport_ImportModule (module_name); - - g_free (module_name); + PyObject *module = pygi_struct_foreign_load_module (namespace); if (module == NULL) PyErr_Clear (); @@ -92,7 +90,7 @@ pygi_struct_foreign_lookup (GIBaseInfo *base_info) if (result == NULL) { PyErr_Format (PyExc_TypeError, - "Couldn't find conversion for foreign struct '%s.%s'", + "Couldn't find foreign struct converter for '%s.%s'", namespace, name); } @@ -100,6 +98,15 @@ pygi_struct_foreign_lookup (GIBaseInfo *base_info) return result; } +static PyGIForeignStruct * +pygi_struct_foreign_lookup (GIBaseInfo *base_info) +{ + const gchar *namespace = g_base_info_get_namespace (base_info); + const gchar *name = g_base_info_get_name (base_info); + + return pygi_struct_foreign_lookup_by_name (namespace, name); +} + PyObject * pygi_struct_foreign_convert_to_g_argument (PyObject *value, GIInterfaceInfo *interface_info, @@ -123,6 +130,7 @@ pygi_struct_foreign_convert_to_g_argument (PyObject *value, PyObject * pygi_struct_foreign_convert_from_g_argument (GIInterfaceInfo *interface_info, + GITransfer transfer, GIArgument *arg) { GIBaseInfo *base_info = (GIBaseInfo *) interface_info; @@ -131,7 +139,7 @@ pygi_struct_foreign_convert_from_g_argument (GIInterfaceInfo *interface_info, if (foreign_struct == NULL) return NULL; - return foreign_struct->from_func (interface_info, arg); + return foreign_struct->from_func (interface_info, transfer, arg); } PyObject * @@ -150,11 +158,11 @@ pygi_struct_foreign_release (GIBaseInfo *base_info, } void -pygi_register_foreign_struct_real (const char* namespace_, - const char* name, - PyGIArgOverrideToGIArgumentFunc to_func, - PyGIArgOverrideFromGIArgumentFunc from_func, - PyGIArgOverrideReleaseFunc release_func) +pygi_register_foreign_struct (const char* namespace_, + const char* name, + PyGIArgOverrideToGIArgumentFunc to_func, + PyGIArgOverrideFromGIArgumentFunc from_func, + PyGIArgOverrideReleaseFunc release_func) { PyGIForeignStruct *new_struct = g_slice_new (PyGIForeignStruct); new_struct->namespace = namespace_; @@ -165,3 +173,63 @@ pygi_register_foreign_struct_real (const char* namespace_, g_ptr_array_add (foreign_structs, new_struct); } + +PyObject * +pygi_require_foreign (PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "namespace", "symbol", NULL }; + const char *namespace = NULL; + const char *symbol = NULL; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, + "s|z:require_foreign", + kwlist, &namespace, &symbol)) { + return NULL; + } + + if (symbol) { + PyGIForeignStruct *foreign; + foreign = pygi_struct_foreign_lookup_by_name (namespace, symbol); + if (foreign == NULL) { + return NULL; + } + } else { + PyObject *module = pygi_struct_foreign_load_module (namespace); + if (module) { + Py_DECREF (module); + } else { + return NULL; + } + } + + Py_RETURN_NONE; +} + +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_foreign_init (void) +{ + if (foreign_structs == NULL) { + init_foreign_structs (); + } + + return 0; +} + + +PyObject *pygi_register_foreign (PyObject *self, PyObject *args) +{ + /* We need to try loading the foreign modules upfront so the GType + * converters are registered: + * https://gitlab.gnome.org/GNOME/pygobject/issues/260 + */ + PyObject *mod = pygi_struct_foreign_load_module ("cairo"); + if (mod == NULL) + PyErr_Clear (); + else + Py_DECREF (mod); + + Py_RETURN_NONE; +} diff --git a/gi/pygi-foreign.h b/gi/pygi-foreign.h index dd5f896..d4c50dd 100644 --- a/gi/pygi-foreign.h +++ b/gi/pygi-foreign.h @@ -26,23 +26,30 @@ #define __PYGI_FOREIGN_H__ #include -#include - -#include "pygi.h" +#include "pygi-foreign-api.h" PyObject *pygi_struct_foreign_convert_to_g_argument (PyObject *value, GIInterfaceInfo *interface_info, GITransfer transfer, GIArgument *arg); PyObject *pygi_struct_foreign_convert_from_g_argument (GIInterfaceInfo *interface_info, + GITransfer transfer, GIArgument *arg); PyObject *pygi_struct_foreign_release (GITypeInfo *type_info, gpointer struct_); -void pygi_register_foreign_struct_real (const char* namespace_, - const char* name, - PyGIArgOverrideToGIArgumentFunc to_func, - PyGIArgOverrideFromGIArgumentFunc from_func, - PyGIArgOverrideReleaseFunc release_func); +void pygi_register_foreign_struct (const char* namespace_, + const char* name, + PyGIArgOverrideToGIArgumentFunc to_func, + PyGIArgOverrideFromGIArgumentFunc from_func, + PyGIArgOverrideReleaseFunc release_func); + +PyObject *pygi_require_foreign (PyObject *self, + PyObject *args, + PyObject *kwargs); + +int pygi_foreign_init (void); + +PyObject *pygi_register_foreign (PyObject *self, PyObject *args); #endif /* __PYGI_FOREIGN_H__ */ diff --git a/gi/pygi-hashtable.c b/gi/pygi-hashtable.c new file mode 100644 index 0000000..26d5f61 --- /dev/null +++ b/gi/pygi-hashtable.c @@ -0,0 +1,420 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include "pygi-hashtable.h" +#include "pygi-argument.h" +#include "pygi-util.h" + +typedef struct _PyGIHashCache +{ + PyGIArgCache arg_cache; + PyGIArgCache *key_cache; + PyGIArgCache *value_cache; +} PyGIHashCache; + + +static void +_hash_cache_free_func (PyGIHashCache *cache) +{ + if (cache != NULL) { + pygi_arg_cache_free (cache->key_cache); + pygi_arg_cache_free (cache->value_cache); + g_slice_free (PyGIHashCache, cache); + } +} + +static gboolean +_pygi_marshal_from_py_ghash (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyGIMarshalFromPyFunc key_from_py_marshaller; + PyGIMarshalFromPyFunc value_from_py_marshaller; + + int i; + Py_ssize_t length; + PyObject *py_keys, *py_values; + + GHashFunc hash_func; + GEqualFunc equal_func; + + GHashTable *hash_ = NULL; + PyGIHashCache *hash_cache = (PyGIHashCache *)arg_cache; + + if (py_arg == Py_None) { + arg->v_pointer = NULL; + return TRUE; + } + + py_keys = PyMapping_Keys (py_arg); + if (py_keys == NULL) { + PyErr_Format (PyExc_TypeError, "Must be mapping, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + length = PyMapping_Length (py_arg); + if (length < 0) { + Py_DECREF (py_keys); + return FALSE; + } + + py_values = PyMapping_Values (py_arg); + if (py_values == NULL) { + Py_DECREF (py_keys); + return FALSE; + } + + key_from_py_marshaller = hash_cache->key_cache->from_py_marshaller; + value_from_py_marshaller = hash_cache->value_cache->from_py_marshaller; + + switch (hash_cache->key_cache->type_tag) { + case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: + hash_func = g_str_hash; + equal_func = g_str_equal; + break; + default: + hash_func = NULL; + equal_func = NULL; + } + + hash_ = g_hash_table_new (hash_func, equal_func); + if (hash_ == NULL) { + PyErr_NoMemory (); + Py_DECREF (py_keys); + Py_DECREF (py_values); + return FALSE; + } + + for (i = 0; i < length; i++) { + GIArgument key, value; + gpointer key_cleanup_data = NULL; + gpointer value_cleanup_data = NULL; + PyObject *py_key = PyList_GET_ITEM (py_keys, i); + PyObject *py_value = PyList_GET_ITEM (py_values, i); + if (py_key == NULL || py_value == NULL) + goto err; + + if (!key_from_py_marshaller ( state, + callable_cache, + hash_cache->key_cache, + py_key, + &key, + &key_cleanup_data)) + goto err; + + if (!value_from_py_marshaller ( state, + callable_cache, + hash_cache->value_cache, + py_value, + &value, + &value_cleanup_data)) + goto err; + + g_hash_table_insert (hash_, + _pygi_arg_to_hash_pointer (&key, hash_cache->key_cache->type_info), + _pygi_arg_to_hash_pointer (&value, hash_cache->value_cache->type_info)); + continue; +err: + /* FIXME: cleanup hash keys and values */ + Py_DECREF (py_keys); + Py_DECREF (py_values); + g_hash_table_unref (hash_); + _PyGI_ERROR_PREFIX ("Item %i: ", i); + return FALSE; + } + + arg->v_pointer = hash_; + + if (arg_cache->transfer == GI_TRANSFER_NOTHING) { + /* Free everything in cleanup. */ + *cleanup_data = arg->v_pointer; + } else if (arg_cache->transfer == GI_TRANSFER_CONTAINER) { + /* Make a shallow copy so we can free the elements later in cleanup + * because it is possible invoke will free the list before our cleanup. */ + *cleanup_data = g_hash_table_ref (arg->v_pointer); + } else { /* GI_TRANSFER_EVERYTHING */ + /* No cleanup, everything is given to the callee. + * Note that the keys and values will leak for transfer everything because + * we do not use g_hash_table_new_full and set key/value_destroy_func. */ + *cleanup_data = NULL; + } + + return TRUE; +} + +static void +_pygi_marshal_cleanup_from_py_ghash (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + if (data == NULL) + return; + + if (was_processed) { + GHashTable *hash_; + PyGIHashCache *hash_cache = (PyGIHashCache *)arg_cache; + + hash_ = (GHashTable *)data; + + /* clean up keys and values first */ + if (hash_cache->key_cache->from_py_cleanup != NULL || + hash_cache->value_cache->from_py_cleanup != NULL) { + GHashTableIter hiter; + gpointer key; + gpointer value; + + PyGIMarshalCleanupFunc key_cleanup_func = + hash_cache->key_cache->from_py_cleanup; + PyGIMarshalCleanupFunc value_cleanup_func = + hash_cache->value_cache->from_py_cleanup; + + g_hash_table_iter_init (&hiter, hash_); + while (g_hash_table_iter_next (&hiter, &key, &value)) { + if (key != NULL && key_cleanup_func != NULL) + key_cleanup_func (state, + hash_cache->key_cache, + NULL, + key, + TRUE); + if (value != NULL && value_cleanup_func != NULL) + value_cleanup_func (state, + hash_cache->value_cache, + NULL, + value, + TRUE); + } + } + + g_hash_table_unref (hash_); + } +} + +static PyObject * +_pygi_marshal_to_py_ghash (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + GHashTable *hash_; + GHashTableIter hash_table_iter; + + PyGIMarshalToPyFunc key_to_py_marshaller; + PyGIMarshalToPyFunc value_to_py_marshaller; + + PyGIArgCache *key_arg_cache; + PyGIArgCache *value_arg_cache; + PyGIHashCache *hash_cache = (PyGIHashCache *)arg_cache; + + GIArgument key_arg; + GIArgument value_arg; + + PyObject *py_obj = NULL; + + hash_ = arg->v_pointer; + + if (hash_ == NULL) { + py_obj = Py_None; + Py_INCREF (py_obj); + return py_obj; + } + + py_obj = PyDict_New (); + if (py_obj == NULL) + return NULL; + + key_arg_cache = hash_cache->key_cache; + key_to_py_marshaller = key_arg_cache->to_py_marshaller; + + value_arg_cache = hash_cache->value_cache; + value_to_py_marshaller = value_arg_cache->to_py_marshaller; + + g_hash_table_iter_init (&hash_table_iter, hash_); + while (g_hash_table_iter_next (&hash_table_iter, + &key_arg.v_pointer, + &value_arg.v_pointer)) { + gpointer key_cleanup_data = NULL; + gpointer value_cleanup_data = NULL; + PyObject *py_key; + PyObject *py_value; + int retval; + + + _pygi_hash_pointer_to_arg (&key_arg, hash_cache->key_cache->type_info); + py_key = key_to_py_marshaller ( state, + callable_cache, + key_arg_cache, + &key_arg, + &key_cleanup_data); + + if (py_key == NULL) { + Py_CLEAR (py_obj); + return NULL; + } + + _pygi_hash_pointer_to_arg (&value_arg, hash_cache->value_cache->type_info); + py_value = value_to_py_marshaller ( state, + callable_cache, + value_arg_cache, + &value_arg, + &value_cleanup_data); + + if (py_value == NULL) { + Py_CLEAR (py_obj); + Py_DECREF(py_key); + return NULL; + } + + retval = PyDict_SetItem (py_obj, py_key, py_value); + + Py_DECREF (py_key); + Py_DECREF (py_value); + + if (retval < 0) { + Py_CLEAR (py_obj); + return NULL; + } + } + + return py_obj; +} + +static void +_pygi_marshal_cleanup_to_py_ghash (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed) +{ + if (data == NULL) + return; + + /* assume hashtable has boxed key and value */ + if (arg_cache->transfer == GI_TRANSFER_EVERYTHING || arg_cache->transfer == GI_TRANSFER_CONTAINER) + g_hash_table_unref ( (GHashTable *)data); +} + +static void +_arg_cache_from_py_ghash_setup (PyGIArgCache *arg_cache) +{ + arg_cache->from_py_marshaller = _pygi_marshal_from_py_ghash; + arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_ghash; +} + +static void +_arg_cache_to_py_ghash_setup (PyGIArgCache *arg_cache) +{ + arg_cache->to_py_marshaller = _pygi_marshal_to_py_ghash; + arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_ghash; +} + +static gboolean +pygi_arg_hash_table_setup_from_info (PyGIHashCache *hc, + GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) +{ + GITypeInfo *key_type_info; + GITypeInfo *value_type_info; + GITransfer item_transfer; + + if (!pygi_arg_base_setup ((PyGIArgCache *)hc, type_info, arg_info, transfer, direction)) + return FALSE; + + ( (PyGIArgCache *)hc)->destroy_notify = (GDestroyNotify)_hash_cache_free_func; + key_type_info = g_type_info_get_param_type (type_info, 0); + value_type_info = g_type_info_get_param_type (type_info, 1); + + item_transfer = + transfer == GI_TRANSFER_CONTAINER ? GI_TRANSFER_NOTHING : transfer; + + hc->key_cache = pygi_arg_cache_new (key_type_info, + NULL, + item_transfer, + direction, + callable_cache, + 0, 0); + + if (hc->key_cache == NULL) { + return FALSE; + } + + hc->value_cache = pygi_arg_cache_new (value_type_info, + NULL, + item_transfer, + direction, + callable_cache, + 0, 0); + + if (hc->value_cache == NULL) { + return FALSE; + } + + g_base_info_unref( (GIBaseInfo *)key_type_info); + g_base_info_unref( (GIBaseInfo *)value_type_info); + + if (direction & PYGI_DIRECTION_FROM_PYTHON) { + _arg_cache_from_py_ghash_setup ((PyGIArgCache *)hc); + } + + if (direction & PYGI_DIRECTION_TO_PYTHON) { + _arg_cache_to_py_ghash_setup ((PyGIArgCache *)hc); + } + + return TRUE; +} + +PyGIArgCache * +pygi_arg_hash_table_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) +{ + gboolean res = FALSE; + PyGIHashCache *hc = NULL; + + hc = g_slice_new0 (PyGIHashCache); + if (hc == NULL) + return NULL; + + res = pygi_arg_hash_table_setup_from_info (hc, + type_info, + arg_info, + transfer, + direction, + callable_cache); + if (res) { + return (PyGIArgCache *)hc; + } else { + pygi_arg_cache_free ((PyGIArgCache *)hc); + return NULL; + } +} diff --git a/gi/pygi-hashtable.h b/gi/pygi-hashtable.h new file mode 100644 index 0000000..74cd04f --- /dev/null +++ b/gi/pygi-hashtable.h @@ -0,0 +1,36 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2013 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_HASHTABLE_H__ +#define __PYGI_HASHTABLE_H__ + +#include "pygi-cache.h" +#include + +G_BEGIN_DECLS + +PyGIArgCache *pygi_arg_hash_table_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache); + +G_END_DECLS + +#endif /*__PYGI_HASHTABLE_H__*/ diff --git a/gi/pygi-info.c b/gi/pygi-info.c index 7164ff9..08c76db 100644 --- a/gi/pygi-info.c +++ b/gi/pygi-info.c @@ -2,6 +2,7 @@ * vim: tabstop=4 shiftwidth=4 expandtab * * Copyright (C) 2005-2009 Johan Dahlin + * Copyright (C) 2013 Simon Feltman * * pygi-info.c: GI.*Info wrappers. * @@ -16,17 +17,17 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" +#include "pygi-info.h" #include "pygi-cache.h" - -#include -#include - +#include "pygi-invoke.h" +#include "pygi-type.h" +#include "pygi-argument.h" +#include "pygi-util.h" +#include "pygi-basictype.h" +#include "pygi-type.h" /* _generate_doc_string * @@ -53,9 +54,119 @@ _generate_doc_string(PyGIBaseInfo *self) return PyObject_CallFunctionObjArgs (_py_generate_doc_string, self, NULL); } +static PyObject * +_get_info_string (PyGIBaseInfo *self, + const gchar* (*get_info_string)(GIBaseInfo*)) +{ + const gchar *value = get_info_string ((GIBaseInfo*)self->info); + if (value == NULL) { + Py_RETURN_NONE; + } + return pygi_utf8_to_py (value); +} + +static PyObject * +_get_child_info (PyGIBaseInfo *self, + GIBaseInfo* (*get_child_info)(GIBaseInfo*)) +{ + GIBaseInfo *info; + PyObject *py_info; + + info = get_child_info ((GIBaseInfo*)self->info); + if (info == NULL) { + Py_RETURN_NONE; + } + + py_info = _pygi_info_new (info); + g_base_info_unref (info); + return py_info; +} + + +static PyObject * +_get_child_info_by_name (PyGIBaseInfo *self, PyObject *py_name, + GIBaseInfo* (*get_child_info_by_name)(GIBaseInfo*, const gchar*)) +{ + GIBaseInfo *info; + PyObject *py_info; + char *name; + + if (!pygi_utf8_from_py (py_name, &name)) + return NULL; + + info = get_child_info_by_name ((GIObjectInfo*)self->info, name); + g_free (name); + if (info == NULL) { + Py_RETURN_NONE; + } + + py_info = _pygi_info_new (info); + g_base_info_unref (info); + return py_info; +} + + +/* _make_infos_tuple + * + * Build a tuple from the common API pattern in GI of having a + * function which returns a count and an indexed GIBaseInfo + * in the range of 0 to count; + */ +static PyObject * +_make_infos_tuple (PyGIBaseInfo *self, + gint (*get_n_infos)(GIBaseInfo*), + GIBaseInfo* (*get_info)(GIBaseInfo*, gint)) +{ + gint n_infos; + PyObject *infos; + gint i; + + n_infos = get_n_infos ( (GIBaseInfo *) self->info); + + infos = PyTuple_New (n_infos); + if (infos == NULL) { + return NULL; + } + + for (i = 0; i < n_infos; i++) { + GIBaseInfo *info; + PyObject *py_info; + + info = (GIBaseInfo *) get_info (self->info, i); + g_assert (info != NULL); + + py_info = _pygi_info_new (info); + + g_base_info_unref (info); + + if (py_info == NULL) { + Py_CLEAR (infos); + break; + } + + PyTuple_SET_ITEM (infos, i, py_info); + } + + return infos; +} + /* BaseInfo */ +/* We need to be careful about calling g_base_info_get_name because + * calling it with a GI_INFO_TYPE_TYPE will crash. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=709456 + */ +static const char * +_safe_base_info_get_name (GIBaseInfo *info) +{ + if (g_base_info_get_type (info) == GI_INFO_TYPE_TYPE) { + return "type_type_instance"; + } else { + return g_base_info_get_name (info); + } +} + static void _base_info_dealloc (PyGIBaseInfo *self) { @@ -64,40 +175,56 @@ _base_info_dealloc (PyGIBaseInfo *self) g_base_info_unref (self->info); - _pygi_callable_cache_free(self->cache); + if (self->cache != NULL) + pygi_callable_cache_free ( (PyGICallableCache *) self->cache); - Py_TYPE( (PyObject *) self)->tp_free ( (PyObject *) self); + Py_TYPE (self)->tp_free ((PyObject *)self); } static PyObject * _base_info_repr (PyGIBaseInfo *self) { - return PYGLIB_PyUnicode_FromFormat ("<%s object (%s) at 0x%p>", - Py_TYPE( (PyObject *) self)->tp_name, - g_base_info_get_name (self->info), - (void *) self); + + return PyUnicode_FromFormat ("%s(%s)", + Py_TYPE( (PyObject *) self)->tp_name, + _safe_base_info_get_name (self->info)); } static PyObject * -_base_info_richcompare (PyGIBaseInfo *self, PyObject *other, int op) +_wrap_g_base_info_equal (PyGIBaseInfo *self, PyObject *other) { - PyObject *res; GIBaseInfo *other_info; - if (!PyObject_TypeCheck(other, &PyGIBaseInfo_Type)) { - Py_INCREF(Py_NotImplemented); + if (!PyObject_TypeCheck (other, &PyGIBaseInfo_Type)) { + Py_INCREF (Py_NotImplemented); return Py_NotImplemented; } other_info = ((PyGIBaseInfo *)other)->info; + if (g_base_info_equal (self->info, other_info)) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } +} + +static PyObject * +_base_info_richcompare (PyGIBaseInfo *self, PyObject *other, int op) +{ + PyObject *res; switch (op) { case Py_EQ: - res = g_base_info_equal (self->info, other_info) ? Py_True : Py_False; - break; + return _wrap_g_base_info_equal (self, other); case Py_NE: - res = g_base_info_equal (self->info, other_info) ? Py_False : Py_True; - break; + res = _wrap_g_base_info_equal (self, other); + if (res == Py_True) { + Py_DECREF (res); + Py_RETURN_FALSE; + } else { + Py_DECREF (res); + Py_RETURN_TRUE; + } default: res = Py_NotImplemented; break; @@ -106,21 +233,14 @@ _base_info_richcompare (PyGIBaseInfo *self, PyObject *other, int op) return res; } -PYGLIB_DEFINE_TYPE("gi.BaseInfo", PyGIBaseInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE("gi.BaseInfo", PyGIBaseInfo_Type, PyGIBaseInfo); gboolean _pygi_is_python_keyword (const gchar *name) { /* It may be better to use keyword.iskeyword(); keep in sync with * python -c 'import keyword; print(keyword.kwlist)' */ -#if PY_VERSION_HEX < 0x03000000 - /* Python 2.x */ - static const gchar* keywords[] = {"and", "as", "assert", "break", "class", - "continue", "def", "del", "elif", "else", "except", "exec", "finally", - "for", "from", "global", "if", "import", "in", "is", "lambda", "not", - "or", "pass", "print", "raise", "return", "try", "while", "with", - "yield", NULL}; -#elif PY_VERSION_HEX < 0x04000000 +#if PY_VERSION_HEX < 0x04000000 /* Python 3.x; note that we explicitly keep "print"; it is not a keyword * any more, but we do not want to break API between Python versions */ static const gchar* keywords[] = {"False", "None", "True", "and", "as", @@ -145,38 +265,73 @@ _pygi_is_python_keyword (const gchar *name) } static PyObject * +_wrap_g_base_info_get_type (PyGIBaseInfo *self) +{ + return pygi_guint_to_py (g_base_info_get_type (self->info)); +} + +static PyObject * _wrap_g_base_info_get_name (PyGIBaseInfo *self) { const gchar *name; - name = g_base_info_get_name (self->info); + name = _safe_base_info_get_name (self->info); /* escape keywords */ if (_pygi_is_python_keyword (name)) { gchar *escaped = g_strconcat (name, "_", NULL); - PyObject *obj = PYGLIB_PyUnicode_FromString (escaped); + PyObject *obj = pygi_utf8_to_py (escaped); g_free (escaped); return obj; } - return PYGLIB_PyUnicode_FromString (name); + return pygi_utf8_to_py (name); } static PyObject * _wrap_g_base_info_get_name_unescaped (PyGIBaseInfo *self) { - return PYGLIB_PyUnicode_FromString (g_base_info_get_name (self->info)); + return _get_info_string (self, _safe_base_info_get_name); } static PyObject * _wrap_g_base_info_get_namespace (PyGIBaseInfo *self) { - return PYGLIB_PyUnicode_FromString (g_base_info_get_namespace (self->info)); + return _get_info_string (self, g_base_info_get_namespace); +} + +static PyObject * +_wrap_g_base_info_is_deprecated (PyGIBaseInfo *self) +{ + if (g_base_info_is_deprecated (self->info)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static PyObject * +_wrap_g_base_info_get_attribute (PyGIBaseInfo *self, PyObject *arg) +{ + char *name; + const char *value; + + if (!pygi_utf8_from_py (arg, &name)) + return NULL; + + value = g_base_info_get_attribute (self->info, name); + g_free (name); + if (value == NULL) { + Py_RETURN_NONE; + } + return pygi_utf8_to_py (value); } static PyObject * _wrap_g_base_info_get_container (PyGIBaseInfo *self) { + /* Note: don't use _get_child_info because g_base_info_get_container + * is marked as [transfer none] and therefore returns a borrowed ref. + */ GIBaseInfo *info; info = g_base_info_get_container (self->info); @@ -190,10 +345,14 @@ _wrap_g_base_info_get_container (PyGIBaseInfo *self) static PyMethodDef _PyGIBaseInfo_methods[] = { + { "get_type", (PyCFunction) _wrap_g_base_info_get_type, METH_NOARGS }, { "get_name", (PyCFunction) _wrap_g_base_info_get_name, METH_NOARGS }, { "get_name_unescaped", (PyCFunction) _wrap_g_base_info_get_name_unescaped, METH_NOARGS }, { "get_namespace", (PyCFunction) _wrap_g_base_info_get_namespace, METH_NOARGS }, + { "is_deprecated", (PyCFunction) _wrap_g_base_info_is_deprecated, METH_NOARGS }, + { "get_attribute", (PyCFunction) _wrap_g_base_info_get_attribute, METH_O }, { "get_container", (PyCFunction) _wrap_g_base_info_get_container, METH_NOARGS }, + { "equal", (PyCFunction) _wrap_g_base_info_equal, METH_O }, { NULL, NULL, 0 } }; @@ -209,13 +368,13 @@ _base_info_getattro(PyGIBaseInfo *self, PyObject *name) static PyObject *docstr; if (docstr == NULL) { - docstr= PYGLIB_PyUnicode_InternFromString("__doc__"); + docstr= PyUnicode_InternFromString ("__doc__"); if (docstr == NULL) return NULL; } Py_INCREF (name); - PYGLIB_PyUnicode_InternInPlace (&name); + PyUnicode_InternInPlace (&name); if (name == docstr) { result = _generate_doc_string (self); @@ -236,8 +395,8 @@ _base_info_attr_name(PyGIBaseInfo *self, void *closure) static PyObject * _base_info_attr_module(PyGIBaseInfo *self, void *closure) { - return PYGLIB_PyUnicode_FromFormat ("gi.repository.%s", - g_base_info_get_namespace (self->info)); + return PyUnicode_FromFormat ("gi.repository.%s", + g_base_info_get_namespace (self->info)); } static PyGetSetDef _base_info_getsets[] = { @@ -267,10 +426,8 @@ _pygi_info_new (GIBaseInfo *info) type = &PyGICallbackInfo_Type; break; case GI_INFO_TYPE_STRUCT: - type = &PyGIStructInfo_Type; - break; case GI_INFO_TYPE_BOXED: - type = &PyGIBoxedInfo_Type; + type = &PyGIStructInfo_Type; break; case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_FLAGS: @@ -342,7 +499,7 @@ _pygi_object_get_gi_info (PyObject *object, } if (!PyObject_TypeCheck (py_info, type)) { PyErr_Format (PyExc_TypeError, "attribute '__info__' must be %s, not %s", - type->tp_name, Py_TYPE(&py_info)->tp_name); + type->tp_name, Py_TYPE(py_info)->tp_name); goto out; } @@ -357,44 +514,7 @@ out: /* CallableInfo */ -PYGLIB_DEFINE_TYPE ("gi.CallableInfo", PyGICallableInfo_Type, PyGICallableInfo); - -static PyObject * -_wrap_g_callable_info_get_arguments (PyGIBaseInfo *self) -{ - gssize n_infos; - PyObject *infos; - gssize i; - - n_infos = g_callable_info_get_n_args ( (GICallableInfo *) self->info); - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } - - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; - - info = (GIBaseInfo *) g_callable_info_get_arg ( (GICallableInfo *) self->info, i); - g_assert (info != NULL); - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } - - PyTuple_SET_ITEM (infos, i, py_info); - } - - return infos; -} - +PYGI_DEFINE_TYPE ("gi.CallableInfo", PyGICallableInfo_Type, PyGICallableInfo); /* _callable_info_call: * @@ -440,6 +560,33 @@ _callable_info_call (PyGICallableInfo *self, PyObject *args, PyObject *kwargs) } } +static PyObject * +_callable_info_repr (PyGICallableInfo *self) +{ + PyObject *bound_repr_o = NULL; + const char *bound_repr = "None"; + PyObject *res = NULL; + + if (self->py_bound_arg) { + bound_repr_o = PyObject_Repr(self->py_bound_arg); + if (bound_repr_o == NULL) + goto out; + + bound_repr = PyUnicode_AsUTF8(bound_repr_o); + if (bound_repr == NULL) + goto out; + } + + res = PyUnicode_FromFormat ("%s(%s, bound=%s)", + Py_TYPE( (PyObject *) self)->tp_name, + _safe_base_info_get_name (self->base.info), + bound_repr); + +out: + Py_XDECREF(bound_repr_o); + + return res; +} /* _function_info_call: * @@ -472,17 +619,12 @@ _function_info_call (PyGICallableInfo *self, PyObject *args, PyObject *kwargs) py_str_name = tmp; } -#if PY_VERSION_HEX < 0x03000000 - str_name = PyString_AsString (py_str_name); -#else str_name = PyBytes_AsString (py_str_name); -#endif - - if (strcmp (str_name, g_base_info_get_name (container_info))) { + if (strcmp (str_name, _safe_base_info_get_name (container_info))) { PyErr_Format (PyExc_TypeError, "%s constructor cannot be used to create instances of " "a subclass %s", - g_base_info_get_name (container_info), + _safe_base_info_get_name (container_info), str_name); Py_DECREF (py_str_name); return NULL; @@ -572,132 +714,224 @@ _callable_info_dealloc (PyGICallableInfo *self) PyGIBaseInfo_Type.tp_dealloc ((PyObject *) self); } +static PyObject * +_wrap_g_callable_info_get_arguments (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_callable_info_get_n_args, g_callable_info_get_arg); +} + +static PyObject * +_wrap_g_callable_info_get_return_type (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_callable_info_get_return_type); +} + +static PyObject * +_wrap_g_callable_info_get_caller_owns (PyGIBaseInfo *self) +{ + return pygi_guint_to_py ( + g_callable_info_get_caller_owns (self->info) ); +} + +static PyObject * +_wrap_g_callable_info_may_return_null (PyGIBaseInfo *self) +{ + return pygi_gboolean_to_py ( + g_callable_info_may_return_null (self->info) ); +} + +static PyObject * +_wrap_g_callable_info_skip_return (PyGIBaseInfo *self) +{ + return pygi_gboolean_to_py (g_callable_info_skip_return (self->info)); +} + +static PyObject * +_wrap_g_callable_info_get_return_attribute (PyGIBaseInfo *self, PyObject *py_name) +{ + gchar *name; + const gchar *attr; + + if (!pygi_utf8_from_py (py_name, &name)) + return NULL; + + attr = g_callable_info_get_return_attribute (self->info, name); + if (attr) { + g_free (name); + return pygi_utf8_to_py (attr); + } else { + PyErr_Format(PyExc_AttributeError, "return attribute %s not found", name); + g_free (name); + return NULL; + } +} + +static PyObject * +_wrap_g_callable_info_can_throw_gerror (PyGIBaseInfo *self) +{ + if (g_callable_info_can_throw_gerror (self->info)) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + static PyMethodDef _PyGICallableInfo_methods[] = { { "invoke", (PyCFunction) _wrap_g_callable_info_invoke, METH_VARARGS | METH_KEYWORDS }, { "get_arguments", (PyCFunction) _wrap_g_callable_info_get_arguments, METH_NOARGS }, + { "get_return_type", (PyCFunction) _wrap_g_callable_info_get_return_type, METH_NOARGS }, + { "get_caller_owns", (PyCFunction) _wrap_g_callable_info_get_caller_owns, METH_NOARGS }, + { "may_return_null", (PyCFunction) _wrap_g_callable_info_may_return_null, METH_NOARGS }, + { "skip_return", (PyCFunction) _wrap_g_callable_info_skip_return, METH_NOARGS }, + { "get_return_attribute", (PyCFunction) _wrap_g_callable_info_get_return_attribute, METH_O }, + { "can_throw_gerror", (PyCFunction) _wrap_g_callable_info_can_throw_gerror, METH_NOARGS }, { NULL, NULL, 0 } }; /* CallbackInfo */ -PYGLIB_DEFINE_TYPE ("gi.CallbackInfo", PyGICallbackInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.CallbackInfo", PyGICallbackInfo_Type, PyGICallableInfo); static PyMethodDef _PyGICallbackInfo_methods[] = { { NULL, NULL, 0 } }; -/* BoxedInfo */ -PYGLIB_DEFINE_TYPE ("gi.BoxedInfo", PyGIBoxedInfo_Type, PyGIBaseInfo); - -static PyMethodDef _PyGIBoxedInfo_methods[] = { - { NULL, NULL, 0 } -}; - /* ErrorDomainInfo */ -PYGLIB_DEFINE_TYPE ("gi.ErrorDomainInfo", PyGIErrorDomainInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.ErrorDomainInfo", PyGIErrorDomainInfo_Type, PyGIBaseInfo); static PyMethodDef _PyGIErrorDomainInfo_methods[] = { { NULL, NULL, 0 } }; /* SignalInfo */ -PYGLIB_DEFINE_TYPE ("gi.SignalInfo", PyGISignalInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.SignalInfo", PyGISignalInfo_Type, PyGICallableInfo); + +static PyObject * +_wrap_g_signal_info_get_flags (PyGIBaseInfo *self) +{ + return pygi_guint_to_py ( + g_signal_info_get_flags ((GISignalInfo *)self->info) ); +} + +static PyObject * +_wrap_g_signal_info_get_class_closure (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_signal_info_get_class_closure); +} + +static PyObject * +_wrap_g_signal_info_true_stops_emit (PyGIBaseInfo *self) +{ + return pygi_gboolean_to_py ( + g_signal_info_true_stops_emit ((GISignalInfo *)self->info) ); +} static PyMethodDef _PyGISignalInfo_methods[] = { + { "get_flags", (PyCFunction) _wrap_g_signal_info_get_flags, METH_NOARGS }, + { "get_class_closure", (PyCFunction) _wrap_g_signal_info_get_class_closure, METH_NOARGS }, + { "true_stops_emit", (PyCFunction) _wrap_g_signal_info_true_stops_emit, METH_NOARGS }, { NULL, NULL, 0 } }; /* PropertyInfo */ -PYGLIB_DEFINE_TYPE ("gi.PropertyInfo", PyGIPropertyInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.PropertyInfo", PyGIPropertyInfo_Type, PyGIBaseInfo); + +static PyObject * +_wrap_g_property_info_get_flags (PyGIBaseInfo *self) +{ + return pygi_guint_to_py ( + g_property_info_get_flags ((GIPropertyInfo *)self->info) ); +} + +static PyObject * +_wrap_g_property_info_get_type (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_property_info_get_type); +} + +static PyObject * +_wrap_g_property_info_get_ownership_transfer (PyGIBaseInfo *self) +{ + return pygi_guint_to_py ( + g_property_info_get_ownership_transfer ((GIPropertyInfo *)self->info) ); +} static PyMethodDef _PyGIPropertyInfo_methods[] = { + { "get_flags", (PyCFunction) _wrap_g_property_info_get_flags, METH_NOARGS }, + { "get_type", (PyCFunction) _wrap_g_property_info_get_type, METH_NOARGS }, + { "get_ownership_transfer", (PyCFunction) _wrap_g_property_info_get_ownership_transfer, METH_NOARGS }, { NULL, NULL, 0 } }; /* ArgInfo */ -PYGLIB_DEFINE_TYPE ("gi.ArgInfo", PyGIArgInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.ArgInfo", PyGIArgInfo_Type, PyGIBaseInfo); static PyObject * _wrap_g_arg_info_get_direction (PyGIBaseInfo *self) { - return PyLong_FromLong ( + return pygi_guint_to_py ( g_arg_info_get_direction ((GIArgInfo*)self->info) ); } static PyObject * _wrap_g_arg_info_is_caller_allocates (PyGIBaseInfo *self) { - return PyBool_FromLong ( + return pygi_gboolean_to_py ( g_arg_info_is_caller_allocates ((GIArgInfo*)self->info) ); } static PyObject * _wrap_g_arg_info_is_return_value (PyGIBaseInfo *self) { - return PyBool_FromLong ( + return pygi_gboolean_to_py ( g_arg_info_is_return_value ((GIArgInfo*)self->info) ); } static PyObject * _wrap_g_arg_info_is_optional (PyGIBaseInfo *self) { - return PyBool_FromLong ( + return pygi_gboolean_to_py ( g_arg_info_is_optional ((GIArgInfo*)self->info) ); } static PyObject * _wrap_g_arg_info_may_be_null (PyGIBaseInfo *self) { - return PyBool_FromLong ( + return pygi_gboolean_to_py ( g_arg_info_may_be_null ((GIArgInfo*)self->info) ); } -/* _g_arg_get_pytype_hint - * - * Returns new value reference to a string hinting at the python type - * which can be used for the given gi argument info. - */ static PyObject * -_g_arg_get_pytype_hint (PyGIBaseInfo *self) +_wrap_g_arg_info_get_ownership_transfer (PyGIBaseInfo *self) { - GIArgInfo *arg_info = (GIArgInfo*)self->info; - GITypeInfo type_info; - GITypeTag type_tag; - PyObject *py_type; + return pygi_guint_to_py ( + g_arg_info_get_ownership_transfer ((GIArgInfo *)self->info) ); +} + +static PyObject * +_wrap_g_arg_info_get_scope (PyGIBaseInfo *self) +{ + return pygi_guint_to_py ( + g_arg_info_get_scope ((GIArgInfo *)self->info) ); +} - g_arg_info_load_type(arg_info, &type_info); - type_tag = g_type_info_get_tag(&type_info); +static PyObject * +_wrap_g_arg_info_get_closure (PyGIBaseInfo *self) +{ + return pygi_gint_to_py ( + g_arg_info_get_closure ((GIArgInfo *)self->info) ); +} - /* First attempt getting a python type object. */ - py_type = _pygi_get_py_type_hint(type_tag); - if (py_type != Py_None && PyObject_HasAttrString(py_type, "__name__")) { - PyObject *name = PyObject_GetAttrString(py_type, "__name__"); - Py_DecRef(py_type); - return name; - } else { - Py_DecRef(py_type); - if (type_tag == GI_TYPE_TAG_INTERFACE) { - const char *info_name; - PyObject *py_string; - GIBaseInfo *iface = g_type_info_get_interface(&type_info); - gchar *name; - - info_name = g_base_info_get_name (iface); - if (info_name == NULL) { - g_base_info_unref (iface); - return PYGLIB_PyUnicode_FromString(g_type_tag_to_string(type_tag)); - } - - name = g_strdup_printf("%s.%s", - g_base_info_get_namespace(iface), - info_name); - g_base_info_unref(iface); - py_string = PYGLIB_PyUnicode_FromString(name); - g_free(name); - return py_string; - } - return PYGLIB_PyUnicode_FromString(g_type_tag_to_string(type_tag)); - } +static PyObject * +_wrap_g_arg_info_get_destroy (PyGIBaseInfo *self) +{ + return pygi_gint_to_py ( + g_arg_info_get_destroy ((GIArgInfo *)self->info) ); +} + +static PyObject * +_wrap_g_arg_info_get_type (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_arg_info_get_type); } static PyMethodDef _PyGIArgInfo_methods[] = { @@ -706,21 +940,103 @@ static PyMethodDef _PyGIArgInfo_methods[] = { { "is_return_value", (PyCFunction) _wrap_g_arg_info_is_return_value, METH_NOARGS }, { "is_optional", (PyCFunction) _wrap_g_arg_info_is_optional, METH_NOARGS }, { "may_be_null", (PyCFunction) _wrap_g_arg_info_may_be_null, METH_NOARGS }, - { "get_pytype_hint", (PyCFunction) _g_arg_get_pytype_hint, METH_NOARGS }, + { "get_ownership_transfer", (PyCFunction) _wrap_g_arg_info_get_ownership_transfer, METH_NOARGS }, + { "get_scope", (PyCFunction) _wrap_g_arg_info_get_scope, METH_NOARGS }, + { "get_closure", (PyCFunction) _wrap_g_arg_info_get_closure, METH_NOARGS }, + { "get_destroy", (PyCFunction) _wrap_g_arg_info_get_destroy, METH_NOARGS }, + { "get_type", (PyCFunction) _wrap_g_arg_info_get_type, METH_NOARGS }, { NULL, NULL, 0 } }; /* TypeInfo */ -PYGLIB_DEFINE_TYPE ("gi.TypeInfo", PyGITypeInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.TypeInfo", PyGITypeInfo_Type, PyGIBaseInfo); -static PyMethodDef _PyGITypeInfo_methods[] = { - { NULL, NULL, 0 } +static PyObject * +_wrap_g_type_info_is_pointer (PyGIBaseInfo *self) +{ + return pygi_gboolean_to_py (g_type_info_is_pointer (self->info)); +} + +static PyObject * +_wrap_g_type_info_get_tag (PyGIBaseInfo *self) +{ + return pygi_guint_to_py (g_type_info_get_tag (self->info)); +} + +static PyObject * +_wrap_g_type_info_get_tag_as_string (PyGIBaseInfo *self) +{ + GITypeTag tag = g_type_info_get_tag (self->info); + return pygi_utf8_to_py (g_type_tag_to_string(tag)); +} + +static PyObject * +_wrap_g_type_info_get_param_type (PyGIBaseInfo *self, PyObject *py_n) +{ + GIBaseInfo *info; + PyObject *py_info; + gint n; + + if (!pygi_gint_from_py (py_n, &n)) + return NULL; + + info = (GIBaseInfo *) g_type_info_get_param_type ( (GITypeInfo *) self->info, n); + if (info == NULL) { + Py_RETURN_NONE; + } + + py_info = _pygi_info_new (info); + g_base_info_unref (info); + return py_info; +} + +static PyObject * +_wrap_g_type_info_get_interface (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_type_info_get_interface); +} + +static PyObject * +_wrap_g_type_info_get_array_length (PyGIBaseInfo *self) +{ + return pygi_gint_to_py (g_type_info_get_array_length (self->info)); +} + +static PyObject * +_wrap_g_type_info_get_array_fixed_size (PyGIBaseInfo *self) +{ + return pygi_gint_to_py (g_type_info_get_array_fixed_size (self->info)); +} + +static PyObject * +_wrap_g_type_info_is_zero_terminated (PyGIBaseInfo *self) +{ + return pygi_gboolean_to_py (g_type_info_is_zero_terminated (self->info)); +} + +static PyObject * +_wrap_g_type_info_get_array_type (PyGIBaseInfo *self) +{ + return pygi_guint_to_py (g_type_info_get_array_type (self->info)); +} + +static PyMethodDef _PyGITypeInfo_methods[] = { + { "is_pointer", (PyCFunction) _wrap_g_type_info_is_pointer, METH_NOARGS }, + { "get_tag", (PyCFunction) _wrap_g_type_info_get_tag, METH_NOARGS }, + { "get_tag_as_string", (PyCFunction) _wrap_g_type_info_get_tag_as_string, METH_NOARGS }, + { "get_param_type", (PyCFunction) _wrap_g_type_info_get_param_type, METH_O }, + { "get_interface", (PyCFunction) _wrap_g_type_info_get_interface, METH_NOARGS }, + { "get_array_length", (PyCFunction) _wrap_g_type_info_get_array_length, METH_NOARGS }, + { "get_array_fixed_size", (PyCFunction) _wrap_g_type_info_get_array_fixed_size, METH_NOARGS }, + { "is_zero_terminated", (PyCFunction) _wrap_g_type_info_is_zero_terminated, METH_NOARGS }, + { "get_array_type", (PyCFunction) _wrap_g_type_info_get_array_type, METH_NOARGS }, + { NULL, NULL, 0 } }; /* FunctionInfo */ -PYGLIB_DEFINE_TYPE ("gi.FunctionInfo", PyGIFunctionInfo_Type, PyGICallableInfo); +PYGI_DEFINE_TYPE ("gi.FunctionInfo", PyGIFunctionInfo_Type, PyGICallableInfo); static PyObject * _wrap_g_function_info_is_constructor (PyGIBaseInfo *self) @@ -731,7 +1047,7 @@ _wrap_g_function_info_is_constructor (PyGIBaseInfo *self) flags = g_function_info_get_flags ( (GIFunctionInfo*) self->info); is_constructor = flags & GI_FUNCTION_IS_CONSTRUCTOR; - return PyBool_FromLong (is_constructor); + return pygi_gboolean_to_py (is_constructor); } static PyObject * @@ -743,7 +1059,7 @@ _wrap_g_function_info_is_method (PyGIBaseInfo *self) flags = g_function_info_get_flags ( (GIFunctionInfo*) self->info); is_method = flags & GI_FUNCTION_IS_METHOD; - return PyBool_FromLong (is_method); + return pygi_gboolean_to_py (is_method); } gsize @@ -796,6 +1112,8 @@ _pygi_g_type_tag_size (GITypeTag type_tag) "Unable to know the size (assuming %s is not a pointer)", g_type_tag_to_string (type_tag)); break; + default: + break; } return size; @@ -854,10 +1172,10 @@ _pygi_g_type_info_size (GITypeInfo *type_info) if (g_type_info_is_pointer (type_info)) { size = sizeof (gpointer); } else { - GITypeTag type_tag; + GITypeTag enum_type_tag; - type_tag = g_enum_info_get_storage_type ( (GIEnumInfo *) info); - size = _pygi_g_type_tag_size (type_tag); + enum_type_tag = g_enum_info_get_storage_type ( (GIEnumInfo *) info); + size = _pygi_g_type_tag_size (enum_type_tag); } break; case GI_INFO_TYPE_BOXED: @@ -895,19 +1213,61 @@ _pygi_g_type_info_size (GITypeInfo *type_info) case GI_TYPE_TAG_ERROR: size = sizeof (gpointer); break; + default: + break; } return size; } +static PyObject * +_wrap_g_function_info_get_symbol (PyGIBaseInfo *self) +{ + return _get_info_string (self, g_function_info_get_symbol); +} + +static PyObject * +_wrap_g_function_info_get_flags (PyGIBaseInfo *self) +{ + return pygi_guint_to_py (g_function_info_get_flags (self->info)); +} + +static PyObject * +_wrap_g_function_info_get_property (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_function_info_get_property); +} + +static PyObject * +_wrap_g_function_info_get_vfunc (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_function_info_get_vfunc); +} + static PyMethodDef _PyGIFunctionInfo_methods[] = { { "is_constructor", (PyCFunction) _wrap_g_function_info_is_constructor, METH_NOARGS }, { "is_method", (PyCFunction) _wrap_g_function_info_is_method, METH_NOARGS }, + { "get_symbol", (PyCFunction) _wrap_g_function_info_get_symbol, METH_NOARGS }, + { "get_flags", (PyCFunction) _wrap_g_function_info_get_flags, METH_NOARGS }, + { "get_property", (PyCFunction) _wrap_g_function_info_get_property, METH_NOARGS }, + { "get_vfunc", (PyCFunction) _wrap_g_function_info_get_vfunc, METH_NOARGS }, { NULL, NULL, 0 } }; /* RegisteredTypeInfo */ -PYGLIB_DEFINE_TYPE ("gi.RegisteredTypeInfo", PyGIRegisteredTypeInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.RegisteredTypeInfo", PyGIRegisteredTypeInfo_Type, PyGIBaseInfo); + +static PyObject * +_wrap_g_registered_type_info_get_type_name (PyGIBaseInfo *self) +{ + return _get_info_string (self, g_registered_type_info_get_type_name); +} + +static PyObject * +_wrap_g_registered_type_info_get_type_init (PyGIBaseInfo *self) +{ + return _get_info_string (self, g_registered_type_info_get_type_init); +} static PyObject * _wrap_g_registered_type_info_get_g_type (PyGIBaseInfo *self) @@ -920,245 +1280,73 @@ _wrap_g_registered_type_info_get_g_type (PyGIBaseInfo *self) } static PyMethodDef _PyGIRegisteredTypeInfo_methods[] = { + { "get_type_name", (PyCFunction) _wrap_g_registered_type_info_get_type_name, METH_NOARGS }, + { "get_type_init", (PyCFunction) _wrap_g_registered_type_info_get_type_init, METH_NOARGS }, { "get_g_type", (PyCFunction) _wrap_g_registered_type_info_get_g_type, METH_NOARGS }, { NULL, NULL, 0 } }; /* GIStructInfo */ -PYGLIB_DEFINE_TYPE ("StructInfo", PyGIStructInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("StructInfo", PyGIStructInfo_Type, PyGIBaseInfo); static PyObject * -_get_fields (PyGIBaseInfo *self, GIInfoType info_type) +_wrap_g_struct_info_get_fields (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - switch (info_type) { - case GI_INFO_TYPE_STRUCT: - n_infos = g_struct_info_get_n_fields ( (GIStructInfo *) self->info); - break; - case GI_INFO_TYPE_OBJECT: - n_infos = g_object_info_get_n_fields ( (GIObjectInfo *) self->info); - break; - default: - g_assert_not_reached(); - } - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } - - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; - - switch (info_type) { - case GI_INFO_TYPE_STRUCT: - info = (GIBaseInfo *) g_struct_info_get_field ( (GIStructInfo *) self->info, i); - break; - case GI_INFO_TYPE_OBJECT: - info = (GIBaseInfo *) g_object_info_get_field ( (GIObjectInfo *) self->info, i); - break; - default: - g_assert_not_reached(); - } - g_assert (info != NULL); - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } - - PyTuple_SET_ITEM (infos, i, py_info); - } - - return infos; + return _make_infos_tuple (self, g_struct_info_get_n_fields, g_struct_info_get_field); } static PyObject * -_get_methods (PyGIBaseInfo *self, GIInfoType info_type) +_wrap_g_struct_info_get_methods (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - switch (info_type) { - case GI_INFO_TYPE_STRUCT: - n_infos = g_struct_info_get_n_methods ( (GIStructInfo *) self->info); - break; - case GI_INFO_TYPE_OBJECT: - n_infos = g_object_info_get_n_methods ( (GIObjectInfo *) self->info); - break; - default: - g_assert_not_reached(); - } - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } - - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; - - switch (info_type) { - case GI_INFO_TYPE_STRUCT: - info = (GIBaseInfo *) g_struct_info_get_method ( (GIStructInfo *) self->info, i); - break; - case GI_INFO_TYPE_OBJECT: - info = (GIBaseInfo *) g_object_info_get_method ( (GIObjectInfo *) self->info, i); - break; - default: - g_assert_not_reached(); - } - g_assert (info != NULL); - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } - - PyTuple_SET_ITEM (infos, i, py_info); - } - - return infos; + return _make_infos_tuple (self, g_struct_info_get_n_methods, g_struct_info_get_method); } static PyObject * -_get_constants (PyGIBaseInfo *self, GIInfoType info_type) +_wrap_g_struct_info_get_size (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - switch (info_type) { - case GI_INFO_TYPE_INTERFACE: - n_infos = g_interface_info_get_n_constants ( (GIInterfaceInfo *) self->info); - break; - case GI_INFO_TYPE_OBJECT: - n_infos = g_object_info_get_n_constants ( (GIObjectInfo *) self->info); - break; - default: - g_assert_not_reached(); - } - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } - - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; - - switch (info_type) { - case GI_INFO_TYPE_INTERFACE: - info = (GIBaseInfo *) g_interface_info_get_constant ( (GIInterfaceInfo *) self->info, i); - break; - case GI_INFO_TYPE_OBJECT: - info = (GIBaseInfo *) g_object_info_get_constant ( (GIObjectInfo *) self->info, i); - break; - default: - g_assert_not_reached(); - } - g_assert (info != NULL); - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } - - PyTuple_SET_ITEM (infos, i, py_info); - } - - return infos; + return pygi_gsize_to_py (g_struct_info_get_size (self->info)); } static PyObject * -_get_vfuncs (PyGIBaseInfo *self, GIInfoType info_type) +_wrap_g_struct_info_get_alignment (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - switch (info_type) { - case GI_INFO_TYPE_INTERFACE: - n_infos = g_interface_info_get_n_vfuncs ( (GIInterfaceInfo *) self->info); - break; - case GI_INFO_TYPE_OBJECT: - n_infos = g_object_info_get_n_vfuncs ( (GIObjectInfo *) self->info); - break; - default: - g_assert_not_reached(); - } - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } - - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; - - switch (info_type) { - case GI_INFO_TYPE_INTERFACE: - info = (GIBaseInfo *) g_interface_info_get_vfunc ( (GIInterfaceInfo *) self->info, i); - break; - case GI_INFO_TYPE_OBJECT: - info = (GIBaseInfo *) g_object_info_get_vfunc ( (GIObjectInfo *) self->info, i); - break; - default: - g_assert_not_reached(); - } - g_assert (info != NULL); - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } + return pygi_gsize_to_py (g_struct_info_get_alignment (self->info)); +} - PyTuple_SET_ITEM (infos, i, py_info); - } +static PyObject * +_wrap_g_struct_info_is_gtype_struct (PyGIBaseInfo *self) +{ + return pygi_gboolean_to_py (g_struct_info_is_gtype_struct (self->info)); +} - return infos; +static PyObject * +_wrap_g_struct_info_is_foreign (PyGIBaseInfo *self) +{ + return pygi_gboolean_to_py (g_struct_info_is_foreign (self->info)); } static PyObject * -_wrap_g_struct_info_get_fields (PyGIBaseInfo *self) +_wrap_g_struct_info_find_method (PyGIBaseInfo *self, PyObject *py_name) { - return _get_fields (self, GI_INFO_TYPE_STRUCT); + return _get_child_info_by_name (self, py_name, g_struct_info_find_method); } static PyObject * -_wrap_g_struct_info_get_methods (PyGIBaseInfo *self) +_wrap_g_struct_info_find_field (PyGIBaseInfo *self, PyObject *py_name) { - return _get_methods (self, GI_INFO_TYPE_STRUCT); + return _get_child_info_by_name (self, py_name, g_struct_info_find_field); } static PyMethodDef _PyGIStructInfo_methods[] = { { "get_fields", (PyCFunction) _wrap_g_struct_info_get_fields, METH_NOARGS }, + { "find_field", (PyCFunction) _wrap_g_struct_info_find_field, METH_O }, { "get_methods", (PyCFunction) _wrap_g_struct_info_get_methods, METH_NOARGS }, + { "find_method", (PyCFunction) _wrap_g_struct_info_find_method, METH_O }, + { "get_size", (PyCFunction) _wrap_g_struct_info_get_size, METH_NOARGS }, + { "get_alignment", (PyCFunction) _wrap_g_struct_info_get_alignment, METH_NOARGS }, + { "is_gtype_struct", (PyCFunction) _wrap_g_struct_info_is_gtype_struct, METH_NOARGS }, + { "is_foreign", (PyCFunction) _wrap_g_struct_info_is_foreign, METH_NOARGS }, { NULL, NULL, 0 } }; @@ -1166,8 +1354,8 @@ gboolean pygi_g_struct_info_is_simple (GIStructInfo *struct_info) { gboolean is_simple; - gsize n_field_infos; - gsize i; + gint n_field_infos; + gint i; is_simple = TRUE; @@ -1263,6 +1451,9 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info) g_base_info_unref (info); break; } + default: + g_assert_not_reached(); + break; } g_base_info_unref ( (GIBaseInfo *) field_type_info); @@ -1274,42 +1465,12 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info) /* EnumInfo */ -PYGLIB_DEFINE_TYPE ("gi.EnumInfo", PyGIEnumInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.EnumInfo", PyGIEnumInfo_Type, PyGIBaseInfo); static PyObject * _wrap_g_enum_info_get_values (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - n_infos = g_enum_info_get_n_values ( (GIEnumInfo *) self->info); - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } - - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; - - info = (GIBaseInfo *) g_enum_info_get_value ( (GIEnumInfo *) self->info, i); - g_assert (info != NULL); - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } - - PyTuple_SET_ITEM (infos, i, py_info); - } - - return infos; + return _make_infos_tuple (self, g_enum_info_get_n_values, g_enum_info_get_value); } static PyObject * @@ -1326,195 +1487,254 @@ _wrap_g_enum_info_is_flags (PyGIBaseInfo *self) } } +static PyObject * +_wrap_g_enum_info_get_methods (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_enum_info_get_n_methods, g_enum_info_get_method); +} + +static PyObject * +_wrap_g_enum_info_get_storage_type (PyGIBaseInfo *self) +{ + return pygi_guint_to_py (g_enum_info_get_storage_type ((GIBaseInfo *) self->info)); +} + static PyMethodDef _PyGIEnumInfo_methods[] = { { "get_values", (PyCFunction) _wrap_g_enum_info_get_values, METH_NOARGS }, { "is_flags", (PyCFunction) _wrap_g_enum_info_is_flags, METH_NOARGS }, + { "get_methods", (PyCFunction) _wrap_g_enum_info_get_methods, METH_NOARGS }, + { "get_storage_type", (PyCFunction) _wrap_g_enum_info_get_storage_type, METH_NOARGS }, { NULL, NULL, 0 } }; /* ObjectInfo */ -PYGLIB_DEFINE_TYPE ("ObjectInfo", PyGIObjectInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("ObjectInfo", PyGIObjectInfo_Type, PyGIBaseInfo); static PyObject * _wrap_g_object_info_get_parent (PyGIBaseInfo *self) { - GIBaseInfo *info; - PyObject *py_info; - - info = (GIBaseInfo *) g_object_info_get_parent ( (GIObjectInfo*) self->info); - - if (info == NULL) { - Py_RETURN_NONE; - } - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - return py_info; + return _get_child_info (self, g_object_info_get_parent); } static PyObject * _wrap_g_object_info_get_methods (PyGIBaseInfo *self) { - return _get_methods (self, GI_INFO_TYPE_OBJECT); + return _make_infos_tuple (self, g_object_info_get_n_methods, g_object_info_get_method); } static PyObject * -_wrap_g_object_info_get_fields (PyGIBaseInfo *self) +_wrap_g_object_info_find_method (PyGIBaseInfo *self, PyObject *py_name) { - return _get_fields (self, GI_INFO_TYPE_OBJECT); + return _get_child_info_by_name (self, py_name, g_object_info_find_method); } static PyObject * -_wrap_g_object_info_get_interfaces (PyGIBaseInfo *self) +_wrap_g_object_info_get_fields (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - n_infos = g_object_info_get_n_interfaces ( (GIObjectInfo *) self->info); + return _make_infos_tuple (self, g_object_info_get_n_fields, g_object_info_get_field); +} - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } +static PyObject * +_wrap_g_object_info_get_properties (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_object_info_get_n_properties, g_object_info_get_property); +} - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; +static PyObject * +_wrap_g_object_info_get_signals (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_object_info_get_n_signals, g_object_info_get_signal); +} - info = (GIBaseInfo *) g_object_info_get_interface ( (GIObjectInfo *) self->info, i); - g_assert (info != NULL); +static PyObject * +_wrap_g_object_info_get_interfaces (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_object_info_get_n_interfaces, g_object_info_get_interface); +} - py_info = _pygi_info_new (info); +static PyObject * +_wrap_g_object_info_get_constants (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_object_info_get_n_constants, g_object_info_get_constant); +} - g_base_info_unref (info); +static PyObject * +_wrap_g_object_info_get_vfuncs (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_object_info_get_n_vfuncs, g_object_info_get_vfunc); +} - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } +static PyObject * +_wrap_g_object_info_get_abstract (PyGIBaseInfo *self) +{ + gboolean is_abstract = g_object_info_get_abstract ( (GIObjectInfo*) self->info); + return pygi_gboolean_to_py (is_abstract); +} - PyTuple_SET_ITEM (infos, i, py_info); - } +static PyObject * +_wrap_g_object_info_get_type_name (PyGIBaseInfo *self) +{ + return _get_info_string (self, g_object_info_get_type_name); +} - return infos; +static PyObject * +_wrap_g_object_info_get_type_init (PyGIBaseInfo *self) +{ + return _get_info_string (self, g_object_info_get_type_init); } static PyObject * -_wrap_g_object_info_get_constants (PyGIBaseInfo *self) +_wrap_g_object_info_get_fundamental (PyGIBaseInfo *self) { - return _get_constants (self, GI_INFO_TYPE_OBJECT); + return pygi_gboolean_to_py (g_object_info_get_fundamental ( (GIObjectInfo*) self->info)); } static PyObject * -_wrap_g_object_info_get_vfuncs (PyGIBaseInfo *self) +_wrap_g_object_info_get_class_struct (PyGIBaseInfo *self) { - return _get_vfuncs (self, GI_INFO_TYPE_OBJECT); + return _get_child_info (self, g_object_info_get_class_struct); } static PyObject * -_wrap_g_object_info_get_abstract (PyGIBaseInfo *self) +_wrap_g_object_info_find_vfunc (PyGIBaseInfo *self, PyObject *py_name) { - gboolean is_abstract = g_object_info_get_abstract ( (GIObjectInfo*) self->info); - return PyBool_FromLong (is_abstract); + return _get_child_info_by_name (self, py_name, g_object_info_find_vfunc); } static PyObject * -_wrap_g_object_info_get_class_struct (PyGIBaseInfo *self) +_wrap_g_object_info_get_unref_function (PyGIBaseInfo *self) { - GIBaseInfo *info; + return _get_info_string (self, g_object_info_get_unref_function); +} - info = g_object_info_get_class_struct ((GIObjectInfo*)self->info); +static PyObject * +_wrap_g_object_info_get_ref_function (PyGIBaseInfo *self) +{ + return _get_info_string (self, g_object_info_get_ref_function); +} - if (info == NULL) { - Py_RETURN_NONE; - } +static PyObject * +_wrap_g_object_info_get_set_value_function (PyGIBaseInfo *self) +{ + return _get_info_string (self, g_object_info_get_set_value_function); +} - return _pygi_info_new (info); +static PyObject * +_wrap_g_object_info_get_get_value_function (PyGIBaseInfo *self) +{ + return _get_info_string (self, g_object_info_get_get_value_function); } static PyMethodDef _PyGIObjectInfo_methods[] = { { "get_parent", (PyCFunction) _wrap_g_object_info_get_parent, METH_NOARGS }, { "get_methods", (PyCFunction) _wrap_g_object_info_get_methods, METH_NOARGS }, + { "find_method", (PyCFunction) _wrap_g_object_info_find_method, METH_O }, { "get_fields", (PyCFunction) _wrap_g_object_info_get_fields, METH_NOARGS }, + { "get_properties", (PyCFunction) _wrap_g_object_info_get_properties, METH_NOARGS }, + { "get_signals", (PyCFunction) _wrap_g_object_info_get_signals, METH_NOARGS }, { "get_interfaces", (PyCFunction) _wrap_g_object_info_get_interfaces, METH_NOARGS }, { "get_constants", (PyCFunction) _wrap_g_object_info_get_constants, METH_NOARGS }, { "get_vfuncs", (PyCFunction) _wrap_g_object_info_get_vfuncs, METH_NOARGS }, + { "find_vfunc", (PyCFunction) _wrap_g_object_info_find_vfunc, METH_O }, { "get_abstract", (PyCFunction) _wrap_g_object_info_get_abstract, METH_NOARGS }, + { "get_type_name", (PyCFunction) _wrap_g_object_info_get_type_name, METH_NOARGS }, + { "get_type_init", (PyCFunction) _wrap_g_object_info_get_type_init, METH_NOARGS }, + { "get_fundamental", (PyCFunction) _wrap_g_object_info_get_fundamental, METH_NOARGS }, { "get_class_struct", (PyCFunction) _wrap_g_object_info_get_class_struct, METH_NOARGS }, + { "get_unref_function", (PyCFunction) _wrap_g_object_info_get_unref_function, METH_NOARGS }, + { "get_ref_function", (PyCFunction) _wrap_g_object_info_get_ref_function, METH_NOARGS }, + { "get_set_value_function", (PyCFunction) _wrap_g_object_info_get_set_value_function, METH_NOARGS }, + { "get_get_value_function", (PyCFunction) _wrap_g_object_info_get_get_value_function, METH_NOARGS }, { NULL, NULL, 0 } }; /* GIInterfaceInfo */ -PYGLIB_DEFINE_TYPE ("InterfaceInfo", PyGIInterfaceInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("InterfaceInfo", PyGIInterfaceInfo_Type, PyGIBaseInfo); static PyObject * _wrap_g_interface_info_get_methods (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - n_infos = g_interface_info_get_n_methods ( (GIInterfaceInfo *) self->info); - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } + return _make_infos_tuple (self, g_interface_info_get_n_methods, g_interface_info_get_method); +} - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; +static PyObject * +_wrap_g_interface_info_find_method (PyGIBaseInfo *self, PyObject *py_name) +{ + return _get_child_info_by_name (self, py_name, g_interface_info_find_method); +} - info = (GIBaseInfo *) g_interface_info_get_method ( (GIInterfaceInfo *) self->info, i); - g_assert (info != NULL); +static PyObject * +_wrap_g_interface_info_get_constants (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_interface_info_get_n_constants, g_interface_info_get_constant); +} - py_info = _pygi_info_new (info); +static PyObject * +_wrap_g_interface_info_get_vfuncs (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_interface_info_get_n_vfuncs, g_interface_info_get_vfunc); +} - g_base_info_unref (info); +static PyObject * +_wrap_g_interface_info_find_vfunc (PyGIBaseInfo *self, PyObject *py_name) +{ + return _get_child_info_by_name (self, py_name, g_interface_info_find_vfunc); +} - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } +static PyObject * +_wrap_g_interface_info_get_prerequisites (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_interface_info_get_n_prerequisites, g_interface_info_get_prerequisite); +} - PyTuple_SET_ITEM (infos, i, py_info); - } +static PyObject * +_wrap_g_interface_info_get_properties (PyGIBaseInfo *self) +{ + return _make_infos_tuple (self, g_interface_info_get_n_properties, g_interface_info_get_property); +} - return infos; +static PyObject * +_wrap_g_interface_info_get_iface_struct (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_interface_info_get_iface_struct); } static PyObject * -_wrap_g_interface_info_get_constants (PyGIBaseInfo *self) +_wrap_g_interface_info_get_signals (PyGIBaseInfo *self) { - return _get_constants (self, GI_INFO_TYPE_INTERFACE); + return _make_infos_tuple (self, g_interface_info_get_n_signals, g_interface_info_get_signal); } static PyObject * -_wrap_g_interface_info_get_vfuncs (PyGIBaseInfo *self) +_wrap_g_interface_info_find_signal (PyGIBaseInfo *self, PyObject *py_name) { - return _get_vfuncs (self, GI_INFO_TYPE_INTERFACE); + return _get_child_info_by_name (self, py_name, g_interface_info_find_signal); } static PyMethodDef _PyGIInterfaceInfo_methods[] = { + { "get_prerequisites", (PyCFunction) _wrap_g_interface_info_get_prerequisites, METH_NOARGS }, + { "get_properties", (PyCFunction) _wrap_g_interface_info_get_properties, METH_NOARGS }, { "get_methods", (PyCFunction) _wrap_g_interface_info_get_methods, METH_NOARGS }, - { "get_constants", (PyCFunction) _wrap_g_interface_info_get_constants, METH_NOARGS }, + { "find_method", (PyCFunction) _wrap_g_interface_info_find_method, METH_O }, + { "get_signals", (PyCFunction) _wrap_g_interface_info_get_signals, METH_NOARGS }, + { "find_signal", (PyCFunction) _wrap_g_interface_info_find_signal, METH_O }, { "get_vfuncs", (PyCFunction) _wrap_g_interface_info_get_vfuncs, METH_NOARGS }, + { "get_constants", (PyCFunction) _wrap_g_interface_info_get_constants, METH_NOARGS }, + { "get_iface_struct", (PyCFunction) _wrap_g_interface_info_get_iface_struct, METH_NOARGS }, + { "find_vfunc", (PyCFunction) _wrap_g_interface_info_find_vfunc, METH_O }, { NULL, NULL, 0 } }; /* GIConstantInfo */ -PYGLIB_DEFINE_TYPE ("gi.ConstantInfo", PyGIConstantInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.ConstantInfo", PyGIConstantInfo_Type, PyGIBaseInfo); static PyObject * _wrap_g_constant_info_get_value (PyGIBaseInfo *self) { GITypeInfo *type_info; - GIArgument value; + GIArgument value = {0}; PyObject *py_value; gboolean free_array = FALSE; @@ -1548,16 +1768,16 @@ static PyMethodDef _PyGIConstantInfo_methods[] = { }; /* GIValueInfo */ -PYGLIB_DEFINE_TYPE ("gi.ValueInfo", PyGIValueInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.ValueInfo", PyGIValueInfo_Type, PyGIBaseInfo); static PyObject * _wrap_g_value_info_get_value (PyGIBaseInfo *self) { - glong value; + gint64 value; value = g_value_info_get_value ( (GIValueInfo *) self->info); - return PYGLIB_PyLong_FromLong (value); + return pygi_gint64_to_py (value); } @@ -1568,7 +1788,119 @@ static PyMethodDef _PyGIValueInfo_methods[] = { /* GIFieldInfo */ -PYGLIB_DEFINE_TYPE ("gi.FieldInfo", PyGIFieldInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.FieldInfo", PyGIFieldInfo_Type, PyGIBaseInfo); + +static gssize +_struct_field_array_length_marshal (gsize length_index, + void *container_ptr, + void *struct_data_ptr) +{ + gssize array_len = -1; + GIFieldInfo *array_len_field = NULL; + GIArgument arg = {0}; + GIBaseInfo *container_info = (GIBaseInfo *)container_ptr; + + switch (g_base_info_get_type (container_info)) { + case GI_INFO_TYPE_UNION: + array_len_field = g_union_info_get_field ((GIUnionInfo *)container_info, (gint)length_index); + break; + case GI_INFO_TYPE_STRUCT: + array_len_field = g_struct_info_get_field ((GIStructInfo *)container_info, (gint)length_index); + break; + case GI_INFO_TYPE_OBJECT: + array_len_field = g_object_info_get_field ((GIObjectInfo *)container_info, (gint)length_index); + break; + default: + /* Other types don't have fields. */ + g_assert_not_reached(); + } + + if (array_len_field == NULL) { + return -1; + } + + if (g_field_info_get_field (array_len_field, struct_data_ptr, &arg)) { + GITypeInfo *array_len_type_info; + + array_len_type_info = g_field_info_get_type (array_len_field); + if (array_len_type_info == NULL) { + goto out; + } + + if (!pygi_argument_to_gssize (&arg, + g_type_info_get_tag (array_len_type_info), + &array_len)) { + array_len = -1; + } + + g_base_info_unref (array_len_type_info); + } + +out: + g_base_info_unref (array_len_field); + return array_len; +} + +static gint +_pygi_g_registered_type_info_check_object (GIRegisteredTypeInfo *info, + PyObject *object) +{ + gint retval; + + GType g_type; + PyObject *py_type; + gchar *type_name_expected = NULL; + GIInfoType interface_type; + + interface_type = g_base_info_get_type (info); + if ( (interface_type == GI_INFO_TYPE_STRUCT) && + (g_struct_info_is_foreign ( (GIStructInfo*) info))) { + /* TODO: Could we check is the correct foreign type? */ + return 1; + } + + g_type = g_registered_type_info_get_g_type (info); + if (g_type != G_TYPE_NONE) { + py_type = pygi_type_get_from_g_type (g_type); + } else { + py_type = pygi_type_import_by_gi_info ( (GIBaseInfo *) info); + } + + if (py_type == NULL) { + return 0; + } + + g_assert (PyType_Check (py_type)); + + retval = PyObject_IsInstance (object, py_type); + if (!retval) { + type_name_expected = _pygi_g_base_info_get_fullname ( + (GIBaseInfo *) info); + } + + Py_DECREF (py_type); + + if (!retval) { + PyTypeObject *object_type; + + if (type_name_expected == NULL) { + return -1; + } + + object_type = (PyTypeObject *) PyObject_Type (object); + if (object_type == NULL) { + g_free (type_name_expected); + return -1; + } + + PyErr_Format (PyExc_TypeError, "Must be %s, not %s", + type_name_expected, object_type->tp_name); + + g_free (type_name_expected); + } + + return retval; +} static PyObject * _wrap_g_field_info_get_value (PyGIBaseInfo *self, @@ -1593,7 +1925,7 @@ _wrap_g_field_info_get_value (PyGIBaseInfo *self, g_assert (container_info != NULL); /* Check the instance. */ - if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, TRUE, instance)) { + if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, instance)) { _PyGI_ERROR_PREFIX ("argument 1: "); return NULL; } @@ -1659,8 +1991,12 @@ _wrap_g_field_info_get_value (PyGIBaseInfo *self, } if (g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_ARRAY) { - value.v_pointer = _pygi_argument_to_array (&value, NULL, NULL, NULL, - field_type_info, &free_array); + value.v_pointer = _pygi_argument_to_array (&value, + _struct_field_array_length_marshal, + container_info, + pointer, + field_type_info, + &free_array); } argument_to_object: @@ -1697,7 +2033,7 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self, g_assert (container_info != NULL); /* Check the instance. */ - if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, TRUE, instance)) { + if (!_pygi_g_registered_type_info_check_object ( (GIRegisteredTypeInfo *) container_info, instance)) { _PyGI_ERROR_PREFIX ("argument 1: "); return NULL; } @@ -1719,21 +2055,6 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self, field_type_info = g_field_info_get_type ( (GIFieldInfo *) self->info); - /* Check the value. */ - { - gboolean retval; - - retval = _pygi_g_type_info_check_object (field_type_info, py_value, TRUE); - if (retval < 0) { - goto out; - } - - if (!retval) { - _PyGI_ERROR_PREFIX ("argument 2: "); - goto out; - } - } - /* Set the field's value. */ /* A few types are not handled by g_field_info_set_field, so do it here. */ if (!g_type_info_is_pointer (field_type_info) @@ -1779,7 +2100,7 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self, size = g_struct_info_get_size ( (GIStructInfo *) info); g_assert (size > 0); - g_memmove ((char*) pointer + offset, value.v_pointer, size); + memmove ((char*) pointer + offset, value.v_pointer, size); g_base_info_unref (info); @@ -1828,122 +2149,116 @@ out: return retval; } +static PyObject * +_wrap_g_field_info_get_flags (PyGIBaseInfo *self) +{ + return pygi_guint_to_py (g_field_info_get_flags (self->info)); +} + +static PyObject * +_wrap_g_field_info_get_size (PyGIBaseInfo *self) +{ + return pygi_gint_to_py (g_field_info_get_size (self->info)); +} + +static PyObject * +_wrap_g_field_info_get_offset (PyGIBaseInfo *self) +{ + return pygi_gint_to_py (g_field_info_get_offset (self->info)); +} + +static PyObject * +_wrap_g_field_info_get_type (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_field_info_get_type); +} + static PyMethodDef _PyGIFieldInfo_methods[] = { { "get_value", (PyCFunction) _wrap_g_field_info_get_value, METH_VARARGS }, { "set_value", (PyCFunction) _wrap_g_field_info_set_value, METH_VARARGS }, + { "get_flags", (PyCFunction) _wrap_g_field_info_get_flags, METH_VARARGS }, + { "get_size", (PyCFunction) _wrap_g_field_info_get_size, METH_VARARGS }, + { "get_offset", (PyCFunction) _wrap_g_field_info_get_offset, METH_VARARGS }, + { "get_type", (PyCFunction) _wrap_g_field_info_get_type, METH_VARARGS }, { NULL, NULL, 0 } }; /* GIUnresolvedInfo */ -PYGLIB_DEFINE_TYPE ("gi.UnresolvedInfo", PyGIUnresolvedInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.UnresolvedInfo", PyGIUnresolvedInfo_Type, PyGIBaseInfo); static PyMethodDef _PyGIUnresolvedInfo_methods[] = { { NULL, NULL, 0 } }; /* GIVFuncInfo */ -PYGLIB_DEFINE_TYPE ("gi.VFuncInfo", PyGIVFuncInfo_Type, PyGICallableInfo); +PYGI_DEFINE_TYPE ("gi.VFuncInfo", PyGIVFuncInfo_Type, PyGICallableInfo); static PyObject * -_wrap_g_vfunc_info_get_invoker (PyGIBaseInfo *self) +_wrap_g_vfunc_info_get_flags (PyGIBaseInfo *self) { - PyObject *result = Py_None; - GIBaseInfo *info; + return pygi_guint_to_py (g_vfunc_info_get_flags ((GIVFuncInfo *) self->info)); +} - info = (GIBaseInfo *) g_vfunc_info_get_invoker ( (GIVFuncInfo *) self->info ); - if (info) - result = _pygi_info_new(info); - else - Py_INCREF(Py_None); +static PyObject * +_wrap_g_vfunc_info_get_offset (PyGIBaseInfo *self) +{ + return pygi_gint_to_py (g_vfunc_info_get_offset ((GIVFuncInfo *) self->info)); +} - return result; +static PyObject * +_wrap_g_vfunc_info_get_signal (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_vfunc_info_get_signal); +} + +static PyObject * +_wrap_g_vfunc_info_get_invoker (PyGIBaseInfo *self) +{ + return _get_child_info (self, g_vfunc_info_get_invoker); } static PyMethodDef _PyGIVFuncInfo_methods[] = { + { "get_flags", (PyCFunction) _wrap_g_vfunc_info_get_flags, METH_NOARGS }, + { "get_offset", (PyCFunction) _wrap_g_vfunc_info_get_offset, METH_NOARGS }, + { "get_signal", (PyCFunction) _wrap_g_vfunc_info_get_signal, METH_NOARGS }, { "get_invoker", (PyCFunction) _wrap_g_vfunc_info_get_invoker, METH_NOARGS }, { NULL, NULL, 0 } }; /* GIUnionInfo */ -PYGLIB_DEFINE_TYPE ("gi.UnionInfo", PyGIUnionInfo_Type, PyGIBaseInfo); +PYGI_DEFINE_TYPE ("gi.UnionInfo", PyGIUnionInfo_Type, PyGIBaseInfo); static PyObject * _wrap_g_union_info_get_fields (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - n_infos = g_union_info_get_n_fields ( (GIUnionInfo *) self->info); - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } - - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; - - info = (GIBaseInfo *) g_union_info_get_field ( (GIUnionInfo *) self->info, i); - g_assert (info != NULL); - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } - - PyTuple_SET_ITEM (infos, i, py_info); - } - - return infos; + return _make_infos_tuple (self, g_union_info_get_n_fields, g_union_info_get_field); } static PyObject * _wrap_g_union_info_get_methods (PyGIBaseInfo *self) { - gssize n_infos; - PyObject *infos; - gssize i; - - n_infos = g_union_info_get_n_methods ( (GIUnionInfo *) self->info); - - infos = PyTuple_New (n_infos); - if (infos == NULL) { - return NULL; - } - - for (i = 0; i < n_infos; i++) { - GIBaseInfo *info; - PyObject *py_info; - - info = (GIBaseInfo *) g_union_info_get_method ( (GIUnionInfo *) self->info, i); - g_assert (info != NULL); - - py_info = _pygi_info_new (info); - - g_base_info_unref (info); - - if (py_info == NULL) { - Py_CLEAR (infos); - break; - } + return _make_infos_tuple (self, g_union_info_get_n_methods, g_union_info_get_method); +} - PyTuple_SET_ITEM (infos, i, py_info); - } +static PyObject * +_wrap_g_union_info_get_size (PyGIBaseInfo *self) +{ + return pygi_gsize_to_py (g_union_info_get_size (self->info)); +} - return infos; +static PyObject * +_wrap_g_union_info_get_alignment (PyGIBaseInfo *self) +{ + return pygi_gsize_to_py (g_union_info_get_alignment (self->info)); } static PyMethodDef _PyGIUnionInfo_methods[] = { { "get_fields", (PyCFunction) _wrap_g_union_info_get_fields, METH_NOARGS }, { "get_methods", (PyCFunction) _wrap_g_union_info_get_methods, METH_NOARGS }, + { "get_size", (PyCFunction) _wrap_g_union_info_get_size, METH_NOARGS }, + { "get_alignment", (PyCFunction) _wrap_g_union_info_get_alignment, METH_NOARGS }, { NULL, NULL, 0 } }; @@ -1959,12 +2274,12 @@ _pygi_g_base_info_get_fullname (GIBaseInfo *info) if (container_info != NULL) { fullname = g_strdup_printf ("%s.%s.%s", g_base_info_get_namespace (container_info), - g_base_info_get_name (container_info), - g_base_info_get_name (info)); + _safe_base_info_get_name (container_info), + _safe_base_info_get_name (info)); } else { fullname = g_strdup_printf ("%s.%s", g_base_info_get_namespace (info), - g_base_info_get_name (info)); + _safe_base_info_get_name (info)); } if (fullname == NULL) { @@ -1974,21 +2289,28 @@ _pygi_g_base_info_get_fullname (GIBaseInfo *info) return fullname; } -void -_pygi_info_register_types (PyObject *m) + +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_info_register_types (PyObject *m) { #define _PyGI_REGISTER_TYPE(m, type, cname, base) \ - Py_TYPE(&type) = &PyType_Type; \ + Py_SET_TYPE(&type, &PyType_Type); \ type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE); \ type.tp_weaklistoffset = offsetof(PyGIBaseInfo, inst_weakreflist); \ type.tp_methods = _PyGI##cname##_methods; \ type.tp_base = &base; \ - if (PyType_Ready(&type)) \ - return; \ - if (PyModule_AddObject(m, #cname, (PyObject *)&type)) \ - return + if (PyType_Ready(&type) < 0) \ + return -1; \ + Py_INCREF ((PyObject *)&type); \ + if (PyModule_AddObject(m, #cname, (PyObject *)&type) < 0) { \ + Py_DECREF ((PyObject *)&type); \ + return -1; \ + }; - Py_TYPE(&PyGIBaseInfo_Type) = &PyType_Type; + Py_SET_TYPE(&PyGIBaseInfo_Type, &PyType_Type); PyGIBaseInfo_Type.tp_dealloc = (destructor) _base_info_dealloc; PyGIBaseInfo_Type.tp_repr = (reprfunc) _base_info_repr; @@ -1999,36 +2321,44 @@ _pygi_info_register_types (PyObject *m) PyGIBaseInfo_Type.tp_getset = _base_info_getsets; PyGIBaseInfo_Type.tp_getattro = (getattrofunc) _base_info_getattro; - if (PyType_Ready(&PyGIBaseInfo_Type)) - return; - if (PyModule_AddObject(m, "BaseInfo", (PyObject *)&PyGIBaseInfo_Type)) - return; - - if (PyModule_AddObject(m, "DIRECTION_IN", PyLong_FromLong(GI_DIRECTION_IN))) - return; - if (PyModule_AddObject(m, "DIRECTION_OUT", PyLong_FromLong(GI_DIRECTION_OUT))) - return; - if (PyModule_AddObject(m, "DIRECTION_INOUT", PyLong_FromLong(GI_DIRECTION_INOUT))) - return; + if (PyType_Ready(&PyGIBaseInfo_Type) < 0) + return -1; + Py_INCREF ((PyObject *)&PyGIBaseInfo_Type); + if (PyModule_AddObject(m, "BaseInfo", (PyObject *)&PyGIBaseInfo_Type) < 0) { + Py_DECREF ((PyObject *)&PyGIBaseInfo_Type); + return -1; + } - _PyGI_REGISTER_TYPE (m, PyGICallableInfo_Type, CallableInfo, - PyGIBaseInfo_Type); PyGICallableInfo_Type.tp_call = (ternaryfunc) _callable_info_call; + PyGICallableInfo_Type.tp_repr = (reprfunc) _callable_info_repr; PyGICallableInfo_Type.tp_dealloc = (destructor) _callable_info_dealloc; + _PyGI_REGISTER_TYPE (m, PyGICallableInfo_Type, CallableInfo, + PyGIBaseInfo_Type); + // FIXME: this is to work around a pylint issue + // https://gitlab.gnome.org/GNOME/pygobject/issues/217 +#ifndef PYPY_VERSION _PyGI_REGISTER_TYPE (m, PyGIFunctionInfo_Type, FunctionInfo, PyGICallableInfo_Type); +#endif PyGIFunctionInfo_Type.tp_call = (ternaryfunc) _function_info_call; PyGIFunctionInfo_Type.tp_descr_get = (descrgetfunc) _function_info_descr_get; +#ifdef PYPY_VERSION + _PyGI_REGISTER_TYPE (m, PyGIFunctionInfo_Type, FunctionInfo, + PyGICallableInfo_Type); +#endif + PyGIVFuncInfo_Type.tp_descr_get = (descrgetfunc) _vfunc_info_descr_get; _PyGI_REGISTER_TYPE (m, PyGIVFuncInfo_Type, VFuncInfo, PyGICallableInfo_Type); - PyGIVFuncInfo_Type.tp_descr_get = (descrgetfunc) _vfunc_info_descr_get; + + _PyGI_REGISTER_TYPE (m, PyGISignalInfo_Type, SignalInfo, + PyGICallableInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIUnresolvedInfo_Type, UnresolvedInfo, PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGICallbackInfo_Type, CallbackInfo, - PyGIBaseInfo_Type); + PyGICallableInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIRegisteredTypeInfo_Type, RegisteredTypeInfo, PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIStructInfo_Type, StructInfo, @@ -2047,12 +2377,8 @@ _pygi_info_register_types (PyObject *m) PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIUnionInfo_Type, UnionInfo, PyGIRegisteredTypeInfo_Type); - _PyGI_REGISTER_TYPE (m, PyGIBoxedInfo_Type, BoxedInfo, - PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIErrorDomainInfo_Type, ErrorDomainInfo, PyGIBaseInfo_Type); - _PyGI_REGISTER_TYPE (m, PyGISignalInfo_Type, SignalInfo, - PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIPropertyInfo_Type, PropertyInfo, PyGIBaseInfo_Type); _PyGI_REGISTER_TYPE (m, PyGIArgInfo_Type, ArgInfo, @@ -2060,6 +2386,148 @@ _pygi_info_register_types (PyObject *m) _PyGI_REGISTER_TYPE (m, PyGITypeInfo_Type, TypeInfo, PyGIBaseInfo_Type); - #undef _PyGI_REGISTER_TYPE + +#define _PyGI_ENUM_BEGIN(name) \ + { \ + const char *__enum_name = #name; \ + PyObject *__enum_value = NULL; \ + PyObject *__new_enum_cls = NULL; \ + PyObject *__enum_instance_dict = PyDict_New(); \ + PyObject *__module_name = PyObject_GetAttrString (m, "__name__"); \ + PyDict_SetItemString (__enum_instance_dict, "__module__", __module_name); \ + Py_DECREF (__module_name); + +#define _PyGI_ENUM_ADD_VALUE(prefix, name) \ + __enum_value = pygi_guint_to_py (prefix##_##name); \ + if (PyDict_SetItemString(__enum_instance_dict, #name, __enum_value) < 0) { \ + Py_DECREF (__enum_instance_dict); \ + Py_DECREF (__enum_value); \ + return -1; \ + } \ + Py_DECREF (__enum_value); + +#define _PyGI_ENUM_END \ + __new_enum_cls = PyObject_CallFunction ((PyObject *)&PyType_Type, "s(O)O", \ + __enum_name, (PyObject *)&PyType_Type, \ + __enum_instance_dict); \ + Py_DECREF (__enum_instance_dict); \ + PyModule_AddObject (m, __enum_name, __new_enum_cls); /* steals ref */ \ + } + + + /* GIDirection */ + _PyGI_ENUM_BEGIN (Direction) + _PyGI_ENUM_ADD_VALUE (GI_DIRECTION, IN) + _PyGI_ENUM_ADD_VALUE (GI_DIRECTION, OUT) + _PyGI_ENUM_ADD_VALUE (GI_DIRECTION, INOUT) + _PyGI_ENUM_END + + + /* GITransfer */ + _PyGI_ENUM_BEGIN (Transfer) + _PyGI_ENUM_ADD_VALUE (GI_TRANSFER, NOTHING) + _PyGI_ENUM_ADD_VALUE (GI_TRANSFER, CONTAINER) + _PyGI_ENUM_ADD_VALUE (GI_TRANSFER, EVERYTHING) + _PyGI_ENUM_END + + /* GIArrayType */ + _PyGI_ENUM_BEGIN (ArrayType) + _PyGI_ENUM_ADD_VALUE (GI_ARRAY_TYPE, C) + _PyGI_ENUM_ADD_VALUE (GI_ARRAY_TYPE, ARRAY) + _PyGI_ENUM_ADD_VALUE (GI_ARRAY_TYPE, PTR_ARRAY) + _PyGI_ENUM_ADD_VALUE (GI_ARRAY_TYPE, BYTE_ARRAY) + _PyGI_ENUM_END + + /* GIScopeType */ + _PyGI_ENUM_BEGIN (ScopeType) + _PyGI_ENUM_ADD_VALUE (GI_SCOPE_TYPE, INVALID) + _PyGI_ENUM_ADD_VALUE (GI_SCOPE_TYPE, CALL) + _PyGI_ENUM_ADD_VALUE (GI_SCOPE_TYPE, ASYNC) + _PyGI_ENUM_ADD_VALUE (GI_SCOPE_TYPE, NOTIFIED) + _PyGI_ENUM_END + + /* GIVFuncInfoFlags */ + _PyGI_ENUM_BEGIN (VFuncInfoFlags) + _PyGI_ENUM_ADD_VALUE (GI_VFUNC_MUST, CHAIN_UP) + _PyGI_ENUM_ADD_VALUE (GI_VFUNC_MUST, OVERRIDE) + _PyGI_ENUM_ADD_VALUE (GI_VFUNC_MUST, NOT_OVERRIDE) + _PyGI_ENUM_END + + /* GIFieldInfoFlags */ + _PyGI_ENUM_BEGIN (FieldInfoFlags) + _PyGI_ENUM_ADD_VALUE (GI_FIELD, IS_READABLE) + _PyGI_ENUM_ADD_VALUE (GI_FIELD, IS_WRITABLE) + _PyGI_ENUM_END + + /* GIFunctionInfoFlags */ + _PyGI_ENUM_BEGIN (FunctionInfoFlags) + _PyGI_ENUM_ADD_VALUE (GI_FUNCTION, IS_METHOD) + _PyGI_ENUM_ADD_VALUE (GI_FUNCTION, IS_CONSTRUCTOR) + _PyGI_ENUM_ADD_VALUE (GI_FUNCTION, IS_GETTER) + _PyGI_ENUM_ADD_VALUE (GI_FUNCTION, IS_SETTER) + _PyGI_ENUM_ADD_VALUE (GI_FUNCTION, WRAPS_VFUNC) + _PyGI_ENUM_ADD_VALUE (GI_FUNCTION, THROWS) + _PyGI_ENUM_END + + /* GITypeTag */ + _PyGI_ENUM_BEGIN (TypeTag) + /* Basic types */ + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, VOID) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, BOOLEAN) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, INT8) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, UINT8) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, INT16) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, UINT16) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, INT32) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, UINT32) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, INT64) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, UINT64) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, FLOAT) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, DOUBLE) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, GTYPE) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, UTF8) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, FILENAME) + + /* Non-basic types; compare with G_TYPE_TAG_IS_BASIC */ + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, ARRAY) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, INTERFACE) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, GLIST) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, GSLIST) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, GHASH) + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, ERROR) + + /* Another basic type */ + _PyGI_ENUM_ADD_VALUE (GI_TYPE_TAG, UNICHAR) + _PyGI_ENUM_END + + /* GIInfoType */ + _PyGI_ENUM_BEGIN (InfoType) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, INVALID) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, FUNCTION) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, CALLBACK) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, STRUCT) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, BOXED) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, ENUM) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, FLAGS) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, OBJECT) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, INTERFACE) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, CONSTANT) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, INVALID_0) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, UNION) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, VALUE) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, SIGNAL) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, VFUNC) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, PROPERTY) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, FIELD) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, ARG) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, TYPE) + _PyGI_ENUM_ADD_VALUE (GI_INFO_TYPE, UNRESOLVED) + _PyGI_ENUM_END + +#undef _PyGI_ENUM_BEGIN +#undef _PyGI_ENUM_ADD_VALUE +#undef _PyGI_ENUM_END + + return 0; } diff --git a/gi/pygi-info.h b/gi/pygi-info.h index d550d8d..12ef491 100644 --- a/gi/pygi-info.h +++ b/gi/pygi-info.h @@ -14,9 +14,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_INFO_H__ @@ -25,9 +23,31 @@ #include #include +#include "pygi-cache.h" G_BEGIN_DECLS +typedef struct { + PyObject_HEAD + GIBaseInfo *info; + PyObject *inst_weakreflist; + PyGICallableCache *cache; +} PyGIBaseInfo; + +typedef struct { + PyGIBaseInfo base; + + /* Reference the unbound version of this struct. + * We use this for the actual call to invoke because it manages the cache. + */ + struct PyGICallableInfo *py_unbound_info; + + /* Holds bound argument for instance, class, and vfunc methods. */ + PyObject *py_bound_arg; + +} PyGICallableInfo; + + gboolean pygi_g_struct_info_is_simple (GIStructInfo *struct_info); @@ -66,7 +86,7 @@ gchar* _pygi_g_base_info_get_fullname (GIBaseInfo *info); gsize _pygi_g_type_tag_size (GITypeTag type_tag); gsize _pygi_g_type_info_size (GITypeInfo *type_info); -void _pygi_info_register_types (PyObject *m); +int pygi_info_register_types (PyObject *m); gboolean _pygi_is_python_keyword (const gchar *name); diff --git a/gi/pygi-invoke-state-struct.h b/gi/pygi-invoke-state-struct.h index 1d9e49c..dbf4e66 100644 --- a/gi/pygi-invoke-state-struct.h +++ b/gi/pygi-invoke-state-struct.h @@ -7,42 +7,60 @@ G_BEGIN_DECLS +typedef struct _PyGIInvokeArgState +{ + /* Holds memory for the C value of arguments marshaled "to" or "from" Python. */ + GIArgument arg_value; + + /* Holds pointers to values in arg_values or a caller allocated chunk of + * memory via arg_pointer.v_pointer. + */ + GIArgument arg_pointer; + + /* Holds from_py marshaler cleanup data. */ + gpointer arg_cleanup_data; + + /* Holds to_py marshaler cleanup data. */ + gpointer to_py_arg_cleanup_data; +} PyGIInvokeArgState; + + typedef struct _PyGIInvokeState { PyObject *py_in_args; gssize n_py_in_args; - gssize current_arg; - - GType implementor_gtype; - - GIArgument **args; - GIArgument *in_args; - - /* Generic array allocated to the same length as args - * for use as extra per-arg state data. */ - gpointer *args_data; - - /* Out args and out values - * In order to pass a parameter and get something back out in C - * we need to pass a pointer to the value, e.g. - * int *out_integer; - * - * so while out_args == out_integer, out_value == *out_integer - * or in other words out_args = &out_values - * - * We do all of our processing on out_values but we pass out_args to - * the actual function. + + /* Number of arguments the ffi wrapped C function takes. Used as the exact + * count for argument related arrays held in this struct. + */ + gssize n_args; + + /* List of arguments passed to ffi. Elements can point directly to values held in + * arg_values for "in/from Python" or indirectly via arg_pointers for + * "out/inout/to Python". In the latter case, the args[x].arg_pointer.v_pointer + * member points to memory for the value storage. */ - GIArgument *out_args; - GIArgument *out_values; + GIArgument **ffi_args; + + /* Array of size n_args containing per argument state */ + PyGIInvokeArgState *args; + /* Memory to receive the result of the C ffi function call. */ GIArgument return_arg; + gpointer to_py_return_arg_cleanup_data; + /* A GError exception which is indirectly bound into the last position of + * the "args" array if the callable caches "throws" member is set. + */ GError *error; gboolean failed; gpointer user_data; + + /* Function pointer to call with ffi. */ + gpointer function_ptr; + } PyGIInvokeState; G_END_DECLS diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c index 17cd278..7b822e4 100644 --- a/gi/pygi-invoke.c +++ b/gi/pygi-invoke.c @@ -17,87 +17,20 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include #include "pygi-invoke.h" #include "pygi-marshal-cleanup.h" +#include "pygi-error.h" +#include "pygi-resulttuple.h" +#include "pygi-foreign.h" +#include "pygi-boxed.h" -static inline gboolean -_invoke_callable (PyGIInvokeState *state, - PyGICallableCache *cache, - GICallableInfo *callable_info, - GCallback function_ptr) -{ - GError *error; - gint retval; - - error = NULL; - - Py_BEGIN_ALLOW_THREADS; - - /* FIXME: use this for now but we can streamline the calls */ - if (cache->function_type == PYGI_FUNCTION_TYPE_VFUNC) - retval = g_vfunc_info_invoke ( callable_info, - state->implementor_gtype, - state->in_args, - cache->n_from_py_args, - state->out_args, - cache->n_to_py_args, - &state->return_arg, - &error); - else if (g_base_info_get_type (callable_info) == GI_INFO_TYPE_CALLBACK) - retval = g_callable_info_invoke (callable_info, - function_ptr, - state->in_args, - cache->n_from_py_args, - state->out_args, - cache->n_to_py_args, - &state->return_arg, - FALSE, - FALSE, - &error); - else - retval = g_function_info_invoke ( callable_info, - state->in_args, - cache->n_from_py_args, - state->out_args, - cache->n_to_py_args, - &state->return_arg, - &error); - Py_END_ALLOW_THREADS; - - if (!retval) { - g_assert (error != NULL); - pyglib_error_check (&error); - - /* It is unclear if the error occured before or after the C - * function was invoked so for now assume success - * We eventually should marshal directly to FFI so we no longer - * have to use the reference implementation - */ - pygi_marshal_cleanup_args_from_py_marshal_success (state, cache); - - return FALSE; - } - - if (state->error != NULL) { - if (pyglib_error_check (&(state->error))) { - /* even though we errored out, the call itself was successful, - so we assume the call processed all of the parameters */ - pygi_marshal_cleanup_args_from_py_marshal_success (state, cache); - return FALSE; - } - } - - return TRUE; -} +extern PyObject *_PyGIDefaultArgPlaceholder; static gboolean -_check_for_unexpected_kwargs (const gchar *function_name, +_check_for_unexpected_kwargs (PyGICallableCache *cache, GHashTable *arg_name_hash, PyObject *py_kwargs) { @@ -107,12 +40,6 @@ _check_for_unexpected_kwargs (const gchar *function_name, while (PyDict_Next (py_kwargs, &dict_iter_pos, &dict_key, &dict_value)) { PyObject *key; -#if PY_VERSION_HEX < 0x03000000 - if (PyString_Check (dict_key)) { - Py_INCREF (dict_key); - key = dict_key; - } else -#endif { key = PyUnicode_AsUTF8String (dict_key); if (key == NULL) { @@ -120,12 +47,18 @@ _check_for_unexpected_kwargs (const gchar *function_name, } } - if (g_hash_table_lookup (arg_name_hash, PyBytes_AsString(key)) == NULL) { + /* Use extended lookup because it returns whether or not the key actually + * exists in the hash table. g_hash_table_lookup returns NULL for keys not + * found which maps to index 0 for our hash lookup. + */ + if (!g_hash_table_lookup_extended (arg_name_hash, PyBytes_AsString(key), NULL, NULL)) { + char *full_name = pygi_callable_cache_get_full_name (cache); PyErr_Format (PyExc_TypeError, "%.200s() got an unexpected keyword argument '%.400s'", - function_name, + full_name, PyBytes_AsString (key)); Py_DECREF (key); + g_free (full_name); return FALSE; } @@ -149,9 +82,8 @@ _py_args_combine_and_check_length (PyGICallableCache *cache, { PyObject *combined_py_args = NULL; Py_ssize_t n_py_args, n_py_kwargs, i; - guint n_expected_args; + gssize n_expected_args = cache->n_py_args; GSList *l; - const gchar *function_name = cache->name; n_py_args = PyTuple_GET_SIZE (py_args); if (py_kwargs == NULL) @@ -160,24 +92,34 @@ _py_args_combine_and_check_length (PyGICallableCache *cache, n_py_kwargs = PyDict_Size (py_kwargs); /* Fast path, we already have the exact number of args and not kwargs. */ - n_expected_args = g_slist_length (cache->arg_name_list); - if (n_py_kwargs == 0 && n_py_args == n_expected_args) { + if (n_py_kwargs == 0 && n_py_args == n_expected_args && cache->user_data_varargs_index < 0) { Py_INCREF (py_args); return py_args; } - if (n_expected_args < n_py_args) { + if (cache->user_data_varargs_index < 0 && n_expected_args < n_py_args) { + char *full_name = pygi_callable_cache_get_full_name (cache); PyErr_Format (PyExc_TypeError, - "%.200s() takes exactly %d %sargument%s (%zd given)", - function_name, + "%.200s() takes exactly %zd %sargument%s (%zd given)", + full_name, n_expected_args, n_py_kwargs > 0 ? "non-keyword " : "", n_expected_args == 1 ? "" : "s", n_py_args); + g_free (full_name); return NULL; } - if (n_py_kwargs > 0 && !_check_for_unexpected_kwargs (function_name, + if (cache->user_data_varargs_index >= 0 && n_py_kwargs > 0 && n_expected_args < n_py_args) { + char *full_name = pygi_callable_cache_get_full_name (cache); + PyErr_Format (PyExc_TypeError, + "%.200s() cannot use variable user data arguments with keyword arguments", + full_name); + g_free (full_name); + return NULL; + } + + if (n_py_kwargs > 0 && !_check_for_unexpected_kwargs (cache, cache->arg_name_hash, py_kwargs)) { return NULL; @@ -187,46 +129,84 @@ _py_args_combine_and_check_length (PyGICallableCache *cache, * when they are combined into a single tuple */ combined_py_args = PyTuple_New (n_expected_args); - for (i = 0; i < n_py_args; i++) { - PyObject *item = PyTuple_GET_ITEM (py_args, i); - Py_INCREF (item); - PyTuple_SET_ITEM (combined_py_args, i, item); - } - for (i = 0, l = cache->arg_name_list; i < n_expected_args && l; i++, l = l->next) { - PyObject *py_arg_item, *kw_arg_item = NULL; + PyObject *py_arg_item = NULL; + PyObject *kw_arg_item = NULL; const gchar *arg_name = l->data; + int arg_cache_index = -1; + gboolean is_varargs_user_data = FALSE; + + if (arg_name != NULL) + arg_cache_index = GPOINTER_TO_INT (g_hash_table_lookup (cache->arg_name_hash, arg_name)); + + is_varargs_user_data = cache->user_data_varargs_index >= 0 && + arg_cache_index == cache->user_data_varargs_index; if (n_py_kwargs > 0 && arg_name != NULL) { /* NULL means this argument has no keyword name */ /* ex. the first argument to a method or constructor */ kw_arg_item = PyDict_GetItemString (py_kwargs, arg_name); } - py_arg_item = PyTuple_GET_ITEM (combined_py_args, i); - if (kw_arg_item != NULL && py_arg_item == NULL) { - Py_INCREF (kw_arg_item); - PyTuple_SET_ITEM (combined_py_args, i, kw_arg_item); + /* use a bounded retrieval of the original input */ + if (i < n_py_args) + py_arg_item = PyTuple_GET_ITEM (py_args, i); + + if (kw_arg_item == NULL && py_arg_item != NULL) { + if (is_varargs_user_data) { + /* For tail end user_data varargs, pull a slice off and we are done. */ + PyObject *user_data = PyTuple_GetSlice (py_args, i, PY_SSIZE_T_MAX); + PyTuple_SET_ITEM (combined_py_args, i, user_data); + return combined_py_args; + } else { + Py_INCREF (py_arg_item); + PyTuple_SET_ITEM (combined_py_args, i, py_arg_item); + } + } else if (kw_arg_item != NULL && py_arg_item == NULL) { + if (is_varargs_user_data) { + /* Special case where user_data is passed as a keyword argument (user_data=foo) + * Wrap the value in a tuple to represent variable args for marshaling later on. + */ + PyObject *user_data = Py_BuildValue("(O)", kw_arg_item, NULL); + PyTuple_SET_ITEM (combined_py_args, i, user_data); + } else { + Py_INCREF (kw_arg_item); + PyTuple_SET_ITEM (combined_py_args, i, kw_arg_item); + } } else if (kw_arg_item == NULL && py_arg_item == NULL) { - PyErr_Format (PyExc_TypeError, - "%.200s() takes exactly %d %sargument%s (%zd given)", - function_name, - n_expected_args, - n_py_kwargs > 0 ? "non-keyword " : "", - n_expected_args == 1 ? "" : "s", - n_py_args); - - Py_DECREF (combined_py_args); - return NULL; - + if (is_varargs_user_data) { + /* For varargs user_data, pass an empty tuple when nothing is given. */ + PyTuple_SET_ITEM (combined_py_args, i, PyTuple_New (0)); + } else if (arg_cache_index >= 0 && _pygi_callable_cache_get_arg (cache, arg_cache_index)->has_default) { + /* If the argument supports a default, use a place holder in the + * argument tuple, this will be checked later during marshaling. + */ + Py_INCREF (_PyGIDefaultArgPlaceholder); + PyTuple_SET_ITEM (combined_py_args, i, _PyGIDefaultArgPlaceholder); + } else { + char *full_name = pygi_callable_cache_get_full_name (cache); + PyErr_Format (PyExc_TypeError, + "%.200s() takes exactly %zd %sargument%s (%zd given)", + full_name, + n_expected_args, + n_py_kwargs > 0 ? "non-keyword " : "", + n_expected_args == 1 ? "" : "s", + n_py_args); + g_free (full_name); + + Py_DECREF (combined_py_args); + return NULL; + } } else if (kw_arg_item != NULL && py_arg_item != NULL) { + char *full_name = pygi_callable_cache_get_full_name (cache); PyErr_Format (PyExc_TypeError, "%.200s() got multiple values for keyword argument '%.200s'", - function_name, + full_name, arg_name); Py_DECREF (combined_py_args); + g_free (full_name); return NULL; } } @@ -234,209 +214,230 @@ _py_args_combine_and_check_length (PyGICallableCache *cache, return combined_py_args; } -static inline gboolean -_invoke_state_init_from_callable_cache (PyGIInvokeState *state, - PyGICallableCache *cache, - PyObject *py_args, - PyObject *kwargs) -{ - PyObject *combined_args = NULL; - state->implementor_gtype = 0; - - /* TODO: We don't use the class parameter sent in by the structure - * so we remove it from the py_args tuple but we can keep it - * around if we want to call actual gobject constructors - * in the future instead of calling g_object_new - */ - if (cache->function_type == PYGI_FUNCTION_TYPE_CONSTRUCTOR) { - PyObject *constructor_class; - constructor_class = PyTuple_GetItem (py_args, 0); - - if (constructor_class == NULL) { - PyErr_Clear (); - PyErr_Format (PyExc_TypeError, - "Constructors require the class to be passed in as an argument, " - "No arguments passed to the %s constructor.", - cache->name); - - return FALSE; - } - } else if (cache->function_type == PYGI_FUNCTION_TYPE_VFUNC) { - PyObject *py_gtype; - py_gtype = PyTuple_GetItem (py_args, 0); - if (py_gtype == NULL) { - PyErr_SetString (PyExc_TypeError, - "need the GType of the implementor class"); - return FALSE; - } +/* To reduce calls to g_slice_*() we (1) allocate all the memory depended on + * the argument count in one go and (2) keep one version per argument count + * around for faster reuse. + */ - state->implementor_gtype = pyg_type_from_object (py_gtype); +#define PyGI_INVOKE_ARG_STATE_SIZE(n) (n * (sizeof (PyGIInvokeArgState) + sizeof (GIArgument *))) +#define PyGI_INVOKE_ARG_STATE_N_MAX 10 +static gpointer free_arg_state[PyGI_INVOKE_ARG_STATE_N_MAX]; - if (state->implementor_gtype == 0) - return FALSE; - } +/** + * _pygi_invoke_arg_state_init: + * Sets PyGIInvokeState.args and PyGIInvokeState.ffi_args. + * On error returns FALSE and sets an exception. + */ +gboolean +_pygi_invoke_arg_state_init (PyGIInvokeState *state) { - if (cache->function_type == PYGI_FUNCTION_TYPE_CONSTRUCTOR || - cache->function_type == PYGI_FUNCTION_TYPE_VFUNC) { + gpointer mem; - /* we could optimize this by using offsets instead of modifying the tuple but it makes the - * code more error prone and confusing so don't do that unless profiling shows - * significant gain - */ - combined_args = PyTuple_GetSlice (py_args, 1, PyTuple_Size (py_args)); + if (state->n_args < PyGI_INVOKE_ARG_STATE_N_MAX && (mem = free_arg_state[state->n_args]) != NULL) { + free_arg_state[state->n_args] = NULL; + memset (mem, 0, PyGI_INVOKE_ARG_STATE_SIZE (state->n_args)); } else { - combined_args = py_args; - Py_INCREF (combined_args); + mem = g_slice_alloc0 (PyGI_INVOKE_ARG_STATE_SIZE (state->n_args)); } - state->py_in_args = _py_args_combine_and_check_length (cache, - combined_args, - kwargs); - Py_DECREF (combined_args); - - if (state->py_in_args == NULL) { + if (mem == NULL && state->n_args != 0) { + PyErr_NoMemory(); return FALSE; } - state->n_py_in_args = PyTuple_Size (state->py_in_args); - state->args = g_slice_alloc0 (cache->n_args * sizeof (GIArgument *)); - if (state->args == NULL && cache->n_args != 0) { - PyErr_NoMemory(); - return FALSE; + if (mem != NULL) { + state->args = mem; + state->ffi_args = (gpointer)((gchar *)mem + state->n_args * sizeof (PyGIInvokeArgState)); } - state->args_data = g_slice_alloc0 (cache->n_args * sizeof (gpointer)); - if (state->args_data == NULL && cache->n_args != 0) { - PyErr_NoMemory(); - return FALSE; + return TRUE; +} + +/** + * _pygi_invoke_arg_state_free: + * Frees PyGIInvokeState.args and PyGIInvokeState.ffi_args + */ +void +_pygi_invoke_arg_state_free(PyGIInvokeState *state) { + if (state->n_args < PyGI_INVOKE_ARG_STATE_N_MAX && free_arg_state[state->n_args] == NULL) { + free_arg_state[state->n_args] = state->args; + return; } - state->in_args = g_slice_alloc0 (cache->n_from_py_args * sizeof(GIArgument)); - if (state->in_args == NULL && cache->n_from_py_args != 0) { - PyErr_NoMemory (); - return FALSE; + g_slice_free1 (PyGI_INVOKE_ARG_STATE_SIZE (state->n_args), state->args); +} + +static gboolean +_invoke_state_init_from_cache (PyGIInvokeState *state, + PyGIFunctionCache *function_cache, + PyObject *py_args, + PyObject *kwargs) +{ + PyGICallableCache *cache = (PyGICallableCache *) function_cache; + + state->n_args = _pygi_callable_cache_args_len (cache); + + if (cache->throws) { + state->n_args++; } - state->out_values = g_slice_alloc0 (cache->n_to_py_args * sizeof(GIArgument)); - if (state->out_values == NULL && cache->n_to_py_args != 0) { - PyErr_NoMemory (); + /* Copy the function pointer to the state for the normal case. For vfuncs, + * this has already been filled out based on the implementor's GType. + */ + if (state->function_ptr == NULL) + state->function_ptr = function_cache->invoker.native_address; + + state->py_in_args = _py_args_combine_and_check_length (cache, + py_args, + kwargs); + + if (state->py_in_args == NULL) { return FALSE; } + state->n_py_in_args = PyTuple_Size (state->py_in_args); - state->out_args = g_slice_alloc0 (cache->n_to_py_args * sizeof(GIArgument)); - if (state->out_args == NULL && cache->n_to_py_args != 0) { - PyErr_NoMemory (); + if (!_pygi_invoke_arg_state_init (state)) { return FALSE; } state->error = NULL; + if (cache->throws) { + gssize error_index = state->n_args - 1; + /* The ffi argument for GError needs to be a triple pointer. */ + state->args[error_index].arg_pointer.v_pointer = &state->error; + state->ffi_args[error_index] = &(state->args[error_index].arg_pointer); + } + return TRUE; } -static inline void -_invoke_state_clear (PyGIInvokeState *state, PyGICallableCache *cache) +static void +_invoke_state_clear (PyGIInvokeState *state, PyGIFunctionCache *function_cache) { - g_slice_free1 (cache->n_args * sizeof(GIArgument *), state->args); - g_slice_free1 (cache->n_args * sizeof(gpointer), state->args_data); - g_slice_free1 (cache->n_from_py_args * sizeof(GIArgument), state->in_args); - g_slice_free1 (cache->n_to_py_args * sizeof(GIArgument), state->out_args); - g_slice_free1 (cache->n_to_py_args * sizeof(GIArgument), state->out_values); - + _pygi_invoke_arg_state_free (state); Py_XDECREF (state->py_in_args); } -static gboolean _caller_alloc (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gssize arg_count, - gssize out_count) +static gboolean +_caller_alloc (PyGIArgCache *arg_cache, GIArgument *arg) { if (arg_cache->type_tag == GI_TYPE_TAG_INTERFACE) { PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - state->out_args[out_count].v_pointer = NULL; - state->args[arg_count] = &state->out_args[out_count]; + arg->v_pointer = NULL; if (g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) { - state->args[arg_count]->v_pointer = - _pygi_boxed_alloc (iface_cache->interface_info, NULL); + arg->v_pointer = + pygi_boxed_alloc (iface_cache->interface_info, NULL); } else if (iface_cache->g_type == G_TYPE_VALUE) { - state->args[arg_count]->v_pointer = g_slice_new0 (GValue); + arg->v_pointer = g_slice_new0 (GValue); } else if (iface_cache->is_foreign) { PyObject *foreign_struct = pygi_struct_foreign_convert_from_g_argument ( iface_cache->interface_info, + GI_TRANSFER_NOTHING, NULL); pygi_struct_foreign_convert_to_g_argument (foreign_struct, iface_cache->interface_info, GI_TRANSFER_EVERYTHING, - state->args[arg_count]); + arg); } else { gssize size = g_struct_info_get_size( (GIStructInfo *)iface_cache->interface_info); - state->args[arg_count]->v_pointer = g_malloc0 (size); + arg->v_pointer = g_malloc0 (size); } } else if (arg_cache->type_tag == GI_TYPE_TAG_ARRAY) { - PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; + PyGIArgGArray *array_cache = (PyGIArgGArray *)arg_cache; - state->out_args[out_count].v_pointer = g_array_new (TRUE, TRUE, seq_cache->item_size); - state->args[arg_count] = &state->out_args[out_count]; + arg->v_pointer = g_array_new (TRUE, TRUE, (guint)array_cache->item_size); } else { return FALSE; } - if (state->args[arg_count]->v_pointer == NULL) + if (arg->v_pointer == NULL) return FALSE; return TRUE; } -static inline gboolean -_invoke_marshal_in_args (PyGIInvokeState *state, PyGICallableCache *cache) +/* pygi_invoke_marshal_in_args: + * + * Fills out the state struct argument lists. arg_values will always hold + * actual values marshaled either to or from Python and C. arg_pointers will + * hold pointers (via v_pointer) to auxilary value storage. This will normally + * point to values stored in arg_values. In the case of caller allocated + * out args, arg_pointers[x].v_pointer will point to newly allocated memory. + * arg_pointers inserts a level of pointer indirection between arg_values + * and the argument list ffi receives when dealing with non-caller allocated + * out arguments. + * + * For example: + * [[ + * void callee (int *i, int j) { *i = 50 - j; } + * void caller () { + * int i = 0; + * callee (&i, 8); + * } + * + * args[0] == &arg_pointers[0]; + * arg_pointers[0].v_pointer == &arg_values[0]; + * arg_values[0].v_int == 42; + * + * args[1] == &arg_values[1]; + * arg_values[1].v_int == 8; + * ]] + * + */ +static gboolean +_invoke_marshal_in_args (PyGIInvokeState *state, PyGIFunctionCache *function_cache) { - gssize i, in_count, out_count; - in_count = 0; - out_count = 0; + PyGICallableCache *cache = (PyGICallableCache *) function_cache; + gssize i; if (state->n_py_in_args > cache->n_py_args) { + char *full_name = pygi_callable_cache_get_full_name (cache); PyErr_Format (PyExc_TypeError, "%s() takes exactly %zd argument(s) (%zd given)", - cache->name, + full_name, cache->n_py_args, state->n_py_in_args); + g_free (full_name); return FALSE; } - for (i = 0; i < cache->n_args; i++) { - GIArgument *c_arg; - PyGIArgCache *arg_cache = cache->args_cache[i]; + for (i = 0; (gsize)i < _pygi_callable_cache_args_len (cache); i++) { + GIArgument *c_arg = &state->args[i].arg_value; + PyGIArgCache *arg_cache = g_ptr_array_index (cache->args_cache, i); PyObject *py_arg = NULL; switch (arg_cache->direction) { case PYGI_DIRECTION_FROM_PYTHON: - state->args[i] = &(state->in_args[in_count]); - in_count++; + /* The ffi argument points directly at memory in arg_values. */ + state->ffi_args[i] = c_arg; if (arg_cache->meta_type == PYGI_META_ARG_TYPE_CLOSURE) { - state->args[i]->v_pointer = state->user_data; + state->ffi_args[i]->v_pointer = state->user_data; continue; } else if (arg_cache->meta_type != PYGI_META_ARG_TYPE_PARENT) continue; if (arg_cache->py_arg_index >= state->n_py_in_args) { + char *full_name = pygi_callable_cache_get_full_name (cache); PyErr_Format (PyExc_TypeError, "%s() takes exactly %zd argument(s) (%zd given)", - cache->name, + full_name, cache->n_py_args, state->n_py_in_args); + g_free (full_name); /* clean up all of the args we have already marshalled, * since invoke will not be called */ pygi_marshal_cleanup_args_from_py_parameter_fail (state, cache, - i - 1); + i); return FALSE; } @@ -446,23 +447,18 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGICallableCache *cache) break; case PYGI_DIRECTION_BIDIRECTIONAL: - /* this will be filled in if it is an child value */ - if (state->in_args[in_count].v_pointer != NULL) - state->out_values[out_count] = state->in_args[in_count]; - - state->in_args[in_count].v_pointer = &state->out_values[out_count]; - in_count++; - if (arg_cache->meta_type != PYGI_META_ARG_TYPE_CHILD) { if (arg_cache->py_arg_index >= state->n_py_in_args) { + char *full_name = pygi_callable_cache_get_full_name (cache); PyErr_Format (PyExc_TypeError, "%s() takes exactly %zd argument(s) (%zd given)", - cache->name, + full_name, cache->n_py_args, state->n_py_in_args); + g_free (full_name); pygi_marshal_cleanup_args_from_py_parameter_fail (state, cache, - i - 1); + i); return FALSE; } @@ -470,28 +466,56 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGICallableCache *cache) PyTuple_GET_ITEM (state->py_in_args, arg_cache->py_arg_index); } + /* Fall through */ + case PYGI_DIRECTION_TO_PYTHON: + /* arg_pointers always stores a pointer to the data to be marshaled "to python" + * even in cases where arg_pointers is not being used as indirection between + * ffi and arg_values. This gives a guarantee that out argument marshaling + * (_invoke_marshal_out_args) can always rely on arg_pointers pointing to + * the correct chunk of memory to marshal. + */ + state->args[i].arg_pointer.v_pointer = c_arg; + if (arg_cache->is_caller_allocates) { - if (!_caller_alloc (state, arg_cache, i, out_count)) { + /* In the case of caller allocated out args, we don't use + * an extra level of indirection and state->args will point + * directly at the data to be marshaled. However, as noted + * above, arg_pointers will also point to this caller allocated + * chunk of memory used by out argument marshaling. + */ + state->ffi_args[i] = c_arg; + + if (!_caller_alloc (arg_cache, c_arg)) { + char *full_name = pygi_callable_cache_get_full_name (cache); PyErr_Format (PyExc_TypeError, "Could not caller allocate argument %zd of callable %s", - i, cache->name); + i, full_name); + g_free (full_name); pygi_marshal_cleanup_args_from_py_parameter_fail (state, cache, - i - 1); + i); return FALSE; } } else { - state->out_args[out_count].v_pointer = &state->out_values[out_count]; - state->args[i] = &state->out_values[out_count]; + /* Non-caller allocated out args will use arg_pointers as an + * extra level of indirection */ + state->ffi_args[i] = &state->args[i].arg_pointer; } - out_count++; + + break; + default: + g_assert_not_reached(); break; } - c_arg = state->args[i]; - if (arg_cache->from_py_marshaller != NULL) { + if (py_arg == _PyGIDefaultArgPlaceholder) { + *c_arg = arg_cache->default_value; + } else if (arg_cache->from_py_marshaller != NULL && + arg_cache->meta_type != PYGI_META_ARG_TYPE_CHILD) { gboolean success; + gpointer cleanup_data = NULL; + if (!arg_cache->allow_none && py_arg == Py_None) { PyErr_Format (PyExc_TypeError, "Argument %zd does not allow None as a value", @@ -499,18 +523,21 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGICallableCache *cache) pygi_marshal_cleanup_args_from_py_parameter_fail (state, cache, - i - 1); + i); return FALSE; } success = arg_cache->from_py_marshaller (state, - cache, - arg_cache, - py_arg, - c_arg); + cache, + arg_cache, + py_arg, + c_arg, + &cleanup_data); + state->args[i].arg_cleanup_data = cleanup_data; + if (!success) { pygi_marshal_cleanup_args_from_py_parameter_fail (state, cache, - i - 1); + i); return FALSE; } @@ -521,57 +548,44 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGICallableCache *cache) return TRUE; } -static inline PyObject * -_invoke_marshal_out_args (PyGIInvokeState *state, PyGICallableCache *cache) +static PyObject * +_invoke_marshal_out_args (PyGIInvokeState *state, PyGIFunctionCache *function_cache) { + PyGICallableCache *cache = (PyGICallableCache *) function_cache; PyObject *py_out = NULL; PyObject *py_return = NULL; - gssize total_out_args = cache->n_to_py_args; - gboolean has_return = FALSE; + gssize n_out_args = cache->n_to_py_args - cache->n_to_py_child_args; if (cache->return_cache) { if (!cache->return_cache->is_skipped) { - if (cache->function_type == PYGI_FUNCTION_TYPE_CONSTRUCTOR) { - if (state->return_arg.v_pointer == NULL) { - PyErr_SetString (PyExc_TypeError, "constructor returned NULL"); - pygi_marshal_cleanup_args_return_fail (state, - cache); - return NULL; - } - } - + gpointer cleanup_data = NULL; py_return = cache->return_cache->to_py_marshaller ( state, cache, cache->return_cache, - &state->return_arg); + &state->return_arg, + &cleanup_data); + state->to_py_return_arg_cleanup_data = cleanup_data; if (py_return == NULL) { pygi_marshal_cleanup_args_return_fail (state, cache); return NULL; } - - - if (cache->return_cache->type_tag != GI_TYPE_TAG_VOID) { - total_out_args++; - has_return = TRUE; - } } else { if (cache->return_cache->transfer == GI_TRANSFER_EVERYTHING) { - PyGIMarshalCleanupFunc to_py_cleanup = + PyGIMarshalToPyCleanupFunc to_py_cleanup = cache->return_cache->to_py_cleanup; if (to_py_cleanup != NULL) to_py_cleanup ( state, cache->return_cache, + NULL, &state->return_arg, FALSE); } } } - total_out_args -= cache->n_to_py_child_args; - - if (cache->n_to_py_args - cache->n_to_py_child_args == 0) { + if (n_out_args == 0) { if (cache->return_cache->is_skipped && state->error == NULL) { /* we skip the return value and have no (out) arguments to return, * so py_return should be NULL. But we must not return NULL, @@ -583,13 +597,16 @@ _invoke_marshal_out_args (PyGIInvokeState *state, PyGICallableCache *cache) } py_out = py_return; - } else if (total_out_args == 1) { + } else if (!cache->has_return && n_out_args == 1) { /* if we get here there is one out arg an no return */ PyGIArgCache *arg_cache = (PyGIArgCache *)cache->to_py_args->data; + gpointer cleanup_data = NULL; py_out = arg_cache->to_py_marshaller (state, cache, arg_cache, - state->args[arg_cache->c_arg_index]); + state->args[arg_cache->c_arg_index].arg_pointer.v_pointer, + &cleanup_data); + state->args[arg_cache->c_arg_index].to_py_arg_cleanup_data = cleanup_data; if (py_out == NULL) { pygi_marshal_cleanup_args_to_py_parameter_fail (state, cache, @@ -598,26 +615,39 @@ _invoke_marshal_out_args (PyGIInvokeState *state, PyGICallableCache *cache) } } else { + /* return a tuple */ gssize py_arg_index = 0; GSList *cache_item = cache->to_py_args; - /* return a tuple */ - py_out = PyTuple_New (total_out_args); - if (has_return) { + gssize tuple_len = cache->has_return + n_out_args; + + py_out = pygi_resulttuple_new (cache->resulttuple_type, tuple_len); + + if (py_out == NULL) { + pygi_marshal_cleanup_args_to_py_parameter_fail (state, + cache, + py_arg_index); + return NULL; + } + + if (cache->has_return) { PyTuple_SET_ITEM (py_out, py_arg_index, py_return); py_arg_index++; } - for(; py_arg_index < total_out_args; py_arg_index++) { + for (; py_arg_index < tuple_len; py_arg_index++) { PyGIArgCache *arg_cache = (PyGIArgCache *)cache_item->data; + gpointer cleanup_data = NULL; PyObject *py_obj = arg_cache->to_py_marshaller (state, cache, arg_cache, - state->args[arg_cache->c_arg_index]); + state->args[arg_cache->c_arg_index].arg_pointer.v_pointer, + &cleanup_data); + state->args[arg_cache->c_arg_index].to_py_arg_cleanup_data = cleanup_data; if (py_obj == NULL) { - if (has_return) + if (cache->has_return) py_arg_index--; - + pygi_marshal_cleanup_args_to_py_parameter_fail (state, cache, py_arg_index); @@ -633,44 +663,103 @@ _invoke_marshal_out_args (PyGIInvokeState *state, PyGICallableCache *cache) } PyObject * -pygi_callable_info_invoke (GIBaseInfo *info, PyObject *py_args, - PyObject *kwargs, PyGICallableCache *cache, - GCallback function_ptr, gpointer user_data) +pygi_invoke_c_callable (PyGIFunctionCache *function_cache, + PyGIInvokeState *state, + PyObject *py_args, + PyObject *py_kwargs) { - PyGIInvokeState state = { 0, }; + PyGICallableCache *cache = (PyGICallableCache *) function_cache; + GIFFIReturnValue ffi_return_value = {0}; PyObject *ret = NULL; - if (!_invoke_state_init_from_callable_cache (&state, cache, py_args, kwargs)) - goto err; + if (!_invoke_state_init_from_cache (state, function_cache, + py_args, py_kwargs)) + goto err; - if (cache->function_type == PYGI_FUNCTION_TYPE_CCALLBACK) - state.user_data = user_data; + if (!_invoke_marshal_in_args (state, function_cache)) + goto err; - if (!_invoke_marshal_in_args (&state, cache)) - goto err; + Py_BEGIN_ALLOW_THREADS; - if (!_invoke_callable (&state, cache, info, function_ptr)) - goto err; + ffi_call (&function_cache->invoker.cif, + state->function_ptr, + (void *) &ffi_return_value, + (void **) state->ffi_args); - pygi_marshal_cleanup_args_from_py_marshal_success (&state, cache); + Py_END_ALLOW_THREADS; + + /* If the callable throws, the address of state->error will be bound into + * the state->args as the last value. When the callee sets an error using + * the state->args passed, it will have the side effect of setting + * state->error allowing for easy checking here. + */ + if (state->error != NULL) { + if (pygi_error_check (&state->error)) { + /* even though we errored out, the call itself was successful, + so we assume the call processed all of the parameters */ + pygi_marshal_cleanup_args_from_py_marshal_success (state, cache); + goto err; + } + } + + if (cache->return_cache) { + gi_type_info_extract_ffi_return_value (cache->return_cache->type_info, + &ffi_return_value, + &state->return_arg); + } + + ret = _invoke_marshal_out_args (state, function_cache); + pygi_marshal_cleanup_args_from_py_marshal_success (state, cache); + + if (ret != NULL) + pygi_marshal_cleanup_args_to_py_marshal_success (state, cache); - ret = _invoke_marshal_out_args (&state, cache); - if (ret) - pygi_marshal_cleanup_args_to_py_marshal_success (&state, cache); err: - _invoke_state_clear (&state, cache); + _invoke_state_clear (state, function_cache); return ret; } PyObject * +pygi_callable_info_invoke (GIBaseInfo *info, PyObject *py_args, + PyObject *kwargs, PyGICallableCache *cache, + gpointer user_data) +{ + return pygi_function_cache_invoke ((PyGIFunctionCache *) cache, + py_args, kwargs); +} + +PyObject * _wrap_g_callable_info_invoke (PyGIBaseInfo *self, PyObject *py_args, PyObject *kwargs) { if (self->cache == NULL) { - self->cache = _pygi_callable_cache_new (self->info, FALSE); + PyGIFunctionCache *function_cache; + GIInfoType type = g_base_info_get_type (self->info); + + if (type == GI_INFO_TYPE_FUNCTION) { + GIFunctionInfoFlags flags; + + flags = g_function_info_get_flags ( (GIFunctionInfo *)self->info); + + if (flags & GI_FUNCTION_IS_CONSTRUCTOR) { + function_cache = pygi_constructor_cache_new (self->info); + } else if (flags & GI_FUNCTION_IS_METHOD) { + function_cache = pygi_method_cache_new (self->info); + } else { + function_cache = pygi_function_cache_new (self->info); + } + } else if (type == GI_INFO_TYPE_VFUNC) { + function_cache = pygi_vfunc_cache_new (self->info); + } else if (type == GI_INFO_TYPE_CALLBACK) { + g_error ("Cannot invoke callback types"); + } else { + function_cache = pygi_method_cache_new (self->info); + } + + self->cache = (PyGICallableCache *)function_cache; if (self->cache == NULL) return NULL; } - return pygi_callable_info_invoke (self->info, py_args, kwargs, self->cache, NULL, NULL); + return pygi_callable_info_invoke (self->info, py_args, kwargs, self->cache, NULL); } diff --git a/gi/pygi-invoke.h b/gi/pygi-invoke.h index 051bc8d..aa51f3f 100644 --- a/gi/pygi-invoke.h +++ b/gi/pygi-invoke.h @@ -14,9 +14,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_INVOKE_H__ @@ -26,16 +24,24 @@ #include -#include "pygi-private.h" +#include "pygi-info.h" #include "pygi-invoke-state-struct.h" + G_BEGIN_DECLS +PyObject *pygi_invoke_c_callable (PyGIFunctionCache *function_cache, + PyGIInvokeState *state, + PyObject *py_args, PyObject *py_kwargs); PyObject *pygi_callable_info_invoke (GIBaseInfo *info, PyObject *py_args, PyObject *kwargs, PyGICallableCache *cache, - GCallback function_ptr, gpointer user_data); + gpointer user_data); PyObject *_wrap_g_callable_info_invoke (PyGIBaseInfo *self, PyObject *py_args, PyObject *kwargs); +gboolean _pygi_invoke_arg_state_init (PyGIInvokeState *state); + +void _pygi_invoke_arg_state_free (PyGIInvokeState *state); + G_END_DECLS #endif /* __PYGI_INVOKE_H__ */ diff --git a/gi/pygi-list.c b/gi/pygi-list.c new file mode 100644 index 0000000..712c372 --- /dev/null +++ b/gi/pygi-list.c @@ -0,0 +1,500 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include "pygi-list.h" +#include "pygi-argument.h" +#include "pygi-util.h" + +typedef PyGISequenceCache PyGIArgGList; + +/* + * GList and GSList from Python + */ +static gboolean +_pygi_marshal_from_py_glist (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyGIMarshalFromPyFunc from_py_marshaller; + int i; + Py_ssize_t length; + GList *list_ = NULL; + PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; + + + if (py_arg == Py_None) { + arg->v_pointer = NULL; + return TRUE; + } + + if (!PySequence_Check (py_arg)) { + PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + length = PySequence_Length (py_arg); + if (length < 0) + return FALSE; + + from_py_marshaller = sequence_cache->item_cache->from_py_marshaller; + for (i = 0; i < length; i++) { + GIArgument item = {0}; + gpointer item_cleanup_data = NULL; + PyObject *py_item = PySequence_GetItem (py_arg, i); + if (py_item == NULL) + goto err; + + if (!from_py_marshaller ( state, + callable_cache, + sequence_cache->item_cache, + py_item, + &item, + &item_cleanup_data)) + goto err; + + Py_DECREF (py_item); + list_ = g_list_prepend (list_, _pygi_arg_to_hash_pointer (&item, sequence_cache->item_cache->type_info)); + continue; +err: + /* FIXME: clean up list + if (sequence_cache->item_cache->from_py_cleanup != NULL) { + PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup; + } + */ + Py_XDECREF (py_item); + g_list_free (list_); + _PyGI_ERROR_PREFIX ("Item %i: ", i); + return FALSE; + } + + arg->v_pointer = g_list_reverse (list_); + + if (arg_cache->transfer == GI_TRANSFER_NOTHING) { + /* Free everything in cleanup. */ + *cleanup_data = arg->v_pointer; + } else if (arg_cache->transfer == GI_TRANSFER_CONTAINER) { + /* Make a shallow copy so we can free the elements later in cleanup + * because it is possible invoke will free the list before our cleanup. */ + *cleanup_data = g_list_copy (arg->v_pointer); + } else { /* GI_TRANSFER_EVERYTHING */ + /* No cleanup, everything is given to the callee. */ + *cleanup_data = NULL; + } + return TRUE; +} + + +static gboolean +_pygi_marshal_from_py_gslist (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyGIMarshalFromPyFunc from_py_marshaller; + int i; + Py_ssize_t length; + GSList *list_ = NULL; + PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; + + if (py_arg == Py_None) { + arg->v_pointer = NULL; + return TRUE; + } + + if (!PySequence_Check (py_arg)) { + PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + length = PySequence_Length (py_arg); + if (length < 0) + return FALSE; + + from_py_marshaller = sequence_cache->item_cache->from_py_marshaller; + for (i = 0; i < length; i++) { + GIArgument item = {0}; + gpointer item_cleanup_data = NULL; + PyObject *py_item = PySequence_GetItem (py_arg, i); + if (py_item == NULL) + goto err; + + if (!from_py_marshaller ( state, + callable_cache, + sequence_cache->item_cache, + py_item, + &item, + &item_cleanup_data)) + goto err; + + Py_DECREF (py_item); + list_ = g_slist_prepend (list_, _pygi_arg_to_hash_pointer (&item, sequence_cache->item_cache->type_info)); + continue; +err: + /* FIXME: Clean up list + if (sequence_cache->item_cache->from_py_cleanup != NULL) { + PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup; + } + */ + + Py_XDECREF (py_item); + g_slist_free (list_); + _PyGI_ERROR_PREFIX ("Item %i: ", i); + return FALSE; + } + + arg->v_pointer = g_slist_reverse (list_); + + if (arg_cache->transfer == GI_TRANSFER_NOTHING) { + /* Free everything in cleanup. */ + *cleanup_data = arg->v_pointer; + } else if (arg_cache->transfer == GI_TRANSFER_CONTAINER) { + /* Make a shallow copy so we can free the elements later in cleanup + * because it is possible invoke will free the list before our cleanup. */ + *cleanup_data = g_slist_copy (arg->v_pointer); + } else { /* GI_TRANSFER_EVERYTHING */ + /* No cleanup, everything is given to the callee. */ + *cleanup_data = NULL; + } + + return TRUE; +} + +static void +_pygi_marshal_cleanup_from_py_glist (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + if (was_processed) { + GSList *list_; + PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; + + list_ = (GSList *)data; + + /* clean up items first */ + if (sequence_cache->item_cache->from_py_cleanup != NULL) { + PyGIMarshalCleanupFunc cleanup_func = + sequence_cache->item_cache->from_py_cleanup; + GSList *node = list_; + gsize i = 0; + while (node != NULL) { + PyObject *py_item = PySequence_GetItem (py_arg, i); + cleanup_func (state, + sequence_cache->item_cache, + py_item, + node->data, + TRUE); + Py_XDECREF (py_item); + node = node->next; + i++; + } + } + + if (arg_cache->type_tag == GI_TYPE_TAG_GLIST) { + g_list_free ( (GList *)list_); + } else if (arg_cache->type_tag == GI_TYPE_TAG_GSLIST) { + g_slist_free (list_); + } else { + g_assert_not_reached(); + } + } +} + + +/* + * GList and GSList to Python + */ +static PyObject * +_pygi_marshal_to_py_glist (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + GList *list_; + guint length; + guint i; + GPtrArray *item_cleanups; + + PyGIMarshalToPyFunc item_to_py_marshaller; + PyGIArgCache *item_arg_cache; + PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; + + PyObject *py_obj = NULL; + + list_ = arg->v_pointer; + length = g_list_length (list_); + + py_obj = PyList_New (length); + if (py_obj == NULL) + return NULL; + + item_cleanups = g_ptr_array_sized_new (length); + *cleanup_data = item_cleanups; + + item_arg_cache = seq_cache->item_cache; + item_to_py_marshaller = item_arg_cache->to_py_marshaller; + + for (i = 0; list_ != NULL; list_ = g_list_next (list_), i++) { + GIArgument item_arg; + PyObject *py_item; + gpointer item_cleanup_data = NULL; + + item_arg.v_pointer = list_->data; + _pygi_hash_pointer_to_arg (&item_arg, item_arg_cache->type_info); + py_item = item_to_py_marshaller (state, + callable_cache, + item_arg_cache, + &item_arg, + &item_cleanup_data); + + g_ptr_array_index (item_cleanups, i) = item_cleanup_data; + + if (py_item == NULL) { + Py_CLEAR (py_obj); + _PyGI_ERROR_PREFIX ("Item %u: ", i); + g_ptr_array_unref (item_cleanups); + return NULL; + } + + PyList_SET_ITEM (py_obj, i, py_item); + } + + return py_obj; +} + +static PyObject * +_pygi_marshal_to_py_gslist (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + GSList *list_; + guint length; + guint i; + GPtrArray *item_cleanups; + + PyGIMarshalToPyFunc item_to_py_marshaller; + PyGIArgCache *item_arg_cache; + PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; + + PyObject *py_obj = NULL; + + list_ = arg->v_pointer; + length = g_slist_length (list_); + + py_obj = PyList_New (length); + if (py_obj == NULL) + return NULL; + + item_cleanups = g_ptr_array_sized_new (length); + *cleanup_data = item_cleanups; + + item_arg_cache = seq_cache->item_cache; + item_to_py_marshaller = item_arg_cache->to_py_marshaller; + + for (i = 0; list_ != NULL; list_ = g_slist_next (list_), i++) { + GIArgument item_arg; + PyObject *py_item; + gpointer item_cleanup_data = NULL; + + item_arg.v_pointer = list_->data; + _pygi_hash_pointer_to_arg (&item_arg, item_arg_cache->type_info); + py_item = item_to_py_marshaller (state, + callable_cache, + item_arg_cache, + &item_arg, + &item_cleanup_data); + + g_ptr_array_index (item_cleanups, i) = item_cleanup_data; + if (py_item == NULL) { + Py_CLEAR (py_obj); + _PyGI_ERROR_PREFIX ("Item %u: ", i); + g_ptr_array_unref (item_cleanups); + return NULL; + } + + PyList_SET_ITEM (py_obj, i, py_item); + } + + return py_obj; +} + +static void +_pygi_marshal_cleanup_to_py_glist (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed) +{ + GPtrArray *item_cleanups = (GPtrArray *) cleanup_data; + PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; + GSList *list_ = (GSList *)data; + + if (sequence_cache->item_cache->to_py_cleanup != NULL) { + PyGIMarshalToPyCleanupFunc cleanup_func = + sequence_cache->item_cache->to_py_cleanup; + GSList *node = list_; + guint i = 0; + + while (node != NULL) { + cleanup_func (state, + sequence_cache->item_cache, + g_ptr_array_index(item_cleanups, i), + node->data, + was_processed); + node = node->next; + i++; + } + } + + if (arg_cache->transfer == GI_TRANSFER_EVERYTHING || + arg_cache->transfer == GI_TRANSFER_CONTAINER) { + + if (arg_cache->type_tag == GI_TYPE_TAG_GLIST) { + g_list_free ( (GList *)list_); + } else if (arg_cache->type_tag == GI_TYPE_TAG_GSLIST) { + g_slist_free (list_); + } else { + g_assert_not_reached(); + } + } + + g_ptr_array_unref (item_cleanups); +} + +static void +_arg_cache_from_py_glist_setup (PyGIArgCache *arg_cache, + GITransfer transfer) +{ + arg_cache->from_py_marshaller = _pygi_marshal_from_py_glist; + arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_glist; +} + +static void +_arg_cache_to_py_glist_setup (PyGIArgCache *arg_cache, + GITransfer transfer) +{ + arg_cache->to_py_marshaller = _pygi_marshal_to_py_glist; + arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_glist; +} + +static void +_arg_cache_from_py_gslist_setup (PyGIArgCache *arg_cache, + GITransfer transfer) +{ + arg_cache->from_py_marshaller = _pygi_marshal_from_py_gslist; + arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_glist; +} + +static void +_arg_cache_to_py_gslist_setup (PyGIArgCache *arg_cache, + GITransfer transfer) +{ + arg_cache->to_py_marshaller = _pygi_marshal_to_py_gslist; + arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_glist; +} + + +/* + * GList/GSList Interface + */ + +static gboolean +pygi_arg_glist_setup_from_info (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) +{ + GITypeTag type_tag = g_type_info_get_tag (type_info); + + if (!pygi_arg_sequence_setup ((PyGISequenceCache *)arg_cache, + type_info, + arg_info, + transfer, + direction, + callable_cache)) + return FALSE; + + switch (type_tag) { + case GI_TYPE_TAG_GLIST: + { + if (direction & PYGI_DIRECTION_FROM_PYTHON) + _arg_cache_from_py_glist_setup (arg_cache, transfer); + + if (direction & PYGI_DIRECTION_TO_PYTHON) + _arg_cache_to_py_glist_setup (arg_cache, transfer); + break; + } + case GI_TYPE_TAG_GSLIST: + { + if (direction & PYGI_DIRECTION_FROM_PYTHON) + _arg_cache_from_py_gslist_setup (arg_cache, transfer); + + if (direction & PYGI_DIRECTION_TO_PYTHON) + _arg_cache_to_py_gslist_setup (arg_cache, transfer); + + break; + } + default: + g_assert_not_reached (); + } + + return TRUE; +} + +PyGIArgCache * +pygi_arg_glist_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) +{ + gboolean res = FALSE; + + PyGIArgCache *arg_cache = (PyGIArgCache *) g_slice_new0 (PyGIArgGList); + if (arg_cache == NULL) + return NULL; + + res = pygi_arg_glist_setup_from_info (arg_cache, + type_info, + arg_info, + transfer, + direction, + callable_cache); + if (res) { + return arg_cache; + } else { + pygi_arg_cache_free (arg_cache); + return NULL; + } +} diff --git a/gi/pygi-list.h b/gi/pygi-list.h new file mode 100644 index 0000000..f22e024 --- /dev/null +++ b/gi/pygi-list.h @@ -0,0 +1,39 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_LIST_H__ +#define __PYGI_LIST_H__ + +#include +#include "pygi-cache.h" + +G_BEGIN_DECLS + +PyGIArgCache *pygi_arg_glist_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache); + +/* Internally dispatches GList and GSList */ +#define pygi_arg_gslist_new_from_info pygi_arg_glist_new_from_info + +G_END_DECLS + +#endif /*__PYGI_LIST_H__*/ diff --git a/gi/pygi-marshal-cleanup.c b/gi/pygi-marshal-cleanup.c index d7d1b63..98fbe47 100644 --- a/gi/pygi-marshal-cleanup.c +++ b/gi/pygi-marshal-cleanup.c @@ -14,31 +14,33 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ - - #include "pygi-marshal-cleanup.h" - #include + +#include "pygi-marshal-cleanup.h" +#include "pygi-foreign.h" +#include + static inline void _cleanup_caller_allocates (PyGIInvokeState *state, PyGIArgCache *cache, + PyObject *py_obj, gpointer data, gboolean was_processed) { PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)cache; - if (g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) { + /* check GValue first because GValue is also a boxed sub-type */ + if (g_type_is_a (iface_cache->g_type, G_TYPE_VALUE)) { + if (was_processed) + g_value_unset (data); + g_slice_free (GValue, data); + } else if (g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) { gsize size; if (was_processed) return; /* will be cleaned up at deallocation */ size = g_struct_info_get_size (iface_cache->interface_info); g_slice_free1 (size, data); - } else if (iface_cache->g_type == G_TYPE_VALUE) { - if (was_processed) - g_value_unset (data); - g_slice_free (GValue, data); } else if (iface_cache->is_foreign) { if (was_processed) return; /* will be cleaned up at deallocation */ @@ -90,24 +92,34 @@ void pygi_marshal_cleanup_args_from_py_marshal_success (PyGIInvokeState *state, PyGICallableCache *cache) { - gssize i; + guint i; + PyObject *error_type, *error_value, *error_traceback; + gboolean have_error = !!PyErr_Occurred (); - /* For in success, call cleanup for all GI_DIRECTION_IN values only. */ - for (i = 0; i < cache->n_args; i++) { - PyGIArgCache *arg_cache = cache->args_cache[i]; - PyGIMarshalCleanupFunc cleanup_func = arg_cache->from_py_cleanup; + if (have_error) + PyErr_Fetch (&error_type, &error_value, &error_traceback); - if (cleanup_func && - arg_cache->direction == PYGI_DIRECTION_FROM_PYTHON && - state->args[i]->v_pointer != NULL) - cleanup_func (state, arg_cache, state->args[i]->v_pointer, TRUE); - - if (cleanup_func && - arg_cache->direction == PYGI_DIRECTION_BIDIRECTIONAL && - state->args_data[i] != NULL) { - cleanup_func (state, arg_cache, state->args_data[i], TRUE); + for (i = 0; i < _pygi_callable_cache_args_len (cache); i++) { + PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (cache, i); + PyGIMarshalCleanupFunc cleanup_func = arg_cache->from_py_cleanup; + gpointer cleanup_data = state->args[i].arg_cleanup_data; + + /* Only cleanup using args_cleanup_data when available. + * It is the responsibility of the various "from_py" marshalers to return + * cleanup_data which is then passed into their respective cleanup function. + * PyGIInvokeState.args_cleanup_data stores this data (via _invoke_marshal_in_args) + * for the duration of the invoke up until this point. + */ + if (cleanup_func && cleanup_data != NULL && arg_cache->py_arg_index >= 0 && + arg_cache->direction & PYGI_DIRECTION_FROM_PYTHON) { + PyObject *py_arg = PyTuple_GET_ITEM (state->py_in_args, arg_cache->py_arg_index); + cleanup_func (state, arg_cache, py_arg, cleanup_data, TRUE); + state->args[i].arg_cleanup_data = NULL; } } + + if (have_error) + PyErr_Restore (error_type, error_value, error_traceback); } void @@ -115,12 +127,20 @@ pygi_marshal_cleanup_args_to_py_marshal_success (PyGIInvokeState *state, PyGICallableCache *cache) { GSList *cache_item; + guint i = 0; + PyObject *error_type, *error_value, *error_traceback; + gboolean have_error = !!PyErr_Occurred (); + + if (have_error) + PyErr_Fetch (&error_type, &error_value, &error_traceback); + /* clean up the return if available */ if (cache->return_cache != NULL) { - PyGIMarshalCleanupFunc cleanup_func = cache->return_cache->to_py_cleanup; + PyGIMarshalToPyCleanupFunc cleanup_func = cache->return_cache->to_py_cleanup; if (cleanup_func && state->return_arg.v_pointer != NULL) cleanup_func (state, cache->return_cache, + state->to_py_return_arg_cleanup_data, state->return_arg.v_pointer, TRUE); } @@ -129,23 +149,29 @@ pygi_marshal_cleanup_args_to_py_marshal_success (PyGIInvokeState *state, cache_item = cache->to_py_args; while (cache_item) { PyGIArgCache *arg_cache = (PyGIArgCache *) cache_item->data; - PyGIMarshalCleanupFunc cleanup_func = arg_cache->to_py_cleanup; - gpointer data = state->args[arg_cache->c_arg_index]->v_pointer; + PyGIMarshalToPyCleanupFunc cleanup_func = arg_cache->to_py_cleanup; + gpointer data = state->args[arg_cache->c_arg_index].arg_value.v_pointer; if (cleanup_func != NULL && data != NULL) cleanup_func (state, arg_cache, + state->args[arg_cache->c_arg_index].to_py_arg_cleanup_data, data, TRUE); else if (arg_cache->is_caller_allocates && data != NULL) { _cleanup_caller_allocates (state, arg_cache, + state->args[arg_cache->c_arg_index].to_py_arg_cleanup_data, data, TRUE); } + i++; cache_item = cache_item->next; } + + if (have_error) + PyErr_Restore (error_type, error_value, error_traceback); } void @@ -153,30 +179,46 @@ pygi_marshal_cleanup_args_from_py_parameter_fail (PyGIInvokeState *state, PyGICallableCache *cache, gssize failed_arg_index) { - gssize i; + guint i; + PyObject *error_type, *error_value, *error_traceback; + gboolean have_error = !!PyErr_Occurred (); + + if (have_error) + PyErr_Fetch (&error_type, &error_value, &error_traceback); state->failed = TRUE; - for (i = 0; i < cache->n_args && i <= failed_arg_index; i++) { - PyGIArgCache *arg_cache = cache->args_cache[i]; + for (i = 0; i < _pygi_callable_cache_args_len (cache) && i <= (guint)failed_arg_index; i++) { + PyGIArgCache *arg_cache = _pygi_callable_cache_get_arg (cache, i); PyGIMarshalCleanupFunc cleanup_func = arg_cache->from_py_cleanup; - gpointer data = state->args[i]->v_pointer; + gpointer cleanup_data = state->args[i].arg_cleanup_data; + PyObject *py_arg = NULL; - if (cleanup_func && - arg_cache->direction == PYGI_DIRECTION_FROM_PYTHON && - data != NULL) { + if (arg_cache->py_arg_index < 0) { + continue; + } + py_arg = PyTuple_GET_ITEM (state->py_in_args, arg_cache->py_arg_index); + + if (cleanup_func && cleanup_data != NULL && + arg_cache->direction == PYGI_DIRECTION_FROM_PYTHON) { cleanup_func (state, arg_cache, - data, - i < failed_arg_index); + py_arg, + cleanup_data, + i < (guint)failed_arg_index); - } else if (arg_cache->is_caller_allocates && data != NULL) { + } else if (arg_cache->is_caller_allocates && cleanup_data != NULL) { _cleanup_caller_allocates (state, arg_cache, - data, + py_arg, + cleanup_data, FALSE); } + state->args[i].arg_cleanup_data = NULL; } + + if (have_error) + PyErr_Restore (error_type, error_value, error_traceback); } void @@ -193,406 +235,3 @@ pygi_marshal_cleanup_args_to_py_parameter_fail (PyGIInvokeState *state, { state->failed = TRUE; } - -void -_pygi_marshal_cleanup_from_py_utf8 (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - /* We strdup strings so always free if we have processed this - parameter for input */ - if (was_processed) - g_free (data); -} - -void -_pygi_marshal_cleanup_to_py_utf8 (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - /* Python copies the string so we need to free it - if the interface is transfering ownership, - whether or not it has been processed yet */ - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) - g_free (data); -} - -void -_pygi_marshal_cleanup_from_py_interface_object (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - /* If we processed the parameter but fail before invoking the method, - we need to remove the ref we added */ - if (was_processed && state->failed && data != NULL && - arg_cache->transfer == GI_TRANSFER_EVERYTHING) - g_object_unref (G_OBJECT(data)); -} - -void -_pygi_marshal_cleanup_to_py_interface_object (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - /* If we error out and the object is not marshalled into a PyGObject - we must take care of removing the ref */ - if (!was_processed && arg_cache->transfer == GI_TRANSFER_EVERYTHING) - g_object_unref (G_OBJECT(data)); -} - - -void -_pygi_marshal_cleanup_from_py_interface_callback (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - PyGICallbackCache *callback_cache = (PyGICallbackCache *)arg_cache; - if (was_processed && callback_cache->scope == GI_SCOPE_TYPE_CALL) { - _pygi_invoke_closure_free (state->args_data[arg_cache->c_arg_index]); - state->args_data[arg_cache->c_arg_index] = NULL; - } -} - -void -_pygi_marshal_cleanup_from_py_interface_struct_gvalue (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - if (was_processed) { - PyObject *py_arg = PyTuple_GET_ITEM (state->py_in_args, - arg_cache->py_arg_index); - GType py_object_type = - pyg_type_from_object_strict ( (PyObject *) py_arg->ob_type, FALSE); - - if (py_object_type != G_TYPE_VALUE) { - g_value_unset ((GValue *) data); - g_slice_free (GValue, data); - } - } -} - -void -_pygi_marshal_cleanup_from_py_interface_struct_foreign (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - if (state->failed && was_processed) - pygi_struct_foreign_release ( - ( (PyGIInterfaceCache *)arg_cache)->interface_info, - data); -} - -void -_pygi_marshal_cleanup_to_py_interface_struct_foreign (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - if (!was_processed && arg_cache->transfer == GI_TRANSFER_EVERYTHING) - pygi_struct_foreign_release ( - ( (PyGIInterfaceCache *)arg_cache)->interface_info, - data); -} - -static GArray* -_wrap_c_array (PyGIInvokeState *state, - PyGISequenceCache *sequence_cache, - gpointer data) -{ - GArray *array_; - gsize len = 0; - - if (sequence_cache->fixed_size >= 0) { - len = sequence_cache->fixed_size; - } else if (sequence_cache->is_zero_terminated) { - len = g_strv_length ((gchar **)data); - } else if (sequence_cache->len_arg_index >= 0) { - GIArgument *len_arg = state->args[sequence_cache->len_arg_index]; - len = len_arg->v_long; - } - - array_ = g_array_new (FALSE, - FALSE, - sequence_cache->item_size); - - if (array_ == NULL) - return NULL; - - g_free (array_->data); - array_->data = data; - array_->len = len; - - return array_; -} - -void -_pygi_marshal_cleanup_from_py_array (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - if (was_processed) { - GArray *array_ = NULL; - GPtrArray *ptr_array_ = NULL; - PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; - - /* If this isn't a garray create one to help process variable sized - array elements */ - if (sequence_cache->array_type == GI_ARRAY_TYPE_C) { - array_ = _wrap_c_array (state, sequence_cache, data); - - if (array_ == NULL) - return; - - } else if (sequence_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) { - ptr_array_ = (GPtrArray *) data; - } else { - array_ = (GArray *) data; - } - - /* clean up items first */ - if (sequence_cache->item_cache->from_py_cleanup != NULL) { - gsize i; - guint len = (array_ != NULL) ? array_->len : ptr_array_->len; - PyGIMarshalCleanupFunc cleanup_func = - sequence_cache->item_cache->from_py_cleanup; - - for (i = 0; i < len; i++) { - gpointer item; - - /* case 1: GPtrArray */ - if (ptr_array_ != NULL) - item = g_ptr_array_index (ptr_array_, i); - /* case 2: C array or GArray with object pointers */ - else if (sequence_cache->item_cache->is_pointer) - item = g_array_index (array_, gpointer, i); - /* case 3: C array or GArray with simple types or structs */ - else { - item = array_->data + i * sequence_cache->item_size; - /* special-case hack: GValue array items do not get slice - * allocated in _pygi_marshal_from_py_array(), so we must - * not try to deallocate it as a slice and thus - * short-circuit cleanup_func. */ - if (cleanup_func == _pygi_marshal_cleanup_from_py_interface_struct_gvalue) { - g_value_unset ((GValue*) item); - continue; - } - } - - cleanup_func (state, sequence_cache->item_cache, item, TRUE); - } - } - - /* Only free the array when we didn't transfer ownership */ - if (sequence_cache->array_type == GI_ARRAY_TYPE_C) { - g_array_free (array_, arg_cache->transfer == GI_TRANSFER_NOTHING); - } else if (state->failed || - arg_cache->transfer == GI_TRANSFER_NOTHING) { - if (array_ != NULL) - g_array_free (array_, TRUE); - else - g_ptr_array_free (ptr_array_, TRUE); - } - } -} - -void -_pygi_marshal_cleanup_to_py_array (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING || - arg_cache->transfer == GI_TRANSFER_CONTAINER) { - GArray *array_ = NULL; - GPtrArray *ptr_array_ = NULL; - PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; - - /* If this isn't a garray create one to help process variable sized - array elements */ - if (sequence_cache->array_type == GI_ARRAY_TYPE_C) { - array_ = _wrap_c_array (state, sequence_cache, data); - - if (array_ == NULL) - return; - - } else if (sequence_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) { - ptr_array_ = (GPtrArray *) data; - } else { - array_ = (GArray *) data; - } - - if (sequence_cache->item_cache->to_py_cleanup != NULL) { - gsize i; - guint len = (array_ != NULL) ? array_->len : ptr_array_->len; - - PyGIMarshalCleanupFunc cleanup_func = sequence_cache->item_cache->to_py_cleanup; - for (i = 0; i < len; i++) { - cleanup_func (state, - sequence_cache->item_cache, - (array_ != NULL) ? g_array_index (array_, gpointer, i) : g_ptr_array_index (ptr_array_, i), - was_processed); - } - } - - if (array_ != NULL) - g_array_free (array_, TRUE); - else - g_ptr_array_free (ptr_array_, TRUE); - } -} - -void -_pygi_marshal_cleanup_from_py_glist (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - if (was_processed) { - GSList *list_; - PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; - - list_ = (GSList *)data; - - /* clean up items first */ - if (sequence_cache->item_cache->from_py_cleanup != NULL) { - PyGIMarshalCleanupFunc cleanup_func = - sequence_cache->item_cache->from_py_cleanup; - GSList *node = list_; - while (node != NULL) { - cleanup_func (state, - sequence_cache->item_cache, - node->data, - TRUE); - node = node->next; - } - } - - if (state->failed || - arg_cache->transfer == GI_TRANSFER_NOTHING || - arg_cache->transfer == GI_TRANSFER_CONTAINER) { - switch (arg_cache->type_tag) { - case GI_TYPE_TAG_GLIST: - g_list_free ( (GList *)list_); - break; - case GI_TYPE_TAG_GSLIST: - g_slist_free (list_); - break; - default: - g_assert_not_reached(); - } - } - } -} - -void -_pygi_marshal_cleanup_to_py_glist (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; - - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING || - arg_cache->transfer == GI_TRANSFER_CONTAINER) { - GSList *list_ = (GSList *)data; - - if (sequence_cache->item_cache->to_py_cleanup != NULL) { - PyGIMarshalCleanupFunc cleanup_func = - sequence_cache->item_cache->to_py_cleanup; - GSList *node = list_; - - while (node != NULL) { - cleanup_func (state, - sequence_cache->item_cache, - node->data, - was_processed); - node = node->next; - } - } - - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) { - switch (arg_cache->type_tag) { - case GI_TYPE_TAG_GLIST: - g_list_free ( (GList *)list_); - break; - case GI_TYPE_TAG_GSLIST: - g_slist_free (list_); - break; - default: - g_assert_not_reached(); - } - } - } -} - -void -_pygi_marshal_cleanup_from_py_ghash (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - if (data == NULL) - return; - - if (was_processed) { - GHashTable *hash_; - PyGIHashCache *hash_cache = (PyGIHashCache *)arg_cache; - - hash_ = (GHashTable *)data; - - /* clean up keys and values first */ - if (hash_cache->key_cache->from_py_cleanup != NULL || - hash_cache->value_cache->from_py_cleanup != NULL) { - GHashTableIter hiter; - gpointer key; - gpointer value; - - PyGIMarshalCleanupFunc key_cleanup_func = - hash_cache->key_cache->from_py_cleanup; - PyGIMarshalCleanupFunc value_cleanup_func = - hash_cache->value_cache->from_py_cleanup; - - g_hash_table_iter_init (&hiter, hash_); - while (g_hash_table_iter_next (&hiter, &key, &value)) { - if (key != NULL && key_cleanup_func != NULL) - key_cleanup_func (state, - hash_cache->key_cache, - key, - TRUE); - if (value != NULL && value_cleanup_func != NULL) - value_cleanup_func (state, - hash_cache->value_cache, - value, - TRUE); - } - } - - if (state->failed || - arg_cache->transfer == GI_TRANSFER_NOTHING || - arg_cache->transfer == GI_TRANSFER_CONTAINER) - g_hash_table_destroy (hash_); - - } -} - -void -_pygi_marshal_cleanup_to_py_ghash (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed) -{ - if (data == NULL) - return; - - /* assume hashtable has boxed key and value */ - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) - g_hash_table_destroy ( (GHashTable *)data); -} diff --git a/gi/pygi-marshal-cleanup.h b/gi/pygi-marshal-cleanup.h index 234e49c..18ba007 100644 --- a/gi/pygi-marshal-cleanup.h +++ b/gi/pygi-marshal-cleanup.h @@ -14,15 +14,15 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_MARSHAL_CLEANUP_H__ #define __PYGI_MARSHAL_CLEANUP_H__ -#include "pygi-private.h" +#include "pygi-struct.h" +#include "pygi-invoke-state-struct.h" +#include "pygi-cache.h" G_BEGIN_DECLS @@ -39,63 +39,6 @@ void pygi_marshal_cleanup_args_return_fail (PyGIInvokeState *state, void pygi_marshal_cleanup_args_to_py_parameter_fail (PyGIInvokeState *state, PyGICallableCache *cache, gssize failed_to_py_arg_index); - -void _pygi_marshal_cleanup_from_py_utf8 (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_to_py_utf8 (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_from_py_interface_struct_gvalue (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_from_py_interface_struct_foreign (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_to_py_interface_struct_foreign (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_from_py_interface_object (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_to_py_interface_object (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_from_py_interface_callback (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_from_py_array (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_to_py_array (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_from_py_glist (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_to_py_glist (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_from_py_ghash (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); -void _pygi_marshal_cleanup_to_py_ghash (PyGIInvokeState *state, - PyGIArgCache *arg_cache, - gpointer data, - gboolean was_processed); G_END_DECLS #endif /* __PYGI_MARSHAL_CLEANUP_H__ */ diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c deleted file mode 100644 index 57b4126..0000000 --- a/gi/pygi-marshal-from-py.c +++ /dev/null @@ -1,1870 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2011 John (J5) Palmieri , Red Hat, Inc. - * - * pygi-marshal-from-py.c: Functions to convert PyObjects to C types. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "pygi-private.h" - -#include -#include -#include -#include - -#include "pygi-cache.h" -#include "pygi-marshal-cleanup.h" -#include "pygi-marshal-from-py.h" - -#ifdef _WIN32 -#ifdef _MSC_VER -#include - -#ifndef NAN -static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff}; -#define NAN (*(const float *) __nan) -#endif - -#ifndef INFINITY -#define INFINITY HUGE_VAL -#endif - -#endif -#endif - -static gboolean -gi_argument_from_py_ssize_t (GIArgument *arg_out, - Py_ssize_t size_in, - GITypeTag type_tag) -{ - switch (type_tag) { - case GI_TYPE_TAG_VOID: - case GI_TYPE_TAG_BOOLEAN: - goto unhandled_type; - - case GI_TYPE_TAG_INT8: - if (size_in >= G_MININT8 && size_in <= G_MAXINT8) { - arg_out->v_int8 = size_in; - return TRUE; - } else { - goto overflow; - } - - case GI_TYPE_TAG_UINT8: - if (size_in >= 0 && size_in <= G_MAXUINT8) { - arg_out->v_uint8 = size_in; - return TRUE; - } else { - goto overflow; - } - - case GI_TYPE_TAG_INT16: - if (size_in >= G_MININT16 && size_in <= G_MAXINT16) { - arg_out->v_int16 = size_in; - return TRUE; - } else { - goto overflow; - } - - case GI_TYPE_TAG_UINT16: - if (size_in >= 0 && size_in <= G_MAXUINT16) { - arg_out->v_uint16 = size_in; - return TRUE; - } else { - goto overflow; - } - - /* Ranges assume two's complement */ - case GI_TYPE_TAG_INT32: - if (size_in >= G_MININT32 && size_in <= G_MAXINT32) { - arg_out->v_int32 = size_in; - return TRUE; - } else { - goto overflow; - } - - case GI_TYPE_TAG_UINT32: - if (size_in >= 0 && size_in <= G_MAXUINT32) { - arg_out->v_uint32 = size_in; - return TRUE; - } else { - goto overflow; - } - - case GI_TYPE_TAG_INT64: - arg_out->v_int64 = size_in; - return TRUE; - - case GI_TYPE_TAG_UINT64: - if (size_in >= 0) { - arg_out->v_uint64 = size_in; - return TRUE; - } else { - goto overflow; - } - - case GI_TYPE_TAG_FLOAT: - case GI_TYPE_TAG_DOUBLE: - case GI_TYPE_TAG_GTYPE: - case GI_TYPE_TAG_UTF8: - case GI_TYPE_TAG_FILENAME: - case GI_TYPE_TAG_ARRAY: - case GI_TYPE_TAG_INTERFACE: - case GI_TYPE_TAG_GLIST: - case GI_TYPE_TAG_GSLIST: - case GI_TYPE_TAG_GHASH: - case GI_TYPE_TAG_ERROR: - case GI_TYPE_TAG_UNICHAR: - default: - goto unhandled_type; - } - - overflow: - PyErr_Format (PyExc_OverflowError, - "Unable to marshal C Py_ssize_t %zd to %s", - size_in, - g_type_tag_to_string (type_tag)); - return FALSE; - - unhandled_type: - PyErr_Format (PyExc_TypeError, - "Unable to marshal C Py_ssize_t %zd to %s", - size_in, - g_type_tag_to_string (type_tag)); - return FALSE; -} - -static gboolean -gi_argument_from_c_long (GIArgument *arg_out, - long c_long_in, - GITypeTag type_tag) -{ - switch (type_tag) { - case GI_TYPE_TAG_INT8: - arg_out->v_int8 = c_long_in; - return TRUE; - case GI_TYPE_TAG_UINT8: - arg_out->v_uint8 = c_long_in; - return TRUE; - case GI_TYPE_TAG_INT16: - arg_out->v_int16 = c_long_in; - return TRUE; - case GI_TYPE_TAG_UINT16: - arg_out->v_uint16 = c_long_in; - return TRUE; - case GI_TYPE_TAG_INT32: - arg_out->v_int32 = c_long_in; - return TRUE; - case GI_TYPE_TAG_UINT32: - arg_out->v_uint32 = c_long_in; - return TRUE; - case GI_TYPE_TAG_INT64: - arg_out->v_int64 = c_long_in; - return TRUE; - case GI_TYPE_TAG_UINT64: - arg_out->v_uint64 = c_long_in; - return TRUE; - default: - PyErr_Format (PyExc_TypeError, - "Unable to marshal C long %ld to %s", - c_long_in, - g_type_tag_to_string (type_tag)); - return FALSE; - } -} - -/* - * _is_union_member - check to see if the py_arg is actually a member of the - * expected C union - */ -static gboolean -_is_union_member (GIInterfaceInfo *interface_info, PyObject *py_arg) { - gint i; - gint n_fields; - GIUnionInfo *union_info; - GIInfoType info_type; - gboolean is_member = FALSE; - - info_type = g_base_info_get_type (interface_info); - - if (info_type != GI_INFO_TYPE_UNION) - return FALSE; - - union_info = (GIUnionInfo *) interface_info; - n_fields = g_union_info_get_n_fields (union_info); - - for (i = 0; i < n_fields; i++) { - GIFieldInfo *field_info; - GITypeInfo *field_type_info; - - field_info = g_union_info_get_field (union_info, i); - field_type_info = g_field_info_get_type (field_info); - - /* we can only check if the members are interfaces */ - if (g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_INTERFACE) { - GIInterfaceInfo *field_iface_info; - PyObject *py_type; - - field_iface_info = g_type_info_get_interface (field_type_info); - py_type = _pygi_type_import_by_gi_info ((GIBaseInfo *) field_iface_info); - - if (py_type != NULL && PyObject_IsInstance (py_arg, py_type)) { - is_member = TRUE; - } - - Py_XDECREF (py_type); - g_base_info_unref ( ( GIBaseInfo *) field_iface_info); - } - - g_base_info_unref ( ( GIBaseInfo *) field_type_info); - g_base_info_unref ( ( GIBaseInfo *) field_info); - - if (is_member) - break; - } - - return is_member; -} - -gboolean -_pygi_marshal_from_py_void (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - g_warn_if_fail (arg_cache->transfer == GI_TRANSFER_NOTHING); - - if (py_arg == Py_None) { - arg->v_pointer = NULL; - } else if (PYGLIB_CPointer_Check(py_arg)) { - arg->v_pointer = PYGLIB_CPointer_GetPointer (py_arg, NULL); - } else { - /* NOTE: This will change to only allow integers and the deprecation - * warning will become a runtime exception. Using the following: - * arg->v_pointer = PyLong_AsVoidPtr (py_arg); - * See: https://bugzilla.gnome.org/show_bug.cgi?id=688081 - */ - - if (!PYGLIB_PyLong_Check(py_arg) && !PyLong_Check(py_arg)) { - if (PyErr_WarnEx(PyGIDeprecationWarning, - "Pointer arguments will be restricted to integers, capsules, and None. " - "See: https://bugzilla.gnome.org/show_bug.cgi?id=683599", - 1)) - return FALSE; - } - arg->v_pointer = py_arg; - } - - return TRUE; -} - -static gboolean -check_valid_double (double x, double min, double max) -{ - char buf[100]; - - if ((x < min || x > max) && x != INFINITY && x != -INFINITY && x != NAN) { - if (PyErr_Occurred()) - PyErr_Clear (); - - /* we need this as PyErr_Format() does not support float types */ - snprintf (buf, sizeof (buf), "%g not in range %g to %g", x, min, max); - PyErr_SetString (PyExc_OverflowError, buf); - return FALSE; - } - return TRUE; -} - -static gboolean -_pygi_py_arg_to_double (PyObject *py_arg, double *double_) -{ - PyObject *py_float; - - if (!PyNumber_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - py_float = PyNumber_Float (py_arg); - if (!py_float) - return FALSE; - - *double_ = PyFloat_AsDouble (py_float); - Py_DECREF (py_float); - - - return TRUE; -} - -static gboolean -_pygi_marshal_from_py_float (PyObject *py_arg, - GIArgument *arg) -{ - double double_; - - if (!_pygi_py_arg_to_double (py_arg, &double_)) - return FALSE; - - if (PyErr_Occurred () || !check_valid_double (double_, -G_MAXFLOAT, G_MAXFLOAT)) - return FALSE; - - arg->v_float = double_; - return TRUE; -} - -static gboolean -_pygi_marshal_from_py_double (PyObject *py_arg, - GIArgument *arg) -{ - double double_; - - if (!_pygi_py_arg_to_double (py_arg, &double_)) - return FALSE; - - if (PyErr_Occurred () || !check_valid_double (double_, -G_MAXDOUBLE, G_MAXDOUBLE)) - return FALSE; - - arg->v_double = double_; - return TRUE; -} - -static gboolean -_pygi_marshal_from_py_unichar (PyObject *py_arg, - GIArgument *arg) -{ - Py_ssize_t size; - gchar *string_; - - if (py_arg == Py_None) { - arg->v_uint32 = 0; - return FALSE; - } - - if (PyUnicode_Check (py_arg)) { - PyObject *py_bytes; - - size = PyUnicode_GET_SIZE (py_arg); - py_bytes = PyUnicode_AsUTF8String (py_arg); - if (!py_bytes) - return FALSE; - - string_ = g_strdup(PYGLIB_PyBytes_AsString (py_bytes)); - Py_DECREF (py_bytes); - -#if PY_VERSION_HEX < 0x03000000 - } else if (PyString_Check (py_arg)) { - PyObject *pyuni = PyUnicode_FromEncodedObject (py_arg, "UTF-8", "strict"); - if (!pyuni) - return FALSE; - - size = PyUnicode_GET_SIZE (pyuni); - string_ = g_strdup (PyString_AsString(py_arg)); - Py_DECREF (pyuni); -#endif - } else { - PyErr_Format (PyExc_TypeError, "Must be string, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - if (size != 1) { - PyErr_Format (PyExc_TypeError, "Must be a one character string, not %lld characters", - (long long) size); - g_free (string_); - return FALSE; - } - - arg->v_uint32 = g_utf8_get_char (string_); - g_free (string_); - - return TRUE; -} - -static gboolean -_pygi_marshal_from_py_gtype (PyObject *py_arg, - GIArgument *arg) -{ - long type_ = pyg_type_from_object (py_arg); - - if (type_ == 0) { - PyErr_Format (PyExc_TypeError, "Must be gobject.GType, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - arg->v_long = type_; - return TRUE; -} - -static gboolean -_pygi_marshal_from_py_utf8 (PyObject *py_arg, - GIArgument *arg) -{ - gchar *string_; - - if (py_arg == Py_None) { - arg->v_pointer = NULL; - return TRUE; - } - - if (PyUnicode_Check (py_arg)) { - PyObject *pystr_obj = PyUnicode_AsUTF8String (py_arg); - if (!pystr_obj) - return FALSE; - - string_ = g_strdup (PYGLIB_PyBytes_AsString (pystr_obj)); - Py_DECREF (pystr_obj); - } -#if PY_VERSION_HEX < 0x03000000 - else if (PyString_Check (py_arg)) { - string_ = g_strdup (PyString_AsString (py_arg)); - } -#endif - else { - PyErr_Format (PyExc_TypeError, "Must be string, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - arg->v_string = string_; - return TRUE; -} - -static gboolean -_pygi_marshal_from_py_filename (PyObject *py_arg, - GIArgument *arg) -{ - gchar *string_; - GError *error = NULL; - - if (PyUnicode_Check (py_arg)) { - PyObject *pystr_obj = PyUnicode_AsUTF8String (py_arg); - if (!pystr_obj) - return FALSE; - - string_ = g_strdup (PYGLIB_PyBytes_AsString (pystr_obj)); - Py_DECREF (pystr_obj); - } -#if PY_VERSION_HEX < 0x03000000 - else if (PyString_Check (py_arg)) { - string_ = g_strdup (PyString_AsString (py_arg)); - } -#endif - else { - PyErr_Format (PyExc_TypeError, "Must be string, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - arg->v_string = g_filename_from_utf8 (string_, -1, NULL, NULL, &error); - g_free (string_); - - if (arg->v_string == NULL) { - PyErr_SetString (PyExc_Exception, error->message); - g_error_free (error); - /* TODO: Convert the error to an exception. */ - return FALSE; - } - - return TRUE; -} - -static gboolean -_pygi_marshal_from_py_long (PyObject *object, /* in */ - GIArgument *arg, /* out */ - GITypeTag type_tag, - GITransfer transfer) -{ - PyObject *number; - - if (!PyNumber_Check (object)) { - PyErr_Format (PyExc_TypeError, "Must be number, not %s", - object->ob_type->tp_name); - return FALSE; - } - -#if PY_MAJOR_VERSION < 3 - { - PyObject *tmp = PyNumber_Int (object); - if (tmp) { - number = PyNumber_Long (tmp); - Py_DECREF (tmp); - } else { - number = PyNumber_Long (object); - } - } -#else - number = PyNumber_Long (object); -#endif - - if (number == NULL) { - PyErr_SetString (PyExc_TypeError, "expected int argument"); - return FALSE; - } - - switch (type_tag) { - case GI_TYPE_TAG_INT8: - { - long long_value = PyLong_AsLong (number); - if (PyErr_Occurred()) { - break; - } else if (long_value < G_MININT8 || long_value > G_MAXINT8) { - PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", - long_value, (long)G_MININT8, (long)G_MAXINT8); - } else { - arg->v_int8 = long_value; - } - break; - } - - case GI_TYPE_TAG_UINT8: - { - long long_value = PyLong_AsLong (number); - if (PyErr_Occurred()) { - break; - } else if (long_value < 0 || long_value > G_MAXUINT8) { - PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", - long_value, (long)0, (long)G_MAXUINT8); - } else { - arg->v_uint8 = long_value; - } - break; - } - - case GI_TYPE_TAG_INT16: - { - long long_value = PyLong_AsLong (number); - if (PyErr_Occurred()) { - break; - } else if (long_value < G_MININT16 || long_value > G_MAXINT16) { - PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", - long_value, (long)G_MININT16, (long)G_MAXINT16); - } else { - arg->v_int16 = long_value; - } - break; - } - - case GI_TYPE_TAG_UINT16: - { - long long_value = PyLong_AsLong (number); - if (PyErr_Occurred()) { - break; - } else if (long_value < 0 || long_value > G_MAXUINT16) { - PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", - long_value, (long)0, (long)G_MAXUINT16); - } else { - arg->v_uint16 = long_value; - } - break; - } - - case GI_TYPE_TAG_INT32: - { - long long_value = PyLong_AsLong (number); - if (PyErr_Occurred()) { - break; - } else if (long_value < G_MININT32 || long_value > G_MAXINT32) { - PyErr_Format (PyExc_OverflowError, "%ld not in range %ld to %ld", - long_value, (long)G_MININT32, (long)G_MAXINT32); - } else { - arg->v_int32 = long_value; - } - break; - } - - case GI_TYPE_TAG_UINT32: - { - PY_LONG_LONG long_value = PyLong_AsLongLong (number); - if (PyErr_Occurred()) { - break; - } else if (long_value < 0 || long_value > G_MAXUINT32) { - PyErr_Format (PyExc_OverflowError, "%lld not in range %ld to %lu", - long_value, (long)0, (unsigned long)G_MAXUINT32); - } else { - arg->v_uint32 = long_value; - } - break; - } - - case GI_TYPE_TAG_INT64: - { - /* Rely on Python overflow error and convert to ValueError for 64 bit values */ - arg->v_int64 = PyLong_AsLongLong (number); - break; - } - - case GI_TYPE_TAG_UINT64: - { - /* Rely on Python overflow error and convert to ValueError for 64 bit values */ - arg->v_uint64 = PyLong_AsUnsignedLongLong (number); - break; - } - - default: - g_assert_not_reached (); - } - - Py_DECREF (number); - - if (PyErr_Occurred()) - return FALSE; - return TRUE; -} - -gboolean -_pygi_marshal_from_py_basic_type (PyObject *object, /* in */ - GIArgument *arg, /* out */ - GITypeTag type_tag, - GITransfer transfer) -{ - switch (type_tag) { - case GI_TYPE_TAG_VOID: - g_warn_if_fail (transfer == GI_TRANSFER_NOTHING); - if (object == Py_None) { - arg->v_pointer = NULL; - } else if (!PYGLIB_PyLong_Check(object) && !PyLong_Check(object)) { - PyErr_SetString(PyExc_TypeError, - "Pointer assignment is restricted to integer values. " - "See: https://bugzilla.gnome.org/show_bug.cgi?id=683599"); - } else { - arg->v_pointer = PyLong_AsVoidPtr (object); - } - break; - case GI_TYPE_TAG_INT8: - case GI_TYPE_TAG_UINT8: - if (PYGLIB_PyBytes_Check (object)) { - if (PYGLIB_PyBytes_Size (object) != 1) { - PyErr_Format (PyExc_TypeError, "Must be a single character"); - return FALSE; - } - if (type_tag == GI_TYPE_TAG_INT8) { - arg->v_int8 = (gint8)(PYGLIB_PyBytes_AsString (object)[0]); - } else { - arg->v_uint8 = (guint8)(PYGLIB_PyBytes_AsString (object)[0]); - } - } else { - return _pygi_marshal_from_py_long (object, arg, type_tag, transfer); - } - break; - case GI_TYPE_TAG_INT16: - case GI_TYPE_TAG_UINT16: - case GI_TYPE_TAG_INT32: - case GI_TYPE_TAG_UINT32: - case GI_TYPE_TAG_INT64: - case GI_TYPE_TAG_UINT64: - return _pygi_marshal_from_py_long (object, arg, type_tag, transfer); - - case GI_TYPE_TAG_BOOLEAN: - arg->v_boolean = PyObject_IsTrue (object); - break; - - case GI_TYPE_TAG_FLOAT: - return _pygi_marshal_from_py_float (object, arg); - - case GI_TYPE_TAG_DOUBLE: - return _pygi_marshal_from_py_double (object, arg); - - case GI_TYPE_TAG_GTYPE: - return _pygi_marshal_from_py_gtype (object, arg); - - case GI_TYPE_TAG_UNICHAR: - return _pygi_marshal_from_py_unichar (object, arg); - - case GI_TYPE_TAG_UTF8: - return _pygi_marshal_from_py_utf8 (object, arg); - - case GI_TYPE_TAG_FILENAME: - return _pygi_marshal_from_py_filename (object, arg); - - default: - return FALSE; - } - - if (PyErr_Occurred()) - return FALSE; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_basic_type_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - return _pygi_marshal_from_py_basic_type (py_arg, - arg, - arg_cache->type_tag, - arg_cache->transfer); -} - -gboolean -_pygi_marshal_from_py_array (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyGIMarshalFromPyFunc from_py_marshaller; - int i = 0; - Py_ssize_t length; - gssize item_size; - gboolean is_ptr_array; - GArray *array_ = NULL; - PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; - - - if (py_arg == Py_None) { - arg->v_pointer = NULL; - return TRUE; - } - - if (!PySequence_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - length = PySequence_Length (py_arg); - if (length < 0) - return FALSE; - - if (sequence_cache->fixed_size >= 0 && - sequence_cache->fixed_size != length) { - PyErr_Format (PyExc_ValueError, "Must contain %zd items, not %zd", - sequence_cache->fixed_size, length); - - return FALSE; - } - - item_size = sequence_cache->item_size; - is_ptr_array = (sequence_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY); - if (is_ptr_array) { - array_ = (GArray *)g_ptr_array_new (); - } else { - array_ = g_array_sized_new (sequence_cache->is_zero_terminated, - FALSE, - item_size, - length); - } - - if (array_ == NULL) { - PyErr_NoMemory (); - return FALSE; - } - - if (sequence_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8 && - PYGLIB_PyBytes_Check (py_arg)) { - memcpy(array_->data, PYGLIB_PyBytes_AsString (py_arg), length); - array_->len = length; - if (sequence_cache->is_zero_terminated) { - /* If array_ has been created with zero_termination, space for the - * terminator is properly allocated, so we're not off-by-one here. */ - array_->data[length] = '\0'; - } - goto array_success; - } - - from_py_marshaller = sequence_cache->item_cache->from_py_marshaller; - for (i = 0; i < length; i++) { - GIArgument item; - PyObject *py_item = PySequence_GetItem (py_arg, i); - if (py_item == NULL) - goto err; - - if (!from_py_marshaller ( state, - callable_cache, - sequence_cache->item_cache, - py_item, - &item)) - goto err; - - /* FIXME: it is much more efficent to have seperate marshaller - * for ptr arrays than doing the evaluation - * and casting each loop iteration - */ - if (is_ptr_array) { - g_ptr_array_add((GPtrArray *)array_, item.v_pointer); - } else if (sequence_cache->item_cache->type_tag == GI_TYPE_TAG_INTERFACE) { - PyGIInterfaceCache *item_iface_cache = (PyGIInterfaceCache *) sequence_cache->item_cache; - GIBaseInfo *base_info = (GIBaseInfo *) item_iface_cache->interface_info; - GIInfoType info_type = g_base_info_get_type (base_info); - - switch (info_type) { - case GI_INFO_TYPE_UNION: - case GI_INFO_TYPE_STRUCT: - { - PyGIArgCache *item_arg_cache = (PyGIArgCache *)item_iface_cache; - PyGIMarshalCleanupFunc from_py_cleanup = item_arg_cache->from_py_cleanup; - gboolean is_boxed = g_type_is_a (item_iface_cache->g_type, G_TYPE_BOXED); - gboolean is_gvalue = item_iface_cache->g_type == G_TYPE_VALUE; - gboolean is_gvariant = item_iface_cache->g_type == G_TYPE_VARIANT; - - if (is_gvariant) { - /* Item size will always be that of a pointer, - * since GVariants are opaque hence always passed by ref */ - g_assert (item_size == sizeof (item.v_pointer)); - g_array_insert_val (array_, i, item.v_pointer); - } else if (is_gvalue) { - GValue* dest = (GValue*) (array_->data + (i * item_size)); - memset (dest, 0, item_size); - if (item.v_pointer != NULL) { - g_value_init (dest, G_VALUE_TYPE ((GValue*) item.v_pointer)); - g_value_copy ((GValue*) item.v_pointer, dest); - } - /* we free the original copy already, the new one is a plain struct - * in an array. _pygi_marshal_cleanup_from_py_array() does not free it again */ - if (from_py_cleanup) - from_py_cleanup (state, item_arg_cache, item.v_pointer, TRUE); - } else if (!is_boxed) { - /* HACK: Gdk.Atom is merely an integer wrapped in a pointer, - * so we must not dereference it; just copy the pointer - * value, and don't attempt to free it. TODO: find out - * if there are other data types with similar behaviour - * and generalize. */ - if (g_strcmp0 (item_iface_cache->type_name, "Gdk.Atom") == 0) { - g_assert (item_size == sizeof (item.v_pointer)); - memcpy (array_->data + (i * item_size), &item.v_pointer, item_size); - } else { - memcpy (array_->data + (i * item_size), item.v_pointer, item_size); - - if (from_py_cleanup) - from_py_cleanup (state, item_arg_cache, item.v_pointer, TRUE); - } - } else if (is_boxed && !item_iface_cache->arg_cache.is_pointer) { - /* The array elements are not expected to be pointers, but the - * elements obtained are boxed pointers themselves, so insert - * the pointed to data. - */ - g_array_insert_vals (array_, i, item.v_pointer, 1); - } else { - g_array_insert_val (array_, i, item); - } - break; - } - default: - g_array_insert_val (array_, i, item); - } - } else { - g_array_insert_val (array_, i, item); - } - continue; -err: - if (sequence_cache->item_cache->from_py_cleanup != NULL) { - gsize j; - PyGIMarshalCleanupFunc cleanup_func = - sequence_cache->item_cache->from_py_cleanup; - - for(j = 0; j < i; j++) { - cleanup_func (state, - sequence_cache->item_cache, - g_array_index (array_, gpointer, j), - TRUE); - } - } - - if (is_ptr_array) - g_ptr_array_free ( ( GPtrArray *)array_, TRUE); - else - g_array_free (array_, TRUE); - _PyGI_ERROR_PREFIX ("Item %i: ", i); - return FALSE; - } - -array_success: - if (sequence_cache->len_arg_index >= 0) { - /* we have an child arg to handle */ - PyGIArgCache *child_cache = - callable_cache->args_cache[sequence_cache->len_arg_index]; - - if (child_cache->direction == PYGI_DIRECTION_BIDIRECTIONAL) { - gint *len_arg = (gint *)state->in_args[child_cache->c_arg_index].v_pointer; - /* if we are not setup yet just set the in arg */ - if (len_arg == NULL) { - if (!gi_argument_from_py_ssize_t (&state->in_args[child_cache->c_arg_index], - length, - child_cache->type_tag)) { - goto err; - } - } else { - *len_arg = length; - } - } else { - if (!gi_argument_from_py_ssize_t (&state->in_args[child_cache->c_arg_index], - length, - child_cache->type_tag)) { - goto err; - } - } - } - - if (sequence_cache->array_type == GI_ARRAY_TYPE_C) { - arg->v_pointer = array_->data; - g_array_free (array_, FALSE); - /* remember the originally allocated array in args_data, as args and - * in_args get changed for (inout) arguments */ - if (arg_cache->transfer == GI_TRANSFER_NOTHING) - state->args_data[arg_cache->c_arg_index] = arg->v_pointer; - } else { - arg->v_pointer = array_; - } - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_glist (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyGIMarshalFromPyFunc from_py_marshaller; - int i; - Py_ssize_t length; - GList *list_ = NULL; - PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; - - - if (py_arg == Py_None) { - arg->v_pointer = NULL; - return TRUE; - } - - if (!PySequence_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - length = PySequence_Length (py_arg); - if (length < 0) - return FALSE; - - if (sequence_cache->fixed_size >= 0 && - sequence_cache->fixed_size != length) { - PyErr_Format (PyExc_ValueError, "Must contain %zd items, not %zd", - sequence_cache->fixed_size, length); - - return FALSE; - } - - from_py_marshaller = sequence_cache->item_cache->from_py_marshaller; - for (i = 0; i < length; i++) { - GIArgument item; - PyObject *py_item = PySequence_GetItem (py_arg, i); - if (py_item == NULL) - goto err; - - if (!from_py_marshaller ( state, - callable_cache, - sequence_cache->item_cache, - py_item, - &item)) - goto err; - - list_ = g_list_prepend (list_, _pygi_arg_to_hash_pointer (&item, sequence_cache->item_cache->type_tag)); - continue; -err: - /* FIXME: clean up list - if (sequence_cache->item_cache->from_py_cleanup != NULL) { - PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup; - } - */ - g_list_free (list_); - _PyGI_ERROR_PREFIX ("Item %i: ", i); - return FALSE; - } - - arg->v_pointer = g_list_reverse (list_); - return TRUE; -} - -gboolean -_pygi_marshal_from_py_gslist (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyGIMarshalFromPyFunc from_py_marshaller; - int i; - Py_ssize_t length; - GSList *list_ = NULL; - PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache; - - if (py_arg == Py_None) { - arg->v_pointer = NULL; - return TRUE; - } - - if (!PySequence_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - length = PySequence_Length (py_arg); - if (length < 0) - return FALSE; - - if (sequence_cache->fixed_size >= 0 && - sequence_cache->fixed_size != length) { - PyErr_Format (PyExc_ValueError, "Must contain %zd items, not %zd", - sequence_cache->fixed_size, length); - - return FALSE; - } - - from_py_marshaller = sequence_cache->item_cache->from_py_marshaller; - for (i = 0; i < length; i++) { - GIArgument item; - PyObject *py_item = PySequence_GetItem (py_arg, i); - if (py_item == NULL) - goto err; - - if (!from_py_marshaller ( state, - callable_cache, - sequence_cache->item_cache, - py_item, - &item)) - goto err; - - list_ = g_slist_prepend (list_, _pygi_arg_to_hash_pointer (&item, sequence_cache->item_cache->type_tag)); - continue; -err: - /* FIXME: Clean up list - if (sequence_cache->item_cache->from_py_cleanup != NULL) { - PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup; - } - */ - - g_slist_free (list_); - _PyGI_ERROR_PREFIX ("Item %i: ", i); - return FALSE; - } - - arg->v_pointer = g_slist_reverse (list_); - return TRUE; -} - -gboolean -_pygi_marshal_from_py_ghash (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyGIMarshalFromPyFunc key_from_py_marshaller; - PyGIMarshalFromPyFunc value_from_py_marshaller; - - int i; - Py_ssize_t length; - PyObject *py_keys, *py_values; - - GHashFunc hash_func; - GEqualFunc equal_func; - - GHashTable *hash_ = NULL; - PyGIHashCache *hash_cache = (PyGIHashCache *)arg_cache; - - if (py_arg == Py_None) { - arg->v_pointer = NULL; - return TRUE; - } - - py_keys = PyMapping_Keys (py_arg); - if (py_keys == NULL) { - PyErr_Format (PyExc_TypeError, "Must be mapping, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - length = PyMapping_Length (py_arg); - if (length < 0) { - Py_DECREF (py_keys); - return FALSE; - } - - py_values = PyMapping_Values (py_arg); - if (py_values == NULL) { - Py_DECREF (py_keys); - return FALSE; - } - - key_from_py_marshaller = hash_cache->key_cache->from_py_marshaller; - value_from_py_marshaller = hash_cache->value_cache->from_py_marshaller; - - switch (hash_cache->key_cache->type_tag) { - case GI_TYPE_TAG_UTF8: - case GI_TYPE_TAG_FILENAME: - hash_func = g_str_hash; - equal_func = g_str_equal; - break; - default: - hash_func = NULL; - equal_func = NULL; - } - - hash_ = g_hash_table_new (hash_func, equal_func); - if (hash_ == NULL) { - PyErr_NoMemory (); - Py_DECREF (py_keys); - Py_DECREF (py_values); - return FALSE; - } - - for (i = 0; i < length; i++) { - GIArgument key, value; - PyObject *py_key = PyList_GET_ITEM (py_keys, i); - PyObject *py_value = PyList_GET_ITEM (py_values, i); - if (py_key == NULL || py_value == NULL) - goto err; - - if (!key_from_py_marshaller ( state, - callable_cache, - hash_cache->key_cache, - py_key, - &key)) - goto err; - - if (!value_from_py_marshaller ( state, - callable_cache, - hash_cache->value_cache, - py_value, - &value)) - goto err; - - g_hash_table_insert (hash_, - _pygi_arg_to_hash_pointer (&key, hash_cache->key_cache->type_tag), - _pygi_arg_to_hash_pointer (&value, hash_cache->value_cache->type_tag)); - continue; -err: - /* FIXME: cleanup hash keys and values */ - Py_XDECREF (py_key); - Py_XDECREF (py_value); - Py_DECREF (py_keys); - Py_DECREF (py_values); - g_hash_table_unref (hash_); - _PyGI_ERROR_PREFIX ("Item %i: ", i); - return FALSE; - } - - arg->v_pointer = hash_; - return TRUE; -} - -gboolean -_pygi_marshal_from_py_gerror (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyErr_Format (PyExc_NotImplementedError, - "Marshalling for GErrors is not implemented"); - return FALSE; -} - -/* _pygi_destroy_notify_dummy: - * - * Dummy method used in the occasion when a method has a GDestroyNotify - * argument without user data. - */ -static void -_pygi_destroy_notify_dummy (gpointer data) { -} - -static PyGICClosure *global_destroy_notify; - -static void -_pygi_destroy_notify_callback_closure (ffi_cif *cif, - void *result, - void **args, - void *data) -{ - PyGICClosure *info = * (void**) (args[0]); - - g_assert (info); - - _pygi_invoke_closure_free (info); -} - -/* _pygi_destroy_notify_create: - * - * Method used in the occasion when a method has a GDestroyNotify - * argument with user data. - */ -static PyGICClosure* -_pygi_destroy_notify_create (void) -{ - if (!global_destroy_notify) { - - PyGICClosure *destroy_notify = g_slice_new0 (PyGICClosure); - GIBaseInfo* glib_destroy_notify; - - g_assert (destroy_notify); - - glib_destroy_notify = g_irepository_find_by_name (NULL, "GLib", "DestroyNotify"); - g_assert (glib_destroy_notify != NULL); - g_assert (g_base_info_get_type (glib_destroy_notify) == GI_INFO_TYPE_CALLBACK); - - destroy_notify->closure = g_callable_info_prepare_closure ( (GICallableInfo*) glib_destroy_notify, - &destroy_notify->cif, - _pygi_destroy_notify_callback_closure, - NULL); - - global_destroy_notify = destroy_notify; - } - - return global_destroy_notify; -} - -gboolean -_pygi_marshal_from_py_interface_callback (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - GICallableInfo *callable_info; - PyGICClosure *closure; - PyGIArgCache *user_data_cache = NULL; - PyGIArgCache *destroy_cache = NULL; - PyGICallbackCache *callback_cache; - PyObject *py_user_data = NULL; - - callback_cache = (PyGICallbackCache *)arg_cache; - - if (callback_cache->user_data_index > 0) { - user_data_cache = callable_cache->args_cache[callback_cache->user_data_index]; - if (user_data_cache->py_arg_index < state->n_py_in_args) { - /* py_user_data is a borrowed reference. */ - py_user_data = PyTuple_GetItem (state->py_in_args, user_data_cache->py_arg_index); - if (!py_user_data) - return FALSE; - } - } - - if (py_arg == Py_None && !(py_user_data == Py_None || py_user_data == NULL)) { - PyErr_Format (PyExc_TypeError, - "When passing None for a callback userdata must also be None"); - - return FALSE; - } - - if (py_arg == Py_None) { - return TRUE; - } - - if (!PyCallable_Check (py_arg)) { - PyErr_Format (PyExc_TypeError, - "Callback needs to be a function or method not %s", - py_arg->ob_type->tp_name); - - return FALSE; - } - - callable_info = (GICallableInfo *)callback_cache->interface_info; - - closure = _pygi_make_native_closure (callable_info, callback_cache->scope, py_arg, py_user_data); - arg->v_pointer = closure->closure; - - /* The PyGICClosure instance is used as user data passed into the C function. - * The return trip to python will marshal this back and pull the python user data out. - */ - if (user_data_cache != NULL) { - state->in_args[user_data_cache->c_arg_index].v_pointer = closure; - } - - /* Setup a GDestroyNotify callback if this method supports it along with - * a user data field. The user data field is a requirement in order - * free resources and ref counts associated with this arguments closure. - * In case a user data field is not available, show a warning giving - * explicit information and setup a dummy notification to avoid a crash - * later on in _pygi_destroy_notify_callback_closure. - */ - if (callback_cache->destroy_notify_index > 0) { - destroy_cache = callable_cache->args_cache[callback_cache->destroy_notify_index]; - } - - if (destroy_cache) { - if (user_data_cache != NULL) { - PyGICClosure *destroy_notify = _pygi_destroy_notify_create (); - state->in_args[destroy_cache->c_arg_index].v_pointer = destroy_notify->closure; - } else { - gchar *msg = g_strdup_printf("Callables passed to %s will leak references because " - "the method does not support a user_data argument. " - "See: https://bugzilla.gnome.org/show_bug.cgi?id=685598", - callable_cache->name); - if (PyErr_WarnEx(PyExc_RuntimeWarning, msg, 2)) { - g_free(msg); - _pygi_invoke_closure_free(closure); - return FALSE; - } - g_free(msg); - state->in_args[destroy_cache->c_arg_index].v_pointer = _pygi_destroy_notify_dummy; - } - } - - /* Store the PyGIClosure as extra args data so _pygi_marshal_cleanup_from_py_interface_callback - * can clean it up later for GI_SCOPE_TYPE_CALL based closures. - */ - state->args_data[arg_cache->c_arg_index] = closure; - - return TRUE; -} - -gboolean -_pygi_marshal_from_py_interface_enum (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - long c_long; - gint is_instance; - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - GIBaseInfo *interface = NULL; - - is_instance = PyObject_IsInstance (py_arg, iface_cache->py_type); - - py_long = PYGLIB_PyNumber_Long (py_arg); - if (py_long == NULL) { - PyErr_Clear(); - goto err; - } - - c_long = PYGLIB_PyLong_AsLong (py_long); - Py_DECREF (py_long); - - /* Write c_long into arg */ - interface = g_type_info_get_interface (arg_cache->type_info); - assert(g_base_info_get_type (interface) == GI_INFO_TYPE_ENUM); - if (!gi_argument_from_c_long(arg, - c_long, - g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { - g_assert_not_reached(); - g_base_info_unref (interface); - return FALSE; - } - - /* If this is not an instance of the Enum type that we want - * we need to check if the value is equivilant to one of the - * Enum's memebers */ - if (!is_instance) { - int i; - gboolean is_found = FALSE; - - for (i = 0; i < g_enum_info_get_n_values (iface_cache->interface_info); i++) { - GIValueInfo *value_info = - g_enum_info_get_value (iface_cache->interface_info, i); - glong enum_value = g_value_info_get_value (value_info); - g_base_info_unref ( (GIBaseInfo *)value_info); - if (c_long == enum_value) { - is_found = TRUE; - break; - } - } - - if (!is_found) - goto err; - } - - g_base_info_unref (interface); - return TRUE; - -err: - if (interface) - g_base_info_unref (interface); - PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s", - iface_cache->type_name, py_arg->ob_type->tp_name); - return FALSE; -} - -gboolean -_pygi_marshal_from_py_interface_flags (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyObject *py_long; - long c_long; - gint is_instance; - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - GIBaseInfo *interface; - - is_instance = PyObject_IsInstance (py_arg, iface_cache->py_type); - - py_long = PYGLIB_PyNumber_Long (py_arg); - if (py_long == NULL) { - PyErr_Clear (); - goto err; - } - - c_long = PYGLIB_PyLong_AsLong (py_long); - Py_DECREF (py_long); - - /* only 0 or argument of type Flag is allowed */ - if (!is_instance && c_long != 0) - goto err; - - /* Write c_long into arg */ - interface = g_type_info_get_interface (arg_cache->type_info); - g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_FLAGS); - if (!gi_argument_from_c_long(arg, c_long, - g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { - g_base_info_unref (interface); - return FALSE; - } - - g_base_info_unref (interface); - return TRUE; - -err: - PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s", - iface_cache->type_name, py_arg->ob_type->tp_name); - return FALSE; - -} - -gboolean -_pygi_marshal_from_py_interface_struct_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - - return _pygi_marshal_from_py_interface_struct (py_arg, - arg, - arg_cache->arg_name, - iface_cache->interface_info, - arg_cache->type_info, - iface_cache->g_type, - iface_cache->py_type, - arg_cache->transfer, - TRUE, /*copy_reference*/ - iface_cache->is_foreign); -} - -gboolean -_pygi_marshal_from_py_interface_boxed (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyErr_Format (PyExc_NotImplementedError, - "Marshalling for this type is not implemented yet"); - return FALSE; -} - -gboolean -_pygi_marshal_from_py_interface_object (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - if (py_arg == Py_None) { - arg->v_pointer = NULL; - return TRUE; - } - - if (!PyObject_IsInstance (py_arg, ( (PyGIInterfaceCache *)arg_cache)->py_type)) { - PyObject *module = PyObject_GetAttrString(py_arg, "__module__"); - - PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s", - arg_cache->arg_name ? arg_cache->arg_name : "self", - ( (PyGIInterfaceCache *)arg_cache)->type_name, - module ? PYGLIB_PyUnicode_AsString(module) : "", - module ? "." : "", - py_arg->ob_type->tp_name); - if (module) - Py_DECREF (module); - return FALSE; - } - - return _pygi_marshal_from_py_gobject (py_arg, arg, arg_cache->transfer); -} - -gboolean -_pygi_marshal_from_py_interface_union (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - PyErr_Format(PyExc_NotImplementedError, - "Marshalling for this type is not implemented yet"); - return FALSE; -} - -gboolean _pygi_marshal_from_py_interface_instance (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg) -{ - GIInfoType info_type; - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - - info_type = g_base_info_get_type (iface_cache->interface_info); - switch (info_type) { - case GI_INFO_TYPE_UNION: - case GI_INFO_TYPE_STRUCT: - { - GType type = iface_cache->g_type; - - if (!PyObject_IsInstance (py_arg, iface_cache->py_type)) { - /* wait, we might be a member of a union so manually check */ - if (!_is_union_member (iface_cache->interface_info, py_arg)) { - if (!PyErr_Occurred()) { - PyObject *module = PyObject_GetAttrString(py_arg, "__module__"); - PyErr_Format (PyExc_TypeError, - "argument %s: Expected a %s, but got %s%s%s", - arg_cache->arg_name ? arg_cache->arg_name : "self", - iface_cache->type_name, - module ? PYGLIB_PyUnicode_AsString(module) : "", - module ? "." : "", - py_arg->ob_type->tp_name); - if (module) - Py_DECREF (module); - } - return FALSE; - } - } - - if (g_type_is_a (type, G_TYPE_BOXED)) { - arg->v_pointer = pyg_boxed_get (py_arg, void); - } else if (g_type_is_a (type, G_TYPE_POINTER) || - g_type_is_a (type, G_TYPE_VARIANT) || - type == G_TYPE_NONE) { - arg->v_pointer = pyg_pointer_get (py_arg, void); - } else { - PyErr_Format (PyExc_TypeError, "unable to convert an instance of '%s'", g_type_name (type)); - return FALSE; - } - - break; - } - case GI_INFO_TYPE_OBJECT: - case GI_INFO_TYPE_INTERFACE: - arg->v_pointer = pygobject_get (py_arg); - if (arg->v_pointer != NULL) { - GType obj_type = G_OBJECT_TYPE (( GObject *)arg->v_pointer); - GType expected_type = iface_cache->g_type; - - if (!g_type_is_a (obj_type, expected_type)) { - PyObject *module = PyObject_GetAttrString(py_arg, "__module__"); - PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s", - arg_cache->arg_name ? arg_cache->arg_name : "self", - iface_cache->type_name, - module ? PYGLIB_PyUnicode_AsString(module) : "", - module ? "." : "", - py_arg->ob_type->tp_name); - if (module) - Py_DECREF (module); - return FALSE; - } - } - break; - default: - /* Other types don't have methods. */ - g_assert_not_reached (); - } - - return TRUE; -} - -/* _pygi_marshal_from_py_gobject: - * py_arg: (in): - * arg: (out): - */ -gboolean -_pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ - GIArgument *arg, /*out*/ - GITransfer transfer) { - GObject *gobj; - - if (py_arg == Py_None) { - arg->v_pointer = NULL; - return TRUE; - } - - if (!pygobject_check (py_arg, &PyGObject_Type)) { - PyObject *repr = PyObject_Repr (py_arg); - PyErr_Format(PyExc_TypeError, "expected GObject but got %s", - PYGLIB_PyUnicode_AsString (repr)); - Py_DECREF (repr); - return FALSE; - } - - gobj = pygobject_get (py_arg); - if (transfer == GI_TRANSFER_EVERYTHING) { - /* For transfer everything, add a new ref that the callee will take ownership of. - * Pythons existing ref to the GObject will be managed with the PyGObject wrapper. - */ - g_object_ref (gobj); - } - - arg->v_pointer = gobj; - return TRUE; -} - -/* _pygi_marshal_from_py_gobject_out_arg: - * py_arg: (in): - * arg: (out): - * - * A specialization for marshaling Python GObjects used for out/return values - * from a Python implemented vfuncs, signals, or an assignment to a GObject property. - */ -gboolean -_pygi_marshal_from_py_gobject_out_arg (PyObject *py_arg, /*in*/ - GIArgument *arg, /*out*/ - GITransfer transfer) { - GObject *gobj; - if (!_pygi_marshal_from_py_gobject (py_arg, arg, transfer)) { - return FALSE; - } - - /* HACK: At this point the basic marshaling of the GObject was successful - * but we add some special case hacks for vfunc returns due to buggy APIs: - * https://bugzilla.gnome.org/show_bug.cgi?id=693393 - */ - gobj = arg->v_pointer; - if (py_arg->ob_refcnt == 1 && gobj->ref_count == 1) { - /* If both object ref counts are only 1 at this point (the reference held - * in a return tuple), we assume the GObject will be free'd before reaching - * its target and become invalid. So instead of getting invalid object errors - * we add a new GObject ref. - */ - g_object_ref (gobj); - - if (((PyGObject *)py_arg)->private_flags.flags & PYGOBJECT_GOBJECT_WAS_FLOATING) { - /* - * We want to re-float instances that were floating and the Python - * wrapper assumed ownership. With the additional caveat that there - * are not any strong references beyond the return tuple. - */ - g_object_force_floating (gobj); - - } else { - PyObject *repr = PyObject_Repr (py_arg); - gchar *msg = g_strdup_printf ("Expecting to marshal a borrowed reference for %s, " - "but nothing in Python is holding a reference to this object. " - "See: https://bugzilla.gnome.org/show_bug.cgi?id=687522", - PYGLIB_PyUnicode_AsString(repr)); - Py_DECREF (repr); - if (PyErr_WarnEx (PyExc_RuntimeWarning, msg, 2)) { - g_free (msg); - return FALSE; - } - g_free (msg); - } - } - - return TRUE; -} - -/* _pygi_marshal_from_py_gvalue: - * py_arg: (in): - * arg: (out): - * transfer: - * copy_reference: TRUE if arg should use the pointer reference held by py_arg - * when it is already holding a GValue vs. copying the value. - */ -gboolean -_pygi_marshal_from_py_gvalue (PyObject *py_arg, - GIArgument *arg, - GITransfer transfer, - gboolean copy_reference) { - GValue *value; - GType object_type; - - object_type = pyg_type_from_object_strict ( (PyObject *) py_arg->ob_type, FALSE); - if (object_type == G_TYPE_INVALID) { - PyErr_SetString (PyExc_RuntimeError, "unable to retrieve object's GType"); - return FALSE; - } - - /* if already a gvalue, use that, else marshal into gvalue */ - if (object_type == G_TYPE_VALUE) { - GValue *source_value = pyg_boxed_get (py_arg, GValue); - if (copy_reference) { - value = source_value; - } else { - value = g_slice_new0 (GValue); - g_value_init (value, G_VALUE_TYPE (source_value)); - g_value_copy (source_value, value); - } - } else { - value = g_slice_new0 (GValue); - g_value_init (value, object_type); - if (pyg_value_from_pyobject (value, py_arg) < 0) { - g_slice_free (GValue, value); - PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GValue failed"); - return FALSE; - } - } - - arg->v_pointer = value; - return TRUE; -} - -/* _pygi_marshal_from_py_gclosure: - * py_arg: (in): - * arg: (out): - */ -gboolean -_pygi_marshal_from_py_gclosure(PyObject *py_arg, - GIArgument *arg) -{ - GClosure *closure; - GType object_gtype = pyg_type_from_object_strict (py_arg, FALSE); - - if ( !(PyCallable_Check(py_arg) || - g_type_is_a (object_gtype, G_TYPE_CLOSURE))) { - PyErr_Format (PyExc_TypeError, "Must be callable, not %s", - py_arg->ob_type->tp_name); - return FALSE; - } - - if (g_type_is_a (object_gtype, G_TYPE_CLOSURE)) - closure = (GClosure *)pyg_boxed_get (py_arg, void); - else - closure = pyg_closure_new (py_arg, NULL, NULL); - - if (closure == NULL) { - PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed"); - return FALSE; - } - - arg->v_pointer = closure; - return TRUE; -} - -gboolean -_pygi_marshal_from_py_interface_struct (PyObject *py_arg, - GIArgument *arg, - const gchar *arg_name, - GIBaseInfo *interface_info, - GITypeInfo *type_info, - GType g_type, - PyObject *py_type, - GITransfer transfer, - gboolean copy_reference, - gboolean is_foreign) -{ - gboolean is_union = FALSE; - - if (py_arg == Py_None) { - arg->v_pointer = NULL; - return TRUE; - } - - /* FIXME: handle this large if statement in the cache - * and set the correct marshaller - */ - - if (g_type_is_a (g_type, G_TYPE_CLOSURE)) { - return _pygi_marshal_from_py_gclosure (py_arg, arg); - } else if (g_type_is_a (g_type, G_TYPE_VALUE)) { - return _pygi_marshal_from_py_gvalue(py_arg, - arg, - transfer, - copy_reference); - } else if (is_foreign) { - PyObject *success; - success = pygi_struct_foreign_convert_to_g_argument (py_arg, - interface_info, - transfer, - arg); - - return (success == Py_None); - } else if (!PyObject_IsInstance (py_arg, py_type)) { - /* first check to see if this is a member of the expected union */ - is_union = _is_union_member (interface_info, py_arg); - if (!is_union) { - goto type_error; - } - } - - if (g_type_is_a (g_type, G_TYPE_BOXED)) { - /* Additionally use pyg_type_from_object to pull the stashed __gtype__ - * attribute off of the input argument for type checking. This is needed - * to work around type discrepancies in cases with aliased (typedef) types. - * e.g. GtkAllocation, GdkRectangle. - * See: https://bugzilla.gnomethere are .org/show_bug.cgi?id=707140 - */ - if (is_union || pyg_boxed_check (py_arg, g_type) || - g_type_is_a (pyg_type_from_object (py_arg), g_type)) { - arg->v_pointer = pyg_boxed_get (py_arg, void); - if (transfer == GI_TRANSFER_EVERYTHING) { - arg->v_pointer = g_boxed_copy (g_type, arg->v_pointer); - } - } else { - goto type_error; - } - - } else if (g_type_is_a (g_type, G_TYPE_POINTER) || - g_type_is_a (g_type, G_TYPE_VARIANT) || - g_type == G_TYPE_NONE) { - g_warn_if_fail (g_type_is_a (g_type, G_TYPE_VARIANT) || !g_type_info_is_pointer (type_info) || transfer == GI_TRANSFER_NOTHING); - - if (g_type_is_a (g_type, G_TYPE_VARIANT) && - pyg_type_from_object (py_arg) != G_TYPE_VARIANT) { - PyErr_SetString (PyExc_TypeError, "expected GLib.Variant"); - return FALSE; - } - arg->v_pointer = pyg_pointer_get (py_arg, void); - - } else { - PyErr_Format (PyExc_NotImplementedError, - "structure type '%s' is not supported yet", - g_type_name(g_type)); - return FALSE; - } - return TRUE; - -type_error: - { - gchar *type_name = _pygi_g_base_info_get_fullname (interface_info); - PyObject *module = PyObject_GetAttrString(py_arg, "__module__"); - - PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s", - arg_name ? arg_name : "self", - type_name, - module ? PYGLIB_PyUnicode_AsString(module) : "", - module ? "." : "", - py_arg->ob_type->tp_name); - if (module) - Py_DECREF (module); - g_free (type_name); - return FALSE; - } -} diff --git a/gi/pygi-marshal-from-py.h b/gi/pygi-marshal-from-py.h deleted file mode 100644 index 9f56a6f..0000000 --- a/gi/pygi-marshal-from-py.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2011 John (J5) Palmieri , Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGI_MARSHAL_from_py_PY_H__ -#define __PYGI_MARSHAL_from_py_PY_H__ - -#include - -#include - -#include "pygi-private.h" - -G_BEGIN_DECLS - -gboolean _pygi_marshal_from_py_ssize_t (PyGIArgCache *arg_cache, - Py_ssize_t size, - GIArgument *arg); -gboolean _pygi_marshal_from_py_void (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_array (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_glist (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_gslist (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_ghash (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_gerror (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_callback (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_enum (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_flags (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_struct_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_interface(PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_boxed (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_object (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_union (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); -gboolean _pygi_marshal_from_py_interface_instance (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); - -/* Simplified marshalers shared between vfunc/closure and direct function calls. */ -gboolean _pygi_marshal_from_py_basic_type (PyObject *object, /* in */ - GIArgument *arg, /* out */ - GITypeTag type_tag, - GITransfer transfer); -gboolean _pygi_marshal_from_py_basic_type_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - PyObject *py_arg, - GIArgument *arg); - -gboolean _pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ - GIArgument *arg, /*out*/ - GITransfer transfer); -gboolean _pygi_marshal_from_py_gobject_out_arg (PyObject *py_arg, /*in*/ - GIArgument *arg, /*out*/ - GITransfer transfer); - -gboolean _pygi_marshal_from_py_gvalue (PyObject *py_arg, /*in*/ - GIArgument *arg, /*out*/ - GITransfer transfer, - gboolean is_allocated); - -gboolean _pygi_marshal_from_py_gclosure(PyObject *py_arg, /*in*/ - GIArgument *arg); /*out*/ - -gboolean _pygi_marshal_from_py_interface_struct (PyObject *py_arg, - GIArgument *arg, - const gchar *arg_name, - GIBaseInfo *interface_info, - GITypeInfo *type_info, - GType g_type, - PyObject *py_type, - GITransfer transfer, - gboolean is_allocated, - gboolean is_foreign); - -G_END_DECLS - -#endif /* __PYGI_MARSHAL_from_py_PY__ */ diff --git a/gi/pygi-marshal-to-py.c b/gi/pygi-marshal-to-py.c deleted file mode 100644 index 7c260f7..0000000 --- a/gi/pygi-marshal-to-py.c +++ /dev/null @@ -1,891 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2011 John (J5) Palmieri , Red Hat, Inc. - * - * pygi-marshal-from-py.c: functions for converting C types to PyObject - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#include "pygi-private.h" - -#include -#include - -#include -#include -#include - -#include "pygi-cache.h" -#include "pygi-marshal-cleanup.h" -#include "pygi-marshal-to-py.h" -#include "pygi-argument.h" - -static gboolean -gi_argument_to_c_long (GIArgument *arg_in, - long *c_long_out, - GITypeTag type_tag) -{ - switch (type_tag) { - case GI_TYPE_TAG_INT8: - *c_long_out = arg_in->v_int8; - return TRUE; - case GI_TYPE_TAG_UINT8: - *c_long_out = arg_in->v_uint8; - return TRUE; - case GI_TYPE_TAG_INT16: - *c_long_out = arg_in->v_int16; - return TRUE; - case GI_TYPE_TAG_UINT16: - *c_long_out = arg_in->v_uint16; - return TRUE; - case GI_TYPE_TAG_INT32: - *c_long_out = arg_in->v_int32; - return TRUE; - case GI_TYPE_TAG_UINT32: - *c_long_out = arg_in->v_uint32; - return TRUE; - case GI_TYPE_TAG_INT64: - *c_long_out = arg_in->v_int64; - return TRUE; - case GI_TYPE_TAG_UINT64: - *c_long_out = arg_in->v_uint64; - return TRUE; - default: - PyErr_Format (PyExc_TypeError, - "Unable to marshal %s to C long", - g_type_tag_to_string (type_tag)); - return FALSE; - } -} - -static gboolean -gi_argument_to_gsize (GIArgument *arg_in, - gsize *gsize_out, - GITypeTag type_tag) -{ - switch (type_tag) { - case GI_TYPE_TAG_INT8: - *gsize_out = arg_in->v_int8; - return TRUE; - case GI_TYPE_TAG_UINT8: - *gsize_out = arg_in->v_uint8; - return TRUE; - case GI_TYPE_TAG_INT16: - *gsize_out = arg_in->v_int16; - return TRUE; - case GI_TYPE_TAG_UINT16: - *gsize_out = arg_in->v_uint16; - return TRUE; - case GI_TYPE_TAG_INT32: - *gsize_out = arg_in->v_int32; - return TRUE; - case GI_TYPE_TAG_UINT32: - *gsize_out = arg_in->v_uint32; - return TRUE; - case GI_TYPE_TAG_INT64: - *gsize_out = arg_in->v_int64; - return TRUE; - case GI_TYPE_TAG_UINT64: - *gsize_out = arg_in->v_uint64; - return TRUE; - default: - PyErr_Format (PyExc_TypeError, - "Unable to marshal %s to gsize", - g_type_tag_to_string (type_tag)); - return FALSE; - } -} - -PyObject * -_pygi_marshal_to_py_void (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = NULL; - if (arg_cache->is_pointer) { - /* NOTE: This will change to interpret pointers as integer values - * by using the following: - * py_obj = PyLong_FromVoidPtr (arg->v_pointer); - * See: https://bugzilla.gnome.org/show_bug.cgi?id=688081 - */ - py_obj = arg->v_pointer; - } else { - py_obj = Py_None; - } - - Py_XINCREF (py_obj); - return py_obj; -} - -static PyObject * -_pygi_marshal_to_py_unichar (GIArgument *arg) -{ - PyObject *py_obj = NULL; - - /* Preserve the bidirectional mapping between 0 and "" */ - if (arg->v_uint32 == 0) { - py_obj = PYGLIB_PyUnicode_FromString (""); - } else if (g_unichar_validate (arg->v_uint32)) { - gchar utf8[6]; - gint bytes; - - bytes = g_unichar_to_utf8 (arg->v_uint32, utf8); - py_obj = PYGLIB_PyUnicode_FromStringAndSize ((char*)utf8, bytes); - } else { - /* TODO: Convert the error to an exception. */ - PyErr_Format (PyExc_TypeError, - "Invalid unicode codepoint %" G_GUINT32_FORMAT, - arg->v_uint32); - } - - return py_obj; -} - -static PyObject * -_pygi_marshal_to_py_utf8 (GIArgument *arg) -{ - PyObject *py_obj = NULL; - if (arg->v_string == NULL) { - Py_RETURN_NONE; - } - - py_obj = PYGLIB_PyUnicode_FromString (arg->v_string); - return py_obj; -} - -static PyObject * -_pygi_marshal_to_py_filename (GIArgument *arg) -{ - gchar *string = NULL; - PyObject *py_obj = NULL; - GError *error = NULL; - - if (arg->v_string == NULL) { - Py_RETURN_NONE; - } - - string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error); - if (string == NULL) { - PyErr_SetString (PyExc_Exception, error->message); - /* TODO: Convert the error to an exception. */ - return NULL; - } - - py_obj = PYGLIB_PyUnicode_FromString (string); - g_free (string); - - return py_obj; -} - - -/** - * _pygi_marshal_to_py_basic_type: - * @arg: The argument to convert to an object. - * @type_tag: Type tag for @arg - * @transfer: Transfer annotation - * - * Convert the given argument to a Python object. This function - * is restricted to simple types that only require the GITypeTag - * and GITransfer. For a more complete conversion routine, use: - * _pygi_argument_to_object. - * - * Returns: A PyObject representing @arg or NULL if it cannot convert - * the argument. - */ -PyObject * -_pygi_marshal_to_py_basic_type (GIArgument *arg, - GITypeTag type_tag, - GITransfer transfer) -{ - switch (type_tag) { - case GI_TYPE_TAG_BOOLEAN: - return PyBool_FromLong (arg->v_boolean); - - case GI_TYPE_TAG_INT8: - return PYGLIB_PyLong_FromLong (arg->v_int8); - - case GI_TYPE_TAG_UINT8: - return PYGLIB_PyLong_FromLong (arg->v_uint8); - - case GI_TYPE_TAG_INT16: - return PYGLIB_PyLong_FromLong (arg->v_int16); - - case GI_TYPE_TAG_UINT16: - return PYGLIB_PyLong_FromLong (arg->v_uint16); - - case GI_TYPE_TAG_INT32: - return PYGLIB_PyLong_FromLong (arg->v_int32); - - case GI_TYPE_TAG_UINT32: - return PyLong_FromLongLong (arg->v_uint32); - - case GI_TYPE_TAG_INT64: - return PyLong_FromLongLong (arg->v_int64); - - case GI_TYPE_TAG_UINT64: - return PyLong_FromUnsignedLongLong (arg->v_uint64); - - case GI_TYPE_TAG_FLOAT: - return PyFloat_FromDouble (arg->v_float); - - case GI_TYPE_TAG_DOUBLE: - return PyFloat_FromDouble (arg->v_double); - - case GI_TYPE_TAG_GTYPE: - return pyg_type_wrapper_new ( (GType) arg->v_long); - - case GI_TYPE_TAG_UNICHAR: - return _pygi_marshal_to_py_unichar (arg); - - case GI_TYPE_TAG_UTF8: - return _pygi_marshal_to_py_utf8 (arg); - - case GI_TYPE_TAG_FILENAME: - return _pygi_marshal_to_py_filename (arg); - - default: - return NULL; - } - return NULL; -} - -PyObject * -_pygi_marshal_to_py_basic_type_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - return _pygi_marshal_to_py_basic_type (arg, - arg_cache->type_tag, - arg_cache->transfer); -} - -PyObject * -_pygi_marshal_to_py_array (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - GArray *array_; - PyObject *py_obj = NULL; - PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; - gsize processed_items = 0; - - /* GArrays make it easier to iterate over arrays - * with different element sizes but requires that - * we allocate a GArray if the argument was a C array - */ - if (seq_cache->array_type == GI_ARRAY_TYPE_C) { - gsize len; - if (seq_cache->fixed_size >= 0) { - g_assert(arg->v_pointer != NULL); - len = seq_cache->fixed_size; - } else if (seq_cache->is_zero_terminated) { - if (arg->v_pointer == NULL) { - len = 0; - } else if (seq_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8) { - len = strlen (arg->v_pointer); - } else { - len = g_strv_length ((gchar **)arg->v_pointer); - } - } else { - GIArgument *len_arg = state->args[seq_cache->len_arg_index]; - - if (!gi_argument_to_gsize (len_arg, - &len, - callable_cache->args_cache[seq_cache->len_arg_index]->type_tag)) { - return NULL; - } - } - - array_ = g_array_new (FALSE, - FALSE, - seq_cache->item_size); - if (array_ == NULL) { - PyErr_NoMemory (); - - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING && arg->v_pointer != NULL) - g_free (arg->v_pointer); - - return NULL; - } - - if (array_->data != NULL) - g_free (array_->data); - array_->data = arg->v_pointer; - array_->len = len; - } else { - array_ = arg->v_pointer; - } - - if (seq_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8) { - if (arg->v_pointer == NULL) { - py_obj = PYGLIB_PyBytes_FromString (""); - } else { - py_obj = PYGLIB_PyBytes_FromStringAndSize (array_->data, array_->len); - } - } else { - if (arg->v_pointer == NULL) { - py_obj = PyList_New (0); - } else { - int i; - - gsize item_size; - PyGIMarshalToPyFunc item_to_py_marshaller; - PyGIArgCache *item_arg_cache; - - py_obj = PyList_New (array_->len); - if (py_obj == NULL) - goto err; - - - item_arg_cache = seq_cache->item_cache; - item_to_py_marshaller = item_arg_cache->to_py_marshaller; - - item_size = g_array_get_element_size (array_); - - for (i = 0; i < array_->len; i++) { - GIArgument item_arg; - PyObject *py_item; - - if (seq_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) { - item_arg.v_pointer = g_ptr_array_index ( ( GPtrArray *)array_, i); - } else if (item_arg_cache->type_tag == GI_TYPE_TAG_INTERFACE) { - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *) item_arg_cache; - gboolean is_gvariant = iface_cache->g_type == G_TYPE_VARIANT; - - // FIXME: This probably doesn't work with boxed types or gvalues. See fx. _pygi_marshal_from_py_array() - switch (g_base_info_get_type (iface_cache->interface_info)) { - case GI_INFO_TYPE_STRUCT: - if (is_gvariant) { - g_assert (item_size == sizeof (gpointer)); - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) - item_arg.v_pointer = g_variant_ref_sink (g_array_index (array_, gpointer, i)); - else - item_arg.v_pointer = g_array_index (array_, gpointer, i); - } else if (arg_cache->transfer == GI_TRANSFER_EVERYTHING && !item_arg_cache->is_pointer && - !g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) { - /* array elements are structs */ - gpointer *_struct = g_malloc (item_size); - memcpy (_struct, array_->data + i * item_size, - item_size); - item_arg.v_pointer = _struct; - } else if (item_arg_cache->is_pointer) - /* array elements are pointers to values */ - item_arg.v_pointer = g_array_index (array_, gpointer, i); - else - item_arg.v_pointer = array_->data + i * item_size; - break; - default: - item_arg.v_pointer = g_array_index (array_, gpointer, i); - break; - } - } else { - memcpy (&item_arg, array_->data + i * item_size, item_size); - } - - py_item = item_to_py_marshaller ( state, - callable_cache, - item_arg_cache, - &item_arg); - - if (py_item == NULL) { - Py_CLEAR (py_obj); - - if (seq_cache->array_type == GI_ARRAY_TYPE_C) - g_array_unref (array_); - - goto err; - } - PyList_SET_ITEM (py_obj, i, py_item); - processed_items++; - } - } - } - - if (seq_cache->array_type == GI_ARRAY_TYPE_C) - g_array_free (array_, FALSE); - - return py_obj; - -err: - if (seq_cache->array_type == GI_ARRAY_TYPE_C) { - g_array_free (array_, arg_cache->transfer == GI_TRANSFER_EVERYTHING); - } else { - /* clean up unprocessed items */ - if (seq_cache->item_cache->to_py_cleanup != NULL) { - int j; - PyGIMarshalCleanupFunc cleanup_func = seq_cache->item_cache->to_py_cleanup; - for (j = processed_items; j < array_->len; j++) { - cleanup_func (state, - seq_cache->item_cache, - g_array_index (array_, gpointer, j), - FALSE); - } - } - - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) - g_array_free (array_, TRUE); - } - - return NULL; -} - -PyObject * -_pygi_marshal_to_py_glist (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - GList *list_; - gsize length; - gsize i; - - PyGIMarshalToPyFunc item_to_py_marshaller; - PyGIArgCache *item_arg_cache; - PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; - - PyObject *py_obj = NULL; - - list_ = arg->v_pointer; - length = g_list_length (list_); - - py_obj = PyList_New (length); - if (py_obj == NULL) - return NULL; - - item_arg_cache = seq_cache->item_cache; - item_to_py_marshaller = item_arg_cache->to_py_marshaller; - - for (i = 0; list_ != NULL; list_ = g_list_next (list_), i++) { - GIArgument item_arg; - PyObject *py_item; - - item_arg.v_pointer = list_->data; - _pygi_hash_pointer_to_arg (&item_arg, item_arg_cache->type_tag); - py_item = item_to_py_marshaller (state, - callable_cache, - item_arg_cache, - &item_arg); - - if (py_item == NULL) { - Py_CLEAR (py_obj); - _PyGI_ERROR_PREFIX ("Item %zu: ", i); - return NULL; - } - - PyList_SET_ITEM (py_obj, i, py_item); - } - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_gslist (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - GSList *list_; - gsize length; - gsize i; - - PyGIMarshalToPyFunc item_to_py_marshaller; - PyGIArgCache *item_arg_cache; - PyGISequenceCache *seq_cache = (PyGISequenceCache *)arg_cache; - - PyObject *py_obj = NULL; - - list_ = arg->v_pointer; - length = g_slist_length (list_); - - py_obj = PyList_New (length); - if (py_obj == NULL) - return NULL; - - item_arg_cache = seq_cache->item_cache; - item_to_py_marshaller = item_arg_cache->to_py_marshaller; - - for (i = 0; list_ != NULL; list_ = g_slist_next (list_), i++) { - GIArgument item_arg; - PyObject *py_item; - - item_arg.v_pointer = list_->data; - _pygi_hash_pointer_to_arg (&item_arg, item_arg_cache->type_tag); - py_item = item_to_py_marshaller (state, - callable_cache, - item_arg_cache, - &item_arg); - - if (py_item == NULL) { - Py_CLEAR (py_obj); - _PyGI_ERROR_PREFIX ("Item %zu: ", i); - return NULL; - } - - PyList_SET_ITEM (py_obj, i, py_item); - } - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_ghash (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - GHashTable *hash_; - GHashTableIter hash_table_iter; - - PyGIMarshalToPyFunc key_to_py_marshaller; - PyGIMarshalToPyFunc value_to_py_marshaller; - - PyGIArgCache *key_arg_cache; - PyGIArgCache *value_arg_cache; - PyGIHashCache *hash_cache = (PyGIHashCache *)arg_cache; - - GIArgument key_arg; - GIArgument value_arg; - - PyObject *py_obj = NULL; - - hash_ = arg->v_pointer; - - if (hash_ == NULL) { - py_obj = Py_None; - Py_INCREF (py_obj); - return py_obj; - } - - py_obj = PyDict_New (); - if (py_obj == NULL) - return NULL; - - key_arg_cache = hash_cache->key_cache; - key_to_py_marshaller = key_arg_cache->to_py_marshaller; - - value_arg_cache = hash_cache->value_cache; - value_to_py_marshaller = value_arg_cache->to_py_marshaller; - - g_hash_table_iter_init (&hash_table_iter, hash_); - while (g_hash_table_iter_next (&hash_table_iter, - &key_arg.v_pointer, - &value_arg.v_pointer)) { - PyObject *py_key; - PyObject *py_value; - int retval; - - - _pygi_hash_pointer_to_arg (&key_arg, hash_cache->key_cache->type_tag); - py_key = key_to_py_marshaller ( state, - callable_cache, - key_arg_cache, - &key_arg); - - if (py_key == NULL) { - Py_CLEAR (py_obj); - return NULL; - } - - _pygi_hash_pointer_to_arg (&value_arg, hash_cache->value_cache->type_tag); - py_value = value_to_py_marshaller ( state, - callable_cache, - value_arg_cache, - &value_arg); - - if (py_value == NULL) { - Py_CLEAR (py_obj); - Py_DECREF(py_key); - return NULL; - } - - retval = PyDict_SetItem (py_obj, py_key, py_value); - - Py_DECREF (py_key); - Py_DECREF (py_value); - - if (retval < 0) { - Py_CLEAR (py_obj); - return NULL; - } - } - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_gerror (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - GError *error = arg->v_pointer; - PyObject *py_obj = NULL; - - py_obj = pyglib_error_marshal(&error); - - if (arg_cache->transfer == GI_TRANSFER_EVERYTHING && error != NULL) { - g_error_free (error); - } - - if (py_obj != NULL) { - return py_obj; - } else { - Py_RETURN_NONE; - } -} - -PyObject * -_pygi_marshal_to_py_interface_callback (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = NULL; - - PyErr_Format (PyExc_NotImplementedError, - "Marshalling a callback to PyObject is not supported"); - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_interface_enum (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = NULL; - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - GIBaseInfo *interface; - long c_long; - - interface = g_type_info_get_interface (arg_cache->type_info); - g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_ENUM); - - if (!gi_argument_to_c_long(arg, &c_long, - g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { - return NULL; - } - - if (iface_cache->g_type == G_TYPE_NONE) { - py_obj = PyObject_CallFunction (iface_cache->py_type, "l", c_long); - } else { - py_obj = pyg_enum_from_gtype (iface_cache->g_type, c_long); - } - g_base_info_unref (interface); - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_interface_flags (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = NULL; - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - GIBaseInfo *interface; - long c_long; - - interface = g_type_info_get_interface (arg_cache->type_info); - g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_FLAGS); - - if (!gi_argument_to_c_long(arg, &c_long, - g_enum_info_get_storage_type ((GIEnumInfo *)interface))) { - g_base_info_unref (interface); - return NULL; - } - - g_base_info_unref (interface); - if (iface_cache->g_type == G_TYPE_NONE) { - /* An enum with a GType of None is an enum without GType */ - - PyObject *py_type = _pygi_type_import_by_gi_info (iface_cache->interface_info); - PyObject *py_args = NULL; - - if (!py_type) - return NULL; - - py_args = PyTuple_New (1); - if (PyTuple_SetItem (py_args, 0, PyLong_FromLong (c_long)) != 0) { - Py_DECREF (py_args); - Py_DECREF (py_type); - return NULL; - } - - py_obj = PyObject_CallFunction (py_type, "l", c_long); - - Py_DECREF (py_args); - Py_DECREF (py_type); - } else { - py_obj = pyg_flags_from_gtype (iface_cache->g_type, c_long); - } - - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_interface_struct_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; - - return _pygi_marshal_to_py_interface_struct (arg, - iface_cache->interface_info, - iface_cache->g_type, - iface_cache->py_type, - arg_cache->transfer, - arg_cache->is_caller_allocates, - iface_cache->is_foreign); -} - -PyObject * -_pygi_marshal_to_py_interface_interface (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = NULL; - - PyErr_Format (PyExc_NotImplementedError, - "Marshalling for this type is not implemented yet"); - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_interface_boxed (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = NULL; - - PyErr_Format (PyExc_NotImplementedError, - "Marshalling for this type is not implemented yet"); - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_interface_object_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - return _pygi_marshal_to_py_object(arg, arg_cache->transfer); -} - -PyObject * -_pygi_marshal_to_py_interface_union (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg) -{ - PyObject *py_obj = NULL; - - PyErr_Format (PyExc_NotImplementedError, - "Marshalling for this type is not implemented yet"); - return py_obj; -} - -PyObject * -_pygi_marshal_to_py_object (GIArgument *arg, GITransfer transfer) { - PyObject *pyobj; - - if (arg->v_pointer == NULL) { - pyobj = Py_None; - Py_INCREF (pyobj); - - } else if (G_IS_PARAM_SPEC(arg->v_pointer)) { - pyobj = pyg_param_spec_new (arg->v_pointer); - if (transfer == GI_TRANSFER_EVERYTHING) - g_param_spec_unref (arg->v_pointer); - - } else { - pyobj = pygobject_new_full (arg->v_pointer, - /*steal=*/ transfer == GI_TRANSFER_EVERYTHING, - /*type=*/ NULL); - } - - return pyobj; -} - -PyObject * -_pygi_marshal_to_py_interface_struct (GIArgument *arg, - GIInterfaceInfo *interface_info, - GType g_type, - PyObject *py_type, - GITransfer transfer, - gboolean is_allocated, - gboolean is_foreign) -{ - PyObject *py_obj = NULL; - - if (arg->v_pointer == NULL) { - Py_RETURN_NONE; - } - - if (g_type_is_a (g_type, G_TYPE_VALUE)) { - py_obj = pyg_value_as_pyobject (arg->v_pointer, FALSE); - } else if (is_foreign) { - py_obj = pygi_struct_foreign_convert_from_g_argument (interface_info, - arg->v_pointer); - } else if (g_type_is_a (g_type, G_TYPE_BOXED)) { - if (py_type) { - py_obj = _pygi_boxed_new ((PyTypeObject *) py_type, - arg->v_pointer, - transfer == GI_TRANSFER_EVERYTHING || is_allocated, - is_allocated ? - g_struct_info_get_size(interface_info) : 0); - } - } else if (g_type_is_a (g_type, G_TYPE_POINTER)) { - if (py_type == NULL || - !PyType_IsSubtype ((PyTypeObject *) py_type, &PyGIStruct_Type)) { - g_warn_if_fail (transfer == GI_TRANSFER_NOTHING); - py_obj = pyg_pointer_new (g_type, arg->v_pointer); - } else { - py_obj = _pygi_struct_new ( (PyTypeObject *) py_type, - arg->v_pointer, - transfer == GI_TRANSFER_EVERYTHING); - } - } else if (g_type_is_a (g_type, G_TYPE_VARIANT)) { - /* Note we do not use transfer for the structs free_on_dealloc because - * GLib.Variant overrides __del__ to call "g_variant_unref". */ - if (py_type) { - g_variant_ref_sink (arg->v_pointer); - py_obj = _pygi_struct_new ((PyTypeObject *) py_type, - arg->v_pointer, - FALSE); - } - } else if (g_type == G_TYPE_NONE) { - if (py_type) { - py_obj = _pygi_struct_new ((PyTypeObject *) py_type, - arg->v_pointer, - transfer == GI_TRANSFER_EVERYTHING); - } - } else { - PyErr_Format (PyExc_NotImplementedError, - "structure type '%s' is not supported yet", - g_type_name (g_type)); - } - - return py_obj; -} diff --git a/gi/pygi-marshal-to-py.h b/gi/pygi-marshal-to-py.h deleted file mode 100644 index 1378630..0000000 --- a/gi/pygi-marshal-to-py.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2011 John (J5) Palmieri , Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGI_MARSHAL_TO_PY_H__ -#define __PYGI_MARSHAL_TO_PY_H__ - -PyObject *_pygi_marshal_to_py_basic_type (GIArgument *arg, - GITypeTag type_tag, - GITransfer transfer); -PyObject *_pygi_marshal_to_py_basic_type_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_void (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_array (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_glist (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_gslist (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_ghash (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_gerror (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_callback(PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_enum (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_flags (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_struct_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_interface(PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_boxed (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_object_cache_adapter (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); -PyObject *_pygi_marshal_to_py_interface_union (PyGIInvokeState *state, - PyGICallableCache *callable_cache, - PyGIArgCache *arg_cache, - GIArgument *arg); - -/* Simplified marshalers shared between vfunc/closure and direct function calls. */ - -PyObject *_pygi_marshal_to_py_object (GIArgument *arg, - GITransfer transfer); - -PyObject *_pygi_marshal_to_py_interface_struct (GIArgument *arg, - GIInterfaceInfo *interface_info, - GType g_type, - PyObject *py_type, - GITransfer transfer, - gboolean is_allocated, - gboolean is_foreign); - -G_END_DECLS - -#endif /* __PYGI_MARSHAL_TO_PY_H__ */ diff --git a/gi/pygi-object.c b/gi/pygi-object.c new file mode 100644 index 0000000..c97d2df --- /dev/null +++ b/gi/pygi-object.c @@ -0,0 +1,381 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include + +#include "pygi-object.h" +#include "pygobject-object.h" +#include "pygparamspec.h" + +/* + * GObject from Python + */ + +typedef gboolean (*PyGIObjectMarshalFromPyFunc) (PyObject *py_arg, + GIArgument *arg, + GITransfer transfer); + +/* _pygi_marshal_from_py_gobject: + * py_arg: (in): + * arg: (out): + */ +static gboolean +_pygi_marshal_from_py_gobject (PyObject *py_arg, /*in*/ + GIArgument *arg, /*out*/ + GITransfer transfer) { + GObject *gobj; + + if (py_arg == Py_None) { + arg->v_pointer = NULL; + return TRUE; + } + + if (!pygobject_check (py_arg, &PyGObject_Type)) { + PyObject *repr = PyObject_Repr (py_arg); + PyErr_Format(PyExc_TypeError, "expected GObject but got %s", + PyUnicode_AsUTF8 (repr)); + Py_DECREF (repr); + return FALSE; + } + + gobj = pygobject_get (py_arg); + if (gobj == NULL) { + PyErr_Format(PyExc_RuntimeError, "object at %p of type %s is not initialized", + py_arg, Py_TYPE(py_arg)->tp_name); + return FALSE; + } + + if (transfer == GI_TRANSFER_EVERYTHING) { + /* For transfer everything, add a new ref that the callee will take ownership of. + * Pythons existing ref to the GObject will be managed with the PyGObject wrapper. + */ + g_object_ref (gobj); + } + + arg->v_pointer = gobj; + return TRUE; +} + +/* pygi_arg_gobject_out_arg_from_py: + * py_arg: (in): + * arg: (out): + * + * A specialization for marshaling Python GObjects used for out/return values + * from a Python implemented vfuncs, signals, or an assignment to a GObject property. + */ +gboolean +pygi_arg_gobject_out_arg_from_py (PyObject *py_arg, /*in*/ + GIArgument *arg, /*out*/ + GITransfer transfer) { + GObject *gobj; + if (!_pygi_marshal_from_py_gobject (py_arg, arg, transfer)) { + return FALSE; + } + + /* HACK: At this point the basic marshaling of the GObject was successful + * but we add some special case hacks for vfunc returns due to buggy APIs: + * https://bugzilla.gnome.org/show_bug.cgi?id=693393 + */ + gobj = arg->v_pointer; + if (Py_REFCNT (py_arg) == 1 && gobj->ref_count == 1) { + /* If both object ref counts are only 1 at this point (the reference held + * in a return tuple), we assume the GObject will be free'd before reaching + * its target and become invalid. So instead of getting invalid object errors + * we add a new GObject ref. + */ + g_object_ref (gobj); + + if (((PyGObject *)py_arg)->private_flags.flags & PYGOBJECT_GOBJECT_WAS_FLOATING) { + /* + * We want to re-float instances that were floating and the Python + * wrapper assumed ownership. With the additional caveat that there + * are not any strong references beyond the return tuple. + */ + g_object_force_floating (gobj); + + } else { + PyObject *repr = PyObject_Repr (py_arg); + gchar *msg = g_strdup_printf ("Expecting to marshal a borrowed reference for %s, " + "but nothing in Python is holding a reference to this object. " + "See: https://bugzilla.gnome.org/show_bug.cgi?id=687522", + PyUnicode_AsUTF8 (repr)); + Py_DECREF (repr); + if (PyErr_WarnEx (PyExc_RuntimeWarning, msg, 2)) { + g_free (msg); + return FALSE; + } + g_free (msg); + } + } + + return TRUE; +} + +static gboolean +_pygi_marshal_from_py_interface_object (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data, + PyGIObjectMarshalFromPyFunc func) +{ + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + + if (py_arg == Py_None) { + arg->v_pointer = NULL; + return TRUE; + } + + if (PyObject_IsInstance (py_arg, iface_cache->py_type) || + (pygobject_check (py_arg, &PyGObject_Type) && + g_type_is_a (G_OBJECT_TYPE (pygobject_get (py_arg)), iface_cache->g_type))) { + + gboolean res; + res = func (py_arg, arg, arg_cache->transfer); + *cleanup_data = arg->v_pointer; + return res; + + } else { + PyObject *module = PyObject_GetAttrString(py_arg, "__module__"); + + PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s", + arg_cache->arg_name ? arg_cache->arg_name : "self", + ( (PyGIInterfaceCache *)arg_cache)->type_name, + module ? PyUnicode_AsUTF8 (module) : "", + module ? "." : "", + Py_TYPE (py_arg)->tp_name); + if (module) + Py_DECREF (module); + return FALSE; + } +} + +static gboolean +_pygi_marshal_from_py_called_from_c_interface_object (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + return _pygi_marshal_from_py_interface_object (state, + callable_cache, + arg_cache, + py_arg, + arg, + cleanup_data, + pygi_arg_gobject_out_arg_from_py); +} + +static gboolean +_pygi_marshal_from_py_called_from_py_interface_object (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + return _pygi_marshal_from_py_interface_object (state, + callable_cache, + arg_cache, + py_arg, + arg, + cleanup_data, + _pygi_marshal_from_py_gobject); +} + +static void +_pygi_marshal_cleanup_from_py_interface_object (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + /* If we processed the parameter but fail before invoking the method, + we need to remove the ref we added */ + if (was_processed && state->failed && data != NULL && + arg_cache->transfer == GI_TRANSFER_EVERYTHING) + g_object_unref (G_OBJECT(data)); +} + + +/* + * GObject to Python + */ + +PyObject * +pygi_arg_gobject_to_py (GIArgument *arg, GITransfer transfer) { + PyObject *pyobj; + + if (arg->v_pointer == NULL) { + pyobj = Py_None; + Py_INCREF (pyobj); + + } else if (G_IS_PARAM_SPEC(arg->v_pointer)) { + pyobj = pyg_param_spec_new (arg->v_pointer); + if (transfer == GI_TRANSFER_EVERYTHING) + g_param_spec_unref (arg->v_pointer); + + } else if (G_IS_OBJECT(arg->v_pointer)) { + pyobj = pygobject_new_full (arg->v_pointer, + /*steal=*/ transfer == GI_TRANSFER_EVERYTHING, + /*type=*/ NULL); + } else { + PyErr_Format(PyExc_TypeError, + "No means to translate argument or return value for '%s'", + g_type_name_from_instance(arg->v_pointer)); + return NULL; + } + + return pyobj; +} + +PyObject * +pygi_arg_gobject_to_py_called_from_c (GIArgument *arg, + GITransfer transfer) +{ + PyObject *object; + + /* HACK: + * The following hack is to work around GTK sending signals which + * contain floating widgets in them. This assumes control of how + * references are added by the PyGObject wrapper and avoids the sink + * behavior by explicitly passing GI_TRANSFER_EVERYTHING as the transfer + * mode and then re-forcing the object as floating afterwards. + * + * See: https://bugzilla.gnome.org/show_bug.cgi?id=693400 + */ + if (arg->v_pointer != NULL && + transfer == GI_TRANSFER_NOTHING && + G_IS_OBJECT (arg->v_pointer) && + g_object_is_floating (arg->v_pointer)) { + + g_object_ref (arg->v_pointer); + object = pygi_arg_gobject_to_py (arg, GI_TRANSFER_EVERYTHING); + g_object_force_floating (arg->v_pointer); + } else { + object = pygi_arg_gobject_to_py (arg, transfer); + } + + return object; +} + +static PyObject * +_pygi_marshal_to_py_called_from_c_interface_object_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + return pygi_arg_gobject_to_py_called_from_c (arg, arg_cache->transfer); +} + +static PyObject * +_pygi_marshal_to_py_called_from_py_interface_object_cache_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + return pygi_arg_gobject_to_py (arg, arg_cache->transfer); +} + +static void +_pygi_marshal_cleanup_to_py_interface_object (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed) +{ + /* If we error out and the object is not marshalled into a PyGObject + we must take care of removing the ref */ + if (!was_processed && arg_cache->transfer == GI_TRANSFER_EVERYTHING) + g_object_unref (G_OBJECT(data)); +} + +static gboolean +pygi_arg_gobject_setup_from_info (PyGIArgCache *arg_cache, + GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + PyGICallableCache *callable_cache) +{ + /* NOTE: usage of pygi_arg_interface_new_from_info already calls + * pygi_arg_interface_setup so no need to do it here. + */ + + if (direction & PYGI_DIRECTION_FROM_PYTHON) { + if (callable_cache->calling_context == PYGI_CALLING_CONTEXT_IS_FROM_C) { + arg_cache->from_py_marshaller = _pygi_marshal_from_py_called_from_c_interface_object; + } else { + arg_cache->from_py_marshaller = _pygi_marshal_from_py_called_from_py_interface_object; + } + + arg_cache->from_py_cleanup = _pygi_marshal_cleanup_from_py_interface_object; + } + + if (direction & PYGI_DIRECTION_TO_PYTHON) { + if (callable_cache->calling_context == PYGI_CALLING_CONTEXT_IS_FROM_C) { + arg_cache->to_py_marshaller = _pygi_marshal_to_py_called_from_c_interface_object_cache_adapter; + } else { + arg_cache->to_py_marshaller = _pygi_marshal_to_py_called_from_py_interface_object_cache_adapter; + } + + arg_cache->to_py_cleanup = _pygi_marshal_cleanup_to_py_interface_object; + } + + return TRUE; +} + +PyGIArgCache * +pygi_arg_gobject_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info, + PyGICallableCache *callable_cache) +{ + gboolean res = FALSE; + PyGIArgCache *cache = NULL; + + cache = pygi_arg_interface_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info); + if (cache == NULL) + return NULL; + + res = pygi_arg_gobject_setup_from_info (cache, + type_info, + arg_info, + transfer, + direction, + callable_cache); + if (res) { + return cache; + } else { + pygi_arg_cache_free (cache); + return NULL; + } +} diff --git a/gi/pygi-object.h b/gi/pygi-object.h new file mode 100644 index 0000000..360bce1 --- /dev/null +++ b/gi/pygi-object.h @@ -0,0 +1,52 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_OBJECT_H__ +#define __PYGI_OBJECT_H__ + +#include +#include "pygi-cache.h" + +G_BEGIN_DECLS + +gboolean +pygi_arg_gobject_out_arg_from_py (PyObject *py_arg, /* in */ + GIArgument *arg, /* out */ + GITransfer transfer); + +PyObject * +pygi_arg_gobject_to_py (GIArgument *arg, + GITransfer transfer); + +PyObject * +pygi_arg_gobject_to_py_called_from_c (GIArgument *arg, + GITransfer transfer); + + +PyGIArgCache * +pygi_arg_gobject_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info, + PyGICallableCache *callable_cache); + +G_END_DECLS + +#endif /*__PYGI_OBJECT_H__*/ diff --git a/gi/pygi-private.h b/gi/pygi-private.h deleted file mode 100644 index 97eced5..0000000 --- a/gi/pygi-private.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - */ -#ifndef __PYGI_PRIVATE_H__ -#define __PYGI_PRIVATE_H__ - -#ifdef __PYGI_H__ -# error "Import pygi.h or pygi-private.h, but not both" -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "pygi.h" - -#include "pygobject-external.h" - -#include "pygi-repository.h" -#include "pygi-info.h" -#include "pygi-struct.h" -#include "pygi-boxed.h" -#include "pygi-argument.h" -#include "pygi-type.h" -#include "pygi-foreign.h" -#include "pygi-closure.h" -#include "pygi-ccallback.h" -#include "pygi-property.h" -#include "pygi-signal-closure.h" -#include "pygi-invoke.h" -#include "pygi-cache.h" -#include "pygi-source.h" - -G_BEGIN_DECLS -#if PY_VERSION_HEX >= 0x03000000 - -#define _PyGI_ERROR_PREFIX(format, ...) G_STMT_START { \ - PyObject *py_error_prefix; \ - py_error_prefix = PyUnicode_FromFormat(format, ## __VA_ARGS__); \ - if (py_error_prefix != NULL) { \ - PyObject *py_error_type, *py_error_value, *py_error_traceback; \ - PyErr_Fetch(&py_error_type, &py_error_value, &py_error_traceback); \ - if (PyUnicode_Check(py_error_value)) { \ - PyObject *new; \ - new = PyUnicode_Concat(py_error_prefix, py_error_value); \ - Py_DECREF(py_error_value); \ - if (new != NULL) { \ - py_error_value = new; \ - } \ - } \ - PyErr_Restore(py_error_type, py_error_value, py_error_traceback); \ - Py_DECREF(py_error_prefix); \ - } \ -} G_STMT_END - -#else - -#define _PyGI_ERROR_PREFIX(format, ...) G_STMT_START { \ - PyObject *py_error_prefix; \ - py_error_prefix = PyString_FromFormat(format, ## __VA_ARGS__); \ - if (py_error_prefix != NULL) { \ - PyObject *py_error_type, *py_error_value, *py_error_traceback; \ - PyErr_Fetch(&py_error_type, &py_error_value, &py_error_traceback); \ - if (PyString_Check(py_error_value)) { \ - PyString_ConcatAndDel(&py_error_prefix, py_error_value); \ - if (py_error_prefix != NULL) { \ - py_error_value = py_error_prefix; \ - } \ - } \ - PyErr_Restore(py_error_type, py_error_value, py_error_traceback); \ - } \ -} G_STMT_END - -#endif - -/* Redefine g_array_index because we want it to return the i-th element, casted - * to the type t, of the array a, and not the i-th element of the array a - * casted to the type t. */ -#define _g_array_index(a,t,i) \ - *(t *)((a)->data + g_array_get_element_size(a) * (i)) - - -G_END_DECLS - -#endif /* __PYGI_PRIVATE_H__ */ diff --git a/gi/pygi-property.c b/gi/pygi-property.c index 3f6d038..595167b 100644 --- a/gi/pygi-property.c +++ b/gi/pygi-property.c @@ -21,7 +21,11 @@ * IN THE SOFTWARE. */ -#include "pygi-private.h" +#include "pygi-property.h" +#include "pygi-value.h" +#include "pygi-argument.h" +#include "pygparamspec.h" +#include "pygi-type.h" #include @@ -29,7 +33,7 @@ static GIPropertyInfo * lookup_property_from_object_info (GIObjectInfo *info, const gchar *attr_name) { gssize n_infos; - gssize i; + gint i; n_infos = g_object_info_get_n_properties (info); for (i = 0; i < n_infos; i++) { @@ -53,7 +57,7 @@ lookup_property_from_interface_info (GIInterfaceInfo *info, const gchar *attr_name) { gssize n_infos; - gssize i; + gint i; n_infos = g_interface_info_get_n_properties (info); for (i = 0; i < n_infos; i++) { @@ -95,185 +99,115 @@ _pygi_lookup_property_from_g_type (GType g_type, const gchar *attr_name) return ret; } -static inline gpointer -g_value_get_or_dup_boxed (const GValue *value, GITransfer transfer) +PyObject * +pygi_call_do_get_property (PyObject *instance, GParamSpec *pspec) { - if (transfer == GI_TRANSFER_EVERYTHING) - return g_value_dup_boxed (value); - else - return g_value_get_boxed (value); + PyObject *py_pspec; + PyObject *retval; + + py_pspec = pyg_param_spec_new (pspec); + retval = PyObject_CallMethod (instance, "do_get_property", "O", py_pspec); + Py_DECREF (py_pspec); + return retval; } PyObject * -pygi_get_property_value_real (PyGObject *instance, GParamSpec *pspec) +pygi_get_property_value (PyGObject *instance, GParamSpec *pspec) { GIPropertyInfo *property_info = NULL; GValue value = { 0, }; - GIArgument arg = { 0, }; PyObject *py_value = NULL; - GITypeInfo *type_info = NULL; - GITransfer transfer; - GITypeTag type_tag; + GType fundamental; + gboolean handled; - /* The owner_type of the pspec gives us the exact type that introduced the - * property, even if it is a parent class of the instance in question. */ - property_info = _pygi_lookup_property_from_g_type (pspec->owner_type, pspec->name); + if (!(pspec->flags & G_PARAM_READABLE)) { + PyErr_Format(PyExc_TypeError, "property %s is not readable", + g_param_spec_get_name (pspec)); + return NULL; + } - if (property_info == NULL) - goto out; + /* Fast path which calls the Python getter implementation directly. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=723872 */ + if (pyg_gtype_is_custom (pspec->owner_type)) { + return pygi_call_do_get_property ((PyObject *)instance, pspec); + } + Py_BEGIN_ALLOW_THREADS; g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); g_object_get_property (instance->obj, pspec->name, &value); + fundamental = G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (&value)); + Py_END_ALLOW_THREADS; - type_info = g_property_info_get_type (property_info); - transfer = g_property_info_get_ownership_transfer (property_info); - type_tag = g_type_info_get_tag (type_info); - switch (type_tag) { - case GI_TYPE_TAG_BOOLEAN: - arg.v_boolean = g_value_get_boolean (&value); - break; - case GI_TYPE_TAG_INT8: - arg.v_int8 = g_value_get_schar (&value); - break; - case GI_TYPE_TAG_INT16: - case GI_TYPE_TAG_INT32: - if (G_VALUE_HOLDS_LONG (&value)) - arg.v_long = g_value_get_long (&value); - else - arg.v_int = g_value_get_int (&value); - break; - case GI_TYPE_TAG_INT64: - if (G_VALUE_HOLDS_LONG (&value)) - arg.v_long = g_value_get_long (&value); - else - arg.v_int64 = g_value_get_int64 (&value); - break; - case GI_TYPE_TAG_UINT8: - arg.v_uint8 = g_value_get_uchar (&value); - break; - case GI_TYPE_TAG_UINT16: - case GI_TYPE_TAG_UINT32: - if (G_VALUE_HOLDS_ULONG (&value)) - arg.v_ulong = g_value_get_ulong (&value); - else - arg.v_uint = g_value_get_uint (&value); - break; - case GI_TYPE_TAG_UINT64: - if (G_VALUE_HOLDS_ULONG (&value)) - arg.v_ulong = g_value_get_ulong (&value); - else - arg.v_uint64 = g_value_get_uint64 (&value); - break; - case GI_TYPE_TAG_FLOAT: - arg.v_float = g_value_get_float (&value); - break; - case GI_TYPE_TAG_DOUBLE: - arg.v_double = g_value_get_double (&value); - break; - case GI_TYPE_TAG_GTYPE: - arg.v_size = g_value_get_gtype (&value); - break; - case GI_TYPE_TAG_UTF8: - case GI_TYPE_TAG_FILENAME: - arg.v_string = g_value_dup_string (&value); - break; - case GI_TYPE_TAG_INTERFACE: - { - GIBaseInfo *info; - GIInfoType info_type; - GType type; - - info = g_type_info_get_interface (type_info); - type = g_registered_type_info_get_g_type (info); - info_type = g_base_info_get_type (info); + /* Fast path basic types which don't need GI type info. */ + py_value = pygi_value_to_py_basic_type (&value, fundamental, &handled); + if (handled) { + goto out; + } - g_base_info_unref (info); + /* Attempt to marshal through GI. + * The owner_type of the pspec gives us the exact type that introduced the + * property, even if it is a parent class of the instance in question. */ + property_info = _pygi_lookup_property_from_g_type (pspec->owner_type, pspec->name); + if (property_info) { + GITypeInfo *type_info = NULL; + gboolean free_array = FALSE; + GIArgument arg = { 0, }; + GITransfer transfer = GI_TRANSFER_NOTHING; + + type_info = g_property_info_get_type (property_info); + arg = _pygi_argument_from_g_value (&value, type_info); + + /* Arrays are special cased, see note in _pygi_argument_to_array. */ + if (g_type_info_get_tag (type_info) == GI_TYPE_TAG_ARRAY) { + arg.v_pointer = _pygi_argument_to_array (&arg, NULL, NULL, NULL, + type_info, &free_array); + } else if (g_type_is_a (pspec->value_type, G_TYPE_BOXED)) { + arg.v_pointer = g_value_dup_boxed (&value); + transfer = GI_TRANSFER_EVERYTHING; + } - switch (info_type) { - case GI_INFO_TYPE_ENUM: - arg.v_int = g_value_get_enum (&value); - break; - case GI_INFO_TYPE_INTERFACE: - case GI_INFO_TYPE_OBJECT: - arg.v_pointer = g_value_get_object (&value); - break; - case GI_INFO_TYPE_BOXED: - case GI_INFO_TYPE_STRUCT: - case GI_INFO_TYPE_UNION: + py_value = _pygi_argument_to_object (&arg, type_info, transfer); - if (g_type_is_a (type, G_TYPE_BOXED)) { - arg.v_pointer = g_value_dup_boxed (&value); - } else if (g_type_is_a (type, G_TYPE_POINTER)) { - arg.v_pointer = g_value_get_pointer (&value); - } else if (g_type_is_a (type, G_TYPE_VARIANT)) { - arg.v_pointer = g_value_get_variant (&value); - } else { - PyErr_Format (PyExc_NotImplementedError, - "Retrieving properties of type '%s' is not implemented", - g_type_name (type)); - } - break; - default: - PyErr_Format (PyExc_NotImplementedError, - "Retrieving properties of type '%s' is not implemented", - g_type_name (type)); - goto out; - } - break; - } - case GI_TYPE_TAG_GHASH: - arg.v_pointer = g_value_get_or_dup_boxed (&value, transfer); - break; - case GI_TYPE_TAG_GLIST: - case GI_TYPE_TAG_GSLIST: - if (G_VALUE_HOLDS_BOXED(&value)) - arg.v_pointer = g_value_get_or_dup_boxed (&value, transfer); - else - arg.v_pointer = g_value_get_pointer (&value); - break; - case GI_TYPE_TAG_ARRAY: - { - gchar** strings; - GArray *arg_items; - int i; - - strings = g_value_get_or_dup_boxed (&value, transfer); - if (strings == NULL) - arg.v_pointer = NULL; - else { - arg_items = g_array_sized_new (TRUE, TRUE, sizeof (GIArgument), g_strv_length (strings)); - g_array_set_size (arg_items, g_strv_length (strings)); - for (i = 0; strings[i] != NULL; ++i) { - g_array_index (arg_items, GIArgument, i).v_string = strings[i]; - } - arg.v_pointer = arg_items; - } - break; + if (free_array) { + g_array_free (arg.v_pointer, FALSE); } - default: - PyErr_Format (PyExc_NotImplementedError, - "Retrieving properties of type %s is not implemented", - g_type_tag_to_string (g_type_info_get_tag (type_info))); - goto out; + + g_base_info_unref (type_info); + g_base_info_unref (property_info); } - py_value = _pygi_argument_to_object (&arg, type_info, transfer); - g_value_unset (&value); + /* Fallback to GValue marshalling. */ + if (py_value == NULL) { + py_value = pyg_param_gvalue_as_pyobject (&value, TRUE, pspec); + } out: - if (property_info != NULL) - g_base_info_unref (property_info); - if (type_info != NULL) - g_base_info_unref (type_info); - + g_value_unset (&value); return py_value; } +PyObject * +pygi_get_property_value_by_name (PyGObject *self, gchar *param_name) +{ + GParamSpec *pspec; + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS(self->obj), + param_name); + if (!pspec) { + PyErr_Format (PyExc_TypeError, + "object of type `%s' does not have property `%s'", + g_type_name (G_OBJECT_TYPE (self->obj)), param_name); + return NULL; + } + + return pygi_get_property_value (self, pspec); +} + gint -pygi_set_property_value_real (PyGObject *instance, - GParamSpec *pspec, - PyObject *py_value) +pygi_set_property_value (PyGObject *instance, + GParamSpec *pspec, + PyObject *py_value) { GIPropertyInfo *property_info = NULL; GITypeInfo *type_info = NULL; @@ -302,7 +236,7 @@ pygi_set_property_value_real (PyGObject *instance, g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); - // FIXME: Lots of types still unhandled + /* FIXME: Lots of types still unhandled */ type_tag = g_type_info_get_tag (type_info); switch (type_tag) { case GI_TYPE_TAG_INTERFACE: @@ -321,6 +255,9 @@ pygi_set_property_value_real (PyGObject *instance, case GI_INFO_TYPE_ENUM: g_value_set_enum (&value, arg.v_int); break; + case GI_INFO_TYPE_FLAGS: + g_value_set_flags (&value, arg.v_uint); + break; case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_OBJECT: g_value_set_object (&value, arg.v_pointer); @@ -411,7 +348,7 @@ pygi_set_property_value_real (PyGObject *instance, */ GArray *arg_items = (GArray*) arg.v_pointer; gchar** strings; - int i; + guint i; if (arg_items == NULL) goto out; diff --git a/gi/pygi-property.h b/gi/pygi-property.h index 875d21e..d641b01 100644 --- a/gi/pygi-property.h +++ b/gi/pygi-property.h @@ -27,13 +27,22 @@ #include #include -#include "pygi.h" +#include "pygobject-internal.h" -PyObject *pygi_get_property_value_real (PyGObject *instance, - GParamSpec *pspec); +PyObject * +pygi_get_property_value (PyGObject *instance, + GParamSpec *pspec); -gint pygi_set_property_value_real (PyGObject *instance, - GParamSpec *pspec, - PyObject *py_value); +PyObject * +pygi_get_property_value_by_name (PyGObject *self, + gchar *param_name); +PyObject * +pygi_call_do_get_property (PyObject *instance, + GParamSpec *pspec); + +gint +pygi_set_property_value (PyGObject *instance, + GParamSpec *pspec, + PyObject *py_value); #endif /* __PYGI_PROPERTY_H__ */ diff --git a/gi/pygi-repository.c b/gi/pygi-repository.c index d7c65f5..07fdc8f 100644 --- a/gi/pygi-repository.c +++ b/gi/pygi-repository.c @@ -16,18 +16,17 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" - -#include +#include "pygi-repository.h" +#include "pygi-info.h" +#include "pygi-basictype.h" +#include "pygi-util.h" PyObject *PyGIRepositoryError; -PYGLIB_DEFINE_TYPE("gi.Repository", PyGIRepository_Type, PyGIRepository); +PYGI_DEFINE_TYPE("gi.Repository", PyGIRepository_Type, PyGIRepository); static PyObject * _wrap_g_irepository_enumerate_versions (PyGIRepository *self, @@ -48,7 +47,7 @@ _wrap_g_irepository_enumerate_versions (PyGIRepository *self, ret = PyList_New(0); for (item = versions; item; item = item->next) { char *version = item->data; - PyObject *py_version = PYGLIB_PyUnicode_FromString (version); + PyObject *py_version = pygi_utf8_to_py (version); PyList_Append(ret, py_version); Py_DECREF(py_version); g_free (version); @@ -110,6 +109,24 @@ _wrap_g_irepository_require (PyGIRepository *self, } static PyObject * +_wrap_g_irepository_is_registered (PyGIRepository *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "namespace", "version", NULL }; + const char *namespace_; + const char *version = NULL; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s|z:Repository.is_registered", + kwlist, &namespace_, &version)) { + return NULL; + } + + return pygi_gboolean_to_py (g_irepository_is_registered (self->repository, + namespace_, version)); +} + +static PyObject * _wrap_g_irepository_find_by_name (PyGIRepository *self, PyObject *args, PyObject *kwargs) @@ -164,7 +181,7 @@ _wrap_g_irepository_get_infos (PyGIRepository *self, const char *namespace_; gssize n_infos; PyObject *infos; - gssize i; + gint i; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:Repository.get_infos", kwlist, &namespace_)) { @@ -221,7 +238,7 @@ _wrap_g_irepository_get_typelib_path (PyGIRepository *self, return NULL; } - return PYGLIB_PyBytes_FromString (typelib_path); + return pygi_filename_to_py (typelib_path); } static PyObject * @@ -244,7 +261,7 @@ _wrap_g_irepository_get_version (PyGIRepository *self, return NULL; } - return PYGLIB_PyUnicode_FromString (version); + return pygi_utf8_to_py (version); } static PyObject * @@ -258,7 +275,7 @@ _wrap_g_irepository_get_loaded_namespaces (PyGIRepository *self) py_namespaces = PyList_New (0); for (i = 0; namespaces[i] != NULL; i++) { - PyObject *py_namespace = PYGLIB_PyUnicode_FromString (namespaces[i]); + PyObject *py_namespace = pygi_utf8_to_py (namespaces[i]); PyList_Append (py_namespaces, py_namespace); Py_DECREF(py_namespace); g_free (namespaces[i]); @@ -269,6 +286,74 @@ _wrap_g_irepository_get_loaded_namespaces (PyGIRepository *self) return py_namespaces; } +static PyObject * +_wrap_g_irepository_get_dependencies (PyGIRepository *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "namespace", NULL }; + const char *namespace_; + char **namespaces; + PyObject *py_namespaces; + gssize i; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, + "s:Repository.get_dependencies", kwlist, &namespace_)) { + return NULL; + } + + py_namespaces = PyList_New (0); + /* Returns NULL in case of no dependencies */ + namespaces = g_irepository_get_dependencies (self->repository, namespace_); + if (namespaces == NULL) { + return py_namespaces; + } + + for (i = 0; namespaces[i] != NULL; i++) { + PyObject *py_namespace = pygi_utf8_to_py (namespaces[i]); + PyList_Append (py_namespaces, py_namespace); + Py_DECREF(py_namespace); + } + + g_strfreev (namespaces); + + return py_namespaces; +} + + +static PyObject * +_wrap_g_irepository_get_immediate_dependencies (PyGIRepository *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "namespace", NULL }; + const char *namespace_; + char **namespaces; + PyObject *py_namespaces; + gssize i; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, + "s:Repository.get_immediate_dependencies", + kwlist, &namespace_)) { + return NULL; + } + + py_namespaces = PyList_New (0); + namespaces = g_irepository_get_immediate_dependencies (self->repository, + namespace_); + + for (i = 0; namespaces[i] != NULL; i++) { + PyObject *py_namespace = pygi_utf8_to_py (namespaces[i]); + PyList_Append (py_namespaces, py_namespace); + Py_DECREF (py_namespace); + } + + g_strfreev (namespaces); + + return py_namespaces; +} + + static PyMethodDef _PyGIRepository_methods[] = { { "enumerate_versions", (PyCFunction) _wrap_g_irepository_enumerate_versions, METH_VARARGS | METH_KEYWORDS }, { "get_default", (PyCFunction) _wrap_g_irepository_get_default, METH_STATIC | METH_NOARGS }, @@ -278,28 +363,41 @@ static PyMethodDef _PyGIRepository_methods[] = { { "get_typelib_path", (PyCFunction) _wrap_g_irepository_get_typelib_path, METH_VARARGS | METH_KEYWORDS }, { "get_version", (PyCFunction) _wrap_g_irepository_get_version, METH_VARARGS | METH_KEYWORDS }, { "get_loaded_namespaces", (PyCFunction) _wrap_g_irepository_get_loaded_namespaces, METH_NOARGS }, + { "get_dependencies", (PyCFunction) _wrap_g_irepository_get_dependencies, METH_VARARGS | METH_KEYWORDS }, + { "get_immediate_dependencies", (PyCFunction) _wrap_g_irepository_get_immediate_dependencies, METH_VARARGS | METH_KEYWORDS }, + { "is_registered", (PyCFunction) _wrap_g_irepository_is_registered, METH_VARARGS | METH_KEYWORDS }, { NULL, NULL, 0 } }; -void -_pygi_repository_register_types (PyObject *m) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_repository_register_types (PyObject *m) { - Py_TYPE(&PyGIRepository_Type) = &PyType_Type; + Py_SET_TYPE(&PyGIRepository_Type, &PyType_Type); PyGIRepository_Type.tp_flags = Py_TPFLAGS_DEFAULT; PyGIRepository_Type.tp_methods = _PyGIRepository_methods; - if (PyType_Ready (&PyGIRepository_Type)) { - return; - } + if (PyType_Ready (&PyGIRepository_Type) < 0) + return -1; - if (PyModule_AddObject (m, "Repository", (PyObject *) &PyGIRepository_Type)) { - return; + Py_INCREF ((PyObject *) &PyGIRepository_Type); + if (PyModule_AddObject (m, "Repository", (PyObject *) &PyGIRepository_Type) < 0) { + Py_DECREF ((PyObject *) &PyGIRepository_Type); + return -1; } PyGIRepositoryError = PyErr_NewException ("gi.RepositoryError", NULL, NULL); - if (PyModule_AddObject (m, "RepositoryError", PyGIRepositoryError)) { - return; + if (PyGIRepositoryError == NULL) + return -1; + + Py_INCREF (PyGIRepositoryError); + if (PyModule_AddObject (m, "RepositoryError", PyGIRepositoryError) < 0) { + Py_DECREF (PyGIRepositoryError); + return -1; } -} + return 0; +} diff --git a/gi/pygi-repository.h b/gi/pygi-repository.h index d8eb8cf..2207de3 100644 --- a/gi/pygi-repository.h +++ b/gi/pygi-repository.h @@ -14,25 +14,29 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_REPOSITORY_H__ #define __PYGI_REPOSITORY_H__ #include +#include G_BEGIN_DECLS +typedef struct { + PyObject_HEAD + GIRepository *repository; +} PyGIRepository; + /* Private */ extern PyTypeObject PyGIRepository_Type; extern PyObject *PyGIRepositoryError; -void _pygi_repository_register_types (PyObject *m); +int pygi_repository_register_types (PyObject *m); G_END_DECLS diff --git a/gi/pygi-resulttuple.c b/gi/pygi-resulttuple.c new file mode 100644 index 0000000..93170ea --- /dev/null +++ b/gi/pygi-resulttuple.c @@ -0,0 +1,368 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2015 Christoph Reiter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include +#include "pygi-resulttuple.h" +#include "pygi-util.h" + +static char repr_format_key[] = "__repr_format"; +static char tuple_indices_key[] = "__tuple_indices"; + +#define PYGI_USE_FREELIST + +#ifdef PYPY_VERSION +#undef PYGI_USE_FREELIST +#endif + +#ifdef PYGI_USE_FREELIST +/* A free list similar to the one used for the CPython tuple. Difference + * is that zero length tuples aren't cached (as we don't need them) + * and that the freelist is smaller as we don't free it with the cyclic GC + * as CPython does. This wastes 21kB max. + */ +#define PyGIResultTuple_MAXSAVESIZE 10 +#define PyGIResultTuple_MAXFREELIST 100 +static PyObject *free_list[PyGIResultTuple_MAXSAVESIZE]; +static int numfree[PyGIResultTuple_MAXSAVESIZE]; +#endif + +PYGI_DEFINE_TYPE ("gi._gi.ResultTuple", PyGIResultTuple_Type, PyTupleObject) + +/** + * ResultTuple.__repr__() implementation. + * Takes the _ResultTuple.__repr_format format string and applies the tuple + * values to it. + */ +static PyObject* +resulttuple_repr(PyObject *self) { + PyObject *format, *repr, *format_attr; + + format_attr = PyUnicode_FromString (repr_format_key); + format = PyTuple_Type.tp_getattro (self, format_attr); + Py_DECREF (format_attr); + if (format == NULL) + return NULL; + repr = PyUnicode_Format (format, self); + Py_DECREF (format); + return repr; +} + +/** + * PyGIResultTuple_Type.tp_getattro implementation. + * Looks up the tuple index in _ResultTuple.__tuple_indices and returns the + * tuple item. + */ +static PyObject* +resulttuple_getattro(PyObject *self, PyObject *name) { + PyObject *mapping, *index, *mapping_attr, *item; + + mapping_attr = PyUnicode_FromString (tuple_indices_key); + mapping = PyTuple_Type.tp_getattro (self, mapping_attr); + Py_DECREF (mapping_attr); + if (mapping == NULL) + return NULL; + g_assert (PyDict_Check (mapping)); + index = PyDict_GetItem (mapping, name); + + if (index != NULL) { + item = PyTuple_GET_ITEM (self, PyLong_AsSsize_t (index)); + Py_INCREF (item); + } else { + item = PyTuple_Type.tp_getattro (self, name); + } + Py_DECREF (mapping); + + return item; +} + +/** + * ResultTuple.__reduce__() implementation. + * Always returns (tuple, tuple(self)) + * Needed so that pickling doesn't depend on our tuple subclass and unpickling + * works without it. As a result unpickle will give back in a normal tuple. + */ +static PyObject * +resulttuple_reduce(PyObject *self) +{ + PyObject *tuple = PySequence_Tuple (self); + if (tuple == NULL) + return NULL; + return Py_BuildValue ("(O, (N))", &PyTuple_Type, tuple); +} + +/** + * Extends __dir__ with the extra attributes accessible through + * resulttuple_getattro() + */ +static PyObject * +resulttuple_dir(PyObject *self) +{ + PyObject *mapping_attr; + PyObject *items = NULL; + PyObject *mapping = NULL; + PyObject *mapping_values = NULL; + PyObject *result = NULL; + + mapping_attr = PyUnicode_FromString (tuple_indices_key); + mapping = PyTuple_Type.tp_getattro (self, mapping_attr); + Py_DECREF (mapping_attr); + if (mapping == NULL) + goto error; + items = PyObject_Dir ((PyObject*)Py_TYPE (self)); + if (items == NULL) + goto error; + mapping_values = PyDict_Keys (mapping); + if (mapping_values == NULL) + goto error; + result = PySequence_InPlaceConcat (items, mapping_values); + +error: + Py_XDECREF (items); + Py_XDECREF (mapping); + Py_XDECREF (mapping_values); + + return result; +} + +/** + * resulttuple_new_type: + * @args: one list object containing tuple item names and None + * + * Exposes pygi_resulttuple_new_type() as ResultTuple._new_type() + * to allow creation of result types for unit tests. + * + * Returns: A new PyTypeObject which is a subclass of PyGIResultTuple_Type + * or %NULL in case of an error. + */ +static PyObject * +resulttuple_new_type(PyObject *self, PyObject *args) { + PyObject *tuple_names, *new_type; + + if (!PyArg_ParseTuple (args, "O:ResultTuple._new_type", &tuple_names)) + return NULL; + + if (!PyList_Check (tuple_names)) { + PyErr_SetString (PyExc_TypeError, "not a list"); + return NULL; + } + + new_type = (PyObject *)pygi_resulttuple_new_type (tuple_names); + return new_type; +} + +static PyMethodDef resulttuple_methods[] = { + {"__reduce__", (PyCFunction)resulttuple_reduce, METH_NOARGS}, + {"__dir__", (PyCFunction)resulttuple_dir, METH_NOARGS}, + {"_new_type", (PyCFunction)resulttuple_new_type, + METH_VARARGS | METH_STATIC}, + {NULL, NULL, 0}, +}; + +/** + * pygi_resulttuple_new_type: + * @tuple_names: A python list containing str or None items. + * + * Similar to namedtuple() creates a new tuple subclass which + * allows to access items by name and have a pretty __repr__. + * Each item in the passed name list corresponds to an item with + * the same index in the tuple class. If the name is None the item/index + * is unnamed. + * + * Returns: A new PyTypeObject which is a subclass of PyGIResultTuple_Type + * or %NULL in case of an error. + */ +PyTypeObject* +pygi_resulttuple_new_type(PyObject *tuple_names) { + PyTypeObject *new_type; + PyObject *class_dict, *format_string, *empty_format, *named_format, + *format_list, *sep, *index_dict, *slots, *paren_format, *new_type_args, + *paren_string; + Py_ssize_t len, i; + + g_assert (PyList_Check (tuple_names)); + + class_dict = PyDict_New (); + + /* To save some memory don't use an instance dict */ + slots = PyTuple_New (0); + PyDict_SetItemString (class_dict, "__slots__", slots); + Py_DECREF (slots); + + format_list = PyList_New (0); + index_dict = PyDict_New (); + + empty_format = PyUnicode_FromString ("%r"); + named_format = PyUnicode_FromString ("%s=%%r"); + len = PyList_Size (tuple_names); + for (i = 0; i < len; i++) { + PyObject *item, *named_args, *named_build, *index; + item = PyList_GET_ITEM (tuple_names, i); + if (item == Py_None) { + PyList_Append (format_list, empty_format); + } else { + named_args = Py_BuildValue ("(O)", item); + named_build = PyUnicode_Format (named_format, named_args); + Py_DECREF (named_args); + PyList_Append (format_list, named_build); + Py_DECREF (named_build); + index = PyLong_FromSsize_t (i); + PyDict_SetItem (index_dict, item, index); + Py_DECREF (index); + } + } + Py_DECREF (empty_format); + Py_DECREF (named_format); + + sep = PyUnicode_FromString (", "); + format_string = PyObject_CallMethod (sep, "join", "O", format_list); + Py_DECREF (sep); + Py_DECREF (format_list); + paren_format = PyUnicode_FromString ("(%s)"); + paren_string = PyUnicode_Format (paren_format, format_string); + Py_DECREF (paren_format); + Py_DECREF (format_string); + + PyDict_SetItemString (class_dict, repr_format_key, paren_string); + Py_DECREF (paren_string); + + PyDict_SetItemString (class_dict, tuple_indices_key, index_dict); + Py_DECREF (index_dict); + + new_type_args = Py_BuildValue ("s(O)O", "_ResultTuple", + &PyGIResultTuple_Type, class_dict); + new_type = (PyTypeObject *)PyType_Type.tp_new (&PyType_Type, + new_type_args, NULL); + Py_DECREF (new_type_args); + Py_DECREF (class_dict); + + if (new_type != NULL) { + /* disallow subclassing as that would break the free list caching + * since we assume that all subclasses use PyTupleObject */ + new_type->tp_flags &= ~Py_TPFLAGS_BASETYPE; + } + + return new_type; +} + + +/** + * pygi_resulttuple_new: + * @subclass: A PyGIResultTuple_Type subclass which will be the type of the + * returned instance. + * @len: Length of the returned tuple + * + * Like PyTuple_New(). Return an uninitialized tuple of the given @length. + * + * Returns: An instance of @subclass or %NULL on error. + */ +PyObject * +pygi_resulttuple_new(PyTypeObject *subclass, Py_ssize_t len) { +#ifdef PYGI_USE_FREELIST + PyObject *self; + Py_ssize_t i; + + /* Check the free list for a tuple object with the needed size; + * clear it and change the class to ours. + */ + if (len > 0 && len < PyGIResultTuple_MAXSAVESIZE) { + self = free_list[len]; + if (self != NULL) { + free_list[len] = PyTuple_GET_ITEM (self, 0); + numfree[len]--; + for (i=0; i < len; i++) { + PyTuple_SET_ITEM (self, i, NULL); + } + Py_SET_TYPE (self, subclass); + Py_INCREF (subclass); + _Py_NewReference (self); + PyObject_GC_Track (self); + return self; + } + } +#endif + + /* For zero length tuples and in case the free list is empty, alloc + * as usual. + */ + return subclass->tp_alloc (subclass, len); +} + +#ifdef PYGI_USE_FREELIST +static void resulttuple_dealloc(PyObject *self) { + Py_ssize_t i, len; + + PyObject_GC_UnTrack (self); + CPy_TRASHCAN_BEGIN (self, resulttuple_dealloc) + + /* Free the tuple items and, if there is space, save the tuple object + * pointer to the front of the free list for its size. Otherwise free it. + */ + len = Py_SIZE (self); + if (len > 0) { + for (i=0; i < len; i++) { + Py_XDECREF (PyTuple_GET_ITEM (self, i)); + } + + if (len < PyGIResultTuple_MAXSAVESIZE && numfree[len] < PyGIResultTuple_MAXFREELIST) { + PyTuple_SET_ITEM (self, 0, free_list[len]); + numfree[len]++; + free_list[len] = self; + goto done; + } + } + + Py_TYPE (self)->tp_free (self); + +done: + CPy_TRASHCAN_END (self) +} +#endif + +/** + * pygi_resulttuple_register_types: + * @module: A Python modules to which ResultTuple gets added to. + * + * Initializes the ResultTuple class and adds it to the passed @module. + * + * Returns: -1 on error, 0 on success. + */ +int pygi_resulttuple_register_types(PyObject *module) { + + PyGIResultTuple_Type.tp_base = &PyTuple_Type; + PyGIResultTuple_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; + PyGIResultTuple_Type.tp_repr = (reprfunc)resulttuple_repr; + PyGIResultTuple_Type.tp_getattro = (getattrofunc)resulttuple_getattro; + PyGIResultTuple_Type.tp_methods = resulttuple_methods; +#ifdef PYGI_USE_FREELIST + PyGIResultTuple_Type.tp_dealloc = (destructor)resulttuple_dealloc; +#endif + + if (PyType_Ready (&PyGIResultTuple_Type) < 0) + return -1; + + Py_INCREF (&PyGIResultTuple_Type); + if (PyModule_AddObject (module, "ResultTuple", + (PyObject *)&PyGIResultTuple_Type) < 0) { + Py_DECREF (&PyGIResultTuple_Type); + return -1; + } + + return 0; +} diff --git a/gi/_gobject/pygenum.h b/gi/pygi-resulttuple.h similarity index 54% rename from gi/_gobject/pygenum.h rename to gi/pygi-resulttuple.h index 0558831..3f63ca0 100644 --- a/gi/_gobject/pygenum.h +++ b/gi/pygi-resulttuple.h @@ -1,7 +1,7 @@ /* -*- Mode: C; c-basic-offset: 4 -*- - * pygtk- Python bindings for the GTK toolkit. - * Copyright (C) 1998-2003 James Henstridge - * 2004-2008 Johan Dahlin + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2015 Christoph Reiter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,14 +14,21 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifndef __PYGOBJECT_ENUM_H__ -#define __PYGOBJECT_ENUM_H__ +#ifndef __PYGI_RESULTTUPLE_H__ +#define __PYGI_RESULTTUPLE_H__ + +#include "Python.h" + +int +pygi_resulttuple_register_types (PyObject *d); + +PyTypeObject * +pygi_resulttuple_new_type (PyObject *tuple_names); -void pygobject_enum_register_types(PyObject *d); +PyObject* +pygi_resulttuple_new (PyTypeObject *subclass, Py_ssize_t len); -#endif /* __PYGOBJECT_ENUM_H__ */ +#endif /* __PYGI_RESULTTUPLE_H__ */ diff --git a/gi/pygi-signal-closure.c b/gi/pygi-signal-closure.c index bcd1320..d553d76 100644 --- a/gi/pygi-signal-closure.c +++ b/gi/pygi-signal-closure.c @@ -13,12 +13,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" +#include "pygi-signal-closure.h" +#include "pygi-value.h" +#include "pygi-argument.h" +#include "pygi-boxed.h" static GISignalInfo * _pygi_lookup_signal_from_g_type (GType g_type, @@ -80,11 +81,14 @@ pygi_signal_closure_marshal(GClosure *closure, GISignalInfo *signal_info; gint n_sig_info_args; gint sig_info_highest_arg; + GSList *list_item = NULL; + GSList *pass_by_ref_structs = NULL; state = PyGILState_Ensure(); signal_info = ((PyGISignalClosure *)closure)->signal_info; n_sig_info_args = g_callable_info_get_n_args(signal_info); + g_assert_cmpint (n_sig_info_args, >=, 0); /* the first argument to a signal callback is instance, but instance is not counted in the introspection data */ sig_info_highest_arg = n_sig_info_args + 1; @@ -107,34 +111,78 @@ pygi_signal_closure_marshal(GClosure *closure, } PyTuple_SetItem(params, i, item); - } else if (i < sig_info_highest_arg) { + } else if (i < (guint)sig_info_highest_arg) { GIArgInfo arg_info; GITypeInfo type_info; - GITransfer transfer; + GITypeTag type_tag; GIArgument arg = { 0, }; PyObject *item = NULL; gboolean free_array = FALSE; + gboolean pass_struct_by_ref = FALSE; g_callable_info_load_arg(signal_info, i - 1, &arg_info); g_arg_info_load_type(&arg_info, &type_info); - transfer = g_arg_info_get_ownership_transfer(&arg_info); arg = _pygi_argument_from_g_value(¶m_values[i], &type_info); - - if (g_type_info_get_tag (&type_info) == GI_TYPE_TAG_ARRAY) { + + type_tag = g_type_info_get_tag (&type_info); + if (type_tag == GI_TYPE_TAG_ARRAY) { /* Skip the self argument of param_values */ - arg.v_pointer = _pygi_argument_to_array (&arg, NULL, param_values + 1, signal_info, - &type_info, &free_array); + arg.v_pointer = _pygi_argument_to_array (&arg, + _pygi_argument_array_length_marshal, + (void *)(param_values + 1), + signal_info, + &type_info, + &free_array); + } + + /* Hack to ensure struct arguments are passed-by-reference allowing + * callback implementors to modify the struct values. This is needed + * for keeping backwards compatibility and should be removed in future + * versions which support signal output arguments as return values. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=735486 + * + * Note the logic here must match the logic path taken in _pygi_argument_to_object. + */ + if (type_tag == GI_TYPE_TAG_INTERFACE) { + GIBaseInfo *info = g_type_info_get_interface (&type_info); + GIInfoType info_type = g_base_info_get_type (info); + + if (info_type == GI_INFO_TYPE_STRUCT || + info_type == GI_INFO_TYPE_BOXED || + info_type == GI_INFO_TYPE_UNION) { + + GType gtype = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo *) info); + gboolean is_foreign = (info_type == GI_INFO_TYPE_STRUCT) && + (g_struct_info_is_foreign ((GIStructInfo *) info)); + + if (!is_foreign && !g_type_is_a (gtype, G_TYPE_VALUE) && + g_type_is_a (gtype, G_TYPE_BOXED)) { + pass_struct_by_ref = TRUE; + } + } + + g_base_info_unref (info); } - - item = _pygi_argument_to_object (&arg, &type_info, transfer); - + + if (pass_struct_by_ref) { + /* transfer everything will ensure the struct is not copied when wrapped. */ + item = _pygi_argument_to_object (&arg, &type_info, GI_TRANSFER_EVERYTHING); + if (item && PyObject_IsInstance (item, (PyObject *) &PyGIBoxed_Type)) { + ((PyGBoxed *)item)->free_on_dealloc = FALSE; + pass_by_ref_structs = g_slist_prepend (pass_by_ref_structs, item); + } + + } else { + item = _pygi_argument_to_object (&arg, &type_info, GI_TRANSFER_NOTHING); + } + if (free_array) { g_array_free (arg.v_pointer, FALSE); } - if (item == NULL) { + PyErr_Print (); goto out; } PyTuple_SetItem(params, i, item); @@ -166,18 +214,35 @@ pygi_signal_closure_marshal(GClosure *closure, } Py_DECREF(ret); + /* Run through the list of structs which have been passed by reference and + * check if they are being held longer than the duration of the callback + * execution. This is determined if the ref count is greater than 1. + * A single ref is held by the argument list and any more would mean the callback + * stored a ref somewhere else. In this case we make an internal copy of + * the boxed struct so Python can own the memory to it. + */ + list_item = pass_by_ref_structs; + while (list_item) { + PyObject *item = list_item->data; + if (Py_REFCNT (item) > 1) { + pygi_boxed_copy_in_place ((PyGIBoxed *)item); + } + list_item = g_slist_next (list_item); + } + out: + g_slist_free (pass_by_ref_structs); Py_DECREF(params); PyGILState_Release(state); } GClosure * -pygi_signal_closure_new_real (PyGObject *instance, - GType g_type, - const gchar *signal_name, - PyObject *callback, - PyObject *extra_args, - PyObject *swap_data) +pygi_signal_closure_new (PyGObject *instance, + GType g_type, + const gchar *signal_name, + PyObject *callback, + PyObject *extra_args, + PyObject *swap_data) { GClosure *closure = NULL; PyGISignalClosure *pygi_closure = NULL; diff --git a/gi/pygi-signal-closure.h b/gi/pygi-signal-closure.h index ffdd29c..9ba8d6d 100644 --- a/gi/pygi-signal-closure.h +++ b/gi/pygi-signal-closure.h @@ -24,7 +24,9 @@ #ifndef __PYGI_SIGNAL_CLOSURE_H__ #define __PYGI_SIGNAL_CLOSURE_H__ -#include "pygi.h" +#include +#include +#include "pygobject-internal.h" G_BEGIN_DECLS @@ -35,12 +37,13 @@ typedef struct _PyGISignalClosure GISignalInfo *signal_info; } PyGISignalClosure; -GClosure * pygi_signal_closure_new_real (PyGObject *instance, - GType g_type, - const gchar *sig_name, - PyObject *callback, - PyObject *extra_args, - PyObject *swap_data); +GClosure * +pygi_signal_closure_new (PyGObject *instance, + GType g_type, + const gchar *sig_name, + PyObject *callback, + PyObject *extra_args, + PyObject *swap_data); G_END_DECLS diff --git a/gi/pygi-source.c b/gi/pygi-source.c index 66bbc3c..c85386d 100644 --- a/gi/pygi-source.c +++ b/gi/pygi-source.c @@ -23,12 +23,11 @@ * IN THE SOFTWARE. */ -#define NO_IMPORT -#include "pygobject.h" - -#include "pygi-private.h" -#include "pyglib.h" -#include "pyglib-private.h" +#include "pygi-info.h" +#include "pygi-boxed.h" +#include "pygi-type.h" +#include "pygi-basictype.h" +#include "pygboxed.h" #include "pygi-source.h" typedef struct @@ -38,7 +37,7 @@ typedef struct } PyGRealSource; static gboolean -pyg_source_prepare(GSource *source, gint *timeout) +source_prepare(GSource *source, gint *timeout) { PyGRealSource *pysource = (PyGRealSource *)source; PyObject *t; @@ -46,7 +45,7 @@ pyg_source_prepare(GSource *source, gint *timeout) gboolean got_err = TRUE; PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); t = PyObject_CallMethod(pysource->obj, "prepare", NULL); @@ -66,13 +65,16 @@ pyg_source_prepare(GSource *source, gint *timeout) goto bail; } - ret = PyObject_IsTrue(PyTuple_GET_ITEM(t, 0)); - *timeout = PYGLIB_PyLong_AsLong(PyTuple_GET_ITEM(t, 1)); + if (!pygi_gboolean_from_py (PyTuple_GET_ITEM(t, 0), &ret)) { + ret = FALSE; + goto bail; + } - if (*timeout == -1 && PyErr_Occurred()) { - ret = FALSE; - goto bail; - } + if (!pygi_gint_from_py (PyTuple_GET_ITEM(t, 1), timeout)) + { + ret = FALSE; + goto bail; + } got_err = FALSE; @@ -82,20 +84,20 @@ bail: Py_XDECREF(t); - pyglib_gil_state_release(state); + PyGILState_Release(state); return ret; } static gboolean -pyg_source_check(GSource *source) +source_check(GSource *source) { PyGRealSource *pysource = (PyGRealSource *)source; PyObject *t; gboolean ret; PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); t = PyObject_CallMethod(pysource->obj, "check", NULL); @@ -107,20 +109,20 @@ pyg_source_check(GSource *source) Py_DECREF(t); } - pyglib_gil_state_release(state); + PyGILState_Release(state); return ret; } static gboolean -pyg_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) +source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) { PyGRealSource *pysource = (PyGRealSource *)source; PyObject *func, *args, *tuple, *t; gboolean ret; PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); if (callback) { tuple = user_data; @@ -142,19 +144,19 @@ pyg_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) Py_DECREF(t); } - pyglib_gil_state_release(state); + PyGILState_Release(state); return ret; } static void -pyg_source_finalize(GSource *source) +source_finalize(GSource *source) { PyGRealSource *pysource = (PyGRealSource *)source; PyObject *func, *t; PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); func = PyObject_GetAttrString(pysource->obj, "finalize"); if (func) { @@ -166,24 +168,71 @@ pyg_source_finalize(GSource *source) } else { Py_DECREF(t); } + } else { + PyErr_Clear (); } - pyglib_gil_state_release(state); + PyGILState_Release(state); } static GSourceFuncs pyg_source_funcs = { - pyg_source_prepare, - pyg_source_check, - pyg_source_dispatch, - pyg_source_finalize + source_prepare, + source_check, + source_dispatch, + source_finalize }; +/** + * _pyglib_destroy_notify: + * @user_data: a PyObject pointer. + * + * A function that can be used as a GDestroyNotify callback that will + * call Py_DECREF on the data. + */ +static void +destroy_notify(gpointer user_data) +{ + PyObject *obj = (PyObject *)user_data; + PyGILState_STATE state; + + state = PyGILState_Ensure(); + Py_DECREF(obj); + PyGILState_Release(state); +} + +static gboolean +handler_marshal(gpointer user_data) +{ + PyObject *tuple, *ret; + gboolean res; + PyGILState_STATE state; + + g_return_val_if_fail(user_data != NULL, FALSE); + + state = PyGILState_Ensure(); + + tuple = (PyObject *)user_data; + ret = PyObject_CallObject(PyTuple_GetItem(tuple, 0), + PyTuple_GetItem(tuple, 1)); + if (!ret) { + PyErr_Print(); + res = FALSE; + } else { + res = PyObject_IsTrue(ret); + Py_DECREF(ret); + } + + PyGILState_Release(state); + + return res; +} + PyObject * -pyg_source_set_callback(PyGObject *self_module, PyObject *args) +pygi_source_set_callback (PyGObject *self_module, PyObject *args) { PyObject *self, *first, *callback, *cbargs = NULL, *data; - gint len; + Py_ssize_t len; len = PyTuple_Size (args); if (len < 2) { @@ -218,30 +267,42 @@ pyg_source_set_callback(PyGObject *self_module, PyObject *args) return NULL; g_source_set_callback(pyg_boxed_get (self, GSource), - _pyglib_handler_marshal, data, - _pyglib_destroy_notify); + handler_marshal, data, + destroy_notify); Py_INCREF(Py_None); return Py_None; } /** - * pyg_source_new: + * pygi_source_new: * * Wrap the un-bindable g_source_new() and provide wrapper callbacks in the * GSourceFuncs which call back to Python. + * + * Returns NULL on error and sets an exception. */ PyObject* -pyg_source_new (void) +pygi_source_new (PyObject *self, PyObject *args) { - PyGRealSource *source = NULL; - PyObject *py_type; + PyGRealSource *source; + PyObject *py_type, *boxed; - source = (PyGRealSource*) g_source_new (&pyg_source_funcs, sizeof (PyGRealSource)); + g_assert (args == NULL); + + py_type = pygi_type_import_by_name ("GLib", "Source"); + if (!py_type) + return NULL; - py_type = _pygi_type_import_by_name ("GLib", "Source"); + source = (PyGRealSource*) g_source_new (&pyg_source_funcs, sizeof (PyGRealSource)); /* g_source_new uses malloc, not slices */ - source->obj = _pygi_boxed_new ( (PyTypeObject *) py_type, source, FALSE, 0); + boxed = pygi_boxed_new ( (PyTypeObject *) py_type, source, TRUE, 0); + Py_DECREF (py_type); + if (!boxed) { + g_source_unref ((GSource *)source); + return NULL; + } + source->obj = boxed; return source->obj; } diff --git a/gi/pygi-source.h b/gi/pygi-source.h index a602767..5d60c63 100644 --- a/gi/pygi-source.h +++ b/gi/pygi-source.h @@ -24,8 +24,8 @@ #ifndef __PYGI_SOURCE_H__ #define __PYGI_SOURCE_H__ -PyObject *pyg_source_new (void); -PyObject *pyg_source_set_callback (PyGObject *self, PyObject *args); +PyObject *pygi_source_new (PyObject *self, PyObject *args); +PyObject *pygi_source_set_callback (PyGObject *self, PyObject *args); #endif /* __PYGI_SOURCE_H__ */ diff --git a/gi/pygi-struct-marshal.c b/gi/pygi-struct-marshal.c new file mode 100644 index 0000000..885f5d7 --- /dev/null +++ b/gi/pygi-struct-marshal.c @@ -0,0 +1,646 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include + +#include "pygi-struct-marshal.h" +#include "pygi-struct.h" +#include "pygi-foreign.h" +#include "pygi-value.h" +#include "pygi-type.h" +#include "pygi-boxed.h" +#include "pygi-info.h" +#include "pygpointer.h" +#include "pygboxed.h" +#include "pygi-type.h" + +/* + * _is_union_member - check to see if the py_arg is actually a member of the + * expected C union + */ +static gboolean +_is_union_member (GIInterfaceInfo *interface_info, PyObject *py_arg) { + gint i; + gint n_fields; + GIUnionInfo *union_info; + GIInfoType info_type; + gboolean is_member = FALSE; + + info_type = g_base_info_get_type (interface_info); + + if (info_type != GI_INFO_TYPE_UNION) + return FALSE; + + union_info = (GIUnionInfo *) interface_info; + n_fields = g_union_info_get_n_fields (union_info); + + for (i = 0; i < n_fields; i++) { + GIFieldInfo *field_info; + GITypeInfo *field_type_info; + + field_info = g_union_info_get_field (union_info, i); + field_type_info = g_field_info_get_type (field_info); + + /* we can only check if the members are interfaces */ + if (g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_INTERFACE) { + GIInterfaceInfo *field_iface_info; + PyObject *py_type; + + field_iface_info = g_type_info_get_interface (field_type_info); + py_type = pygi_type_import_by_gi_info ((GIBaseInfo *) field_iface_info); + + if (py_type != NULL && PyObject_IsInstance (py_arg, py_type)) { + is_member = TRUE; + } + + Py_XDECREF (py_type); + g_base_info_unref ( ( GIBaseInfo *) field_iface_info); + } + + g_base_info_unref ( ( GIBaseInfo *) field_type_info); + g_base_info_unref ( ( GIBaseInfo *) field_info); + + if (is_member) + break; + } + + return is_member; +} + + +/* + * GValue from Python + */ + +/* pygi_arg_gvalue_from_py_marshal: + * py_arg: (in): + * arg: (out): + * transfer: + * copy_reference: TRUE if arg should use the pointer reference held by py_arg + * when it is already holding a GValue vs. copying the value. + */ +gboolean +pygi_arg_gvalue_from_py_marshal (PyObject *py_arg, + GIArgument *arg, + GITransfer transfer, + gboolean copy_reference) { + GValue *value; + GType object_type; + + object_type = pyg_type_from_object_strict ( (PyObject *) Py_TYPE (py_arg), FALSE); + if (object_type == G_TYPE_INVALID) { + PyErr_SetString (PyExc_RuntimeError, "unable to retrieve object's GType"); + return FALSE; + } + + /* if already a gvalue, use that, else marshal into gvalue */ + if (object_type == G_TYPE_VALUE) { + GValue *source_value = pyg_boxed_get (py_arg, GValue); + if (copy_reference) { + value = source_value; + } else { + value = g_slice_new0 (GValue); + g_value_init (value, G_VALUE_TYPE (source_value)); + g_value_copy (source_value, value); + } + } else { + value = g_slice_new0 (GValue); + g_value_init (value, object_type); + if (pyg_value_from_pyobject_with_error (value, py_arg) < 0) { + g_slice_free (GValue, value); + return FALSE; + } + } + + arg->v_pointer = value; + return TRUE; +} + +void +pygi_arg_gvalue_from_py_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + /* Note py_arg can be NULL for hash table which is a bug. */ + if (was_processed && py_arg != NULL) { + GType py_object_type = + pyg_type_from_object_strict ( (PyObject *) Py_TYPE (py_arg), FALSE); + + /* When a GValue was not passed, it means the marshalers created a new + * one to pass in, clean this up. + */ + if (py_object_type != G_TYPE_VALUE) { + g_value_unset ((GValue *) data); + g_slice_free (GValue, data); + } + } +} + +/* pygi_arg_gclosure_from_py_marshal: + * py_arg: (in): + * arg: (out): + */ +static gboolean +pygi_arg_gclosure_from_py_marshal (PyObject *py_arg, + GIArgument *arg, + GITransfer transfer) +{ + GClosure *closure; + GType object_gtype = pyg_type_from_object_strict (py_arg, FALSE); + + if ( !(PyCallable_Check(py_arg) || + g_type_is_a (object_gtype, G_TYPE_CLOSURE))) { + PyErr_Format (PyExc_TypeError, "Must be callable, not %s", + Py_TYPE (py_arg)->tp_name); + return FALSE; + } + + if (g_type_is_a (object_gtype, G_TYPE_CLOSURE)) { + closure = (GClosure *)pyg_boxed_get (py_arg, void); + /* Make sure we own a ref which is held until cleanup. */ + if (closure != NULL) { + g_closure_ref (closure); + } + } else { + PyObject *functools; + PyObject *partial = NULL; + + functools = PyImport_ImportModule ("functools"); + if (functools) { + partial = PyObject_GetAttrString (functools, "partial"); + Py_DECREF (functools); + } + + if (partial && PyObject_IsInstance (py_arg, partial) > 0 && PyObject_HasAttrString (py_arg, "__gtk_template__")) { + PyObject *partial_func; + PyObject *partial_args; + PyObject *partial_keywords; + PyObject *swap_data; + + partial_func = PyObject_GetAttrString (py_arg, "func"); + partial_args = PyObject_GetAttrString (py_arg, "args"); + partial_keywords = PyObject_GetAttrString (py_arg, "keywords"); + swap_data = PyDict_GetItemString (partial_keywords, "swap_data"); + + closure = pyg_closure_new (partial_func, partial_args, swap_data); + + Py_DECREF (partial_func); + Py_DECREF (partial_args); + Py_DECREF (partial_keywords); + g_closure_ref (closure); + g_closure_sink (closure); + } else { + closure = pyg_closure_new (py_arg, NULL, NULL); + g_closure_ref (closure); + g_closure_sink (closure); + } + + if (partial) { + Py_DECREF (partial); + } + } + + if (closure == NULL) { + PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed"); + return FALSE; + } + + /* Add an additional ref when transfering everything to the callee. */ + if (transfer == GI_TRANSFER_EVERYTHING) { + g_closure_ref (closure); + } + + arg->v_pointer = closure; + return TRUE; +} + +static void +arg_gclosure_from_py_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer cleanup_data, + gboolean was_processed) +{ + if (cleanup_data != NULL) { + g_closure_unref (cleanup_data); + } +} + +/* pygi_arg_struct_from_py_marshal: + * + * Dispatcher to various sub marshalers + */ +gboolean +pygi_arg_struct_from_py_marshal (PyObject *py_arg, + GIArgument *arg, + const gchar *arg_name, + GIBaseInfo *interface_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, + gboolean copy_reference, + gboolean is_foreign, + gboolean is_pointer) +{ + gboolean is_union = FALSE; + + if (py_arg == Py_None) { + arg->v_pointer = NULL; + return TRUE; + } + + /* FIXME: handle this large if statement in the cache + * and set the correct marshaller + */ + + if (g_type_is_a (g_type, G_TYPE_CLOSURE)) { + return pygi_arg_gclosure_from_py_marshal (py_arg, arg, transfer); + } else if (g_type_is_a (g_type, G_TYPE_VALUE)) { + return pygi_arg_gvalue_from_py_marshal(py_arg, + arg, + transfer, + copy_reference); + } else if (is_foreign) { + PyObject *success; + success = pygi_struct_foreign_convert_to_g_argument (py_arg, + interface_info, + transfer, + arg); + + return (success == Py_None); + } else if (!PyObject_IsInstance (py_arg, py_type)) { + /* first check to see if this is a member of the expected union */ + is_union = _is_union_member (interface_info, py_arg); + if (!is_union) { + goto type_error; + } + } + + if (g_type_is_a (g_type, G_TYPE_BOXED)) { + /* Additionally use pyg_type_from_object to pull the stashed __gtype__ + * attribute off of the input argument for type checking. This is needed + * to work around type discrepancies in cases with aliased (typedef) types. + * e.g. GtkAllocation, GdkRectangle. + * See: https://bugzilla.gnomethere are .org/show_bug.cgi?id=707140 + */ + if (is_union || pyg_boxed_check (py_arg, g_type) || + g_type_is_a (pyg_type_from_object (py_arg), g_type)) { + arg->v_pointer = pyg_boxed_get (py_arg, void); + if (transfer == GI_TRANSFER_EVERYTHING) { + arg->v_pointer = g_boxed_copy (g_type, arg->v_pointer); + } + } else { + goto type_error; + } + + } else if (g_type_is_a (g_type, G_TYPE_POINTER) || + g_type_is_a (g_type, G_TYPE_VARIANT) || + g_type == G_TYPE_NONE) { + g_warn_if_fail (g_type_is_a (g_type, G_TYPE_VARIANT) || !is_pointer || transfer == GI_TRANSFER_NOTHING); + + if (g_type_is_a (g_type, G_TYPE_VARIANT) && + pyg_type_from_object (py_arg) != G_TYPE_VARIANT) { + PyErr_SetString (PyExc_TypeError, "expected GLib.Variant"); + return FALSE; + } + arg->v_pointer = pyg_pointer_get (py_arg, void); + if (transfer == GI_TRANSFER_EVERYTHING) { + g_variant_ref ((GVariant *)arg->v_pointer); + } + + } else { + PyErr_Format (PyExc_NotImplementedError, + "structure type '%s' is not supported yet", + g_type_name(g_type)); + return FALSE; + } + return TRUE; + +type_error: + { + gchar *type_name = _pygi_g_base_info_get_fullname (interface_info); + PyObject *module = PyObject_GetAttrString(py_arg, "__module__"); + + PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s", + arg_name ? arg_name : "self", + type_name, + module ? PyUnicode_AsUTF8(module) : "", + module ? "." : "", + Py_TYPE (py_arg)->tp_name); + if (module) + Py_DECREF (module); + g_free (type_name); + return FALSE; + } +} + +static gboolean +arg_struct_from_py_marshal_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + + gboolean res = pygi_arg_struct_from_py_marshal (py_arg, + arg, + arg_cache->arg_name, + iface_cache->interface_info, + iface_cache->g_type, + iface_cache->py_type, + arg_cache->transfer, + TRUE, /*copy_reference*/ + iface_cache->is_foreign, + arg_cache->is_pointer); + + /* Assume struct marshaling is always a pointer and assign cleanup_data + * here rather than passing it further down the chain. + */ + *cleanup_data = arg->v_pointer; + return res; +} + +static void +arg_foreign_from_py_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + if (state->failed && was_processed) { + pygi_struct_foreign_release ( + ( (PyGIInterfaceCache *)arg_cache)->interface_info, + data); + } +} + +static PyObject * +pygi_arg_struct_to_py_marshaller (GIArgument *arg, + GIInterfaceInfo *interface_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, + gboolean is_allocated, + gboolean is_foreign) +{ + PyObject *py_obj = NULL; + + if (arg->v_pointer == NULL) { + Py_RETURN_NONE; + } + + if (g_type_is_a (g_type, G_TYPE_VALUE)) { + py_obj = pyg_value_as_pyobject (arg->v_pointer, is_allocated); + } else if (is_foreign) { + py_obj = pygi_struct_foreign_convert_from_g_argument (interface_info, + transfer, + arg->v_pointer); + } else if (g_type_is_a (g_type, G_TYPE_BOXED)) { + if (py_type) { + py_obj = pygi_boxed_new ((PyTypeObject *) py_type, + arg->v_pointer, + transfer == GI_TRANSFER_EVERYTHING || is_allocated, + is_allocated ? + g_struct_info_get_size(interface_info) : 0); + } + } else if (g_type_is_a (g_type, G_TYPE_POINTER)) { + if (py_type == NULL || + !PyType_IsSubtype ((PyTypeObject *) py_type, &PyGIStruct_Type)) { + g_warn_if_fail (transfer == GI_TRANSFER_NOTHING); + py_obj = pyg_pointer_new (g_type, arg->v_pointer); + } else { + py_obj = pygi_struct_new ( (PyTypeObject *) py_type, + arg->v_pointer, + transfer == GI_TRANSFER_EVERYTHING); + } + } else if (g_type_is_a (g_type, G_TYPE_VARIANT)) { + /* Note: sink the variant (add a ref) only if we are not transfered ownership. + * GLib.Variant overrides __del__ which will then call "g_variant_unref" for + * cleanup in either case. */ + if (py_type) { + if (transfer == GI_TRANSFER_NOTHING) { + g_variant_ref_sink (arg->v_pointer); + } + py_obj = pygi_struct_new ((PyTypeObject *) py_type, + arg->v_pointer, + FALSE); + } + } else if (g_type == G_TYPE_NONE) { + if (py_type) { + py_obj = pygi_struct_new ((PyTypeObject *) py_type, + arg->v_pointer, + transfer == GI_TRANSFER_EVERYTHING || is_allocated); + } + } else { + PyErr_Format (PyExc_NotImplementedError, + "structure type '%s' is not supported yet", + g_type_name (g_type)); + } + + return py_obj; +} + +PyObject * +pygi_arg_struct_to_py_marshal (GIArgument *arg, + GIInterfaceInfo *interface_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, + gboolean is_allocated, + gboolean is_foreign) +{ + PyObject *ret = pygi_arg_struct_to_py_marshaller (arg, interface_info, g_type, py_type, transfer, is_allocated, is_foreign); + + if (ret && PyObject_IsInstance (ret, (PyObject *) &PyGIBoxed_Type) && transfer == GI_TRANSFER_NOTHING) + pygi_boxed_copy_in_place ((PyGIBoxed *) ret); + + return ret; +}; + +static PyObject * +arg_struct_to_py_marshal_adapter (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + GIArgument *arg, + gpointer *cleanup_data) +{ + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + PyObject *ret; + + ret = pygi_arg_struct_to_py_marshaller (arg, + iface_cache->interface_info, + iface_cache->g_type, + iface_cache->py_type, + arg_cache->transfer, + arg_cache->is_caller_allocates, + iface_cache->is_foreign); + + *cleanup_data = ret; + + return ret; +} + +static void +arg_foreign_to_py_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed) +{ + if (!was_processed && arg_cache->transfer == GI_TRANSFER_EVERYTHING) { + pygi_struct_foreign_release ( + ( (PyGIInterfaceCache *)arg_cache)->interface_info, + data); + } +} + +static void +arg_boxed_to_py_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + gpointer cleanup_data, + gpointer data, + gboolean was_processed) +{ + if (arg_cache->transfer == GI_TRANSFER_NOTHING) + pygi_boxed_copy_in_place ((PyGIBoxed *) cleanup_data); +} + +static gboolean +arg_type_class_from_py_marshal (PyGIInvokeState *state, + PyGICallableCache *callable_cache, + PyGIArgCache *arg_cache, + PyObject *py_arg, + GIArgument *arg, + gpointer *cleanup_data) +{ + GType gtype = pyg_type_from_object (py_arg); + + if (G_TYPE_IS_CLASSED (gtype)) { + arg->v_pointer = g_type_class_ref (gtype); + *cleanup_data = arg->v_pointer; + return TRUE; + } else { + PyErr_Format (PyExc_TypeError, + "Unable to retrieve a GObject type class from \"%s\".", + Py_TYPE(py_arg)->tp_name); + return FALSE; + } +} + +static void +arg_type_class_from_py_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed) +{ + if (was_processed) { + g_type_class_unref (data); + } +} + +static void +arg_struct_from_py_setup (PyGIArgCache *arg_cache, + GIInterfaceInfo *iface_info, + GITransfer transfer) +{ + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + + if (g_struct_info_is_gtype_struct ((GIStructInfo*)iface_info)) { + arg_cache->from_py_marshaller = arg_type_class_from_py_marshal; + /* Since we always add a ref in the marshalling, only unref the + * GTypeClass when we don't transfer ownership. */ + if (transfer == GI_TRANSFER_NOTHING) { + arg_cache->from_py_cleanup = arg_type_class_from_py_cleanup; + } + + } else { + arg_cache->from_py_marshaller = arg_struct_from_py_marshal_adapter; + + if (g_type_is_a (iface_cache->g_type, G_TYPE_CLOSURE)) { + arg_cache->from_py_cleanup = arg_gclosure_from_py_cleanup; + + } else if (iface_cache->g_type == G_TYPE_VALUE) { + arg_cache->from_py_cleanup = pygi_arg_gvalue_from_py_cleanup; + + } else if (iface_cache->is_foreign) { + arg_cache->from_py_cleanup = arg_foreign_from_py_cleanup; + } + } +} + +static void +arg_struct_to_py_setup (PyGIArgCache *arg_cache, + GIInterfaceInfo *iface_info, + GITransfer transfer) +{ + PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache; + + if (arg_cache->to_py_marshaller == NULL) { + arg_cache->to_py_marshaller = arg_struct_to_py_marshal_adapter; + } + + iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info); + + if (iface_cache->is_foreign) + arg_cache->to_py_cleanup = arg_foreign_to_py_cleanup; + else if (!g_type_is_a (iface_cache->g_type, G_TYPE_VALUE) && + iface_cache->py_type && + g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) + arg_cache->to_py_cleanup = arg_boxed_to_py_cleanup; +} + +PyGIArgCache * +pygi_arg_struct_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info) +{ + PyGIArgCache *cache = NULL; + PyGIInterfaceCache *iface_cache; + + cache = pygi_arg_interface_new_from_info (type_info, + arg_info, + transfer, + direction, + iface_info); + if (cache == NULL) + return NULL; + + iface_cache = (PyGIInterfaceCache *)cache; + iface_cache->is_foreign = (g_base_info_get_type ((GIBaseInfo *) iface_info) == GI_INFO_TYPE_STRUCT) && + (g_struct_info_is_foreign ((GIStructInfo*) iface_info)); + + if (direction & PYGI_DIRECTION_FROM_PYTHON) { + arg_struct_from_py_setup (cache, iface_info, transfer); + } + + if (direction & PYGI_DIRECTION_TO_PYTHON) { + arg_struct_to_py_setup (cache, iface_info, transfer); + } + + return cache; +} diff --git a/gi/pygi-struct-marshal.h b/gi/pygi-struct-marshal.h new file mode 100644 index 0000000..b2846df --- /dev/null +++ b/gi/pygi-struct-marshal.h @@ -0,0 +1,69 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * Copyright (C) 2011 John (J5) Palmieri + * Copyright (C) 2014 Simon Feltman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_STRUCT_MARSHAL_H__ +#define __PYGI_STRUCT_MARSHAL_H__ + +#include +#include "pygi-cache.h" + +G_BEGIN_DECLS + +PyGIArgCache *pygi_arg_struct_new_from_info (GITypeInfo *type_info, + GIArgInfo *arg_info, /* may be null */ + GITransfer transfer, + PyGIDirection direction, + GIInterfaceInfo *iface_info); + + +gboolean pygi_arg_gvalue_from_py_marshal (PyObject *py_arg, /*in*/ + GIArgument *arg, /*out*/ + GITransfer transfer, + gboolean is_allocated); + +gboolean pygi_arg_struct_from_py_marshal (PyObject *py_arg, + GIArgument *arg, + const gchar *arg_name, + GIBaseInfo *interface_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, + gboolean is_allocated, + gboolean is_foreign, + gboolean is_pointer); + +PyObject *pygi_arg_struct_to_py_marshal (GIArgument *arg, + GIInterfaceInfo *interface_info, + GType g_type, + PyObject *py_type, + GITransfer transfer, + gboolean is_allocated, + gboolean is_foreign); + +/* Needed for hack in pygi-arg-garray.c */ +void pygi_arg_gvalue_from_py_cleanup (PyGIInvokeState *state, + PyGIArgCache *arg_cache, + PyObject *py_arg, + gpointer data, + gboolean was_processed); + +G_END_DECLS + +#endif /*__PYGI_STRUCT_MARSHAL_H__*/ diff --git a/gi/pygi-struct.c b/gi/pygi-struct.c index 29ea38e..f6e75e3 100644 --- a/gi/pygi-struct.c +++ b/gi/pygi-struct.c @@ -16,39 +16,80 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" +#include "pygi-struct.h" +#include "pygi-foreign.h" +#include "pygi-info.h" +#include "pygi-type.h" +#include "pygi-type.h" +#include "pygpointer.h" +#include "pygi-util.h" -#include #include -#include + + +static GIBaseInfo * +struct_get_info (PyTypeObject *type) +{ + PyObject *py_info; + GIBaseInfo *info = NULL; + + py_info = PyObject_GetAttrString ((PyObject *)type, "__info__"); + if (py_info == NULL) { + return NULL; + } + if (!PyObject_TypeCheck (py_info, &PyGIStructInfo_Type) && + !PyObject_TypeCheck (py_info, &PyGIUnionInfo_Type)) { + PyErr_Format (PyExc_TypeError, "attribute '__info__' must be %s or %s, not %s", + PyGIStructInfo_Type.tp_name, + PyGIUnionInfo_Type.tp_name, + Py_TYPE(py_info)->tp_name); + goto out; + } + + info = ( (PyGIBaseInfo *) py_info)->info; + g_base_info_ref (info); + +out: + Py_DECREF (py_info); + + return info; +} static void -_struct_dealloc (PyGIStruct *self) +struct_dealloc (PyGIStruct *self) { - GIBaseInfo *info = _pygi_object_get_gi_info ( - (PyObject *) self, - &PyGIStructInfo_Type); + GIBaseInfo *info; + PyObject *error_type, *error_value, *error_traceback; + gboolean have_error = !!PyErr_Occurred (); + + if (have_error) + PyErr_Fetch (&error_type, &error_value, &error_traceback); + + info = struct_get_info (Py_TYPE (self)); if (info != NULL && g_struct_info_is_foreign ( (GIStructInfo *) info)) { - pygi_struct_foreign_release (info, ( (PyGPointer *) self)->pointer); + pygi_struct_foreign_release (info, pyg_pointer_get_ptr (self)); } else if (self->free_on_dealloc) { - g_free ( ( (PyGPointer *) self)->pointer); + g_free (pyg_pointer_get_ptr (self)); } - g_base_info_unref (info); + if (info != NULL) { + g_base_info_unref (info); + } + + if (have_error) + PyErr_Restore (error_type, error_value, error_traceback); - Py_TYPE( (PyGPointer *) self )->tp_free ( (PyObject *) self); + Py_TYPE (self)->tp_free ((PyObject *)self); } static PyObject * -_struct_new (PyTypeObject *type, - PyObject *args, - PyObject *kwargs) +struct_new (PyTypeObject *type, + PyObject *args, + PyObject *kwargs) { static char *kwlist[] = { NULL }; @@ -61,7 +102,7 @@ _struct_new (PyTypeObject *type, return NULL; } - info = _pygi_object_get_gi_info ( (PyObject *) type, &PyGIStructInfo_Type); + info = struct_get_info ( type ); if (info == NULL) { if (PyErr_ExceptionMatches (PyExc_AttributeError)) { PyErr_Format (PyExc_TypeError, "missing introspection information"); @@ -72,7 +113,7 @@ _struct_new (PyTypeObject *type, size = g_struct_info_get_size ( (GIStructInfo *) info); if (size == 0) { PyErr_Format (PyExc_TypeError, - "cannot allocate disguised struct %s.%s; consider adding a constructor to the library or to the overrides", + "struct cannot be created directly; try using a constructor, see: help(%s.%s)", g_base_info_get_namespace (info), g_base_info_get_name (info)); goto out; @@ -83,7 +124,7 @@ _struct_new (PyTypeObject *type, goto out; } - self = _pygi_struct_new (type, pointer, TRUE); + self = pygi_struct_new (type, pointer, TRUE); if (self == NULL) { g_free (pointer); } @@ -95,7 +136,7 @@ out: } static int -_struct_init (PyObject *self, +struct_init (PyObject *self, PyObject *args, PyObject *kwargs) { @@ -103,12 +144,44 @@ _struct_init (PyObject *self, return 0; } -PYGLIB_DEFINE_TYPE("gi.Struct", PyGIStruct_Type, PyGIStruct); +PYGI_DEFINE_TYPE("gi.Struct", PyGIStruct_Type, PyGIStruct); + PyObject * -_pygi_struct_new (PyTypeObject *type, - gpointer pointer, - gboolean free_on_dealloc) +pygi_struct_new_from_g_type (GType g_type, + gpointer pointer, + gboolean free_on_dealloc) +{ + PyGIStruct *self; + PyTypeObject *type; + + type = (PyTypeObject *)pygi_type_import_by_g_type (g_type); + + if (!type) + type = (PyTypeObject *)&PyGIStruct_Type; /* fallback */ + + if (!PyType_IsSubtype (type, &PyGIStruct_Type)) { + PyErr_SetString (PyExc_TypeError, "must be a subtype of gi.Struct"); + return NULL; + } + + self = (PyGIStruct *) type->tp_alloc (type, 0); + if (self == NULL) { + return NULL; + } + + pyg_pointer_set_ptr (self, pointer); + ( (PyGPointer *) self)->gtype = g_type; + self->free_on_dealloc = free_on_dealloc; + + return (PyObject *) self; +} + + +PyObject * +pygi_struct_new (PyTypeObject *type, + gpointer pointer, + gboolean free_on_dealloc) { PyGIStruct *self; GType g_type; @@ -125,25 +198,57 @@ _pygi_struct_new (PyTypeObject *type, g_type = pyg_type_from_object ( (PyObject *) type); + pyg_pointer_set_ptr (self, pointer); ( (PyGPointer *) self)->gtype = g_type; - ( (PyGPointer *) self)->pointer = pointer; self->free_on_dealloc = free_on_dealloc; return (PyObject *) self; } -void -_pygi_struct_register_types (PyObject *m) +static PyObject * +struct_repr(PyGIStruct *self) +{ + PyObject* repr; + GIBaseInfo *info; + PyGPointer *pointer = (PyGPointer *)self; + + info = struct_get_info (Py_TYPE (self)); + if (info == NULL) + return NULL; + + repr = PyUnicode_FromFormat ("<%s.%s object at %p (%s at %p)>", + g_base_info_get_namespace (info), + g_base_info_get_name (info), + self, g_type_name (pointer->gtype), + pointer->pointer); + + g_base_info_unref (info); + + return repr; +} + +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_struct_register_types (PyObject *m) { - Py_TYPE(&PyGIStruct_Type) = &PyType_Type; + Py_SET_TYPE(&PyGIStruct_Type, &PyType_Type); + g_assert (Py_TYPE (&PyGPointer_Type) != NULL); PyGIStruct_Type.tp_base = &PyGPointer_Type; - PyGIStruct_Type.tp_new = (newfunc) _struct_new; - PyGIStruct_Type.tp_init = (initproc) _struct_init; - PyGIStruct_Type.tp_dealloc = (destructor) _struct_dealloc; + PyGIStruct_Type.tp_new = (newfunc) struct_new; + PyGIStruct_Type.tp_init = (initproc) struct_init; + PyGIStruct_Type.tp_dealloc = (destructor) struct_dealloc; PyGIStruct_Type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE); + PyGIStruct_Type.tp_repr = (reprfunc)struct_repr; + + if (PyType_Ready (&PyGIStruct_Type) < 0) + return -1; + Py_INCREF ((PyObject *) &PyGIStruct_Type); + if (PyModule_AddObject (m, "Struct", (PyObject *) &PyGIStruct_Type) < 0) { + Py_DECREF ((PyObject *) &PyGIStruct_Type); + return -1; + } - if (PyType_Ready (&PyGIStruct_Type)) - return; - if (PyModule_AddObject (m, "Struct", (PyObject *) &PyGIStruct_Type)) - return; + return 0; } diff --git a/gi/pygi-struct.h b/gi/pygi-struct.h index 963d05a..27230a9 100644 --- a/gi/pygi-struct.h +++ b/gi/pygi-struct.h @@ -14,26 +14,35 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGI_STRUCT_H__ #define __PYGI_STRUCT_H__ #include +#include G_BEGIN_DECLS +typedef struct { + PyGPointer base; + gboolean free_on_dealloc; +} PyGIStruct; + extern PyTypeObject PyGIStruct_Type; PyObject * -_pygi_struct_new (PyTypeObject *type, - gpointer pointer, - gboolean free_on_dealloc); +pygi_struct_new (PyTypeObject *type, + gpointer pointer, + gboolean free_on_dealloc); + +PyObject * +pygi_struct_new_from_g_type (GType g_type, + gpointer pointer, + gboolean free_on_dealloc); -void _pygi_struct_register_types (PyObject *m); +int pygi_struct_register_types (PyObject *m); G_END_DECLS diff --git a/gi/pygi-type.c b/gi/pygi-type.c index dfaadb0..619c6a2 100644 --- a/gi/pygi-type.c +++ b/gi/pygi-type.c @@ -1,9 +1,6 @@ /* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2009 Simon van der Linden - * - * pygi-type.c: helpers to lookup Python wrappers from GType and GIBaseInfo. + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,19 +13,27 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#include "pygi-private.h" +#include -#include +#include "pygobject-object.h" +#include "pygboxed.h" +#include "pygenum.h" +#include "pygflags.h" +#include "pygparamspec.h" +#include "pygi-util.h" +#include "pygpointer.h" +#include "pyginterface.h" +#include "pygi-type.h" +#include "pygi-value.h" +#include "pygi-basictype.h" PyObject * -_pygi_type_import_by_name (const char *namespace_, - const char *name) +pygi_type_import_by_name (const char *namespace_, + const char *name) { gchar *module_name; PyObject *py_module; @@ -52,7 +57,7 @@ _pygi_type_import_by_name (const char *namespace_, } PyObject * -pygi_type_import_by_g_type_real (GType g_type) +pygi_type_import_by_g_type (GType g_type) { GIRepository *repository; GIBaseInfo *info; @@ -65,21 +70,21 @@ pygi_type_import_by_g_type_real (GType g_type) return NULL; } - type = _pygi_type_import_by_gi_info (info); + type = pygi_type_import_by_gi_info (info); g_base_info_unref (info); return type; } PyObject * -_pygi_type_import_by_gi_info (GIBaseInfo *info) +pygi_type_import_by_gi_info (GIBaseInfo *info) { - return _pygi_type_import_by_name (g_base_info_get_namespace (info), - g_base_info_get_name (info)); + return pygi_type_import_by_name (g_base_info_get_namespace (info), + g_base_info_get_name (info)); } PyObject * -_pygi_type_get_from_g_type (GType g_type) +pygi_type_get_from_g_type (GType g_type) { PyObject *py_g_type; PyObject *py_type; @@ -91,7 +96,7 @@ _pygi_type_get_from_g_type (GType g_type) py_type = PyObject_GetAttrString (py_g_type, "pytype"); if (py_type == Py_None) { - py_type = pygi_type_import_by_g_type_real (g_type); + py_type = pygi_type_import_by_g_type (g_type); } Py_DECREF (py_g_type); @@ -99,61 +104,1279 @@ _pygi_type_get_from_g_type (GType g_type) return py_type; } -/* _pygi_get_py_type_hint +/* -------------- __gtype__ objects ---------------------------- */ + +typedef struct { + PyObject_HEAD + GType type; +} PyGTypeWrapper; + +PYGI_DEFINE_TYPE("gobject.GType", PyGTypeWrapper_Type, PyGTypeWrapper); + +static PyObject* +generic_gsize_richcompare(gsize a, gsize b, int op) +{ + PyObject *res; + + switch (op) { + + case Py_EQ: + res = (a == b) ? Py_True : Py_False; + Py_INCREF(res); + break; + + case Py_NE: + res = (a != b) ? Py_True : Py_False; + Py_INCREF(res); + break; + + + case Py_LT: + res = (a < b) ? Py_True : Py_False; + Py_INCREF(res); + break; + + case Py_LE: + res = (a <= b) ? Py_True : Py_False; + Py_INCREF(res); + break; + + case Py_GT: + res = (a > b) ? Py_True : Py_False; + Py_INCREF(res); + break; + + case Py_GE: + res = (a >= b) ? Py_True : Py_False; + Py_INCREF(res); + break; + + default: + res = Py_NotImplemented; + Py_INCREF(res); + break; + } + + return res; +} + +static PyObject* +pyg_type_wrapper_richcompare(PyObject *self, PyObject *other, int op) +{ + if (Py_TYPE(self) == Py_TYPE(other) && Py_TYPE(self) == &PyGTypeWrapper_Type) + return generic_gsize_richcompare(((PyGTypeWrapper*)self)->type, + ((PyGTypeWrapper*)other)->type, + op); + else { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } +} + +static long +pyg_type_wrapper_hash(PyGTypeWrapper *self) +{ + return (long)self->type; +} + +static PyObject * +pyg_type_wrapper_repr(PyGTypeWrapper *self) +{ + char buf[80]; + const gchar *name = g_type_name(self->type); + + g_snprintf(buf, sizeof(buf), "", + name?name:"invalid", (unsigned long int) self->type); + return PyUnicode_FromString (buf); +} + +static void +pyg_type_wrapper_dealloc(PyGTypeWrapper *self) +{ + PyObject_DEL(self); +} + +static GQuark +_pyg_type_key(GType type) { + GQuark key; + + if (g_type_is_a(type, G_TYPE_INTERFACE)) { + key = pyginterface_type_key; + } else if (g_type_is_a(type, G_TYPE_ENUM)) { + key = pygenum_class_key; + } else if (g_type_is_a(type, G_TYPE_FLAGS)) { + key = pygflags_class_key; + } else if (g_type_is_a(type, G_TYPE_POINTER)) { + key = pygpointer_class_key; + } else if (g_type_is_a(type, G_TYPE_BOXED)) { + key = pygboxed_type_key; + } else { + key = pygobject_class_key; + } + + return key; +} + +static PyObject * +_wrap_g_type_wrapper__get_pytype(PyGTypeWrapper *self, void *closure) +{ + GQuark key; + PyObject *py_type; + + key = _pyg_type_key(self->type); + + py_type = g_type_get_qdata(self->type, key); + if (!py_type) + py_type = Py_None; + + Py_INCREF(py_type); + return py_type; +} + +static int +_wrap_g_type_wrapper__set_pytype(PyGTypeWrapper *self, PyObject* value, void *closure) +{ + GQuark key; + PyObject *py_type; + + key = _pyg_type_key(self->type); + + py_type = g_type_get_qdata(self->type, key); + Py_CLEAR(py_type); + if (value == Py_None) + g_type_set_qdata(self->type, key, NULL); + else if (PyType_Check(value)) { + Py_INCREF(value); + g_type_set_qdata(self->type, key, value); + } else { + PyErr_SetString(PyExc_TypeError, "Value must be None or a type object"); + return -1; + } + + return 0; +} + +static PyObject * +_wrap_g_type_wrapper__get_name(PyGTypeWrapper *self, void *closure) +{ + const char *name = g_type_name(self->type); + return PyUnicode_FromString (name ? name : "invalid"); +} + +static PyObject * +_wrap_g_type_wrapper__get_parent(PyGTypeWrapper *self, void *closure) +{ + return pyg_type_wrapper_new(g_type_parent(self->type)); +} + +static PyObject * +_wrap_g_type_wrapper__get_fundamental(PyGTypeWrapper *self, void *closure) +{ + return pyg_type_wrapper_new(g_type_fundamental(self->type)); +} + +static PyObject * +_wrap_g_type_wrapper__get_children(PyGTypeWrapper *self, void *closure) +{ + guint n_children, i; + GType *children; + PyObject *retval; + + children = g_type_children(self->type, &n_children); + + retval = PyList_New(n_children); + for (i = 0; i < n_children; i++) + PyList_SetItem(retval, i, pyg_type_wrapper_new(children[i])); + g_free(children); + + return retval; +} + +static PyObject * +_wrap_g_type_wrapper__get_interfaces(PyGTypeWrapper *self, void *closure) +{ + guint n_interfaces, i; + GType *interfaces; + PyObject *retval; + + interfaces = g_type_interfaces(self->type, &n_interfaces); + + retval = PyList_New(n_interfaces); + for (i = 0; i < n_interfaces; i++) + PyList_SetItem(retval, i, pyg_type_wrapper_new(interfaces[i])); + g_free(interfaces); + + return retval; +} + +static PyObject * +_wrap_g_type_wrapper__get_depth(PyGTypeWrapper *self, void *closure) +{ + return pygi_guint_to_py (g_type_depth (self->type)); +} + +static PyGetSetDef _PyGTypeWrapper_getsets[] = { + { "pytype", (getter)_wrap_g_type_wrapper__get_pytype, (setter)_wrap_g_type_wrapper__set_pytype }, + { "name", (getter)_wrap_g_type_wrapper__get_name, (setter)0 }, + { "fundamental", (getter)_wrap_g_type_wrapper__get_fundamental, (setter)0 }, + { "parent", (getter)_wrap_g_type_wrapper__get_parent, (setter)0 }, + { "children", (getter)_wrap_g_type_wrapper__get_children, (setter)0 }, + { "interfaces", (getter)_wrap_g_type_wrapper__get_interfaces, (setter)0 }, + { "depth", (getter)_wrap_g_type_wrapper__get_depth, (setter)0 }, + { NULL, (getter)0, (setter)0 } +}; + +static PyObject* +_wrap_g_type_is_interface(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_IS_INTERFACE (self->type)); +} + +static PyObject* +_wrap_g_type_is_classed(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_IS_CLASSED (self->type)); +} + +static PyObject* +_wrap_g_type_is_instantiatable(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_IS_INSTANTIATABLE(self->type)); +} + +static PyObject* +_wrap_g_type_is_derivable(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_IS_DERIVABLE (self->type)); +} + +static PyObject* +_wrap_g_type_is_deep_derivable(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_IS_DEEP_DERIVABLE (self->type)); +} + +static PyObject* +_wrap_g_type_is_abstract(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_IS_ABSTRACT (self->type)); +} + +static PyObject* +_wrap_g_type_is_value_abstract(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_IS_VALUE_ABSTRACT (self->type)); +} + +static PyObject* +_wrap_g_type_is_value_type(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_IS_VALUE_TYPE (self->type)); +} + +static PyObject* +_wrap_g_type_has_value_table(PyGTypeWrapper *self) +{ + return pygi_gboolean_to_py (G_TYPE_HAS_VALUE_TABLE (self->type)); +} + +static PyObject* +_wrap_g_type_from_name(PyGTypeWrapper *_, PyObject *args) +{ + char *type_name; + GType type; + + if (!PyArg_ParseTuple(args, "s:GType.from_name", &type_name)) + return NULL; + + type = g_type_from_name(type_name); + if (type == 0) { + PyErr_SetString(PyExc_RuntimeError, "unknown type name"); + return NULL; + } + + return pyg_type_wrapper_new(type); +} + +static PyObject* +_wrap_g_type_is_a(PyGTypeWrapper *self, PyObject *args) +{ + PyObject *gparent; + GType parent; + + if (!PyArg_ParseTuple(args, "O:GType.is_a", &gparent)) + return NULL; + else if ((parent = pyg_type_from_object(gparent)) == 0) + return NULL; + + return pygi_gboolean_to_py (g_type_is_a (self->type, parent)); +} + +static PyMethodDef _PyGTypeWrapper_methods[] = { + { "is_interface", (PyCFunction)_wrap_g_type_is_interface, METH_NOARGS }, + { "is_classed", (PyCFunction)_wrap_g_type_is_classed, METH_NOARGS }, + { "is_instantiatable", (PyCFunction)_wrap_g_type_is_instantiatable, METH_NOARGS }, + { "is_derivable", (PyCFunction)_wrap_g_type_is_derivable, METH_NOARGS }, + { "is_deep_derivable", (PyCFunction)_wrap_g_type_is_deep_derivable, METH_NOARGS }, + { "is_abstract", (PyCFunction)_wrap_g_type_is_abstract, METH_NOARGS }, + { "is_value_abstract", (PyCFunction)_wrap_g_type_is_value_abstract, METH_NOARGS }, + { "is_value_type", (PyCFunction)_wrap_g_type_is_value_type, METH_NOARGS }, + { "has_value_table", (PyCFunction)_wrap_g_type_has_value_table, METH_NOARGS }, + { "from_name", (PyCFunction)_wrap_g_type_from_name, METH_VARARGS | METH_STATIC }, + { "is_a", (PyCFunction)_wrap_g_type_is_a, METH_VARARGS }, + { NULL, 0, 0 } +}; + +static int +pyg_type_wrapper_init(PyGTypeWrapper *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "object", NULL }; + PyObject *py_object; + GType type; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O:GType.__init__", + kwlist, &py_object)) + return -1; + + if (!(type = pyg_type_from_object(py_object))) + return -1; + + self->type = type; + + return 0; +} + +/** + * pyg_type_wrapper_new: + * type: a GType + * + * Creates a Python wrapper for a GType. * - * This gives a hint to what python type might be used as - * a particular gi type. + * Returns: the Python wrapper. */ PyObject * -_pygi_get_py_type_hint(GITypeTag type_tag) -{ - PyObject *type = Py_None; - - switch (type_tag) { - case GI_TYPE_TAG_BOOLEAN: - type = (PyObject *) &PyBool_Type; - break; - - case GI_TYPE_TAG_INT8: - case GI_TYPE_TAG_UINT8: - case GI_TYPE_TAG_INT16: - case GI_TYPE_TAG_UINT16: - case GI_TYPE_TAG_INT32: - case GI_TYPE_TAG_UINT32: - case GI_TYPE_TAG_INT64: - case GI_TYPE_TAG_UINT64: - type = (PyObject *) &PYGLIB_PyLong_Type; - break; - - case GI_TYPE_TAG_FLOAT: - case GI_TYPE_TAG_DOUBLE: - type = (PyObject *) &PyFloat_Type; - break; - - case GI_TYPE_TAG_GLIST: - case GI_TYPE_TAG_GSLIST: - case GI_TYPE_TAG_ARRAY: - type = (PyObject *) &PyList_Type; - break; - - case GI_TYPE_TAG_GHASH: - type = (PyObject *) &PyDict_Type; - break; - - case GI_TYPE_TAG_UTF8: - case GI_TYPE_TAG_FILENAME: - case GI_TYPE_TAG_UNICHAR: - type = (PyObject *) &PYGLIB_PyUnicode_Type; - break; - - case GI_TYPE_TAG_INTERFACE: - case GI_TYPE_TAG_GTYPE: - case GI_TYPE_TAG_ERROR: - case GI_TYPE_TAG_VOID: - break; - } - - Py_INCREF(type); - return type; +pyg_type_wrapper_new(GType type) +{ + PyGTypeWrapper *self; + + g_assert (Py_TYPE (&PyGTypeWrapper_Type) != NULL); + self = (PyGTypeWrapper *)PyObject_NEW(PyGTypeWrapper, + &PyGTypeWrapper_Type); + if (self == NULL) + return NULL; + + self->type = type; + return (PyObject *)self; +} + +/** + * pyg_type_from_object_strict: + * obj: a Python object + * strict: if set to TRUE, raises an exception if it can't perform the + * conversion + * + * converts a python object to a GType. If strict is set, raises an + * exception if it can't perform the conversion, otherwise returns + * PY_TYPE_OBJECT. + * + * Returns: the corresponding GType, or 0 on error. + */ + +GType +pyg_type_from_object_strict(PyObject *obj, gboolean strict) +{ + PyObject *gtype; + GType type; + + /* NULL check */ + if (!obj) { + PyErr_SetString(PyExc_TypeError, "can't get type from NULL object"); + return 0; + } + + /* map some standard types to primitive GTypes ... */ + if (obj == Py_None) + return G_TYPE_NONE; + if (PyType_Check(obj)) { + PyTypeObject *tp = (PyTypeObject *)obj; + + if (tp == &PyLong_Type) + return G_TYPE_INT; + else if (tp == &PyBool_Type) + return G_TYPE_BOOLEAN; + else if (tp == &PyFloat_Type) + return G_TYPE_DOUBLE; + else if (tp == &PyUnicode_Type) + return G_TYPE_STRING; + else if (tp == &PyBaseObject_Type) + return PY_TYPE_OBJECT; + } + + if (Py_TYPE(obj) == &PyGTypeWrapper_Type) { + return ((PyGTypeWrapper *)obj)->type; + } + + /* handle strings */ + if (PyUnicode_Check (obj)) { + gchar *name = PyUnicode_AsUTF8(obj); + + type = g_type_from_name(name); + if (type != 0) { + return type; + } + } + + /* finally, look for a __gtype__ attribute on the object */ + gtype = PyObject_GetAttrString(obj, "__gtype__"); + + if (gtype) { + if (Py_TYPE(gtype) == &PyGTypeWrapper_Type) { + type = ((PyGTypeWrapper *)gtype)->type; + Py_DECREF(gtype); + return type; + } + Py_DECREF(gtype); + } + + PyErr_Clear(); + + /* Some API like those that take GValues can hold a python object as + * a pointer. This is potentially dangerous becuase everything is + * passed in as a PyObject so we can't actually type check it. Only + * fallback to PY_TYPE_OBJECT if strict checking is disabled + */ + if (!strict) + return PY_TYPE_OBJECT; + + PyErr_SetString(PyExc_TypeError, "could not get typecode from object"); + return 0; } +/** + * pyg_type_from_object: + * obj: a Python object + * + * converts a python object to a GType. Raises an exception if it + * can't perform the conversion. + * + * Returns: the corresponding GType, or 0 on error. + */ +GType +pyg_type_from_object(PyObject *obj) +{ + /* Legacy call always defaults to strict type checking */ + return pyg_type_from_object_strict(obj, TRUE); +} + +/** + * pyg_enum_get_value: + * @enum_type: the GType of the flag. + * @obj: a Python object representing the flag value + * @val: a pointer to the location to store the integer representation of the flag. + * + * Converts a Python object to the integer equivalent. The conversion + * will depend on the type of the Python object. If the object is an + * integer, it is passed through directly. If it is a string, it will + * be treated as a full or short enum name as defined in the GType. + * + * Returns: 0 on success or -1 on failure + */ +gint +pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val) +{ + GEnumClass *eclass = NULL; + gint res = -1; + + g_return_val_if_fail(val != NULL, -1); + if (!obj) { + *val = 0; + res = 0; + } else if (PyLong_Check (obj)) { + if (!pygi_gint_from_py (obj, val)) + res = -1; + else + res = 0; + + if (PyObject_TypeCheck(obj, &PyGEnum_Type) && ((PyGEnum *) obj)->gtype != enum_type) { + g_warning("expected enumeration type %s, but got %s instead", + g_type_name(enum_type), + g_type_name(((PyGEnum *) obj)->gtype)); + } + } else if (PyUnicode_Check (obj)) { + GEnumValue *info; + char *str = PyUnicode_AsUTF8 (obj); + + if (enum_type != G_TYPE_NONE) + eclass = G_ENUM_CLASS(g_type_class_ref(enum_type)); + else { + PyErr_SetString(PyExc_TypeError, "could not convert string to enum because there is no GType associated to look up the value"); + res = -1; + } + info = g_enum_get_value_by_name(eclass, str); + g_type_class_unref(eclass); + + if (!info) + info = g_enum_get_value_by_nick(eclass, str); + if (info) { + *val = info->value; + res = 0; + } else { + PyErr_SetString(PyExc_TypeError, "could not convert string"); + res = -1; + } + } else { + PyErr_SetString(PyExc_TypeError,"enum values must be strings or ints"); + res = -1; + } + return res; +} + +/** + * pyg_flags_get_value: + * @flag_type: the GType of the flag. + * @obj: a Python object representing the flag value + * @val: a pointer to the location to store the integer representation of the flag. + * + * Converts a Python object to the integer equivalent. The conversion + * will depend on the type of the Python object. If the object is an + * integer, it is passed through directly. If it is a string, it will + * be treated as a full or short flag name as defined in the GType. + * If it is a tuple, then the items are treated as strings and ORed + * together. + * + * Returns: 0 on success or -1 on failure + */ +gint +pyg_flags_get_value(GType flag_type, PyObject *obj, guint *val) +{ + GFlagsClass *fclass = NULL; + gint res = -1; + + g_return_val_if_fail(val != NULL, -1); + if (!obj) { + *val = 0; + res = 0; + } else if (PyLong_Check (obj)) { + if (pygi_guint_from_py (obj, val)) + res = 0; + } else if (PyUnicode_Check (obj)) { + GFlagsValue *info; + char *str = PyUnicode_AsUTF8 (obj); + + if (flag_type != G_TYPE_NONE) + fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type)); + else { + PyErr_SetString(PyExc_TypeError, "could not convert string to flag because there is no GType associated to look up the value"); + res = -1; + } + info = g_flags_get_value_by_name(fclass, str); + g_type_class_unref(fclass); + + if (!info) + info = g_flags_get_value_by_nick(fclass, str); + if (info) { + *val = info->value; + res = 0; + } else { + PyErr_SetString(PyExc_TypeError, "could not convert string"); + res = -1; + } + } else if (PyTuple_Check(obj)) { + Py_ssize_t i, len; + + len = PyTuple_Size(obj); + *val = 0; + res = 0; + + if (flag_type != G_TYPE_NONE) + fclass = G_FLAGS_CLASS(g_type_class_ref(flag_type)); + else { + PyErr_SetString(PyExc_TypeError, "could not convert string to flag because there is no GType associated to look up the value"); + res = -1; + } + + for (i = 0; i < len; i++) { + PyObject *item = PyTuple_GetItem(obj, i); + char *str = PyUnicode_AsUTF8 (item); + GFlagsValue *info = g_flags_get_value_by_name(fclass, str); + + if (!info) + info = g_flags_get_value_by_nick(fclass, str); + if (info) { + *val |= info->value; + } else { + PyErr_SetString(PyExc_TypeError, "could not convert string"); + res = -1; + break; + } + } + g_type_class_unref(fclass); + } else { + PyErr_SetString(PyExc_TypeError, + "flag values must be strings, ints, longs, or tuples"); + res = -1; + } + return res; +} + +static GQuark pyg_type_marshal_key = 0; +static GQuark pyg_type_marshal_helper_key = 0; + +typedef enum _marshal_helper_data_e marshal_helper_data_e; +enum _marshal_helper_data_e { + MARSHAL_HELPER_NONE = 0, + MARSHAL_HELPER_RETURN_NULL, + MARSHAL_HELPER_IMPORT_DONE, +}; + +PyGTypeMarshal * +pyg_type_lookup(GType type) +{ + GType ptype = type; + PyGTypeMarshal *tm = NULL; + marshal_helper_data_e marshal_helper; + + if (type == G_TYPE_INVALID) + return NULL; + + marshal_helper = GPOINTER_TO_INT ( + g_type_get_qdata(type, pyg_type_marshal_helper_key)); + + /* If we called this function before with @type and nothing was found, + * return NULL early to not spend time in the loop below */ + if (marshal_helper == MARSHAL_HELPER_RETURN_NULL) + return NULL; + + /* Otherwise do recursive type lookup */ + do { + if (marshal_helper == MARSHAL_HELPER_IMPORT_DONE) + pygi_type_import_by_g_type (ptype); + + if ((tm = g_type_get_qdata(ptype, pyg_type_marshal_key)) != NULL) + break; + ptype = g_type_parent(ptype); + } while (ptype); + + if (marshal_helper == MARSHAL_HELPER_NONE) { + marshal_helper = (tm == NULL) ? + MARSHAL_HELPER_RETURN_NULL: + MARSHAL_HELPER_IMPORT_DONE; + g_type_set_qdata(type, pyg_type_marshal_helper_key, + GINT_TO_POINTER(marshal_helper)); + } + return tm; +} + +/** + * pyg_register_gtype_custom: + * @gtype: the GType for the new type + * @from_func: a function to convert GValues to Python objects + * @to_func: a function to convert Python objects to GValues + * + * In order to handle specific conversion of gboxed types or new + * fundamental types, you may use this function to register conversion + * handlers. + */ + +void +pyg_register_gtype_custom(GType gtype, + fromvaluefunc from_func, + tovaluefunc to_func) +{ + PyGTypeMarshal *tm; + + if (!pyg_type_marshal_key) { + pyg_type_marshal_key = g_quark_from_static_string("PyGType::marshal"); + pyg_type_marshal_helper_key = g_quark_from_static_string("PyGType::marshal-helper"); + } + + tm = g_new(PyGTypeMarshal, 1); + tm->fromvalue = from_func; + tm->tovalue = to_func; + g_type_set_qdata(gtype, pyg_type_marshal_key, tm); +} + +/* -------------- PyGClosure ----------------- */ + +static void +pyg_closure_invalidate(gpointer data, GClosure *closure) +{ + PyGClosure *pc = (PyGClosure *)closure; + PyGILState_STATE state; + + state = PyGILState_Ensure(); + Py_XDECREF(pc->callback); + Py_XDECREF(pc->extra_args); + Py_XDECREF(pc->swap_data); + PyGILState_Release(state); + + pc->callback = NULL; + pc->extra_args = NULL; + pc->swap_data = NULL; +} + +static void +pyg_closure_marshal(GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + PyGILState_STATE state; + PyGClosure *pc = (PyGClosure *)closure; + PyObject *params, *ret; + guint i; + + state = PyGILState_Ensure(); + + /* construct Python tuple for the parameter values */ + params = PyTuple_New(n_param_values); + for (i = 0; i < n_param_values; i++) { + /* swap in a different initial data for connect_object() */ + if (i == 0 && G_CCLOSURE_SWAP_DATA(closure)) { + g_return_if_fail(pc->swap_data != NULL); + Py_INCREF(pc->swap_data); + PyTuple_SetItem(params, 0, pc->swap_data); + } else { + PyObject *item = pyg_value_as_pyobject(¶m_values[i], FALSE); + + /* error condition */ + if (!item) { + if (!PyErr_Occurred ()) + PyErr_SetString (PyExc_TypeError, + "can't convert parameter to desired type"); + + if (pc->exception_handler) + pc->exception_handler (return_value, n_param_values, param_values); + else + PyErr_Print(); + + goto out; + } + PyTuple_SetItem(params, i, item); + } + } + /* params passed to function may have extra arguments */ + if (pc->extra_args) { + PyObject *tuple = params; + params = PySequence_Concat(tuple, pc->extra_args); + Py_DECREF(tuple); + } + ret = PyObject_CallObject(pc->callback, params); + if (ret == NULL) { + if (pc->exception_handler) + pc->exception_handler(return_value, n_param_values, param_values); + else + PyErr_Print(); + goto out; + } + + if (G_IS_VALUE(return_value) && pyg_value_from_pyobject(return_value, ret) != 0) { + /* If we already have an exception set, use that, otherwise set a + * generic one */ + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_TypeError, + "can't convert return value to desired type"); + + if (pc->exception_handler) + pc->exception_handler(return_value, n_param_values, param_values); + else + PyErr_Print(); + } + Py_DECREF(ret); + + out: + Py_DECREF(params); + PyGILState_Release(state); +} + +/** + * pyg_closure_new: + * callback: a Python callable object + * extra_args: a tuple of extra arguments, or None/NULL. + * swap_data: an alternative python object to pass first. + * + * Creates a GClosure wrapping a Python callable and optionally a set + * of additional function arguments. This is needed to attach python + * handlers to signals, for instance. + * + * Returns: the new closure. + */ +GClosure * +pyg_closure_new(PyObject *callback, PyObject *extra_args, PyObject *swap_data) +{ + GClosure *closure; + + g_return_val_if_fail(callback != NULL, NULL); + closure = g_closure_new_simple(sizeof(PyGClosure), NULL); + g_closure_add_invalidate_notifier(closure, NULL, pyg_closure_invalidate); + g_closure_set_marshal(closure, pyg_closure_marshal); + Py_INCREF(callback); + ((PyGClosure *)closure)->callback = callback; + if (extra_args && extra_args != Py_None) { + Py_INCREF(extra_args); + if (!PyTuple_Check(extra_args)) { + PyObject *tmp = PyTuple_New(1); + PyTuple_SetItem(tmp, 0, extra_args); + extra_args = tmp; + } + ((PyGClosure *)closure)->extra_args = extra_args; + } + if (swap_data) { + Py_INCREF(swap_data); + ((PyGClosure *)closure)->swap_data = swap_data; + closure->derivative_flag = TRUE; + } + return closure; +} + +/** + * pyg_closure_set_exception_handler: + * @closure: a closure created with pyg_closure_new() + * @handler: the handler to call when an exception occurs or NULL for none + * + * Sets the handler to call when an exception occurs during closure invocation. + * The handler is responsible for providing a proper return value to the + * closure invocation. If @handler is %NULL, the default handler will be used. + * The default handler prints the exception to stderr and doesn't touch the + * closure's return value. + */ +void +pyg_closure_set_exception_handler(GClosure *closure, + PyClosureExceptionHandler handler) +{ + PyGClosure *pygclosure; + + g_return_if_fail(closure != NULL); + + pygclosure = (PyGClosure *)closure; + pygclosure->exception_handler = handler; +} +/* -------------- PySignalClassClosure ----------------- */ +/* a closure used for the `class closure' of a signal. As this gets + * all the info from the first argument to the closure and the + * invocation hint, we can have a single closure that handles all + * class closure cases. We call a method by the name of the signal + * with "do_" prepended. + * + * We also remove the first argument from the * param list, as it is + * the instance object, which is passed * implicitly to the method + * object. */ + +static void +pyg_signal_class_closure_marshal(GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + PyGILState_STATE state; + GObject *object; + PyObject *object_wrapper; + GSignalInvocationHint *hint = (GSignalInvocationHint *)invocation_hint; + gchar *method_name, *tmp; + PyObject *method; + PyObject *params, *ret; + Py_ssize_t py_len; + guint i, len; + + state = PyGILState_Ensure(); + + g_return_if_fail(invocation_hint != NULL); + /* get the object passed as the first argument to the closure */ + object = g_value_get_object(¶m_values[0]); + g_return_if_fail(object != NULL && G_IS_OBJECT(object)); + + /* get the wrapper for this object */ + object_wrapper = pygobject_new(object); + g_return_if_fail(object_wrapper != NULL); + + /* construct method name for this class closure */ + method_name = g_strconcat("do_", g_signal_name(hint->signal_id), NULL); + + /* convert dashes to underscores. For some reason, g_signal_name + * seems to convert all the underscores in the signal name to + dashes??? */ + for (tmp = method_name; *tmp != '\0'; tmp++) + if (*tmp == '-') *tmp = '_'; + + method = PyObject_GetAttrString(object_wrapper, method_name); + g_free(method_name); + + if (!method) { + PyErr_Clear(); + Py_DECREF(object_wrapper); + PyGILState_Release(state); + return; + } + Py_DECREF(object_wrapper); + + /* construct Python tuple for the parameter values; don't copy boxed values + initially because we'll check after the call to see if a copy is needed. */ + params = PyTuple_New(n_param_values - 1); + for (i = 1; i < n_param_values; i++) { + PyObject *item = pyg_value_as_pyobject(¶m_values[i], FALSE); + + /* error condition */ + if (!item) { + Py_DECREF(params); + PyGILState_Release(state); + return; + } + PyTuple_SetItem(params, i - 1, item); + } + + ret = PyObject_CallObject(method, params); + + /* Copy boxed values if others ref them, this needs to be done regardless of + exception status. */ + py_len = PyTuple_Size(params); + len = (guint)py_len; + for (i = 0; i < len; i++) { + PyObject *item = PyTuple_GetItem(params, i); + if (item != NULL && PyObject_TypeCheck(item, &PyGBoxed_Type) + && Py_REFCNT (item) != 1) { + PyGBoxed* boxed_item = (PyGBoxed*)item; + if (!boxed_item->free_on_dealloc) { + gpointer boxed_ptr = pyg_boxed_get_ptr (boxed_item); + pyg_boxed_set_ptr (boxed_item, g_boxed_copy (boxed_item->gtype, boxed_ptr)); + boxed_item->free_on_dealloc = TRUE; + } + } + } + + if (ret == NULL) { + PyErr_Print(); + Py_DECREF(method); + Py_DECREF(params); + PyGILState_Release(state); + return; + } + Py_DECREF(method); + Py_DECREF(params); + if (G_IS_VALUE(return_value)) + pyg_value_from_pyobject(return_value, ret); + Py_DECREF(ret); + PyGILState_Release(state); +} + +/** + * pyg_signal_class_closure_get: + * + * Returns the GClosure used for the class closure of signals. When + * called, it will invoke the method do_signalname (for the signal + * "signalname"). + * + * Returns: the closure. + */ +GClosure * +pyg_signal_class_closure_get(void) +{ + static GClosure *closure; + + if (closure == NULL) { + closure = g_closure_new_simple(sizeof(GClosure), NULL); + g_closure_set_marshal(closure, pyg_signal_class_closure_marshal); + + g_closure_ref(closure); + g_closure_sink(closure); + } + return closure; +} + +/* ----- __doc__ descriptor for GObject and GInterface ----- */ + +static void +object_doc_dealloc(PyObject *self) +{ + PyObject_FREE(self); +} + +/* append information about signals of a particular gtype */ +static void +add_signal_docs(GType gtype, GString *string) +{ + GTypeClass *class = NULL; + guint *signal_ids, n_ids = 0, i; + + if (G_TYPE_IS_CLASSED(gtype)) + class = g_type_class_ref(gtype); + signal_ids = g_signal_list_ids(gtype, &n_ids); + + if (n_ids > 0) { + g_string_append_printf(string, "Signals from %s:\n", + g_type_name(gtype)); + + for (i = 0; i < n_ids; i++) { + GSignalQuery query; + guint j; + + g_signal_query(signal_ids[i], &query); + + g_string_append(string, " "); + g_string_append(string, query.signal_name); + g_string_append(string, " ("); + for (j = 0; j < query.n_params; j++) { + g_string_append(string, g_type_name(query.param_types[j])); + if (j != query.n_params - 1) + g_string_append(string, ", "); + } + g_string_append(string, ")"); + if (query.return_type && query.return_type != G_TYPE_NONE) { + g_string_append(string, " -> "); + g_string_append(string, g_type_name(query.return_type)); + } + g_string_append(string, "\n"); + } + g_free(signal_ids); + g_string_append(string, "\n"); + } + if (class) + g_type_class_unref(class); +} + +static void +add_property_docs(GType gtype, GString *string) +{ + GObjectClass *class; + GParamSpec **props; + guint n_props = 0, i; + gboolean has_prop = FALSE; + const gchar *blurb=NULL; + + class = g_type_class_ref(gtype); + props = g_object_class_list_properties(class, &n_props); + + for (i = 0; i < n_props; i++) { + if (props[i]->owner_type != gtype) + continue; /* these are from a parent type */ + + /* print out the heading first */ + if (!has_prop) { + g_string_append_printf(string, "Properties from %s:\n", + g_type_name(gtype)); + has_prop = TRUE; + } + g_string_append_printf(string, " %s -> %s: %s\n", + g_param_spec_get_name(props[i]), + g_type_name(props[i]->value_type), + g_param_spec_get_nick(props[i])); + + /* g_string_append_printf crashes on win32 if the third + argument is NULL. */ + blurb=g_param_spec_get_blurb(props[i]); + if (blurb) + g_string_append_printf(string, " %s\n",blurb); + } + g_free(props); + if (has_prop) + g_string_append(string, "\n"); + g_type_class_unref(class); +} + +static PyObject * +object_doc_descr_get(PyObject *self, PyObject *obj, PyObject *type) +{ + GType gtype = 0; + GString *string; + PyObject *pystring; + + if (obj && pygobject_check(obj, &PyGObject_Type)) { + gtype = G_OBJECT_TYPE(pygobject_get(obj)); + if (!gtype) + PyErr_SetString(PyExc_RuntimeError, "could not get object type"); + } else { + gtype = pyg_type_from_object(type); + } + if (!gtype) + return NULL; + + string = g_string_new_len(NULL, 512); + + if (g_type_is_a(gtype, G_TYPE_INTERFACE)) + g_string_append_printf(string, "Interface %s\n\n", g_type_name(gtype)); + else if (g_type_is_a(gtype, G_TYPE_OBJECT)) + g_string_append_printf(string, "Object %s\n\n", g_type_name(gtype)); + else + g_string_append_printf(string, "%s\n\n", g_type_name(gtype)); + + if (((PyTypeObject *) type)->tp_doc) + g_string_append_printf(string, "%s\n\n", ((PyTypeObject *) type)->tp_doc); + + if (g_type_is_a(gtype, G_TYPE_OBJECT)) { + GType parent = G_TYPE_OBJECT; + GArray *parents = g_array_new(FALSE, FALSE, sizeof(GType)); + int iparent; + + while (parent) { + g_array_append_val(parents, parent); + parent = g_type_next_base(gtype, parent); + } + + for (iparent = parents->len - 1; iparent >= 0; --iparent) { + GType *interfaces; + guint n_interfaces, i; + + parent = g_array_index(parents, GType, iparent); + add_signal_docs(parent, string); + add_property_docs(parent, string); + + /* add docs for implemented interfaces */ + interfaces = g_type_interfaces(parent, &n_interfaces); + for (i = 0; i < n_interfaces; i++) + add_signal_docs(interfaces[i], string); + g_free(interfaces); + } + g_array_free(parents, TRUE); + } + + pystring = PyUnicode_FromStringAndSize (string->str, string->len); + g_string_free(string, TRUE); + return pystring; +} + +PYGI_DEFINE_TYPE("gobject.GObject.__doc__", PyGObjectDoc_Type, PyObject); + +/** + * pyg_object_descr_doc_get: + * + * Returns an object intended to be the __doc__ attribute of GObject + * wrappers. When read in the context of the object it will return + * some documentation about the signals and properties of the object. + * + * Returns: the descriptor. + */ +PyObject * +pyg_object_descr_doc_get(void) +{ + static PyObject *doc_descr = NULL; + + if (!doc_descr) { + Py_SET_TYPE(&PyGObjectDoc_Type, &PyType_Type); + if (PyType_Ready(&PyGObjectDoc_Type)) + return NULL; + + doc_descr = PyObject_NEW(PyObject, &PyGObjectDoc_Type); + if (doc_descr == NULL) + return NULL; + } + return doc_descr; +} + + +/** + * pyg_pyobj_to_unichar_conv: + * + * Converts PyObject value to a unichar and write result to memory + * pointed to by ptr. Follows the calling convention of a ParseArgs + * converter (O& format specifier) so it may be used to convert function + * arguments. + * + * Returns: 1 if the conversion succeeds and 0 otherwise. If the conversion + * did not succeesd, a Python exception is raised + */ +int pyg_pyobj_to_unichar_conv(PyObject* py_obj, void* ptr) +{ + if (!pygi_gunichar_from_py (py_obj, ptr)) + return 0; + return 1; +} + +gboolean +pyg_gtype_is_custom(GType gtype) +{ + return g_type_get_qdata (gtype, pygobject_custom_key) != NULL; +} + +static PyObject * +strv_from_gvalue(const GValue *value) +{ + gchar **argv; + PyObject *py_argv; + gsize i; + + argv = (gchar **) g_value_get_boxed (value); + py_argv = PyList_New (0); + + for (i = 0; argv && argv[i]; i++) { + int res; + PyObject *item = pygi_utf8_to_py (argv[i]); + if (item == NULL) { + Py_DECREF (py_argv); + return NULL; + } + res = PyList_Append (py_argv, item); + Py_DECREF (item); + if (res == -1) { + Py_DECREF (py_argv); + return NULL; + } + } + + return py_argv; +} + +static int +strv_to_gvalue(GValue *value, PyObject *obj) +{ + Py_ssize_t argc, i; + gchar **argv; + + if (!(PyTuple_Check (obj) || PyList_Check (obj))) + return -1; + + argc = PySequence_Length (obj); + argv = g_new (gchar *, argc + 1); + for (i = 0; i < argc; ++i) { + PyObject* item = PySequence_Fast_GET_ITEM (obj, i); + if (!pygi_utf8_from_py (item, &(argv[i]))) + goto error; + } + + argv[i] = NULL; + g_value_take_boxed (value, argv); + return 0; + +error: + for (i = i - 1; i >= 0; i--) { + g_free (argv[i]); + } + g_free (argv); + return -1; +} + +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_type_register_types(PyObject *d) +{ + PyGTypeWrapper_Type.tp_dealloc = (destructor)pyg_type_wrapper_dealloc; + PyGTypeWrapper_Type.tp_richcompare = pyg_type_wrapper_richcompare; + PyGTypeWrapper_Type.tp_repr = (reprfunc)pyg_type_wrapper_repr; + PyGTypeWrapper_Type.tp_hash = (hashfunc)pyg_type_wrapper_hash; + PyGTypeWrapper_Type.tp_flags = Py_TPFLAGS_DEFAULT; + PyGTypeWrapper_Type.tp_methods = _PyGTypeWrapper_methods; + PyGTypeWrapper_Type.tp_getset = _PyGTypeWrapper_getsets; + PyGTypeWrapper_Type.tp_init = (initproc)pyg_type_wrapper_init; + PyGTypeWrapper_Type.tp_alloc = PyType_GenericAlloc; + PyGTypeWrapper_Type.tp_new = PyType_GenericNew; + if (PyType_Ready(&PyGTypeWrapper_Type)) + return -1; + + PyDict_SetItemString(d, "GType", (PyObject *)&PyGTypeWrapper_Type); + + /* This type lazily registered in pyg_object_descr_doc_get */ + PyGObjectDoc_Type.tp_dealloc = (destructor)object_doc_dealloc; + PyGObjectDoc_Type.tp_flags = Py_TPFLAGS_DEFAULT; + PyGObjectDoc_Type.tp_descr_get = (descrgetfunc)object_doc_descr_get; + + pyg_register_gtype_custom (G_TYPE_STRV, + strv_from_gvalue, + strv_to_gvalue); + + return 0; +} diff --git a/gi/pygi-type.h b/gi/pygi-type.h index 01b5994..c7e1a45 100644 --- a/gi/pygi-type.h +++ b/gi/pygi-type.h @@ -1,7 +1,8 @@ /* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2009 Simon van der Linden + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * 2004-2008 Johan Dahlin + * pyginterface.c: wrapper for the gobject library. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,33 +15,52 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifndef __PYGI_TYPE_H__ +#ifndef __PYGI_TYPE_H__ #define __PYGI_TYPE_H__ #include +#include +#include +#include "pygobject-internal.h" + +extern PyTypeObject PyGTypeWrapper_Type; -G_BEGIN_DECLS +typedef PyObject *(* fromvaluefunc)(const GValue *value); +typedef int (*tovaluefunc)(GValue *value, PyObject *obj); -/* Public */ +typedef struct { + fromvaluefunc fromvalue; + tovaluefunc tovalue; +} PyGTypeMarshal; -PyObject *pygi_type_import_by_g_type_real (GType g_type); +PyGTypeMarshal *pyg_type_lookup(GType type); +gboolean pyg_gtype_is_custom (GType gtype); -/* Private */ +void pyg_register_gtype_custom(GType gtype, + fromvaluefunc from_func, + tovaluefunc to_func); -PyObject *_pygi_type_import_by_name (const char *namespace_, const char *name); +int pygi_type_register_types(PyObject *d); -PyObject *_pygi_type_import_by_gi_info (GIBaseInfo *info); +PyObject *pyg_object_descr_doc_get(void); +PyObject *pyg_type_wrapper_new (GType type); +GType pyg_type_from_object_strict (PyObject *obj, gboolean strict); +GType pyg_type_from_object (PyObject *obj); -PyObject *_pygi_type_get_from_g_type (GType g_type); +int pyg_pyobj_to_unichar_conv (PyObject* py_obj, void* ptr); -PyObject *_pygi_get_py_type_hint (GITypeTag type_tag); +GClosure *pyg_closure_new(PyObject *callback, PyObject *extra_args, PyObject *swap_data); +GClosure *pyg_signal_class_closure_get(void); +void pyg_closure_set_exception_handler(GClosure *closure, + PyClosureExceptionHandler handler); -G_END_DECLS +PyObject *pygi_type_import_by_g_type (GType g_type); +PyObject *pygi_type_import_by_name (const char *namespace_, const char *name); +PyObject *pygi_type_import_by_gi_info (GIBaseInfo *info); +PyObject *pygi_type_get_from_g_type (GType g_type); #endif /* __PYGI_TYPE_H__ */ diff --git a/gi/pygi-util.c b/gi/pygi-util.c new file mode 100644 index 0000000..3a297f4 --- /dev/null +++ b/gi/pygi-util.c @@ -0,0 +1,126 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "pygi-util.h" + +gboolean +pygi_guint_from_pyssize (Py_ssize_t pyval, guint *result) +{ + if (pyval < 0) { + PyErr_SetString (PyExc_ValueError, "< 0"); + return FALSE; + } else if (G_MAXUINT < PY_SSIZE_T_MAX && pyval > (Py_ssize_t)G_MAXUINT) { + PyErr_SetString (PyExc_ValueError, "too large"); + return FALSE; + } + *result = (guint)pyval; + return TRUE; +} + +PyObject * +pyg_integer_richcompare(PyObject *v, PyObject *w, int op) +{ + PyObject *result; + gboolean t; + + switch (op) { + case Py_EQ: t = PyLong_AS_LONG (v) == PyLong_AS_LONG (w); break; + case Py_NE: t = PyLong_AS_LONG (v) != PyLong_AS_LONG (w); break; + case Py_LE: t = PyLong_AS_LONG (v) <= PyLong_AS_LONG (w); break; + case Py_GE: t = PyLong_AS_LONG (v) >= PyLong_AS_LONG (w); break; + case Py_LT: t = PyLong_AS_LONG (v) < PyLong_AS_LONG (w); break; + case Py_GT: t = PyLong_AS_LONG (v) > PyLong_AS_LONG (w); break; + default: g_assert_not_reached(); + } + + result = t ? Py_True : Py_False; + Py_INCREF(result); + return result; +} + +PyObject* +pyg_ptr_richcompare(void* a, void *b, int op) +{ + PyObject *res; + + switch (op) { + case Py_EQ: + res = (a == b) ? Py_True : Py_False; + break; + case Py_NE: + res = (a != b) ? Py_True : Py_False; + break; + case Py_LT: + res = (a < b) ? Py_True : Py_False; + break; + case Py_LE: + res = (a <= b) ? Py_True : Py_False; + break; + case Py_GT: + res = (a > b) ? Py_True : Py_False; + break; + case Py_GE: + res = (a >= b) ? Py_True : Py_False; + break; + default: + res = Py_NotImplemented; + break; + } + + Py_INCREF(res); + return res; +} + +/** + * pyg_constant_strip_prefix: + * @name: the constant name. + * @strip_prefix: the prefix to strip. + * + * Advances the pointer @name by strlen(@strip_prefix) characters. If + * the resulting name does not start with a letter or underscore, the + * @name pointer will be rewound. This is to ensure that the + * resulting name is a valid identifier. Hence the returned string is + * a pointer into the string @name. + * + * Returns: the stripped constant name. + */ +const gchar * +pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix) +{ + size_t prefix_len, i; + + prefix_len = strlen(strip_prefix); + + /* Check so name starts with strip_prefix, if it doesn't: + * return the rest of the part which doesn't match + */ + for (i = 0; i < prefix_len; i++) { + if (name[i] != strip_prefix[i] && name[i] != '_') { + return &name[i]; + } + } + + /* strip off prefix from value name, while keeping it a valid + * identifier */ + for (i = prefix_len + 1; i > 0; i--) { + if (g_ascii_isalpha(name[i - 1]) || name[i - 1] == '_') { + return &name[i - 1]; + } + } + return name; +} diff --git a/gi/pygi-util.h b/gi/pygi-util.h new file mode 100644 index 0000000..a223730 --- /dev/null +++ b/gi/pygi-util.h @@ -0,0 +1,56 @@ +#ifndef __PYGI_UTIL_H__ +#define __PYGI_UTIL_H__ + +#include +#include + +G_BEGIN_DECLS + +PyObject * pyg_integer_richcompare(PyObject *v, PyObject *w, int op); +PyObject * pyg_ptr_richcompare(void* a, void *b, int op); +const gchar * pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix); + +gboolean pygi_guint_from_pyssize (Py_ssize_t pyval, guint *result); + +#if PY_VERSION_HEX < 0x030900A4 +# define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0) +#endif + +#if PY_VERSION_HEX >= 0x03080000 +# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc) +# define CPy_TRASHCAN_END(op) Py_TRASHCAN_END +#else +# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_SAFE_BEGIN(op) +# define CPy_TRASHCAN_END(op) Py_TRASHCAN_SAFE_END(op) +#endif + +#define PYGI_DEFINE_TYPE(typename, symbol, csymbol) \ +PyTypeObject symbol = { \ + PyVarObject_HEAD_INIT(NULL, 0) \ + typename, \ + sizeof(csymbol) \ +}; + +#define _PyGI_ERROR_PREFIX(format, ...) G_STMT_START { \ + PyObject *py_error_prefix; \ + py_error_prefix = PyUnicode_FromFormat(format, ## __VA_ARGS__); \ + if (py_error_prefix != NULL) { \ + PyObject *py_error_type, *py_error_value, *py_error_traceback; \ + PyErr_Fetch(&py_error_type, &py_error_value, &py_error_traceback); \ + if (PyUnicode_Check(py_error_value)) { \ + PyObject *new; \ + new = PyUnicode_Concat(py_error_prefix, py_error_value); \ + Py_DECREF(py_error_value); \ + if (new != NULL) { \ + py_error_value = new; \ + } \ + } \ + PyErr_Restore(py_error_type, py_error_value, py_error_traceback); \ + Py_DECREF(py_error_prefix); \ + } \ +} G_STMT_END + + +G_END_DECLS + +#endif /* __PYGI_UTIL_H__ */ diff --git a/gi/pygi-value.c b/gi/pygi-value.c new file mode 100644 index 0000000..e7ee1e0 --- /dev/null +++ b/gi/pygi-value.c @@ -0,0 +1,933 @@ + +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include +#include "pygi-value.h" +#include "pygi-struct.h" +#include "pygi-basictype.h" +#include "pygobject-object.h" +#include "pygi-type.h" +#include "pygenum.h" +#include "pygpointer.h" +#include "pygboxed.h" +#include "pygflags.h" +#include "pygparamspec.h" + + +/* glib 2.62 has started to print warnings for these which can't be disabled selectively, so just copy them here */ +#define PYGI_TYPE_VALUE_ARRAY (g_value_array_get_type()) +#define PYGI_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PYGI_TYPE_VALUE_ARRAY)) +#define PYGI_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), g_param_spec_types[18], GParamSpecValueArray)) + +GIArgument +_pygi_argument_from_g_value(const GValue *value, + GITypeInfo *type_info) +{ + GIArgument arg = { 0, }; + + GITypeTag type_tag = g_type_info_get_tag (type_info); + + /* For the long handling: long can be equivalent to + int32 or int64, depending on the architecture, but + gi doesn't tell us (and same for ulong) + */ + switch (type_tag) { + case GI_TYPE_TAG_BOOLEAN: + arg.v_boolean = g_value_get_boolean (value); + break; + case GI_TYPE_TAG_INT8: + arg.v_int8 = g_value_get_schar (value); + break; + case GI_TYPE_TAG_INT16: + case GI_TYPE_TAG_INT32: + if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_LONG)) + arg.v_int32 = (gint32)g_value_get_long (value); + else + arg.v_int32 = (gint32)g_value_get_int (value); + break; + case GI_TYPE_TAG_INT64: + if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_LONG)) + arg.v_int64 = g_value_get_long (value); + else + arg.v_int64 = g_value_get_int64 (value); + break; + case GI_TYPE_TAG_UINT8: + arg.v_uint8 = g_value_get_uchar (value); + break; + case GI_TYPE_TAG_UINT16: + case GI_TYPE_TAG_UINT32: + if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_ULONG)) + arg.v_uint32 = (guint32)g_value_get_ulong (value); + else + arg.v_uint32 = (guint32)g_value_get_uint (value); + break; + case GI_TYPE_TAG_UINT64: + if (g_type_is_a (G_VALUE_TYPE (value), G_TYPE_ULONG)) + arg.v_uint64 = g_value_get_ulong (value); + else + arg.v_uint64 = g_value_get_uint64 (value); + break; + case GI_TYPE_TAG_UNICHAR: + arg.v_uint32 = g_value_get_schar (value); + break; + case GI_TYPE_TAG_FLOAT: + arg.v_float = g_value_get_float (value); + break; + case GI_TYPE_TAG_DOUBLE: + arg.v_double = g_value_get_double (value); + break; + case GI_TYPE_TAG_GTYPE: + arg.v_size = g_value_get_gtype (value); + break; + case GI_TYPE_TAG_UTF8: + case GI_TYPE_TAG_FILENAME: + /* Callers are responsible for ensuring the GValue stays alive + * long enough for the string to be copied. */ + arg.v_string = (char *)g_value_get_string (value); + break; + case GI_TYPE_TAG_GLIST: + case GI_TYPE_TAG_GSLIST: + case GI_TYPE_TAG_ARRAY: + case GI_TYPE_TAG_GHASH: + if (G_VALUE_HOLDS_BOXED (value)) + arg.v_pointer = g_value_get_boxed (value); + else + /* e. g. GSettings::change-event */ + arg.v_pointer = g_value_get_pointer (value); + break; + case GI_TYPE_TAG_INTERFACE: + { + GIBaseInfo *info; + GIInfoType info_type; + + info = g_type_info_get_interface (type_info); + info_type = g_base_info_get_type (info); + + g_base_info_unref (info); + + switch (info_type) { + case GI_INFO_TYPE_FLAGS: + arg.v_uint = g_value_get_flags (value); + break; + case GI_INFO_TYPE_ENUM: + arg.v_int = g_value_get_enum (value); + break; + case GI_INFO_TYPE_INTERFACE: + case GI_INFO_TYPE_OBJECT: + if (G_VALUE_HOLDS_PARAM (value)) + arg.v_pointer = g_value_get_param (value); + else + arg.v_pointer = g_value_get_object (value); + break; + case GI_INFO_TYPE_BOXED: + case GI_INFO_TYPE_STRUCT: + case GI_INFO_TYPE_UNION: + if (G_VALUE_HOLDS (value, G_TYPE_BOXED)) { + arg.v_pointer = g_value_get_boxed (value); + } else if (G_VALUE_HOLDS (value, G_TYPE_VARIANT)) { + arg.v_pointer = g_value_get_variant (value); + } else if (G_VALUE_HOLDS (value, G_TYPE_POINTER)) { + arg.v_pointer = g_value_get_pointer (value); + } else { + PyErr_Format (PyExc_NotImplementedError, + "Converting GValue's of type '%s' is not implemented.", + g_type_name (G_VALUE_TYPE (value))); + } + break; + default: + PyErr_Format (PyExc_NotImplementedError, + "Converting GValue's of type '%s' is not implemented.", + g_info_type_to_string (info_type)); + break; + } + break; + } + case GI_TYPE_TAG_ERROR: + arg.v_pointer = g_value_get_boxed (value); + break; + case GI_TYPE_TAG_VOID: + arg.v_pointer = g_value_get_pointer (value); + break; + default: + break; + } + + return arg; +} + + +/* Ignore g_value_array deprecations. Although they are deprecated, + * we still need to support the marshaling of them in PyGObject. + */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +static int +pyg_value_array_from_pyobject(GValue *value, + PyObject *obj, + const GParamSpecValueArray *pspec) +{ + Py_ssize_t seq_len; + GValueArray *value_array; + guint len, i; + + seq_len = PySequence_Length(obj); + if (seq_len == -1) { + PyErr_Clear(); + return -1; + } + len = (guint)seq_len; + + if (pspec && pspec->fixed_n_elements > 0 && len != pspec->fixed_n_elements) + return -1; + + value_array = g_value_array_new(len); + + for (i = 0; i < len; ++i) { + PyObject *item = PySequence_GetItem(obj, i); + GType type; + + if (! item) { + PyErr_Clear(); + g_value_array_free(value_array); + return -1; + } + + if (pspec && pspec->element_spec) + type = G_PARAM_SPEC_VALUE_TYPE(pspec->element_spec); + else if (item == Py_None) + type = G_TYPE_POINTER; /* store None as NULL */ + else { + type = pyg_type_from_object((PyObject*)Py_TYPE(item)); + if (! type) { + PyErr_Clear(); + g_value_array_free(value_array); + Py_DECREF(item); + return -1; + } + } + + if (type == G_TYPE_VALUE) { + const GValue * item_value = pyg_boxed_get(item, GValue); + g_value_array_append(value_array, item_value); + } else { + GValue item_value = { 0, }; + int status; + + g_value_init(&item_value, type); + status = (pspec && pspec->element_spec) + ? pyg_param_gvalue_from_pyobject(&item_value, item, pspec->element_spec) + : pyg_value_from_pyobject(&item_value, item); + Py_DECREF(item); + + if (status == -1) { + g_value_array_free(value_array); + g_value_unset(&item_value); + return -1; + } + g_value_array_append(value_array, &item_value); + g_value_unset(&item_value); + } + } + + g_value_take_boxed(value, value_array); + return 0; +} + +G_GNUC_END_IGNORE_DEPRECATIONS + +static int +pyg_array_from_pyobject(GValue *value, + PyObject *obj) +{ + Py_ssize_t len, i; + GArray *array; + + len = PySequence_Length(obj); + if (len == -1) { + PyErr_Clear(); + return -1; + } + + array = g_array_new(FALSE, TRUE, sizeof(GValue)); + + for (i = 0; i < len; ++i) { + PyObject *item = PySequence_GetItem(obj, i); + GType type; + GValue item_value = { 0, }; + int status; + + if (! item) { + PyErr_Clear(); + g_array_free(array, FALSE); + return -1; + } + + if (item == Py_None) + type = G_TYPE_POINTER; /* store None as NULL */ + else { + type = pyg_type_from_object((PyObject*)Py_TYPE(item)); + if (! type) { + PyErr_Clear(); + g_array_free(array, FALSE); + Py_DECREF(item); + return -1; + } + } + + g_value_init(&item_value, type); + status = pyg_value_from_pyobject(&item_value, item); + Py_DECREF(item); + + if (status == -1) { + g_array_free(array, FALSE); + g_value_unset(&item_value); + return -1; + } + + g_array_append_val(array, item_value); + } + + g_value_take_boxed(value, array); + return 0; +} + +/** + * pyg_value_from_pyobject_with_error: + * @value: the GValue object to store the converted value in. + * @obj: the Python object to convert. + * + * This function converts a Python object and stores the result in a + * GValue. The GValue must be initialised in advance with + * g_value_init(). If the Python object can't be converted to the + * type of the GValue, then an error is returned. + * + * Returns: 0 on success, -1 on error. + */ +int +pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj) +{ + GType value_type = G_VALUE_TYPE(value); + + switch (G_TYPE_FUNDAMENTAL(value_type)) { + case G_TYPE_INTERFACE: + /* we only handle interface types that have a GObject prereq */ + if (g_type_is_a(value_type, G_TYPE_OBJECT)) { + if (obj == Py_None) + g_value_set_object(value, NULL); + else { + if (!PyObject_TypeCheck(obj, &PyGObject_Type)) { + PyErr_SetString(PyExc_TypeError, "GObject is required"); + return -1; + } + if (!G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), + value_type)) { + PyErr_SetString(PyExc_TypeError, "Invalid GObject type for assignment"); + return -1; + } + g_value_set_object(value, pygobject_get(obj)); + } + } else { + PyErr_SetString(PyExc_TypeError, "Unsupported conversion"); + return -1; + } + break; + case G_TYPE_CHAR: + { + gint8 temp; + if (pygi_gschar_from_py (obj, &temp)) { + g_value_set_schar (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_UCHAR: + { + guchar temp; + if (pygi_guchar_from_py (obj, &temp)) { + g_value_set_uchar (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_BOOLEAN: + { + gboolean temp; + if (pygi_gboolean_from_py (obj, &temp)) { + g_value_set_boolean (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_INT: + { + gint temp; + if (pygi_gint_from_py (obj, &temp)) { + g_value_set_int (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_UINT: + { + guint temp; + if (pygi_guint_from_py (obj, &temp)) { + g_value_set_uint (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_LONG: + { + glong temp; + if (pygi_glong_from_py (obj, &temp)) { + g_value_set_long (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_ULONG: + { + gulong temp; + if (pygi_gulong_from_py (obj, &temp)) { + g_value_set_ulong (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_INT64: + { + gint64 temp; + if (pygi_gint64_from_py (obj, &temp)) { + g_value_set_int64 (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_UINT64: + { + guint64 temp; + if (pygi_guint64_from_py (obj, &temp)) { + g_value_set_uint64 (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_ENUM: + { + gint val = 0; + if (pyg_enum_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { + return -1; + } + g_value_set_enum(value, val); + } + break; + case G_TYPE_FLAGS: + { + guint val = 0; + if (pyg_flags_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { + return -1; + } + g_value_set_flags(value, val); + return 0; + } + break; + case G_TYPE_FLOAT: + { + gfloat temp; + if (pygi_gfloat_from_py (obj, &temp)) { + g_value_set_float (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_DOUBLE: + { + gdouble temp; + if (pygi_gdouble_from_py (obj, &temp)) { + g_value_set_double (value, temp); + return 0; + } else + return -1; + } + case G_TYPE_STRING: + { + gchar *temp; + if (pygi_utf8_from_py (obj, &temp)) { + g_value_take_string (value, temp); + return 0; + } else { + /* also allows setting anything implementing __str__ */ + PyObject* str; + PyErr_Clear (); + str = PyObject_Str (obj); + if (str == NULL) + return -1; + if (pygi_utf8_from_py (str, &temp)) { + Py_DECREF (str); + g_value_take_string (value, temp); + return 0; + } + Py_DECREF (str); + return -1; + } + } + case G_TYPE_POINTER: + if (obj == Py_None) + g_value_set_pointer(value, NULL); + else if (PyObject_TypeCheck(obj, &PyGPointer_Type) && + G_VALUE_HOLDS(value, ((PyGPointer *)obj)->gtype)) + g_value_set_pointer(value, pyg_pointer_get(obj, gpointer)); + else if (PyCapsule_CheckExact (obj)) + g_value_set_pointer(value, PyCapsule_GetPointer (obj, NULL)); + else if (G_VALUE_HOLDS_GTYPE (value)) + g_value_set_gtype (value, pyg_type_from_object (obj)); + else { + PyErr_SetString(PyExc_TypeError, "Expected pointer"); + return -1; + } + break; + case G_TYPE_BOXED: { + PyGTypeMarshal *bm; + gboolean holds_value_array; + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + holds_value_array = G_VALUE_HOLDS(value, PYGI_TYPE_VALUE_ARRAY); + G_GNUC_END_IGNORE_DEPRECATIONS + + if (obj == Py_None) + g_value_set_boxed(value, NULL); + else if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) + g_value_set_boxed(value, obj); + else if (PyObject_TypeCheck(obj, &PyGBoxed_Type) && + G_VALUE_HOLDS(value, ((PyGBoxed *)obj)->gtype)) + g_value_set_boxed(value, pyg_boxed_get(obj, gpointer)); + else if (G_VALUE_HOLDS(value, G_TYPE_VALUE)) { + GType type; + GValue *n_value; + + type = pyg_type_from_object((PyObject*)Py_TYPE(obj)); + if (G_UNLIKELY (! type)) { + return -1; + } + n_value = g_new0 (GValue, 1); + g_value_init (n_value, type); + g_value_take_boxed (value, n_value); + return pyg_value_from_pyobject_with_error (n_value, obj); + } + else if (PySequence_Check(obj) && holds_value_array) + return pyg_value_array_from_pyobject(value, obj, NULL); + + else if (PySequence_Check(obj) && + G_VALUE_HOLDS(value, G_TYPE_ARRAY)) + return pyg_array_from_pyobject(value, obj); + else if (PyUnicode_Check (obj) && + G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { + GString *string; + char *buffer; + Py_ssize_t len; + buffer = PyUnicode_AsUTF8AndSize (obj, &len); + if (buffer == NULL) + return -1; + string = g_string_new_len(buffer, len); + g_value_set_boxed(value, string); + g_string_free (string, TRUE); + break; + } + else if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) + return bm->tovalue(value, obj); + else if (PyCapsule_CheckExact (obj)) + g_value_set_boxed(value, PyCapsule_GetPointer (obj, NULL)); + else { + PyErr_SetString(PyExc_TypeError, "Expected Boxed"); + return -1; + } + break; + } + case G_TYPE_PARAM: + /* we need to support both the wrapped _gi.GParamSpec and the GI + * GObject.ParamSpec */ + if (G_IS_PARAM_SPEC (pygobject_get (obj))) + g_value_set_param(value, G_PARAM_SPEC (pygobject_get (obj))); + else if (pyg_param_spec_check (obj)) + g_value_set_param(value, PyCapsule_GetPointer (obj, NULL)); + else { + PyErr_SetString(PyExc_TypeError, "Expected ParamSpec"); + return -1; + } + break; + case G_TYPE_OBJECT: + if (obj == Py_None) { + g_value_set_object(value, NULL); + } else if (PyObject_TypeCheck(obj, &PyGObject_Type) && + G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), + G_VALUE_TYPE(value))) { + g_value_set_object(value, pygobject_get(obj)); + } else { + PyErr_SetString(PyExc_TypeError, "Expected GObject"); + return -1; + } + break; + case G_TYPE_VARIANT: + { + if (obj == Py_None) + g_value_set_variant(value, NULL); + else if (pyg_type_from_object_strict(obj, FALSE) == G_TYPE_VARIANT) + g_value_set_variant(value, pyg_boxed_get(obj, GVariant)); + else { + PyErr_SetString(PyExc_TypeError, "Expected Variant"); + return -1; + } + break; + } + default: + { + PyGTypeMarshal *bm; + if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) { + return bm->tovalue(value, obj); + } else { + PyErr_SetString(PyExc_TypeError, "Unknown value type"); + return -1; + } + break; + } + } + + /* If an error occurred, unset the GValue but don't clear the Python error. */ + if (PyErr_Occurred()) { + g_value_unset(value); + return -1; + } + + return 0; +} + +/** + * pyg_value_from_pyobject: + * @value: the GValue object to store the converted value in. + * @obj: the Python object to convert. + * + * Same basic function as pyg_value_from_pyobject_with_error but clears + * any Python errors before returning. + * + * Returns: 0 on success, -1 on error. + */ +int +pyg_value_from_pyobject(GValue *value, PyObject *obj) +{ + int res = pyg_value_from_pyobject_with_error (value, obj); + + if (PyErr_Occurred()) { + PyErr_Clear(); + return -1; + } + return res; +} + +/** + * pygi_value_to_py_basic_type: + * @value: the GValue object. + * @handled: (out): TRUE if the return value is defined + * + * This function creates/returns a Python wrapper object that + * represents the GValue passed as an argument limited to supporting basic types + * like ints, bools, and strings. + * + * Returns: a PyObject representing the value. + */ +PyObject * +pygi_value_to_py_basic_type (const GValue *value, GType fundamental, gboolean *handled) +{ + *handled = TRUE; + switch (fundamental) { + case G_TYPE_CHAR: + return PyLong_FromLong (g_value_get_schar (value)); + case G_TYPE_UCHAR: + return PyLong_FromLong (g_value_get_uchar (value)); + case G_TYPE_BOOLEAN: + return pygi_gboolean_to_py (g_value_get_boolean (value)); + case G_TYPE_INT: + return pygi_gint_to_py (g_value_get_int (value)); + case G_TYPE_UINT: + return pygi_guint_to_py (g_value_get_uint (value)); + case G_TYPE_LONG: + return pygi_glong_to_py (g_value_get_long(value)); + case G_TYPE_ULONG: + return pygi_gulong_to_py (g_value_get_ulong (value)); + case G_TYPE_INT64: + return pygi_gint64_to_py (g_value_get_int64 (value)); + case G_TYPE_UINT64: + return pygi_guint64_to_py (g_value_get_uint64 (value)); + case G_TYPE_ENUM: + return pyg_enum_from_gtype (G_VALUE_TYPE (value), + g_value_get_enum (value)); + case G_TYPE_FLAGS: + return pyg_flags_from_gtype (G_VALUE_TYPE (value), + g_value_get_flags (value)); + case G_TYPE_FLOAT: + return pygi_gfloat_to_py (g_value_get_float (value)); + case G_TYPE_DOUBLE: + return pygi_gdouble_to_py (g_value_get_double (value)); + case G_TYPE_STRING: + return pygi_utf8_to_py (g_value_get_string (value)); + default: + *handled = FALSE; + return NULL; + } +} + +/** + * value_to_py_structured_type: + * @value: the GValue object. + * @copy_boxed: true if boxed values should be copied. + * + * This function creates/returns a Python wrapper object that + * represents the GValue passed as an argument. + * + * Returns: a PyObject representing the value or NULL and sets an error; + */ +static PyObject * +value_to_py_structured_type (const GValue *value, GType fundamental, gboolean copy_boxed) +{ + const gchar *type_name; + + switch (fundamental) { + case G_TYPE_INTERFACE: + if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT)) + return pygobject_new(g_value_get_object(value)); + else + break; + + case G_TYPE_POINTER: + if (G_VALUE_HOLDS_GTYPE (value)) + return pyg_type_wrapper_new (g_value_get_gtype (value)); + else + return pyg_pointer_new(G_VALUE_TYPE(value), + g_value_get_pointer(value)); + case G_TYPE_BOXED: { + PyGTypeMarshal *bm; + gboolean holds_value_array; + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + holds_value_array = G_VALUE_HOLDS(value, PYGI_TYPE_VALUE_ARRAY); + G_GNUC_END_IGNORE_DEPRECATIONS + + if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) { + PyObject *ret = (PyObject *)g_value_dup_boxed(value); + if (ret == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + return ret; + } else if (G_VALUE_HOLDS(value, G_TYPE_VALUE)) { + GValue *n_value = g_value_get_boxed (value); + return pyg_value_as_pyobject(n_value, copy_boxed); + } else if (holds_value_array) { + GValueArray *array = (GValueArray *) g_value_get_boxed(value); + Py_ssize_t n_values = array ? array->n_values : 0; + PyObject *ret = PyList_New(n_values); + int i; + for (i = 0; i < n_values; ++i) + PyList_SET_ITEM(ret, i, pyg_value_as_pyobject + (array->values + i, copy_boxed)); + return ret; + } else if (G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { + GString *string = (GString *) g_value_get_boxed(value); + PyObject *ret = PyUnicode_FromStringAndSize (string->str, string->len); + return ret; + } + bm = pyg_type_lookup(G_VALUE_TYPE(value)); + if (bm) { + return bm->fromvalue(value); + } else { + if (copy_boxed) + return pygi_gboxed_new(G_VALUE_TYPE(value), + g_value_get_boxed(value), TRUE, TRUE); + else + return pygi_gboxed_new(G_VALUE_TYPE(value), + g_value_get_boxed(value),FALSE,FALSE); + } + } + case G_TYPE_PARAM: + return pyg_param_spec_new(g_value_get_param(value)); + case G_TYPE_OBJECT: + return pygobject_new(g_value_get_object(value)); + case G_TYPE_VARIANT: + { + GVariant *v = g_value_get_variant(value); + if (v == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + return pygi_struct_new_from_g_type (G_TYPE_VARIANT, g_variant_ref(v), FALSE); + } + default: + { + PyGTypeMarshal *bm; + if ((bm = pyg_type_lookup(G_VALUE_TYPE(value)))) + return bm->fromvalue(value); + break; + } + } + + type_name = g_type_name (G_VALUE_TYPE (value)); + if (type_name == NULL) { + type_name = "(null)"; + } + PyErr_Format (PyExc_TypeError, "unknown type %s", type_name); + return NULL; +} + + +/** + * pyg_value_as_pyobject: + * @value: the GValue object. + * @copy_boxed: true if boxed values should be copied. + * + * This function creates/returns a Python wrapper object that + * represents the GValue passed as an argument. + * + * Returns: a PyObject representing the value or %NULL and sets an exception. + */ +PyObject * +pyg_value_as_pyobject (const GValue *value, gboolean copy_boxed) +{ + PyObject *pyobj; + gboolean handled; + GType fundamental = G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (value)); + + /* HACK: special case char and uchar to return PyBytes intstead of integers + * in the general case. Property access will skip this by calling + * pygi_value_to_py_basic_type() directly. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=733893 */ + if (fundamental == G_TYPE_CHAR) { + gint8 val = g_value_get_schar(value); + return PyUnicode_FromStringAndSize ((char *)&val, 1); + } else if (fundamental == G_TYPE_UCHAR) { + guint8 val = g_value_get_uchar(value); + return PyBytes_FromStringAndSize ((char *)&val, 1); + } + + pyobj = pygi_value_to_py_basic_type (value, fundamental, &handled); + if (handled) + return pyobj; + + pyobj = value_to_py_structured_type (value, fundamental, copy_boxed); + return pyobj; +} + + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +int +pyg_param_gvalue_from_pyobject(GValue* value, + PyObject* py_obj, + const GParamSpec* pspec) +{ + if (G_IS_PARAM_SPEC_UNICHAR(pspec)) { + gunichar u; + + if (!pyg_pyobj_to_unichar_conv(py_obj, &u)) { + PyErr_Clear(); + return -1; + } + g_value_set_uint(value, u); + return 0; + } + else if (PYGI_IS_PARAM_SPEC_VALUE_ARRAY(pspec)) + return pyg_value_array_from_pyobject(value, py_obj, + PYGI_PARAM_SPEC_VALUE_ARRAY(pspec)); + else { + return pyg_value_from_pyobject(value, py_obj); + } +} + +G_GNUC_END_IGNORE_DEPRECATIONS + +PyObject* +pyg_param_gvalue_as_pyobject(const GValue* gvalue, + gboolean copy_boxed, + const GParamSpec* pspec) +{ + if (G_IS_PARAM_SPEC_UNICHAR(pspec)) { + gunichar u; + gchar *encoded; + PyObject *retval; + + u = g_value_get_uint (gvalue); + encoded = g_ucs4_to_utf8 (&u, 1, NULL, NULL, NULL); + if (encoded == NULL) { + PyErr_SetString (PyExc_ValueError, "Failed to decode"); + return NULL; + } + retval = PyUnicode_FromString (encoded); + g_free (encoded); + return retval; + } + else { + return pyg_value_as_pyobject(gvalue, copy_boxed); + } +} + +PyObject * +pyg__gvalue_get(PyObject *module, PyObject *pygvalue) +{ + if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) { + PyErr_SetString (PyExc_TypeError, "Expected GValue argument."); + return NULL; + } + + return pyg_value_as_pyobject (pyg_boxed_get(pygvalue, GValue), + /*copy_boxed=*/ TRUE); +} + +PyObject * +pyg__gvalue_get_type(PyObject *module, PyObject *pygvalue) +{ + GValue *value; + GType type; + + if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) { + PyErr_SetString (PyExc_TypeError, "Expected GValue argument."); + return NULL; + } + + value = pyg_boxed_get (pygvalue, GValue); + type = G_VALUE_TYPE (value); + return pyg_type_wrapper_new (type); +} + +PyObject * +pyg__gvalue_set(PyObject *module, PyObject *args) +{ + PyObject *pygvalue; + PyObject *pyobject; + + if (!PyArg_ParseTuple (args, "OO:_gi._gvalue_set", + &pygvalue, &pyobject)) + return NULL; + + if (!pyg_boxed_check (pygvalue, G_TYPE_VALUE)) { + PyErr_SetString (PyExc_TypeError, "Expected GValue argument."); + return NULL; + } + + if (pyg_value_from_pyobject_with_error (pyg_boxed_get (pygvalue, GValue), + pyobject) == -1) + return NULL; + + Py_RETURN_NONE; +} diff --git a/gi/pygi-value.h b/gi/pygi-value.h new file mode 100644 index 0000000..5778a22 --- /dev/null +++ b/gi/pygi-value.h @@ -0,0 +1,52 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __PYGI_VALUE_H__ +#define __PYGI_VALUE_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +GIArgument _pygi_argument_from_g_value(const GValue *value, + GITypeInfo *type_info); + +int pyg_value_from_pyobject(GValue *value, PyObject *obj); +int pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj); +PyObject *pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed); +int pyg_param_gvalue_from_pyobject(GValue* value, + PyObject* py_obj, + const GParamSpec* pspec); +PyObject *pyg_param_gvalue_as_pyobject(const GValue* gvalue, + gboolean copy_boxed, + const GParamSpec* pspec); +PyObject *pyg_strv_from_gvalue(const GValue *value); +int pyg_strv_to_gvalue(GValue *value, PyObject *obj); + +PyObject *pygi_value_to_py_basic_type (const GValue *value, + GType fundamental, + gboolean *handled); + +PyObject *pyg__gvalue_get(PyObject *module, PyObject *pygvalue); +PyObject *pyg__gvalue_set(PyObject *module, PyObject *args); +PyObject *pyg__gvalue_get_type(PyObject *module, PyObject *pygvalue); + +G_END_DECLS + +#endif /* __PYGI_VALUE_H__ */ diff --git a/gi/pygi.h b/gi/pygi.h deleted file mode 100644 index 3bf40bb..0000000 --- a/gi/pygi.h +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2005-2009 Johan Dahlin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGI_H__ -#define __PYGI_H__ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#define NO_IMPORT_PYGOBJECT -#include - -#include -#include "pygi-cache.h" - -extern PyObject *PyGIDeprecationWarning; - -typedef struct { - PyObject_HEAD - GIRepository *repository; -} PyGIRepository; - -typedef struct { - PyObject_HEAD - GIBaseInfo *info; - PyObject *inst_weakreflist; - PyGICallableCache *cache; -} PyGIBaseInfo; - -typedef struct { - PyGIBaseInfo base; - - /* Reference the unbound version of this struct. - * We use this for the actual call to invoke because it manages the cache. - */ - struct PyGICallableInfo *py_unbound_info; - - /* Holds bound argument for instance, class, and vfunc methods. */ - PyObject *py_bound_arg; - -} PyGICallableInfo; - -typedef struct { - PyGPointer base; - gboolean free_on_dealloc; -} PyGIStruct; - -typedef struct { - PyGBoxed base; - gboolean slice_allocated; - gsize size; -} PyGIBoxed; - -typedef struct { - PyObject_HEAD - GCallback callback; - GIFunctionInfo *info; - gpointer user_data; - GIScopeType scope; - GDestroyNotify destroy_notify_func; - PyGICallableCache *cache; -} PyGICCallback; - -typedef PyObject * (*PyGIArgOverrideToGIArgumentFunc) (PyObject *value, - GIInterfaceInfo *interface_info, - GITransfer transfer, - GIArgument *arg); -typedef PyObject * (*PyGIArgOverrideFromGIArgumentFunc) (GIInterfaceInfo *interface_info, - gpointer data); -typedef PyObject * (*PyGIArgOverrideReleaseFunc) (GITypeInfo *type_info, - gpointer struct_); - -struct PyGI_API { - PyObject* (*type_import_by_g_type) (GType g_type); - PyObject* (*get_property_value) (PyGObject *instance, - GParamSpec *pspec); - gint (*set_property_value) (PyGObject *instance, - GParamSpec *pspec, - PyObject *value); - GClosure * (*signal_closure_new) (PyGObject *instance, - GType g_type, - const gchar *sig_name, - PyObject *callback, - PyObject *extra_args, - PyObject *swap_data); - void (*register_foreign_struct) (const char* namespace_, - const char* name, - PyGIArgOverrideToGIArgumentFunc to_func, - PyGIArgOverrideFromGIArgumentFunc from_func, - PyGIArgOverrideReleaseFunc release_func); -}; - -static struct PyGI_API *PyGI_API = NULL; - -static int -_pygi_import (void) -{ - if (PyGI_API != NULL) { - return 1; - } - PyGI_API = (struct PyGI_API*) PyCapsule_Import("gi._API", FALSE); - if (PyGI_API == NULL) { - return -1; - } - - return 0; -} - -static inline PyObject * -pygi_type_import_by_g_type (GType g_type) -{ - if (_pygi_import() < 0) { - return NULL; - } - return PyGI_API->type_import_by_g_type(g_type); -} - -static inline PyObject * -pygi_get_property_value (PyGObject *instance, - GParamSpec *pspec) -{ - if (_pygi_import() < 0) { - return NULL; - } - return PyGI_API->get_property_value(instance, pspec); -} - -static inline gint -pygi_set_property_value (PyGObject *instance, - GParamSpec *pspec, - PyObject *value) -{ - if (_pygi_import() < 0) { - return -1; - } - return PyGI_API->set_property_value(instance, pspec, value); -} - -static inline GClosure * -pygi_signal_closure_new (PyGObject *instance, - GType g_type, - const gchar *sig_name, - PyObject *callback, - PyObject *extra_args, - PyObject *swap_data) -{ - if (_pygi_import() < 0) { - return NULL; - } - return PyGI_API->signal_closure_new(instance, g_type, sig_name, callback, extra_args, swap_data); -} - -static inline PyObject * -pygi_register_foreign_struct (const char* namespace_, - const char* name, - PyGIArgOverrideToGIArgumentFunc to_func, - PyGIArgOverrideFromGIArgumentFunc from_func, - PyGIArgOverrideReleaseFunc release_func) -{ - if (_pygi_import() < 0) { - return NULL; - } - PyGI_API->register_foreign_struct(namespace_, - name, - to_func, - from_func, - release_func); - Py_RETURN_NONE; -} - -#endif /* __PYGI_H__ */ diff --git a/gi/_gobject/pyginterface.c b/gi/pyginterface.c similarity index 60% rename from gi/_gobject/pyginterface.c rename to gi/pyginterface.c index eb76ba0..288fbb2 100644 --- a/gi/_gobject/pyginterface.c +++ b/gi/pyginterface.c @@ -15,25 +15,22 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include -#include "pyglib.h" -#include "pygobject-private.h" +#include +#include "pygi-util.h" #include "pyginterface.h" +#include "pygi-type.h" GQuark pyginterface_type_key; GQuark pyginterface_info_key; -PYGLIB_DEFINE_TYPE("gobject.GInterface", PyGInterface_Type, PyObject) +PYGI_DEFINE_TYPE("gobject.GInterface", PyGInterface_Type, PyObject) static int pyg_interface_init(PyObject *self, PyObject *args, PyObject *kwargs) @@ -72,7 +69,8 @@ pyg_register_interface(PyObject *dict, const gchar *class_name, { PyObject *o; - Py_TYPE(type) = &PyType_Type; + Py_SET_TYPE(type, &PyType_Type); + g_assert (Py_TYPE (&PyGInterface_Type) != NULL); type->tp_base = &PyGInterface_Type; if (PyType_Ready(type) < 0) { @@ -87,15 +85,21 @@ pyg_register_interface(PyObject *dict, const gchar *class_name, } g_type_set_qdata(gtype, pyginterface_type_key, type); - + PyDict_SetItemString(dict, (char *)class_name, (PyObject *)type); - + } void pyg_register_interface_info(GType gtype, const GInterfaceInfo *info) { - g_type_set_qdata(gtype, pyginterface_info_key, (gpointer) info); + GInterfaceInfo *prev_info = pyg_lookup_interface_info (gtype); + + if (prev_info) { + g_free (prev_info); + } + + g_type_set_qdata(gtype, pyginterface_info_key, g_memdup2 (info, sizeof(GInterfaceInfo))); } const GInterfaceInfo * @@ -104,21 +108,35 @@ pyg_lookup_interface_info(GType gtype) return g_type_get_qdata(gtype, pyginterface_info_key); } -void -pygobject_interface_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_interface_register_types(PyObject *d) { - pyginterface_type_key = g_quark_from_static_string("PyGInterface::type"); - pyginterface_info_key = g_quark_from_static_string("PyGInterface::info"); + PyObject *pygtype; + + pyginterface_type_key = g_quark_from_static_string("PyGInterface::type"); + pyginterface_info_key = g_quark_from_static_string("PyGInterface::info"); + + PyGInterface_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; + PyGInterface_Type.tp_init = (initproc)pyg_interface_init; + PyGInterface_Type.tp_free = (freefunc)pyg_interface_free; + PyGInterface_Type.tp_alloc = PyType_GenericAlloc; + PyGInterface_Type.tp_new = PyType_GenericNew; + if (PyType_Ready(&PyGInterface_Type)) + return -1; + + pygtype = pyg_type_wrapper_new (G_TYPE_INTERFACE); + PyDict_SetItemString (PyGInterface_Type.tp_dict, "__gtype__", pygtype); + Py_DECREF (pygtype); - PyGInterface_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; - PyGInterface_Type.tp_init = (initproc)pyg_interface_init; - PyGInterface_Type.tp_free = (freefunc)pyg_interface_free; + PyDict_SetItemString(PyGInterface_Type.tp_dict, "__doc__", + pyg_object_descr_doc_get()); + PyDict_SetItemString(PyGInterface_Type.tp_dict, "__gdoc__", + pyg_object_descr_doc_get()); - PYGOBJECT_REGISTER_GTYPE(d, PyGInterface_Type, "GInterface", G_TYPE_INTERFACE) + PyDict_SetItemString(d, "GInterface", (PyObject *)&PyGInterface_Type); - PyDict_SetItemString(PyGInterface_Type.tp_dict, "__doc__", - pyg_object_descr_doc_get()); - PyDict_SetItemString(PyGInterface_Type.tp_dict, "__gdoc__", - pyg_object_descr_doc_get()); - + return 0; } diff --git a/gi/_gobject/pyginterface.h b/gi/pyginterface.h similarity index 86% rename from gi/_gobject/pyginterface.h rename to gi/pyginterface.h index 0f390c2..d5819ce 100644 --- a/gi/_gobject/pyginterface.h +++ b/gi/pyginterface.h @@ -15,9 +15,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGOBJECT_INTERFACE_H__ @@ -35,6 +33,6 @@ void pyg_register_interface(PyObject *dict, const GInterfaceInfo * pyg_lookup_interface_info(GType gtype); void pyg_register_interface_info(GType gtype, const GInterfaceInfo *info); -void pygobject_interface_register_types(PyObject *d); +int pygi_interface_register_types(PyObject *d); #endif /* __PYGOBJECT_INTERFACE_H__ */ diff --git a/gi/pygobject-external.h b/gi/pygobject-external.h deleted file mode 100644 index 8299864..0000000 --- a/gi/pygobject-external.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; c-basic-offset: 4 -*- - * vim: tabstop=4 shiftwidth=4 expandtab - * - * Copyright (C) 2009 Simon van der Linden - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __PYGOBJECT_EXTERN_H__ -#define __PYGOBJECT_EXTERN_H__ - -#include - -G_BEGIN_DECLS - -static PyTypeObject *_PyGTypeWrapper_Type; - -#define PyGTypeWrapper_Type (*_PyGTypeWrapper_Type) - -G_GNUC_UNUSED -static int -_pygobject_import (void) -{ - static gboolean imported = FALSE; - PyObject *from_list; - PyObject *module; - int retval = 0; - - if (imported) { - return 1; - } - - from_list = Py_BuildValue ("(s)", "GType"); - if (from_list == NULL) { - return -1; - } - - module = PyImport_ImportModuleEx ("gi._gobject", NULL, NULL, from_list); - - Py_DECREF (from_list); - - if (module == NULL) { - return -1; - } - - _PyGTypeWrapper_Type = (PyTypeObject *) PyObject_GetAttrString (module, "GType"); - if (_PyGTypeWrapper_Type == NULL) { - retval = -1; - goto out; - } - - imported = TRUE; - -out: - Py_DECREF (module); - - return retval; -} - -G_END_DECLS - -#endif /* __PYGOBJECT_EXTERN_H__ */ diff --git a/gi/pygobject-internal.h b/gi/pygobject-internal.h new file mode 100644 index 0000000..2cd82c5 --- /dev/null +++ b/gi/pygobject-internal.h @@ -0,0 +1,7 @@ +#ifndef _PYGOBJECT_INTERNAL_H_ +#define _PYGOBJECT_INTERNAL_H_ + +#define _INSIDE_PYGOBJECT_ +#include "pygobject.h" + +#endif /*_PYGOBJECT_INTERNAL_H_*/ diff --git a/gi/_gobject/pygobject.c b/gi/pygobject-object.c similarity index 83% rename from gi/_gobject/pygobject.c rename to gi/pygobject-object.c index 126c80e..961f6dd 100644 --- a/gi/_gobject/pygobject.c +++ b/gi/pygobject-object.c @@ -15,31 +15,32 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include -#include -#include "pygobject-private.h" +#include "pygobject-object.h" #include "pyginterface.h" #include "pygparamspec.h" +#include "pygi-type.h" +#include "pygboxed.h" +#include "gimodule.h" -#include "pygi.h" +#include "pygi-util.h" +#include "pygi-value.h" +#include "pygi-type.h" +#include "pygi-property.h" +#include "pygi-signal-closure.h" +#include "pygi-basictype.h" +extern PyObject *PyGIDeprecationWarning; static void pygobject_dealloc(PyGObject *self); static int pygobject_traverse(PyGObject *self, visitproc visit, void *arg); -static int pygobject_clear(PyGObject *self); static PyObject * pyg_type_get_bases(GType gtype); static inline int pygobject_clear(PyGObject *self); static PyObject * pygobject_weak_ref_new(GObject *obj, PyObject *callback, PyObject *user_data); -static PyObject * pygbinding_weak_ref_new(GObject *obj); -static inline PyGObjectData * pyg_object_peek_inst_data(GObject *obj); static void pygobject_inherit_slots(PyTypeObject *type, PyObject *bases, gboolean check_for_present); static void pygobject_find_slot_for(PyTypeObject *type, PyObject *bases, int slot_offset, @@ -52,6 +53,31 @@ GQuark pygobject_wrapper_key; GQuark pygobject_has_updated_constructor_key; GQuark pygobject_instance_data_key; +/* PyPy doesn't support tp_dictoffset, so we have to work around it */ +#ifndef PYPY_VERSION +#define PYGI_OBJECT_USE_CUSTOM_DICT +#endif + +GClosure * +gclosure_from_pyfunc(PyGObject *object, PyObject *func) +{ + GSList *l; + PyGObjectData *inst_data; + inst_data = pyg_object_peek_inst_data(object->obj); + if (inst_data) { + for (l = inst_data->closures; l; l = l->next) { + PyGClosure *pyclosure = l->data; + int res = PyObject_RichCompareBool(pyclosure->callback, func, Py_EQ); + if (res == -1) { + PyErr_Clear(); /* Is there anything else to do? */ + } else if (res) { + return (GClosure*)pyclosure; + } + } + } + return NULL; +} + /* Copied from glib. gobject uses hyphens in property names, but in Python * we can only represent hyphens as underscores. Convert underscores to * hyphens for glib compatibility. */ @@ -74,19 +100,20 @@ canonicalize_key (gchar *key) /* -------------- class <-> wrapper manipulation --------------- */ -void +static void pygobject_data_free(PyGObjectData *data) { /* This function may be called after the python interpreter has already * been shut down. If this happens, we cannot do any python calls, so just * free the memory. */ - PyGILState_STATE state; + PyGILState_STATE state = 0; PyThreadState *_save = NULL; - + gboolean state_saved; GSList *closures, *tmp; - if (Py_IsInitialized()) { - state = pyglib_gil_state_ensure(); + state_saved = Py_IsInitialized(); + if (state_saved) { + state = PyGILState_Ensure(); Py_DECREF(data->type); /* We cannot use Py_BEGIN_ALLOW_THREADS here because this is inside * a branch. */ @@ -112,9 +139,9 @@ pygobject_data_free(PyGObjectData *data) g_free(data); - if (Py_IsInitialized()) { + if (state_saved && Py_IsInitialized ()) { Py_BLOCK_THREADS; /* Restores _save */ - pyglib_gil_state_release(state); + PyGILState_Release(state); } } @@ -180,7 +207,7 @@ typedef struct { guint index; } PyGPropsIter; -PYGLIB_DEFINE_TYPE("gi._gobject.GPropsIter", PyGPropsIter_Type, PyGPropsIter); +PYGI_DEFINE_TYPE("gi._gi.GPropsIter", PyGPropsIter_Type, PyGPropsIter); static void pyg_props_iter_dealloc(PyGPropsIter *self) @@ -236,14 +263,12 @@ build_parameter_list(GObjectClass *class) name = g_strdup(g_param_spec_get_name(props[i])); /* hyphens cannot belong in identifiers */ g_strdelimit(name, "-", '_'); - prop_str = PYGLIB_PyUnicode_FromString(name); + prop_str = PyUnicode_FromString (name); PyList_SetItem(props_list, i, prop_str); g_free(name); } - g_type_class_unref(class); - if (props) g_free(props); @@ -256,22 +281,14 @@ PyGProps_getattro(PyGProps *self, PyObject *attr) char *attr_name, *property_name; GObjectClass *class; GParamSpec *pspec; - GValue value = { 0, }; - PyObject *ret; - attr_name = PYGLIB_PyUnicode_AsString(attr); + attr_name = PyUnicode_AsUTF8 (attr); if (!attr_name) { PyErr_Clear(); return PyObject_GenericGetAttr((PyObject *)self, attr); } class = g_type_class_ref(self->gtype); - - if (!strcmp(attr_name, "__members__")) { - ret = build_parameter_list(class); - g_type_class_unref(class); - return ret; - } /* g_object_class_find_property recurses through the class hierarchy, * so the resulting pspec tells us the owner_type that owns the property @@ -286,36 +303,12 @@ PyGProps_getattro(PyGProps *self, PyObject *attr) return PyObject_GenericGetAttr((PyObject *)self, attr); } - if (!(pspec->flags & G_PARAM_READABLE)) { - PyErr_Format(PyExc_TypeError, - "property '%s' is not readable", attr_name); - return NULL; - } - if (!self->pygobject) { /* If we're doing it without an instance, return a GParamSpec */ return pyg_param_spec_new(pspec); } - if (!pyg_gtype_is_custom (pspec->owner_type)) { - /* The GType is not implemented at the Python level: see if we can - * read the property value via gi. */ - ret = pygi_get_property_value (self->pygobject, pspec); - if (ret) - return ret; - } - - /* The GType is implemented in Python, or we failed to read it via gi: - * do a straightforward read. */ - Py_BEGIN_ALLOW_THREADS; - g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); - g_object_get_property(self->pygobject->obj, pspec->name, &value); - Py_END_ALLOW_THREADS; - - ret = pyg_param_gvalue_as_pyobject(&value, TRUE, pspec); - g_value_unset(&value); - - return ret; + return pygi_get_property_value (self->pygobject, pspec); } static gboolean @@ -340,10 +333,10 @@ set_property_from_pspec(GObject *obj, g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); if (pyg_param_gvalue_from_pyobject(&value, pvalue, pspec) < 0) { - PyObject *pvalue_str = PyObject_Str(pvalue); + PyObject *pvalue_str = PyObject_Repr(pvalue); PyErr_Format(PyExc_TypeError, - "could not convert '%s' to type '%s' when setting property '%s.%s'", - PYGLIB_PyUnicode_AsString(pvalue_str), + "could not convert %s to type '%s' when setting property '%s.%s'", + PyUnicode_AsUTF8 (pvalue_str), g_type_name(G_PARAM_SPEC_VALUE_TYPE(pspec)), G_OBJECT_TYPE_NAME(obj), pspec->name); @@ -359,7 +352,7 @@ set_property_from_pspec(GObject *obj, return TRUE; } -PYGLIB_DEFINE_TYPE("gi._gobject.GProps", PyGProps_Type, PyGProps); +PYGI_DEFINE_TYPE("gi._gi.GProps", PyGProps_Type, PyGProps); static int PyGProps_setattro(PyGProps *self, PyObject *attr, PyObject *pvalue) @@ -375,7 +368,7 @@ PyGProps_setattro(PyGProps *self, PyObject *attr, PyObject *pvalue) return -1; } - attr_name = PYGLIB_PyUnicode_AsString(attr); + attr_name = PyUnicode_AsUTF8 (attr); if (!attr_name) { PyErr_Clear(); return PyObject_GenericSetAttr((PyObject *)self, attr, pvalue); @@ -441,6 +434,25 @@ pygobject_props_get_iter(PyGProps *self) return (PyObject *) iter; } +static PyObject* +pygobject_props_dir(PyGProps *self) +{ + PyObject *ret; + GObjectClass *class; + + class = g_type_class_ref (self->gtype); + ret = build_parameter_list (class); + g_type_class_unref (class); + + return ret; +} + +static PyMethodDef pygobject_props_methods[] = { + { "__dir__", (PyCFunction)pygobject_props_dir, METH_NOARGS}, + { NULL, NULL, 0} +}; + + static Py_ssize_t PyGProps_length(PyGProps *self) { @@ -466,7 +478,7 @@ static PySequenceMethods _PyGProps_as_sequence = { 0 }; -PYGLIB_DEFINE_TYPE("gi._gobject.GPropsDescr", PyGPropsDescr_Type, PyObject); +PYGI_DEFINE_TYPE("gi._gi.GPropsDescr", PyGPropsDescr_Type, PyObject); static PyObject * pyg_props_descr_descr_get(PyObject *self, PyObject *obj, PyObject *type) @@ -548,7 +560,7 @@ pygobject_register_class(PyObject *dict, const gchar *type_name, } else bases = runtime_bases; - Py_TYPE(type) = PyGObject_MetaType; + Py_SET_TYPE(type, PyGObject_MetaType); type->tp_bases = bases; if (G_LIKELY(bases)) { type->tp_base = (PyTypeObject *)PyTuple_GetItem(bases, 0); @@ -567,7 +579,7 @@ pygobject_register_class(PyObject *dict, const gchar *type_name, */ s = strrchr(type->tp_name, '.'); if (s != NULL) { - mod_name = PYGLIB_PyUnicode_FromStringAndSize(type->tp_name, (int)(s - type->tp_name)); + mod_name = PyUnicode_FromStringAndSize (type->tp_name, (int)(s - type->tp_name)); PyDict_SetItemString(type->tp_dict, "__module__", mod_name); Py_DECREF(mod_name); } @@ -592,17 +604,49 @@ pygobject_register_class(PyObject *dict, const gchar *type_name, static void pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref) { - PyGObject *self = (PyGObject*) data; + PyGObject *self; PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); - if (is_last_ref) - Py_DECREF(self); - else - Py_INCREF(self); + /* Avoid thread safety problems by using qdata for wrapper retrieval + * instead of the user data argument. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=709223 + */ + self = (PyGObject *)g_object_get_qdata (object, pygobject_wrapper_key); + if (self) { + if (is_last_ref) + Py_DECREF(self); + else + Py_INCREF(self); + } - pyglib_gil_state_release(state); + PyGILState_Release(state); +} + +static inline gboolean +pygobject_toggle_ref_is_required (PyGObject *self) +{ +#ifdef PYGI_OBJECT_USE_CUSTOM_DICT + return self->inst_dict != NULL; +#else + PyObject *dict; + gboolean result; + dict = PyObject_GetAttrString ((PyObject *)self, "__dict__"); + if (!dict) { + PyErr_Clear (); + return FALSE; + } + result = PyDict_Size (dict) != 0; + Py_DECREF (dict); + return result; +#endif +} + +static inline gboolean +pygobject_toggle_ref_is_active (PyGObject *self) +{ + return self->private_flags.flags & PYGOBJECT_USING_TOGGLE_REF; } /* Called when the inst_dict is first created; switches the @@ -611,17 +655,23 @@ pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref) inst_dict was NULL the python wrapper is allowed to die at will and is recreated on demand. */ static inline void -pygobject_switch_to_toggle_ref(PyGObject *self) +pygobject_toggle_ref_ensure (PyGObject *self) { - g_assert(self->obj->ref_count >= 1); + if (pygobject_toggle_ref_is_active (self)) + return; - if (self->private_flags.flags & PYGOBJECT_USING_TOGGLE_REF) - return; /* already using toggle ref */ + if (!pygobject_toggle_ref_is_required (self)) + return; + + if (self->obj == NULL) + return; + + g_assert(self->obj->ref_count >= 1); self->private_flags.flags |= PYGOBJECT_USING_TOGGLE_REF; /* Note that add_toggle_ref will never immediately call back into pyg_toggle_notify */ Py_INCREF((PyObject *) self); - g_object_add_toggle_ref(self->obj, pyg_toggle_notify, self); + g_object_add_toggle_ref(self->obj, pyg_toggle_notify, NULL); g_object_unref(self->obj); } @@ -672,8 +722,8 @@ pygobject_register_wrapper(PyObject *self) g_assert(gself->obj->ref_count >= 1); /* save wrapper pointer so we can access it later */ g_object_set_qdata_full(gself->obj, pygobject_wrapper_key, gself, NULL); - if (gself->inst_dict) - pygobject_switch_to_toggle_ref(gself); + + pygobject_toggle_ref_ensure (gself); } static PyObject * @@ -683,7 +733,7 @@ pyg_type_get_bases(GType gtype) guint n_interfaces; PyTypeObject *py_parent_type, *py_interface_type; PyObject *bases; - int i; + guint i; if (G_UNLIKELY(gtype == G_TYPE_OBJECT)) return NULL; @@ -728,10 +778,8 @@ pygobject_new_with_interfaces(GType gtype) PyObject *dict; PyTypeObject *py_parent_type; PyObject *bases; - PyObject *modules, *module; - gchar *type_name, *mod_name, *gtype_name; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); bases = pyg_type_get_bases(gtype); py_parent_type = (PyTypeObject *) PyTuple_GetItem(bases, 0); @@ -745,36 +793,18 @@ pygobject_new_with_interfaces(GType gtype) /* set up __doc__ descriptor on type */ PyDict_SetItemString(dict, "__doc__", pyg_object_descr_doc_get()); - /* generate the pygtk module name and extract the base type name */ - gtype_name = (gchar*)g_type_name(gtype); - if (g_str_has_prefix(gtype_name, "Gtk")) { - mod_name = "gtk"; - gtype_name += 3; - type_name = g_strconcat(mod_name, ".", gtype_name, NULL); - } else if (g_str_has_prefix(gtype_name, "Gdk")) { - mod_name = "gtk.gdk"; - gtype_name += 3; - type_name = g_strconcat(mod_name, ".", gtype_name, NULL); - } else if (g_str_has_prefix(gtype_name, "Atk")) { - mod_name = "atk"; - gtype_name += 3; - type_name = g_strconcat(mod_name, ".", gtype_name, NULL); - } else if (g_str_has_prefix(gtype_name, "Pango")) { - mod_name = "pango"; - gtype_name += 5; - type_name = g_strconcat(mod_name, ".", gtype_name, NULL); - } else { - mod_name = "__main__"; - type_name = g_strconcat(mod_name, ".", gtype_name, NULL); - } + /* Something special to point out that it's not accessible through + * gi.repository */ + o = PyUnicode_FromString ("__gi__"); + PyDict_SetItemString (dict, "__module__", o); + Py_DECREF (o); type = (PyTypeObject*)PyObject_CallFunction((PyObject *) Py_TYPE(py_parent_type), - "sNN", type_name, bases, dict); - g_free(type_name); + "sNN", g_type_name (gtype), bases, dict); if (type == NULL) { PyErr_Print(); - pyglib_gil_state_release(state); + PyGILState_Release(state); return NULL; } @@ -799,21 +829,15 @@ pygobject_new_with_interfaces(GType gtype) if (PyType_Ready(type) < 0) { g_warning ("couldn't make the type `%s' ready", type->tp_name); - pyglib_gil_state_release(state); + PyGILState_Release(state); return NULL; } - /* insert type name in module dict */ - modules = PyImport_GetModuleDict(); - if ((module = PyDict_GetItemString(modules, mod_name)) != NULL) { - if (PyObject_SetAttrString(module, gtype_name, (PyObject *)type) < 0) - PyErr_Clear(); - } /* stash a pointer to the python class with the GType */ Py_INCREF(type); g_type_set_qdata(gtype, pygobject_class_key, type); - pyglib_gil_state_release(state); + PyGILState_Release(state); return type; } @@ -846,16 +870,13 @@ static void pygobject_inherit_slots(PyTypeObject *type, PyObject *bases, gboolean check_for_present) { static int slot_offsets[] = { offsetof(PyTypeObject, tp_richcompare), -#if PY_VERSION_HEX < 0x03000000 - offsetof(PyTypeObject, tp_compare), -#endif offsetof(PyTypeObject, tp_richcompare), offsetof(PyTypeObject, tp_hash), offsetof(PyTypeObject, tp_iter), offsetof(PyTypeObject, tp_repr), offsetof(PyTypeObject, tp_str), - offsetof(PyTypeObject, tp_print) }; - int i; + }; + gsize i; /* Happens when registering gobject.GObject itself, at least. */ if (!bases) @@ -869,11 +890,11 @@ static void pygobject_find_slot_for(PyTypeObject *type, PyObject *bases, int slot_offset, gboolean check_for_present) { -#define TYPE_SLOT(type) (* (void **) (((char *) (type)) + slot_offset)) +#define TYPE_SLOT(type) (* (void **) (void *) (((char *) (type)) + slot_offset)) void *found_slot = NULL; - int num_bases = PyTuple_Size(bases); - int i; + Py_ssize_t num_bases = PyTuple_Size(bases); + Py_ssize_t i; if (check_for_present && TYPE_SLOT(type) != NULL) { /* We are requested to check if there is any custom slot value @@ -921,6 +942,8 @@ pygobject_find_slot_for(PyTypeObject *type, PyObject *bases, int slot_offset, * or interface has been registered for the given GType, then a new * type will be created. * + * Does not set an exception when NULL is returned. + * * Returns: The wrapper class for the GObject or NULL if the * GType has no registered type and a new type couldn't be created */ @@ -930,19 +953,22 @@ pygobject_lookup_class(GType gtype) PyTypeObject *py_type; if (gtype == G_TYPE_INTERFACE) - return &PyGInterface_Type; + return &PyGInterface_Type; py_type = g_type_get_qdata(gtype, pygobject_class_key); if (py_type == NULL) { - py_type = g_type_get_qdata(gtype, pyginterface_type_key); + py_type = g_type_get_qdata(gtype, pyginterface_type_key); - if (py_type == NULL) - py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype); + if (py_type == NULL) { + py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype); + PyErr_Clear (); + } - if (py_type == NULL) { - py_type = pygobject_new_with_interfaces(gtype); - g_type_set_qdata(gtype, pyginterface_type_key, py_type); - } + if (py_type == NULL) { + py_type = pygobject_new_with_interfaces(gtype); + PyErr_Clear (); + g_type_set_qdata(gtype, pyginterface_type_key, py_type); + } } return py_type; @@ -1040,7 +1066,12 @@ pygobject_unwatch_closure(gpointer data, GClosure *closure) { PyGObjectData *inst_data = data; + /* Despite no Python API is called the list inst_data->closures + * must be protected by GIL as it is used by GC in + * pygobject_traverse */ + PyGILState_STATE state = PyGILState_Ensure(); inst_data->closures = g_slist_remove (inst_data->closures, closure); + PyGILState_Release(state); } /** @@ -1067,6 +1098,7 @@ pygobject_watch_closure(PyObject *self, GClosure *closure) gself = (PyGObject *)self; data = pygobject_get_inst_data(gself); + g_return_if_fail(data != NULL); g_return_if_fail(g_slist_find(data->closures, closure) == NULL); data->closures = g_slist_prepend(data->closures, closure); g_closure_add_invalidate_notifier(closure, data, pygobject_unwatch_closure); @@ -1075,7 +1107,7 @@ pygobject_watch_closure(PyObject *self, GClosure *closure) /* -------------- PyGObject behaviour ----------------- */ -PYGLIB_DEFINE_TYPE("gi._gobject.GObject", PyGObject_Type, PyGObject); +PYGI_DEFINE_TYPE("gi._gi.GObject", PyGObject_Type, PyGObject); static void pygobject_dealloc(PyGObject *self) @@ -1087,7 +1119,9 @@ pygobject_dealloc(PyGObject *self) * object. */ PyObject_GC_UnTrack((PyObject *)self); - PyObject_ClearWeakRefs((PyObject *)self); + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *)self); + /* this forces inst_data->type to be updated, which could prove * important if a new wrapper has to be created and it is of a * unregistered type */ @@ -1118,29 +1152,46 @@ pygobject_richcompare(PyObject *self, PyObject *other, int op) return Py_NotImplemented; } - return _pyglib_generic_ptr_richcompare(((PyGObject*)self)->obj, - ((PyGObject*)other)->obj, - op); + return pyg_ptr_richcompare(((PyGObject*)self)->obj, + ((PyGObject*)other)->obj, + op); } -static long +static Py_hash_t pygobject_hash(PyGObject *self) { - return (long)self->obj; + return (Py_hash_t)(gintptr)(self->obj); } static PyObject * pygobject_repr(PyGObject *self) { - gchar buf[256]; + PyObject *module, *repr; + gchar *module_str, *namespace; - g_snprintf(buf, sizeof(buf), - "<%s object at 0x%lx (%s at 0x%lx)>", - Py_TYPE(self)->tp_name, - (long)self, - self->obj ? G_OBJECT_TYPE_NAME(self->obj) : "uninitialized", - (long)self->obj); - return PYGLIB_PyUnicode_FromString(buf); + module = PyObject_GetAttrString ((PyObject *)self, "__module__"); + if (module == NULL) + return NULL; + + if (!PyUnicode_Check (module)) { + Py_DECREF (module); + return NULL; + } + + module_str = PyUnicode_AsUTF8 (module); + namespace = g_strrstr (module_str, "."); + if (namespace == NULL) { + namespace = module_str; + } else { + namespace += 1; + } + + repr = PyUnicode_FromFormat ("<%s.%s object at %p (%s at %p)>", + namespace, Py_TYPE (self)->tp_name, self, + self->obj ? G_OBJECT_TYPE_NAME (self->obj) : "uninitialized", + self->obj); + Py_DECREF (module); + return repr; } @@ -1154,8 +1205,10 @@ pygobject_traverse(PyGObject *self, visitproc visit, void *arg) if (self->inst_dict) ret = visit(self->inst_dict, arg); if (ret != 0) return ret; - if (data) { - + /* Only let the GC track the closures when tp_clear() would free them. + * https://bugzilla.gnome.org/show_bug.cgi?id=731501 + */ + if (data && self->obj->ref_count == 1) { for (tmp = data->closures; tmp != NULL; tmp = tmp->next) { PyGClosure *closure = tmp->data; @@ -1177,8 +1230,8 @@ pygobject_clear(PyGObject *self) { if (self->obj) { g_object_set_qdata_full(self->obj, pygobject_wrapper_key, NULL, NULL); - if (self->inst_dict) { - g_object_remove_toggle_ref(self->obj, pyg_toggle_notify, self); + if (pygobject_toggle_ref_is_active (self)) { + g_object_remove_toggle_ref(self->obj, pyg_toggle_notify, NULL); self->private_flags.flags &= ~PYGOBJECT_USING_TOGGLE_REF; } else { Py_BEGIN_ALLOW_THREADS; @@ -1197,23 +1250,28 @@ pygobject_free(PyObject *op) PyObject_GC_Del(op); } -gboolean +static gboolean pygobject_prepare_construct_properties(GObjectClass *class, PyObject *kwargs, - guint *n_params, GParameter **params) + guint *n_properties, const char **names[], const GValue **values) { - *n_params = 0; - *params = NULL; + *n_properties = 0; + *names = NULL; + *values = NULL; if (kwargs) { Py_ssize_t pos = 0; PyObject *key; PyObject *value; + Py_ssize_t len; - *params = g_new0(GParameter, PyDict_Size(kwargs)); + len = PyDict_Size(kwargs); + *names = g_new(const char*, len); + *values = g_new0(GValue, len); while (PyDict_Next(kwargs, &pos, &key, &value)) { GParamSpec *pspec; - GParameter *param = &(*params)[*n_params]; - const gchar *key_str = PYGLIB_PyUnicode_AsString(key); + GValue *gvalue = &(*values)[*n_properties]; + + const gchar *key_str = PyUnicode_AsUTF8 (key); pspec = g_object_class_find_property(class, key_str); if (!pspec) { @@ -1222,16 +1280,16 @@ pygobject_prepare_construct_properties(GObjectClass *class, PyObject *kwargs, G_OBJECT_CLASS_NAME(class), key_str); return FALSE; } - g_value_init(¶m->value, G_PARAM_SPEC_VALUE_TYPE(pspec)); - if (pyg_param_gvalue_from_pyobject(¶m->value, value, pspec) < 0) { + g_value_init(gvalue, G_PARAM_SPEC_VALUE_TYPE(pspec)); + if (pyg_param_gvalue_from_pyobject(gvalue, value, pspec) < 0) { PyErr_Format(PyExc_TypeError, "could not convert value for property `%s' from %s to %s", key_str, Py_TYPE(value)->tp_name, g_type_name(G_PARAM_SPEC_VALUE_TYPE(pspec))); return FALSE; } - param->name = g_strdup(key_str); - ++(*n_params); + (*names)[*n_properties] = g_strdup(key_str); + ++(*n_properties); } } return TRUE; @@ -1243,11 +1301,24 @@ static int pygobject_init(PyGObject *self, PyObject *args, PyObject *kwargs) { GType object_type; - guint n_params = 0, i; - GParameter *params = NULL; + guint n_properties = 0, i; + const GValue *values = NULL; + const char **names = NULL; GObjectClass *class; - if (!PyArg_ParseTuple(args, ":GObject.__init__", &object_type)) + /* Only do GObject creation and property setting if the GObject hasn't + * already been created. The case where self->obj already exists can occur + * when C constructors are called directly (Gtk.Button.new_with_label) + * and we are simply wrapping the result with a PyGObject. + * In these cases we want to ignore any keyword arguments passed along + * to __init__ and simply return. + * + * See: https://bugzilla.gnome.org/show_bug.cgi?id=705810 + */ + if (self->obj != NULL) + return 0; + + if (!PyArg_ParseTuple(args, ":GObject.__init__", NULL)) return -1; object_type = pyg_type_from_object((PyObject *)self); @@ -1266,18 +1337,20 @@ pygobject_init(PyGObject *self, PyObject *args, PyObject *kwargs) return -1; } - if (!pygobject_prepare_construct_properties (class, kwargs, &n_params, ¶ms)) + if (!pygobject_prepare_construct_properties (class, kwargs, &n_properties, &names, &values)) goto cleanup; - if (pygobject_constructv(self, n_params, params)) - PyErr_SetString(PyExc_RuntimeError, "could not create object"); - + if (pygobject_constructv(self, n_properties, names, values)) + PyErr_SetString(PyExc_RuntimeError, "could not create object"); + cleanup: - for (i = 0; i < n_params; i++) { - g_free((gchar *) params[i].name); - g_value_unset(¶ms[i].value); + for (i = 0; i < n_properties; i++) { + g_free(names[i]); + g_value_unset(&values[i]); } - g_free(params); + g_free(names); + g_free(values); + g_type_class_unref(class); return (self->obj) ? 0 : -1; @@ -1292,46 +1365,23 @@ pygobject_init(PyGObject *self, PyObject *args, PyObject *kwargs) } static PyObject * -pygobject_get_property(PyGObject *self, PyObject *args) +pygobject_get_property (PyGObject *self, PyObject *args) { gchar *param_name; - GParamSpec *pspec; - GValue value = { 0, }; - PyObject *ret; - if (!PyArg_ParseTuple(args, "s:GObject.get_property", ¶m_name)) - return NULL; + if (!PyArg_ParseTuple (args, "s:GObject.get_property", ¶m_name)) { + return NULL; + } CHECK_GOBJECT(self); - - pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(self->obj), - param_name); - if (!pspec) { - PyErr_Format(PyExc_TypeError, - "object of type `%s' does not have property `%s'", - g_type_name(G_OBJECT_TYPE(self->obj)), param_name); - return NULL; - } - if (!(pspec->flags & G_PARAM_READABLE)) { - PyErr_Format(PyExc_TypeError, "property %s is not readable", - param_name); - return NULL; - } - g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); - Py_BEGIN_ALLOW_THREADS; - g_object_get_property(self->obj, param_name, &value); - Py_END_ALLOW_THREADS; - ret = pyg_param_gvalue_as_pyobject(&value, TRUE, pspec); - g_value_unset(&value); - return ret; + return pygi_get_property_value_by_name (self, param_name); } static PyObject * pygobject_get_properties(PyGObject *self, PyObject *args) { - GObjectClass *class; - int len, i; + Py_ssize_t len, i; PyObject *tuple; if ((len = PyTuple_Size(args)) < 1) { @@ -1340,48 +1390,27 @@ pygobject_get_properties(PyGObject *self, PyObject *args) } tuple = PyTuple_New(len); - class = G_OBJECT_GET_CLASS(self->obj); for (i = 0; i < len; i++) { PyObject *py_property = PyTuple_GetItem(args, i); gchar *property_name; - GParamSpec *pspec; - GValue value = { 0 }; PyObject *item; - if (!PYGLIB_PyUnicode_Check(py_property)) { + if (!PyUnicode_Check (py_property)) { PyErr_SetString(PyExc_TypeError, "Expected string argument for property."); - return NULL; - } - - property_name = PYGLIB_PyUnicode_AsString(py_property); - - pspec = g_object_class_find_property(class, - property_name); - if (!pspec) { - PyErr_Format(PyExc_TypeError, - "object of type `%s' does not have property `%s'", - g_type_name(G_OBJECT_TYPE(self->obj)), property_name); - return NULL; - } - if (!(pspec->flags & G_PARAM_READABLE)) { - PyErr_Format(PyExc_TypeError, "property %s is not readable", - property_name); - return NULL; + goto fail; } - g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); - - Py_BEGIN_ALLOW_THREADS; - g_object_get_property(self->obj, property_name, &value); - Py_END_ALLOW_THREADS; - item = pyg_value_as_pyobject(&value, TRUE); - PyTuple_SetItem(tuple, i, item); - - g_value_unset(&value); + property_name = PyUnicode_AsUTF8 (py_property); + item = pygi_get_property_value_by_name (self, property_name); + PyTuple_SetItem (tuple, i, item); } return tuple; + +fail: + Py_DECREF (tuple); + return NULL; } static PyObject * @@ -1439,7 +1468,7 @@ pygobject_set_properties(PyGObject *self, PyObject *args, PyObject *kwargs) pos = 0; while (kwargs && PyDict_Next (kwargs, &pos, &key, &value)) { - gchar *key_str = PYGLIB_PyUnicode_AsString(key); + gchar *key_str = PyUnicode_AsUTF8 (key); GParamSpec *pspec; int ret = -1; @@ -1482,10 +1511,10 @@ pygbinding_closure_invalidate(gpointer data, GClosure *closure) PyGClosure *pc = (PyGClosure *)closure; PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); Py_XDECREF(pc->callback); Py_XDECREF(pc->extra_args); - pyglib_gil_state_release(state); + PyGILState_Release(state); pc->callback = NULL; pc->extra_args = NULL; @@ -1504,7 +1533,7 @@ pygbinding_marshal (GClosure *closure, PyObject *params, *ret; GValue *out_value; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); /* construct Python tuple for the parameter values */ params = PyTuple_New(2); @@ -1539,7 +1568,7 @@ pygbinding_marshal (GClosure *closure, out: Py_DECREF(params); - pyglib_gil_state_release(state); + PyGILState_Release(state); } static GClosure * @@ -1623,14 +1652,14 @@ pygobject_bind_property(PyGObject *self, PyObject *args) source_repr = PyObject_Repr((PyObject*)self); target_repr = PyObject_Repr(target); PyErr_Format(PyExc_TypeError, "Cannot create binding from %s.%s to %s.%s", - PYGLIB_PyUnicode_AsString(source_repr), source_name, - PYGLIB_PyUnicode_AsString(target_repr), target_name); + PyUnicode_AsUTF8 (source_repr), source_name, + PyUnicode_AsUTF8 (target_repr), target_name); Py_DECREF(source_repr); Py_DECREF(target_repr); return NULL; } - return pygbinding_weak_ref_new(G_OBJECT (binding)); + return pygobject_new (G_OBJECT (binding)); } static PyObject * @@ -1646,12 +1675,21 @@ connect_helper(PyGObject *self, gchar *name, PyObject *callback, PyObject *extra &sigid, &detail, TRUE)) { PyObject *repr = PyObject_Repr((PyObject*)self); PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", - PYGLIB_PyUnicode_AsString(repr), + PyUnicode_AsUTF8 (repr), name); Py_DECREF(repr); return NULL; } + if (object && !PyObject_TypeCheck (object, &PyGObject_Type)) { + if (PyErr_WarnEx (PyGIDeprecationWarning, + "Using non GObject arguments for connect_object() is deprecated, use: " + "connect_data(signal, callback, data, connect_flags=GObject.ConnectFlags.SWAPPED)", + 1)) { + return NULL; + } + } + g_signal_query (sigid, &query_info); if (!pyg_gtype_is_custom (query_info.itype)) { /* The signal is implemented by a non-Python class, probably @@ -1670,7 +1708,7 @@ connect_helper(PyGObject *self, gchar *name, PyObject *callback, PyObject *extra pygobject_watch_closure((PyObject *)self, closure); handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail, closure, after); - return PyLong_FromUnsignedLong(handlerid); + return pygi_gulong_to_py (handlerid); } static PyObject * @@ -1678,7 +1716,7 @@ pygobject_connect(PyGObject *self, PyObject *args) { PyObject *first, *callback, *extra_args, *ret; gchar *name; - guint len; + Py_ssize_t len; len = PyTuple_Size(args); if (len < 2) { @@ -1845,13 +1883,13 @@ pygobject_emit(PyGObject *self, PyObject *args) &signal_id, &detail, TRUE)) { repr = PyObject_Repr((PyObject*)self); PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", - PYGLIB_PyUnicode_AsString(repr), + PyUnicode_AsUTF8 (repr), name); Py_DECREF(repr); return NULL; } g_signal_query(signal_id, &query); - if (len != query.n_params + 1) { + if ((gsize)len != query.n_params + 1) { gchar buf[128]; g_snprintf(buf, sizeof(buf), @@ -1890,15 +1928,26 @@ pygobject_emit(PyGObject *self, PyObject *args) if (query.return_type != G_TYPE_NONE) g_value_init(&ret, query.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE); + Py_BEGIN_ALLOW_THREADS; g_signal_emitv(params, signal_id, detail, &ret); + Py_END_ALLOW_THREADS; for (i = 0; i < query.n_params + 1; i++) g_value_unset(¶ms[i]); g_free(params); if ((query.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE) != G_TYPE_NONE) { + gboolean was_floating = FALSE; + + if (G_VALUE_HOLDS_OBJECT (&ret)) { + GObject *obj = g_value_get_object (&ret); + if (obj != NULL && G_IS_OBJECT(obj)) { + was_floating = g_object_is_floating (obj); + } + } py_ret = pyg_value_as_pyobject(&ret, TRUE); - g_value_unset(&ret); + if (!was_floating) + g_value_unset(&ret); } else { Py_INCREF(Py_None); py_ret = Py_None; @@ -1936,7 +1985,7 @@ pygobject_chain_from_overridden(PyGObject *self, PyObject *args) return NULL; } g_signal_query(signal_id, &query); - if (len != query.n_params) { + if (len < 0 || (gsize)len != query.n_params) { gchar buf[128]; g_snprintf(buf, sizeof(buf), @@ -1992,7 +2041,7 @@ pygobject_chain_from_overridden(PyGObject *self, PyObject *args) static PyObject * pygobject_weak_ref(PyGObject *self, PyObject *args) { - int len; + Py_ssize_t len; PyObject *callback = NULL, *user_data = NULL; PyObject *retval; @@ -2047,7 +2096,7 @@ pygobject_disconnect_by_func(PyGObject *self, PyObject *args) if (!closure) { repr = PyObject_Repr((PyObject*)pyfunc); PyErr_Format(PyExc_TypeError, "nothing connected to %s", - PYGLIB_PyUnicode_AsString(repr)); + PyUnicode_AsUTF8 (repr)); Py_DECREF(repr); return NULL; } @@ -2057,7 +2106,7 @@ pygobject_disconnect_by_func(PyGObject *self, PyObject *args) 0, 0, closure, NULL, NULL); - return PYGLIB_PyLong_FromLong(retval); + return pygi_guint_to_py (retval); } static PyObject * @@ -2081,7 +2130,7 @@ pygobject_handler_block_by_func(PyGObject *self, PyObject *args) if (!closure) { repr = PyObject_Repr((PyObject*)pyfunc); PyErr_Format(PyExc_TypeError, "nothing connected to %s", - PYGLIB_PyUnicode_AsString(repr)); + PyUnicode_AsUTF8 (repr)); Py_DECREF(repr); return NULL; } @@ -2091,7 +2140,7 @@ pygobject_handler_block_by_func(PyGObject *self, PyObject *args) 0, 0, closure, NULL, NULL); - return PYGLIB_PyLong_FromLong(retval); + return pygi_guint_to_py (retval); } static PyObject * @@ -2115,7 +2164,7 @@ pygobject_handler_unblock_by_func(PyGObject *self, PyObject *args) if (!closure) { repr = PyObject_Repr((PyObject*)pyfunc); PyErr_Format(PyExc_TypeError, "nothing connected to %s", - PYGLIB_PyUnicode_AsString(repr)); + PyUnicode_AsUTF8 (repr)); Py_DECREF(repr); return NULL; } @@ -2125,7 +2174,7 @@ pygobject_handler_unblock_by_func(PyGObject *self, PyObject *args) 0, 0, closure, NULL, NULL); - return PYGLIB_PyLong_FromLong(retval); + return pygi_guint_to_py (retval); } @@ -2150,20 +2199,18 @@ static PyMethodDef pygobject_methods[] = { { NULL, NULL, 0 } }; - +#ifdef PYGI_OBJECT_USE_CUSTOM_DICT static PyObject * pygobject_get_dict(PyGObject *self, void *closure) { if (self->inst_dict == NULL) { - self->inst_dict = PyDict_New(); - if (self->inst_dict == NULL) - return NULL; - if (G_LIKELY(self->obj)) - pygobject_switch_to_toggle_ref(self); + self->inst_dict = PyDict_New(); + pygobject_toggle_ref_ensure (self); } Py_INCREF(self->inst_dict); return self->inst_dict; } +#endif static PyObject * pygobject_get_refcount(PyGObject *self, void *closure) @@ -2172,32 +2219,28 @@ pygobject_get_refcount(PyGObject *self, void *closure) PyErr_Format(PyExc_TypeError, "GObject instance is not yet created"); return NULL; } - return PYGLIB_PyLong_FromLong(self->obj->ref_count); + return pygi_guint_to_py (self->obj->ref_count); } static PyObject * pygobject_get_pointer(PyGObject *self, void *closure) { - return PYGLIB_CPointer_WrapPointer (self->obj, NULL); + return PyCapsule_New (self->obj, NULL, NULL); } static int pygobject_setattro(PyObject *self, PyObject *name, PyObject *value) { int res; - PyGObject *gself = (PyGObject *) self; - PyObject *inst_dict_before = gself->inst_dict; - /* call parent type's setattro */ res = PyGObject_Type.tp_base->tp_setattro(self, name, value); - if (inst_dict_before == NULL && gself->inst_dict != NULL) { - if (G_LIKELY(gself->obj)) - pygobject_switch_to_toggle_ref(gself); - } + pygobject_toggle_ref_ensure ((PyGObject *) self); return res; } static PyGetSetDef pygobject_getsets[] = { +#ifdef PYGI_OBJECT_USE_CUSTOM_DICT { "__dict__", (getter)pygobject_get_dict, (setter)0 }, +#endif { "__grefcount__", (getter)pygobject_get_refcount, (setter)0, }, { "__gpointer__", (getter)pygobject_get_pointer, (setter)0, }, { NULL, 0, 0 } @@ -2215,7 +2258,7 @@ typedef struct { gboolean have_floating_ref; } PyGObjectWeakRef; -PYGLIB_DEFINE_TYPE("gi._gobject.GObjectWeakRef", PyGObjectWeakRef_Type, PyGObjectWeakRef); +PYGI_DEFINE_TYPE("gi._gi.GObjectWeakRef", PyGObjectWeakRef_Type, PyGObjectWeakRef); static int pygobject_weak_ref_traverse(PyGObjectWeakRef *self, visitproc visit, void *arg) @@ -2233,7 +2276,7 @@ pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy) self->obj = NULL; if (self->callback) { PyObject *retval; - PyGILState_STATE state = pyglib_gil_state_ensure(); + PyGILState_STATE state = PyGILState_Ensure(); retval = PyObject_Call(self->callback, self->user_data, NULL); if (retval) { if (retval != Py_None) @@ -2251,7 +2294,7 @@ pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy) self->have_floating_ref = FALSE; Py_DECREF((PyObject *) self); } - pyglib_gil_state_release(state); + PyGILState_Release(state); } } @@ -2334,63 +2377,15 @@ pygobject_weak_ref_call(PyGObjectWeakRef *self, PyObject *args, PyObject *kw) } } - -/* -------------- GBinding Weak Reference ----------------- */ - -/** - * BindingWeakRef - * - * The BindingWeakRef object is used to manage GBinding objects within python - * created through GObject.bind_property. It is a sub-class PyGObjectWeakRef so - * that we can maintain the same reference counting semantics between Python - * and GObject Binding objects. This gives explicit direct control of the - * binding lifetime by using the "unbind" method on the BindingWeakRef object - * along with implicit management based on the lifetime of the source or - * target objects. - */ - -PYGLIB_DEFINE_TYPE("gi._gobject.GBindingWeakRef", PyGBindingWeakRef_Type, PyGObjectWeakRef); - -static PyObject * -pygbinding_weak_ref_new(GObject *obj) -{ - PyGObjectWeakRef *self; - - self = PyObject_GC_New(PyGObjectWeakRef, &PyGBindingWeakRef_Type); - self->callback = NULL; - self->user_data = NULL; - self->obj = obj; - g_object_weak_ref(self->obj, (GWeakNotify) pygobject_weak_ref_notify, self); - return (PyObject *) self; -} - -static PyObject * -pygbinding_weak_ref_unbind(PyGObjectWeakRef *self, PyObject *args) -{ - if (!self->obj) { - PyErr_SetString(PyExc_ValueError, "weak binding ref already unreffed"); - return NULL; - } - g_object_unref(self->obj); - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef pygbinding_weak_ref_methods[] = { - { "unbind", (PyCFunction)pygbinding_weak_ref_unbind, METH_NOARGS}, - { NULL, NULL, 0} -}; - - static gpointer pyobject_copy(gpointer boxed) { PyObject *object = boxed; PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); Py_INCREF(object); - pyglib_gil_state_release(state); + PyGILState_Release(state); return object; } @@ -2400,13 +2395,16 @@ pyobject_free(gpointer boxed) PyObject *object = boxed; PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); Py_DECREF(object); - pyglib_gil_state_release(state); + PyGILState_Release(state); } -void -pygobject_object_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pyi_object_register_types(PyObject *d) { PyObject *o, *descr; @@ -2435,7 +2433,9 @@ pygobject_object_register_types(PyObject *d) PyGObject_Type.tp_weaklistoffset = offsetof(PyGObject, weakreflist); PyGObject_Type.tp_methods = pygobject_methods; PyGObject_Type.tp_getset = pygobject_getsets; +#ifdef PYGI_OBJECT_USE_CUSTOM_DICT PyGObject_Type.tp_dictoffset = offsetof(PyGObject, inst_dict); +#endif PyGObject_Type.tp_init = (initproc)pygobject_init; PyGObject_Type.tp_free = (freefunc)pygobject_free; PyGObject_Type.tp_alloc = PyType_GenericAlloc; @@ -2455,18 +2455,19 @@ pygobject_object_register_types(PyObject *d) "Python attributes."; PyGProps_Type.tp_traverse = (traverseproc)pygobject_props_traverse; PyGProps_Type.tp_iter = (getiterfunc)pygobject_props_get_iter; + PyGProps_Type.tp_methods = pygobject_props_methods; if (PyType_Ready(&PyGProps_Type) < 0) - return; + return -1; /* GPropsDescr */ PyGPropsDescr_Type.tp_flags = Py_TPFLAGS_DEFAULT; PyGPropsDescr_Type.tp_descr_get = pyg_props_descr_descr_get; if (PyType_Ready(&PyGPropsDescr_Type) < 0) - return; + return -1; descr = PyObject_New(PyObject, &PyGPropsDescr_Type); PyDict_SetItemString(PyGObject_Type.tp_dict, "props", descr); PyDict_SetItemString(PyGObject_Type.tp_dict, "__module__", - o=PYGLIB_PyUnicode_FromString("gi._gobject._gobject")); + o=PyUnicode_FromString ("gi._gi")); Py_DECREF(o); /* GPropsIter */ @@ -2475,7 +2476,7 @@ pygobject_object_register_types(PyObject *d) PyGPropsIter_Type.tp_doc = "GObject properties iterator"; PyGPropsIter_Type.tp_iternext = (iternextfunc)pygobject_props_iter_next; if (PyType_Ready(&PyGPropsIter_Type) < 0) - return; + return -1; PyGObjectWeakRef_Type.tp_dealloc = (destructor)pygobject_weak_ref_dealloc; PyGObjectWeakRef_Type.tp_call = (ternaryfunc)pygobject_weak_ref_call; @@ -2485,14 +2486,66 @@ pygobject_object_register_types(PyObject *d) PyGObjectWeakRef_Type.tp_clear = (inquiry)pygobject_weak_ref_clear; PyGObjectWeakRef_Type.tp_methods = pygobject_weak_ref_methods; if (PyType_Ready(&PyGObjectWeakRef_Type) < 0) - return; + return -1; PyDict_SetItemString(d, "GObjectWeakRef", (PyObject *) &PyGObjectWeakRef_Type); - PyGBindingWeakRef_Type.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC; - PyGBindingWeakRef_Type.tp_doc = "A GBinding weak reference"; - PyGBindingWeakRef_Type.tp_methods = pygbinding_weak_ref_methods; - PyGBindingWeakRef_Type.tp_base = &PyGObjectWeakRef_Type; - if (PyType_Ready(&PyGBindingWeakRef_Type) < 0) - return; - PyDict_SetItemString(d, "GBindingWeakRef", (PyObject *) &PyGBindingWeakRef_Type); + return 0; +} + +PyObject * +pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs) +{ + PyObject *pytype; + GType type; + GObject *obj = NULL; + GObjectClass *class; + guint n_properties = 0, i; + const GValue *values = NULL; + const char **names = NULL; + + if (!PyArg_ParseTuple (args, "O:gobject.new", &pytype)) { + return NULL; + } + + if ((type = pyg_type_from_object (pytype)) == 0) + return NULL; + + if (G_TYPE_IS_ABSTRACT(type)) { + PyErr_Format(PyExc_TypeError, "cannot create instance of abstract " + "(non-instantiable) type `%s'", g_type_name(type)); + return NULL; + } + + if ((class = g_type_class_ref (type)) == NULL) { + PyErr_SetString(PyExc_TypeError, + "could not get a reference to type class"); + return NULL; + } + + if (!pygobject_prepare_construct_properties (class, kwargs, &n_properties, &names, &values)) + goto cleanup; + + obj = pygobject_object_new_with_properties(type, n_properties, names, values); + + if (!obj) + PyErr_SetString (PyExc_RuntimeError, "could not create object"); + + cleanup: + for (i = 0; i < n_properties; i++) { + g_free(names[i]); + g_value_unset(&values[i]); + } + g_free(names); + g_free(values); + + g_type_class_unref(class); + + if (obj) { + pygobject_sink (obj); + self = (PyGObject *) pygobject_new((GObject *)obj); + g_object_unref(obj); + } else + self = NULL; + + return (PyObject *) self; } diff --git a/gi/pygobject-object.h b/gi/pygobject-object.h new file mode 100644 index 0000000..95e95aa --- /dev/null +++ b/gi/pygobject-object.h @@ -0,0 +1,52 @@ +#ifndef _PYGOBJECT_OBJECT_H_ +#define _PYGOBJECT_OBJECT_H_ + +#include +#include +#include "pygobject-internal.h" + +/* Data that belongs to the GObject instance, not the Python wrapper */ +struct _PyGObjectData { + PyTypeObject *type; /* wrapper type for this instance */ + GSList *closures; +}; + +extern GType PY_TYPE_OBJECT; +extern GQuark pygobject_instance_data_key; +extern GQuark pygobject_custom_key; +extern GQuark pygobject_wrapper_key; +extern GQuark pygobject_class_key; +extern GQuark pygobject_class_init_key; + +extern PyTypeObject PyGObjectWeakRef_Type; +extern PyTypeObject PyGPropsIter_Type; +extern PyTypeObject PyGPropsDescr_Type; +extern PyTypeObject PyGProps_Type; +extern PyTypeObject PyGObject_Type; +extern PyTypeObject *PyGObject_MetaType; + +static inline PyGObjectData * +pyg_object_peek_inst_data(GObject *obj) +{ + return ((PyGObjectData *) + g_object_get_qdata(obj, pygobject_instance_data_key)); +} + +void pygobject_register_class (PyObject *dict, + const gchar *type_name, + GType gtype, PyTypeObject *type, + PyObject *bases); +void pygobject_register_wrapper (PyObject *self); +PyObject * pygobject_new (GObject *obj); +PyObject * pygobject_new_full (GObject *obj, gboolean steal, gpointer g_class); +void pygobject_sink (GObject *obj); +PyTypeObject *pygobject_lookup_class (GType gtype); +void pygobject_watch_closure (PyObject *self, GClosure *closure); +int pyi_object_register_types (PyObject *d); +void pygobject_ref_float(PyGObject *self); +void pygobject_ref_sink(PyGObject *self); +PyObject * pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs); + +GClosure * gclosure_from_pyfunc(PyGObject *object, PyObject *func); + +#endif /*_PYGOBJECT_OBJECT_H_*/ diff --git a/gi/_gobject/pygobject.h b/gi/pygobject.h similarity index 95% rename from gi/_gobject/pygobject.h rename to gi/pygobject.h index 76b8b11..a45a4b0 100644 --- a/gi/_gobject/pygobject.h +++ b/gi/pygobject.h @@ -25,7 +25,7 @@ struct _PyGClosure { typedef enum { PYGOBJECT_USING_TOGGLE_REF = 1 << 0, PYGOBJECT_IS_FLOATING_REF = 1 << 1, - PYGOBJECT_GOBJECT_WAS_FLOATING = 1 << 2, + PYGOBJECT_GOBJECT_WAS_FLOATING = 1 << 2 } PyGObjectFlags; /* closures is just an alias for what is found in the @@ -57,6 +57,8 @@ typedef struct { } PyGBoxed; #define pyg_boxed_get(v,t) ((t *)((PyGBoxed *)(v))->boxed) +#define pyg_boxed_get_ptr(v) (((PyGBoxed *)(v))->boxed) +#define pyg_boxed_set_ptr(v,p) (((PyGBoxed *)(v))->boxed = (gpointer)p) #define pyg_boxed_check(v,typecode) (PyObject_TypeCheck(v, &PyGBoxed_Type) && ((PyGBoxed *)(v))->gtype == typecode) typedef struct { @@ -66,6 +68,8 @@ typedef struct { } PyGPointer; #define pyg_pointer_get(v,t) ((t *)((PyGPointer *)(v))->pointer) +#define pyg_pointer_get_ptr(v) (((PyGPointer *)(v))->pointer) +#define pyg_pointer_set_ptr(v,p) (((PyGPointer *)(v))->pointer = (gpointer)p) #define pyg_pointer_check(v,typecode) (PyObject_TypeCheck(v, &PyGPointer_Type) && ((PyGPointer *)(v))->gtype == typecode) typedef void (*PyGFatalExceptionFunc) (void); @@ -76,8 +80,13 @@ typedef struct { GParamSpec *pspec; } PyGParamSpec; -#define PyGParamSpec_Get(v) (((PyGParamSpec *)v)->pspec) -#define PyGParamSpec_Check(v) (PyObject_TypeCheck(v, &PyGParamSpec_Type)) +#define pyg_param_spec_get(v) (((PyGParamSpec *)v)->pspec) +#define pyg_param_spec_set(v,p) (((PyGParamSpec *)v)->pspec = (GParamSpec*)p) +#define pyg_param_spec_check(v) (PyObject_TypeCheck(v, &PyGParamSpec_Type)) + +/* Deprecated in favor of lower case with underscore macros above. */ +#define PyGParamSpec_Get pyg_param_spec_get +#define PyGParamSpec_Check pyg_param_spec_check typedef int (*PyGClassInitFunc) (gpointer gclass, PyTypeObject *pyclass); typedef PyTypeObject * (*PyGTypeRegistrationFunction) (const gchar *name, @@ -145,12 +154,14 @@ struct _PyGObject_Functions { PyObject *(* paramspec_new)(GParamSpec *spec); GParamSpec *(*paramspec_get)(PyObject *tuple); int (*pyobj_to_unichar_conv)(PyObject *pyobj, void* ptr); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS gboolean (*parse_constructor_args)(GType obj_type, char **arg_names, char **prop_names, GParameter *params, guint *nparams, PyObject **py_args); +G_GNUC_END_IGNORE_DEPRECATIONS PyObject *(* param_gvalue_as_pyobject) (const GValue* gvalue, gboolean copy_boxed, const GParamSpec* pspec); @@ -199,21 +210,12 @@ struct _PyGObject_Functions { }; -#ifdef DISABLE_THREADING -# define pyg_threads_enabled FALSE -# define pyg_gil_state_ensure() 0 -# define pyg_gil_state_release(state) -# define pyg_begin_allow_threads G_STMT_START { -# define pyg_end_allow_threads } G_STMT_END -#else -# define pyg_threads_enabled TRUE -# define pyg_gil_state_ensure PyGILState_Ensure -# define pyg_gil_state_release PyGILState_Release -# define pyg_begin_allow_threads Py_BEGIN_ALLOW_THREADS -# define pyg_end_allow_threads Py_END_ALLOW_THREADS -#endif - /* Deprecated, only available for API compatibility. */ +#define pyg_threads_enabled TRUE +#define pyg_gil_state_ensure PyGILState_Ensure +#define pyg_gil_state_release PyGILState_Release +#define pyg_begin_allow_threads Py_BEGIN_ALLOW_THREADS +#define pyg_end_allow_threads Py_END_ALLOW_THREADS #define pyg_enable_threads() #define pyg_set_thread_block_funcs(a, b) #define pyg_block_threads() @@ -343,11 +345,13 @@ pygobject_init(int req_major, int req_minor, int req_micro) } cobject = PyObject_GetAttrString(gobject, "_PyGObject_API"); - if (cobject && PyCapsule_CheckExact(cobject)) + if (cobject && PyCapsule_CheckExact(cobject)) { _PyGObject_API = (struct _PyGObject_Functions *) PyCapsule_GetPointer(cobject, "gobject._PyGObject_API"); - else { + Py_DECREF (cobject); + } else { PyErr_SetString(PyExc_ImportError, "could not import gobject (could not find _PyGObject_API object)"); + Py_XDECREF (cobject); Py_DECREF(gobject); return NULL; } diff --git a/gi/_glib/pygoptioncontext.c b/gi/pygoptioncontext.c similarity index 80% rename from gi/_glib/pygoptioncontext.c rename to gi/pygoptioncontext.c index 8ecbff8..c2f402c 100644 --- a/gi/_glib/pygoptioncontext.c +++ b/gi/pygoptioncontext.c @@ -15,20 +15,52 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include -#include -#include "pyglib-private.h" #include "pygoptioncontext.h" +#include "pygi-error.h" +#include "pygi-util.h" +#include "pygi-basictype.h" -PYGLIB_DEFINE_TYPE("gi._glib.OptionContext", PyGOptionContext_Type, PyGOptionContext) +PYGI_DEFINE_TYPE("gi._gi.OptionContext", PyGOptionContext_Type, PyGOptionContext) + +/** + * pyg_option_group_transfer_group: + * @group: a GOptionGroup wrapper + * + * This is used to transfer the GOptionGroup to a GOptionContext. After this + * is called, the calle must handle the release of the GOptionGroup. + * + * When #NULL is returned, the GOptionGroup was already transfered. + * + * Returns: Either #NULL or the wrapped GOptionGroup. + */ +static GOptionGroup * +pyglib_option_group_transfer_group(PyObject *obj) +{ + PyGOptionGroup *self = (PyGOptionGroup*)obj; + + if (self->is_in_context) + return NULL; + + self->is_in_context = TRUE; + + /* Here we increase the reference count of the PyGOptionGroup, because now + * the GOptionContext holds an reference to us (it is the userdata passed + * to g_option_group_new(). + * + * The GOptionGroup is freed with the GOptionContext. + * + * We set it here because if we would do this in the init method we would + * hold two references and the PyGOptionGroup would never be freed. + */ + Py_INCREF(self); + + return self->group; +} /** * pyg_option_context_new: @@ -58,7 +90,7 @@ pyg_option_context_init(PyGOptionContext *self, { char *parameter_string; - if (!PyArg_ParseTuple(args, "s:gi._glib.GOptionContext.__init__", + if (!PyArg_ParseTuple(args, "s:gi._gi.GOptionContext.__init__", ¶meter_string)) return -1; @@ -119,7 +151,7 @@ pyg_option_context_parse(PyGOptionContext *self, for (pos = 0; pos < argv_length; pos++) { arg = PyList_GetItem(argv, pos); - argv_content[pos] = g_strdup(PYGLIB_PyUnicode_AsString(arg)); + argv_content[pos] = g_strdup(PyUnicode_AsUTF8 (arg)); if (argv_content[pos] == NULL) { g_strfreev(argv_content); @@ -129,7 +161,7 @@ pyg_option_context_parse(PyGOptionContext *self, original = g_strdupv(argv_content); g_assert(argv_length <= G_MAXINT); - argv_length_int = argv_length; + argv_length_int = (gint)argv_length; Py_BEGIN_ALLOW_THREADS; result = g_option_context_parse(self->context, &argv_length_int, &argv_content, &error); @@ -140,14 +172,14 @@ pyg_option_context_parse(PyGOptionContext *self, { g_strfreev(argv_content); g_strfreev(original); - pyglib_error_check(&error); + pygi_error_check(&error); return NULL; } new_argv = PyList_New(g_strv_length(argv_content)); for (pos = 0; pos < argv_length; pos++) { - arg = PYGLIB_PyUnicode_FromString(argv_content[pos]); + arg = PyUnicode_FromString (argv_content[pos]); PyList_SetItem(new_argv, pos, arg); } @@ -178,7 +210,7 @@ pyg_option_context_set_help_enabled(PyGOptionContext *self, static PyObject * pyg_option_context_get_help_enabled(PyGOptionContext *self) { - return PyBool_FromLong(g_option_context_get_help_enabled(self->context)); + return pygi_gboolean_to_py (g_option_context_get_help_enabled(self->context)); } static PyObject * @@ -205,7 +237,7 @@ pyg_option_context_set_ignore_unknown_options(PyGOptionContext *self, static PyObject * pyg_option_context_get_ignore_unknown_options(PyGOptionContext *self) { - return PyBool_FromLong( + return pygi_gboolean_to_py ( g_option_context_get_ignore_unknown_options(self->context)); } @@ -297,9 +329,9 @@ static PyObject* pyg_option_context_richcompare(PyObject *self, PyObject *other, int op) { if (Py_TYPE(self) == Py_TYPE(other) && Py_TYPE(self) == &PyGOptionContext_Type) - return _pyglib_generic_ptr_richcompare(((PyGOptionContext*)self)->context, - ((PyGOptionContext*)other)->context, - op); + return pyg_ptr_richcompare(((PyGOptionContext*)self)->context, + ((PyGOptionContext*)other)->context, + op); else { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; @@ -309,7 +341,7 @@ pyg_option_context_richcompare(PyObject *self, PyObject *other, int op) static PyObject * pyg_option_get_context(PyGOptionContext *self) { - return PYGLIB_CPointer_WrapPointer(self->context, "goption.context"); + return PyCapsule_New (self->context, "goption.context", NULL); } static PyMethodDef pyg_option_context_methods[] = { @@ -325,13 +357,23 @@ static PyMethodDef pyg_option_context_methods[] = { { NULL, NULL, 0 }, }; -void -pyglib_option_context_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_option_context_register_types(PyObject *d) { PyGOptionContext_Type.tp_dealloc = (destructor)pyg_option_context_dealloc; PyGOptionContext_Type.tp_richcompare = pyg_option_context_richcompare; PyGOptionContext_Type.tp_flags = Py_TPFLAGS_DEFAULT; PyGOptionContext_Type.tp_methods = pyg_option_context_methods; PyGOptionContext_Type.tp_init = (initproc)pyg_option_context_init; - PYGLIB_REGISTER_TYPE(d, PyGOptionContext_Type, "OptionContext"); + PyGOptionContext_Type.tp_alloc = PyType_GenericAlloc; + PyGOptionContext_Type.tp_new = PyType_GenericNew; + if (PyType_Ready(&PyGOptionContext_Type)) + return -1; + + PyDict_SetItemString(d, "OptionContext", (PyObject *)&PyGOptionContext_Type); + + return 0; } diff --git a/gi/_glib/pygoptioncontext.h b/gi/pygoptioncontext.h similarity index 84% rename from gi/_glib/pygoptioncontext.h rename to gi/pygoptioncontext.h index efe5ffa..4dea56d 100644 --- a/gi/_glib/pygoptioncontext.h +++ b/gi/pygoptioncontext.h @@ -14,9 +14,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYG_OPTIONCONTEXT_H__ @@ -34,6 +32,6 @@ typedef struct { PyObject* pyg_option_context_new(GOptionContext *context); -void pyglib_option_context_register_types(PyObject *d); +int pygi_option_context_register_types(PyObject *d); #endif /* __PYG_OPTIONCONTEXT_H__ */ diff --git a/gi/_glib/pygoptiongroup.c b/gi/pygoptiongroup.c similarity index 87% rename from gi/_glib/pygoptiongroup.c rename to gi/pygoptiongroup.c index 2990342..9d1bdc1 100644 --- a/gi/_glib/pygoptiongroup.c +++ b/gi/pygoptiongroup.c @@ -15,20 +15,16 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include -#include -#include "pyglib-private.h" #include "pygoptiongroup.h" +#include "pygi-error.h" +#include "pygi-util.h" -PYGLIB_DEFINE_TYPE("gi._glib.OptionGroup", PyGOptionGroup_Type, PyGOptionGroup) +PYGI_DEFINE_TYPE("gi._gi.OptionGroup", PyGOptionGroup_Type, PyGOptionGroup) /** * pyg_option_group_new: @@ -62,7 +58,7 @@ check_if_owned(PyGOptionGroup *self) if (self->other_owner) { PyErr_SetString(PyExc_ValueError, "The GOptionGroup was not created by " - "gi._glib.OptionGroup(), so operation is not possible."); + "gi._gi.OptionGroup(), so operation is not possible."); return TRUE; } return FALSE; @@ -72,7 +68,7 @@ static void destroy_g_group(PyGOptionGroup *self) { PyGILState_STATE state; - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); self->group = NULL; Py_CLEAR(self->callback); @@ -85,7 +81,7 @@ destroy_g_group(PyGOptionGroup *self) Py_DECREF(self); } - pyglib_gil_state_release(state); + PyGILState_Release(state); } static int @@ -119,8 +115,11 @@ pyg_option_group_dealloc(PyGOptionGroup *self) { GOptionGroup *tmp = self->group; self->group = NULL; - if (tmp) + if (tmp) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_option_group_free(tmp); + G_GNUC_END_IGNORE_DEPRECATIONS + } } PyObject_Del(self); @@ -136,8 +135,7 @@ arg_func(const gchar *option_name, PyGILState_STATE state; gboolean no_error; - state = pyglib_gil_state_ensure(); - + state = PyGILState_Ensure(); if (value == NULL) ret = PyObject_CallFunction(self->callback, "sOO", option_name, Py_None, self); @@ -150,9 +148,9 @@ arg_func(const gchar *option_name, Py_DECREF(ret); no_error = TRUE; } else - no_error = pyglib_gerror_exception_check(error) != -1; + no_error = pygi_gerror_exception_check(error) != -1; - pyglib_gil_state_release(state); + PyGILState_Release(state); return no_error; } @@ -271,9 +269,9 @@ pyg_option_group_richcompare(PyObject *self, PyObject *other, int op) { if (Py_TYPE(self) == Py_TYPE(other) && Py_TYPE(self) == &PyGOptionGroup_Type) { - return _pyglib_generic_ptr_richcompare(((PyGOptionGroup*)self)->group, - ((PyGOptionGroup*)other)->group, - op); + return pyg_ptr_richcompare(((PyGOptionGroup*)self)->group, + ((PyGOptionGroup*)other)->group, + op); } else { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; @@ -286,13 +284,24 @@ static PyMethodDef pyg_option_group_methods[] = { { NULL, NULL, 0 }, }; -void -pyglib_option_group_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_option_group_register_types(PyObject *d) { PyGOptionGroup_Type.tp_dealloc = (destructor)pyg_option_group_dealloc; PyGOptionGroup_Type.tp_richcompare = pyg_option_group_richcompare; PyGOptionGroup_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; PyGOptionGroup_Type.tp_methods = pyg_option_group_methods; PyGOptionGroup_Type.tp_init = (initproc)pyg_option_group_init; - PYGLIB_REGISTER_TYPE(d, PyGOptionGroup_Type, "OptionGroup"); + PyGOptionGroup_Type.tp_alloc = PyType_GenericAlloc; + PyGOptionGroup_Type.tp_new = PyType_GenericNew; + + if (PyType_Ready(&PyGOptionGroup_Type)) + return -1; + + PyDict_SetItemString(d, "OptionGroup", (PyObject *)&PyGOptionGroup_Type); + + return 0; } diff --git a/gi/_glib/pygoptiongroup.h b/gi/pygoptiongroup.h similarity index 85% rename from gi/_glib/pygoptiongroup.h rename to gi/pygoptiongroup.h index 872b9c6..65d08e4 100644 --- a/gi/_glib/pygoptiongroup.h +++ b/gi/pygoptiongroup.h @@ -14,14 +14,15 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYG_OPTIONGROUP_H__ #define __PYG_OPTIONGROUP_H__ +#include +#include + extern PyTypeObject PyGOptionGroup_Type; typedef struct { @@ -35,7 +36,7 @@ typedef struct { PyObject* pyg_option_group_new(GOptionGroup *group); -void pyglib_option_group_register_types(PyObject *d); +int pygi_option_group_register_types(PyObject *d); #endif /* __PYG_OPTIONGROUP_H__ */ diff --git a/gi/pygparamspec.c b/gi/pygparamspec.c new file mode 100644 index 0000000..e49bd36 --- /dev/null +++ b/gi/pygparamspec.c @@ -0,0 +1,423 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * Copyright (C) 2004 Johan Dahlin + * + * pygenum.c: GEnum and GFlag wrappers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include + +#include +#include + +#include "pygenum.h" +#include "pygflags.h" +#include "pygi-type.h" +#include "pygparamspec.h" +#include "pygi-util.h" +#include "pygi-basictype.h" + +PYGI_DEFINE_TYPE("gobject.GParamSpec", PyGParamSpec_Type, PyGParamSpec); + +static PyObject* +pyg_param_spec_richcompare(PyObject *self, PyObject *other, int op) +{ + if (Py_TYPE(self) == Py_TYPE(other) && Py_TYPE(self) == &PyGParamSpec_Type) + return pyg_ptr_richcompare (pyg_param_spec_get (self), + pyg_param_spec_get (other), + op); + else { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } +} + +static Py_hash_t +pyg_param_spec_hash(PyGParamSpec *self) +{ + return (Py_hash_t)(gintptr)(pyg_param_spec_get (self)); +} + +static PyObject * +pyg_param_spec_repr(PyGParamSpec *self) +{ + char buf[80]; + + g_snprintf(buf, sizeof(buf), "<%s '%s'>", + G_PARAM_SPEC_TYPE_NAME (pyg_param_spec_get (self)), + g_param_spec_get_name (pyg_param_spec_get (self))); + return PyUnicode_FromString (buf); +} + +static void +pyg_param_spec_dealloc(PyGParamSpec *self) +{ + g_param_spec_unref (pyg_param_spec_get (self)); + PyObject_DEL(self); +} + + +static PyObject * +pygenum_from_pspec(GParamSpec *pspec) +{ + PyObject *pyclass; + GParamSpecEnum *enum_pspec; + GType enum_type; + + enum_pspec = G_PARAM_SPEC_ENUM(pspec); + enum_type = G_ENUM_CLASS_TYPE(enum_pspec->enum_class); + pyclass = (PyObject*)g_type_get_qdata(enum_type, pygenum_class_key); + if (pyclass == NULL) { + pyclass = pyg_enum_add(NULL, g_type_name(enum_type), NULL, enum_type); + if (pyclass == NULL) + pyclass = Py_None; + } + + Py_INCREF(pyclass); + return pyclass; +} + +static PyObject * +pygflags_from_pspec(GParamSpec *pspec) +{ + PyObject *pyclass; + GParamSpecFlags *flag_pspec; + GType flag_type; + + flag_pspec = G_PARAM_SPEC_FLAGS(pspec); + flag_type = G_FLAGS_CLASS_TYPE(flag_pspec->flags_class); + pyclass = (PyObject*)g_type_get_qdata(flag_type, pygflags_class_key); + if (pyclass == NULL) { + pyclass = pyg_flags_add(NULL, g_type_name(flag_type), NULL, flag_type); + if (pyclass == NULL) + pyclass = Py_None; + } + Py_INCREF(pyclass); + return pyclass; +} + +static PyObject * +pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) +{ + GParamSpec *pspec; + + pspec = pyg_param_spec_get (self); + + /* common attributes */ + if (!strcmp(attr, "__gtype__")) { + return pyg_type_wrapper_new(G_PARAM_SPEC_TYPE(pspec)); + } else if (!strcmp(attr, "name")) { + return Py_BuildValue("s", g_param_spec_get_name(pspec)); + } else if (!strcmp(attr, "nick")) { + return Py_BuildValue("s", g_param_spec_get_nick(pspec)); + } else if (!strcmp(attr, "blurb") || !strcmp(attr, "__doc__")) { + return Py_BuildValue("s", g_param_spec_get_blurb(pspec)); + } else if (!strcmp(attr, "flags")) { + return pygi_guint_to_py (pspec->flags); + } else if (!strcmp(attr, "value_type")) { + return pyg_type_wrapper_new(pspec->value_type); + } else if (!strcmp(attr, "owner_type")) { + return pyg_type_wrapper_new(pspec->owner_type); + } + + if (G_IS_PARAM_SPEC_CHAR(pspec)) { + if (!strcmp(attr, "default_value")) { + return PyUnicode_FromFormat( + "%c", G_PARAM_SPEC_CHAR(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_gint8_to_py (G_PARAM_SPEC_CHAR(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_gint8_to_py (G_PARAM_SPEC_CHAR(pspec)->maximum); + } + } else if (G_IS_PARAM_SPEC_UCHAR(pspec)) { + if (!strcmp(attr, "default_value")) { + return PyUnicode_FromFormat( + "%c", G_PARAM_SPEC_UCHAR(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_guint8_to_py (G_PARAM_SPEC_UCHAR(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_guint8_to_py (G_PARAM_SPEC_UCHAR(pspec)->maximum); + } + } else if (G_IS_PARAM_SPEC_BOOLEAN(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_gboolean_to_py (G_PARAM_SPEC_BOOLEAN(pspec)->default_value); + } + } else if (G_IS_PARAM_SPEC_INT(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_gint_to_py (G_PARAM_SPEC_INT(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_gint_to_py (G_PARAM_SPEC_INT(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_gint_to_py (G_PARAM_SPEC_INT(pspec)->maximum); + } + } else if (G_IS_PARAM_SPEC_UINT(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_guint_to_py (G_PARAM_SPEC_UINT(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_guint_to_py (G_PARAM_SPEC_UINT(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_guint_to_py (G_PARAM_SPEC_UINT(pspec)->maximum); + } + } else if (G_IS_PARAM_SPEC_LONG(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_glong_to_py (G_PARAM_SPEC_LONG(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_glong_to_py (G_PARAM_SPEC_LONG(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_glong_to_py (G_PARAM_SPEC_LONG(pspec)->maximum); + } + } else if (G_IS_PARAM_SPEC_ULONG(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_gulong_to_py (G_PARAM_SPEC_ULONG(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_gulong_to_py (G_PARAM_SPEC_ULONG(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_gulong_to_py (G_PARAM_SPEC_ULONG(pspec)->maximum); + } + } else if (G_IS_PARAM_SPEC_INT64(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_gint64_to_py (G_PARAM_SPEC_INT64(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_gint64_to_py (G_PARAM_SPEC_INT64(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_gint64_to_py (G_PARAM_SPEC_INT64(pspec)->maximum); + } + } else if (G_IS_PARAM_SPEC_UINT64(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_guint64_to_py (G_PARAM_SPEC_UINT64(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_guint64_to_py (G_PARAM_SPEC_UINT64(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_guint64_to_py (G_PARAM_SPEC_UINT64(pspec)->maximum); + } + } else if (G_IS_PARAM_SPEC_UNICHAR(pspec)) { + if (!strcmp(attr, "default_value")) { + return PyUnicode_FromFormat( + "%c", G_PARAM_SPEC_UNICHAR(pspec)->default_value); + } + } else if (G_IS_PARAM_SPEC_ENUM(pspec)) { + if (!strcmp(attr, "default_value")) { + return pyg_enum_from_gtype( + pspec->value_type, G_PARAM_SPEC_ENUM(pspec)->default_value); + } else if (!strcmp(attr, "enum_class")) { + return pygenum_from_pspec(pspec); + } + } else if (G_IS_PARAM_SPEC_FLAGS(pspec)) { + if (!strcmp(attr, "default_value")) { + return pyg_flags_from_gtype( + pspec->value_type, G_PARAM_SPEC_FLAGS(pspec)->default_value); + } else if (!strcmp(attr, "flags_class")) { + return pygflags_from_pspec(pspec); + } + } else if (G_IS_PARAM_SPEC_FLOAT(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_gfloat_to_py (G_PARAM_SPEC_FLOAT(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_gfloat_to_py (G_PARAM_SPEC_FLOAT(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_gfloat_to_py (G_PARAM_SPEC_FLOAT(pspec)->maximum); + } else if (!strcmp(attr, "epsilon")) { + return pygi_gfloat_to_py (G_PARAM_SPEC_FLOAT(pspec)->epsilon); + } + } else if (G_IS_PARAM_SPEC_DOUBLE(pspec)) { + if (!strcmp(attr, "default_value")) { + return pygi_gdouble_to_py ( + G_PARAM_SPEC_DOUBLE(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return pygi_gdouble_to_py (G_PARAM_SPEC_DOUBLE(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return pygi_gdouble_to_py (G_PARAM_SPEC_DOUBLE(pspec)->maximum); + } else if (!strcmp(attr, "epsilon")) { + return pygi_gdouble_to_py (G_PARAM_SPEC_DOUBLE(pspec)->epsilon); + } + } else if (G_IS_PARAM_SPEC_STRING(pspec)) { + if (!strcmp(attr, "default_value")) { + return Py_BuildValue( + "s", G_PARAM_SPEC_STRING(pspec)->default_value); + } else if (!strcmp(attr, "cset_first")) { + return Py_BuildValue( + "s", G_PARAM_SPEC_STRING(pspec)->cset_first); + } else if (!strcmp(attr, "cset_nth")) { + return Py_BuildValue( + "s", G_PARAM_SPEC_STRING(pspec)->cset_nth); + } else if (!strcmp(attr, "substitutor")) { + return Py_BuildValue( + "c", G_PARAM_SPEC_STRING(pspec)->substitutor); + } else if (!strcmp(attr, "null_fold_if_empty")) { + return pygi_gboolean_to_py ( + G_PARAM_SPEC_STRING(pspec)->null_fold_if_empty); + } else if (!strcmp(attr, "ensure_non_null")) { + return pygi_gboolean_to_py ( + G_PARAM_SPEC_STRING(pspec)->ensure_non_null); + } + } else { + /* This is actually not what's exported by GObjects paramspecs, + * But we exported this in earlier versions, so it's better to keep it here + * compatibility. But don't return it in __dir__, to "hide" it. + */ + if (!strcmp(attr, "default_value")) { + /* XXX: Raise deprecation warning */ + Py_INCREF(Py_None); + return Py_None; + } + } + + PyErr_SetString(PyExc_AttributeError, attr); + return NULL; +} + + +static PyObject * +pyg_param_spec_dir(PyGParamSpec *self, PyObject *dummy) +{ + GParamSpec *pspec = pyg_param_spec_get (self); + + if (G_IS_PARAM_SPEC_CHAR(pspec)) { + return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", "flags", + "maximum", "minimum", "name", "nick", + "owner_type", "value_type"); + } else if (G_IS_PARAM_SPEC_UCHAR(pspec)) { + return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "maximum", "minimum", + "name", "nick", "owner_type", + "value_type"); + } else if (G_IS_PARAM_SPEC_BOOLEAN(pspec)) { + return Py_BuildValue("[sssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "name", "nick", "owner_type", + "value_type"); + } else if (G_IS_PARAM_SPEC_INT(pspec)) { + return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "maximum", "minimum", "name", + "nick", "owner_type", "value_type"); + } else if (G_IS_PARAM_SPEC_UINT(pspec)) { + return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "maximum", "minimum", + "name", "nick", "owner_type", + "value_type"); + } else if (G_IS_PARAM_SPEC_LONG(pspec)) { + return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "maximum", "minimum", "name", + "nick", "owner_type", "value_type"); + } else if (G_IS_PARAM_SPEC_ULONG(pspec)) { + return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "maximum", "minimum", "name", + "nick", "owner_type", "value_type"); + } else if (G_IS_PARAM_SPEC_INT64(pspec)) { + return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "maximum", "minimum", "name", + "nick", "owner_type", "value_type"); + } else if (G_IS_PARAM_SPEC_UINT64(pspec)) { + return Py_BuildValue("[sssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "maximum", "minimum", + "name", "nick", "owner_type", + "value_type"); + } else if (G_IS_PARAM_SPEC_UNICHAR(pspec)) { + return Py_BuildValue("[sssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "name", "nick", "owner_type", + "value_type"); + } else if (G_IS_PARAM_SPEC_ENUM(pspec)) { + return Py_BuildValue("[ssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", "enum_class", + "flags", "name", "nick", "owner_type", + "value_type"); + } else if (G_IS_PARAM_SPEC_FLAGS(pspec)) { + return Py_BuildValue("[ssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", + "flags", "flags_class", "name", "nick", + "owner_type", "value_type"); + } else if (G_IS_PARAM_SPEC_FLOAT(pspec)) { + return Py_BuildValue("[ssssssssssss]", "__doc__", "__gtype__", + "blurb", "epsilon", + "flags", "maximum", "minimum", "name", "nick", "owner_type", + "value_type", + "default_value"); + } else if (G_IS_PARAM_SPEC_DOUBLE(pspec)) { + return Py_BuildValue("[ssssssssssss]", "__doc__", "__gtype__", + "blurb", "default_value", "epsilon", + "flags", "maximum", "minimum", "name", "nick", + "owner_type", "value_type"); + } else if (G_IS_PARAM_SPEC_STRING(pspec)) { + return Py_BuildValue("[ssssssssssssss]", "__doc__", "__gtype__", + "blurb", "cset_first", "cset_nth", "default_value", + "ensure_non_null", "flags", "name", "nick", + "null_fold_if_empty", "owner_type", "substitutor", + "value_type"); + } else { + return Py_BuildValue("[ssssssss]", "__doc__", "__gtype__", "blurb", + "flags", "name", "nick", + "owner_type", "value_type"); + } +} + +static PyMethodDef pyg_param_spec_methods[] = { + { "__dir__", (PyCFunction)pyg_param_spec_dir, METH_NOARGS}, + { NULL, NULL, 0} +}; + +/** + * pyg_param_spec_new: + * @pspec: a GParamSpec. + * + * Creates a wrapper for a GParamSpec. + * + * Returns: the GParamSpec wrapper. + */ +PyObject * +pyg_param_spec_new(GParamSpec *pspec) +{ + PyGParamSpec *self; + + self = (PyGParamSpec *)PyObject_NEW(PyGParamSpec, + &PyGParamSpec_Type); + if (self == NULL) + return NULL; + + pyg_param_spec_set (self, g_param_spec_ref (pspec)); + return (PyObject *)self; +} + +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_paramspec_register_types(PyObject *d) +{ + Py_SET_TYPE(&PyGParamSpec_Type, &PyType_Type); + PyGParamSpec_Type.tp_dealloc = (destructor)pyg_param_spec_dealloc; + PyGParamSpec_Type.tp_getattr = (getattrfunc)pyg_param_spec_getattr; + PyGParamSpec_Type.tp_richcompare = pyg_param_spec_richcompare; + PyGParamSpec_Type.tp_flags = Py_TPFLAGS_DEFAULT; + PyGParamSpec_Type.tp_repr = (reprfunc)pyg_param_spec_repr; + PyGParamSpec_Type.tp_hash = (hashfunc)pyg_param_spec_hash; + PyGParamSpec_Type.tp_methods = pyg_param_spec_methods; + + if (PyType_Ready(&PyGParamSpec_Type)) + return -1; + PyDict_SetItemString(d, "GParamSpec", (PyObject *)&PyGParamSpec_Type); + + return 0; +} diff --git a/gi/_gobject/pygparamspec.h b/gi/pygparamspec.h similarity index 83% rename from gi/_gobject/pygparamspec.h rename to gi/pygparamspec.h index 64aab0c..8798535 100644 --- a/gi/_gobject/pygparamspec.h +++ b/gi/pygparamspec.h @@ -15,17 +15,17 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGOBJECT_PARAMSPEC_H__ #define __PYGOBJECT_PARAMSPEC_H__ +#include + extern PyTypeObject PyGParamSpec_Type; PyObject * pyg_param_spec_new (GParamSpec *pspec); -void pygobject_paramspec_register_types(PyObject *d); +int pygi_paramspec_register_types(PyObject *d); #endif /* __PYGOBJECT_PARAMSPEC_H__ */ diff --git a/gi/_gobject/pygpointer.c b/gi/pygpointer.c similarity index 74% rename from gi/_gobject/pygpointer.c rename to gi/pygpointer.c index 575c751..6d6b62f 100644 --- a/gi/_gobject/pygpointer.c +++ b/gi/pygpointer.c @@ -15,25 +15,22 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include -#include -#include "pygobject-private.h" +#include +#include #include "pygpointer.h" - -#include "pygi.h" +#include "pygi-type.h" +#include "pygi-type.h" +#include "pygi-util.h" GQuark pygpointer_class_key; -PYGLIB_DEFINE_TYPE("gobject.GPointer", PyGPointer_Type, PyGPointer); +PYGI_DEFINE_TYPE("gobject.GPointer", PyGPointer_Type, PyGPointer); static void pyg_pointer_dealloc(PyGPointer *self) @@ -45,19 +42,19 @@ static PyObject* pyg_pointer_richcompare(PyObject *self, PyObject *other, int op) { if (Py_TYPE(self) == Py_TYPE(other)) - return _pyglib_generic_ptr_richcompare(((PyGPointer*)self)->pointer, - ((PyGPointer*)other)->pointer, - op); + return pyg_ptr_richcompare (pyg_pointer_get_ptr (self), + pyg_pointer_get_ptr (other), + op); else { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } } -static long +static Py_hash_t pyg_pointer_hash(PyGPointer *self) { - return (long)self->pointer; + return (Py_hash_t)(gintptr)(pyg_pointer_get_ptr (self)); } static PyObject * @@ -65,9 +62,10 @@ pyg_pointer_repr(PyGPointer *self) { gchar buf[128]; - g_snprintf(buf, sizeof(buf), "<%s at 0x%lx>", g_type_name(self->gtype), - (long)self->pointer); - return PYGLIB_PyUnicode_FromString(buf); + g_snprintf(buf, sizeof(buf), "<%s at 0x%" G_GUINTPTR_FORMAT ">", + g_type_name(self->gtype), + (guintptr)pyg_pointer_get_ptr (self)); + return PyUnicode_FromString (buf); } static int @@ -78,7 +76,7 @@ pyg_pointer_init(PyGPointer *self, PyObject *args, PyObject *kwargs) if (!PyArg_ParseTuple(args, ":GPointer.__init__")) return -1; - self->pointer = NULL; + pyg_pointer_set_ptr (self, NULL); self->gtype = 0; g_snprintf(buf, sizeof(buf), "%s can not be constructed", @@ -116,7 +114,8 @@ pyg_register_pointer(PyObject *dict, const gchar *class_name, if (!type->tp_dealloc) type->tp_dealloc = (destructor)pyg_pointer_dealloc; - Py_TYPE(type) = &PyType_Type; + Py_SET_TYPE(type, &PyType_Type); + g_assert (Py_TYPE (&PyGPointer_Type) != NULL); type->tp_base = &PyGPointer_Type; if (PyType_Ready(type) < 0) { @@ -154,11 +153,11 @@ pyg_pointer_new(GType pointer_type, gpointer pointer) PyTypeObject *tp; g_return_val_if_fail(pointer_type != 0, NULL); - state = pyglib_gil_state_ensure(); + state = PyGILState_Ensure(); if (!pointer) { Py_INCREF(Py_None); - pyglib_gil_state_release(state); + PyGILState_Release(state); return Py_None; } @@ -171,20 +170,25 @@ pyg_pointer_new(GType pointer_type, gpointer pointer) tp = (PyTypeObject *)&PyGPointer_Type; /* fallback */ self = PyObject_NEW(PyGPointer, tp); - pyglib_gil_state_release(state); + PyGILState_Release(state); if (self == NULL) return NULL; - self->pointer = pointer; + pyg_pointer_set_ptr (self, pointer); self->gtype = pointer_type; return (PyObject *)self; } -void -pygobject_pointer_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_pointer_register_types(PyObject *d) { + PyObject *pygtype; + pygpointer_class_key = g_quark_from_static_string("PyGPointer::class"); PyGPointer_Type.tp_dealloc = (destructor)pyg_pointer_dealloc; @@ -194,5 +198,16 @@ pygobject_pointer_register_types(PyObject *d) PyGPointer_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; PyGPointer_Type.tp_init = (initproc)pyg_pointer_init; PyGPointer_Type.tp_free = (freefunc)pyg_pointer_free; - PYGOBJECT_REGISTER_GTYPE(d, PyGPointer_Type, "GPointer", G_TYPE_POINTER); + PyGPointer_Type.tp_alloc = PyType_GenericAlloc; + PyGPointer_Type.tp_new = PyType_GenericNew; + if (PyType_Ready(&PyGPointer_Type)) + return -1; + + pygtype = pyg_type_wrapper_new (G_TYPE_POINTER); + PyDict_SetItemString (PyGPointer_Type.tp_dict, "__gtype__", pygtype); + Py_DECREF (pygtype); + + PyDict_SetItemString(d, "GPointer", (PyObject *)&PyGPointer_Type); + + return 0; } diff --git a/gi/_gobject/pygpointer.h b/gi/pygpointer.h similarity index 66% rename from gi/_gobject/pygpointer.h rename to gi/pygpointer.h index f2923da..df2c1e0 100644 --- a/gi/_gobject/pygpointer.h +++ b/gi/pygpointer.h @@ -14,14 +14,22 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYGOBJECT_POINTER_H__ #define __PYGOBJECT_POINTER_H__ -void pygobject_pointer_register_types(PyObject *d); +#include + +extern GQuark pygpointer_class_key; + +extern PyTypeObject PyGPointer_Type; + +void pyg_register_pointer (PyObject *dict, const gchar *class_name, + GType pointer_type, PyTypeObject *type); +PyObject * pyg_pointer_new (GType pointer_type, gpointer pointer); + +int pygi_pointer_register_types(PyObject *d); #endif /* __PYGOBJECT_POINTER_H__ */ diff --git a/gi/_glib/pygspawn.c b/gi/pygspawn.c similarity index 77% rename from gi/_glib/pygspawn.c rename to gi/pygspawn.c index 72746b8..56ecf06 100644 --- a/gi/_glib/pygspawn.c +++ b/gi/pygspawn.c @@ -16,30 +16,38 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #include #include -#include "pyglib.h" -#include "pyglib-private.h" - +#include "pygi-util.h" +#include "pygi-basictype.h" #include "pygspawn.h" +#include "pygi-error.h" struct _PyGChildSetupData { PyObject *func; PyObject *data; }; -PYGLIB_DEFINE_TYPE("gi._glib.Pid", PyGPid_Type, PYGLIB_PyLongObject) +PYGI_DEFINE_TYPE("gi._gi.Pid", PyGPid_Type, PyLongObject) + +static GPid +pyg_pid_get_pid (PyObject *self) +{ +#ifdef G_OS_WIN32 + return (GPid)PyLong_AsVoidPtr (self); +#else + return (GPid)PyLong_AsLong (self); +#endif +} static PyObject * pyg_pid_close(PyObject *self, PyObject *args, PyObject *kwargs) { - g_spawn_close_pid(PYGLIB_PyLong_AsLong(self)); + g_spawn_close_pid(pyg_pid_get_pid (self)); Py_INCREF(Py_None); return Py_None; } @@ -52,22 +60,28 @@ static PyMethodDef pyg_pid_methods[] = { static void pyg_pid_free(PyObject *gpid) { - g_spawn_close_pid((GPid) PYGLIB_PyLong_AsLong(gpid)); - PYGLIB_PyLong_Type.tp_free((void *) gpid); + g_spawn_close_pid(pyg_pid_get_pid (gpid)); + PyLong_Type.tp_free((void *) gpid); } static int pyg_pid_tp_init(PyObject *self, PyObject *args, PyObject *kwargs) { - PyErr_SetString(PyExc_TypeError, "gi._glib.Pid cannot be manually instantiated"); + PyErr_SetString(PyExc_TypeError, "gi._gi.Pid cannot be manually instantiated"); return -1; } PyObject * pyg_pid_new(GPid pid) { - return PyObject_CallMethod((PyObject*)&PyGPid_Type, "__new__", "Oi", - &PyGPid_Type, pid); + PyObject *long_val; +#ifdef G_OS_WIN32 + long_val = PyLong_FromVoidPtr (pid); +#else + long_val = pygi_gint_to_py (pid); +#endif + return PyObject_CallMethod((PyObject*)&PyGPid_Type, "__new__", "ON", + &PyGPid_Type, long_val); } static void @@ -78,7 +92,7 @@ _pyg_spawn_async_callback(gpointer user_data) PyGILState_STATE gil; data = (struct _PyGChildSetupData *) user_data; - gil = pyglib_gil_state_ensure(); + gil = PyGILState_Ensure(); if (data->data) retval = PyObject_CallFunction(data->func, "O", data->data); else @@ -90,7 +104,7 @@ _pyg_spawn_async_callback(gpointer user_data) Py_DECREF(data->func); Py_XDECREF(data->data); g_slice_free(struct _PyGChildSetupData, data); - pyglib_gil_state_release(gil); + PyGILState_Release(gil); } PyObject * @@ -108,10 +122,10 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) gint *standard_input, *standard_output, *standard_error; struct _PyGChildSetupData *callback_data = NULL; GError *error = NULL; - GPid child_pid = -1; + GPid child_pid = 0; Py_ssize_t len, i; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OsiOOOOO:gi._glib.spawn_async", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OsiOOOOO:gi._gi.spawn_async", kwlist, &pyargv, &pyenvp, &working_directory, &flags, &func, &user_data, @@ -136,7 +150,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) /* parse argv */ if (!PySequence_Check(pyargv)) { PyErr_SetString(PyExc_TypeError, - "gi._glib.spawn_async: " + "gi._gi.spawn_async: " "first argument must be a sequence of strings"); return NULL; } @@ -144,15 +158,15 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) argv = g_new0(char *, len + 1); for (i = 0; i < len; ++i) { PyObject *tmp = PySequence_ITEM(pyargv, i); - if (tmp == NULL || !PYGLIB_PyUnicode_Check(tmp)) { + if (tmp == NULL || !PyUnicode_Check (tmp)) { PyErr_SetString(PyExc_TypeError, - "gi._glib.spawn_async: " + "gi._gi.spawn_async: " "first argument must be a sequence of strings"); g_free(argv); Py_XDECREF(tmp); return NULL; } - argv[i] = PYGLIB_PyUnicode_AsString(tmp); + argv[i] = PyUnicode_AsUTF8 (tmp); Py_DECREF(tmp); } @@ -160,7 +174,7 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) if (pyenvp) { if (!PySequence_Check(pyenvp)) { PyErr_SetString(PyExc_TypeError, - "gi._glib.spawn_async: " + "gi._gi.spawn_async: " "second argument must be a sequence of strings"); g_free(argv); return NULL; @@ -169,16 +183,16 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) envp = g_new0(char *, len + 1); for (i = 0; i < len; ++i) { PyObject *tmp = PySequence_ITEM(pyenvp, i); - if (tmp == NULL || !PYGLIB_PyUnicode_Check(tmp)) { + if (tmp == NULL || !PyUnicode_Check (tmp)) { PyErr_SetString(PyExc_TypeError, - "gi._glib.spawn_async: " + "gi._gi.spawn_async: " "second argument must be a sequence of strings"); g_free(envp); Py_XDECREF(tmp); g_free(argv); return NULL; } - envp[i] = PYGLIB_PyUnicode_AsString(tmp); + envp[i] = PyUnicode_AsUTF8 (tmp); Py_DECREF(tmp); } } @@ -216,28 +230,28 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) Py_XDECREF(callback_data->data); g_slice_free(struct _PyGChildSetupData, callback_data); } - pyglib_error_check(&error); + pygi_error_check(&error); return NULL; } g_free(argv); if (envp) g_free(envp); if (standard_input) - pystdin = PYGLIB_PyLong_FromLong(*standard_input); + pystdin = pygi_gint_to_py(*standard_input); else { Py_INCREF(Py_None); pystdin = Py_None; } if (standard_output) - pystdout = PYGLIB_PyLong_FromLong(*standard_output); + pystdout = pygi_gint_to_py(*standard_output); else { Py_INCREF(Py_None); pystdout = Py_None; } if (standard_error) - pystderr = PYGLIB_PyLong_FromLong(*standard_error); + pystderr = pygi_gint_to_py(*standard_error); else { Py_INCREF(Py_None); pystderr = Py_None; @@ -246,14 +260,24 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) return Py_BuildValue("NNNN", pyg_pid_new(child_pid), pystdin, pystdout, pystderr); } -void -pyglib_spawn_register_types(PyObject *d) +/** + * Returns 0 on success, or -1 and sets an exception. + */ +int +pygi_spawn_register_types(PyObject *d) { - PyGPid_Type.tp_base = &PYGLIB_PyLong_Type; + PyGPid_Type.tp_base = &PyLong_Type; PyGPid_Type.tp_flags = Py_TPFLAGS_DEFAULT; PyGPid_Type.tp_methods = pyg_pid_methods; PyGPid_Type.tp_init = pyg_pid_tp_init; PyGPid_Type.tp_free = (freefunc)pyg_pid_free; - PyGPid_Type.tp_new = PYGLIB_PyLong_Type.tp_new; - PYGLIB_REGISTER_TYPE(d, PyGPid_Type, "Pid"); + PyGPid_Type.tp_new = PyLong_Type.tp_new; + PyGPid_Type.tp_alloc = PyType_GenericAlloc; + + if (PyType_Ready(&PyGPid_Type)) + return -1; + + PyDict_SetItemString(d, "Pid", (PyObject *)&PyGPid_Type); + + return 0; } diff --git a/gi/_glib/pygspawn.h b/gi/pygspawn.h similarity index 82% rename from gi/_glib/pygspawn.h rename to gi/pygspawn.h index 2e8dd3c..c493ef8 100644 --- a/gi/_glib/pygspawn.h +++ b/gi/pygspawn.h @@ -14,16 +14,14 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * License along with this library; if not, see . */ #ifndef __PYG_PID_H__ #define __PYG_PID_H__ PyObject * pyg_pid_new(GPid pid); -void pyglib_spawn_register_types(PyObject *d); +int pygi_spawn_register_types(PyObject *d); PyObject * pyglib_spawn_async(PyObject *self, PyObject *args, PyObject *kwargs); diff --git a/gi/pygtkcompat.py b/gi/pygtkcompat.py index 4a9c4be..364fb6c 100644 --- a/gi/pygtkcompat.py +++ b/gi/pygtkcompat.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import warnings from gi import PyGIDeprecationWarning diff --git a/gi/repository/Makefile.am b/gi/repository/Makefile.am deleted file mode 100644 index 1177ad5..0000000 --- a/gi/repository/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -pygirepositorydir = $(pyexecdir)/gi/repository - -pygirepository_PYTHON = \ - __init__.py - - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygirepository_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: build_pylinks -check-local: build_pylinks diff --git a/gi/repository/Makefile.in b/gi/repository/Makefile.in deleted file mode 100644 index 72cbd29..0000000 --- a/gi/repository/Makefile.in +++ /dev/null @@ -1,574 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = gi/repository -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(pygirepository_PYTHON) $(top_srcdir)/py-compile -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) -am__installdirs = "$(DESTDIR)$(pygirepositorydir)" -am__pep3147_tweak = \ - sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' -py_compile = $(top_srcdir)/py-compile -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -pygirepositorydir = $(pyexecdir)/gi/repository -pygirepository_PYTHON = \ - __init__.py - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gi/repository/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign gi/repository/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-pygirepositoryPYTHON: $(pygirepository_PYTHON) - @$(NORMAL_INSTALL) - @list='$(pygirepository_PYTHON)'; dlist=; list2=; test -n "$(pygirepositorydir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pygirepositorydir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pygirepositorydir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ - if test -f $$b$$p; then \ - $(am__strip_dir) \ - dlist="$$dlist $$f"; \ - list2="$$list2 $$b$$p"; \ - else :; fi; \ - done; \ - for file in $$list2; do echo $$file; done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pygirepositorydir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pygirepositorydir)" || exit $$?; \ - done || exit $$?; \ - if test -n "$$dlist"; then \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygirepositorydir)" $$dlist; \ - else :; fi - -uninstall-pygirepositoryPYTHON: - @$(NORMAL_UNINSTALL) - @list='$(pygirepository_PYTHON)'; test -n "$(pygirepositorydir)" || list=; \ - py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$py_files" || exit 0; \ - dir='$(DESTDIR)$(pygirepositorydir)'; \ - pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ - pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ - py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ - echo "$$py_files_pep3147";\ - pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ - pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ - st=0; \ - for files in \ - "$$py_files" \ - "$$pyc_files" \ - "$$pyo_files" \ - "$$pyc_files_pep3147" \ - "$$pyo_files_pep3147" \ - ; do \ - $(am__uninstall_files_from_dir) || st=$$?; \ - done; \ - exit $$st -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-am -all-am: Makefile all-local -installdirs: - for dir in "$(DESTDIR)$(pygirepositorydir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-pygirepositoryPYTHON - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-pygirepositoryPYTHON - -.MAKE: check-am install-am install-strip - -.PHONY: all all-am all-local check check-am check-local clean \ - clean-generic clean-libtool cscopelist-am ctags-am distclean \ - distclean-generic distclean-libtool distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-pygirepositoryPYTHON \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am uninstall-pygirepositoryPYTHON - - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygirepository_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: build_pylinks -check-local: build_pylinks - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/gi/repository/__init__.py b/gi/repository/__init__.py index 5c5552a..640fc8e 100644 --- a/gi/repository/__init__.py +++ b/gi/repository/__init__.py @@ -18,8 +18,6 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -from __future__ import absolute_import - import sys from ..importer import DynamicImporter diff --git a/gi/repository/meson.build b/gi/repository/meson.build new file mode 100644 index 0000000..fdc136b --- /dev/null +++ b/gi/repository/meson.build @@ -0,0 +1,5 @@ +python_sources = ['__init__.py'] + +python.install_sources(python_sources, + subdir : join_paths('gi', 'repository') +) diff --git a/gi/types.py b/gi/types.py index 7c0f617..9205936 100644 --- a/gi/types.py +++ b/gi/types.py @@ -20,14 +20,10 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA -from __future__ import absolute_import +import re -import sys -import warnings - -from . import _gobject -from ._gobject._gobject import GInterface -from ._gobject.constants import TYPE_INVALID +from ._constants import TYPE_INVALID +from .docstring import generate_doc_string from ._gi import \ InterfaceInfo, \ @@ -35,15 +31,19 @@ from ._gi import \ StructInfo, \ VFuncInfo, \ register_interface_info, \ - hook_up_vfunc_implementation + hook_up_vfunc_implementation, \ + GInterface +from . import _gi + +StructInfo, GInterface # pyflakes +from . import _propertyhelper as propertyhelper +from . import _signalhelper as signalhelper -StructInfo # pyflakes -if (3, 0) <= sys.version_info < (3, 3): - # callable not available for python 3.0 thru 3.2 - def callable(obj): - return hasattr(obj, '__call__') +def snake_case(name): + s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) + return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() class MetaClassHelper(object): @@ -51,6 +51,17 @@ class MetaClassHelper(object): for method_info in cls.__info__.get_methods(): setattr(cls, method_info.__name__, method_info) + def _setup_class_methods(cls): + info = cls.__info__ + class_struct = info.get_class_struct() + if class_struct is None: + return + for method_info in class_struct.get_methods(): + name = method_info.__name__ + # Don't mask regular methods or base class methods with TypeClass methods. + if not hasattr(cls, name): + setattr(cls, name, classmethod(method_info)) + def _setup_fields(cls): for field_info in cls.__info__.get_fields(): name = field_info.get_name().replace('-', '_') @@ -67,6 +78,8 @@ class MetaClassHelper(object): if not vfunc_name.startswith("do_") or not callable(py_vfunc): continue + skip_ambiguity_check = False + # If a method name starts with "do_" assume it is a vfunc, and search # in the base classes for a method with the same name to override. # Recursion is necessary as overriden methods in most immediate parent @@ -78,6 +91,20 @@ class MetaClassHelper(object): vfunc_info = method break + if not hasattr(base, '__info__') or not hasattr(base.__info__, 'get_vfuncs'): + continue + + base_name = snake_case(base.__info__.get_type_name()) + + for v in base.__info__.get_vfuncs(): + if vfunc_name == 'do_%s_%s' % (base_name, v.get_name()): + vfunc_info = v + skip_ambiguity_check = True + break + + if vfunc_info: + break + # If we did not find a matching method name in the bases, we might # be overriding an interface virtual method. Since interfaces do not # provide implementations, there will be no method attribute installed @@ -88,22 +115,22 @@ class MetaClassHelper(object): vfunc_info = find_vfunc_info_in_interface(cls.__bases__, vfunc_name[len("do_"):]) if vfunc_info is not None: - assert vfunc_name == ('do_' + vfunc_info.get_name()) # Check to see if there are vfuncs with the same name in the bases. # We have no way of specifying which one we are supposed to override. - ambiguous_base = find_vfunc_conflict_in_bases(vfunc_info, cls.__bases__) - if ambiguous_base is not None: - base_info = vfunc_info.get_container() - raise TypeError('Method %s() on class %s.%s is ambiguous ' - 'with methods in base classes %s.%s and %s.%s' % - (vfunc_name, - cls.__info__.get_namespace(), - cls.__info__.get_name(), - base_info.get_namespace(), - base_info.get_name(), - ambiguous_base.__info__.get_namespace(), - ambiguous_base.__info__.get_name() - )) + if not skip_ambiguity_check: + ambiguous_base = find_vfunc_conflict_in_bases(vfunc_info, cls.__bases__) + if ambiguous_base is not None: + base_info = vfunc_info.get_container() + raise TypeError('Method %s() on class %s.%s is ambiguous ' + 'with methods in base classes %s.%s and %s.%s' % + (vfunc_name, + cls.__info__.get_namespace(), + cls.__info__.get_name(), + base_info.get_namespace(), + base_info.get_name(), + ambiguous_base.__info__.get_namespace(), + ambiguous_base.__info__.get_name() + )) hook_up_vfunc_implementation(vfunc_info, cls.__gtype__, py_vfunc) @@ -132,7 +159,7 @@ def find_vfunc_info_in_interface(bases, vfunc_name): # This can be seen in IntrospectionModule.__getattr__() in module.py. # We do not need to search regular classes here, only wrapped interfaces. # We also skip GInterface, because it is not wrapped and has no __info__ attr. - # Skip bases without __info__ (static _gobject._gobject.GObject) + # Skip bases without __info__ (static _gi.GObject) if base is GInterface or\ not issubclass(base, GInterface) or\ not hasattr(base, '__info__'): @@ -169,8 +196,32 @@ def find_vfunc_conflict_in_bases(vfunc, bases): return None -class GObjectMeta(_gobject.GObjectMeta, MetaClassHelper): +class _GObjectMetaBase(type): + """Metaclass for automatically registering GObject classes.""" + def __init__(cls, name, bases, dict_): + type.__init__(cls, name, bases, dict_) + propertyhelper.install_properties(cls) + signalhelper.install_signals(cls) + cls._type_register(cls.__dict__) + + def _type_register(cls, namespace): + # don't register the class if already registered + if '__gtype__' in namespace: + return + + # Do not register a new GType for the overrides, as this would sort of + # defeat the purpose of overrides... + if cls.__module__.startswith('gi.overrides.'): + return + _gi.type_register(cls, namespace.get('__gtype_name__')) + + +_gi._install_metaclass(_GObjectMetaBase) + + +class GObjectMeta(_GObjectMetaBase, MetaClassHelper): + """Meta class used for GI GObject based types.""" def __init__(cls, name, bases, dict_): super(GObjectMeta, cls).__init__(name, bases, dict_) is_gi_defined = False @@ -184,6 +235,8 @@ class GObjectMeta(_gobject.GObjectMeta, MetaClassHelper): if is_python_defined: cls._setup_vfuncs() elif is_gi_defined: + if isinstance(cls.__info__, ObjectInfo): + cls._setup_class_methods() cls._setup_methods() cls._setup_constants() cls._setup_native_vfuncs() @@ -196,6 +249,22 @@ class GObjectMeta(_gobject.GObjectMeta, MetaClassHelper): def mro(cls): return mro(cls) + @property + def __doc__(cls): + """Meta class property which shows up on any class using this meta-class.""" + if cls == GObjectMeta: + return '' + + doc = cls.__dict__.get('__doc__', None) + if doc is not None: + return doc + + # For repository classes, dynamically generate a doc string if it wasn't overridden. + if cls.__module__.startswith(('gi.repository.', 'gi.overrides')): + return generate_doc_string(cls.__info__) + + return None + def mro(C): """Compute the class precedence list (mro) according to C3, with GObject @@ -218,19 +287,7 @@ def mro(C): # in __mro__ at each point. Therefore at this point we know that # we already have our base class MRO's available to us, there is # no need for us to (re)calculate them. - if hasattr(base, '__mro__'): - bases_of_subclasses += [list(base.__mro__)] - else: - warnings.warn('Mixin class %s is an old style class, please ' - 'update this to derive from "object".' % base, - RuntimeWarning) - # For old-style classes (Python2 only), the MRO is not - # easily accessible. As we do need it here, we calculate - # it via recursion, according to the C3 algorithm. Using C3 - # for old style classes deviates from Python's own behaviour, - # but visible effects here would be a corner case triggered by - # questionable design. - bases_of_subclasses += [mro(base)] + bases_of_subclasses += [list(base.__mro__)] bases_of_subclasses += [list(C.__bases__)] while bases_of_subclasses: @@ -257,7 +314,12 @@ def mro(C): return bases +def nothing(*args, **kwargs): + pass + + class StructMeta(type, MetaClassHelper): + """Meta class used for GI Struct based types.""" def __init__(cls, name, bases, dict_): super(StructMeta, cls).__init__(name, bases, dict_) @@ -273,6 +335,16 @@ class StructMeta(type, MetaClassHelper): for method_info in cls.__info__.get_methods(): if method_info.is_constructor() and \ method_info.__name__ == 'new' and \ - not method_info.get_arguments(): + (not method_info.get_arguments() or + cls.__info__.get_size() == 0): cls.__new__ = staticmethod(method_info) + # Boxed will raise an exception + # if arguments are given to __init__ + cls.__init__ = nothing break + + @property + def __doc__(cls): + if cls == StructMeta: + return '' + return generate_doc_string(cls.__info__) diff --git a/install-sh b/install-sh deleted file mode 100755 index 377bb86..0000000 --- a/install-sh +++ /dev/null @@ -1,527 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2011-11-20.07; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/ltmain.sh b/ltmain.sh deleted file mode 100644 index 3825a2a..0000000 --- a/ltmain.sh +++ /dev/null @@ -1,9661 +0,0 @@ - -# libtool (GNU libtool) 2.4.2 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --no-warn don't display warning messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.3ubuntu1 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -PROGRAM=libtool -PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1.3ubuntu1" -TIMESTAMP="" -package_revision=1.3337 - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=${PATH_SEPARATOR-:} - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation - -exit_cmd=: - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -nonopt= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "${1}=\$${1}\${2}" -} # func_append may be replaced by extended shell implementation - -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by extended shell implementation - - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "${@}"` -} # func_arith may be replaced by extended shell implementation - - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by extended shell implementation - - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by extended shell implementation - - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} # func_xform may be replaced by extended shell implementation - - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_features () -{ - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - - exit $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac - - - -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_warning=: -opt_verbose=: -opt_silent=false -opt_verbose=false - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" - shift - ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac - shift - ;; - --no-silent|--no-quiet) - opt_silent=false -func_append preserve_args " $opt" - ;; - --no-warning|--no-warn) - opt_warning=false -func_append preserve_args " $opt" - ;; - --no-verbose) - opt_verbose=false -func_append preserve_args " $opt" - ;; - --silent|--quiet) - opt_silent=: -func_append preserve_args " $opt" - opt_verbose=false - ;; - --verbose|-v) - opt_verbose=: -func_append preserve_args " $opt" -opt_silent=false - ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -func_append preserve_args " $opt $optarg" -func_enable_tag "$optarg" - shift - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi - - # preserve --debug - test "$opt_debug" = : || func_append preserve_args " --debug" - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - - $opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -## ----------- ## -## Main. ## -## ----------- ## - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_resolve_sysroot PATH -# Replace a leading = in PATH with a sysroot. Store the result into -# func_resolve_sysroot_result -func_resolve_sysroot () -{ - func_resolve_sysroot_result=$1 - case $func_resolve_sysroot_result in - =*) - func_stripname '=' '' "$func_resolve_sysroot_result" - func_resolve_sysroot_result=$lt_sysroot$func_stripname_result - ;; - esac -} - -# func_replace_sysroot PATH -# If PATH begins with the sysroot, replace it with = and -# store the result into func_replace_sysroot_result. -func_replace_sysroot () -{ - case "$lt_sysroot:$1" in - ?*:"$lt_sysroot"*) - func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" - ;; - *) - # Including no sysroot. - func_replace_sysroot_result=$1 - ;; - esac -} - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then - func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_convert_core_file_wine_to_w32_result= - fi - fi -} -# end: func_convert_core_file_wine_to_w32 - - -# func_convert_core_path_wine_to_w32 ARG -# Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. -# -# ARG is path to be converted from $build format to win32. -# Result is available in $func_convert_core_path_wine_to_w32_result. -# Unconvertible file (directory) names in ARG are skipped; if no directory names -# are convertible, then the result may be empty. -func_convert_core_path_wine_to_w32 () -{ - $opt_debug - # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" - if test -n "$1"; then - oldIFS=$IFS - IFS=: - for func_convert_core_path_wine_to_w32_f in $1; do - IFS=$oldIFS - func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then - if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" - else - func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" - fi - fi - done - IFS=$oldIFS - fi -} -# end: func_convert_core_path_wine_to_w32 - - -# func_cygpath ARGS... -# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when -# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) -# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or -# (2), returns the Cygwin file name or path in func_cygpath_result (input -# file name or path is assumed to be in w32 format, as previously converted -# from $build's *nix or MSYS format). In case (3), returns the w32 file name -# or path in func_cygpath_result (input file name or path is assumed to be in -# Cygwin format). Returns an empty string on error. -# -# ARGS are passed to cygpath, with the last one being the file name or path to -# be converted. -# -# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH -# environment variable; do not put it in $PATH. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_convert_core_msys_to_w32 ARG -# Convert file name or path ARG from MSYS format to w32 format. Return -# result in func_convert_core_msys_to_w32_result. -func_convert_core_msys_to_w32 () -{ - $opt_debug - # awkward: cmd appends spaces to result - func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_convert_core_msys_to_w32 - - -# func_convert_file_check ARG1 ARG2 -# Verify that ARG1 (a file name in $build format) was converted to $host -# format in ARG2. Otherwise, emit an error message, but continue (resetting -# func_to_host_file_result to ARG1). -func_convert_file_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host file name corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_file_result="$1" - fi -} -# end func_convert_file_check - - -# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH -# Verify that FROM_PATH (a path in $build format) was converted to $host -# format in TO_PATH. Otherwise, emit an error message, but continue, resetting -# func_to_host_file_result to a simplistic fallback value (see below). -func_convert_path_check () -{ - $opt_debug - if test -z "$4" && test -n "$3"; then - func_error "Could not determine the host path corresponding to" - func_error " \`$3'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This is a deliberately simplistic "conversion" and - # should not be "improved". See libtool.info. - if test "x$1" != "x$2"; then - lt_replace_pathsep_chars="s|$1|$2|g" - func_to_host_path_result=`echo "$3" | - $SED -e "$lt_replace_pathsep_chars"` - else - func_to_host_path_result="$3" - fi - fi -} -# end func_convert_path_check - - -# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG -# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT -# and appending REPL if ORIG matches BACKPAT. -func_convert_path_front_back_pathsep () -{ - $opt_debug - case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" - ;; - esac - case $4 in - $2 ) func_append func_to_host_path_result "$3" - ;; - esac -} -# end func_convert_path_front_back_pathsep - - -################################################## -# $build to $host FILE NAME CONVERSION FUNCTIONS # -################################################## -# invoked via `$to_host_file_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# Result will be available in $func_to_host_file_result. - - -# func_to_host_file ARG -# Converts the file name ARG from $build format to $host format. Return result -# in func_to_host_file_result. -func_to_host_file () -{ - $opt_debug - $to_host_file_cmd "$1" -} -# end func_to_host_file - - -# func_to_tool_file ARG LAZY -# converts the file name ARG from $build format to toolchain format. Return -# result in func_to_tool_file_result. If the conversion in use is listed -# in (the comma separated) LAZY, no conversion takes place. -func_to_tool_file () -{ - $opt_debug - case ,$2, in - *,"$to_tool_file_cmd",*) - func_to_tool_file_result=$1 - ;; - *) - $to_tool_file_cmd "$1" - func_to_tool_file_result=$func_to_host_file_result - ;; - esac -} -# end func_to_tool_file - - -# func_convert_file_noop ARG -# Copy ARG to func_to_host_file_result. -func_convert_file_noop () -{ - func_to_host_file_result="$1" -} -# end func_convert_file_noop - - -# func_convert_file_msys_to_w32 ARG -# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_file_result. -func_convert_file_msys_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_w32 - - -# func_convert_file_cygwin_to_w32 ARG -# Convert file name ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_file_cygwin_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath in $PATH; no need to use - # LT_CYGPATH in this case. - func_to_host_file_result=`cygpath -m "$1"` - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_cygwin_to_w32 - - -# func_convert_file_nix_to_w32 ARG -# Convert file name ARG from *nix to w32 format. Requires a wine environment -# and a working winepath. Returns result in func_to_host_file_result. -func_convert_file_nix_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_w32 - - -# func_convert_file_msys_to_cygwin ARG -# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_file_msys_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_cygwin - - -# func_convert_file_nix_to_cygwin ARG -# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed -# in a wine environment, working winepath, and LT_CYGPATH set. Returns result -# in func_to_host_file_result. -func_convert_file_nix_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. - func_convert_core_file_wine_to_w32 "$1" - func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_cygwin - - -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `$to_host_path_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# The result will be available in $func_to_host_path_result. -# -# Path separators are also converted from $build format to $host format. If -# ARG begins or ends with a path separator character, it is preserved (but -# converted to $host format) on output. -# -# All path conversion functions are named using the following convention: -# file name conversion function : func_convert_file_X_to_Y () -# path conversion function : func_convert_path_X_to_Y () -# where, for any given $build/$host combination the 'X_to_Y' value is the -# same. If conversion functions are added for new $build/$host combinations, -# the two new functions must follow this pattern, or func_init_to_host_path_cmd -# will break. - - -# func_init_to_host_path_cmd -# Ensures that function "pointer" variable $to_host_path_cmd is set to the -# appropriate value, based on the value of $to_host_file_cmd. -to_host_path_cmd= -func_init_to_host_path_cmd () -{ - $opt_debug - if test -z "$to_host_path_cmd"; then - func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" - fi -} - - -# func_to_host_path ARG -# Converts the path ARG from $build format to $host format. Return result -# in func_to_host_path_result. -func_to_host_path () -{ - $opt_debug - func_init_to_host_path_cmd - $to_host_path_cmd "$1" -} -# end func_to_host_path - - -# func_convert_path_noop ARG -# Copy ARG to func_to_host_path_result. -func_convert_path_noop () -{ - func_to_host_path_result="$1" -} -# end func_convert_path_noop - - -# func_convert_path_msys_to_w32 ARG -# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_path_result. -func_convert_path_msys_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from ARG. MSYS - # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; - # and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_msys_to_w32 - - -# func_convert_path_cygwin_to_w32 ARG -# Convert path ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_path_cygwin_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_cygwin_to_w32 - - -# func_convert_path_nix_to_w32 ARG -# Convert path ARG from *nix to w32 format. Requires a wine environment and -# a working winepath. Returns result in func_to_host_file_result. -func_convert_path_nix_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_nix_to_w32 - - -# func_convert_path_msys_to_cygwin ARG -# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_path_msys_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_msys_to_cygwin - - -# func_convert_path_nix_to_cygwin ARG -# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a -# a wine environment, working winepath, and LT_CYGPATH set. Returns result in -# func_to_host_file_result. -func_convert_path_nix_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_nix_to_cygwin - - -# func_mode_compile arg... -func_mode_compile () -{ - $opt_debug - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - pie_flag= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - test -n "$libobj" && \ - func_fatal_error "you cannot specify \`-o' more than once" - arg_mode=target - continue - ;; - - -pie | -fpie | -fPIE) - func_append pie_flag " $arg" - continue - ;; - - -shared | -static | -prefer-pic | -prefer-non-pic) - func_append later " $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - func_append_quoted lastarg "$arg" - done - IFS="$save_ifs" - func_stripname ' ' '' "$lastarg" - lastarg=$func_stripname_result - - # Add the arguments to base_compile. - func_append base_compile " $lastarg" - continue - ;; - - *) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - func_append_quoted base_compile "$lastarg" - done # for arg - - case $arg_mode in - arg) - func_fatal_error "you must specify an argument for -Xcompile" - ;; - target) - func_fatal_error "you must specify a target with \`-o'" - ;; - *) - # Get the name of the library object. - test -z "$libobj" && { - func_basename "$srcfile" - libobj="$func_basename_result" - } - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - case $libobj in - *.[cCFSifmso] | \ - *.ada | *.adb | *.ads | *.asm | \ - *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) - func_xform "$libobj" - libobj=$func_xform_result - ;; - esac - - case $libobj in - *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; - *) - func_fatal_error "cannot determine name of library object from \`$libobj'" - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - continue - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ - && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - func_append removelist " $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - func_append removelist " $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 - srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - func_append command " -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - func_append command " -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - func_append command "$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $opt_mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$opt_mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $opt_dlopen; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - func_append dir "/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_append_quoted args "$file" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libs= - libdirs= - admincmds= - - for opt in "$nonopt" ${1+"$@"} - do - if test -d "$opt"; then - func_append libdirs " $opt" - - elif test -f "$opt"; then - if func_lalib_unsafe_p "$opt"; then - func_append libs " $opt" - else - func_warning "\`$opt' is not a valid libtool archive" - fi - - else - func_fatal_error "invalid argument \`$opt'" - fi - done - - if test -n "$libs"; then - if test -n "$lt_sysroot"; then - sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` - sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" - else - sysroot_cmd= - fi - - # Remove sysroot references - if $opt_dry_run; then - for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" - done - else - tmpdir=`func_mktempdir` - for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ - > $tmpdir/tmp-la - mv -f $tmpdir/tmp-la $lib - done - ${RM}r "$tmpdir" - fi - fi - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || func_append admincmds " - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - fi - exit $EXIT_SUCCESS -} - -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - func_append files " $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - func_append install_shared_prog " $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - func_append staticlibs " $file" - ;; - - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) func_append current_libdirs " $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) func_append future_libdirs " $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - func_append dir "$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && func_append staticlibs " $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 - tool_oldlib=$func_to_tool_file_result - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $tool_oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" - $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - case $host in - *cygwin* | *mingw* | *cegcc* ) - # if an import library, we need to obtain dlname - if func_win32_import_lib_p "$dlprefile"; then - func_tr_sh "$dlprefile" - eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" - if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then - # Use subshell, to avoid clobbering current variable values - dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then - func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" - else - # no lafile. user explicitly requested -dlpreopen . - $sharedlib_from_linklib_cmd "$dlprefile" - dlprefile_dlbasename=$sharedlib_from_linklib_result - fi - fi - $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then - eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' - else - func_warning "Could not compute DLL name from $name" - eval '$ECHO ": $name " >> "$nlist"' - fi - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" - } - else # not an import lib - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - fi - ;; - *) - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - ;; - esac - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) func_append symtab_cflags " $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - -# func_cygming_dll_for_implib ARG -# -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib () -{ - $opt_debug - sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` -} - -# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs -# -# The is the core of a fallback implementation of a -# platform-specific function to extract the name of the -# DLL associated with the specified import library LIBNAME. -# -# SECTION_NAME is either .idata$6 or .idata$7, depending -# on the platform and compiler that created the implib. -# -# Echos the name of the DLL associated with the -# specified import library. -func_cygming_dll_for_implib_fallback_core () -{ - $opt_debug - match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` - $OBJDUMP -s --section "$1" "$2" 2>/dev/null | - $SED '/^Contents of section '"$match_literal"':/{ - # Place marker at beginning of archive member dllname section - s/.*/====MARK====/ - p - d - } - # These lines can sometimes be longer than 43 characters, but - # are always uninteresting - /:[ ]*file format pe[i]\{,1\}-/d - /^In archive [^:]*:/d - # Ensure marker is printed - /^====MARK====/p - # Remove all lines with less than 43 characters - /^.\{43\}/!d - # From remaining lines, remove first 43 characters - s/^.\{43\}//' | - $SED -n ' - # Join marker and all lines until next marker into a single line - /^====MARK====/ b para - H - $ b para - b - :para - x - s/\n//g - # Remove the marker - s/^====MARK====// - # Remove trailing dots and whitespace - s/[\. \t]*$// - # Print - /./p' | - # we now have a list, one entry per line, of the stringified - # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is - # a '.' (that is, objdump's representation of an unprintable - # character.) This should work for all archives with less than - # 0x302f exports -- but will fail for DLLs whose name actually - # begins with a literal '.' or a single character followed by - # a '.'. - # - # Of those that remain, print the first one. - $SED -e '/^\./d;/^.\./d;q' -} - -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - -# func_cygming_dll_for_implib_fallback ARG -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# -# This fallback implementation is for use when $DLLTOOL -# does not support the --identify-strict option. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib_fallback () -{ - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then - # binutils import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then - # ms-generated import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` - else - # unknown - sharedlib_from_linklib_result="" - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - case \" \$* \" in - *\\ --lt-*) - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done ;; - esac - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # fixup the dll searchpath if we need to. - # - # Fix the DLL searchpath if we need to. Do this before prepending - # to shlibpath, because on Windows, both are PATH and uninstalled - # libraries must come first. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - func_exec_program \${1+\"\$@\"} - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} - - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; -#else -static int lt_debug = 0; -#endif - -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - -static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *file, int line, const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); - va_end (ap); -} - -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - -void -lt_setenv (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -n -e ' -s/^\(.\{79\}\)\(..*\)/\1\ -\2/ -h -s/\([\\"]\)/\\\1/g -s/$/\\n/ -s/\([^\n]*\).*/ fputs ("\1", f);/p -g -D' - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - func_append dlfiles " $arg" - else - func_append dlprefiles " $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) func_append deplibs " $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# func_append moreargs " $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) func_append rpath " $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) func_append xrpath " $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - func_append weak_libs " $arg" - prev= - continue - ;; - xcclinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname "-L" '' "$arg" - if test -z "$func_stripname_result"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "* | *" $arg "*) - # Will only happen for absolute or sysroot arguments - ;; - *) - # Preserve sysroot, but never include relative directories - case $dir in - [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; - *) func_append deplibs " -L$dir" ;; - esac - func_append lib_search_path " $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) func_append dllsearchpath ":$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - func_append deplibs " System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - func_append deplibs " $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - =*) - func_stripname '=' '' "$dir" - dir=$lt_sysroot$func_stripname_result - ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - func_append compiler_flags " $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - func_append objs " $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - func_append deplibs " $arg" - func_append old_deplibs " $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - func_resolve_sysroot "$arg" - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - func_append dlfiles " $func_resolve_sysroot_result" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - func_append dlprefiles " $func_resolve_sysroot_result" - prev= - else - func_append deplibs " $func_resolve_sysroot_result" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - func_to_tool_file "$output_objdir/" - tool_output_objdir=$func_to_tool_file_result - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_preserve_dup_deps ; then - case "$libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append libs " $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; - esac - func_append pre_post_deps " $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) - libs="$deplibs %DEPLIBS%" - test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" - ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - func_resolve_sysroot "$lib" - case $lib in - *.la) func_source "$func_resolve_sysroot_result" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) func_append deplibs " $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append compiler_flags " $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) - func_resolve_sysroot "$deplib" - lib=$func_resolve_sysroot_result - ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - func_append newdlprefiles " $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append newdlfiles " $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && func_append dlfiles " $dlopen" - test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then - linklib=$old_library - else - for l in $old_library $library_names; do - linklib="$l" - done - fi - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - func_append dlprefiles " $lib $dependency_libs" - else - func_append newdlfiles " $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - case "$host" in - # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) - # Linker will automatically link against shared library if both - # static and shared are present. Therefore, ensure we extract - # symbols from the import library if a shared library is present - # (otherwise, the dlopen module name will be incorrect). We do - # this by putting the import library name into $newdlprefiles. - # We recover the dlopen module name by 'saving' the la file - # name in a special purpose variable, and (later) extracting the - # dlname from the la file. - if test -n "$dlname"; then - func_tr_sh "$dir/$linklib" - eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" - func_append newdlprefiles " $dir/$linklib" - else - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - fi - ;; - * ) - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - func_append newdlprefiles " $dir/$dlname" - else - func_append newdlprefiles " $dir/$linklib" - fi - ;; - esac - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - func_append newlib_search_path " $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) func_append temp_rpath "$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - func_append notinst_deplibs " $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - func_append notinst_deplibs " $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$opt_mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$absdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) func_append compile_shlibpath "$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$opt_mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) func_append xrpath " $temp_xrpath";; - esac;; - *) func_append temp_deplibs " $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - func_append newlib_search_path " $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result";; - *) func_resolve_sysroot "$deplib" ;; - esac - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $func_resolve_sysroot_result "*) - func_append specialdeplibs " $func_resolve_sysroot_result" ;; - esac - fi - func_append tmp_libs " $func_resolve_sysroot_result" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_resolve_sysroot "$deplib" - deplib=$func_resolve_sysroot_result - func_dirname "$deplib" "" "." - dir=$func_dirname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) func_append lib_search_path " $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) func_append tmp_libs " $deplib" ;; - esac - ;; - *) func_append tmp_libs " $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - func_append tmp_libs " $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - func_append objs "$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - func_append libobjs " $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - # correct linux to gnu/linux during the next big refactor - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - *) - func_fatal_configuration "$modename: unknown library version type \`$version_type'" - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) # correct to gnu/linux during the next big refactor - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - func_append verstring ":${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - func_append libobjs " $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$opt_mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - func_append removelist " $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - func_append oldlibs " $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - func_replace_sysroot "$libdir" - func_append temp_xrpath " -R$func_replace_sysroot_result" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) func_append dlfiles " $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) func_append dlprefiles " $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - func_append deplibs " System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - func_append deplibs " -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - $nocaseglob - else - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - fi - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - func_append newdeplibs " $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - # Remove ${wl} instances when linking with ld. - # FIXME: should test the right _cmds variable. - case $archive_cmds in - *\$LD\ *) wl= ;; - esac - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append dep_rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - func_append linknames " $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - func_append delfiles " $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd1 in $cmds; do - IFS="$save_ifs" - # Take the normal branch if the nm_file_list_spec branch - # doesn't work or if tool conversion is not needed. - case $nm_file_list_spec~$to_tool_file_cmd in - *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) - try_normal_branch=yes - eval cmd=\"$cmd1\" - func_len " $cmd" - len=$func_len_result - ;; - *) - try_normal_branch=no - ;; - esac - if test "$try_normal_branch" = yes \ - && { test "$len" -lt "$max_cmd_len" \ - || test "$max_cmd_len" -le -1; } - then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - elif test -n "$nm_file_list_spec"; then - func_basename "$output" - output_la=$func_basename_result - save_libobjs=$libobjs - save_output=$output - output=${output_objdir}/${output_la}.nm - func_to_tool_file "$output" - libobjs=$nm_file_list_spec$func_to_tool_file_result - func_append delfiles " $output" - func_verbose "creating $NM input file list: $output" - for obj in $save_libobjs; do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > "$output" - eval cmd=\"$cmd1\" - func_show_eval "$cmd" 'exit $?' - output=$save_output - libobjs=$save_libobjs - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - func_append tmp_deplibs " $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - func_append linker_flags " $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - echo ')' >> $output - func_append delfiles " $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - func_append delfiles " $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - func_append delfiles " $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - func_append compile_command " ${wl}-bind_at_load" - func_append finalize_command " ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - func_append compile_command " $compile_deplibs" - func_append finalize_command " $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) func_append dllsearchpath ":$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) func_append finalize_perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - func_append rpath "$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output_objdir/$outputname" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - func_append oldobjs " $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $addlibs - func_append oldobjs " $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append oldobjs " $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - func_append oldobjs " $gentop/$newobj" - ;; - *) func_append oldobjs " $obj" ;; - esac - done - fi - func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 - tool_oldlib=$func_to_tool_file_result - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - elif test -n "$archiver_list_spec"; then - func_verbose "using command file archive linking..." - for obj in $oldobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > $output_objdir/$libname.libcmd - func_to_tool_file "$output_objdir/$libname.libcmd" - oldobjs=" $archiver_list_spec$func_to_tool_file_result" - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - func_resolve_sysroot "$deplib" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" - ;; - -L*) - func_stripname -L '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -L$func_replace_sysroot_result" - ;; - -R*) - func_stripname -R '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -R$func_replace_sysroot_result" - ;; - *) func_append newdependency_libs " $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" - ;; - *) func_append newdlfiles " $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlfiles " $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlprefiles " $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) func_append RM " $arg"; rmforce=yes ;; - -*) func_append RM " $arg" ;; - *) func_append files " $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - odir="$objdir" - else - odir="$dir/$objdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" - - # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then - case " $rmdirs " in - *" $odir "*) ;; - *) func_append rmdirs " $odir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - func_append rmfiles " $odir/$n" - done - test -n "$old_library" && func_append rmfiles " $odir/$old_library" - - case "$opt_mode" in - clean) - case " $library_names " in - *" $dlname "*) ;; - *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; - esac - test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - func_append rmfiles " $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - func_append rmfiles " $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$opt_mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - func_append rmfiles " $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - func_append rmfiles " $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - func_append rmfiles " $odir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - func_append rmfiles " $odir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$opt_mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/m4/as-ac-expand.m4 b/m4/as-ac-expand.m4 deleted file mode 100644 index 0c71173..0000000 --- a/m4/as-ac-expand.m4 +++ /dev/null @@ -1,40 +0,0 @@ -dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) -dnl -dnl example -dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) -dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local - -AC_DEFUN([AS_AC_EXPAND], -[ - EXP_VAR=[$1] - FROM_VAR=[$2] - - dnl first expand prefix and exec_prefix if necessary - prefix_save=$prefix - exec_prefix_save=$exec_prefix - - dnl if no prefix given, then use /usr/local, the default prefix - if test "x$prefix" = "xNONE"; then - prefix=$ac_default_prefix - fi - dnl if no exec_prefix given, then use prefix - if test "x$exec_prefix" = "xNONE"; then - exec_prefix=$prefix - fi - - full_var="$FROM_VAR" - dnl loop until it doesn't change anymore - while true; do - new_full_var="`eval echo $full_var`" - if test "x$new_full_var"="x$full_var"; then break; fi - full_var=$new_full_var - done - - dnl clean up - full_var=$new_full_var - AC_SUBST([$1], "$full_var") - - dnl restore prefix and exec_prefix - prefix=$prefix_save - exec_prefix=$exec_prefix_save -]) diff --git a/m4/jhflags.m4 b/m4/jhflags.m4 deleted file mode 100644 index 222e4b0..0000000 --- a/m4/jhflags.m4 +++ /dev/null @@ -1,21 +0,0 @@ -dnl -dnl JH_ADD_CFLAG(FLAG) -dnl checks whether the C compiler supports the given flag, and if so, adds -dnl it to $CFLAGS. If the flag is already present in the list, then the -dnl check is not performed. -AC_DEFUN([JH_ADD_CFLAG], -[ -case " $CFLAGS " in -*@<:@\ \ @:>@$1@<:@\ \ @:>@*) - ;; -*) - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $1" - AC_MSG_CHECKING([whether [$]CC understands $1]) - AC_TRY_COMPILE([], [], [jh_has_option=yes], [jh_has_option=no]) - AC_MSG_RESULT($jh_has_option) - if test $jh_has_option = no; then - CFLAGS="$save_CFLAGS" - fi - ;; -esac]) diff --git a/m4/libtool.m4 b/m4/libtool.m4 deleted file mode 100644 index 02b4bbe..0000000 --- a/m4/libtool.m4 +++ /dev/null @@ -1,7991 +0,0 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 57 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl -dnl -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_WITH_SYSROOT])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - -## ------------------------------------- ## -## Accumulate code for creating libtool. ## -## ------------------------------------- ## - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - -## ------------------------ ## -## FIXME: Eliminate VARNAME ## -## ------------------------ ## - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2011 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_REPLACE_SHELLFNS - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Go], [_LT_LANG(GO)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -m4_ifndef([AC_PROG_GO], [ -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_GO. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -m4_defun([AC_PROG_GO], -[AC_LANG_PUSH(Go)dnl -AC_ARG_VAR([GOC], [Go compiler command])dnl -AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl -_AC_ARG_VAR_LDFLAGS()dnl -AC_CHECK_TOOL(GOC, gccgo) -if test -z "$GOC"; then - if test -n "$ac_tool_prefix"; then - AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) - fi -fi -if test -z "$GOC"; then - AC_CHECK_PROG(GOC, gccgo, gccgo, false) -fi -])#m4_defun -])#m4_ifndef - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([AC_PROG_GO], - [LT_LANG(GO)], - [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&AS_MESSAGE_LOG_FD - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&AS_MESSAGE_LOG_FD - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES([TAG]) -# --------------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], - [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) -# ---------------------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -# Store the results from the different compilers for each TAGNAME. -# Allow to override them for all tags through lt_cv_aix_libpath. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], - [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ - lt_aix_libpath_sed='[ - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }]' - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi],[]) - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" - fi - ]) - aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) -fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -case "$ECHO" in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_WITH_SYSROOT -# ---------------- -AC_DEFUN([_LT_WITH_SYSROOT], -[AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[ --with-sysroot[=DIR] Search for dependent libraries within DIR - (or the compiler's sysroot if not specified).], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([${with_sysroot}]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac - - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and in which our libraries should be installed.])]) - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_PROG_AR -# ----------- -m4_defun([_LT_PROG_AR], -[AC_CHECK_TOOLS(AR, [ar], false) -: ${AR=ar} -: ${AR_FLAGS=cru} -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) - -AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], - [lt_cv_ar_at_file=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - ]) - ]) - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi -_LT_DECL([], [archiver_list_spec], [1], - [How to feed a file listing to the archiver]) -])# _LT_PROG_AR - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[_LT_PROG_AR - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[23]].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[[3-9]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method = "file_magic"]) -_LT_DECL([], [file_magic_glob], [1], - [How to find potential files when deplibs_check_method = "file_magic"]) -_LT_DECL([], [want_nocaseglob], [1], - [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - -# _LT_CHECK_SHAREDLIB_FROM_LINKLIB -# -------------------------------- -# how to determine the name of the shared library -# associated with a specific link library. -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -m4_require([_LT_DECL_DLLTOOL]) -AC_CACHE_CHECK([how to associate runtime and link libraries], -lt_cv_sharedlib_from_linklib_cmd, -[lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac -]) -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - -_LT_DECL([], [sharedlib_from_linklib_cmd], [1], - [Command to associate shared and link libraries]) -])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB - - -# _LT_PATH_MANIFEST_TOOL -# ---------------------- -# locate the manifest tool -m4_defun([_LT_PATH_MANIFEST_TOOL], -[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&AS_MESSAGE_LOG_FD - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest*]) -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi -_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl -])# _LT_PATH_MANIFEST_TOOL - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT@&t@_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT@&t@_DLSYM_CONST -#else -# define LT@&t@_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT@&t@_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([], [nm_file_list_spec], [1], - [Specify filename containing input files for $NM]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ F* | *Sun*Fortran*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - *Intel*\ [[CF]]*Compiler*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - *Portland\ Group*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac - -AC_CACHE_CHECK([for $compiler option to produce PIC], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) - _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - esac - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], - [lt_cv_irix_exported_symbol], - [save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], - [C++], [[int foo (void) { return 0; }]], - [Fortran 77], [[ - subroutine foo - end]], - [Fortran], [[ - subroutine foo - end]])])], - [lt_cv_irix_exported_symbol=yes], - [lt_cv_irix_exported_symbol=no]) - LDFLAGS="$save_LDFLAGS"]) - if test "$lt_cv_irix_exported_symbol" = yes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [postlink_cmds], [2], - [Commands necessary for finishing linking programs]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd2.*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_FUNC_STRIPNAME_CNF -# ---------------------- -# func_stripname_cnf prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# -# This function is identical to the (non-XSI) version of func_stripname, -# except this one can be used by m4 code that may be executed by configure, -# rather than the libtool script. -m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl -AC_REQUIRE([_LT_DECL_SED]) -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf -])# _LT_FUNC_STRIPNAME_CNF - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF -package foo -func foo() { -} -_LT_EOF -]) - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; -esac - -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${F77-"f77"} - CFLAGS=$FFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" - CFLAGS="$lt_save_CFLAGS" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${FC-"f95"} - CFLAGS=$FCFLAGS - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -CFLAGS=$GCJFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_GO_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Go compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GO_CONFIG], -[AC_REQUIRE([LT_PROG_GO])dnl -AC_LANG_SAVE - -# Source file extension for Go test sources. -ac_ext=go - -# Object file extension for compiled Go test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="package main; func main() { }" - -# Code to be used in simple link tests -lt_simple_link_test_code='package main; func main() { }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GOC-"gccgo"} -CFLAGS=$GOFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# Go did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GO_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -CFLAGS= -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_GO -# ---------- -AC_DEFUN([LT_PROG_GO], -[AC_CHECK_TOOL(GOC, gccgo,) -]) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - -# _LT_DECL_DLLTOOL -# ---------------- -# Ensure DLLTOOL variable is set. -m4_defun([_LT_DECL_DLLTOOL], -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) -AC_SUBST([DLLTOOL]) -]) - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------------ -# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and -# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_FUNCTION_REPLACE], -[dnl { -sed -e '/^$1 ()$/,/^} # $1 /c\ -$1 ()\ -{\ -m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: -]) - - -# _LT_PROG_REPLACE_SHELLFNS -# ------------------------- -# Replace existing portable implementations of several shell functions with -# equivalent extended shell implementations where those features are available.. -m4_defun([_LT_PROG_REPLACE_SHELLFNS], -[if test x"$xsi_shell" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) - - _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) - - _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) - - _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) -fi - -if test x"$lt_shell_append" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) - - _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl - func_quote_for_eval "${2}" -dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ - eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) -fi -]) - -# _LT_PATH_CONVERSION_FUNCTIONS -# ----------------------------- -# Determine which file name conversion functions should be used by -# func_to_host_file (and, implicitly, by func_to_host_path). These are needed -# for certain cross-compile configurations and native mingw. -m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_MSG_CHECKING([how to convert $build file names to $host format]) -AC_CACHE_VAL(lt_cv_to_host_file_cmd, -[case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac -]) -to_host_file_cmd=$lt_cv_to_host_file_cmd -AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) -_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], - [0], [convert $build file names to $host format])dnl - -AC_MSG_CHECKING([how to convert $build file names to toolchain format]) -AC_CACHE_VAL(lt_cv_to_tool_file_cmd, -[#assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac -]) -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) -_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], - [0], [convert $build files to toolchain format])dnl -])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 deleted file mode 100644 index 5d9acd8..0000000 --- a/m4/ltoptions.m4 +++ /dev/null @@ -1,384 +0,0 @@ -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 7 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - -## --------------------------------- ## -## Macros to handle LT_INIT options. ## -## --------------------------------- ## - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for lt_pkg in $withval; do - IFS="$lt_save_ifs" - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - -## ----------------- ## -## LTDL_INIT Options ## -## ----------------- ## - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 deleted file mode 100644 index 9000a05..0000000 --- a/m4/ltsugar.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 deleted file mode 100644 index 07a8602..0000000 --- a/m4/ltversion.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# @configure_input@ - -# serial 3337 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.4.2]) -m4_define([LT_PACKAGE_REVISION], [1.3337]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.2' -macro_revision='1.3337' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 deleted file mode 100644 index c573da9..0000000 --- a/m4/lt~obsolete.m4 +++ /dev/null @@ -1,98 +0,0 @@ -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/m4/python.m4 b/m4/python.m4 deleted file mode 100644 index 95ae809..0000000 --- a/m4/python.m4 +++ /dev/null @@ -1,251 +0,0 @@ -## this one is commonly used with AM_PATH_PYTHONDIR ... -dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]]) -dnl Check if a module containing a given symbol is visible to python. -AC_DEFUN([AM_CHECK_PYMOD], -[AC_REQUIRE([AM_PATH_PYTHON]) -py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` -AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1) -AC_CACHE_VAL(py_cv_mod_$py_mod_var, [ -ifelse([$2],[], [prog=" -import sys -try: - import $1 -except ImportError: - sys.exit(1) -except: - sys.exit(0) -sys.exit(0)"], [prog=" -import $1 -$1.$2"]) -if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC - then - eval "py_cv_mod_$py_mod_var=yes" - else - eval "py_cv_mod_$py_mod_var=no" - fi -]) -py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"` -if test "x$py_val" != xno; then - AC_MSG_RESULT(yes) - ifelse([$3], [],, [$3 -])dnl -else - AC_MSG_RESULT(no) - ifelse([$4], [],, [$4 -])dnl -fi -]) - -dnl a macro to check for ability to create python extensions -dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) -dnl function also defines PYTHON_INCLUDES -AC_DEFUN([AM_CHECK_PYTHON_HEADERS], -[AC_REQUIRE([AM_PATH_PYTHON]) -AC_MSG_CHECKING(for headers required to compile python extensions) -dnl deduce PYTHON_INCLUDES -if test "x$PYTHON_INCLUDES" = x; then - PYTHON_CONFIG=`which $PYTHON`-config - if test -x "$PYTHON_CONFIG"; then - PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null` - else - PYTHON_INCLUDES=`$PYTHON -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc(True))"` - PYTHON_INCLUDES="-I$PYTHON_INCLUDES" - fi -fi -AC_SUBST(PYTHON_INCLUDES) -dnl check if the headers exist: -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" -AC_TRY_CPP([#include ],dnl -[AC_MSG_RESULT(found) -$1],dnl -[AC_MSG_RESULT(not found) -$2]) -CPPFLAGS="$save_CPPFLAGS" -]) - -dnl a macro to check for ability to embed python -dnl AM_CHECK_PYTHON_LIBS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) -dnl function also defines PYTHON_LIBS -AC_DEFUN([AM_CHECK_PYTHON_LIBS], -[AC_REQUIRE([AM_PATH_PYTHON]) -AC_MSG_CHECKING(for libraries required to embed python) -dnl deduce PYTHON_LIBS -py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` -if test "x$PYTHON_LIBS" = x; then - PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}" -fi -if test "x$PYTHON_LIB_LOC" = x; then - PYTHON_LIB_LOC="${py_prefix}/lib" -fi -AC_SUBST(PYTHON_LIBS) -AC_SUBST(PYTHON_LIB_LOC) -dnl check if the headers exist: -save_LIBS="$LIBS" -LIBS="$LIBS $PYTHON_LIBS" -AC_TRY_LINK_FUNC(Py_Initialize, dnl - [LIBS="$save_LIBS"; AC_MSG_RESULT(yes); $1], dnl - [LIBS="$save_LIBS"; AC_MSG_RESULT(no); $2]) - -]) - -# JD_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) -# --------------------------------------------------------------------------- -# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. -# Run ACTION-IF-FALSE otherwise. -# This test uses sys.hexversion instead of the string equivalent. -# This is similar to AM_PYTHON_CHECK_VERSION, but without python 1.5.x support -# and with python 3.0 support. -AC_DEFUN([JD_PYTHON_CHECK_VERSION], - [prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] -sys.exit(sys.hexversion < minverhex)" - AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# JD_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# --------------------------------------------------------------------------- -# Adds support for distributing Python modules and packages. To -# install modules, copy them to $(pythondir), using the python_PYTHON -# automake variable. To install a package with the same name as the -# automake package, install to $(pkgpythondir), or use the -# pkgpython_PYTHON automake variable. -# -# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as -# locations to install python extension modules (shared libraries). -# Another macro is required to find the appropriate flags to compile -# extension modules. -# -# If your package is configured with a different prefix to python, -# users will have to add the install directory to the PYTHONPATH -# environment variable, or create a .pth file (see the python -# documentation for details). -# -# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will -# cause an error if the version of python installed on the system -# doesn't meet the requirement. MINIMUM-VERSION should consist of -# numbers and dots only. -AC_DEFUN([JD_PATH_PYTHON], - [ - dnl Find a Python interpreter. Python versions prior to 2.0 are not - dnl supported - m4_define_default([_AM_PYTHON_INTERPRETER_LIST], - [python3 python3.3 python3.2 python3.1 python2 python2.7 python]) - - m4_if([$1],[],[ - dnl No version check is needed. - # Find any Python interpreter. - if test -z "$PYTHON"; then - AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) - fi - am_display_PYTHON=python - ], [ - dnl A version check is needed. - if test -n "$PYTHON"; then - # If the user set $PYTHON, use it and don't search something else. - AC_MSG_CHECKING([whether $PYTHON version >= $1]) - JD_PYTHON_CHECK_VERSION([$PYTHON], [$1], - [AC_MSG_RESULT(yes)], - [AC_MSG_ERROR(too old)]) - am_display_PYTHON=$PYTHON - else - # Otherwise, try each interpreter until we find one that satisfies - # VERSION. - AC_CACHE_CHECK([for a Python interpreter with version >= $1], - [am_cv_pathless_PYTHON],[ - for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do - test "$am_cv_pathless_PYTHON" = none && break - JD_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) - done]) - # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. - if test "$am_cv_pathless_PYTHON" = none; then - PYTHON=: - else - AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) - fi - am_display_PYTHON=$am_cv_pathless_PYTHON - fi - ]) - - if test "$PYTHON" = :; then - dnl Run any user-specified action, or abort. - m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) - else - - dnl Query Python for its version number. Getting [:3] seems to be - dnl the best way to do this; it's what "site.py" does in the standard - dnl library. - - AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], - [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) - AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) - - dnl Use the values of $prefix and $exec_prefix for the corresponding - dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made - dnl distinct variables so they can be overridden if need be. However, - dnl general consensus is that you shouldn't need this ability. - - AC_SUBST([PYTHON_PREFIX], ['${prefix}']) - AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) - - dnl At times (like when building shared libraries) you may want - dnl to know which OS platform Python thinks this is. - - AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], - [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) - AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) - - - dnl Set up 4 directories: - - dnl pythondir -- where to install python scripts. This is the - dnl site-packages directory, not the python standard library - dnl directory like in previous automake betas. This behavior - dnl is more consistent with lispdir.m4 for example. - dnl Query distutils for this directory. distutils does not exist in - dnl Python 1.5, so we fall back to the hardcoded directory if it - dnl doesn't work. - AC_CACHE_CHECK([for $am_display_PYTHON script directory], - [am_cv_python_pythondir], - [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX'))" 2>/dev/null || - echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`]) - AC_SUBST([pythondir], [$am_cv_python_pythondir]) - - dnl pkgpythondir -- $PACKAGE directory under pythondir. Was - dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is - dnl more consistent with the rest of automake. - - AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) - - dnl pyexecdir -- directory for installing python extension modules - dnl (shared libraries) - dnl Query distutils for this directory. distutils does not exist in - dnl Python 1.5, so we fall back to the hardcoded directory if it - dnl doesn't work. - AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], - [am_cv_python_pyexecdir], - [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX'))" 2>/dev/null || - echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`]) - AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) - - dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) - - AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) - - dnl Run any user-specified action. - $2 - fi - -]) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..4c0cb8a --- /dev/null +++ b/meson.build @@ -0,0 +1,221 @@ +project('pygobject', 'c', + version : '3.46.0', + meson_version : '>= 0.56.0', + default_options : [ 'warning_level=1', + 'buildtype=debugoptimized']) + +pygobject_version = meson.project_version() +version_arr = pygobject_version.split('.') +pygobject_version_major = version_arr[0].to_int() +pygobject_version_minor = version_arr[1].to_int() +pygobject_version_micro = version_arr[2].to_int() + +platform_version = '@0@.0'.format(pygobject_version_major) + +pymod = import('python') +python = pymod.find_installation(get_option('python')) + +if python.language_version().version_compare('< 3.8') + error('Requires Python >= 3.8') +endif + +python_dep = python.dependency() + +glib_version_req = '>= 2.64.0' +gi_version_req = '>= 1.64.0' +pycairo_version_req = '>= 1.16.0' +libffi_version_req = '>= 3.0' + +gi_dep = dependency('gobject-introspection-1.0', version : gi_version_req, + fallback: ['gobject-introspection', 'girepo_dep']) +glib_dep = dependency('glib-2.0', version : glib_version_req, + fallback: ['glib', 'libglib_dep']) +gobject_dep = dependency('gobject-2.0', version : glib_version_req, + fallback: ['glib', 'libgobject_dep']) +gio_dep = dependency('gio-2.0', version : glib_version_req, + fallback: ['glib', 'libgio_dep']) +gmodule_dep = dependency('gmodule-2.0', version : glib_version_req, + fallback: ['glib', 'libgmodule_dep']) +ffi_dep = dependency('libffi', version : libffi_version_req, + fallback : ['libffi', 'ffi_dep']) + +with_pycairo = get_option('pycairo') + +cc = meson.get_compiler('c') + +if not with_pycairo.disabled() + cairo_dep = dependency('cairo', required: with_pycairo.enabled() and cc.get_id() != 'msvc') + cairo_gobject_dep = dependency('cairo-gobject', required: with_pycairo.enabled() and cc.get_id() != 'msvc') + + if cc.get_id() == 'msvc' and (not cairo_gobject_dep.found() or not cairo_dep.found()) + if cc.has_header('cairo.h') and cc.has_header ('cairo-gobject.h') + cairo_dep = cc.find_library ('cairo', required: with_pycairo) + cairo_gobject_dep = cc.find_library ('cairo-gobject', required: with_pycairo) + endif + endif + + # Find pycairo with target Python (TODO: extract version as well, see setup.py) + r = run_command( + python, + '-c', + ''' +import os, sys +from importlib.util import find_spec +spec = find_spec("cairo") +if spec is None: + sys.stderr.write("cairo module spec not found") + sys.exit(1) +sys.stdout.write(os.path.join(os.path.dirname(spec.origin), "include")) +''', + check: false, + ) + + if r.returncode() == 0 + message('Found pycairo with target Python: ' + r.stdout()) + pycairo_inc_dir = include_directories(r.stdout()) + pycairo_dep = declare_dependency( + include_directories: pycairo_inc_dir, + ) + else + message('pycairo not found via target Python, falling back to pkg-config (@0@)'.format(r.stderr())) + # Find pycairo with pkg-config + pycairo_dep = dependency( + 'py3cairo', + version: pycairo_version_req, + fallback: ['pycairo', 'pycairo_dep'], + default_options: ['python=' + get_option('python')], + required: with_pycairo, + ) + endif +else + cairo_dep = dependency('', required: false) + pycairo_dep = dependency('', required: false) +endif + +main_c_args = [] +if cc.get_id() == 'msvc' + main_c_args += [ '-FImsvc_recommended_pragmas.h' ] +else + main_c_args += [ + '-Wall', + '-Warray-bounds', + '-Wcast-align', + '-Wduplicated-branches', + '-Wextra', + '-Wformat=2', + '-Wformat-nonliteral', + '-Wformat-security', + '-Wimplicit-function-declaration', + '-Winit-self', + '-Wjump-misses-init', + '-Wlogical-op', + '-Wmissing-declarations', + '-Wmissing-format-attribute', + '-Wmissing-include-dirs', + '-Wmissing-noreturn', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wnull-dereference', + '-Wold-style-definition', + '-Wpacked', + '-Wpointer-arith', + '-Wrestrict', + '-Wreturn-type', + '-Wshadow', + '-Wsign-compare', + '-Wstrict-aliasing', + '-Wstrict-prototypes', + '-Wswitch-default', + '-Wundef', + '-Wunused-but-set-variable', + '-Wwrite-strings', + ] + + if python.language_version().split('.')[0] == '2' + main_c_args += [ + '-Wdeclaration-after-statement', + ] + endif + + main_c_args += [ + '-Wno-incompatible-pointer-types-discards-qualifiers', + '-Wno-missing-field-initializers', + '-Wno-unused-parameter', + '-Wno-discarded-qualifiers', + '-Wno-sign-conversion', + '-Wno-cast-function-type', + '-Wno-int-conversion', + ] + + main_c_args += [ + '-fno-strict-aliasing', + '-fvisibility=hidden', + ] + + main_c_args = cc.get_supported_arguments(main_c_args) +endif + +pyext_c_args = ['-DPY_SSIZE_T_CLEAN'] + +cdata = configuration_data() + +cdata.set('PYGOBJECT_MAJOR_VERSION', pygobject_version_major) +cdata.set('PYGOBJECT_MINOR_VERSION', pygobject_version_minor) +cdata.set('PYGOBJECT_MICRO_VERSION', pygobject_version_micro) + +if gio_dep.version().version_compare('< 2.67.4') + cdata.set('g_memdup2(ptr,sz)', '(G_LIKELY(((guint64)(sz)) < G_MAXUINT)) ? g_memdup(ptr,sz) : (g_abort(),NULL)') +endif + +configure_file(output : 'config.h', configuration : cdata) + +pkgconf = configuration_data() + +pkgconf.set('prefix', join_paths(get_option('prefix'))) +pkgconf.set('exec_prefix', '${prefix}') +pkgconf.set('includedir', join_paths('${prefix}', get_option('includedir'))) +pkgconf.set('datarootdir', join_paths('${prefix}', get_option('datadir'))) +pkgconf.set('datadir', '${datarootdir}') +pkgconf.set('VERSION', pygobject_version) + +pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir')) + +configure_file(input : 'pygobject-@0@.pc.in'.format(platform_version), + output : 'pygobject-@0@.pc'.format(platform_version), + configuration : pkgconf, + install_dir : pkg_install_dir) + +pygobject_dep = declare_dependency( + include_directories: include_directories('gi'), + dependencies: [gobject_dep, ffi_dep], + version: meson.project_version(), +) + +if pygobject_version_minor.is_odd() + py_version = '@0@.dev0'.format(pygobject_version) +else + py_version = pygobject_version +endif + +pkginfo_conf = configuration_data() +pkginfo_conf.set('VERSION', py_version) +configure_file(input : 'PKG-INFO.in', + output : 'PyGObject-@0@.egg-info'.format(py_version), + configuration : pkginfo_conf, + install_dir : python.get_install_dir(pure : false)) + +subdir('gi') +subdir('pygtkcompat') +with_tests = get_option('tests') +if with_tests +subdir('tests') +endif + +if meson.version().version_compare('>=0.58.0') + devenv = environment() + devenv.prepend('PYTHONPATH', [ + meson.current_source_dir(), + meson.current_build_dir(), + ]) + meson.add_devenv(devenv) +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..4fb5304 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,3 @@ +option('python', type : 'string', value : 'python3') +option('pycairo', type : 'feature', value : 'auto', description : 'build with pycairo integration') +option('tests', type : 'boolean', value : true, description : 'build unit tests') diff --git a/missing b/missing deleted file mode 100755 index cdea514..0000000 --- a/missing +++ /dev/null @@ -1,215 +0,0 @@ -#! /bin/sh -# Common wrapper for a few potentially missing GNU programs. - -scriptversion=2012-06-26.16; # UTC - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# Originally written by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try '$0 --help' for more information" - exit 1 -fi - -case $1 in - - --is-lightweight) - # Used by our autoconf macros to check whether the available missing - # script is modern enough. - exit 0 - ;; - - --run) - # Back-compat with the calling convention used by older automake. - shift - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due -to PROGRAM being missing or too old. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - -Supported PROGRAM values: - aclocal autoconf autoheader autom4te automake makeinfo - bison yacc flex lex help2man - -Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and -'g' are ignored when checking the name. - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: unknown '$1' option" - echo 1>&2 "Try '$0 --help' for more information" - exit 1 - ;; - -esac - -# Run the given program, remember its exit status. -"$@"; st=$? - -# If it succeeded, we are done. -test $st -eq 0 && exit 0 - -# Also exit now if we it failed (or wasn't found), and '--version' was -# passed; such an option is passed most likely to detect whether the -# program is present and works. -case $2 in --version|--help) exit $st;; esac - -# Exit code 63 means version mismatch. This often happens when the user -# tries to use an ancient version of a tool on a file that requires a -# minimum version. -if test $st -eq 63; then - msg="probably too old" -elif test $st -eq 127; then - # Program was missing. - msg="missing on your system" -else - # Program was found and executed, but failed. Give up. - exit $st -fi - -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software - -program_details () -{ - case $1 in - aclocal|automake) - echo "The '$1' program is part of the GNU Automake package:" - echo "<$gnu_software_URL/automake>" - echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/autoconf>" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - autoconf|autom4te|autoheader) - echo "The '$1' program is part of the GNU Autoconf package:" - echo "<$gnu_software_URL/autoconf/>" - echo "It also requires GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - esac -} - -give_advice () -{ - # Normalize program name to check for. - normalized_program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - - printf '%s\n' "'$1' is $msg." - - configure_deps="'configure.ac' or m4 files included by 'configure.ac'" - case $normalized_program in - autoconf*) - echo "You should only need it if you modified 'configure.ac'," - echo "or m4 files included by it." - program_details 'autoconf' - ;; - autoheader*) - echo "You should only need it if you modified 'acconfig.h' or" - echo "$configure_deps." - program_details 'autoheader' - ;; - automake*) - echo "You should only need it if you modified 'Makefile.am' or" - echo "$configure_deps." - program_details 'automake' - ;; - aclocal*) - echo "You should only need it if you modified 'acinclude.m4' or" - echo "$configure_deps." - program_details 'aclocal' - ;; - autom4te*) - echo "You might have modified some maintainer files that require" - echo "the 'automa4te' program to be rebuilt." - program_details 'autom4te' - ;; - bison*|yacc*) - echo "You should only need it if you modified a '.y' file." - echo "You may want to install the GNU Bison package:" - echo "<$gnu_software_URL/bison/>" - ;; - lex*|flex*) - echo "You should only need it if you modified a '.l' file." - echo "You may want to install the Fast Lexical Analyzer package:" - echo "<$flex_URL>" - ;; - help2man*) - echo "You should only need it if you modified a dependency" \ - "of a man page." - echo "You may want to install the GNU Help2man package:" - echo "<$gnu_software_URL/help2man/>" - ;; - makeinfo*) - echo "You should only need it if you modified a '.texi' file, or" - echo "any other file indirectly affecting the aspect of the manual." - echo "You might want to install the Texinfo package:" - echo "<$gnu_software_URL/texinfo/>" - echo "The spurious makeinfo call might also be the consequence of" - echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" - echo "want to install GNU make:" - echo "<$gnu_software_URL/make/>" - ;; - *) - echo "You might have modified some files without having the proper" - echo "tools for further handling them. Check the 'README' file, it" - echo "often tells you about the needed prerequisites for installing" - echo "this package. You may also peek at any GNU archive site, in" - echo "case some other package contains this missing '$1' program." - ;; - esac -} - -give_advice "$1" | sed -e '1s/^/WARNING: /' \ - -e '2,$s/^/ /' >&2 - -# Propagate the correct exit status (expected to be 127 for a program -# not found, 63 for a program that failed due to version mismatch). -exit $st - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/py-compile b/py-compile deleted file mode 100755 index 46ea866..0000000 --- a/py-compile +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/sh -# py-compile - Compile a Python program - -scriptversion=2011-06-08.12; # UTC - -# Copyright (C) 2000-2013 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -if [ -z "$PYTHON" ]; then - PYTHON=python -fi - -me=py-compile - -usage_error () -{ - echo "$me: $*" >&2 - echo "Try '$me --help' for more information." >&2 - exit 1 -} - -basedir= -destdir= -while test $# -ne 0; do - case "$1" in - --basedir) - if test $# -lt 2; then - usage_error "option '--basedir' requires an argument" - else - basedir=$2 - fi - shift - ;; - --destdir) - if test $# -lt 2; then - usage_error "option '--destdir' requires an argument" - else - destdir=$2 - fi - shift - ;; - -h|--help) - cat <<\EOF -Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." - -Byte compile some python scripts FILES. Use --destdir to specify any -leading directory path to the FILES that you don't want to include in the -byte compiled file. Specify --basedir for any additional path information you -do want to be shown in the byte compiled file. - -Example: - py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py - -Report bugs to . -EOF - exit $? - ;; - -v|--version) - echo "$me $scriptversion" - exit $? - ;; - --) - shift - break - ;; - -*) - usage_error "unrecognized option '$1'" - ;; - *) - break - ;; - esac - shift -done - -files=$* -if test -z "$files"; then - usage_error "no files given" -fi - -# if basedir was given, then it should be prepended to filenames before -# byte compilation. -if [ -z "$basedir" ]; then - pathtrans="path = file" -else - pathtrans="path = os.path.join('$basedir', file)" -fi - -# if destdir was given, then it needs to be prepended to the filename to -# byte compile but not go into the compiled file. -if [ -z "$destdir" ]; then - filetrans="filepath = path" -else - filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)" -fi - -$PYTHON -c " -import sys, os, py_compile, imp - -files = '''$files''' - -sys.stdout.write('Byte-compiling python modules...\n') -for file in files.split(): - $pathtrans - $filetrans - if not os.path.exists(filepath) or not (len(filepath) >= 3 - and filepath[-3:] == '.py'): - continue - sys.stdout.write(file) - sys.stdout.flush() - if hasattr(imp, 'get_tag'): - py_compile.compile(filepath, imp.cache_from_source(filepath), path) - else: - py_compile.compile(filepath, filepath + 'c', path) -sys.stdout.write('\n')" || exit $? - -# this will fail for python < 1.5, but that doesn't matter ... -$PYTHON -O -c " -import sys, os, py_compile, imp - -# pypy does not use .pyo optimization -if hasattr(sys, 'pypy_translation_info'): - sys.exit(0) - -files = '''$files''' -sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n') -for file in files.split(): - $pathtrans - $filetrans - if not os.path.exists(filepath) or not (len(filepath) >= 3 - and filepath[-3:] == '.py'): - continue - sys.stdout.write(file) - sys.stdout.flush() - if hasattr(imp, 'get_tag'): - py_compile.compile(filepath, imp.cache_from_source(filepath, False), path) - else: - py_compile.compile(filepath, filepath + 'o', path) -sys.stdout.write('\n')" 2>/dev/null || : - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/pygobject-3.0-uninstalled.pc.in b/pygobject-3.0-uninstalled.pc.in deleted file mode 100644 index 4cec178..0000000 --- a/pygobject-3.0-uninstalled.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -# you can use the --variable=pygobjectincludedir argument to -# pkg-config to get this value. You might want to use this to -# install additional headers. -pygobjectincludedir=${pcfiledir}/gi/_gobject -overridesdir=${pcfiledir}/gi/overrides - -Name: PyGObject -Description: Python bindings for GObject -Requires: gobject-2.0 -Requires.private: @LIBFFI_PC@ -Version: @VERSION@ -Cflags: -I${pcfiledir}/gi/_gobject diff --git a/pygobject-3.0.pc.in b/pygobject-3.0.pc.in index 3c7af01..ca49423 100644 --- a/pygobject-3.0.pc.in +++ b/pygobject-3.0.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ includedir=@includedir@ datarootdir=@datarootdir@ datadir=@datadir@ -libdir=@libdir@ # you can use the --variable=pygobjectincludedir argument to # pkg-config to get this value. You might want to use this to @@ -13,7 +12,7 @@ pygobjectincludedir=${includedir}/pygobject-3.0 Name: PyGObject Description: Python bindings for GObject Requires: gobject-2.0 -Requires.private: @LIBFFI_PC@ +Requires.private: libffi Version: @VERSION@ Cflags: -I${pygobjectincludedir} diff --git a/pygobject.doap b/pygobject.doap index 63214b7..5327d77 100644 --- a/pygobject.doap +++ b/pygobject.doap @@ -7,7 +7,7 @@ PyGObject Python bindings for GObject Introspection -GObject is a object system used by GTK+, GStreamer and other libraries. +GObject is a object system used by GTK, GStreamer and other libraries. PyGObject provides a convenient wrapper for use in Python programs when accessing GObject libraries. @@ -15,11 +15,13 @@ Like the GObject library itself PyGObject is licensed under the GNU LGPL, so is PyGObject now dynamically accesses any GObject libraries that uses GObject Introspection. It replaces the need for separate modules such as PyGTK, GIO and python-gnome to build a full GNOME 3.0 application. Once new functionality is added to gobject library it is instantly available as a Python API without the need for intermediate Python glue. - + - + - + + C + Python Tomeu Vizoso @@ -29,13 +31,6 @@ PyGObject now dynamically accesses any GObject libraries that uses GObject Intro - Martin Pitt - - martinpitt - - - - Paolo Borelli pborelli @@ -58,8 +53,15 @@ PyGObject now dynamically accesses any GObject libraries that uses GObject Intro Simon Feltman - + sfeltman + + + Christoph Reiter + + creiter + + diff --git a/pygtkcompat/Makefile.am b/pygtkcompat/Makefile.am deleted file mode 100644 index 914b3e2..0000000 --- a/pygtkcompat/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -pygtkcompatdir = $(pyexecdir)/pygtkcompat - -pygtkcompat_PYTHON = \ - __init__.py \ - generictreemodel.py \ - pygtkcompat.py - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygtkcompat_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: build_pylinks diff --git a/pygtkcompat/Makefile.in b/pygtkcompat/Makefile.in deleted file mode 100644 index ab80a82..0000000 --- a/pygtkcompat/Makefile.in +++ /dev/null @@ -1,574 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = pygtkcompat -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(pygtkcompat_PYTHON) $(top_srcdir)/py-compile -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) -am__installdirs = "$(DESTDIR)$(pygtkcompatdir)" -am__pep3147_tweak = \ - sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' -py_compile = $(top_srcdir)/py-compile -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -pygtkcompatdir = $(pyexecdir)/pygtkcompat -pygtkcompat_PYTHON = \ - __init__.py \ - generictreemodel.py \ - pygtkcompat.py - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign pygtkcompat/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign pygtkcompat/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-pygtkcompatPYTHON: $(pygtkcompat_PYTHON) - @$(NORMAL_INSTALL) - @list='$(pygtkcompat_PYTHON)'; dlist=; list2=; test -n "$(pygtkcompatdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pygtkcompatdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pygtkcompatdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ - if test -f $$b$$p; then \ - $(am__strip_dir) \ - dlist="$$dlist $$f"; \ - list2="$$list2 $$b$$p"; \ - else :; fi; \ - done; \ - for file in $$list2; do echo $$file; done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pygtkcompatdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pygtkcompatdir)" || exit $$?; \ - done || exit $$?; \ - if test -n "$$dlist"; then \ - $(am__py_compile) --destdir "$(DESTDIR)" \ - --basedir "$(pygtkcompatdir)" $$dlist; \ - else :; fi - -uninstall-pygtkcompatPYTHON: - @$(NORMAL_UNINSTALL) - @list='$(pygtkcompat_PYTHON)'; test -n "$(pygtkcompatdir)" || list=; \ - py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$py_files" || exit 0; \ - dir='$(DESTDIR)$(pygtkcompatdir)'; \ - pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ - pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ - py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ - echo "$$py_files_pep3147";\ - pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ - pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ - st=0; \ - for files in \ - "$$py_files" \ - "$$pyc_files" \ - "$$pyo_files" \ - "$$pyc_files_pep3147" \ - "$$pyo_files_pep3147" \ - ; do \ - $(am__uninstall_files_from_dir) || st=$$?; \ - done; \ - exit $$st -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile all-local -installdirs: - for dir in "$(DESTDIR)$(pygtkcompatdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-pygtkcompatPYTHON - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-pygtkcompatPYTHON - -.MAKE: install-am install-strip - -.PHONY: all all-am all-local check check-am clean clean-generic \ - clean-libtool cscopelist-am ctags-am distclean \ - distclean-generic distclean-libtool distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-pygtkcompatPYTHON \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am uninstall-pygtkcompatPYTHON - - -# if we build in a separate tree, we need to symlink the *.py files from the -# source tree; Python does not accept the extensions and modules in different -# paths -build_pylinks: - for f in $(pygtkcompat_PYTHON); do \ - [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \ - done - -all-local: build_pylinks - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/pygtkcompat/generictreemodel.py b/pygtkcompat/generictreemodel.py index b5e66b0..226dffc 100644 --- a/pygtkcompat/generictreemodel.py +++ b/pygtkcompat/generictreemodel.py @@ -15,9 +15,7 @@ # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA +# License along with this library; if not, see . # System @@ -25,6 +23,7 @@ import sys import random import collections import ctypes +import platform # GObject from gi.repository import GObject @@ -43,9 +42,13 @@ class _CTreeIter(ctypes.Structure): return ctypes.POINTER(cls).from_address(id(iter) + offset) -def _get_user_data_as_pyobject(iter): - citer = _CTreeIter.from_iter(iter) - return ctypes.cast(citer.contents.user_data, ctypes.py_object).value +if platform.python_implementation() == "PyPy": + def _get_user_data_as_pyobject(iter): + raise NotImplementedError("Not yet supported under PyPy") +else: + def _get_user_data_as_pyobject(iter): + citer = _CTreeIter.from_iter(iter) + return ctypes.cast(citer.contents.user_data, ctypes.py_object).value def handle_exception(default_return): diff --git a/pygtkcompat/meson.build b/pygtkcompat/meson.build new file mode 100644 index 0000000..9e43c44 --- /dev/null +++ b/pygtkcompat/meson.build @@ -0,0 +1,8 @@ +python_sources = [ + '__init__.py', + 'generictreemodel.py', + 'pygtkcompat.py'] + +python.install_sources(python_sources, + subdir : 'pygtkcompat' +) diff --git a/pygtkcompat/pygtkcompat.py b/pygtkcompat/pygtkcompat.py index 67571ac..966b67b 100644 --- a/pygtkcompat/pygtkcompat.py +++ b/pygtkcompat/pygtkcompat.py @@ -34,21 +34,30 @@ a well behaved PyGTK application mostly unmodified on top of PyGI. import sys import warnings - -try: - # Python 3 - from collections import UserList - from imp import reload - UserList # pyflakes -except ImportError: - # Python 2 ships that in a different module - from UserList import UserList - UserList # pyflakes +from collections import UserList import gi from gi.repository import GObject +_patches = [] +_module_patches = [] +_unset = object() +_enabled_registry = {} + + +def _patch(obj, name, new_value): + old_value = getattr(obj, name, _unset) + setattr(obj, name, new_value) + _patches.append((obj, name, old_value)) + + +def _patch_module(name, new_value): + old_value = sys.modules.get(name, _unset) + sys.modules[name] = new_value + _module_patches.append((name, old_value)) + + def _install_enums(module, dest=None, strip=''): if dest is None: dest = module @@ -65,7 +74,7 @@ def _install_enums(module, dest=None, strip=''): name = name.replace(modname + '_', '') if strip and name.startswith(strip): name = name[len(strip):] - setattr(dest, name, enum) + _patch(dest, name, enum) except TypeError: continue try: @@ -77,78 +86,117 @@ def _install_enums(module, dest=None, strip=''): # FIXME: this happens for some large flags which do not # fit into a long on 32 bit systems continue - setattr(dest, name, flag) + _patch(dest, name, flag) except TypeError: continue +def _check_enabled(name, version=None): + """Returns True in case it is already enabled""" + + if name in _enabled_registry: + enabled_version = _enabled_registry[name] + if enabled_version != version: + raise ValueError( + "%r already enabled with different version (%r)" % ( + name, enabled_version)) + return True + else: + _enabled_registry[name] = version + return False + + def enable(): + if _check_enabled(""): + return + # gobject from gi.repository import GLib - sys.modules['glib'] = GLib + _patch_module('glib', GLib) # gobject from gi.repository import GObject - sys.modules['gobject'] = GObject - from gi._gobject import propertyhelper - sys.modules['gobject.propertyhelper'] = propertyhelper + _patch_module('gobject', GObject) + from gi import _propertyhelper + _patch_module('gobject.propertyhelper', _propertyhelper) # gio from gi.repository import Gio - sys.modules['gio'] = Gio + _patch_module('gio', Gio) -_unset = object() + +def _disable_all(): + """Reverse all effects of the enable_xxx() calls except for + require_version() calls and imports. + """ + + _enabled_registry.clear() + + for obj, name, old_value in reversed(_patches): + if old_value is _unset: + delattr(obj, name) + else: + # try if deleting is enough (for override proxies) + delattr(obj, name) + if getattr(obj, name, _unset) is not old_value: + setattr(obj, name, old_value) + del _patches[:] + + for name, old_value in reversed(_module_patches): + if old_value is _unset: + del sys.modules[name] + else: + sys.modules[name] = old_value + del _module_patches[:] def enable_gtk(version='3.0'): - # set the default encoding like PyGTK - reload(sys) - if sys.version_info < (3, 0): - sys.setdefaultencoding('utf-8') + if _check_enabled("gtk", version): + return + + if version == "4.0": + raise ValueError("version 4.0 not supported") # atk gi.require_version('Atk', '1.0') from gi.repository import Atk - sys.modules['atk'] = Atk + _patch_module('atk', Atk) _install_enums(Atk) # pango gi.require_version('Pango', '1.0') from gi.repository import Pango - sys.modules['pango'] = Pango + _patch_module('pango', Pango) _install_enums(Pango) # pangocairo gi.require_version('PangoCairo', '1.0') from gi.repository import PangoCairo - sys.modules['pangocairo'] = PangoCairo + _patch_module('pangocairo', PangoCairo) # gdk gi.require_version('Gdk', version) gi.require_version('GdkPixbuf', '2.0') from gi.repository import Gdk from gi.repository import GdkPixbuf - sys.modules['gtk.gdk'] = Gdk + _patch_module('gtk.gdk', Gdk) _install_enums(Gdk) _install_enums(GdkPixbuf, dest=Gdk) - Gdk._2BUTTON_PRESS = 5 - Gdk.BUTTON_PRESS = 4 - - Gdk.screen_get_default = Gdk.Screen.get_default - Gdk.Pixbuf = GdkPixbuf.Pixbuf - Gdk.PixbufLoader = GdkPixbuf.PixbufLoader.new_with_type - Gdk.pixbuf_new_from_data = GdkPixbuf.Pixbuf.new_from_data - Gdk.pixbuf_new_from_file = GdkPixbuf.Pixbuf.new_from_file - try: - Gdk.pixbuf_new_from_file_at_scale = GdkPixbuf.Pixbuf.new_from_file_at_scale - except AttributeError: - pass - Gdk.pixbuf_new_from_file_at_size = GdkPixbuf.Pixbuf.new_from_file_at_size - Gdk.pixbuf_new_from_inline = GdkPixbuf.Pixbuf.new_from_inline - Gdk.pixbuf_new_from_stream = GdkPixbuf.Pixbuf.new_from_stream - Gdk.pixbuf_new_from_stream_at_scale = GdkPixbuf.Pixbuf.new_from_stream_at_scale - Gdk.pixbuf_new_from_xpm_data = GdkPixbuf.Pixbuf.new_from_xpm_data - Gdk.pixbuf_get_file_info = GdkPixbuf.Pixbuf.get_file_info + _patch(Gdk, "_2BUTTON_PRESS", 5) + _patch(Gdk, "BUTTON_PRESS", 4) + + _patch(Gdk, "screen_get_default", Gdk.Screen.get_default) + _patch(Gdk, "Pixbuf", GdkPixbuf.Pixbuf) + _patch(Gdk, "PixbufLoader", GdkPixbuf.PixbufLoader.new_with_type) + _patch(Gdk, "pixbuf_new_from_data", GdkPixbuf.Pixbuf.new_from_data) + _patch(Gdk, "pixbuf_new_from_file", GdkPixbuf.Pixbuf.new_from_file) + _patch(Gdk, "pixbuf_new_from_file_at_scale", GdkPixbuf.Pixbuf.new_from_file_at_scale) + _patch(Gdk, "pixbuf_new_from_file_at_size", GdkPixbuf.Pixbuf.new_from_file_at_size) + _patch(Gdk, "pixbuf_new_from_inline", GdkPixbuf.Pixbuf.new_from_inline) + _patch(Gdk, "pixbuf_new_from_stream", GdkPixbuf.Pixbuf.new_from_stream) + _patch(Gdk, "pixbuf_new_from_stream_at_scale", GdkPixbuf.Pixbuf.new_from_stream_at_scale) + _patch(Gdk, "pixbuf_new_from_xpm_data", GdkPixbuf.Pixbuf.new_from_xpm_data) + _patch(Gdk, "pixbuf_get_file_info", GdkPixbuf.Pixbuf.get_file_info) orig_get_formats = GdkPixbuf.Pixbuf.get_formats @@ -168,48 +216,34 @@ def enable_gtk(version='3.0'): result.append(make_dict(format_)) return result - Gdk.pixbuf_get_formats = get_formats - - orig_get_frame_extents = Gdk.Window.get_frame_extents - - def get_frame_extents(window): - try: - try: - rect = Gdk.Rectangle(0, 0, 0, 0) - except TypeError: - rect = Gdk.Rectangle() - orig_get_frame_extents(window, rect) - except TypeError: - rect = orig_get_frame_extents(window) - return rect - Gdk.Window.get_frame_extents = get_frame_extents + _patch(Gdk, "pixbuf_get_formats", get_formats) orig_get_origin = Gdk.Window.get_origin def get_origin(self): return orig_get_origin(self)[1:] - Gdk.Window.get_origin = get_origin + _patch(Gdk.Window, "get_origin", get_origin) - Gdk.screen_width = Gdk.Screen.width - Gdk.screen_height = Gdk.Screen.height + _patch(Gdk, "screen_width", Gdk.Screen.width) + _patch(Gdk, "screen_height", Gdk.Screen.height) orig_gdk_window_get_geometry = Gdk.Window.get_geometry def gdk_window_get_geometry(window): return orig_gdk_window_get_geometry(window) + (window.get_visual().get_best_depth(),) - Gdk.Window.get_geometry = gdk_window_get_geometry + _patch(Gdk.Window, "get_geometry", gdk_window_get_geometry) # gtk gi.require_version('Gtk', version) from gi.repository import Gtk - sys.modules['gtk'] = Gtk - Gtk.gdk = Gdk + _patch_module('gtk', Gtk) + _patch(Gtk, "gdk", Gdk) - Gtk.pygtk_version = (2, 99, 0) + _patch(Gtk, "pygtk_version", (2, 99, 0)) - Gtk.gtk_version = (Gtk.MAJOR_VERSION, - Gtk.MINOR_VERSION, - Gtk.MICRO_VERSION) + _patch(Gtk, "gtk_version", (Gtk.MAJOR_VERSION, + Gtk.MINOR_VERSION, + Gtk.MICRO_VERSION)) _install_enums(Gtk) # Action @@ -217,7 +251,7 @@ def enable_gtk(version='3.0'): def set_tool_item_type(menuaction, gtype): warnings.warn('set_tool_item_type() is not supported', gi.PyGIDeprecationWarning, stacklevel=2) - Gtk.Action.set_tool_item_type = classmethod(set_tool_item_type) + _patch(Gtk.Action, "set_tool_item_type", classmethod(set_tool_item_type)) # Alignment @@ -231,7 +265,7 @@ def enable_gtk(version='3.0'): self.props.xscale = xscale self.props.yscale = yscale - Gtk.Alignment = Alignment + _patch(Gtk, "Alignment", Alignment) # Box @@ -239,13 +273,13 @@ def enable_gtk(version='3.0'): def pack_end(self, child, expand=True, fill=True, padding=0): orig_pack_end(self, child, expand, fill, padding) - Gtk.Box.pack_end = pack_end + _patch(Gtk.Box, "pack_end", pack_end) orig_pack_start = Gtk.Box.pack_start def pack_start(self, child, expand=True, fill=True, padding=0): orig_pack_start(self, child, expand, fill, padding) - Gtk.Box.pack_start = pack_start + _patch(Gtk.Box, "pack_start", pack_start) # TreeViewColumn @@ -253,13 +287,13 @@ def enable_gtk(version='3.0'): def tree_view_column_pack_end(self, cell, expand=True): orig_tree_view_column_pack_end(self, cell, expand) - Gtk.TreeViewColumn.pack_end = tree_view_column_pack_end + _patch(Gtk.TreeViewColumn, "pack_end", tree_view_column_pack_end) orig_tree_view_column_pack_start = Gtk.TreeViewColumn.pack_start def tree_view_column_pack_start(self, cell, expand=True): orig_tree_view_column_pack_start(self, cell, expand) - Gtk.TreeViewColumn.pack_start = tree_view_column_pack_start + _patch(Gtk.TreeViewColumn, "pack_start", tree_view_column_pack_start) # CellLayout @@ -267,13 +301,13 @@ def enable_gtk(version='3.0'): def cell_pack_end(self, cell, expand=True): orig_cell_pack_end(self, cell, expand) - Gtk.CellLayout.pack_end = cell_pack_end + _patch(Gtk.CellLayout, "pack_end", cell_pack_end) orig_cell_pack_start = Gtk.CellLayout.pack_start def cell_pack_start(self, cell, expand=True): orig_cell_pack_start(self, cell, expand) - Gtk.CellLayout.pack_start = cell_pack_start + _patch(Gtk.CellLayout, "pack_start", cell_pack_start) orig_set_cell_data_func = Gtk.CellLayout.set_cell_data_func @@ -283,13 +317,13 @@ def enable_gtk(version='3.0'): args = args[:-1] return func(*args) orig_set_cell_data_func(self, cell, callback, user_data) - Gtk.CellLayout.set_cell_data_func = set_cell_data_func + _patch(Gtk.CellLayout, "set_cell_data_func", set_cell_data_func) # CellRenderer class GenericCellRenderer(Gtk.CellRenderer): pass - Gtk.GenericCellRenderer = GenericCellRenderer + _patch(Gtk, "GenericCellRenderer", GenericCellRenderer) # ComboBox @@ -301,7 +335,7 @@ def enable_gtk(version='3.0'): args = args[:-1] return func(*args) orig_combo_row_separator_func(self, callback, user_data) - Gtk.ComboBox.set_row_separator_func = combo_row_separator_func + _patch(Gtk.ComboBox, "set_row_separator_func", combo_row_separator_func) # ComboBoxEntry @@ -314,22 +348,22 @@ def enable_gtk(version='3.0'): def get_text_column(self): return self.get_entry_text_column() - Gtk.ComboBoxEntry = ComboBoxEntry + _patch(Gtk, "ComboBoxEntry", ComboBoxEntry) def combo_box_entry_new(): return Gtk.ComboBoxEntry() - Gtk.combo_box_entry_new = combo_box_entry_new + _patch(Gtk, "combo_box_entry_new", combo_box_entry_new) def combo_box_entry_new_with_model(model): return Gtk.ComboBoxEntry(model=model) - Gtk.combo_box_entry_new_with_model = combo_box_entry_new_with_model + _patch(Gtk, "combo_box_entry_new_with_model", combo_box_entry_new_with_model) # Container def install_child_property(container, flag, pspec): warnings.warn('install_child_property() is not supported', gi.PyGIDeprecationWarning, stacklevel=2) - Gtk.Container.install_child_property = classmethod(install_child_property) + _patch(Gtk.Container, "install_child_property", classmethod(install_child_property)) def new_text(): combo = Gtk.ComboBox() @@ -337,32 +371,29 @@ def enable_gtk(version='3.0'): combo.set_model(model) combo.set_entry_text_column(0) return combo - Gtk.combo_box_new_text = new_text + _patch(Gtk, "combo_box_new_text", new_text) def append_text(self, text): model = self.get_model() model.append([text]) - Gtk.ComboBox.append_text = append_text - Gtk.expander_new_with_mnemonic = Gtk.Expander.new_with_mnemonic - Gtk.icon_theme_get_default = Gtk.IconTheme.get_default - Gtk.image_new_from_pixbuf = Gtk.Image.new_from_pixbuf - Gtk.image_new_from_stock = Gtk.Image.new_from_stock - Gtk.image_new_from_animation = Gtk.Image.new_from_animation - Gtk.image_new_from_icon_set = Gtk.Image.new_from_icon_set - Gtk.image_new_from_file = Gtk.Image.new_from_file - Gtk.settings_get_default = Gtk.Settings.get_default - Gtk.window_set_default_icon = Gtk.Window.set_default_icon - try: - Gtk.clipboard_get = Gtk.Clipboard.get - except AttributeError: - pass - - #AccelGroup - Gtk.AccelGroup.connect_group = Gtk.AccelGroup.connect - - #StatusIcon - Gtk.status_icon_position_menu = Gtk.StatusIcon.position_menu - Gtk.StatusIcon.set_tooltip = Gtk.StatusIcon.set_tooltip_text + _patch(Gtk.ComboBox, "append_text", append_text) + _patch(Gtk, "expander_new_with_mnemonic", Gtk.Expander.new_with_mnemonic) + _patch(Gtk, "icon_theme_get_default", Gtk.IconTheme.get_default) + _patch(Gtk, "image_new_from_pixbuf", Gtk.Image.new_from_pixbuf) + _patch(Gtk, "image_new_from_stock", Gtk.Image.new_from_stock) + _patch(Gtk, "image_new_from_animation", Gtk.Image.new_from_animation) + _patch(Gtk, "image_new_from_icon_set", Gtk.Image.new_from_icon_set) + _patch(Gtk, "image_new_from_file", Gtk.Image.new_from_file) + _patch(Gtk, "settings_get_default", Gtk.Settings.get_default) + _patch(Gtk, "window_set_default_icon", Gtk.Window.set_default_icon) + _patch(Gtk, "clipboard_get", Gtk.Clipboard.get) + + # AccelGroup + _patch(Gtk.AccelGroup, "connect_group", Gtk.AccelGroup.connect) + + # StatusIcon + _patch(Gtk, "status_icon_position_menu", Gtk.StatusIcon.position_menu) + _patch(Gtk.StatusIcon, "set_tooltip", Gtk.StatusIcon.set_tooltip_text) # Scale @@ -372,20 +403,20 @@ def enable_gtk(version='3.0'): class HScale(orig_HScale): def __init__(self, adjustment=None): orig_HScale.__init__(self, adjustment=adjustment) - Gtk.HScale = HScale + _patch(Gtk, "HScale", HScale) class VScale(orig_VScale): def __init__(self, adjustment=None): orig_VScale.__init__(self, adjustment=adjustment) - Gtk.VScale = VScale + _patch(Gtk, "VScale", VScale) - Gtk.stock_add = lambda items: None + _patch(Gtk, "stock_add", lambda items: None) # Widget - Gtk.Widget.window = property(fget=Gtk.Widget.get_window) + _patch(Gtk.Widget, "window", property(fget=Gtk.Widget.get_window)) - Gtk.widget_get_default_direction = Gtk.Widget.get_default_direction + _patch(Gtk, "widget_get_default_direction", Gtk.Widget.get_default_direction) orig_size_request = Gtk.Widget.size_request def size_request(widget): @@ -395,8 +426,8 @@ def enable_gtk(version='3.0'): self.width = req.width UserList.__init__(self, [self.width, self.height]) return SizeRequest(orig_size_request(widget)) - Gtk.Widget.size_request = size_request - Gtk.Widget.hide_all = Gtk.Widget.hide + _patch(Gtk.Widget, "size_request", size_request) + _patch(Gtk.Widget, "hide_all", Gtk.Widget.hide) class BaseGetter(object): def __init__(self, context): @@ -417,7 +448,7 @@ def enable_gtk(version='3.0'): class StyleDescriptor(object): def __get__(self, instance, class_): return Styles(instance) - Gtk.Widget.style = StyleDescriptor() + _patch(Gtk.Widget, "style", StyleDescriptor()) # TextView @@ -427,7 +458,7 @@ def enable_gtk(version='3.0'): use_align=False, xalign=0.5, yalign=0.5): return orig_text_view_scroll_to_mark(self, mark, within_margin, use_align, xalign, yalign) - Gtk.TextView.scroll_to_mark = text_view_scroll_to_mark + _patch(Gtk.TextView, "scroll_to_mark", text_view_scroll_to_mark) # Window @@ -471,109 +502,125 @@ def enable_gtk(version='3.0'): return orig_set_geometry_hints(self, geometry_widget, geometry, geom_mask) - Gtk.Window.set_geometry_hints = set_geometry_hints - Gtk.window_list_toplevels = Gtk.Window.list_toplevels - Gtk.window_set_default_icon_name = Gtk.Window.set_default_icon_name + _patch(Gtk.Window, "set_geometry_hints", set_geometry_hints) + _patch(Gtk, "window_list_toplevels", Gtk.Window.list_toplevels) + _patch(Gtk, "window_set_default_icon_name", Gtk.Window.set_default_icon_name) # gtk.unixprint class UnixPrint(object): pass unixprint = UnixPrint() - sys.modules['gtkunixprint'] = unixprint + _patch_module('gtkunixprint', unixprint) # gtk.keysyms - class Keysyms(object): - pass - keysyms = Keysyms() - sys.modules['gtk.keysyms'] = keysyms - Gtk.keysyms = keysyms - for name in dir(Gdk): - if name.startswith('KEY_'): - target = name[4:] - if target[0] in '0123456789': - target = '_' + target - value = getattr(Gdk, name) - setattr(keysyms, target, value) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', category=RuntimeWarning) + from gi.overrides import keysyms + + _patch_module('gtk.keysyms', keysyms) + _patch(Gtk, "keysyms", keysyms) from . import generictreemodel - Gtk.GenericTreeModel = generictreemodel.GenericTreeModel + _patch(Gtk, "GenericTreeModel", generictreemodel.GenericTreeModel) def enable_vte(): + if _check_enabled("vte"): + return + gi.require_version('Vte', '0.0') from gi.repository import Vte - sys.modules['vte'] = Vte + _patch_module('vte', Vte) def enable_poppler(): + if _check_enabled("poppler"): + return + gi.require_version('Poppler', '0.18') from gi.repository import Poppler - sys.modules['poppler'] = Poppler - Poppler.pypoppler_version = (1, 0, 0) + _patch_module('poppler', Poppler) + + _patch(Poppler, "pypoppler_version", (1, 0, 0)) def enable_webkit(version='1.0'): + if _check_enabled("webkit", version): + return + gi.require_version('WebKit', version) from gi.repository import WebKit - sys.modules['webkit'] = WebKit - WebKit.WebView.get_web_inspector = WebKit.WebView.get_inspector + _patch_module('webkit', WebKit) + + _patch(WebKit.WebView, "get_web_inspector", WebKit.WebView.get_inspector) def enable_gudev(): + if _check_enabled("gudev"): + return + gi.require_version('GUdev', '1.0') from gi.repository import GUdev - sys.modules['gudev'] = GUdev + _patch_module('gudev', GUdev) def enable_gst(): + if _check_enabled("gst"): + return + gi.require_version('Gst', '0.10') from gi.repository import Gst - sys.modules['gst'] = Gst + _patch_module('gst', Gst) _install_enums(Gst) - Gst.registry_get_default = Gst.Registry.get_default - Gst.element_register = Gst.Element.register - Gst.element_factory_make = Gst.ElementFactory.make - Gst.caps_new_any = Gst.Caps.new_any - Gst.get_pygst_version = lambda: (0, 10, 19) - Gst.get_gst_version = lambda: (0, 10, 40) + + _patch(Gst, "registry_get_default", Gst.Registry.get_default) + _patch(Gst, "element_register", Gst.Element.register) + _patch(Gst, "element_factory_make", Gst.ElementFactory.make) + _patch(Gst, "caps_new_any", Gst.Caps.new_any) + _patch(Gst, "get_pygst_version", lambda: (0, 10, 19)) + _patch(Gst, "get_gst_version", lambda: (0, 10, 40)) from gi.repository import GstInterfaces - sys.modules['gst.interfaces'] = GstInterfaces + _patch_module('gst.interfaces', GstInterfaces) _install_enums(GstInterfaces) from gi.repository import GstAudio - sys.modules['gst.audio'] = GstAudio + _patch_module('gst.audio', GstAudio) _install_enums(GstAudio) from gi.repository import GstVideo - sys.modules['gst.video'] = GstVideo + _patch_module('gst.video', GstVideo) _install_enums(GstVideo) from gi.repository import GstBase - sys.modules['gst.base'] = GstBase + _patch_module('gst.base', GstBase) _install_enums(GstBase) - Gst.BaseTransform = GstBase.BaseTransform - Gst.BaseSink = GstBase.BaseSink + _patch(Gst, "BaseTransform", GstBase.BaseTransform) + _patch(Gst, "BaseSink", GstBase.BaseSink) from gi.repository import GstController - sys.modules['gst.controller'] = GstController + _patch_module('gst.controller', GstController) _install_enums(GstController, dest=Gst) from gi.repository import GstPbutils - sys.modules['gst.pbutils'] = GstPbutils + _patch_module('gst.pbutils', GstPbutils) _install_enums(GstPbutils) def enable_goocanvas(): + if _check_enabled("goocanvas"): + return + gi.require_version('GooCanvas', '2.0') from gi.repository import GooCanvas - sys.modules['goocanvas'] = GooCanvas + _patch_module('goocanvas', GooCanvas) _install_enums(GooCanvas, strip='GOO_CANVAS_') - GooCanvas.ItemSimple = GooCanvas.CanvasItemSimple - GooCanvas.Item = GooCanvas.CanvasItem - GooCanvas.Image = GooCanvas.CanvasImage - GooCanvas.Group = GooCanvas.CanvasGroup - GooCanvas.Rect = GooCanvas.CanvasRect + + _patch(GooCanvas, "ItemSimple", GooCanvas.CanvasItemSimple) + _patch(GooCanvas, "Item", GooCanvas.CanvasItem) + _patch(GooCanvas, "Image", GooCanvas.CanvasImage) + _patch(GooCanvas, "Group", GooCanvas.CanvasGroup) + _patch(GooCanvas, "Rect", GooCanvas.CanvasRect) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9e76335 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[tool.poetry] +name = "PyGObject" +version = "3.46.0" +description = "Python bindings for GObject Introspection" +authors = ["Christoph Reiter"] + +[tool.poetry.dependencies] +python = "^3.8" +pycairo = "^1.16" + +[tool.poetry.dev-dependencies] +pytest = "^7.0.0" +flake8 = "^3.9.1" +Sphinx = "^3.5.4|^4.2.0" +sphinx-rtd-theme = "^0.5.2|^1.0.0" +coverage = "^6.3.2" +setuptools = "^67.8.0" + +[build-system] +requires = ["setuptools", "wheel", "pycairo"] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..c165fa2 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,11 @@ +[flake8] +ignore=E501,E123,E124,E402,E731,E722,W504 +exclude=subprojects + +[coverage:run] +branch=True +relative_files=True +include= + gi/* + tests/* + pygtkcompat/* diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..2b8a7d7 --- /dev/null +++ b/setup.py @@ -0,0 +1,1248 @@ +#!/usr/bin/env python3 +# Copyright 2017 Christoph Reiter +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +import io +import os +import sys +import errno +import subprocess +import tarfile +import tempfile +import posixpath + +from email import parser + +from setuptools import setup +from distutils.core import Extension, Distribution, Command +from distutils.errors import DistutilsSetupError, DistutilsOptionError +from distutils.ccompiler import new_compiler +from distutils.sysconfig import get_python_lib, customize_compiler +from distutils import dir_util, log +from distutils.spawn import find_executable + + +PYGOBJECT_VERSION = "3.46.0" +GLIB_VERSION_REQUIRED = "2.64.0" +GI_VERSION_REQUIRED = "1.64.0" +PYCAIRO_VERSION_REQUIRED = "1.16.0" +LIBFFI_VERSION_REQUIRED = "3.0" + +WITH_CAIRO = not bool(os.environ.get("PYGOBJECT_WITHOUT_PYCAIRO")) +"""Set PYGOBJECT_WITHOUT_PYCAIRO if you don't want to build with +cairo/pycairo support. Note that this option might get removed in the future. +""" + + +def is_dev_version(): + version = tuple(map(int, PYGOBJECT_VERSION.split("."))) + return version[1] % 2 != 0 + + +def get_command_class(name): + # Returns the right class for either distutils or setuptools + return Distribution({}).get_command_class(name) + + +def get_version_requirement(pkg_config_name): + """Given a pkg-config module name gets the minimum version required""" + + versions = { + "gobject-introspection-1.0": GI_VERSION_REQUIRED, + "glib-2.0": GLIB_VERSION_REQUIRED, + "gio-2.0": GLIB_VERSION_REQUIRED, + "py3cairo": PYCAIRO_VERSION_REQUIRED, + "libffi": LIBFFI_VERSION_REQUIRED, + "cairo": "0", + "cairo-gobject": "0", + } + + return versions[pkg_config_name] + + +def get_versions(): + version = PYGOBJECT_VERSION.split(".") + assert len(version) == 3 + + versions = { + "PYGOBJECT_MAJOR_VERSION": version[0], + "PYGOBJECT_MINOR_VERSION": version[1], + "PYGOBJECT_MICRO_VERSION": version[2], + "VERSION": ".".join(version), + } + return versions + + +def parse_pkg_info(conf_dir): + """Returns an email.message.Message instance containing the content + of the PKG-INFO file. + """ + + versions = get_versions() + + pkg_info = os.path.join(conf_dir, "PKG-INFO.in") + with io.open(pkg_info, "r", encoding="utf-8") as h: + text = h.read() + for key, value in versions.items(): + text = text.replace("@%s@" % key, value) + + p = parser.Parser() + message = p.parse(io.StringIO(text)) + return message + + +def pkg_config_get_install_hint(): + """Returns an installation hint for installing pkg-config or None""" + + if not sys.platform.startswith("linux"): + return + + if find_executable("apt"): + return "sudo apt install pkg-config" + elif find_executable("dnf"): + return "sudo dnf install pkg-config" + + +def pkg_config_get_package_install_hint(pkg_name): + """Returns an installation hint for a pkg-config name or None""" + + if not sys.platform.startswith("linux"): + return + + if find_executable("apt"): + dev_packages = { + "gobject-introspection-1.0": "libgirepository1.0-dev", + "glib-2.0": "libglib2.0-dev", + "gio-2.0": "libglib2.0-dev", + "cairo": "libcairo2-dev", + "cairo-gobject": "libcairo2-dev", + "libffi": "libffi-dev", + } + if pkg_name in dev_packages: + return "sudo apt install %s" % dev_packages[pkg_name] + elif find_executable("dnf"): + dev_packages = { + "gobject-introspection-1.0": "gobject-introspection-devel", + "glib-2.0": "glib2-devel", + "gio-2.0": "glib2-devel", + "cairo": "cairo-devel", + "cairo-gobject": "cairo-gobject-devel", + "libffi": "libffi-devel", + } + if pkg_name in dev_packages: + return "sudo dnf install %s" % dev_packages[pkg_name] + + +class PkgConfigError(Exception): + pass + + +class PkgConfigMissingError(PkgConfigError): + pass + + +class PkgConfigMissingPackageError(PkgConfigError): + pass + + +def _run_pkg_config(pkg_name, args, _cache={}): + """Raises PkgConfigError""" + + command = tuple(["pkg-config"] + args) + + if command not in _cache: + try: + result = subprocess.check_output(command) + except OSError as e: + if e.errno == errno.ENOENT: + raise PkgConfigMissingError( + "%r not found.\nArguments: %r" % (command[0], command)) + raise PkgConfigError(e) + except subprocess.CalledProcessError as e: + try: + subprocess.check_output(["pkg-config", "--exists", pkg_name]) + except (subprocess.CalledProcessError, OSError): + raise PkgConfigMissingPackageError(e) + else: + raise PkgConfigError(e) + else: + _cache[command] = result + + return _cache[command] + + +def _run_pkg_config_or_exit(pkg_name, args): + try: + return _run_pkg_config(pkg_name, args) + except PkgConfigMissingError as e: + hint = pkg_config_get_install_hint() + if hint: + raise SystemExit( + "%s\n\nTry installing it with: %r" % (e, hint)) + else: + raise SystemExit(e) + except PkgConfigMissingPackageError as e: + hint = pkg_config_get_package_install_hint(pkg_name) + if hint: + raise SystemExit( + "%s\n\nTry installing it with: %r" % (e, hint)) + else: + raise SystemExit(e) + except PkgConfigError as e: + raise SystemExit(e) + + +def pkg_config_version_check(pkg_name, version): + _run_pkg_config_or_exit(pkg_name, [ + "--print-errors", + "--exists", + '%s >= %s' % (pkg_name, version), + ]) + + +def pkg_config_parse(opt, pkg_name): + ret = _run_pkg_config_or_exit(pkg_name, [opt, pkg_name]) + output = ret.decode() + opt = opt[-2:] + return [x.lstrip(opt) for x in output.split()] + + +def list_headers(d): + return [os.path.join(d, e) for e in os.listdir(d) if e.endswith(".h")] + + +def filter_compiler_arguments(compiler, args): + """Given a compiler instance and a list of compiler warning flags + returns the list of supported flags. + """ + + if compiler.compiler_type == "msvc": + # TODO, not much of need for now. + return [] + + extra = [] + + def check_arguments(compiler, args): + p = subprocess.Popen( + [compiler.compiler[0]] + args + extra + ["-x", "c", "-E", "-"], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + stdout, stderr = p.communicate(b"int i;\n") + if p.returncode != 0: + text = stderr.decode("ascii", "replace") + return False, [a for a in args if a in text] + else: + return True, [] + + def check_argument(compiler, arg): + return check_arguments(compiler, [arg])[0] + + # clang doesn't error out for unknown options, force it to + if check_argument(compiler, '-Werror=unknown-warning-option'): + extra += ['-Werror=unknown-warning-option'] + if check_argument(compiler, '-Werror=unused-command-line-argument'): + extra += ['-Werror=unused-command-line-argument'] + + # first try to remove all arguments contained in the error message + supported = list(args) + while 1: + ok, maybe_unknown = check_arguments(compiler, supported) + if ok: + return supported + elif not maybe_unknown: + break + for unknown in maybe_unknown: + if not check_argument(compiler, unknown): + supported.remove(unknown) + + # hm, didn't work, try each argument one by one + supported = [] + for arg in args: + if check_argument(compiler, arg): + supported.append(arg) + return supported + + +class sdist_gnome(Command): + description = "Create a source tarball for GNOME" + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + # Don't use PEP 440 pre-release versions for GNOME releases + self.distribution.metadata.version = PYGOBJECT_VERSION + + dist_dir = tempfile.mkdtemp() + try: + cmd = self.reinitialize_command("sdist") + cmd.dist_dir = dist_dir + cmd.ensure_finalized() + cmd.run() + + base_name = self.distribution.get_fullname().lower() + cmd.make_release_tree(base_name, cmd.filelist.files) + try: + self.make_archive(base_name, "xztar", base_dir=base_name) + finally: + dir_util.remove_tree(base_name) + finally: + dir_util.remove_tree(dist_dir) + + +du_sdist = get_command_class("sdist") + + +class distcheck(du_sdist): + """Creates a tarball and does some additional sanity checks such as + checking if the tarball includes all files, builds successfully and + the tests suite passes. + """ + + def _check_manifest(self): + # make sure MANIFEST.in includes all tracked files + assert self.get_archive_files() + + if subprocess.call(["git", "status"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) != 0: + return + + included_files = self.filelist.files + assert included_files + + process = subprocess.Popen( + ["git", "ls-tree", "-r", "HEAD", "--name-only"], + stdout=subprocess.PIPE, universal_newlines=True) + out, err = process.communicate() + assert process.returncode == 0 + + tracked_files = out.splitlines() + tracked_files = [ + f for f in tracked_files + if os.path.basename(f) not in [".gitignore"]] + + diff = set(tracked_files) - set(included_files) + assert not diff, ( + "Not all tracked files included in tarball, check MANIFEST.in", + diff) + + def _check_dist(self): + # make sure the tarball builds + assert self.get_archive_files() + + distcheck_dir = os.path.abspath( + os.path.join(self.dist_dir, "distcheck")) + if os.path.exists(distcheck_dir): + dir_util.remove_tree(distcheck_dir) + self.mkpath(distcheck_dir) + + archive = self.get_archive_files()[0] + tfile = tarfile.open(archive, "r:gz") + tfile.extractall(distcheck_dir) + tfile.close() + + name = self.distribution.get_fullname() + extract_dir = os.path.join(distcheck_dir, name) + + old_pwd = os.getcwd() + os.chdir(extract_dir) + try: + self.spawn([sys.executable, "setup.py", "build"]) + self.spawn([sys.executable, "setup.py", "install", + "--root", + os.path.join(distcheck_dir, "prefix"), + "--record", + os.path.join(distcheck_dir, "log.txt"), + ]) + self.spawn([sys.executable, "setup.py", "test"]) + finally: + os.chdir(old_pwd) + + def run(self): + du_sdist.run(self) + self._check_manifest() + self._check_dist() + + +class build_tests(Command): + description = "build test libraries and extensions" + user_options = [ + ("force", "f", "force a rebuild"), + ] + + def initialize_options(self): + self.build_temp = None + self.build_base = None + self.force = False + + def finalize_options(self): + self.set_undefined_options( + 'build_ext', + ('build_temp', 'build_temp')) + self.set_undefined_options( + 'build', + ('build_base', 'build_base')) + + def _newer_group(self, sources, *targets): + assert targets + + from distutils.dep_util import newer_group + + if self.force: + return True + else: + for target in targets: + if not newer_group(sources, target): + return False + return True + + def run(self): + cmd = self.reinitialize_command("build_ext") + cmd.inplace = True + cmd.force = self.force + cmd.ensure_finalized() + cmd.run() + + gidatadir = pkg_config_parse( + "--variable=gidatadir", "gobject-introspection-1.0")[0] + g_ir_scanner = pkg_config_parse( + "--variable=g_ir_scanner", "gobject-introspection-1.0")[0] + g_ir_compiler = pkg_config_parse( + "--variable=g_ir_compiler", "gobject-introspection-1.0")[0] + + script_dir = get_script_dir() + gi_dir = os.path.join(script_dir, "gi") + tests_dir = os.path.join(script_dir, "tests") + gi_tests_dir = os.path.join(gidatadir, "tests") + + schema_xml = os.path.join(tests_dir, "org.gnome.test.gschema.xml") + schema_bin = os.path.join(tests_dir, "gschemas.compiled") + if self._newer_group([schema_xml], schema_bin): + subprocess.check_call([ + "glib-compile-schemas", + "--targetdir=%s" % tests_dir, + "--schema-file=%s" % schema_xml, + ]) + + compiler = new_compiler() + customize_compiler(compiler) + + if os.name == "nt": + compiler.shared_lib_extension = ".dll" + elif sys.platform == "darwin": + compiler.shared_lib_extension = ".dylib" + if "-bundle" in compiler.linker_so: + compiler.linker_so = list(compiler.linker_so) + i = compiler.linker_so.index("-bundle") + compiler.linker_so[i] = "-dynamiclib" + else: + compiler.shared_lib_extension = ".so" + + if compiler.compiler_type == "msvc": + g_ir_scanner_cmd = [sys.executable, g_ir_scanner] + else: + g_ir_scanner_cmd = [g_ir_scanner] + + def build_ext(ext): + + libname = compiler.shared_object_filename(ext.name) + ext_paths = [os.path.join(tests_dir, libname)] + if os.name == "nt": + if compiler.compiler_type == "msvc": + # MSVC: Get rid of the 'lib' prefix and the .dll + # suffix from libname, and append .lib so + # that we get the right .lib filename to + # pass to g-ir-scanner with --library + implibname = libname[3:libname.rfind(".dll")] + '.lib' + else: + implibname = libname + ".a" + ext_paths.append(os.path.join(tests_dir, implibname)) + + if self._newer_group(ext.sources + ext.depends, *ext_paths): + # MSVC: We need to define _GI_EXTERN explcitly so that + # symbols get exported properly + if compiler.compiler_type == "msvc": + extra_defines = [('_GI_EXTERN', + '__declspec(dllexport)extern')] + else: + extra_defines = [] + objects = compiler.compile( + ext.sources, + output_dir=self.build_temp, + include_dirs=ext.include_dirs, + macros=ext.define_macros + extra_defines) + + if os.name == "nt": + if compiler.compiler_type == "msvc": + postargs = ["-implib:%s" % + os.path.join(tests_dir, implibname)] + else: + postargs = ["-Wl,--out-implib=%s" % + os.path.join(tests_dir, implibname)] + else: + postargs = [] + + compiler.link_shared_object( + objects, + compiler.shared_object_filename(ext.name), + output_dir=tests_dir, + libraries=ext.libraries, + library_dirs=ext.library_dirs, + extra_postargs=postargs) + + return ext_paths + + ext = Extension( + name='libgimarshallingtests', + sources=[ + os.path.join(gi_tests_dir, "gimarshallingtests.c"), + os.path.join(tests_dir, "gimarshallingtestsextra.c"), + ], + include_dirs=[ + gi_tests_dir, + tests_dir, + ], + depends=[ + os.path.join(gi_tests_dir, "gimarshallingtests.h"), + os.path.join(tests_dir, "gimarshallingtestsextra.h"), + ], + ) + add_ext_pkg_config_dep(ext, compiler.compiler_type, "glib-2.0") + add_ext_pkg_config_dep(ext, compiler.compiler_type, "gio-2.0") + ext_paths = build_ext(ext) + + # We want to always use POSIX-style paths for g-ir-compiler + # because it expects the input .gir file and .typelib file to use + # POSIX-style paths, otherwise it fails + gir_path = posixpath.join( + tests_dir, "GIMarshallingTests-1.0.gir") + typelib_path = posixpath.join( + tests_dir, "GIMarshallingTests-1.0.typelib") + + gimarshal_g_ir_scanner_cmd = g_ir_scanner_cmd + [ + "--no-libtool", + "--include=Gio-2.0", + "--namespace=GIMarshallingTests", + "--nsversion=1.0", + "--symbol-prefix=gi_marshalling_tests", + "--warn-all", + "--warn-error", + "--library-path=%s" % tests_dir, + "--library=gimarshallingtests", + "--pkg=glib-2.0", + "--pkg=gio-2.0", + "--cflags-begin", + "-I%s" % gi_tests_dir, + "--cflags-end", + "--output=%s" % gir_path, + ] + + if self._newer_group(ext_paths, gir_path): + subprocess.check_call(gimarshal_g_ir_scanner_cmd + + ext.sources + ext.depends) + + if self._newer_group([gir_path], typelib_path): + subprocess.check_call([ + g_ir_compiler, + gir_path, + "--output=%s" % typelib_path, + ]) + + regress_macros = [] + if not WITH_CAIRO: + regress_macros.append(("_GI_DISABLE_CAIRO", "1")) + + ext = Extension( + name='libregress', + sources=[ + os.path.join(gi_tests_dir, "regress.c"), + os.path.join(tests_dir, "regressextra.c"), + ], + include_dirs=[ + gi_tests_dir, + ], + depends=[ + os.path.join(gi_tests_dir, "regress.h"), + os.path.join(tests_dir, "regressextra.h"), + ], + define_macros=regress_macros, + ) + add_ext_pkg_config_dep(ext, compiler.compiler_type, "glib-2.0") + add_ext_pkg_config_dep(ext, compiler.compiler_type, "gio-2.0") + if WITH_CAIRO: + add_ext_pkg_config_dep(ext, compiler.compiler_type, "cairo") + add_ext_pkg_config_dep( + ext, compiler.compiler_type, "cairo-gobject") + ext_paths = build_ext(ext) + + # We want to always use POSIX-style paths for g-ir-compiler + # because it expects the input .gir file and .typelib file to use + # POSIX-style paths, otherwise it fails + gir_path = posixpath.join(tests_dir, "Regress-1.0.gir") + typelib_path = posixpath.join(tests_dir, "Regress-1.0.typelib") + regress_g_ir_scanner_cmd = g_ir_scanner_cmd + [ + "--no-libtool", + "--include=Gio-2.0", + "--namespace=Regress", + "--nsversion=1.0", + "--warn-all", + "--warn-error", + "--library-path=%s" % tests_dir, + "--library=regress", + "--pkg=glib-2.0", + "--pkg=gio-2.0"] + + if self._newer_group(ext_paths, gir_path): + if WITH_CAIRO: + regress_g_ir_scanner_cmd += ["--include=cairo-1.0"] + # MSVC: We don't normally have the pkg-config files for + # cairo and cairo-gobject, so use --extra-library + # instead of --pkg to pass those to the linker, so that + # g-ir-scanner won't fail due to linker errors + if compiler.compiler_type == "msvc": + regress_g_ir_scanner_cmd += [ + "--extra-library=cairo", + "--extra-library=cairo-gobject"] + + else: + regress_g_ir_scanner_cmd += [ + "--pkg=cairo", + "--pkg=cairo-gobject"] + else: + regress_g_ir_scanner_cmd += ["-D_GI_DISABLE_CAIRO"] + + regress_g_ir_scanner_cmd += ["--output=%s" % gir_path] + + subprocess.check_call(regress_g_ir_scanner_cmd + + ext.sources + ext.depends) + + if self._newer_group([gir_path], typelib_path): + subprocess.check_call([ + g_ir_compiler, + gir_path, + "--output=%s" % typelib_path, + ]) + + ext = Extension( + name='tests.testhelper', + sources=[ + os.path.join(tests_dir, "testhelpermodule.c"), + os.path.join(tests_dir, "test-floating.c"), + os.path.join(tests_dir, "test-thread.c"), + os.path.join(tests_dir, "test-unknown.c"), + ], + include_dirs=[ + gi_dir, + tests_dir, + ], + depends=list_headers(gi_dir) + list_headers(tests_dir), + define_macros=[("PY_SSIZE_T_CLEAN", None)], + ) + add_ext_pkg_config_dep(ext, compiler.compiler_type, "glib-2.0") + add_ext_pkg_config_dep(ext, compiler.compiler_type, "gio-2.0") + add_ext_compiler_flags(ext, compiler) + + dist = Distribution({"ext_modules": [ext]}) + + build_cmd = dist.get_command_obj("build") + build_cmd.build_base = os.path.join(self.build_base, "pygobject_tests") + build_cmd.ensure_finalized() + + cmd = dist.get_command_obj("build_ext") + cmd.inplace = True + cmd.force = self.force + cmd.ensure_finalized() + cmd.run() + + +def get_suppression_files_for_prefix(prefix): + """Returns a list of valgrind suppression files for a given prefix""" + + # Most specific first (/usr/share/doc is Fedora, /usr/lib is Debian) + # Take the first one found + major = str(sys.version_info[0]) + minor = str(sys.version_info[1]) + pyfiles = [] + pyfiles.append( + os.path.join( + prefix, "share", "doc", "python%s%s" % (major, minor), + "valgrind-python.supp")) + pyfiles.append( + os.path.join(prefix, "lib", "valgrind", "python%s.supp" % major)) + pyfiles.append( + os.path.join( + prefix, "share", "doc", "python%s-devel" % major, + "valgrind-python.supp")) + pyfiles.append(os.path.join(prefix, "lib", "valgrind", "python.supp")) + + files = [] + for f in pyfiles: + if os.path.isfile(f): + files.append(f) + break + + files.append(os.path.join( + prefix, "share", "glib-2.0", "valgrind", "glib.supp")) + return [f for f in files if os.path.isfile(f)] + + +def get_real_prefix(): + """Returns the base Python prefix, even in a virtualenv/venv""" + + return getattr(sys, "base_prefix", getattr(sys, "real_prefix", sys.prefix)) + + +def get_suppression_files(): + """Returns a list of valgrind suppression files""" + + prefixes = [ + sys.prefix, + get_real_prefix(), + pkg_config_parse("--variable=prefix", "glib-2.0")[0], + ] + + files = [] + for prefix in prefixes: + files.extend(get_suppression_files_for_prefix(prefix)) + + files.append(os.path.join(get_script_dir(), "tests", "valgrind.supp")) + return sorted(set(files)) + + +class test(Command): + user_options = [ + ("valgrind", None, "run tests under valgrind"), + ("valgrind-log-file=", None, "save logs instead of printing them"), + ("gdb", None, "run tests under gdb"), + ("no-capture", "s", "don't capture test output"), + ] + + def initialize_options(self): + self.valgrind = None + self.valgrind_log_file = None + self.gdb = None + self.no_capture = None + + def finalize_options(self): + self.valgrind = bool(self.valgrind) + if self.valgrind_log_file and not self.valgrind: + raise DistutilsOptionError("valgrind not enabled") + self.gdb = bool(self.gdb) + self.no_capture = bool(self.no_capture) + + def run(self): + cmd = self.reinitialize_command("build_tests") + cmd.ensure_finalized() + cmd.run() + + env = os.environ.copy() + env.pop("MSYSTEM", None) + + if self.no_capture: + env["PYGI_TEST_VERBOSE"] = "1" + + env["MALLOC_PERTURB_"] = "85" + env["MALLOC_CHECK_"] = "3" + env["G_SLICE"] = "debug-blocks" + + pre_args = [] + + if self.valgrind: + env["G_SLICE"] = "always-malloc" + env["G_DEBUG"] = "gc-friendly" + env["PYTHONMALLOC"] = "malloc" + + pre_args += [ + "valgrind", "--leak-check=full", "--show-possibly-lost=no", + "--num-callers=20", "--child-silent-after-fork=yes", + ] + ["--suppressions=" + f for f in get_suppression_files()] + + if self.valgrind_log_file: + pre_args += ["--log-file=" + self.valgrind_log_file] + + if self.gdb: + env["PYGI_TEST_GDB"] = "1" + pre_args += ["gdb", "--args"] + + if pre_args: + log.info(" ".join(pre_args)) + + tests_dir = os.path.join(get_script_dir(), "tests") + sys.exit(subprocess.call(pre_args + [ + sys.executable, + os.path.join(tests_dir, "runtests.py"), + ], env=env)) + + +class quality(Command): + description = "run code quality tests" + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + status = subprocess.call([ + sys.executable, "-m", "flake8", + ], cwd=get_script_dir()) + if status != 0: + raise SystemExit(status) + + +def get_script_dir(): + return os.path.dirname(os.path.realpath(__file__)) + + +def get_pycairo_include_dir(): + """Returns the best guess at where to find the pycairo headers. + A bit convoluted because we have to deal with multiple pycairo + versions. + + Raises if pycairo isn't found or it's too old. + """ + + pkg_config_name = "py3cairo" + min_version = get_version_requirement(pkg_config_name) + + def parse_version(string): + return tuple(int(p) for p in string.split(".")) + + def check_path(include_dir): + log.info("pycairo: trying include directory: %r" % include_dir) + header_path = os.path.join(include_dir, "%s.h" % pkg_config_name) + if os.path.exists(header_path): + log.info("pycairo: found %r" % header_path) + return True + log.info("pycairo: header file (%r) not found" % header_path) + return False + + def find_path(paths): + for p in reversed(paths): + if check_path(p): + return p + + def find_python(): + """This tries to find the pycairo module without importing it""" + + from importlib.util import find_spec + + # Find the module path + spec = find_spec("cairo") + if spec is None: + log.info("pycairo: cairo module not found via importlib") + return [] + package_path = os.path.dirname(spec.origin) + + # With Python 3.8 we can also check the package version + try: + from importlib.metadata import distribution, PackageNotFoundError + except ImportError: + # Python <3.8 + pass + else: + try: + d = distribution("pycairo") + except PackageNotFoundError: + log.info("pycairo: pycairo distribution not found via importlib") + else: + if parse_version(d.version) < parse_version(min_version): + raise DistutilsSetupError( + "pycairo >= %s required, %s found (%s)." % ( + min_version, d.version, package_path)) + + return [os.path.join(package_path, 'include')] + + def find_pkg_config(): + log.info("pycairo: pkg-config") + pkg_config_version_check(pkg_config_name, min_version) + return pkg_config_parse("--cflags-only-I", pkg_config_name) + + # First look in the current Python installation/venv + include_dir = find_path(find_python()) + if include_dir is not None: + return include_dir + + # Finally, fall back to pkg-config + include_dir = find_path(find_pkg_config()) + if include_dir is not None: + return include_dir + + raise DistutilsSetupError("Could not find pycairo headers") + + +def add_ext_pkg_config_dep(ext, compiler_type, name): + msvc_libraries = { + "glib-2.0": ["glib-2.0"], + "gio-2.0": ["gio-2.0", "gobject-2.0", "glib-2.0"], + "gobject-introspection-1.0": + ["girepository-1.0", "gobject-2.0", "glib-2.0"], + "cairo": ["cairo"], + "cairo-gobject": + ["cairo-gobject", "cairo", "gobject-2.0", "glib-2.0"], + "libffi": ["ffi"], + } + + def add(target, new): + for entry in new: + if entry not in target: + target.append(entry) + + fallback_libs = msvc_libraries[name] + if compiler_type == "msvc": + # assume that INCLUDE and LIB contains the right paths + add(ext.libraries, fallback_libs) + else: + min_version = get_version_requirement(name) + pkg_config_version_check(name, min_version) + add(ext.include_dirs, pkg_config_parse("--cflags-only-I", name)) + add(ext.library_dirs, pkg_config_parse("--libs-only-L", name)) + add(ext.libraries, pkg_config_parse("--libs-only-l", name)) + + +def add_ext_compiler_flags(ext, compiler, _cache={}): + if compiler.compiler_type == "msvc": + # MSVC: Just force-include msvc_recommended_pragmas.h so that + # we can look out for compiler warnings that we really + # want to look out for, and filter out those that don't + # really matter to us. + ext.extra_compile_args += ['-FImsvc_recommended_pragmas.h'] + else: + cache_key = compiler.compiler[0] + if cache_key not in _cache: + + args = [ + "-Wall", + "-Warray-bounds", + "-Wcast-align", + "-Wduplicated-branches", + "-Wextra", + "-Wformat=2", + "-Wformat-nonliteral", + "-Wformat-security", + "-Wimplicit-function-declaration", + "-Winit-self", + "-Wjump-misses-init", + "-Wlogical-op", + "-Wmissing-declarations", + "-Wmissing-format-attribute", + "-Wmissing-include-dirs", + "-Wmissing-noreturn", + "-Wmissing-prototypes", + "-Wnested-externs", + "-Wnull-dereference", + "-Wold-style-definition", + "-Wpacked", + "-Wpointer-arith", + "-Wrestrict", + "-Wreturn-type", + "-Wshadow", + "-Wsign-compare", + "-Wstrict-aliasing", + "-Wstrict-prototypes", + "-Wswitch-default", + "-Wundef", + "-Wunused-but-set-variable", + "-Wwrite-strings", + ] + + args += [ + "-Wno-incompatible-pointer-types-discards-qualifiers", + "-Wno-missing-field-initializers", + "-Wno-unused-parameter", + "-Wno-discarded-qualifiers", + "-Wno-sign-conversion", + "-Wno-cast-function-type", + "-Wno-int-conversion", + ] + + # silence clang for unused gcc CFLAGS added by Debian + args += [ + "-Wno-unused-command-line-argument", + ] + + args += [ + "-fno-strict-aliasing", + "-fvisibility=hidden", + ] + + # force GCC to use colors + if hasattr(sys.stdout, "isatty") and sys.stdout.isatty(): + args.append("-fdiagnostics-color") + + _cache[cache_key] = filter_compiler_arguments(compiler, args) + + ext.extra_compile_args += _cache[cache_key] + + +du_build_ext = get_command_class("build_ext") + + +class build_ext(du_build_ext): + + def initialize_options(self): + du_build_ext.initialize_options(self) + self.compiler_type = None + + def finalize_options(self): + du_build_ext.finalize_options(self) + self.compiler_type = new_compiler(compiler=self.compiler).compiler_type + + def _write_config_h(self): + script_dir = get_script_dir() + target = os.path.join(script_dir, "config.h") + versions = get_versions() + content = u""" +/* Configuration header created by setup.py - do not edit */ +#ifndef _CONFIG_H +#define _CONFIG_H 1 +#include + +#if !GLIB_CHECK_VERSION(2, 67, 4) +#define g_memdup2(ptr,sz) (G_LIKELY(((guint64)(sz)) < G_MAXUINT)) ? g_memdup(ptr,sz) : (g_abort(),NULL) +#endif + +#define PYGOBJECT_MAJOR_VERSION %(PYGOBJECT_MAJOR_VERSION)s +#define PYGOBJECT_MINOR_VERSION %(PYGOBJECT_MINOR_VERSION)s +#define PYGOBJECT_MICRO_VERSION %(PYGOBJECT_MICRO_VERSION)s +#define VERSION "%(VERSION)s" + +#endif /* _CONFIG_H */ +""" % versions + + try: + with io.open(target, 'r', encoding="utf-8") as h: + if h.read() == content: + return + except EnvironmentError: + pass + + with io.open(target, 'w', encoding="utf-8") as h: + h.write(content) + + def _setup_extensions(self): + ext = {e.name: e for e in self.extensions} + + compiler = new_compiler(compiler=self.compiler) + customize_compiler(compiler) + + def add_dependency(ext, name): + add_ext_pkg_config_dep(ext, compiler.compiler_type, name) + + def add_pycairo(ext): + ext.include_dirs += [get_pycairo_include_dir()] + + gi_ext = ext["gi._gi"] + add_dependency(gi_ext, "glib-2.0") + add_dependency(gi_ext, "gio-2.0") + add_dependency(gi_ext, "gobject-introspection-1.0") + add_dependency(gi_ext, "libffi") + add_ext_compiler_flags(gi_ext, compiler) + + if WITH_CAIRO: + gi_cairo_ext = ext["gi._gi_cairo"] + add_dependency(gi_cairo_ext, "glib-2.0") + add_dependency(gi_cairo_ext, "gio-2.0") + add_dependency(gi_cairo_ext, "gobject-introspection-1.0") + add_dependency(gi_cairo_ext, "libffi") + add_dependency(gi_cairo_ext, "cairo") + add_dependency(gi_cairo_ext, "cairo-gobject") + add_pycairo(gi_cairo_ext) + add_ext_compiler_flags(gi_cairo_ext, compiler) + + def run(self): + self._write_config_h() + self._setup_extensions() + du_build_ext.run(self) + + +class install_pkgconfig(Command): + description = "install .pc file" + user_options = [] + + def initialize_options(self): + self.install_base = None + self.install_platbase = None + self.install_data = None + self.compiler_type = None + self.outfiles = [] + + def finalize_options(self): + self.set_undefined_options( + 'install', + ('install_base', 'install_base'), + ('install_data', 'install_data'), + ('install_platbase', 'install_platbase'), + ) + + self.set_undefined_options( + 'build_ext', + ('compiler_type', 'compiler_type'), + ) + + def get_outputs(self): + return self.outfiles + + def get_inputs(self): + return [] + + def run(self): + cmd = self.distribution.get_command_obj("bdist_wheel", create=False) + if cmd is not None: + log.warn( + "Python wheels and pkg-config is not compatible. " + "No pkg-config file will be included in the wheel. Install " + "from source if you need one.") + return + + if self.compiler_type == "msvc": + return + + script_dir = get_script_dir() + pkgconfig_in = os.path.join(script_dir, "pygobject-3.0.pc.in") + with io.open(pkgconfig_in, "r", encoding="utf-8") as h: + content = h.read() + + config = { + "prefix": self.install_base, + "exec_prefix": self.install_platbase, + "includedir": "${prefix}/include", + "datarootdir": "${prefix}/share", + "datadir": "${datarootdir}", + "VERSION": PYGOBJECT_VERSION, + } + for key, value in config.items(): + content = content.replace("@%s@" % key, value) + + libdir = os.path.dirname(get_python_lib(True, True, self.install_data)) + pkgconfig_dir = os.path.join(libdir, "pkgconfig") + self.mkpath(pkgconfig_dir) + target = os.path.join(pkgconfig_dir, "pygobject-3.0.pc") + with io.open(target, "w", encoding="utf-8") as h: + h.write(content) + self.outfiles.append(target) + + +du_install = get_command_class("install") + + +class install(du_install): + + sub_commands = du_install.sub_commands + [ + ("install_pkgconfig", lambda self: True), + ] + + +def main(): + if sys.version_info[0] < 3: + raise Exception("Python 2 no longer supported") + + script_dir = get_script_dir() + pkginfo = parse_pkg_info(script_dir) + gi_dir = os.path.join(script_dir, "gi") + + sources = [ + os.path.join("gi", n) for n in os.listdir(gi_dir) + if os.path.splitext(n)[-1] == ".c" + ] + cairo_sources = [os.path.join("gi", "pygi-foreign-cairo.c")] + for s in cairo_sources: + sources.remove(s) + + readme = os.path.join(script_dir, "README.rst") + with io.open(readme, encoding="utf-8") as h: + long_description = h.read() + + ext_modules = [] + install_requires = [] + + gi_ext = Extension( + name='gi._gi', + sources=sorted(sources), + include_dirs=[script_dir, gi_dir], + depends=list_headers(script_dir) + list_headers(gi_dir), + define_macros=[("PY_SSIZE_T_CLEAN", None)], + ) + ext_modules.append(gi_ext) + + if WITH_CAIRO: + gi_cairo_ext = Extension( + name='gi._gi_cairo', + sources=cairo_sources, + include_dirs=[script_dir, gi_dir], + depends=list_headers(script_dir) + list_headers(gi_dir), + define_macros=[("PY_SSIZE_T_CLEAN", None)], + ) + ext_modules.append(gi_cairo_ext) + install_requires.append( + "pycairo>=%s" % get_version_requirement("py3cairo")) + + version = pkginfo["Version"] + if is_dev_version(): + # This makes it a PEP 440 pre-release and pip will only install it from + # PyPI in case --pre is passed. + version += ".dev0" + + setup( + name=pkginfo["Name"], + version=version, + description=pkginfo["Summary"], + url=pkginfo["Home-page"], + author=pkginfo["Author"], + author_email=pkginfo["Author-email"], + maintainer=pkginfo["Maintainer"], + maintainer_email=pkginfo["Maintainer-email"], + license=pkginfo["License"], + long_description=long_description, + platforms=pkginfo.get_all("Platform"), + classifiers=pkginfo.get_all("Classifier"), + packages=[ + "pygtkcompat", + "gi", + "gi.repository", + "gi.overrides", + ], + ext_modules=ext_modules, + cmdclass={ + "build_ext": build_ext, + "distcheck": distcheck, + "sdist_gnome": sdist_gnome, + "build_tests": build_tests, + "test": test, + "quality": quality, + "install": install, + "install_pkgconfig": install_pkgconfig, + }, + install_requires=install_requires, + python_requires=pkginfo["Requires-Python"], + data_files=[ + ('include/pygobject-3.0', ['gi/pygobject.h']), + ], + zip_safe=False, + ) + + +if __name__ == "__main__": + main() diff --git a/subprojects/.gitignore b/subprojects/.gitignore new file mode 100644 index 0000000..e3ab765 --- /dev/null +++ b/subprojects/.gitignore @@ -0,0 +1,4 @@ +glib +libffi +gobject-introspection +pycairo diff --git a/subprojects/glib.wrap b/subprojects/glib.wrap new file mode 100644 index 0000000..9e8b843 --- /dev/null +++ b/subprojects/glib.wrap @@ -0,0 +1,6 @@ +[wrap-git] +directory=glib +url=https://gitlab.gnome.org/GNOME/glib.git +push-url=git@gitlab.gnome.org:GNOME/glib.git +revision=main +depth=1 diff --git a/subprojects/gobject-introspection.wrap b/subprojects/gobject-introspection.wrap new file mode 100644 index 0000000..c63dc22 --- /dev/null +++ b/subprojects/gobject-introspection.wrap @@ -0,0 +1,6 @@ +[wrap-git] +directory=gobject-introspection +url=https://gitlab.gnome.org/GNOME/gobject-introspection.git +push-url=git@gitlab.gnome.org:GNOME/gobject-introspection.git +revision=main +depth=1 diff --git a/subprojects/libffi.wrap b/subprojects/libffi.wrap new file mode 100644 index 0000000..a8a23bb --- /dev/null +++ b/subprojects/libffi.wrap @@ -0,0 +1,8 @@ +[wrap-git] +directory=libffi +url=https://gitlab.freedesktop.org/gstreamer/meson-ports/libffi.git +revision=meson +depth=1 + +[provide] +libffi = ffi_dep diff --git a/subprojects/pycairo.wrap b/subprojects/pycairo.wrap new file mode 100644 index 0000000..676c4fb --- /dev/null +++ b/subprojects/pycairo.wrap @@ -0,0 +1,5 @@ +[wrap-git] +directory=pycairo +url=https://github.com/pygobject/pycairo.git +revision=main +depth=1 diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index b845e4b..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,155 +0,0 @@ -CLEANFILES = -check_LTLIBRARIES = libgimarshallingtests.la -test_typelibs = GIMarshallingTests-1.0.typelib - -nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h -libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS) -libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) - -# This is a hack to make sure a shared library is built -libgimarshallingtests.la: $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_DEPENDENCIES) - $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libgimarshallingtests_la_LDFLAGS) $(libgimarshallingtests_la_OBJECTS) $(libgimarhallingtests_la_LIBADD) $(LIBS) - -GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile - $(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \ - --namespace=GIMarshallingTests --nsversion=1.0 --symbol-prefix=gi_marshalling_tests \ - --warn-all --warn-error \ - --library=libgimarshallingtests.la \ - --libtool="$(top_builddir)/libtool" \ - --output $@ \ - $(nodist_libgimarshallingtests_la_SOURCES) -GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile - $(AM_V_GEN) g-ir-compiler $< -o $@ - -# regress.c needs cairo -if ENABLE_CAIRO -check_LTLIBRARIES += libregress.la -test_typelibs += Regress-1.0.typelib -nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h -libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS) -libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS) - -libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES) - $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libregress_la_LDFLAGS) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS) - -# g-i doesn't ship these as shared libraries anymore; we build them here -Regress-1.0.gir: libregress.la Makefile - $(AM_V_GEN) g-ir-scanner --include=cairo-1.0 --include=Gio-2.0 \ - --namespace=Regress --nsversion=1.0 \ - --warn-all --warn-error \ - --library=libregress.la \ - --libtool="$(top_builddir)/libtool" \ - --output $@ \ - $(nodist_libregress_la_SOURCES) -Regress-1.0.typelib: Regress-1.0.gir Makefile - $(AM_V_GEN) g-ir-compiler $< -o $@ - -endif # ENABLE_CAIRO - - -gschemas.compiled: org.gnome.test.gschema.xml - glib-compile-schemas --targetdir=. --schema-file=$< - -CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib gschemas.compiled - -check_LTLIBRARIES += testhelper.la - -testhelper_la_CFLAGS = -I$(top_srcdir)/gi/_gobject -I$(top_srcdir)/gi/_glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS) -testhelper_la_LDFLAGS = -module -avoid-version -testhelper_la_LIBADD = $(GLIB_LIBS) -testhelper_la_SOURCES = \ - testhelpermodule.c \ - test-floating.c \ - test-thread.c \ - test-unknown.c - -# This is a hack to make sure a shared library is built -testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES) - $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS) - - -.la.so: - test -L $@ || $(LN_S) .libs/$@ $@ - - -all: $(check_LTLIBRARIES:.la=.so) - -EXTRA_DIST = \ - compathelper.py \ - runtests.py \ - runtests-windows.py \ - testmodule.py \ - test-floating.h \ - test-thread.h \ - test-unknown.h \ - te_ST@nouppera \ - org.gnome.test.gschema.xml \ - test_gio.py \ - test_glib.py \ - test_gobject.py \ - test_gtype.py \ - test_interface.py \ - test_internal_api.py \ - test_iochannel.py \ - test_mainloop.py \ - test_object_marshaling.py \ - test_option.py \ - test_properties.py \ - test_signal.py \ - test_source.py \ - test_subprocess.py \ - test_thread.py \ - test_everything.py \ - test_gi.py \ - test_gdbus.py \ - test_overrides.py \ - test_overrides_glib.py \ - test_overrides_pango.py \ - test_overrides_gdk.py \ - test_overrides_gtk.py \ - test_atoms.py \ - test_generictreemodel.py \ - test_docstring.py \ - compat_test_pygtk.py \ - gi/__init__.py \ - gi/overrides/__init__.py \ - gi/overrides/Regress.py \ - $(NULL) - -clean-local: - rm -f $(check_LTLIBRARIES:.la=.so) file.txt~ - -DBUS_LAUNCH=$(shell which dbus-launch) -RUN_TESTS_ENV_VARS= \ - PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \ - LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \ - GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \ - XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share \ - MALLOC_PERTURB_=85 \ - MALLOC_CHECK_=3 \ - G_SLICE=debug-blocks \ - TESTS_BUILDDIR=$(builddir) - -# pygtkcompat tests need to be run in a separate process as they -# clobber global name space -check-local: $(check_LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled - @echo " CHECK Pyflakes" - @if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi - @if test -z "$$SKIP_PEP8"; then \ - echo " CHECK PEP8"; \ - if type pep8 >/dev/null 2>&1; then pep8 --ignore=E501,E123,E124 --repeat --show-source $(top_srcdir); else echo "skipped, pep8 not installed"; fi; \ - fi - export `$(DBUS_LAUNCH)` && \ - $(RUN_TESTS_ENV_VARS) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \ - [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \ - kill $$DBUS_SESSION_BUS_PID; \ - exit $$rc - -check.gdb: - EXEC_NAME="gdb --args" $(MAKE) check - -check.nemiver: - EXEC_NAME="nemiver" $(MAKE) check - -check.valgrind: - EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --suppressions=python.supp" G_DEBUG=gc-friendly $(MAKE) check diff --git a/tests/Makefile.in b/tests/Makefile.in deleted file mode 100644 index d9b217c..0000000 --- a/tests/Makefile.in +++ /dev/null @@ -1,839 +0,0 @@ -# Makefile.in generated by automake 1.13.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ - -# regress.c needs cairo -@ENABLE_CAIRO_TRUE@am__append_1 = libregress.la -@ENABLE_CAIRO_TRUE@am__append_2 = Regress-1.0.typelib -subdir = tests -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \ - $(top_srcdir)/m4/jhflags.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/python.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -libgimarshallingtests_la_LIBADD = -nodist_libgimarshallingtests_la_OBJECTS = \ - libgimarshallingtests_la-gimarshallingtests.lo -libgimarshallingtests_la_OBJECTS = \ - $(nodist_libgimarshallingtests_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libgimarshallingtests_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(libgimarshallingtests_la_CFLAGS) $(CFLAGS) \ - $(libgimarshallingtests_la_LDFLAGS) $(LDFLAGS) -o $@ -libregress_la_LIBADD = -@ENABLE_CAIRO_TRUE@nodist_libregress_la_OBJECTS = \ -@ENABLE_CAIRO_TRUE@ libregress_la-regress.lo -libregress_la_OBJECTS = $(nodist_libregress_la_OBJECTS) -libregress_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libregress_la_CFLAGS) \ - $(CFLAGS) $(libregress_la_LDFLAGS) $(LDFLAGS) -o $@ -@ENABLE_CAIRO_TRUE@am_libregress_la_rpath = -am__DEPENDENCIES_1 = -testhelper_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_testhelper_la_OBJECTS = testhelper_la-testhelpermodule.lo \ - testhelper_la-test-floating.lo testhelper_la-test-thread.lo \ - testhelper_la-test-unknown.lo -testhelper_la_OBJECTS = $(am_testhelper_la_OBJECTS) -testhelper_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testhelper_la_CFLAGS) \ - $(CFLAGS) $(testhelper_la_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(nodist_libgimarshallingtests_la_SOURCES) \ - $(nodist_libregress_la_SOURCES) $(testhelper_la_SOURCES) -DIST_SOURCES = $(testhelper_la_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CAIRO_CFLAGS = @CAIRO_CFLAGS@ -CAIRO_LIBS = @CAIRO_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIR = @DATADIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFI_CFLAGS = @FFI_CFLAGS@ -FFI_LIBS = @FFI_LIBS@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GIO_CFLAGS = @GIO_CFLAGS@ -GIO_LIBS = @GIO_LIBS@ -GI_CFLAGS = @GI_CFLAGS@ -GI_DATADIR = @GI_DATADIR@ -GI_LIBS = @GI_LIBS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBFFI_PC = @LIBFFI_PC@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PLATFORM = @PLATFORM@ -PYCAIRO_CFLAGS = @PYCAIRO_CFLAGS@ -PYCAIRO_LIBS = @PYCAIRO_LIBS@ -PYGOBJECT_MAJOR_VERSION = @PYGOBJECT_MAJOR_VERSION@ -PYGOBJECT_MICRO_VERSION = @PYGOBJECT_MICRO_VERSION@ -PYGOBJECT_MINOR_VERSION = @PYGOBJECT_MINOR_VERSION@ -PYTHON = @PYTHON@ -PYTHON_BASENAME = @PYTHON_BASENAME@ -PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_LIB_LOC = @PYTHON_LIB_LOC@ -PYTHON_PLATFORM = @PYTHON_PLATFORM@ -PYTHON_PREFIX = @PYTHON_PREFIX@ -PYTHON_SO = @PYTHON_SO@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -THREADING_CFLAGS = @THREADING_CFLAGS@ -VERSION = @VERSION@ -WARN_CFLAGS = @WARN_CFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgpyexecdir = @pkgpyexecdir@ -pkgpythondir = @pkgpythondir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pyexecdir = @pyexecdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -CLEANFILES = Regress-1.0.gir Regress-1.0.typelib \ - GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib \ - gschemas.compiled -check_LTLIBRARIES = libgimarshallingtests.la $(am__append_1) \ - testhelper.la -test_typelibs = GIMarshallingTests-1.0.typelib $(am__append_2) -nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h -libgimarshallingtests_la_CFLAGS = $(GLIB_CFLAGS) -libgimarshallingtests_la_LDFLAGS = -module -avoid-version $(GLIB_LIBS) -@ENABLE_CAIRO_TRUE@nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h -@ENABLE_CAIRO_TRUE@libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS) -@ENABLE_CAIRO_TRUE@libregress_la_LDFLAGS = -module -avoid-version $(GIO_LIBS) $(CAIRO_LIBS) -testhelper_la_CFLAGS = -I$(top_srcdir)/gi/_gobject -I$(top_srcdir)/gi/_glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS) -testhelper_la_LDFLAGS = -module -avoid-version -testhelper_la_LIBADD = $(GLIB_LIBS) -testhelper_la_SOURCES = \ - testhelpermodule.c \ - test-floating.c \ - test-thread.c \ - test-unknown.c - -EXTRA_DIST = \ - compathelper.py \ - runtests.py \ - runtests-windows.py \ - testmodule.py \ - test-floating.h \ - test-thread.h \ - test-unknown.h \ - te_ST@nouppera \ - org.gnome.test.gschema.xml \ - test_gio.py \ - test_glib.py \ - test_gobject.py \ - test_gtype.py \ - test_interface.py \ - test_internal_api.py \ - test_iochannel.py \ - test_mainloop.py \ - test_object_marshaling.py \ - test_option.py \ - test_properties.py \ - test_signal.py \ - test_source.py \ - test_subprocess.py \ - test_thread.py \ - test_everything.py \ - test_gi.py \ - test_gdbus.py \ - test_overrides.py \ - test_overrides_glib.py \ - test_overrides_pango.py \ - test_overrides_gdk.py \ - test_overrides_gtk.py \ - test_atoms.py \ - test_generictreemodel.py \ - test_docstring.py \ - compat_test_pygtk.py \ - gi/__init__.py \ - gi/overrides/__init__.py \ - gi/overrides/Regress.py \ - $(NULL) - -DBUS_LAUNCH = $(shell which dbus-launch) -RUN_TESTS_ENV_VARS = \ - PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \ - LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \ - GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \ - XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share \ - MALLOC_PERTURB_=85 \ - MALLOC_CHECK_=3 \ - G_SLICE=debug-blocks \ - TESTS_BUILDDIR=$(builddir) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .la .lo .o .obj .so -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign tests/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-checkLTLIBRARIES: - -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES) - @list='$(check_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -@ENABLE_CAIRO_FALSE@libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES) $(EXTRA_libregress_la_DEPENDENCIES) -@ENABLE_CAIRO_FALSE@ $(AM_V_CCLD)$(libregress_la_LINK) $(am_libregress_la_rpath) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgimarshallingtests_la-gimarshallingtests.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libregress_la-regress.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhelper_la-test-floating.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhelper_la-test-thread.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhelper_la-test-unknown.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhelper_la-testhelpermodule.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -libgimarshallingtests_la-gimarshallingtests.lo: $(GI_DATADIR)/tests/gimarshallingtests.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgimarshallingtests_la_CFLAGS) $(CFLAGS) -MT libgimarshallingtests_la-gimarshallingtests.lo -MD -MP -MF $(DEPDIR)/libgimarshallingtests_la-gimarshallingtests.Tpo -c -o libgimarshallingtests_la-gimarshallingtests.lo `test -f '$(GI_DATADIR)/tests/gimarshallingtests.c' || echo '$(srcdir)/'`$(GI_DATADIR)/tests/gimarshallingtests.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgimarshallingtests_la-gimarshallingtests.Tpo $(DEPDIR)/libgimarshallingtests_la-gimarshallingtests.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(GI_DATADIR)/tests/gimarshallingtests.c' object='libgimarshallingtests_la-gimarshallingtests.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgimarshallingtests_la_CFLAGS) $(CFLAGS) -c -o libgimarshallingtests_la-gimarshallingtests.lo `test -f '$(GI_DATADIR)/tests/gimarshallingtests.c' || echo '$(srcdir)/'`$(GI_DATADIR)/tests/gimarshallingtests.c - -libregress_la-regress.lo: $(GI_DATADIR)/tests/regress.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libregress_la_CFLAGS) $(CFLAGS) -MT libregress_la-regress.lo -MD -MP -MF $(DEPDIR)/libregress_la-regress.Tpo -c -o libregress_la-regress.lo `test -f '$(GI_DATADIR)/tests/regress.c' || echo '$(srcdir)/'`$(GI_DATADIR)/tests/regress.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libregress_la-regress.Tpo $(DEPDIR)/libregress_la-regress.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(GI_DATADIR)/tests/regress.c' object='libregress_la-regress.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libregress_la_CFLAGS) $(CFLAGS) -c -o libregress_la-regress.lo `test -f '$(GI_DATADIR)/tests/regress.c' || echo '$(srcdir)/'`$(GI_DATADIR)/tests/regress.c - -testhelper_la-testhelpermodule.lo: testhelpermodule.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-testhelpermodule.lo -MD -MP -MF $(DEPDIR)/testhelper_la-testhelpermodule.Tpo -c -o testhelper_la-testhelpermodule.lo `test -f 'testhelpermodule.c' || echo '$(srcdir)/'`testhelpermodule.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testhelper_la-testhelpermodule.Tpo $(DEPDIR)/testhelper_la-testhelpermodule.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testhelpermodule.c' object='testhelper_la-testhelpermodule.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-testhelpermodule.lo `test -f 'testhelpermodule.c' || echo '$(srcdir)/'`testhelpermodule.c - -testhelper_la-test-floating.lo: test-floating.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-floating.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-floating.Tpo -c -o testhelper_la-test-floating.lo `test -f 'test-floating.c' || echo '$(srcdir)/'`test-floating.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testhelper_la-test-floating.Tpo $(DEPDIR)/testhelper_la-test-floating.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-floating.c' object='testhelper_la-test-floating.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-floating.lo `test -f 'test-floating.c' || echo '$(srcdir)/'`test-floating.c - -testhelper_la-test-thread.lo: test-thread.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-thread.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-thread.Tpo -c -o testhelper_la-test-thread.lo `test -f 'test-thread.c' || echo '$(srcdir)/'`test-thread.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testhelper_la-test-thread.Tpo $(DEPDIR)/testhelper_la-test-thread.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-thread.c' object='testhelper_la-test-thread.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-thread.lo `test -f 'test-thread.c' || echo '$(srcdir)/'`test-thread.c - -testhelper_la-test-unknown.lo: test-unknown.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -MT testhelper_la-test-unknown.lo -MD -MP -MF $(DEPDIR)/testhelper_la-test-unknown.Tpo -c -o testhelper_la-test-unknown.lo `test -f 'test-unknown.c' || echo '$(srcdir)/'`test-unknown.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/testhelper_la-test-unknown.Tpo $(DEPDIR)/testhelper_la-test-unknown.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-unknown.c' object='testhelper_la-test-unknown.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testhelper_la_CFLAGS) $(CFLAGS) -c -o testhelper_la-test-unknown.lo `test -f 'test-unknown.c' || echo '$(srcdir)/'`test-unknown.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) - $(MAKE) $(AM_MAKEFLAGS) check-local -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-checkLTLIBRARIES clean-generic clean-libtool \ - clean-local mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ - clean-checkLTLIBRARIES clean-generic clean-libtool clean-local \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - - -# This is a hack to make sure a shared library is built -libgimarshallingtests.la: $(libgimarshallingtests_la_OBJECTS) $(libgimarshallingtests_la_DEPENDENCIES) - $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libgimarshallingtests_la_LDFLAGS) $(libgimarshallingtests_la_OBJECTS) $(libgimarhallingtests_la_LIBADD) $(LIBS) - -GIMarshallingTests-1.0.gir: libgimarshallingtests.la Makefile - $(AM_V_GEN) g-ir-scanner --include=Gio-2.0 \ - --namespace=GIMarshallingTests --nsversion=1.0 --symbol-prefix=gi_marshalling_tests \ - --warn-all --warn-error \ - --library=libgimarshallingtests.la \ - --libtool="$(top_builddir)/libtool" \ - --output $@ \ - $(nodist_libgimarshallingtests_la_SOURCES) -GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile - $(AM_V_GEN) g-ir-compiler $< -o $@ - -@ENABLE_CAIRO_TRUE@libregress.la: $(libregress_la_OBJECTS) $(libregress_la_DEPENDENCIES) -@ENABLE_CAIRO_TRUE@ $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(libregress_la_LDFLAGS) $(libregress_la_OBJECTS) $(libregress_la_LIBADD) $(LIBS) - -# g-i doesn't ship these as shared libraries anymore; we build them here -@ENABLE_CAIRO_TRUE@Regress-1.0.gir: libregress.la Makefile -@ENABLE_CAIRO_TRUE@ $(AM_V_GEN) g-ir-scanner --include=cairo-1.0 --include=Gio-2.0 \ -@ENABLE_CAIRO_TRUE@ --namespace=Regress --nsversion=1.0 \ -@ENABLE_CAIRO_TRUE@ --warn-all --warn-error \ -@ENABLE_CAIRO_TRUE@ --library=libregress.la \ -@ENABLE_CAIRO_TRUE@ --libtool="$(top_builddir)/libtool" \ -@ENABLE_CAIRO_TRUE@ --output $@ \ -@ENABLE_CAIRO_TRUE@ $(nodist_libregress_la_SOURCES) -@ENABLE_CAIRO_TRUE@Regress-1.0.typelib: Regress-1.0.gir Makefile -@ENABLE_CAIRO_TRUE@ $(AM_V_GEN) g-ir-compiler $< -o $@ - -gschemas.compiled: org.gnome.test.gschema.xml - glib-compile-schemas --targetdir=. --schema-file=$< - -# This is a hack to make sure a shared library is built -testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES) - $(AM_V_GEN) $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS) - -.la.so: - test -L $@ || $(LN_S) .libs/$@ $@ - -all: $(check_LTLIBRARIES:.la=.so) - -clean-local: - rm -f $(check_LTLIBRARIES:.la=.so) file.txt~ - -# pygtkcompat tests need to be run in a separate process as they -# clobber global name space -check-local: $(check_LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled - @echo " CHECK Pyflakes" - @if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi - @if test -z "$$SKIP_PEP8"; then \ - echo " CHECK PEP8"; \ - if type pep8 >/dev/null 2>&1; then pep8 --ignore=E501,E123,E124 --repeat --show-source $(top_srcdir); else echo "skipped, pep8 not installed"; fi; \ - fi - export `$(DBUS_LAUNCH)` && \ - $(RUN_TESTS_ENV_VARS) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \ - [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \ - kill $$DBUS_SESSION_BUS_PID; \ - exit $$rc - -check.gdb: - EXEC_NAME="gdb --args" $(MAKE) check - -check.nemiver: - EXEC_NAME="nemiver" $(MAKE) check - -check.valgrind: - EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --suppressions=python.supp" G_DEBUG=gc-friendly $(MAKE) check - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..a7b7ff2 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,137 @@ +import os +import sys +import signal +import subprocess +import atexit +import warnings + + +def set_dll_search_path(): + # Python 3.8 no longer searches for DLLs in PATH, so we have to add + # everything in PATH manually. Note that unlike PATH add_dll_directory + # has no defined order, so if there are two cairo DLLs in PATH we + # might get a random one. + if os.name != "nt" or not hasattr(os, "add_dll_directory"): + return + for p in os.environ.get("PATH", "").split(os.pathsep): + try: + os.add_dll_directory(p) + except OSError: + pass + + +def init_test_environ(): + + set_dll_search_path() + + def dbus_launch_session(): + if os.name == "nt" or sys.platform == "darwin": + return (-1, "") + + try: + out = subprocess.check_output([ + "dbus-daemon", "--session", "--fork", "--print-address=1", + "--print-pid=1"]) + except (subprocess.CalledProcessError, OSError): + return (-1, "") + else: + out = out.decode("utf-8") + addr, pid = out.splitlines() + return int(pid), addr + + pid, addr = dbus_launch_session() + if pid >= 0: + os.environ["DBUS_SESSION_BUS_ADDRESS"] = addr + atexit.register(os.kill, pid, signal.SIGKILL) + else: + os.environ["DBUS_SESSION_BUS_ADDRESS"] = "." + + tests_builddir = os.path.abspath(os.environ.get('TESTS_BUILDDIR', os.path.dirname(__file__))) + builddir = os.path.dirname(tests_builddir) + tests_srcdir = os.path.abspath(os.path.dirname(__file__)) + srcdir = os.path.dirname(tests_srcdir) + + sys.path.insert(0, os.path.join(builddir, 'gi')) + sys.path.insert(0, tests_srcdir) + sys.path.insert(0, srcdir) + sys.path.insert(0, tests_builddir) + sys.path.insert(0, builddir) + + # force untranslated messages, as we check for them in some tests + os.environ['LC_MESSAGES'] = 'C' + os.environ['G_DEBUG'] = 'fatal-warnings fatal-criticals' + if sys.platform == "darwin" or os.name == "nt": + # gtk 3.22 has warnings and ciriticals on OS X, ignore for now. + # On Windows glib will create an error dialog which will block tests + # so it's never a good idea there to make things fatal. + os.environ['G_DEBUG'] = '' + + # make Gio able to find our gschemas.compiled in tests/. This needs to be set + # before importing Gio. Support a separate build tree, so look in build dir + # first. + os.environ['GSETTINGS_BACKEND'] = 'memory' + os.environ['GSETTINGS_SCHEMA_DIR'] = tests_builddir + os.environ['G_FILENAME_ENCODING'] = 'UTF-8' + + # Avoid accessibility dbus warnings + os.environ['NO_AT_BRIDGE'] = '1' + + # A workaround for https://gitlab.gnome.org/GNOME/glib/-/issues/2251 + # The gtk4 a11y stack calls get_dbus_object_path() on the default app + os.environ['GTK_A11Y'] = 'none' + + # Force the default theme so broken themes don't affect the tests + os.environ['GTK_THEME'] = 'Adwaita' + + import gi + gi.require_version("GIRepository", "2.0") + from gi.repository import GIRepository + repo = GIRepository.Repository.get_default() + repo.prepend_library_path(os.path.join(tests_builddir)) + repo.prepend_search_path(tests_builddir) + + def try_require_version(namespace, version): + try: + gi.require_version(namespace, version) + except ValueError: + # prevent tests from running with the wrong version + sys.modules["gi.repository." + namespace] = None + + # Optional + try_require_version("Gtk", os.environ.get("TEST_GTK_VERSION", "3.0")) + try_require_version("Gdk", os.environ.get("TEST_GTK_VERSION", "3.0")) + try_require_version("GdkPixbuf", "2.0") + try_require_version("Pango", "1.0") + try_require_version("PangoCairo", "1.0") + try_require_version("Atk", "1.0") + + # Required + gi.require_versions({ + "GIMarshallingTests": "1.0", + "Regress": "1.0", + "GLib": "2.0", + "Gio": "2.0", + "GObject": "2.0", + }) + + # It's disabled for stable releases by default, this makes sure it's + # always on for the tests. + warnings.simplefilter('default', gi.PyGIDeprecationWarning) + + # Otherwise we crash on the first gtk use when e.g. DISPLAY isn't set + try: + from gi.repository import Gtk + except ImportError: + pass + else: + if Gtk._version == "4.0": + res = Gtk.init_check() + else: + res = Gtk.init_check([])[0] + if not res: + raise RuntimeError("Gtk available, but Gtk.init_check() failed") + + +init_test_environ() + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/tests/compat_test_pygtk.py b/tests/compat_test_pygtk.py deleted file mode 100644 index 10be6a3..0000000 --- a/tests/compat_test_pygtk.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -# vim: tabstop=4 shiftwidth=4 expandtab - -import unittest - -from gi.repository import GLib - -try: - from gi.repository import Pango - from gi.repository import Atk - from gi.repository import Gdk - from gi.repository import Gtk - (Atk, Gtk, Pango) # pyflakes - - import pygtkcompat - - pygtkcompat.enable() - pygtkcompat.enable_gtk(version='3.0') - - import atk - import pango - import pangocairo - import gtk - import gtk.gdk -except ImportError: - Gtk = None - - -@unittest.skipUnless(Gtk, 'Gtk not available') -class TestATKCompat(unittest.TestCase): - def test_object(self): - self.assertTrue(hasattr(atk, 'Object')) - - -@unittest.skipUnless(Gtk, 'Gtk not available') -class TestPangoCompat(unittest.TestCase): - def test_layout(self): - self.assertTrue(hasattr(pango, 'Layout')) - - -@unittest.skipUnless(Gtk, 'Gtk not available') -class TestPangoCairoCompat(unittest.TestCase): - def test_error_underline_path(self): - self.assertTrue(hasattr(pangocairo, 'error_underline_path')) - - -@unittest.skipUnless(Gtk, 'Gtk not available') -class TestGTKCompat(unittest.TestCase): - def test_buttons(self): - self.assertEqual(Gdk._2BUTTON_PRESS, 5) - self.assertEqual(Gdk.BUTTON_PRESS, 4) - - def test_enums(self): - self.assertEqual(gtk.WINDOW_TOPLEVEL, Gtk.WindowType.TOPLEVEL) - self.assertEqual(gtk.PACK_START, Gtk.PackType.START) - - def test_flags(self): - self.assertEqual(gtk.EXPAND, Gtk.AttachOptions.EXPAND) - self.assertEqual(gtk.gdk.SHIFT_MASK, Gdk.ModifierType.SHIFT_MASK) - - def test_keysyms(self): - import gtk.keysyms - self.assertEqual(gtk.keysyms.Escape, Gdk.KEY_Escape) - self.assertTrue(gtk.keysyms._0, Gdk.KEY_0) - - def test_style(self): - widget = gtk.Button() - self.assertTrue(isinstance(widget.style.base[gtk.STATE_NORMAL], - gtk.gdk.Color)) - - def test_alignment(self): - a = gtk.Alignment() - self.assertEqual(a.props.xalign, 0.0) - self.assertEqual(a.props.yalign, 0.0) - self.assertEqual(a.props.xscale, 0.0) - self.assertEqual(a.props.yscale, 0.0) - - def test_box(self): - box = gtk.Box() - child = gtk.Button() - - box.pack_start(child) - expand, fill, padding, pack_type = box.query_child_packing(child) - self.assertTrue(expand) - self.assertTrue(fill) - self.assertEqual(padding, 0) - self.assertEqual(pack_type, gtk.PACK_START) - - child = gtk.Button() - box.pack_end(child) - expand, fill, padding, pack_type = box.query_child_packing(child) - self.assertTrue(expand) - self.assertTrue(fill) - self.assertEqual(padding, 0) - self.assertEqual(pack_type, gtk.PACK_END) - - def test_combobox_entry(self): - liststore = gtk.ListStore(int, str) - liststore.append((1, 'One')) - liststore.append((2, 'Two')) - liststore.append((3, 'Three')) - # might cause a Pango warning, do not break on this - old_mask = GLib.log_set_always_fatal( - GLib.LogLevelFlags.LEVEL_CRITICAL | GLib.LogLevelFlags.LEVEL_ERROR) - try: - combo = gtk.ComboBoxEntry(model=liststore) - finally: - GLib.log_set_always_fatal(old_mask) - combo.set_text_column(1) - combo.set_active(0) - self.assertEqual(combo.get_text_column(), 1) - self.assertEqual(combo.get_child().get_text(), 'One') - combo = gtk.combo_box_entry_new() - combo.set_model(liststore) - combo.set_text_column(1) - combo.set_active(0) - self.assertEqual(combo.get_text_column(), 1) - self.assertEqual(combo.get_child().get_text(), 'One') - combo = gtk.combo_box_entry_new_with_model(liststore) - combo.set_text_column(1) - combo.set_active(0) - self.assertEqual(combo.get_text_column(), 1) - self.assertEqual(combo.get_child().get_text(), 'One') - - def test_size_request(self): - box = gtk.Box() - self.assertEqual(box.size_request(), [0, 0]) - - def test_pixbuf(self): - gtk.gdk.Pixbuf() - - def test_pixbuf_loader(self): - loader = gtk.gdk.PixbufLoader('png') - loader.close() - - def test_pixbuf_formats(self): - formats = gtk.gdk.pixbuf_get_formats() - self.assertEqual(type(formats[0]), dict) - self.assertTrue('name' in formats[0]) - self.assertTrue('description' in formats[0]) - self.assertTrue('mime_types' in formats[0]) - self.assertEqual(type(formats[0]['extensions']), list) - - def test_gdk_window(self): - w = gtk.Window() - w.realize() - self.assertEqual(w.get_window().get_origin(), (0, 0)) diff --git a/tests/compathelper.py b/tests/compathelper.py deleted file mode 100644 index 668e60a..0000000 --- a/tests/compathelper.py +++ /dev/null @@ -1,69 +0,0 @@ -import sys - -if sys.version_info >= (3, 0): - ''' - for tests that need to test long values in python 2 - - python 3 does not differentiate between long and int - and does not supply a long keyword - - instead of testing longs by using values such as 10L - test writters should do this: - - from compathelper import _long - _long(10) - ''' - _long = int - - ''' - for tests that need to test string values in python 2 - - python 3 does differentiate between str and bytes - and does not supply a basestring keyword - - any tests that use basestring should do this: - - from compathelper import _basestring - isinstance(_basestring, "hello") - ''' - _basestring = str - - ''' - for tests that need to write to intefaces that take bytes in - python 3 - - python 3 has a seperate bytes type for low level functions like os.write - - python 2 treats these as strings - - any tests that need to write a string of bytes should do something like - this: - - from compathelper import _bytes - os.write(_bytes("hello")) - ''' - - _bytes = lambda s: s.encode() - - ''' - for tests that need to write to intefaces that take unicode in - python 2 - - python 3 strings are unicode encoded as UTF-8 so the unicode object - doesn't exist - - python 2 differs between a string an unicode string and you must specify - an encoding. This macro will specify UTF-8 in python 2 - - any tests that need to use unicode should do this - - from compathelper import _unicode - unicode_string = _unicode('this is a unicode string') - ''' - - _unicode = lambda s: str(s) -else: - _long = long - _basestring = basestring - _bytes = str - _unicode = lambda s: unicode(s, 'UTF-8') diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..254a721 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,26 @@ +import sys + +import pytest + + +@pytest.hookimpl(hookwrapper=True, tryfirst=True) +def pytest_runtest_call(item): + """A pytest hook which takes over sys.excepthook and raises any uncaught + exception (with PyGObject this happesn often when we get called from C, + like any signal handler, vfuncs tc) + """ + + exceptions = [] + + def on_hook(type_, value, tback): + exceptions.append((type_, value, tback)) + + orig_excepthook = sys.excepthook + sys.excepthook = on_hook + try: + yield + finally: + sys.excepthook = orig_excepthook + if exceptions: + tp, value, tb = exceptions[0] + raise tp(value).with_traceback(tb) diff --git a/tests/gi/__init__.py b/tests/gi/__init__.py deleted file mode 100644 index 3ad9513..0000000 --- a/tests/gi/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from pkgutil import extend_path -__path__ = extend_path(__path__, __name__) diff --git a/tests/gimarshallingtestsextra.c b/tests/gimarshallingtestsextra.c new file mode 100644 index 0000000..d4d6189 --- /dev/null +++ b/tests/gimarshallingtestsextra.c @@ -0,0 +1,177 @@ +/* gimarshallingtestsextra.c + * + * Copyright (C) 2016 Thibault Saunier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "gimarshallingtestsextra.h" +#include + +void +gi_marshalling_tests_compare_two_gerrors_in_gvalue (GValue *v, GValue *v1) +{ + GError *error, * error1; + + g_assert_cmpstr (g_type_name (G_VALUE_TYPE (v)), ==, + g_type_name (G_TYPE_ERROR)); + g_assert_cmpstr (g_type_name (G_VALUE_TYPE (v1)), ==, + g_type_name (G_TYPE_ERROR)); + + error = (GError*) g_value_get_boxed (v); + error1 = (GError*) g_value_get_boxed (v1); + + g_assert_cmpint (error->domain, ==, error1->domain); + g_assert_cmpint (error->code, ==, error1->code); + g_assert_cmpstr (error->message, ==, error1->message); +} + +/** + * gi_marshalling_tests_ghashtable_enum_none_in: + * @hash_table: (element-type gint GIMarshallingTestsExtraEnum) (transfer none): + */ +void +gi_marshalling_tests_ghashtable_enum_none_in (GHashTable *hash_table) +{ + g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (1))), ==, GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE1); + g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (2))), ==, GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE2); + g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (3))), ==, GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE3); +} + +/** + * gi_marshalling_tests_ghashtable_enum_none_return: + * + * Returns: (element-type gint GIMarshallingTestsExtraEnum) (transfer none): + */ +GHashTable * +gi_marshalling_tests_ghashtable_enum_none_return (void) +{ + static GHashTable *hash_table = NULL; + + if (hash_table == NULL) + { + hash_table = g_hash_table_new (NULL, NULL); + g_hash_table_insert (hash_table, GINT_TO_POINTER (1), GINT_TO_POINTER (GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE1)); + g_hash_table_insert (hash_table, GINT_TO_POINTER (2), GINT_TO_POINTER (GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE2)); + g_hash_table_insert (hash_table, GINT_TO_POINTER (3), GINT_TO_POINTER (GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE3)); + } + + return hash_table; +} + +/** + * gi_marshalling_tests_filename_copy: + * @path_in: (type filename) (nullable) + * + * Returns: (type filename) (nullable) + */ +gchar * +gi_marshalling_tests_filename_copy (gchar *path_in) +{ + return g_strdup (path_in); +} + +/** + * gi_marshalling_tests_filename_to_glib_repr: + * @path_in: (type filename) (nullable) + * + * Returns: (array length=len) (element-type guint8) + */ +gchar * +gi_marshalling_tests_filename_to_glib_repr (gchar *path_in, gsize *len) +{ + *len = strlen(path_in); + return g_strdup (path_in); +} + +/** + * gi_marshalling_tests_filename_exists: + * @path: (type filename) + */ +gboolean +gi_marshalling_tests_filename_exists (gchar *path) +{ + return g_file_test (path, G_FILE_TEST_EXISTS); +} + + +/** + * gi_marshalling_tests_enum_array_return_type: + * @n_members: (out): The number of members + * + * Returns: (array length=n_members) (transfer full): An array of enum values + */ +GIMarshallingTestsExtraEnum * +gi_marshalling_tests_enum_array_return_type (gsize *n_members) +{ + GIMarshallingTestsExtraEnum *res = g_new0(GIMarshallingTestsExtraEnum, 3); + + *n_members = 3; + + res[0] = GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE1; + res[1] = GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE2; + res[2] = GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE3; + + return res; +} + +GType +gi_marshalling_tests_extra_flags_get_type (void) +{ + static GType type = 0; + if (G_UNLIKELY (type == 0)) + { + static const GFlagsValue values[] = { + {GI_MARSHALLING_TESTS_EXTRA_FLAGS_VALUE1, + "GI_MARSHALLING_TESTS_EXTRA_FLAGS_VALUE1", "value1"}, + {GI_MARSHALLING_TESTS_EXTRA_FLAGS_VALUE2, + "GI_MARSHALLING_TESTS_EXTRA_FLAGS_VALUE2", "value2"}, + {0, NULL, NULL} + }; + type = g_flags_register_static ( + g_intern_static_string ("GIMarshallingTestsExtraFlags"), values); + } + + return type; +} + +/** + * gi_marshalling_tests_extra_flags_large_in: + */ +void +gi_marshalling_tests_extra_flags_large_in (GIMarshallingTestsExtraFlags value) +{ + g_assert_cmpint (value, ==, GI_MARSHALLING_TESTS_EXTRA_FLAGS_VALUE2); +} + + +/** + * gi_marshalling_tests_extra_utf8_full_return_invalid: + */ +gchar * +gi_marshalling_tests_extra_utf8_full_return_invalid (void) +{ + return g_strdup ("invalid utf8 \xff\xfe"); +} + + +/** + * gi_marshalling_tests_extra_utf8_full_out_invalid: + * @utf8: (out) (transfer full): + */ +void +gi_marshalling_tests_extra_utf8_full_out_invalid (gchar **utf8) +{ + *utf8 = g_strdup ("invalid utf8 \xff\xfe"); +} diff --git a/tests/gimarshallingtestsextra.h b/tests/gimarshallingtestsextra.h new file mode 100644 index 0000000..68ce1d1 --- /dev/null +++ b/tests/gimarshallingtestsextra.h @@ -0,0 +1,69 @@ +/* gimarshallingtestsextra.h + * + * Copyright (C) 2016 Thibault Saunier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef EXTRA_TESTS +#define EXTRA_TESTS + +#include +#include + +typedef enum +{ + GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE1, + GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE2, + GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE3 = 42 +} GIMarshallingTestsExtraEnum; + + +typedef enum +{ + GI_MARSHALLING_TESTS_EXTRA_FLAGS_VALUE1 = 0, + GI_MARSHALLING_TESTS_EXTRA_FLAGS_VALUE2 = (gint)(1 << 31), +} GIMarshallingTestsExtraFlags; + + +_GI_TEST_EXTERN +GType gi_marshalling_tests_extra_flags_get_type (void) G_GNUC_CONST; +#define GI_MARSHALLING_TESTS_TYPE_EXTRA_FLAGS (gi_marshalling_tests_extra_flags_get_type ()) + +_GI_TEST_EXTERN +void gi_marshalling_tests_compare_two_gerrors_in_gvalue (GValue *v, GValue *v1); +_GI_TEST_EXTERN +void gi_marshalling_tests_ghashtable_enum_none_in (GHashTable *hash_table); +_GI_TEST_EXTERN +GHashTable * gi_marshalling_tests_ghashtable_enum_none_return (void); + +_GI_TEST_EXTERN +gchar * gi_marshalling_tests_filename_copy (gchar *path_in); +_GI_TEST_EXTERN +gboolean gi_marshalling_tests_filename_exists (gchar *path); +_GI_TEST_EXTERN +gchar * gi_marshalling_tests_filename_to_glib_repr (gchar *path_in, gsize *len); + +_GI_TEST_EXTERN +GIMarshallingTestsExtraEnum * gi_marshalling_tests_enum_array_return_type (gsize *n_members); + +_GI_TEST_EXTERN +void gi_marshalling_tests_extra_flags_large_in (GIMarshallingTestsExtraFlags value); + +_GI_TEST_EXTERN +gchar *gi_marshalling_tests_extra_utf8_full_return_invalid (void); +_GI_TEST_EXTERN +void gi_marshalling_tests_extra_utf8_full_out_invalid (gchar **utf8); + +#endif /* EXTRA_TESTS */ diff --git a/tests/helper.py b/tests/helper.py new file mode 100644 index 0000000..bed51e8 --- /dev/null +++ b/tests/helper.py @@ -0,0 +1,131 @@ +import contextlib +import unittest +import inspect +import warnings +import functools +import sys +from collections import namedtuple +from io import StringIO + +import gi +from gi import PyGIDeprecationWarning +from gi.repository import GLib + + +ExceptionInfo = namedtuple("ExceptionInfo", ["type", "value", "traceback"]) +"""The type used for storing exceptions used by capture_exceptions()""" + + +@contextlib.contextmanager +def capture_exceptions(): + """Installs a temporary sys.excepthook which records all exceptions + instead of printing them. + """ + + exceptions = [] + + def custom_excepthook(*args): + exceptions.append(ExceptionInfo(*args)) + + old_hook = sys.excepthook + sys.excepthook = custom_excepthook + try: + yield exceptions + finally: + sys.excepthook = old_hook + + +def ignore_gi_deprecation_warnings(func_or_class): + """A unittest class and function decorator which makes them ignore + PyGIDeprecationWarning. + """ + + if inspect.isclass(func_or_class): + assert issubclass(func_or_class, unittest.TestCase) + cls = func_or_class + for name, value in cls.__dict__.items(): + if callable(value) and name.startswith("test_"): + new_value = ignore_gi_deprecation_warnings(value) + setattr(cls, name, new_value) + return cls + else: + func = func_or_class + + @functools.wraps(func) + def wrapper(*args, **kwargs): + with capture_gi_deprecation_warnings(): + return func(*args, **kwargs) + + return wrapper + + +@contextlib.contextmanager +def capture_gi_deprecation_warnings(): + """Temporarily suppress PyGIDeprecationWarning output and record them""" + + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always', category=PyGIDeprecationWarning) + yield warn + + +@contextlib.contextmanager +def capture_glib_warnings(allow_warnings=False, allow_criticals=False): + """Temporarily suppress glib warning output and record them. + + The test suite is run with G_DEBUG="fatal-warnings fatal-criticals" + by default. Setting allow_warnings and allow_criticals will temporarily + allow warnings or criticals without terminating the test run. + """ + + old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags(0)) + + new_mask = old_mask + if allow_warnings: + new_mask &= ~GLib.LogLevelFlags.LEVEL_WARNING + if allow_criticals: + new_mask &= ~GLib.LogLevelFlags.LEVEL_CRITICAL + + GLib.log_set_always_fatal(GLib.LogLevelFlags(new_mask)) + + GLibWarning = gi._gi.Warning + try: + with warnings.catch_warnings(record=True) as warn: + warnings.filterwarnings('always', category=GLibWarning) + yield warn + finally: + GLib.log_set_always_fatal(old_mask) + + +@contextlib.contextmanager +def capture_glib_deprecation_warnings(): + """Temporarily suppress glib deprecation warning output and record them""" + + GLibWarning = gi._gi.Warning + with warnings.catch_warnings(record=True) as warn: + warnings.filterwarnings( + 'always', category=GLibWarning, + message=".+ is deprecated and shouldn't be used anymore\\. " + "It will be removed in a future version\\.") + yield warn + + +@contextlib.contextmanager +def capture_output(): + """ + with capture_output() as (stdout, stderr): + some_action() + print(stdout.getvalue(), stderr.getvalue()) + """ + + err = StringIO() + out = StringIO() + old_err = sys.stderr + old_out = sys.stdout + sys.stderr = err + sys.stdout = out + + try: + yield (out, err) + finally: + sys.stderr = old_err + sys.stdout = old_out diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..0a56ac5 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,133 @@ +gnome = import('gnome') + +host_system = host_machine.system() + +cc = meson.get_compiler('c') + +visibility_args = [] +if get_option('default_library') != 'static' + if host_system == 'windows' + visibility_args += ['-DDLL_EXPORT'] + if cc.get_id() == 'msvc' + visibility_args += ['-D_GI_EXTERN=__declspec(dllexport) extern'] + elif cc.has_argument('-fvisibility=hidden') + visibility_args += ['-D_GI_EXTERN=__attribute__((visibility("default"))) __declspec(dllexport) extern'] + visibility_args += ['-fvisibility=hidden'] + endif + elif cc.has_argument('-fvisibility=hidden') + visibility_args += ['-D_GI_EXTERN=__attribute__((visibility("default"))) extern'] + visibility_args += ['-fvisibility=hidden'] + endif +endif + +if gi_dep.type_name() == 'pkgconfig' + gi_datadir = gi_dep.get_variable(pkgconfig : 'gidatadir') + regress_sources = [join_paths(gi_datadir, 'tests', 'regress.c')] + regress_headers = [join_paths(gi_datadir, 'tests', 'regress.h')] + regress_incdir = include_directories(join_paths(gi_datadir, 'tests')) + marshalling_sources = [join_paths(gi_datadir, 'tests', 'gimarshallingtests.c')] + marshalling_headers = [join_paths(gi_datadir, 'tests', 'gimarshallingtests.h')] +else + gi_subproject = subproject('gobject-introspection') + regress_sources = gi_subproject.get_variable('test_regress_sources') + regress_headers = gi_subproject.get_variable('test_regress_headers') + regress_incdir = gi_subproject.get_variable('test_regress_incdirs') + marshalling_sources = gi_subproject.get_variable('test_marshalling_sources') + marshalling_headers = gi_subproject.get_variable('test_marshalling_headers') + gi_datadir = join_paths(meson.source_root(), 'subprojects', 'gobject-introspection', 'tests') +endif + +marshalling_sources += ['gimarshallingtestsextra.c'] + +marshalling_headers += ['gimarshallingtestsextra.h'] + +marshalling_lib = library( + 'gimarshallingtests', + sources : marshalling_sources, + dependencies : [glib_dep, gobject_dep, gio_dep, gmodule_dep], + include_directories : regress_incdir, + c_args: visibility_args, +) + +gnome.generate_gir( + marshalling_lib, + sources : marshalling_sources + marshalling_headers, + nsversion : '1.0', + namespace : 'GIMarshallingTests', + dependencies : [glib_dep, gobject_dep, gio_dep, gmodule_dep], + symbol_prefix : 'gi_marshalling_tests', + includes : ['Gio-2.0'], + build_by_default : true, + extra_args: ['--quiet'], +) + +regress_sources += ['regressextra.c'] + +regress_headers += ['regressextra.h'] + +regress_deps = [glib_dep, gobject_dep, gio_dep, gmodule_dep] +regress_c_args = [] + +if cairo_dep.found() + regress_deps += [cairo_dep, cairo_gobject_dep] +else + regress_c_args += ['-D_GI_DISABLE_CAIRO'] +endif + +regress_lib = library( + 'regress', + sources : regress_sources, + dependencies : regress_deps, + include_directories : regress_incdir, + c_args: regress_c_args + visibility_args, +) + +gnome.generate_gir( + regress_lib, + sources : regress_sources + regress_headers, + nsversion : '1.0', + namespace : 'Regress', + includes : ['Gio-2.0', 'cairo-1.0'], + build_by_default : true, + dependencies : regress_deps, + extra_args: regress_c_args + ['--quiet'], +) + +helper_sources = [ + 'testhelpermodule.c', + 'test-floating.c', + 'test-thread.c', + 'test-unknown.c'] + +helperext = python.extension_module('testhelper', helper_sources, + dependencies : [python_dep, glib_dep, gobject_dep], + c_args: pyext_c_args + main_c_args, + include_directories: include_directories(join_paths('..', 'gi')) +) + +schemas = gnome.compile_schemas(build_by_default: true) + +envdata = environment() +envdata.append('GI_TYPELIB_PATH', meson.current_build_dir()) +if gi_dep.type_name() == 'internal' + envdata.append('GI_TYPELIB_PATH', join_paths(meson.project_build_root(), 'subprojects', 'gobject-introspection', 'gir')) +endif + +if host_machine.system() == 'linux' + envdata.prepend('LD_LIBRARY_PATH', meson.current_build_dir()) +endif +if host_machine.system() == 'windows' + envdata.prepend('PATH', join_paths(get_option('prefix'), get_option('bindir'))) +endif + +python_paths = [join_paths(meson.current_build_dir(), '..')] +if pycairo_dep.found() and pycairo_dep.type_name() == 'internal' + python_paths += [join_paths(meson.project_build_root(), 'subprojects', 'pycairo')] +endif +envdata.append('PYTHONPATH', python_paths) +envdata.append('TESTS_BUILDDIR', meson.current_build_dir()) + +test('pygobject-test-suite', python, + args : [join_paths(meson.current_source_dir(), 'runtests.py')], + env : envdata, + timeout : 90) diff --git a/tests/org.gnome.test.gschema.xml b/tests/org.gnome.test.gschema.xml index eb9aab8..0c1e5c4 100644 --- a/tests/org.gnome.test.gschema.xml +++ b/tests/org.gnome.test.gschema.xml @@ -21,6 +21,10 @@ 'banana' + + + 123 + diff --git a/tests/regressextra.c b/tests/regressextra.c new file mode 100644 index 0000000..41fdb84 --- /dev/null +++ b/tests/regressextra.c @@ -0,0 +1,416 @@ +#include "regress.h" +#include "regressextra.h" + +#include + +struct _RegressTestBoxedCWrapper +{ + RegressTestBoxedC * cptr; +}; + +RegressTestBoxedCWrapper * +regress_test_boxed_c_wrapper_new (void) +{ + RegressTestBoxedCWrapper *boxed; + boxed = g_slice_new (RegressTestBoxedCWrapper); + boxed->cptr = regress_test_boxed_c_new (); + return boxed; +} + +RegressTestBoxedCWrapper * +regress_test_boxed_c_wrapper_copy (RegressTestBoxedCWrapper *self) +{ + RegressTestBoxedCWrapper *ret_boxed; + ret_boxed = g_slice_new (RegressTestBoxedCWrapper); + ret_boxed->cptr = g_boxed_copy (regress_test_boxed_c_get_type(), self->cptr); + return ret_boxed; +} + +static void +regress_test_boxed_c_wrapper_free (RegressTestBoxedCWrapper *boxed) +{ + g_boxed_free (regress_test_boxed_c_get_type(), boxed->cptr); + g_slice_free (RegressTestBoxedCWrapper, boxed); +} + +G_DEFINE_BOXED_TYPE(RegressTestBoxedCWrapper, + regress_test_boxed_c_wrapper, + regress_test_boxed_c_wrapper_copy, + regress_test_boxed_c_wrapper_free); + +/** + * regress_test_boxed_c_wrapper_get + * @self: a #RegressTestBoxedCWrapper objects + * + * Returns: (transfer none): associated #RegressTestBoxedC +**/ +RegressTestBoxedC * +regress_test_boxed_c_wrapper_get (RegressTestBoxedCWrapper *self) +{ + return self->cptr; +} + +/** + * regress_test_array_fixed_boxed_none_out + * @objs: (out) (array fixed-size=2) (transfer none): An array of #RegressTestBoxedC +**/ +void +regress_test_array_fixed_boxed_none_out (RegressTestBoxedC ***objs) +{ + static RegressTestBoxedC **arr; + + if (arr == NULL) { + arr = g_new0 (RegressTestBoxedC *, 3); + arr[0] = regress_test_boxed_c_new (); + arr[1] = regress_test_boxed_c_new (); + } + + *objs = arr; +} + +/** + * regress_test_gvalue_out_boxed: + * @value: (out) (transfer full): the output gvalue + * @init: (in): the initialisation value +**/ +void +regress_test_gvalue_out_boxed (GValue *value, int init) +{ + RegressTestBoxed rtb; + GValue v = G_VALUE_INIT; + + memset(&rtb, 0, sizeof (rtb)); + rtb.some_int8 = init; + g_value_init (&v, REGRESS_TEST_TYPE_BOXED); + g_value_set_boxed (&v, &rtb); + *value = v; +} + +/** + * regress_test_glist_boxed_none_return + * Return value: (element-type RegressTestBoxedC) (transfer none): +**/ +GList * +regress_test_glist_boxed_none_return (guint count) +{ + static GList *list = NULL; + if (!list) { + while (count > 0) { + list = g_list_prepend (list, regress_test_boxed_c_new ()); + count--; + } + } + + return list; +} + +/** + * regress_test_glist_boxed_full_return + * Return value: (element-type RegressTestBoxedC) (transfer full): +**/ +GList * +regress_test_glist_boxed_full_return (guint count) +{ + GList *list = NULL; + while (count > 0) { + list = g_list_prepend (list, regress_test_boxed_c_new ()); + count--; + } + return list; +} + + +#ifndef _GI_DISABLE_CAIRO + +/** + * regress_test_cairo_context_none_return: + * + * Returns: (transfer none): + */ +cairo_t * +regress_test_cairo_context_none_return (void) +{ + static cairo_t *cr; + + if (cr == NULL) { + cairo_surface_t *surface; + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10); + cr = cairo_create (surface); + cairo_surface_destroy (surface); + } + + return cr; +} + +/** + * regress_test_cairo_context_full_in: + * @context: (transfer full): + */ +void +regress_test_cairo_context_full_in (cairo_t *context) +{ + cairo_destroy (context); +} + + +/** + * regress_test_cairo_path_full_return: + * + * Returns: (transfer full): + */ +cairo_path_t * +regress_test_cairo_path_full_return (void) +{ + cairo_t *cr = regress_test_cairo_context_none_return (); + + return cairo_copy_path (cr); +} + +/** + * regress_test_cairo_path_none_in: + * @path: (transfer none): + */ +void +regress_test_cairo_path_none_in (cairo_path_t *path) +{ + cairo_t *cr = regress_test_cairo_context_full_return (); + cairo_append_path (cr, path); + g_assert (cairo_status (cr) == CAIRO_STATUS_SUCCESS); + cairo_destroy (cr); +} + +/** + * regress_test_cairo_path_full_in_full_return: + * @path: (transfer full): + * + * Returns: (transfer full): + */ +cairo_path_t * +regress_test_cairo_path_full_in_full_return (cairo_path_t *path) +{ + return path; +} + +/** + * regress_test_cairo_pattern_full_in: + * @pattern: (transfer full): + */ +void +regress_test_cairo_pattern_full_in (cairo_pattern_t *pattern) +{ + cairo_pattern_destroy (pattern); +} + +/** + * regress_test_cairo_pattern_none_in: + * @pattern: (transfer none): + */ +void +regress_test_cairo_pattern_none_in (cairo_pattern_t *pattern) +{ + cairo_t *cr = regress_test_cairo_context_full_return (); + cairo_set_source (cr, pattern); + g_assert (cairo_status (cr) == CAIRO_STATUS_SUCCESS); + cairo_destroy (cr); +} + +/** + * regress_test_cairo_pattern_none_return: + * + * Returns: (transfer none): + */ +cairo_pattern_t* +regress_test_cairo_pattern_none_return (void) +{ + static cairo_pattern_t *pattern; + + if (pattern == NULL) { + pattern = cairo_pattern_create_rgb(0.1, 0.2, 0.3); + } + + return pattern; +} + +/** + * regress_test_cairo_pattern_full_return: + * + * Returns: (transfer full): + */ +cairo_pattern_t * +regress_test_cairo_pattern_full_return (void) +{ + cairo_pattern_t *pattern = cairo_pattern_create_rgb(0.5, 0.6, 0.7); + return pattern; +} + +/** + * regress_test_cairo_region_full_in: + * @region: (transfer full): + */ +void +regress_test_cairo_region_full_in (cairo_region_t *region) +{ + cairo_region_destroy (region); +} + +/** + * regress_test_cairo_surface_full_in: + * @surface: (transfer full): + */ +void +regress_test_cairo_surface_full_in (cairo_surface_t *surface) +{ + g_assert (cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32); + g_assert (cairo_image_surface_get_width (surface) == 10); + g_assert (cairo_image_surface_get_height (surface) == 10); + cairo_surface_destroy (surface); +} + +/** + * regress_test_cairo_font_options_full_return: + * + * Returns: (transfer full): + */ +cairo_font_options_t * +regress_test_cairo_font_options_full_return (void) +{ + return cairo_font_options_create (); +} + +/** + * regress_test_cairo_font_options_none_return: + * + * Returns: (transfer none): + */ +cairo_font_options_t * +regress_test_cairo_font_options_none_return (void) +{ + static cairo_font_options_t *options; + + if (options == NULL) + options = cairo_font_options_create (); + + return options; +} + +/** + * regress_test_cairo_font_options_full_in: + * @options: (transfer full): + */ +void +regress_test_cairo_font_options_full_in (cairo_font_options_t *options) +{ + cairo_font_options_destroy (options); +} + +/** + * regress_test_cairo_font_options_none_in: + * @options: (transfer none): + */ +void +regress_test_cairo_font_options_none_in (cairo_font_options_t *options) +{ +} + + +/** + * regress_test_cairo_matrix_none_in: + * @matrix: (transfer none): + */ +void +regress_test_cairo_matrix_none_in (const cairo_matrix_t *matrix) +{ + cairo_matrix_t m = *matrix; + g_assert (m.x0 == 0); + g_assert (m.y0 == 0); + g_assert (m.xx == 1); + g_assert (m.xy == 0); + g_assert (m.yy == 1); + g_assert (m.yx == 0); +} + +/** + * regress_test_cairo_matrix_none_return: + * Returns: (transfer none): + */ +cairo_matrix_t * +regress_test_cairo_matrix_none_return (void) +{ + static cairo_matrix_t matrix; + cairo_matrix_init_identity (&matrix); + return &matrix; +} + +/** + * regress_test_cairo_matrix_out_caller_allocates: + * @matrix: (out): + */ +void +regress_test_cairo_matrix_out_caller_allocates (cairo_matrix_t *matrix) +{ + cairo_matrix_t m; + cairo_matrix_init_identity (&m); + *matrix = m; +} + +#endif + +G_DEFINE_TYPE (RegressTestAction, regress_test_action, G_TYPE_INITIALLY_UNOWNED) + +enum +{ + SIGNAL_0, + ACTION_SIGNAL, + ACTION2_SIGNAL, + LAST_SIGNAL +}; + +static guint regress_test_action_signals[LAST_SIGNAL] = { 0 }; + +static RegressTestAction * +regress_test_action_do_action (RegressTestAction *self) +{ + RegressTestAction *ret = g_object_new (regress_test_action_get_type (), NULL); + + return ret; +} + +static RegressTestAction * +regress_test_action_do_action2 (RegressTestAction *self) +{ + return NULL; +} + +static void +regress_test_action_init (RegressTestAction *self) +{ +} + +static void regress_test_action_class_init (RegressTestActionClass *klass) +{ + /** + * RegressTestAction::action: + * + * An action signal. + * + * Returns: (transfer full): another #RegressTestAction + */ + regress_test_action_signals[ACTION_SIGNAL] = + g_signal_new_class_handler ("action", + G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_CALLBACK (regress_test_action_do_action), NULL, NULL, + NULL, regress_test_action_get_type (), 0); + + /** + * RegressTestAction::action2: + * + * Another action signal. + * + * Returns: (transfer full): another #RegressTestAction + */ + regress_test_action_signals[ACTION2_SIGNAL] = + g_signal_new_class_handler ("action2", + G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_CALLBACK (regress_test_action_do_action2), NULL, NULL, + NULL, regress_test_action_get_type (), 0); +} diff --git a/tests/regressextra.h b/tests/regressextra.h new file mode 100644 index 0000000..8834eb7 --- /dev/null +++ b/tests/regressextra.h @@ -0,0 +1,82 @@ +#ifndef REGRESS_EXTRA_H +#define REGRESS_EXTRA_H + +#include + +typedef struct _RegressTestBoxedC RegressTestBoxedC; +typedef struct _RegressTestBoxedCWrapper RegressTestBoxedCWrapper; + +_GI_TEST_EXTERN +GType regress_test_boxed_c_wrapper_get_type (void); + +_GI_TEST_EXTERN +RegressTestBoxedCWrapper *regress_test_boxed_c_wrapper_new (void); +_GI_TEST_EXTERN +RegressTestBoxedCWrapper * regress_test_boxed_c_wrapper_copy (RegressTestBoxedCWrapper *self); +_GI_TEST_EXTERN +RegressTestBoxedC *regress_test_boxed_c_wrapper_get (RegressTestBoxedCWrapper *self); + +_GI_TEST_EXTERN +void regress_test_array_fixed_boxed_none_out (RegressTestBoxedC ***objs); +_GI_TEST_EXTERN +void regress_test_gvalue_out_boxed (GValue *value, int init); +_GI_TEST_EXTERN +GList *regress_test_glist_boxed_none_return (guint count); +_GI_TEST_EXTERN +GList *regress_test_glist_boxed_full_return (guint count); + +#ifndef _GI_DISABLE_CAIRO + +_GI_TEST_EXTERN +cairo_t *regress_test_cairo_context_none_return (void); +_GI_TEST_EXTERN +void regress_test_cairo_context_full_in (cairo_t *context); +_GI_TEST_EXTERN +cairo_path_t *regress_test_cairo_path_full_return (void); +_GI_TEST_EXTERN +void regress_test_cairo_path_none_in (cairo_path_t *path); +_GI_TEST_EXTERN +cairo_path_t * regress_test_cairo_path_full_in_full_return (cairo_path_t *path); +_GI_TEST_EXTERN +void regress_test_cairo_pattern_full_in (cairo_pattern_t *pattern); +_GI_TEST_EXTERN +void regress_test_cairo_pattern_none_in (cairo_pattern_t *pattern); +_GI_TEST_EXTERN +cairo_pattern_t* regress_test_cairo_pattern_none_return (void); +_GI_TEST_EXTERN +cairo_pattern_t * regress_test_cairo_pattern_full_return (void); +_GI_TEST_EXTERN +cairo_font_options_t *regress_test_cairo_font_options_full_return (void); +_GI_TEST_EXTERN +cairo_font_options_t *regress_test_cairo_font_options_none_return (void); +_GI_TEST_EXTERN +void regress_test_cairo_font_options_full_in (cairo_font_options_t *options); +_GI_TEST_EXTERN +void regress_test_cairo_font_options_none_in (cairo_font_options_t *options); +_GI_TEST_EXTERN +void regress_test_cairo_region_full_in (cairo_region_t *region); +_GI_TEST_EXTERN +void regress_test_cairo_surface_full_in (cairo_surface_t *surface); +_GI_TEST_EXTERN +void regress_test_cairo_matrix_none_in (const cairo_matrix_t *matrix); +_GI_TEST_EXTERN +cairo_matrix_t *regress_test_cairo_matrix_none_return (void); +_GI_TEST_EXTERN +void regress_test_cairo_matrix_out_caller_allocates (cairo_matrix_t *matrix); + +#endif + +/* RegressTestAction */ + +typedef struct { + GInitiallyUnowned parent; +} RegressTestAction; + +typedef struct { + GInitiallyUnownedClass parent_class; +} RegressTestActionClass; + +_GI_TEST_EXTERN +GType regress_test_action_get_type (void); + +#endif /* REGRESS_EXTRA_H */ diff --git a/tests/runtests-windows.py b/tests/runtests-windows.py deleted file mode 100644 index 36ab9e1..0000000 --- a/tests/runtests-windows.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - - -import os -import sys -import glob -import unittest - -mydir = os.path.dirname(os.path.abspath(__file__)) -tests_builddir = os.path.abspath(os.environ.get('TESTS_BUILDDIR', os.path.dirname(__file__))) -builddir = os.path.dirname(tests_builddir) - -# we have to do this here instead of Makefile.am so that the implicitly added -# directory for the source file comes after the builddir -sys.path.insert(0, tests_builddir) -sys.path.insert(0, builddir) - -os.environ['PYGTK_USE_GIL_STATE_API'] = '' -sys.argv.append('--g-fatal-warnings') - -from gi.repository import GObject -GObject.threads_init() - - -SKIP_FILES = ['runtests', - 'test_mainloop', # no os.fork on windows - 'test_subprocess'] # blocks on testChildWatch - - -if __name__ == '__main__': - testdir = os.path.split(os.path.abspath(__file__))[0] - os.chdir(testdir) - - def gettestnames(): - files = glob.glob('*.py') - names = map(lambda x: x[:-3], files) - map(names.remove, SKIP_FILES) - return names - - suite = unittest.TestSuite() - loader = unittest.TestLoader() - - for name in gettestnames(): - try: - suite.addTest(loader.loadTestsFromName(name)) - except Exception, e: - print 'Could not load %s: %s' % (name, e) - - testRunner = unittest.TextTestRunner() - testRunner.verbosity = 2 - testRunner.run(suite) diff --git a/tests/runtests.py b/tests/runtests.py index 6085ff9..721b5d8 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -2,61 +2,43 @@ # -*- Mode: Python -*- import os -import glob import sys -import unittest - -# this was renamed in Python 3, provide backwards compatible name -if sys.version_info[:2] == (2, 7): - unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp - -if '--help' in sys.argv: - print("Usage: ./runtests.py ") - sys.exit(0) - -mydir = os.path.dirname(os.path.abspath(__file__)) -tests_builddir = os.path.abspath(os.environ.get('TESTS_BUILDDIR', os.path.dirname(__file__))) -builddir = os.path.dirname(tests_builddir) - -# we have to do this here instead of Makefile.am so that the implicitly added -# directory for the source file comes after the builddir -sys.path.insert(0, tests_builddir) -sys.path.insert(0, builddir) - -# force untranslated messages, as we check for them in some tests -os.environ['LC_MESSAGES'] = 'C' -os.environ['G_DEBUG'] = 'fatal-warnings fatal-criticals' - -# make Gio able to find our gschemas.compiled in tests/. This needs to be set -# before importing Gio. Support a separate build tree, so look in build dir -# first. -os.environ['GSETTINGS_BACKEND'] = 'memory' -os.environ['GSETTINGS_SCHEMA_DIR'] = tests_builddir -os.environ['G_FILENAME_ENCODING'] = 'UTF-8' - -# Load tests. -if 'TEST_NAMES' in os.environ: - names = os.environ['TEST_NAMES'].split() -elif 'TEST_FILES' in os.environ: - names = [] - for filename in os.environ['TEST_FILES'].split(): - names.append(filename[:-3]) -elif len(sys.argv) > 1: - names = [] - for filename in sys.argv[1:]: - names.append(filename.replace('.py', '')) -else: - names = [] - for filename in glob.iglob(os.path.join(mydir, 'test_*.py')): - names.append(os.path.basename(filename)[:-3]) - -loader = unittest.TestLoader() -suite = loader.loadTestsFromNames(names) - - -# Run tests. -runner = unittest.TextTestRunner(verbosity=2) -result = runner.run(suite) -if not result.wasSuccessful(): - sys.exit(1) # exit code so "make check" reports error +import pytest + + +def main(argv): + if '--help' in argv: + print("Usage: ./runtests.py ") + return + + mydir = os.path.dirname(os.path.abspath(__file__)) + + verbosity_args = [] + + if 'PYGI_TEST_VERBOSE' in os.environ: + verbosity_args += ['--capture=no'] + + if 'TEST_NAMES' in os.environ: + names = os.environ['TEST_NAMES'].split() + elif 'TEST_FILES' in os.environ: + names = [] + for filename in os.environ['TEST_FILES'].split(): + names.append(filename[:-3]) + elif len(argv) > 1: + names = [] + for filename in argv[1:]: + names.append(filename.replace('.py', '')) + else: + return pytest.main([mydir] + verbosity_args) + + def unittest_to_pytest_name(name): + parts = name.split(".") + parts[0] = os.path.join(mydir, parts[0] + ".py") + return "::".join(parts) + + return pytest.main([unittest_to_pytest_name(n) for n in names] + verbosity_args) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/tests/te_ST@nouppera b/tests/te_ST@nouppera deleted file mode 100644 index a511e90..0000000 --- a/tests/te_ST@nouppera +++ /dev/null @@ -1,50 +0,0 @@ -LC_IDENTIFICATION -title "pygobject test locale" -END LC_IDENTIFICATION - -LC_COLLATE -copy "POSIX" -END LC_COLLATE - -LC_CTYPE -# a → a, other characters normally -toupper (,); (,); (,); \ - (,); (,); (,); \ - (,); -END LC_CTYPE - -LC_MESSAGES -copy "en_US" -END LC_MESSAGES - -LC_MONETARY -copy "en_US" -END LC_MONETARY - -LC_NUMERIC -copy "POSIX" -END LC_NUMERIC - -LC_TIME -copy "POSIX" -END LC_TIME - -LC_PAPER -copy "en_US" -END LC_PAPER - -LC_TELEPHONE -copy "en_US" -END LC_TELEPHONE - -LC_MEASUREMENT -copy "en_US" -END LC_MEASUREMENT - -LC_NAME -copy "en_US" -END LC_NAME - -LC_ADDRESS -copy "en_US" -END LC_ADDRESS diff --git a/tests/test_atoms.py b/tests/test_atoms.py index 1561dbd..a74db38 100644 --- a/tests/test_atoms.py +++ b/tests/test_atoms.py @@ -1,13 +1,28 @@ +import os import unittest try: - from gi.repository import Atk, Gdk, Gtk - (Atk, Gdk) # pyflakes -except: + from gi.repository import Gtk, Atk, Gdk +except ImportError: Gdk = None + Atk = None + Gtk = None + +from .helper import capture_glib_deprecation_warnings + + +def is_X11(): + try: + from gi.repository import Gdk, GdkX11 + except ImportError: + return False + + display = Gdk.Display.get_default() + return isinstance(display, GdkX11.X11Display) @unittest.skipUnless(Gdk, 'Gdk not available') +@unittest.skipIf(Gdk._version == "4.0", 'Gdk4 doesn\'t have GdkAtom') class TestGdkAtom(unittest.TestCase): def test_create(self): atom = Gdk.Atom.intern('my_string', False) @@ -20,11 +35,15 @@ class TestGdkAtom(unittest.TestCase): self.assertEqual(str(Gdk.SELECTION_CLIPBOARD), 'CLIPBOARD') def test_repr(self): + # __repr__ should generate a string which is parsable when possible + # http://docs.python.org/2/reference/datamodel.html#object.__repr__ atom = Gdk.Atom.intern('my_string', False) - self.assertEqual(repr(atom), 'Gdk.Atom') + self.assertEqual(repr(atom), 'Gdk.Atom.intern("my_string", False)') + self.assertEqual(eval(repr(atom)), atom) - self.assertEqual(repr(Gdk.SELECTION_CLIPBOARD), 'Gdk.Atom') + self.assertEqual(repr(Gdk.SELECTION_CLIPBOARD), 'Gdk.Atom.intern("CLIPBOARD", False)') + @unittest.skipUnless(os.name != "nt", "not on Windows") def test_in_single(self): a_selection = Gdk.Atom.intern('test_clipboard', False) clipboard = Gtk.Clipboard.get(a_selection) @@ -48,6 +67,7 @@ class TestGdkAtom(unittest.TestCase): self.assertTrue(Gtk.targets_include_image([a_jpeg], False)) self.assertTrue(Gtk.targets_include_image([a_jpeg, a_plain], False)) + @unittest.skipUnless(is_X11(), "only on X11") def test_out_array(self): a_selection = Gdk.Atom.intern('my_clipboard', False) clipboard = Gtk.Clipboard.get(a_selection) @@ -67,11 +87,13 @@ class TestGdkAtom(unittest.TestCase): self.assertFalse(None in names, names) self.assertTrue('TEXT' in names, names) + @unittest.skipUnless(is_X11(), "only on X11") + @unittest.skipIf(not Gdk or Gdk._version == "4.0", "not in gdk4") def test_out_glist(self): display = Gdk.Display.get_default() - dm = display.get_device_manager() - device = dm.get_client_pointer() + with capture_glib_deprecation_warnings(): + dm = display.get_device_manager() + device = dm.get_client_pointer() axes = device.list_axes() - axes_names = [atom.name() for atom in axes] - self.assertNotEqual(axes_names, []) - self.assertTrue('Rel X' in axes_names) + axes_names = [atom.name() for atom in axes if atom is not None] + assert all(isinstance(name, str) for name in axes_names) diff --git a/tests/test_cairo.py b/tests/test_cairo.py new file mode 100644 index 0000000..d73037e --- /dev/null +++ b/tests/test_cairo.py @@ -0,0 +1,308 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab + +import unittest +import pytest + +import gi + +try: + gi.require_foreign('cairo') + import cairo + has_cairo = True +except ImportError: + has_cairo = False + +has_region = has_cairo and hasattr(cairo, "Region") + +try: + from gi.repository import Gtk, Gdk + Gtk, Gdk # pyflakes +except: + Gtk = None + Gdk = None + +from gi.repository import GObject, Regress + + +@unittest.skipUnless(has_cairo, 'built without cairo support') +class Test(unittest.TestCase): + + def test_gvalue_converters(self): + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + context = cairo.Context(surface) + matrix = cairo.Matrix() + objects = { + 'CairoContext': context, + 'CairoSurface': surface, + 'CairoFontFace': context.get_font_face(), + 'CairoScaledFont': context.get_scaled_font(), + 'CairoPattern': context.get_source(), + 'CairoMatrix': matrix, + } + for type_name, cairo_obj in objects.items(): + gtype = GObject.type_from_name(type_name) + v = GObject.Value() + assert v.init(gtype) is None + assert v.get_value() is None + v.set_value(None) + assert v.get_value() is None + v.set_value(cairo_obj) + assert v.get_value() == cairo_obj + + def test_cairo_context(self): + context = Regress.test_cairo_context_full_return() + self.assertTrue(isinstance(context, cairo.Context)) + + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + context = cairo.Context(surface) + Regress.test_cairo_context_none_in(context) + + def test_cairo_context_full_in(self): + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + context = cairo.Context(surface) + Regress.test_cairo_context_full_in(context) + + with pytest.raises(TypeError): + Regress.test_cairo_context_full_in(object()) + + def test_cairo_context_none_return(self): + context = Regress.test_cairo_context_none_return() + self.assertTrue(isinstance(context, cairo.Context)) + + def test_cairo_path_full_return(self): + path = Regress.test_cairo_path_full_return() + if hasattr(cairo, "Path"): # pycairo 1.15.1+ + assert isinstance(path, cairo.Path) + + def test_cairo_path_none_in(self): + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + context = cairo.Context(surface) + path = context.copy_path() + Regress.test_cairo_path_none_in(path) + surface.finish() + + with pytest.raises(TypeError): + Regress.test_cairo_path_none_in(object()) + + def test_cairo_path_full_in_full_return(self): + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + context = cairo.Context(surface) + context.move_to(10, 10) + context.curve_to(10, 10, 3, 4, 5, 6) + path = context.copy_path() + new_path = Regress.test_cairo_path_full_in_full_return(path) + assert list(path) == list(new_path) + surface.finish() + + def test_cairo_font_options_full_return(self): + options = Regress.test_cairo_font_options_full_return() + assert isinstance(options, cairo.FontOptions) + + def test_cairo_font_options_none_return(self): + options = Regress.test_cairo_font_options_none_return() + assert isinstance(options, cairo.FontOptions) + + def test_cairo_font_options_full_in(self): + options = cairo.FontOptions() + Regress.test_cairo_font_options_full_in(options) + + with pytest.raises(TypeError): + Regress.test_cairo_font_options_full_in(object()) + + def test_cairo_font_options_none_in(self): + options = cairo.FontOptions() + Regress.test_cairo_font_options_none_in(options) + + def test_cairo_pattern_full_in(self): + pattern = cairo.SolidPattern(1, 1, 1, 1) + Regress.test_cairo_pattern_full_in(pattern) + + with pytest.raises(TypeError): + Regress.test_cairo_pattern_full_in(object()) + + def test_cairo_pattern_none_in(self): + pattern = cairo.SolidPattern(1, 1, 1, 1) + Regress.test_cairo_pattern_none_in(pattern) + + def test_cairo_pattern_full_return(self): + pattern = Regress.test_cairo_pattern_full_return() + self.assertTrue(isinstance(pattern, cairo.Pattern)) + self.assertTrue(isinstance(pattern, cairo.SolidPattern)) + + def test_cairo_pattern_none_return(self): + pattern = Regress.test_cairo_pattern_none_return() + self.assertTrue(isinstance(pattern, cairo.Pattern)) + self.assertTrue(isinstance(pattern, cairo.SolidPattern)) + + def test_cairo_region_full_in(self): + region = cairo.Region() + Regress.test_cairo_region_full_in(region) + + with pytest.raises(TypeError): + Regress.test_cairo_region_full_in(object()) + + def test_cairo_matrix_none_in(self): + matrix = cairo.Matrix() + Regress.test_cairo_matrix_none_in(matrix) + + with pytest.raises(TypeError): + Regress.test_cairo_matrix_none_in(object()) + + def test_cairo_matrix_none_return(self): + matrix = Regress.test_cairo_matrix_none_return() + assert matrix == cairo.Matrix() + + def test_cairo_matrix_out_caller_allocates(self): + matrix = Regress.test_cairo_matrix_out_caller_allocates() + assert matrix == cairo.Matrix() + + def test_cairo_surface(self): + surface = Regress.test_cairo_surface_none_return() + self.assertTrue(isinstance(surface, cairo.ImageSurface)) + self.assertTrue(isinstance(surface, cairo.Surface)) + self.assertEqual(surface.get_format(), cairo.FORMAT_ARGB32) + self.assertEqual(surface.get_width(), 10) + self.assertEqual(surface.get_height(), 10) + + surface = Regress.test_cairo_surface_full_return() + self.assertTrue(isinstance(surface, cairo.ImageSurface)) + self.assertTrue(isinstance(surface, cairo.Surface)) + self.assertEqual(surface.get_format(), cairo.FORMAT_ARGB32) + self.assertEqual(surface.get_width(), 10) + self.assertEqual(surface.get_height(), 10) + + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + Regress.test_cairo_surface_none_in(surface) + + surface = Regress.test_cairo_surface_full_out() + self.assertTrue(isinstance(surface, cairo.ImageSurface)) + self.assertTrue(isinstance(surface, cairo.Surface)) + self.assertEqual(surface.get_format(), cairo.FORMAT_ARGB32) + self.assertEqual(surface.get_width(), 10) + self.assertEqual(surface.get_height(), 10) + + def test_cairo_surface_full_in(self): + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + Regress.test_cairo_surface_full_in(surface) + + with pytest.raises(TypeError): + Regress.test_cairo_surface_full_in(object()) + + def test_require_foreign(self): + self.assertEqual(gi.require_foreign('cairo'), None) + self.assertEqual(gi.require_foreign('cairo', 'Context'), None) + self.assertRaises(ImportError, gi.require_foreign, 'invalid_module') + self.assertRaises(ImportError, gi.require_foreign, 'invalid_module', 'invalid_symbol') + self.assertRaises(ImportError, gi.require_foreign, 'cairo', 'invalid_symbol') + + +@unittest.skipUnless(has_cairo, 'built without cairo support') +@unittest.skipUnless(has_region, 'built without cairo.Region support') +@unittest.skipUnless(Gdk, 'Gdk not available') +class TestRegion(unittest.TestCase): + + def test_region_to_py(self): + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + context = cairo.Context(surface) + context.paint() + region = Gdk.cairo_region_create_from_surface(surface) + r = region.get_extents() + self.assertEqual((r.height, r.width), (10, 10)) + + def test_region_from_py(self): + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + context = cairo.Context(surface) + region = cairo.Region(cairo.RectangleInt(0, 0, 42, 42)) + Gdk.cairo_region(context, region) + self.assertTrue("42" in repr(list(context.copy_path()))) + + +@unittest.skipUnless(has_cairo, 'built without cairo support') +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestPango(unittest.TestCase): + + def test_cairo_font_options(self): + window = Gtk.Window() + if Gtk._version == "4.0": + window.set_font_options(cairo.FontOptions()) + font_opts = window.get_font_options() + else: + screen = window.get_screen() + font_opts = screen.get_font_options() + assert font_opts is not None + self.assertTrue(isinstance(font_opts.get_subpixel_order(), int)) + + +if has_cairo: + from gi.repository import cairo as CairoGObject + + # Use PyGI signals to test non-introspected foreign marshaling. + class CairoSignalTester(GObject.Object): + sig_context = GObject.Signal(arg_types=[CairoGObject.Context]) + sig_surface = GObject.Signal(arg_types=[CairoGObject.Surface]) + sig_font_face = GObject.Signal(arg_types=[CairoGObject.FontFace]) + sig_scaled_font = GObject.Signal(arg_types=[CairoGObject.ScaledFont]) + sig_pattern = GObject.Signal(arg_types=[CairoGObject.Pattern]) + + +@unittest.skipUnless(has_cairo, 'built without cairo support') +class TestSignalMarshaling(unittest.TestCase): + # Tests round tripping of cairo objects through non-introspected signals. + + def setUp(self): + self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) + self.context = cairo.Context(self.surface) + self.tester = CairoSignalTester() + + def pass_object_through_signal(self, obj, signal): + """Pass the given `obj` through the `signal` emission storing the + `obj` passed through the signal and returning it.""" + passthrough_result = [] + + def callback(instance, passthrough): + passthrough_result.append(passthrough) + + signal.connect(callback) + signal.emit(obj) + + return passthrough_result[0] + + def test_context(self): + result = self.pass_object_through_signal(self.context, self.tester.sig_context) + self.assertTrue(isinstance(result, cairo.Context)) + + with pytest.raises(TypeError): + self.pass_object_through_signal(object(), self.tester.sig_context) + + def test_surface(self): + result = self.pass_object_through_signal(self.surface, self.tester.sig_surface) + self.assertTrue(isinstance(result, cairo.Surface)) + + def test_font_face(self): + font_face = self.context.get_font_face() + result = self.pass_object_through_signal(font_face, self.tester.sig_font_face) + self.assertTrue(isinstance(result, cairo.FontFace)) + + with pytest.raises(TypeError): + self.pass_object_through_signal(object(), self.tester.sig_font_face) + + def test_scaled_font(self): + scaled_font = cairo.ScaledFont(self.context.get_font_face(), + cairo.Matrix(), + cairo.Matrix(), + self.context.get_font_options()) + result = self.pass_object_through_signal(scaled_font, self.tester.sig_scaled_font) + self.assertTrue(isinstance(result, cairo.ScaledFont)) + + with pytest.raises(TypeError): + result = self.pass_object_through_signal(object(), self.tester.sig_scaled_font) + + def test_pattern(self): + pattern = cairo.SolidPattern(1, 1, 1, 1) + result = self.pass_object_through_signal(pattern, self.tester.sig_pattern) + self.assertTrue(isinstance(result, cairo.Pattern)) + self.assertTrue(isinstance(result, cairo.SolidPattern)) + + with pytest.raises(TypeError): + result = self.pass_object_through_signal(object(), self.tester.sig_pattern) diff --git a/tests/test_docstring.py b/tests/test_docstring.py index 1628295..527d2a1 100644 --- a/tests/test_docstring.py +++ b/tests/test_docstring.py @@ -1,7 +1,17 @@ import unittest import gi.docstring + +from gi.repository import Regress from gi.repository import GIMarshallingTests +from gi.repository import Gio +from gi.repository import GObject +from gi.repository import GLib + +try: + from gi.repository import Gtk +except ImportError: + Gtk = None class Test(unittest.TestCase): @@ -20,26 +30,6 @@ class Test(unittest.TestCase): self.assertEqual(gi.docstring.get_doc_string_generator(), old_func) - def test_split_args_multi_out(self): - in_args, out_args = gi.docstring.split_function_info_args(GIMarshallingTests.int_out_out) - self.assertEqual(len(in_args), 0) - self.assertEqual(len(out_args), 2) - self.assertEqual(out_args[0].get_pytype_hint(), 'int') - self.assertEqual(out_args[1].get_pytype_hint(), 'int') - - def test_split_args_inout(self): - in_args, out_args = gi.docstring.split_function_info_args(GIMarshallingTests.long_inout_max_min) - self.assertEqual(len(in_args), 1) - self.assertEqual(len(out_args), 1) - self.assertEqual(in_args[0].get_name(), out_args[0].get_name()) - self.assertEqual(in_args[0].get_pytype_hint(), out_args[0].get_pytype_hint()) - - def test_split_args_none(self): - obj = GIMarshallingTests.Object(int=33) - in_args, out_args = gi.docstring.split_function_info_args(obj.none_inout) - self.assertEqual(len(in_args), 1) - self.assertEqual(len(out_args), 1) - def test_final_signature_with_full_inout(self): self.assertEqual(GIMarshallingTests.Object.full_inout.__doc__, 'full_inout(object:GIMarshallingTests.Object) -> object:GIMarshallingTests.Object') @@ -47,3 +37,102 @@ class Test(unittest.TestCase): def test_overridden_doc_is_not_clobbered(self): self.assertEqual(GIMarshallingTests.OverridesObject.method.__doc__, 'Overridden doc string.') + + def test_allow_none_with_user_data_defaults(self): + g_file_copy_doc = 'copy(self, destination:Gio.File, ' \ + 'flags:Gio.FileCopyFlags, ' \ + 'cancellable:Gio.Cancellable=None, ' \ + 'progress_callback:Gio.FileProgressCallback=None, ' \ + 'progress_callback_data=None) -> bool' + + self.assertEqual(Gio.File.copy.__doc__, g_file_copy_doc) + + def test_array_length_arg(self): + self.assertEqual(GIMarshallingTests.array_in.__doc__, + 'array_in(ints:list)') + + def test_init_function(self): + # This tests implicit array length args along with skipping a + # boolean return + self.assertEqual(GIMarshallingTests.init_function.__doc__, + 'init_function(argv:list=None) -> bool, argv:list') + + def test_boolean_return(self): + self.assertEqual(GIMarshallingTests.boolean_return_true.__doc__, + 'boolean_return_true() -> bool') + + @unittest.skipUnless((GLib.MAJOR_VERSION, GLib.MINOR_VERSION) >= (2, 42), + "nullable was added in newer glib/gi") + # https://bugzilla.gnome.org/show_bug.cgi?id=740301 + def test_may_return_none(self): + self.assertEqual(Gio.File.get_basename.__doc__, + 'get_basename(self) -> str or None') + + def test_class_doc_constructors(self): + doc = GIMarshallingTests.Object.__doc__ + self.assertTrue('new(int_:int)' in doc) + + def test_struct_doc_constructors(self): + doc = GIMarshallingTests.BoxedStruct.__doc__ + self.assertTrue('new()' in doc) + self.assertTrue('BoxedStruct()' in doc) + + def test_private_struct_constructors(self): + # Structs without a size or constructor should have no constructor docs. + doc = Regress.TestBoxedPrivate.__doc__ + self.assertEqual(doc, '') + + def test_array_inout_etc(self): + self.assertEqual(GIMarshallingTests.array_inout_etc.__doc__, + 'array_inout_etc(first:int, ints:list, last:int) -> ints:list, sum:int') + + def test_array_out_etc(self): + self.assertEqual(GIMarshallingTests.array_out_etc.__doc__, + 'array_out_etc(first:int, last:int) -> ints:list, sum:int') + + @unittest.skipUnless(Gtk, 'no Gtk') + def test_shared_array_length_with_prior_out_arg(self): + # Test the 'iter' out argument does not effect length argument skipping. + self.assertRegex( + Gtk.ListStore.insert_with_valuesv.__doc__, + 'insert_with_values.*\\(self, position:int, columns:list, values:list\\) -> iter:Gtk.TreeIter') + + def test_sub_class_doc(self): + class A(GObject.Object): + """first doc""" + pass + + class B(A): + """second doc""" + pass + + self.assertEqual(A.__doc__, "first doc") + self.assertEqual(B.__doc__, "second doc") + + def test_sub_class_no_doc(self): + class A(GObject.Object): + pass + + class B(A): + """sub-class doc""" + + self.assertEqual(A.__doc__, None) + self.assertEqual(B.__doc__, "sub-class doc") + + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=734926 + def test_sub_class_doc_setattr(self): + class A(GObject.Object): + pass + + class B(A): + pass + + A.__doc__ = 'custom doc' + + self.assertEqual(A.__doc__, "custom doc") + self.assertEqual(B.__doc__, "custom doc") + + def test_return_array_with_length_argument(self): + self.assertEqual( + GIMarshallingTests.enum_array_return_type.__doc__, + "enum_array_return_type() -> list") diff --git a/tests/test_error.py b/tests/test_error.py new file mode 100644 index 0000000..6bcad38 --- /dev/null +++ b/tests/test_error.py @@ -0,0 +1,157 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# test_error.py: Tests for GError wrapper implementation +# +# Copyright (C) 2012 Will Thompson +# Copyright (C) 2013 Martin Pitt +# Copyright (C) 2014 Simon Feltman +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +import unittest +import pickle + +from gi.repository import GLib +from gi.repository import GIMarshallingTests + + +class TestType(unittest.TestCase): + def test_attributes(self): + e = GLib.Error('test message', 'mydomain', 42) + self.assertEqual(e.message, 'test message') + self.assertEqual(e.domain, 'mydomain') + self.assertEqual(e.code, 42) + + def test_new_literal(self): + mydomain = GLib.quark_from_string('mydomain') + e = GLib.Error.new_literal(mydomain, 'test message', 42) + self.assertEqual(e.message, 'test message') + self.assertEqual(e.domain, 'mydomain') + self.assertEqual(e.code, 42) + + def test_matches(self): + mydomain = GLib.quark_from_string('mydomain') + notmydomain = GLib.quark_from_string('notmydomain') + e = GLib.Error('test message', 'mydomain', 42) + self.assertTrue(e.matches(mydomain, 42)) + self.assertFalse(e.matches(notmydomain, 42)) + self.assertFalse(e.matches(mydomain, 40)) + + def test_str(self): + e = GLib.Error('test message', 'mydomain', 42) + self.assertEqual(str(e), + 'mydomain: test message (42)') + + def test_repr(self): + e = GLib.Error('test message', 'mydomain', 42) + self.assertEqual(repr(e), + "GLib.Error('test message', 'mydomain', 42)") + + def test_inheritance(self): + self.assertTrue(issubclass(GLib.Error, RuntimeError)) + + def test_pickle(self): + + def check_pickle(e): + assert isinstance(e, GLib.Error) + new_e = pickle.loads(pickle.dumps(e)) + assert type(new_e) is type(e) + assert repr(e) == repr(new_e) + + e = GLib.Error('test message', 'mydomain', 42) + check_pickle(e) + + try: + GLib.file_get_contents("") + except Exception as e: + check_pickle(e) + + +class ObjectWithVFuncException(GIMarshallingTests.Object): + def do_vfunc_meth_with_err(self, x): + if x == 42: + return True + + raise GLib.Error('unexpected value %d' % x, 'mydomain', 42) + + +class TestMarshalling(unittest.TestCase): + def test_array_in_crash(self): + # Previously there was a bug in invoke, in which C arrays were unwrapped + # from inside GArrays to be passed to the C function. But when a GError was + # set, invoke would attempt to free the C array as if it were a GArray. + # This crash is only for C arrays. It does not happen for C functions which + # take in GArrays. See https://bugzilla.gnome.org/show_bug.cgi?id=642708 + self.assertRaises(GLib.Error, GIMarshallingTests.gerror_array_in, [1, 2, 3]) + + def test_out(self): + # See https://bugzilla.gnome.org/show_bug.cgi?id=666098 + error, debug = GIMarshallingTests.gerror_out() + + self.assertIsInstance(error, GLib.Error) + self.assertEqual(error.domain, GIMarshallingTests.CONSTANT_GERROR_DOMAIN) + self.assertEqual(error.code, GIMarshallingTests.CONSTANT_GERROR_CODE) + self.assertEqual(error.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE) + self.assertEqual(debug, GIMarshallingTests.CONSTANT_GERROR_DEBUG_MESSAGE) + + def test_out_transfer_none(self): + # See https://bugzilla.gnome.org/show_bug.cgi?id=666098 + error, debug = GIMarshallingTests.gerror_out_transfer_none() + + self.assertIsInstance(error, GLib.Error) + self.assertEqual(error.domain, GIMarshallingTests.CONSTANT_GERROR_DOMAIN) + self.assertEqual(error.code, GIMarshallingTests.CONSTANT_GERROR_CODE) + self.assertEqual(error.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE) + self.assertEqual(GIMarshallingTests.CONSTANT_GERROR_DEBUG_MESSAGE, debug) + + def test_return(self): + # See https://bugzilla.gnome.org/show_bug.cgi?id=666098 + error = GIMarshallingTests.gerror_return() + + self.assertIsInstance(error, GLib.Error) + self.assertEqual(error.domain, GIMarshallingTests.CONSTANT_GERROR_DOMAIN) + self.assertEqual(error.code, GIMarshallingTests.CONSTANT_GERROR_CODE) + self.assertEqual(error.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE) + + def test_exception(self): + with self.assertRaises(GLib.Error) as context: + GIMarshallingTests.gerror() + + e = context.exception + self.assertEqual(e.domain, GIMarshallingTests.CONSTANT_GERROR_DOMAIN) + self.assertEqual(e.code, GIMarshallingTests.CONSTANT_GERROR_CODE) + self.assertEqual(e.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE) + + def test_vfunc_no_exception(self): + obj = ObjectWithVFuncException() + self.assertTrue(obj.vfunc_meth_with_error(42)) + + def test_vfunc_gerror_exception(self): + obj = ObjectWithVFuncException() + with self.assertRaises(GLib.Error) as context: + obj.vfunc_meth_with_error(-1) + + e = context.exception + self.assertEqual(e.message, 'unexpected value -1') + self.assertEqual(e.domain, 'mydomain') + self.assertEqual(e.code, 42) + + def tests_compare_two_gerrors_in_gvalue(self): + error = GLib.Error.new_literal(1, "error", 1) + error1 = GLib.Error.new_literal(1, "error", 1) + + GIMarshallingTests.compare_two_gerrors_in_gvalue(error, error1) diff --git a/tests/test_everything.py b/tests/test_everything.py index b2f0528..0eaa522 100644 --- a/tests/test_everything.py +++ b/tests/test_everything.py @@ -1,5 +1,4 @@ # -*- Mode: Python; py-indent-offset: 4 -*- -# coding=utf-8 # vim: tabstop=4 shiftwidth=4 expandtab import unittest @@ -7,15 +6,16 @@ import traceback import ctypes import warnings import sys +import os +import re +import platform +import gc +import timeit +import random -try: - import cairo - has_cairo = True - from gi.repository import Regress as Everything -except ImportError: - has_cairo = False +import pytest -#import gi +from gi.repository import Regress as Everything from gi.repository import GObject from gi.repository import GLib from gi.repository import Gio @@ -26,11 +26,11 @@ try: except: Gtk = None -if sys.version_info < (3, 0): - UNICHAR = "\xe2\x99\xa5" - PY2_UNICODE_UNICHAR = unicode(UNICHAR, 'UTF-8') -else: - UNICHAR = "♥" +from .helper import capture_exceptions + + +const_str = b'const \xe2\x99\xa5 utf8'.decode('UTF-8') +noconst_str = 'non' + const_str class RawGList(ctypes.Structure): @@ -44,41 +44,15 @@ class RawGList(ctypes.Structure): return ctypes.POINTER(cls).from_address(id(obj) + offset) -@unittest.skipUnless(has_cairo, 'built without cairo support') -class TestEverything(unittest.TestCase): +class TestInstanceTransfer(unittest.TestCase): + + def test_main(self): + obj = Everything.TestObj() + for _ in range(10): + obj.instance_method_full() + - def test_cairo_context(self): - context = Everything.test_cairo_context_full_return() - self.assertTrue(isinstance(context, cairo.Context)) - - surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) - context = cairo.Context(surface) - Everything.test_cairo_context_none_in(context) - - def test_cairo_surface(self): - surface = Everything.test_cairo_surface_none_return() - self.assertTrue(isinstance(surface, cairo.ImageSurface)) - self.assertTrue(isinstance(surface, cairo.Surface)) - self.assertEqual(surface.get_format(), cairo.FORMAT_ARGB32) - self.assertEqual(surface.get_width(), 10) - self.assertEqual(surface.get_height(), 10) - - surface = Everything.test_cairo_surface_full_return() - self.assertTrue(isinstance(surface, cairo.ImageSurface)) - self.assertTrue(isinstance(surface, cairo.Surface)) - self.assertEqual(surface.get_format(), cairo.FORMAT_ARGB32) - self.assertEqual(surface.get_width(), 10) - self.assertEqual(surface.get_height(), 10) - - surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) - Everything.test_cairo_surface_none_in(surface) - - surface = Everything.test_cairo_surface_full_out() - self.assertTrue(isinstance(surface, cairo.ImageSurface)) - self.assertTrue(isinstance(surface, cairo.Surface)) - self.assertEqual(surface.get_format(), cairo.FORMAT_ARGB32) - self.assertEqual(surface.get_width(), 10) - self.assertEqual(surface.get_height(), 10) +class TestEverything(unittest.TestCase): def test_bool(self): self.assertEqual(Everything.test_boolean(False), False) @@ -90,142 +64,334 @@ class TestEverything(unittest.TestCase): self.assertEqual(Everything.test_boolean_false(False), False) def test_int8(self): - self.assertEqual(Everything.test_int8(GObject.G_MAXINT8), - GObject.G_MAXINT8) - self.assertEqual(Everything.test_int8(GObject.G_MININT8), - GObject.G_MININT8) - self.assertRaises(OverflowError, Everything.test_int8, GObject.G_MAXINT8 + 1) - - self.assertEqual(Everything.test_uint8(GObject.G_MAXUINT8), - GObject.G_MAXUINT8) + self.assertEqual(Everything.test_int8(GLib.MAXINT8), + GLib.MAXINT8) + self.assertEqual(Everything.test_int8(GLib.MININT8), + GLib.MININT8) + self.assertRaises(OverflowError, Everything.test_int8, GLib.MAXINT8 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXINT8 + 1, GLib.MININT8, GLib.MAXINT8)): + Everything.test_int8(GLib.MAXINT8 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXUINT64 * 2, GLib.MININT8, GLib.MAXINT8)): + Everything.test_int8(GLib.MAXUINT64 * 2) + + def test_uint8(self): + self.assertEqual(Everything.test_uint8(GLib.MAXUINT8), + GLib.MAXUINT8) self.assertEqual(Everything.test_uint8(0), 0) self.assertRaises(OverflowError, Everything.test_uint8, -1) - self.assertRaises(OverflowError, Everything.test_uint8, GObject.G_MAXUINT8 + 1) + self.assertRaises(OverflowError, Everything.test_uint8, GLib.MAXUINT8 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT8 + 1, GLib.MAXUINT8)): + Everything.test_uint8(GLib.MAXUINT8 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 * 2, GLib.MAXUINT8)): + Everything.test_uint8(GLib.MAXUINT64 * 2) def test_int16(self): - self.assertEqual(Everything.test_int16(GObject.G_MAXINT16), - GObject.G_MAXINT16) - self.assertEqual(Everything.test_int16(GObject.G_MININT16), - GObject.G_MININT16) - self.assertRaises(OverflowError, Everything.test_int16, GObject.G_MAXINT16 + 1) - - self.assertEqual(Everything.test_uint16(GObject.G_MAXUINT16), - GObject.G_MAXUINT16) + self.assertEqual(Everything.test_int16(GLib.MAXINT16), + GLib.MAXINT16) + self.assertEqual(Everything.test_int16(GLib.MININT16), + GLib.MININT16) + + with pytest.raises( + OverflowError, + match="32768 not in range -32768 to 32767"): + Everything.test_int16(GLib.MAXINT16 + 1) + + with pytest.raises( + OverflowError, + match="36893488147419103230 not in range -32768 to 32767"): + Everything.test_int16(GLib.MAXUINT64 * 2) + + def test_uint16(self): + self.assertEqual(Everything.test_uint16(GLib.MAXUINT16), + GLib.MAXUINT16) self.assertEqual(Everything.test_uint16(0), 0) self.assertRaises(OverflowError, Everything.test_uint16, -1) - self.assertRaises(OverflowError, Everything.test_uint16, GObject.G_MAXUINT16 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT16 + 1, GLib.MAXUINT16)): + Everything.test_uint16(GLib.MAXUINT16 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 * 2, GLib.MAXUINT16)): + Everything.test_uint16(GLib.MAXUINT64 * 2) def test_int32(self): - self.assertEqual(Everything.test_int32(GObject.G_MAXINT32), - GObject.G_MAXINT32) - self.assertEqual(Everything.test_int32(GObject.G_MININT32), - GObject.G_MININT32) - self.assertRaises(OverflowError, Everything.test_int32, GObject.G_MAXINT32 + 1) - - self.assertEqual(Everything.test_uint32(GObject.G_MAXUINT32), - GObject.G_MAXUINT32) + self.assertEqual(Everything.test_int32(GLib.MAXINT32), + GLib.MAXINT32) + self.assertEqual(Everything.test_int32(GLib.MININT32), + GLib.MININT32) + + with pytest.raises( + OverflowError, + match="2147483648 not in range -2147483648 to 2147483647"): + Everything.test_int32(GLib.MAXINT32 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range -2147483648 to 2147483647" % ( + GLib.MAXINT64 + 1,)): + Everything.test_int32(GLib.MAXINT64 + 1) + + def test_uint32(self): + self.assertEqual(Everything.test_uint32(GLib.MAXUINT32), + GLib.MAXUINT32) self.assertEqual(Everything.test_uint32(0), 0) self.assertRaises(OverflowError, Everything.test_uint32, -1) - self.assertRaises(OverflowError, Everything.test_uint32, GObject.G_MAXUINT32 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT32 + 1, GLib.MAXUINT32)): + Everything.test_uint32(GLib.MAXUINT32 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 * 2, GLib.MAXUINT32)): + Everything.test_uint32(GLib.MAXUINT64 * 2) def test_int64(self): - self.assertEqual(Everything.test_int64(GObject.G_MAXINT64), - GObject.G_MAXINT64) - self.assertEqual(Everything.test_int64(GObject.G_MININT64), - GObject.G_MININT64) - self.assertRaises(OverflowError, Everything.test_int64, GObject.G_MAXINT64 + 1) - - self.assertEqual(Everything.test_uint64(GObject.G_MAXUINT64), - GObject.G_MAXUINT64) + self.assertEqual(Everything.test_int64(GLib.MAXINT64), + GLib.MAXINT64) + self.assertEqual(Everything.test_int64(GLib.MININT64), + GLib.MININT64) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXINT64 + 1, GLib.MININT64, GLib.MAXINT64)): + Everything.test_int64(GLib.MAXINT64 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXUINT64 * 2, GLib.MININT64, GLib.MAXINT64)): + Everything.test_int64(GLib.MAXUINT64 * 2) + + def test_uint64(self): + self.assertEqual(Everything.test_uint64(GLib.MAXUINT64), + GLib.MAXUINT64) self.assertEqual(Everything.test_uint64(0), 0) self.assertRaises(OverflowError, Everything.test_uint64, -1) - self.assertRaises(OverflowError, Everything.test_uint64, GObject.G_MAXUINT64 + 1) + self.assertRaises(OverflowError, Everything.test_uint64, GLib.MAXUINT64 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 + 1, GLib.MAXUINT64)): + Everything.test_uint64(GLib.MAXUINT64 + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 * 2, GLib.MAXUINT64)): + Everything.test_uint64(GLib.MAXUINT64 * 2) def test_int(self): - self.assertEqual(Everything.test_int(GObject.G_MAXINT), - GObject.G_MAXINT) - self.assertEqual(Everything.test_int(GObject.G_MININT), - GObject.G_MININT) - self.assertRaises(OverflowError, Everything.test_int, GObject.G_MAXINT + 1) - - self.assertEqual(Everything.test_uint(GObject.G_MAXUINT), - GObject.G_MAXUINT) + self.assertEqual(Everything.test_int(GLib.MAXINT), + GLib.MAXINT) + self.assertEqual(Everything.test_int(GLib.MININT), + GLib.MININT) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXINT + 1, GLib.MININT, GLib.MAXINT)): + Everything.test_int(GLib.MAXINT + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXUINT64 * 2, GLib.MININT, GLib.MAXINT)): + Everything.test_int(GLib.MAXUINT64 * 2) + + def test_uint(self): + self.assertEqual(Everything.test_uint(GLib.MAXUINT), + GLib.MAXUINT) self.assertEqual(Everything.test_uint(0), 0) self.assertRaises(OverflowError, Everything.test_uint, -1) - self.assertRaises(OverflowError, Everything.test_uint, GObject.G_MAXUINT + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT + 1, GLib.MAXUINT)): + Everything.test_uint(GLib.MAXUINT + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 * 2, GLib.MAXUINT)): + Everything.test_uint(GLib.MAXUINT64 * 2) def test_short(self): - self.assertEqual(Everything.test_short(GObject.G_MAXSHORT), - GObject.G_MAXSHORT) - self.assertEqual(Everything.test_short(GObject.G_MINSHORT), - GObject.G_MINSHORT) - self.assertRaises(OverflowError, Everything.test_short, GObject.G_MAXSHORT + 1) - - self.assertEqual(Everything.test_ushort(GObject.G_MAXUSHORT), - GObject.G_MAXUSHORT) + self.assertEqual(Everything.test_short(GLib.MAXSHORT), + GLib.MAXSHORT) + self.assertEqual(Everything.test_short(GLib.MINSHORT), + GLib.MINSHORT) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXSHORT + 1, GLib.MINSHORT, GLib.MAXSHORT)): + Everything.test_short(GLib.MAXSHORT + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXUINT64 * 2, GLib.MINSHORT, GLib.MAXSHORT)): + Everything.test_short(GLib.MAXUINT64 * 2) + + def test_ushort(self): + self.assertEqual(Everything.test_ushort(GLib.MAXUSHORT), + GLib.MAXUSHORT) self.assertEqual(Everything.test_ushort(0), 0) self.assertRaises(OverflowError, Everything.test_ushort, -1) - self.assertRaises(OverflowError, Everything.test_ushort, GObject.G_MAXUSHORT + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUSHORT + 1, GLib.MAXUSHORT)): + Everything.test_ushort(GLib.MAXUSHORT + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 * 2, GLib.MAXUSHORT)): + Everything.test_ushort(GLib.MAXUINT64 * 2) def test_long(self): - self.assertEqual(Everything.test_long(GObject.G_MAXLONG), - GObject.G_MAXLONG) - self.assertEqual(Everything.test_long(GObject.G_MINLONG), - GObject.G_MINLONG) - self.assertRaises(OverflowError, Everything.test_long, GObject.G_MAXLONG + 1) - - self.assertEqual(Everything.test_ulong(GObject.G_MAXULONG), - GObject.G_MAXULONG) + self.assertEqual(Everything.test_long(GLib.MAXLONG), + GLib.MAXLONG) + self.assertEqual(Everything.test_long(GLib.MINLONG), + GLib.MINLONG) + self.assertRaises(OverflowError, Everything.test_long, GLib.MAXLONG + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXLONG + 1, GLib.MINLONG, GLib.MAXLONG)): + Everything.test_long(GLib.MAXLONG + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXUINT64 * 2, GLib.MINLONG, GLib.MAXLONG)): + Everything.test_long(GLib.MAXUINT64 * 2) + + def test_ulong(self): + self.assertEqual(Everything.test_ulong(GLib.MAXULONG), + GLib.MAXULONG) self.assertEqual(Everything.test_ulong(0), 0) self.assertRaises(OverflowError, Everything.test_ulong, -1) - self.assertRaises(OverflowError, Everything.test_ulong, GObject.G_MAXULONG + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXULONG + 1, GLib.MAXULONG)): + Everything.test_ulong(GLib.MAXULONG + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 * 2, GLib.MAXULONG)): + Everything.test_ulong(GLib.MAXUINT64 * 2) + + def test_ssize(self): + self.assertEqual(Everything.test_ssize(GLib.MAXSSIZE), + GLib.MAXSSIZE) + self.assertEqual(Everything.test_ssize(GLib.MINSSIZE), + GLib.MINSSIZE) + self.assertRaises(OverflowError, Everything.test_ssize, GLib.MAXSSIZE + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXSSIZE + 1, GLib.MINSSIZE, GLib.MAXSSIZE)): + Everything.test_ssize(GLib.MAXSSIZE + 1) + + with pytest.raises( + OverflowError, + match="%s not in range %s to %s" % ( + GLib.MAXUINT64 * 2, GLib.MINSSIZE, GLib.MAXSSIZE)): + Everything.test_ssize(GLib.MAXUINT64 * 2) def test_size(self): - self.assertEqual(Everything.test_ssize(GObject.G_MAXSSIZE), - GObject.G_MAXSSIZE) - self.assertEqual(Everything.test_ssize(GObject.G_MINSSIZE), - GObject.G_MINSSIZE) - self.assertRaises(OverflowError, Everything.test_ssize, GObject.G_MAXSSIZE + 1) - - self.assertEqual(Everything.test_size(GObject.G_MAXSIZE), - GObject.G_MAXSIZE) + self.assertEqual(Everything.test_size(GLib.MAXSIZE), + GLib.MAXSIZE) self.assertEqual(Everything.test_size(0), 0) self.assertRaises(OverflowError, Everything.test_size, -1) - self.assertRaises(OverflowError, Everything.test_size, GObject.G_MAXSIZE + 1) + self.assertRaises(OverflowError, Everything.test_size, GLib.MAXSIZE + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXSIZE + 1, GLib.MAXSIZE)): + Everything.test_size(GLib.MAXSIZE + 1) + + with pytest.raises( + OverflowError, + match="%s not in range 0 to %s" % ( + GLib.MAXUINT64 * 2, GLib.MAXSIZE)): + Everything.test_size(GLib.MAXUINT64 * 2) def test_timet(self): self.assertEqual(Everything.test_timet(42), 42) - self.assertRaises(OverflowError, Everything.test_timet, GObject.G_MAXUINT64 + 1) + self.assertRaises(OverflowError, Everything.test_timet, GLib.MAXUINT64 + 1) def test_unichar(self): self.assertEqual("c", Everything.test_unichar("c")) + self.assertEqual(chr(sys.maxunicode), Everything.test_unichar(chr(sys.maxunicode))) - if sys.version_info < (3, 0): - self.assertEqual(UNICHAR, Everything.test_unichar(PY2_UNICODE_UNICHAR)) - self.assertEqual(UNICHAR, Everything.test_unichar(UNICHAR)) + self.assertEqual(u"♥", Everything.test_unichar(u"♥")) self.assertRaises(TypeError, Everything.test_unichar, "") self.assertRaises(TypeError, Everything.test_unichar, "morethanonechar") def test_float(self): - self.assertEqual(Everything.test_float(GObject.G_MAXFLOAT), - GObject.G_MAXFLOAT) - self.assertEqual(Everything.test_float(GObject.G_MINFLOAT), - GObject.G_MINFLOAT) - self.assertRaises(OverflowError, Everything.test_float, GObject.G_MAXFLOAT * 2) + self.assertEqual(Everything.test_float(GLib.MAXFLOAT), + GLib.MAXFLOAT) + self.assertEqual(Everything.test_float(GLib.MINFLOAT), + GLib.MINFLOAT) + self.assertRaises(OverflowError, Everything.test_float, GLib.MAXFLOAT * 2) + + with pytest.raises( + OverflowError, + match=re.escape("%s not in range %s to %s" % ( + GLib.MAXFLOAT * 2, -GLib.MAXFLOAT, GLib.MAXFLOAT))): + Everything.test_float(GLib.MAXFLOAT * 2) def test_double(self): - self.assertEqual(Everything.test_double(GObject.G_MAXDOUBLE), - GObject.G_MAXDOUBLE) - self.assertEqual(Everything.test_double(GObject.G_MINDOUBLE), - GObject.G_MINDOUBLE) + self.assertEqual(Everything.test_double(GLib.MAXDOUBLE), + GLib.MAXDOUBLE) + self.assertEqual(Everything.test_double(GLib.MINDOUBLE), + GLib.MINDOUBLE) (two, three) = Everything.test_multi_double_args(2.5) self.assertAlmostEqual(two, 5.0) self.assertAlmostEqual(three, 7.5) def test_value(self): - self.assertEqual(Everything.test_int_value_arg(GObject.G_MAXINT), GObject.G_MAXINT) - self.assertEqual(Everything.test_value_return(GObject.G_MAXINT), GObject.G_MAXINT) + self.assertEqual(Everything.test_int_value_arg(GLib.MAXINT), GLib.MAXINT) + self.assertEqual(Everything.test_value_return(GLib.MAXINT), GLib.MAXINT) def test_variant(self): v = Everything.test_gvariant_i() @@ -254,27 +420,38 @@ class TestEverything(unittest.TestCase): timeout = v.lookup_value('timeout', None) self.assertEqual(timeout.get_int32(), 10) - def test_string(self): - const_str = b'const \xe2\x99\xa5 utf8' - if sys.version_info >= (3, 0): - const_str = const_str.decode('UTF-8') - noconst_str = 'non' + const_str - + def test_utf8_const_return(self): self.assertEqual(Everything.test_utf8_const_return(), const_str) + + def test_utf8_nonconst_return(self): self.assertEqual(Everything.test_utf8_nonconst_return(), noconst_str) + + def test_utf8_out(self): self.assertEqual(Everything.test_utf8_out(), noconst_str) + def test_utf8_const_in(self): Everything.test_utf8_const_in(const_str) + + def test_utf8_inout(self): self.assertEqual(Everything.test_utf8_inout(const_str), noconst_str) - self.assertEqual(Everything.test_filename_return(), ['åäö', '/etc/fstab']) + def test_filename_return(self): + if os.name != "nt": + result = [os.fsdecode(b'\xc3\xa5\xc3\xa4\xc3\xb6'), '/etc/fstab'] + else: + result = ['åäö', '/etc/fstab'] + self.assertEqual(Everything.test_filename_return(), result) + def test_int_out_utf8(self): # returns g_utf8_strlen() in out argument self.assertEqual(Everything.test_int_out_utf8(''), 0) self.assertEqual(Everything.test_int_out_utf8('hello world'), 11) self.assertEqual(Everything.test_int_out_utf8('åäö'), 3) + def test_utf8_out_out(self): self.assertEqual(Everything.test_utf8_out_out(), ('first', 'second')) + + def test_utf8_out_nonconst_return(self): self.assertEqual(Everything.test_utf8_out_nonconst_return(), ('first', 'second')) def test_enum(self): @@ -342,7 +519,7 @@ class TestEverything(unittest.TestCase): Everything.test_int8() except TypeError: (e_type, e) = sys.exc_info()[:2] - self.assertEqual(e.args, ("test_int8() takes exactly 1 argument (0 given)",)) + self.assertEqual(e.args, ("Regress.test_int8() takes exactly 1 argument (0 given)",)) def test_gtypes(self): gchararray_gtype = GObject.type_from_name('gchararray') @@ -389,53 +566,87 @@ class TestEverything(unittest.TestCase): # test that there are no duplicates returned self.assertEqual(len(attr_list), len(set(attr_list))) - def test_array(self): + def test_array_int_in_empty(self): self.assertEqual(Everything.test_array_int_in([]), 0) + + def test_array_int_in(self): self.assertEqual(Everything.test_array_int_in([1, 5, -2]), 4) + + def test_array_int_out(self): self.assertEqual(Everything.test_array_int_out(), [0, 1, 2, 3, 4]) + + def test_array_int_full_out(self): self.assertEqual(Everything.test_array_int_full_out(), [0, 1, 2, 3, 4]) + + def test_array_int_none_out(self): self.assertEqual(Everything.test_array_int_none_out(), [1, 2, 3, 4, 5]) + + def test_array_int_inout(self): self.assertEqual(Everything.test_array_int_inout([1, 5, 42, -8]), [6, 43, -7]) - if sys.version_info >= (3, 0): - self.assertEqual(Everything.test_array_gint8_in(b'\x01\x03\x05'), 9) + def test_array_int_inout_empty(self): + self.assertEqual(Everything.test_array_int_inout([]), []) + + def test_array_gint8_in(self): + self.assertEqual(Everything.test_array_gint8_in(b'\x01\x03\x05'), 9) self.assertEqual(Everything.test_array_gint8_in([1, 3, 5, -50]), -41) + + def test_array_gint16_in(self): self.assertEqual(Everything.test_array_gint16_in([256, 257, -1000, 10000]), 9513) + + def test_array_gint32_in(self): self.assertEqual(Everything.test_array_gint32_in([30000, 1, -2]), 29999) + + def test_array_gint64_in(self): self.assertEqual(Everything.test_array_gint64_in([2 ** 33, 2 ** 34]), 2 ** 33 + 2 ** 34) + def test_array_gtype_in(self): self.assertEqual(Everything.test_array_gtype_in( [GObject.TYPE_STRING, GObject.TYPE_UINT64, GObject.TYPE_VARIANT]), '[gchararray,guint64,GVariant,]') - def test_array_fixed_size(self): + def test_array_fixed_size_int_in(self): # fixed length of 5 self.assertEqual(Everything.test_array_fixed_size_int_in([1, 2, -10, 5, 3]), 1) + + def test_array_fixed_size_int_in_error(self): self.assertRaises(ValueError, Everything.test_array_fixed_size_int_in, [1, 2, 3, 4]) self.assertRaises(ValueError, Everything.test_array_fixed_size_int_in, [1, 2, 3, 4, 5, 6]) + def test_array_fixed_size_int_out(self): self.assertEqual(Everything.test_array_fixed_size_int_out(), [0, 1, 2, 3, 4]) + + def test_array_fixed_size_int_return(self): self.assertEqual(Everything.test_array_fixed_size_int_return(), [0, 1, 2, 3, 4]) - def test_ptrarray(self): - # transfer container + def test_garray_container_return(self): + # GPtrArray transfer container result = Everything.test_garray_container_return() self.assertEqual(result, ['regress']) result = None - # transfer full + def test_garray_full_return(self): + # GPtrArray transfer full result = Everything.test_garray_full_return() self.assertEqual(result, ['regress']) result = None - def test_strv(self): + def test_strv_out(self): self.assertEqual(Everything.test_strv_out(), ['thanks', 'for', 'all', 'the', 'fish']) + + def test_strv_out_c(self): self.assertEqual(Everything.test_strv_out_c(), ['thanks', 'for', 'all', 'the', 'fish']) + + def test_strv_out_container(self): self.assertEqual(Everything.test_strv_out_container(), ['1', '2', '3']) + + def test_strv_outarg(self): self.assertEqual(Everything.test_strv_outarg(), ['1', '2', '3']) + def test_strv_in_gvalue(self): self.assertEqual(Everything.test_strv_in_gvalue(), ['one', 'two', 'three']) + def test_strv_in(self): Everything.test_strv_in(['1', '2', '3']) def test_glist(self): @@ -447,6 +658,12 @@ class TestEverything(unittest.TestCase): Everything.test_glist_nothing_in(['1', '2', '3']) Everything.test_glist_nothing_in2(['1', '2', '3']) + @unittest.skipUnless(hasattr(Everything, 'test_glist_gtype_container_in'), + 'Requires newer version of GI') + def test_glist_gtype(self): + Everything.test_glist_gtype_container_in( + [Everything.TestObj, Everything.TestSubObj]) + def test_gslist(self): self.assertEqual(Everything.test_gslist_nothing_return(), ['1', '2', '3']) self.assertEqual(Everything.test_gslist_nothing_return2(), ['1', '2', '3']) @@ -510,6 +727,7 @@ class TestEverything(unittest.TestCase): Everything.test_ghash_gvalue_in(data) data = None + @unittest.skipIf(platform.python_implementation() == "PyPy", "CPython only") def test_struct_gpointer(self): glist = GLib.List() raw = RawGList.from_wrapped(glist) @@ -540,13 +758,11 @@ class TestEverything(unittest.TestCase): (e_type, e_value, e_tb) = sys.exc_info() self.assertEqual(e_type, TypeError) self.assertTrue('TestBoxedPrivate' in str(e_value), str(e_value)) - self.assertTrue('override' in str(e_value), str(e_value)) self.assertTrue('constructor' in str(e_value), str(e_value)) tb = ''.join(traceback.format_exception(e_type, e_value, e_tb)) - self.assertTrue('tests/test_everything.py", line' in tb, tb) + self.assertTrue('test_everything.py", line' in tb, tb) -@unittest.skipUnless(has_cairo, 'built without cairo support') class TestNullableArgs(unittest.TestCase): def test_in_nullable_hash(self): Everything.test_ghash_null_in(None) @@ -584,7 +800,6 @@ class TestNullableArgs(unittest.TestCase): self.assertEqual(None, Everything.TestObj.null_out()) -@unittest.skipUnless(has_cairo, 'built without cairo support') class TestCallbacks(unittest.TestCase): called = False main_loop = GLib.MainLoop() @@ -610,7 +825,10 @@ class TestCallbacks(unittest.TestCase): # note that we do NOT expect the ZeroDivisionError to be propagated # through from the callback, as it crosses the Python<->C boundary # twice. (See GNOME #616279) - Everything.test_simple_callback(callback) + with capture_exceptions() as exc: + Everything.test_simple_callback(callback) + self.assertTrue(exc) + self.assertEqual(exc[0].type, ZeroDivisionError) def test_double_callback_exception(self): """ @@ -629,7 +847,10 @@ class TestCallbacks(unittest.TestCase): # note that we do NOT expect the ZeroDivisionError to be propagated # through from the callback, as it crosses the Python<->C boundary # twice. (See GNOME #616279) - Everything.test_simple_callback(callback) + with capture_exceptions() as exc: + Everything.test_simple_callback(callback) + self.assertTrue(exc) + self.assertEqual(exc[0].type, ZeroDivisionError) def test_return_value_callback(self): TestCallbacks.called = False @@ -650,14 +871,17 @@ class TestCallbacks(unittest.TestCase): TestCallbacks.called = True return 44 - ud_refcount = sys.getrefcount(ud) - callback_refcount = sys.getrefcount(callback) + if hasattr(sys, "getrefcount"): + ud_refcount = sys.getrefcount(ud) + callback_refcount = sys.getrefcount(callback) self.assertEqual(Everything.test_callback_async(callback, ud), None) # Callback should not have run and the ref count is increased by 1 self.assertEqual(TestCallbacks.called, False) - self.assertEqual(sys.getrefcount(callback), callback_refcount + 1) - self.assertEqual(sys.getrefcount(ud), ud_refcount + 1) + + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), callback_refcount + 1) + self.assertEqual(sys.getrefcount(ud), ud_refcount + 1) # test_callback_thaw_async will run the callback previously supplied. # references should be auto decremented after this call. @@ -665,8 +889,9 @@ class TestCallbacks(unittest.TestCase): self.assertTrue(TestCallbacks.called) # Make sure refcounts are returned to normal - self.assertEqual(sys.getrefcount(callback), callback_refcount) - self.assertEqual(sys.getrefcount(ud), ud_refcount) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), callback_refcount) + self.assertEqual(sys.getrefcount(ud), ud_refcount) def test_callback_scope_call_multi(self): # This tests a callback that gets called multiple times from a @@ -677,12 +902,15 @@ class TestCallbacks(unittest.TestCase): TestCallbacks.called += 1 return TestCallbacks.called - refcount = sys.getrefcount(callback) + if hasattr(sys, "getrefcount"): + refcount = sys.getrefcount(callback) result = Everything.test_multi_callback(callback) # first callback should give 1, second 2, and the function sums them up self.assertEqual(result, 3) self.assertEqual(TestCallbacks.called, 2) - self.assertEqual(sys.getrefcount(callback), refcount) + + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), refcount) def test_callback_scope_call_array(self): # This tests a callback that gets called multiple times from a @@ -695,13 +923,37 @@ class TestCallbacks(unittest.TestCase): TestCallbacks.callargs.append((one, two)) return len(TestCallbacks.callargs) - refcount = sys.getrefcount(callback) + if hasattr(sys, "getrefcount"): + refcount = sys.getrefcount(callback) result = Everything.test_array_callback(callback) # first callback should give 1, second 2, and the function sums them up self.assertEqual(result, 3) self.assertEqual(TestCallbacks.callargs, [([-1, 0, 1, 2], ['one', 'two', 'three'])] * 2) - self.assertEqual(sys.getrefcount(callback), refcount) + + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), refcount) + + @unittest.skipUnless(hasattr(Everything, 'test_array_inout_callback'), + 'Requires newer version of GI') + def test_callback_scope_call_array_inout(self): + # This tests a callback that gets called multiple times from a + # single scope call in python with inout array arguments + TestCallbacks.callargs = [] + + def callback(ints, ints_length): + TestCallbacks.callargs.append(ints) + return ints[1:], len(ints[1:]) + + if hasattr(sys, "getrefcount"): + refcount = sys.getrefcount(callback) + result = Everything.test_array_inout_callback(callback) + self.assertEqual(TestCallbacks.callargs, + [[-2, -1, 0, 1, 2], [-1, 0, 1, 2]]) + # first callback should give 4, second 3 + self.assertEqual(result, 3) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), refcount) def test_callback_userdata(self): TestCallbacks.called = 0 @@ -717,6 +969,99 @@ class TestCallbacks(unittest.TestCase): self.assertEqual(TestCallbacks.called, 100) + def test_callback_userdata_no_user_data(self): + TestCallbacks.called = 0 + + def callback(): + TestCallbacks.called += 1 + return TestCallbacks.called + + for i in range(100): + val = Everything.test_callback_user_data(callback) + self.assertEqual(val, i + 1) + + self.assertEqual(TestCallbacks.called, 100) + + def test_callback_userdata_varargs(self): + TestCallbacks.called = 0 + collected_user_data = [] + + def callback(a, b): + collected_user_data.extend([a, b]) + TestCallbacks.called += 1 + return TestCallbacks.called + + for i in range(10): + val = Everything.test_callback_user_data(callback, 1, 2) + self.assertEqual(val, i + 1) + + self.assertEqual(TestCallbacks.called, 10) + self.assertSequenceEqual(collected_user_data, [1, 2] * 10) + + def test_callback_userdata_as_kwarg_tuple(self): + TestCallbacks.called = 0 + collected_user_data = [] + + def callback(user_data): + collected_user_data.extend(user_data) + TestCallbacks.called += 1 + return TestCallbacks.called + + for i in range(10): + val = Everything.test_callback_user_data(callback, user_data=(1, 2)) + self.assertEqual(val, i + 1) + + self.assertEqual(TestCallbacks.called, 10) + self.assertSequenceEqual(collected_user_data, [1, 2] * 10) + + def test_callback_user_data_middle_none(self): + cb_info = {} + + def callback(userdata): + cb_info['called'] = True + cb_info['userdata'] = userdata + return 1 + + (y, z, q) = Everything.test_torture_signature_2( + 42, callback, None, 'some string', 3) + self.assertEqual(y, 42) + self.assertEqual(z, 84) + self.assertEqual(q, 14) + self.assertTrue(cb_info['called']) + self.assertEqual(cb_info['userdata'], None) + + def test_callback_user_data_middle_single(self): + cb_info = {} + + def callback(userdata): + cb_info['called'] = True + cb_info['userdata'] = userdata + return 1 + + (y, z, q) = Everything.test_torture_signature_2( + 42, callback, 'User Data', 'some string', 3) + self.assertEqual(y, 42) + self.assertEqual(z, 84) + self.assertEqual(q, 14) + self.assertTrue(cb_info['called']) + self.assertEqual(cb_info['userdata'], 'User Data') + + def test_callback_user_data_middle_tuple(self): + cb_info = {} + + def callback(userdata): + cb_info['called'] = True + cb_info['userdata'] = userdata + return 1 + + (y, z, q) = Everything.test_torture_signature_2( + 42, callback, (-5, 'User Data'), 'some string', 3) + self.assertEqual(y, 42) + self.assertEqual(z, 84) + self.assertEqual(q, 14) + self.assertTrue(cb_info['called']) + self.assertEqual(cb_info['userdata'], (-5, 'User Data')) + def test_async_ready_callback(self): TestCallbacks.called = False TestCallbacks.main_loop = GLib.MainLoop() @@ -740,8 +1085,9 @@ class TestCallbacks(unittest.TestCase): TestCallbacks.called += 1 return 33 - value_refcount = sys.getrefcount(ud) - callback_refcount = sys.getrefcount(callback) + if hasattr(sys, "getrefcount"): + value_refcount = sys.getrefcount(ud) + callback_refcount = sys.getrefcount(callback) # Callback is immediately called. for i in range(100): @@ -749,14 +1095,16 @@ class TestCallbacks(unittest.TestCase): self.assertEqual(res, 33) self.assertEqual(TestCallbacks.called, 100) - self.assertEqual(sys.getrefcount(callback), callback_refcount + 100) - self.assertEqual(sys.getrefcount(ud), value_refcount + 100) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), callback_refcount + 100) + self.assertEqual(sys.getrefcount(ud), value_refcount + 100) # thaw will call the callback again, this time resources should be freed self.assertEqual(Everything.test_callback_thaw_notifications(), 33 * 100) self.assertEqual(TestCallbacks.called, 200) - self.assertEqual(sys.getrefcount(callback), callback_refcount) - self.assertEqual(sys.getrefcount(ud), value_refcount) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), callback_refcount) + self.assertEqual(sys.getrefcount(ud), value_refcount) def test_callback_scope_notified_with_destroy_no_user_data(self): TestCallbacks.called = 0 @@ -766,7 +1114,8 @@ class TestCallbacks(unittest.TestCase): TestCallbacks.called += 1 return 34 - callback_refcount = sys.getrefcount(callback) + if hasattr(sys, "getrefcount"): + callback_refcount = sys.getrefcount(callback) # Run with warning as exception with warnings.catch_warnings(record=True) as w: @@ -776,7 +1125,8 @@ class TestCallbacks(unittest.TestCase): callback) self.assertEqual(TestCallbacks.called, 0) - self.assertEqual(sys.getrefcount(callback), callback_refcount) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), callback_refcount) # Run with warning as warning with warnings.catch_warnings(record=True) as w: @@ -791,13 +1141,15 @@ class TestCallbacks(unittest.TestCase): self.assertEqual(res, 34) self.assertEqual(TestCallbacks.called, 1) - self.assertEqual(sys.getrefcount(callback), callback_refcount + 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), callback_refcount + 1) # thaw will call the callback again, # refcount will not go down without user_data parameter self.assertEqual(Everything.test_callback_thaw_notifications(), 34) self.assertEqual(TestCallbacks.called, 2) - self.assertEqual(sys.getrefcount(callback), callback_refcount + 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(callback), callback_refcount + 1) def test_callback_in_methods(self): object_ = Everything.TestObj() @@ -875,7 +1227,6 @@ class TestCallbacks(unittest.TestCase): self.assertEqual(mydict, {'foo': 1, 'bar': 2, 'new': 42}) -@unittest.skipUnless(has_cairo, 'built without cairo support') class TestClosures(unittest.TestCase): def test_no_arg(self): def callback(): @@ -924,65 +1275,19 @@ class TestClosures(unittest.TestCase): def callback(variant): return 'no_variant' - # reset last error - sys.last_type = None - - # this does not directly raise an exception (see - # https://bugzilla.gnome.org/show_bug.cgi?id=616279) - result = Everything.test_closure_variant(callback, GLib.Variant('i', 42)) + with capture_exceptions() as exc: + # this does not directly raise an exception (see + # https://bugzilla.gnome.org/show_bug.cgi?id=616279) + result = Everything.test_closure_variant(callback, GLib.Variant('i', 42)) # ... but the result shouldn't be a string self.assertEqual(result, None) # and the error should be shown - self.assertEqual(sys.last_type, TypeError) - self.assertTrue('return value' in str(sys.last_value), sys.last_value) - - -@unittest.skipUnless(has_cairo, 'built without cairo support') -class TestProperties(unittest.TestCase): - - def test_basic(self): - object_ = Everything.TestObj() + self.assertEqual(len(exc), 1) + self.assertEqual(exc[0].type, TypeError) + self.assertTrue('return value' in str(exc[0].value), exc[0].value) - self.assertEqual(object_.props.int, 0) - object_.props.int = 42 - self.assertTrue(isinstance(object_.props.int, int)) - self.assertEqual(object_.props.int, 42) - - self.assertEqual(object_.props.float, 0.0) - object_.props.float = 42.42 - self.assertTrue(isinstance(object_.props.float, float)) - self.assertAlmostEqual(object_.props.float, 42.42, places=5) - - self.assertEqual(object_.props.double, 0.0) - object_.props.double = 42.42 - self.assertTrue(isinstance(object_.props.double, float)) - self.assertAlmostEqual(object_.props.double, 42.42, places=5) - - self.assertEqual(object_.props.string, None) - object_.props.string = 'mec' - self.assertTrue(isinstance(object_.props.string, str)) - self.assertEqual(object_.props.string, 'mec') - - self.assertEqual(object_.props.gtype, GObject.TYPE_INVALID) - object_.props.gtype = int - self.assertEqual(object_.props.gtype, GObject.TYPE_INT) - - def test_hash_table(self): - object_ = Everything.TestObj() - self.assertEqual(object_.props.hash_table, None) - - object_.props.hash_table = {'mec': 56} - self.assertTrue(isinstance(object_.props.hash_table, dict)) - self.assertEqual(list(object_.props.hash_table.items())[0], ('mec', 56)) - - def test_list(self): - object_ = Everything.TestObj() - self.assertEqual(object_.props.list, []) - - object_.props.list = ['1', '2', '3'] - self.assertTrue(isinstance(object_.props.list, list)) - self.assertEqual(object_.props.list, ['1', '2', '3']) +class TestBoxed(unittest.TestCase): def test_boxed(self): object_ = Everything.TestObj() self.assertEqual(object_.props.boxed, None) @@ -1014,6 +1319,15 @@ class TestProperties(unittest.TestCase): self.assertTrue(boxed42_2.equals(boxed42)) self.assertTrue(boxed42.equals(boxed42)) + def test_boxed_b_constructor(self): + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + boxed = Everything.TestBoxedB(42, 47) + self.assertTrue(issubclass(warn[0].category, DeprecationWarning)) + + self.assertEqual(boxed.some_int8, 0) + self.assertEqual(boxed.some_long, 0) + def test_boxed_c_equality(self): boxed = Everything.TestBoxedC() # TestBoxedC uses refcounting, so we know that @@ -1022,71 +1336,111 @@ class TestProperties(unittest.TestCase): self.assertEqual(boxed, copy) self.assertNotEqual(id(boxed), id(copy)) - def test_gtype(self): - object_ = Everything.TestObj() - self.assertEqual(object_.props.gtype, GObject.TYPE_INVALID) - object_.props.gtype = int - self.assertEqual(object_.props.gtype, GObject.TYPE_INT) - - object_ = Everything.TestObj(gtype=int) - self.assertEqual(object_.props.gtype, GObject.TYPE_INT) - object_.props.gtype = str - self.assertEqual(object_.props.gtype, GObject.TYPE_STRING) - - def test_parent_class(self): - class A(Everything.TestObj): - prop1 = GObject.Property(type=int) + def test_boxed_c_wrapper(self): + wrapper = Everything.TestBoxedCWrapper() + obj = wrapper.get() - a = A() - a.props.int = 20 - self.assertEqual(a.props.int, 20) + # TestBoxedC uses refcounting, so we know that + # it should be 2 at this point: + # - one owned by @wrapper + # - another owned by @obj + self.assertEqual(obj.refcount, 2) + del wrapper + gc.collect() + gc.collect() + self.assertEqual(obj.refcount, 1) + + def test_boxed_c_wrapper_copy(self): + wrapper = Everything.TestBoxedCWrapper() + wrapper_copy = wrapper.copy() + obj = wrapper.get() - # test parent property which needs introspection - a.props.list = ("str1", "str2") - self.assertEqual(a.props.list, ["str1", "str2"]) + # TestBoxedC uses refcounting, so we know that + # it should be 3 at this point: + # - one owned by @wrapper + # - one owned by @wrapper_copy + # - another owned by @obj + self.assertEqual(obj.refcount, 3) + del wrapper + gc.collect() + gc.collect() + self.assertEqual(obj.refcount, 2) + del wrapper_copy + gc.collect() + gc.collect() + self.assertEqual(obj.refcount, 1) + del obj + gc.collect() + gc.collect() + + def test_array_fixed_boxed_none_out(self): + arr = Everything.test_array_fixed_boxed_none_out() + assert len(arr) == 2 + assert arr[0].refcount == 2 + assert arr[1].refcount == 2 + + def test_gvalue_out_boxed(self): + # As corruption is random data, check several times. + for i in range(10): + int8 = random.randint(GLib.MININT8, GLib.MAXINT8) + assert Everything.test_gvalue_out_boxed(int8).some_int8 == int8 + + def test_glist_boxed_none_return(self): + assert len(Everything.test_glist_boxed_none_return(0)) == 0 + + list_ = Everything.test_glist_boxed_none_return(2) + assert len(list_) == 2 + assert list_[0].refcount == 2 + assert list_[1].refcount == 2 + + def test_glist_boxed_full_return(self): + assert len(Everything.test_glist_boxed_full_return(0)) == 0 + + list_ = Everything.test_glist_boxed_full_return(2) + assert len(list_) == 2 + assert list_[0].refcount == 1 + assert list_[1].refcount == 1 -@unittest.skipUnless(has_cairo, 'built without cairo support') class TestTortureProfile(unittest.TestCase): def test_torture_profile(self): - import time total_time = 0 print("") object_ = Everything.TestObj() sys.stdout.write("\ttorture test 1 (10000 iterations): ") - start_time = time.clock() + start_time = timeit.default_timer() for i in range(10000): (y, z, q) = object_.torture_signature_0(5000, "Torture Test 1", 12345) - end_time = time.clock() + end_time = timeit.default_timer() delta_time = end_time - start_time total_time += delta_time print("%f secs" % delta_time) sys.stdout.write("\ttorture test 2 (10000 iterations): ") - start_time = time.clock() + start_time = timeit.default_timer() for i in range(10000): (y, z, q) = Everything.TestObj().torture_signature_0( 5000, "Torture Test 2", 12345) - end_time = time.clock() + end_time = timeit.default_timer() delta_time = end_time - start_time total_time += delta_time print("%f secs" % delta_time) sys.stdout.write("\ttorture test 3 (10000 iterations): ") - start_time = time.clock() + start_time = timeit.default_timer() for i in range(10000): try: (y, z, q) = object_.torture_signature_1( 5000, "Torture Test 3", 12345) except: pass - end_time = time.clock() + end_time = timeit.default_timer() delta_time = end_time - start_time total_time += delta_time print("%f secs" % delta_time) @@ -1094,14 +1448,14 @@ class TestTortureProfile(unittest.TestCase): sys.stdout.write("\ttorture test 4 (10000 iterations): ") def callback(userdata): - pass + return 0 userdata = [1, 2, 3, 4] - start_time = time.clock() + start_time = timeit.default_timer() for i in range(10000): (y, z, q) = Everything.test_torture_signature_2( 5000, callback, userdata, "Torture Test 4", 12345) - end_time = time.clock() + end_time = timeit.default_timer() delta_time = end_time - start_time total_time += delta_time print("%f secs" % delta_time) @@ -1109,7 +1463,6 @@ class TestTortureProfile(unittest.TestCase): print("\tTotal: %f sec" % total_time) -@unittest.skipUnless(has_cairo, 'built without cairo support') class TestAdvancedInterfaces(unittest.TestCase): def test_array_objs(self): obj1, obj2 = Everything.test_array_fixed_out_objects() @@ -1132,135 +1485,3 @@ class TestAdvancedInterfaces(unittest.TestCase): ret = obj.skip_return_val_no_out(1) self.assertEqual(ret, None) - - -@unittest.skipUnless(has_cairo, 'built without cairo support') -class TestSignals(unittest.TestCase): - def test_object_param_signal(self): - obj = Everything.TestObj() - - def callback(obj, obj_param): - self.assertEqual(obj_param.props.int, 3) - self.assertGreater(obj_param.__grefcount__, 1) - obj.called = True - - obj.called = False - obj.connect('sig-with-obj', callback) - obj.emit_sig_with_obj() - self.assertTrue(obj.called) - - def test_connect_after(self): - obj = Everything.TestObj() - - def callback(obj, obj_param): - obj.called = True - - obj.called = False - obj.connect_after('sig-with-obj', callback) - obj.emit_sig_with_obj() - self.assertTrue(obj.called) - - def test_connect_object(self): - obj = Everything.TestObj() - - def callback(obj, obj_param): - obj.called = True - - obj.called = False - obj.connect_object('sig-with-obj', callback, obj) - obj.emit_sig_with_obj() - self.assertTrue(obj.called) - - def test_connect_object_after(self): - obj = Everything.TestObj() - - def callback(obj, obj_param): - obj.called = True - - obj.called = False - obj.connect_object_after('sig-with-obj', callback, obj) - obj.emit_sig_with_obj() - self.assertTrue(obj.called) - - def test_int64_param_from_py(self): - obj = Everything.TestObj() - - def callback(obj, i): - obj.callback_i = i - return i - - obj.callback_i = None - obj.connect('sig-with-int64-prop', callback) - rv = obj.emit('sig-with-int64-prop', GObject.G_MAXINT64) - self.assertEqual(rv, GObject.G_MAXINT64) - self.assertEqual(obj.callback_i, GObject.G_MAXINT64) - - def test_uint64_param_from_py(self): - obj = Everything.TestObj() - - def callback(obj, i): - obj.callback_i = i - return i - - obj.callback_i = None - obj.connect('sig-with-uint64-prop', callback) - rv = obj.emit('sig-with-uint64-prop', GObject.G_MAXUINT64) - self.assertEqual(rv, GObject.G_MAXUINT64) - self.assertEqual(obj.callback_i, GObject.G_MAXUINT64) - - def test_int64_param_from_c(self): - obj = Everything.TestObj() - - def callback(obj, i): - obj.callback_i = i - return i - - obj.callback_i = None - - obj.connect('sig-with-int64-prop', callback) - obj.emit_sig_with_int64() - self.assertEqual(obj.callback_i, GObject.G_MAXINT64) - - def test_uint64_param_from_c(self): - obj = Everything.TestObj() - - def callback(obj, i): - obj.callback_i = i - return i - - obj.callback_i = None - - obj.connect('sig-with-uint64-prop', callback) - obj.emit_sig_with_uint64() - self.assertEqual(obj.callback_i, GObject.G_MAXUINT64) - - def test_intarray_ret(self): - obj = Everything.TestObj() - - def callback(obj, i): - obj.callback_i = i - return [i, i + 1] - - obj.callback_i = None - - try: - obj.connect('sig-with-intarray-ret', callback) - except TypeError as e: - # compat with g-i 1.34.x - if 'unknown signal' in str(e): - return - raise - - rv = obj.emit('sig-with-intarray-ret', 42) - self.assertEqual(obj.callback_i, 42) - self.assertEqual(type(rv), GLib.Array) - self.assertEqual(rv.len, 2) - - -@unittest.skipUnless(has_cairo, 'built without cairo support') -@unittest.skipUnless(Gtk, 'Gtk not available') -class TestPango(unittest.TestCase): - def test_cairo_font_options(self): - screen = Gtk.Window().get_screen() - font_opts = screen.get_font_options() - self.assertEqual(type(font_opts.get_subpixel_order()), int) diff --git a/tests/test_fields.py b/tests/test_fields.py new file mode 100644 index 0000000..b9a06e2 --- /dev/null +++ b/tests/test_fields.py @@ -0,0 +1,185 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- + +import math +import unittest + +from gi.repository import GLib +from gi.repository import Regress +from gi.repository import GIMarshallingTests + + +class Number(object): + + def __init__(self, value): + self.value = value + + def __int__(self): + return int(self.value) + + def __float__(self): + return float(self.value) + + +class TestFields(unittest.TestCase): + + def test_int8(self): + s = Regress.TestStructA() + s.some_int8 = 21 + self.assertEqual(s.some_int8, 21) + + s.some_int8 = b"\x42" + self.assertEqual(s.some_int8, 0x42) + + self.assertRaises(TypeError, setattr, s, "some_int8", b"ab") + self.assertRaises(TypeError, setattr, s, "some_int8", None) + self.assertRaises(OverflowError, setattr, s, "some_int8", 128) + self.assertRaises(OverflowError, setattr, s, "some_int8", -129) + + s.some_int8 = 3.6 + self.assertEqual(s.some_int8, 3) + + s.some_int8 = Number(55) + self.assertEqual(s.some_int8, 55) + + def test_int(self): + s = Regress.TestStructA() + s.some_int = GLib.MAXINT + self.assertEqual(s.some_int, GLib.MAXINT) + + self.assertRaises(TypeError, setattr, s, "some_int", b"a") + self.assertRaises(TypeError, setattr, s, "some_int", None) + self.assertRaises( + OverflowError, setattr, s, "some_int", GLib.MAXINT + 1) + self.assertRaises( + OverflowError, setattr, s, "some_int", GLib.MININT - 1) + + s.some_int = 3.6 + self.assertEqual(s.some_int, 3) + + s.some_int = Number(GLib.MININT) + self.assertEqual(s.some_int, GLib.MININT) + + def test_long(self): + s = GIMarshallingTests.SimpleStruct() + s.long_ = GLib.MAXLONG + self.assertEqual(s.long_, GLib.MAXLONG) + + self.assertRaises(TypeError, setattr, s, "long_", b"a") + self.assertRaises(TypeError, setattr, s, "long_", None) + self.assertRaises(OverflowError, setattr, s, "long_", GLib.MAXLONG + 1) + self.assertRaises(OverflowError, setattr, s, "long_", GLib.MINLONG - 1) + + s.long_ = 3.6 + self.assertEqual(s.long_, 3) + + s.long_ = Number(GLib.MINLONG) + self.assertEqual(s.long_, GLib.MINLONG) + + def test_double(self): + s = Regress.TestStructA() + s.some_double = GLib.MAXDOUBLE + self.assertEqual(s.some_double, GLib.MAXDOUBLE) + s.some_double = GLib.MINDOUBLE + self.assertEqual(s.some_double, GLib.MINDOUBLE) + + s.some_double = float("nan") + self.assertTrue(math.isnan(s.some_double)) + + self.assertRaises(TypeError, setattr, s, "some_double", b"a") + self.assertRaises(TypeError, setattr, s, "some_double", None) + + def test_gtype(self): + s = Regress.TestStructE() + + s.some_type = Regress.TestObj + self.assertEqual(s.some_type, Regress.TestObj.__gtype__) + + self.assertRaises(TypeError, setattr, s, "some_type", 42) + + def test_unichar(self): + # I can't find a unichar field.. + pass + + def test_utf8(self): + s = GIMarshallingTests.BoxedStruct() + s.string_ = "hello" + self.assertEqual(s.string_, "hello") + + s.string_ = u"hello" + self.assertEqual(s.string_, u"hello") + + s.string_ = None + self.assertEqual(s.string_, None) + + self.assertRaises(TypeError, setattr, s, "string_", 42) + + def test_array_of_structs(self): + s = Regress.TestStructD() + self.assertEqual(s.array1, []) + self.assertEqual(s.array2, []) + + def test_interface(self): + s = Regress.TestStructC() + + obj = Regress.TestObj() + s.obj = obj + self.assertTrue(s.obj is obj) + + s.obj = None + self.assertTrue(s.obj is None) + + self.assertRaises(TypeError, setattr, s, "obj", object()) + + def test_glist(self): + s = Regress.TestStructD() + self.assertEqual(s.list, []) + + self.assertRaises(TypeError, setattr, s, "list", [object()]) + + def test_gpointer(self): + glist = GLib.List() + + glist.data = 123 + self.assertEqual(glist.data, 123) + + glist.data = None + self.assertEqual(glist.data, 0) + + def test_gptrarray(self): + s = Regress.TestStructD() + self.assertEqual(s.garray, []) + + self.assertRaises(TypeError, setattr, s, "garray", [object()]) + + def test_enum(self): + s = Regress.TestStructA() + + s.some_enum = Regress.TestEnum.VALUE3 + self.assertEqual(s.some_enum, Regress.TestEnum.VALUE3) + + self.assertRaises(TypeError, setattr, s, "some_enum", object()) + + s.some_enum = 0 + self.assertEqual(s.some_enum, Regress.TestEnum.VALUE1) + + def test_union(self): + s = Regress.TestStructE() + self.assertEqual(s.some_union, [None, None]) + + def test_struct(self): + s = GIMarshallingTests.NestedStruct() + + # FIXME: segfaults + # https://bugzilla.gnome.org/show_bug.cgi?id=747002 + # s.simple_struct = None + + self.assertRaises(TypeError, setattr, s, "simple_struct", object()) + + sub = GIMarshallingTests.SimpleStruct() + sub.long_ = 42 + s.simple_struct = sub + self.assertEqual(s.simple_struct.long_, 42) + + def test_ghashtable(self): + obj = Regress.TestObj() + self.assertTrue(obj.hash_table is None) diff --git a/tests/test_gdbus.py b/tests/test_gdbus.py index 805633a..6c9afb0 100644 --- a/tests/test_gdbus.py +++ b/tests/test_gdbus.py @@ -7,6 +7,44 @@ from gi.repository import GLib from gi.repository import Gio +try: + Gio.bus_get_sync(Gio.BusType.SESSION, None) +except GLib.Error: + has_dbus = False +else: + has_dbus = True + + +class TestDBusNodeInfo(unittest.TestCase): + + def test_new_for_xml(self): + info = Gio.DBusNodeInfo.new_for_xml(""" + + + + + + + + +""") + + interfaces = info.interfaces + del info + assert len(interfaces) == 1 + assert interfaces[0].name == "org.freedesktop.DBus.Introspectable" + methods = interfaces[0].methods + del interfaces + assert len(methods) == 1 + assert methods[0].name == "Introspect" + out_args = methods[0].out_args + assert len(out_args) + del methods + assert out_args[0].name == "data" + + +@unittest.skipUnless(has_dbus, "no dbus running") class TestGDBusClient(unittest.TestCase): def setUp(self): self.bus = Gio.bus_get_sync(Gio.BusType.SESSION, None) @@ -208,3 +246,10 @@ class TestGDBusClient(unittest.TestCase): self.assertTrue(isinstance(data['error'], Exception)) self.assertTrue('InvalidArgs' in str(data['error']), str(data['error'])) + + def test_instantiate_custom_proxy(self): + class SomeProxy(Gio.DBusProxy): + def __init__(self): + Gio.DBusProxy.__init__(self) + + SomeProxy() diff --git a/tests/test_generictreemodel.py b/tests/test_generictreemodel.py index 9fa89ff..ab31579 100644 --- a/tests/test_generictreemodel.py +++ b/tests/test_generictreemodel.py @@ -15,22 +15,26 @@ # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -# USA - +# License along with this library; if not, see . # system import gc import sys import weakref import unittest +import platform # pygobject from gi.repository import GObject -from gi.repository import Gtk -from pygtkcompat.generictreemodel import GenericTreeModel -from pygtkcompat.generictreemodel import _get_user_data_as_pyobject + +try: + from gi.repository import Gtk + from pygtkcompat.generictreemodel import GenericTreeModel + from pygtkcompat.generictreemodel import _get_user_data_as_pyobject + has_gtk = True +except ImportError: + GenericTreeModel = object + has_gtk = False class Node(object): @@ -51,9 +55,9 @@ class Node(object): return 'Node("%s", %s)' % (self.name, self.value) -class TesterModel(GenericTreeModel): +class ATesterModel(GenericTreeModel): def __init__(self): - super(TesterModel, self).__init__() + super(ATesterModel, self).__init__() self.root = Node('root', 0, Node('spam', 1, Node('sushi', 2), @@ -127,10 +131,12 @@ class TesterModel(GenericTreeModel): return child.parent() +@unittest.skipUnless(has_gtk, 'Gtk not available') class TestReferences(unittest.TestCase): def setUp(self): pass + @unittest.skipIf(platform.python_implementation() == "PyPy", "not with PyPy") def test_c_tree_iter_user_data_as_pyobject(self): obj = object() obj_id = id(obj) @@ -145,27 +151,31 @@ class TestReferences(unittest.TestCase): self.assertEqual(sys.getrefcount(obj), ref_count + 1) def test_leak_references_on(self): - model = TesterModel() + model = ATesterModel() obj_ref = weakref.ref(model.root) # Initial refcount is 1 for model.root + the temporary - self.assertEqual(sys.getrefcount(model.root), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 2) # Iter increases by 1 do to assignment to iter.user_data res, it = model.do_get_iter([0]) self.assertEqual(id(model.root), it.user_data) - self.assertEqual(sys.getrefcount(model.root), 3) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 3) # Verify getting a TreeIter more then once does not further increase # the ref count. res2, it2 = model.do_get_iter([0]) self.assertEqual(id(model.root), it2.user_data) - self.assertEqual(sys.getrefcount(model.root), 3) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 3) # Deleting the iter does not decrease refcount because references # leak by default (they are stored in the held_refs pool) del it gc.collect() - self.assertEqual(sys.getrefcount(model.root), 3) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 3) # Deleting a model should free all held references to user data # stored by TreeIters @@ -174,20 +184,23 @@ class TestReferences(unittest.TestCase): self.assertEqual(obj_ref(), None) def test_row_deleted_frees_refs(self): - model = TesterModel() + model = ATesterModel() obj_ref = weakref.ref(model.root) # Initial refcount is 1 for model.root + the temporary - self.assertEqual(sys.getrefcount(model.root), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 2) # Iter increases by 1 do to assignment to iter.user_data res, it = model.do_get_iter([0]) self.assertEqual(id(model.root), it.user_data) - self.assertEqual(sys.getrefcount(model.root), 3) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 3) # Notifying the underlying model of a row_deleted should decrease the # ref count. model.row_deleted(Gtk.TreePath('0'), model.root) - self.assertEqual(sys.getrefcount(model.root), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 2) # Finally deleting the actual object should collect it completely del model.root @@ -195,23 +208,26 @@ class TestReferences(unittest.TestCase): self.assertEqual(obj_ref(), None) def test_leak_references_off(self): - model = TesterModel() + model = ATesterModel() model.leak_references = False obj_ref = weakref.ref(model.root) # Initial refcount is 1 for model.root + the temporary - self.assertEqual(sys.getrefcount(model.root), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 2) # Iter does not increas count by 1 when leak_references is false res, it = model.do_get_iter([0]) self.assertEqual(id(model.root), it.user_data) - self.assertEqual(sys.getrefcount(model.root), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 2) # Deleting the iter does not decrease refcount because assigning user_data # eats references and does not release them. del it gc.collect() - self.assertEqual(sys.getrefcount(model.root), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(model.root), 2) # Deleting the model decreases the final ref, and the object is collected del model @@ -221,7 +237,7 @@ class TestReferences(unittest.TestCase): def test_iteration_refs(self): # Pull iterators off the model using the wrapped C API which will # then call back into the python overrides. - model = TesterModel() + model = ATesterModel() nodes = [node for node in model.iter_depth_first()] values = [node.value for node in nodes] @@ -236,14 +252,16 @@ class TestReferences(unittest.TestCase): # 4 - ref held by the root/children graph itself # 5 - ref held by the model "held_refs" instance var for node in nodes: - self.assertEqual(sys.getrefcount(node), 5) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(node), 5) # A second iteration and storage of the nodes in a new list # should only increase refcounts by 1 even though new # iterators are created and assigned. nodes2 = [node for node in model.iter_depth_first()] for node in nodes2: - self.assertEqual(sys.getrefcount(node), 6) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(node), 6) # Hold weak refs and start verifying ref collection. node_refs = [weakref.ref(node) for node in nodes] @@ -252,14 +270,16 @@ class TestReferences(unittest.TestCase): del nodes2 gc.collect() for node in nodes: - self.assertEqual(sys.getrefcount(node), 5) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(node), 5) # Second round of collection, no more local lists of nodes. del nodes gc.collect() for ref in node_refs: node = ref() - self.assertEqual(sys.getrefcount(node), 4) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(node), 4) # Using invalidate_iters or row_deleted(path, node) will clear out # the pooled refs held internal to the GenericTreeModel implementation. @@ -268,7 +288,8 @@ class TestReferences(unittest.TestCase): gc.collect() for ref in node_refs: node = ref() - self.assertEqual(sys.getrefcount(node), 3) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(node), 3) # Deleting the root node at this point should allow all nodes to be collected # as there is no longer a way to reach the children @@ -279,9 +300,10 @@ class TestReferences(unittest.TestCase): self.assertEqual(ref(), None) +@unittest.skipUnless(has_gtk, 'Gtk not available') class TestIteration(unittest.TestCase): def test_iter_next_root(self): - model = TesterModel() + model = ATesterModel() it = model.get_iter([0]) self.assertEqual(it.user_data, id(model.root)) self.assertEqual(model.root.next, None) @@ -290,7 +312,7 @@ class TestIteration(unittest.TestCase): self.assertEqual(it, None) def test_iter_next_multiple(self): - model = TesterModel() + model = ATesterModel() it = model.get_iter([0, 0]) self.assertEqual(it.user_data, id(model.root.children[0])) @@ -306,6 +328,7 @@ class ErrorModel(GenericTreeModel): pass +@unittest.skipUnless(has_gtk, 'Gtk not available') class ExceptHook(object): """ Temporarily installs an exception hook in a context which @@ -337,6 +360,7 @@ class ExceptHook(object): assert issubclass(got, expected), error_message +@unittest.skipUnless(has_gtk, 'Gtk not available') class TestReturnsAfterError(unittest.TestCase): def setUp(self): self.model = ErrorModel() @@ -352,7 +376,7 @@ class TestReturnsAfterError(unittest.TestCase): self.assertEqual(count, 0) def test_get_column_type(self): - with ExceptHook(NotImplementedError, TypeError): + with ExceptHook(NotImplementedError, ValueError): col_type = self.model.get_column_type(0) self.assertEqual(col_type, GObject.TYPE_INVALID) @@ -406,6 +430,3 @@ class TestReturnsAfterError(unittest.TestCase): with ExceptHook(NotImplementedError): res = self.model.iter_parent(child) self.assertEqual(res, None) - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_gi.py b/tests/test_gi.py index c47ac57..261d8b2 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -1,5 +1,4 @@ # -*- Mode: Python; py-indent-offset: 4 -*- -# coding=utf-8 # vim: tabstop=4 shiftwidth=4 expandtab import sys @@ -8,29 +7,25 @@ import unittest import tempfile import shutil import os -import locale -import subprocess import gc import weakref import warnings -from io import StringIO, BytesIO +import pickle +import platform import gi +import gi.overrides +from gi import PyGIWarning +from gi import PyGIDeprecationWarning from gi.repository import GObject, GLib, Gio - from gi.repository import GIMarshallingTests +import pytest -from compathelper import _bytes, _unicode +from .helper import capture_exceptions, capture_output -if sys.version_info < (3, 0): - CONSTANT_UTF8 = "const \xe2\x99\xa5 utf8" - PY2_UNICODE_UTF8 = unicode(CONSTANT_UTF8, 'UTF-8') - CHAR_255 = '\xff' -else: - CONSTANT_UTF8 = "const ♥ utf8" - CHAR_255 = bytes([255]) -CONSTANT_NUMBER = 42 +CONSTANT_UTF8 = "const ♥ utf8" +CONSTANT_UCS4 = u"const ♥ utf8" class Number(object): @@ -59,12 +54,11 @@ class Sequence(object): class TestConstant(unittest.TestCase): -# Blocked by https://bugzilla.gnome.org/show_bug.cgi?id=595773 -# def test_constant_utf8(self): -# self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8) + def test_constant_utf8(self): + self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8) def test_constant_number(self): - self.assertEqual(CONSTANT_NUMBER, GIMarshallingTests.CONSTANT_NUMBER) + self.assertEqual(42, GIMarshallingTests.CONSTANT_NUMBER) def test_min_max_int(self): self.assertEqual(GLib.MAXINT32, 2 ** 31 - 1) @@ -89,6 +83,11 @@ class TestBoolean(unittest.TestCase): GIMarshallingTests.boolean_in_true(1) GIMarshallingTests.boolean_in_false(0) + def test_boolean_in_other_types(self): + GIMarshallingTests.boolean_in_true([""]) + GIMarshallingTests.boolean_in_false([]) + GIMarshallingTests.boolean_in_false(None) + def test_boolean_out(self): self.assertEqual(True, GIMarshallingTests.boolean_out_true()) self.assertEqual(False, GIMarshallingTests.boolean_out_false()) @@ -100,8 +99,8 @@ class TestBoolean(unittest.TestCase): class TestInt8(unittest.TestCase): - MAX = GObject.G_MAXINT8 - MIN = GObject.G_MININT8 + MAX = GLib.MAXINT8 + MIN = GLib.MININT8 def test_int8_return(self): self.assertEqual(self.MAX, GIMarshallingTests.int8_return_max()) @@ -133,7 +132,7 @@ class TestInt8(unittest.TestCase): class TestUInt8(unittest.TestCase): - MAX = GObject.G_MAXUINT8 + MAX = GLib.MAXUINT8 def test_uint8_return(self): self.assertEqual(self.MAX, GIMarshallingTests.uint8_return()) @@ -142,7 +141,7 @@ class TestUInt8(unittest.TestCase): number = Number(self.MAX) GIMarshallingTests.uint8_in(number) - GIMarshallingTests.uint8_in(CHAR_255) + GIMarshallingTests.uint8_in(b'\xff') number.value += 1 self.assertRaises(OverflowError, GIMarshallingTests.uint8_in, number) @@ -159,8 +158,8 @@ class TestUInt8(unittest.TestCase): class TestInt16(unittest.TestCase): - MAX = GObject.G_MAXINT16 - MIN = GObject.G_MININT16 + MAX = GLib.MAXINT16 + MIN = GLib.MININT16 def test_int16_return(self): self.assertEqual(self.MAX, GIMarshallingTests.int16_return_max()) @@ -192,7 +191,7 @@ class TestInt16(unittest.TestCase): class TestUInt16(unittest.TestCase): - MAX = GObject.G_MAXUINT16 + MAX = GLib.MAXUINT16 def test_uint16_return(self): self.assertEqual(self.MAX, GIMarshallingTests.uint16_return()) @@ -218,8 +217,8 @@ class TestUInt16(unittest.TestCase): class TestInt32(unittest.TestCase): - MAX = GObject.G_MAXINT32 - MIN = GObject.G_MININT32 + MAX = GLib.MAXINT32 + MIN = GLib.MININT32 def test_int32_return(self): self.assertEqual(self.MAX, GIMarshallingTests.int32_return_max()) @@ -251,7 +250,7 @@ class TestInt32(unittest.TestCase): class TestUInt32(unittest.TestCase): - MAX = GObject.G_MAXUINT32 + MAX = GLib.MAXUINT32 def test_uint32_return(self): self.assertEqual(self.MAX, GIMarshallingTests.uint32_return()) @@ -336,8 +335,8 @@ class TestUInt64(unittest.TestCase): class TestShort(unittest.TestCase): - MAX = GObject.G_MAXSHORT - MIN = GObject.G_MINSHORT + MAX = GLib.MAXSHORT + MIN = GLib.MINSHORT def test_short_return(self): self.assertEqual(self.MAX, GIMarshallingTests.short_return_max()) @@ -369,7 +368,7 @@ class TestShort(unittest.TestCase): class TestUShort(unittest.TestCase): - MAX = GObject.G_MAXUSHORT + MAX = GLib.MAXUSHORT def test_ushort_return(self): self.assertEqual(self.MAX, GIMarshallingTests.ushort_return()) @@ -395,8 +394,8 @@ class TestUShort(unittest.TestCase): class TestInt(unittest.TestCase): - MAX = GObject.G_MAXINT - MIN = GObject.G_MININT + MAX = GLib.MAXINT + MIN = GLib.MININT def test_int_return(self): self.assertEqual(self.MAX, GIMarshallingTests.int_return_max()) @@ -424,12 +423,12 @@ class TestInt(unittest.TestCase): def test_int_inout(self): self.assertEqual(self.MIN, GIMarshallingTests.int_inout_max_min(Number(self.MAX))) self.assertEqual(self.MAX, GIMarshallingTests.int_inout_min_max(Number(self.MIN))) - self.assertRaises(TypeError, GIMarshallingTests.int_inout_min_max, Number(self.MIN), CONSTANT_NUMBER) + self.assertRaises(TypeError, GIMarshallingTests.int_inout_min_max, Number(self.MIN), 42) class TestUInt(unittest.TestCase): - MAX = GObject.G_MAXUINT + MAX = GLib.MAXUINT def test_uint_return(self): self.assertEqual(self.MAX, GIMarshallingTests.uint_return()) @@ -455,8 +454,8 @@ class TestUInt(unittest.TestCase): class TestLong(unittest.TestCase): - MAX = GObject.G_MAXLONG - MIN = GObject.G_MINLONG + MAX = GLib.MAXLONG + MIN = GLib.MINLONG def test_long_return(self): self.assertEqual(self.MAX, GIMarshallingTests.long_return_max()) @@ -488,7 +487,7 @@ class TestLong(unittest.TestCase): class TestULong(unittest.TestCase): - MAX = GObject.G_MAXULONG + MAX = GLib.MAXULONG def test_ulong_return(self): self.assertEqual(self.MAX, GIMarshallingTests.ulong_return()) @@ -514,8 +513,8 @@ class TestULong(unittest.TestCase): class TestSSize(unittest.TestCase): - MAX = GObject.G_MAXLONG - MIN = GObject.G_MINLONG + MAX = GLib.MAXSSIZE + MIN = GLib.MINSSIZE def test_ssize_return(self): self.assertEqual(self.MAX, GIMarshallingTests.ssize_return_max()) @@ -547,7 +546,7 @@ class TestSSize(unittest.TestCase): class TestSize(unittest.TestCase): - MAX = GObject.G_MAXULONG + MAX = GLib.MAXSIZE def test_size_return(self): self.assertEqual(self.MAX, GIMarshallingTests.size_return()) @@ -589,8 +588,8 @@ class TestTimet(unittest.TestCase): class TestFloat(unittest.TestCase): - MAX = GObject.G_MAXFLOAT - MIN = GObject.G_MINFLOAT + MAX = GLib.MAXFLOAT + MIN = GLib.MINFLOAT def test_float_return(self): self.assertAlmostEqual(self.MAX, GIMarshallingTests.float_return()) @@ -609,8 +608,8 @@ class TestFloat(unittest.TestCase): class TestDouble(unittest.TestCase): - MAX = GObject.G_MAXDOUBLE - MIN = GObject.G_MINDOUBLE + MAX = GLib.MAXDOUBLE + MIN = GLib.MINDOUBLE def test_double_return(self): self.assertAlmostEqual(self.MAX, GIMarshallingTests.double_return()) @@ -636,8 +635,13 @@ class TestGType(unittest.TestCase): def check_readonly(gtype): gtype.name = "foo" - self.assertRaises(AttributeError, check_readonly, GObject.TYPE_NONE) - self.assertRaises(AttributeError, check_readonly, GObject.TYPE_STRING) + errors = (AttributeError,) + if platform.python_implementation() == "PyPy": + # https://foss.heptapod.net/pypy/pypy/-/issues/2788 + errors = (AttributeError, TypeError) + + self.assertRaises(errors, check_readonly, GObject.TYPE_NONE) + self.assertRaises(errors, check_readonly, GObject.TYPE_STRING) def test_gtype_return(self): self.assertEqual(GObject.TYPE_NONE, GIMarshallingTests.gtype_return()) @@ -659,18 +663,29 @@ class TestGType(unittest.TestCase): class TestUtf8(unittest.TestCase): + def test_utf8_as_uint8array_in(self): + data = CONSTANT_UTF8 + if not isinstance(data, bytes): + data = data.encode("utf-8") + GIMarshallingTests.utf8_as_uint8array_in(data) + def test_utf8_none_return(self): self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.utf8_none_return()) def test_utf8_full_return(self): self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.utf8_full_return()) + def test_extra_utf8_full_return_invalid(self): + with pytest.raises(UnicodeDecodeError): + GIMarshallingTests.extra_utf8_full_return_invalid() + + def test_extra_utf8_full_out_invalid(self): + with pytest.raises(UnicodeDecodeError): + GIMarshallingTests.extra_utf8_full_out_invalid() + def test_utf8_none_in(self): GIMarshallingTests.utf8_none_in(CONSTANT_UTF8) - if sys.version_info < (3, 0): - GIMarshallingTests.utf8_none_in(PY2_UNICODE_UTF8) - - self.assertRaises(TypeError, GIMarshallingTests.utf8_none_in, CONSTANT_NUMBER) + self.assertRaises(TypeError, GIMarshallingTests.utf8_none_in, 42) self.assertRaises(TypeError, GIMarshallingTests.utf8_none_in, None) def test_utf8_none_out(self): @@ -696,8 +711,19 @@ class TestFilename(unittest.TestCase): def tearDown(self): shutil.rmtree(self.workdir) + def tests_filename_list_return(self): + assert GIMarshallingTests.filename_list_return() == [] + + @unittest.skipIf(os.name == "nt", "fixme") def test_filename_in(self): - fname = os.path.join(self.workdir, _unicode('testäø.txt')) + fname = os.path.join(self.workdir, u'testäø.txt') + + try: + os.path.exists(fname) + except ValueError: + # non-unicode fs encoding + return + self.assertRaises(GLib.GError, GLib.file_get_contents, fname) with open(fname.encode('UTF-8'), 'wb') as f: @@ -707,21 +733,197 @@ class TestFilename(unittest.TestCase): self.assertEqual(result, True) self.assertEqual(contents, b'hello world!\n\x01\x02') + def test_filename_in_nullable(self): + self.assertTrue(GIMarshallingTests.filename_copy(None) is None) + self.assertRaises(TypeError, GIMarshallingTests.filename_exists, None) + + @unittest.skipIf(os.name == "nt", "fixme") def test_filename_out(self): self.assertRaises(GLib.GError, GLib.Dir.make_tmp, 'test') + name = 'testäø.XXXXXX' - dirname = GLib.Dir.make_tmp('testäø.XXXXXX') - self.assertTrue('/testäø.' in dirname, dirname) - dirname = _bytes(dirname) + try: + os.path.exists(name) + except ValueError: + # non-unicode fs encoding + return + + dirname = GLib.Dir.make_tmp(name) + self.assertTrue(os.path.sep + 'testäø.' in dirname, dirname) self.assertTrue(os.path.isdir(dirname)) os.rmdir(dirname) - def test_filename_type_error(self): - self.assertRaises(TypeError, GLib.file_get_contents, 23) + def test_wrong_types(self): + self.assertRaises(TypeError, GIMarshallingTests.filename_copy, 23) + self.assertRaises(TypeError, GIMarshallingTests.filename_copy, []) + + def test_null(self): + self.assertTrue(GIMarshallingTests.filename_copy(None) is None) + self.assertRaises(TypeError, GIMarshallingTests.filename_exists, None) + + def test_round_trip(self): + self.assertEqual(GIMarshallingTests.filename_copy(u"foo"), "foo") + self.assertEqual(GIMarshallingTests.filename_copy(b"foo"), "foo") + + def test_contains_null(self): + self.assertRaises( + (ValueError, TypeError), + GIMarshallingTests.filename_copy, b"foo\x00") + self.assertRaises( + (ValueError, TypeError), + GIMarshallingTests.filename_copy, u"foo\x00") + + def test_win32_surrogates(self): + if os.name != "nt": + return + + copy = GIMarshallingTests.filename_copy + glib_repr = GIMarshallingTests.filename_to_glib_repr + + self.assertEqual(copy(u"\ud83d"), u"\ud83d") + self.assertEqual(copy(u"\x61\uDC00"), u"\x61\uDC00") + self.assertEqual(copy(u"\uD800\uDC01"), u"\U00010001") + self.assertEqual(copy(u"\uD83D\x20\uDCA9"), u"\uD83D\x20\uDCA9") + + self.assertEqual(glib_repr(u"\ud83d"), b"\xed\xa0\xbd") + self.assertEqual(glib_repr(u"\uD800\uDC01"), b"\xf0\x90\x80\x81") + + self.assertEqual( + glib_repr(u"\uD800\uDBFF"), b"\xED\xA0\x80\xED\xAF\xBF") + self.assertEqual( + glib_repr(u"\uD800\uE000"), b"\xED\xA0\x80\xEE\x80\x80") + self.assertEqual( + glib_repr(u"\uD7FF\uDC00"), b"\xED\x9F\xBF\xED\xB0\x80") + self.assertEqual(glib_repr(u"\x61\uDC00"), b"\x61\xED\xB0\x80") + self.assertEqual(glib_repr(u"\uDC00"), b"\xED\xB0\x80") + + def test_win32_bytes_py3(self): + if not (os.name == "nt"): + return + + values = [ + b"foo", + b"\xff\xff", + b"\xc3\xb6\xc3\xa4\xc3\xbc", + b"\xed\xa0\xbd", + b"\xf0\x90\x80\x81", + ] + + for v in values: + try: + uni = v.decode(sys.getfilesystemencoding(), "surrogatepass") + except UnicodeDecodeError: + continue + self.assertEqual(GIMarshallingTests.filename_copy(v), uni) + + def test_unix_various(self): + if os.name == "nt": + return + + copy = GIMarshallingTests.filename_copy + glib_repr = GIMarshallingTests.filename_to_glib_repr + + try: + os.fsdecode(b"\xff\xfe") + except UnicodeDecodeError: + self.assertRaises(UnicodeDecodeError, copy, b"\xff\xfe") + else: + str_path = copy(b"\xff\xfe") + self.assertTrue(isinstance(str_path, str)) + self.assertEqual(str_path, os.fsdecode(b"\xff\xfe")) + self.assertEqual(copy(str_path), str_path) + self.assertEqual(glib_repr(b"\xff\xfe"), b"\xff\xfe") + self.assertEqual(glib_repr(str_path), b"\xff\xfe") + + # if getfilesystemencoding is ASCII, then we should fail like + # os.fsencode + try: + byte_path = os.fsencode(u"ä") + except UnicodeEncodeError: + self.assertRaises(UnicodeEncodeError, copy, u"ä") + else: + self.assertEqual(copy(u"ä"), u"ä") + self.assertEqual(glib_repr(u"ä"), byte_path) + + @unittest.skip("glib can't handle non-unicode paths") + def test_win32_surrogates_exists(self): + if os.name != "nt": + return + + path = os.path.join(self.workdir, u"\ud83d") + with open(path, "wb"): + self.assertTrue(os.path.exists(path)) + self.assertTrue(GIMarshallingTests.filename_exists(path)) + os.unlink(path) + + def test_path_exists_various_types(self): + wd = self.workdir + wdb = os.fsencode(wd) + + paths = [(wdb, b"foo-1"), (wd, u"foo-2"), (wd, u"öäü-3")] + + try: + paths.append((wd, os.fsdecode(b"\xff\xfe-4"))) + except UnicodeDecodeError: + # depends on the code page + pass + + if os.name != "nt": + paths.append((wdb, b"\xff\xfe-5")) + + def valid_path(p): + try: + os.path.exists(p) + except ValueError: + return False + return True + + for (d, path) in paths: + if not valid_path(path): + continue + path = os.path.join(d, path) + with open(path, "wb"): + self.assertTrue(GIMarshallingTests.filename_exists(path)) class TestArray(unittest.TestCase): + @unittest.skipUnless( + hasattr(GIMarshallingTests, "array_bool_in"), "too old gi") + def test_array_bool_in(self): + GIMarshallingTests.array_bool_in([True, False, True, True]) + + @unittest.skipUnless( + hasattr(GIMarshallingTests, "array_bool_out"), "too old gi") + def test_array_bool_out(self): + assert GIMarshallingTests.array_bool_out() == [True, False, True, True] + + @unittest.skipUnless( + hasattr(GIMarshallingTests, "array_int64_in"), "too old gi") + def test_array_int64_in(self): + GIMarshallingTests.array_int64_in([-1, 0, 1, 2]) + + @unittest.skipUnless( + hasattr(GIMarshallingTests, "array_uint64_in"), "too old gi") + def test_array_uint64_in(self): + GIMarshallingTests.array_uint64_in([GLib.MAXUINT64, 0, 1, 2]) + + @unittest.skipUnless( + hasattr(GIMarshallingTests, "array_unichar_in"), "too old gi") + def test_array_unichar_in(self): + GIMarshallingTests.array_unichar_in(list(CONSTANT_UCS4)) + GIMarshallingTests.array_unichar_in(CONSTANT_UCS4) + + @unittest.skipUnless( + hasattr(GIMarshallingTests, "array_unichar_out"), "too old gi") + def test_array_unichar_out(self): + result = list(CONSTANT_UCS4) + assert GIMarshallingTests.array_unichar_out() == result + + def test_array_zero_terminated_return_unichar(self): + assert GIMarshallingTests.array_zero_terminated_return_unichar() == \ + list(CONSTANT_UCS4) + def test_array_fixed_int_return(self): self.assertEqual([-1, 0, 1, 2], GIMarshallingTests.array_fixed_int_return()) @@ -764,7 +966,7 @@ class TestArray(unittest.TestCase): def test_array_uint8_in(self): GIMarshallingTests.array_uint8_in(Sequence([97, 98, 99, 100])) - GIMarshallingTests.array_uint8_in(_bytes("abcd")) + GIMarshallingTests.array_uint8_in(b"abcd") def test_array_string_in(self): GIMarshallingTests.array_string_in(['foo', 'bar']) @@ -813,6 +1015,15 @@ class TestArray(unittest.TestCase): GIMarshallingTests.array_struct_in([struct1, struct2, struct3]) + def test_array_boxed_struct_in_item_marshal_failure(self): + struct1 = GIMarshallingTests.BoxedStruct() + struct1.long_ = 1 + struct2 = GIMarshallingTests.BoxedStruct() + struct2.long_ = 2 + + self.assertRaises(TypeError, GIMarshallingTests.array_struct_in, + [struct1, struct2, 'not_a_struct']) + def test_array_boxed_struct_value_in(self): struct1 = GIMarshallingTests.BoxedStruct() struct1.long_ = 1 @@ -823,6 +1034,15 @@ class TestArray(unittest.TestCase): GIMarshallingTests.array_struct_value_in([struct1, struct2, struct3]) + def test_array_boxed_struct_value_in_item_marshal_failure(self): + struct1 = GIMarshallingTests.BoxedStruct() + struct1.long_ = 1 + struct2 = GIMarshallingTests.BoxedStruct() + struct2.long_ = 2 + + self.assertRaises(TypeError, GIMarshallingTests.array_struct_value_in, + [struct1, struct2, 'not_a_struct']) + def test_array_boxed_struct_take_in(self): struct1 = GIMarshallingTests.BoxedStruct() struct1.long_ = 1 @@ -854,6 +1074,15 @@ class TestArray(unittest.TestCase): GIMarshallingTests.array_simple_struct_in([struct1, struct2, struct3]) + def test_array_simple_struct_in_item_marshal_failure(self): + struct1 = GIMarshallingTests.SimpleStruct() + struct1.long_ = 1 + struct2 = GIMarshallingTests.SimpleStruct() + struct2.long_ = 2 + + self.assertRaises(TypeError, GIMarshallingTests.array_simple_struct_in, + [struct1, struct2, 'not_a_struct']) + def test_array_multi_array_key_value_in(self): GIMarshallingTests.multi_array_key_value_in(["one", "two", "three"], [1, 2, 3]) @@ -890,6 +1119,12 @@ class TestArray(unittest.TestCase): self.assertEqual((True, ['hello']), GIMarshallingTests.init_function(['hello', 'world'])) + def test_enum_array_return_type(self): + self.assertEqual(GIMarshallingTests.enum_array_return_type(), + [GIMarshallingTests.ExtraEnum.VALUE1, + GIMarshallingTests.ExtraEnum.VALUE2, + GIMarshallingTests.ExtraEnum.VALUE3]) + class TestGStrv(unittest.TestCase): @@ -930,11 +1165,22 @@ class TestArrayGVariant(unittest.TestCase): class TestGArray(unittest.TestCase): + @unittest.skipUnless( + hasattr(GIMarshallingTests, "garray_bool_none_in"), "too old gi") + def test_garray_bool_none_in(self): + GIMarshallingTests.garray_bool_none_in([True, False, True, True]) + + @unittest.skipUnless( + hasattr(GIMarshallingTests, "garray_unichar_none_in"), "too old gi") + def test_garray_unichar_none_in(self): + GIMarshallingTests.garray_unichar_none_in(CONSTANT_UCS4) + GIMarshallingTests.garray_unichar_none_in(list(CONSTANT_UCS4)) + def test_garray_int_none_return(self): self.assertEqual([-1, 0, 1, 2], GIMarshallingTests.garray_int_none_return()) def test_garray_uint64_none_return(self): - self.assertEqual([0, GObject.G_MAXUINT64], GIMarshallingTests.garray_uint64_none_return()) + self.assertEqual([0, GLib.MAXUINT64], GIMarshallingTests.garray_uint64_none_return()) def test_garray_utf8_none_return(self): self.assertEqual(['0', '1', '2'], GIMarshallingTests.garray_utf8_none_return()) @@ -954,7 +1200,7 @@ class TestGArray(unittest.TestCase): self.assertRaises(TypeError, GIMarshallingTests.garray_int_none_in, None) def test_garray_uint64_none_in(self): - GIMarshallingTests.garray_uint64_none_in(Sequence([0, GObject.G_MAXUINT64])) + GIMarshallingTests.garray_uint64_none_in(Sequence([0, GLib.MAXUINT64])) def test_garray_utf8_none_in(self): GIMarshallingTests.garray_utf8_none_in(Sequence(['0', '1', '2'])) @@ -1061,7 +1307,18 @@ class TestGByteArray(unittest.TestCase): self.assertEqual(b'\x001\xFF3', GIMarshallingTests.bytearray_full_return()) def test_bytearray_none_in(self): - GIMarshallingTests.bytearray_none_in(b'\x00\x31\xFF\x33') + b = b'\x00\x31\xFF\x33' + ba = GLib.ByteArray.new_take(b) + + # b should always have the same value even + # though the generated GByteArray is being modified + GIMarshallingTests.bytearray_none_in(b) + GIMarshallingTests.bytearray_none_in(b) + + # The GByteArray is just a bytes + # thus it will not reflect any changes + GIMarshallingTests.bytearray_none_in(ba) + GIMarshallingTests.bytearray_none_in(ba) class TestGList(unittest.TestCase): @@ -1070,7 +1327,7 @@ class TestGList(unittest.TestCase): self.assertEqual([-1, 0, 1, 2], GIMarshallingTests.glist_int_none_return()) def test_glist_uint32_none_return(self): - self.assertEqual([0, GObject.G_MAXUINT32], GIMarshallingTests.glist_uint32_none_return()) + self.assertEqual([0, GLib.MAXUINT32], GIMarshallingTests.glist_uint32_none_return()) def test_glist_utf8_none_return(self): self.assertEqual(['0', '1', '2'], GIMarshallingTests.glist_utf8_none_return()) @@ -1089,8 +1346,16 @@ class TestGList(unittest.TestCase): self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, 42) self.assertRaises(TypeError, GIMarshallingTests.glist_int_none_in, None) + def test_glist_int_none_in_error_getitem(self): + + class FailingSequence(Sequence): + def __getitem__(self, key): + raise Exception + + self.assertRaises(Exception, GIMarshallingTests.glist_int_none_in, FailingSequence((-1, 0, 1, 2))) + def test_glist_uint32_none_in(self): - GIMarshallingTests.glist_uint32_none_in(Sequence((0, GObject.G_MAXUINT32))) + GIMarshallingTests.glist_uint32_none_in(Sequence((0, GLib.MAXUINT32))) def test_glist_utf8_none_in(self): GIMarshallingTests.glist_utf8_none_in(Sequence(('0', '1', '2'))) @@ -1136,6 +1401,14 @@ class TestGSList(unittest.TestCase): self.assertRaises(TypeError, GIMarshallingTests.gslist_int_none_in, 42) self.assertRaises(TypeError, GIMarshallingTests.gslist_int_none_in, None) + def test_gslist_int_none_in_error_getitem(self): + + class FailingSequence(Sequence): + def __getitem__(self, key): + raise Exception + + self.assertRaises(Exception, GIMarshallingTests.gslist_int_none_in, FailingSequence((-1, 0, 1, 2))) + def test_gslist_utf8_none_in(self): GIMarshallingTests.gslist_utf8_none_in(Sequence(('0', '1', '2'))) @@ -1160,6 +1433,26 @@ class TestGSList(unittest.TestCase): class TestGHashTable(unittest.TestCase): + @unittest.skip("broken") + def test_ghashtable_double_in(self): + GIMarshallingTests.ghashtable_double_in( + {"-1": -0.1, "0": 0.0, "1": 0.1, "2": 0.2}) + + @unittest.skip("broken") + def test_ghashtable_float_in(self): + GIMarshallingTests.ghashtable_float_in( + {"-1": -0.1, "0": 0.0, "1": 0.1, "2": 0.2}) + + @unittest.skip("broken") + def test_ghashtable_int64_in(self): + GIMarshallingTests.ghashtable_int64_in( + {"-1": GLib.MAXUINT32 + 1, "0": 0, "1": 1, "2": 2}) + + @unittest.skip("broken") + def test_ghashtable_uint64_in(self): + GIMarshallingTests.ghashtable_uint64_in( + {"-1": GLib.MAXUINT32 + 1, "0": 0, "1": 1, "2": 2}) + def test_ghashtable_int_none_return(self): self.assertEqual({-1: 1, 0: 0, 1: -1, 2: -2}, GIMarshallingTests.ghashtable_int_none_return()) @@ -1208,6 +1501,17 @@ class TestGHashTable(unittest.TestCase): self.assertEqual({'-1': '1', '0': '0', '1': '1'}, GIMarshallingTests.ghashtable_utf8_full_inout(i)) + def test_ghashtable_enum_none_in(self): + GIMarshallingTests.ghashtable_enum_none_in({1: GIMarshallingTests.ExtraEnum.VALUE1, + 2: GIMarshallingTests.ExtraEnum.VALUE2, + 3: GIMarshallingTests.ExtraEnum.VALUE3}) + + def test_ghashtable_enum_none_return(self): + self.assertEqual({1: GIMarshallingTests.ExtraEnum.VALUE1, + 2: GIMarshallingTests.ExtraEnum.VALUE2, + 3: GIMarshallingTests.ExtraEnum.VALUE3}, + GIMarshallingTests.ghashtable_enum_none_return()) + class TestGValue(unittest.TestCase): @@ -1219,15 +1523,13 @@ class TestGValue(unittest.TestCase): value = GObject.Value(GObject.TYPE_INT, 42) GIMarshallingTests.gvalue_in(value) - @unittest.skipUnless(hasattr(GIMarshallingTests, 'gvalue_in_with_modification'), - 'Newer version of gi needed.') def test_gvalue_in_with_modification(self): value = GObject.Value(GObject.TYPE_INT, 42) GIMarshallingTests.gvalue_in_with_modification(value) self.assertEqual(value.get_int(), 24) def test_gvalue_int64_in(self): - value = GObject.Value(GObject.TYPE_INT64, GObject.G_MAXINT64) + value = GObject.Value(GObject.TYPE_INT64, GLib.MAXINT64) GIMarshallingTests.gvalue_int64_in(value) def test_gvalue_in_with_type(self): @@ -1247,7 +1549,7 @@ class TestGValue(unittest.TestCase): self.assertEqual(42, GIMarshallingTests.gvalue_out()) def test_gvalue_int64_out(self): - self.assertEqual(GObject.G_MAXINT64, GIMarshallingTests.gvalue_int64_out()) + self.assertEqual(GLib.MAXINT64, GIMarshallingTests.gvalue_int64_out()) def test_gvalue_out_caller_allocates(self): self.assertEqual(42, GIMarshallingTests.gvalue_out_caller_allocates()) @@ -1261,10 +1563,46 @@ class TestGValue(unittest.TestCase): # the function already asserts the correct values GIMarshallingTests.gvalue_flat_array([42, "42", True]) + def test_gvalue_flat_array_in_item_marshal_failure(self): + # Tests the failure to marshal 2^256 to a GValue mid-way through the array marshaling. + self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array, + [42, 2 ** 256, True]) + + self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array, + [GLib.MAXINT + 1, "42", True]) + self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array, + [GLib.MININT - 1, "42", True]) + + # FIXME: https://gitlab.gnome.org/GNOME/pygobject/-/issues/582#note_1764164 + exc_prefix = "Item 0: " if sys.version_info[:2] < (3, 12) else "" + + with pytest.raises( + OverflowError, + match=exc_prefix + '%d not in range %d to %d' % ( + GLib.MAXINT + 1, GLib.MININT, GLib.MAXINT)): + GIMarshallingTests.gvalue_flat_array([GLib.MAXINT + 1, "42", True]) + + min_, max_ = GLib.MININT, GLib.MAXINT + + with pytest.raises( + OverflowError, + match=exc_prefix + '%d not in range %d to %d' % ( + GLib.MAXUINT64 * 2, min_, max_)): + GIMarshallingTests.gvalue_flat_array([GLib.MAXUINT64 * 2, "42", True]) + def test_gvalue_flat_array_out(self): values = GIMarshallingTests.return_gvalue_flat_array() self.assertEqual(values, [42, '42', True]) + def test_gvalue_gobject_ref_counts_simple(self): + obj = GObject.Object() + grefcount = obj.__grefcount__ + value = GObject.Value(GObject.TYPE_OBJECT, obj) + del value + gc.collect() + gc.collect() + assert obj.__grefcount__ == grefcount + def test_gvalue_gobject_ref_counts(self): # Tests a GObject held by a GValue obj = GObject.Object() @@ -1296,12 +1634,14 @@ class TestGValue(unittest.TestCase): del res del value gc.collect() + gc.collect() self.assertEqual(obj.__grefcount__, grefcount) del obj gc.collect() self.assertEqual(ref(), None) + @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount") def test_gvalue_boxed_ref_counts(self): # Tests a boxed type wrapping a python object pointer (TYPE_PYOBJECT) # held by a GValue @@ -1342,8 +1682,8 @@ class TestGValue(unittest.TestCase): gc.collect() self.assertEqual(ref(), None) - # FIXME: crashes - def disabled_test_gvalue_flat_array_round_trip(self): + @unittest.skip("broken") + def test_gvalue_flat_array_round_trip(self): self.assertEqual([42, '42', True], GIMarshallingTests.gvalue_flat_array_round_trip(42, '42', True)) @@ -1353,6 +1693,22 @@ class TestGClosure(unittest.TestCase): def test_in(self): GIMarshallingTests.gclosure_in(lambda: 42) + def test_in_partial(self): + from functools import partial + + called_args = [] + called_kwargs = {} + + def callback(*args, **kwargs): + called_args.extend(args) + called_kwargs.update(kwargs) + return 42 + + func = partial(callback, 1, 2, 3, foo=42) + GIMarshallingTests.gclosure_in(func) + assert called_args == [1, 2, 3] + assert called_kwargs["foo"] == 42 + def test_pass(self): # test passing a closure between two C calls closure = GIMarshallingTests.gclosure_return() @@ -1402,31 +1758,6 @@ class TestPointer(unittest.TestCase): class TestEnum(unittest.TestCase): - @classmethod - def setUpClass(cls): - '''Run tests under a test locale. - - Upper case conversion of member names should not be locale specific - e. g. in Turkish, "i".upper() == "i", which gives results like "iNVALiD" - - Run test under a locale which defines toupper('a') == 'a' - ''' - cls.locale_dir = tempfile.mkdtemp() - src = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'te_ST@nouppera') - dest = os.path.join(cls.locale_dir, 'te_ST.UTF-8@nouppera') - subprocess.check_call(['localedef', '-i', src, '-c', '-f', 'UTF-8', dest]) - os.environ['LOCPATH'] = cls.locale_dir - locale.setlocale(locale.LC_ALL, 'te_ST.UTF-8@nouppera') - - @classmethod - def tearDownClass(cls): - locale.setlocale(locale.LC_ALL, 'C') - shutil.rmtree(cls.locale_dir) - try: - del os.environ['LOCPATH'] - except KeyError: - pass - def test_enum(self): self.assertTrue(issubclass(GIMarshallingTests.Enum, int)) self.assertTrue(isinstance(GIMarshallingTests.Enum.VALUE1, GIMarshallingTests.Enum)) @@ -1479,22 +1810,25 @@ class TestEnum(unittest.TestCase): self.assertEqual(GIMarshallingTests.Enum.__gtype__.name, 'PyGIMarshallingTestsEnum') - def test_enum_double_registration_error(self): - # a warning is printed for double registration and pygobject will - # also raise a RuntimeError. - old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_ERROR) - try: - self.assertRaises(RuntimeError, - gi._gi.enum_register_new_gtype_and_add, - GIMarshallingTests.Enum.__info__) - finally: - GLib.log_set_always_fatal(old_mask) - def test_enum_add_type_error(self): self.assertRaises(TypeError, gi._gi.enum_add, GIMarshallingTests.NoTypeFlags.__gtype__) + def test_type_module_name(self): + self.assertEqual(GIMarshallingTests.Enum.__name__, "Enum") + self.assertEqual(GIMarshallingTests.Enum.__module__, + "gi.repository.GIMarshallingTests") + + def test_hash(self): + assert (hash(GIMarshallingTests.Enum.VALUE1) == + hash(GIMarshallingTests.Enum(GIMarshallingTests.Enum.VALUE1))) + + def test_repr(self): + self.assertEqual(repr(GIMarshallingTests.Enum.VALUE3), + "") + class TestEnumVFuncResults(unittest.TestCase): class EnumTester(GIMarshallingTests.Object): @@ -1522,6 +1856,12 @@ class TestGEnum(unittest.TestCase): self.assertTrue(isinstance(GIMarshallingTests.GEnum.VALUE3, GIMarshallingTests.GEnum)) self.assertEqual(42, GIMarshallingTests.GEnum.VALUE3) + def test_pickle(self): + v = GIMarshallingTests.GEnum.VALUE3 + new_v = pickle.loads(pickle.dumps(v)) + assert new_v == v + assert isinstance(new_v, GIMarshallingTests.GEnum) + def test_value_nick_and_name(self): self.assertEqual(GIMarshallingTests.GEnum.VALUE1.value_nick, 'value1') self.assertEqual(GIMarshallingTests.GEnum.VALUE2.value_nick, 'value2') @@ -1534,6 +1874,7 @@ class TestGEnum(unittest.TestCase): def test_genum_in(self): GIMarshallingTests.genum_in(GIMarshallingTests.GEnum.VALUE3) GIMarshallingTests.genum_in(42) + GIMarshallingTests.GEnum.in_(42) self.assertRaises(TypeError, GIMarshallingTests.genum_in, 43) self.assertRaises(TypeError, GIMarshallingTests.genum_in, 'GIMarshallingTests.GEnum.VALUE3') @@ -1545,6 +1886,7 @@ class TestGEnum(unittest.TestCase): def test_genum_out(self): genum = GIMarshallingTests.genum_out() + genum = GIMarshallingTests.GEnum.out() self.assertTrue(isinstance(genum, GIMarshallingTests.GEnum)) self.assertEqual(genum, GIMarshallingTests.GEnum.VALUE3) @@ -1553,6 +1895,20 @@ class TestGEnum(unittest.TestCase): self.assertTrue(isinstance(genum, GIMarshallingTests.GEnum)) self.assertEqual(genum, GIMarshallingTests.GEnum.VALUE1) + def test_type_module_name(self): + self.assertEqual(GIMarshallingTests.GEnum.__name__, "GEnum") + self.assertEqual(GIMarshallingTests.GEnum.__module__, + "gi.repository.GIMarshallingTests") + + def test_hash(self): + assert (hash(GIMarshallingTests.GEnum.VALUE3) == + hash(GIMarshallingTests.GEnum(GIMarshallingTests.GEnum.VALUE3))) + + def test_repr(self): + self.assertEqual(repr(GIMarshallingTests.GEnum.VALUE3), + "") + class TestGFlags(unittest.TestCase): @@ -1577,9 +1933,11 @@ class TestGFlags(unittest.TestCase): def test_flags_in(self): GIMarshallingTests.flags_in(GIMarshallingTests.Flags.VALUE2) + GIMarshallingTests.Flags.in_(GIMarshallingTests.Flags.VALUE2) # result of __or__() operation should still be valid instance, not an int. GIMarshallingTests.flags_in(GIMarshallingTests.Flags.VALUE2 | GIMarshallingTests.Flags.VALUE2) GIMarshallingTests.flags_in_zero(Number(0)) + GIMarshallingTests.Flags.in_zero(Number(0)) self.assertRaises(TypeError, GIMarshallingTests.flags_in, 1 << 1) self.assertRaises(TypeError, GIMarshallingTests.flags_in, 'GIMarshallingTests.Flags.VALUE2') @@ -1589,6 +1947,11 @@ class TestGFlags(unittest.TestCase): self.assertTrue(isinstance(flags, GIMarshallingTests.Flags)) self.assertEqual(flags, GIMarshallingTests.Flags.VALUE2) + def test_flags_return_method(self): + flags = GIMarshallingTests.Flags.returnv() + self.assertTrue(isinstance(flags, GIMarshallingTests.Flags)) + self.assertEqual(flags, GIMarshallingTests.Flags.VALUE2) + def test_flags_out(self): flags = GIMarshallingTests.flags_out() self.assertTrue(isinstance(flags, GIMarshallingTests.Flags)) @@ -1599,6 +1962,24 @@ class TestGFlags(unittest.TestCase): self.assertTrue(isinstance(flags, GIMarshallingTests.Flags)) self.assertEqual(flags, GIMarshallingTests.Flags.VALUE1) + def test_type_module_name(self): + self.assertEqual(GIMarshallingTests.Flags.__name__, "Flags") + self.assertEqual(GIMarshallingTests.Flags.__module__, + "gi.repository.GIMarshallingTests") + + def test_repr(self): + self.assertEqual(repr(GIMarshallingTests.Flags.VALUE2), + "") + + def test_hash(self): + assert (hash(GIMarshallingTests.Flags.VALUE2) == + hash(GIMarshallingTests.Flags(GIMarshallingTests.Flags.VALUE2))) + + def test_flags_large_in(self): + GIMarshallingTests.extra_flags_large_in( + GIMarshallingTests.ExtraFlags.VALUE2) + class TestNoTypeFlags(unittest.TestCase): @@ -1648,16 +2029,16 @@ class TestNoTypeFlags(unittest.TestCase): self.assertEqual(GIMarshallingTests.NoTypeFlags.__gtype__.name, 'PyGIMarshallingTestsNoTypeFlags') - def test_flags_double_registration_error(self): - # a warning is printed for double registration and pygobject will - # also raise a RuntimeError. - old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_ERROR) - try: - self.assertRaises(RuntimeError, - gi._gi.flags_register_new_gtype_and_add, - GIMarshallingTests.NoTypeFlags.__info__) - finally: - GLib.log_set_always_fatal(old_mask) + def test_type_module_name(self): + self.assertEqual(GIMarshallingTests.NoTypeFlags.__name__, + "NoTypeFlags") + self.assertEqual(GIMarshallingTests.NoTypeFlags.__module__, + "gi.repository.GIMarshallingTests") + + def test_repr(self): + self.assertEqual(repr(GIMarshallingTests.NoTypeFlags.VALUE2), + "") class TestStructure(unittest.TestCase): @@ -1833,6 +2214,19 @@ class TestStructure(unittest.TestCase): self.assertEqual(struct.long_, 42) self.assertEqual(struct.string_, 'hello') + def test_union_init(self): + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + GIMarshallingTests.Union(42) + + self.assertTrue(issubclass(warn[0].category, DeprecationWarning)) + + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + GIMarshallingTests.Union(f=42) + + self.assertTrue(issubclass(warn[0].category, DeprecationWarning)) + def test_union(self): union = GIMarshallingTests.Union() @@ -1870,6 +2264,27 @@ class TestStructure(unittest.TestCase): self.assertRaises(TypeError, GIMarshallingTests.Union.method) + def test_repr(self): + self.assertRegex( + repr(GIMarshallingTests.PointerStruct()), + r"") + + self.assertRegex( + repr(GIMarshallingTests.SimpleStruct()), + r"") + + self.assertRegex( + repr(GIMarshallingTests.Union()), + r"") + + self.assertRegex( + repr(GIMarshallingTests.BoxedStruct()), + r"") + class TestGObject(unittest.TestCase): @@ -1987,6 +2402,9 @@ class TestGObject(unittest.TestCase): GIMarshallingTests.Object.none_inout(GIMarshallingTests.SubObject(int=42)) def test_object_full_inout(self): + # Using gimarshallingtests.c from GI versions > 1.38.0 will show this + # test as an "unexpected success" due to reference leak fixes in that file. + # TODO: remove the expectedFailure once PyGI relies on GI > 1.38.0. object_ = GIMarshallingTests.Object(int=42) new_object = GIMarshallingTests.Object.full_inout(object_) @@ -1994,9 +2412,21 @@ class TestGObject(unittest.TestCase): self.assertFalse(object_ is new_object) - self.assertEqual(object_.__grefcount__, 2) + self.assertEqual(object_.__grefcount__, 1) self.assertEqual(new_object.__grefcount__, 1) + def test_repr(self): + self.assertRegex( + repr(GIMarshallingTests.Object(int=42)), + r"") + + def test_nongir_repr(self): + self.assertRegex( + repr(Gio.File.new_for_path("/")), + r"<__gi__.GLocalFile object at 0x[^\s]+ " + r"\(GLocalFile at 0x[^\s]+\)>") + # FIXME: Doesn't actually return the same object. # def test_object_inout_same(self): # object_ = GIMarshallingTests.Object() @@ -2086,6 +2516,12 @@ class TestPythonGObject(unittest.TestCase): object_ = self.Object(int=42) self.assertTrue(isinstance(object_, self.Object)) + @unittest.skipUnless(hasattr(GIMarshallingTests.Object, 'new_fail'), + 'Requires newer version of GI') + def test_object_fail(self): + with self.assertRaises(GLib.Error): + GIMarshallingTests.Object.new_fail(int_=42) + def test_object_method(self): self.Object(int=0).method() @@ -2125,6 +2561,7 @@ class TestPythonGObject(unittest.TestCase): object_.method_with_default_implementation(84) self.assertEqual(object_.props.int, 84) + @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount") def test_vfunc_return_ref_count(self): obj = self.Object(int=42) ref_count = sys.getrefcount(obj.return_for_caller_allocated_out_parameter) @@ -2138,6 +2575,12 @@ class TestPythonGObject(unittest.TestCase): self.assertEqual(sys.getrefcount(obj.return_for_caller_allocated_out_parameter), ref_count) + def test_vfunc_return_no_ref_count(self): + obj = self.Object(int=42) + ret = obj.vfunc_caller_allocated_out_parameter() + self.assertEqual(ret, obj.return_for_caller_allocated_out_parameter) + self.assertFalse(ret is obj.return_for_caller_allocated_out_parameter) + def test_subobject_parent_vfunc(self): object_ = self.SubObject(int=81) object_.method_with_default_implementation(87) @@ -2147,10 +2590,6 @@ class TestPythonGObject(unittest.TestCase): object_ = self.SubObject(int=1) self.assertEqual(object_.vfunc_return_value_only(), 2121) - def test_dynamic_module(self): - from gi.module import DynamicModule - self.assertTrue(isinstance(GObject, DynamicModule)) - def test_subobject_non_vfunc_do_method(self): class PythonObjectWithNonVFuncDoMethod(object): def do_not_a_vfunc(self): @@ -2241,7 +2680,23 @@ class TestPythonGObject(unittest.TestCase): def test_exception_in_vfunc_return_value(self): obj = self.ErrorObject() - self.assertEqual(obj.vfunc_return_value_only(), 0) + with capture_exceptions() as exc: + self.assertEqual(obj.vfunc_return_value_only(), 0) + self.assertEqual(len(exc), 1) + self.assertEqual(exc[0].type, ValueError) + + @unittest.skipUnless(hasattr(GIMarshallingTests, 'callback_owned_boxed'), + 'requires newer version of GI') + def test_callback_owned_box(self): + def callback(box, data): + self.box = box + + def nop_callback(box, data): + pass + + GIMarshallingTests.callback_owned_boxed(callback, None) + GIMarshallingTests.callback_owned_boxed(nop_callback, None) + self.assertEqual(self.box.long_, 1) class TestMultiOutputArgs(unittest.TestCase): @@ -2268,6 +2723,11 @@ class TestInterfaces(unittest.TestCase): def setUp(self): self.instance = self.TestInterfaceImpl() + def test_iface_impl(self): + instance = GIMarshallingTests.InterfaceImpl() + assert instance.get_as_interface() is instance + instance.test_int8_in(42) + def test_wrapper(self): self.assertTrue(issubclass(GIMarshallingTests.Interface, GObject.GInterface)) self.assertEqual(GIMarshallingTests.Interface.__gtype__.name, 'GIMarshallingTestsInterface') @@ -2383,7 +2843,7 @@ class TestMRO(unittest.TestCase): pass expected = (E, D, B, C, A, GIMarshallingTests.Object, - GObject.Object, GObject.Object.__base__, gi._gobject.GObject, + GObject.Object, GObject.Object.__base__, gi._gi.GObject, object) self.assertEqual(expected, E.__mro__) @@ -2415,10 +2875,7 @@ class TestMRO(unittest.TestCase): # style mixin. type('GIWithOldStyleMixin', (GIMarshallingTests.Object, Mixin), {}) - if sys.version_info < (3, 0): - self.assertTrue(issubclass(warn[0].category, RuntimeWarning)) - else: - self.assertEqual(len(warn), 0) + self.assertEqual(len(warn), 0) class TestInterfaceClash(unittest.TestCase): @@ -2483,9 +2940,7 @@ class TestOverrides(unittest.TestCase): # not overridden self.assertEqual(GIMarshallingTests.SubObject.__module__, 'gi.repository.GIMarshallingTests') - # FIXME: does not work with TEST_NAMES='test_thread test_gi.TestOverrides', - # it is importlib._bootstrap then - #self.assertEqual(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject') + self.assertEqual(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject') class TestDir(unittest.TestCase): @@ -2513,55 +2968,6 @@ class TestDir(unittest.TestCase): # self.assertTrue('DoNotImportDummyTests' in list) -class TestGError(unittest.TestCase): - def test_array_in_crash(self): - # Previously there was a bug in invoke, in which C arrays were unwrapped - # from inside GArrays to be passed to the C function. But when a GError was - # set, invoke would attempt to free the C array as if it were a GArray. - # This crash is only for C arrays. It does not happen for C functions which - # take in GArrays. See https://bugzilla.gnome.org/show_bug.cgi?id=642708 - self.assertRaises(GObject.GError, GIMarshallingTests.gerror_array_in, [1, 2, 3]) - - def test_out(self): - # See https://bugzilla.gnome.org/show_bug.cgi?id=666098 - error, debug = GIMarshallingTests.gerror_out() - - self.assertIsInstance(error, GObject.GError) - self.assertEqual(error.domain, GIMarshallingTests.CONSTANT_GERROR_DOMAIN) - self.assertEqual(error.code, GIMarshallingTests.CONSTANT_GERROR_CODE) - self.assertEqual(error.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE) - self.assertEqual(debug, GIMarshallingTests.CONSTANT_GERROR_DEBUG_MESSAGE) - - def test_out_transfer_none(self): - # See https://bugzilla.gnome.org/show_bug.cgi?id=666098 - error, debug = GIMarshallingTests.gerror_out_transfer_none() - - self.assertIsInstance(error, GObject.GError) - self.assertEqual(error.domain, GIMarshallingTests.CONSTANT_GERROR_DOMAIN) - self.assertEqual(error.code, GIMarshallingTests.CONSTANT_GERROR_CODE) - self.assertEqual(error.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE) - self.assertEqual(GIMarshallingTests.CONSTANT_GERROR_DEBUG_MESSAGE, debug) - - def test_return(self): - # See https://bugzilla.gnome.org/show_bug.cgi?id=666098 - error = GIMarshallingTests.gerror_return() - - self.assertIsInstance(error, GObject.GError) - self.assertEqual(error.domain, GIMarshallingTests.CONSTANT_GERROR_DOMAIN) - self.assertEqual(error.code, GIMarshallingTests.CONSTANT_GERROR_CODE) - self.assertEqual(error.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE) - - def test_exception(self): - self.assertRaises(GObject.GError, GIMarshallingTests.gerror) - try: - GIMarshallingTests.gerror() - except Exception: - etype, e = sys.exc_info()[:2] - self.assertEqual(e.domain, GIMarshallingTests.CONSTANT_GERROR_DOMAIN) - self.assertEqual(e.code, GIMarshallingTests.CONSTANT_GERROR_CODE) - self.assertEqual(e.message, GIMarshallingTests.CONSTANT_GERROR_MESSAGE) - - class TestParamSpec(unittest.TestCase): # https://bugzilla.gnome.org/show_bug.cgi?id=682355 @unittest.expectedFailure @@ -2611,29 +3017,29 @@ class TestKeywordArgs(unittest.TestCase): def test_type_errors(self): # test too few args - self.assertRaisesMessage(TypeError, "int_three_in_three_out() takes exactly 3 arguments (0 given)", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() takes exactly 3 arguments (0 given)", GIMarshallingTests.int_three_in_three_out) - self.assertRaisesMessage(TypeError, "int_three_in_three_out() takes exactly 3 arguments (1 given)", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() takes exactly 3 arguments (1 given)", GIMarshallingTests.int_three_in_three_out, 1) - self.assertRaisesMessage(TypeError, "int_three_in_three_out() takes exactly 3 arguments (0 given)", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() takes exactly 3 arguments (0 given)", GIMarshallingTests.int_three_in_three_out, *()) - self.assertRaisesMessage(TypeError, "int_three_in_three_out() takes exactly 3 arguments (0 given)", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() takes exactly 3 arguments (0 given)", GIMarshallingTests.int_three_in_three_out, *(), **{}) - self.assertRaisesMessage(TypeError, "int_three_in_three_out() takes exactly 3 non-keyword arguments (0 given)", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() takes exactly 3 non-keyword arguments (0 given)", GIMarshallingTests.int_three_in_three_out, *(), **{'c': 4}) # test too many args - self.assertRaisesMessage(TypeError, "int_three_in_three_out() takes exactly 3 arguments (4 given)", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() takes exactly 3 arguments (4 given)", GIMarshallingTests.int_three_in_three_out, *(1, 2, 3, 4)) - self.assertRaisesMessage(TypeError, "int_three_in_three_out() takes exactly 3 non-keyword arguments (4 given)", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() takes exactly 3 non-keyword arguments (4 given)", GIMarshallingTests.int_three_in_three_out, *(1, 2, 3, 4), c=6) # test too many keyword args - self.assertRaisesMessage(TypeError, "int_three_in_three_out() got multiple values for keyword argument 'a'", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() got multiple values for keyword argument 'a'", GIMarshallingTests.int_three_in_three_out, 1, 2, 3, **{'a': 4, 'b': 5}) - self.assertRaisesMessage(TypeError, "int_three_in_three_out() got an unexpected keyword argument 'd'", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() got an unexpected keyword argument 'd'", GIMarshallingTests.int_three_in_three_out, d=4) - self.assertRaisesMessage(TypeError, "int_three_in_three_out() got an unexpected keyword argument 'e'", + self.assertRaisesMessage(TypeError, "GIMarshallingTests.int_three_in_three_out() got an unexpected keyword argument 'e'", GIMarshallingTests.int_three_in_three_out, **{'e': 2}) def test_kwargs_are_not_modified(self): @@ -2642,214 +3048,35 @@ class TestKeywordArgs(unittest.TestCase): GIMarshallingTests.int_three_in_three_out(1, c=4, **d) self.assertEqual(d, d2) + @unittest.skipUnless(hasattr(GIMarshallingTests, 'int_one_in_utf8_two_in_one_allows_none'), + 'Requires newer GIMarshallingTests') + def test_allow_none_as_default(self): + GIMarshallingTests.int_two_in_utf8_two_in_with_allow_none(1, 2, '3', '4') + GIMarshallingTests.int_two_in_utf8_two_in_with_allow_none(1, 2, '3') + GIMarshallingTests.int_two_in_utf8_two_in_with_allow_none(1, 2) + GIMarshallingTests.int_two_in_utf8_two_in_with_allow_none(1, 2, d='4') -class TestPropertiesObject(unittest.TestCase): - - def setUp(self): - self.obj = GIMarshallingTests.PropertiesObject() - - def test_boolean(self): - self.assertEqual(self.obj.props.some_boolean, False) - self.obj.props.some_boolean = True - self.assertEqual(self.obj.props.some_boolean, True) - - obj = GIMarshallingTests.PropertiesObject(some_boolean=True) - self.assertEqual(obj.props.some_boolean, True) - - def test_char(self): - self.assertEqual(self.obj.props.some_char, 0) - self.obj.props.some_char = GObject.G_MAXINT8 - self.assertEqual(self.obj.props.some_char, GObject.G_MAXINT8) - - obj = GIMarshallingTests.PropertiesObject(some_char=-42) - self.assertEqual(obj.props.some_char, -42) - - def test_uchar(self): - self.assertEqual(self.obj.props.some_uchar, 0) - self.obj.props.some_uchar = GObject.G_MAXUINT8 - self.assertEqual(self.obj.props.some_uchar, GObject.G_MAXUINT8) - - obj = GIMarshallingTests.PropertiesObject(some_uchar=42) - self.assertEqual(obj.props.some_uchar, 42) - - def test_int(self): - self.assertEqual(self.obj.props.some_int, 0) - self.obj.props.some_int = GObject.G_MAXINT - self.assertEqual(self.obj.props.some_int, GObject.G_MAXINT) - - obj = GIMarshallingTests.PropertiesObject(some_int=-42) - self.assertEqual(obj.props.some_int, -42) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_int', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_int', None) - - self.assertEqual(obj.props.some_int, -42) - - def test_uint(self): - self.assertEqual(self.obj.props.some_uint, 0) - self.obj.props.some_uint = GObject.G_MAXUINT - self.assertEqual(self.obj.props.some_uint, GObject.G_MAXUINT) - - obj = GIMarshallingTests.PropertiesObject(some_uint=42) - self.assertEqual(obj.props.some_uint, 42) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_uint', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_uint', None) - - self.assertEqual(obj.props.some_uint, 42) - - def test_long(self): - self.assertEqual(self.obj.props.some_long, 0) - self.obj.props.some_long = GObject.G_MAXLONG - self.assertEqual(self.obj.props.some_long, GObject.G_MAXLONG) - - obj = GIMarshallingTests.PropertiesObject(some_long=-42) - self.assertEqual(obj.props.some_long, -42) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_long', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_long', None) - - self.assertEqual(obj.props.some_long, -42) - - def test_ulong(self): - self.assertEqual(self.obj.props.some_ulong, 0) - self.obj.props.some_ulong = GObject.G_MAXULONG - self.assertEqual(self.obj.props.some_ulong, GObject.G_MAXULONG) - - obj = GIMarshallingTests.PropertiesObject(some_ulong=42) - self.assertEqual(obj.props.some_ulong, 42) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_ulong', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_ulong', None) - - self.assertEqual(obj.props.some_ulong, 42) - - def test_int64(self): - self.assertEqual(self.obj.props.some_int64, 0) - self.obj.props.some_int64 = GObject.G_MAXINT64 - self.assertEqual(self.obj.props.some_int64, GObject.G_MAXINT64) - - obj = GIMarshallingTests.PropertiesObject(some_int64=-4200000000000000) - self.assertEqual(obj.props.some_int64, -4200000000000000) - - def test_uint64(self): - self.assertEqual(self.obj.props.some_uint64, 0) - self.obj.props.some_uint64 = GObject.G_MAXUINT64 - self.assertEqual(self.obj.props.some_uint64, GObject.G_MAXUINT64) - - obj = GIMarshallingTests.PropertiesObject(some_uint64=4200000000000000) - self.assertEqual(obj.props.some_uint64, 4200000000000000) - - def test_float(self): - self.assertEqual(self.obj.props.some_float, 0) - self.obj.props.some_float = GObject.G_MAXFLOAT - self.assertEqual(self.obj.props.some_float, GObject.G_MAXFLOAT) - - obj = GIMarshallingTests.PropertiesObject(some_float=42.42) - self.assertAlmostEqual(obj.props.some_float, 42.42, 4) - - obj = GIMarshallingTests.PropertiesObject(some_float=42) - self.assertAlmostEqual(obj.props.some_float, 42.0, 4) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_float', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_float', None) - - self.assertAlmostEqual(obj.props.some_float, 42.0, 4) - - def test_double(self): - self.assertEqual(self.obj.props.some_double, 0) - self.obj.props.some_double = GObject.G_MAXDOUBLE - self.assertEqual(self.obj.props.some_double, GObject.G_MAXDOUBLE) - - obj = GIMarshallingTests.PropertiesObject(some_double=42.42) - self.assertAlmostEqual(obj.props.some_double, 42.42) - - obj = GIMarshallingTests.PropertiesObject(some_double=42) - self.assertAlmostEqual(obj.props.some_double, 42.0) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_double', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_double', None) - - self.assertAlmostEqual(obj.props.some_double, 42.0) - - def test_strv(self): - self.assertEqual(self.obj.props.some_strv, []) - self.obj.props.some_strv = ['hello', 'world'] - self.assertEqual(self.obj.props.some_strv, ['hello', 'world']) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_strv', 1) - self.assertRaises(TypeError, setattr, self.obj.props, 'some_strv', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_strv', [1, 2]) - self.assertRaises(TypeError, setattr, self.obj.props, 'some_strv', ['foo', 1]) - - self.assertEqual(self.obj.props.some_strv, ['hello', 'world']) - - obj = GIMarshallingTests.PropertiesObject(some_strv=['hello', 'world']) - self.assertEqual(obj.props.some_strv, ['hello', 'world']) - - def test_boxed_struct(self): - self.assertEqual(self.obj.props.some_boxed_struct, None) - - class GStrv(list): - __gtype__ = GObject.TYPE_STRV - - struct1 = GIMarshallingTests.BoxedStruct() - struct1.long_ = 1 - - self.obj.props.some_boxed_struct = struct1 - self.assertEqual(self.obj.props.some_boxed_struct.long_, 1) - self.assertEqual(self.obj.some_boxed_struct.long_, 1) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_boxed_struct', 1) - self.assertRaises(TypeError, setattr, self.obj.props, 'some_boxed_struct', 'foo') - - obj = GIMarshallingTests.PropertiesObject(some_boxed_struct=struct1) - self.assertEqual(obj.props.some_boxed_struct.long_, 1) - - def test_boxed_glist(self): - self.assertEqual(self.obj.props.some_boxed_glist, []) - - l = [GObject.G_MININT, 42, GObject.G_MAXINT] - self.obj.props.some_boxed_glist = l - self.assertEqual(self.obj.props.some_boxed_glist, l) - self.obj.props.some_boxed_glist = [] - self.assertEqual(self.obj.props.some_boxed_glist, []) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_boxed_glist', 1) - self.assertRaises(TypeError, setattr, self.obj.props, 'some_boxed_glist', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_boxed_glist', ['a']) - - @unittest.expectedFailure - def test_boxed_glist_ctor(self): - l = [GObject.G_MININT, 42, GObject.G_MAXINT] - obj = GIMarshallingTests.PropertiesObject(some_boxed_glist=l) - self.assertEqual(obj.props.some_boxed_glist, l) - - def test_variant(self): - self.assertEqual(self.obj.props.some_variant, None) - - self.obj.props.some_variant = GLib.Variant('o', '/myobj') - self.assertEqual(self.obj.props.some_variant.get_type_string(), 'o') - self.assertEqual(self.obj.props.some_variant.print_(False), "'/myobj'") - - self.obj.props.some_variant = None - self.assertEqual(self.obj.props.some_variant, None) - - obj = GIMarshallingTests.PropertiesObject(some_variant=GLib.Variant('b', True)) - self.assertEqual(obj.props.some_variant.get_type_string(), 'b') - self.assertEqual(obj.props.some_variant.get_boolean(), True) - - self.assertRaises(TypeError, setattr, self.obj.props, 'some_variant', 'foo') - self.assertRaises(TypeError, setattr, self.obj.props, 'some_variant', 23) + GIMarshallingTests.array_in_utf8_two_in_out_of_order('1', [-1, 0, 1, 2]) + GIMarshallingTests.array_in_utf8_two_in_out_of_order('1', [-1, 0, 1, 2], '2') + self.assertRaises(TypeError, + GIMarshallingTests.array_in_utf8_two_in_out_of_order, + [-1, 0, 1, 2], a='1') + self.assertRaises(TypeError, + GIMarshallingTests.array_in_utf8_two_in_out_of_order, + [-1, 0, 1, 2]) - self.assertEqual(obj.props.some_variant.get_type_string(), 'b') - self.assertEqual(obj.props.some_variant.get_boolean(), True) + GIMarshallingTests.array_in_utf8_two_in([-1, 0, 1, 2], '1', '2') + GIMarshallingTests.array_in_utf8_two_in([-1, 0, 1, 2], '1') + GIMarshallingTests.array_in_utf8_two_in([-1, 0, 1, 2]) + GIMarshallingTests.array_in_utf8_two_in([-1, 0, 1, 2], b='2') - def test_setting_several_properties(self): - obj = GIMarshallingTests.PropertiesObject() - obj.set_properties(some_uchar=54, some_int=42) - self.assertEqual(42, obj.props.some_int) - self.assertEqual(54, obj.props.some_uchar) + GIMarshallingTests.int_one_in_utf8_two_in_one_allows_none(1, '2', '3') + self.assertRaises(TypeError, + GIMarshallingTests.int_one_in_utf8_two_in_one_allows_none, + 1, '3') + self.assertRaises(TypeError, + GIMarshallingTests.int_one_in_utf8_two_in_one_allows_none, + 1, c='3') class TestKeywords(unittest.TestCase): @@ -2874,8 +3101,10 @@ class TestKeywords(unittest.TestCase): class TestModule(unittest.TestCase): def test_path(self): - self.assertTrue(GIMarshallingTests.__path__.endswith('GIMarshallingTests-1.0.typelib'), - GIMarshallingTests.__path__) + path = GIMarshallingTests.__path__ + assert isinstance(path, list) + assert len(path) == 1 + assert path[0].endswith('GIMarshallingTests-1.0.typelib') def test_str(self): self.assertTrue("'GIMarshallingTests' from '" in str(GIMarshallingTests), @@ -2896,16 +3125,9 @@ class TestModule(unittest.TestCase): self.assertTrue(hasattr(item, '__class__')) def test_help(self): - orig_stdout = sys.stdout - try: - if sys.version_info < (3, 0): - sys.stdout = BytesIO() - else: - sys.stdout = StringIO() + with capture_output() as (stdout, stderr): help(GIMarshallingTests) - output = sys.stdout.getvalue() - finally: - sys.stdout = orig_stdout + output = stdout.getvalue() self.assertTrue('SimpleStruct' in output, output) self.assertTrue('Interface2' in output, output) @@ -2914,7 +3136,7 @@ class TestModule(unittest.TestCase): class TestProjectVersion(unittest.TestCase): def test_version_str(self): - self.assertGreaterEqual(gi.__version__, "3.3.5") + self.assertGreater(gi.__version__, "3.") def test_version_info(self): self.assertEqual(len(gi.version_info), 3) @@ -2927,20 +3149,18 @@ class TestProjectVersion(unittest.TestCase): gi.check_version("3.3.5") -class TestObjectInfo(unittest.TestCase): - def test_get_abstract_with_abstract(self): - repo = gi.gi.Repository.get_default() - info = repo.find_by_name('GObject', 'TypeModule') - self.assertTrue(info.get_abstract()) +class TestGIWarning(unittest.TestCase): - def test_get_abstract_with_concrete(self): - repo = gi.gi.Repository.get_default() - info = repo.find_by_name('GObject', 'Object') - self.assertFalse(info.get_abstract()) + def test_warning(self): + ignored_by_default = (DeprecationWarning, PendingDeprecationWarning, + ImportWarning) - def test_get_class_struct(self): - self.assertEqual(GObject.Object.__info__.get_class_struct(), - GObject.ObjectClass.__info__) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + warnings.warn("test", PyGIWarning) + self.assertTrue(issubclass(warn[0].category, Warning)) + # We don't want PyGIWarning get ignored by default + self.assertFalse(issubclass(warn[0].category, ignored_by_default)) class TestDeprecation(unittest.TestCase): @@ -2950,3 +3170,156 @@ class TestDeprecation(unittest.TestCase): warnings.simplefilter('always') d.set_time(1) self.assertTrue(issubclass(warn[0].category, DeprecationWarning)) + self.assertEqual(str(warn[0].message), "GLib.Date.set_time is deprecated") + + def test_function(self): + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + GLib.strcasecmp("foo", "bar") + self.assertTrue(issubclass(warn[0].category, DeprecationWarning)) + self.assertEqual(str(warn[0].message), "GLib.strcasecmp is deprecated") + + def test_deprecated_attribute_compat(self): + # test if the deprecation descriptor behaves like an instance attribute + + # save the descriptor + desc = type(GLib).__dict__["IO_STATUS_ERROR"] + + # the descriptor raises AttributeError for itself + self.assertFalse(hasattr(type(GLib), "IO_STATUS_ERROR")) + + with warnings.catch_warnings(): + warnings.simplefilter('ignore', PyGIDeprecationWarning) + self.assertTrue(hasattr(GLib, "IO_STATUS_ERROR")) + + try: + # check if replacing works + GLib.IO_STATUS_ERROR = "foo" + self.assertEqual(GLib.IO_STATUS_ERROR, "foo") + finally: + # restore descriptor + try: + del GLib.IO_STATUS_ERROR + except AttributeError: + pass + setattr(type(GLib), "IO_STATUS_ERROR", desc) + + try: + # check if deleting works + del GLib.IO_STATUS_ERROR + self.assertFalse(hasattr(GLib, "IO_STATUS_ERROR")) + finally: + # restore descriptor + try: + del GLib.IO_STATUS_ERROR + except AttributeError: + pass + setattr(type(GLib), "IO_STATUS_ERROR", desc) + + def test_deprecated_attribute_warning(self): + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + self.assertEqual(GLib.IO_STATUS_ERROR, GLib.IOStatus.ERROR) + GLib.IO_STATUS_ERROR + GLib.IO_STATUS_ERROR + self.assertEqual(len(warn), 3) + self.assertTrue( + issubclass(warn[0].category, PyGIDeprecationWarning)) + self.assertRegex( + str(warn[0].message), + ".*GLib.IO_STATUS_ERROR.*GLib.IOStatus.ERROR.*") + + def test_deprecated_attribute_warning_coverage(self): + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + GObject.markup_escape_text + GObject.PRIORITY_DEFAULT + GObject.GError + GObject.PARAM_CONSTRUCT + GObject.SIGNAL_ACTION + GObject.property + GObject.IO_STATUS_ERROR + GObject.G_MAXUINT64 + GLib.IO_STATUS_ERROR + GLib.SPAWN_SEARCH_PATH + GLib.OPTION_FLAG_HIDDEN + GLib.IO_FLAG_IS_WRITEABLE + GLib.IO_FLAG_NONBLOCK + GLib.USER_DIRECTORY_DESKTOP + GLib.OPTION_ERROR_BAD_VALUE + GLib.glib_version + GLib.pyglib_version + self.assertEqual(len(warn), 17) + + def test_deprecated_init_no_keywords(self): + def init(self, **kwargs): + self.assertDictEqual(kwargs, {'a': 1, 'b': 2, 'c': 3}) + + fn = gi.overrides.deprecated_init(init, arg_names=('a', 'b', 'c')) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + fn(self, 1, 2, 3) + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*keyword.*a, b, c.*') + + def test_deprecated_init_no_keywords_out_of_order(self): + def init(self, **kwargs): + self.assertDictEqual(kwargs, {'a': 1, 'b': 2, 'c': 3}) + + fn = gi.overrides.deprecated_init(init, arg_names=('b', 'a', 'c')) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + fn(self, 2, 1, 3) + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*keyword.*b, a, c.*') + + def test_deprecated_init_ignored_keyword(self): + def init(self, **kwargs): + self.assertDictEqual(kwargs, {'a': 1, 'c': 3}) + + fn = gi.overrides.deprecated_init(init, + arg_names=('a', 'b', 'c'), + ignore=('b',)) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + fn(self, 1, 2, 3) + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*keyword.*a, b, c.*') + + def test_deprecated_init_with_aliases(self): + def init(self, **kwargs): + self.assertDictEqual(kwargs, {'a': 1, 'b': 2, 'c': 3}) + + fn = gi.overrides.deprecated_init(init, + arg_names=('a', 'b', 'c'), + deprecated_aliases={'b': 'bb', 'c': 'cc'}) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + + fn(self, a=1, bb=2, cc=3) + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*keyword.*"bb, cc".*deprecated.*"b, c" respectively') + + def test_deprecated_init_with_defaults(self): + def init(self, **kwargs): + self.assertDictEqual(kwargs, {'a': 1, 'b': 2, 'c': 3}) + + fn = gi.overrides.deprecated_init(init, + arg_names=('a', 'b', 'c'), + deprecated_defaults={'b': 2, 'c': 3}) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + fn(self, a=1) + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*relying on deprecated non-standard defaults.*' + 'explicitly use: b=2, c=3') diff --git a/tests/test_gio.py b/tests/test_gio.py index 57ab013..07ee506 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -1,11 +1,18 @@ # -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab +import os import unittest +import warnings + +import pytest import gi.overrides +from gi import PyGIWarning from gi.repository import GLib, Gio +from .helper import ignore_gi_deprecation_warnings + class TestGio(unittest.TestCase): def test_file_enumerator(self): @@ -37,10 +44,19 @@ class TestGio(unittest.TestCase): value = menu.get_item_attribute_value(0, "action", GLib.VariantType.new("s")) self.assertEqual("app.test", value.unpack()) + def test_volume_monitor_warning(self): + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + Gio.VolumeMonitor() + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGIWarning)) + self.assertRegex(str(warn[0].message), + '.*Gio\\.VolumeMonitor\\.get\\(\\).*') + class TestGSettings(unittest.TestCase): def setUp(self): - self.settings = Gio.Settings('org.gnome.test') + self.settings = Gio.Settings.new('org.gnome.test') # we change the values in the tests, so set them to predictable start # value self.settings.reset('test-string') @@ -48,6 +64,17 @@ class TestGSettings(unittest.TestCase): self.settings.reset('test-boolean') self.settings.reset('test-enum') + def test_iter(self): + assert set(list(self.settings)) == set([ + 'test-tuple', 'test-array', 'test-boolean', 'test-string', + 'test-enum', 'test-range']) + + def test_get_set(self): + for key in self.settings: + old_value = self.settings[key] + self.settings[key] = old_value + assert self.settings[key] == old_value + def test_native(self): self.assertTrue('test-array' in self.settings.list_keys()) @@ -66,6 +93,9 @@ class TestGSettings(unittest.TestCase): v = self.settings.get_value('test-tuple') self.assertEqual(v.unpack(), (1, 2)) + v = self.settings.get_value('test-range') + assert v.unpack() == 123 + # set a value self.settings.set_string('test-string', 'World') self.assertEqual(self.settings.get_string('test-string'), 'World') @@ -78,12 +108,12 @@ class TestGSettings(unittest.TestCase): self.assertEqual(self.settings.get_property('path'), '/tests/') # optional constructor arguments - with_path = Gio.Settings('org.gnome.nopathtest', path='/mypath/') + with_path = Gio.Settings.new_with_path('org.gnome.nopathtest', '/mypath/') self.assertEqual(with_path.get_property('path'), '/mypath/') self.assertEqual(with_path['np-int'], 42) def test_dictionary_api(self): - self.assertEqual(len(self.settings), 5) + self.assertEqual(len(self.settings), 6) self.assertTrue('test-array' in self.settings) self.assertTrue('test-array' in self.settings.keys()) self.assertFalse('nonexisting' in self.settings) @@ -114,12 +144,25 @@ class TestGSettings(unittest.TestCase): self.assertRaises(ValueError, self.settings.__setitem__, 'test-enum', 'plum') self.assertRaises(KeyError, self.settings.__setitem__, 'unknown', 'moo') + def test_set_range(self): + self.settings['test-range'] = 7 + assert self.settings['test-range'] == 7 + self.settings['test-range'] = 65535 + assert self.settings['test-range'] == 65535 + + with pytest.raises(ValueError, match=".*7 - 65535.*"): + self.settings['test-range'] = 7 - 1 + + with pytest.raises(ValueError, match=".*7 - 65535.*"): + self.settings['test-range'] = 65535 + 1 + def test_empty(self): - empty = Gio.Settings('org.gnome.empty', path='/tests/') + empty = Gio.Settings.new_with_path('org.gnome.empty', '/tests/') self.assertEqual(len(empty), 0) self.assertEqual(bool(empty), True) self.assertEqual(empty.keys(), []) + @ignore_gi_deprecation_warnings def test_change_event(self): changed_log = [] change_event_log = [] @@ -139,6 +182,7 @@ class TestGSettings(unittest.TestCase): 1)]) +@unittest.skipIf(os.name == "nt", "FIXME") class TestGFile(unittest.TestCase): def setUp(self): self.file, self.io_stream = Gio.File.new_tmp('TestGFile.XXXXXX') @@ -201,3 +245,98 @@ class TestGFile(unittest.TestCase): main_loop = GLib.MainLoop() main_loop.run() self.assertFalse(self.file.query_exists(None)) + + +@unittest.skipIf(os.name == "nt", "crashes on Windows") +class TestGApplication(unittest.TestCase): + def test_command_line(self): + class App(Gio.Application): + args = None + + def __init__(self): + super(App, self).__init__(flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE) + + def do_command_line(self, cmdline): + self.args = cmdline.get_arguments() + return 42 + + app = App() + res = app.run(['spam', 'eggs']) + + self.assertEqual(res, 42) + self.assertSequenceEqual(app.args, ['spam', 'eggs']) + + def test_local_command_line(self): + class App(Gio.Application): + local_args = None + + def __init__(self): + super(App, self).__init__(flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE) + + def do_local_command_line(self, args): + self.local_args = args[:] # copy + args.remove('eggs') + + # True skips do_command_line being called. + return True, args, 42 + + app = App() + res = app.run(['spam', 'eggs']) + + self.assertEqual(res, 42) + self.assertSequenceEqual(app.local_args, ['spam', 'eggs']) + + def test_local_and_remote_command_line(self): + class App(Gio.Application): + args = None + local_args = None + + def __init__(self): + super(App, self).__init__(flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE) + + def do_command_line(self, cmdline): + self.args = cmdline.get_arguments() + return 42 + + def do_local_command_line(self, args): + self.local_args = args[:] # copy + args.remove('eggs') + + # False causes do_command_line to be called with args. + return False, args, 0 + + app = App() + res = app.run(['spam', 'eggs']) + + self.assertEqual(res, 42) + self.assertSequenceEqual(app.args, ['spam']) + self.assertSequenceEqual(app.local_args, ['spam', 'eggs']) + + @unittest.skipUnless(hasattr(Gio.Application, 'add_main_option'), + 'Requires newer version of GLib') + def test_add_main_option(self): + stored_options = [] + + def on_handle_local_options(app, options): + stored_options.append(options) + return 0 # Return 0 if options have been handled + + def on_activate(app): + pass + + app = Gio.Application() + app.add_main_option(long_name='string', + short_name=b's', + flags=0, + arg=GLib.OptionArg.STRING, + description='some string') + + app.connect('activate', on_activate) + app.connect('handle-local-options', on_handle_local_options) + app.run(['app', '-s', 'test string']) + + self.assertEqual(len(stored_options), 1) + options = stored_options[0] + self.assertTrue(options.contains('string')) + self.assertEqual(options.lookup_value('string').unpack(), + 'test string') diff --git a/tests/test_glib.py b/tests/test_glib.py index 3cde168..19eff7f 100644 --- a/tests/test_glib.py +++ b/tests/test_glib.py @@ -1,31 +1,45 @@ # -*- Mode: Python -*- -# encoding: UTF-8 +import os +import sys import unittest import os.path import warnings import subprocess +import pytest from gi.repository import GLib from gi import PyGIDeprecationWarning -from compathelper import _unicode, _bytes - class TestGLib(unittest.TestCase): + + @pytest.mark.xfail() + def test_pytest_capture_error_in_closure(self): + # this test is supposed to fail + ml = GLib.MainLoop() + + def callback(): + ml.quit() + raise Exception("expected") + + GLib.idle_add(callback) + ml.run() + + @unittest.skipIf(os.name == "nt", "no bash on Windows") def test_find_program_in_path(self): bash_path = GLib.find_program_in_path('bash') - self.assertTrue(bash_path.endswith('/bash')) + self.assertTrue(bash_path.endswith(os.path.sep + 'bash')) self.assertTrue(os.path.exists(bash_path)) self.assertEqual(GLib.find_program_in_path('non existing'), None) def test_markup_escape_text(self): - self.assertEqual(GLib.markup_escape_text(_unicode('a&bä')), 'a&bä') - self.assertEqual(GLib.markup_escape_text(_bytes('a&b\x05')), 'a&b') + self.assertEqual(GLib.markup_escape_text(u'a&bä'), 'a&bä') + self.assertEqual(GLib.markup_escape_text(b'a&b\x05'), 'a&b') # with explicit length argument - self.assertEqual(GLib.markup_escape_text(_bytes('a\x05\x01\x02'), 2), 'a') + self.assertEqual(GLib.markup_escape_text(b'a\x05\x01\x02', 2), 'a') def test_progname(self): GLib.set_prgname('moo') @@ -37,15 +51,18 @@ class TestGLib(unittest.TestCase): def test_xdg_dirs(self): d = GLib.get_user_data_dir() - self.assertTrue('/' in d, d) - d = GLib.get_user_special_dir(GLib.USER_DIRECTORY_DESKTOP) - self.assertTrue('/' in d, d) - # also works with backwards compatible enum names - self.assertEqual(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC), - GLib.get_user_special_dir(GLib.USER_DIRECTORY_MUSIC)) + self.assertTrue(os.path.sep in d, d) + d = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP) + self.assertTrue(os.path.sep in d, d) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', PyGIDeprecationWarning) + + # also works with backwards compatible enum names + self.assertEqual(GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC), + GLib.get_user_special_dir(GLib.USER_DIRECTORY_MUSIC)) for d in GLib.get_system_config_dirs(): - self.assertTrue('/' in d, d) + self.assertTrue(os.path.sep in d, d) for d in GLib.get_system_data_dirs(): self.assertTrue(isinstance(d, str), d) @@ -56,13 +73,26 @@ class TestGLib(unittest.TestCase): self.assertEqual(GLib.filename_display_name('foo'), 'foo') self.assertEqual(GLib.filename_display_basename('bar/foo'), 'foo') + def glibfsencode(f): + # the annotations of filename_from_utf8() was changed in + # https://bugzilla.gnome.org/show_bug.cgi?id=756128 + if isinstance(f, bytes): + return f + if os.name == "nt": + return f.encode("utf-8", "surrogatepass") + else: + return os.fsencode(f) + # this is locale dependent, so we cannot completely verify the result - res = GLib.filename_from_utf8(_unicode('aäb')) + res = GLib.filename_from_utf8(u'aäb') + res = glibfsencode(res) self.assertTrue(isinstance(res, bytes)) self.assertGreaterEqual(len(res), 3) # with explicit length argument - self.assertEqual(GLib.filename_from_utf8(_unicode('aäb'), 1), b'a') + res = GLib.filename_from_utf8(u'aäb', 1) + res = glibfsencode(res) + self.assertEqual(res, b'a') def test_uri_extract(self): res = GLib.uri_list_extract_uris('''# some comment @@ -82,6 +112,7 @@ https://my.org/q?x=1&y=2 self.assertTrue(isinstance(tm, float)) self.assertGreater(tm, 1350000000.0) + @unittest.skipIf(sys.platform == "darwin", "fails on OSX") def test_main_loop(self): # note we do not test run() here, as we use this in countless other # tests @@ -119,57 +150,96 @@ https://my.org/q?x=1&y=2 self.assertTrue(context.pending() in [True, False]) self.assertTrue(context.iteration(False) in [True, False]) + @unittest.skipIf(os.name == "nt", "hangs") def test_io_add_watch_no_data(self): (r, w) = os.pipe() call_data = [] def cb(fd, condition): call_data.append((fd, condition, os.read(fd, 1))) + if len(call_data) == 2: + ml.quit() return True # io_add_watch() takes an IOChannel, calling with an fd is deprecated with warnings.catch_warnings(record=True) as warn: warnings.simplefilter('always') - GLib.io_add_watch(r, GLib.IOCondition.IN, cb) + GLib.io_add_watch(r, GLib.IOCondition.IN, cb, + priority=GLib.PRIORITY_HIGH) self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) + ml = GLib.MainLoop() - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + GLib.idle_add(write) + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(call_data, [(r, GLib.IOCondition.IN, b'a'), (r, GLib.IOCondition.IN, b'b')]) + @unittest.skipIf(os.name == "nt", "hangs") def test_io_add_watch_with_data(self): (r, w) = os.pipe() call_data = [] def cb(fd, condition, data): call_data.append((fd, condition, os.read(fd, 1), data)) + if len(call_data) == 2: + ml.quit() return True # io_add_watch() takes an IOChannel, calling with an fd is deprecated with warnings.catch_warnings(record=True) as warn: warnings.simplefilter('always') - GLib.io_add_watch(r, GLib.IOCondition.IN, cb, 'moo') + GLib.io_add_watch(r, GLib.IOCondition.IN, cb, 'moo', + priority=GLib.PRIORITY_HIGH) self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) + ml = GLib.MainLoop() - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + GLib.idle_add(write) + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(call_data, [(r, GLib.IOCondition.IN, b'a', 'moo'), (r, GLib.IOCondition.IN, b'b', 'moo')]) + @unittest.skipIf(os.name == "nt", "hangs") + def test_io_add_watch_with_multiple_data(self): + (r, w) = os.pipe() + call_data = [] + + def cb(fd, condition, *user_data): + call_data.append((fd, condition, os.read(fd, 1), user_data)) + ml.quit() + return True + + # io_add_watch() takes an IOChannel, calling with an fd is deprecated + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + GLib.io_add_watch(r, GLib.IOCondition.IN, cb, 'moo', 'foo') + self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + + ml = GLib.MainLoop() + GLib.idle_add(lambda: os.write(w, b'a') and False) + GLib.timeout_add(2000, ml.quit) + ml.run() + + self.assertEqual(call_data, [(r, GLib.IOCondition.IN, b'a', ('moo', 'foo'))]) + + @unittest.skipIf(sys.platform == "darwin", "fails") + @unittest.skipIf(os.name == "nt", "no shell on Windows") def test_io_add_watch_pyfile(self): call_data = [] - cmd = subprocess.Popen('sleep 0.1; echo hello; sleep 0.2; echo world', - shell=True, stdout=subprocess.PIPE) + cmd = subprocess.Popen('echo hello; echo world', + shell=True, bufsize=0, stdout=subprocess.PIPE) def cb(file, condition): call_data.append((file, condition, file.readline())) @@ -194,13 +264,32 @@ https://my.org/q?x=1&y=2 (cmd.stdout, GLib.IOCondition.IN, b'world\n')]) def test_glib_version(self): - (major, minor, micro) = GLib.glib_version - self.assertGreaterEqual(major, 2) - self.assertGreaterEqual(minor, 0) - self.assertGreaterEqual(micro, 0) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', PyGIDeprecationWarning) + + (major, minor, micro) = GLib.glib_version + self.assertGreaterEqual(major, 2) + self.assertGreaterEqual(minor, 0) + self.assertGreaterEqual(micro, 0) def test_pyglib_version(self): - (major, minor, micro) = GLib.pyglib_version - self.assertGreaterEqual(major, 3) - self.assertGreaterEqual(minor, 0) - self.assertGreaterEqual(micro, 0) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', PyGIDeprecationWarning) + + (major, minor, micro) = GLib.pyglib_version + self.assertGreaterEqual(major, 3) + self.assertGreaterEqual(minor, 0) + self.assertGreaterEqual(micro, 0) + + def test_timezone_constructor(self): + with warnings.catch_warnings(): + warnings.simplefilter('ignore', DeprecationWarning) + timezone = GLib.TimeZone("+05:21") + self.assertEqual(timezone.get_offset(0), ((5 * 60) + 21) * 60) + + def test_source_attach_implicit_context(self): + context = GLib.MainContext.default() + source = GLib.Idle() + source_id = source.attach() + self.assertEqual(context, source.get_context()) + self.assertTrue(GLib.Source.remove(source_id)) diff --git a/tests/test_gobject.py b/tests/test_gobject.py index 57d3822..fbc3bb7 100644 --- a/tests/test_gobject.py +++ b/tests/test_gobject.py @@ -4,24 +4,101 @@ import sys import gc import unittest import warnings +import weakref +import platform -from gi.repository import GObject, GLib +import pytest + +from gi.repository import GObject, GLib, Gio from gi import PyGIDeprecationWarning from gi.module import get_introspection_module -from gi._gobject import _gobject +from gi import _gi import testhelper +from .helper import capture_glib_deprecation_warnings + + +@pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="crashes") +def test_gobject_weak_ref(): + + called = [] + + def callback(*args): + called.extend(args) + + # object gets finalized + obj = GObject.Object() + obj.weak_ref(callback, 1) + del obj + gc.collect() + gc.collect() + assert called == [1] + del called[:] + + # wrapper gets finalized first + obj = GObject.Object() + pyref = weakref.ref(obj, lambda x: callback(-2)) + value = GObject.Value(GObject.Object, obj) + ref = obj.weak_ref(callback, 2) + del obj + gc.collect() + assert called == [-2] + del pyref + value.unset() + gc.collect() + assert called == [-2, 2] + del called[:] + + # weakref gets unregistered first + obj = GObject.Object() + ref = obj.weak_ref(callback, 3) + ref.unref() + del obj + gc.collect() + assert not called + + # weakref gets GCed + obj = GObject.Object() + obj.weak_ref(callback, 4) + gc.collect() + del obj + assert called == [4] class TestGObjectAPI(unittest.TestCase): + + def test_run_dispose(self): + class TestObject(GObject.GObject): + int_prop = GObject.Property(default=0, type=int) + + obj = TestObject() + called = [] + + def on_notify(*args): + called.append(args) + + obj.connect('notify::int-prop', on_notify) + obj.notify("int-prop") + obj.notify("int-prop") + # after this everything should be disconnected + obj.run_dispose() + obj.notify("int-prop") + obj.notify("int-prop") + assert len(called) == 2 + + def test_call_method_uninitialized_instance(self): + obj = GObject.Object.__new__(GObject.Object) + with self.assertRaisesRegex(RuntimeError, '.*is not initialized'): + obj.notify("foo") + def test_gobject_inheritance(self): # GObject.Object is a class hierarchy as follows: # overrides.Object -> introspection.Object -> static.GObject GIObjectModule = get_introspection_module('GObject') self.assertTrue(issubclass(GObject.Object, GIObjectModule.Object)) - self.assertTrue(issubclass(GIObjectModule.Object, _gobject.GObject)) + self.assertTrue(issubclass(GIObjectModule.Object, _gi.GObject)) - self.assertEqual(_gobject.GObject.__gtype__, GObject.TYPE_OBJECT) + self.assertEqual(_gi.GObject.__gtype__, GObject.TYPE_OBJECT) self.assertEqual(GIObjectModule.Object.__gtype__, GObject.TYPE_OBJECT) self.assertEqual(GObject.Object.__gtype__, GObject.TYPE_OBJECT) @@ -58,17 +135,20 @@ class TestGObjectAPI(unittest.TestCase): self.assertLess(GObject.PRIORITY_HIGH, GObject.PRIORITY_DEFAULT) def test_min_max_int(self): - self.assertEqual(GObject.G_MAXINT16, 2 ** 15 - 1) - self.assertEqual(GObject.G_MININT16, -2 ** 15) - self.assertEqual(GObject.G_MAXUINT16, 2 ** 16 - 1) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', PyGIDeprecationWarning) - self.assertEqual(GObject.G_MAXINT32, 2 ** 31 - 1) - self.assertEqual(GObject.G_MININT32, -2 ** 31) - self.assertEqual(GObject.G_MAXUINT32, 2 ** 32 - 1) + self.assertEqual(GObject.G_MAXINT16, 2 ** 15 - 1) + self.assertEqual(GObject.G_MININT16, -2 ** 15) + self.assertEqual(GObject.G_MAXUINT16, 2 ** 16 - 1) - self.assertEqual(GObject.G_MAXINT64, 2 ** 63 - 1) - self.assertEqual(GObject.G_MININT64, -2 ** 63) - self.assertEqual(GObject.G_MAXUINT64, 2 ** 64 - 1) + self.assertEqual(GObject.G_MAXINT32, 2 ** 31 - 1) + self.assertEqual(GObject.G_MININT32, -2 ** 31) + self.assertEqual(GObject.G_MAXUINT32, 2 ** 32 - 1) + + self.assertEqual(GObject.G_MAXINT64, 2 ** 63 - 1) + self.assertEqual(GObject.G_MININT64, -2 ** 63) + self.assertEqual(GObject.G_MAXUINT64, 2 ** 64 - 1) class TestReferenceCounting(unittest.TestCase): @@ -233,19 +313,23 @@ class TestPythonReferenceCounting(unittest.TestCase): def test_new_instance_has_two_refs(self): obj = GObject.GObject() - self.assertEqual(sys.getrefcount(obj), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(obj), 2) def test_new_instance_has_two_refs_using_gobject_new(self): obj = GObject.new(GObject.GObject) - self.assertEqual(sys.getrefcount(obj), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(obj), 2) def test_new_subclass_instance_has_two_refs(self): obj = A() - self.assertEqual(sys.getrefcount(obj), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(obj), 2) def test_new_subclass_instance_has_two_refs_using_gobject_new(self): obj = GObject.new(A) - self.assertEqual(sys.getrefcount(obj), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(obj), 2) class TestContextManagers(unittest.TestCase): @@ -270,14 +354,16 @@ class TestContextManagers(unittest.TestCase): self.assertEqual(self.tracking, [1, 2]) self.assertEqual(self.obj.__grefcount__, 1) - pyref_count = sys.getrefcount(self.obj) + if hasattr(sys, "getrefcount"): + pyref_count = sys.getrefcount(self.obj) # Using the context manager the tracking list should not be affected. # The GObject reference count should stay the same and the python # object ref-count should go up. with self.obj.freeze_notify(): self.assertEqual(self.obj.__grefcount__, 1) - self.assertEqual(sys.getrefcount(self.obj), pyref_count + 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(self.obj), pyref_count + 1) self.obj.props.prop = 3 self.assertEqual(self.obj.props.prop, 3) self.assertEqual(self.tracking, [1, 2]) @@ -289,7 +375,8 @@ class TestContextManagers(unittest.TestCase): self.assertEqual(self.obj.props.prop, 3) self.assertEqual(self.tracking, [1, 2, 3]) self.assertEqual(self.obj.__grefcount__, 1) - self.assertEqual(sys.getrefcount(self.obj), pyref_count) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(self.obj), pyref_count) def test_handler_block_context(self): # Verify prop tracking list @@ -300,14 +387,16 @@ class TestContextManagers(unittest.TestCase): self.assertEqual(self.tracking, [1, 2]) self.assertEqual(self.obj.__grefcount__, 1) - pyref_count = sys.getrefcount(self.obj) + if hasattr(sys, "getrefcount"): + pyref_count = sys.getrefcount(self.obj) # Using the context manager the tracking list should not be affected. # The GObject reference count should stay the same and the python # object ref-count should go up. with self.obj.handler_block(self.handler): self.assertEqual(self.obj.__grefcount__, 1) - self.assertEqual(sys.getrefcount(self.obj), pyref_count + 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(self.obj), pyref_count + 1) self.obj.props.prop = 3 self.assertEqual(self.obj.props.prop, 3) self.assertEqual(self.tracking, [1, 2]) @@ -319,7 +408,8 @@ class TestContextManagers(unittest.TestCase): self.assertEqual(self.obj.props.prop, 3) self.assertEqual(self.tracking, [1, 2]) self.assertEqual(self.obj.__grefcount__, 1) - self.assertEqual(sys.getrefcount(self.obj), pyref_count) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(self.obj), pyref_count) def test_freeze_notify_context_nested(self): self.assertEqual(self.tracking, []) @@ -415,6 +505,8 @@ class TestContextManagers(unittest.TestCase): self.assertEqual(self.tracking, [2]) +@unittest.skipUnless(hasattr(GObject.Binding, 'unbind'), + 'Requires newer GLib which has g_binding_unbind') class TestPropertyBindings(unittest.TestCase): class TestObject(GObject.GObject): int_prop = GObject.Property(default=0, type=int) @@ -438,6 +530,14 @@ class TestPropertyBindings(unittest.TestCase): self.assertEqual(self.source.int_prop, 1) self.assertEqual(self.target.int_prop, 2) + def test_call_binding(self): + binding = self.source.bind_property('int_prop', self.target, 'int_prop', + GObject.BindingFlags.DEFAULT) + with capture_glib_deprecation_warnings() as warn: + result = binding() + assert len(warn) + assert result is binding + def test_bidirectional_binding(self): binding = self.source.bind_property('int_prop', self.target, 'int_prop', GObject.BindingFlags.BIDIRECTIONAL) @@ -500,17 +600,19 @@ class TestPropertyBindings(unittest.TestCase): self.assertEqual(user_data, test_data) return value // 2 - test_data_ref_count = sys.getrefcount(test_data) - transform_to_ref_count = sys.getrefcount(transform_to) - transform_from_ref_count = sys.getrefcount(transform_from) + if hasattr(sys, "getrefcount"): + test_data_ref_count = sys.getrefcount(test_data) + transform_to_ref_count = sys.getrefcount(transform_to) + transform_from_ref_count = sys.getrefcount(transform_from) # bidirectional bindings binding = self.source.bind_property('int_prop', self.target, 'int_prop', GObject.BindingFlags.BIDIRECTIONAL, transform_to, transform_from, test_data) binding = binding # PyFlakes - binding_ref_count = sys.getrefcount(binding()) - binding_gref_count = binding().__grefcount__ + if hasattr(sys, "getrefcount"): + binding_ref_count = sys.getrefcount(binding) + binding_gref_count = binding.__grefcount__ self.source.int_prop = 1 self.assertEqual(self.source.int_prop, 1) @@ -520,19 +622,18 @@ class TestPropertyBindings(unittest.TestCase): self.assertEqual(self.source.int_prop, 2) self.assertEqual(self.target.int_prop, 4) - self.assertEqual(sys.getrefcount(binding()), binding_ref_count) - self.assertEqual(binding().__grefcount__, binding_gref_count) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(binding), binding_ref_count) + self.assertEqual(binding.__grefcount__, binding_gref_count) # test_data ref count increases by 2, once for each callback. - self.assertEqual(sys.getrefcount(test_data), test_data_ref_count + 2) - self.assertEqual(sys.getrefcount(transform_to), transform_to_ref_count + 1) - self.assertEqual(sys.getrefcount(transform_from), transform_from_ref_count + 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(test_data), test_data_ref_count + 2) + self.assertEqual(sys.getrefcount(transform_to), transform_to_ref_count + 1) + self.assertEqual(sys.getrefcount(transform_from), transform_from_ref_count + 1) # Unbind should clear out the binding and its transforms binding.unbind() - self.assertEqual(binding(), None) - del binding - gc.collect() # Setting source or target should not change the other. self.target.int_prop = 3 @@ -540,9 +641,10 @@ class TestPropertyBindings(unittest.TestCase): self.assertEqual(self.target.int_prop, 3) self.assertEqual(self.source.int_prop, 5) - self.assertEqual(sys.getrefcount(test_data), test_data_ref_count) - self.assertEqual(sys.getrefcount(transform_to), transform_to_ref_count) - self.assertEqual(sys.getrefcount(transform_from), transform_from_ref_count) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(test_data), test_data_ref_count) + self.assertEqual(sys.getrefcount(transform_to), transform_to_ref_count) + self.assertEqual(sys.getrefcount(transform_from), transform_from_ref_count) def test_explicit_unbind_clears_connection(self): self.assertEqual(self.source.int_prop, 0) @@ -554,15 +656,24 @@ class TestPropertyBindings(unittest.TestCase): self.assertEqual(self.source.int_prop, 1) self.assertEqual(self.target.int_prop, 1) + # unbind should clear out the bindings self reference binding.unbind() - self.assertEqual(binding(), None) + self.assertEqual(binding.__grefcount__, 1) self.source.int_prop = 10 self.assertEqual(self.source.int_prop, 10) self.assertEqual(self.target.int_prop, 1) - # An already unbound BindingWeakRef will raise if unbind is attempted a second time. - self.assertRaises(ValueError, binding.unbind) + glib_version = (GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION) + + # calling unbind() on an already unbound binding + if glib_version >= (2, 57, 3): + # Fixed in newer glib: + # https://gitlab.gnome.org/GNOME/glib/merge_requests/244 + for i in range(10): + binding.unbind() + else: + self.assertRaises(ValueError, binding.unbind) def test_reference_counts(self): self.assertEqual(self.source.__grefcount__, 1) @@ -572,7 +683,7 @@ class TestPropertyBindings(unittest.TestCase): # the act of binding and the ref incurred by using __call__ to generate # a wrapper from the weak binding ref within python. binding = self.source.bind_property('int_prop', self.target, 'int_prop') - self.assertEqual(binding().__grefcount__, 2) + self.assertEqual(binding.__grefcount__, 2) # Creating a binding does not inc refs on source and target (they are weak # on the binding object itself) @@ -581,18 +692,25 @@ class TestPropertyBindings(unittest.TestCase): # Use GObject.get_property because the "props" accessor leaks. # Note property names are canonicalized. - self.assertEqual(binding().get_property('source'), self.source) - self.assertEqual(binding().get_property('source_property'), 'int-prop') - self.assertEqual(binding().get_property('target'), self.target) - self.assertEqual(binding().get_property('target_property'), 'int-prop') - self.assertEqual(binding().get_property('flags'), GObject.BindingFlags.DEFAULT) - - # Delete reference to source or target and the binding should listen. + self.assertEqual(binding.get_property('source'), self.source) + self.assertEqual(binding.get_property('source_property'), 'int-prop') + self.assertEqual(binding.get_property('target'), self.target) + self.assertEqual(binding.get_property('target_property'), 'int-prop') + self.assertEqual(binding.get_property('flags'), GObject.BindingFlags.DEFAULT) + + # Delete reference to source or target and the binding will remove its own + # "self reference". ref = self.source.weak_ref() del self.source gc.collect() self.assertEqual(ref(), None) - self.assertEqual(binding(), None) + self.assertEqual(binding.__grefcount__, 1) + + # Finally clear out the last ref held by the python wrapper + ref = binding.weak_ref() + del binding + gc.collect() + self.assertEqual(ref(), None) class TestGValue(unittest.TestCase): @@ -657,5 +775,86 @@ class TestGValue(unittest.TestCase): value = GObject.Value(GObject.TYPE_OBJECT, obj) self.assertEqual(value.get_value(), obj) -if __name__ == '__main__': - unittest.main() + def test_value_array(self): + value = GObject.Value(GObject.ValueArray) + self.assertEqual(value.g_type, GObject.type_from_name('GValueArray')) + value.set_value([32, 'foo_bar', 0.3]) + self.assertEqual(value.get_value(), [32, 'foo_bar', 0.3]) + + def test_value_array_from_gvalue_list(self): + value = GObject.Value(GObject.ValueArray, [ + GObject.Value(GObject.TYPE_UINT, 0xffffffff), + GObject.Value(GObject.TYPE_STRING, 'foo_bar')]) + self.assertEqual(value.g_type, GObject.type_from_name('GValueArray')) + self.assertEqual(value.get_value(), [0xffffffff, 'foo_bar']) + self.assertEqual(testhelper.value_array_get_nth_type(value, 0), GObject.TYPE_UINT) + self.assertEqual(testhelper.value_array_get_nth_type(value, 1), GObject.TYPE_STRING) + + def test_value_array_append_gvalue(self): + with warnings.catch_warnings(): + warnings.simplefilter('ignore', DeprecationWarning) + + arr = GObject.ValueArray.new(0) + arr.append(GObject.Value(GObject.TYPE_UINT, 0xffffffff)) + arr.append(GObject.Value(GObject.TYPE_STRING, 'foo_bar')) + self.assertEqual(arr.get_nth(0), 0xffffffff) + self.assertEqual(arr.get_nth(1), 'foo_bar') + self.assertEqual(testhelper.value_array_get_nth_type(arr, 0), GObject.TYPE_UINT) + self.assertEqual(testhelper.value_array_get_nth_type(arr, 1), GObject.TYPE_STRING) + + def test_gerror_boxing(self): + error = GLib.Error('test message', domain='mydomain', code=42) + value = GObject.Value(GLib.Error, error) + self.assertEqual(value.g_type, GObject.type_from_name('GError')) + + unboxed = value.get_value() + self.assertEqual(unboxed.message, error.message) + self.assertEqual(unboxed.domain, error.domain) + self.assertEqual(unboxed.code, error.code) + + def test_gerror_novalue(self): + GLib.Error('test message', domain='mydomain', code=42) + value = GObject.Value(GLib.Error) + self.assertEqual(value.g_type, GObject.type_from_name('GError')) + self.assertEqual(value.get_value(), None) + + +def test_list_properties(): + + def find_param(props, name): + for param in props: + if param.name == name: + return param + return + + list_props = GObject.list_properties + + props = list_props(Gio.Action) + param = find_param(props, "enabled") + assert param + assert param.value_type == GObject.TYPE_BOOLEAN + assert list_props("GAction") == list_props(Gio.Action) + assert list_props(Gio.Action.__gtype__) == list_props(Gio.Action) + + props = list_props(Gio.SimpleAction) + assert find_param(props, "enabled") + + def names(props): + return [p.name for p in props] + + assert (set(names(list_props(Gio.Action))) <= + set(names(list_props(Gio.SimpleAction)))) + + props = list_props(Gio.FileIcon) + param = find_param(props, "file") + assert param + assert param.value_type == Gio.File.__gtype__ + + assert list_props("GFileIcon") == list_props(Gio.FileIcon) + assert list_props(Gio.FileIcon.__gtype__) == list_props(Gio.FileIcon) + assert list_props(Gio.FileIcon( + file=Gio.File.new_for_path('.'))) == list_props(Gio.FileIcon) + + for obj in [Gio.ActionEntry, Gio.DBusError, 0, object()]: + with pytest.raises(TypeError): + list_props(obj) diff --git a/tests/test_gtk_template.py b/tests/test_gtk_template.py new file mode 100644 index 0000000..9dd7a90 --- /dev/null +++ b/tests/test_gtk_template.py @@ -0,0 +1,721 @@ +import tempfile +import os +import pytest + +Gtk = pytest.importorskip("gi.repository.Gtk") +GLib = pytest.importorskip("gi.repository.GLib") +GObject = pytest.importorskip("gi.repository.GObject") +Gio = pytest.importorskip("gi.repository.Gio") + +from .helper import capture_exceptions + +GTK4 = (Gtk._version == "4.0") + + +def new_gtype_name(_count=[0]): + _count[0] += 1 + return "GtkTemplateTest%d" % _count[0] + + +def ensure_resource_registered(): + resource_path = "/org/gnome/pygobject/test/a.ui" + + def is_registered(path): + try: + Gio.resources_get_info(path, Gio.ResourceLookupFlags.NONE) + except GLib.Error: + return False + return True + + if is_registered(resource_path): + return resource_path + + gresource_data = ( + b'GVariant\x00\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00' + b'\xc8\x00\x00\x00\x00\x00\x00(\x06\x00\x00\x00\x00\x00\x00\x00' + b'\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00' + b'\x06\x00\x00\x00KP\x90\x0b\x03\x00\x00\x00\xc8\x00\x00\x00' + b'\x04\x00L\x00\xcc\x00\x00\x00\xd0\x00\x00\x00\xb0\xb7$0' + b'\x00\x00\x00\x00\xd0\x00\x00\x00\x06\x00L\x00\xd8\x00\x00\x00' + b'\xdc\x00\x00\x00f\xc30\xd1\x01\x00\x00\x00\xdc\x00\x00\x00' + b'\n\x00L\x00\xe8\x00\x00\x00\xec\x00\x00\x00\xd4\xb5\x02\x00' + b'\xff\xff\xff\xff\xec\x00\x00\x00\x01\x00L\x00\xf0\x00\x00\x00' + b'\xf4\x00\x00\x005H}\xe3\x02\x00\x00\x00\xf4\x00\x00\x00' + b'\x05\x00L\x00\xfc\x00\x00\x00\x00\x01\x00\x00\xa2^\xd6t' + b'\x04\x00\x00\x00\x00\x01\x00\x00\x04\x00v\x00\x08\x01\x00\x00' + b'\xa5\x01\x00\x00org/\x01\x00\x00\x00gnome/\x00\x00\x02\x00\x00\x00' + b'pygobject/\x00\x00\x04\x00\x00\x00/\x00\x00\x00\x00\x00\x00\x00' + b'test/\x00\x00\x00\x05\x00\x00\x00a.ui\x00\x00\x00\x00' + b'\x8d\x00\x00\x00\x00\x00\x00\x00\n \n\n\x00\x00(uuay)' + ) + + resource = Gio.Resource.new_from_data(GLib.Bytes.new(gresource_data)) + Gio.resources_register(resource) + assert is_registered(resource_path) + return resource_path + + +def test_allow_init_template_call(): + + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + @Gtk.Template.from_string(xml) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + def __init__(self): + super(Foo, self).__init__() + self.init_template() + + # Stop current pygobject from handling the initialisation + del Foo.__dontuse_ginstance_init__ + + Foo() + + +def test_init_template_second_instance(): + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + @Gtk.Template.from_string(xml) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + label = Gtk.Template.Child("label") + + def __init__(self): + super(Foo, self).__init__() + self.init_template() + + # Stop current pygobject from handling the initialisation + del Foo.__dontuse_ginstance_init__ + + foo = Foo() + assert isinstance(foo.label, Gtk.Label) + + foo2 = Foo() + assert isinstance(foo2.label, Gtk.Label) + + +def test_main_example(): + + type_name = new_gtype_name() + + example_xml = """\ + + + +""".format(type_name) + + @Gtk.Template.from_string(example_xml) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + def __init__(self): + super(Foo, self).__init__() + self.callback_hello = [] + self.callback_hello_after = [] + self.callback_goodbye = [] + self.callback_goodbye_after = [] + + @Gtk.Template.Callback("hello_button_clicked") + def _hello_button_clicked(self, *args): + self.callback_hello.append(args) + + @Gtk.Template.Callback("hello_button_clicked_after") + def _hello_after(self, *args): + self.callback_hello_after.append(args) + + _hello_button = Gtk.Template.Child("hello_button") + + goodbye_button = Gtk.Template.Child() + + @Gtk.Template.Callback("goodbye_button_clicked") + def _goodbye_button_clicked(self, *args): + self.callback_goodbye.append(args) + + @Gtk.Template.Callback("goodbye_button_clicked_after") + def _goodbye_after(self, *args): + self.callback_goodbye_after.append(args) + + w = Foo() + assert w.__gtype__.name == type_name + assert w.props.orientation == Gtk.Orientation.HORIZONTAL + assert w.props.spacing == 4 + assert isinstance(w._hello_button, Gtk.Button) + assert w._hello_button.props.label == "Hello World" + assert isinstance(w.goodbye_button, Gtk.Button) + assert w.goodbye_button.props.label == "Goodbye World" + + assert w.callback_hello == [] + w._hello_button.emit("clicked") + assert w.callback_hello == [(w,)] + assert w.callback_hello_after == [(w,)] + + assert w.callback_goodbye == [] + w.goodbye_button.emit("clicked") + assert w.callback_goodbye == [(w.goodbye_button,)] + assert w.callback_goodbye_after == [(w.goodbye_button,)] + + +def test_duplicate_handler(): + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + class Foo(Gtk.Box): + __gtype_name__ = type_name + + @Gtk.Template.Callback("hello_button_clicked") + def _hello_button_clicked(self, *args): + pass + + @Gtk.Template.Callback() + def hello_button_clicked(self, *args): + pass + + with pytest.raises(RuntimeError, match=".*hello_button_clicked.*"): + Gtk.Template.from_string(xml)(Foo) + + +def test_duplicate_child(): + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + class Foo(Gtk.Box): + __gtype_name__ = type_name + + foo = Gtk.Template.Child("hello_button") + hello_button = Gtk.Template.Child() + + with pytest.raises(RuntimeError, match=".*hello_button.*"): + Gtk.Template.from_string(xml)(Foo) + + +def test_nonexist_handler(): + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + @Gtk.Template.from_string(xml) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + @Gtk.Template.Callback("nonexit") + def foo(self, *args): + pass + + with capture_exceptions() as exc_info: + Foo() + assert "nonexit" in str(exc_info[0].value) + assert exc_info[0].type is RuntimeError + + +def test_missing_handler_callback(): + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + class Foo(Gtk.Box): + __gtype_name__ = type_name + + Gtk.Template.from_string(xml)(Foo)() + + +def test_handler_swapped_not_supported(): + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + @Gtk.Template.from_string(xml) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + hello_button = Gtk.Template.Child() + + @Gtk.Template.Callback("hello_button_clicked") + def foo(self, *args): + pass + + with capture_exceptions() as exc_info: + Foo() + assert "G_CONNECT_SWAPPED" in str(exc_info[0].value) + + +def test_handler_class_staticmethod(): + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + signal_args_class = [] + signal_args_static = [] + + @Gtk.Template.from_string(xml) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + hello_button = Gtk.Template.Child() + + @Gtk.Template.Callback("clicked_class") + @classmethod + def cb1(*args): + signal_args_class.append(args) + + @Gtk.Template.Callback("clicked_static") + @staticmethod + def cb2(*args): + signal_args_static.append(args) + + foo = Foo() + foo.hello_button.emit("clicked") + assert signal_args_class == [(Foo, foo.hello_button)] + assert signal_args_static == [(foo.hello_button,)] + + +@pytest.mark.skipif(Gtk._version == "4.0", reason="errors out first with gtk4") +def test_check_decorated_class(): + NonWidget = type("Foo", (object,), {}) + with pytest.raises(TypeError, match=".*on Widgets.*"): + Gtk.Template.from_string("")(NonWidget) + + Widget = type("Foo", (Gtk.Widget,), {"__gtype_name__": new_gtype_name()}) + with pytest.raises(TypeError, match=".*Cannot nest.*"): + Gtk.Template.from_string("")(Gtk.Template.from_string("")(Widget)) + + Widget = type("Foo", (Gtk.Widget,), {}) + with pytest.raises(TypeError, match=".*__gtype_name__.*"): + Gtk.Template.from_string("")(Widget) + + with pytest.raises(TypeError, match=".*on Widgets.*"): + Gtk.Template.from_string("")(object()) + + +@pytest.mark.skipif(Gtk._version == "4.0", reason="errors out first with gtk4") +def test_subclass_fail(): + @Gtk.Template.from_string("") + class Base(Gtk.Widget): + __gtype_name__ = new_gtype_name() + + with capture_exceptions() as exc_info: + type("Sub", (Base,), {})() + assert "not allowed at this time" in str(exc_info[0].value) + assert exc_info[0].type is TypeError + + +def test_from_file(): + fd, name = tempfile.mkstemp() + try: + os.close(fd) + + type_name = new_gtype_name() + + with open(name, "wb") as h: + h.write(u"""\ + + + + """.format(type_name).encode()) + + @Gtk.Template.from_file(name) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + foo = Foo() + assert foo.props.spacing == 42 + finally: + os.remove(name) + + +def test_property_override(): + type_name = new_gtype_name() + + xml = """\ + + + +""".format(type_name) + + @Gtk.Template.from_string(xml) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + foo = Foo() + assert foo.props.spacing == 42 + + foo = Foo(spacing=124) + assert foo.props.spacing == 124 + + +def test_from_file_non_exist(): + dirname = tempfile.mkdtemp() + try: + path = os.path.join(dirname, "noexist") + + Widget = type( + "Foo", (Gtk.Widget,), {"__gtype_name__": new_gtype_name()}) + with pytest.raises(GLib.Error, match=".*No such file.*"): + Gtk.Template.from_file(path)(Widget) + finally: + os.rmdir(dirname) + + +def test_from_string_bytes(): + type_name = new_gtype_name() + + xml = u"""\ + + + + """.format(type_name).encode() + + @Gtk.Template.from_string(xml) + class Foo(Gtk.Box): + __gtype_name__ = type_name + + foo = Foo() + assert foo.props.spacing == 42 + + +def test_from_resource(): + resource_path = ensure_resource_registered() + + @Gtk.Template.from_resource(resource_path) + class Foo(Gtk.Box): + __gtype_name__ = "GtkTemplateTestResource" + + foo = Foo() + assert foo.props.spacing == 42 + + +def test_from_resource_non_exit(): + Widget = type("Foo", (Gtk.Widget,), {"__gtype_name__": new_gtype_name()}) + with pytest.raises(GLib.Error, match=".*/or/gnome/pygobject/noexit.*"): + Gtk.Template.from_resource("/or/gnome/pygobject/noexit")(Widget) + + +def test_constructors(): + with pytest.raises(TypeError): + Gtk.Template() + + with pytest.raises(TypeError): + Gtk.Template(foo=1) + + Gtk.Template(filename="foo") + Gtk.Template(resource_path="foo") + Gtk.Template(string="foo") + + with pytest.raises(TypeError): + Gtk.Template(filename="foo", resource_path="bar") + + with pytest.raises(TypeError): + Gtk.Template(filename="foo", nope="bar") + + Gtk.Template.from_string("bla") + Gtk.Template.from_resource("foo") + Gtk.Template.from_file("foo") + + +def test_child_construct(): + Gtk.Template.Child() + Gtk.Template.Child("name") + with pytest.raises(TypeError): + Gtk.Template.Child("name", True) + Gtk.Template.Child("name", internal=True) + with pytest.raises(TypeError): + Gtk.Template.Child("name", internal=True, something=False) + + +def test_internal_child(): + + main_type_name = new_gtype_name() + + xml = """\ + + + + """.format(main_type_name) + + @Gtk.Template.from_string(xml) + class MainThing(Gtk.Box): + __gtype_name__ = main_type_name + + somechild = Gtk.Template.Child(internal=True) + + thing = MainThing() + assert thing.somechild.props.margin_top == 42 + + other_type_name = new_gtype_name() + + xml = """\ + + + + """.format(other_type_name, main_type_name) + + @Gtk.Template.from_string(xml) + class OtherThing(Gtk.Box): + __gtype_name__ = other_type_name + + other = OtherThing() + if not GTK4: + child = other.get_children()[0] + else: + child = other.get_first_child() + + assert isinstance(child, MainThing) + + if not GTK4: + child = child.get_children()[0] + else: + child = child.get_first_child() + + assert isinstance(child, Gtk.Box) + assert child.props.margin_top == 24 + + if not GTK4: + child = child.get_children()[0] + else: + child = child.get_first_child() + + assert isinstance(child, Gtk.Label) + assert child.props.label == "foo" + + +def test_template_hierarchy(): + testlabel = """ + + + + """ + + @Gtk.Template(string=testlabel) + class TestLabel(Gtk.Label): + + __gtype_name__ = "TestLabel" + + def __init__(self): + super().__init__() + self.props.label = "TestLabel" + + testbox = """ + + + + """ + + @Gtk.Template(string=testbox) + class TestBox(Gtk.Box): + + __gtype_name__ = "TestBox" + + _testlabel = Gtk.Template.Child() + + def __init__(self): + super().__init__() + + assert isinstance(self._testlabel, TestLabel) + + window = """ + + + + """ + + @Gtk.Template(string=window) + class MyWindow(Gtk.Window): + + __gtype_name__ = "MyWindow" + + _testbox = Gtk.Template.Child() + _testlabel = Gtk.Template.Child() + + def __init__(self): + super().__init__() + + assert isinstance(self._testbox, TestBox) + assert isinstance(self._testlabel, TestLabel) + if not GTK4: + children = self._testbox.get_children() + else: + children = list(self._testbox) + + assert len(children) == 2 + + win = MyWindow() + assert isinstance(win, MyWindow) + + +def test_multiple_init_template_calls(): + xml = """ + + + + """ + + @Gtk.Template(string=xml) + class MyBox(Gtk.Box): + + __gtype_name__ = "MyBox" + + _label = Gtk.Template.Child() + + def __init__(self): + super().__init__() + self._label.props.label = "awesome label" + + my_box = MyBox() + assert isinstance(my_box, MyBox) + if not GTK4: + children = my_box.get_children() + else: + children = list(my_box) + + assert len(children) == 1 + my_box.init_template() + assert isinstance(my_box, MyBox) + if not GTK4: + children = my_box.get_children() + else: + children = list(my_box) + + assert len(children) == 1 diff --git a/tests/test_gtype.py b/tests/test_gtype.py index 8099101..1d24f9f 100644 --- a/tests/test_gtype.py +++ b/tests/test_gtype.py @@ -49,3 +49,64 @@ class TestTypeModuleLevelFunctions(unittest.TestCase): self.assertEqual(GObject.type_parent(CustomChild), CustomBase.__gtype__) self.assertEqual(GObject.type_parent(CustomBase), GObject.TYPE_OBJECT) self.assertRaises(RuntimeError, GObject.type_parent, GObject.GObject) + + +def test_gtype_has_value_table(): + assert CustomBase.__gtype__.has_value_table() + assert not GIMarshallingTests.Interface.__gtype__.has_value_table() + assert CustomChild.__gtype__.has_value_table() + + +def test_gtype_is_abstract(): + assert not CustomBase.__gtype__.is_abstract() + assert not GIMarshallingTests.Interface.__gtype__.is_abstract() + assert not CustomChild.__gtype__.is_abstract() + + +def test_gtype_is_classed(): + assert CustomBase.__gtype__.is_classed() + assert not GIMarshallingTests.Interface.__gtype__.is_classed() + assert CustomChild.__gtype__.is_classed() + + +def test_gtype_is_deep_derivable(): + assert CustomBase.__gtype__.is_deep_derivable() + assert not GIMarshallingTests.Interface.__gtype__.is_deep_derivable() + assert CustomChild.__gtype__.is_deep_derivable() + + +def test_gtype_is_derivable(): + assert CustomBase.__gtype__.is_derivable() + assert GIMarshallingTests.Interface.__gtype__.is_derivable() + assert CustomChild.__gtype__.is_derivable() + + +def test_gtype_is_value_abstract(): + assert not CustomBase.__gtype__.is_value_abstract() + assert not GIMarshallingTests.Interface.__gtype__.is_value_abstract() + assert not CustomChild.__gtype__.is_value_abstract() + + +def test_gtype_is_value_type(): + assert CustomBase.__gtype__.is_value_type() + assert not GIMarshallingTests.Interface.__gtype__.is_value_type() + assert CustomChild.__gtype__.is_value_type() + + +def test_gtype_children(): + assert CustomBase.__gtype__.children == [CustomChild.__gtype__] + assert GIMarshallingTests.Interface.__gtype__.children == [] + assert CustomChild.__gtype__.children == [] + + +def test_gtype_depth(): + assert CustomBase.__gtype__.depth == 2 + assert GIMarshallingTests.Interface.__gtype__.depth == 2 + assert CustomChild.__gtype__.depth == 3 + + +def test_gtype_interfaces(): + assert CustomBase.__gtype__.interfaces == [] + assert GIMarshallingTests.Interface.__gtype__.interfaces == [] + assert CustomChild.__gtype__.interfaces == \ + [GIMarshallingTests.Interface.__gtype__] diff --git a/tests/test_gtype_instance.py b/tests/test_gtype_instance.py new file mode 100644 index 0000000..a2f7eec --- /dev/null +++ b/tests/test_gtype_instance.py @@ -0,0 +1,8 @@ + +import pytest +from gi.repository import Regress + + +def test_fundamental_type_instantiation_fails(): + with pytest.raises(TypeError, match="No means to translate argument or return value for 'RegressTestFundamentalSubObject'"): + Regress.TestFundamentalSubObject.new("data") diff --git a/tests/test_import_machinery.py b/tests/test_import_machinery.py new file mode 100644 index 0000000..a8d5005 --- /dev/null +++ b/tests/test_import_machinery.py @@ -0,0 +1,154 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab + +import sys +import unittest + +import gi.overrides +import gi.module +import gi.importer + +from gi.repository import Regress + + +class TestOverrides(unittest.TestCase): + + def test_non_gi(self): + class MyClass: + pass + + try: + gi.overrides.override(MyClass) + self.fail('unexpected success of overriding non-GI class') + except TypeError as e: + self.assertTrue('Can not override a type MyClass' in str(e)) + + def test_separate_path(self): + # Regress override is in tests/gi/overrides, separate from gi/overrides + # https://bugzilla.gnome.org/show_bug.cgi?id=680913 + self.assertEqual(Regress.REGRESS_OVERRIDE, 42) + + def test_load_overrides(self): + mod = gi.module.get_introspection_module('GIMarshallingTests') + mod_override = gi.overrides.load_overrides(mod) + self.assertTrue(mod_override is not mod) + self.assertTrue(mod_override._introspection_module is mod) + self.assertEqual(mod_override.OVERRIDES_CONSTANT, 7) + self.assertEqual(mod.OVERRIDES_CONSTANT, 42) + + def test_load_no_overrides(self): + mod_key = "gi.overrides.GIMarshallingTests" + had_mod = mod_key in sys.modules + old_mod = sys.modules.get(mod_key) + try: + # this makes override import fail + sys.modules[mod_key] = None + mod = gi.module.get_introspection_module('GIMarshallingTests') + mod_override = gi.overrides.load_overrides(mod) + self.assertTrue(mod_override is mod) + finally: + del sys.modules[mod_key] + if had_mod: + sys.modules[mod_key] = old_mod + + +class TestModule(unittest.TestCase): + # Tests for gi.module + + def test_get_introspection_module_caching(self): + # This test attempts to minimize side effects by + # using a DynamicModule directly instead of going though: + # from gi.repository import Foo + + # Clear out introspection module cache before running this test. + old_modules = gi.module._introspection_modules + gi.module._introspection_modules = {} + + mod_name = 'GIMarshallingTests' + mod1 = gi.module.get_introspection_module(mod_name) + mod2 = gi.module.get_introspection_module(mod_name) + self.assertTrue(mod1 is mod2) + + # Restore the previous cache + gi.module._introspection_modules = old_modules + + def test_module_dependency_loading(self): + # Difficult to because this generally need to run in isolation to make + # sure GIMarshallingTests has not yet been loaded. But we can do this with: + # make check TEST_NAMES=test_import_machinery.TestModule.test_module_dependency_loading + if 'gi.repository.Gio' in sys.modules: + return + + from gi.repository import GIMarshallingTests + GIMarshallingTests # PyFlakes + + self.assertIn('gi.repository.Gio', sys.modules) + self.assertIn('gi.repository.GIMarshallingTests', sys.modules) + + def test_static_binding_protection(self): + # Importing old static bindings once gi has been imported should not + # crash but instead give back a dummy module which produces RuntimeErrors + # on access. + with self.assertRaises(AttributeError): + import gobject + gobject.anything + + with self.assertRaises(AttributeError): + import glib + glib.anything + + with self.assertRaises(AttributeError): + import gio + gio.anything + + with self.assertRaises(AttributeError): + import gtk + gtk.anything + + with self.assertRaises(AttributeError): + import gtk.gdk + gtk.gdk.anything + + +class TestImporter(unittest.TestCase): + def test_invalid_repository_module_name(self): + with self.assertRaises(ImportError) as context: + from gi.repository import InvalidGObjectRepositoryModuleName + InvalidGObjectRepositoryModuleName # pyflakes + + exception_string = str(context.exception) + + self.assertTrue('InvalidGObjectRepositoryModuleName' in exception_string) + self.assertTrue('introspection typelib' in exception_string) + + def test_require_version_warning(self): + check = gi.importer._check_require_version + + # make sure it doesn't fail at least + with check("GLib", 1): + from gi.repository import GLib + GLib + + # make sure the exception propagates + with self.assertRaises(ImportError): + with check("InvalidGObjectRepositoryModuleName", 1): + from gi.repository import InvalidGObjectRepositoryModuleName + InvalidGObjectRepositoryModuleName + + def test_require_version_versiontype(self): + import gi + with self.assertRaises(ValueError): + gi.require_version('GLib', 2.0) + + with self.assertRaises(ValueError): + gi.require_version('GLib', b'2.0') + + def test_require_versions(self): + import gi + gi.require_versions({'GLib': '2.0', 'Gio': '2.0', 'GObject': '2.0'}) + from gi.repository import GLib + GLib + + def test_get_import_stacklevel(self): + gi.importer.get_import_stacklevel(import_hook=True) + gi.importer.get_import_stacklevel(import_hook=False) diff --git a/tests/test_interface.py b/tests/test_interface.py index dd01af8..ba20cb4 100644 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -20,6 +20,8 @@ class MyUnknown(Unknown, testhelper.Interface): def do_iface_method(self): self.called = True Unknown.do_iface_method(self) + + GObject.type_register(MyUnknown) @@ -32,6 +34,8 @@ class MyObject(GObject.GObject, testhelper.Interface): def do_iface_method(self): self.called = True + + GObject.type_register(MyObject) diff --git a/tests/test_internal_api.py b/tests/test_internal_api.py index ca50f6b..5136037 100644 --- a/tests/test_internal_api.py +++ b/tests/test_internal_api.py @@ -1,18 +1,44 @@ # -*- Mode: Python -*- import unittest +import pytest from gi.repository import GLib, GObject import testhelper -import testmodule + + +class PyGObject(GObject.GObject): + __gtype_name__ = 'PyGObject' + __gproperties__ = { + 'label': (GObject.TYPE_STRING, + 'label property', + 'the label of the object', + 'default', + GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE), + } + + def __init__(self): + self._props = {} + GObject.GObject.__init__(self) + self.set_property('label', 'hello') + + def do_set_property(self, name, value): + self._props[name] = value + + def do_get_property(self, name): + return self._props[name] + + +def test_parse_constructor_args(): + assert testhelper.test_parse_constructor_args("foo") == 1 class TestObject(unittest.TestCase): def test_create_ctor(self): - o = testmodule.PyGObject() + o = PyGObject() self.assertTrue(isinstance(o, GObject.Object)) - self.assertTrue(isinstance(o, testmodule.PyGObject)) + self.assertTrue(isinstance(o, PyGObject)) # has expected property self.assertEqual(o.props.label, 'hello') @@ -22,7 +48,7 @@ class TestObject(unittest.TestCase): def test_pyobject_new_test_type(self): o = testhelper.create_test_type() - self.assertTrue(isinstance(o, testmodule.PyGObject)) + self.assertTrue(isinstance(o, PyGObject)) # has expected property self.assertEqual(o.props.label, 'hello') @@ -40,8 +66,8 @@ class TestGValueConversion(unittest.TestCase): self.assertEqual(testhelper.test_value(0), 0) self.assertEqual(testhelper.test_value(5), 5) self.assertEqual(testhelper.test_value(-5), -5) - self.assertEqual(testhelper.test_value(GObject.G_MAXINT32), GObject.G_MAXINT32) - self.assertEqual(testhelper.test_value(GObject.G_MININT32), GObject.G_MININT32) + self.assertEqual(testhelper.test_value(GLib.MAXINT32), GLib.MAXINT32) + self.assertEqual(testhelper.test_value(GLib.MININT32), GLib.MININT32) def test_str(self): self.assertEqual(testhelper.test_value('hello'), 'hello') @@ -69,5 +95,28 @@ class TestErrors(unittest.TestCase): self.assertEqual(testhelper.test_gerror_exception(callable_), None) -if __name__ == '__main__': - unittest.main() +def test_to_unichar_conv(): + assert testhelper.test_to_unichar_conv(u"A") == 65 + assert testhelper.test_to_unichar_conv(u"Ä") == 196 + + with pytest.raises(TypeError): + assert testhelper.test_to_unichar_conv(b"\x65") + + with pytest.raises(TypeError): + testhelper.test_to_unichar_conv(object()) + + with pytest.raises(TypeError): + testhelper.test_to_unichar_conv(u"AA") + + +def test_constant_strip_prefix(): + assert testhelper.constant_strip_prefix("foo", "bar") == "foo" + assert testhelper.constant_strip_prefix("foo", "f") == "oo" + assert testhelper.constant_strip_prefix("foo", "f") == "oo" + assert testhelper.constant_strip_prefix("ha2foo", "ha") == "a2foo" + assert testhelper.constant_strip_prefix("2foo", "ha") == "2foo" + assert testhelper.constant_strip_prefix("bla_foo", "bla") == "_foo" + + +def test_state_ensure_release(): + testhelper.test_state_ensure_release() diff --git a/tests/test_iochannel.py b/tests/test_iochannel.py index 0cc1b4b..c4c6e3d 100644 --- a/tests/test_iochannel.py +++ b/tests/test_iochannel.py @@ -1,19 +1,20 @@ # -*- Mode: Python -*- -# encoding: UTF-8 -from __future__ import unicode_literals +import os import unittest import tempfile import os.path -import fcntl import shutil import warnings +try: + import fcntl +except ImportError: + fcntl = None + from gi.repository import GLib from gi import PyGIDeprecationWarning -from compathelper import _unicode - class IOChannel(unittest.TestCase): def setUp(self): @@ -21,7 +22,7 @@ class IOChannel(unittest.TestCase): self.testutf8 = os.path.join(self.workdir, 'testutf8.txt') with open(self.testutf8, 'wb') as f: - f.write('''hello ♥ world + f.write(u'''hello ♥ world second line À demain!'''.encode('UTF-8')) @@ -42,24 +43,24 @@ second line ch = GLib.IOChannel(filename=self.testutf8) self.assertEqual(ch.get_encoding(), 'UTF-8') self.assertTrue(ch.get_close_on_unref()) - self.assertEqual(_unicode(ch.readline()), 'hello ♥ world\n') + self.assertEqual(ch.readline(), 'hello ♥ world\n') self.assertEqual(ch.get_buffer_condition(), GLib.IOCondition.IN) self.assertEqual(ch.readline(), 'second line\n') self.assertEqual(ch.readline(), '\n') - self.assertEqual(_unicode(ch.readline()), 'À demain!') + self.assertEqual(ch.readline(), 'À demain!') self.assertEqual(ch.get_buffer_condition(), 0) self.assertEqual(ch.readline(), '') - ch.close() + ch.shutdown(True) def test_file_readline_latin1(self): ch = GLib.IOChannel(filename=self.testlatin1, mode='r') ch.set_encoding('latin1') self.assertEqual(ch.get_encoding(), 'latin1') - self.assertEqual(_unicode(ch.readline()), 'hellø world\n') + self.assertEqual(ch.readline(), 'hellø world\n') self.assertEqual(ch.readline(), 'second line\n') self.assertEqual(ch.readline(), '\n') - self.assertEqual(_unicode(ch.readline()), 'À demain!') - ch.close() + self.assertEqual(ch.readline(), 'À demain!') + ch.shutdown(True) def test_file_iter(self): items = [] @@ -67,8 +68,8 @@ second line for item in ch: items.append(item) self.assertEqual(len(items), 4) - self.assertEqual(_unicode(items[0]), 'hello ♥ world\n') - ch.close() + self.assertEqual(items[0], 'hello ♥ world\n') + ch.shutdown(True) def test_file_readlines(self): ch = GLib.IOChannel(filename=self.testutf8) @@ -77,8 +78,8 @@ second line # empty one self.assertGreaterEqual(len(lines), 4) self.assertLessEqual(len(lines), 5) - self.assertEqual(_unicode(lines[0]), 'hello ♥ world\n') - self.assertEqual(_unicode(lines[3]), 'À demain!') + self.assertEqual(lines[0], 'hello ♥ world\n') + self.assertEqual(lines[3], 'À demain!') if len(lines) == 4: self.assertEqual(lines[4], '') @@ -108,28 +109,29 @@ second line ch.seek(2, 2) # SEEK_END # FIXME: does not work currently - #self.assertEqual(ch.read(2), b'n!') + # self.assertEqual(ch.read(2), b'n!') # invalid whence value self.assertRaises(ValueError, ch.seek, 0, 3) + ch.shutdown(True) def test_file_write(self): ch = GLib.IOChannel(filename=self.testout, mode='w') ch.set_encoding('latin1') ch.write('hellø world\n') - ch.close() + ch.shutdown(True) ch = GLib.IOChannel(filename=self.testout, mode='a') ch.set_encoding('latin1') ch.write('À demain!') - ch.close() + ch.shutdown(True) with open(self.testout, 'rb') as f: - self.assertEqual(f.read().decode('latin1'), 'hellø world\nÀ demain!') + self.assertEqual(f.read().decode('latin1'), u'hellø world\nÀ demain!') def test_file_writelines(self): ch = GLib.IOChannel(filename=self.testout, mode='w') ch.writelines(['foo', 'bar\n', 'baz\n', 'end']) - ch.close() + ch.shutdown(True) with open(self.testout, 'r') as f: self.assertEqual(f.read(), 'foobar\nbaz\nend') @@ -163,10 +165,11 @@ second line # closing flushes writer.set_buffered(True) writer.write('ghi') - writer.close() + writer.shutdown(True) self.assertEqual(reader.read(), b'ghi') - reader.close() + reader.shutdown(True) + @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows") def test_fd_read(self): (r, w) = os.pipe() @@ -184,8 +187,9 @@ second line os.close(w) self.assertEqual(ch.read(), b'\x03\x04') - ch.close() + ch.shutdown(True) + @unittest.skipUnless(fcntl, "no fcntl") def test_fd_write(self): (r, w) = os.pipe() fcntl.fcntl(r, fcntl.F_SETFL, fcntl.fcntl(r, fcntl.F_GETFL) | os.O_NONBLOCK) @@ -199,10 +203,11 @@ second line # now test blocking case, after closing the write end fcntl.fcntl(r, fcntl.F_SETFL, fcntl.fcntl(r, fcntl.F_GETFL) & ~os.O_NONBLOCK) ch.write(b'\x03\x04') - ch.close() + ch.shutdown(True) self.assertEqual(os.read(r, 10), b'\x03\x04') os.close(r) + @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows") def test_deprecated_method_add_watch_no_data(self): (r, w) = os.pipe() @@ -216,23 +221,28 @@ second line self.assertEqual(channel, ch) self.assertEqual(condition, GLib.IOCondition.IN) cb_reads.append(channel.read()) + if len(cb_reads) == 2: + ml.quit() return True # io_add_watch() method is deprecated, use GLib.io_add_watch with warnings.catch_warnings(record=True) as warn: warnings.simplefilter('always') - ch.add_watch(GLib.IOCondition.IN, cb) + ch.add_watch(GLib.IOCondition.IN, cb, priority=GLib.PRIORITY_HIGH) self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) - ml = GLib.MainLoop() + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + ml = GLib.MainLoop() + GLib.idle_add(write) + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(cb_reads, [b'a', b'b']) + @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows") def test_deprecated_method_add_watch_data_priority(self): (r, w) = os.pipe() @@ -247,6 +257,8 @@ second line self.assertEqual(condition, GLib.IOCondition.IN) self.assertEqual(data, 'hello') cb_reads.append(channel.read()) + if len(cb_reads) == 2: + ml.quit() return True ml = GLib.MainLoop() @@ -259,13 +271,17 @@ second line self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_HIGH) - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) + + GLib.idle_add(write) + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(cb_reads, [b'a', b'b']) + @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows") def test_add_watch_no_data(self): (r, w) = os.pipe() @@ -279,6 +295,8 @@ second line self.assertEqual(channel, ch) self.assertEqual(condition, GLib.IOCondition.IN) cb_reads.append(channel.read()) + if len(cb_reads) == 2: + ml.quit() return True id = GLib.io_add_watch(ch, GLib.PRIORITY_HIGH, GLib.IOCondition.IN, cb) @@ -286,13 +304,18 @@ second line ml = GLib.MainLoop() self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_HIGH) - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) + + GLib.idle_add(write) + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(cb_reads, [b'a', b'b']) + @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows") def test_add_watch_with_data(self): (r, w) = os.pipe() @@ -307,6 +330,8 @@ second line self.assertEqual(condition, GLib.IOCondition.IN) self.assertEqual(data, 'hello') cb_reads.append(channel.read()) + if len(cb_reads) == 2: + ml.quit() return True id = GLib.io_add_watch(ch, GLib.PRIORITY_HIGH, GLib.IOCondition.IN, cb, 'hello') @@ -314,13 +339,18 @@ second line ml = GLib.MainLoop() self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_HIGH) - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) + + GLib.idle_add(write) + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(cb_reads, [b'a', b'b']) + @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows") def test_add_watch_with_multi_data(self): (r, w) = os.pipe() @@ -337,6 +367,8 @@ second line self.assertEqual(data2, 'b') self.assertEqual(data3, 'c') cb_reads.append(channel.read()) + if len(cb_reads) == 2: + ml.quit() return True id = GLib.io_add_watch(ch, GLib.PRIORITY_HIGH, GLib.IOCondition.IN, cb, @@ -345,13 +377,18 @@ second line ml = GLib.MainLoop() self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_HIGH) - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) + + GLib.idle_add(write) + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(cb_reads, [b'a', b'b']) + @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows") def test_deprecated_add_watch_no_data(self): (r, w) = os.pipe() @@ -365,6 +402,8 @@ second line self.assertEqual(channel, ch) self.assertEqual(condition, GLib.IOCondition.IN) cb_reads.append(channel.read()) + if len(cb_reads) == 2: + ml.quit() return True with warnings.catch_warnings(record=True) as warn: @@ -375,13 +414,18 @@ second line ml = GLib.MainLoop() self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_HIGH) - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) + + GLib.idle_add(write) + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(cb_reads, [b'a', b'b']) + @unittest.skipIf(os.name == "nt", "NONBLOCK not implemented on Windows") def test_deprecated_add_watch_with_data(self): (r, w) = os.pipe() @@ -396,6 +440,8 @@ second line self.assertEqual(condition, GLib.IOCondition.IN) self.assertEqual(data, 'hello') cb_reads.append(channel.read()) + if len(cb_reads) == 2: + ml.quit() return True with warnings.catch_warnings(record=True) as warn: @@ -407,18 +453,23 @@ second line ml = GLib.MainLoop() self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_HIGH) - GLib.timeout_add(10, lambda: os.write(w, b'a') and False) - GLib.timeout_add(100, lambda: os.write(w, b'b') and False) - GLib.timeout_add(200, ml.quit) + + def write(): + os.write(w, b'a') + GLib.idle_add(lambda: os.write(w, b'b') and False) + + GLib.idle_add(write) + + GLib.timeout_add(2000, ml.quit) ml.run() self.assertEqual(cb_reads, [b'a', b'b']) def test_backwards_compat_flags(self): - self.assertEqual(GLib.IOCondition.IN, GLib.IO_IN) - self.assertEqual(GLib.IOFlags.NONBLOCK, GLib.IO_FLAG_NONBLOCK) - self.assertEqual(GLib.IOFlags.IS_SEEKABLE, GLib.IO_FLAG_IS_SEEKABLE) - self.assertEqual(GLib.IOStatus.NORMAL, GLib.IO_STATUS_NORMAL) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', PyGIDeprecationWarning) -if __name__ == '__main__': - unittest.main() + self.assertEqual(GLib.IOCondition.IN, GLib.IO_IN) + self.assertEqual(GLib.IOFlags.NONBLOCK, GLib.IO_FLAG_NONBLOCK) + self.assertEqual(GLib.IOFlags.IS_SEEKABLE, GLib.IO_FLAG_IS_SEEKABLE) + self.assertEqual(GLib.IOStatus.NORMAL, GLib.IO_STATUS_NORMAL) diff --git a/tests/test_mainloop.py b/tests/test_mainloop.py index 44197b3..48399d1 100644 --- a/tests/test_mainloop.py +++ b/tests/test_mainloop.py @@ -1,24 +1,18 @@ # -*- Mode: Python -*- import os -import sys import select import signal -import time import unittest -try: - from _thread import start_new_thread - start_new_thread # pyflakes -except ImportError: - # Python 2 - from thread import start_new_thread from gi.repository import GLib -from compathelper import _bytes +from .helper import capture_exceptions class TestMainLoop(unittest.TestCase): + + @unittest.skipUnless(hasattr(os, "fork"), "no os.fork available") def test_exception_handling(self): pipe_r, pipe_w = os.pipe() @@ -37,56 +31,35 @@ class TestMainLoop(unittest.TestCase): GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, child_died, loop) os.close(pipe_r) - os.write(pipe_w, _bytes("Y")) + os.write(pipe_w, b"Y") os.close(pipe_w) - def excepthook(type, value, traceback): - self.assertTrue(type is Exception) - self.assertEqual(value.args[0], "deadbabe") - sys.excepthook = excepthook - try: - got_exception = False - try: - loop.run() - except: - got_exception = True - finally: - sys.excepthook = sys.__excepthook__ - - # - # The exception should be handled (by printing it) - # immediately on return from child_died() rather - # than here. See bug #303573 - # - self.assertFalse(got_exception) - - def test_concurrency(self): - def on_usr1(signum, frame): - pass + with capture_exceptions() as exc: + loop.run() - try: - # create a thread which will terminate upon SIGUSR1 by way of - # interrupting sleep() - orig_handler = signal.signal(signal.SIGUSR1, on_usr1) - start_new_thread(time.sleep, (10,)) - - # now create two main loops - loop1 = GLib.MainLoop() - loop2 = GLib.MainLoop() - GLib.timeout_add(100, lambda: os.kill(os.getpid(), signal.SIGUSR1)) - GLib.timeout_add(500, loop1.quit) - loop1.run() - loop2.quit() - finally: - signal.signal(signal.SIGUSR1, orig_handler) + assert len(exc) == 1 + assert exc[0].type is Exception + assert exc[0].value.args[0] == "deadbabe" + @unittest.skipUnless(hasattr(os, "fork"), "no os.fork available") + @unittest.skipIf(os.environ.get("PYGI_TEST_GDB"), "SIGINT stops gdb") def test_sigint(self): + r, w = os.pipe() pid = os.fork() if pid == 0: - time.sleep(0.5) + # wait for the parent process loop to start + os.read(r, 1) + os.close(r) + os.kill(os.getppid(), signal.SIGINT) os._exit(0) + def notify_child(): + # tell the child that it can kill the parent + os.write(w, b"X") + os.close(w) + + GLib.idle_add(notify_child) loop = GLib.MainLoop() try: loop.run() diff --git a/tests/test_object_marshaling.py b/tests/test_object_marshaling.py index 624ed9d..d52ff54 100644 --- a/tests/test_object_marshaling.py +++ b/tests/test_object_marshaling.py @@ -10,6 +10,11 @@ import warnings from gi.repository import GObject from gi.repository import GIMarshallingTests +try: + from gi.repository import Regress +except ImportError: + Regress = None + class StrongRef(object): # A class that behaves like weakref.ref but holds a strong reference. @@ -103,7 +108,8 @@ class TestVFuncsWithObjectArg(unittest.TestCase): vfuncs.get_ref_info_for_vfunc_return_object_transfer_full() # Use any vfunc to test this. gc.collect() - self.assertEqual(sys.getrefcount(vfuncs), 2) + if hasattr(sys, "getrefcount"): + self.assertEqual(sys.getrefcount(vfuncs), 2) self.assertEqual(vfuncs.__grefcount__, 1) del vfuncs @@ -120,11 +126,13 @@ class TestVFuncsWithObjectArg(unittest.TestCase): with warnings.catch_warnings(record=True) as warn: warnings.simplefilter('always') ref_count, is_floating = vfuncs.get_ref_info_for_vfunc_out_object_transfer_none() - self.assertTrue(issubclass(warn[0].category, RuntimeWarning)) + if hasattr(sys, "getrefcount"): + self.assertTrue(issubclass(warn[0].category, RuntimeWarning)) # The ref count of the GObject returned to the caller (get_ref_info_for_vfunc_return_object_transfer_none) # should be a single floating ref - self.assertEqual(ref_count, 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 1) self.assertFalse(is_floating) gc.collect() @@ -136,9 +144,11 @@ class TestVFuncsWithObjectArg(unittest.TestCase): with warnings.catch_warnings(record=True) as warn: warnings.simplefilter('always') ref_count, is_floating = vfuncs.get_ref_info_for_vfunc_out_object_transfer_none() - self.assertTrue(issubclass(warn[0].category, RuntimeWarning)) + if hasattr(sys, "getrefcount"): + self.assertTrue(issubclass(warn[0].category, RuntimeWarning)) - self.assertEqual(ref_count, 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 1) self.assertFalse(is_floating) gc.collect() @@ -150,7 +160,8 @@ class TestVFuncsWithObjectArg(unittest.TestCase): # The vfunc caller receives full ownership of a single ref which should not # be floating. - self.assertEqual(ref_count, 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 1) self.assertFalse(is_floating) gc.collect() @@ -161,7 +172,8 @@ class TestVFuncsWithObjectArg(unittest.TestCase): vfuncs = self.VFuncs() ref_count, is_floating = vfuncs.get_ref_info_for_vfunc_out_object_transfer_full() - self.assertEqual(ref_count, 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 1) self.assertFalse(is_floating) gc.collect() @@ -175,9 +187,12 @@ class TestVFuncsWithObjectArg(unittest.TestCase): self.assertEqual(vfuncs.in_object_grefcount, 2) # initial + python wrapper self.assertFalse(vfuncs.in_object_is_floating) - self.assertEqual(ref_count, 1) # ensure python wrapper released + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 1) # ensure python wrapper released self.assertFalse(is_floating) + gc.collect() + gc.collect() self.assertTrue(vfuncs.object_ref() is None) def test_vfunc_in_object_transfer_full(self): @@ -191,9 +206,12 @@ class TestVFuncsWithObjectArg(unittest.TestCase): self.assertFalse(vfuncs.in_object_is_floating) # ensure python wrapper took ownership and released, after vfunc was complete - self.assertEqual(ref_count, 0) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 0) self.assertFalse(is_floating) + gc.collect() + gc.collect() self.assertTrue(vfuncs.object_ref() is None) @@ -205,6 +223,7 @@ class TestVFuncsWithFloatingArg(unittest.TestCase): Object = GObject.InitiallyUnowned ObjectRef = weakref.ref + @unittest.skipUnless(hasattr(sys, "getrefcount"), "refcount specific") def test_vfunc_return_object_transfer_none_with_floating(self): # Python is expected to return a single floating reference without warning. vfuncs = self.VFuncs() @@ -218,6 +237,7 @@ class TestVFuncsWithFloatingArg(unittest.TestCase): gc.collect() self.assertTrue(vfuncs.object_ref() is None) + @unittest.skipUnless(hasattr(sys, "getrefcount"), "refcount specific") def test_vfunc_out_object_transfer_none_with_floating(self): # Same as above except uses out arg instead of return vfuncs = self.VFuncs() @@ -234,7 +254,8 @@ class TestVFuncsWithFloatingArg(unittest.TestCase): ref_count, is_floating = vfuncs.get_ref_info_for_vfunc_return_object_transfer_full() # The vfunc caller receives full ownership of a single ref. - self.assertEqual(ref_count, 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 1) self.assertFalse(is_floating) gc.collect() @@ -245,7 +266,8 @@ class TestVFuncsWithFloatingArg(unittest.TestCase): vfuncs = self.VFuncs() ref_count, is_floating = vfuncs.get_ref_info_for_vfunc_out_object_transfer_full() - self.assertEqual(ref_count, 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 1) self.assertFalse(is_floating) gc.collect() @@ -262,9 +284,12 @@ class TestVFuncsWithFloatingArg(unittest.TestCase): self.assertTrue(vfuncs.in_object_is_floating) # vfunc caller should only have a single floating ref after the vfunc finishes - self.assertEqual(ref_count, 1) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 1) self.assertTrue(is_floating) + gc.collect() + gc.collect() self.assertTrue(vfuncs.object_ref() is None) def test_vfunc_in_object_transfer_full_with_floating(self): @@ -278,9 +303,12 @@ class TestVFuncsWithFloatingArg(unittest.TestCase): self.assertFalse(vfuncs.in_object_is_floating) # ensure python wrapper took ownership and released - self.assertEqual(ref_count, 0) + if hasattr(sys, "getrefcount"): + self.assertEqual(ref_count, 0) self.assertFalse(is_floating) + gc.collect() + gc.collect() self.assertTrue(vfuncs.object_ref() is None) @@ -535,69 +563,31 @@ class TestVFuncsWithHeldFloatingArg(unittest.TestCase): self.assertTrue(held_object_ref() is None) -class TestPropertyHoldingObject(unittest.TestCase): - def test_props_getter_holding_object_ref_count(self): - holder = GIMarshallingTests.PropertiesObject() - held = GObject.Object() - - self.assertEqual(holder.__grefcount__, 1) - self.assertEqual(held.__grefcount__, 1) - - holder.set_property('some-object', held) - self.assertEqual(holder.__grefcount__, 1) - - initial_ref_count = held.__grefcount__ - holder.props.some_object - gc.collect() - self.assertEqual(held.__grefcount__, initial_ref_count) - - def test_get_property_holding_object_ref_count(self): - holder = GIMarshallingTests.PropertiesObject() - held = GObject.Object() - - self.assertEqual(holder.__grefcount__, 1) - self.assertEqual(held.__grefcount__, 1) - - holder.set_property('some-object', held) - self.assertEqual(holder.__grefcount__, 1) - - initial_ref_count = held.__grefcount__ - holder.get_property('some-object') - gc.collect() - self.assertEqual(held.__grefcount__, initial_ref_count) - - def test_props_setter_holding_object_ref_count(self): - holder = GIMarshallingTests.PropertiesObject() - held = GObject.Object() - - self.assertEqual(holder.__grefcount__, 1) - self.assertEqual(held.__grefcount__, 1) - - # Setting property should only increase ref count by 1 - holder.props.some_object = held - self.assertEqual(holder.__grefcount__, 1) - self.assertEqual(held.__grefcount__, 2) - - # Clearing should pull it back down - holder.props.some_object = None - self.assertEqual(held.__grefcount__, 1) - - def test_set_property_holding_object_ref_count(self): - holder = GIMarshallingTests.PropertiesObject() - held = GObject.Object() - - self.assertEqual(holder.__grefcount__, 1) - self.assertEqual(held.__grefcount__, 1) - - # Setting property should only increase ref count by 1 - holder.set_property('some-object', held) - self.assertEqual(holder.__grefcount__, 1) - self.assertEqual(held.__grefcount__, 2) - - # Clearing should pull it back down - holder.set_property('some-object', None) - self.assertEqual(held.__grefcount__, 1) - - def test_set_object_property_to_invalid_type(self): - obj = GIMarshallingTests.PropertiesObject() - self.assertRaises(TypeError, obj.set_property, 'some-object', 'not_an_object') +@unittest.skipIf(Regress is None, 'Regress is required') +class TestArgumentTypeErrors(unittest.TestCase): + def test_object_argument_type_error(self): + # ensure TypeError is raised for things which are not GObjects + obj = Regress.TestObj() + obj.set_bare(GObject.Object()) + obj.set_bare(None) + + self.assertRaises(TypeError, obj.set_bare, object()) + self.assertRaises(TypeError, obj.set_bare, 42) + self.assertRaises(TypeError, obj.set_bare, 'not an object') + + def test_instance_argument_error(self): + # ensure TypeError is raised for non Regress.TestObj instances. + obj = Regress.TestObj() + self.assertEqual(Regress.TestObj.instance_method(obj), -1) + self.assertRaises(TypeError, Regress.TestObj.instance_method, object()) + self.assertRaises(TypeError, Regress.TestObj.instance_method, GObject.Object()) + self.assertRaises(TypeError, Regress.TestObj.instance_method, 42) + self.assertRaises(TypeError, Regress.TestObj.instance_method, 'not an object') + + def test_instance_argument_base_type_error(self): + # ensure TypeError is raised when a base type is passed to something + # expecting a derived type + obj = Regress.TestSubObj() + self.assertEqual(Regress.TestSubObj.instance_method(obj), 0) + self.assertRaises(TypeError, Regress.TestSubObj.instance_method, GObject.Object()) + self.assertRaises(TypeError, Regress.TestSubObj.instance_method, Regress.TestObj()) diff --git a/tests/test_option.py b/tests/test_option.py index 2900edd..1dc496a 100644 --- a/tests/test_option.py +++ b/tests/test_option.py @@ -1,20 +1,13 @@ #!/usr/bin/env python import unittest -import sys - -# py3k has StringIO in a different module -try: - from StringIO import StringIO - StringIO # pyflakes -except ImportError: - from io import StringIO from gi.repository import GLib +from .helper import capture_exceptions + class TestOption(unittest.TestCase): - EXCEPTION_MESSAGE = "This callback fails" def setUp(self): self.parser = GLib.option.OptionParser("NAMES...", @@ -28,7 +21,7 @@ class TestOption(unittest.TestCase): def _create_group(self): def option_callback(option, opt, value, parser): - raise Exception(self.EXCEPTION_MESSAGE) + raise Exception("foo") group = GLib.option.OptionGroup( "unittest", "Unit test options", "Show all unittest options", @@ -55,29 +48,53 @@ class TestOption(unittest.TestCase): self.parser.add_option_group(group) return group - def test_parse_args(self): + def test_integer(self): + self._create_group() options, args = self.parser.parse_args( - ["test_option.py"]) - self.assertFalse(args) + ["--test-integer", "42", "bla"]) + assert options.test_integer == 42 + assert args == ["bla"] + + def test_file(self): + self._create_group() options, args = self.parser.parse_args( - ["test_option.py", "foo"]) - self.assertEqual(args, []) + ["--file", "fn", "bla"]) + assert options.unit_file == "fn" + assert args == ["bla"] + + def test_mixed(self): + self._create_group() options, args = self.parser.parse_args( - ["test_option.py", "foo", "bar"]) - self.assertEqual(args, []) + ["--file", "fn", "--test-integer", "12", "--test", + "--g-fatal-warnings", "nope"]) + + assert options.unit_file == "fn" + assert options.test_integer == 12 + assert options.test is False + assert options.fatal_warnings is True + assert args == ["nope"] + + def test_parse_args(self): + options, args = self.parser.parse_args([]) + self.assertFalse(args) + + options, args = self.parser.parse_args(["foo"]) + self.assertEqual(args, ["foo"]) + + options, args = self.parser.parse_args(["foo", "bar"]) + self.assertEqual(args, ["foo", "bar"]) def test_parse_args_double_dash(self): - options, args = self.parser.parse_args( - ["test_option.py", "--", "-xxx"]) - #self.assertEqual(args, ["-xxx"]) + options, args = self.parser.parse_args(["--", "-xxx"]) + self.assertEqual(args, ["--", "-xxx"]) def test_parse_args_group(self): group = self._create_group() options, args = self.parser.parse_args( - ["test_option.py", "--test", "-f", "test"]) + ["--test", "-f", "test"]) self.assertFalse(options.test) self.assertEqual(options.unit_file, "test") @@ -90,26 +107,21 @@ class TestOption(unittest.TestCase): def test_option_value_error(self): self._create_group() self.assertRaises(GLib.option.OptionValueError, self.parser.parse_args, - ["test_option.py", "--test-integer=text"]) + ["--test-integer=text"]) def test_bad_option_error(self): self.assertRaises(GLib.option.BadOptionError, self.parser.parse_args, - ["test_option.py", "--unknwon-option"]) + ["--unknwon-option"]) def test_option_group_constructor(self): self.assertRaises(TypeError, GLib.option.OptionGroup) def test_standard_error(self): self._create_group() - sio = StringIO() - old_stderr = sys.stderr - sys.stderr = sio - try: - self.parser.parse_args( - ["test_option.py", "--callback-failure-test"]) - finally: - sys.stderr = old_stderr - - assert (sio.getvalue().split('\n')[-2] == - "Exception: " + self.EXCEPTION_MESSAGE) + + with capture_exceptions() as exc: + self.parser.parse_args(["--callback-failure-test"]) + + assert len(exc) == 1 + assert exc[0].value.args[0] == "foo" diff --git a/tests/test_ossig.py b/tests/test_ossig.py new file mode 100644 index 0000000..bdd7f70 --- /dev/null +++ b/tests/test_ossig.py @@ -0,0 +1,182 @@ +# Copyright 2017 Christoph Reiter +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +from __future__ import absolute_import + +import os +import signal +import unittest +import threading +from contextlib import contextmanager + +try: + from gi.repository import Gtk + Gtk_version = Gtk._version +except ImportError: + Gtk = None + Gtk_version = None +from gi.repository import Gio, GLib +from gi._ossighelper import wakeup_on_signal, register_sigint_fallback + + +class TestOverridesWakeupOnAlarm(unittest.TestCase): + + @contextmanager + def _run_with_timeout(self, timeout, abort_func): + failed = [] + + def fail(): + abort_func() + failed.append(1) + return True + + fail_id = GLib.timeout_add(timeout, fail) + try: + yield + finally: + GLib.source_remove(fail_id) + self.assertFalse(failed) + + def test_basic(self): + self.assertEqual(signal.set_wakeup_fd(-1), -1) + with wakeup_on_signal(): + pass + self.assertEqual(signal.set_wakeup_fd(-1), -1) + + def test_in_thread(self): + failed = [] + + def target(): + try: + with wakeup_on_signal(): + pass + except: + failed.append(1) + + t = threading.Thread(target=target) + t.start() + t.join(5) + self.assertFalse(failed) + + @unittest.skipIf(os.name == "nt", "not on Windows") + def test_glib_mainloop(self): + loop = GLib.MainLoop() + signal.signal(signal.SIGALRM, lambda *args: loop.quit()) + GLib.idle_add(signal.setitimer, signal.ITIMER_REAL, 0.001) + + with self._run_with_timeout(2000, loop.quit): + loop.run() + + @unittest.skipIf(os.name == "nt", "not on Windows") + def test_gio_application(self): + app = Gio.Application() + signal.signal(signal.SIGALRM, lambda *args: app.quit()) + GLib.idle_add(signal.setitimer, signal.ITIMER_REAL, 0.001) + + with self._run_with_timeout(2000, app.quit): + app.hold() + app.connect("activate", lambda *args: None) + app.run() + + @unittest.skipIf(Gtk is None or os.name == "nt", "not on Windows") + @unittest.skipIf(Gtk is None or Gtk_version == "4.0", "not in gtk4") + def test_gtk_main(self): + signal.signal(signal.SIGALRM, lambda *args: Gtk.main_quit()) + GLib.idle_add(signal.setitimer, signal.ITIMER_REAL, 0.001) + + with self._run_with_timeout(2000, Gtk.main_quit): + Gtk.main() + + @unittest.skipIf(Gtk is None or os.name == "nt", "not on Windows") + @unittest.skipIf(Gtk is None or Gtk_version == "4.0", "not in gtk4") + def test_gtk_dialog_run(self): + w = Gtk.Window() + d = Gtk.Dialog(transient_for=w) + signal.signal(signal.SIGALRM, lambda *args: d.destroy()) + GLib.idle_add(signal.setitimer, signal.ITIMER_REAL, 0.001) + + with self._run_with_timeout(2000, d.destroy): + d.run() + + +class TestSigintFallback(unittest.TestCase): + + def setUp(self): + self.assertEqual( + signal.getsignal(signal.SIGINT), signal.default_int_handler) + + def tearDown(self): + self.assertEqual( + signal.getsignal(signal.SIGINT), signal.default_int_handler) + + def test_replace_handler_and_restore_nested(self): + with register_sigint_fallback(lambda: None): + new_handler = signal.getsignal(signal.SIGINT) + self.assertNotEqual(new_handler, signal.default_int_handler) + with register_sigint_fallback(lambda: None): + self.assertTrue(signal.getsignal(signal.SIGINT) is new_handler) + self.assertEqual( + signal.getsignal(signal.SIGINT), signal.default_int_handler) + + def test_no_replace_if_not_default(self): + new_handler = lambda *args: None + signal.signal(signal.SIGINT, new_handler) + try: + with register_sigint_fallback(lambda: None): + self.assertTrue(signal.getsignal(signal.SIGINT) is new_handler) + with register_sigint_fallback(lambda: None): + self.assertTrue( + signal.getsignal(signal.SIGINT) is new_handler) + self.assertTrue(signal.getsignal(signal.SIGINT) is new_handler) + finally: + signal.signal(signal.SIGINT, signal.default_int_handler) + + def test_noop_in_threads(self): + failed = [] + + def target(): + try: + with register_sigint_fallback(lambda: None): + with register_sigint_fallback(lambda: None): + self.assertTrue( + signal.getsignal(signal.SIGINT) is + signal.default_int_handler) + except: + failed.append(1) + + t = threading.Thread(target=target) + t.start() + t.join(5) + self.assertFalse(failed) + + @unittest.skipIf(os.name == "nt", "not on Windows") + def test_no_replace_if_set_by_glib(self): + id_ = GLib.unix_signal_add( + GLib.PRIORITY_DEFAULT, signal.SIGINT, lambda *args: None) + try: + # signal.getsignal() doesn't pick up that unix_signal_add() + # has changed the handler, but we should anyway. + self.assertEqual( + signal.getsignal(signal.SIGINT), signal.default_int_handler) + with register_sigint_fallback(lambda: None): + self.assertEqual( + signal.getsignal(signal.SIGINT), + signal.default_int_handler) + self.assertEqual( + signal.getsignal(signal.SIGINT), signal.default_int_handler) + finally: + GLib.source_remove(id_) + signal.signal(signal.SIGINT, signal.SIG_DFL) + signal.signal(signal.SIGINT, signal.default_int_handler) diff --git a/tests/test_overrides.py b/tests/test_overrides.py deleted file mode 100644 index e1af1f1..0000000 --- a/tests/test_overrides.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -# vim: tabstop=4 shiftwidth=4 expandtab - -import unittest - -import gi.overrides -import gi.module - -try: - from gi.repository import Regress - Regress # pyflakes -except ImportError: - Regress = None - - -class TestRegistry(unittest.TestCase): - def test_non_gi(self): - class MyClass: - pass - - try: - gi.overrides.override(MyClass) - self.fail('unexpected success of overriding non-GI class') - except TypeError as e: - self.assertTrue('Can not override a type MyClass' in str(e)) - - @unittest.skipUnless(Regress, 'built without cairo support') - def test_separate_path(self): - # Regress override is in tests/gi/overrides, separate from gi/overrides - # https://bugzilla.gnome.org/show_bug.cgi?id=680913 - self.assertEqual(Regress.REGRESS_OVERRIDE, 42) - - -class TestModule(unittest.TestCase): - # Tests for gi.module - - def test_get_introspection_module_caching(self): - # This test attempts to minimize side effects by - # using a DynamicModule directly instead of going though: - # from gi.repository import Foo - - # Clear out introspection module cache before running this test. - old_modules = gi.module._introspection_modules - gi.module._introspection_modules = {} - - mod_name = 'GIMarshallingTests' - mod1 = gi.module.get_introspection_module(mod_name) - mod2 = gi.module.get_introspection_module(mod_name) - self.assertTrue(mod1 is mod2) - - # Using a DynamicModule will use get_introspection_module internally - # in its _load method. - mod_overridden = gi.module.DynamicModule(mod_name) - mod_overridden._load() - self.assertTrue(mod1 is mod_overridden._introspection_module) - - # Restore the previous cache - gi.module._introspection_modules = old_modules diff --git a/tests/test_overrides_gdk.py b/tests/test_overrides_gdk.py index 46f0a38..119e56b 100644 --- a/tests/test_overrides_gdk.py +++ b/tests/test_overrides_gdk.py @@ -1,19 +1,46 @@ # -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab +import re +import os +import sys import unittest +import pytest +import gi import gi.overrides +from gi import PyGIDeprecationWarning try: - from gi.repository import Gdk, GdkPixbuf, Gtk - Gdk # pyflakes + from gi.repository import Gio, Gdk, GdkPixbuf, Gtk + GDK4 = Gdk._version == "4.0" except ImportError: Gdk = None + GDK4 = False + + +def gtkver(): + if Gtk is None: + return (0, 0, 0) + return (Gtk.get_major_version(), + Gtk.get_minor_version(), + Gtk.get_micro_version()) + + +try: + gi.require_foreign('cairo') + has_cairo = True +except ImportError: + has_cairo = False + +from .helper import capture_glib_deprecation_warnings @unittest.skipUnless(Gdk, 'Gdk not available') class TestGdk(unittest.TestCase): + + @unittest.skipIf(sys.platform == "darwin" or os.name == "nt", "crashes") + @unittest.skipIf(GDK4, "not in gdk4") def test_constructor(self): attribute = Gdk.WindowAttr() attribute.window_type = Gdk.WindowType.CHILD @@ -22,14 +49,21 @@ class TestGdk(unittest.TestCase): window = Gdk.Window(None, attribute, attributes_mask) self.assertEqual(window.get_window_type(), Gdk.WindowType.CHILD) + @unittest.skipIf(GDK4, "not in gdk4") def test_color(self): color = Gdk.Color(100, 200, 300) self.assertEqual(color.red, 100) self.assertEqual(color.green, 200) self.assertEqual(color.blue, 300) - self.assertEqual(color, Gdk.Color(100, 200, 300)) + with capture_glib_deprecation_warnings(): + self.assertEqual(color, Gdk.Color(100, 200, 300)) self.assertNotEqual(color, Gdk.Color(1, 2, 3)) + self.assertNotEqual(color, None) + # assertNotEqual only tests __ne__. Following line explicitly + # tests __eq__ with objects of other types + self.assertFalse(color == object()) + @unittest.skipIf(GDK4, "not in gdk4") def test_color_floats(self): self.assertEqual(Gdk.Color(13107, 21845, 65535), Gdk.Color.from_floats(0.2, 1.0 / 3.0, 1.0)) @@ -43,6 +77,20 @@ class TestGdk(unittest.TestCase): self.assertEqual(Gdk.RGBA.from_color(Gdk.Color(13107, 21845, 65535)), Gdk.RGBA(0.2, 1.0 / 3.0, 1.0, 1.0)) + @unittest.skipIf(GDK4, "not in gdk4") + def test_color_to_floats_attrs(self): + color = Gdk.Color(13107, 21845, 65535) + assert color.red_float == 0.2 + color.red_float = 0 + assert color.red_float == 0 + assert color.green_float == 1.0 / 3.0 + color.green_float = 0 + assert color.green_float == 0 + assert color.blue_float == 1.0 + color.blue_float = 0 + assert color.blue_float == 0 + + @unittest.skipIf(GDK4, "not in gdk4") def test_rgba(self): self.assertEqual(Gdk.RGBA, gi.overrides.Gdk.RGBA) rgba = Gdk.RGBA(0.1, 0.2, 0.3, 0.4) @@ -54,25 +102,98 @@ class TestGdk(unittest.TestCase): self.assertEqual(rgba.alpha, 0.4) rgba.green = 0.9 self.assertEqual(rgba.green, 0.9) + self.assertNotEqual(rgba, None) + # assertNotEqual only tests __ne__. Following line explicitly + # tests __eq__ with objects of other types + self.assertFalse(rgba == object()) # Iterator/tuple convsersion self.assertEqual(tuple(Gdk.RGBA(0.1, 0.2, 0.3, 0.4)), (0.1, 0.2, 0.3, 0.4)) + @unittest.skipUnless(GDK4, "only in gdk4") + def test_rgba_gtk4(self): + c = Gdk.RGBA() + assert c.to_string() == "rgba(0,0,0,0)" + + @unittest.skipIf(not has_cairo or GDK4, "not in gdk4") + def test_window(self): + w = Gtk.Window() + w.realize() + window = w.get_window() + with capture_glib_deprecation_warnings(): + assert window.cairo_create() is not None + + @unittest.skipIf(GDK4, "not in gdk4") + def test_drag_context(self): + context = Gdk.DragContext() + # using it this way crashes.. + assert hasattr(context, "finish") + + @unittest.skipIf(GDK4, "not in gdk4") def test_event(self): event = Gdk.Event.new(Gdk.EventType.CONFIGURE) self.assertEqual(event.type, Gdk.EventType.CONFIGURE) self.assertEqual(event.send_event, 0) + event = Gdk.Event() + event.type = Gdk.EventType.SCROLL + self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar')) + + @unittest.skipIf(GDK4, "not in gdk4") + def test_scroll_event(self): + event = Gdk.Event.new(Gdk.EventType.SCROLL) + assert event.direction == Gdk.ScrollDirection.UP + + @unittest.skipIf(GDK4, "not in gdk4") + def test_event_strip_boolean(self): + ev = Gdk.EventButton() + ev.type = Gdk.EventType.BUTTON_PRESS + assert ev.get_coords() == (0.0, 0.0) + + # https://gitlab.gnome.org/GNOME/pygobject/issues/85 + ev = Gdk.Event.new(Gdk.EventType.BUTTON_PRESS) + assert ev.get_coords() == (True, 0.0, 0.0) + + @unittest.skipIf(GDK4, "not in gdk4") + def test_event_touch(self): + event = Gdk.Event.new(Gdk.EventType.TOUCH_BEGIN) + self.assertEqual(event.type, Gdk.EventType.TOUCH_BEGIN) + + # emulating_pointer is unique to touch events + self.assertFalse(event.emulating_pointer) + self.assertFalse(event.touch.emulating_pointer) + + event.emulating_pointer = True + self.assertTrue(event.emulating_pointer) + self.assertTrue(event.touch.emulating_pointer) + + @unittest.skipIf(GDK4, "not in gdk4") + def test_event_setattr(self): event = Gdk.Event.new(Gdk.EventType.DRAG_MOTION) event.x_root, event.y_root = 0, 5 + self.assertEqual(event.dnd.x_root, 0) + self.assertEqual(event.dnd.y_root, 5) self.assertEqual(event.x_root, 0) self.assertEqual(event.y_root, 5) - event = Gdk.Event() - event.type = Gdk.EventType.SCROLL - self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar')) + # this used to work, keep it that way + self.assertFalse(hasattr(event, "foo_bar")) + event.foo_bar = 42 + + # unhandled type + event.type = Gdk.EventType.EVENT_LAST + with pytest.raises(AttributeError): + event.foo_bar + event.foo_bar = 42 + assert event.foo_bar == 42 + + @unittest.skipIf(GDK4, "not in gdk4") + def test_event_repr(self): + event = Gdk.Event.new(Gdk.EventType.CONFIGURE) + self.assertTrue("CONFIGURE" in repr(event)) + @unittest.skipIf(GDK4, "not in gdk4") def test_event_structures(self): def button_press_cb(button, event): self.assertTrue(isinstance(event, Gdk.EventButton)) @@ -88,18 +209,22 @@ class TestGdk(unittest.TestCase): b = Gtk.Button() b.connect('button-press-event', button_press_cb) w.add(b) - w.show_all() + b.show() + b.realize() Gdk.test_simulate_button(b.get_window(), 2, 5, 0, Gdk.ModifierType.CONTROL_MASK, Gdk.EventType.BUTTON_PRESS) + @unittest.skipIf(GDK4, "not in gdk4") def test_cursor(self): self.assertEqual(Gdk.Cursor, gi.overrides.Gdk.Cursor) - c = Gdk.Cursor(Gdk.CursorType.WATCH) + with capture_glib_deprecation_warnings(): + c = Gdk.Cursor(Gdk.CursorType.WATCH) self.assertNotEqual(c, None) - c = Gdk.Cursor(cursor_type=Gdk.CursorType.WATCH) + with capture_glib_deprecation_warnings(): + c = Gdk.Cursor(cursor_type=Gdk.CursorType.WATCH) self.assertNotEqual(c, None) display_manager = Gdk.DisplayManager.get() @@ -111,31 +236,90 @@ class TestGdk(unittest.TestCase): 5, 10) - c = Gdk.Cursor(display, - test_pixbuf, - y=0, x=0) + with capture_glib_deprecation_warnings() as warn: + c = Gdk.Cursor(display, + test_pixbuf, + y=0, x=0) + self.assertNotEqual(c, None) + + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGIDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*new_from_pixbuf.*') - self.assertNotEqual(c, None) self.assertRaises(ValueError, Gdk.Cursor, 1, 2, 3) + with capture_glib_deprecation_warnings() as warn: + c = Gdk.Cursor(display, Gdk.CursorType.WATCH) + assert len(warn) == 1 + # on macOS the type is switched to PIXMAP behind the scenes + assert c.props.cursor_type in ( + Gdk.CursorType.WATCH, Gdk.CursorType.CURSOR_IS_PIXMAP) + assert c.props.display == display + + @unittest.skipUnless(GDK4, "only gdk4") + def test_cursor_gdk4(self): + Gdk.Cursor() + Gdk.Cursor(name="foo") + Gdk.Cursor(fallback=Gdk.Cursor()) + def test_flags(self): self.assertEqual(Gdk.ModifierType.META_MASK | 0, 0x10000000) self.assertEqual(hex(Gdk.ModifierType.META_MASK), '0x10000000') self.assertEqual(str(Gdk.ModifierType.META_MASK), - '') + '') - self.assertEqual(Gdk.ModifierType.RELEASE_MASK | 0, 0x40000000) - self.assertEqual(hex(Gdk.ModifierType.RELEASE_MASK), '0x40000000') - self.assertEqual(str(Gdk.ModifierType.RELEASE_MASK), - '') + # RELEASE_MASK does not exist in gdk4 + if not GDK4: + self.assertEqual(Gdk.ModifierType.RELEASE_MASK | 0, 0x40000000) + self.assertEqual(hex(Gdk.ModifierType.RELEASE_MASK), '0x40000000') + self.assertEqual(str(Gdk.ModifierType.RELEASE_MASK), + '') - self.assertEqual(Gdk.ModifierType.RELEASE_MASK | Gdk.ModifierType.META_MASK, 0x50000000) - self.assertEqual(str(Gdk.ModifierType.RELEASE_MASK | Gdk.ModifierType.META_MASK), - '') + self.assertEqual(Gdk.ModifierType.RELEASE_MASK | Gdk.ModifierType.META_MASK, 0x50000000) + self.assertEqual(str(Gdk.ModifierType.RELEASE_MASK | Gdk.ModifierType.META_MASK), + '') + @unittest.skipIf(GDK4, "not in gdk4") def test_color_parse(self): - c = Gdk.color_parse('#00FF80') + with capture_glib_deprecation_warnings(): + c = Gdk.color_parse('#00FF80') self.assertEqual(c.red, 0) self.assertEqual(c.green, 65535) self.assertEqual(c.blue, 32896) self.assertEqual(Gdk.color_parse('bogus'), None) + + @unittest.skipIf(GDK4, "not in gdk4") + def test_color_representations(self): + # __repr__ should generate a string which is parsable when possible + # http://docs.python.org/2/reference/datamodel.html#object.__repr__ + color = Gdk.Color(red=65535, green=32896, blue=1) + self.assertEqual(eval(repr(color)), color) + + rgba = Gdk.RGBA(red=1.0, green=0.8, blue=0.6, alpha=0.4) + self.assertEqual(eval(repr(rgba)), rgba) + + @unittest.skipIf(GDK4, "not in gdk4") + def test_rectangle_functions(self): + # https://bugzilla.gnome.org/show_bug.cgi?id=756364 + a = Gdk.Rectangle() + b = Gdk.Rectangle() + self.assertTrue(isinstance(Gdk.rectangle_union(a, b), Gdk.Rectangle)) + intersect, rect = Gdk.rectangle_intersect(a, b) + self.assertTrue(isinstance(rect, Gdk.Rectangle)) + self.assertTrue(isinstance(intersect, bool)) + + @unittest.skipIf(GDK4, "not in gdk4") + def test_atom_repr_str(self): + atom = Gdk.atom_intern("", True) + assert re.match(r"", repr(atom)) + assert re.match(r"Gdk.Atom<\d+>", str(atom)) + + @unittest.skipUnless(GDK4, "only in gdk4") + @unittest.skipUnless(gtkver() >= (4, 8, 0), "constructor available since 4.8") + def test_file_list(self): + f = Gio.File.new_for_path("/tmp") + filelist = Gdk.FileList([f]) + self.assertTrue(isinstance(filelist, Gdk.FileList)) + self.assertEqual(len(filelist), 1) + self.assertEqual(filelist[0], f) diff --git a/tests/test_overrides_gdkpixbuf.py b/tests/test_overrides_gdkpixbuf.py new file mode 100644 index 0000000..4edd9bf --- /dev/null +++ b/tests/test_overrides_gdkpixbuf.py @@ -0,0 +1,47 @@ +# Copyright 2018 Christoph Reiter +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +import pytest + +from gi import PyGIDeprecationWarning +GdkPixbuf = pytest.importorskip("gi.repository.GdkPixbuf") + + +def test_new_from_data(): + width = 600 + height = 32769 + pixbuf = GdkPixbuf.Pixbuf.new( + GdkPixbuf.Colorspace.RGB, True, 8, width, height) + pixels = pixbuf.get_pixels() + new_pixbuf = GdkPixbuf.Pixbuf.new_from_data( + pixels, GdkPixbuf.Colorspace.RGB, True, 8, + pixbuf.get_width(), pixbuf.get_height(), pixbuf.get_rowstride()) + del pixbuf + del pixels + new_pixels = new_pixbuf.get_pixels() + assert len(new_pixels) == width * height * 4 + + +def test_new_from_data_deprecated_args(): + GdkPixbuf.Pixbuf.new_from_data(b"1234", 0, True, 8, 1, 1, 4) + GdkPixbuf.Pixbuf.new_from_data(b"1234", 0, True, 8, 1, 1, 4, None) + with pytest.warns(PyGIDeprecationWarning, match=".*destroy_fn.*"): + GdkPixbuf.Pixbuf.new_from_data( + b"1234", 0, True, 8, 1, 1, 4, object(), object(), object()) + with pytest.warns(PyGIDeprecationWarning, match=".*destroy_fn_data.*"): + GdkPixbuf.Pixbuf.new_from_data( + b"1234", 0, True, 8, 1, 1, 4, object(), object(), object()) diff --git a/tests/test_overrides_gio.py b/tests/test_overrides_gio.py new file mode 100644 index 0000000..db09859 --- /dev/null +++ b/tests/test_overrides_gio.py @@ -0,0 +1,360 @@ +import random +import platform +import warnings + +import pytest + +from gi.repository import Gio, GObject +from gi import PyGIWarning + + +class Item(GObject.Object): + _id = 0 + + def __init__(self, **kwargs): + super(Item, self).__init__(**kwargs) + Item._id += 1 + self._id = self._id + + def __repr__(self): + return str(self._id) + + +class NamedItem(Item): + + name = GObject.Property(type=str, default='') + + def __repr__(self): + return self.props.name + + +def test_list_store_sort(): + store = Gio.ListStore() + items = [NamedItem(name=n) for n in "cabx"] + sorted_items = sorted(items, key=lambda i: i.props.name) + + user_data = [object(), object()] + + def sort_func(a, b, *args): + assert list(args) == user_data + assert isinstance(a, NamedItem) + assert isinstance(b, NamedItem) + cmp = lambda a, b: (a > b) - (a < b) + return cmp(a.props.name, b.props.name) + + store[:] = items + assert store[:] != sorted_items + store.sort(sort_func, *user_data) + assert store[:] == sorted_items + + +def test_list_store_insert_sorted(): + store = Gio.ListStore() + items = [NamedItem(name=n) for n in "cabx"] + sorted_items = sorted(items, key=lambda i: i.props.name) + + user_data = [object(), object()] + + def sort_func(a, b, *args): + assert list(args) == user_data + assert isinstance(a, NamedItem) + assert isinstance(b, NamedItem) + cmp = lambda a, b: (a > b) - (a < b) + return cmp(a.props.name, b.props.name) + + for item in items: + index = store.insert_sorted(item, sort_func, *user_data) + assert isinstance(index, int) + assert store[:] == sorted_items + + +def test_list_model_len(): + model = Gio.ListStore.new(Item) + assert len(model) == 0 + assert not model + for i in range(1, 10): + model.append(Item()) + assert len(model) == i + assert model + model.remove_all() + assert not model + assert len(model) == 0 + + +def test_list_model_get_item_simple(): + model = Gio.ListStore.new(Item) + with pytest.raises(IndexError): + model[0] + first_item = Item() + model.append(first_item) + assert model[0] is first_item + assert model[-1] is first_item + second_item = Item() + model.append(second_item) + assert model[1] is second_item + assert model[-1] is second_item + assert model[-2] is first_item + with pytest.raises(IndexError): + model[-3] + + with pytest.raises(TypeError): + model[object()] + + +def test_list_model_get_item_slice(): + model = Gio.ListStore.new(Item) + source = [Item() for i in range(30)] + for i in source: + model.append(i) + assert model[1:10] == source[1:10] + assert model[1:-2] == source[1:-2] + assert model[-4:-1] == source[-4:-1] + assert model[-100:-1] == source[-100:-1] + assert model[::-1] == source[::-1] + assert model[:] == source[:] + + +def test_list_model_contains(): + model = Gio.ListStore.new(Item) + item = Item() + model.append(item) + assert item in model + assert Item() not in model + with pytest.raises(TypeError): + object() in model + with pytest.raises(TypeError): + None in model + + +def test_list_model_iter(): + model = Gio.ListStore.new(Item) + item = Item() + model.append(item) + + it = iter(model) + assert next(it) is item + repr(item) + + +def test_list_store_delitem_simple(): + store = Gio.ListStore.new(Item) + store.append(Item()) + del store[0] + assert not store + with pytest.raises(IndexError): + del store[0] + with pytest.raises(IndexError): + del store[-1] + + store.append(Item()) + with pytest.raises(IndexError): + del store[-2] + del store[-1] + assert not store + + source = [Item(), Item()] + store.append(source[0]) + store.append(source[1]) + del store[-1] + assert store[:] == [source[0]] + + with pytest.raises(TypeError): + del store[object()] + + +def test_list_store_delitem_slice(): + + def do_del(count, key): + + events = [] + + def on_changed(m, *args): + events.append(args) + + store = Gio.ListStore.new(Item) + source = [Item() for i in range(count)] + for item in source: + store.append(item) + store.connect("items-changed", on_changed) + source.__delitem__(key) + store.__delitem__(key) + assert source == store[:] + return events + + values = [None, 1, -15, 3, -2, 0, -3, 5, 7] + variants = set() + for i in range(500): + start = random.choice(values) + stop = random.choice(values) + step = random.choice(values) + length = abs(random.choice(values) or 0) + if step == 0: + step += 1 + variants.add((length, start, stop, step)) + + for length, start, stop, step in variants: + do_del(length, slice(start, stop, step)) + + # basics + do_del(10, slice(None, None, None)) + do_del(10, slice(None, None, None)) + do_del(10, slice(None, None, -1)) + do_del(10, slice(0, 5, None)) + do_del(10, slice(0, 10, 1)) + do_del(10, slice(0, 10, 2)) + do_del(10, slice(14, 2, -1)) + + # test some fast paths + assert do_del(100, slice(None, None, None)) == [(0, 100, 0)] + assert do_del(100, slice(None, None, -1)) == [(0, 100, 0)] + assert do_del(100, slice(0, 50, 1)) == [(0, 50, 0)] + + +def test_list_store_setitem_simple(): + + store = Gio.ListStore.new(Item) + first = Item() + store.append(first) + + class Wrong(GObject.Object): + pass + + with pytest.raises(TypeError): + store[0] = object() + with pytest.raises(TypeError): + store[0] = None + with pytest.raises(TypeError): + store[0] = Wrong() + + assert store[:] == [first] + + new = Item() + store[0] = new + assert len(store) == 1 + store[-1] = Item() + assert len(store) == 1 + + with pytest.raises(IndexError): + store[1] = Item() + with pytest.raises(IndexError): + store[-2] = Item() + + store = Gio.ListStore.new(Item) + source = [Item(), Item(), Item()] + for item in source: + store.append(item) + new = Item() + store[1] = new + assert store[:] == [source[0], new, source[2]] + + with pytest.raises(TypeError): + store[object()] = Item() + + +def test_list_store_setitem_slice(): + + def do_set(count, key, new_count): + if count == 0 and key.step is not None \ + and platform.python_implementation() == "PyPy": + # https://foss.heptapod.net/pypy/pypy/-/issues/2804 + return + store = Gio.ListStore.new(Item) + source = [Item() for i in range(count)] + new = [Item() for i in range(new_count)] + for item in source: + store.append(item) + source_error = None + try: + source.__setitem__(key, new) + except ValueError as e: + source_error = type(e) + + store_error = None + try: + store.__setitem__(key, new) + except Exception as e: + store_error = type(e) + + assert source_error == store_error + assert source == store[:] + + values = [None, 1, -15, 3, -2, 0, 3, 4, 100] + variants = set() + for i in range(500): + start = random.choice(values) + stop = random.choice(values) + step = random.choice(values) + length = abs(random.choice(values) or 0) + new = random.choice(values) or 0 + if step == 0: + step += 1 + variants.add((length, start, stop, step, new)) + + for length, start, stop, step, new in variants: + do_set(length, slice(start, stop, step), new) + + # basics + do_set(10, slice(None, None, None), 20) + do_set(10, slice(None, None, None), 0) + do_set(10, slice(None, None, -1), 20) + do_set(10, slice(None, None, -1), 10) + do_set(10, slice(0, 5, None), 20) + do_set(10, slice(0, 10, 1), 0) + + # test iterators + store = Gio.ListStore.new(Item) + store[:] = iter([Item() for i in range(10)]) + assert len(store) == 10 + + # make sure we do all or nothing + store = Gio.ListStore.new(Item) + with pytest.raises(TypeError): + store[:] = [Item(), object()] + assert len(store) == 0 + + +def test_action_map_add_action_entries(): + actionmap = Gio.SimpleActionGroup() + + test_data = [] + + def f(action, parameter, data): + test_data.append('test back') + + actionmap.add_action_entries(( + ("simple", f), + ("with_type", f, "i"), + ("with_state", f, "s", "'left'", f), + )) + assert actionmap.has_action("simple") + assert actionmap.has_action("with_type") + assert actionmap.has_action("with_state") + actionmap.add_action_entries(( + ("with_user_data", f), + ), "user_data") + assert actionmap.has_action("with_user_data") + + with pytest.raises(TypeError): + actionmap.add_action_entries(( + ("invaild_type_string", f, 'asdf'), + )) + with pytest.raises(ValueError): + actionmap.add_action_entries(( + ("stateless_with_change_state", f, None, None, f), + )) + + actionmap.activate_action("simple") + assert test_data[0] == 'test back' + + +def test_types_init_warn(): + types = [ + Gio.DBusAnnotationInfo, Gio.DBusArgInfo, Gio.DBusMethodInfo, + Gio.DBusSignalInfo, Gio.DBusInterfaceInfo, Gio.DBusNodeInfo, + ] + + for t in types: + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + t() + assert issubclass(warn[0].category, PyGIWarning) diff --git a/tests/test_overrides_glib.py b/tests/test_overrides_glib.py index 4d7e63a..08c41ae 100644 --- a/tests/test_overrides_glib.py +++ b/tests/test_overrides_glib.py @@ -1,11 +1,121 @@ # -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab +import os +import gc import unittest +import tempfile +import socket + +import pytest import gi from gi.repository import GLib -from compathelper import _long + +from .helper import capture_gi_deprecation_warnings + + +def test_io_add_watch_get_args(): + get_args = GLib._io_add_watch_get_args + func = lambda: None + + # create a closed channel for testing + fd, fn = tempfile.mkstemp() + os.close(fd) + try: + chan = GLib.IOChannel(filename=fn) + chan.shutdown(True) + finally: + os.remove(fn) + + # old way + with capture_gi_deprecation_warnings(): + assert get_args(chan, GLib.IOCondition.IN, func) == ( + chan, 0, GLib.IOCondition.IN, func, tuple()) + + with pytest.raises(TypeError): + get_args(chan, GLib.IOCondition.IN, object()) + + # new way + prio = GLib.PRIORITY_DEFAULT + with capture_gi_deprecation_warnings(): + assert get_args(chan, prio, GLib.IOCondition.IN, func, 99) == \ + (chan, prio, GLib.IOCondition.IN, func, (99,)) + + with pytest.raises(TypeError): + assert get_args(chan, prio, GLib.IOCondition.IN) + + with pytest.raises(TypeError): + assert get_args(chan, prio, 99) + + +@pytest.mark.skipif(os.name != "nt", reason="windows only") +def test_io_add_watch_get_args_win32_socket(): + get_args = GLib._io_add_watch_get_args + + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + func = lambda: None + prio = GLib.PRIORITY_DEFAULT + chan = get_args(s, prio, GLib.IOCondition.IN, func)[0] + assert isinstance(chan, GLib.IOChannel) + chan.shutdown(False) + + +def test_threads_init(): + with capture_gi_deprecation_warnings() as w: + GLib.threads_init() + assert len(w) + + +def test_gerror_matches(): + e = GLib.Error(domain=42, code=24) + assert e.matches(42, 24) + + +def test_timeout_add_seconds(): + h = GLib.timeout_add_seconds( + 100, lambda *x: None, 1, 2, 3, priority=GLib.PRIORITY_HIGH_IDLE) + GLib.source_remove(h) + + +def test_iochannel(): + with pytest.raises(TypeError): + GLib.IOChannel() + + +def test_iochannel_write(): + fd, fn = tempfile.mkstemp() + os.close(fd) + chan = GLib.IOChannel(filename=fn, mode="r+") + try: + assert chan.write(b"foo", 2) == 2 + chan.seek(0) + assert chan.read() == b"fo" + finally: + chan.shutdown(True) + + +@pytest.mark.skipif(os.name == "nt", reason="unix only") +def test_has_unix_signal_add(): + with capture_gi_deprecation_warnings(): + GLib.unix_signal_add == GLib.unix_signal_add_full + + +@pytest.mark.skipif(os.name != "nt", reason="windows only") +def test_iochannel_win32(): + fd, fn = tempfile.mkstemp() + closed = False + try: + channel = GLib.IOChannel(hwnd=fd) + try: + assert channel.read() == b"" + finally: + closed = True + channel.shutdown(True) + finally: + if not closed: + os.close(fd) + os.remove(fn) class TestGVariant(unittest.TestCase): @@ -22,6 +132,17 @@ class TestGVariant(unittest.TestCase): self.assertTrue(isinstance(variant, GLib.Variant)) self.assertEqual(variant.get_string(), 'hello') + def test_simple_invalid_ops(self): + variant = GLib.Variant('i', 42) + with pytest.raises(TypeError): + len(variant) + + with pytest.raises(TypeError): + variant[0] + + with pytest.raises(TypeError): + variant.keys() + def test_create_variant(self): variant = GLib.Variant('v', GLib.Variant('i', 42)) self.assertTrue(isinstance(variant, GLib.Variant)) @@ -59,7 +180,13 @@ class TestGVariant(unittest.TestCase): # nested tuples variant = GLib.Variant('((si)(ub))', (('hello', -1), (42, True))) self.assertEqual(variant.get_type_string(), '((si)(ub))') - self.assertEqual(variant.unpack(), (('hello', -1), (_long(42), True))) + self.assertEqual(variant.unpack(), (('hello', -1), (42, True))) + + def test_new_tuple_sink(self): + # https://bugzilla.gnome.org/show_bug.cgi?id=735166 + variant = GLib.Variant.new_tuple(GLib.Variant.new_tuple()) + del variant + gc.collect() def test_create_dictionary(self): variant = GLib.Variant('a{si}', {}) @@ -88,6 +215,15 @@ class TestGVariant(unittest.TestCase): self.assertTrue(isinstance(variant, GLib.Variant)) self.assertEqual(variant.unpack(), d) + # init with an iterable + variant = GLib.Variant('a{si}', [("foo", 2)]) + assert variant.unpack() == {'foo': 2} + + with pytest.raises(TypeError): + GLib.Variant('a{si}', [("foo",)]) + with pytest.raises(TypeError): + GLib.Variant('a{si}', [("foo", 1, 2)]) + def test_create_array(self): variant = GLib.Variant('ai', []) self.assertEqual(variant.get_type_string(), 'ai') @@ -133,6 +269,50 @@ class TestGVariant(unittest.TestCase): self.assertEqual(variant.get_type_string(), 'aai') self.assertEqual(variant.unpack(), [[1, 2], [3, 4, 5]]) + def test_create_array_guchar(self): + variant = GLib.Variant('ay', [97, 97, 97]) + assert variant.unpack() == [97, 97, 97] + + variant = GLib.Variant('ay', b'aaa') + assert variant.unpack() == [97, 97, 97] + + variant = GLib.Variant('ay', iter([1, 2, 3])) + assert variant.unpack() == [1, 2, 3] + + with self.assertRaises(TypeError): + GLib.Variant('ay', u'aaa') + + with self.assertRaises(TypeError): + GLib.Variant('ay', object()) + + def test_create_maybe(self): + variant = GLib.Variant('mai', None) + self.assertEqual(variant.get_type_string(), 'mai') + self.assertEqual(variant.n_children(), 0) + self.assertEqual(variant.unpack(), None) + + variant = GLib.Variant('mai', []) + self.assertEqual(variant.get_type_string(), 'mai') + self.assertEqual(variant.n_children(), 1) + + variant = GLib.Variant('mami', [None]) + self.assertEqual(variant.get_type_string(), 'mami') + self.assertEqual(variant.n_children(), 1) + + variant = GLib.Variant('mami', [None, 13, None]) + self.assertEqual(variant.get_type_string(), 'mami') + self.assertEqual(variant.n_children(), 1) + array = variant.get_child_value(0) + self.assertEqual(array.n_children(), 3) + + element = array.get_child_value(0) + self.assertEqual(element.n_children(), 0) + element = array.get_child_value(1) + self.assertEqual(element.n_children(), 1) + self.assertEqual(element.get_child_value(0).get_int32(), 13) + element = array.get_child_value(2) + self.assertEqual(element.n_children(), 0) + def test_create_complex(self): variant = GLib.Variant('(as)', ([],)) self.assertEqual(variant.get_type_string(), '(as)') @@ -225,8 +405,8 @@ class TestGVariant(unittest.TestCase): self.assertRaises(TypeError, GLib.Variant, '(ss)', 'mec', 'mac') self.assertRaises(TypeError, GLib.Variant, '(s)', 'hello') - # unimplemented data type - self.assertRaises(NotImplementedError, GLib.Variant, 'Q', 1) + # invalid format string + self.assertRaises(TypeError, GLib.Variant, 'Q', 1) # invalid types self.assertRaises(TypeError, GLib.Variant, '(ii', (42, 3)) @@ -273,12 +453,16 @@ class TestGVariant(unittest.TestCase): self.assertEqual(res, {'key1': 1, 'key2': 2}) # maybe - v = GLib.Variant.new_maybe(GLib.VariantType.new('i'), GLib.Variant('i', 1)) - res = v.unpack() - self.assertEqual(res, 1) - v = GLib.Variant.new_maybe(GLib.VariantType.new('i'), None) - res = v.unpack() - self.assertEqual(res, None) + v = GLib.Variant('mi', 1) + self.assertEqual(v.unpack(), 1) + v = GLib.Variant('mi', None) + self.assertEqual(v.unpack(), None) + v = GLib.Variant('mai', []) + self.assertEqual(v.unpack(), []) + v = GLib.Variant('m()', ()) + self.assertEqual(v.unpack(), ()) + v = GLib.Variant('mami', [None, 1, None]) + self.assertEqual(v.unpack(), [None, 1, None]) def test_iteration(self): # array index access @@ -414,6 +598,9 @@ class TestGVariant(unittest.TestCase): assert_equal('v', GLib.Variant('i', 42)) assert_not_equal('v', GLib.Variant('i', 42), 'v', GLib.Variant('i', 43)) + assert GLib.Variant('i', 42) != object() + assert not GLib.Variant('i', 42) == object() + def test_bool(self): # Check if the GVariant bool matches the unpacked Pythonic bool @@ -470,6 +657,11 @@ class TestGVariant(unittest.TestCase): assert_equals_bool('v', GLib.Variant('i', 0)) assert_equals_bool('v', GLib.Variant('i', 1)) + # maybe types + assert_equals_bool('mi', 42) + assert_equals_bool('mi', 0) + assert_equals_bool('mi', None) + def test_repr(self): # with C constructor v = GLib.Variant.new_uint32(42) @@ -487,3 +679,46 @@ class TestGVariant(unittest.TestCase): # with override constructor v = GLib.Variant('(is)', (1, 'somestring')) self.assertEqual(str(v), "(1, 'somestring')") + + def test_parse_error(self): + # This test doubles as a test for GLib.Error marshaling. + source_str = 'abc' + with self.assertRaises(GLib.Error) as context: + GLib.Variant.parse(None, source_str, None, None) + e = context.exception + text = GLib.Variant.parse_error_print_context(e, source_str) + self.assertTrue(source_str in text) + + def test_parse_error_exceptions(self): + source_str = 'abc' + self.assertRaisesRegex(TypeError, 'Must be GLib.Error, not int', + GLib.Variant.parse_error_print_context, + 42, source_str) + + gerror = GLib.Error(message=42) # not a string + self.assertRaisesRegex(TypeError, ".*Must be string, not int.*", + GLib.Variant.parse_error_print_context, + gerror, source_str) + + gerror = GLib.Error(domain=42) # not a string + self.assertRaisesRegex(TypeError, ".*Must be string, not int.*", + GLib.Variant.parse_error_print_context, + gerror, source_str) + + gerror = GLib.Error(code='not an int') + self.assertRaisesRegex(TypeError, ".*Must be number, not str.*", + GLib.Variant.parse_error_print_context, + gerror, source_str) + + gerror = GLib.Error(code=GLib.MAXUINT) + self.assertRaisesRegex(OverflowError, + ".*not in range.*", + GLib.Variant.parse_error_print_context, + gerror, source_str) + + +class TestConstants(unittest.TestCase): + + def test_basic_types_limits(self): + self.assertTrue(isinstance(GLib.MINFLOAT, float)) + self.assertTrue(isinstance(GLib.MAXLONG, int)) diff --git a/tests/test_overrides_gobject.py b/tests/test_overrides_gobject.py new file mode 100644 index 0000000..dc26596 --- /dev/null +++ b/tests/test_overrides_gobject.py @@ -0,0 +1,423 @@ +import pytest + +from gi import PyGIDeprecationWarning +from gi.repository import GObject, GLib, GIMarshallingTests + +from .helper import ignore_gi_deprecation_warnings + + +def test_stop_emission_deprec(): + class TestObject(GObject.GObject): + int_prop = GObject.Property(default=0, type=int) + + obj = TestObject() + + def notify_callback(obj, *args): + with pytest.warns(PyGIDeprecationWarning): + obj.stop_emission("notify::int-prop") + + with pytest.warns(PyGIDeprecationWarning): + obj.emit_stop_by_name("notify::int-prop") + + obj.stop_emission_by_name("notify::int-prop") + + obj.connect("notify::int-prop", notify_callback) + obj.notify("int-prop") + + +def test_signal_parse_name(): + obj = GObject.GObject() + assert GObject.signal_parse_name("notify", obj, True) == (1, 0) + + with pytest.raises(ValueError): + GObject.signal_parse_name("foobar", obj, True) + + +def test_signal_query(): + obj = GObject.GObject() + res = GObject.signal_query("notify", obj) + assert res.signal_name == "notify" + assert res.itype == obj.__gtype__ + + res = GObject.signal_query("foobar", obj) + assert res is None + + +def test_value_repr(): + v = GObject.Value() + assert repr(v) == "" + + v = GObject.Value(int, 0) + assert repr(v) == "" + + +def test_value_no_init(): + v = GObject.Value() + with pytest.raises(TypeError): + v.set_value(0) + v.init(GObject.TYPE_LONG) + assert v.get_value() == 0 + v.set_value(0) + + +def test_value_invalid_type(): + v = GObject.Value() + assert v.g_type == GObject.TYPE_INVALID + assert isinstance(GObject.TYPE_INVALID, GObject.GType) + with pytest.raises(ValueError, match="Invalid GType"): + v.init(GObject.TYPE_INVALID) + + with pytest.raises( + TypeError, match="GObject.Value needs to be initialized first"): + v.set_value(None) + + assert v.get_value() is None + + +def test_value_long(): + v = GObject.Value(GObject.TYPE_LONG) + assert v.get_value() == 0 + v.set_value(0) + assert v.get_value() == 0 + + v.set_value(GLib.MAXLONG) + assert v.get_value() == GLib.MAXLONG + + v.set_value(GLib.MINLONG) + assert v.get_value() == GLib.MINLONG + + with pytest.raises(OverflowError): + v.set_value(GLib.MAXLONG + 1) + + with pytest.raises(OverflowError): + v.set_value(GLib.MINLONG - 1) + + +def test_value_ulong(): + v = GObject.Value(GObject.TYPE_ULONG) + assert v.get_value() == 0 + v.set_value(0) + assert v.get_value() == 0 + + v.set_value(GLib.MAXULONG) + assert v.get_value() == GLib.MAXULONG + + with pytest.raises(OverflowError): + v.set_value(GLib.MAXULONG + 1) + + with pytest.raises(OverflowError): + v.set_value(-1) + + with pytest.raises(TypeError): + v.set_value(object()) + + with pytest.raises(TypeError): + v.set_value(None) + + +def test_value_float(): + v = GObject.Value(GObject.TYPE_FLOAT) + + for getter, setter in [(v.get_value, v.set_value), + (v.get_float, v.set_float)]: + + assert getter() == 0.0 + setter(0) + assert getter() == 0 + + setter(GLib.MAXFLOAT) + assert getter() == GLib.MAXFLOAT + + setter(GLib.MINFLOAT) + assert getter() == GLib.MINFLOAT + + setter(-GLib.MAXFLOAT) + assert getter() == -GLib.MAXFLOAT + + with pytest.raises(OverflowError): + setter(GLib.MAXFLOAT * 2) + + with pytest.raises(OverflowError): + setter(-GLib.MAXFLOAT * 2) + + with pytest.raises(TypeError): + setter(object()) + + with pytest.raises(TypeError): + setter(None) + + with pytest.raises(TypeError): + setter(1j) + + v.reset() + + +def test_value_double(): + v = GObject.Value(GObject.TYPE_DOUBLE) + assert v.get_value() == 0.0 + v.set_value(0) + assert v.get_value() == 0 + + v.set_value(GLib.MAXDOUBLE) + assert v.get_value() == GLib.MAXDOUBLE + + v.set_value(GLib.MINDOUBLE) + assert v.get_value() == GLib.MINDOUBLE + + v.set_value(-GLib.MAXDOUBLE) + assert v.get_value() == -GLib.MAXDOUBLE + + with pytest.raises(TypeError): + v.set_value(object()) + + with pytest.raises(TypeError): + v.set_value(None) + + with pytest.raises(TypeError): + v.set_value(1j) + + +def test_value_uint64(): + v = GObject.Value(GObject.TYPE_UINT64) + assert v.get_value() == 0 + v.set_value(0) + assert v.get_value() == 0 + + v.set_value(GLib.MAXUINT64) + assert v.get_value() == GLib.MAXUINT64 + + with pytest.raises(OverflowError): + v.set_value(GLib.MAXUINT64 + 1) + + with pytest.raises(OverflowError): + v.set_value(-1) + + +def test_value_int64(): + v = GObject.Value(GObject.TYPE_INT64) + assert v.get_value() == 0 + v.set_value(0) + assert v.get_value() == 0 + + v.set_value(GLib.MAXINT64) + assert v.get_value() == GLib.MAXINT64 + v.set_value(GLib.MININT64) + assert v.get_value() == GLib.MININT64 + + with pytest.raises(OverflowError): + v.set_value(GLib.MAXINT64 + 1) + + with pytest.raises(OverflowError): + v.set_value(GLib.MININT64 - 1) + + with pytest.raises(TypeError): + v.set_value(object()) + + with pytest.raises(TypeError): + v.set_value(None) + + +def test_value_pointer(): + v = GObject.Value(GObject.TYPE_POINTER) + assert v.get_value() == 0 + v.set_value(42) + assert v.get_value() == 42 + v.set_value(0) + assert v.get_value() == 0 + + +def test_value_unichar(): + assert GObject.TYPE_UNICHAR == GObject.TYPE_UINT + + v = GObject.Value(GObject.TYPE_UNICHAR) + assert v.get_value() == 0 + v.set_value(42) + assert v.get_value() == 42 + + v.set_value(GLib.MAXUINT) + assert v.get_value() == GLib.MAXUINT + + +def test_value_gtype(): + class TestObject(GObject.GObject): + pass + + v = GObject.Value(GObject.TYPE_GTYPE) + assert v.get_value() == GObject.TYPE_INVALID + v.set_value(TestObject.__gtype__) + assert v.get_value() == TestObject.__gtype__ + v.set_value(TestObject) + assert v.get_value() == TestObject.__gtype__ + + with pytest.raises(TypeError): + v.set_value(None) + + +def test_value_variant(): + v = GObject.Value(GObject.TYPE_VARIANT) + assert v.get_value() is None + variant = GLib.Variant('i', 42) + v.set_value(variant) + assert v.get_value() == variant + + v.set_value(None) + assert v.get_value() is None + + with pytest.raises(TypeError): + v.set_value(object()) + + +def test_value_param(): + # FIXME: set_value and get_value trigger a critical + # GObject.Value(GObject.TYPE_PARAM) + pass + + +def test_value_string(): + v = GObject.Value(GObject.TYPE_STRING) + for getter, setter in [(v.get_value, v.set_value), + (v.get_string, v.set_string)]: + + assert getter() is None + + with pytest.raises(TypeError): + setter(b"bar") + + setter(u"quux") + assert getter() == u"quux" + assert isinstance(getter(), str) + + setter(None) + assert getter() is None + + v.reset() + + +def test_value_pyobject(): + class Foo(object): + pass + + v = GObject.Value(GObject.TYPE_PYOBJECT) + assert v.get_value() is None + for obj in [Foo(), None, 42, "foo"]: + v.set_value(obj) + assert v.get_value() == obj + + +@ignore_gi_deprecation_warnings +def test_value_char(): + v = GObject.Value(GObject.TYPE_CHAR) + assert v.get_value() == 0 + v.set_value(42) + assert v.get_value() == 42 + v.set_value(-1) + assert v.get_value() == -1 + v.set_value(b"a") + assert v.get_value() == 97 + v.set_value(b"\x00") + assert v.get_value() == 0 + + with pytest.raises(TypeError): + v.set_value(u"a") + + with pytest.raises(OverflowError): + v.set_value(128) + + +def test_value_uchar(): + v = GObject.Value(GObject.TYPE_UCHAR) + assert v.get_value() == 0 + v.set_value(200) + assert v.get_value() == 200 + v.set_value(b"a") + assert v.get_value() == 97 + v.set_value(b"\x00") + assert v.get_value() == 0 + + with pytest.raises(TypeError): + v.set_value(u"a") + + with pytest.raises(OverflowError): + v.set_value(256) + + +def test_value_set_boxed_deprecate_non_boxed(): + v = GObject.Value(GObject.TYPE_POINTER) + with pytest.warns(PyGIDeprecationWarning): + v.get_boxed() + with pytest.warns(PyGIDeprecationWarning): + v.set_boxed(None) + + +def test_value_boolean(): + v = GObject.Value(GObject.TYPE_BOOLEAN) + for getter, setter in [(v.get_value, v.set_value), + (v.get_boolean, v.set_boolean)]: + assert getter() is False + assert isinstance(getter(), bool) + + setter(42) + assert getter() is True + setter(-1) + assert getter() is True + setter(0) + assert getter() is False + + setter([]) + assert getter() is False + setter(["foo"]) + assert getter() is True + + setter(None) + assert getter() is False + v.reset() + + +def test_value_enum(): + t = GIMarshallingTests.GEnum + v = GObject.Value(t) + + for getter, setter in [(v.get_value, v.set_value), + (v.get_enum, v.set_enum)]: + assert v.g_type == t.__gtype__ + assert getter() == 0 + + setter(t.VALUE1) + assert getter() == t.VALUE1 + # FIXME: we should try to return an enum type + assert type(getter()) is int + + setter(2424242) + assert getter() == 2424242 + + setter(-1) + assert getter() == -1 + + with pytest.raises(TypeError): + setter(object()) + + with pytest.raises(TypeError): + setter(None) + + v.reset() + + +def test_value_object(): + v = GObject.Value(GIMarshallingTests.Object) + assert v.g_type.is_a(GObject.TYPE_OBJECT) + + for getter, setter in [(v.get_value, v.set_value), + (v.get_object, v.set_object)]: + assert getter() is None + + setter(None) + assert getter() is None + + obj = GIMarshallingTests.Object() + setter(obj) + assert getter() is obj + + with pytest.raises(TypeError): + setter(object()) + + v.reset() diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py index fbe51ec..04ab718 100644 --- a/tests/test_overrides_gtk.py +++ b/tests/test_overrides_gtk.py @@ -1,23 +1,42 @@ # -*- Mode: Python; py-indent-offset: 4 -*- -# coding: UTF-8 # vim: tabstop=4 shiftwidth=4 expandtab import contextlib import unittest -import time import sys +import gc +import warnings +import timeit -from compathelper import _unicode, _bytes +import pytest + +from .helper import ignore_gi_deprecation_warnings, capture_glib_warnings import gi.overrides import gi.types -from gi.repository import GLib, GObject +from gi.repository import Gio, GLib, GObject try: - from gi.repository import GdkPixbuf, Gdk, Gtk - Gtk # pyflakes + from gi.repository import Gtk, GdkPixbuf, Gdk + PyGTKDeprecationWarning = Gtk.PyGTKDeprecationWarning + Gtk_version = Gtk._version except ImportError: Gtk = None + Gtk_version = None + PyGTKDeprecationWarning = None + GdkPixbuf = None + Gdk = None + + +def gtkver(): + if Gtk is None: + return (0, 0, 0) + return (Gtk.get_major_version(), + Gtk.get_minor_version(), + Gtk.get_micro_version()) + + +GTK4 = (Gtk._version == "4.0") @contextlib.contextmanager @@ -32,28 +51,132 @@ def realized(widget): if isinstance(widget, Gtk.Window): toplevel = widget else: - toplevel = widget.get_parent_window() + if Gtk._version == "4.0": + toplevel = widget.get_parent() + else: + toplevel = widget.get_parent_window() if toplevel is None: window = Gtk.Window() - window.add(widget) + if Gtk._version == "4.0": + window.set_child(widget) + else: + window.add(widget) + window.show() widget.realize() - while Gtk.events_pending(): - Gtk.main_iteration() + if Gtk._version == "4.0": + context = GLib.MainContext() + while context.pending(): + context.iteration(False) + else: + while Gtk.events_pending(): + Gtk.main_iteration() + assert widget.get_realized() yield widget if toplevel is None: - window.remove(widget) + if Gtk._version == "4.0": + window.set_child(None) + else: + window.remove(widget) + window.destroy() - while Gtk.events_pending(): - Gtk.main_iteration() + if Gtk._version == "4.0": + context = GLib.MainContext() + while context.pending(): + context.iteration(False) + else: + while Gtk.events_pending(): + Gtk.main_iteration() @unittest.skipUnless(Gtk, 'Gtk not available') +@unittest.skipIf(Gtk_version == "4.0", "not in gtk4") +def test_freeze_child_notif(): + + events = [] + + def on_notify(widget, spec): + events.append(spec.name) + + b = Gtk.Box() + c = Gtk.Button() + c.connect("child-notify", on_notify) + c.freeze_child_notify() + b.pack_start(c, True, True, 0) + b.child_set_property(c, "pack-type", Gtk.PackType.END) + b.child_set_property(c, "pack-type", Gtk.PackType.START) + c.thaw_child_notify() + assert events.count("pack-type") == 1 + del events[:] + + with c.freeze_child_notify(): + b.child_set_property(c, "pack-type", Gtk.PackType.END) + b.child_set_property(c, "pack-type", Gtk.PackType.START) + + assert events.count("pack-type") == 1 + + +@unittest.skipUnless(Gtk, 'Gtk not available') +@unittest.skipIf(Gtk_version == "4.0", "not in gtk4") +def test_menu_popup(): + m = Gtk.Menu() + with capture_glib_warnings(): + m.popup(None, None, None, None, 0, 0) + m.popdown() + + +@unittest.skipUnless(Gtk, 'Gtk not available') +@unittest.skipIf(Gtk_version == "4.0", "not in gtk4") +def test_button_stock(): + with capture_glib_warnings(): + button = Gtk.Button(stock=Gtk.STOCK_OK) + assert button.props.label == Gtk.STOCK_OK + assert button.props.use_stock + + +@unittest.skipUnless(Gtk, 'Gtk not available') +def test_wrapper_toggle_refs(): + if not GTK4: + BASE = Gtk.Button + else: + BASE = Gtk.Widget + + class MyWidget(BASE): + def __init__(self, height): + BASE.__init__(self) + self._height = height + + def do_measure(self, orientation, for_size): + if orientation == Gtk.Orientation.VERTICAL: + return (self._height, self._height, -1, -1) + else: + return (0, 0, -1, -1) + + def do_get_preferred_height(self): + return (self._height, self._height) + + height = 142 + w = Gtk.Window() + b = MyWidget(height) + if not GTK4: + w.add(b) + b.show_all() + else: + w.set_child(b) + del b + gc.collect() + gc.collect() + assert w.get_preferred_size().minimum_size.height >= height + + +@unittest.skipUnless(Gtk, 'Gtk not available') +@ignore_gi_deprecation_warnings class TestGtk(unittest.TestCase): + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_container(self): box = Gtk.Box() self.assertTrue(isinstance(box, Gtk.Box)) @@ -68,30 +191,29 @@ class TestGtk(unittest.TestCase): self.assertTrue(label2 in box) self.assertEqual(len(box), 2) self.assertTrue(box) - l = [x for x in box] - self.assertEqual(l, [label, label2]) + labels = [x for x in box] + self.assertEqual(labels, [label, label2]) + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_actions(self): self.assertEqual(Gtk.Action, gi.overrides.Gtk.Action) - self.assertRaises(TypeError, Gtk.Action) - action = Gtk.Action("test", "Test", "Test Action", Gtk.STOCK_COPY) + action = Gtk.Action(name="test", label="Test", tooltip="Test Action", stock_id=Gtk.STOCK_COPY) self.assertEqual(action.get_name(), "test") self.assertEqual(action.get_label(), "Test") self.assertEqual(action.get_tooltip(), "Test Action") self.assertEqual(action.get_stock_id(), Gtk.STOCK_COPY) self.assertEqual(Gtk.RadioAction, gi.overrides.Gtk.RadioAction) - self.assertRaises(TypeError, Gtk.RadioAction) - action = Gtk.RadioAction("test", "Test", "Test Action", Gtk.STOCK_COPY, 1) + action = Gtk.RadioAction(name="test", label="Test", tooltip="Test Action", stock_id=Gtk.STOCK_COPY, value=1) self.assertEqual(action.get_name(), "test") self.assertEqual(action.get_label(), "Test") self.assertEqual(action.get_tooltip(), "Test Action") self.assertEqual(action.get_stock_id(), Gtk.STOCK_COPY) self.assertEqual(action.get_current_value(), 1) + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_actiongroup(self): self.assertEqual(Gtk.ActionGroup, gi.overrides.Gtk.ActionGroup) - self.assertRaises(TypeError, Gtk.ActionGroup) action_group = Gtk.ActionGroup(name='TestActionGroup') callback_data = "callback data" @@ -131,14 +253,61 @@ class TestGtk(unittest.TestCase): expected_results.remove(a) action.activate() + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_action_group_error_handling(self): + action_group = Gtk.ActionGroup(name='TestActionGroup') + with pytest.raises(TypeError): + action_group.add_actions(42) + + with pytest.raises(TypeError): + action_group.add_toggle_actions(42) + + with pytest.raises(TypeError): + action_group.add_radio_actions(42) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_action_group_no_user_data(self): + action_group = Gtk.ActionGroup(name='TestActionGroup') + + called = [] + + def test_action_callback_no_data(action): + called.append(action) + + action_group.add_actions([ + ('test-action1', None, 'Test Action 1', + None, None, test_action_callback_no_data)]) + action_group.add_actions([('test2-action1',)]) + action_group.get_action('test-action1').activate() + + action_group.add_toggle_actions([ + ('test-action2', None, 'Test Action 2', + None, None, test_action_callback_no_data)]) + action_group.add_toggle_actions([('test2-action2',)]) + action_group.get_action('test-action2').activate() + + def test_action_callback_no_data_radio(action, current): + called.append(action) + + action_group.add_radio_actions([ + ('test-action3', None, 'Test Action 3', None, None, 0), + ('test-action4', None, 'Test Action 4', None, None, 1)], + 1, test_action_callback_no_data_radio) + action_group.add_radio_actions([('test2-action3',)]) + action = action_group.get_action('test-action3') + assert action.get_current_value() == 1 + action.activate() + + assert len(called) == 3 + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_uimanager(self): self.assertEqual(Gtk.UIManager, gi.overrides.Gtk.UIManager) ui = Gtk.UIManager() ui.add_ui_from_string(""" -""" -) +""") menubar = ui.get_widget("/menubar1") self.assertEqual(type(menubar), Gtk.MenuBar) @@ -150,13 +319,18 @@ class TestGtk(unittest.TestCase): self.assertEqual(ag, groups[-2]) self.assertEqual(ag2, groups[-1]) + with pytest.raises(TypeError): + ui.add_ui_from_string(42) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_uimanager_nonascii(self): ui = Gtk.UIManager() ui.add_ui_from_string(b''.decode('UTF-8')) mi = ui.get_widget("/menubær1") self.assertEqual(type(mi), Gtk.MenuBar) - def test_window(self): + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_window_gtk3(self): # standard Window w = Gtk.Window() self.assertEqual(w.get_property('type'), Gtk.WindowType.TOPLEVEL) @@ -165,10 +339,6 @@ class TestGtk(unittest.TestCase): w = Gtk.Window(type=Gtk.WindowType.POPUP) self.assertEqual(w.get_property('type'), Gtk.WindowType.POPUP) - # pygtk compatible positional argument - w = Gtk.Window(Gtk.WindowType.POPUP) - self.assertEqual(w.get_property('type'), Gtk.WindowType.POPUP) - class TestWindow(Gtk.Window): __gtype_name__ = "TestWindow" @@ -192,43 +362,146 @@ class TestGtk(unittest.TestCase): self.assertEqual(builder.get_object('testpop').get_property('type'), Gtk.WindowType.POPUP) - def test_dialogs(self): + @unittest.skipUnless(Gtk_version == "4.0", "no GtkWindowType in gtk4") + def test_window_gtk4(self): + w = Gtk.Window() + + # check that setting default size works + w.set_default_size(300, 300) + self.assertEqual(w.get_default_size(), (300, 300)) + + class TestWindow(Gtk.Window): + __gtype_name__ = "TestWindow" + + # works from builder + builder = Gtk.Builder() + builder.add_from_string(''' + + + amazing + + + amazing-test + +''') + self.assertEqual(builder.get_object("win").get_property("css-name"), + "amazing") + self.assertEqual(builder.get_object("testwin").get_property("css-name"), + "amazing-test") + + def test_dialog_classes(self): self.assertEqual(Gtk.Dialog, gi.overrides.Gtk.Dialog) - self.assertEqual(Gtk.AboutDialog, gi.overrides.Gtk.AboutDialog) - self.assertEqual(Gtk.MessageDialog, gi.overrides.Gtk.MessageDialog) - self.assertEqual(Gtk.ColorSelectionDialog, gi.overrides.Gtk.ColorSelectionDialog) - self.assertEqual(Gtk.FileChooserDialog, gi.overrides.Gtk.FileChooserDialog) - self.assertEqual(Gtk.FontSelectionDialog, gi.overrides.Gtk.FontSelectionDialog) - self.assertEqual(Gtk.RecentChooserDialog, gi.overrides.Gtk.RecentChooserDialog) - - # Gtk.Dialog - dialog = Gtk.Dialog(title='Foo', - flags=Gtk.DialogFlags.MODAL, - buttons=('test-button1', 1)) + if not GTK4: + self.assertEqual(Gtk.FileChooserDialog, gi.overrides.Gtk.FileChooserDialog) + self.assertEqual(Gtk.RecentChooserDialog, gi.overrides.Gtk.RecentChooserDialog) + self.assertEqual(Gtk.ColorSelectionDialog, gi.overrides.Gtk.ColorSelectionDialog) + self.assertEqual(Gtk.FontSelectionDialog, gi.overrides.Gtk.FontSelectionDialog) + + def test_dialog_base(self): + dialog = Gtk.Dialog(title='Foo', modal=True) self.assertTrue(isinstance(dialog, Gtk.Dialog)) self.assertTrue(isinstance(dialog, Gtk.Window)) - - dialog.add_buttons('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE) - self.assertEqual('Foo', dialog.get_title()) self.assertTrue(dialog.get_modal()) + + @unittest.skipIf(GTK4, "flags not in gtk4") + def test_dialog_deprecations(self): + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + dialog = Gtk.Dialog(title='Foo', flags=Gtk.DialogFlags.MODAL) + self.assertTrue(dialog.get_modal()) + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGTKDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*flags.*modal.*') + + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + dialog = Gtk.Dialog(title='Foo', flags=Gtk.DialogFlags.DESTROY_WITH_PARENT) + self.assertTrue(dialog.get_destroy_with_parent()) + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGTKDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*flags.*destroy_with_parent.*') + + @unittest.skipIf(GTK4, "flags not in gtk4") + def test_dialog_deprecation_stacklevels(self): + # Test warning levels are setup to give the correct filename for + # deprecations in different classes in the inheritance hierarchy. + + # Base class + self.assertEqual(Gtk.Dialog, gi.overrides.Gtk.Dialog) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + Gtk.Dialog(flags=Gtk.DialogFlags.MODAL) + self.assertEqual(len(warn), 1) + self.assertRegex(warn[0].filename, '.*test_overrides_gtk.*') + + # Validate overridden base with overridden sub-class. + self.assertEqual(Gtk.MessageDialog, gi.overrides.Gtk.MessageDialog) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + Gtk.MessageDialog(flags=Gtk.DialogFlags.MODAL) + self.assertEqual(len(warn), 1) + self.assertRegex(warn[0].filename, '.*test_overrides_gtk.*') + + # Validate overridden base with non-overridden sub-class. + self.assertEqual(Gtk.AboutDialog, gi.repository.Gtk.AboutDialog) + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + Gtk.AboutDialog(flags=Gtk.DialogFlags.MODAL) + self.assertEqual(len(warn), 1) + self.assertRegex(warn[0].filename, '.*test_overrides_gtk.*') + + def test_dialog_add_buttons(self): + if not GTK4: + # The overloaded "buttons" keyword gives a warning when attempting + # to use it for adding buttons as was available in PyGTK. + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + dialog = Gtk.Dialog(title='Foo', modal=True, + buttons=('test-button1', 1)) + self.assertEqual(len(warn), 1) + self.assertTrue(issubclass(warn[0].category, PyGTKDeprecationWarning)) + self.assertRegex(str(warn[0].message), + '.*ButtonsType.*add_buttons.*') + else: + dialog = Gtk.Dialog() + dialog.add_buttons('test-button1', 1) + + dialog.add_buttons('test-button2', 2, 'gtk-close', Gtk.ResponseType.CLOSE) button = dialog.get_widget_for_response(1) self.assertEqual('test-button1', button.get_label()) button = dialog.get_widget_for_response(2) self.assertEqual('test-button2', button.get_label()) button = dialog.get_widget_for_response(Gtk.ResponseType.CLOSE) - self.assertEqual(Gtk.STOCK_CLOSE, button.get_label()) + self.assertEqual('gtk-close', button.get_label()) + + with pytest.raises(ValueError, match="even number"): + dialog.add_buttons('test-button2', 2, 'gtk-close') - # Gtk.AboutDialog + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_dialog_deprecated_attributes(self): + dialog = Gtk.Dialog() + assert dialog.action_area == dialog.get_action_area() + assert dialog.vbox == dialog.get_content_area() + + def test_about_dialog(self): dialog = Gtk.AboutDialog() - self.assertTrue(isinstance(dialog, Gtk.Dialog)) self.assertTrue(isinstance(dialog, Gtk.Window)) - # Gtk.MessageDialog + if not GTK4: + self.assertTrue(isinstance(dialog, Gtk.Dialog)) + + # AboutDialog is not sub-classed in overrides, make sure + # the mro still injects the base class "add_buttons" override. + self.assertTrue(hasattr(dialog, 'add_buttons')) + + def test_message_dialog(self): dialog = Gtk.MessageDialog(title='message dialog test', - flags=Gtk.DialogFlags.MODAL, + modal=True, buttons=Gtk.ButtonsType.OK, - message_format='dude!') + text='dude!') self.assertTrue(isinstance(dialog, Gtk.Dialog)) self.assertTrue(isinstance(dialog, Gtk.Window)) @@ -237,66 +510,58 @@ class TestGtk(unittest.TestCase): text = dialog.get_property('text') self.assertEqual('dude!', text) - dialog.format_secondary_text('2nd text') - self.assertEqual(dialog.get_property('secondary-text'), '2nd text') - self.assertFalse(dialog.get_property('secondary-use-markup')) + if not GTK4: + dialog.format_secondary_text('2nd text') + self.assertEqual(dialog.get_property('secondary-text'), '2nd text') + self.assertFalse(dialog.get_property('secondary-use-markup')) - dialog.format_secondary_markup('2nd markup') - self.assertEqual(dialog.get_property('secondary-text'), '2nd markup') - self.assertTrue(dialog.get_property('secondary-use-markup')) + dialog.format_secondary_markup('2nd markup') + self.assertEqual(dialog.get_property('secondary-text'), '2nd markup') + self.assertTrue(dialog.get_property('secondary-use-markup')) - # Gtk.ColorSelectionDialog - dialog = Gtk.ColorSelectionDialog("color selection dialog test") + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_color_selection_dialog(self): + dialog = Gtk.ColorSelectionDialog(title="color selection dialog test") self.assertTrue(isinstance(dialog, Gtk.Dialog)) self.assertTrue(isinstance(dialog, Gtk.Window)) self.assertEqual('color selection dialog test', dialog.get_title()) - # Gtk.FileChooserDialog + def test_file_chooser_dialog(self): # might cause a GVFS warning, do not break on this - old_mask = GLib.log_set_always_fatal( - GLib.LogLevelFlags.LEVEL_CRITICAL | GLib.LogLevelFlags.LEVEL_ERROR) - try: + with capture_glib_warnings(allow_warnings=True): dialog = Gtk.FileChooserDialog(title='file chooser dialog test', - buttons=('test-button1', 1), action=Gtk.FileChooserAction.SAVE) - finally: - GLib.log_set_always_fatal(old_mask) + self.assertTrue(isinstance(dialog, Gtk.Dialog)) self.assertTrue(isinstance(dialog, Gtk.Window)) - - dialog.add_buttons('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE) self.assertEqual('file chooser dialog test', dialog.get_title()) - button = dialog.get_widget_for_response(1) - self.assertEqual('test-button1', button.get_label()) - button = dialog.get_widget_for_response(2) - self.assertEqual('test-button2', button.get_label()) - button = dialog.get_widget_for_response(Gtk.ResponseType.CLOSE) - self.assertEqual(Gtk.STOCK_CLOSE, button.get_label()) + action = dialog.get_property('action') self.assertEqual(Gtk.FileChooserAction.SAVE, action) - # Gtk.FontSelectionDialog - dialog = Gtk.ColorSelectionDialog("font selection dialog test") + def test_file_chooser_dialog_default_action(self): + # might cause a GVFS warning, do not break on this + with capture_glib_warnings(allow_warnings=True): + dialog = Gtk.FileChooserDialog(title='file chooser dialog test') + + action = dialog.get_property('action') + self.assertEqual(Gtk.FileChooserAction.OPEN, action) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_font_selection_dialog(self): + dialog = Gtk.FontSelectionDialog(title="font selection dialog test") self.assertTrue(isinstance(dialog, Gtk.Dialog)) self.assertTrue(isinstance(dialog, Gtk.Window)) self.assertEqual('font selection dialog test', dialog.get_title()) - # Gtk.RecentChooserDialog + @unittest.skipIf(GTK4, "not in gtk4") + def test_recent_chooser_dialog(self): test_manager = Gtk.RecentManager() dialog = Gtk.RecentChooserDialog(title='recent chooser dialog test', - buttons=('test-button1', 1), - manager=test_manager) + recent_manager=test_manager) self.assertTrue(isinstance(dialog, Gtk.Dialog)) self.assertTrue(isinstance(dialog, Gtk.Window)) - - dialog.add_buttons('test-button2', 2, Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE) self.assertEqual('recent chooser dialog test', dialog.get_title()) - button = dialog.get_widget_for_response(1) - self.assertEqual('test-button1', button.get_label()) - button = dialog.get_widget_for_response(2) - self.assertEqual('test-button2', button.get_label()) - button = dialog.get_widget_for_response(Gtk.ResponseType.CLOSE) - self.assertEqual(Gtk.STOCK_CLOSE, button.get_label()) class TestClass(GObject.GObject): __gtype_name__ = "GIOverrideTreeAPITest" @@ -312,29 +577,37 @@ class TestGtk(unittest.TestCase): self.tester.assertEqual(string_value, self.string_value) def test_buttons(self): - self.assertEqual(Gtk.Button, gi.overrides.Gtk.Button) + if not GTK4: + self.assertEqual(Gtk.Button, gi.overrides.Gtk.Button) # test Gtk.Button button = Gtk.Button() self.assertTrue(isinstance(button, Gtk.Button)) - self.assertTrue(isinstance(button, Gtk.Container)) + if Gtk._version != "4.0": + self.assertTrue(isinstance(button, Gtk.Container)) self.assertTrue(isinstance(button, Gtk.Widget)) - button = Gtk.Button(stock=Gtk.STOCK_CLOSE) - self.assertEqual(Gtk.STOCK_CLOSE, button.get_label()) - self.assertTrue(button.get_use_stock()) - self.assertTrue(button.get_use_underline()) - # test Gtk.Button use_stock - button = Gtk.Button(label=Gtk.STOCK_CLOSE, use_stock=True, use_underline=True) - self.assertEqual(Gtk.STOCK_CLOSE, button.get_label()) - self.assertTrue(button.get_use_stock()) - self.assertTrue(button.get_use_underline()) + if Gtk_version != "4.0": + # Using stock items causes hard warning in devel versions of GTK. + with capture_glib_warnings(allow_warnings=True): + button = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE) + + self.assertEqual(Gtk.STOCK_CLOSE, button.get_label()) + self.assertTrue(button.get_use_stock()) + self.assertTrue(button.get_use_underline()) + + # test Gtk.Button use_stock + button = Gtk.Button(label=Gtk.STOCK_CLOSE, use_stock=True, + use_underline=True) + self.assertEqual(Gtk.STOCK_CLOSE, button.get_label()) + self.assertTrue(button.get_use_stock()) + self.assertTrue(button.get_use_underline()) # test Gtk.LinkButton - self.assertRaises(TypeError, Gtk.LinkButton) - button = Gtk.LinkButton('http://www.Gtk.org', 'Gtk') + button = Gtk.LinkButton(uri='http://www.Gtk.org', label='Gtk') self.assertTrue(isinstance(button, Gtk.Button)) - self.assertTrue(isinstance(button, Gtk.Container)) + if Gtk._version != "4.0": + self.assertTrue(isinstance(button, Gtk.Container)) self.assertTrue(isinstance(button, Gtk.Widget)) self.assertEqual('http://www.Gtk.org', button.get_uri()) self.assertEqual('Gtk', button.get_label()) @@ -353,7 +626,7 @@ class TestGtk(unittest.TestCase): if isinstance(info, gi.types.ObjectInfo): classes = list(info.get_interfaces()) parent = info.get_parent() - while parent.get_name() != "Object": + while parent is not None and parent.get_name() != "Object": classes.append(parent) parent = parent.get_parent() classes = [kl for kl in classes if kl.get_namespace() == "Gtk"] @@ -392,43 +665,42 @@ class TestGtk(unittest.TestCase): self.assertEqual(adjustment.get_page_size(), page_size) def test_adjustment(self): - adjustment = Gtk.Adjustment(1, 0, 6, 4, 5, 3) - self.adjustment_check(adjustment, 1, 0, 6, 4, 5, 3) + adjustment = Gtk.Adjustment(value=1, lower=0, upper=6, step_increment=4, page_increment=5, page_size=3) + self.adjustment_check(adjustment, value=1, lower=0, upper=6, step_increment=4, page_increment=5, page_size=3) - adjustment = Gtk.Adjustment(1, 0, 6, 4, 5) - self.adjustment_check(adjustment, 1, 0, 6, 4, 5) + adjustment = Gtk.Adjustment(value=1, lower=0, upper=6, step_increment=4, page_increment=5) + self.adjustment_check(adjustment, value=1, lower=0, upper=6, step_increment=4, page_increment=5) - adjustment = Gtk.Adjustment(1, 0, 6, 4) - self.adjustment_check(adjustment, 1, 0, 6, 4) + adjustment = Gtk.Adjustment(value=1, lower=0, upper=6, step_increment=4) + self.adjustment_check(adjustment, value=1, lower=0, upper=6, step_increment=4) - adjustment = Gtk.Adjustment(1, 0, 6) - self.adjustment_check(adjustment, 1, 0, 6) + adjustment = Gtk.Adjustment(value=1, lower=0, upper=6) + self.adjustment_check(adjustment, value=1, lower=0, upper=6) adjustment = Gtk.Adjustment() self.adjustment_check(adjustment) - adjustment = Gtk.Adjustment(value=1, lower=0, upper=6, - step_increment=4, page_increment=5, page_size=3) - self.adjustment_check(adjustment, 1, 0, 6, 4, 5, 3) + if not GTK4: + adjustment = Gtk.Adjustment(1, -1, 3, 0, 0, 0) + self.adjustment_check(adjustment, value=1, lower=-1, upper=3) + adjustment = Gtk.Adjustment(1, -1, 3, 0, 0, 0, value=2) + self.adjustment_check(adjustment, value=2, lower=-1, upper=3) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_table(self): table = Gtk.Table() self.assertTrue(isinstance(table, Gtk.Table)) - self.assertTrue(isinstance(table, Gtk.Container)) + if Gtk._version != "4.0": + self.assertTrue(isinstance(table, Gtk.Container)) self.assertTrue(isinstance(table, Gtk.Widget)) self.assertEqual(table.get_size(), (1, 1)) self.assertEqual(table.get_homogeneous(), False) - table = Gtk.Table(2, 3) + + table = Gtk.Table(n_rows=2, n_columns=3) self.assertEqual(table.get_size(), (2, 3)) self.assertEqual(table.get_homogeneous(), False) - table = Gtk.Table(2, 3, True) - self.assertEqual(table.get_size(), (2, 3)) - self.assertEqual(table.get_homogeneous(), True) - # Test PyGTK interface - table = Gtk.Table(rows=3, columns=2) - self.assertEqual(table.get_size(), (3, 2)) - # Test using the actual property names table = Gtk.Table(n_rows=2, n_columns=3, homogeneous=True) self.assertEqual(table.get_size(), (2, 3)) self.assertEqual(table.get_homogeneous(), True) @@ -441,13 +713,15 @@ class TestGtk(unittest.TestCase): def test_scrolledwindow(self): sw = Gtk.ScrolledWindow() self.assertTrue(isinstance(sw, Gtk.ScrolledWindow)) - self.assertTrue(isinstance(sw, Gtk.Container)) + if Gtk._version != "4.0": + self.assertTrue(isinstance(sw, Gtk.Container)) self.assertTrue(isinstance(sw, Gtk.Widget)) sb = sw.get_hscrollbar() self.assertEqual(sw.get_hadjustment(), sb.get_adjustment()) sb = sw.get_vscrollbar() self.assertEqual(sw.get_vadjustment(), sb.get_adjustment()) + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_widget_drag_methods(self): widget = Gtk.Button() @@ -464,6 +738,8 @@ class TestGtk(unittest.TestCase): widget.drag_dest_get_track_motion() widget.drag_dest_set_track_motion(True) widget.drag_dest_get_target_list() + widget.drag_dest_set_target_list(None) + widget.drag_dest_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry.new('test', 0, 0)])) widget.drag_dest_unset() @@ -475,10 +751,11 @@ class TestGtk(unittest.TestCase): widget.drag_source_add_image_targets() widget.drag_source_add_text_targets() widget.drag_source_add_uri_targets() - widget.drag_source_set_icon_name("") + widget.drag_source_set_icon_name("_About") widget.drag_source_set_icon_pixbuf(GdkPixbuf.Pixbuf()) - widget.drag_source_set_icon_stock("") + widget.drag_source_set_icon_stock(Gtk.STOCK_ABOUT) widget.drag_source_get_target_list() + widget.drag_source_set_target_list(None) widget.drag_source_set_target_list(Gtk.TargetList.new([Gtk.TargetEntry.new('test', 0, 0)])) widget.drag_source_unset() @@ -487,7 +764,30 @@ class TestGtk(unittest.TestCase): self.assertTrue(hasattr(widget, 'drag_dest_set_proxy')) self.assertTrue(hasattr(widget, 'drag_get_data')) - def test_drag_target_list(self): + @unittest.skipIf(Gtk_version != "4.0", "gtk4 only") + def test_widget_drag_methods_gtk4(self): + widget = Gtk.Button() + widget.drag_check_threshold(0, 0, 0, 0) + + # drag source + drag_source = Gtk.DragSource() + content = Gdk.ContentProvider.new_for_value("data") + drag_source.set_content(content) + drag_source.set_actions(Gdk.DragAction.COPY) + image = Gtk.Image.new_from_icon_name("dialog-warning") + drag_source.set_icon(image.get_paintable(), 0, 0) + widget.add_controller(drag_source) + + # drop target + drop_target = Gtk.DropTarget.new(Gdk.ContentFormats.new([]), Gdk.DragAction.COPY) + widget.add_controller(drop_target) + + widget.remove_controller(drag_source) + widget.remove_controller(drop_target) + + @unittest.skipIf(sys.platform == "darwin", "crashes") + @unittest.skipIf(GTK4, "uses lots of gtk3 only api") + def test_tree_view_drag_target_list_gtk3(self): mixed_target_list = [Gtk.TargetEntry.new('test0', 0, 0), ('test1', 1, 1), Gtk.TargetEntry.new('test2', 2, 2), @@ -519,8 +819,21 @@ class TestGtk(unittest.TestCase): treeview.enable_model_drag_dest(mixed_target_list, Gdk.DragAction.DEFAULT | Gdk.DragAction.MOVE) + @unittest.skipUnless(GTK4, "gtk4 only") + def test_tree_view_drag_content_formats_gtk4(self): + content_formats = Gdk.ContentFormats.new( + ["application/json", "GTK_TREE_MODEL_ROW"] + ) + treeview = Gtk.TreeView() + treeview.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, + content_formats, + Gdk.DragAction.MOVE) + + treeview.enable_model_drag_dest(content_formats, + Gdk.DragAction.MOVE) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_scrollbar(self): - # PyGTK compat adjustment = Gtk.Adjustment() hscrollbar = Gtk.HScrollbar() @@ -528,8 +841,8 @@ class TestGtk(unittest.TestCase): self.assertNotEqual(hscrollbar.props.adjustment, adjustment) self.assertNotEqual(vscrollbar.props.adjustment, adjustment) - hscrollbar = Gtk.HScrollbar(adjustment) - vscrollbar = Gtk.VScrollbar(adjustment) + hscrollbar = Gtk.HScrollbar(adjustment=adjustment) + vscrollbar = Gtk.VScrollbar(adjustment=adjustment) self.assertEqual(hscrollbar.props.adjustment, adjustment) self.assertEqual(vscrollbar.props.adjustment, adjustment) @@ -539,31 +852,38 @@ class TestGtk(unittest.TestCase): self.assertEqual(iconview.props.model, None) model = Gtk.ListStore(str) - iconview = Gtk.IconView(model) + iconview = Gtk.IconView(model=model) self.assertEqual(iconview.props.model, model) + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_toolbutton(self): # PyGTK compat - button = Gtk.ToolButton() - self.assertEqual(button.props.stock_id, None) - button = Gtk.ToolButton('gtk-new') - self.assertEqual(button.props.stock_id, 'gtk-new') + # Using stock items causes hard warning in devel versions of GTK. + with capture_glib_warnings(allow_warnings=True): + button = Gtk.ToolButton() + self.assertEqual(button.props.stock_id, None) - icon = Gtk.Image.new_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.SMALL_TOOLBAR) + button = Gtk.ToolButton(stock_id='gtk-new') + self.assertEqual(button.props.stock_id, 'gtk-new') + icon = Gtk.Image.new_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.SMALL_TOOLBAR) button = Gtk.ToolButton(label='mylabel', icon_widget=icon) self.assertEqual(button.props.label, 'mylabel') self.assertEqual(button.props.icon_widget, icon) + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_iconset(self): - # PyGTK compat Gtk.IconSet() pixbuf = GdkPixbuf.Pixbuf() - Gtk.IconSet(pixbuf) + Gtk.IconSet.new_from_pixbuf(pixbuf) + + with warnings.catch_warnings(record=True) as warn: + warnings.simplefilter('always') + Gtk.IconSet(pixbuf) + assert issubclass(warn[0].category, PyGTKDeprecationWarning) def test_viewport(self): - # PyGTK compat vadjustment = Gtk.Adjustment() hadjustment = Gtk.Adjustment() @@ -573,55 +893,169 @@ class TestGtk(unittest.TestCase): self.assertEqual(viewport.props.vadjustment, vadjustment) self.assertEqual(viewport.props.hadjustment, hadjustment) + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_stock_lookup(self): - l = Gtk.stock_lookup('gtk-ok') - self.assertEqual(type(l), Gtk.StockItem) - self.assertEqual(l.stock_id, 'gtk-ok') + stock_item = Gtk.stock_lookup('gtk-ok') + self.assertEqual(type(stock_item), Gtk.StockItem) + self.assertEqual(stock_item.stock_id, 'gtk-ok') self.assertEqual(Gtk.stock_lookup('nosuchthing'), None) + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") def test_gtk_main(self): # with no arguments - GLib.timeout_add(100, Gtk.main_quit) + GLib.idle_add(Gtk.main_quit) Gtk.main() # overridden function ignores its arguments - GLib.timeout_add(100, Gtk.main_quit, 'hello') + GLib.idle_add(Gtk.main_quit, 'hello') Gtk.main() + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_widget_render_icon(self): + button = Gtk.Button(label='OK') + pixbuf = button.render_icon(Gtk.STOCK_OK, Gtk.IconSize.BUTTON) + self.assertTrue(pixbuf is not None) + + @unittest.skipUnless( + Gtk_version == "4.0", "GtkWidget prior to gtk4 is not iterable") + def test_widget_iterable(self): + widget = Gtk.Box() + + children = [child for child in widget] + self.assertEqual(len(children), 0) + + nr_children = 7 + for i in range(nr_children): + widget.append(Gtk.Label()) + + children = [child for child in widget] + self.assertEqual(len(children), nr_children) + + first_child = children[0] + last_child = children[-1] + self.assertEqual(first_child, widget.get_first_child()) + self.assertEqual(last_child, widget.get_last_child()) + + self.assertTrue(first_child in widget) + self.assertTrue(last_child in widget) + + widget.remove(first_child) + self.assertTrue(first_child not in widget) + self.assertTrue(last_child in widget) + + widget.remove(last_child) + self.assertTrue(first_child not in widget) + self.assertTrue(last_child not in widget) + @unittest.skipUnless(Gtk, 'Gtk not available') -class TestSignals(unittest.TestCase): - class WindowWithSizeAllocOverride(Gtk.ScrolledWindow): - __gsignals__ = {'size-allocate': 'override'} +class TestWidget(unittest.TestCase): + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_style_get_property_gvalue(self): + button = Gtk.Button() + value = GObject.Value(int, -42) + button.style_get_property('focus-padding', value) + # Test only that the style property changed since we can't actuall + # set it. + self.assertNotEqual(value.get_int(), -42) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_style_get_property_return_with_explicit_gvalue(self): + button = Gtk.Button() + value = GObject.Value(int, -42) + result = button.style_get_property('focus-padding', value) + self.assertIsInstance(result, int) + self.assertNotEqual(result, -42) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_style_get_property_return_with_implicit_gvalue(self): + button = Gtk.Button() + result = button.style_get_property('focus-padding') + self.assertIsInstance(result, int) + self.assertNotEqual(result, -42) - def __init__(self): - Gtk.ScrolledWindow.__init__(self) - self._alloc_called = False - self._alloc_value = None - self._alloc_error = None + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_style_get_property_error(self): + button = Gtk.Button() + with self.assertRaises(ValueError): + button.style_get_property('not-a-valid-style-property') - def do_size_allocate(self, alloc): - self._alloc_called = True - self._alloc_value = alloc + @unittest.skipIf(Gtk_version != "4.0", "only in gtk4") + def test_translate_coordinates(self): + box = Gtk.Box() + child = Gtk.Button() + box.append(child) + with realized(box): + assert box.translate_coordinates(child, 42, 24) == (42.0, 24.0) + assert box.translate_coordinates(Gtk.Button(), 0, 0) is None - try: - Gtk.ScrolledWindow.do_size_allocate(self, alloc) - except Exception as e: - self._alloc_error = e +@unittest.skipIf(sys.platform == "darwin", "hangs") +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestSignals(unittest.TestCase): def test_class_closure_override_with_aliased_type(self): - win = self.WindowWithSizeAllocOverride() + class WindowWithSizeAllocOverride(Gtk.ScrolledWindow): + if not GTK4: + __gsignals__ = {'size-allocate': 'override'} + + def __init__(self): + Gtk.ScrolledWindow.__init__(self) + self._alloc_called = False + self._alloc_value = None + self._alloc_error = None + + def do_size_allocate(self, *args): + self._alloc_called = True + self._alloc_value = args[0] + + try: + Gtk.ScrolledWindow.do_size_allocate(self, *args) + except Exception as e: + self._alloc_error = e + + win = WindowWithSizeAllocOverride() rect = Gdk.Rectangle() rect.width = 100 rect.height = 100 with realized(win): win.show() - win.size_allocate(rect) + win.get_preferred_size() + if GTK4: + win.size_allocate(rect, 0) + else: + win.size_allocate(rect) self.assertTrue(win._alloc_called) - self.assertIsInstance(win._alloc_value, Gdk.Rectangle) + if GTK4: + self.assertIsInstance(win._alloc_value, int) + else: + self.assertIsInstance(win._alloc_value, Gdk.Rectangle) self.assertTrue(win._alloc_error is None, win._alloc_error) + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=735693 + def test_overlay_child_position(self): + def get_child_position(overlay, widget, rect, user_data=None): + rect.x = 1 + rect.y = 2 + rect.width = 3 + rect.height = 4 + return True + + overlay = Gtk.Overlay() + overlay.connect('get-child-position', get_child_position) + + rect = Gdk.Rectangle() + rect.x = -1 + rect.y = -1 + rect.width = -1 + rect.height = -1 + + overlay.emit('get-child-position', None, rect) + self.assertEqual(rect.x, 1) + self.assertEqual(rect.y, 2) + self.assertEqual(rect.width, 3) + self.assertEqual(rect.height, 4) + @unittest.skipUnless(Gtk, 'Gtk not available') class TestBuilder(unittest.TestCase): @@ -633,6 +1067,40 @@ class TestBuilder(unittest.TestCase): []), } + class SignalTestObject(GObject.GObject): + __gtype_name__ = "GIOverrideSignalTestObject" + + def test_add_from_string(self): + builder = Gtk.Builder() + + with pytest.raises(TypeError): + builder.add_from_string(object()) + + builder.add_from_string(u"") + builder.add_from_string("") + + def get_example(string): + return u"""\ + + +
+ + %s + +
+
+
""" % string + + builder.add_from_string(get_example(u"ä" * 1000)) + + builder = Gtk.Builder() + builder.add_objects_from_string(u"", ['']) + builder.add_objects_from_string("", ['']) + builder.add_objects_from_string(get_example(u"ä" * 1000), ['']) + + with pytest.raises(TypeError): + builder.add_objects_from_string(object(), []) + def test_extract_handler_and_args_object(self): class Obj(): pass @@ -640,32 +1108,51 @@ class TestBuilder(unittest.TestCase): obj = Obj() obj.foo = lambda: None - handler, args = Gtk.Builder._extract_handler_and_args(obj, 'foo') + handler, args = Gtk._extract_handler_and_args(obj, 'foo') self.assertEqual(handler, obj.foo) self.assertEqual(len(args), 0) def test_extract_handler_and_args_dict(self): obj = {'foo': lambda: None} - handler, args = Gtk.Builder._extract_handler_and_args(obj, 'foo') + handler, args = Gtk._extract_handler_and_args(obj, 'foo') self.assertEqual(handler, obj['foo']) self.assertEqual(len(args), 0) def test_extract_handler_and_args_with_seq(self): obj = {'foo': (lambda: None, 1, 2)} - handler, args = Gtk.Builder._extract_handler_and_args(obj, 'foo') + handler, args = Gtk._extract_handler_and_args(obj, 'foo') self.assertEqual(handler, obj['foo'][0]) self.assertSequenceEqual(args, [1, 2]) def test_extract_handler_and_args_no_handler_error(self): obj = dict(foo=lambda: None) self.assertRaises(AttributeError, - Gtk.Builder._extract_handler_and_args, + Gtk._extract_handler_and_args, obj, 'not_a_handler') + def test_extract_handler_and_args_type_mismatch(self): + with pytest.raises(TypeError): + Gtk._extract_handler_and_args({"foo": object()}, "foo") + + with pytest.raises(TypeError): + Gtk._extract_handler_and_args({"foo": []}, "foo") + def test_builder_with_handler_and_args(self): - builder = Gtk.Builder() + args_collector = [] + + def on_signal(*args): + args_collector.append(args) + + signals_dict = {'on_signal1': (on_signal, 1, 2), + 'on_signal2': on_signal} + + if GTK4: + builder = Gtk.Builder(signals_dict) + else: + builder = Gtk.Builder() + builder.add_from_string(""" @@ -675,13 +1162,8 @@ class TestBuilder(unittest.TestCase): """) - args_collector = [] - - def on_signal(*args): - args_collector.append(args) - - builder.connect_signals({'on_signal1': (on_signal, 1, 2), - 'on_signal2': on_signal}) + if not GTK4: + builder.connect_signals(signals_dict) objects = builder.get_objects() self.assertEqual(len(objects), 1) @@ -692,6 +1174,40 @@ class TestBuilder(unittest.TestCase): self.assertSequenceEqual(args_collector[0], (obj, 1, 2)) self.assertSequenceEqual(args_collector[1], (obj, )) + def test_builder_with_handler_object(self): + args_collector = [] + + def on_signal(*args): + args_collector.append(args) + + signals_dict = {'on_signal1': (on_signal, 1, 2), + 'on_signal2': on_signal} + + if GTK4: + builder = Gtk.Builder(signals_dict) + else: + builder = Gtk.Builder() + + builder.add_from_string(""" + + + + + + + + """) + + if not GTK4: + builder.connect_signals(signals_dict) + + obj = builder.get_object("foo") + emitter = builder.get_object("object_sig_test") + emitter.emit("test-signal") + assert len(args_collector) == 2 + assert args_collector[0] == (obj, 1, 2) + assert args_collector[1] == (obj, ) + def test_builder(self): self.assertEqual(Gtk.Builder, gi.overrides.Gtk.Builder) @@ -712,7 +1228,11 @@ class TestBuilder(unittest.TestCase): self.after_sentinel += 1 signal_checker = SignalCheck() - builder = Gtk.Builder() + signal_checker = SignalCheck() + if GTK4: + builder = Gtk.Builder(signal_checker) + else: + builder = Gtk.Builder() # add object1 to the builder builder.add_from_string(""" @@ -739,8 +1259,9 @@ class TestBuilder(unittest.TestCase): """, ['object3']) - # hook up signals - builder.connect_signals(signal_checker) + # hook up signals for Gtk3 + if not GTK4: + builder.connect_signals(signal_checker) # call their notify signals and check sentinel objects = builder.get_objects() @@ -753,12 +1274,161 @@ class TestBuilder(unittest.TestCase): @unittest.skipUnless(Gtk, 'Gtk not available') +class TestTreeModelRow(unittest.TestCase): + def test_tree_model_row(self): + model = Gtk.TreeStore(int) + iter_ = model.append(None, [42]) + path = model.get_path(iter_) + Gtk.TreeModelRow(model, iter_) + row = Gtk.TreeModelRow(model, path) + + with pytest.raises(TypeError): + row["foo"] + + with pytest.raises(TypeError): + Gtk.TreeModelRow(model, 42) + + with pytest.raises(TypeError): + Gtk.TreeModelRow(42, path) + + iter_ = model.append(None, [24]) + row = Gtk.TreeModelRow(model, iter_) + assert row.previous[0] == 42 + assert row.get_previous()[0] == 42 + assert row.previous.previous is None + + +@unittest.skipUnless(Gtk, "Gtk not available") +class TestCustomSorter(): + class Person(GObject.GObject): + + name = GObject.Property(type=str, default="") + + def __init__(self, name): + super().__init__() + self.props.name = name + + user_data = "user_data" + + def names_sort(self, name_a, name_b, user_data): + assert user_data is None + if name_a.props.name < name_b.props.name: + return Gtk.Ordering.SMALLER + elif name_a.props.name > name_b.props.name: + return Gtk.Ordering.LARGER + else: + return Gtk.Ordering.EQUAL + + def names_invert_sort(self, name_a, name_b, user_data): + assert user_data == self.user_data + if name_a.props.name < name_b.props.name: + return Gtk.Ordering.LARGER + elif name_a.props.name > name_b.props.name: + return Gtk.Ordering.SMALLER + else: + return Gtk.Ordering.EQUAL + + @unittest.skipIf(Gtk_version != "4.0", "gtk4 only") + def test_custom_sorter_init(self): + custom_sorter_empty = Gtk.CustomSorter() + assert isinstance(custom_sorter_empty, Gtk.CustomSorter) + + custom_sorter_empty.set_sort_func(self.names_sort) + assert isinstance(custom_sorter_empty, Gtk.CustomSorter) + + custom_sorter_empty.set_sort_func( + self.names_invert_sort, self.user_data) + assert isinstance(custom_sorter_empty, Gtk.CustomSorter) + + custom_sorter_empty_sort = Gtk.CustomSorter.new(None) + assert isinstance(custom_sorter_empty_sort, Gtk.CustomSorter) + + custom_sorter_with_sort = Gtk.CustomSorter.new(self.names_sort, None) + assert isinstance(custom_sorter_with_sort, Gtk.CustomSorter) + + custom_sorter_with_sort_ud = Gtk.CustomSorter.new( + self.names_invert_sort, self.user_data) + assert isinstance(custom_sorter_with_sort_ud, Gtk.CustomSorter) + + @unittest.skipIf(Gtk_version != "4.0", "gtk4 only") + def test_custom_sorter_with_model(self): + model = Gio.ListStore.new(self.Person) + sort_model = Gtk.SortListModel.new(model) + assert sort_model.props.sorter is None + + empty_sorter = Gtk.CustomSorter() + empty_sorter.set_sort_func(self.names_sort, None) + sort_model.set_sorter(empty_sorter) + assert sort_model.props.sorter is empty_sorter + + john = self.Person("john") + bob = self.Person("bob") + model.append(john) + model.append(bob) + assert sort_model[0] == bob + assert sort_model[1] == john + + alice = self.Person("alice") + model.append(alice) + assert sort_model[0] == alice + assert sort_model[2] == john + + new_model = Gio.ListStore.new(self.Person) + new_sort_model = Gtk.SortListModel.new(new_model) + assert new_sort_model.props.sorter is None + + invert_sorter = Gtk.CustomSorter.new( + self.names_invert_sort, self.user_data) + new_sort_model.set_sorter(invert_sorter) + assert new_sort_model.props.sorter is invert_sorter + + beatles = ["john", "paul", "george", "ringo"] + for member in beatles: + new_model.append(self.Person(member)) + + expected_result = ["ringo", "paul", "john", "george"] + for result, member in zip(new_sort_model, expected_result): + assert result.props.name == member + + +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestListStore(unittest.TestCase): + + def test_insert_with_values(self): + model = Gtk.ListStore(int) + assert hasattr(model, 'insert_with_values') + iter_ = model.insert_with_values(0, (0,), [42]) + assert isinstance(iter_, Gtk.TreeIter) + assert hasattr(model, 'insert_with_valuesv') + iter_ = model.insert_with_valuesv(0, (0,), [43]) + assert isinstance(iter_, Gtk.TreeIter) + assert len(model) == 2 + + +@ignore_gi_deprecation_warnings +@unittest.skipUnless(Gtk, 'Gtk not available') class TestTreeModel(unittest.TestCase): + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_tree_model_sort_new_with_model_old(self): + # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1134 + model = Gtk.TreeStore(int) + sort_model = model.sort_new_with_model() + assert isinstance(sort_model, Gtk.TreeModelSort) + assert sort_model.get_model() == model + + def test_tree_model_sort_new_with_model_new(self): + # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1134 + model = Gtk.TreeStore(int) + sort_model = Gtk.TreeModelSort.new_with_model(child_model=model) + assert isinstance(sort_model, Gtk.TreeModelSort) + assert sort_model.get_model() == model + def test_tree_model_sort(self): - self.assertEqual(Gtk.TreeModelSort, gi.overrides.Gtk.TreeModelSort) - self.assertRaises(TypeError, Gtk.TreeModelSort) + if not GTK4: + self.assertEqual(Gtk.TreeModelSort, gi.overrides.Gtk.TreeModelSort) model = Gtk.TreeStore(int, bool) - model_sort = Gtk.TreeModelSort(model) + model_sort = Gtk.TreeModelSort(model=model) self.assertEqual(model_sort.get_model(), model) def test_tree_store(self): @@ -803,11 +1473,11 @@ class TestTreeModel(unittest.TestCase): i % 2, bool(i % 2), i, - GObject.G_MAXULONG, - GObject.G_MININT64, + GLib.MAXULONG, + GLib.MININT64, 0xffffffffffffffff, 254, - _bytes('a') + b'a' )) # test set parent = tree_store.append(parent) @@ -825,11 +1495,11 @@ class TestTreeModel(unittest.TestCase): 7, i % 2, 8, bool(i % 2), 9, i, - 10, GObject.G_MAXULONG, - 11, GObject.G_MININT64, + 10, GLib.MAXULONG, + 11, GLib.MININT64, 12, 0xffffffffffffffff, 13, 254, - 14, _bytes('a')) + 14, b'a') parent = tree_store.append(parent) i = 98 @@ -845,11 +1515,11 @@ class TestTreeModel(unittest.TestCase): 7: i % 2, 8: bool(i % 2), 9: i, - 10: GObject.G_MAXULONG, - 11: GObject.G_MININT64, + 10: GLib.MAXULONG, + 11: GLib.MININT64, 12: 0xffffffffffffffff, 13: 254, - 14: _bytes('a')}) + 14: b'a'}) parent = tree_store.append(parent) i = 99 @@ -866,11 +1536,11 @@ class TestTreeModel(unittest.TestCase): i % 2, bool(i % 2), i, - GObject.G_MAXULONG, - GObject.G_MININT64, + GLib.MAXULONG, + GLib.MININT64, 0xffffffffffffffff, 254, - _bytes('a'))) + b'a')) # len gets the number of children in the root node # since we kept appending to the previous node @@ -906,9 +1576,9 @@ class TestTreeModel(unittest.TestCase): uint_ = tree_store.get_value(treeiter, 9) self.assertEqual(uint_, i) ulong_ = tree_store.get_value(treeiter, 10) - self.assertEqual(ulong_, GObject.G_MAXULONG) + self.assertEqual(ulong_, GLib.MAXULONG) int64_ = tree_store.get_value(treeiter, 11) - self.assertEqual(int64_, GObject.G_MININT64) + self.assertEqual(int64_, GLib.MININT64) uint64_ = tree_store.get_value(treeiter, 12) self.assertEqual(uint64_, 0xffffffffffffffff) uchar_ = tree_store.get_value(treeiter, 13) @@ -958,6 +1628,12 @@ class TestTreeModel(unittest.TestCase): tree_store.insert(None, 1) self.assertEqual(signals, ['row-inserted']) + # One set one signal + signals.pop() + tree_iter = tree_store.append(None, (10, False)) + tree_store.set(tree_iter, (0, 1), (20, True)) + self.assertEqual(signals, ['row-inserted', 'row-changed']) + def test_list_store(self): class TestPyObject(object): pass @@ -980,7 +1656,7 @@ class TestTreeModel(unittest.TestCase): bool(i % 2))) i = 93 - label = _unicode('this is row #93') + label = u'this is row #93' treeiter = list_store.append() list_store.set_value(treeiter, 0, i) list_store.set_value(treeiter, 1, label) @@ -1004,7 +1680,7 @@ class TestTreeModel(unittest.TestCase): # test automatic unicode->str conversion i = 94 - label = _unicode('this is row #94') + label = u'this is row #94' treeiter = list_store.append((i, label, TestGtk.TestClass(self, i, label), @@ -1215,6 +1891,269 @@ class TestTreeModel(unittest.TestCase): list_store.insert(1) self.assertEqual(signals, ['row-inserted']) + # One set one signal + signals.pop() + tree_iter = list_store.append((10, False)) + list_store.set(tree_iter, (0, 1), (20, True)) + self.assertEqual(signals, ['row-inserted', 'row-changed']) + + def test_list_store_insert_before(self): + store = Gtk.ListStore(object) + signals = [] + + def on_row_inserted(store, tree_path, tree_iter, signal_list): + signal_list.append('row-inserted') + + def on_row_changed(store, tree_path, tree_iter, signal_list): + signal_list.append('row-changed') + + store.connect('row-inserted', on_row_inserted, signals) + store.connect('row-changed', on_row_changed, signals) + + iter_ = store.append([0]) + assert store.get_value(iter_, 0) == 0 + assert signals == ['row-inserted'] + del signals[:] + + # append empty + iter_ = store.insert_before(None) + assert store.get_path(iter_).get_indices() == [1] + assert store.get_value(iter_, 0) is None + assert signals == ['row-inserted'] + del signals[:] + + # insert empty + iter_ = store.insert_before(iter_) + assert store.get_path(iter_).get_indices() == [1] + assert store.get_value(iter_, 0) is None + assert signals == ['row-inserted'] + del signals[:] + + # append non-empty + iter_ = store.insert_before(None, [1234]) + assert store.get_path(iter_).get_indices() == [3] + assert store.get_value(iter_, 0) == 1234 + assert signals == ['row-inserted'] + del signals[:] + + # insert non-empty + iter_ = store.insert_before(iter_, [4321]) + assert store.get_path(iter_).get_indices() == [3] + assert store.get_value(iter_, 0) == 4321 + assert signals == ['row-inserted'] + del signals[:] + + assert [r[0] for r in store] == [0, None, None, 4321, 1234] + + def test_list_store_insert_after(self): + store = Gtk.ListStore(object) + signals = [] + + def on_row_inserted(store, tree_path, tree_iter, signal_list): + signal_list.append('row-inserted') + + def on_row_changed(store, tree_path, tree_iter, signal_list): + signal_list.append('row-changed') + + store.connect('row-inserted', on_row_inserted, signals) + store.connect('row-changed', on_row_changed, signals) + + iter_ = store.append([0]) + assert store.get_value(iter_, 0) == 0 + assert signals == ['row-inserted'] + del signals[:] + + # prepend empty + iter_ = store.insert_after(None) + assert store.get_path(iter_).get_indices() == [0] + assert store.get_value(iter_, 0) is None + assert signals == ['row-inserted'] + del signals[:] + + # insert empty + iter_ = store.insert_after(iter_) + assert store.get_path(iter_).get_indices() == [1] + assert store.get_value(iter_, 0) is None + assert signals == ['row-inserted'] + del signals[:] + + # prepend non-empty + iter_ = store.insert_after(None, [1234]) + assert store.get_path(iter_).get_indices() == [0] + assert store.get_value(iter_, 0) == 1234 + assert signals == ['row-inserted'] + del signals[:] + + # insert non-empty + iter_ = store.insert_after(iter_, [4321]) + assert store.get_path(iter_).get_indices() == [1] + assert store.get_value(iter_, 0) == 4321 + assert signals == ['row-inserted'] + del signals[:] + + assert [r[0] for r in store] == [1234, 4321, None, None, 0] + + def test_tree_store_insert_before(self): + store = Gtk.TreeStore(object) + signals = [] + + def on_row_inserted(store, tree_path, tree_iter, signal_list): + signal_list.append('row-inserted') + + def on_row_changed(store, tree_path, tree_iter, signal_list): + signal_list.append('row-changed') + + store.connect('row-inserted', on_row_inserted, signals) + store.connect('row-changed', on_row_changed, signals) + + parent = store.append(None, [-1]) + assert signals == ['row-inserted'] + del signals[:] + + iter_ = store.append(parent, [0]) + assert store.get_path(iter_).get_indices() == [0, 0] + assert store.get_value(iter_, 0) == 0 + assert signals == ['row-inserted'] + del signals[:] + + # append empty + iter_ = store.insert_before(parent, None) + assert store.get_path(iter_).get_indices() == [0, 1] + assert store.get_value(iter_, 0) is None + assert signals == ['row-inserted'] + del signals[:] + + # insert empty + iter_ = store.insert_before(parent, iter_) + assert store.get_path(iter_).get_indices() == [0, 1] + assert store.get_value(iter_, 0) is None + assert signals == ['row-inserted'] + del signals[:] + + # append non-empty + iter_ = store.insert_before(parent, None, [1234]) + assert store.get_path(iter_).get_indices() == [0, 3] + assert store.get_value(iter_, 0) == 1234 + assert signals == ['row-inserted'] + del signals[:] + + # insert non-empty + iter_ = store.insert_before(parent, iter_, [4321]) + assert store.get_path(iter_).get_indices() == [0, 3] + assert store.get_value(iter_, 0) == 4321 + assert signals == ['row-inserted'] + del signals[:] + + def func(model, path, iter_, rows): + rows.append((path.get_indices(), model[iter_][:])) + + rows = [] + store.foreach(func, rows) + assert rows == [ + ([0], [-1]), ([0, 0], [0]), ([0, 1], [None]), ([0, 2], [None]), + ([0, 3], [4321]), ([0, 4], [1234])] + + def test_tree_store_insert_before_none(self): + store = Gtk.TreeStore(object) + root = store.append(None) + sub = store.append(root) + + iter_ = store.insert_before(None, None, [1]) + assert store.get_path(iter_).get_indices() == [1] + + iter_ = store.insert_before(root, None, [1]) + assert store.get_path(iter_).get_indices() == [0, 1] + + iter_ = store.insert_before(sub, None, [1]) + assert store.get_path(iter_).get_indices() == [0, 0, 0] + + iter_ = store.insert_before(None, root, [1]) + assert store.get_path(iter_).get_indices() == [0] + + iter_ = store.insert_before(None, sub, [1]) + assert store.get_path(iter_).get_indices() == [1, 0] + + def test_tree_store_insert_after(self): + store = Gtk.TreeStore(object) + signals = [] + + def on_row_inserted(store, tree_path, tree_iter, signal_list): + signal_list.append('row-inserted') + + def on_row_changed(store, tree_path, tree_iter, signal_list): + signal_list.append('row-changed') + + store.connect('row-inserted', on_row_inserted, signals) + store.connect('row-changed', on_row_changed, signals) + + parent = store.append(None, [-1]) + assert signals == ['row-inserted'] + del signals[:] + + iter_ = store.append(parent, [0]) + assert store.get_path(iter_).get_indices() == [0, 0] + assert store.get_value(iter_, 0) == 0 + assert signals == ['row-inserted'] + del signals[:] + + # append empty + iter_ = store.insert_after(parent, None) + assert store.get_path(iter_).get_indices() == [0, 0] + assert store.get_value(iter_, 0) is None + assert signals == ['row-inserted'] + del signals[:] + + # insert empty + iter_ = store.insert_after(parent, iter_) + assert store.get_path(iter_).get_indices() == [0, 1] + assert store.get_value(iter_, 0) is None + assert signals == ['row-inserted'] + del signals[:] + + # append non-empty + iter_ = store.insert_after(parent, None, [1234]) + assert store.get_path(iter_).get_indices() == [0, 0] + assert store.get_value(iter_, 0) == 1234 + assert signals == ['row-inserted'] + del signals[:] + + # insert non-empty + iter_ = store.insert_after(parent, iter_, [4321]) + assert store.get_path(iter_).get_indices() == [0, 1] + assert store.get_value(iter_, 0) == 4321 + assert signals == ['row-inserted'] + del signals[:] + + def func(model, path, iter_, rows): + rows.append((path.get_indices(), model[iter_][:])) + + rows = [] + store.foreach(func, rows) + + assert rows == [ + ([0], [-1]), ([0, 0], [1234]), ([0, 1], [4321]), + ([0, 2], [None]), ([0, 3], [None]), ([0, 4], [0])] + + def test_tree_store_insert_after_none(self): + store = Gtk.TreeStore(object) + root = store.append(None) + sub = store.append(root) + + iter_ = store.insert_after(None, None, [1]) + assert store.get_path(iter_).get_indices() == [0] + + iter_ = store.insert_after(root, None, [1]) + assert store.get_path(iter_).get_indices() == [1, 0] + + iter_ = store.insert_after(sub, None, [1]) + assert store.get_path(iter_).get_indices() == [1, 1, 0] + + iter_ = store.insert_after(None, root, [1]) + assert store.get_path(iter_).get_indices() == [2] + + iter_ = store.insert_after(None, sub, [1]) + assert store.get_path(iter_).get_indices() == [1, 2] + def test_tree_path(self): p1 = Gtk.TreePath() p2 = Gtk.TreePath.new_first() @@ -1248,6 +2187,10 @@ class TestTreeModel(unittest.TestCase): self.assertEqual(p1[2], 3) self.assertRaises(IndexError, p1.__getitem__, 3) + def test_tree_path_empty(self): + p1 = Gtk.TreePath.new() + assert str(p1) == "" + def test_tree_model(self): tree_store = Gtk.TreeStore(int, str) @@ -1487,6 +2430,52 @@ class TestTreeModel(unittest.TestCase): self.assertRaises(TypeError, set_row3) + def test_tree_row_sequence(self): + model = Gtk.ListStore(int, str, float) + model.append([1, "one", -0.1]) + + self.assertEqual([1, "one", -0.1], model[0][0, 1, 2]) + self.assertEqual([1, "one"], model[0][0, 1]) + self.assertEqual(["one", -0.1], model[0][1, 2]) + self.assertEqual("one", model[0][1]) + self.assertEqual([1, -0.1], model[0][0, 2]) + self.assertEqual([-0.1, 1], model[0][2, 0]) + + model[0][0, 1, 2] = (2, "two", -0.2) + self.assertEqual([2, "two", -0.2], model[0][0, 1, 2]) + + model[0][0, 1] = (3, "three") + self.assertEqual([3, "three"], model[0][0, 1]) + + model[0][1, 2] = ("four", -0.4) + self.assertEqual(["four", -0.4], model[0][1, 2]) + + model[0][0, 2] = (5, -0.5) + self.assertEqual([5, -0.5], model[0][0, 2]) + + model[0][0, 1, 2] = (6, "six", -0.6) + self.assertEqual([-0.6, 6, "six"], model[0][2, 0, 1]) + + def set_row1(): + model[0][4, 5] = ("shouldn't", "work",) + + self.assertRaises(IndexError, set_row1) + + def set_row2(): + model[0][0, 1] = (0, "zero", 0) + + self.assertRaises(ValueError, set_row2) + + def set_row3(): + model[0][0, 1] = ("shouldn't", 0) + + self.assertRaises(TypeError, set_row3) + + def set_row4(): + model[0][0, "two"] = (0, "zero") + + self.assertRaises(TypeError, set_row4) + def test_tree_model_set_value_to_none(self): # Tests allowing the usage of None to set an empty value on a model. store = Gtk.ListStore(str) @@ -1533,19 +2522,118 @@ class TestTreeModel(unittest.TestCase): filtered[0][1] = 'ONE' self.assertEqual(filtered[0][1], 'ONE') + def foo(store, iter_, data): + assert data is None + return False + + filtered.set_visible_func(foo) + filtered.refilter() + assert len(filtered) == 0 + def test_list_store_performance(self): model = Gtk.ListStore(int, str) iterations = 2000 - start = time.clock() + start = timeit.default_timer() i = iterations while i > 0: model.append([1, 'hello']) i -= 1 - end = time.clock() + end = timeit.default_timer() sys.stderr.write('[%.0f µs/append] ' % ((end - start) * 1000000 / iterations)) - + def test_filter_new_default(self): + # Test filter_new accepts implicit default of None + model = Gtk.ListStore(int) + filt = model.filter_new() + self.assertTrue(filt is not None) + + def test_tree_store_set(self): + tree_store = Gtk.TreeStore(int, int) + iter_ = tree_store.append(None) + tree_store.set(iter_) + assert tree_store.get_value(iter_, 0) == 0 + tree_store.set(iter_, 0, 42) + assert tree_store.get_value(iter_, 0) == 42 + assert tree_store.get_value(iter_, 1) == 0 + tree_store.set(iter_, 0, 42, 1, 24) + assert tree_store.get_value(iter_, 1) == 24 + tree_store.set(iter_, 1, 124) + assert tree_store.get_value(iter_, 1) == 124 + + with pytest.raises(TypeError): + tree_store.set(iter_, 0, 42, "foo", 24) + with pytest.raises(TypeError): + tree_store.set(iter_, "foo") + with pytest.raises(TypeError): + tree_store.set(iter_, [1, 2, 3]) + with pytest.raises(TypeError): + tree_store.set(iter_, 0, 42, 24) + + def test_list_store_set(self): + list_store = Gtk.ListStore(int, int) + iter_ = list_store.append() + list_store.set(iter_) + assert list_store.get_value(iter_, 0) == 0 + list_store.set(iter_, 0, 42) + assert list_store.get_value(iter_, 0) == 42 + assert list_store.get_value(iter_, 1) == 0 + list_store.set(iter_, 0, 42, 1, 24) + assert list_store.get_value(iter_, 1) == 24 + list_store.set(iter_, 1, 124) + assert list_store.get_value(iter_, 1) == 124 + + with pytest.raises(TypeError): + list_store.set(iter_, 0, 42, "foo", 24) + with pytest.raises(TypeError): + list_store.set(iter_, "foo") + with pytest.raises(TypeError): + list_store.set(iter_, [1, 2, 3]) + with pytest.raises(TypeError): + list_store.set(iter_, 0, 42, 24) + + def test_set_default_sort_func(self): + list_store = Gtk.ListStore(int) + list_store.append([2]) + list_store.append([1]) + + def sort_func(store, iter1, iter2, data): + assert data is None + cmp = lambda a, b: (a > b) - (a < b) + return cmp(store[iter1][0], store[iter2][0]) + + list_store.set_default_sort_func(sort_func) + list_store.set_sort_column_id( + Gtk.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, Gtk.SortType.ASCENDING) + assert [v[0] for v in list_store] == [1, 2] + + def test_model_rows_reordered(self): + list_store = Gtk.ListStore(int) + list_store.append([2]) + list_store.append([1]) + list_store.rows_reordered(Gtk.TreePath.new_first(), None, [0, 1]) + list_store.rows_reordered(0, None, [0, 1]) + + def test_model_set_row(self): + list_store = Gtk.ListStore(int, int) + list_store.append([1, 2]) + iter_ = list_store.get_iter_first() + list_store.set_row(iter_, [3, 4]) + assert list_store[0][:] == [3, 4] + list_store.set_row(iter_, [None, 7]) + assert list_store[0][:] == [3, 7] + list_store.set_row(iter_, [None, GObject.Value(int, 9)]) + assert list_store[0][:] == [3, 9] + + def test_model_set_row_skip_on_none(self): + list_store = Gtk.ListStore(int, int, int, int) + list_store.append([1, 2, 3, 4]) + iter_ = list_store.get_iter_first() + list_store.set_row(iter_, [None, 7, None, 9]) + assert list_store[0][:] == [1, 7, 3, 9] + + +@unittest.skipIf(sys.platform == "darwin", "hangs") @unittest.skipUnless(Gtk, 'Gtk not available') class TestTreeView(unittest.TestCase): def test_tree_view(self): @@ -1563,10 +2651,13 @@ class TestTreeView(unittest.TestCase): def test_tree_view_column(self): cell = Gtk.CellRendererText() - Gtk.TreeViewColumn(title='This is just a test', - cell_renderer=cell, - text=0, - style=2) + col = Gtk.TreeViewColumn(title='This is just a test', + cell_renderer=cell, + text=0, + style=2) + + # Regression test for: https://bugzilla.gnome.org/show_bug.cgi?id=711173 + col.set_cell_data_func(cell, None, None) def test_tree_view_add_column_with_attributes(self): model = Gtk.ListStore(str, str, str) @@ -1575,7 +2666,7 @@ class TestTreeView(unittest.TestCase): model.append(['cell13', 'cell11', 'cell12']) model.append(['cell23', 'cell21', 'cell22']) - tree = Gtk.TreeView(model) + tree = Gtk.TreeView(model=model) cell1 = Gtk.CellRendererText() cell2 = Gtk.CellRendererText() cell3 = Gtk.CellRendererText() @@ -1589,8 +2680,13 @@ class TestTreeView(unittest.TestCase): with realized(tree): tree.set_cursor(model[0].path) - while Gtk.events_pending(): - Gtk.main_iteration() + if Gtk._version == "4.0": + context = GLib.MainContext() + while context.pending(): + context.iteration(False) + else: + while Gtk.events_pending(): + Gtk.main_iteration() self.assertEqual(tree.get_column(0).get_title(), 'Head1') self.assertEqual(tree.get_column(1).get_title(), 'Head2') @@ -1598,10 +2694,12 @@ class TestTreeView(unittest.TestCase): self.assertEqual(tree.get_column(3).get_title(), 'Head4') # cursor should be at the first row - self.assertEqual(cell1.props.text, 'cell11') - self.assertEqual(cell2.props.text, 'cell12') - self.assertEqual(cell3.props.text, 'cell13') - self.assertEqual(cell4.props.text, None) + if not GTK4: + # not sure why this doesn't work with gtk4 + self.assertEqual(cell1.props.text, 'cell11') + self.assertEqual(cell2.props.text, 'cell12') + self.assertEqual(cell3.props.text, 'cell13') + self.assertEqual(cell4.props.text, None) def test_tree_view_column_set_attributes(self): store = Gtk.ListStore(int, str) @@ -1620,7 +2718,9 @@ class TestTreeView(unittest.TestCase): column.set_attributes(cell, text=1) with realized(treeview): - self.assertTrue(cell.props.text in directors) + if not GTK4: + # not sure why this doesn't work with gtk4 + self.assertTrue(cell.props.text in directors) def test_tree_selection(self): store = Gtk.ListStore(int, str) @@ -1651,12 +2751,31 @@ class TestTreeView(unittest.TestCase): self.assertEqual(m, store) self.assertEqual(store.get_path(s), firstpath) + sel.unselect_all() + (m, s) = sel.get_selected() + assert s is None + + sel.select_path(0) + m, r = sel.get_selected_rows() + assert m == store + assert len(r) == 1 + assert r[0] == store[0].path + + def test_scroll_to_cell(self): + store = Gtk.ListStore(int, str) + store.append((0, "foo")) + view = Gtk.TreeView() + view.set_model(store) + view.scroll_to_cell(store[0].path) + view.scroll_to_cell(0) + @unittest.skipUnless(Gtk, 'Gtk not available') class TestTextBuffer(unittest.TestCase): def test_text_buffer(self): self.assertEqual(Gtk.TextBuffer, gi.overrides.Gtk.TextBuffer) buffer = Gtk.TextBuffer() + assert buffer.get_tag_table() is not None tag = buffer.create_tag('title', font='Sans 18') self.assertEqual(tag.props.name, 'title') @@ -1697,21 +2816,52 @@ class TestTextBuffer(unittest.TestCase): self.assertTrue(sel[1].equal(end)) buffer.set_text('') + buffer.insert_with_tags(buffer.get_start_iter(), 'HelloHello') + start, end = buffer.get_bounds() + text = buffer.get_text(start, end, False) + self.assertEqual(text, 'HelloHello') + + buffer.set_text('') + buffer.insert_with_tags_by_name(buffer.get_start_iter(), 'HelloHello') + start, end = buffer.get_bounds() + text = buffer.get_text(start, end, False) + self.assertEqual(text, 'HelloHello') + + try: + starts_tag = Gtk.TextIter.starts_tag + except AttributeError: + starts_tag = Gtk.TextIter.begins_tag + + buffer.set_text('') buffer.insert_with_tags(buffer.get_start_iter(), 'HelloHello', tag) (start, end) = buffer.get_bounds() - self.assertTrue(start.begins_tag(tag)) + self.assertTrue(starts_tag(start, tag)) self.assertTrue(start.has_tag(tag)) buffer.set_text('') buffer.insert_with_tags_by_name(buffer.get_start_iter(), 'HelloHello', 'title') (start, end) = buffer.get_bounds() - self.assertTrue(start.begins_tag(tag)) + self.assertTrue(starts_tag(start, tag)) self.assertTrue(start.has_tag(tag)) self.assertRaises(ValueError, buffer.insert_with_tags_by_name, buffer.get_start_iter(), 'HelloHello', 'unknowntag') + def test_insert(self): + buffer = Gtk.TextBuffer() + start = buffer.get_bounds()[0] + with pytest.raises(TypeError): + buffer.insert(start, 42) + + with pytest.raises(TypeError): + buffer.insert_at_cursor(42) + def test_text_iter(self): + try: + starts_tag = Gtk.TextIter.starts_tag + except AttributeError: + starts_tag = Gtk.TextIter.begins_tag + self.assertEqual(Gtk.TextIter, gi.overrides.Gtk.TextIter) buffer = Gtk.TextBuffer() buffer.set_text('Hello Jane Hello Bob') @@ -1719,12 +2869,12 @@ class TestTextBuffer(unittest.TestCase): (start, end) = buffer.get_bounds() start.forward_chars(10) buffer.apply_tag(tag, start, end) - self.assertTrue(start.begins_tag()) + self.assertTrue(starts_tag(start)) self.assertTrue(end.ends_tag()) self.assertTrue(start.toggles_tag()) self.assertTrue(end.toggles_tag()) start.backward_chars(1) - self.assertFalse(start.begins_tag()) + self.assertFalse(starts_tag(start)) self.assertFalse(start.ends_tag()) self.assertFalse(start.toggles_tag()) @@ -1746,3 +2896,146 @@ class TestTextBuffer(unittest.TestCase): None) self.assertEqual(start.get_offset(), 6) self.assertEqual(end.get_offset(), 11) + + def test_insert_text_signal_location_modification(self): + # Regression test for: https://bugzilla.gnome.org/show_bug.cgi?id=736175 + + def callback(buffer, location, text, length): + location.assign(buffer.get_end_iter()) + + buffer = Gtk.TextBuffer() + buffer.set_text('first line\n') + buffer.connect('insert-text', callback) + + # attempt insertion at the beginning of the buffer, the callback will + # modify the insert location to the end. + buffer.place_cursor(buffer.get_start_iter()) + buffer.insert_at_cursor('second line\n') + + self.assertEqual(buffer.get_property('text'), + 'first line\nsecond line\n') + + @unittest.skipIf(gtkver() < (3, 20, 0), "broken with older gtk") + def test_backward_find_char(self): + buffer = Gtk.TextBuffer() + buffer.set_text('abc') + res = buffer.get_iter_at_line(99) + if GTK4: + end = res.iter + else: + end = res + + values = [] + + def pred_func(ch, user_data): + values.append(ch) + return ch == u"a" + + self.assertTrue(end.backward_find_char(pred_func)) + self.assertEqual(values, [u"c", u"b", u"a"]) + + +@unittest.skipUnless(Gtk, 'Gtk not available') +@unittest.skipIf(Gtk_version == "4.0", "not in gtk4") +class TestPaned(unittest.TestCase): + + def test_pack_defaults(self): + p = Gtk.Paned() + l1 = Gtk.Label() + l2 = Gtk.Label() + p.pack1(l1) + p.pack2(l2) + assert p.get_children() == [l1, l2] + + +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestContainer(unittest.TestCase): + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_child_set_property(self): + box = Gtk.Box() + child = Gtk.Button() + box.pack_start(child, expand=False, fill=True, padding=0) + + box.child_set_property(child, 'padding', 42) + + value = GObject.Value(int) + box.child_get_property(child, 'padding', value) + self.assertEqual(value.get_int(), 42) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_child_get_property_gvalue(self): + box = Gtk.Box() + child = Gtk.Button() + box.pack_start(child, expand=False, fill=True, padding=42) + + value = GObject.Value(int) + box.child_get_property(child, 'padding', value) + self.assertEqual(value.get_int(), 42) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_child_get_property_return_with_explicit_gvalue(self): + box = Gtk.Box() + child = Gtk.Button() + box.pack_start(child, expand=False, fill=True, padding=42) + + value = GObject.Value(int) + result = box.child_get_property(child, 'padding', value) + self.assertEqual(result, 42) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_child_get_property_return_with_implicit_gvalue(self): + box = Gtk.Box() + child = Gtk.Button() + box.pack_start(child, expand=False, fill=True, padding=42) + + result = box.child_get_property(child, 'padding') + self.assertEqual(result, 42) + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_child_get_property_error(self): + box = Gtk.Box() + child = Gtk.Button() + if Gtk_version == "4.0": + box.add(child) + else: + box.pack_start(child, expand=False, fill=True, padding=42) + with self.assertRaises(ValueError): + box.child_get_property(child, 'not-a-valid-child-property') + + @unittest.skipIf(Gtk_version == "4.0", "not in gtk4") + def test_child_get_and_set(self): + box = Gtk.Box() + child = Gtk.Button() + box.pack_start(child, expand=True, fill=True, padding=42) + + expand, fill, padding = box.child_get(child, 'expand', 'fill', 'padding') + self.assertEqual(expand, True) + self.assertEqual(fill, True) + self.assertEqual(padding, 42) + + box.child_set(child, expand=False, fill=False, padding=21, pack_type=1) + expand, fill, padding, pack_type = box.child_get(child, 'expand', 'fill', 'padding', 'pack-type') + self.assertEqual(expand, False) + self.assertEqual(fill, False) + self.assertEqual(padding, 21) + + +def test_button_focus_on_click(): + b = Gtk.Button() + b.set_focus_on_click(True) + assert b.get_focus_on_click() + b.set_focus_on_click(False) + assert not b.get_focus_on_click() + + +@pytest.mark.parametrize( + "data", + [ + "* { background: white; }", + "* { background: white; }".encode() + ] +) +def test_css_provider_load_from_data(data): + provider = Gtk.CssProvider.new() + provider.load_from_data(data) diff --git a/tests/test_overrides_pango.py b/tests/test_overrides_pango.py index 42d4de9..2ec4cb1 100644 --- a/tests/test_overrides_pango.py +++ b/tests/test_overrides_pango.py @@ -5,9 +5,10 @@ import unittest try: from gi.repository import Pango - Pango + from gi.repository import PangoCairo except ImportError: Pango = None + PangoCairo = None @unittest.skipUnless(Pango, 'Pango not available') @@ -31,7 +32,36 @@ class TestPango(unittest.TestCase): layout.set_markup("Foobar") self.assertEqual(layout.get_text(), "Foobar") + def test_layout_set_markup(self): + context = Pango.Context() + layout = Pango.Layout(context) + layout.set_markup("abc") + assert layout.get_text() == "abc" + layout.set_markup("abc", -1) + assert layout.get_text() == "abc" + layout.set_markup("abc", 2) + assert layout.get_text() == "ab" + + def test_layout_set_test(self): + context = Pango.Context() + layout = Pango.Layout(context) + layout.set_text("abc") + assert layout.get_text() == "abc" + layout.set_text("abc", -1) + assert layout.get_text() == "abc" + layout.set_text("abc", 2) + assert layout.get_text() == "ab" + def test_break_keyword_escape(self): # https://bugzilla.gnome.org/show_bug.cgi?id=697363 self.assertTrue(hasattr(Pango, 'break_')) self.assertTrue(Pango.break_ is not None) + + def test_context_get_metrics(self): + # Test default "language" argument + font_map = PangoCairo.font_map_get_default() + context = font_map.create_context() + desc = Pango.FontDescription('monospace') + metrics1 = context.get_metrics(desc) + metrics2 = context.get_metrics(desc, context.get_language()) + self.assertEqual(metrics1.get_ascent(), metrics2.get_ascent()) diff --git a/tests/test_properties.py b/tests/test_properties.py index ef6b867..f8b7823 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -1,13 +1,15 @@ -# coding=utf-8 - +import os +import gc import sys import struct import types import unittest +import tempfile + +import pytest from gi.repository import GObject -from gi.repository.GObject import GType, new, PARAM_READWRITE, \ - PARAM_CONSTRUCT, PARAM_READABLE, PARAM_WRITABLE, PARAM_CONSTRUCT_ONLY +from gi.repository.GObject import ParamFlags, GType, new from gi.repository.GObject import \ TYPE_INT, TYPE_UINT, TYPE_LONG, TYPE_ULONG, TYPE_INT64, \ TYPE_UINT64, TYPE_GTYPE, TYPE_INVALID, TYPE_NONE, TYPE_STRV, \ @@ -15,62 +17,66 @@ from gi.repository.GObject import \ TYPE_DOUBLE, TYPE_POINTER, TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, \ TYPE_STRING, TYPE_PYOBJECT, TYPE_VARIANT -from gi.repository.GObject import \ - G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, G_MAXULONG, \ - G_MAXUINT64, G_MAXINT64, G_MININT64 +from gi.repository.GLib import \ + MININT, MAXINT, MAXUINT, MINLONG, MAXLONG, MAXULONG, \ + MAXUINT64, MAXINT64, MININT64 from gi.repository import Gio from gi.repository import GLib -from gi.repository import Regress from gi.repository import GIMarshallingTests -from gi._gobject import propertyhelper - -if sys.version_info < (3, 0): - TEST_UTF8 = "\xe2\x99\xa5" - UNICODE_UTF8 = unicode(TEST_UTF8, 'UTF-8') -else: - TEST_UTF8 = "♥" - UNICODE_UTF8 = TEST_UTF8 +from gi.repository import Regress +from gi import _propertyhelper as propertyhelper -from compathelper import _long +from .helper import capture_glib_warnings class PropertyObject(GObject.GObject): normal = GObject.Property(type=str) construct = GObject.Property( type=str, - flags=PARAM_READWRITE | PARAM_CONSTRUCT, default='default') + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT, + default='default') + construct_only = GObject.Property( type=str, - flags=PARAM_READWRITE | PARAM_CONSTRUCT_ONLY) + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT_ONLY) + uint64 = GObject.Property( - type=TYPE_UINT64, flags=PARAM_READWRITE | PARAM_CONSTRUCT) + type=TYPE_UINT64, + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT) enum = GObject.Property( type=Gio.SocketType, default=Gio.SocketType.STREAM) boxed = GObject.Property( - type=GLib.Regex, flags=PARAM_READWRITE | PARAM_CONSTRUCT) + type=GLib.Regex, + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT) flags = GObject.Property( - type=GIMarshallingTests.Flags, flags=PARAM_READWRITE | PARAM_CONSTRUCT, + type=GIMarshallingTests.Flags, + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT, default=GIMarshallingTests.Flags.VALUE1) gtype = GObject.Property( - type=TYPE_GTYPE, flags=PARAM_READWRITE | PARAM_CONSTRUCT) + type=TYPE_GTYPE, + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT) strings = GObject.Property( - type=TYPE_STRV, flags=PARAM_READWRITE | PARAM_CONSTRUCT) + type=TYPE_STRV, + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT) variant = GObject.Property( - type=TYPE_VARIANT, flags=PARAM_READWRITE | PARAM_CONSTRUCT) + type=TYPE_VARIANT, + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT) variant_def = GObject.Property( - type=TYPE_VARIANT, flags=PARAM_READWRITE | PARAM_CONSTRUCT, + type=TYPE_VARIANT, + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT, default=GLib.Variant('i', 42)) interface = GObject.Property( - type=Gio.File, flags=PARAM_READWRITE | PARAM_CONSTRUCT) + type=Gio.File, + flags=ParamFlags.READABLE | ParamFlags.WRITABLE | ParamFlags.CONSTRUCT) class PropertyInheritanceObject(Regress.TestObj): @@ -160,12 +166,19 @@ class TestPropertyObject(unittest.TestCase): self.assertEqual(obj.props.construct, "789") def test_utf8(self): - obj = new(PropertyObject, construct_only=UNICODE_UTF8) - self.assertEqual(obj.props.construct_only, TEST_UTF8) - obj.set_property('construct', UNICODE_UTF8) - self.assertEqual(obj.props.construct, TEST_UTF8) - obj.props.normal = UNICODE_UTF8 - self.assertEqual(obj.props.normal, TEST_UTF8) + test_utf8 = "♥" + unicode_utf8 = u"♥" + obj = new(PropertyObject, construct_only=unicode_utf8) + self.assertEqual(obj.props.construct_only, test_utf8) + obj.set_property('construct', unicode_utf8) + self.assertEqual(obj.props.construct, test_utf8) + obj.props.normal = unicode_utf8 + self.assertEqual(obj.props.normal, test_utf8) + + def test_utf8_lone_surrogate(self): + obj = PropertyObject() + with pytest.raises(TypeError): + obj.set_property('construct', '\ud83d') def test_int_to_str(self): obj = new(PropertyObject, construct_only=1) @@ -186,12 +199,12 @@ class TestPropertyObject(unittest.TestCase): def test_uint64(self): obj = new(PropertyObject) self.assertEqual(obj.props.uint64, 0) - obj.props.uint64 = _long(1) - self.assertEqual(obj.props.uint64, _long(1)) obj.props.uint64 = 1 - self.assertEqual(obj.props.uint64, _long(1)) + self.assertEqual(obj.props.uint64, 1) + obj.props.uint64 = 1 + self.assertEqual(obj.props.uint64, 1) - self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", _long(-1)) + self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1) self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1) def test_uint64_default_value(self): @@ -199,8 +212,8 @@ class TestPropertyObject(unittest.TestCase): class TimeControl(GObject.GObject): __gproperties__ = { 'time': (TYPE_UINT64, 'Time', 'Time', - _long(0), (1 << 64) - 1, _long(0), - PARAM_READABLE) + 0, (1 << 64) - 1, 0, + ParamFlags.READABLE) } except OverflowError: (etype, ex) = sys.exc_info()[2:] @@ -234,6 +247,10 @@ class TestPropertyObject(unittest.TestCase): self.assertRaises(TypeError, GObject.Property, type=Gio.SocketType, default=1) + def test_repr(self): + prop = GObject.Property(type=int) + assert repr(prop) == "" + def test_flags(self): obj = new(PropertyObject) self.assertEqual(obj.props.flags, GIMarshallingTests.Flags.VALUE1) @@ -396,10 +413,11 @@ class TestPropertyObject(unittest.TestCase): def test_interface(self): obj = new(PropertyObject) - file = Gio.File.new_for_path('/some/path') + path = os.path.join(tempfile.gettempdir(), "some", "path") + file = Gio.File.new_for_path(path) obj.props.interface = file - self.assertEqual(obj.props.interface.get_path(), '/some/path') - self.assertEqual(obj.interface.get_path(), '/some/path') + self.assertEqual(obj.props.interface.get_path(), path) + self.assertEqual(obj.interface.get_path(), path) self.assertRaises(TypeError, setattr, obj, 'interface', 'foo') self.assertRaises(TypeError, setattr, obj, 'interface', object()) @@ -433,7 +451,7 @@ class TestPropertyObject(unittest.TestCase): d = {} for key, (gtype, min, max) in types_.items(): d[key] = (gtype, 'blurb', 'desc', min, max, 0, - PARAM_READABLE | PARAM_WRITABLE) + ParamFlags.READABLE | ParamFlags.WRITABLE) return d class RangeCheck(GObject.GObject): @@ -486,9 +504,9 @@ class TestProperty(unittest.TestCase): def test_simple(self): class C(GObject.GObject): str = GObject.Property(type=str) - int = GObject.Property(type=int) float = GObject.Property(type=float) - long = GObject.Property(type=_long) + long = GObject.Property(type=int) + int = GObject.Property(type=int) self.assertTrue(hasattr(C.props, 'str')) self.assertTrue(hasattr(C.props, 'int')) @@ -508,9 +526,9 @@ class TestProperty(unittest.TestCase): o.float = 3.14 self.assertEqual(o.float, 3.14) - self.assertEqual(o.long, _long(0)) - o.long = _long(100) - self.assertEqual(o.long, _long(100)) + self.assertEqual(o.long, 0) + o.long = 100 + self.assertEqual(o.long, 100) def test_custom_getter(self): class C(GObject.GObject): @@ -522,6 +540,23 @@ class TestProperty(unittest.TestCase): self.assertEqual(o.prop, 'value') self.assertRaises(TypeError, setattr, o, 'prop', 'xxx') + def test_getter_exception(self): + class C(GObject.Object): + @GObject.Property(type=int) + def prop(self): + raise ValueError('something bad happend') + + o = C() + + with self.assertRaisesRegex(ValueError, 'something bad happend'): + o.prop + + with self.assertRaisesRegex(ValueError, 'something bad happend'): + o.get_property('prop') + + with self.assertRaisesRegex(ValueError, 'something bad happend'): + o.props.prop + def test_custom_setter(self): class C(GObject.GObject): def set_prop(self, value): @@ -618,12 +653,12 @@ class TestProperty(unittest.TestCase): def test_range(self): types_ = [ - (TYPE_INT, G_MININT, G_MAXINT), - (TYPE_UINT, 0, G_MAXUINT), - (TYPE_LONG, G_MINLONG, G_MAXLONG), - (TYPE_ULONG, 0, G_MAXULONG), - (TYPE_INT64, G_MININT64, G_MAXINT64), - (TYPE_UINT64, 0, G_MAXUINT64), + (TYPE_INT, MININT, MAXINT), + (TYPE_UINT, 0, MAXUINT), + (TYPE_LONG, MINLONG, MAXLONG), + (TYPE_ULONG, 0, MAXULONG), + (TYPE_INT64, MININT64, MAXINT64), + (TYPE_UINT64, 0, MAXUINT64), ] for gtype, min, max in types_: @@ -653,8 +688,7 @@ class TestProperty(unittest.TestCase): # we test known-bad values here which cause Gtk-WARNING logs. # Explicitly allow these for this test. - old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_CRITICAL) - try: + with capture_glib_warnings(allow_warnings=True, allow_criticals=True): o = C() self.assertEqual(o.prop_int, 1) @@ -677,8 +711,6 @@ class TestProperty(unittest.TestCase): o.prop_float = 10.51 self.assertEqual(o.prop_float, 7.75) - finally: - GLib.log_set_always_fatal(old_mask) def test_multiple_instances(self): class C(GObject.GObject): @@ -791,7 +823,7 @@ class TestProperty(unittest.TestCase): GObject.Property(type=GObject.TYPE_DOUBLE, minimum=-1) # Bug 644039 - + @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount") def test_reference_count(self): # We can check directly if an object gets finalized, so we will # observe it indirectly through the refcount of a member object. @@ -831,8 +863,6 @@ class TestProperty(unittest.TestCase): def test_python_to_glib_type_mapping(self): tester = GObject.Property() self.assertEqual(tester._type_from_python(int), GObject.TYPE_INT) - if sys.version_info < (3, 0): - self.assertEqual(tester._type_from_python(long), GObject.TYPE_LONG) self.assertEqual(tester._type_from_python(bool), GObject.TYPE_BOOLEAN) self.assertEqual(tester._type_from_python(float), GObject.TYPE_DOUBLE) self.assertEqual(tester._type_from_python(str), GObject.TYPE_STRING) @@ -918,5 +948,415 @@ class TestInstallProperties(unittest.TestCase): self.assertRaises(ValueError, propertyhelper.install_properties, self.ClassWithPropertyRedefined) -if __name__ == '__main__': - unittest.main() + +class CPropertiesTestBase(object): + # Tests for properties implemented in C not Python. + + def setUp(self): + self.obj = GIMarshallingTests.PropertiesObject() + + def get_prop(self, obj, name): + raise NotImplementedError + + def set_prop(self, obj, name, value): + raise NotImplementedError + + # https://bugzilla.gnome.org/show_bug.cgi?id=780652 + @unittest.skipUnless( + "some_flags" in dir(GIMarshallingTests.PropertiesObject.props), + "tool old gi") + def test_flags(self): + self.assertEqual( + self.get_prop(self.obj, 'some-flags'), + GIMarshallingTests.Flags.VALUE1) + self.set_prop(self.obj, 'some-flags', GIMarshallingTests.Flags.VALUE2) + self.assertEqual(self.get_prop(self.obj, 'some-flags'), + GIMarshallingTests.Flags.VALUE2) + + obj = GIMarshallingTests.PropertiesObject( + some_flags=GIMarshallingTests.Flags.VALUE3) + self.assertEqual(self.get_prop(obj, 'some-flags'), + GIMarshallingTests.Flags.VALUE3) + + # https://bugzilla.gnome.org/show_bug.cgi?id=780652 + @unittest.skipUnless( + "some_enum" in dir(GIMarshallingTests.PropertiesObject.props), + "tool old gi") + def test_enum(self): + self.assertEqual( + self.get_prop(self.obj, 'some-enum'), + GIMarshallingTests.GEnum.VALUE1) + self.set_prop(self.obj, 'some-enum', GIMarshallingTests.GEnum.VALUE2) + self.assertEqual(self.get_prop(self.obj, 'some-enum'), + GIMarshallingTests.GEnum.VALUE2) + + obj = GIMarshallingTests.PropertiesObject( + some_enum=GIMarshallingTests.GEnum.VALUE3) + self.assertEqual(self.get_prop(obj, 'some-enum'), + GIMarshallingTests.GEnum.VALUE3) + + def test_boolean(self): + self.assertEqual(self.get_prop(self.obj, 'some-boolean'), False) + self.set_prop(self.obj, 'some-boolean', True) + self.assertEqual(self.get_prop(self.obj, 'some-boolean'), True) + + obj = GIMarshallingTests.PropertiesObject(some_boolean=True) + self.assertEqual(self.get_prop(obj, 'some-boolean'), True) + + def test_char(self): + self.assertEqual(self.get_prop(self.obj, 'some-char'), 0) + self.set_prop(self.obj, 'some-char', GLib.MAXINT8) + self.assertEqual(self.get_prop(self.obj, 'some-char'), GLib.MAXINT8) + + obj = GIMarshallingTests.PropertiesObject(some_char=-42) + self.assertEqual(self.get_prop(obj, 'some-char'), -42) + + with pytest.raises(OverflowError): + self.set_prop(obj, 'some-char', GLib.MAXINT8 + 1) + with pytest.raises(OverflowError): + self.set_prop(obj, 'some-char', GLib.MININT8 - 1) + + self.set_prop(obj, 'some-char', b"\x44") + assert self.get_prop(obj, 'some-char') == 0x44 + + self.set_prop(obj, 'some-char', b"\xff") + assert self.get_prop(obj, 'some-char') == -1 + + obj = GIMarshallingTests.PropertiesObject(some_char=u"\x7f") + assert self.get_prop(obj, 'some-char') == 0x7f + + with pytest.raises(TypeError): + GIMarshallingTests.PropertiesObject(some_char=u"€") + + with pytest.raises(TypeError): + GIMarshallingTests.PropertiesObject(some_char=u"\ud83d") + + def test_uchar(self): + self.assertEqual(self.get_prop(self.obj, 'some-uchar'), 0) + self.set_prop(self.obj, 'some-uchar', GLib.MAXUINT8) + self.assertEqual(self.get_prop(self.obj, 'some-uchar'), GLib.MAXUINT8) + + obj = GIMarshallingTests.PropertiesObject(some_uchar=42) + self.assertEqual(self.get_prop(obj, 'some-uchar'), 42) + + with pytest.raises(OverflowError): + self.set_prop(obj, 'some-uchar', GLib.MAXUINT8 + 1) + with pytest.raises(OverflowError): + self.set_prop(obj, 'some-uchar', -1) + + self.set_prop(obj, 'some-uchar', b"\x57") + assert self.get_prop(obj, 'some-uchar') == 0x57 + + self.set_prop(obj, 'some-uchar', b"\xff") + assert self.get_prop(obj, 'some-uchar') == 255 + + obj = GIMarshallingTests.PropertiesObject(some_uchar=u"\x7f") + assert self.get_prop(obj, 'some-uchar') == 127 + + with pytest.raises(TypeError): + GIMarshallingTests.PropertiesObject(some_uchar=u"\x80") + + with pytest.raises(TypeError): + GIMarshallingTests.PropertiesObject(some_uchar=u"\ud83d") + + def test_int(self): + self.assertEqual(self.get_prop(self.obj, 'some_int'), 0) + self.set_prop(self.obj, 'some-int', GLib.MAXINT) + self.assertEqual(self.get_prop(self.obj, 'some_int'), GLib.MAXINT) + + obj = GIMarshallingTests.PropertiesObject(some_int=-42) + self.assertEqual(self.get_prop(obj, 'some-int'), -42) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-int', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-int', None) + + self.assertEqual(self.get_prop(obj, 'some-int'), -42) + + def test_uint(self): + self.assertEqual(self.get_prop(self.obj, 'some_uint'), 0) + self.set_prop(self.obj, 'some-uint', GLib.MAXUINT) + self.assertEqual(self.get_prop(self.obj, 'some_uint'), GLib.MAXUINT) + + obj = GIMarshallingTests.PropertiesObject(some_uint=42) + self.assertEqual(self.get_prop(obj, 'some-uint'), 42) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-uint', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-uint', None) + + self.assertEqual(self.get_prop(obj, 'some-uint'), 42) + + def test_long(self): + self.assertEqual(self.get_prop(self.obj, 'some_long'), 0) + self.set_prop(self.obj, 'some-long', GLib.MAXLONG) + self.assertEqual(self.get_prop(self.obj, 'some_long'), GLib.MAXLONG) + + obj = GIMarshallingTests.PropertiesObject(some_long=-42) + self.assertEqual(self.get_prop(obj, 'some-long'), -42) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-long', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-long', None) + + self.assertEqual(self.get_prop(obj, 'some-long'), -42) + + def test_ulong(self): + self.assertEqual(self.get_prop(self.obj, 'some_ulong'), 0) + self.set_prop(self.obj, 'some-ulong', GLib.MAXULONG) + self.assertEqual(self.get_prop(self.obj, 'some_ulong'), GLib.MAXULONG) + + obj = GIMarshallingTests.PropertiesObject(some_ulong=42) + self.assertEqual(self.get_prop(obj, 'some-ulong'), 42) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-ulong', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-ulong', None) + + self.assertEqual(self.get_prop(obj, 'some-ulong'), 42) + + def test_int64(self): + self.assertEqual(self.get_prop(self.obj, 'some-int64'), 0) + self.set_prop(self.obj, 'some-int64', GLib.MAXINT64) + self.assertEqual(self.get_prop(self.obj, 'some-int64'), GLib.MAXINT64) + + obj = GIMarshallingTests.PropertiesObject(some_int64=-4200000000000000) + self.assertEqual(self.get_prop(obj, 'some-int64'), -4200000000000000) + + def test_uint64(self): + self.assertEqual(self.get_prop(self.obj, 'some-uint64'), 0) + self.set_prop(self.obj, 'some-uint64', GLib.MAXUINT64) + self.assertEqual(self.get_prop(self.obj, 'some-uint64'), GLib.MAXUINT64) + + obj = GIMarshallingTests.PropertiesObject(some_uint64=4200000000000000) + self.assertEqual(self.get_prop(obj, 'some-uint64'), 4200000000000000) + + def test_float(self): + self.assertEqual(self.get_prop(self.obj, 'some-float'), 0) + self.set_prop(self.obj, 'some-float', GLib.MAXFLOAT) + self.assertEqual(self.get_prop(self.obj, 'some-float'), GLib.MAXFLOAT) + + obj = GIMarshallingTests.PropertiesObject(some_float=42.42) + self.assertAlmostEqual(self.get_prop(obj, 'some-float'), 42.42, places=4) + + obj = GIMarshallingTests.PropertiesObject(some_float=42) + self.assertAlmostEqual(self.get_prop(obj, 'some-float'), 42.0, places=4) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-float', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-float', None) + + self.assertAlmostEqual(self.get_prop(obj, 'some-float'), 42.0, places=4) + + def test_double(self): + self.assertEqual(self.get_prop(self.obj, 'some-double'), 0) + self.set_prop(self.obj, 'some-double', GLib.MAXDOUBLE) + self.assertEqual(self.get_prop(self.obj, 'some-double'), GLib.MAXDOUBLE) + + obj = GIMarshallingTests.PropertiesObject(some_double=42.42) + self.assertAlmostEqual(self.get_prop(obj, 'some-double'), 42.42) + + obj = GIMarshallingTests.PropertiesObject(some_double=42) + self.assertAlmostEqual(self.get_prop(obj, 'some-double'), 42.0) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-double', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-double', None) + + self.assertAlmostEqual(self.get_prop(obj, 'some-double'), 42.0) + + def test_strv(self): + self.assertEqual(self.get_prop(self.obj, 'some-strv'), []) + self.set_prop(self.obj, 'some-strv', ['hello', 'world']) + self.assertEqual(self.get_prop(self.obj, 'some-strv'), ['hello', 'world']) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-strv', 1) + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-strv', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-strv', [1, 2]) + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-strv', ['foo', 1]) + + self.assertEqual(self.get_prop(self.obj, 'some-strv'), ['hello', 'world']) + + obj = GIMarshallingTests.PropertiesObject(some_strv=['hello', 'world']) + self.assertEqual(self.get_prop(obj, 'some-strv'), ['hello', 'world']) + + # unicode on py2 + obj = GIMarshallingTests.PropertiesObject(some_strv=[u'foo']) + self.assertEqual(self.get_prop(obj, 'some-strv'), [u'foo']) + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-strv', + [u'foo', 1]) + + def test_boxed_struct(self): + self.assertEqual(self.get_prop(self.obj, 'some-boxed-struct'), None) + + class GStrv(list): + __gtype__ = GObject.TYPE_STRV + + struct1 = GIMarshallingTests.BoxedStruct() + struct1.long_ = 1 + + self.set_prop(self.obj, 'some-boxed-struct', struct1) + self.assertEqual(self.get_prop(self.obj, 'some-boxed-struct').long_, 1) + self.assertEqual(self.obj.some_boxed_struct.long_, 1) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-boxed-struct', 1) + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-boxed-struct', 'foo') + + obj = GIMarshallingTests.PropertiesObject(some_boxed_struct=struct1) + self.assertEqual(self.get_prop(obj, 'some-boxed-struct').long_, 1) + + def test_boxed_glist(self): + self.assertEqual(self.get_prop(self.obj, 'some-boxed-glist'), []) + + list_ = [GLib.MININT, 42, GLib.MAXINT] + self.set_prop(self.obj, 'some-boxed-glist', list_) + self.assertEqual(self.get_prop(self.obj, 'some-boxed-glist'), list_) + self.set_prop(self.obj, 'some-boxed-glist', []) + self.assertEqual(self.get_prop(self.obj, 'some-boxed-glist'), []) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-boxed-glist', 1) + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-boxed-glist', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-boxed-glist', ['a']) + + def test_annotated_glist(self): + obj = Regress.TestObj() + self.assertEqual(self.get_prop(obj, 'list'), []) + + self.set_prop(obj, 'list', ['1', '2', '3']) + self.assertTrue(isinstance(self.get_prop(obj, 'list'), list)) + self.assertEqual(self.get_prop(obj, 'list'), ['1', '2', '3']) + + @unittest.expectedFailure + def test_boxed_glist_ctor(self): + list_ = [GLib.MININT, 42, GLib.MAXINT] + obj = GIMarshallingTests.PropertiesObject(some_boxed_glist=list_) + self.assertEqual(self.get_prop(obj, 'some-boxed-glist'), list_) + + def test_variant(self): + self.assertEqual(self.get_prop(self.obj, 'some-variant'), None) + + self.set_prop(self.obj, 'some-variant', GLib.Variant('o', '/myobj')) + self.assertEqual(self.get_prop(self.obj, 'some-variant').get_type_string(), 'o') + self.assertEqual(self.get_prop(self.obj, 'some-variant').print_(False), "'/myobj'") + + self.set_prop(self.obj, 'some-variant', None) + self.assertEqual(self.get_prop(self.obj, 'some-variant'), None) + + obj = GIMarshallingTests.PropertiesObject(some_variant=GLib.Variant('b', True)) + self.assertEqual(self.get_prop(obj, 'some-variant').get_type_string(), 'b') + self.assertEqual(self.get_prop(obj, 'some-variant').get_boolean(), True) + + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-variant', 'foo') + self.assertRaises(TypeError, self.set_prop, self.obj, 'some-variant', 23) + + self.assertEqual(self.get_prop(obj, 'some-variant').get_type_string(), 'b') + self.assertEqual(self.get_prop(obj, 'some-variant').get_boolean(), True) + + def test_setting_several_properties(self): + obj = GIMarshallingTests.PropertiesObject() + obj.set_properties(some_uchar=54, some_int=42) + self.assertEqual(42, self.get_prop(obj, 'some-int')) + self.assertEqual(54, self.get_prop(obj, 'some-uchar')) + + def test_gtype(self): + obj = Regress.TestObj() + self.assertEqual(self.get_prop(obj, 'gtype'), GObject.TYPE_INVALID) + self.set_prop(obj, 'gtype', int) + self.assertEqual(self.get_prop(obj, 'gtype'), GObject.TYPE_INT) + + obj = Regress.TestObj(gtype=int) + self.assertEqual(self.get_prop(obj, 'gtype'), GObject.TYPE_INT) + self.set_prop(obj, 'gtype', str) + self.assertEqual(self.get_prop(obj, 'gtype'), GObject.TYPE_STRING) + + def test_hash_table(self): + obj = Regress.TestObj() + self.assertEqual(self.get_prop(obj, 'hash-table'), None) + + self.set_prop(obj, 'hash-table', {'mec': 56}) + self.assertTrue(isinstance(self.get_prop(obj, 'hash-table'), dict)) + self.assertEqual(list(self.get_prop(obj, 'hash-table').items())[0], + ('mec', 56)) + + def test_parent_class(self): + class A(Regress.TestObj): + prop1 = GObject.Property(type=int) + + a = A() + self.set_prop(a, 'int', 20) + self.assertEqual(self.get_prop(a, 'int'), 20) + + # test parent property which needs introspection + self.set_prop(a, 'list', ("str1", "str2")) + self.assertEqual(self.get_prop(a, 'list'), ["str1", "str2"]) + + def test_held_object_ref_count_getter(self): + holder = GIMarshallingTests.PropertiesObject() + held = GObject.Object() + + self.assertEqual(holder.__grefcount__, 1) + self.assertEqual(held.__grefcount__, 1) + + self.set_prop(holder, 'some-object', held) + self.assertEqual(holder.__grefcount__, 1) + + initial_ref_count = held.__grefcount__ + self.get_prop(holder, 'some-object') + gc.collect() + self.assertEqual(held.__grefcount__, initial_ref_count) + + def test_held_object_ref_count_setter(self): + holder = GIMarshallingTests.PropertiesObject() + held = GObject.Object() + + self.assertEqual(holder.__grefcount__, 1) + self.assertEqual(held.__grefcount__, 1) + + # Setting property should only increase ref count by 1 + self.set_prop(holder, 'some-object', held) + self.assertEqual(holder.__grefcount__, 1) + self.assertEqual(held.__grefcount__, 2) + + # Clearing should pull it back down + self.set_prop(holder, 'some-object', None) + self.assertEqual(held.__grefcount__, 1) + + def test_set_object_property_to_invalid_type(self): + obj = GIMarshallingTests.PropertiesObject() + self.assertRaises(TypeError, self.set_prop, obj, 'some-object', 'not_an_object') + + +class TestCPropsAccessor(CPropertiesTestBase, unittest.TestCase): + # C property tests using the "props" accessor. + def get_prop(self, obj, name): + return getattr(obj.props, name.replace('-', '_')) + + def set_prop(self, obj, name, value): + setattr(obj.props, name.replace('-', '_'), value) + + def test_props_accessor_dir(self): + # Test class + props = dir(GIMarshallingTests.PropertiesObject.props) + self.assertTrue('some_float' in props) + self.assertTrue('some_double' in props) + self.assertTrue('some_variant' in props) + + # Test instance + obj = GIMarshallingTests.PropertiesObject() + props = dir(obj.props) + self.assertTrue('some_float' in props) + self.assertTrue('some_double' in props) + self.assertTrue('some_variant' in props) + + def test_param_spec_dir(self): + attrs = dir(GIMarshallingTests.PropertiesObject.props.some_float) + self.assertTrue('name' in attrs) + self.assertTrue('nick' in attrs) + self.assertTrue('blurb' in attrs) + self.assertTrue('flags' in attrs) + self.assertTrue('default_value' in attrs) + self.assertTrue('minimum' in attrs) + self.assertTrue('maximum' in attrs) + + +class TestCGetPropertyMethod(CPropertiesTestBase, unittest.TestCase): + # C property tests using the "props" accessor. + def get_prop(self, obj, name): + return obj.get_property(name) + + def set_prop(self, obj, name, value): + obj.set_property(name, value) diff --git a/tests/test_pycapi.py b/tests/test_pycapi.py new file mode 100644 index 0000000..d049a8d --- /dev/null +++ b/tests/test_pycapi.py @@ -0,0 +1,45 @@ +import unittest +import ctypes +from ctypes import c_void_p, py_object, c_char_p + +import gi +from gi.repository import Gio + + +def get_capi(): + + if not hasattr(ctypes, "pythonapi"): + return + + class CAPI(ctypes.Structure): + _fields_ = [ + ("", c_void_p), + ("", c_void_p), + ("", c_void_p), + ("newgobj", ctypes.PYFUNCTYPE(py_object, c_void_p)), + ] + + api_obj = gi._gobject._PyGObject_API + func_type = ctypes.PYFUNCTYPE(c_void_p, py_object, c_char_p) + PyCapsule_GetPointer = func_type( + ('PyCapsule_GetPointer', ctypes.pythonapi)) + ptr = PyCapsule_GetPointer(api_obj, b"gobject._PyGObject_API") + + ptr = ctypes.cast(ptr, ctypes.POINTER(CAPI)) + return ptr.contents + + +API = get_capi() + + +@unittest.skipUnless(API, "no pythonapi support") +class TestPythonCAPI(unittest.TestCase): + + def test_newgobj(self): + w = Gio.FileInfo() + # XXX: ugh :/ + ptr = int(repr(w).split()[-1].split(")")[0], 16) + + capi = get_capi() + new_w = capi.newgobj(ptr) + assert w == new_w diff --git a/tests/test_pygtkcompat.py b/tests/test_pygtkcompat.py new file mode 100644 index 0000000..c01892a --- /dev/null +++ b/tests/test_pygtkcompat.py @@ -0,0 +1,339 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab + +import unittest +import base64 + +import pytest +import gi +import pygtkcompat +from pygtkcompat.pygtkcompat import _disable_all as disable_all + +from .helper import capture_gi_deprecation_warnings, capture_glib_warnings + +try: + from gi.repository import Gtk, Gdk +except ImportError: + Gtk = None +else: + if Gtk._version != "3.0": + Gtk = None + + +class TestGlibCompat(unittest.TestCase): + + def setUp(self): + pygtkcompat.enable() + + def tearDown(self): + disable_all() + + def test_import(self): + import glib + import gio + glib, gio + + +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestMultipleEnable(unittest.TestCase): + + def tearDown(self): + disable_all() + + def test_main(self): + pygtkcompat.enable() + pygtkcompat.enable() + + def test_gtk(self): + pygtkcompat.enable_gtk("3.0") + pygtkcompat.enable_gtk("3.0") + import gtk + + # https://bugzilla.gnome.org/show_bug.cgi?id=759009 + w = gtk.Window() + w.realize() + self.assertEqual(len(w.window.get_origin()), 2) + w.destroy() + + def test_gtk_no_4(self): + self.assertRaises(ValueError, pygtkcompat.enable_gtk, version='4.0') + + def test_gtk_version_conflict(self): + pygtkcompat.enable_gtk("3.0") + self.assertRaises(ValueError, pygtkcompat.enable_gtk, version='2.0') + + +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestATKCompat(unittest.TestCase): + + def setUp(self): + pygtkcompat.enable_gtk("3.0") + + def tearDown(self): + disable_all() + + def test_object(self): + import atk + self.assertTrue(hasattr(atk, 'Object')) + + +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestPangoCompat(unittest.TestCase): + + def setUp(self): + pygtkcompat.enable_gtk("3.0") + + def tearDown(self): + disable_all() + + def test_layout(self): + import pango + self.assertTrue(hasattr(pango, 'Layout')) + + +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestPangoCairoCompat(unittest.TestCase): + + def setUp(self): + pygtkcompat.enable_gtk("3.0") + + def tearDown(self): + disable_all() + + def test_error_underline_path(self): + import pangocairo + self.assertTrue(hasattr(pangocairo, 'error_underline_path')) + + +@unittest.skipUnless(Gtk, 'Gtk not available') +class TestGTKCompat(unittest.TestCase): + + def setUp(self): + pygtkcompat.enable_gtk("3.0") + + def tearDown(self): + disable_all() + + def test_window_get_frame_extents(self): + import gtk + import gtk.gdk + w = gtk.Window() + w.realize() + rect = w.window.get_frame_extents() + assert isinstance(rect, gtk.gdk.Rectangle) + + def test_window_get_geometry(self): + import gtk + w = gtk.Window() + w.realize() + with capture_gi_deprecation_warnings(): + geo = w.window.get_geometry() + assert isinstance(geo, tuple) + assert len(geo) == 5 + + def test_action_set_tool_item_type(self): + import gtk + with pytest.warns(gi.PyGIDeprecationWarning): + gtk.Action().set_tool_item_type(gtk.Action) + + def test_treeviewcolumn_pack(self): + import gtk + col = gtk.TreeViewColumn() + col.pack_end(gtk.CellRendererText()) + col.pack_start(gtk.CellRendererText()) + + def test_cell_layout_pack(self): + import gtk + layout = gtk.EntryCompletion() + layout.pack_end(gtk.CellRendererText()) + layout.pack_start(gtk.CellRendererText()) + + def test_cell_layout_cell_data_func(self): + import gtk + + def func(*args): + pass + + layout = gtk.EntryCompletion() + render = gtk.CellRendererText() + layout.set_cell_data_func(render, func) + + def test_combo_row_separator_func(self): + import gtk + + def func(*args): + pass + + combo = gtk.ComboBox() + combo.set_row_separator_func(func) + + def test_container_install_child_property(self): + import gtk + + box = gtk.Box() + with pytest.warns(gi.PyGIDeprecationWarning): + box.install_child_property(0, None) + + def test_combo_box_new_text(self): + import gtk + + combo = gtk.combo_box_new_text() + assert isinstance(combo, gtk.ComboBox) + combo.append_text("foo") + + def test_scale(self): + import gtk + + adjustment = gtk.Adjustment() + assert gtk.HScale() + assert gtk.HScale(adjustment).get_adjustment() == adjustment + adjustment = gtk.Adjustment() + assert gtk.VScale() + assert gtk.VScale(adjustment).get_adjustment() == adjustment + + def test_stock_add(self): + import gtk + + gtk.stock_add([]) + + def test_text_view_scroll_to_mark(self): + import gtk + + view = gtk.TextView() + buf = view.get_buffer() + mark = gtk.TextMark(name="foo") + buf.add_mark(mark, buf.get_end_iter()) + view.scroll_to_mark(mark, 0.0) + + def test_window_set_geometry_hints(self): + import gtk + + w = gtk.Window() + w.set_geometry_hints(None, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + w.set_geometry_hints(None, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1) + with pytest.raises(TypeError): + w.set_geometry_hints(None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + + def test_buttons(self): + import gtk.gdk + self.assertEqual(gtk.gdk._2BUTTON_PRESS, 5) + self.assertEqual(gtk.gdk.BUTTON_PRESS, 4) + + def test_enums(self): + import gtk + self.assertEqual(gtk.WINDOW_TOPLEVEL, Gtk.WindowType.TOPLEVEL) + self.assertEqual(gtk.PACK_START, Gtk.PackType.START) + + def test_flags(self): + import gtk + self.assertEqual(gtk.EXPAND, Gtk.AttachOptions.EXPAND) + self.assertEqual(gtk.gdk.SHIFT_MASK, Gdk.ModifierType.SHIFT_MASK) + + def test_keysyms(self): + import gtk.keysyms + self.assertEqual(gtk.keysyms.Escape, Gdk.KEY_Escape) + self.assertTrue(gtk.keysyms._0, Gdk.KEY_0) + + def test_style(self): + import gtk + widget = gtk.Button() + with capture_gi_deprecation_warnings(): + widget.get_style_context().set_state(gtk.STATE_NORMAL) + self.assertTrue(isinstance(widget.style.base[gtk.STATE_NORMAL], + gtk.gdk.Color)) + + def test_alignment(self): + import gtk + # Creation of pygtk.Alignment causes hard warnings, ignore this in testing. + with capture_glib_warnings(allow_warnings=True): + a = gtk.Alignment() + + self.assertEqual(a.props.xalign, 0.0) + self.assertEqual(a.props.yalign, 0.0) + self.assertEqual(a.props.xscale, 0.0) + self.assertEqual(a.props.yscale, 0.0) + + def test_box(self): + import gtk + box = gtk.Box() + child = gtk.Button() + + box.pack_start(child) + expand, fill, padding, pack_type = box.query_child_packing(child) + self.assertTrue(expand) + self.assertTrue(fill) + self.assertEqual(padding, 0) + self.assertEqual(pack_type, gtk.PACK_START) + + child = gtk.Button() + box.pack_end(child) + expand, fill, padding, pack_type = box.query_child_packing(child) + self.assertTrue(expand) + self.assertTrue(fill) + self.assertEqual(padding, 0) + self.assertEqual(pack_type, gtk.PACK_END) + + def test_combobox_entry(self): + import gtk + liststore = gtk.ListStore(int, str) + liststore.append((1, 'One')) + liststore.append((2, 'Two')) + liststore.append((3, 'Three')) + # might cause a Pango warning, do not break on this + with capture_glib_warnings(allow_warnings=True): + combo = gtk.ComboBoxEntry(model=liststore) + combo.set_text_column(1) + combo.set_active(0) + self.assertEqual(combo.get_text_column(), 1) + self.assertEqual(combo.get_child().get_text(), 'One') + combo = gtk.combo_box_entry_new() + combo.set_model(liststore) + combo.set_text_column(1) + combo.set_active(0) + self.assertEqual(combo.get_text_column(), 1) + self.assertEqual(combo.get_child().get_text(), 'One') + combo = gtk.combo_box_entry_new_with_model(liststore) + combo.set_text_column(1) + combo.set_active(0) + self.assertEqual(combo.get_text_column(), 1) + self.assertEqual(combo.get_child().get_text(), 'One') + + def test_size_request(self): + import gtk + box = gtk.Box() + with capture_gi_deprecation_warnings(): + self.assertEqual(box.size_request(), [0, 0]) + + def test_pixbuf(self): + import gtk.gdk + gtk.gdk.Pixbuf() + + def test_pixbuf_loader(self): + import gtk.gdk + # load a 1x1 pixel PNG from memory + data = base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4n8Dw' + 'HwAGIAJf85Z3XgAAAABJRU5ErkJggg==') + loader = gtk.gdk.PixbufLoader('png') + loader.write(data) + loader.close() + + pixbuf = loader.get_pixbuf() + self.assertEqual(pixbuf.get_width(), 1) + self.assertEqual(pixbuf.get_height(), 1) + + def test_pixbuf_formats(self): + import gtk.gdk + formats = gtk.gdk.pixbuf_get_formats() + self.assertEqual(type(formats[0]), dict) + self.assertTrue('name' in formats[0]) + self.assertTrue('description' in formats[0]) + self.assertTrue('mime_types' in formats[0]) + self.assertEqual(type(formats[0]['extensions']), list) + + def test_gdk_window(self): + import gtk + w = gtk.Window() + w.realize() + origin = w.get_window().get_origin() + self.assertTrue(isinstance(origin, tuple)) + self.assertEqual(len(origin), 2) diff --git a/tests/test_repository.py b/tests/test_repository.py new file mode 100644 index 0000000..4390ff0 --- /dev/null +++ b/tests/test_repository.py @@ -0,0 +1,403 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2013 Simon Feltman +# +# test_repository.py: Test for the GIRepository module +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + + +import unittest +from collections import abc + +import gi._gi as GIRepository +from gi.module import repository as repo +from gi.repository import GObject +from gi.repository import GIMarshallingTests +from gi.repository import GIRepository as IntrospectedRepository + +from .helper import capture_glib_warnings + + +def find_child_info(info, getter_name, name): + getter = getattr(info, getter_name) + for child in getter(): + if child.get_name() == name: + return child + else: + raise ValueError('child info %s not found' % name) + + +class Test(unittest.TestCase): + def setUp(self): + repo.require('GLib') + repo.require('GObject') + repo.require('GIMarshallingTests') + + def test_repo_get_dependencies(self): + self.assertRaises(TypeError, repo.get_dependencies) + self.assertEqual(repo.get_dependencies("GLib"), []) + self.assertEqual(repo.get_dependencies("GObject"), ["GLib-2.0"]) + + def test_repo_is_registered(self): + self.assertRaises(TypeError, repo.is_registered) + self.assertRaises(TypeError, repo.is_registered, None) + self.assertTrue(repo.is_registered("GIRepository")) + self.assertTrue(repo.is_registered("GIRepository", None)) + self.assertTrue(isinstance(repo.is_registered("GIRepository"), bool)) + self.assertTrue(repo.is_registered("GIRepository", "2.0")) + self.assertFalse(repo.is_registered("GIRepository", "")) + self.assertFalse(repo.is_registered("GIRepository", "99.0")) + self.assertFalse(repo.is_registered("GIRepository", "1.0")) + + def test_repo_get_immediate_dependencies(self): + self.assertRaises(TypeError, repo.get_immediate_dependencies) + self.assertEqual(repo.get_immediate_dependencies("GLib"), []) + self.assertEqual( + repo.get_immediate_dependencies("GObject"), ["GLib-2.0"]) + self.assertEqual( + repo.get_immediate_dependencies(namespace="GObject"), ["GLib-2.0"]) + self.assertEqual( + repo.get_immediate_dependencies("GIMarshallingTests"), ["Gio-2.0"]) + + def test_arg_info(self): + func_info = repo.find_by_name('GIMarshallingTests', 'array_fixed_out_struct') + args = func_info.get_arguments() + self.assertTrue(len(args), 1) + + arg = args[0] + self.assertEqual(arg.get_container(), func_info) + self.assertEqual(arg.get_direction(), GIRepository.Direction.OUT) + self.assertEqual(arg.get_name(), 'structs') + self.assertEqual(arg.get_namespace(), 'GIMarshallingTests') + self.assertFalse(arg.is_caller_allocates()) + self.assertFalse(arg.is_optional()) + self.assertFalse(arg.is_return_value()) + self.assertFalse(arg.may_be_null()) + self.assertEqual(arg.get_destroy(), -1) + self.assertEqual(arg.get_ownership_transfer(), GIRepository.Transfer.NOTHING) + self.assertEqual(arg.get_scope(), GIRepository.ScopeType.INVALID) + self.assertEqual(arg.get_type().get_tag(), GIRepository.TypeTag.ARRAY) + + def test_base_info(self): + info = repo.find_by_name('GIMarshallingTests', 'Object') + self.assertEqual(info.__name__, 'Object') + self.assertEqual(info.get_name(), 'Object') + self.assertEqual(info.__module__, 'gi.repository.GIMarshallingTests') + self.assertEqual(info.get_name_unescaped(), 'Object') + self.assertEqual(info.get_namespace(), 'GIMarshallingTests') + self.assertEqual(info.get_container(), None) + info2 = repo.find_by_name('GIMarshallingTests', 'Object') + self.assertFalse(info is info2) + self.assertEqual(info, info2) + self.assertTrue(info.equal(info2)) + assert isinstance(info.is_deprecated(), bool) + assert isinstance(info.get_type(), int) + assert info.get_attribute("nopenope") is None + + def test_object_info(self): + info = repo.find_by_name('GIMarshallingTests', 'Object') + self.assertEqual(info.get_parent(), repo.find_by_name('GObject', 'Object')) + self.assertTrue(isinstance(info.get_methods(), abc.Iterable)) + self.assertTrue(isinstance(info.get_fields(), abc.Iterable)) + self.assertTrue(isinstance(info.get_interfaces(), abc.Iterable)) + self.assertTrue(isinstance(info.get_constants(), abc.Iterable)) + self.assertTrue(isinstance(info.get_vfuncs(), abc.Iterable)) + self.assertTrue(isinstance(info.get_properties(), abc.Iterable)) + self.assertFalse(info.get_abstract()) + self.assertEqual(info.get_class_struct(), repo.find_by_name('GIMarshallingTests', 'ObjectClass')) + self.assertEqual(info.get_type_name(), 'GIMarshallingTestsObject') + self.assertEqual(info.get_type_init(), 'gi_marshalling_tests_object_get_type') + self.assertFalse(info.get_fundamental()) + self.assertEqual(info.get_parent(), repo.find_by_name('GObject', 'Object')) + assert info.find_vfunc("nopenope") is None + vfunc = info.find_vfunc("method_int8_out") + assert isinstance(vfunc, GIRepository.VFuncInfo) + + def test_callable_inheritance(self): + self.assertTrue(issubclass(GIRepository.CallableInfo, GIRepository.BaseInfo)) + self.assertTrue(issubclass(GIRepository.CallbackInfo, GIRepository.CallableInfo)) + self.assertTrue(issubclass(GIRepository.FunctionInfo, GIRepository.CallableInfo)) + self.assertTrue(issubclass(GIRepository.VFuncInfo, GIRepository.CallableInfo)) + self.assertTrue(issubclass(GIRepository.SignalInfo, GIRepository.CallableInfo)) + + def test_registered_type_info(self): + info = repo.find_by_name('GIMarshallingTests', 'Object') + # Call these from the class because GIObjectInfo overrides them + self.assertEqual(GIRepository.RegisteredTypeInfo.get_g_type(info), + GObject.type_from_name('GIMarshallingTestsObject')) + self.assertEqual(GIRepository.RegisteredTypeInfo.get_type_name(info), + 'GIMarshallingTestsObject') + self.assertEqual(GIRepository.RegisteredTypeInfo.get_type_init(info), + 'gi_marshalling_tests_object_get_type') + + def test_fundamental_object_info(self): + repo.require('Regress') + info = repo.find_by_name('Regress', 'TestFundamentalObject') + self.assertTrue(info.get_abstract()) + self.assertTrue(info.get_fundamental()) + self.assertEqual(info.get_ref_function(), 'regress_test_fundamental_object_ref') + self.assertEqual(info.get_unref_function(), 'regress_test_fundamental_object_unref') + self.assertEqual(info.get_get_value_function(), 'regress_test_value_get_fundamental_object') + self.assertEqual(info.get_set_value_function(), 'regress_test_value_set_fundamental_object') + + def test_interface_info(self): + info = repo.find_by_name('GIMarshallingTests', 'Interface') + self.assertTrue(isinstance(info.get_methods(), abc.Iterable)) + self.assertTrue(isinstance(info.get_vfuncs(), abc.Iterable)) + self.assertTrue(isinstance(info.get_constants(), abc.Iterable)) + self.assertTrue(isinstance(info.get_prerequisites(), abc.Iterable)) + self.assertTrue(isinstance(info.get_properties(), abc.Iterable)) + self.assertTrue(isinstance(info.get_signals(), abc.Iterable)) + + method = info.find_method('test_int8_in') + vfunc = info.find_vfunc('test_int8_in') + self.assertEqual(method.get_name(), 'test_int8_in') + self.assertEqual(vfunc.get_invoker(), method) + self.assertEqual(method.get_vfunc(), vfunc) + + iface = info.get_iface_struct() + self.assertEqual(iface, repo.find_by_name('GIMarshallingTests', 'InterfaceIface')) + + assert info.find_signal("nopenope") is None + + def test_struct_info(self): + info = repo.find_by_name('GIMarshallingTests', 'InterfaceIface') + self.assertTrue(isinstance(info, GIRepository.StructInfo)) + self.assertTrue(isinstance(info.get_fields(), abc.Iterable)) + self.assertTrue(isinstance(info.get_methods(), abc.Iterable)) + self.assertTrue(isinstance(info.get_size(), int)) + self.assertTrue(isinstance(info.get_alignment(), int)) + self.assertTrue(info.is_gtype_struct()) + self.assertFalse(info.is_foreign()) + + info = repo.find_by_name('GIMarshallingTests', 'SimpleStruct') + assert info.find_method("nope") is None + assert isinstance(info.find_method("method"), GIRepository.FunctionInfo) + + assert info.find_field("nope") is None + assert isinstance(info.find_field("int8"), GIRepository.FieldInfo) + + def test_enum_info(self): + info = repo.find_by_name('GIMarshallingTests', 'Enum') + self.assertTrue(isinstance(info, GIRepository.EnumInfo)) + self.assertTrue(isinstance(info.get_values(), abc.Iterable)) + self.assertTrue(isinstance(info.get_methods(), abc.Iterable)) + self.assertFalse(info.is_flags()) + self.assertTrue(info.get_storage_type() > 0) # might be platform dependent + + def test_union_info(self): + info = repo.find_by_name('GIMarshallingTests', 'Union') + self.assertTrue(isinstance(info, GIRepository.UnionInfo)) + self.assertTrue(isinstance(info.get_fields(), abc.Iterable)) + self.assertTrue(isinstance(info.get_methods(), abc.Iterable)) + self.assertTrue(isinstance(info.get_size(), int)) + self.assertTrue(isinstance(info.get_alignment(), int)) + + def test_type_info(self): + func_info = repo.find_by_name('GIMarshallingTests', 'array_fixed_out_struct') + arg_info, = func_info.get_arguments() + type_info = arg_info.get_type() + + self.assertTrue(type_info.is_pointer()) + self.assertEqual(type_info.get_tag(), GIRepository.TypeTag.ARRAY) + self.assertEqual(type_info.get_tag_as_string(), 'array') + self.assertEqual(type_info.get_param_type(0).get_tag(), + GIRepository.TypeTag.INTERFACE) + self.assertEqual(type_info.get_param_type(0).get_interface(), + repo.find_by_name('GIMarshallingTests', 'SimpleStruct')) + self.assertEqual(type_info.get_interface(), None) + self.assertEqual(type_info.get_array_length(), -1) + self.assertEqual(type_info.get_array_fixed_size(), 2) + self.assertFalse(type_info.is_zero_terminated()) + self.assertEqual(type_info.get_array_type(), GIRepository.ArrayType.C) + + def test_field_info(self): + info = repo.find_by_name('GIMarshallingTests', 'InterfaceIface') + field = find_child_info(info, 'get_fields', 'test_int8_in') + self.assertEqual(field.get_name(), 'test_int8_in') + self.assertTrue(field.get_flags() & GIRepository.FieldInfoFlags.IS_READABLE) + self.assertFalse(field.get_flags() & GIRepository.FieldInfoFlags.IS_WRITABLE) + self.assertEqual(field.get_type().get_tag(), GIRepository.TypeTag.INTERFACE) + + # don't test actual values because that might fail with architecture differences + self.assertTrue(isinstance(field.get_size(), int)) + self.assertTrue(isinstance(field.get_offset(), int)) + + def test_property_info(self): + info = repo.find_by_name('GIMarshallingTests', 'PropertiesObject') + prop = find_child_info(info, 'get_properties', 'some-object') + + flags = GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE | GObject.ParamFlags.CONSTRUCT + self.assertEqual(prop.get_flags(), flags) + self.assertEqual(prop.get_type().get_tag(), GIRepository.TypeTag.INTERFACE) + self.assertEqual(prop.get_type().get_interface(), + repo.find_by_name('GObject', 'Object')) + self.assertEqual(prop.get_ownership_transfer(), GIRepository.Transfer.NOTHING) + + def test_callable_info(self): + func_info = repo.find_by_name('GIMarshallingTests', 'array_fixed_out_struct') + self.assertTrue(hasattr(func_info, 'invoke')) + self.assertTrue(isinstance(func_info.get_arguments(), abc.Iterable)) + self.assertEqual(func_info.get_caller_owns(), GIRepository.Transfer.NOTHING) + self.assertFalse(func_info.may_return_null()) + self.assertEqual(func_info.get_return_type().get_tag(), GIRepository.TypeTag.VOID) + self.assertRaises(AttributeError, func_info.get_return_attribute, '_not_an_attr') + + def test_signal_info(self): + repo.require('Regress') + info = repo.find_by_name('Regress', 'TestObj') + sig_info = find_child_info(info, 'get_signals', 'test') + + sig_flags = GObject.SignalFlags.RUN_LAST | \ + GObject.SignalFlags.NO_RECURSE | GObject.SignalFlags.NO_HOOKS + + self.assertTrue(sig_info is not None) + self.assertTrue(isinstance(sig_info, GIRepository.CallableInfo)) + self.assertTrue(isinstance(sig_info, GIRepository.SignalInfo)) + self.assertEqual(sig_info.get_name(), 'test') + self.assertEqual(sig_info.get_class_closure(), None) + self.assertFalse(sig_info.true_stops_emit()) + self.assertEqual(sig_info.get_flags(), sig_flags) + + def test_notify_signal_info_with_obj(self): + repo.require('Regress') + info = repo.find_by_name('Regress', 'TestObj') + sig_info = find_child_info(info, 'get_signals', 'sig-with-array-prop') + + sig_flags = GObject.SignalFlags.RUN_LAST + + self.assertTrue(sig_info is not None) + self.assertTrue(isinstance(sig_info, GIRepository.CallableInfo)) + self.assertTrue(isinstance(sig_info, GIRepository.SignalInfo)) + self.assertEqual(sig_info.get_name(), 'sig-with-array-prop') + self.assertEqual(sig_info.get_class_closure(), None) + self.assertFalse(sig_info.true_stops_emit()) + self.assertEqual(sig_info.get_flags(), sig_flags) + + def test_object_constructor(self): + info = repo.find_by_name('GIMarshallingTests', 'Object') + method = find_child_info(info, 'get_methods', 'new') + + self.assertTrue(isinstance(method, GIRepository.CallableInfo)) + self.assertTrue(isinstance(method, GIRepository.FunctionInfo)) + self.assertTrue(method in info.get_methods()) + self.assertEqual(method.get_name(), 'new') + self.assertFalse(method.is_method()) + self.assertTrue(method.is_constructor()) + self.assertEqual(method.get_symbol(), 'gi_marshalling_tests_object_new') + + flags = method.get_flags() + self.assertFalse(flags & GIRepository.FunctionInfoFlags.IS_METHOD) + self.assertTrue(flags & GIRepository.FunctionInfoFlags.IS_CONSTRUCTOR) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.IS_GETTER) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.IS_SETTER) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.WRAPS_VFUNC) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.THROWS) + + def test_method_info(self): + info = repo.find_by_name('GIMarshallingTests', 'Object') + method = find_child_info(info, 'get_methods', 'vfunc_return_value_only') + + self.assertTrue(isinstance(method, GIRepository.CallableInfo)) + self.assertTrue(isinstance(method, GIRepository.FunctionInfo)) + self.assertTrue(method in info.get_methods()) + self.assertEqual(method.get_name(), 'vfunc_return_value_only') + self.assertFalse(method.is_constructor()) + self.assertEqual(method.get_symbol(), 'gi_marshalling_tests_object_vfunc_return_value_only') + self.assertTrue(method.is_method()) + + flags = method.get_flags() + self.assertTrue(flags & GIRepository.FunctionInfoFlags.IS_METHOD) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.IS_CONSTRUCTOR) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.IS_GETTER) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.IS_SETTER) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.WRAPS_VFUNC) + self.assertFalse(flags & GIRepository.FunctionInfoFlags.THROWS) + + def test_vfunc_info(self): + info = repo.find_by_name('GIMarshallingTests', 'Object') + invoker = find_child_info(info, 'get_methods', 'vfunc_return_value_only') + vfunc = find_child_info(info, 'get_vfuncs', 'vfunc_return_value_only') + + self.assertTrue(isinstance(vfunc, GIRepository.CallableInfo)) + self.assertTrue(isinstance(vfunc, GIRepository.VFuncInfo)) + self.assertEqual(vfunc.get_name(), 'vfunc_return_value_only') + self.assertEqual(vfunc.get_invoker(), invoker) + self.assertEqual(invoker, info.find_method('vfunc_return_value_only')) + self.assertEqual(vfunc.get_flags(), 0) + self.assertEqual(vfunc.get_offset(), 0xFFFF) # unknown offset + self.assertEqual(vfunc.get_signal(), None) + + def test_callable_can_throw_gerror(self): + info = repo.find_by_name('GIMarshallingTests', 'Object') + invoker = find_child_info(info, 'get_methods', 'vfunc_meth_with_error') + vfunc = find_child_info(info, 'get_vfuncs', 'vfunc_meth_with_err') + + self.assertTrue(invoker.can_throw_gerror()) + self.assertTrue(vfunc.can_throw_gerror()) + + # Test that args do not include the GError** + self.assertEqual(len(invoker.get_arguments()), 1) + self.assertEqual(len(vfunc.get_arguments()), 1) + + # Sanity check method that does not throw. + invoker_no_throws = find_child_info(info, 'get_methods', 'method_int8_in') + self.assertFalse(invoker_no_throws.can_throw_gerror()) + + def test_flags_double_registration_error(self): + # a warning is printed for double registration and pygobject will + # also raise a RuntimeError. + GIMarshallingTests.NoTypeFlags # cause flags registration + info = repo.find_by_name('GIMarshallingTests', 'NoTypeFlags') + with capture_glib_warnings(allow_warnings=True, allow_criticals=True): + self.assertRaises(RuntimeError, + GIRepository.flags_register_new_gtype_and_add, + info) + + def test_enum_double_registration_error(self): + # a warning is printed for double registration and pygobject will + # also raise a RuntimeError. + GIMarshallingTests.Enum # cause enum registration + info = repo.find_by_name('GIMarshallingTests', 'Enum') + with capture_glib_warnings(allow_warnings=True, allow_criticals=True): + self.assertRaises(RuntimeError, + GIRepository.enum_register_new_gtype_and_add, + info) + + def test_enums(self): + self.assertTrue(hasattr(GIRepository, 'Direction')) + self.assertTrue(hasattr(GIRepository, 'Transfer')) + self.assertTrue(hasattr(GIRepository, 'ArrayType')) + self.assertTrue(hasattr(GIRepository, 'ScopeType')) + self.assertTrue(hasattr(GIRepository, 'VFuncInfoFlags')) + self.assertTrue(hasattr(GIRepository, 'FieldInfoFlags')) + self.assertTrue(hasattr(GIRepository, 'FunctionInfoFlags')) + self.assertTrue(hasattr(GIRepository, 'TypeTag')) + self.assertTrue(hasattr(GIRepository, 'InfoType')) + + def test_introspected_argument_info(self): + self.assertTrue(isinstance(IntrospectedRepository.Argument.__info__, + GIRepository.UnionInfo)) + + arg = IntrospectedRepository.Argument() + self.assertTrue(isinstance(arg.__info__, GIRepository.UnionInfo)) + + old_info = IntrospectedRepository.Argument.__info__ + IntrospectedRepository.Argument.__info__ = 'not an info' + self.assertRaises(TypeError, IntrospectedRepository.Argument) + IntrospectedRepository.Argument.__info__ = old_info diff --git a/tests/test_resulttuple.py b/tests/test_resulttuple.py new file mode 100644 index 0000000..00daa7b --- /dev/null +++ b/tests/test_resulttuple.py @@ -0,0 +1,89 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# Copyright (C) 2015 Christoph Reiter +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +import unittest +import pickle + +import gi +from gi.repository import GIMarshallingTests +from gi.repository import Regress + + +ResultTuple = gi._gi.ResultTuple + + +class TestResultTuple(unittest.TestCase): + + def test_base(self): + self.assertTrue(issubclass(ResultTuple, tuple)) + + def test_create(self): + names = [None, "foo", None, "bar"] + for i in range(10): + new = ResultTuple._new_type(names) + self.assertTrue(issubclass(new, ResultTuple)) + + def test_repr_dir(self): + new = ResultTuple._new_type([None, "foo", None, "bar"]) + inst = new([1, 2, 3, "a"]) + + self.assertEqual(repr(inst), "(1, foo=2, 3, bar='a')") + self.assertTrue("foo" in dir(inst)) + + def test_repr_dir_empty(self): + new = ResultTuple._new_type([]) + inst = new() + self.assertEqual(repr(inst), "()") + dir(inst) + + def test_getatttr(self): + new = ResultTuple._new_type([None, "foo", None, "bar"]) + inst = new([1, 2, 3, "a"]) + + self.assertTrue(hasattr(inst, "foo")) + self.assertEqual(inst.foo, inst[1]) + self.assertRaises(AttributeError, getattr, inst, "nope") + + def test_pickle(self): + new = ResultTuple._new_type([None, "foo", None, "bar"]) + inst = new([1, 2, 3, "a"]) + + inst2 = pickle.loads(pickle.dumps(inst)) + self.assertEqual(inst2, inst) + self.assertTrue(isinstance(inst2, tuple)) + self.assertFalse(isinstance(inst2, new)) + + def test_gi(self): + res = GIMarshallingTests.init_function([]) + self.assertEqual(repr(res), "(True, argv=[])") + + res = GIMarshallingTests.array_return_etc(5, 9) + self.assertEqual(repr(res), "([5, 0, 1, 9], sum=14)") + + res = GIMarshallingTests.array_out_etc(-5, 9) + self.assertEqual(repr(res), "(ints=[-5, 0, 1, 9], sum=4)") + + cb = lambda: (1, 2) + res = GIMarshallingTests.callback_multiple_out_parameters(cb) + self.assertEqual(repr(res), "(a=1.0, b=2.0)") + + def test_regress(self): + res = Regress.TestObj().skip_return_val(50, 42.0, 60, 2, 3) + self.assertEqual(repr(res), "(out_b=51, inout_d=61, out_sum=32)") diff --git a/tests/test_signal.py b/tests/test_signal.py index ec13896..8a935fd 100644 --- a/tests/test_signal.py +++ b/tests/test_signal.py @@ -3,11 +3,16 @@ import gc import unittest import sys +import weakref +import threading +import time + +from gi.repository import GObject, GLib, Regress, Gio +from gi import _signalhelper as signalhelper +from gi.module import repository as repo -from gi.repository import GObject, GLib -from gi._gobject import signalhelper import testhelper -from compathelper import _long +from .helper import capture_glib_warnings, capture_gi_deprecation_warnings class C(GObject.GObject): @@ -74,13 +79,9 @@ class TestGSignalsError(unittest.TestCase): def foo(): class Foo(GObject.GObject): __gsignals__ = {'not-exists': 'override'} - # do not stumble over the warning thrown by GLib - old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_CRITICAL | - GLib.LogLevelFlags.LEVEL_ERROR) - try: + + with capture_glib_warnings(allow_warnings=True): self.assertRaises(TypeError, foo) - finally: - GLib.log_set_always_fatal(old_mask) gc.collect() @@ -136,9 +137,9 @@ class TestAccumulator(unittest.TestCase): inst = Foo() inst.my_acc_signal.connect(lambda obj: 1) inst.my_acc_signal.connect(lambda obj: 2) - ## the value returned in the following handler will not be - ## considered, because at this point the accumulator already - ## reached its limit. + # the value returned in the following handler will not be + # considered, because at this point the accumulator already + # reached its limit. inst.my_acc_signal.connect(lambda obj: 3) retval = inst.my_acc_signal.emit() self.assertEqual(retval, 3) @@ -147,8 +148,8 @@ class TestAccumulator(unittest.TestCase): inst = Foo() inst.my_other_acc_signal.connect(self._true_handler1) inst.my_other_acc_signal.connect(self._true_handler2) - ## the following handler will not be called because handler2 - ## returns True, so it should stop the emission. + # the following handler will not be called because handler2 + # returns True, so it should stop the emission. inst.my_other_acc_signal.connect(self._true_handler3) self.__true_val = None inst.my_other_acc_signal.emit() @@ -327,9 +328,6 @@ class TestMatching(unittest.TestCase): self.assertEqual(obj.status, 2) def test_signal_handler_find(self): - def dummy(*args): - "Hack to work around: " - def foo(obj): obj.status += 1 @@ -340,7 +338,7 @@ class TestMatching(unittest.TestCase): found_id = GObject.signal_handler_find(obj, GObject.SignalMatchType.ID, signal_id=signal_id, detail=detail, - closure=None, func=dummy, data=dummy) + closure=None, func=0, data=0) self.assertEqual(handler_id, found_id) @@ -367,15 +365,10 @@ class TestClosures(unittest.TestCase): self.count += 1 def _callback_invalid_stop_emission_name(self, obj, prop): - # We expect a GLib warning but there currently is no way to test that - # This can at least make sure we don't crash - old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_CRITICAL | - GLib.LogLevelFlags.LEVEL_ERROR) - try: + with capture_glib_warnings(allow_warnings=True, allow_criticals=True) as warn: obj.stop_emission_by_name('notasignal::baddetail') - finally: - GLib.log_set_always_fatal(old_mask) self.emission_error = True + self.assertTrue(warn) def test_disconnect_by_func(self): e = E() @@ -410,7 +403,8 @@ class TestClosures(unittest.TestCase): e = E() e.connect('notify::prop', self._callback_invalid_stop_emission_name) - e.set_property('prop', 1234) + with capture_glib_warnings(): + e.set_property('prop', 1234) self.assertTrue(self.emission_error) def test_handler_block(self): @@ -494,7 +488,8 @@ class SigPropClass(GObject.GObject): (GObject.TYPE_INT,))} __gproperties__ = { - 'foo': (str, None, None, '', GObject.PARAM_WRITABLE | GObject.PARAM_CONSTRUCT), + 'foo': (str, None, None, '', + GObject.ParamFlags.WRITABLE | GObject.ParamFlags.CONSTRUCT), } signal_emission_failed = False @@ -525,7 +520,7 @@ class CM(GObject.GObject): test2=(GObject.SignalFlags.RUN_LAST, None, (str,)), test3=(GObject.SignalFlags.RUN_LAST, int, (GObject.TYPE_DOUBLE,)), test4=(GObject.SignalFlags.RUN_FIRST, None, - (bool, _long, GObject.TYPE_FLOAT, GObject.TYPE_DOUBLE, int, + (bool, int, GObject.TYPE_FLOAT, GObject.TYPE_DOUBLE, int, GObject.TYPE_UINT, GObject.TYPE_ULONG)), test_float=(GObject.SignalFlags.RUN_LAST, GObject.TYPE_FLOAT, (GObject.TYPE_FLOAT,)), test_double=(GObject.SignalFlags.RUN_LAST, GObject.TYPE_DOUBLE, (GObject.TYPE_DOUBLE,)), @@ -557,7 +552,7 @@ class _TestCMarshaller: self.assertEqual(rv, 20) def test_test4(self): - self.obj.emit("test4", True, _long(10), 3.14, 1.78, 20, _long(30), _long(31)) + self.obj.emit("test4", True, 10, 3.14, 1.78, 20, 30, 31) def test_float(self): rv = self.obj.emit("test-float", 1.234) @@ -571,11 +566,11 @@ class _TestCMarshaller: rv = self.obj.emit("test-int64", 102030405) self.assertEqual(rv, 102030405) - rv = self.obj.emit("test-int64", GObject.G_MAXINT64) - self.assertEqual(rv, GObject.G_MAXINT64 - 1) + rv = self.obj.emit("test-int64", GLib.MAXINT64) + self.assertEqual(rv, GLib.MAXINT64 - 1) - rv = self.obj.emit("test-int64", GObject.G_MININT64) - self.assertEqual(rv, GObject.G_MININT64) + rv = self.obj.emit("test-int64", GLib.MININT64) + self.assertEqual(rv, GLib.MININT64) def test_string(self): rv = self.obj.emit("test-string", "str") @@ -621,51 +616,48 @@ class _TestCMarshaller: # explicit float v = GObject.Value(GObject.TYPE_FLOAT, 1.234) rv = self.obj.emit("test-gvalue", v) - self.assertAlmostEqual(rv, 1.234, 4) + self.assertAlmostEqual(rv, 1.234, places=4) # implicit float rv = self.obj.emit("test-gvalue", 1.234) - self.assertAlmostEqual(rv, 1.234, 4) + self.assertAlmostEqual(rv, 1.234, places=4) # explicit int64 - v = GObject.Value(GObject.TYPE_INT64, GObject.G_MAXINT64) + v = GObject.Value(GObject.TYPE_INT64, GLib.MAXINT64) rv = self.obj.emit("test-gvalue", v) - self.assertEqual(rv, GObject.G_MAXINT64) - - # implicit int64 - # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775 - #rv = self.obj.emit("test-gvalue", GObject.G_MAXINT64) - #self.assertEqual(rv, GObject.G_MAXINT64) + self.assertEqual(rv, GLib.MAXINT64) # explicit uint64 - v = GObject.Value(GObject.TYPE_UINT64, GObject.G_MAXUINT64) + v = GObject.Value(GObject.TYPE_UINT64, GLib.MAXUINT64) rv = self.obj.emit("test-gvalue", v) - self.assertEqual(rv, GObject.G_MAXUINT64) + self.assertEqual(rv, GLib.MAXUINT64) + + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=705291 + def test_gvalue_implicit_int64(self): + # implicit int64 + rv = self.obj.emit("test-gvalue", GLib.MAXINT64) + self.assertEqual(rv, GLib.MAXINT64) # implicit uint64 - # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775 - #rv = self.obj.emit("test-gvalue", GObject.G_MAXUINT64) - #self.assertEqual(rv, GObject.G_MAXUINT64) + rv = self.obj.emit("test-gvalue", GLib.MAXUINT64) + self.assertEqual(rv, GLib.MAXUINT64) def test_gvalue_ret(self): self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_INT), - GObject.G_MAXINT) + GLib.MAXINT) self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_UINT), - GObject.G_MAXUINT) + GLib.MAXUINT) self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_INT64), - GObject.G_MAXINT64) + GLib.MAXINT64) self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_UINT64), - GObject.G_MAXUINT64) + GLib.MAXUINT64) self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_STRING), "hello") -if 'generic-c-marshaller' in GObject.features: - class TestCMarshaller(_TestCMarshaller, unittest.TestCase): - pass -else: - print() - print('** WARNING: LIBFFI disabled, not testing') - print() + +class TestCMarshaller(_TestCMarshaller, unittest.TestCase): + pass + # Test for 374653 @@ -697,6 +689,10 @@ class TestSignalDecorator(unittest.TestCase): def pulled(self): self.value -= 1 + @GObject.Signal(flags=GObject.SignalFlags.DETAILED) + def detailed(self): + self.value -= 1 + stomped = GObject.Signal('stomped', arg_types=(int,), doc='this will stomp') unnamed = GObject.Signal() @@ -708,7 +704,6 @@ class TestSignalDecorator(unittest.TestCase): @GObject.SignalOverride def notify(self, *args, **kargs): self.overridden_closure_called = True - #GObject.GObject.notify(self, *args, **kargs) def on_notify(self, obj, prop): self.notify_called = True @@ -719,6 +714,26 @@ class TestSignalDecorator(unittest.TestCase): def onUnnamed(self, obj): self.unnamedCalled = True + def test_disconnect(self): + decorated = self.Decorated() + id_ = decorated.pushed.connect(lambda *args: None) + decorated.pushed.disconnect(id_) + + def test_signal_repr(self): + decorated = self.Decorated() + assert repr(decorated.pushed) == 'BoundSignal("pushed")' + + def test_signal_call(self): + decorated = self.Decorated() + assert decorated.value == 0 + decorated.pushed() + assert decorated.value == 1 + + def test_connect_detailed(self): + decorated = self.Decorated() + id_ = decorated.detailed.connect_detailed(lambda *args: None, "foo") + decorated.pushed.disconnect(id_) + def test_get_signal_args(self): self.assertEqual(self.Decorated.pushed.get_signal_args(), (GObject.SignalFlags.RUN_FIRST, None, tuple(), None, None)) @@ -760,13 +775,12 @@ class TestSignalDecorator(unittest.TestCase): obj.emit('unnamed') self.assertEqual(self.unnamedCalled, True) - def NOtest_overridden_signal(self): + def test_overridden_signal(self): # Test that the pushed signal is called in with super and the override # which should both increment the "value" to 3 obj = self.DecoratedOverride() obj.connect("notify", obj.on_notify) self.assertEqual(obj.value, 0) - #obj.notify.emit() obj.value = 1 self.assertEqual(obj.value, 1) self.assertTrue(obj.overridden_closure_called) @@ -847,6 +861,114 @@ class TestSignalConnectors(unittest.TestCase): self.assertEqual(self.value, 3) +class _ConnectDataTestBase(object): + # Notes: + # - self.Object is overridden in sub-classes. + # - Numeric suffixes indicate the number of user data args passed in. + Object = None + + def run_connect_test(self, emit_args, user_data, flags=0): + obj = self.Object() + callback_args = [] + + def callback(*args): + callback_args.append(args) + return 0 + + obj.connect_data('sig-with-int64-prop', callback, connect_flags=flags, *user_data) + obj.emit('sig-with-int64-prop', *emit_args) + self.assertEqual(len(callback_args), 1) + return callback_args[0] + + def test_0(self): + obj, value = self.run_connect_test([GLib.MAXINT64], user_data=[]) + self.assertIsInstance(obj, self.Object) + self.assertEqual(value, GLib.MAXINT64) + + def test_1(self): + obj, value, data = self.run_connect_test([GLib.MAXINT64], + user_data=['mydata']) + self.assertIsInstance(obj, self.Object) + self.assertEqual(value, GLib.MAXINT64) + self.assertEqual(data, 'mydata') + + def test_after_0(self): + obj, value = self.run_connect_test([GLib.MAXINT64], + user_data=[], + flags=GObject.ConnectFlags.AFTER) + self.assertIsInstance(obj, self.Object) + self.assertEqual(value, GLib.MAXINT64) + + def test_after_1(self): + obj, value, data = self.run_connect_test([GLib.MAXINT64], + user_data=['mydata'], + flags=GObject.ConnectFlags.AFTER) + self.assertIsInstance(obj, self.Object) + self.assertEqual(value, GLib.MAXINT64) + self.assertEqual(data, 'mydata') + + def test_swaped_0(self): + # Swapped only works with a single user data argument. + with self.assertRaises(ValueError): + self.run_connect_test([GLib.MAXINT64], + user_data=[], + flags=GObject.ConnectFlags.SWAPPED) + + def test_swaped_1(self): + # Notice obj and data are reversed in the return. + data, value, obj = self.run_connect_test([GLib.MAXINT64], + user_data=['mydata'], + flags=GObject.ConnectFlags.SWAPPED) + self.assertIsInstance(obj, self.Object) + self.assertEqual(value, GLib.MAXINT64) + self.assertEqual(data, 'mydata') + + def test_swaped_2(self): + # Swapped only works with a single user data argument. + with self.assertRaises(ValueError): + self.run_connect_test([GLib.MAXINT64], + user_data=[1, 2], + flags=GObject.ConnectFlags.SWAPPED) + + def test_after_and_swapped_0(self): + # Swapped only works with a single user data argument. + with self.assertRaises(ValueError): + self.run_connect_test([GLib.MAXINT64], + user_data=[], + flags=GObject.ConnectFlags.AFTER | GObject.ConnectFlags.SWAPPED) + + def test_after_and_swapped_1(self): + # Notice obj and data are reversed in the return. + data, value, obj = self.run_connect_test([GLib.MAXINT64], + user_data=['mydata'], + flags=GObject.ConnectFlags.AFTER | GObject.ConnectFlags.SWAPPED) + self.assertIsInstance(obj, self.Object) + self.assertEqual(value, GLib.MAXINT64) + self.assertEqual(data, 'mydata') + + def test_after_and_swapped_2(self): + # Swapped only works with a single user data argument. + with self.assertRaises(ValueError): + self.run_connect_test([GLib.MAXINT64], + user_data=[], + flags=GObject.ConnectFlags.AFTER | GObject.ConnectFlags.SWAPPED) + + +class TestConnectDataNonIntrospected(unittest.TestCase, _ConnectDataTestBase): + # This tests connect_data with non-introspected signals + # (created in Python in this case). + class Object(GObject.Object): + test = GObject.Signal() + sig_with_int64_prop = GObject.Signal(return_type=GObject.TYPE_INT64, + arg_types=[GObject.TYPE_INT64], + flags=GObject.SignalFlags.RUN_LAST) + + +class TestConnectDataIntrospected(unittest.TestCase, _ConnectDataTestBase): + # This tests connect_data with introspected signals brought in from Regress. + Object = Regress.TestObj + + class TestInstallSignals(unittest.TestCase): # These tests only test how signalhelper.install_signals works # with the __gsignals__ dict and therefore does not need to use @@ -890,29 +1012,16 @@ class TestInstallSignals(unittest.TestCase): self.assertTrue(hasattr(self.Sub2, 'do_sub2test')) -# For this test to work with both python2 and 3 we need to dynamically -# exec the given code due to the new syntax causing an error in python 2. -annotated_class_code = """ -class AnnotatedSignalClass(GObject.GObject): - @GObject.Signal - def sig1(self, a:int, b:float): - pass - - @GObject.Signal(flags=GObject.SignalFlags.RUN_LAST) - def sig2_with_return(self, a:int, b:float) -> str: - return "test" -""" - - -@unittest.skipUnless(sys.version_info >= (3, 0), - 'Argument annotations require Python 3') class TestPython3Signals(unittest.TestCase): - AnnotatedClass = None - def setUp(self): - exec(annotated_class_code, globals(), globals()) - self.assertTrue('AnnotatedSignalClass' in globals()) - self.AnnotatedClass = globals()['AnnotatedSignalClass'] + class AnnotatedClass(GObject.GObject): + @GObject.Signal + def sig1(self, a: int, b: float): + pass + + @GObject.Signal(flags=GObject.SignalFlags.RUN_LAST) + def sig2_with_return(self, a: int, b: float) -> str: + return "test" def test_annotations(self): self.assertEqual(signalhelper.get_signal_annotations(self.AnnotatedClass.sig1.func), @@ -981,5 +1090,473 @@ class TestSignalModuleLevelFunctions(unittest.TestCase): None) -if __name__ == '__main__': - unittest.main() +class TestIntrospectedSignals(unittest.TestCase): + def test_object_param_signal(self): + obj = Regress.TestObj() + + def callback(obj, obj_param): + self.assertEqual(obj_param.props.int, 3) + self.assertGreater(obj_param.__grefcount__, 1) + obj.called = True + + obj.called = False + obj.connect('sig-with-obj', callback) + obj.emit_sig_with_obj() + self.assertTrue(obj.called) + + def test_connect_after(self): + obj = Regress.TestObj() + + def callback(obj, obj_param): + obj.called = True + + obj.called = False + obj.connect_after('sig-with-obj', callback) + obj.emit_sig_with_obj() + self.assertTrue(obj.called) + + def test_int64_param_from_py(self): + obj = Regress.TestObj() + + def callback(obj, i): + obj.callback_i = i + return i + + obj.callback_i = None + obj.connect('sig-with-int64-prop', callback) + rv = obj.emit('sig-with-int64-prop', GLib.MAXINT64) + self.assertEqual(rv, GLib.MAXINT64) + self.assertEqual(obj.callback_i, GLib.MAXINT64) + + def test_uint64_param_from_py(self): + obj = Regress.TestObj() + + def callback(obj, i): + obj.callback_i = i + return i + + obj.callback_i = None + obj.connect('sig-with-uint64-prop', callback) + rv = obj.emit('sig-with-uint64-prop', GLib.MAXUINT64) + self.assertEqual(rv, GLib.MAXUINT64) + self.assertEqual(obj.callback_i, GLib.MAXUINT64) + + def test_int64_param_from_c(self): + obj = Regress.TestObj() + + def callback(obj, i): + obj.callback_i = i + return i + + obj.callback_i = None + + obj.connect('sig-with-int64-prop', callback) + obj.emit_sig_with_int64() + self.assertEqual(obj.callback_i, GLib.MAXINT64) + + def test_uint64_param_from_c(self): + obj = Regress.TestObj() + + def callback(obj, i): + obj.callback_i = i + return i + + obj.callback_i = None + + obj.connect('sig-with-uint64-prop', callback) + obj.emit_sig_with_uint64() + self.assertEqual(obj.callback_i, GLib.MAXUINT64) + + def test_intarray_ret(self): + obj = Regress.TestObj() + + def callback(obj, i): + obj.callback_i = i + return [i, i + 1] + + obj.callback_i = None + + try: + obj.connect('sig-with-intarray-ret', callback) + except TypeError as e: + # compat with g-i 1.34.x + if 'unknown signal' in str(e): + return + raise + + rv = obj.emit('sig-with-intarray-ret', 42) + self.assertEqual(obj.callback_i, 42) + self.assertEqual(type(rv), GLib.Array) + self.assertEqual(rv.len, 2) + + @unittest.skip('https://bugzilla.gnome.org/show_bug.cgi?id=669496') + def test_array_parm(self): + obj = Regress.TestObj() + + def callback(obj, arr): + obj.callback_arr = arr + + obj.connect('sig-with-array-prop', callback) + obj.callback_arr = None + self.assertEqual(obj.emit('sig-with-array-prop', [1, 2, GLib.MAXUINT]), None) + self.assertEqual(obj.callback_arr, [1, 2, GLib.MAXUINT]) + + def test_held_struct_ref(self): + held_structs = [] + + def callback(obj, struct): + # The struct held by Python will become a copy after this callback exits. + struct.some_int = 42 + struct.some_int8 = 42 + held_structs.append(struct) + + struct = Regress.TestSimpleBoxedA() + obj = Regress.TestObj() + + self.assertEqual(struct.some_int, 0) + self.assertEqual(struct.some_int8, 0) + + obj.connect('test-with-static-scope-arg', callback) + obj.emit('test-with-static-scope-arg', struct) + + # The held struct will be a copy of the modified struct. + self.assertEqual(len(held_structs), 1) + held_struct = held_structs[0] + self.assertEqual(held_struct.some_int, 42) + self.assertEqual(held_struct.some_int8, 42) + + # Boxed equality checks pointers by default. + self.assertNotEqual(struct, held_struct) + + def test_action(self): + obj = Regress.TestAction() + other_obj = obj.emit('action') + self.assertEqual(other_obj.__grefcount__, 1) + other_obj2 = obj.emit('action2') + self.assertIsNone(other_obj2) + + +class TestIntrospectedSignalsIssue158(unittest.TestCase): + """ + The test for https://gitlab.gnome.org/GNOME/pygobject/issues/158 + """ + _obj_sig_names = [sig.get_name() for sig in repo.find_by_name('Regress', 'TestObj').get_signals()] + + def __init__(self, *args): + unittest.TestCase.__init__(self, *args) + self._gc_thread_stop = False + + def _gc_thread(self): + while not self._gc_thread_stop: + gc.collect() + time.sleep(0.010) + + def _callback(self, *args): + pass + + def test_run(self): + """ + Manually trigger GC from a different thread periodicaly + while the main thread keeps connecting/disconnecting to/from signals. + + It takes a lot of time to reproduce the issue. It is possible to make it + fail reliably by changing the code of pygobject_unwatch_closure slightly from: + PyGObjectData *inst_data = data; + inst_data->closures = g_slist_remove (inst_data->closures, closure); + to + PyGObjectData *inst_data = data; + GSList *tmp = g_slist_remove (inst_data->closures, closure); + g_usleep(G_USEC_PER_SEC/10); + inst_data->closures = tmp; + """ + obj = Regress.TestObj() + gc_thread = threading.Thread(target=self._gc_thread) + gc_thread.start() + + for _ in range(8): + handlers = [obj.connect(sig, self._callback) for sig in self._obj_sig_names] + time.sleep(0.010) + while len(handlers) > 0: + obj.disconnect(handlers.pop()) + + self._gc_thread_stop = True + gc_thread.join() + + +class _ConnectObjectTestBase(object): + # Notes: + # - self.Object is overridden in sub-classes. + # - Numeric suffixes indicate the number of user data args passed in. + Object = None + SwapObject = None + + def run_connect_test(self, emit_args, user_data, flags=0): + obj = self.Object() + callback_args = [] + swap_obj = self.SwapObject() + + def callback(*args): + callback_args.append(args) + return 0 + + if flags & GObject.ConnectFlags.AFTER: + connect_func = obj.connect_object_after + else: + connect_func = obj.connect_object + + with capture_gi_deprecation_warnings(): + connect_func('sig-with-int64-prop', callback, swap_obj, *user_data) + obj.emit('sig-with-int64-prop', *emit_args) + self.assertEqual(len(callback_args), 1) + return callback_args[0] + + def test_0(self): + obj, value = self.run_connect_test([GLib.MAXINT64], user_data=[]) + self.assertIsInstance(obj, self.SwapObject) + self.assertEqual(value, GLib.MAXINT64) + + def test_1(self): + obj, value, data = self.run_connect_test([GLib.MAXINT64], + user_data=['mydata']) + self.assertIsInstance(obj, self.SwapObject) + self.assertEqual(value, GLib.MAXINT64) + self.assertEqual(data, 'mydata') + + def test_2(self): + obj, value, data1, data2 = self.run_connect_test([GLib.MAXINT64], + user_data=['mydata1', 'mydata2']) + self.assertIsInstance(obj, self.SwapObject) + self.assertEqual(value, GLib.MAXINT64) + self.assertEqual(data1, 'mydata1') + self.assertEqual(data2, 'mydata2') + + def test_after_0(self): + obj, value = self.run_connect_test([GLib.MAXINT64], + user_data=[], + flags=GObject.ConnectFlags.AFTER) + self.assertIsInstance(obj, self.SwapObject) + self.assertEqual(value, GLib.MAXINT64) + + def test_after_1(self): + obj, value, data = self.run_connect_test([GLib.MAXINT64], + user_data=['mydata'], + flags=GObject.ConnectFlags.AFTER) + self.assertIsInstance(obj, self.SwapObject) + self.assertEqual(value, GLib.MAXINT64) + self.assertEqual(data, 'mydata') + + def test_after_2(self): + obj, value, data1, data2 = self.run_connect_test([GLib.MAXINT64], + user_data=['mydata1', 'mydata2'], + flags=GObject.ConnectFlags.AFTER) + self.assertIsInstance(obj, self.SwapObject) + self.assertEqual(value, GLib.MAXINT64) + self.assertEqual(data1, 'mydata1') + self.assertEqual(data2, 'mydata2') + + +class TestConnectGObjectNonIntrospected(unittest.TestCase, _ConnectObjectTestBase): + # This tests connect_object with non-introspected signals + # (created in Python in this case). + class Object(GObject.Object): + test = GObject.Signal() + sig_with_int64_prop = GObject.Signal(return_type=GObject.TYPE_INT64, + arg_types=[GObject.TYPE_INT64], + flags=GObject.SignalFlags.RUN_LAST) + + # Object passed for swapping is GObject based. + class SwapObject(GObject.Object): + pass + + +class TestConnectGObjectIntrospected(unittest.TestCase, _ConnectObjectTestBase): + # This tests connect_object with introspected signals brought in from Regress. + Object = Regress.TestObj + + # Object passed for swapping is GObject based. + class SwapObject(GObject.Object): + pass + + +class TestConnectPyObjectNonIntrospected(unittest.TestCase, _ConnectObjectTestBase): + # This tests connect_object with non-introspected signals + # (created in Python in this case). + class Object(GObject.Object): + test = GObject.Signal() + sig_with_int64_prop = GObject.Signal(return_type=GObject.TYPE_INT64, + arg_types=[GObject.TYPE_INT64], + flags=GObject.SignalFlags.RUN_LAST) + + # Object passed for swapping is pure Python + SwapObject = object + + +class TestConnectPyObjectIntrospected(unittest.TestCase, _ConnectObjectTestBase): + # This tests connect_object with introspected signals brought in from Regress. + Object = Regress.TestObj + + # Object passed for swapping is pure Python + SwapObject = object + + +class _RefCountTestBase(object): + # NOTE: ref counts are always one more than expected because the getrefcount() + # function adds a ref for the input argument. + + # Sub-classes set this + Object = None + + class PyData(object): + pass + + @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount") + def test_callback_ref_count_del(self): + def callback(obj, value): + return value // 2 + + callback_ref = weakref.ref(callback) + self.assertEqual(sys.getrefcount(callback), 2) + + obj = self.Object() + obj.connect('sig-with-int64-prop', callback) + self.assertEqual(sys.getrefcount(callback), 3) + + del callback + self.assertEqual(sys.getrefcount(callback_ref()), 2) + + res = obj.emit('sig-with-int64-prop', 42) + self.assertEqual(res, 21) + self.assertEqual(sys.getrefcount(callback_ref), 2) + + del obj + self.assertIsNone(callback_ref()) + + @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount") + def test_callback_ref_count_disconnect(self): + def callback(obj, value): + return value // 2 + + callback_ref = weakref.ref(callback) + self.assertEqual(sys.getrefcount(callback), 2) + + obj = self.Object() + handler_id = obj.connect('sig-with-int64-prop', callback) + self.assertEqual(sys.getrefcount(callback), 3) + + del callback + self.assertEqual(sys.getrefcount(callback_ref()), 2) + + res = obj.emit('sig-with-int64-prop', 42) + self.assertEqual(res, 21) + self.assertEqual(sys.getrefcount(callback_ref), 2) + + obj.disconnect(handler_id) + self.assertIsNone(callback_ref()) + + @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount") + def test_callback_ref_count_disconnect_by_func(self): + def callback(obj, value): + return value // 2 + + callback_ref = weakref.ref(callback) + self.assertEqual(sys.getrefcount(callback), 2) + + obj = self.Object() + obj.connect('sig-with-int64-prop', callback) + self.assertEqual(sys.getrefcount(callback), 3) + + del callback + self.assertEqual(sys.getrefcount(callback_ref()), 2) + + res = obj.emit('sig-with-int64-prop', 42) + self.assertEqual(res, 21) + self.assertEqual(sys.getrefcount(callback_ref), 2) + + obj.disconnect_by_func(callback_ref()) + self.assertIsNone(callback_ref()) + + @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount") + def test_user_data_ref_count(self): + def callback(obj, value, data): + return value // 2 + + data = self.PyData() + data_ref = weakref.ref(data) + self.assertEqual(sys.getrefcount(data), 2) + + obj = self.Object() + obj.connect('sig-with-int64-prop', callback, data) + self.assertEqual(sys.getrefcount(data), 3) + + del data + self.assertEqual(sys.getrefcount(data_ref()), 2) + + res = obj.emit('sig-with-int64-prop', 42) + self.assertEqual(res, 21) + self.assertEqual(sys.getrefcount(data_ref()), 2) + + del obj + self.assertIsNone(data_ref()) + + @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount") + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=688064 + def test_object_ref_count(self): + # connect_object() should only weakly reference the object passed in + # and auto-disconnect the signal when the object is destroyed. + def callback(data, value): + return value // 2 + + data = GObject.Object() + data_ref = weakref.ref(data) + self.assertEqual(sys.getrefcount(data), 2) + + obj = self.Object() + handler_id = obj.connect_object('sig-with-int64-prop', callback, data) + self.assertEqual(sys.getrefcount(data), 2) + + res = obj.emit('sig-with-int64-prop', 42) + self.assertEqual(res, 21) + self.assertEqual(sys.getrefcount(data), 2) + + del data + + self.assertIsNone(data_ref()) + self.assertFalse(obj.handler_is_connected(handler_id)) + + +class TestRefCountsNonIntrospected(unittest.TestCase, _RefCountTestBase): + class Object(GObject.Object): + sig_with_int64_prop = GObject.Signal(return_type=GObject.TYPE_INT64, + arg_types=[GObject.TYPE_INT64], + flags=GObject.SignalFlags.RUN_LAST) + + +class TestRefCountsIntrospected(unittest.TestCase, _RefCountTestBase): + Object = Regress.TestObj + + +class TestClosureRefCycle(unittest.TestCase): + + def test_closure_ref_cycle_unreachable(self): + # https://bugzilla.gnome.org/show_bug.cgi?id=731501 + + called = [] + + def on_add(store, *args): + called.append(store) + + store = Gio.ListStore() + store.connect_object('items-changed', on_add, store) + + # Remove all Python references to the object and keep it alive + # on the C level. + x = Gio.FileInfo() + x.set_attribute_object('store', store) + del store + gc.collect() + + # get it back and trigger the signal + x.get_attribute_object('store').append(Gio.FileInfo()) + + self.assertEqual(len(called), 1) + self.assertTrue(called[0].__grefcount__ > 0) diff --git a/tests/test_source.py b/tests/test_source.py index d0e28e4..9249892 100644 --- a/tests/test_source.py +++ b/tests/test_source.py @@ -1,11 +1,15 @@ # -*- Mode: Python -*- +import sys +import gc import unittest import warnings -from gi.repository import GLib, GObject +from gi.repository import GLib from gi import PyGIDeprecationWarning +from .helper import capture_glib_warnings + class Idle(GLib.Idle): def __init__(self, loop): @@ -123,18 +127,24 @@ class TestSource(unittest.TestCase): return s s = f() + gc.collect() + gc.collect() self.assertTrue(s.is_destroyed()) def test_remove(self): s = GLib.idle_add(dir) self.assertEqual(GLib.source_remove(s), True) - # s is now removed, should fail now - self.assertEqual(GLib.source_remove(s), False) - # accepts large source IDs (they are unsigned) - self.assertEqual(GLib.source_remove(GObject.G_MAXINT32), False) - self.assertEqual(GLib.source_remove(GObject.G_MAXINT32 + 1), False) - self.assertEqual(GLib.source_remove(GObject.G_MAXUINT32), False) + # Removing sources not found cause critical + with capture_glib_warnings(allow_criticals=True): + + # s is now removed, should fail now + self.assertEqual(GLib.source_remove(s), False) + + # accepts large source IDs (they are unsigned) + self.assertEqual(GLib.source_remove(GLib.MAXINT32), False) + self.assertEqual(GLib.source_remove(GLib.MAXINT32 + 1), False) + self.assertEqual(GLib.source_remove(GLib.MAXUINT32), False) def test_recurse_property(self): s = GLib.Idle() @@ -183,6 +193,7 @@ class TestSource(unittest.TestCase): GLib.Timeout(20) GLib.Idle() + @unittest.skipIf(sys.platform == "darwin", "hangs") def test_finalize(self): self.dispatched = False self.finalized = False @@ -199,8 +210,7 @@ class TestSource(unittest.TestCase): self.finalized = True source = S() - id = source.attach() - print('source id:', id) + source.attach() self.assertFalse(self.finalized) self.assertFalse(source.is_destroyed()) @@ -212,8 +222,48 @@ class TestSource(unittest.TestCase): self.assertFalse(self.finalized) self.assertTrue(source.is_destroyed()) del source + gc.collect() + gc.collect() self.assertTrue(self.finalized) + def test_python_unref_with_active_source(self): + # Tests a Python derived Source which is free'd in the context of + # Python, but which was attached to a MainContext (via source.attach()) + self.dispatched = False + self.finalized = False + + class S(GLib.Source): + def prepare(s): + return (True, 1) + + def check(s): + pass + + def dispatch(s, callback, args): + self.dispatched = True + return False + + def finalize(s): + self.finalized = True + + context = GLib.MainContext.new() + source = S() + id_ = source.attach(context) + self.assertFalse(self.finalized) + self.assertFalse(source.is_destroyed()) + + # Delete the source from Python, it should detach + del source + gc.collect() + gc.collect() + + while context.iteration(may_block=False): + pass + + assert self.finalized + assert not self.dispatched + assert context.find_source_by_id(id_) is None + def test_extra_init_args(self): class SourceWithInitArgs(GLib.Source): def __init__(self, arg, kwarg=None): @@ -226,6 +276,7 @@ class TestSource(unittest.TestCase): self.assertEqual(source.kwarg, 2) +@unittest.skipIf(sys.platform == "darwin", "hangs") class TestUserData(unittest.TestCase): def test_idle_no_data(self): ml = GLib.MainLoop() @@ -242,7 +293,7 @@ class TestUserData(unittest.TestCase): def cb(): ml.quit() - id = GLib.timeout_add(50, cb) + id = GLib.timeout_add(1, cb) self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_DEFAULT) ml.run() @@ -282,7 +333,7 @@ class TestUserData(unittest.TestCase): data['called'] = True ml.quit() data = {} - id = GLib.timeout_add(50, cb, data) + id = GLib.timeout_add(1, cb, data) self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_DEFAULT) ml.run() @@ -296,7 +347,7 @@ class TestUserData(unittest.TestCase): data['data2'] = data2 ml.quit() data = {} - id = GLib.timeout_add(50, cb, data, 'hello') + id = GLib.timeout_add(1, cb, data, 'hello') self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_DEFAULT) ml.run() @@ -318,7 +369,7 @@ class TestUserData(unittest.TestCase): def cb(): ml.quit() - id = GLib.timeout_add(50, cb, priority=GLib.PRIORITY_HIGH) + id = GLib.timeout_add(1, cb, priority=GLib.PRIORITY_HIGH) self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_HIGH) ml.run() @@ -343,7 +394,7 @@ class TestUserData(unittest.TestCase): data['called'] = True ml.quit() data = {} - id = GLib.timeout_add(50, cb, data, priority=GLib.PRIORITY_HIGH) + id = GLib.timeout_add(1, cb, data, priority=GLib.PRIORITY_HIGH) self.assertEqual(ml.get_context().find_source_by_id(id).priority, GLib.PRIORITY_HIGH) ml.run() @@ -367,7 +418,3 @@ class TestUserData(unittest.TestCase): GLib.idle_add(self.cb_with_data, data) self.loop.run() self.assertTrue(data['called']) - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py index ef4c35e..274a501 100644 --- a/tests/test_subprocess.py +++ b/tests/test_subprocess.py @@ -5,75 +5,91 @@ import os import unittest import warnings +import pytest + from gi.repository import GLib from gi import PyGIDeprecationWarning +from .helper import capture_gi_deprecation_warnings + + +def test_child_watch_add_get_args_various(): + cb = lambda pid, status: None + get_args = GLib._child_watch_add_get_args + pid = 42 + with capture_gi_deprecation_warnings(): + assert get_args(pid, cb, 2) == (0, pid, cb, (2,)) + + with pytest.raises(TypeError): + get_args(pid, cb, 2, 3, 4) + + assert get_args(0, pid, 2, 3, function=cb) == (0, pid, cb, (2, 3)) + assert get_args(0, pid, cb, 2, 3) == (0, pid, cb, (2, 3)) + assert get_args(0, pid, cb, data=99) == (0, pid, cb, (99,)) + with pytest.raises(TypeError): + get_args(0, pid, 24) + + with pytest.raises(TypeError): + get_args(0, pid, cb, 2, 3, data=99) + + +@unittest.skipIf(os.name == "nt", "not on Windows") class TestProcess(unittest.TestCase): def test_deprecated_child_watch_no_data(self): - def cb(pid, status): - self.status = status - self.loop.quit() - - self.status = None - self.loop = GLib.MainLoop() - argv = [sys.executable, '-c', 'import sys'] - pid, stdin, stdout, stderr = GLib.spawn_async( - argv, flags=GLib.SpawnFlags.DO_NOT_REAP_CHILD) - pid.close() + cb = lambda pid, status: None + pid = object() with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') - GLib.child_watch_add(pid, cb) + res = GLib._child_watch_add_get_args(pid, cb) self.assertTrue(issubclass(w[0].category, PyGIDeprecationWarning)) - self.loop.run() - self.assertEqual(self.status, 0) - def test_deprecated_child_watch_data_priority(self): - def cb(pid, status, data): - self.data = data - self.status = status - self.loop.quit() + self.assertEqual(len(res), 4) + self.assertEqual(res[0], GLib.PRIORITY_DEFAULT) + self.assertEqual(res[1], pid) + self.assertTrue(callable(cb)) + self.assertSequenceEqual(res[3], []) - self.status = None - self.data = None - self.loop = GLib.MainLoop() - argv = [sys.executable, '-c', 'import sys'] - pid, stdin, stdout, stderr = GLib.spawn_async( - argv, flags=GLib.SpawnFlags.DO_NOT_REAP_CHILD) - pid.close() + def test_deprecated_child_watch_data_priority(self): + cb = lambda pid, status: None + pid = object() with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') - id = GLib.child_watch_add(pid, cb, 12345, GLib.PRIORITY_HIGH) + res = GLib._child_watch_add_get_args(pid, cb, 12345, GLib.PRIORITY_HIGH) self.assertTrue(issubclass(w[0].category, PyGIDeprecationWarning)) - self.assertEqual(self.loop.get_context().find_source_by_id(id).priority, - GLib.PRIORITY_HIGH) - self.loop.run() - self.assertEqual(self.data, 12345) - self.assertEqual(self.status, 0) - def test_deprecated_child_watch_data_priority_kwargs(self): - def cb(pid, status, data): - self.data = data - self.status = status - self.loop.quit() + self.assertEqual(len(res), 4) + self.assertEqual(res[0], GLib.PRIORITY_HIGH) + self.assertEqual(res[1], pid) + self.assertEqual(res[2], cb) + self.assertSequenceEqual(res[3], [12345]) - self.status = None - self.data = None - self.loop = GLib.MainLoop() - argv = [sys.executable, '-c', 'import sys'] - pid, stdin, stdout, stderr = GLib.spawn_async( - argv, flags=GLib.SpawnFlags.DO_NOT_REAP_CHILD) - pid.close() + def test_deprecated_child_watch_data_priority_kwargs(self): + cb = lambda pid, status: None + pid = object() with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') - id = GLib.child_watch_add(pid, cb, priority=GLib.PRIORITY_HIGH, data=12345) + res = GLib._child_watch_add_get_args(pid, cb, priority=GLib.PRIORITY_HIGH, data=12345) self.assertTrue(issubclass(w[0].category, PyGIDeprecationWarning)) - self.assertEqual(self.loop.get_context().find_source_by_id(id).priority, - GLib.PRIORITY_HIGH) - self.loop.run() - self.assertEqual(self.data, 12345) - self.assertEqual(self.status, 0) + + self.assertEqual(len(res), 4) + self.assertEqual(res[0], GLib.PRIORITY_HIGH) + self.assertEqual(res[1], pid) + self.assertEqual(res[2], cb) + self.assertSequenceEqual(res[3], [12345]) + + @unittest.expectedFailure # using keyword args is fully supported by PyGObject machinery + def test_child_watch_all_kwargs(self): + cb = lambda pid, status: None + pid = object() + + res = GLib._child_watch_add_get_args(priority=GLib.PRIORITY_HIGH, pid=pid, function=cb, data=12345) + self.assertEqual(len(res), 4) + self.assertEqual(res[0], GLib.PRIORITY_HIGH) + self.assertEqual(res[1], pid) + self.assertEqual(res[2], cb) + self.assertSequenceEqual(res[3], [12345]) def test_child_watch_no_data(self): def cb(pid, status): @@ -130,6 +146,23 @@ class TestProcess(unittest.TestCase): self.assertEqual(out, b'hello world!\n') self.assertEqual(err, b'') + def test_spawn_async_with_pipes(self): + res, pid, stdin, stdout, stderr = GLib.spawn_async_with_pipes( + working_directory=None, + argv=['cat'], + envp=None, + flags=GLib.SpawnFlags.SEARCH_PATH) + + os.write(stdin, b'hello world!\n') + os.close(stdin) + out = os.read(stdout, 50) + os.close(stdout) + err = os.read(stderr, 50) + os.close(stderr) + GLib.spawn_close_pid(pid) + self.assertEqual(out, b'hello world!\n') + self.assertEqual(err, b'') + def test_spawn_async_envp(self): pid, stdin, stdout, stderr = GLib.spawn_async( ['sh', '-c', 'echo $TEST_VAR'], ['TEST_VAR=moo!'], @@ -142,5 +175,8 @@ class TestProcess(unittest.TestCase): self.assertEqual(out, b'moo!\n') def test_backwards_compat_flags(self): - self.assertEqual(GLib.SpawnFlags.DO_NOT_REAP_CHILD, - GLib.SPAWN_DO_NOT_REAP_CHILD) + with warnings.catch_warnings(): + warnings.simplefilter('ignore', PyGIDeprecationWarning) + + self.assertEqual(GLib.SpawnFlags.DO_NOT_REAP_CHILD, + GLib.SPAWN_DO_NOT_REAP_CHILD) diff --git a/tests/test_thread.py b/tests/test_thread.py index 3d0557e..8c2d639 100644 --- a/tests/test_thread.py +++ b/tests/test_thread.py @@ -1,19 +1,23 @@ # -*- Mode: Python -*- import unittest -import testhelper from gi.repository import GLib +import testhelper + class TestThread(unittest.TestCase): def setUp(self): self.main = GLib.MainLoop() + self.called = False def from_thread_cb(self, test, enum): assert test == self.obj assert int(enum) == 0 - assert type(enum) != int + assert type(enum) is not int + self.called = True + GLib.idle_add(self.timeout_cb) def idle_cb(self): self.obj = testhelper.get_test_thread() @@ -22,8 +26,9 @@ class TestThread(unittest.TestCase): def test_extension_module(self): GLib.idle_add(self.idle_cb) - GLib.timeout_add(50, self.timeout_cb) + GLib.timeout_add(2000, self.timeout_cb) self.main.run() + self.assertTrue(self.called) def timeout_cb(self): self.main.quit() diff --git a/tests/test_typeclass.py b/tests/test_typeclass.py new file mode 100644 index 0000000..1f34a09 --- /dev/null +++ b/tests/test_typeclass.py @@ -0,0 +1,76 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# vim: tabstop=4 shiftwidth=4 expandtab +# +# test_typeclass.py: Tests for GTypeClass related methods and marshalling. +# +# Copyright (C) 2014 Simon Feltman +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +# USA + +import unittest + +from gi.repository import GObject +from gi.repository import GIMarshallingTests + + +class TestCoercion(unittest.TestCase): + def test_coerce_from_class(self): + prop = GObject.ObjectClass.find_property(GIMarshallingTests.PropertiesObject, + 'some-int') + + self.assertIsInstance(prop, GObject.GParamSpec) + self.assertEqual(prop.name, 'some-int') + self.assertEqual(prop.value_type, GObject.TYPE_INT) + self.assertEqual(prop.owner_type, + GIMarshallingTests.PropertiesObject.__gtype__) + + def test_coerce_from_gtype(self): + gtype = GIMarshallingTests.PropertiesObject.__gtype__ + prop = GObject.ObjectClass.find_property(gtype, 'some-int') + + self.assertIsInstance(prop, GObject.GParamSpec) + self.assertEqual(prop.name, 'some-int') + self.assertEqual(prop.value_type, GObject.TYPE_INT) + self.assertEqual(prop.owner_type, gtype) + + def test_coerce_from_instance(self): + obj = GIMarshallingTests.PropertiesObject() + prop = GObject.ObjectClass.find_property(obj, 'some-int') + + self.assertIsInstance(prop, GObject.GParamSpec) + self.assertEqual(prop.name, 'some-int') + self.assertEqual(prop.value_type, GObject.TYPE_INT) + self.assertEqual(prop.owner_type, obj.__gtype__) + + def test_marshalling_error(self): + with self.assertRaises(TypeError): + GObject.ObjectClass.find_property(object, 'some-int') + + with self.assertRaises(TypeError): + GObject.ObjectClass.find_property(42, 'some-int') + + +class TestTypeClassMethodsMovedToClass(unittest.TestCase): + def test_list_child_properties(self): + pspecs = GIMarshallingTests.PropertiesObject.list_properties() + pnames = [pspec.name for pspec in pspecs] + self.assertTrue('some-int' in pnames) + self.assertTrue('some-float' in pnames) + self.assertTrue('some-char' in pnames) + + def test_find_child_property(self): + pspec = GIMarshallingTests.PropertiesObject.find_property('some-int') + self.assertEqual(pspec.name, 'some-int') diff --git a/tests/test_unknown.py b/tests/test_unknown.py new file mode 100644 index 0000000..76fa185 --- /dev/null +++ b/tests/test_unknown.py @@ -0,0 +1,29 @@ +# -*- Mode: Python -*- + +import unittest + +from gi.repository import GObject + +import testhelper + + +TestInterface = GObject.GType.from_name('TestInterface') + + +class TestUnknown(unittest.TestCase): + def test_unknown_interface(self): + obj = testhelper.get_unknown() + TestUnknownGType = GObject.GType.from_name('TestUnknown') + TestUnknown = GObject.new(TestUnknownGType).__class__ + assert isinstance(obj, testhelper.Interface) + assert isinstance(obj, TestUnknown) + + def test_property(self): + obj = testhelper.get_unknown() + self.assertEqual(obj.get_property('some-property'), None) + obj.set_property('some-property', 'foo') + + def test_unknown_property(self): + obj = testhelper.get_unknown() + self.assertRaises(TypeError, obj.get_property, 'unknown') + self.assertRaises(TypeError, obj.set_property, 'unknown', '1') diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c index 9b198c3..eb17af8 100644 --- a/tests/testhelpermodule.c +++ b/tests/testhelpermodule.c @@ -5,7 +5,12 @@ #include "test-unknown.h" #include "test-floating.h" -#include +#define PYGI_DEFINE_TYPE(typename, symbol, csymbol) \ +PyTypeObject symbol = { \ + PyVarObject_HEAD_INIT(NULL, 0) \ + typename, \ + sizeof(csymbol) \ +}; static PyObject * _wrap_TestInterface__do_iface_method(PyObject *cls, PyObject *args, @@ -29,8 +34,8 @@ test_type_get_type(void) type_info = (GTypeInfo *)g_new0(GTypeInfo, 1); g_type_query(parent_type, &query); - type_info->class_size = query.class_size; - type_info->instance_size = query.instance_size; + type_info->class_size = (guint16)query.class_size; + type_info->instance_size = (guint16)query.instance_size; gtype = g_type_register_static(parent_type, "TestType", type_info, 0); @@ -82,7 +87,7 @@ _wrap_test_g_object_new (PyObject * self) PyObject *rv; obj = g_object_new(g_type_from_name("PyGObject"), NULL); - rv = PYGLIB_PyLong_FromLong(obj->ref_count); /* should be == 2 at this point */ + rv = PyLong_FromLong(obj->ref_count); /* should be == 2 at this point */ g_object_unref(obj); return rv; } @@ -111,7 +116,7 @@ static const PyMethodDef _PyTestInterface_methods[] = { }; /* TestInterface */ -PYGLIB_DEFINE_TYPE("test.Interface", PyTestInterface_Type, PyObject); +PYGI_DEFINE_TYPE("test.Interface", PyTestInterface_Type, PyObject); static PyObject * _wrap_TestInterface__do_iface_method(PyObject *cls, PyObject *args, PyObject *kwargs) @@ -136,7 +141,7 @@ _wrap_TestInterface__do_iface_method(PyObject *cls, PyObject *args, PyObject *kw return Py_None; } -PYGLIB_DEFINE_TYPE("testhelper.Unknown", PyTestUnknown_Type, PyGObject); +PYGI_DEFINE_TYPE("testhelper.Unknown", PyTestUnknown_Type, PyGObject); static void _wrap_TestInterface__proxy_do_iface_method(TestInterface *self) @@ -147,12 +152,12 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self) PyObject *py_args; PyObject *py_method; - __py_state = pyg_gil_state_ensure(); + __py_state = PyGILState_Ensure(); py_self = pygobject_new((GObject *) self); if (!py_self) { if (PyErr_Occurred()) PyErr_Print(); - pyg_gil_state_release(__py_state); + PyGILState_Release(__py_state); return; } py_args = PyTuple_New(0); @@ -162,7 +167,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self) PyErr_Print(); Py_DECREF(py_args); Py_DECREF(py_self); - pyg_gil_state_release(__py_state); + PyGILState_Release(__py_state); return; } py_retval = PyObject_CallObject(py_method, py_args); @@ -172,7 +177,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self) Py_DECREF(py_method); Py_DECREF(py_args); Py_DECREF(py_self); - pyg_gil_state_release(__py_state); + PyGILState_Release(__py_state); return; } if (py_retval != Py_None) { @@ -183,7 +188,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self) Py_DECREF(py_method); Py_DECREF(py_args); Py_DECREF(py_self); - pyg_gil_state_release(__py_state); + PyGILState_Release(__py_state); return; } @@ -191,7 +196,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self) Py_DECREF(py_method); Py_DECREF(py_args); Py_DECREF(py_self); - pyg_gil_state_release(__py_state); + PyGILState_Release(__py_state); } static void @@ -222,10 +227,10 @@ static const GInterfaceInfo __TestInterface__iinfo = { }; /* TestFloating */ -PYGLIB_DEFINE_TYPE("testhelper.Floating", PyTestFloating_Type, PyGObject); +PYGI_DEFINE_TYPE("testhelper.Floating", PyTestFloating_Type, PyGObject); /* TestOwnedByLibrary */ -PYGLIB_DEFINE_TYPE("testhelper.OwnedByLibrary", PyTestOwnedByLibrary_Type, PyGObject); +PYGI_DEFINE_TYPE("testhelper.OwnedByLibrary", PyTestOwnedByLibrary_Type, PyGObject); static PyObject * _wrap_test_owned_by_library_release (PyGObject *self) @@ -240,7 +245,7 @@ static const PyMethodDef _PyTestOwnedByLibrary_methods[] = { }; /* TestFloatingAndSunk */ -PYGLIB_DEFINE_TYPE("testhelper.FloatingAndSunk", PyTestFloatingAndSunk_Type, PyGObject); +PYGI_DEFINE_TYPE("testhelper.FloatingAndSunk", PyTestFloatingAndSunk_Type, PyGObject); static PyObject * _wrap_test_floating_and_sunk_release (PyGObject *self) @@ -357,11 +362,12 @@ test_paramspec_callback (GObject *object) static GValue * test_gvalue_callback (GObject *object, const GValue *v) { - GValue *ret = g_malloc0 (sizeof (GValue)); + GValue *ret; g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (G_IS_VALUE (v), NULL); + ret = g_malloc0 (sizeof (GValue)); g_value_init (ret, G_VALUE_TYPE (v)); g_value_copy (v, ret); return ret; @@ -370,10 +376,11 @@ test_gvalue_callback (GObject *object, const GValue *v) static GValue * test_gvalue_ret_callback (GObject *object, GType type) { - GValue *ret = g_malloc0 (sizeof (GValue)); + GValue *ret; g_return_val_if_fail (G_IS_OBJECT (object), NULL); + ret = g_malloc0 (sizeof (GValue)); g_value_init (ret, type); switch (type) { @@ -505,6 +512,17 @@ _wrap_test_value(PyObject *self, PyObject *args) } static PyObject * +_wrap_test_state_ensure_release(PyObject *self, PyObject *args) +{ + int state = pyg_gil_state_ensure (); + pyg_gil_state_release (state); + + Py_RETURN_NONE; +} + +#define PYGI_TYPE_VALUE_ARRAY (g_value_array_get_type()) + +static PyObject * _wrap_test_value_array(PyObject *self, PyObject *args) { GValue tvalue = {0,}, *value = &tvalue; @@ -513,7 +531,10 @@ _wrap_test_value_array(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; - g_value_init(value, G_TYPE_VALUE_ARRAY); + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + g_value_init(value, PYGI_TYPE_VALUE_ARRAY); + G_GNUC_END_IGNORE_DEPRECATIONS + if (pyg_value_from_pyobject(value, obj)) { PyErr_SetString(PyExc_TypeError, "Could not convert to GValueArray"); return NULL; @@ -522,6 +543,56 @@ _wrap_test_value_array(PyObject *self, PyObject *args) return pyg_value_as_pyobject(value, FALSE); } + +static PyObject * +_wrap_value_array_get_nth_type(PyObject *self, PyObject *args) +{ + guint n; + GType type; + GValue *nth; + GValueArray *arr; + PyObject *obj; + + if (!PyArg_ParseTuple(args, "OI", &obj, &n)) + return NULL; + + G_GNUC_BEGIN_IGNORE_DEPRECATIONS + + if (pyg_boxed_check(obj, G_TYPE_VALUE) && + G_VALUE_HOLDS(pyg_boxed_get(obj, GValue), PYGI_TYPE_VALUE_ARRAY)) { + arr = g_value_get_boxed(pyg_boxed_get(obj, GValue)); + } else if (pyg_boxed_check(obj, PYGI_TYPE_VALUE_ARRAY)) { + arr = pyg_boxed_get(obj, GValueArray); + } else { + PyErr_SetString(PyExc_TypeError, "First argument is not GValueArray"); + return NULL; + } + + if (n >= arr->n_values) { + PyErr_SetString(PyExc_TypeError, "Index is out of bounds"); + return NULL; + } + nth = g_value_array_get_nth(arr, n); + type = G_VALUE_TYPE(nth); + + G_GNUC_END_IGNORE_DEPRECATIONS + + return pyg_type_wrapper_new(type); +} + +static PyObject * +_wrap_constant_strip_prefix(PyObject *self, PyObject *args) +{ + const char *name, *strip_prefix; + const gchar *result; + + if (!PyArg_ParseTuple (args, "ss", &name, &strip_prefix)) + return NULL; + + result = pyg_constant_strip_prefix (name, strip_prefix); + return PyUnicode_FromString (result); +} + static PyObject * _wrap_test_gerror_exception(PyObject *self, PyObject *args) { @@ -593,32 +664,101 @@ _wrap_test_floating_and_sunk_get_instance_list (PyObject *self) return py_list; } +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +static PyObject * +_wrap_test_parse_constructor_args (PyObject *self, PyObject *args) +{ + char *arg_names[] = {"label", NULL}; + char *prop_names[] = {"label", NULL}; + GParameter params[1] = {{0}}; + PyObject *parsed_args[1]; + guint nparams = 0; + + if (!PyArg_ParseTuple(args, "O", &(parsed_args[0]))) + return NULL; + + if (!pyg_parse_constructor_args ( + TYPE_TEST, arg_names, prop_names, params, &nparams, parsed_args)) { + return NULL; + } + + return PyLong_FromLong (nparams); +} + +G_GNUC_END_IGNORE_DEPRECATIONS + +static PyObject * +_wrap_test_to_unichar_conv (PyObject * self, PyObject *args) +{ + PyObject *obj; + gunichar result; + + if (!PyArg_ParseTuple(args, "O", &obj)) + return NULL; + + if (!pyg_pyobj_to_unichar_conv (obj, &result)) + return NULL; + + return PyLong_FromLong (result); +} + static PyMethodDef testhelper_functions[] = { + { "test_parse_constructor_args", (PyCFunction)_wrap_test_parse_constructor_args, METH_VARARGS }, { "get_test_thread", (PyCFunction)_wrap_get_test_thread, METH_NOARGS }, + { "test_to_unichar_conv", (PyCFunction)_wrap_test_to_unichar_conv, METH_VARARGS }, { "get_unknown", (PyCFunction)_wrap_get_unknown, METH_NOARGS }, { "create_test_type", (PyCFunction)_wrap_create_test_type, METH_NOARGS }, + { "test_state_ensure_release", (PyCFunction)_wrap_test_state_ensure_release, METH_NOARGS }, { "test_g_object_new", (PyCFunction)_wrap_test_g_object_new, METH_NOARGS }, { "connectcallbacks", (PyCFunction)_wrap_connectcallbacks, METH_VARARGS }, { "test_value", (PyCFunction)_wrap_test_value, METH_VARARGS }, { "test_value_array", (PyCFunction)_wrap_test_value_array, METH_VARARGS }, + { "value_array_get_nth_type", (PyCFunction)_wrap_value_array_get_nth_type, METH_VARARGS }, + { "constant_strip_prefix", (PyCFunction)_wrap_constant_strip_prefix, METH_VARARGS }, { "test_gerror_exception", (PyCFunction)_wrap_test_gerror_exception, METH_VARARGS }, { "owned_by_library_get_instance_list", (PyCFunction)_wrap_test_owned_by_library_get_instance_list, METH_NOARGS }, { "floating_and_sunk_get_instance_list", (PyCFunction)_wrap_test_floating_and_sunk_get_instance_list, METH_NOARGS }, { NULL, NULL } }; -PYGLIB_MODULE_START(testhelper, "testhelper") -{ +static struct PyModuleDef _testhelpermodule = { + PyModuleDef_HEAD_INIT, + "testhelper", + NULL, + -1, + testhelper_functions, + NULL, + NULL, + NULL, + NULL +}; + +#ifdef __GNUC__ +#define PYGI_MODINIT_FUNC __attribute__((visibility("default"))) PyMODINIT_FUNC +#else +#define PYGI_MODINIT_FUNC PyMODINIT_FUNC +#endif + +PYGI_MODINIT_FUNC PyInit_testhelper(void); + +PYGI_MODINIT_FUNC PyInit_testhelper(void) { + PyObject *module; + PyObject *gobject_module; PyObject *m, *d; - - pygobject_init(-1, -1, -1); + + module = PyModule_Create(&_testhelpermodule); + + if ((gobject_module = pygobject_init(-1, -1, -1)) == NULL) + return NULL; + Py_DECREF (gobject_module); d = PyModule_GetDict(module); if ((m = PyImport_ImportModule("gi.repository.GObject")) == NULL) { PyErr_SetString(PyExc_ImportError, "could not import gobject"); - return PYGLIB_MODULE_ERROR_RETURN; + return NULL; } /* TestInterface */ @@ -667,6 +807,7 @@ PYGLIB_MODULE_START(testhelper, "testhelper") &PyTestFloatingAndSunk_Type, Py_BuildValue("(O)", &PyGObject_Type)); + + return module; } -PYGLIB_MODULE_END diff --git a/tests/testmodule.py b/tests/testmodule.py deleted file mode 100644 index 3da8ed5..0000000 --- a/tests/testmodule.py +++ /dev/null @@ -1,22 +0,0 @@ -from gi.repository import GObject - - -class PyGObject(GObject.GObject): - __gtype_name__ = 'PyGObject' - __gproperties__ = { - 'label': (GObject.TYPE_STRING, - 'label property', - 'the label of the object', - 'default', GObject.PARAM_READWRITE), - } - - def __init__(self): - self._props = {} - GObject.GObject.__init__(self) - self.set_property('label', 'hello') - - def do_set_property(self, name, value): - self._props[name] = value - - def do_get_property(self, name): - return self._props[name] diff --git a/tests/valgrind.supp b/tests/valgrind.supp new file mode 100644 index 0000000..5792a7c --- /dev/null +++ b/tests/valgrind.supp @@ -0,0 +1,30 @@ +# https://bugzilla.redhat.com/show_bug.cgi?id=1538073 + +{ + + Memcheck:Cond + fun:__wcsnlen_sse4_1 + fun:wcsrtombs + fun:wcstombs + fun:wcstombs + fun:encode_current_locale* +} + +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:FcPatternObjectInsertElt + fun:FcPatternObjectAddWithBinding +} + +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:FcPatternCreate + fun:FcParsePattern + fun:FcEndElement +} diff --git a/pygi-convert.sh b/tools/pygi-convert.sh similarity index 97% rename from pygi-convert.sh rename to tools/pygi-convert.sh index 43af662..8a2160a 100755 --- a/pygi-convert.sh +++ b/tools/pygi-convert.sh @@ -209,15 +209,13 @@ for f in $FILES_TO_CONVERT; do -pe "s/Gio.OUTPUT_STREAM_SPLICE_/Gio.OutputStreamSpliceFlags./g;" \ -pe "s/Gio.vfs_/Gio.Vfs./g;" \ \ - -pe "#s/import glib\n/from gi.repository import GLib\n/g;" \ - -pe "#s/(?