From c6b9e84f2f7f8c85939a8e5ff5d8a5aa067cecf3 Mon Sep 17 00:00:00 2001 From: Jinkun Jang Date: Wed, 13 Mar 2013 02:21:24 +0900 Subject: [PATCH] Tizen 2.1 base --- AUTHORS | 8 + COPYING | 504 + ChangeLog | 2329 ++++ ChangeLog.pre-2.18 | 3608 +++++ INSTALL | 236 + MANIFEST.in | 7 + Makefile.am | 120 + Makefile.in | 1082 ++ NEWS | 460 + PKG-INFO | 25 + PKG-INFO.in | 25 + README | 101 + README.win32 | 24 + aclocal.m4 | 1596 +++ codegen/Makefile.am | 31 + codegen/Makefile.in | 555 + 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 | 448 + codegen/docextract_to_xml.py | 139 + 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 + compile | 143 + config.guess | 1501 +++ config.h.in | 80 + config.sub | 1705 +++ configure | 16893 ++++++++++++++++++++++++ configure.ac | 244 + depcomp | 630 + docs/Makefile.am | 195 + docs/Makefile.in | 641 + docs/html/class-gioappinfo.html | 210 + docs/html/class-gioapplaunchcontext.html | 44 + docs/html/class-gioasyncresult.html | 44 + docs/html/class-giobufferedinputstream.html | 133 + docs/html/class-giobufferedoutputstream.html | 62 + docs/html/class-giocancellable.html | 61 + docs/html/class-giodatainputstream.html | 223 + docs/html/class-giodataoutputstream.html | 118 + docs/html/class-giodrive.html | 117 + docs/html/class-gioemblem.html | 46 + docs/html/class-gioemblemedicon.html | 38 + docs/html/class-giofile.html | 1436 ++ docs/html/class-giofileattributeinfo.html | 11 + docs/html/class-giofileenumerator.html | 126 + docs/html/class-giofileicon.html | 21 + docs/html/class-giofileinfo.html | 42 + docs/html/class-giofileinputstream.html | 65 + docs/html/class-giofilemonitor.html | 21 + docs/html/class-giofileoutputstream.html | 84 + docs/html/class-giofilterinputstream.html | 22 + docs/html/class-giofilteroutputstream.html | 22 + docs/html/class-gioicon.html | 81 + docs/html/class-gioinputstream.html | 242 + docs/html/class-gioloadableicon.html | 51 + docs/html/class-giomemoryinputstream.html | 32 + docs/html/class-giomemoryoutputstream.html | 40 + docs/html/class-giomount.html | 242 + docs/html/class-giomountoperation.html | 123 + docs/html/class-giooutputstream.html | 19 + docs/html/class-gioseekable.html | 55 + docs/html/class-giosimpleasyncresult.html | 87 + docs/html/class-giothemedicon.html | 42 + docs/html/class-giounixinputstream.html | 37 + docs/html/class-giounixoutputstream.html | 37 + docs/html/class-giovolume.html | 176 + docs/html/class-giovolumemonitor.html | 135 + docs/html/class-glibmaincontext.html | 29 + docs/html/class-glibmainloop.html | 38 + docs/html/class-gobject.html | 176 + docs/html/class-gobjectgboxed.html | 9 + docs/html/class-gobjectginterface.html | 4 + docs/html/class-gobjectgpointer.html | 8 + docs/html/gio-class-reference.html | 1 + docs/html/gio-constants.html | 414 + docs/html/gio-functions.html | 74 + docs/html/giounix-class-reference.html | 1 + docs/html/glib-class-reference.html | 3 + docs/html/glib-constants.html | 40 + docs/html/glib-functions.html | 280 + docs/html/gobject-class-reference.html | 2 + docs/html/gobject-constants.html | 63 + docs/html/gobject-functions.html | 134 + docs/html/index.html | 6 + docs/html/index.sgml | 532 + docs/html/pygobject-introduction.html | 83 + docs/html/pygobject.devhelp | 525 + docs/reference/entities.docbook.in | 1 + 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 | 961 ++ 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/pyglib-classes.xml | 15 + docs/reference/pyglib-constants.xml | 282 + docs/reference/pyglib-functions.xml | 1047 ++ docs/reference/pyglib-maincontext.xml | 152 + docs/reference/pyglib-mainloop.xml | 202 + docs/reference/pygobject-classes.xml | 17 + docs/reference/pygobject-constants.xml | 390 + docs/reference/pygobject-functions.xml | 889 ++ docs/reference/pygobject-gboxed.xml | 68 + docs/reference/pygobject-ginterface.xml | 38 + docs/reference/pygobject-gpointer.xml | 42 + docs/reference/pygobject-introduction.xml | 222 + docs/reference/pygobject-ref.xml | 36 + docs/reference/pygobject.xml | 1016 ++ docs/style.css | 10 + docs/xsl/common.xsl | 19 + docs/xsl/devhelp.xsl | 154 + docs/xsl/fixxref.py | 67 + docs/xsl/fixxref.py.in | 67 + docs/xsl/html.xsl | 285 + docs/xsl/pdf-style.xsl | 11 + docs/xsl/pdf.xsl | 259 + docs/xsl/ref-html-style.xsl | 54 + dsextras.py | 457 + examples/Makefile.am | 2 + examples/Makefile.in | 386 + examples/option.py | 30 + examples/properties.py | 31 + examples/signal.py | 28 + gio/Makefile.am | 116 + gio/Makefile.in | 807 ++ gio/__init__.py | 40 + gio/gappinfo.override | 208 + gio/gapplaunchcontext.override | 99 + gio/gbufferedinputstream.override | 70 + gio/gcancellable.override | 38 + gio/gdatainputstream.override | 250 + gio/gdrive.override | 347 + gio/gfile.override | 2216 ++++ 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 | 404 + gio/giomodule.c | 205 + 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 | 208 + gio/pygio-utils.h | 49 + gio/unix-types.defs | 55 + gio/unix.defs | 475 + gio/unix.override | 62 + gio/unixmodule.c | 52 + glib/Makefile.am | 59 + glib/Makefile.in | 787 ++ glib/__init__.py | 25 + glib/glibmodule.c | 896 ++ glib/option.py | 350 + glib/pygiochannel.c | 740 ++ glib/pygiochannel.h | 29 + glib/pyglib-private.h | 46 + glib/pyglib-python-compat.h | 120 + glib/pyglib.c | 577 + glib/pyglib.h | 94 + glib/pygmaincontext.c | 99 + glib/pygmaincontext.h | 40 + glib/pygmainloop.c | 354 + glib/pygmainloop.h | 36 + glib/pygoptioncontext.c | 312 + glib/pygoptioncontext.h | 37 + glib/pygoptiongroup.c | 270 + glib/pygoptiongroup.h | 40 + glib/pygsource.c | 723 + glib/pygsource.h | 39 + glib/pygspawn.c | 263 + glib/pygspawn.h | 32 + gobject/Makefile.am | 67 + gobject/Makefile.in | 747 ++ gobject/__init__.py | 117 + gobject/constants.py | 83 + gobject/ffi-marshaller.c | 194 + gobject/ffi-marshaller.h | 31 + gobject/gobjectmodule.c | 2659 ++++ gobject/propertyhelper.py | 298 + gobject/pygboxed.c | 228 + gobject/pygboxed.h | 27 + gobject/pygenum.c | 356 + gobject/pygenum.h | 27 + gobject/pygflags.c | 491 + gobject/pygflags.h | 27 + gobject/pygi-external.h | 67 + gobject/pyginterface.c | 122 + gobject/pyginterface.h | 40 + gobject/pygobject-private.h | 229 + gobject/pygobject.c | 2326 ++++ gobject/pygobject.h | 636 + gobject/pygparamspec.c | 397 + gobject/pygparamspec.h | 31 + gobject/pygpointer.c | 193 + gobject/pygpointer.h | 27 + gobject/pygtype.c | 1779 +++ gobject/pygtype.h | 28 + install-sh | 520 + ltmain.sh | 8406 ++++++++++++ m4/as-ac-expand.m4 | 40 + m4/jhflags.m4 | 21 + m4/libtool.m4 | 7360 +++++++++++ m4/ltoptions.m4 | 368 + m4/ltsugar.m4 | 123 + m4/ltversion.m4 | 23 + m4/lt~obsolete.m4 | 92 + m4/python.m4 | 257 + missing | 376 + packaging/pygobject-rpmlintrc | 3 + packaging/pygobject.changes | 2 + packaging/pygobject.spec | 119 + py-compile | 146 + pygobject-2.0-uninstalled.pc.in | 19 + pygobject-2.0.pc.in | 22 + pygobject_postinstall.py | 72 + pygtk.py | 95 + setup.py | 272 + tests/Makefile.am | 63 + tests/Makefile.in | 569 + tests/common.py | 48 + tests/runtests.py | 44 + tests/test-floating.c | 95 + tests/test-floating.h | 60 + tests/test-thread.c | 64 + tests/test-thread.h | 22 + tests/test-unknown.c | 113 + tests/test-unknown.h | 40 + tests/test_gicon.py | 111 + tests/test_gio.py | 1137 ++ tests/test_gobject.py | 29 + tests/test_interface.py | 45 + tests/test_mainloop.py | 53 + tests/test_properties.py | 376 + tests/test_signal.py | 393 + tests/test_source.py | 100 + tests/test_subprocess.py | 27 + tests/test_unknown.py | 15 + tests/testhelpermodule.c | 679 + tests/testmodule.py | 21 + 301 files changed, 130126 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 ChangeLog.pre-2.18 create mode 100644 INSTALL create mode 100644 MANIFEST.in create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 PKG-INFO create mode 100644 PKG-INFO.in create mode 100644 README create mode 100644 README.win32 create mode 100644 aclocal.m4 create mode 100644 codegen/Makefile.am create mode 100644 codegen/Makefile.in create mode 100644 codegen/README.defs create mode 100644 codegen/__init__.py create mode 100644 codegen/argtypes.py create mode 100755 codegen/code-coverage.py create mode 100755 codegen/codegen.py create mode 100755 codegen/createdefs.py create mode 100644 codegen/definitions.py create mode 100755 codegen/defsconvert.py create mode 100755 codegen/defsgen.py create mode 100644 codegen/defsparser.py create mode 100644 codegen/docextract.py create mode 100755 codegen/docextract_to_xml.py create mode 100755 codegen/docgen.py create mode 100755 codegen/h2def.py create mode 100755 codegen/mergedefs.py create mode 100755 codegen/missingdefs.py create mode 100755 codegen/mkskel.py create mode 100644 codegen/override.py create mode 100644 codegen/pygobject-codegen-2.0.in create mode 100644 codegen/reversewrapper.py create mode 100755 codegen/scanvirtuals.py create mode 100755 codegen/scmexpr.py create mode 100755 compile create mode 100755 config.guess create mode 100644 config.h.in create mode 100755 config.sub create mode 100755 configure create mode 100644 configure.ac create mode 100755 depcomp create mode 100644 docs/Makefile.am create mode 100644 docs/Makefile.in create mode 100644 docs/html/class-gioappinfo.html create mode 100644 docs/html/class-gioapplaunchcontext.html create mode 100644 docs/html/class-gioasyncresult.html create mode 100644 docs/html/class-giobufferedinputstream.html create mode 100644 docs/html/class-giobufferedoutputstream.html create mode 100644 docs/html/class-giocancellable.html create mode 100644 docs/html/class-giodatainputstream.html create mode 100644 docs/html/class-giodataoutputstream.html create mode 100644 docs/html/class-giodrive.html create mode 100644 docs/html/class-gioemblem.html create mode 100644 docs/html/class-gioemblemedicon.html create mode 100644 docs/html/class-giofile.html create mode 100644 docs/html/class-giofileattributeinfo.html create mode 100644 docs/html/class-giofileenumerator.html create mode 100644 docs/html/class-giofileicon.html create mode 100644 docs/html/class-giofileinfo.html create mode 100644 docs/html/class-giofileinputstream.html create mode 100644 docs/html/class-giofilemonitor.html create mode 100644 docs/html/class-giofileoutputstream.html create mode 100644 docs/html/class-giofilterinputstream.html create mode 100644 docs/html/class-giofilteroutputstream.html create mode 100644 docs/html/class-gioicon.html create mode 100644 docs/html/class-gioinputstream.html create mode 100644 docs/html/class-gioloadableicon.html create mode 100644 docs/html/class-giomemoryinputstream.html create mode 100644 docs/html/class-giomemoryoutputstream.html create mode 100644 docs/html/class-giomount.html create mode 100644 docs/html/class-giomountoperation.html create mode 100644 docs/html/class-giooutputstream.html create mode 100644 docs/html/class-gioseekable.html create mode 100644 docs/html/class-giosimpleasyncresult.html create mode 100644 docs/html/class-giothemedicon.html create mode 100644 docs/html/class-giounixinputstream.html create mode 100644 docs/html/class-giounixoutputstream.html create mode 100644 docs/html/class-giovolume.html create mode 100644 docs/html/class-giovolumemonitor.html create mode 100644 docs/html/class-glibmaincontext.html create mode 100644 docs/html/class-glibmainloop.html create mode 100644 docs/html/class-gobject.html create mode 100644 docs/html/class-gobjectgboxed.html create mode 100644 docs/html/class-gobjectginterface.html create mode 100644 docs/html/class-gobjectgpointer.html create mode 100644 docs/html/gio-class-reference.html create mode 100644 docs/html/gio-constants.html create mode 100644 docs/html/gio-functions.html create mode 100644 docs/html/giounix-class-reference.html create mode 100644 docs/html/glib-class-reference.html create mode 100644 docs/html/glib-constants.html create mode 100644 docs/html/glib-functions.html create mode 100644 docs/html/gobject-class-reference.html create mode 100644 docs/html/gobject-constants.html create mode 100644 docs/html/gobject-functions.html create mode 100644 docs/html/index.html create mode 100644 docs/html/index.sgml create mode 100644 docs/html/pygobject-introduction.html create mode 100644 docs/html/pygobject.devhelp create mode 100644 docs/reference/entities.docbook.in create mode 100644 docs/reference/pygio-appinfo.xml create mode 100644 docs/reference/pygio-applaunchcontext.xml create mode 100644 docs/reference/pygio-asyncresult.xml create mode 100644 docs/reference/pygio-bufferedinputstream.xml create mode 100644 docs/reference/pygio-bufferedoutputstream.xml create mode 100644 docs/reference/pygio-cancellable.xml create mode 100644 docs/reference/pygio-classes.xml create mode 100644 docs/reference/pygio-constants.xml create mode 100644 docs/reference/pygio-datainputstream.xml create mode 100644 docs/reference/pygio-dataoutputstream.xml create mode 100644 docs/reference/pygio-drive.xml create mode 100644 docs/reference/pygio-emblem.xml create mode 100644 docs/reference/pygio-emblemedicon.xml create mode 100644 docs/reference/pygio-file.xml create mode 100644 docs/reference/pygio-fileattributeinfo.xml create mode 100644 docs/reference/pygio-fileenumerator.xml create mode 100644 docs/reference/pygio-fileicon.xml create mode 100644 docs/reference/pygio-fileinfo.xml create mode 100644 docs/reference/pygio-fileinputstream.xml create mode 100644 docs/reference/pygio-filemonitor.xml create mode 100644 docs/reference/pygio-fileoutputstream.xml create mode 100644 docs/reference/pygio-filterinputstream.xml create mode 100644 docs/reference/pygio-filteroutputstream.xml create mode 100644 docs/reference/pygio-functions.xml create mode 100644 docs/reference/pygio-icon.xml create mode 100644 docs/reference/pygio-inputstream.xml create mode 100644 docs/reference/pygio-loadableicon.xml create mode 100644 docs/reference/pygio-memoryinputstream.xml create mode 100644 docs/reference/pygio-memoryoutputstream.xml create mode 100644 docs/reference/pygio-mount.xml create mode 100644 docs/reference/pygio-mountoperation.xml create mode 100644 docs/reference/pygio-outputstream.xml create mode 100644 docs/reference/pygio-seekable.xml create mode 100644 docs/reference/pygio-simpleasyncresult.xml create mode 100644 docs/reference/pygio-themedicon.xml create mode 100644 docs/reference/pygio-unixinputstream.xml create mode 100644 docs/reference/pygio-unixoutputstream.xml create mode 100644 docs/reference/pygio-volume.xml create mode 100644 docs/reference/pygio-volumemonitor.xml create mode 100644 docs/reference/pygiounix-classes.xml create mode 100644 docs/reference/pyglib-classes.xml create mode 100644 docs/reference/pyglib-constants.xml create mode 100644 docs/reference/pyglib-functions.xml create mode 100644 docs/reference/pyglib-maincontext.xml create mode 100644 docs/reference/pyglib-mainloop.xml create mode 100644 docs/reference/pygobject-classes.xml create mode 100644 docs/reference/pygobject-constants.xml create mode 100644 docs/reference/pygobject-functions.xml create mode 100644 docs/reference/pygobject-gboxed.xml create mode 100644 docs/reference/pygobject-ginterface.xml create mode 100644 docs/reference/pygobject-gpointer.xml create mode 100644 docs/reference/pygobject-introduction.xml create mode 100644 docs/reference/pygobject-ref.xml create mode 100644 docs/reference/pygobject.xml create mode 100644 docs/style.css create mode 100644 docs/xsl/common.xsl create mode 100644 docs/xsl/devhelp.xsl create mode 100644 docs/xsl/fixxref.py create mode 100644 docs/xsl/fixxref.py.in create mode 100644 docs/xsl/html.xsl create mode 100644 docs/xsl/pdf-style.xsl create mode 100644 docs/xsl/pdf.xsl create mode 100644 docs/xsl/ref-html-style.xsl create mode 100644 dsextras.py create mode 100644 examples/Makefile.am create mode 100644 examples/Makefile.in create mode 100644 examples/option.py create mode 100644 examples/properties.py create mode 100644 examples/signal.py create mode 100644 gio/Makefile.am create mode 100644 gio/Makefile.in create mode 100644 gio/__init__.py create mode 100644 gio/gappinfo.override create mode 100644 gio/gapplaunchcontext.override create mode 100644 gio/gbufferedinputstream.override create mode 100644 gio/gcancellable.override create mode 100644 gio/gdatainputstream.override create mode 100644 gio/gdrive.override create mode 100644 gio/gfile.override create mode 100644 gio/gfileattribute.override create mode 100644 gio/gfileenumerator.override create mode 100644 gio/gfileinfo.override create mode 100644 gio/gfileinputstream.override create mode 100644 gio/gfileiostream.override create mode 100644 gio/gfileoutputstream.override create mode 100644 gio/gicon.override create mode 100644 gio/ginputstream.override create mode 100644 gio/gio-types.defs create mode 100644 gio/gio.defs create mode 100644 gio/gio.override create mode 100644 gio/giomodule.c create mode 100644 gio/giostream.override create mode 100644 gio/gmemoryinputstream.override create mode 100644 gio/gmemoryoutputstream.override create mode 100644 gio/gmount.override create mode 100644 gio/goutputstream.override create mode 100644 gio/gresolver.override create mode 100644 gio/gsocket.override create mode 100644 gio/gvolume.override create mode 100644 gio/gvolumemonitor.override create mode 100644 gio/pygio-utils.c create mode 100644 gio/pygio-utils.h create mode 100644 gio/unix-types.defs create mode 100644 gio/unix.defs create mode 100644 gio/unix.override create mode 100644 gio/unixmodule.c create mode 100644 glib/Makefile.am create mode 100644 glib/Makefile.in create mode 100644 glib/__init__.py create mode 100644 glib/glibmodule.c create mode 100644 glib/option.py create mode 100644 glib/pygiochannel.c create mode 100644 glib/pygiochannel.h create mode 100644 glib/pyglib-private.h create mode 100644 glib/pyglib-python-compat.h create mode 100644 glib/pyglib.c create mode 100644 glib/pyglib.h create mode 100644 glib/pygmaincontext.c create mode 100644 glib/pygmaincontext.h create mode 100644 glib/pygmainloop.c create mode 100644 glib/pygmainloop.h create mode 100644 glib/pygoptioncontext.c create mode 100644 glib/pygoptioncontext.h create mode 100644 glib/pygoptiongroup.c create mode 100644 glib/pygoptiongroup.h create mode 100644 glib/pygsource.c create mode 100644 glib/pygsource.h create mode 100644 glib/pygspawn.c create mode 100644 glib/pygspawn.h create mode 100644 gobject/Makefile.am create mode 100644 gobject/Makefile.in create mode 100644 gobject/__init__.py create mode 100644 gobject/constants.py create mode 100644 gobject/ffi-marshaller.c create mode 100644 gobject/ffi-marshaller.h create mode 100644 gobject/gobjectmodule.c create mode 100644 gobject/propertyhelper.py create mode 100644 gobject/pygboxed.c create mode 100644 gobject/pygboxed.h create mode 100644 gobject/pygenum.c create mode 100644 gobject/pygenum.h create mode 100644 gobject/pygflags.c create mode 100644 gobject/pygflags.h create mode 100644 gobject/pygi-external.h create mode 100644 gobject/pyginterface.c create mode 100644 gobject/pyginterface.h create mode 100644 gobject/pygobject-private.h create mode 100644 gobject/pygobject.c create mode 100644 gobject/pygobject.h create mode 100644 gobject/pygparamspec.c create mode 100644 gobject/pygparamspec.h create mode 100644 gobject/pygpointer.c create mode 100644 gobject/pygpointer.h create mode 100644 gobject/pygtype.c create mode 100644 gobject/pygtype.h create mode 100755 install-sh create mode 100755 ltmain.sh create mode 100644 m4/as-ac-expand.m4 create mode 100644 m4/jhflags.m4 create mode 100644 m4/libtool.m4 create mode 100644 m4/ltoptions.m4 create mode 100644 m4/ltsugar.m4 create mode 100644 m4/ltversion.m4 create mode 100644 m4/lt~obsolete.m4 create mode 100644 m4/python.m4 create mode 100755 missing create mode 100644 packaging/pygobject-rpmlintrc create mode 100644 packaging/pygobject.changes create mode 100644 packaging/pygobject.spec create mode 100755 py-compile create mode 100644 pygobject-2.0-uninstalled.pc.in create mode 100644 pygobject-2.0.pc.in create mode 100644 pygobject_postinstall.py create mode 100644 pygtk.py create mode 100755 setup.py create mode 100644 tests/Makefile.am create mode 100644 tests/Makefile.in create mode 100644 tests/common.py create mode 100644 tests/runtests.py create mode 100644 tests/test-floating.c create mode 100644 tests/test-floating.h create mode 100644 tests/test-thread.c create mode 100644 tests/test-thread.h create mode 100644 tests/test-unknown.c create mode 100644 tests/test-unknown.h create mode 100644 tests/test_gicon.py create mode 100644 tests/test_gio.py create mode 100644 tests/test_gobject.py create mode 100644 tests/test_interface.py create mode 100644 tests/test_mainloop.py create mode 100644 tests/test_properties.py create mode 100644 tests/test_signal.py create mode 100644 tests/test_source.py create mode 100644 tests/test_subprocess.py create mode 100644 tests/test_unknown.py create mode 100644 tests/testhelpermodule.c create mode 100644 tests/testmodule.py diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..4a37fe3 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,8 @@ +Original Authors +James Henstridge +Johan Dahlin + +Current Maintainers +Gustavo J A M Carneiro +Paul Pogonyshev +Gian Mario Tagliaretti diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..ae23fcf --- /dev/null +++ b/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..fa99267 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2329 @@ +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 files changed, 7 insertions(+), 0 deletions(-) + +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 files changed, 4 insertions(+), 1 deletions(-) + +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 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 files changed, 2 insertions(+), 0 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 files changed, 10 insertions(+), 1 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 files changed, 1 insertions(+), 1 deletions(-) + +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 files changed, 26 insertions(+), 0 deletions(-) + +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 files changed, 0 insertions(+), 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 files changed, 1 insertions(+), 0 deletions(-) + +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 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(+), 0 deletions(-) + +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 files changed, 2 insertions(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 files 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 files changed, 8 insertions(+), 0 deletions(-) + +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 files changed, 2 insertions(+), 2 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 3 insertions(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 0 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 files changed, 1 insertions(+), 0 deletions(-) + +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 files changed, 4 insertions(+), 0 deletions(-) + +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 files changed, 9 insertions(+), 0 deletions(-) + +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 files changed, 4 insertions(+), 0 deletions(-) + +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 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, 0 insertions(+), 718 deletions(-) + +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 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 files changed, 1 insertions(+), 0 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 files changed, 13 insertions(+), 14 deletions(-) + +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(+), 0 deletions(-) + +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 files 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 files changed, 1 insertions(+), 1 deletions(-) + +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 files changed, 55 insertions(+), 0 deletions(-) + +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 files changed, 54 insertions(+), 0 deletions(-) + +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 files 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 files changed, 54 insertions(+), 0 deletions(-) + +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 files changed, 54 insertions(+), 0 deletions(-) + +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 files changed, 54 insertions(+), 0 deletions(-) + +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 files changed, 52 insertions(+), 0 deletions(-) + +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 files changed, 52 insertions(+), 0 deletions(-) + +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 files changed, 55 insertions(+), 0 deletions(-) + +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 files changed, 41 insertions(+), 0 deletions(-) + +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 files changed, 44 insertions(+), 0 deletions(-) + +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 files changed, 54 insertions(+), 0 deletions(-) + +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(+), 0 deletions(-) + +commit f72c5e451dfaeb01b3c3d9243fed2732d3620462 +Author: Gian Mario Tagliaretti +Date: Fri Jan 1 13:20:11 2010 +0100 + + Wrap gio.Drive.stop() + + gio/gdrive.override | 52 + +++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 52 insertions(+), 0 deletions(-) + +commit 29043bade408338cefa13fb4b0c875aabd3ef05e +Author: Gian Mario Tagliaretti +Date: Fri Jan 1 13:00:42 2010 +0100 + + Wrap gio.Drive.start() + + gio/gdrive.override | 52 + +++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 52 insertions(+), 0 deletions(-) + +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 files changed, 3 insertions(+), 0 deletions(-) + +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 files changed, 42 insertions(+), 0 deletions(-) + +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 deletions(-) + +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 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 deletions(-) + +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 files changed, 8 insertions(+), 0 deletions(-) + +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 files changed, 47 insertions(+), 0 deletions(-) + +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 files changed, 48 insertions(+), 0 deletions(-) + +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 files changed, 45 insertions(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 files changed, 5 insertions(+), 0 deletions(-) + +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 deletions(-) + +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(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 48 insertions(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 54 insertions(+), 0 deletions(-) + +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 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 files 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 files 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 files changed, 1 insertions(+), 1 deletions(-) + +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(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 files changed, 0 insertions(+), 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(+), 0 deletions(-) + +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 files 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 files changed, 1 insertions(+), 1 deletions(-) + +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 files changed, 11 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 files changed, 2 insertions(+), 1 deletions(-) + +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 files changed, 20 insertions(+), 0 deletions(-) + +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 deletions(-) + +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 files 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 files changed, 6 insertions(+), 6 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 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 files changed, 16 insertions(+), 1 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 | 2012 + +++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 2144 insertions(+), 6 deletions(-) + +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/repository.py | 51 -- + tests/test_girepository.py | 386 ------------ + 16 files changed, 1 insertions(+), 3174 deletions(-) + +commit d67d5afb5115c1d8294415b2e1a82af2c737ba17 +Author: Paul Pogonyshev +Date: Sun Nov 22 18:23:02 2009 +0200 + + Ignore one more file. + + .gitignore | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +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 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 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 files changed, 2 insertions(+), 1 deletions(-) + +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(+), 0 deletions(-) + +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 files 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 files 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 files changed, 1 insertions(+), 1 deletions(-) + +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 files changed, 6 insertions(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 files 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 files changed, 1 insertions(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +commit c888b5ca722fcad6a03de585606c677c2969ebd6 +Author: Paolo Borelli +Date: Thu Aug 13 21:32:07 2009 +0200 + + Allow to use automake 1.11 + + autogen.sh | 13 +++++++------ + 1 files 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 files 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 files 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(+), 0 deletions(-) + +commit 3bfae47fbcb5523d91fb2d1ed7ea347eeddd1775 +Author: Gian Mario Tagliaretti +Date: Tue Aug 11 20:52:44 2009 +0200 + + Update NEWS release 2.19.0 + + NEWS | 29 +++++++++++++++++++++++++++++ + 1 files changed, 29 insertions(+), 0 deletions(-) + +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 files changed, 241 insertions(+), 1 deletions(-) + +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 files 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, 0 insertions(+), 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 files 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(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 7 insertions(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files 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(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 files 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(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 7 insertions(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 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 ++++++++ + 4 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 files 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 files changed, 288 insertions(+), 0 deletions(-) + +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 files 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(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 30 insertions(+), 0 deletions(-) + +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 deletions(-) + +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 files 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 files 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(+), 0 deletions(-) + +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/defsconvert.py | 2 ++ + 4 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 files 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 files changed, 1 insertions(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 deletions(-) + +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 deletions(-) + +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 deletions(-) + +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(+), 0 deletions(-) + +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 files 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(+), 0 deletions(-) + +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 files changed, 2 insertions(+), 1 deletions(-) + +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(+), 0 deletions(-) + +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 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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(+), 0 deletions(-) + +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(+), 0 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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 files changed, 1 insertions(+), 1 deletions(-) + +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(+), 0 deletions(-) + +commit fceea8e843e880f0469e454df23141e7dd2bc0cf +Author: Gian Mario Tagliaretti +Date: Thu Apr 30 22:13:06 2009 +0200 + + Update NEWS, release 2.17.0 + + NEWS | 93 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 93 insertions(+), 0 deletions(-) + +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 files changed, 4 insertions(+), 0 deletions(-) diff --git a/ChangeLog.pre-2.18 b/ChangeLog.pre-2.18 new file mode 100644 index 0000000..2fb8ef4 --- /dev/null +++ b/ChangeLog.pre-2.18 @@ -0,0 +1,3608 @@ +=== ChangeLog discontinued === + +2009-05-04 Siavash Safi + + Bug 579275 – Patch which removes dll api in headers and adds + a namespace option + + * codegen/h2def.py: Add -n --namespace option and the code to remove + dll API in headers, Added documentation + +2009-04-17 Paul Pogonyshev + + Bug 568499 – CellRendererPixbuf stock-size property has wrong type + + * gobject/pygtype.c (pyg_enum_get_value): Also accept long + integers. + +2009-04-15 Götz Waschk + + Bug 550231 – missing dep on libffi in pygobject-2.0.pc + + * configure.ac: Define `LIBFFI_PC' subst. + + * pygobject-2.0.pc.in: + * pygobject-2.0-uninstalled.pc.in: Use it. + +2009-04-15 Paul Pogonyshev + + Bug 555613 – gio.VolumeMonitor segfaults + + * gio/gvolumemonitor.override (_wrap_g_volume_monitor_tp_new): New + function, return the singleton object. + +2009-04-14 James Westby + + Bug 573753 – DeprecationWarning under python 2.6 + + * codegen/definitions.py (ReturnType.__init__): Don't pass + 'type_name' argument to super __init__. + +2009-04-14 Krzesimir Nowak + + Bug 576566 – several scripts from codegen directory are not + distributed + + * codegen/Makefile.am (codegen_PYTHON): List several missing + scripts. + +2009-04-14 Gian Mario Tagliaretti + + * gio/gfile.override: (_wrap_g_file_copy_async) change argument order + to keep it consistent with the other methods. + +2009-04-13 Paul Pogonyshev + + Bug 578870 – memory leak in gio.File.copy_async + + * gio/gio.override (PyGIONotify): Add 'slaves' field. + (pygio_notify_new_slave): New function. + (pygio_notify_reference_callback): Recurse for slaves, if any. + (pygio_notify_free): Likewise. + + * gio/gfile.override (file_progress_callback_marshal): Use new + chaining functionality to avoid leaking the second PyGIONotify + structure. Rename 'callback' as 'progress_callback' for clarity. + +2009-04-12 Gian Mario Tagliaretti + + * gio/gio.defs: (g_file_monitor) should accept None + for cancellable and set the default flag to G_FILE_MONITOR_NONE. + +2009-04-09 Jonathan Matthew + + Bug 575781 – pyg_notify_free needs to ensure it has GIL before calling + Py_XDECREF + + * gio/gio.override: Ensure we're holding the GIL before potentially + destroying the callback and data. + +2009-04-05 Gian Mario Tagliaretti + + * gio/gfile.override: + (_wrap_g_file_set_display_name_async) Wrap new GFile method. + + * tests/test_gio.py: Test the above methods. + +2009-04-05 Tristan Hill + + reviewed by: Gustavo J. A. M. Carneiro. + + * glib/pygoptioncontext.c (pyg_option_get_context): Add a + semi-private method to return the option context C object from an + option context wrapper. Used in gnome-python for fixing Bug + #507174. + +2009-04-05 Gustavo J. A. M. Carneiro + + * gobject/pygtype.c (pyg_value_from_pyobject): Bug 577999 – + converting a negative long Python value to a GUINT64 GValue + doesn't error out as it should. + +2009-04-04 Gian Mario Tagliaretti + + * gio/gfile.override: + (_wrap_g_file_set_attributes_async) + (_wrap_g_file_set_attributes_finish) Wrap new GFile methods. + + * tests/test_gio.py: Test the above methods. + +2009-03-31 Gian Mario Tagliaretti + + * gio/gfile.override: + (_wrap_g_file_query_filesystem_info_async) Fix a typo. + +2009-03-31 Gian Mario Tagliaretti + + * gio/gfile.override: + (_wrap_g_file_query_filesystem_info_async) Wrap new GFile method. + +2009-03-31 Gian Mario Tagliaretti + + * gio/gio.defs: Add missing g_file_query_filesystem_info_async and + g_file_query_filesystem_info_finish + +2009-03-30 Gian Mario Tagliaretti + + * gio/gfile.override: (_wrap_g_file_mount_mountable) + Swap kwargs names to reflect the code. + +2009-03-30 Gian Mario Tagliaretti + + * gio/gfile.override: (_wrap_g_file_mount_enclosing_volume) + Swap kwargs names to reflect the code. + +2009-03-30 Gian Mario Tagliaretti + + * gio/gfile.override: + (_wrap_g_file_find_enclosing_mount_async) Wrap new GFile method. + +2009-03-30 Gian Mario Tagliaretti + + * gio/gfile.override: + (_wrap_g_file_eject_mountable) Wrap new GFile method. + +2009-03-30 Gian Mario Tagliaretti + + * gio/gfile.override: (_wrap_g_file_copy) revert previous commit. + +2009-03-30 Gian Mario Tagliaretti + + * gio/gfile.override: (_wrap_g_file_copy) callback cannot be optional. + +2009-03-29 Gian Mario Tagliaretti + + * gio/gvolume.override: (_wrap_g_volume_mount) should accept None + for mount_operation. + +2009-03-29 Gian Mario Tagliaretti + + * gio/gvolume.override: Swap kwargs names to reflect the code. + +2009-03-29 Tobias Mueller + + * ltihooks.py: + * pygtk.py: + * COPYING: + * gobject/pygparamspec.h: + * gobject/pygpointer.c: + * gobject/ffi-marshaller.h: + * gobject/pygtype.c: + * gobject/__init__.py: + * gobject/pygpointer.h: + * gobject/pygtype.h: + * gobject/pygflags.c: + * gobject/pyginterface.c: + * gobject/pygflags.h: + * gobject/pygboxed.c: + * gobject/gobjectmodule.c: + * gobject/pygenum.c: + * gobject/pyginterface.h: + * gobject/pygboxed.h: + * gobject/pygobject.c: + * gobject/constants.py.in: + * gobject/pygenum.h: + * gobject/propertyhelper.py: + * gobject/pygparamspec.c: + * gobject/ffi-marshaller.c: + * glib/pygmainloop.c: + * glib/pygoptioncontext.h: + * glib/pygmainloop.h: + * glib/pyglib-private.h: + * glib/__init__.py: + * glib/pygoptiongroup.c: + * glib/pygspawn.c: + * glib/pygmaincontext.c: + * glib/pygoptiongroup.h: + * glib/pygspawn.h: + * glib/pygmaincontext.h: + * glib/option.py: + * glib/pygsource.c: + * glib/glibmodule.c: + * glib/pygiochannel.h: + * glib/pygsource.h: + * glib/pyglib.c: + * glib/pyglib.h: + * glib/pyglib-python-compat.h: + * glib/pygoptioncontext.c: + * gio/gfileinfo.override: + * gio/gappinfo.override: + * gio/__init__.py: + * gio/gfileattribute.override: + * gio/gvolume.override: + * gio/gio.override: + * gio/ginputstream.override: + * gio/goutputstream.override: + * gio/unix.override: + * gio/gfile.override: + * gio/gvolumemonitor.override: + * gio/gapplaunchcontext.override: + * gio/giomodule.c: + * gio/gfileenumerator.override: + * gio/pygio-utils.c: + * gio/unixmodule.c: + * gio/pygio-utils.h: + * gio/gicon.override: + Update the address of the FSF, by replacing old bits of the address + with new ones. + Fixes bug 577134 + +2009-03-29 Gian Mario Tagliaretti + + * gio/gio.defs: Add g_volume_should_automount + +2009-03-28 Gian Mario Tagliaretti + + * gio/pygio-utils.[hc]: (strv_to_pylist) (pylist_to_strv) add a couple + of convinence functions to convert from/to a python list and an array + of strings. + + * gio/Makefile.am + * gio/gdrive.override: + * gio/gio.override: Strip GDrive overrides and + wrap g_drive_enumerate_identifiers + + * tests/test_gio.py: + * gio/gvolume.override: wrap g_volume_enumerate_identifiers + + * gio/gio.defs: add missing g_drive_get_identifier and + g_drive_enumerate_identifiers + +2009-03-22 Mark Lee + + Bug 559001 – Allow setting pytype wrapper class + + initial patch by: John Ehresman + + * gobject/pygtype.c (_wrap_g_type_wrapper__set_pytype): New function. + + * tests/test_gtype.py (GTypeTest.assertPyType), + (GTypeTest.setInvalidPyType), (GTypeTest.testPyType), + (GTypeTest.testInvalidPyType): Two new testcases to test the above, + with accompanying helper methods. + +2009-03-22 Gian Mario Tagliaretti + + * gio/gio.defs: Add g_file_enumerator_get_container, new in 2.18 + +2009-03-22 Gian Mario Tagliaretti + + * gio/gfileenumerator.override (_wrap_g_file_enumerator_close_async) + wrap new method. + + * tests/test_gio.py (TestGFileEnumerator.testCloseFilesAsync): + Test the above. + +2009-03-09 Gian Mario Tagliaretti + + * docs/reference/Changelog: Create a dedicated Changelog for the docs + and move the latest entries in there. + +2009-02-20 James Henstridge + + * ltihooks.py: pull in changes from pygtk (updating license header + from GPL to LGPL). + +2009-02-18 Andre Klapper + + * gobject/pygobject.h: + Change comment to avoid false positives when grep'ing for + deprecated gtk functions + +2009-02-17 Gustavo J. A. M. Carneiro + + * gio/gfile.override, gio/gio.defs, gio/gio.override: Bug 556250 + again. I screwed up and gave misinformation about how to fix it. + It must be pyg_begin/end_allow_threads, pyg_block/unblock_threads + is only to be used for async callbacks. + +2009-02-10 Gian Mario Tagliaretti + + Bug 556250 – non-async functions don't release python locks before + calling blocking C functions + + * gio/gio.override: + * gio/gfile.override: + * gio/gio.defs: release the thread lock. + +2009-02-10 Gian Mario Tagliaretti + + * gio/gio.defs: + * gio/gio-types.defs: + * gio/unix.defs: Add 2.18 gio API. + +2009-02-08 Gian Mario Tagliaretti + + Bug 568427 – "gio.Error: Too many open files" without too many + open files + + * gobject/pygtype.c (_wrap_g_type_wrapper__get_name): + * gobject/gobjectmodule.c (get_type_name_for_class): + * gobject/pygobject.c (build_parameter_list), (PyGProps_length): + * gio/gfileinfo.override (_wrap_g_file_info_list_attributes): + * gio/gio.override (_wrap_g_content_type_guess): + * gio/gfile.override (_wrap__file_init), (_wrap_g_file_load_contents) + (_wrap_g_file_load_contents_finish): Remove some memory leaks. + + * gio/gio.defs: add (caller-owns-return #t) all over the place to + prevent memory leaks. + + patch contributed by Paul Pogonyshev, Paolo Borelli and + Gian Mario Tagliaretti. + +2009-02-06 Murray Cumming + + * codegen/h2def.py DefsWriter::write_enum_defs(): Prevent an exception + when the prefix is empty. + +2009-01-29 Paul Pogonyshev + + Bug 569350 – Inconsistent use of tabs and spaces in pygtk.py + + * pygtk.py: Replace all tabs with spaces. + +2009-01-29 Paul Pogonyshev + + Bug 567792 – gio.InputStream.read_async can cause memory + corruption + + * gio/gio.override (py_decref_callback): Remove (unused now). + (pygio_notify_allocate_buffer, pygio_notify_attach_to_result) + (pygio_notify_get_attached): New functions. + (async_result_callback_marshal): Attach to the result object if + asked and then don't free self. Fix reference leak (spotted by + Gustavo). + + * gio/ginputstream.override (async_result_callback_marshal_read): + Remove. Use new attachment functionality in + async_result_callback_marshal() instead. + (_wrap_g_input_stream_read_async): Use the new functions (also + those mentioned in the cleanup log below). + (_wrap_g_input_stream_read_finish): Use the new functions. + +2009-01-27 Daniel Elstner + + * codegen/docextract_to_xml.py (escape_text): Do not escape the + ampersand "&" in entity references (bug #568485). Replace some + unusual entity references in the output with their literal values. + +2009-01-14 Paul Pogonyshev + + Bug 566571 – gtk.Buildable interface method override is not + recognized + + * gobject/gobjectmodule.c (pyg_type_add_interfaces): New function, + break out code repetition out of pyg_type_register(). + + * tests/test_subtype.py + (TestSubType.test_gtk_buildable_virtual_method): New test + case (inactive). + +2009-01-14 Paul Pogonyshev + + Bug 566706 – cleanup GIO overrides + + * gio/gio.override (pygio_notify_new) + (pygio_notify_using_optional_callback) + (pygio_notify_callback_is_valid_full) + (pygio_notify_callback_is_valid) + (pygio_notify_reference_callback): New functions. + (pygio_notify_free): Rename from pygio_free_notify() and extend. + (async_result_callback_marshal): Warn if new `referenced' field is + not set (programming error). + (_wrap_g_drive_eject, _wrap_g_drive_poll_for_media) + (_wrap_g_mount_unmount, _wrap_g_mount_eject) + (_wrap_g_mount_remount): Lots of cleanup: use new functions + instead of repeating code, unify and fix error handling. + + * gio/gfile.override (_wrap_g_file_read_async) + (_wrap_g_file_load_contents_async) + (_wrap_g_file_enumerate_children_async) + (_wrap_g_file_mount_mountable, _wrap_g_file_unmount_mountable) + (_wrap_g_file_mount_enclosing_volume, _wrap_g_file_copy) + (_wrap_g_file_copy_async, _wrap_g_file_move) + (_wrap_g_file_append_to_async, _wrap_g_file_create_async) + (_wrap_g_file_replace_async, _wrap_g_file_query_info_async) + (_wrap_g_file_replace_contents_async): Similar cleanup. + + * gio/gfileenumerator.override + (_wrap_g_file_enumerator_next_files_async): Similar cleanup. + + * gio/gicon.override (_wrap_g_loadable_icon_load_async): Similar + cleanup. + + * gio/ginputstream.override (_wrap_g_input_stream_close_async): + Similar cleanup. + + * gio/goutputstream.override (_wrap_g_output_stream_write_async) + (_wrap_g_output_stream_close_async): Similar cleanup. + + * gio/gvolume.override (_wrap_g_volume_mount) + (_wrap_g_volume_eject): Similar cleanup. + + * tests/test_gio.py (TestFile.test_copy_async): Fix the test. + +2009-01-09 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pyg_type_register): Add a comment + explaining why the two for loops for registering interfaces. + +2009-01-07 Paul Pogonyshev + + Bug 566744 – _wrap_g_input_stream_read_async() argument parsing + has incorrect keyword args + + * gio/ginputstream.override (_wrap_g_input_stream_read_async): Fix + keyword list to be in sync with positional arguments. + +2009-01-06 Gian Mario Tagliaretti + + Bug 566737 – Bad -I ordering can break build + + * Makefile.am: + * gobject/Makefile.am: + * gio/Makefile.am: + * tests/Makefile.am: + Commit a patch from [dmacks at netspace dot org] + +2009-01-04 Mads Chr. Olesen + + * gio/gio.defs (gio.File.copy_async, gio.File.copy_finish): Define + methods. + + * gio/gfile.override (_wrap_g_file_copy_async): New function. + + * tests/test_gio.py (TestFile.test_copy_async): Test the methods. + +2009-01-04 Przemysław Grzegorczyk + + Bug 563714 – GNOME Goal: Clean up GLib and GTK+ includes + + * gobject/generate-constants.c: + * glib/pygspawn.c: Only include toplevel . + +2009-01-04 Paul Pogonyshev + + Bug 564018 – pygobject libtool-2.2 patch + + * configure.ac: Apply the patch provided by Cygwin Ports + maintainer. + +2009-01-04 Paul Pogonyshev + + * configure.ac: Branch, bump version to 2.17.0. + +=== 2.16.0 === +2008-12-24 Paul Pogonyshev + + Bug 547119 – gobject.timeout_add_seconds() not found in docs + + * docs/reference/pyglib-functions.xml (glib.timeout_add_seconds): + Describe. + +2008-12-21 Paul Pogonyshev + + Bug 564102 – _wrap_g_output_stream_write_async not adding a + reference to the buffer passed + + * gio/gio.override (pygio_notify_copy_buffer): New function. + (pygio_free_notify): Free new `buffer' field if it is set. + + * gio/goutputstream.override (_wrap_g_output_stream_write_async): + Copy the buffer with new pygio_notify_copy_buffer() and use the + copy for g_output_stream_write_async() call. + + * gio/gfile.override (_wrap_g_file_replace_contents_async): Same + as for _wrap_g_output_stream_write_async(). + +2008-12-03 Paul Pogonyshev + + * glib/pyglib.c (pyglib_error_check): Test if `domain' is not-null + before using it (avoids segfaults, see bug #561826). + +2008-10-31 John Finlay + + * codegen/__init__.py (__all__): Add defsgen to __all__ list. + + * codegen/h2def.py (find_enum_defs): Strip out # directives from + enum defintions. + (clean_func): Change ' * G_CONST_RETURN * ' to '** ' + + * codegen/Makefile.am (codegen_PYTHON): Add defsgen.py + + * codegen/defsgen.py (typecode): Use the passed in prefix as a + hint when creating a typecode. + (split_prefix,write_enum_defs,_write_obj_helper): Add function to + use passed in prefix as a hint when splitting an object name into + module and name. + + * codegen/h2def.py (DefsWriter.write_enum_defs): Make sure the + prefix ends with a _ i.e. really handle the GDK_FONT_FONT, + GDK_FONT_FONTSET case. + +2008-09-12 Gian Mario Tagliaretti + + * gio/goutputstream.override + (g_output_stream_write_all): use gsize instead of gssize. + +2008-09-10 Paul Pogonyshev + + Bug 530935 – pygobject_set_properties doesnt release the GIL + + * gobject/pygobject.c (pygobject_set_properties): Reuse + set_property_from_pspec() which release GIL for us. Also make + sure that g_object_thaw_notify() is called even after error. + +2008-09-09 Paul Pogonyshev + + Bug 549517 – add __repr__ to gio.Drive, gio.Mount and gio.Volume + + * gio/gio.override (_wrap_g_drive_tp_repr, _wrap_g_mount_tp_repr): + New functions. + + * gio/gvolume.override (_wrap_g_volume_tp_repr): New function. + +2008-09-09 Loïc Minier + + Bug 551227 – Missing AC_CONFIG_MACRO_DIR([m4]) + + * configure.ac: Add AC_CONFIG_MACRO_DIR. + +2008-09-08 Paul Pogonyshev + + Bug 551056 – make codegen not import when corresponding argument + types are not registered + + * codegen/override.py (import_pat): Add support for optional 'for' + clause. + (Overrides.__parse_override): Handle it. + + * codegen/codegen.py (SourceWriter.write_imports) + (SourceWriter.write_object_imports): Adapt for changes in + get_imports() return value. + (is_registered_object): New function. + +2008-09-07 Frederic Peters + + * gio/gfile.override (_wrap_g_file_load_contents) + (_wrap_g_file_load_contents_finish): Fix typos breaking + compilation (bug #551212). + +2008-09-07 Jonathan Matthew + + Bug 551059 – GFile load_contents methods chop data at first \0 + + * gio/gfile.override: + Use 's#' (length specified) rather than 's' when constructing + result values in load_contents and load_contents_finish. + +2008-09-03 Johan Dahlin + + * configure.ac: + Post release version bump + +=== 2.15.4 === +2008-09-03 Johan Dahlin + + * NEWS: Update + +2008-09-03 Loïc Minier + + * gobject/pygpointer.c: (pyg_register_pointer): + Fix typo (s/&type/type) introduced in r886 causing weird crashes on + x86-64; bug #550463. + +2008-09-01 Gian Mario Tagliaretti + + * codegen/argtypes.py: add G_TYPE_CLOSURE boxed type in codegen. + +2008-08-31 Johan Dahlin + + * configure.ac: + Post release version bump + +=== 2.15.3 === +2008-08-31 Johan Dahlin + + * NEWS: Update + +2008-08-30 Gustavo J. A. M. Carneiro + + * glib/pyglib.h: * gobject/pygobject.c: Fix memory problems + reported by valgrind due to invalid tp_basicsize in + PyGPropsDescr_Type. Closes #549945. + +2008-08-28 Paul Pogonyshev + + Bug 549191 – Constructor of gtk.TreeView raises TypeError when + model is None + + * gobject/pygtype.c (pyg_value_from_pyobject): Handle None in + G_TYPE_INTERFACE branch. + +2008-08-28 Paul Pogonyshev + + Bug 549351 – an unitialized variable in PyGLib + + * glib/pygmainloop.c (pyg_main_loop_init): Initialize + `is_running'. + +2008-08-28 Paul Pogonyshev + + Bug 547633 – cannot create new threads when pygtk is used + + * glib/pyglib.c (_pyglib_notify_on_enabling_threads): New + function. + (pyglib_enable_threads): Invoke all callbacks added with new + _pyglib_notify_on_enabling_threads(). + + * gobject/gobjectmodule.c (pyg_note_threads_enabled): New + function (callback for new _pyglib_notify_on_enabling_threads()). + (PYGLIB_MODULE_START): Initialize + 'pygobject_api_functions.threads_enabled' and also watch for + thread being enabled later on. + +2008-08-28 Paul Pogonyshev + + Bug 547088 – wrap g_content_types_get_registered() + + * gio/gio.override (_wrap_g_drive_get_volumes): Fix refleak. + (_wrap_g_content_types_get_registered): New function. + + * gio/gfileenumerator.override (_wrap_g_file_enumerator_next_files_finish): + Fix refleak. + + * gio/gvolumemonitor.override (_wrap_g_volume_monitor_get_connected_drives): + Fix refleak. + (_wrap_g_volume_monitor_get_volumes): Likewise. + (_wrap_g_volume_monitor_get_mounts): Likewise. + +2008-08-28 Paul Pogonyshev + + Bug 547494 – gio.InputStream.read() looks broken + + * gio/gio.defs (gio.InputStream.read_part): Rename from read(), + document. + (gio.InputStream.read): Rename from read_all(), document. + (gio.OutputStream.write_part): Rename from write(), document. + (gio.OutputStream.write): Rename from write_all(), document. + + * gio/ginputstream.override (_wrap_g_input_stream_read): Fix + several bugs. + (_wrap_g_input_stream_read_all): New function. + + * gio/goutputstream.override (_wrap_g_output_stream_write_all): + New function. + + * tests/test_gio.py (TestInputStream.testRead): Add more tests. + (TestInputStream.test_read_part): New test. + (TestInputStream._read_in_loop): New helper method. + (TestOutputStream.test_write_part): New test. + +2008-08-16 Paul Pogonyshev + + * gio/gfile.override (_wrap_g_file_enumerate_children_async): Fix + keywords getting out of sync with actual argument order. + +2008-08-13 Paul Pogonyshev + + Bug 547495 – wrap four important asynchronous methods in gio.Drive + and gio.Mount + + * gio/gio.defs (gio.Drive.eject, gio.Drive.poll_for_media) + (gio.Mount.remount): Document. + + * gio/gio.override (_wrap_g_drive_eject) + (_wrap_g_drive_poll_for_media, _wrap_g_mount_eject) + (_wrap_g_mount_remount): New functions. + +2008-08-12 Paul Pogonyshev + + Bug 547484 – wrap gio.DataInputStream.read_line and ...read_until + + * tests/test_gio.py (TestDataInputStream): New test case. + + * gio/gio.defs (gio.DataInputStream.read_line) + (gio.DataInputStream.read_until): Document. + + * gio/ginputstream.override (_wrap_g_data_input_stream_read_line) + (_wrap_g_data_input_stream_read_until): New functions. + +2008-08-12 Paul Pogonyshev + + Bug 547354 – wrap a few memory stream methods + + * gio/ginputstream.override (_wrap_g_memory_input_stream_add_data): + New function. + + * gio/gio.defs (gio.MemoryOutputStream.get_contents): Rename from + get_data() to avoid name clash. + + * gio/goutputstream.override (_wrap_g_memory_output_stream_new) + (_wrap_g_memory_output_stream_get_data): New functions. + + * tests/test_gio.py (TestMemoryInputStream) + (TestMemoryOutputStream): New test cases. + +2008-08-12 Paul Pogonyshev + + * gio/gio.override: Ignore `g_io_module*' and `g_io_scheduler_*'. + +2008-08-11 Paul Pogonyshev + + Bug 540376 – No TypeError raised when type is None + + * gobject/gobjectmodule.c (pyg_signal_new): Add check on second + argument type. + + * tests/test_signal.py (TestSignalCreation): New test case. + +2008-08-11 Paul Pogonyshev + + Bug 547104 – improve type wrapper creation + + * gio/gappinfo.override (_wrap_g_app_info_tp_richcompare) + (_wrap_g_app_info_tp_repr): New functions. + + * tests/test_gio.py (TestAppInfo.test_eq): New test. + +2008-08-11 Paul Pogonyshev + + Bug 547104 – improve type wrapper creation + + * gobject/pygobject.c (pygobject_register_class): Use new + pygobject_inherit_slots() to propagate custom slots in normal + types too. + (pygobject_inherit_slots): New function, break out of + pygobject_new_with_interfaces() and rewrite a bit. + (pygobject_find_slot_for): Add new argument that can forbid + overriding non-NULL slots. + + * gio/gicon.override (pygio_do_icon_richcompare): Remove, the code + is now directly in _wrap_g_icon_tp_richcompare(). + (_wrap_g_file_icon_tp_richcompare, _wrap_g_file_icon_tp_hash) + (_wrap_g_themed_icon_tp_richcompare, _wrap_g_themed_icon_tp_hash): + Remove, duplicating code in this way is not needed anymore. + +2008-08-10 Paul Pogonyshev + + Bug 546120 – make gio.File more Pythonic + + * gio/gfile.override (_wrap_g_file_tp_richcompare) + (_wrap_g_file_tp_hash, _wrap_g_file_tp_repr): New functions. + + * tests/test_gio.py (TestFile.test_eq, TestFile.test_hash): New + tests. + +2008-08-10 Paul Pogonyshev + + Bug 547104 – improve runtime type wrapper creation + + * gobject/pygobject.c (pygobject_new_with_interfaces): Use new + pygobject_find_slot_for() for `tp_richcompare', `tp_compare`, + `tp_hash', `tp_iter', `tp_repr', `tp_str' and `tp_print'. + (pygobject_find_slot_for): New static function. + +2008-08-10 Jonathan Matthew + + Bug 547134 – fix docstring line length + + * gio/gio.defs: + Fix docstring line lengths so they don't wrap across lines in an 80 + column terminal. + +2008-08-10 Gian Mario Tagliaretti + + * gio/gio.defs: + Add GFile.query_default_handler which was missing from the defs. + +2008-08-10 Jonathan Matthew + + Bug 547067 – add File.replace_contents, replace_contents_async, + replace_contents_finish. + + * gio/gfile.override: + * gio/gio.defs: + * tests/test_gio.py: + Add overrides, docs, and tests for File.replace_contents, + replace_contents_async, and replace_contents_finish. + +2008-08-09 Paul Pogonyshev + + * tests/test_gicon.py (TestThemedIcon.test_constructor): Fix to + not use `use_default_fallbacks' property (it's new). + +2008-08-09 Paul Pogonyshev + + Bug 546135 – GIcon and implementations improvements + + * gio/gio.defs (g_file_icon_new): Change from method of gio.File + to constructor of gio.FileIcon. + + * tests/test_gicon.py (TestIcon.test_eq, Test_Eq.test_hash) + (TestLoadableIcon.setUp): Adapt accordingly. + (TestFileIcon): New test case. + +2008-08-09 Paul Pogonyshev + + Bug 546591 – File.copy progress_callback does not work + + * gio/gfile.override (file_progress_callback_marshal): Use + PyObject_CallFunction() instead of PyEval_CallFunction(). Use "K" + instead of "k" (the latter is not correct for 32-bit platforms). + Don't free 'notify' here. + (_wrap_g_file_copy): Free 'notify'. + (_wrap_g_file_move): Likewise. + + * gio/gio.override (pygio_free_notify): New function. + (async_result_callback_marshal): Use it. + + * tests/test_gio.py (TestFile.test_copy_progress.progress): New + test. + +2008-08-09 Paul Pogonyshev + + Bug 546135 – GIcon and implementations improvements + + * gio/gio.defs (gio.LoadableIcon.load) + (gio.LoadableIcon.load_async, gio.LoadableIcon.load_finish): + Document. + + * gio/Makefile.am: + * gio/gicon.override: New file: parts of 'gio.override', three + methods of gio.LoadableIcon and gio.ThemedIcon constructor. + + * gio/gio.override: Move over all icon-related overrides to + 'gicon.override'. + + * tests/Makefile.am: + * tests/test_gicon.py: New file: parts of 'test_gio.py' and + several new gio.Icon tests. + + * tests/test_gio.py (TestThemedIcon): Move over to + 'test_gicon.py'. + +2008-08-07 Jonathan Matthew + + Bug 546734 – Missing Py_INCREFs for some file async methods + + * gio/gfile.override: + Increment refcounts on callbacks and callback data for + append_to_async, create_async, replace_async, query_info_async and + load_contents_async as for all other async methods. + +2008-08-06 Johan Dahlin + + * gio/gfile.override: + * gio/gio.defs: + Move the progress callback for move/copy so it's consistent with + the documentation and positional arguments. Update documentation as well + +2008-08-06 Johan Dahlin + + * glib/pyglib.c (pyglib_enable_threads): + * gobject/gobjectmodule.c (pyg_threads_init), + (pygobject_enable_threads): + Add a pygobject_enable_threads wrapper around pyglib_threads_enable + and return 0/-1 which existing gobject based applications expect. + +2008-08-06 Johan Dahlin + + * glib/pyglib.c (pyglib_init): + return in case of error instead of trying to access the internal + types. + +2008-08-06 Paul Pogonyshev + + * gio/gio.override: Add 'pygio_do_icon_richcompare' prototype to + header. + (_wrap_g_file_icon_tp_repr, _wrap_g_themed_icon_tp_repr): Fix + return value type in signature. + +2008-08-05 Paul Pogonyshev + + Bug 546135 – GIcon and implementations improvements + + * gio/gio-types.defs (FileIcon): New 'define-object'. + + * gio/gio.override (pygio_do_icon_richcompare) + (_wrap_g_icon_tp_richcompare, _wrap_g_icon_tp_hash) + (_wrap_g_file_icon_tp_richcompare, _wrap_g_file_icon_tp_hash) + (_wrap_g_file_icon_tp_repr, _wrap_g_themed_icon_tp_richcompare) + (_wrap_g_themed_icon_tp_hash, _wrap_g_themed_icon_tp_repr): New + functions. + +2008-08-03 Gian Mario Tagliaretti + + Bug 546046 – Wrap GFile.replace_async and query_info_async + + * tests/test_gio.py: + * gio/gfile.override: + * gio/gio.defs: + Wrap GFile.replace_async and query_info_async with docs and test. + +2008-08-03 Paul Pogonyshev + + * glib/pyglib.h: + * glib/pyglib.c (pyglib_enable_threads): Change return value from + 'gboolean' to 'int' and changed semantics to Pythonic: restores + backwards compatibility. + + * gobject/gobjectmodule.c (pyg_threads_init): Treat return value + accordingly (bug #544946). + +2008-08-02 Gian Mario Tagliaretti + + Bug 546020 – Wrap GFile.create_async + + * tests/test_gio.py: + * gio/gfile.override: + * gio/gio.defs: + Wrap GFile.create_async with docs and test + +2008-08-02 Johan Dahlin + + * codegen/docgen.py: + Remove SGML support, require python 2.4, modernize, + PEP-8ify. Make it run on gio. + + * codegen/definitions.py: + Make property iterable + + * gio/gio.defs: + Include the gio-types.defs file. + +2008-08-02 Johan Dahlin + + * glib/glibmodule.c (pyglib_set_prgname): + * glib/pygoptioncontext.c (pyg_option_context_init), + (pyg_option_context_set_help_enabled), + (pyg_option_context_set_ignore_unknown_options), + (pyg_option_context_set_main_group), + (pyg_option_context_add_group): + * glib/pygoptiongroup.c (arg_func), (pyg_option_group_add_entries), + (pyg_option_group_set_translation_domain), + (pyg_option_group_compare), (pyglib_option_group_register_types): + Fix compilation warnings, clean up style and indentation. + +2008-08-02 Gian Mario Tagliaretti + + Bug 545959 – Wrap GFile.append_to_async + + * tests/test_gio.py: + * gio/gfile.override: + * gio/gio.defs: + Wrap GFile.append_to_async with docs and test + +2008-08-02 Johan Dahlin + + * gio/gfileinfo.override: + * gio/gio.override: + * glib/glibmodule.c (pyglib_get_current_time): + * glib/pyglib.c (pyglib_float_from_timeval): + * glib/pyglib.h: + Add pyglib_float_from_timeval and use it + +2008-08-02 Johan Dahlin + + * docs/Makefile.am: + * docs/reference/pyglib-constants.xml: + * docs/reference/pyglib-functions.xml: + * docs/reference/pyglib-maincontext.xml: + * docs/reference/pyglib-mainloop.xml: + * docs/reference/pygobject-classes.xml: + * docs/reference/pygobject-constants.xml: + * docs/reference/pygobject-functions.xml: + * docs/reference/pygobject-maincontext.xml: + * docs/reference/pygobject-mainloop.xml: + Separate the glib and gobject bindings in the manual. + +2008-08-02 Gian Mario Tagliaretti + + Bug 545920 – Wrap GFile.query_writable_namespaces + + * tests/test_gio.py: + * gio/gfile.override: + * gio/gio.defs: + Wrap GFile.query_writable_namespaces with docs and test + +2008-08-02 Johan Dahlin + + * gio/gio.defs: + * gio/gfile.override: + * tests/test_gio.py: + Wrap gio.File.move + +2008-08-02 Johan Dahlin + + * gio/Makefile.am: + * gio/gfile.override: + * gio/gio.defs: + * gio/gio.override: + * gio/gvolume.override: + Wrap gio.Volume.mount and gio.Volume.eject + +2008-08-01 Gian Mario Tagliaretti + + * gio/gio.defs: + Add docstring for gio.FileInfo.list_attributes + +2008-08-01 Johan Dahlin + + Bug 545861 – g_file_info_get_modification_time is missing + * gio/gfileinfo.override: + * gio/gio.defs: + * tests/test_gio.py: + Wrap, add test and documentation + +2008-08-01 Johan Dahlin + + Bug 545846 – g_vfs_get_supported_uri_schemes is missing + + * gio/gio.defs: + * gio/gio.override: + * tests/test_gio.py: + Wrap, add test and documentation + +2008-08-01 Johan Dahlin + + * glib/glibmodule.c (pyglib_set_application_name): + Use %r instead of %s, this is not python! + +2008-07-31 Johan Dahlin + + * glib/glibmodule.c (pyglib_set_prgname) + (pyglib_set_application_name): Use METH_O instead of METH_VARARGS. + (_glib_functions): Add doc strings for idle_add, timeout_add, + timeout_add_seconds, io_add_watch, child_watch_add, source_remove, + main_depth and main_context_default. + +2008-07-29 Gian Mario Tagliaretti + + * tests/test_gio.py: + * gio/gfileattribute.override: + * gio/gio.override: + * gio/gio.defs: + * gio/gfile.override: + * gio/Makefile.am: Wrap new object gio.FileAttributeInfo, + g_file_set_attribute and g_file_query_settable_attributes methods. + +2008-07-29 Gian Mario Tagliaretti + + * gio/unix-types.defs: Wrap gio.unix.DesktopAppInfo + + * gio/gappinfo.override: + * gio/gio.override: + * gio/gio.defs: + * gio/gapplaunchcontext.override: + * gio/Makefile.am: Wrap g_app_info_launch_uris, + g_app_info_launch, g_app_launch_context_get_display and + g_app_launch_context_get_startup_notify_id + + * gio/pygio-utils.c: + * gio/pygio-utils.h: Add a couple of useful function to reduce the + code in wrapped methods. + +2008-07-29 Johan Dahlin + + * examples/gio/downloader.py: + * gio/giomodule.c (init_gio): + Add gio.FILE_ATTRIBUTE_* constants and update the examples to use them. + +2008-07-29 Johan Dahlin + + * examples/gio/downloader.py: + Add a new example + + * gio/ginputstream.override: + Use a string internally instead of a PyStringObject when + in read_async. Create a new python string in finish and + honor the number of bytes read. + +2008-07-28 Johan Dahlin + + * glib/pyglib-python-compat.h: + * gobject/pygobject-private.h: + Move all compatibility into the same place, fixes build + on python 2.4. + +2008-07-27 Johan Dahlin + + * glib/option.py: + Remove tabs. Use sys.exc_info()[1] to fetch the exception value + + * gobject/__init__.py: + * gobject/propertyhelper.py: + Import gobject._gobject instead of just gobject. + + * gobject/Makefile.am: + * gobject/constants.py.in: + * gobject/generate-constants.c (main): + Don't add long suffix if python >= 3.0 + +2008-07-27 Johan Dahlin + + * glib/pyglib-python-compat.h: + * gobject/gobjectmodule.c (pyg_object_new), + (pyg__install_metaclass): + * gobject/pygboxed.c (pyg_boxed_dealloc), (pyg_boxed_init), + (pyg_register_boxed): + * gobject/pygenum.c (pyg_enum_reduce): + * gobject/pyginterface.c (pyg_interface_init), + (pyg_register_interface): + * gobject/pygobject.c (pygobject_get_inst_data), + (pygobject_register_class), (pygobject_new_with_interfaces), + (pygobject_dealloc), (pygobject_repr), (pygobject_emit), + (pygobject_chain_from_overridden), (pygobject_weak_ref_notify): + * gobject/pygparamspec.c (pygobject_paramspec_register_types): + * gobject/pygpointer.c (pyg_pointer_dealloc), (pyg_pointer_init), + (pyg_register_pointer): + * gobject/pygtype.c (pyg_type_from_object), + (pyg_value_array_from_pyobject), (pyg_value_from_pyobject), + (pyg_object_descr_doc_get): + Use the Py_TYPE macro everywhere. + +2008-07-27 Johan Dahlin + + * glib/pyglib-python-compat.h: + Add a Py_TYPE macro for accessing ob_type. + * glib/glibmodule.c (pyglib_register_constants): + * gobject/gobjectmodule.c (pygobject__g_instance_init), + (pyg_integer_richcompare): + * gobject/pygenum.c (pyg_enum_repr), (pyg_enum_from_gtype), + (pyg_enum_add), (pyg_enum_get_value_name), + (pyg_enum_get_value_nick): + * gobject/pygflags.c (pyg_flags_repr), (pyg_flags_from_gtype), + (pyg_flags_add), (pyg_flags_and), (pyg_flags_or), (pyg_flags_xor), + (pyg_flags_get_first_value_name), (pyg_flags_get_first_value_nick), + (pyg_flags_get_value_names), (pyg_flags_get_value_nicks): + Use Py_TYPE and PyLong macros to access struct fields + +2008-07-27 Johan Dahlin + + * gobject/gobjectmodule.c (pyg_param_spec_from_object), + (add_properties), (pyg_signal_new), (pyg_signal_list_ids), + (pyg_signal_lookup), (pyg_signal_query): + * gobject/pygenum.c (pyg_enum_richcompare), (pyg_enum_new), + (pyg_enum_from_gtype), (pyg_enum_add), (pyg_enum_reduce), + (pygobject_enum_register_types): + * gobject/pygflags.c (pyg_flags_richcompare), (pyg_flags_new), + (pyg_flags_from_gtype), (pyg_flags_add), (pyg_flags_and), + (pyg_flags_or), (pyg_flags_xor), (pygobject_flags_register_types): + * gobject/pygobject-private.h: + * gobject/pygobject.c (pygobject_disconnect_by_func), + (pygobject_handler_block_by_func), + (pygobject_handler_unblock_by_func), (pygobject_get_refcount): + * gobject/pygparamspec.c (pyg_param_spec_getattr): + * gobject/pygtype.c (_wrap_g_type_wrapper__get_depth), + (pyg_type_from_object), (pyg_enum_get_value), + (pyg_flags_get_value), (pyg_value_from_pyobject), + (pyg_value_as_pyobject): + Use _PyLong macros. + +2008-07-27 Johan Dahlin + + * gobject/pygboxed.c (pygobject_boxed_register_types): + * gobject/pygenum.c (pygobject_enum_register_types): + * gobject/pygflags.c (pygobject_flags_register_types): + * gobject/pygobject.c (pygobject_object_register_types): + * gobject/pygparamspec.c (pygobject_paramspec_register_types): + * gobject/pygpointer.c (pygobject_pointer_register_types): + * gobject/pygtype.c (pygobject_type_register_types): + Use PYGLIB_DEFINE_TYPE macro and move struct field initialization + to the registration methods. + +2008-07-27 Johan Dahlin + + * glib/pyglib-python-compat.h: + Add _PyUnicode_Type macro + + * gobject/gobjectmodule.c (pyg_type_name), (pyg_type_from_name), + (_pyg_signal_accumulator), (add_signals), (add_properties), + (get_type_name_for_class), (pyg_signal_list_names), + (pyg_signal_name), (pyg_signal_query), (pyg_object_new), + (pyg_add_emission_hook), (pyg_remove_emission_hook): + * gobject/pygboxed.c (pyg_boxed_repr): + * gobject/pygenum.c (pyg_enum_repr), (pyg_enum_add), + (pyg_enum_get_value_name), (pyg_enum_get_value_nick): + * gobject/pygflags.c (pyg_flags_repr), (pyg_flags_add), + (pyg_flags_get_first_value_name), (pyg_flags_get_first_value_nick), + (pyg_flags_get_value_names), (pyg_flags_get_value_nicks): + * gobject/pygobject.c (build_parameter_list), (PyGProps_getattro), + (PyGProps_setattro), (pygobject_register_class), (pygobject_repr), + (pygobject_init), (pygobject_get_properties), + (pygobject_set_properties), (pygobject_connect), + (pygobject_connect_after), (pygobject_connect_object), + (pygobject_connect_object_after), (pygobject_emit), + (pygobject_stop_emission), (pygobject_disconnect_by_func), + (pygobject_handler_block_by_func), + (pygobject_handler_unblock_by_func), + (pygobject_object_register_types): + * gobject/pygparamspec.c (pyg_param_spec_repr), + (pyg_param_spec_getattr): + * gobject/pygpointer.c (pyg_pointer_repr): + * gobject/pygtype.c (pyg_type_wrapper_repr), + (_wrap_g_type_wrapper__get_name), (pyg_type_from_object), + (pyg_enum_get_value), (pyg_flags_get_value), + (pyg_value_from_pyobject), (pyg_value_as_pyobject), + (object_doc_descr_get), (_pyg_strv_from_gvalue), + (_pyg_strv_to_gvalue): + + Use _PyUnicode_* macros in the gobject module + +2008-07-27 Johan Dahlin + + * gobject/Makefile.am: + * gobject/gobjectmodule.c (PYGLIB_MODULE_START): + * gobject/pygobject-private.h: + Use glib macros to define the module, update export regexp. + +2008-07-27 Johan Dahlin + + * gobject/Makefile.am: + * gobject/gobjectmodule.c (init_gobject): + * gobject/pygboxed.c (pygobject_boxed_register_types): + * gobject/pygboxed.h: + * gobject/pygenum.c (pygobject_enum_register_types): + * gobject/pygenum.h: + * gobject/pygflags.c (pygobject_flags_register_types): + * gobject/pygflags.h: + * gobject/pygpointer.c (pygobject_pointer_register_types): + * gobject/pygpointer.h: + Split out quark and type registration to the respective + implementation source files, add headers. + +2008-07-27 Johan Dahlin + + * gobject/Makefile.am: + * gobject/gobjectmodule.c (pygobject_register_api), + (pygobject_register_constants), (pygobject_register_features), + (pygobject_register_version_tuples), (pygobject_register_warnings), + (init_gobject): + * gobject/pygobject-private.h: + * gobject/pygobject.c (pyobject_copy), (pyobject_free), + (pygobject_object_register_types): + * gobject/pygtype.c (_pyg_strv_from_gvalue), (_pyg_strv_to_gvalue), + (pygobject_type_register_types): + * gobject/pygtype.h: + Move off a bit more to separate functions, cleaning up the init_glib + a bit more. + +2008-07-27 Johan Dahlin + + * gobject/Makefile.am: + * gobject/gobjectmodule.c (init_gobject): + * gobject/pygobject-private.h: + * gobject/pygobject.c: + * gobject/pygparamspec.c (pygobject_paramspec_register_types): + * gobject/pygparamspec.h: + * gobject/pygtype.c: + Move paramspec registration to a separate file, add a header + for the internal API. + +2008-07-27 Paul Pogonyshev + + * gobject/pygtype.c (pyg_enum_get_value): Issue warning if 'obj' + is a PyGEnum of wrong type, i.e. not matching 'enum_type' (bug + #503771). + +2008-07-26 Johan Dahlin + + reviewed by: + + * glib/pyglib-python-compat.h: + * glib/pyglib.h: + Make a few macros public + + * gobject/Makefile.am: + * gobject/gobjectmodule.c (init_gobject): + * gobject/pyginterface.c (pyg_interface_init), + (pyg_interface_free), (pyg_register_interface), + (pyg_register_interface_info), (pyg_lookup_interface_info), + (pygobject_interface_register_types): + * gobject/pyginterface.h: + * gobject/pygobject-private.h: + * gobject/pygobject.c: + Move GInterface wrapper into its own file + +2008-07-26 Johan Dahlin + + * glib/Makefile.am: + Also export PyInit_glib + * glib/__init__.py: + import glib._glib instead of just _glib + * glib/pyglib-python-compat.h: + * glib/pygoptioncontext.c (pyg_option_context_parse): + * glib/pygsource.c (source_repr), (pyg_source_attach), + (pyg_source_get_priority), (pyg_source_set_priority), + (pyg_source_get_id), (pyg_source_prepare), (pyg_poll_fd_repr): + * glib/pygspawn.c (pyg_pid_close), (pyg_pid_free), (pyg_pid_new), + (pyglib_spawn_async), (pyglib_spawn_register_types): + Go over the rest and replace missing symbols on python3. + the glib module successfully compiles and runs now. + +2008-07-26 Johan Dahlin + + * glib/pygiochannel.c (py_io_channel_shutdown), + (py_io_channel_set_buffer_size), (py_io_channel_get_buffer_size), + (py_io_channel_set_buffered), (py_io_channel_get_buffered), + (py_io_channel_set_encoding), (py_io_channel_get_encoding), + (py_io_channel_read_chars), (py_io_channel_write_chars), + (py_io_channel_write_lines), (py_io_channel_flush), + (py_io_channel_set_flags), (py_io_channel_get_flags), + (py_io_channel_get_buffer_condition), + (py_io_channel_set_close_on_unref), (py_io_channel_add_watch), + (py_io_channel_win32_poll), (py_io_channel_win32_make_pollfd), + (py_io_channel_read_line), (py_io_channel_read_lines), + (py_io_channel_seek), (py_io_channel_init): + * glib/pyglib.c (pyglib_gerror_exception_check): + * glib/pygoptioncontext.c (pyg_option_context_init): + * glib/pygoptiongroup.c (check_if_owned): + * glib/pygsource.c (pyg_idle_init), (pyg_timeout_init), + (pyg_poll_fd_init): + gobject -> glib + +2008-07-26 Johan Dahlin + + * glib/pygmaincontext.c (pyglib_maincontext_register_types): + * glib/pygmainloop.c (pyg_main_loop_init), + (pyglib_mainloop_register_types): + * glib/pygoptioncontext.c (pyg_option_context_set_main_group), + (pyglib_option_context_register_types): + * glib/pygoptiongroup.c (pyglib_option_group_register_types): + * glib/pygspawn.c (pyglib_spawn_register_types): + Convert the pid/mainloop/maincontext/optiongroup/optioncontext. + +2008-07-26 Johan Dahlin + + * glib/pygsource.c (pyglib_source_register_types): + Convert the source objects to use macros, saves ~150 lines of code! + +2008-07-26 Johan Dahlin + + * glib/glibmodule.c (get_handler_priority), (pyglib_idle_add), + (pyglib_timeout_add), (pyglib_timeout_add_seconds), + (pyglib_io_add_watch), (pyglib_child_watch_add), + (pyglib_markup_escape_text), (pyglib_main_depth), + (pyglib_filename_from_utf8), (pyglib_get_application_name), + (pyglib_get_prgname), (PYGLIB_MODULE_START): + * glib/pygiochannel.c (py_io_channel_next), + (py_io_channel_shutdown), (py_io_channel_get_buffer_size), + (py_io_channel_get_buffered), (py_io_channel_get_encoding), + (py_io_channel_read_chars), (py_io_channel_write_chars), + (py_io_channel_write_lines), (py_io_channel_flush), + (py_io_channel_set_flags), (py_io_channel_get_flags), + (py_io_channel_get_buffer_condition), (py_io_channel_win32_poll), + (py_io_channel_read_line), (py_io_channel_read_lines), + (py_io_channel_seek), (pyglib_iochannel_register_types): + * glib/pyglib-private.h: + * glib/pyglib-python-compat.h: + * glib/pyglib.c (pyglib_init), (pyglib_error_check), + (pyglib_gerror_exception_check), + (pyglib_register_exception_for_domain): + Add macros for supporting additional python versions. + Start using them for the glib module. Tested on python 2.5 and 3.0. + +2008-07-26 Johan Dahlin + + * configure.ac: + * m4/python.m4: + Add macros which are compatible with python > 2.6. + +2008-07-26 Johan Dahlin + + * configure.ac: + Post release version bump + +=== 2.15.2 === +2008-07-26 Johan Dahlin + + * NEWS: Update + +2008-07-26 Johan Dahlin + + * gobject/Makefile.am (_gobject_la_SOURCES): Build fix, remove + extra \ + + * examples/gio/directory-async.py: + * gio/Makefile.am: + * gio/giomodule.c (init_gio): + * glib/pyglib.c (pyglib_error_check), + (pyglib_register_exception_for_domain): + * glib/pyglib.h: + * tests/test_gio.py: + Add a new API for registering exceptions for a GError domain. + Register a new exception for G_IO_ERROR, update tests + and examples to use the new exception. + +2008-07-26 Johan Dahlin + + * glib/pygoptioncontext.c (pyg_option_context_set_main_group), + (pyg_option_context_add_group): + Send in a PyObject instead of a PyGOptionGroup object. + +2008-07-26 Johan Dahlin + + * glib/Makefile.am: + * glib/glibmodule.c (pyglib_register_constants), (init_glib): + * glib/option.py: + * glib/pyglib.c (pyglib_init), + (pyglib_option_group_transfer_group), (pyglib_option_group_new), + (pyglib_option_context_new): + * glib/pyglib.h: + * glib/pygoptioncontext.c (pyg_option_context_parse), + (pyg_option_context_set_main_group), + (pyg_option_context_add_group), + (pyglib_option_context_register_types): + * glib/pygoptioncontext.h: + * glib/pygoptiongroup.c (arg_func), + (pyglib_option_group_register_types): + * glib/pygoptiongroup.h: + * gobject/Makefile.am: + * gobject/__init__.py: + * gobject/gobjectmodule.c (init_gobject): + * gobject/option.py: + * gobject/pygobject-private.h: + * gobject/pygoptioncontext.c: + * gobject/pygoptiongroup.c: + Move option over from gobject to glib. + +2008-07-26 Johan Dahlin + + * tests/common.py: + * tests/test_conversion.py: + * tests/test_enum.py: + * tests/test_interface.py: + * tests/test_option.py: + * tests/test_source.py: + * tests/test_subprocess.py: + * tests/test_subtype.py: + * tests/test_thread.py: + * tests/test_unknown.py: + Run pyflakes on the testsuite, remove unused imports + and reorganize others. + +2008-07-26 Johan Dahlin + + * glib/glibmodule.c (pyglib_register_constants), (init_glib): + * gobject/__init__.py: + * gobject/gobjectmodule.c (init_gobject): + Move over glib constants to gobject + * tests/test_gio.py: + * tests/test_mainloop.py: + * tests/test_source.py: + * tests/test_subprocess.py: + * tests/test_thread.py: + Update tests to refer to glib when appropriate + +2008-07-26 Johan Dahlin + + * README: + * configure.ac: + Bump required glib version to 2.10 + +2008-07-26 Johan Dahlin + + * glib/glibmodule.c (child_watch_dnotify), + (pyglib_child_watch_add): + * glib/pygiochannel.c (pyg_iowatch_data_free), + (py_io_channel_add_watch): + * glib/pygspawn.c (_pyg_spawn_async_callback), + (pyglib_spawn_async): + Use g_slice_new instead of g_new + +2008-07-25 Johan Dahlin + + * gobject/Makefile.am: + * tests/Makefile.am: + Make distcheck pass + +2008-07-25 Johan Dahlin + + * gobject/gobjectmodule.c (init_gobject): + * gobject/pygobject-private.h: + Remove private structures which moved to pyglib. + +2008-07-24 Johan Dahlin + + Bug 544600 – pygobject building failed since 839 revision, + error : "Py_ssize_t" undeclared + + * glib/pyglib-private.h: Add backward compatibility macros for + python 2.4. + + * gio/gfile.override: + * gio/gfileenumerator.override: + * gio/ginputstream.override: + * gio/gio.defs: + * gio/gio.override: + * gio/goutputstream.override: + * tests/test_gio.py: + Wrap gio.File.copy, add tests and documentation. + Rename PyGAsyncRequestNotify to PyGIONotify and reuse it. + +2008-07-23 Johan Dahlin + + * glib/pyglib.c (_pyglib_destroy_notify): + Rename the function too, not just the prototype! + +2008-07-21 Johan Dahlin + + * glib/glibmodule.c (pyglib_idle_add), (pyglib_timeout_add), + (pyglib_timeout_add_seconds), (pyglib_io_add_watch): + * glib/pyglib-private.h: + * glib/pyglib.c (pyglib_destroy_notify), (_pyglib_handler_marshal): + * glib/pyglib.h: + * glib/pygsource.c (pyg_source_set_callback): + Make pyglib_destroy_notify and pyglib_handler_marshal private. + Add a few public prototypes. + +2008-07-21 Johan Dahlin + + * glib/glibmodule.c (pyglib_idle_add), (pyglib_timeout_add), + (pyglib_timeout_add_seconds), (pyglib_io_add_watch), + (pyglib_source_remove), (pyglib_child_watch_add), + (pyglib_markup_escape_text), (pyglib_get_current_time), + (pyglib_main_depth), (pyglib_filename_display_name), + (pyglib_filename_display_basename), (pyglib_filename_from_utf8), + (pyglib_get_application_name), (pyglib_set_application_name), + (pyglib_get_prgname), (pyglib_set_prgname), (pyglib_register_api), + (pyglib_register_error): + Mark as static, rename from pyg_* -> pyglib_*. Fill in api struct, + rename struct and remove function suffix. + +2008-07-21 Johan Dahlin + + * glib/Makefile.am: + * glib/glibmodule.c (pyg_idle_add), (pyg_timeout_add), + (pyg_timeout_add_seconds), (pyg_io_add_watch), + (pyglib_register_api), (pyglib_register_error), + (pyglib_register_version_tuples), (init_glib): + * glib/pygiochannel.c (py_io_channel_next), + (py_io_channel_shutdown), (py_io_channel_set_encoding), + (py_io_channel_read_chars), (py_io_channel_write_chars), + (py_io_channel_write_lines), (py_io_channel_flush), + (py_io_channel_set_flags), (py_io_channel_read_line), + (py_io_channel_read_lines), (py_io_channel_seek), + (py_io_channel_init), (pyglib_iochannel_register_types): + * glib/pygiochannel.h: + * glib/pyglib-private.h: + * glib/pyglib.c (pyglib_threads_enabled), + (pyglib_gil_state_ensure), (pyglib_gil_state_release), + (pyglib_enable_threads), (pyglib_block_threads), + (pyglib_unblock_threads), (pyglib_set_thread_block_funcs), + (pyglib_handler_marshal), (pyglib_destroy_notify): + * glib/pyglib.h: + * glib/pygsource.c (pyg_source_set_callback), + (pyglib_source_register_types): + * glib/pygsource.h: + * glib/pygspawn.c (pyglib_spawn_register_types): + * glib/pygspawn.h: + * gobject/Makefile.am: + * gobject/__init__.py: + * gobject/gobjectmodule.c (pyg_set_thread_block_funcs), + (init_gobject): + * gobject/pygiochannel.c: + * gobject/pygobject-private.h: + * gobject/pygsource.c: + Move over Source, IOChannel, Idle, Timeout and PollFD to glib from + gobject. + Clean up and add a bit of new api for glib. + +2008-07-21 Johan Dahlin + + * configure.ac: + Use yes/no instead of true/false. Avoid bashism. + Fix another logic bug, and let's hope I didn't break anything + +2008-07-20 Paul Pogonyshev + + * configure.ac (pygobject_CODEGEN_DEFINES): Fix libffi check + logic. + +2008-07-20 Johan Dahlin + + * glib/Makefile.am: + * glib/glibmodule.c (pyglib_main_context_default), (init_glib): + * glib/pyglib.c (pyglib_init), (pyglib_threads_enabled), + (pyglib_main_context_new): + * glib/pyglib.h: + * glib/pygmaincontext.c (_wrap_g_main_context_iteration), + (pyglib_maincontext_register_types): + * glib/pygmaincontext.h: + * glib/pygmainloop.c (pyg_signal_watch_prepare), + (pyg_signal_watch_check), (pyg_main_loop_new), + (_wrap_g_main_loop_get_context), (_wrap_g_main_loop_run), + (pyglib_mainloop_register_types): + * glib/pygmainloop.h: + * gobject/Makefile.am: + * gobject/__init__.py: + * gobject/gobjectmodule.c (pyg_destroy_notify), (pyobject_free), + (pyg_object_set_property), (pyg_object_get_property), + (_pyg_signal_accumulator), (pygobject__g_instance_init), + (pyg_handler_marshal), (pygobject_gil_state_ensure), + (pygobject_gil_state_release), (marshal_emission_hook), + (_log_func), (init_gobject): + * gobject/pygboxed.c (pyg_boxed_dealloc), (pyg_boxed_new): + * gobject/pygenum.c (pyg_enum_add): + * gobject/pygflags.c (pyg_flags_add): + * gobject/pygiochannel.c (pyg_iowatch_marshal): + * gobject/pygmaincontext.c: + * gobject/pygmainloop.c: + * gobject/pygobject-private.h: + * gobject/pygobject.c (pygobject_data_free), (pyg_toggle_notify), + (pygobject_new_with_interfaces), (pygobject_weak_ref_notify): + * gobject/pygobject.h: + * gobject/pygoptiongroup.c (destroy_g_group), (arg_func): + * gobject/pygpointer.c (pyg_pointer_new): + * gobject/pygsource.c (pyg_source_get_context), + (pyg_source_prepare), (pyg_source_check), (pyg_source_dispatch), + (pyg_source_finalize): + * gobject/pygtype.c (pyg_closure_invalidate), + (pyg_closure_marshal), (pyg_signal_class_closure_marshal): + * tests/common.py: + + Move maincontext and mainloop over to glib. + Update the threadstate api to use the variant in glib. + +2008-07-20 Johan Dahlin + + * glib/Makefile.am: + * gobject/Makefile.am: + * gobject/__init__.py: + * gobject/gobjectmodule.c (pyg_threads_init), (pyg_error_check), + (pyg_gerror_exception_check), (init_gobject): + * gobject/option.py: + Install the glib module, the helper library and the headers. + Use it from gobject and remove the old glib specific code from there. + +2008-07-20 Johan Dahlin + + * configure.ac: + * gobject/Makefile.am: + Use pkg-config to check for libffi again. + +2008-07-20 Johan Dahlin + + * glib/Makefile.am: + * glib/glibmodule.c (pyg_main_context_default): + * glib/pyglib.c (pyglib_gerror_exception_check): + * glib/pyglib.h: + Rename helper library to libpyglib-2.0. + Move over pyg_gerror_exception_check as well. + +2008-07-20 Johan Dahlin + + * Makefile.am: + * configure.ac: + * glib/Makefile.am: + * glib/__init__.py: + * glib/glibmodule.c (pyg_destroy_notify), (get_handler_priority), + (pyg_handler_marshal), (pyg_idle_add), (pyg_timeout_add), + (pyg_timeout_add_seconds), (iowatch_marshal), (pyg_io_add_watch), + (pyg_source_remove), (pyg_main_context_default), + (child_watch_func), (child_watch_dnotify), (pyg_child_watch_add), + (pyg_markup_escape_text), (pyg_get_current_time), (pyg_main_depth), + (pyg_filename_display_name), (pyg_filename_display_basename), + (pyg_filename_from_utf8), (pyg_get_application_name), + (pyg_set_application_name), (pyg_get_prgname), (pyg_set_prgname), + (pyg_register_api), (pyg_register_error), + (pyg_register_version_tuples), (init_glib): + * glib/pyglib-private.h: + * glib/pyglib.c (pyglib_init), (pyglib_init_internal), + (pyglib_gil_state_ensure), (pyglib_gil_state_release), + (pyglib_enable_threads), (pyglib_gil_state_ensure_py23), + (pyglib_gil_state_release_py23), (pyglib_error_check): + * glib/pyglib.h: + * glib/pygspawn.c (pyg_pid_close), (pyg_pid_free), + (pyg_pid_tp_init), (pyg_pid_new), (_pyg_spawn_async_callback), + (pyglib_spawn_async), (pyg_spawn_register_types): + * glib/pygspawn.h: + Add glib bindings, currently not installed or used. + Add some internal API and move over a couple of functions + from the gobject module. Still very much a work in progress. + +2008-07-19 Johan Dahlin + + * gio/gio.override: + Ignore a bunch of functions which are not relevant. + +2008-07-19 Johan Dahlin + + * gio/gfile.override: + * gio/gio.defs: + * gio/gio.override: + * tests/test_gio.py: + Bind gio.Mount.unmount, gio.File.mount_mountable, + gio.File.unmount_mountable and gio.File.mount_enclosing_volume. + Add documents and tests. + +2008-07-19 Johan Dahlin + + * gio/gio.override: Set module name back to + gio, as setting it to gio._gio breaks pydoc. + + * gio/gio.defs: + Use property based constructors when possible. + +2008-07-19 Johan Dahlin + + * examples/gio/directory-async.py: + * gio/gfileenumerator.override: + * gio/gio.defs: + * tests/test_gio.py: + Wrap gio.FileEnumerator.next_files_async/next_files_done. + Update the example to use them instead of the synchronous versions, + add documentation and tests. + +2008-07-19 Johan Dahlin + + * examples/gio/directory-async.py: + Only fetch name, saves a couple of syscalls. + * gio/gio.override: + Set name to gio._gio so pychecker/pydoc works. + +2008-07-18 Johan Dahlin + + * examples/gio/directory-async.py: + * gio/gfile.override: + * gio/gfileenumerator.override: + * gio/gio.defs: + * tests/test_gio.py: + Wrap gio.File.enumerate_children_async, add tests, docstring + and an example. + Also document gio.File.enumerate while we're at it. + +2008-07-18 Johan Dahlin + + * gio/gfile.override: + Use %zd instead of %d since it's a Py_ssize_t and not an int. + +2008-07-18 Johan Dahlin + + * gio/pygio-utils.h: + define NO_IMPORT_PYGOBJECT before including pygobject.h + +2008-07-18 Johan Dahlin + + * gio/giomodule.c (init_gio): + Require pygobject 2.15.2 + +2008-07-17 Johan Dahlin + + * gio/giomodule.c (init_gio): + Add a pygio_version module attribute + (DL_EXPORT): The module is called gio._gio, not just _gio. + +2008-07-17 Johan Dahlin + + * gio/gio-types.defs: + Rename gio.IOErrorEnum to gio.ErrorEnum + +2008-07-17 Johan Dahlin + + * gio/giomodule.c (init_gio): + Add gio.ERROR which maps to the G_IO_ERROR quark. + +2008-07-17 Johan Dahlin + + * gio/giomodule.c (init_gio): + Use the prefix G_IO_ for stripping constants instead of just G_ + * gobject/gobjectmodule.c (pyg_constant_strip_prefix): + Check so the fist part of name and strip_prefix are the same, + if they don't, just strip of the part of strip_prefix which + matches. + + This removes the initial IO_* prefix for some constants in gio. + Eg, gio.IO_ERROR_* -> gio.ERROR_* + +2008-07-16 Johan Dahlin + + * configure.ac: Post release version bump + +=== 2.15.1 === +2008-07-16 Johan Dahlin + + * NEWS: Update + +2008-07-15 Paul Pogonyshev + + * codegen/pygobject-codegen-2.0.in: Rename from + 'pygtk-codegen-2.0.in'. + + * configure.ac: + * codegen/Makefile.am: Update accordingly. + +2008-07-15 Johan Dahlin + + * configure.ac: Post release version bump + +=== 2.15.0 === +2008-07-15 Johan Dahlin + + New version + + * NEWS: Update + + * tests/Makefile.am: + Make sure we can distcheck the gio module properly + +2008-07-15 Johan Dahlin + + Bug 450659 – h2def.py - export 'typedef struct' object definitions not + working + + * codegen/h2def.py: + Patch by Lauro Moura + +2008-07-14 Johan Dahlin + + Bug 471559 – add AM_PROG_CC_C_O to configure.ac for recent automake + + * configure.ac: + Patch by Tim Mooney + +2008-07-14 Johan Dahlin + + Bug 448173 – use python-config to get python includes + + * configure.ac: + Really close the by, patch by Matthias Klose + +2008-07-14 Johan Dahlin + + Bug 378704 – OptionParser.parse_args() returns unexpected results + + * gobject/option.py: + Patch by Johannes Hölzl + +2008-07-14 Johan Dahlin + + Bug 491773 – autoconf failure: .m4 files cannot be found + + * Makefile.am: + Patch by macks@netspace.org + +2008-07-14 Gian Mario Tagliaretti + + * gio/gfile.override: wrap File.load_contents_async and + File.load_contents_finish + + * gio/gio.defs: Add docstring for the above methods. + + * tests/test_gio.py: Add a test for the above methods. + +2008-07-14 Johan Dahlin + + Bug 487523 – Add xslfiles variable to .pc.in files + + * pygobject-2.0-uninstalled.pc.in: + Add xslfiles variable, patch by Damien Carbery + +2008-07-14 Johan Dahlin + + * gio/gio.defs: + Remove g_file_input_stream_seek and g_file_output_stream_seek, + they already implement the seekable interface. + +2008-07-14 Johan Dahlin + + Bug 504337 - crash bug in gobject.Timeout and gobject.Idle + + * gobject/pygsource.c: + * tests/test_source.py: + Fix crash in Timeout and Idle, patch by Bryan Silverthorn. + +2008-07-14 Johan Dahlin + + * codegen/argtypes.py: + Map GSeekType to an int + + * gio/gfileinfo.override: + * gio/ginputstream.override: + * gio/goutputstream.override: + Add comments for missing API + +2008-07-14 Johan Dahlin + + * gio/Makefile.am: + * gio/gfile.override: + * gio/ginputstream.override: + * gio/gio.override: + * gio/goutputstream.override: + * gio/pygio-utils.c (pygio_check_cancellable): + * gio/pygio-utils.h: + Refactor cancellable check to a utility function, avoids + plenty of code duplication. + +2008-07-14 Paul Pogonyshev + + * codegen/definitions.py (ReturnType): New class. + (MethodDefBase.__init__): Make 'self.ret' a 'ReturnType' instance, + not string. Accept 'optional' flag. + + * codegen/argtypes.py (ArgMatcher.get_reverse_ret): Test if + 'ptype' has true 'optional' attribute and copy it to 'props' then. + + * codegen/reversewrapper.py (ReturnType.support_optional): New + class field, False by default. + (GObjectReturn.support_optional, GObjectReturn.write_decl) + (GObjectReturn.write_conversion): Support optional return. + + * pygobject-2.0.pc.in: Add 'codegendir' variable. + * codegen/pygtk-codegen-2.0.in: Make 'codegendir' refer to + PyGObject's codegen, not PyGTK's one --- the latter will be + removed (first part of bug #542821). + +2008-07-08 Murray Cumming + + * codegen/h2def.py: clean_func(): Strip GSEAL out, to avoid us + thinking that there are many functions called GSEAL (merge from + PyGTK). + +2008-01-29 Olivier Crete + + * codegen/h2def.py (DefsWriter.__init__): Fix copy-paste + typos (merge from PyGTK). + +2008-07-11 Gian Mario Tagliaretti + + * gio/gfile.override: wrap File.load_contents, fix a typo. + + * gio/gio.defs: Add docstring for File.load_contents. + + * tests/test_gio.py: Add a test for the above method. + +2008-07-09 Juha Sahakangas + + * gobject/gobjectmodule.c (pyg_io_add_watch): Fix error message + referencing wrong argument. + +2008-06-29 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pyg_markup_escape_text): text_size + should be Py_ssize_t instead of int. + Bug 540696 – gobject.markup_escape_text() causes python to segfault. + +2008-06-28 Johan Dahlin + + * docs/reference/pygobject.xml: + Document GObject.handler_block_by_func/handler_unblock_by_func + +2008-06-17 Johan Dahlin + + * gio/gio-types.defs: + * tests/test_gio.py: + Sort out confusion between interfaces and objects, add test. + Fixes #538601 + +2008-06-09 Paul Pogonyshev + + * gobject/pygobject.c (pygobject_copy, pygobject_deepcopy): New + functions, unconditionally raise TypeError. + (pygobject_methods): Hook them up. (bug #482370) + +2008-05-31 Johan Dahlin + + * setup.py: set FFI_LIBS to '', since this is mostly used on win32. + +2008-05-30 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (init_gobject): Call PyType_Ready for + PyGParamSpec_Type, and add it to the module dict. + +2008-05-23 Johan Dahlin + + * gio/gio.defs: + Add default values for all GSeekType variables. + +2008-05-21 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pyg_spawn_async): Accept None for the + child_setup parameter of gobject.spawn_async(). Also check that + it is callable. + +2008-04-27 Paul Pogonyshev + + * gobject/pygenum.c (pyg_enum_richcompare): Fix: raise warning as + exception if asked by PyErr_Warn(). + + * gobject/pygflags.c (pyg_flags_richcompare): Don't return NULL + after warning; more useful warning message. + + (#480424, borrowing code by Mark Doffman) + +2008-04-21 Johan Dahlin + + * codegen/h2def.py: Update link to defs format discussion + +2008-04-15 Johan Dahlin + + * gobject/gobjectmodule.c (init_gobject): Set + gobject.GObject.__module__ to gobject._gobject, this + helps pylint to check public methods of GObject subclasses + + * tests/Makefile.am (tests): + * tests/test_gobject.py (TestGObjectAPI.testGObjectModule): + Add a test for this + + (#523821, Simon Schampijer) + +2008-04-11 Johan Dahlin + + * gio/gio.defs (write_async): document. + Add default values to all flags parameters. + +2008-04-11 Johan Dahlin + + * gio/gio.defs (read_async, read): document. + Set io_priority default to G_PRIORITY_DEFAULT. + +2008-04-11 Johan Dahlin + + * gio/gfile.override: + * gio/ginputstream.override: + * gio/goutputstream.override: + * tests/test_gio.py: + Move around the order of the callback argument to async methods, + so it comes before priority and cancellable, which can have default + values. + +2008-04-08 Johan Dahlin + + * gio/Makefile.am: + * gio/__init__.py: + * gio/gappinfo.override: + * gio/gio.defs: + * gio/gio.override: + * tests/test_gio.py: + Implement GAppInfo constructor, add tests. + +2008-04-08 Johan Dahlin + + * gio/Makefile.am: + * gio/gfileinfo.override: + * gio/gio.defs: + * gio/gio.override: + * tests/test_gio.py: + Wrap GFileInfo.list_attributes(), add tests and + set the default of GFileQueryInfoFlags args to G_FILE_QUERY_INFO_NONE. + +2008-04-08 Johan Dahlin + + * gobject/option.py: Fix a typo + * tests/test_option.py: + Update the tests after the latest "refactoring". + The testsuite should run fine now again, finally. + +2008-04-08 Johan Dahlin + + * tests/test_gio.py (TestOutputStream.testWriteAsyncError): + (TestInputStream._testCloseAsync.callback): + Disable these tests until we can figure why they freeze during + make check. + +2008-04-08 Johan Dahlin + + * gio/gio.defs: + * gio/gio.override: + * tests/test_gio.py: + Add bindings for content_type_guess. + Based on patch by Thomas Leonard (#525113) + +2008-04-08 Johan Dahlin + + * gio/gio-types.defs: + * gio/gio.defs: + * gio/gio.override: + * tests/test_gio.py: + Add basic support for GThemedIcon, based on patch by + Thomas Leonard (#521883) + +2008-04-08 Johan Dahlin + + * gobject/pygsource.c: + * tests/test_source.py: + Unbreak Source.prepare (#523075, Bryan Silverthorn) + +2008-04-08 Johan Dahlin + + * gio/gfile.override (_wrap__install_file_meta): Fix a couple of + silly typos and use gio.File instead of GFile in exceptions. + +2008-04-07 Johan Dahlin + + * gio/__init__.py: + * gio/gfile.override: + * gio/gio-types.defs: + * gio/gio.override: + * tests/test_gio.py: + Make gio.File() (calling on an interface) a factory for creating + files. Add tests and a docstring. + +2008-04-07 Johan Dahlin + + * gio/Makefile.am (pygiodir): Install gio in the right location + +2008-04-06 Johan Dahlin + + * tests/test_gio.py: Add tests for recently added features. + + * gio/goutputstream.override: + (_wrap_g_output_stream_write_asyn,_wrap_g_output_stream_close_async): + * gio/ginputstream.override (async_result_callback_marshal_read): + Add wrappers. + + * gio/gio.override: Ignore vararg functions and remove a couple + of left overs in the generic marshaller. + + * gio/gio.defs: Remove g_file_output_stream_truncate, + g_file_output_stream_tell and g_file_input_stream_tell + + * Makefile.am: + * gio/gfileenumerator.override (_wrap_g_file_enumerator_tp_iter): + Implement the python iteration protocol on GFileEnumerator + + * codegen/argtypes.py (arg): Add goffset to the int64 arg type + +2008-04-02 Paul Pogonyshev + + * gobject/pygenum.c: bug #428732 + (pyg_enum_new): Fix two wrong assertions about '__enum_values__' + size and contents. + (pyg_enum_reduce): New function (based on patch by Phil Dumont). + (pyg_enum_methods): Hook it up. + +2008-03-24 Paul Pogonyshev + + * gobject/pygenum.c (pyg_enum_richcompare): Don't return NULL + after warning; more useful warning message (bug #519631). + +2008-03-22 Johan Dahlin + + * gio/ginputstream.override: + * gio/gio.override: + * tests/test_gio.py: + + Make read_finish() return the string, remove the get_buffer method. + This is more pythonic, as it mimics the normal read() behavior of + python. + Update the tests and use a separate marshaller for read. + +2008-03-21 Johan Dahlin + + * gobject/__init__.py: + * tests/test_properties.py: + Allow gobject.property work with subclasses. Add tests. + + (#523352, Tomeu Vizoso) + +2008-03-10 Johan Dahlin + + * configure.ac: Require gio and giounix 2.15.7. + +2008-03-09 Johan Dahlin + + * gio/gio-types.defs: + * gio/gio.defs: + * tests/test_gio.py: + Update to SVN of gio: + g_file_contains_file -> g_file_has_prefix + can_seek and can_truncate are now only on the GSeekable interface + Add tests + + (#521207, Thomas Leonard) + +2008-03-08 Johan Dahlin + + * gio/ginputstream.override: + Pass in l instead of i to PyArg_ParseTupleAndKeywords when + parsing a long. Fixes the build on 64-bit systems. + (#521165, Thomas Leonard) + +2008-03-02 Johan Dahlin + + * Makefile.am: Dist .m4 files. + (#496011, Ed Catmur) + +2008-03-02 Paul Pogonyshev + + * gobject/gobjectmodule.c (REGISTER_TYPE): Never override customly + set 'tp_new' and 'tp_alloc'. + +2008-02-01 Dan Winship + + * pygobject-2.0.pc.in (defsdir): Add this so other bindings can + find gio.defs + +2008-01-21 Johan Dahlin + + * gio/gio.override (async_result_callback_marshal): + Don't assume the buffer is set, use Py_XINCREF instead of Py_INCREF. + + * gio/Makefile.am: + * gio/ginputstream.override: + * gio/goutputstream.override: + * gio/gvolumemonitor.override: + * gio/gfile.override: + * tests/test_gio.py: + Implement and test GFile.read_async. Use try/finally to always quit + the mainloop, even if the test fail. + Update source comment headers. + +2008-01-20 Johan Dahlin + + * tests/test_gio.py (TestVolumeMonitor): New test + + * gio/Makefile.am: + * gio/ginputstream.override: + * gio/gio.override: + * gio/giomodule.c: + * gio/goutputstream.override: + * gio/gvolumemonitor.override: + * gio/unix.override: + * gio/unixmodule.c: + + Split out overrides into more files. Fix up module description in + comments + +2008-01-20 Johan Dahlin + + * gio/gio.override (_wrap_g_simple_async_result_get_buffer): Add + a new method, to fetch the buffer + (_wrap_g_input_stream_read_async): Save a reference to the buffer. + * tests/test_gio.py (TestInputStream.testReadAsync.callback): + Check the content + + * tests/test_gio.py (TestInputStream.testReadAsyncError): + New function to test error condition of async read. + + * gio/gio.override (async_result_callback_marshal): Grab a reference + to callback/data. + +2008-01-19 Johan Dahlin + + * gio/gio.override (_wrap_g_output_stream_write): Impl. + * gio/gio.override: + * gio/unix.defs: + Add GUnixInputStream type and methods + + * tests/common.py: + * tests/test_gio.py: + Add GIO tests. + + * gio/gio.override (_wrap_g_app_info_get_all_for_type), + (_wrap_g_app_info_get_all), + (_wrap_g_drive_get_volumes): Implement. + + * gio/gio.override (async_result_callback_marshal): New marshaller + for async results + (_wrap_g_input_stream_read_async): Impl. + * gio/gio-types.defs: Add SimpleAsyncRequest + * gio/giomodule.c: Register enums/constants + + * gio/gio.override: Fix a silly bug so it possible to read files + larger than 8192 bytes. + + * gio/gio.defs: Set null-ok for all cancelable as well. + + * gio/__init__.py: set gio.unix to None if it's not available + + * gio/gio.override: Implement InputStream.read efficiently without + copying the strings, based on the standard libararys file.read() + implementation. + + * gio/gio-types.defs (Cancellable): Add wrapper. + + * gio/gio.defs (replace): Do not require cancellable argument + to be specified, default to NULL if not. + + * Makefile.am: + * codegen/Makefile.am: + * codegen/README.defs: + * codegen/__init__.py: + * codegen/argtypes.py: + * codegen/code-coverage.py: + * codegen/codegen.py: + * codegen/createdefs.py: + * codegen/definitions.py: + * codegen/defsconvert.py: + * codegen/defsgen.py: + * codegen/defsparser.py: + * codegen/docextract.py: + * codegen/docextract_to_xml.py: + * codegen/docgen.py: + * codegen/h2def.py: + * codegen/mergedefs.py: + * codegen/missingdefs.py: + * codegen/mkskel.py: + * codegen/override.py: + * codegen/pygtk-codegen-2.0.in: + * codegen/reversewrapper.py: + * codegen/scanvirtuals.py: + * codegen/scmexpr.py: + + * configure.ac: + * gio/Makefile.am: + * gio/__init__.py: + * gio/gio-types.defs: + * gio/gio.defs: + * gio/gio.override: + * gio/giomodule.c: (init_gio): + * gio/unix-types.defs: + * gio/unix.defs: + * gio/unix.override: + * gio/unixmodule.c: (initunix): + + Import codegen from pygtk. + Add initial gio and gio.unix bindings. + +2008-01-11 Johan Dahlin + + * configure.ac: Don't link against libffi if we cannot find libffi + on the system. (#496006, Ed Catmur) + +2008-01-03 Johan Dahlin + + Reviewed by: Gustavo + + * configure.ac: + * gobject/pygmainloop.c (pyg_signal_watch_prepare): Optinally + use PySignal_SetWakeupFd to avoid having to do a timeout to find + out if there are any pending signals from python. + Fixes #481569 + + * configure.ac (CPPFLAGS): + Include -Wall and -Werror when checking for PySignal_SetWakeupFd + +2008-01-02 Sebastian Rittau + + * gobject/gobjectmodule.c + * gobject/gobjectmodule.c (pyg_get_application_name) + (pyg_get_prgname): Add wrappers for g_get_application_name and + g_get_prgname. + +2007-11-30 Rafael Villar Burke + + * docs/reference/pygobject.xml: Add props attribute + +2007-11-24 Paolo Borelli + + * gobject/gobjectmodule.c (pyg_type_register): check for NULL before + dereferencing. + +2007-11-24 Paolo Borelli + + * gobject/gobjectmodule.c (pyg_type_register): do not use a + potentially uninitialized variable. Bug #499334. + +2007-11-12 Johan Dahlin + + * gobject/option.py (OptionParser.parse_args): + Set the default value of old_args to 0, so we don't end + up slicing with None. Fixes #496278 (Vincent Untz) + +2007-11-06 Johan Dahlin + + * gobject/option.py (OptionParser.parse_args): Merge in values + from all groups to the global option group. Slice up args + so it doesn't return too much. + + * tests/test_option.py: Refactor to be unittesty, + Add new tests to test what options returns. + +2007-11-05 Johan Dahlin + + * gobject/pygobject.h: + * gobject/gobjectmodule.c: + Add pyg_option_group_new to the public API + + * configure.ac: Branch, bump version to 2.15.0. + +2007-10-16 Damien Carbery + + reviewed by: Johan Dahlin. + + * pygobject-2.0-uninstalled.pc.in: uninstalled.pc file missing + 'datadir' value. Fixes #486876. + +2007-09-16 Gustavo J. A. M. Carneiro + + * configure.ac: Post-relase version bump. + +=== 2.14.0 === +2007-09-16 Gustavo J. A. M. Carneiro + + * configure.ac: Bump version to 2.14.0. + + * NEWS: Update NEWS for next release. + +2007-09-06 John Finlay + + * docs/xsl/fixxref.py.in: Remove DATADIR substitution since it now + gets substituted as ${prefix}/share which doesn't work in a Python + script. + +2007-08-27 Johan Dahlin + + * gobject/propertyhelper.py (property.__metaclass__.__repr__): Avoid + exporting the metaclass, just define it where it will be used. + + * gobject/__init__.py (GObjectMeta._install_properties): + Refactor a bit to make sure that it is possible to use in subclasses, + fixes #470718 (Marco Giusti) + +2007-08-27 Marco Giusti + + reviewed by: Gustavo J. A. M. Carneiro + + * gobject/propertyhelper.py: + * tests/test_properties.py: + Bug 470230 – check for default value in boolean type is wrong. + +2007-08-27 Gustavo J. A. M. Carneiro + + * tests/Makefile.am, + * gobject/Makefile.am: Remove -D_XOPEN_SOURCE=600 + -D__EXTENSIONS__, no longer needed. + + * configure.ac: Don't add -std=c9x CFLAG on Solaris. Fixes + #339924 again. + + * gobject/pygtype.c (pyg_type_wrapper_repr): Typecast self->type + to (unsigned long int) to fix a compilation warning. + +2007-08-14 Ed Catmur + + reviewed by: Gustavo J. A. M. Carneiro + + * gobject/pygobject.c (pygobject_new_full, pygobject_clear), + (pygobject_get_dict): Bug 466082 – pygobject_new_full not fully + initialising PyGObject, chaos results. + +2007-08-13 Gustavo J. A. M. Carneiro + + * tests/test_subtype.py (TestSubType.testGetDict): Add unit test + exercising a bug when GObject.__dict__ is accessed directly. + +2007-07-08 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pygobject_functions) + (pyg_timeout_add_seconds): Wrap g_timeout_add_seconds, + conditionally compiled if glib version >= 2.13.5. + +2007-07-08 Johannes Hölzl + + reviewed by: Gustavo Carneiro + + * gobject/gobjectmodule.c (build_gerror, init_gobject): Work + around the deprecation warning of BaseException.message in Python + 2.6+ affecting GError exceptions. Fixes #342948. + +2007-07-07 Gustavo J. A. M. Carneiro + + * configure.ac: Post-release version bump. + +=== 2.13.2 === +2007-07-07 Gustavo J. A. M. Carneiro + + * NEWS: Update. + +2007-07-07 Damien Carbery + + reviewed by: Gustavo Carneiro. + + * configure.ac: Bug 339924 – pygobject doesn't compile on opensolaris. + +2007-04-30 Johannes Hölzl + + * gobject/gobjectmodule.c (init_gobjectmodule), + * gobject/pygoptiongroup.c (arg_func), + * gobject/option.py (OptionParser._parse_args, OptionGroup._to_goptiongroup), + * tests/test_option.py: OptParse-Exceptions in GOption-callbacks + are now convertet into an GError. GError from the + GOptionGroup.run is convertet into an OptParse-Exception. + Fixes #342948. + +2007-07-06 Ed Catmur + + * gobject/pygtype.c (pyg_param_gvalue_from_pyobject), + (pyg_param_gvalue_as_pyobject): Applied patch from Ed Catmur to + support G_TYPE_VALUE boxed args/signals, and add a test, Fixes + #351072 + +2007-07-06 Carlos Martin + + * tests/test_gtype.py: + * tests/testhelpermodule.c: add test for #351072 + +2007-07-04 Murray Cumming + + * gobject/pygobject.c: (pygobject_switch_to_toggle_ref): + * gobject/pygobject.h: Rename the private struct field to + private_flags, because private is a C++ keyword, so this broke + builds of some C++ applications, such as Glom. + +2007-07-02 Sebastian Granjoux + + reviewed by: Johan Dahlin + + * gobject/gobjectmodule.c: (pyg_gerror_exception_check): + * tests/test_gtype.py: + * tests/testhelpermodule.c: (_wrap_test_gerror_exception): + + Fix a bug in pyg_error_exception_check, add a test, Fixes #449879 + +2007-06-17 Gustavo J. A. M. Carneiro + + * gobject/pygobject.h: Add a flags field to PyGObject; uses + structure space formerly occupied by the now stale "GSList + *closures" field. + + * gobject/pygobject.c (pygobject_switch_to_toggle_ref): Do nothing + if the wrapper is already in toggle reference mode. Closes #447271. + + * tests/test_subtype.py: Test case for #447271. + +2007-06-17 Sebastien Bacher + + * m4/python.m4: use python-config to get python includes + (Closes #448173) + +2007-06-16 Gustavo J. A. M. Carneiro + + * gobject/propertyhelper.py, + * tests/test_properties.py: Support type=GObject or + type=TYPE_OBJECT in the new properties API. + +2007-06-06 Yevgen Muntyan + + OK'd by Johan + + * gobject/generate-constants.c: Return 0 from main(). + + * gobject/Makefile.am: use generate-constants$(EXEEXT) instead + of generate-constants in the constants.py target rule. + +2007-05-30 Yevgen Muntyan + + reviewed by: Gustavo Carneiro + + * autogen.sh: Allow running autogen.sh from outside $srcdir. + +2007-05-09 Gustavo J. A. M. Carneiro + + * tests/Makefile.am (INCLUDES): Idem. + + * gobject/Makefile.am (INCLUDES): Add -D_XOPEN_SOURCE=600 and + -D__EXTENSIONS__ to make it compile with c99 and Sun C compiler. + + Fixes #339924: gnome-python doesn't compile on opensolaris. + +2007-05-02 Johan Dahlin + + * configure.ac: Post-release version bump. + +=== 2.13.1 === +2007-05-02 Johan Dahlin + + * pygobject-2.0-uninstalled.pc.in: Add libdir. + Fixes #435132 (Luca Ferretti) + +2007-05-01 Johan Dahlin + + * gobject/propertyhelper.py: + * tests/test_properties.py: + + Store property values in the descriptor per instance, add a test. + + * examples/properties.py: + * gobject/Makefile.am: + * gobject/__init__.py: + * gobject/constants.py.in: + * gobject/generate-constants.c: (main): + * gobject/propertyhelper.py: + * tests/Makefile.am: + * tests/test_enum.py: + * tests/test_interface.py: + * tests/test_properties.py: + + Add a property helper, fixes #338098 + +2007-04-30 Gustavo J. A. M. Carneiro + + * tests/common.py (importModules): Import testhelper first so that + g_thread_init is called before init_pygobject. + + * tests/testhelpermodule.c (inittesthelper): Call g_thread_init + before init_pygobject. + + * tests/test_subtype.py (TestSubType.testDescriptor): Unit test + for the bug below. + + * gobject/pygobject.c (pygobject_setattro): Account for the case + when attribute setting doesn't actually create an instance + dictionary, in which case pygobject_switch_to_toggle_ref would be + called twice, thereby causing gobject error. + Fixes #434659 + +2007-04-29 James Livingstone + + reviewed by: Johan Dahlin + + * gobject/pygtype.c: (pyg_value_from_pyobject): + * tests/test_signal.py: + + Add a missing else to avoid throwing a TypeError. + Includes a test written by Ed Catmur. + Fixes #374653 + +2007-04-29 Johan Dahlin + + * gobject/pygtype.c: (pyg_value_array_from_pyobject): + * tests/test_gtype.py: + * tests/testhelpermodule.c: (_wrap_test_value_array): + + Treat None in a GValueArray as pointer/NULL, patch by + Ed Catmur, fixes #352209. + +2007-04-29 Loïc Minier + + reviewed by: Johan Dahlin + + * autogen.sh: + + Use dirname $0 instead of pwd to compute srcdir in autogen, + fixes #409234 + +2007-04-29 Damien Carbery + + reviewed by: Johan Dahlin + + * tests/test-unknown.c: (test_interface_iface_method): + + Do not return in a void function, fixes #385127 + +2007-04-29 Johan Dahlin + + * gobject/pygflags.c: (pyg_flags_from_gtype): + Fix leak, patch by Daniel Berrange. Fixes #428726 (Phil Dumont) + +2007-04-29 Damien Carbery + + reviewed by: Johan Dahlin + + * configure.ac: + * pygobject-2.0-uninstalled.pc.in: + + Add an uninstalled pkg-config file, fixes #385129 + +2007-04-29 Johan Dahlin + + * README: + * configure.ac: + * gobject/Makefile.am: + * gobject/ffi-marshaller.c: (g_value_to_ffi_type), + (g_value_from_ffi_type), (g_cclosure_marshal_generic_ffi): + * gobject/ffi-marshaller.h: + * gobject/gobjectmodule.c: (create_signal), (init_gobject): + * pygobject-2.0.pc.in: + * tests/test_signal.py: + * tests/testhelpermodule.c: (test1_callback), + (test1_callback_swapped), (test2_callback), (test3_callback), + (test4_callback), (test_float_callback), (test_double_callback), + (test_string_callback), (test_object_callback), (connectcallbacks), + (_wrap_connectcallbacks), (inittesthelper): + + Add a generic CClosure marshaller based on ffi. + This makes it possible to connect to signals on PyGObjects from C. + libffi is now an optional dependency + Fixes #353816 (Edward Hervey) + +2007-04-23 Gustavo J. A. M. Carneiro + + * configure.ac: Post-release version bump. + +=== 2.13.0 === +2007-04-23 Gustavo J. A. M. Carneiro + + * configure.ac: Bump version to 2.13.0. + + * tests/test_properties.py (TestProperties.testMulti): Unit test + for get/set_properties. + +2007-04-23 Gian Mario Tagliaretti + + * gobject/pygobject.c: Implemented pygobject_set_properties and + pygobject_get_properties in order to set multiple properties using + keyword arguments. Fixes 403212 + + * docs/reference/pygobject.xml: Docs for the above new methods. + +2007-04-14 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c, gobject/pygobject.h: Add a new + pyg_gerror_exception_check API. Fixes #425242. + + * gobject/gobjectmodule.c (pyg_set_application_name) + (pyg_set_prgname): Add wrappers for g_set_application_name and + g_set_prgname. Patch by Havoc Pennington. Fixes #415853. + + * gobject/pygobject.h: Bug #419379: Modernize init_pygobject: use + static inline functions instead of macros. + + * gobject/gobjectmodule.c (init_gobject): + * gobject/pygobject-private.h: + * gobject/pygobject.c (pygobject_data_free, pygobject_data_new), + (pygobject_get_inst_data, pyg_toggle_notify), + (pygobject_switch_to_toggle_ref), + (pygobject_register_wrapper_full, pygobject_register_wrapper), + (pygobject_new_full, pygobject_unwatch_closure), + (pygobject_watch_closure, pygobject_dealloc, pygobject_repr), + (pygobject_traverse, pygobject_clear, pygobject_weak_ref), + (pygobject_setattro, pygobject_weak_ref_traverse), + (pygobject_weak_ref_notify, pygobject_weak_ref_clear), + (pygobject_weak_ref_dealloc, pygobject_weak_ref_new), + (pygobject_weak_ref_unref, pygobject_weak_ref_call): + * gobject/pygobject.h: + * gobject/pygtype.c (gclosure_from_pyfunc): + * tests/test_subtype.py: + Bug #320428: Break PyGObject<->GObject reference cycle (patch + v7.1; thanks John Ehresman for the help with this patch). + +2007-03-17 Gustavo J. A. M. Carneiro + + * gobject/pygobject.c (pygobject_emit): Fix %ld vs int warning. + (pygobject_chain_from_overridden): Idem. + +2007-03-06 Richard Hult + + * configure.ac: Fix the docs option so that it's possible to disable + building the docs. + +2007-03-03 Edward Hervey + + * gobject/pygobject.c: (set_property_from_pspec): + Release the GIL when calling g_object_set_property, since setting a + property might trigger some code that might come back in python land. + Fixes #395048 + +2007-01-09 Gustavo J. A. M. Carneiro + + * configure.ac: Turn the option --disable-docs into --enable-docs. + * docs/Makefile.am: Tread --enable-docs like --enable-gtk-doc in + gtk+, i.e. do not ever build docs unless requested, but always + install them if they are found already built. + +2006-12-14 Kjartan Maraas + + * autogen.sh: Make this work with automake 1.10 too. + +2006-11-18 Johan Dahlin + + * configure.ac: Post release version bump + +=== 2.12.3 === +2006-11-18 Johan Dahlin + + * NEWS: Update + + * gobject/pygoptiongroup.c (pyg_option_group_dealloc): + * tests/test_option.py (TestOption.testBadConstructor): + Make sure an exception is raised when we pass in invalid arguments + to the optiongroup constructor, add a test. #364576 (Laszlo Pandy) + + * gobject/pygobject.c (pygobject_register_class): set __module__ on + gobject derived types, fixes #376099 (Osmo Salomaa) + +2006-11-18 Yevgen Muntyan + + reviewed by: Johan Dahlin + + * gobject/gobjectmodule.c: (create_property): + * gobject/pygparamspec.c: (pyg_param_spec_getattr): + * tests/test_properties.py: + + Avoid truncating in pyg_param_spec_getattr, add test for all non-float + numeric types. Fixes #353943 + +2006-11-18 Johan Dahlin + + * gobject/pygtype.c (gclosure_from_pyfunc): Use PyObject_Cmp instead + of comparing function closure addresses, which makes it possible + to use any callable and not just functions. + Fixes #375589 (Dima) + +2006-10-13 John Finlay + + * docs/Makefile.am (HTML_FILES): Remove + html/pygobject-reference-copyright.html. + Fixes #361906 (Marc-Andre Lureau) + +2006-10-11 John Finlay + + * docs/reference/pygobject-introduction.xml: Remove Copyright and + License section. + + * docs/reference/pygobject-ref.xml: Remove author info + +2006-10-05 Cedric Gustin + + * dsextras.py (Template) (TemplateExtension): Add + py_ssize_t_clean flag to be passed to codegen.SourceWriter. + +2006-10-04 Cedric Gustin + + * Makefile.am: Add pygobject_postinstall.py to EXTRA_DIST. + +2006-10-03 Johan Dahlin + + * configure.ac: Post release version bump + +=== 2.12.2 === +2006-10-03 Johan Dahlin + + * NEWS: + * configure.ac: 2.12.2 + +2006-10-03 Gustavo J. A. M. Carneiro + + * gobject/Makefile.am: + * gobject/gobjectmodule.c: (add_signals), (add_properties), + (pyg_signal_new), (pyg_object_new), (get_handler_priority), + (pyg_io_add_watch), (pyg_spawn_async), (pyg_add_emission_hook), + (pyg_remove_emission_hook), (pyg_filename_from_utf8), + (_pyg_strv_to_gvalue): + * gobject/pygiochannel.c: (py_io_channel_write_chars), + (py_io_channel_write_lines): + * gobject/pygobject-private.h: + * gobject/pygobject.c: (PyGProps_length), (pygobject_init), + (pygobject_connect), (pygobject_connect_after), + (pygobject_connect_object), (pygobject_connect_object_after), + (pygobject_disconnect), (pygobject_handler_is_connected), + (pygobject_handler_block), (pygobject_handler_unblock), + (pygobject_emit), (pygobject_chain_from_overridden): + * gobject/pygoptioncontext.c: (pyg_option_context_parse): + * gobject/pygtype.c: (pyg_value_from_pyobject): + + Python 2.5 and 64 bits fixes (Py_ssize_t), closes bug #338487. + + * gobject/pygenum.c (pyg_enum_repr): Const warning fix. + +2006-09-29 Johan Dahlin + + * pygtk.py: LGPL, not GPL header + +2006-09-24 Gustavo J. A. M. Carneiro + + * gobject/pygobject.h (init_pygobject_check): Add parentheses + "around && within ||" to please gcc. + +2006-09-21 Cedric Gustin + + * dsextras.py: Catch ImportError exception when codegen is not + available: disable Template and TemplateExtension, redirect the + user to the pygtk installer and raise a NameError + exception. check_date has also been rewritten and now uses + distutils.dep_util.newer_group(). defs files can also be built + using createdefs by passing tuples as keyword argument to Template + (see for example the gdk and gtk templates in setup.py). + * setup.py: Changed the way the VERSION macro is defined on win32. + Also install the html reference documentation, the xsl files and + fixxref. + * pygobject_postinstall.py: Set the value of DATADIR in + fixxref.py. Add functions to install shortcuts in the Start menu + to the reference manual (currently disabled: see bug #353849). + +2006-09-16 Gustavo J. A. M. Carneiro + + * tests/test_signal.py (TestEmissionHook.testCallbackReturnFalse) + (TestEmissionHook.testCallbackReturnTrue) + (TestEmissionHook.testCallbackReturnTrueButRemove): Add a few more + emission hook tests. + + * gobject/gobjectmodule.c (pyg_add_emission_hook): One too many + DECREF on 'extra_args'. + +2006-09-12 John Ehresman + + * gobject/pygobject.h (init_pygobject_check): Declare variables + at start of code block + +2006-09-06 Johan Dahlin + + * gobject/pygmainloop.c (pyg_signal_watch_prepare): Increase the timeout + to 1000ms instead of 100. + +=== 2.12.1 === +2006-09-04 Johan Dahlin + + * gobject/pygobject.h (_PYGOBJECT_H_): Corrected version check, + (Sebastian Dröge, #354364) + + * configure.ac: Post release version bump + +=== 2.12.0 === +2006-09-04 Johan Dahlin + + * NEWS: + * configure.ac: 2.12.0 + +2006-08-28 Johan Dahlin + + * docs/Makefile.am: Install html files regardless even when passing + in --disable-docs, fixes #353159 (Matthias Clasen) + +2006-08-27 Gustavo J. A. M. Carneiro + + * configure.ac: Post-release version bump. + +=== 2.11.4 === +2006-08-27 Gustavo J. A. M. Carneiro + + * NEWS: Update. + + * gobject/gobjectmodule.c (pyg_type_register): Correct a bug in + the code that checks if parent already implements an interface or not. + + * tests/test-unknown.c (test_interface_base_init), + (test_interface_get_type): Add a property to the interface, for + better testing. + (test_unknown_get_property), + (test_unknown_set_property, test_unknown_class_init): Add a + property to the class as required by the interface. + + * tests/test_interface.py: More thorough interface testing, with + properties and test both the case of implementing an interface + from scratch, and re-implementing and interface that a parent + already implements. + +2006-08-27 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pygobject__g_instance_init): If + necessary, attach the GObject to the PyGObject here. + (pygobject_constructv): Cope with the fact that wrapper->obj may + have already been set due to the change above. + + * tests/test_signal.py: Add test case fixed by the changes above, + basically calling self.emit() inside do_set_property called + implicitly by the constructor due to a CONSTRUCT property. + + Fixes bug 353039: "Failure in signal emission during + do_set_property invoked from constructor". + +2006-08-26 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pyg_type_register): Fix type + registration once more to account for all corner cases. This time + we register interfaces in two stages: first, before properties and + signals are registered, we register the interfaces that are + already implemented in the parent type and are being overridden; + second, after registration of properties and signals, we register + the remaining interfaces. + +2006-08-21 Johan Dahlin + + * docs/Makefile.am (EXTRA_DIST): Remove build_stamp, include generated .html + in the distributed tarball. Remove builddate.xml, reference directory and fixxref.py + dependencies to avoid regenerating the tarball when it's not needed. + + * configure.ac: Post release version bump + +=== 2.11.3 === +2006-08-21 Johan Dahlin + + * NEWS: Update + + * Makefile.am: + * docs/Makefile.am: + Always install the xsl files & css files, regardless if the + documentation was actually built or not. Also clean it up considerably. + +2006-08-17 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pyg_type_register): Move the interface + registration code up, to run before properties and signals + registration, because glib doesn't allow us to add interfaces + after the first call to g_class_ref. + +2006-08-16 John Finlay + + * docs/reference/pygobject-functions.xml: Update docs for + gobject functions. + +2006-08-15 Murray Cumming + + * gobject/pygobject-private.h: + * gobject/pygobject.h: + Replace uses of typename with type_name, because that is a + reserved C++ keyword. This was breaking compilation of Glom + due its use in the new type_register_custom function pointer in + pygobject.h. + +2006-08-12 John Finlay + + * pygobject-2.0.pc.in: Add reference to installed pygobject docs + * docs/Makefile.am: Add install of style.css + * docs/xsl/html.xsl: Define stylesheet as style.css + * docs/style.css: Add. + +2006-08-10 John Finlay + + * docs/reference/entities.docbook.in: + * docs/reference/pygobject-ref.xml: + * docs/Makefile.am: + * configure.ac: + Use builddate.xml for the builddate entity and have builddate.xml be + updated when the docs are built not during configure time. + +2006-08-08 Johan Dahlin + + * configure.ac: Post release version bump. + +=== 2.11.2 === +2006-08-08 Johan Dahlin + + * NEWS: Update + +2006-08-07 Johan Dahlin + + * docs/Makefile.am ($(HTML_DATA)): Fix parallel build + (#350225, Ed Catmur) + +2006-08-06 Johan Dahlin + + * m4/as-expand.m4: New file to workaround automake silliness + + * docs/xsl/fixxref.py.in: New script + + * docs/Makefile.am (XSLFILES): Add fixxref.py script, moved in from + PyGTK. + + * docs/xsl/html.xsl: Do not use shade.verbatim, set the background + color and border as a normal html tag to avoid an external + stylesheet. + +2006-08-04 Johan Dahlin + + * configure.ac: Post release version bump + +=== 2.11.1 === +2006-08-04 Johan Dahlin + + * NEWS: Update + + * README: Update, some s/PyGTK/PyGObject/ + + * configure.ac: + * docs/Makefile.am: + * docs/reference/.cvsignore: + * docs/reference/entities.docbook.in: + * docs/reference/pygobject-ref.xml: + Clean up the build date/version mess I created. + Now it's created during configure time and properly included in + the docbook files. Also make sure distcheck passes + +2006-08-04 Gustavo J. A. M. Carneiro + + * configure.in: Add hack to disable libtool checking for g++ and + g77 (copied from libglade). + +2006-07-29 John Finlay + + * gobject/pygobject.h (pyg_param_gvalue_from_pyobject): Fix define + to point to the correct function pointer field. + +2006-07-29 Gustavo J. A. M. Carneiro + + * gobject/pygflags.c (pyg_flags_add): idem. + + * gobject/pygenum.c (pyg_enum_add): Give a more explicit error + message when the gtype is not an enum. + +2006-07-25 Johan Dahlin + + * gobject/pygobject.h (init_pygobject_check): Add a macro to easily + check the installed pygobject version. + + * gobject/pygflags.c (pyg_flags_add) + * gobject/pygenum.c (pyg_enum_add): Duplicate the string before + sending it to python. Fixes GCC warnings. + +2006-07-24 John Finlay + + * gobject/pygflags.c (pyg_flags_get_first_value_name) + (pyg_flags_get_first_value_nick): Avoid segfault when + g_flags_get_first_value returns NULL. + +2006-07-20 John Finlay + + * docs/Makefile.am: Make version.xml dependent on config.h + Make builddate.xml dependent on REFERENCE_DEPS. Add builddate.xml to + build_stamp and pdf dependencies. Add pdf files to cleanup. + +2006-07-20 Johan Dahlin + + * configure.ac: + * docs/Makefile.am: + * docs/reference/.cvsignore: + * docs/reference/version.xml.in: + Generate builddate.xml and version.xml at build time instead on + configure time, add proper dependencies. + +2006-07-19 John Finlay + + * docs/Makefile.am: Use more portable date generator. + + * docs/xsl/ref-html-style.xsl: Add book to list of indexed items. + + * docs/xsl/html.xsl: Output xref links for unknown links. + + * docs/xsl/ref-html-style.xsl: Include refsect1 and refsect2 in + indexed items but only if they have ids. + + * configure.ac (AC_CONFIG_FILES) : Add docs/reference/version.xml + + * docs/reference/pygobject-ref.xml: Add pygobject-introduction.xml + and version and builddate entities. Remove commented out items. + + * docs/Makefile.am: Add reference/pygobject-introduction.xml and + reference/version.xml.in + +2006-07-18 Johan Dahlin + + * docs/Makefile.am (HTMLdir): Install book in $datadir/gtk-doc/html + +2006-07-13 Johan Dahlin + + * gobject/gobjectmodule.c: (pyg_type_from_name), + (get_type_name_for_class): + * gobject/pygobject-private.h: + * gobject/pygobject.c: (pygobject_new_with_interfaces), + (pygobject_lookup_class), (pygobject_emit): + * gobject/pygobject.h: + * gobject/pygtype.c: (_wrap_g_type_from_name), + (pyg_type_from_object), (pyg_type_register_custom_callback), + (pyg_type_get_custom), (_pyg_type_from_name): + Add infrastructure for lazy type registration, fixes #346947 + +2006-07-13 Gustavo J. A. M. Carneiro + + * m4/python.m4: Properly quote AM_CHECK_PYMOD definition. + + * gobject/pygoptioncontext.c (pyg_option_context_parse): Fix mem + leak. + +2006-07-12 Johan Dahlin + + * Makefile.am: + * configure.ac: + * docs/.cvsignore: + * docs/Makefile.am: + * docs/common.xsl: + * docs/devhelp.xsl: + * docs/html.xsl: + * docs/pdf-style.xsl: + * docs/pdf.xsl: + * docs/ref-html-style.xsl: + * docs/reference/.cvsignore: + * docs/reference/pygobject-classes.xml: + * docs/reference/pygobject-constants.xml: + * docs/reference/pygobject-functions.xml: + * docs/reference/pygobject-gboxed.xml: + * docs/reference/pygobject-ginterface.xml: + * docs/reference/pygobject-gpointer.xml: + * docs/reference/pygobject-maincontext.xml: + * docs/reference/pygobject-mainloop.xml: + * docs/reference/pygobject-ref.xml: + * docs/reference/pygobject.xml: + Import GObject part of John Finlay's PyGTK Reference Manual, copy + over infrastructure from the pygtk-web module. + +2006-07-12 Gustavo J. A. M. Carneiro + + * configure.ac: Post-release version bump to 2.11.1. + +=== PyGObject 2.11.0 === +2006-07-09 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pyg_type_register): Make interface_data + point to the python type before adding the interface to the new + type. This should fix interface implementation (actually I + thought such code had already been added earlier but can't find it + now and it is obviously needed...) + (pyg_type_register): move the code that needs g_type_class_ref + until after interface registration (more code that I already wrote + in the past but got lost). + +2006-07-05 John Finlay + + * gobject/pygiochannel.c (py_io_channel_init): Fix message typo. + +2006-06-28 Cedric Gustin + + * dsextras.py (InstallData): Set datarootdir in .pc file. + + * pygobject_postinstall.py (replace_prefix): Do not parse + pygtk-codegen-2.0 as it is part of pygtk. + + * setup.py: Create gobject extension as gobject._gobject. Add + pygoptioncontext.c and pygoptiongroup.c to the list of source + files. Add option.py to the module files. Changed name of + distutils package from pygtk to pygobject. + +2006-06-24 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pyg_filename_from_utf8): Wrap + g_filename_from_utf8. + + * tests/test_signal.py (TestClosures.testGString): Add unit test + for signals using the type TYPE_GSTRING. + + * gobject/pygtype.c (pyg_value_as_pyobject) + (pyg_value_from_pyobject): Implement conversion code for the type + G_TYPE_GSTRING. + + * gobject/gobjectmodule.c (pyg_filename_display_basename) + (pyg_filename_display_name): Add bindings for + g_filename_display_basename and g_filename_display_name. + (init_gobject): Add a TYPE_GSTRING definition. + + * gobject/pygobject.h, + * gobject/pygobject-private.h: Make pyg_constant_strip_prefix + receive and return const gchar*, to indicate it does not change + the string. Unfortunately since PyModule_AddIntConst is broken in + python < 2.5 this introduces const warnings elsewhere :-( + + * gobject/gobjectmodule.c (pyg_flags_add_constants) + (pyg_enum_add_constants): Fix const warnings. + +2006-06-23 John Finlay + + * gobject/gobjectmodule.c (pyg_object_class_list_properties) + (pyg_signal_list_ids, pyg_signal_lookup, pyg_signal_query): Add + support for retrieving signal and propertie info from interface types. + +2006-06-04 Johan Dahlin + + * gobject/gobjectmodule.c (pyg_spawn_async) + (pyg_signal_new): Fix two leaks in error cases, found by + Coverity. + +2006-05-28 Gustavo J. A. M. Carneiro + + * tests/test_subtype.py: Uncomment Johan's "subsubtype" test case. + + * gobject/gobjectmodule.c (pygobject__g_instance_init): Pass the + g_class to pygobject_new_full, because during the instance init + function instances are temporarily assigned the parent's GType. + + * gobject/pygobject-private.h, + * gobject/pygobject.c (pygobject_new_full): Make + pygobject_new_full accept an optional g_class parameter; If + present, the GType is extracted from the class instead of from the + instance. + +2006-05-20 Yevgen Muntyan + + reviewed by: Gustavo Carneiro + + * gobject/pygobject.c (pygobject_init, pygobject_get_property), + (pygobject_set_property): Bug 341174: Be more specific in + set/get_property error messages. + +2006-05-07 Yevgen Muntyan + + reviewed by: Gustavo Carneiro + + * gobject/gobjectmodule.c (_log_func, add_warning_redirection), + (remove_handler, disable_warning_redirections, init_gobject): + * gobject/pygobject.h: Add new pyg_add_warning_redirection and + pyg_disable_warning_redirections APIs (bug #323786 again). + +2006-05-07 Johan Dahlin + + * Makefile.am (CLEANFILES): Remove pygtk.py, it's not + auto-generated any longer. Thanks to Kjartan for noticing. + +2006-05-07 Gustavo J. A. M. Carneiro + + * gobject/pygoptioncontext.c: + s/sizeof(PyGMainContext)/sizeof(PyGOptionContext)/ (copy-paste error). + +2006-05-01 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (pyg_pid_close): Add a close() method + to the GPid wrapper. + + * gobject/gobjectmodule.c (pyg_pid_free, pyg_pid_new), + (pyg_spawn_async, init_gobject): Wrap GPid in an object whose + destructor calls g_spawn_close_pid. Fixes #340160. + +2006-04-29 Johannes Hölzl + + reviewed by: Johan Dahlin + + * examples/Makefile.am: + * examples/option.py: + * gobject/Makefile.am: + * gobject/gobjectmodule.c: (init_gobject): + * gobject/option.py: + * gobject/pygobject-private.h: + * gobject/pygoptioncontext.c: (pyg_option_context_init), + (pyg_option_context_dealloc), (pyg_option_context_parse), + (pyg_option_context_set_help_enabled), + (pyg_option_context_get_help_enabled), + (pyg_option_context_set_ignore_unknown_options), + (pyg_option_context_get_ignore_unknown_options), + (pyg_option_context_set_main_group), + (pyg_option_context_get_main_group), + (pyg_option_context_add_group), (pyg_option_context_compare), + (pyg_option_context_new): + * gobject/pygoptiongroup.c: (check_if_owned), (destroy_g_group), + (pyg_option_group_init), (pyg_option_group_dealloc), (arg_func), + (pyg_option_group_add_entries), + (pyg_option_group_set_translation_domain), + (pyg_option_group_compare), (pyg_option_group_transfer_group), + (pyg_option_group_new): + * tests/test_option.py: + + Add support for GOption, fixes #163645 + +2006-04-29 Johan Dahlin + + * gobject/pygtype.c (gclosure_from_pyfunc): + + * gobject/pygobject.c (pygobject_disconnect_by_func) + (pygobject_handler_block_by_func) + (pygobject_handler_unblock_by_func): + + * tests/test_signal.py (TestEmissionHook._callback): + + Fix #154845, add tests and a private method. + +2006-04-23 John Ehresman + + reviewed by: Gustavo + + * Makefile.am: + * pygtk.py: + * pygtk.py.in: + Bug 338945: Make pygtk.py relocatable + +2006-04-18 John Ehresman + + * dsextras.py: Add compiler / linker flags from pkgconfig-2.0.pc + by default, with an override mechanism. Filter out -lc & -lm if + compiling with msvc. + + * setup.py: Change C extension name to _gobject and don't use the + pkgconfig-2.0.pc when compiling + +2006-04-15 Gustavo J. A. M. Carneiro + + * gobject/__init__.py (_PyGObject_API): Copy _PyGObject_API from + gobject._gobject into gobject in order to preserve binary + compatibility with 3rd party modules. + + * gobject/pygobject.h (init_pygobject): Import gobject, gobject._gobject. + + * gobject/Makefile.am: Fix pygobject installation dir: install + both _gobject.la and __init__.py into + $(pyexecdir)/gtk-2.0/gobject. + +2006-04-11 Johan Dahlin + + * gobject/gobjectmodule.c (init_gobject): + * gobject/__init__.py: + Move over almost all GType constants from C to Python. + +2006-04-11 Gustavo J. A. M. Carneiro + + * gobject/__init__.py: + * gobject/gobjectmodule.c (_wrap_pyg_type_register), + (pyg__install_metaclass, init_gobject): GObjectMeta now moved to + python-land (__init__.py). + + * gobject/pygobject-private.h: + * gobject/pygobject.c (pygobject_register_class): + PyGObject_MetaType is now a pointer, not structure. + + * gobject/gobjectmodule.c (_wrap_pyg_type_register): Add optional + type name parameter. + + * tests/common.py (importModule): Include original exception + string in the raised SystemExit. + +2006-04-11 Johan Dahlin + + * gobject/.cvsignore: + * gobject/Makefile.am: + * gobject/__init__.py: + * gobject/gobjectmodule.c: (init_gobject): + * gobject/pygobject.h: + * tests/Makefile.am: + * tests/common.py: + + Turn gobject into a package; move _gobject to gobject._gobject and + add gobject/__init__.py. Update macros and testsuite. + +2006-04-11 Johan Dahlin + + * configure.ac: Post release version bump + +=== PyGObject 2.10.1 === +2006-04-11 Johan Dahlin + + * NEWS: Update + +2006-04-11 Andy Wingo + + reviewed by: Johan Dahlin + + * gobject/gobjectmodule.c (create_property): Parse unsigned int64 + constraints in param spec declaration using the "K" ParseTuple + format unit, not L -- allows the full range of the datatype to be + parsed. K format unit added in python 2.3. + +2006-04-01 Gustavo J. A. M. Carneiro + + * tests/test_properties.py: Add test for #335854. + + * pygtk.py.in (require): For version == '2.0', use a hardcoded + pygtk path, recorded during build. + + * gobject/gobjectmodule.c (_pyg_strv_to_gvalue): Don't allow + arbitrary sequences, only tuple or list, since a string is a + sequence too. + (pyg_object_new): Add a bit more detail to the exception string. + +2006-01-16 Johan Dahlin + + * Makefile.am: Include dsextras.py in the dist and install it. + +2006-03-19 Gustavo J. A. M. Carneiro + + * gobject/pygobject.c (pygobject_new_with_interfaces): Remove + comment "It will currently not filter out interfaces already + implemented by it parents.", since it is no longer true since + 2006-01-13. + +=== PyGObject 2.10.0 === +2006-01-16 Johan Dahlin + + * NEWS: Update + +2006-03-09 Michael Smith + + reviewed by: Johan Dahlin + + * gobject/pygenum.c: (pyg_enum_new), (pyg_enum_from_gtype), + (pyg_enum_add): + * gobject/pygflags.c: (pyg_flags_new), (pyg_flags_from_gtype), + (pyg_flags_add): + Plug a couple of leaks, fixes #334027. + +2006-01-19 Johan Dahlin + + * configure.ac (export_dynamic): + * Makefile.am (egg): + Add a make egg target + +2006-01-16 Johan Dahlin + + * configure.ac: Post release version bump + +=== PyGObject 2.9.1 === +2006-01-16 Johan Dahlin + + * NEWS: Update + +2006-01-15 Christopher Aillon + + * gobject/gobjectmodule.c (pyg_strv_to_gvalue): + Don't call g_value_init since the other *_to_gvalue + methods expect an already inited GValue + +2006-01-14 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (iowatch_marshal): Warn if io callback + returns None: almost always this is an error. + +2006-01-13 Gustavo J. A. M. Carneiro + + * gobject/pygobject.c (pygobject_register_class): Change strategy + a bit: don't ignore bases; use but augment it with missing bases + extracted in runtime. + + * gobject/pygobject.c (pygobject_register_class): Don't use the + passed in 'bases' parameter; instead find out in runtime the bases + for any given gtype. + (pyg_type_get_bases, pygobject_new_with_interfaces): Refactor code + that dynamically discovers bases into a separate function; + Override tp_dealloc, tp_alloc, tp_free, tp_traverse, and tp_clear, + inherit them again from the parent type, since type_new inside + Python core sets them to hardcoded functions subtype_xxx. Also + call py_parent_type->ob_type, instead of fixed &PyType_Type. + (pygobject_clear): Change a g_message to g_warning. + +2006-01-13 Johan Dahlin + + * gobject/gobjectmodule.c: (pyg_io_add_watch), + (marshal_emission_hook), (pyg_add_emission_hook), + (pyg_remove_emission_hook): + * gobject/pygobject.c: + * tests/test_signal.py: + + Add add/remove_emission_hook and tests. Fixes #325977 + +2006-01-11 Gustavo J. A. M. Carneiro + + * gobject/gobjectmodule.c (_pyg_signal_accumulator), + (create_signal, pyg_signal_accumulator_true_handled), + (initgobject): Bug 155380 -- Add support for signal accumulators. + + * tests/runtests.py: Add 'test_enum', 'test_conversion' to + SKIP_FILES, since they depend on pygtk modules so don't work + anymore. This should be eventually fixed, though. + + * tests/test_signal.py: Test signal accumulators. + + * gobject/pygtype.c (object_doc_descr_get): Reorder + properties/signals documentation more nicely: signals + properties + from each type are presented, with types ranging from the leaf + types to the base types. + + * configure.ac: Branch, bump version to 2.9.1. + +=== PyGObject 2.8.0 === +2006-01-09 Johan Dahlin + + * MANIFEST.in: + * Makefile.am: + * tests/Makefile.am: + + Make dist/distcheck work again + +2006-01-09 Johan Dahlin + + * setup.py: Add distutils support + + * dsextras.py (get_m4_define): Check for configure.ac aswell. + + * .cvsignore: + * AUTHORS: + * COPYING: + * INSTALL: + * Makefile.am: + * PKG-INFO.in: + * README: + * autogen.sh: + * configure.ac: + * examples/.cvsignore: + * examples/Makefile.am: + * gobject/gobjectmodule.c: (initgobject): + * m4/jhflags.m4: + * m4/python.m4: + * pygobject-2.0.pc.in: + * tests/Makefile.am: + * tests/common.py: + * tests/leak.glade: + * tests/runtests.py: + * tests/test_actiongroup.py: + * tests/test_dialog.py: + * tests/test_gdk.py: + * tests/test_gdkevent.py: + * tests/test_glade.py: + * tests/test_gtype.py: + * tests/test_liststore.py: + * tests/test_radiobutton.py: + * tests/test_signal.py: + * tests/test_subtype.py: + * tests/test_textview.py: + * tests/test_thread.py: + * tests/testhelpermodule.c: (test_type_get_type), + (_wrap_test_g_object_new): + * tests/testmodule.py: + + Split out PyGObject from PyGTK. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..23e5f25 --- /dev/null +++ b/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + 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 only 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. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. 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. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. 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. + +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=c89 CFLAGS=-O2 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 must use a version of `make' that +supports the `VPATH' variable, such as 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 `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have 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. + +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'. + + 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. + + 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'. + +Optional Features +================= + +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. + +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). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--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. + +`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..002138a --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +include ChangeLog AUTHORS COPYING NEWS README +include MANIFEST.in +include gobject/pygobject.h gobject/pygobject-private.h +include pygtk.py pygobject-2.0.pc.in +include dsextras.py +recursive-include examples *.py +global-exclude */CVS/* .cvsignore diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..f68b338 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,120 @@ +ACLOCAL_AMFLAGS = -I m4 +AUTOMAKE_OPTIONS = 1.7 + +SUBDIRS = docs codegen glib gobject gio examples tests + +PLATFORM_VERSION = 2.0 + +CLEANFILES = +EXTRA_DIST = \ + MANIFEST.in \ + README.win32 \ + pygobject-$(PLATFORM_VERSION).pc.in \ + PKG-INFO \ + PKG-INFO.in \ + setup.py \ + pygobject_postinstall.py \ + pygtk.py \ + dsextras.py \ + ChangeLog.pre-2.18 \ + m4/as-ac-expand.m4 \ + m4/jhflags.m4 \ + m4/python.m4 + +BUILT_EXTRA_DIST = \ + ChangeLog + +INCLUDES = -I$(top_srcdir)/gobject $(PYTHON_INCLUDES) $(GLIB_CFLAGS) + +# pkg-config files +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = pygobject-$(PLATFORM_VERSION).pc + +# python modules +pkgpyexecdir = $(pyexecdir)/gtk-2.0 +pkgpyexec_PYTHON = dsextras.py +pkgpyexec_LTLIBRARIES = + +# python +pyexec_PYTHON = pygtk.py +pyexec_LTLIBRARIES = + +# linker flags +common_ldflags = -module -avoid-version +if PLATFORM_WIN32 +common_ldflags += -no-undefined +endif + +# install pth file. +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(pythondir) + echo "gtk-$(PLATFORM_VERSION)" > $(DESTDIR)$(pyexecdir)/pygtk.pth +install-exec-local: + $(mkinstalldirs) $(DESTDIR)$(pyexecdir) + echo "gtk-$(PLATFORM_VERSION)" > $(DESTDIR)$(pyexecdir)/pygtk.pth +uninstall-local: + rm -f $(DESTDIR)$(pythondir)/pygtk.pth $(DESTDIR)$(pyexecdir)/pygtk.pth + +EGG_NAME = $(PACKAGE)-$(PACKAGE_VERSION)-py$(PYTHON_VERSION)-$(PLATFORM).egg + +egg: EGG_TMPDIR:=$(TMPDIR)/$(PACKAGE)-$(PACKAGE_VERSION) +egg: $(top_srcdir)/gobject/gobject.la PKG-INFO + rm -fr $(EGG_TMPDIR) + echo $(EGG_NAME) + $(MKDIR_P) $(EGG_TMPDIR) + $(MKDIR_P) $(EGG_TMPDIR)/EGG-INFO + $(MAKE) -C gobject install-pkgpyexecLTLIBRARIES pkgpyexecdir=$(EGG_TMPDIR) + $(INSTALL) dsextras.py $(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" ; echo "dsextras.py" ) >> $(EGG_TMPDIR)/EGG-INFO/top_level.txt + cd $(EGG_TMPDIR) && zip -rq $(EGG_NAME) . + mv $(EGG_TMPDIR)/$(EGG_NAME) . + 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-tag: + @ROOT=`svn info --xml|egrep ^""|cut -d\> -f2|cut -d\< -f1`; \ + SVNVERSION=`echo $(VERSION)|sed s/\\\./_/g`;\ + echo "* Tagging $(VERSION)"; \ + svn cp -m "Tag $(VERSION)" \ + $$ROOT \ + svn+ssh://johan@svn.gnome.org/svn/pygobject/tags/PYGOBJECT_$$SVNVERSION + + +.PHONY: ChangeLog + +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 diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..000c547 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,1082 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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@ +@PLATFORM_WIN32_TRUE@am__append_1 = -no-undefined +subdir = . +DIST_COMMON = README $(am__configure_deps) $(pkgpyexec_PYTHON) \ + $(pyexec_PYTHON) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/PKG-INFO.in $(srcdir)/config.h.in \ + $(srcdir)/pygobject-2.0-uninstalled.pc.in \ + $(srcdir)/pygobject-2.0.pc.in $(top_srcdir)/configure \ + $(top_srcdir)/docs/reference/entities.docbook.in \ + $(top_srcdir)/docs/xsl/fixxref.py.in AUTHORS COPYING ChangeLog \ + INSTALL NEWS compile config.guess config.sub depcomp \ + install-sh ltmain.sh missing 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) +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-2.0.pc pygobject-2.0-uninstalled.pc \ + docs/reference/entities.docbook docs/xsl/fixxref.py 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__installdirs = "$(DESTDIR)$(pkgpyexecdir)" "$(DESTDIR)$(pyexecdir)" \ + "$(DESTDIR)$(pkgpyexecdir)" "$(DESTDIR)$(pyexecdir)" \ + "$(DESTDIR)$(pkgconfigdir)" +LTLIBRARIES = $(pkgpyexec_LTLIBRARIES) $(pyexec_LTLIBRARIES) +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive +py_compile = $(top_srcdir)/py-compile +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(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" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = -I m4 +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +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@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +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@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBFFI_PC = @LIBFFI_PC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PLATFORM = @PLATFORM@ +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_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +THREADING_CFLAGS = @THREADING_CFLAGS@ +VERSION = @VERSION@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +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@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ + +# python modules +pkgpyexecdir = $(pyexecdir)/gtk-2.0 +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pygobject_CODEGEN_DEFINES = @pygobject_CODEGEN_DEFINES@ +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 = docs codegen glib gobject gio examples tests +PLATFORM_VERSION = 2.0 +CLEANFILES = +EXTRA_DIST = \ + MANIFEST.in \ + README.win32 \ + pygobject-$(PLATFORM_VERSION).pc.in \ + PKG-INFO \ + PKG-INFO.in \ + setup.py \ + pygobject_postinstall.py \ + pygtk.py \ + dsextras.py \ + ChangeLog.pre-2.18 \ + m4/as-ac-expand.m4 \ + m4/jhflags.m4 \ + m4/python.m4 + +BUILT_EXTRA_DIST = \ + ChangeLog + +INCLUDES = -I$(top_srcdir)/gobject $(PYTHON_INCLUDES) $(GLIB_CFLAGS) + +# pkg-config files +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = pygobject-$(PLATFORM_VERSION).pc +pkgpyexec_PYTHON = dsextras.py +pkgpyexec_LTLIBRARIES = + +# python +pyexec_PYTHON = pygtk.py +pyexec_LTLIBRARIES = + +# linker flags +common_ldflags = -module -avoid-version $(am__append_1) +EGG_NAME = $(PACKAGE)-$(PACKAGE_VERSION)-py$(PYTHON_VERSION)-$(PLATFORM).egg +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu 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; \ + $(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-2.0.pc: $(top_builddir)/config.status $(srcdir)/pygobject-2.0.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +pygobject-2.0-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/pygobject-2.0-uninstalled.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +docs/reference/entities.docbook: $(top_builddir)/config.status $(top_srcdir)/docs/reference/entities.docbook.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +docs/xsl/fixxref.py: $(top_builddir)/config.status $(top_srcdir)/docs/xsl/fixxref.py.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +PKG-INFO: $(top_builddir)/config.status $(srcdir)/PKG-INFO.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-pkgpyexecLTLIBRARIES: $(pkgpyexec_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgpyexecdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgpyexecdir)" + @list='$(pkgpyexec_LTLIBRARIES)'; test -n "$(pkgpyexecdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgpyexecdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgpyexecdir)"; \ + } + +uninstall-pkgpyexecLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkgpyexec_LTLIBRARIES)'; test -n "$(pkgpyexecdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgpyexecdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgpyexecdir)/$$f"; \ + done + +clean-pkgpyexecLTLIBRARIES: + -test -z "$(pkgpyexec_LTLIBRARIES)" || rm -f $(pkgpyexec_LTLIBRARIES) + @list='$(pkgpyexec_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pyexecdir)" || $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" + @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 " $(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)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt +install-pkgpyexecPYTHON: $(pkgpyexec_PYTHON) + @$(NORMAL_INSTALL) + test -z "$(pkgpyexecdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgpyexecdir)" + @list='$(pkgpyexec_PYTHON)'; dlist=; list2=; test -n "$(pkgpyexecdir)" || list=; \ + 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)$(pkgpyexecdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgpyexecdir)" || exit $$?; \ + done || exit $$?; \ + if test -n "$$dlist"; then \ + if test -z "$(DESTDIR)"; then \ + PYTHON=$(PYTHON) $(py_compile) --basedir "$(pkgpyexecdir)" $$dlist; \ + else \ + PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pkgpyexecdir)" $$dlist; \ + fi; \ + else :; fi + +uninstall-pkgpyexecPYTHON: + @$(NORMAL_UNINSTALL) + @list='$(pkgpyexec_PYTHON)'; test -n "$(pkgpyexecdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + filesc=`echo "$$files" | sed 's|$$|c|'`; \ + fileso=`echo "$$files" | sed 's|$$|o|'`; \ + echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$files || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$filesc ")"; \ + cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$filesc || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pkgpyexecdir)' && rm -f" $$fileso ")"; \ + cd "$(DESTDIR)$(pkgpyexecdir)" && rm -f $$fileso +install-pyexecPYTHON: $(pyexec_PYTHON) + @$(NORMAL_INSTALL) + test -z "$(pyexecdir)" || $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" + @list='$(pyexec_PYTHON)'; dlist=; list2=; test -n "$(pyexecdir)" || list=; \ + 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)$(pyexecdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pyexecdir)" || exit $$?; \ + done || exit $$?; \ + if test -n "$$dlist"; then \ + if test -z "$(DESTDIR)"; then \ + PYTHON=$(PYTHON) $(py_compile) --basedir "$(pyexecdir)" $$dlist; \ + else \ + PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pyexecdir)" $$dlist; \ + fi; \ + else :; fi + +uninstall-pyexecPYTHON: + @$(NORMAL_UNINSTALL) + @list='$(pyexec_PYTHON)'; test -n "$(pyexecdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + filesc=`echo "$$files" | sed 's|$$|c|'`; \ + fileso=`echo "$$files" | sed 's|$$|o|'`; \ + echo " ( cd '$(DESTDIR)$(pyexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pyexecdir)" && rm -f $$files || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pyexecdir)' && rm -f" $$filesc ")"; \ + cd "$(DESTDIR)$(pyexecdir)" && rm -f $$filesc || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pyexecdir)' && rm -f" $$fileso ")"; \ + cd "$(DESTDIR)$(pyexecdir)" && rm -f $$fileso +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files + +# 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. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +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 \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + 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__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__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.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(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 a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(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" \ + $(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__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: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { 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)$(pkgpyexecdir)" "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(pkgpyexecdir)" "$(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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-recursive + +clean-am: clean-generic clean-libtool clean-pkgpyexecLTLIBRARIES \ + 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-pkgpyexecLTLIBRARIES \ + install-pkgpyexecPYTHON install-pyexecLTLIBRARIES \ + install-pyexecPYTHON + +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-pkgpyexecLTLIBRARIES uninstall-pkgpyexecPYTHON \ + uninstall-pyexecLTLIBRARIES uninstall-pyexecPYTHON + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool clean-pkgpyexecLTLIBRARIES \ + clean-pyexecLTLIBRARIES ctags ctags-recursive dist dist-all \ + dist-bzip2 dist-gzip dist-hook dist-lzma 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-pkgpyexecLTLIBRARIES install-pkgpyexecPYTHON \ + install-ps install-ps-am install-pyexecLTLIBRARIES \ + install-pyexecPYTHON 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-recursive \ + uninstall uninstall-am uninstall-local uninstall-pkgconfigDATA \ + uninstall-pkgpyexecLTLIBRARIES uninstall-pkgpyexecPYTHON \ + uninstall-pyexecLTLIBRARIES uninstall-pyexecPYTHON + + +# install pth file. +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(pythondir) + echo "gtk-$(PLATFORM_VERSION)" > $(DESTDIR)$(pyexecdir)/pygtk.pth +install-exec-local: + $(mkinstalldirs) $(DESTDIR)$(pyexecdir) + echo "gtk-$(PLATFORM_VERSION)" > $(DESTDIR)$(pyexecdir)/pygtk.pth +uninstall-local: + rm -f $(DESTDIR)$(pythondir)/pygtk.pth $(DESTDIR)$(pyexecdir)/pygtk.pth + +egg: EGG_TMPDIR:=$(TMPDIR)/$(PACKAGE)-$(PACKAGE_VERSION) +egg: $(top_srcdir)/gobject/gobject.la PKG-INFO + rm -fr $(EGG_TMPDIR) + echo $(EGG_NAME) + $(MKDIR_P) $(EGG_TMPDIR) + $(MKDIR_P) $(EGG_TMPDIR)/EGG-INFO + $(MAKE) -C gobject install-pkgpyexecLTLIBRARIES pkgpyexecdir=$(EGG_TMPDIR) + $(INSTALL) dsextras.py $(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" ; echo "dsextras.py" ) >> $(EGG_TMPDIR)/EGG-INFO/top_level.txt + cd $(EGG_TMPDIR) && zip -rq $(EGG_NAME) . + mv $(EGG_TMPDIR)/$(EGG_NAME) . + 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-tag: + @ROOT=`svn info --xml|egrep ^""|cut -d\> -f2|cut -d\< -f1`; \ + SVNVERSION=`echo $(VERSION)|sed s/\\\./_/g`;\ + echo "* Tagging $(VERSION)"; \ + svn cp -m "Tag $(VERSION)" \ + $$ROOT \ + svn+ssh://johan@svn.gnome.org/svn/pygobject/tags/PYGOBJECT_$$SVNVERSION + +.PHONY: ChangeLog + +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 + +# 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 new file mode 100644 index 0000000..cee8732 --- /dev/null +++ b/NEWS @@ -0,0 +1,460 @@ +2.21.3 21-Jan-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-Jan-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) diff --git a/PKG-INFO b/PKG-INFO new file mode 100644 index 0000000..f029d09 --- /dev/null +++ b/PKG-INFO @@ -0,0 +1,25 @@ +Metadata-Version: 1.0 +Name: PyGObject +Version: 2.21.3 +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/2.21/pygobject-2.21.3.tar.gz +Description: Python bindings for GLib, GObject and GIO +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 new file mode 100644 index 0000000..ac0e2e6 --- /dev/null +++ b/PKG-INFO.in @@ -0,0 +1,25 @@ +Metadata-Version: 1.0 +Name: PyGObject +Version: @VERSION@ +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/@PYGOBJECT_MAJOR_VERSION@.@PYGOBJECT_MINOR_VERSION@/pygobject-@VERSION@.tar.gz +Description: Python bindings for GLib, GObject and GIO +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/README b/README new file mode 100644 index 0000000..c5a7089 --- /dev/null +++ b/README @@ -0,0 +1,101 @@ +PyGObject +===== +Original authors: James Henstridge + Johan Dahlin + +Current maintainers: Gustavo J A M Carneiro + Paul Pogonyshev + Gian Mario Tagliaretti + Tomeu Vizoso + +This archive contains bindings for the GLib, GObject and GIO, +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 share mailing list with pygtk. You can subscribe to it through +the web interface: + http://www.daa.com.au/mailman/listinfo/pygtk + + +Requirements +============ + * C compiler (GCC and MSVC supported) + * Python 2.3.5 or higher + * Glib 2.22.4 or higher + * GIO 2.22.4 or higher + * GIO-unix 2.22.4 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 + +If your Python interpreter isn't in the path, or is not called +"python", you can set the PYTHON environment variable to the full path +of the interpreter: + + $ PYTHON=/prefix/bin/python + $ export 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 +send a message to the mailing list (information on subscribing is +above). Alternatively, your question may be answered in the PyGTK FAQ: + + http://www.async.com.br/faq/pygtk/?req=index diff --git a/README.win32 b/README.win32 new file mode 100644 index 0000000..548a3c8 --- /dev/null +++ b/README.win32 @@ -0,0 +1,24 @@ +Windows Setuptools Build Instructions +====================================== + + 1. Install gtk+ bundle from gtk.org (to C:\GTK for example) + 2. Install Python2.6 + 3. Install MinGW and MSYS + 4. Add C:\GTK\bin to path (from windows) + 5. Add the following to your msys environment variables + (open and append to C:\msys\1.0\etc\profile) or set for the session + + $ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/c/GTK/lib/pkgconfig:/c/Python26/Lib/pkgconfig + $ export PATH=$PATH:/c/Python26:/c/Python26/bin + + 6. In msys shell, build with + + $ python setup.py build --compiler=mingw32 --enable-threading \ + --yes-i-know-its-not-supported bdist_wininst + +Tested with + * gtk+-bundle_2.20.0-20100406_win32.zip + * MinGW-5.16.exe + * MSYS-1.0.11.exe + * python-2.6.5.exe + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..784a482 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1596 @@ +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 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_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],, +[m4_warning([this file was generated for autoconf 2.63. +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, 2003, 2005, 2006, 2007, 2008 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.11' +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.11.1], [], + [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.11.1])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, 2003, 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. + +# 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, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# 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. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$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, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# 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. + +# serial 10 + +# 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", "GCJ", or "OBJC". +# 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 + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" 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'. + 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 8's {/usr,}/bin/sh. + touch 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 + ;; + 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, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# 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. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 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"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/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"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 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. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 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. + +# serial 16 + +# 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.62])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], +[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], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [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([AM_PROG_MKDIR_P])dnl +# 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)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl 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, 2003, 2005, 2008 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, 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. + +# serial 2 + +# 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, 2002, 2003, 2005, 2009 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. + +# serial 4 + +# 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, 2000, 2001, 2003, 2004, 2005, 2008 +# 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. + +# serial 6 + +# 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, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# 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. + +# serial 6 + +# 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 supports --run. +# If it does, 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 --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 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_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 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. + +# serial 4 + +# _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, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 +# 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.0 python2.5 python2.4 python2.3 python2.2 dnl +python2.1 python2.0]) + + 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]) + AM_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 + 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]) + + + 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], + [if test "x$prefix" = xNONE + then + am_py_prefix=$ac_default_prefix + else + am_py_prefix=$prefix + fi + am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || + echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + 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. 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], + [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 "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || + echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + 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, 2003, 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. + +# 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, 1997, 2000, 2001, 2003, 2005, 2008 +# 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. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# 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 ( + 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 + rm -f conftest.file + 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 + + 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)]) + +# Copyright (C) 2001, 2003, 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. + +# 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, 2008 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. + +# serial 2 + +# _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, 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. + +# serial 2 + +# _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. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +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 + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# 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)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +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. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure 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_ifval([$2], [$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`], + [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 + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[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 +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[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 .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$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_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 () +{ + 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, "%d.%d.%d", &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 (%d.%d.%d) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %d.%d.%d. 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="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) + AC_SUBST(GLIB_GENMARSHAL) + AC_SUBST(GOBJECT_QUERY) + AC_SUBST(GLIB_MKENUMS) + 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/codegen/Makefile.am b/codegen/Makefile.am new file mode 100644 index 0000000..cdb1e99 --- /dev/null +++ b/codegen/Makefile.am @@ -0,0 +1,31 @@ +PLATFORM_VERSION = 2.0 + +bin_SCRIPTS = pygobject-codegen-$(PLATFORM_VERSION) + +codegendir = $(pkgdatadir)/$(PLATFORM_VERSION)/codegen + +codegen_SCRIPTS = \ + code-coverage.py \ + codegen.py \ + createdefs.py \ + defsconvert.py \ + defsgen.py \ + docextract_to_xml.py \ + docgen.py \ + h2def.py \ + mergedefs.py \ + missingdefs.py \ + mkskel.py \ + scanvirtuals.py \ + scmexpr.py + +codegen_PYTHON = \ + __init__.py \ + argtypes.py \ + definitions.py \ + defsparser.py \ + docextract.py \ + override.py \ + reversewrapper.py + +EXTRA_DIST = $(codegen_SCRIPTS) README.defs pygobject-codegen-$(PLATFORM_VERSION).in diff --git a/codegen/Makefile.in b/codegen/Makefile.in new file mode 100644 index 0000000..c9193fc --- /dev/null +++ b/codegen/Makefile.in @@ -0,0 +1,555 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = codegen +DIST_COMMON = $(codegen_PYTHON) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/pygobject-codegen-2.0.in +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 = pygobject-codegen-2.0 +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__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(codegendir)" \ + "$(DESTDIR)$(codegendir)" +SCRIPTS = $(bin_SCRIPTS) $(codegen_SCRIPTS) +SOURCES = +DIST_SOURCES = +py_compile = $(top_srcdir)/py-compile +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +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@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +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@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBFFI_PC = @LIBFFI_PC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PLATFORM = @PLATFORM@ +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_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +THREADING_CFLAGS = @THREADING_CFLAGS@ +VERSION = @VERSION@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +pygobject_CODEGEN_DEFINES = @pygobject_CODEGEN_DEFINES@ +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@ +PLATFORM_VERSION = 2.0 +bin_SCRIPTS = pygobject-codegen-$(PLATFORM_VERSION) +codegendir = $(pkgdatadir)/$(PLATFORM_VERSION)/codegen +codegen_SCRIPTS = \ + code-coverage.py \ + codegen.py \ + createdefs.py \ + defsconvert.py \ + defsgen.py \ + docextract_to_xml.py \ + docgen.py \ + h2def.py \ + mergedefs.py \ + missingdefs.py \ + mkskel.py \ + scanvirtuals.py \ + scmexpr.py + +codegen_PYTHON = \ + __init__.py \ + argtypes.py \ + definitions.py \ + defsparser.py \ + docextract.py \ + override.py \ + reversewrapper.py + +EXTRA_DIST = $(codegen_SCRIPTS) README.defs pygobject-codegen-$(PLATFORM_VERSION).in +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) --gnu codegen/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu codegen/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): +pygobject-codegen-2.0: $(top_builddir)/config.status $(srcdir)/pygobject-codegen-2.0.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files +install-codegenSCRIPTS: $(codegen_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(codegendir)" || $(MKDIR_P) "$(DESTDIR)$(codegendir)" + @list='$(codegen_SCRIPTS)'; test -n "$(codegendir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(codegendir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(codegendir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-codegenSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(codegen_SCRIPTS)'; test -n "$(codegendir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(codegendir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(codegendir)" && rm -f $$files + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-codegenPYTHON: $(codegen_PYTHON) + @$(NORMAL_INSTALL) + test -z "$(codegendir)" || $(MKDIR_P) "$(DESTDIR)$(codegendir)" + @list='$(codegen_PYTHON)'; dlist=; list2=; test -n "$(codegendir)" || list=; \ + 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)$(codegendir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(codegendir)" || exit $$?; \ + done || exit $$?; \ + if test -n "$$dlist"; then \ + if test -z "$(DESTDIR)"; then \ + PYTHON=$(PYTHON) $(py_compile) --basedir "$(codegendir)" $$dlist; \ + else \ + PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(codegendir)" $$dlist; \ + fi; \ + else :; fi + +uninstall-codegenPYTHON: + @$(NORMAL_UNINSTALL) + @list='$(codegen_PYTHON)'; test -n "$(codegendir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + filesc=`echo "$$files" | sed 's|$$|c|'`; \ + fileso=`echo "$$files" | sed 's|$$|o|'`; \ + echo " ( cd '$(DESTDIR)$(codegendir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(codegendir)" && rm -f $$files || exit $$?; \ + echo " ( cd '$(DESTDIR)$(codegendir)' && rm -f" $$filesc ")"; \ + cd "$(DESTDIR)$(codegendir)" && rm -f $$filesc || exit $$?; \ + echo " ( cd '$(DESTDIR)$(codegendir)' && rm -f" $$fileso ")"; \ + cd "$(DESTDIR)$(codegendir)" && rm -f $$fileso +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +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 $(SCRIPTS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(codegendir)" "$(DESTDIR)$(codegendir)"; 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-codegenPYTHON install-codegenSCRIPTS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binSCRIPTS + +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-binSCRIPTS uninstall-codegenPYTHON \ + uninstall-codegenSCRIPTS + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binSCRIPTS install-codegenPYTHON \ + install-codegenSCRIPTS 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 uninstall uninstall-am uninstall-binSCRIPTS \ + uninstall-codegenPYTHON uninstall-codegenSCRIPTS + + +# 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/codegen/README.defs b/codegen/README.defs new file mode 100644 index 0000000..5f7957e --- /dev/null +++ b/codegen/README.defs @@ -0,0 +1,351 @@ + ChangeLog for this draft: + - caller-owns-return attribute on functions/methods + - include gtk-type-id in the type alias system + - c-name for types converted to in-c-name out-c-name inout-c-name + - merge unref-func and destroy-func for boxed types into release-func + + - split structs out of boxed types + - c-declaration field + - special "native" type alias; bail and use C declaration when + necessary + - defined objects and boxeds automatically create a module + - make constructors functions and not methods, in appropriate + object/boxed module + + Draft ========================= + + The overall syntax is: + + (type-of-thing-being-defined name-used-to-refer-to-this-thing + (attribute-name attribute-value-depending-on-the-attribute) + (attribute-name attribute-value-depending-on-the-attribute) + (attribute-name attribute-value-depending-on-the-attribute)) + + Some definitions can have a c-declaration field that gives the C code + we parsed to arrive at the definition. The c-declaration is a quoted + string because it can contain parentheses and such. + + Defined types and their attributes: + + === + (module module-name + (submodule-of module-name)) ;; submodule is optional + + Ex: (module Gtk) + Ex: (module Rgb + (submodule-of Gdk)) + + modules are later referred to with a list of module names, like + (Gdk Rgb) or (Gtk) + + Object and boxed type definitions automatically create a submodule. + For example, GtkCList creates the module (module CList (submodule-of + (Gtk))) which is referred to as module (Gtk CList). + + === + + (type + (alias some-unique-identifier) + (in-module module-name) ;; optional, gchar* is not in a module + (gtk-type-id gtk-type-system-id) ;; optional, absent if this is not + ;; in the type system + (in-c-name name-of-symbol-in-C) + (out-c-name name-of-symbol-in-C) + (inout-c-name name-of-symbol-in-C)) + + Ex: (type + (alias string) + (gtk-type-id GTK_TYPE_STRING) + (in-c-name const-gchar*) + (out-c-name gchar**) ;; actually I'm not sure how strings work + out/inout + (inout-c-name gchar*)) + + ;; This one would be implied by the (object) def for GtkWidget I + ;; think - (type) is only required for types that are not implied + ;; by other definitions, such as int/boolean/etc. + + (type + (alias GtkWidget) + (in-module (Gtk)) + (gtk-type-id GTK_TYPE_WIDGET) + (in-c-name GtkWidget*) + (inout-c-name GtkWidget*) + (out-c-name GtkWidget**)) + + "Type" bindings are automatically assumed for objects, boxed types, + etc. as defined below. + + The alias field is used to refer to the type later on. + + If the C type has spaces they are converted to hyphens after + compressing all syntactically significant whitespace to a single + space: + (type + (alias const-gchar* + (c-name const-gchar*))) + + So hyphens have to go back to spaces for binding generators that + output C code. + + Whenever a type alias can be used, it is also possible to use the + keyword "native", which implies that the type in question is too + C-specific to represent. Then a c-declaration will typically be + available for use. + + C types containing [] or () are function pointers or arrays. For + arrays that don't specify a size, we just treat them as pointers. For + function pointers, we need special (type) syntax/attributes of some + kind, but since there basically aren't any of these right now in the + libs we care about we can just ignore them. For arrays that specify a + size ditto, you would handle them by adding an (array-size) attribute + or something or using the "native" keyword and skipping the (type) + stuff. + + === + (object object-name + (in-module module-name-list) + (parent object-name optional-module-name-if-different) + (abstract boolean-is-abstract-class) ;; omit for default of #f + (c-name name-of-the-object-in-C) + (field (type-and-name type-alias-of-struct-field + name-of-struct-field) + (access read-or-write-or-readwrite))) + + + Ex: (object Widget + (in-module (Gtk)) + (parent Object) ;; could say (parent Object (Gtk)) + (abstract #t) + (c-name GtkWidget) + (field (type-and-name GdkWindow* window) (access read))) + + An "object" declaration automatically implies the type definition: + + (type + (alias concat-module-elements-and-object-name) + (in-c-name pointer-to-c-name) + (out-c-name pointer-to-pointer-to-c-name) + (inout-c-name pointer-to-c-name)) + + Ex: + (type (alias GtkWidget) + (in-c-name GtkWidget*) + (out-c-name GtkWidget**) + (inout-c-name GtkWidget*)) + + It also implies a module that is the name broken into parts: + (module CTree + (submodule-of Gtk)) + + === + + (function function-name + (in-module module-name-list) ;; "static methods" go in their + ;; object's module + (is-constructor-of object-type-alias) ;; optional, marks a + constructor + (c-name function-name) + (return-type return-value-type) ;; defaults to void + (caller-owns-return boolean-value) ;; defaults to #f + (parameter in-or-out-or-inout + (type-and-name parameter-type-alias parameter-name) + (c-declaration "c-type-and-name")) ;; c-declaration only + required + ;; if the type alias is + "native" + (varargs #t) ;; has varargs at the end + ) + + Ex: + (function init + (in-module (Gdk Rgb) + (c-name gdk_rgb_init))) + + Ex: + (function new + (in-module (Gdk Rgb Cmap)) + (is-constructor-of GdkRgbCmap) + (c-name gdk_rgb_cmap_new) + (return-type GdkRgbCmap) + (caller-owns-return #t) ;; perhaps this could be implied by + is-constructor-of + (parameter in (type-and-name array-of-guint32 colors)) + (parameter in (type-and-name gint n_colors))) + + Ex: + (function config_set_set_handler + (in-module (Gnome)) + (c-name gnome_config_set_set_handler) + (parameter in (type-and-name native func) + (c-declaration "void (*func)(void*)")) + (parameter in (type-and-name gpointer data))) + + === + (method method-name + (of-object object-name module-name) + ;; retval/arg attributes as for (function), but with first parameter + + ;; omitted for non-constructors + ) + + Ex: + (method set_text + (of-object Label (Gtk)) + (parameter (type-and-name const-gchar* str))) + + === + (object-argument arg-name + (of-object object-we-are-an-argument-of optional-objects-module) + (type argument-type) ;; not sure what to put for type + ;; flags all default to #f + (readable bool-value) + (writeable bool-value) + (run-action bool-value) + (construct-only bool-value)) + + Ex: + (object-argument label + (of-object Label (Gtk)) + (type gchar*) ;; ???? + (readable #t) + (writeable #t)) + + === + (signal signal-name + (of-object object-we-are-a-signal-of optional-objects-module) + ;; return value and parameters as for a function, omitting the + object + ;; and user data parameters + + ;; what other properties matter for a signal? + ) + + Ex: + (signal select_row + (of-object CList (Gtk)) + ;; return type defaults to void + (parameter in (type-and-name gint row)) + (parameter in (type-and-name gint column)) + (parameter in (type-and-name GdkEvent* event))) + + === + (enum enum-name + (in-module modname) + (c-name name-in-c) + (value (name value-name-noprefixes-hyphen-lowercase) (c-name + value-c-name))) + + Ex: + + (enum DirectionType + (in-module Gtk) + (c-name GtkDirectionType) + (value (name tab-forward) (c-name GTK_DIR_TAB_FORWARD)) + (value (name tab-backward) (c-name GTK_DIR_TAB_BACKWARD)) + (value (name up) (c-name GTK_DIR_UP)) + (value (name down) (c-name GTK_DIR_DOWN)) + (value (name left) (c-name GTK_DIR_LEFT)) + (value (name right) (c-name GTK_DIR_RIGHT))) + + (enum Pos + (in-module (Gtk CTree)) + (c-name GtkCTreePos) + (value (name before) (c-name GTK_CTREE_POS_BEFORE)) + (value (name as-child) (c-name GTK_CTREE_POS_AS_CHILD)) + (value (name after) (c-name GTK_CTREE_POS_AFTER))) + + === + (flags) is just like enum, but some bindings may wrap enums and flags + differently. + + === + + (boxed boxed-name + (in-module modname) + (c-name c-name) + (ref-func func-to-increase-refcount) + (copy-func func-to-copy) + (release-func func-to-destroy-or-decrement-refcount) + (field (type-and-name type-alias-of-struct-field + name-of-struct-field) (access access-rule))) + + It is never OK to use memcpy() to copy a boxed type, or use + malloc()/free() to alloc/free one. + + Ex: + + (boxed Pixmap + (in-module (Gdk)) + (c-name GdkPixmap) + (ref-func pixmap_ref) + (unref-func pixmap_unref)) + + An "object" declaration automatically implies the type definition: + + (type + (alias concat-module-elements-and-boxed-name) + (in-c-name pointer-to-c-name) + (out-c-name pointer-to-pointer-to-c-name) + (inout-c-name pointer-to-c-name)) + + Ex: + (type (alias GdkPixmap) + (in-c-name GdkPixmap*) + (out-c-name GdkPixmap**) + (inout-c-name GdkPixmap*)) + + === + + (struct struct-name + (in-module modname) + (c-name c-name) + (field (type-and-name type-alias-of-struct-field + name-of-struct-field) (access access-rule))) + + Ex: + (struct Rectangle + (in-module (Gdk)) + (c-name GdkRectangle) + (field (type-and-name gint16 x) (access readwrite)) + (field (type-and-name gint16 y) (access readwrite)) + (field (type-and-name guint16 width) (access readwrite)) + (field (type-and-name guint16 height) (access readwrite))) + + Implies GdkRectangle type alias: + + (type (alias GdkRectangle) + (in-c-name GdkRectangle*) + (out-c-name GdkRectangle*) ;; note - not the same as boxed + types + (inout-c-name GdkRectangle*)) + + === + + (user-function name + (in-module module) + (c-name c-typedef-name) + ;; return-type and parameters as for (function) + ) + + Ex: + + (user-function PrintFunc + (in-module (Gtk)) + (parameter in (type-and-name gpointer func_data)) + (parameter in (type-and-name gchar* str))) + + === + + (typedef new-name + (in-module module) + (c-name c-full-name) + (orig-type alias-of-orig-type)) + + Ex: + + (typedef Type + (in-module (Gtk)) + (c-name GtkType) + (orig-type guint)) + diff --git a/codegen/__init__.py b/codegen/__init__.py new file mode 100644 index 0000000..86188f9 --- /dev/null +++ b/codegen/__init__.py @@ -0,0 +1,16 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- + +__all__ = [ + 'argtypes', + 'codegen', + 'definitions', + 'defsparser', + 'docextract', + 'docgen', + 'h2def', + 'defsgen' + 'mergedefs', + 'mkskel', + 'override', + 'scmexpr' +] diff --git a/codegen/argtypes.py b/codegen/argtypes.py new file mode 100644 index 0000000..b35f6ef --- /dev/null +++ b/codegen/argtypes.py @@ -0,0 +1,1043 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +import string +import keyword +import struct + +py_ssize_t_clean = False + +class ArgTypeError(Exception): + pass + +class ArgTypeNotFoundError(ArgTypeError): + pass + +class ArgTypeConfigurationError(ArgTypeError): + pass + + +class VarList: + """Nicely format a C variable list""" + def __init__(self): + self.vars = {} + def add(self, ctype, name): + if self.vars.has_key(ctype): + self.vars[ctype] = self.vars[ctype] + (name,) + else: + self.vars[ctype] = (name,) + def __str__(self): + ret = [] + for type in self.vars.keys(): + ret.append(' ') + ret.append(type) + ret.append(' ') + ret.append(string.join(self.vars[type], ', ')) + ret.append(';\n') + if ret: + ret.append('\n') + return string.join(ret, '') + return '' + +class WrapperInfo: + """A class that holds information about variable defs, code + snippets, etcd for use in writing out the function/method + wrapper.""" + def __init__(self): + self.varlist = VarList() + self.parsestr = '' + self.parselist = ['', 'kwlist'] + self.codebefore = [] + self.codeafter = [] + self.arglist = [] + self.kwlist = [] + def get_parselist(self): + return string.join(self.parselist, ', ') + def get_codebefore(self): + return string.join(self.codebefore, '') + def get_codeafter(self): + return string.join(self.codeafter, '') + def get_arglist(self): + return string.join(self.arglist, ', ') + def get_varlist(self): + return str(self.varlist) + def get_kwlist(self): + ret = ' static char *kwlist[] = { %s };\n' % \ + string.join(self.kwlist + [ 'NULL' ], ', ') + if not self.get_varlist(): + ret = ret + '\n' + return ret + + def add_parselist(self, codes, parseargs, keywords): + self.parsestr = self.parsestr + codes + for arg in parseargs: + self.parselist.append(arg) + for kw in keywords: + if keyword.iskeyword(kw): + kw = kw + '_' + self.kwlist.append('"%s"' % kw) + +class ArgType: + def write_param(self, ptype, pname, pdflt, pnull, info): + """Add code to the WrapperInfo instance to handle + parameter.""" + raise RuntimeError, "write_param not implemented for %s" % \ + self.__class__.__name__ + def write_return(self, ptype, ownsreturn, info): + """Adds a variable named ret of the return type to + info.varlist, and add any required code to info.codeafter to + convert the return value to a python object.""" + raise RuntimeError, "write_return not implemented for %s" % \ + self.__class__.__name__ + +class NoneArg(ArgType): + def write_return(self, ptype, ownsreturn, info): + info.codeafter.append(' Py_INCREF(Py_None);\n' + + ' return Py_None;') + +class StringArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt != None: + if pdflt != 'NULL': pdflt = '"' + pdflt + '"' + info.varlist.add('char', '*' + pname + ' = ' + pdflt) + else: + info.varlist.add('char', '*' + pname) + info.arglist.append(pname) + if pnull: + info.add_parselist('z', ['&' + pname], [pname]) + else: + info.add_parselist('s', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + if ownsreturn: + # have to free result ... + info.varlist.add('gchar', '*ret') + info.codeafter.append(' if (ret) {\n' + + ' PyObject *py_ret = PyString_FromString(ret);\n' + + ' g_free(ret);\n' + + ' return py_ret;\n' + + ' }\n' + + ' Py_INCREF(Py_None);\n' + + ' return Py_None;') + else: + info.varlist.add('const gchar', '*ret') + info.codeafter.append(' if (ret)\n' + + ' return PyString_FromString(ret);\n'+ + ' Py_INCREF(Py_None);\n' + + ' return Py_None;') + +class UCharArg(ArgType): + # allows strings with embedded NULLs. + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('guchar', '*' + pname + ' = "' + pdflt + '"') + else: + info.varlist.add('guchar', '*' + pname) + if py_ssize_t_clean: + info.varlist.add('Py_ssize_t', pname + '_len') + else: + info.varlist.add('int', pname + '_len') + info.arglist.append(pname) + if pnull: + info.add_parselist('z#', ['&' + pname, '&' + pname + '_len'], + [pname]) + else: + info.add_parselist('s#', ['&' + pname, '&' + pname + '_len'], + [pname]) + +class CharArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('char', pname + " = '" + pdflt + "'") + else: + info.varlist.add('char', pname) + info.arglist.append(pname) + info.add_parselist('c', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('gchar', 'ret') + info.codeafter.append(' return PyString_FromStringAndSize(&ret, 1);') +class GUniCharArg(ArgType): + ret_tmpl = ('#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2\n' + ' if (ret > 0xffff) {\n' + ' PyErr_SetString(PyExc_RuntimeError, "returned character can not be represented in 16-bit unicode");\n' + ' return NULL;\n' + ' }\n' + '#endif\n' + ' py_ret = (Py_UNICODE)ret;\n' + ' return PyUnicode_FromUnicode(&py_ret, 1);\n') + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('gunichar', pname + " = '" + pdflt + "'") + else: + info.varlist.add('gunichar', pname) + info.arglist.append(pname) + info.add_parselist('O&', ['pyg_pyobj_to_unichar_conv', '&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('gunichar', 'ret') + info.varlist.add('Py_UNICODE', 'py_ret') + info.codeafter.append(self.ret_tmpl) + + +class IntArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('int', pname + ' = ' + pdflt) + else: + info.varlist.add('int', pname) + info.arglist.append(pname) + info.add_parselist('i', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('int', 'ret') + info.codeafter.append(' return PyInt_FromLong(ret);') + +class UIntArg(ArgType): + dflt = (' if (py_%(name)s) {\n' + ' if (PyLong_Check(py_%(name)s))\n' + ' %(name)s = PyLong_AsUnsignedLong(py_%(name)s);\n' + ' else if (PyInt_Check(py_%(name)s))\n' + ' %(name)s = PyInt_AsLong(py_%(name)s);\n' + ' else\n' + ' PyErr_SetString(PyExc_TypeError, "Parameter \'%(name)s\' must be an int or a long");\n' + ' if (PyErr_Occurred())\n' + ' return NULL;\n' + ' }\n') + before = (' if (PyLong_Check(py_%(name)s))\n' + ' %(name)s = PyLong_AsUnsignedLong(py_%(name)s);\n' + ' else if (PyInt_Check(py_%(name)s))\n' + ' %(name)s = PyInt_AsLong(py_%(name)s);\n' + ' else\n' + ' PyErr_SetString(PyExc_TypeError, "Parameter \'%(name)s\' must be an int or a long");\n' + ' if (PyErr_Occurred())\n' + ' return NULL;\n') + def write_param(self, ptype, pname, pdflt, pnull, info): + if not pdflt: + pdflt = '0'; + + info.varlist.add(ptype, pname + ' = ' + pdflt) + info.codebefore.append(self.dflt % {'name':pname}) + info.varlist.add('PyObject', "*py_" + pname + ' = NULL') + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add(ptype, 'ret') + info.codeafter.append(' return PyLong_FromUnsignedLong(ret);') + +class SizeArg(ArgType): + + if struct.calcsize('P') <= struct.calcsize('l'): + llp64 = True + else: + llp64 = False + + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add(ptype, pname + ' = ' + pdflt) + else: + info.varlist.add(ptype, pname) + info.arglist.append(pname) + if self.llp64: + info.add_parselist('k', ['&' + pname], [pname]) + else: + info.add_parselist('K', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add(ptype, 'ret') + if self.llp64: + info.codeafter.append(' return PyLong_FromUnsignedLongLong(ret);\n') + else: + info.codeafter.append(' return PyLong_FromUnsignedLong(ret);\n') + +class SSizeArg(ArgType): + + if struct.calcsize('P') <= struct.calcsize('l'): + llp64 = True + else: + llp64 = False + + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add(ptype, pname + ' = ' + pdflt) + else: + info.varlist.add(ptype, pname) + info.arglist.append(pname) + if self.llp64: + info.add_parselist('l', ['&' + pname], [pname]) + else: + info.add_parselist('L', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add(ptype, 'ret') + if self.llp64: + info.codeafter.append(' return PyLong_FromLongLong(ret);\n') + else: + info.codeafter.append(' return PyLong_FromLong(ret);\n') + +class LongArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add(ptype, pname + ' = ' + pdflt) + else: + info.varlist.add(ptype, pname) + info.arglist.append(pname) + info.add_parselist('l', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add(ptype, 'ret') + info.codeafter.append(' return PyInt_FromLong(ret);\n') + +class BoolArg(IntArg): + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('int', 'ret') + info.codeafter.append(' return PyBool_FromLong(ret);\n') + +class TimeTArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('time_t', pname + ' = ' + pdflt) + else: + info.varlist.add('time_t', pname) + info.arglist.append(pname) + info.add_parselist('i', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('time_t', 'ret') + info.codeafter.append(' return PyInt_FromLong(ret);') + +class ULongArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('unsigned long', pname + ' = ' + pdflt) + else: + info.varlist.add('unsigned long', pname) + info.arglist.append(pname) + info.add_parselist('k', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add(ptype, 'ret') + info.codeafter.append(' return PyLong_FromUnsignedLong(ret);\n') + +class UInt32Arg(ULongArg): + def write_param(self, ptype, pname, pdflt, pnull, info): + ULongArg.write_param(self, ptype, pname, pdflt, pnull, info) + ## if sizeof(unsigned long) > sizeof(unsigned int), we need to + ## check the value is within guint32 range + if struct.calcsize('L') > struct.calcsize('I'): + info.codebefore.append(( + ' if (%(pname)s > G_MAXUINT32) {\n' + ' PyErr_SetString(PyExc_ValueError,\n' + ' "Value out of range in conversion of"\n' + ' " %(pname)s parameter to unsigned 32 bit integer");\n' + ' return NULL;\n' + ' }\n') % vars()) + +class Int64Arg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('gint64', pname + ' = ' + pdflt) + else: + info.varlist.add('gint64', pname) + info.arglist.append(pname) + info.add_parselist('L', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('gint64', 'ret') + info.codeafter.append(' return PyLong_FromLongLong(ret);') + +class UInt64Arg(ArgType): + dflt = ' if (py_%(name)s)\n' \ + ' %(name)s = PyLong_AsUnsignedLongLong(py_%(name)s);\n' + before = ' %(name)s = PyLong_AsUnsignedLongLong(py_%(name)s);\n' + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('guint64', pname + ' = ' + pdflt) + info.codebefore.append(self.dflt % {'name':pname}) + else: + info.varlist.add('guint64', pname) + info.codebefore.append(self.before % {'name':pname}) + info.varlist.add('PyObject', "*py_" + pname + ' = NULL') + info.arglist.append(pname) + info.add_parselist('O!', ['&PyLong_Type', '&py_' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('guint64', 'ret') + info.codeafter.append(' return PyLong_FromUnsignedLongLong(ret);') + + +class DoubleArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('double', pname + ' = ' + pdflt) + else: + info.varlist.add('double', pname) + info.arglist.append(pname) + info.add_parselist('d', ['&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('double', 'ret') + info.codeafter.append(' return PyFloat_FromDouble(ret);') + +class FileArg(ArgType): + nulldflt = (' if (py_%(name)s == Py_None)\n' + ' %(name)s = NULL;\n' + ' else if (py_%(name)s && PyFile_Check(py_%(name)s)\n' + ' %s = PyFile_AsFile(py_%(name)s);\n' + ' else if (py_%(name)s) {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a file object or None");\n' + ' return NULL;\n' + ' }') + null = (' if (py_%(name)s && PyFile_Check(py_%(name)s)\n' + ' %(name)s = PyFile_AsFile(py_%(name)s);\n' + ' else if (py_%(name)s != Py_None) {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a file object or None");\n' + ' return NULL;\n' + ' }\n') + dflt = (' if (py_%(name)s)\n' + ' %(name)s = PyFile_AsFile(py_%(name)s);\n') + def write_param(self, ptype, pname, pdflt, pnull, info): + if pnull: + if pdflt: + info.varlist.add('FILE', '*' + pname + ' = ' + pdflt) + info.varlist.add('PyObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.nulldflt % {'name':pname}) + else: + info.varlist.add('FILE', '*' + pname + ' = NULL') + info.varlist.add('PyObject', '*py_' + pname) + info.codebefore.append(self.null & {'name':pname}) + info.arglist.appned(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + else: + if pdflt: + info.varlist.add('FILE', '*' + pname + ' = ' + pdflt) + info.varlist.add('PyObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.dflt % {'name':pname}) + info.arglist.append(pname) + else: + info.varlist.add('PyObject', '*' + pname) + info.arglist.append('PyFile_AsFile(' + pname + ')') + info.add_parselist('O!', ['&PyFile_Type', '&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('FILE', '*ret') + info.codeafter.append(' if (ret)\n' + + ' return PyFile_FromFile(ret, "", "", fclose);\n' + + ' Py_INCREF(Py_None);\n' + + ' return Py_None;') + +class EnumArg(ArgType): + enum = (' if (pyg_enum_get_value(%(typecode)s, py_%(name)s, (gpointer)&%(name)s))\n' + ' return NULL;\n') + def __init__(self, enumname, typecode): + self.enumname = enumname + self.typecode = typecode + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add(self.enumname, pname + ' = ' + pdflt) + else: + info.varlist.add(self.enumname, pname) + info.varlist.add('PyObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.enum % { 'typecode': self.typecode, + 'name': pname}) + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]); + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('gint', 'ret') + info.codeafter.append(' return pyg_enum_from_gtype(%s, ret);' % self.typecode) + +class FlagsArg(ArgType): + flag = (' if (%(default)spyg_flags_get_value(%(typecode)s, py_%(name)s, (gpointer)&%(name)s))\n' + ' return NULL;\n') + def __init__(self, flagname, typecode): + self.flagname = flagname + self.typecode = typecode + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add(self.flagname, pname + ' = ' + pdflt) + default = "py_%s && " % (pname,) + else: + info.varlist.add(self.flagname, pname) + default = "" + info.varlist.add('PyObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.flag % {'default':default, + 'typecode':self.typecode, + 'name':pname}) + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('guint', 'ret') + info.codeafter.append(' return pyg_flags_from_gtype(%s, ret);' % self.typecode) + +class ObjectArg(ArgType): + # should change these checks to more typesafe versions that check + # a little further down in the class heirachy. + nulldflt = (' if ((PyObject *)py_%(name)s == Py_None)\n' + ' %(name)s = NULL;\n' + ' else if (py_%(name)s && pygobject_check(py_%(name)s, &Py%(type)s_Type))\n' + ' %(name)s = %(cast)s(py_%(name)s->obj);\n' + ' else if (py_%(name)s) {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(type)s or None");\n' + ' return NULL;\n' + ' }\n') + null = (' if (py_%(name)s && pygobject_check(py_%(name)s, &Py%(type)s_Type))\n' + ' %(name)s = %(cast)s(py_%(name)s->obj);\n' + ' else if ((PyObject *)py_%(name)s != Py_None) {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(type)s or None");\n' + ' return NULL;\n' + ' }\n') + dflt = ' if (py_%(name)s)\n' \ + ' %(name)s = %(cast)s(py_%(name)s->obj);\n' + def __init__(self, objname, parent, typecode): + self.objname = objname + self.cast = string.replace(typecode, '_TYPE_', '_', 1) + self.parent = parent + def write_param(self, ptype, pname, pdflt, pnull, info): + if pnull: + if pdflt: + info.varlist.add(self.objname, '*' + pname + ' = ' + pdflt) + info.varlist.add('PyGObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.nulldflt % {'name':pname, + 'cast':self.cast, + 'type':self.objname}) + else: + info.varlist.add(self.objname, '*' + pname + ' = NULL') + info.varlist.add('PyGObject', '*py_' + pname) + info.codebefore.append(self.null % {'name':pname, + 'cast':self.cast, + 'type':self.objname}) + if ptype.endswith('*'): + typename = ptype[:-1] + try: + const, typename = typename.split('const-') + except ValueError: + const = '' + if typename != ptype: + info.arglist.append('(%s *) %s' % (ptype[:-1], pname)) + else: + info.arglist.append(pname) + + info.add_parselist('O', ['&py_' + pname], [pname]) + else: + if pdflt: + info.varlist.add(self.objname, '*' + pname + ' = ' + pdflt) + info.varlist.add('PyGObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.dflt % {'name':pname, + 'cast':self.cast}) + info.arglist.append(pname) + info.add_parselist('O!', ['&Py%s_Type' % self.objname, + '&py_' + pname], [pname]) + else: + info.varlist.add('PyGObject', '*' + pname) + info.arglist.append('%s(%s->obj)' % (self.cast, pname)) + info.add_parselist('O!', ['&Py%s_Type' % self.objname, + '&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + if ptype.endswith('*'): + typename = ptype[:-1] + try: + const, typename = typename.split('const-') + except ValueError: + const = '' + info.varlist.add(typename, '*ret') + if ownsreturn: + info.varlist.add('PyObject', '*py_ret') + info.codeafter.append(' py_ret = pygobject_new((GObject *)ret);\n' + ' if (ret != NULL)\n' + ' g_object_unref(ret);\n' + ' return py_ret;') + else: + info.codeafter.append(' /* pygobject_new handles NULL checking */\n' + + ' return pygobject_new((GObject *)ret);') + +class BoxedArg(ArgType): + # haven't done support for default args. Is it needed? + check = (' if (pyg_boxed_check(py_%(name)s, %(typecode)s))\n' + ' %(name)s = pyg_boxed_get(py_%(name)s, %(typename)s);\n' + ' else {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(typename)s");\n' + ' return NULL;\n' + ' }\n') + null = (' if (pyg_boxed_check(py_%(name)s, %(typecode)s))\n' + ' %(name)s = pyg_boxed_get(py_%(name)s, %(typename)s);\n' + ' else if (py_%(name)s != Py_None) {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(typename)s or None");\n' + ' return NULL;\n' + ' }\n') + def __init__(self, ptype, typecode): + self.typename = ptype + self.typecode = typecode + def write_param(self, ptype, pname, pdflt, pnull, info): + if pnull: + info.varlist.add(self.typename, '*' + pname + ' = NULL') + info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') + info.codebefore.append(self.null % {'name': pname, + 'typename': self.typename, + 'typecode': self.typecode}) + else: + info.varlist.add(self.typename, '*' + pname + ' = NULL') + info.varlist.add('PyObject', '*py_' + pname) + info.codebefore.append(self.check % {'name': pname, + 'typename': self.typename, + 'typecode': self.typecode}) + if ptype[-1] == '*': + typename = ptype[:-1] + if typename[:6] == 'const-': typename = typename[6:] + if typename != self.typename: + info.arglist.append('(%s *)%s' % (ptype[:-1], pname)) + else: + info.arglist.append(pname) + else: + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + ret_tmpl = ' /* pyg_boxed_new handles NULL checking */\n' \ + ' return pyg_boxed_new(%(typecode)s, %(ret)s, %(copy)s, TRUE);' + def write_return(self, ptype, ownsreturn, info): + if ptype[-1] == '*': + decl_type = self.typename + ret = 'ret' + if ptype[:6] == 'const-': + decl_type = 'const ' + self.typename + ret = '(%s*) ret' % (self.typename,) + info.varlist.add(decl_type, '*ret') + else: + info.varlist.add(self.typename, 'ret') + ret = '&ret' + ownsreturn = 0 # of course it can't own a ref to a local var ... + info.codeafter.append(self.ret_tmpl % + { 'typecode': self.typecode, + 'ret': ret, + 'copy': ownsreturn and 'FALSE' or 'TRUE'}) + +class CustomBoxedArg(ArgType): + # haven't done support for default args. Is it needed? + null = (' if (%(check)s(py_%(name)s))\n' + ' %(name)s = %(get)s(py_%(name)s);\n' + ' else if (py_%(name)s != Py_None) {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(type)s or None");\n' + ' return NULL;\n' + ' }\n') + def __init__(self, ptype, pytype, getter, new): + self.pytype = pytype + self.getter = getter + self.checker = 'Py' + ptype + '_Check' + self.new = new + def write_param(self, ptype, pname, pdflt, pnull, info): + if pnull: + info.varlist.add(ptype[:-1], '*' + pname + ' = NULL') + info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') + info.codebefore.append(self.null % {'name': pname, + 'get': self.getter, + 'check': self.checker, + 'type': ptype[:-1]}) + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + else: + info.varlist.add('PyObject', '*' + pname) + info.arglist.append(self.getter + '(' + pname + ')') + info.add_parselist('O!', ['&' + self.pytype, '&' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add(ptype[:-1], '*ret') + info.codeafter.append(' if (ret)\n' + + ' return ' + self.new + '(ret);\n' + + ' Py_INCREF(Py_None);\n' + + ' return Py_None;') + +class PointerArg(ArgType): + # haven't done support for default args. Is it needed? + check = (' if (pyg_pointer_check(py_%(name)s, %(typecode)s))\n' + ' %(name)s = pyg_pointer_get(py_%(name)s, %(typename)s);\n' + ' else {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(typename)s");\n' + ' return NULL;\n' + ' }\n') + null = (' if (pyg_pointer_check(py_%(name)s, %(typecode)s))\n' + ' %(name)s = pyg_pointer_get(py_%(name)s, %(typename)s);\n' + ' else if (py_%(name)s != Py_None) {\n' + ' PyErr_SetString(PyExc_TypeError, "%(name)s should be a %(typename)s or None");\n' + ' return NULL;\n' + ' }\n') + def __init__(self, ptype, typecode): + self.typename = ptype + self.typecode = typecode + def write_param(self, ptype, pname, pdflt, pnull, info): + if pnull: + info.varlist.add(self.typename, '*' + pname + ' = NULL') + info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') + info.codebefore.append(self.null % {'name': pname, + 'typename': self.typename, + 'typecode': self.typecode}) + else: + info.varlist.add(self.typename, '*' + pname + ' = NULL') + info.varlist.add('PyObject', '*py_' + pname) + info.codebefore.append(self.check % {'name': pname, + 'typename': self.typename, + 'typecode': self.typecode}) + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + if ptype[-1] == '*': + info.varlist.add(self.typename, '*ret') + info.codeafter.append(' /* pyg_pointer_new handles NULL checking */\n' + + ' return pyg_pointer_new(' + self.typecode + ', ret);') + else: + info.varlist.add(self.typename, 'ret') + info.codeafter.append(' /* pyg_pointer_new handles NULL checking */\n' + + ' return pyg_pointer_new(' + self.typecode + ', &ret);') + +class AtomArg(IntArg): + dflt = ' if (py_%(name)s) {\n' \ + ' %(name)s = pygdk_atom_from_pyobject(py_%(name)s);\n' \ + ' if (PyErr_Occurred())\n' \ + ' return NULL;\n' \ + ' }\n' + atom = (' %(name)s = pygdk_atom_from_pyobject(py_%(name)s);\n' + ' if (PyErr_Occurred())\n' + ' return NULL;\n') + def write_param(self, ptype, pname, pdflt, pnull, info): + if pdflt: + info.varlist.add('GdkAtom', pname + ' = ' + pdflt) + info.varlist.add('PyObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.dflt % {'name': pname}) + else: + info.varlist.add('GdkAtom', pname) + info.varlist.add('PyObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.atom % {'name': pname}) + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('GdkAtom', 'ret') + info.varlist.add('PyObject *', 'py_ret') + info.varlist.add('gchar *', 'name') + info.codeafter.append(' name = gdk_atom_name(ret);\n' + ' py_ret = PyString_FromString(name);\n' + ' g_free(name);\n' + ' return py_ret;') + +class GTypeArg(ArgType): + gtype = (' if ((%(name)s = pyg_type_from_object(py_%(name)s)) == 0)\n' + ' return NULL;\n') + def write_param(self, ptype, pname, pdflt, pnull, info): + info.varlist.add('GType', pname) + info.varlist.add('PyObject', '*py_' + pname + ' = NULL') + info.codebefore.append(self.gtype % {'name': pname}) + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('GType', 'ret') + info.codeafter.append(' return pyg_type_wrapper_new(ret);') + +# simple GError handler. +class GErrorArg(ArgType): + handleerror = (' if (pyg_error_check(&%(name)s))\n' + ' return NULL;\n') + def write_param(self, ptype, pname, pdflt, pnull, info): + info.varlist.add('GError', '*' + pname + ' = NULL') + info.arglist.append('&' + pname) + info.codeafter.append(self.handleerror % { 'name': pname }) + +class GtkTreePathArg(ArgType): + # haven't done support for default args. Is it needed? + normal = (' %(name)s = pygtk_tree_path_from_pyobject(py_%(name)s);\n' + ' if (!%(name)s) {\n' + ' PyErr_SetString(PyExc_TypeError, "could not convert %(name)s to a GtkTreePath");\n' + ' return NULL;\n' + ' }\n') + null = (' if (py_%(name)s != Py_None) {\n' + ' %(name)s = pygtk_tree_path_from_pyobject(py_%(name)s);\n' + ' if (!%(name)s) {\n' + ' PyErr_SetString(PyExc_TypeError, "could not convert %(name)s to a GtkTreePath");\n' + ' return NULL;\n' + ' }\n' + ' }\n') + freepath = (' if (%(name)s)\n' + ' gtk_tree_path_free(%(name)s);\n') + def __init__(self): + pass + def write_param(self, ptype, pname, pdflt, pnull, info): + if pnull: + info.varlist.add('GtkTreePath', '*' + pname + ' = NULL') + info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') + info.codebefore.append(self.null % {'name': pname}) + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + else: + info.varlist.add('GtkTreePath', '*' + pname) + info.varlist.add('PyObject', '*py_' + pname) + info.codebefore.append(self.normal % {'name': pname}) + info.arglist.append(pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + info.codeafter.append(self.freepath % {'name': pname}) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('GtkTreePath', '*ret') + if ownsreturn: + info.codeafter.append(' if (ret) {\n' + ' PyObject *py_ret = pygtk_tree_path_to_pyobject(ret);\n' + ' gtk_tree_path_free(ret);\n' + ' return py_ret;\n' + ' }\n' + ' Py_INCREF(Py_None);\n' + ' return Py_None;') + else: + info.codeafter.append(' if (ret) {\n' + ' PyObject *py_ret = pygtk_tree_path_to_pyobject(ret);\n' + ' return py_ret;\n' + ' }\n' + ' Py_INCREF(Py_None);\n' + ' return Py_None;') + +class GdkRectanglePtrArg(ArgType): + normal = (' if (!pygdk_rectangle_from_pyobject(py_%(name)s, &%(name)s))\n' + ' return NULL;\n') + null = (' if (py_%(name)s == Py_None)\n' + ' %(name)s = NULL;\n' + ' else if (pygdk_rectangle_from_pyobject(py_%(name)s, &%(name)s_rect))\n' + ' %(name)s = &%(name)s_rect;\n' + ' else\n' + ' return NULL;\n') + def write_param(self, ptype, pname, pdflt, pnull, info): + if pnull: + info.varlist.add('GdkRectangle', pname + '_rect = { 0, 0, 0, 0 }') + info.varlist.add('GdkRectangle', '*' + pname) + info.varlist.add('PyObject', '*py_' + pname + ' = Py_None') + info.add_parselist('O', ['&py_' + pname], [pname]) + info.arglist.append(pname) + info.codebefore.append(self.null % {'name': pname}) + else: + info.varlist.add('GdkRectangle', pname + ' = { 0, 0, 0, 0 }') + info.varlist.add('PyObject', '*py_' + pname) + info.add_parselist('O', ['&py_' + pname], [pname]) + info.arglist.append('&' + pname) + info.codebefore.append(self.normal % {'name': pname}) + +class GdkRectangleArg(ArgType): + def write_return(self, ptype, ownsreturn, info): + info.varlist.add('GdkRectangle', 'ret') + info.codeafter.append(' return pyg_boxed_new(GDK_TYPE_RECTANGLE, &ret, TRUE, TRUE);') + +class PyObjectArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + info.varlist.add('PyObject', '*' + pname) + info.add_parselist('O', ['&' + pname], [pname]) + info.arglist.append(pname) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add("PyObject", "*ret") + if ownsreturn: + info.codeafter.append(' if (ret) {\n' + ' return ret;\n' + ' }\n' + ' Py_INCREF(Py_None);\n' + ' return Py_None;') + else: + info.codeafter.append(' if (!ret) ret = Py_None;\n' + ' Py_INCREF(ret);\n' + ' return ret;') + +class CairoArg(ArgType): + def write_param(self, ptype, pname, pdflt, pnull, info): + info.varlist.add('PycairoContext', '*' + pname) + info.add_parselist('O!', ['&PycairoContext_Type', '&' + pname], [pname]) + info.arglist.append('%s->ctx' % pname) + def write_return(self, ptype, ownsreturn, info): + info.varlist.add("cairo_t", "*ret") + if ownsreturn: + info.codeafter.append(' return PycairoContext_FromContext(ret, NULL, NULL);') + else: + info.codeafter.append(' cairo_reference(ret);\n' + ' return PycairoContext_FromContext(ret, NULL, NULL);') + + +class ArgMatcher: + def __init__(self): + self.argtypes = {} + self.reverse_argtypes = {} + self.reverse_rettypes = {} + + def register(self, ptype, handler, overwrite=False): + if not overwrite and ptype in self.argtypes: + return + self.argtypes[ptype] = handler + def register_reverse(self, ptype, handler): + self.reverse_argtypes[ptype] = handler + def register_reverse_ret(self, ptype, handler): + self.reverse_rettypes[ptype] = handler + + def register_enum(self, ptype, typecode): + if typecode is None: + self.register(ptype, IntArg()) + else: + self.register(ptype, EnumArg(ptype, typecode)) + def register_flag(self, ptype, typecode): + if typecode is None: + self.register(ptype, IntArg()) + else: + self.register(ptype, FlagsArg(ptype, typecode)) + def register_object(self, ptype, parent, typecode): + oa = ObjectArg(ptype, parent, typecode) + self.register(ptype, oa) # in case I forget the * in the .defs + self.register(ptype+'*', oa) + self.register('const-'+ptype+'*', oa) + if ptype == 'GdkPixmap': + # hack to handle GdkBitmap synonym. + self.register('GdkBitmap', oa) + self.register('GdkBitmap*', oa) + def register_boxed(self, ptype, typecode): + if self.argtypes.has_key(ptype): return + arg = BoxedArg(ptype, typecode) + self.register(ptype, arg) + self.register(ptype+'*', arg) + self.register('const-'+ptype+'*', arg) + def register_custom_boxed(self, ptype, pytype, getter, new): + arg = CustomBoxedArg(ptype, pytype, getter, new) + self.register(ptype+'*', arg) + self.register('const-'+ptype+'*', arg) + def register_pointer(self, ptype, typecode): + arg = PointerArg(ptype, typecode) + self.register(ptype, arg) + self.register(ptype+'*', arg) + self.register('const-'+ptype+'*', arg) + + def get(self, ptype): + try: + return self.argtypes[ptype] + except KeyError: + if ptype[:8] == 'GdkEvent' and ptype[-1] == '*': + return self.argtypes['GdkEvent*'] + raise ArgTypeNotFoundError("No ArgType for %s" % (ptype,)) + def _get_reverse_common(self, ptype, registry): + props = dict(c_type=ptype) + try: + return registry[ptype], props + except KeyError: + try: + handler = self.argtypes[ptype] + except KeyError: + if ptype.startswith('GdkEvent') and ptype.endswith('*'): + handler = self.argtypes['GdkEvent*'] + else: + raise ArgTypeNotFoundError("No ArgType for %s" % (ptype,)) + if isinstance(handler, ObjectArg): + return registry['GObject*'], props + elif isinstance(handler, EnumArg): + props['typecode'] = handler.typecode + props['enumname'] = handler.enumname + return registry['GEnum'], props + elif isinstance(handler, FlagsArg): + props['typecode'] = handler.typecode + props['flagname'] = handler.flagname + return registry['GFlags'], props + elif isinstance(handler, BoxedArg): + props['typecode'] = handler.typecode + props['typename'] = handler.typename + return registry['GBoxed'], props + else: + raise ArgTypeNotFoundError("No ArgType for %s" % (ptype,)) + + def get_reverse(self, ptype): + return self._get_reverse_common(ptype, self.reverse_argtypes) + + def get_reverse_ret(self, ptype): + ret, props = self._get_reverse_common(ptype, self.reverse_rettypes) + if hasattr(ptype, 'optional') and ptype.optional: + if ret.supports_optional: + props['optional'] = True + else: + raise ArgTypeNotFoundError("Unsupported 'optional' for %s" + % (ptype,)) + return ret, props + + def object_is_a(self, otype, parent): + if otype == None: return 0 + if otype == parent: return 1 + if not self.argtypes.has_key(otype): return 0 + return self.object_is_a(self.get(otype).parent, parent) + +matcher = ArgMatcher() + +arg = NoneArg() +matcher.register(None, arg) +matcher.register('none', arg) + +arg = StringArg() +matcher.register('char*', arg) +matcher.register('gchar*', arg) +matcher.register('const-char*', arg) +matcher.register('char-const*', arg) +matcher.register('const-gchar*', arg) +matcher.register('gchar-const*', arg) +matcher.register('string', arg) +matcher.register('static_string', arg) + +arg = UCharArg() +matcher.register('unsigned-char*', arg) +matcher.register('const-guchar*', arg) +matcher.register('const-guint8*', arg) +matcher.register('guchar*', arg) + +arg = CharArg() +matcher.register('char', arg) +matcher.register('gchar', arg) +matcher.register('guchar', arg) + +arg = GUniCharArg() +matcher.register('gunichar', arg) + +arg = IntArg() +matcher.register('int', arg) +matcher.register('gint', arg) +matcher.register('short', arg) +matcher.register('gshort', arg) +matcher.register('gushort', arg) +matcher.register('gsize', SizeArg()) +matcher.register('gssize', SSizeArg()) +matcher.register('guint8', arg) +matcher.register('gint8', arg) +matcher.register('guint16', arg) +matcher.register('gint16', arg) +matcher.register('gint32', arg) +matcher.register('GTime', arg) +matcher.register('GSeekType', arg) # Hack, but we have no python wrapper + +arg = LongArg() +matcher.register('long', arg) +matcher.register('glong', arg) + +arg = UIntArg() +matcher.register('guint', arg) + +arg = BoolArg() +matcher.register('gboolean', arg) + +arg = TimeTArg() +matcher.register('time_t', arg) + +matcher.register('guint32', UInt32Arg()) + +arg = ULongArg() +matcher.register('gulong', arg) + +arg = Int64Arg() +matcher.register('gint64', arg) +matcher.register('long-long', arg) +matcher.register('goffset', arg) + +arg = UInt64Arg() +matcher.register('guint64', arg) +matcher.register('unsigned-long-long', arg) + +arg = DoubleArg() +matcher.register('double', arg) +matcher.register('gdouble', arg) +matcher.register('float', arg) +matcher.register('gfloat', arg) + +arg = FileArg() +matcher.register('FILE*', arg) + +# enums, flags, objects + +matcher.register('GdkAtom', AtomArg()) + +matcher.register('GType', GTypeArg()) +matcher.register('GtkType', GTypeArg()) + +matcher.register('GError**', GErrorArg()) +matcher.register('GtkTreePath*', GtkTreePathArg()) +matcher.register('GdkRectangle*', GdkRectanglePtrArg()) +matcher.register('GtkAllocation*', GdkRectanglePtrArg()) +matcher.register('GdkRectangle', GdkRectangleArg()) +matcher.register('PyObject*', PyObjectArg()) + +matcher.register('GdkNativeWindow', ULongArg()) + +matcher.register_object('GObject', None, 'G_TYPE_OBJECT') + +del arg + +matcher.register('cairo_t*', CairoArg()) +matcher.register_boxed("GClosure", "G_TYPE_CLOSURE") diff --git a/codegen/code-coverage.py b/codegen/code-coverage.py new file mode 100755 index 0000000..1dc54c3 --- /dev/null +++ b/codegen/code-coverage.py @@ -0,0 +1,44 @@ +#! /usr/bin/env python + +from __future__ import generators +import sys, os + +def read_symbols(file, type=None, dynamic=0): + if dynamic: + cmd = 'nm -D %s' % file + else: + cmd = 'nm %s' % file + for line in os.popen(cmd, 'r'): + if line[0] != ' ': # has an address as first bit of line + while line[0] != ' ': + line = line[1:] + while line[0] == ' ': + line = line[1:] + # we should be up to "type symbolname" now + sym_type = line[0] + symbol = line[1:].strip() + + if not type or type == sym_type: + yield symbol + +def main(): + if len(sys.argv) != 3: + sys.stderr.write('usage: coverage-check library.so wrapper.so\n') + sys.exit(1) + library = sys.argv[1] + wrapper = sys.argv[2] + + # first create a dict with all referenced symbols in the wrapper + # should really be a set, but a dict will do ... + wrapper_symbols = {} + for symbol in read_symbols(wrapper, type='U', dynamic=1): + wrapper_symbols[symbol] = 1 + + # now go through the library looking for matches on the defined symbols: + for symbol in read_symbols(library, type='T', dynamic=1): + if symbol[0] == '_': continue + if symbol not in wrapper_symbols: + print symbol + +if __name__ == '__main__': + main() diff --git a/codegen/codegen.py b/codegen/codegen.py new file mode 100755 index 0000000..008f01c --- /dev/null +++ b/codegen/codegen.py @@ -0,0 +1,1722 @@ +#! /usr/bin/env python + +import getopt +import keyword +import os +import string +import sys + +import argtypes +import definitions +import defsparser +import override +import reversewrapper +import warnings + +class Coverage(object): + def __init__(self, name): + self.name = name + self.wrapped = 0 + self.not_wrapped = 0 + + def declare_wrapped(self): + self.wrapped += 1 + + def declare_not_wrapped(self): + self.not_wrapped += 1 + + def printstats(self): + total = self.wrapped + self.not_wrapped + fd = sys.stderr + if total: + fd.write("***INFO*** The coverage of %s is %.2f%% (%i/%i)\n" % + (self.name, + float(self.wrapped*100)/total, + self.wrapped, + total)) + else: + fd.write("***INFO*** There are no declared %s.\n" % self.name) + +functions_coverage = Coverage("global functions") +methods_coverage = Coverage("methods") +vproxies_coverage = Coverage("virtual proxies") +vaccessors_coverage = Coverage("virtual accessors") +iproxies_coverage = Coverage("interface proxies") + +def exc_info(): + warnings.warn("deprecated", DeprecationWarning, stacklevel=2) + #traceback.print_exc() + etype, value, tb = sys.exc_info() + ret = "" + try: + sval = str(value) + if etype == argtypes.ArgTypeError: + ret = "No ArgType for %s" % (sval,) + else: + ret = sval + finally: + del etype, value, tb + return ret + +def fixname(name): + if keyword.iskeyword(name): + return name + '_' + return name + +class FileOutput: + '''Simple wrapper for file object, that makes writing #line + statements easier.''' # " + def __init__(self, fp, filename=None): + self.fp = fp + self.lineno = 1 + if filename: + self.filename = filename + else: + self.filename = self.fp.name + # handle writing to the file, and keep track of the line number ... + def write(self, str): + self.fp.write(str) + self.lineno = self.lineno + string.count(str, '\n') + def writelines(self, sequence): + for line in sequence: + self.write(line) + def close(self): + self.fp.close() + def flush(self): + self.fp.flush() + + def setline(self, linenum, filename): + '''writes out a #line statement, for use by the C + preprocessor.''' # " + self.write('#line %d "%s"\n' % (linenum, filename)) + def resetline(self): + '''resets line numbering to the original file''' + self.setline(self.lineno + 1, self.filename) + +class Wrapper: + type_tmpl = ( + 'PyTypeObject G_GNUC_INTERNAL Py%(typename)s_Type = {\n' + ' PyObject_HEAD_INIT(NULL)\n' + ' 0, /* ob_size */\n' + ' "%(classname)s", /* tp_name */\n' + ' sizeof(%(tp_basicsize)s), /* tp_basicsize */\n' + ' 0, /* tp_itemsize */\n' + ' /* methods */\n' + ' (destructor)%(tp_dealloc)s, /* tp_dealloc */\n' + ' (printfunc)0, /* tp_print */\n' + ' (getattrfunc)%(tp_getattr)s, /* tp_getattr */\n' + ' (setattrfunc)%(tp_setattr)s, /* tp_setattr */\n' + ' (cmpfunc)%(tp_compare)s, /* tp_compare */\n' + ' (reprfunc)%(tp_repr)s, /* tp_repr */\n' + ' (PyNumberMethods*)%(tp_as_number)s, /* tp_as_number */\n' + ' (PySequenceMethods*)%(tp_as_sequence)s, /* tp_as_sequence */\n' + ' (PyMappingMethods*)%(tp_as_mapping)s, /* tp_as_mapping */\n' + ' (hashfunc)%(tp_hash)s, /* tp_hash */\n' + ' (ternaryfunc)%(tp_call)s, /* tp_call */\n' + ' (reprfunc)%(tp_str)s, /* tp_str */\n' + ' (getattrofunc)%(tp_getattro)s, /* tp_getattro */\n' + ' (setattrofunc)%(tp_setattro)s, /* tp_setattro */\n' + ' (PyBufferProcs*)%(tp_as_buffer)s, /* tp_as_buffer */\n' + ' %(tp_flags)s, /* tp_flags */\n' + ' %(tp_doc)s, /* Documentation string */\n' + ' (traverseproc)%(tp_traverse)s, /* tp_traverse */\n' + ' (inquiry)%(tp_clear)s, /* tp_clear */\n' + ' (richcmpfunc)%(tp_richcompare)s, /* tp_richcompare */\n' + ' %(tp_weaklistoffset)s, /* tp_weaklistoffset */\n' + ' (getiterfunc)%(tp_iter)s, /* tp_iter */\n' + ' (iternextfunc)%(tp_iternext)s, /* tp_iternext */\n' + ' (struct PyMethodDef*)%(tp_methods)s, /* tp_methods */\n' + ' (struct PyMemberDef*)0, /* tp_members */\n' + ' (struct PyGetSetDef*)%(tp_getset)s, /* tp_getset */\n' + ' NULL, /* tp_base */\n' + ' NULL, /* tp_dict */\n' + ' (descrgetfunc)%(tp_descr_get)s, /* tp_descr_get */\n' + ' (descrsetfunc)%(tp_descr_set)s, /* tp_descr_set */\n' + ' %(tp_dictoffset)s, /* tp_dictoffset */\n' + ' (initproc)%(tp_init)s, /* tp_init */\n' + ' (allocfunc)%(tp_alloc)s, /* tp_alloc */\n' + ' (newfunc)%(tp_new)s, /* tp_new */\n' + ' (freefunc)%(tp_free)s, /* tp_free */\n' + ' (inquiry)%(tp_is_gc)s /* tp_is_gc */\n' + '};\n\n' + ) + + slots_list = [ + 'tp_getattr', 'tp_setattr', 'tp_getattro', 'tp_setattro', + 'tp_compare', 'tp_repr', + 'tp_as_number', 'tp_as_sequence', 'tp_as_mapping', 'tp_hash', + 'tp_call', 'tp_str', 'tp_as_buffer', 'tp_richcompare', 'tp_iter', + 'tp_iternext', 'tp_descr_get', 'tp_descr_set', 'tp_init', + 'tp_alloc', 'tp_new', 'tp_free', 'tp_is_gc', + 'tp_traverse', 'tp_clear', 'tp_dealloc', 'tp_flags', 'tp_doc' + ] + + getter_tmpl = ( + 'static PyObject *\n' + '%(funcname)s(PyObject *self, void *closure)\n' + '{\n' + '%(varlist)s' + ' ret = %(field)s;\n' + '%(codeafter)s\n' + '}\n\n' + ) + + parse_tmpl = ( + ' if (!PyArg_ParseTupleAndKeywords(args, kwargs,' + '"%(typecodes)s:%(name)s"%(parselist)s))\n' + ' return %(errorreturn)s;\n' + ) + + deprecated_tmpl = ( + ' if (PyErr_Warn(PyExc_DeprecationWarning, ' + '"%(deprecationmsg)s") < 0)\n' + ' return %(errorreturn)s;\n' + ) + + methdef_tmpl = ( + ' { "%(name)s", (PyCFunction)%(cname)s, %(flags)s,\n' + ' %(docstring)s },\n' + ) + + noconstructor = ( + 'static int\n' + 'pygobject_no_constructor(PyObject *self, PyObject *args, ' + 'PyObject *kwargs)\n' + '{\n' + ' gchar buf[512];\n' + '\n' + ' g_snprintf(buf, sizeof(buf), "%s is an abstract widget", ' + 'self->ob_type->tp_name);\n' + ' PyErr_SetString(PyExc_NotImplementedError, buf);\n' + ' return -1;\n' + '}\n\n' + ) + + function_tmpl = ( + 'static PyObject *\n' + '_wrap_%(cname)s(PyObject *self%(extraparams)s)\n' + '{\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' %(begin_allow_threads)s\n' + ' %(setreturn)s%(cname)s(%(arglist)s);\n' + ' %(end_allow_threads)s\n' + '%(codeafter)s\n' + '}\n\n' + ) + + virtual_accessor_tmpl = ( + 'static PyObject *\n' + '_wrap_%(cname)s(PyObject *cls%(extraparams)s)\n' + '{\n' + ' gpointer klass;\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' klass = g_type_class_ref(pyg_type_from_object(cls));\n' + ' if (%(class_cast_macro)s(klass)->%(virtual)s)\n' + ' %(setreturn)s%(class_cast_macro)s(klass)->' + '%(virtual)s(%(arglist)s);\n' + ' else {\n' + ' PyErr_SetString(PyExc_NotImplementedError, ' + '"virtual method %(name)s not implemented");\n' + ' g_type_class_unref(klass);\n' + ' return NULL;\n' + ' }\n' + ' g_type_class_unref(klass);\n' + '%(codeafter)s\n' + '}\n\n' + ) + + # template for method calls + constructor_tmpl = None + method_tmpl = None + + def __init__(self, parser, objinfo, overrides, fp=FileOutput(sys.stdout)): + self.parser = parser + self.objinfo = objinfo + self.overrides = overrides + self.fp = fp + + def get_lower_name(self): + return string.lower(string.replace(self.objinfo.typecode, + '_TYPE_', '_', 1)) + + def get_field_accessor(self, fieldname): + raise NotImplementedError + + def get_initial_class_substdict(self): return {} + + def get_initial_constructor_substdict(self, constructor): + return { 'name': '%s.__init__' % self.objinfo.py_name, + 'errorreturn': '-1' } + + def get_initial_method_substdict(self, method): + substdict = { 'name': '%s.%s' % (self.objinfo.py_name, method.name) } + if method.unblock_threads: + substdict['begin_allow_threads'] = 'pyg_begin_allow_threads;' + substdict['end_allow_threads'] = 'pyg_end_allow_threads;' + else: + substdict['begin_allow_threads'] = '' + substdict['end_allow_threads'] = '' + return substdict + + def write_class(self): + if self.overrides.is_type_ignored(self.objinfo.c_name): + return + self.fp.write('\n/* ----------- %s ----------- */\n\n' % + self.objinfo.c_name) + substdict = self.get_initial_class_substdict() + if not substdict.has_key('tp_flags'): + substdict['tp_flags'] = 'Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE' + substdict['typename'] = self.objinfo.c_name + if self.overrides.modulename: + substdict['classname'] = '%s.%s' % (self.overrides.modulename, + self.objinfo.name) + else: + substdict['classname'] = self.objinfo.name + substdict['tp_doc'] = self.objinfo.docstring + + # Maybe this could be done in a nicer way, but I'll leave it as it is + # for now: -- Johan + if not self.overrides.slot_is_overriden('%s.tp_init' % + self.objinfo.c_name): + substdict['tp_init'] = self.write_constructor() + substdict['tp_methods'] = self.write_methods() + substdict['tp_getset'] = self.write_getsets() + + # handle slots ... + for slot in self.slots_list: + + slotname = '%s.%s' % (self.objinfo.c_name, slot) + slotfunc = '_wrap_%s_%s' % (self.get_lower_name(), slot) + if slot[:6] == 'tp_as_': + slotfunc = '&' + slotfunc + if self.overrides.slot_is_overriden(slotname): + data = self.overrides.slot_override(slotname) + self.write_function(slotname, data) + substdict[slot] = slotfunc + else: + if not substdict.has_key(slot): + substdict[slot] = '0' + + self.fp.write(self.type_tmpl % substdict) + + self.write_virtuals() + + def write_function_wrapper(self, function_obj, template, + handle_return=0, is_method=0, kwargs_needed=0, + substdict=None): + '''This function is the guts of all functions that generate + wrappers for functions, methods and constructors.''' + if not substdict: substdict = {} + + info = argtypes.WrapperInfo() + + substdict.setdefault('errorreturn', 'NULL') + + # for methods, we want the leading comma + if is_method: + info.arglist.append('') + + if function_obj.varargs: + raise argtypes.ArgTypeNotFoundError("varargs functions not supported") + + for param in function_obj.params: + if param.pdflt != None and '|' not in info.parsestr: + info.add_parselist('|', [], []) + handler = argtypes.matcher.get(param.ptype) + handler.write_param(param.ptype, param.pname, param.pdflt, + param.pnull, info) + + substdict['setreturn'] = '' + if handle_return: + if function_obj.ret not in ('none', None): + substdict['setreturn'] = 'ret = ' + handler = argtypes.matcher.get(function_obj.ret) + handler.write_return(function_obj.ret, + function_obj.caller_owns_return, info) + + if function_obj.deprecated != None: + deprecated = self.deprecated_tmpl % { + 'deprecationmsg': function_obj.deprecated, + 'errorreturn': substdict['errorreturn'] } + else: + deprecated = '' + + # if name isn't set, set it to function_obj.name + substdict.setdefault('name', function_obj.name) + + if function_obj.unblock_threads: + substdict['begin_allow_threads'] = 'pyg_begin_allow_threads;' + substdict['end_allow_threads'] = 'pyg_end_allow_threads;' + else: + substdict['begin_allow_threads'] = '' + substdict['end_allow_threads'] = '' + + if self.objinfo: + substdict['typename'] = self.objinfo.c_name + substdict.setdefault('cname', function_obj.c_name) + substdict['varlist'] = info.get_varlist() + substdict['typecodes'] = info.parsestr + substdict['parselist'] = info.get_parselist() + substdict['arglist'] = info.get_arglist() + substdict['codebefore'] = deprecated + ( + string.replace(info.get_codebefore(), + 'return NULL', 'return ' + substdict['errorreturn']) + ) + substdict['codeafter'] = ( + string.replace(info.get_codeafter(), + 'return NULL', + 'return ' + substdict['errorreturn'])) + + if info.parsestr or kwargs_needed: + substdict['parseargs'] = self.parse_tmpl % substdict + substdict['extraparams'] = ', PyObject *args, PyObject *kwargs' + flags = 'METH_VARARGS|METH_KEYWORDS' + + # prepend the keyword list to the variable list + substdict['varlist'] = info.get_kwlist() + substdict['varlist'] + else: + substdict['parseargs'] = '' + substdict['extraparams'] = '' + flags = 'METH_NOARGS' + + return template % substdict, flags + + def write_constructor(self): + initfunc = '0' + constructor = self.parser.find_constructor(self.objinfo,self.overrides) + if not constructor: + return self.write_default_constructor() + + funcname = constructor.c_name + try: + if self.overrides.is_overriden(funcname): + data = self.overrides.override(funcname) + self.write_function(funcname, data) + self.objinfo.has_new_constructor_api = ( + self.objinfo.typecode in + self.overrides.newstyle_constructors) + else: + # ok, a hack to determine if we should use + # new-style constructores :P + property_based = getattr(self, + 'write_property_based_constructor', + None) + if property_based: + if (len(constructor.params) == 0 or + isinstance(constructor.params[0], + definitions.Property)): + # write_property_based_constructor is only + # implemented in GObjectWrapper + return self.write_property_based_constructor( + constructor) + else: + sys.stderr.write( + "Warning: generating old-style constructor for:" + + constructor.c_name + '\n') + + # write constructor from template ... + code = self.write_function_wrapper(constructor, + self.constructor_tmpl, + handle_return=0, is_method=0, kwargs_needed=1, + substdict=self.get_initial_constructor_substdict( + constructor))[0] + self.fp.write(code) + initfunc = '_wrap_' + funcname + except argtypes.ArgTypeError, ex: + sys.stderr.write('Could not write constructor for %s: %s\n' + % (self.objinfo.c_name, str(ex))) + + initfunc = self.write_noconstructor() + return initfunc + + def write_noconstructor(self): + # this is a hack ... + if not hasattr(self.overrides, 'no_constructor_written'): + self.fp.write(self.noconstructor) + self.overrides.no_constructor_written = 1 + initfunc = 'pygobject_no_constructor' + return initfunc + + def write_default_constructor(self): + return self.write_noconstructor() + + def get_methflags(self, funcname): + if self.overrides.wants_kwargs(funcname): + flags = 'METH_VARARGS|METH_KEYWORDS' + elif self.overrides.wants_noargs(funcname): + flags = 'METH_NOARGS' + elif self.overrides.wants_onearg(funcname): + flags = 'METH_O' + else: + flags = 'METH_VARARGS' + if self.overrides.is_staticmethod(funcname): + flags += '|METH_STATIC' + elif self.overrides.is_classmethod(funcname): + flags += '|METH_CLASS' + return flags + + def write_function(self, funcname, data): + lineno, filename = self.overrides.getstartline(funcname) + self.fp.setline(lineno, filename) + self.fp.write(data) + self.fp.resetline() + self.fp.write('\n\n') + + def _get_class_virtual_substdict(self, meth, cname, parent): + substdict = self.get_initial_method_substdict(meth) + substdict['virtual'] = meth.name + substdict['cname'] = cname + substdict['class_cast_macro'] = parent.typecode.replace( + '_TYPE_', '_', 1) + "_CLASS" + substdict['typecode'] = self.objinfo.typecode + substdict['cast'] = string.replace(parent.typecode, '_TYPE_', '_', 1) + return substdict + + def write_methods(self): + methods = [] + klass = self.objinfo.c_name + # First, get methods from the defs files + for meth in self.parser.find_methods(self.objinfo): + method_name = meth.c_name + if self.overrides.is_ignored(method_name): + continue + try: + if self.overrides.is_overriden(method_name): + if not self.overrides.is_already_included(method_name): + data = self.overrides.override(method_name) + self.write_function(method_name, data) + + methflags = self.get_methflags(method_name) + else: + # write constructor from template ... + code, methflags = self.write_function_wrapper(meth, + self.method_tmpl, handle_return=1, is_method=1, + substdict=self.get_initial_method_substdict(meth)) + self.fp.write(code) + methods.append(self.methdef_tmpl % + { 'name': fixname(meth.name), + 'cname': '_wrap_' + method_name, + 'flags': methflags, + 'docstring': meth.docstring }) + methods_coverage.declare_wrapped() + except argtypes.ArgTypeError, ex: + methods_coverage.declare_not_wrapped() + sys.stderr.write('Could not write method %s.%s: %s\n' + % (klass, meth.name, str(ex))) + + # Now try to see if there are any defined in the override + for method_name in self.overrides.get_defines_for(klass): + c_name = override.class2cname(klass, method_name) + if self.overrides.is_already_included(method_name): + continue + + try: + data = self.overrides.define(klass, method_name) + self.write_function(method_name, data) + methflags = self.get_methflags(method_name) + + methods.append(self.methdef_tmpl % + { 'name': method_name, + 'cname': '_wrap_' + c_name, + 'flags': methflags, + 'docstring': 'NULL' }) + methods_coverage.declare_wrapped() + except argtypes.ArgTypeError, ex: + methods_coverage.declare_not_wrapped() + sys.stderr.write('Could not write method %s.%s: %s\n' + % (klass, method_name, str(ex))) + + # Add GObject virtual method accessors, for chaining to parent + # virtuals from subclasses + methods += self.write_virtual_accessors() + + if methods: + methoddefs = '_Py%s_methods' % self.objinfo.c_name + # write the PyMethodDef structure + methods.append(' { NULL, NULL, 0, NULL }\n') + self.fp.write('static const PyMethodDef %s[] = {\n' % methoddefs) + self.fp.write(string.join(methods, '')) + self.fp.write('};\n\n') + else: + methoddefs = 'NULL' + return methoddefs + + def write_virtual_accessors(self): + klass = self.objinfo.c_name + methods = [] + for meth in self.parser.find_virtuals(self.objinfo): + method_name = self.objinfo.c_name + "__do_" + meth.name + if self.overrides.is_ignored(method_name): + continue + try: + if self.overrides.is_overriden(method_name): + if not self.overrides.is_already_included(method_name): + data = self.overrides.override(method_name) + self.write_function(method_name, data) + methflags = self.get_methflags(method_name) + else: + # temporarily add a 'self' parameter as first argument + meth.params.insert(0, definitions.Parameter( + ptype=(self.objinfo.c_name + '*'), + pname='self', pdflt=None, pnull=None)) + try: + # write method from template ... + code, methflags = self.write_function_wrapper( + meth, self.virtual_accessor_tmpl, + handle_return=True, is_method=False, + substdict=self._get_class_virtual_substdict( + meth, method_name, self.objinfo)) + self.fp.write(code) + finally: + del meth.params[0] + methods.append(self.methdef_tmpl % + { 'name': "do_" + fixname(meth.name), + 'cname': '_wrap_' + method_name, + 'flags': methflags + '|METH_CLASS', + 'docstring': 'NULL'}) + vaccessors_coverage.declare_wrapped() + except argtypes.ArgTypeError, ex: + vaccessors_coverage.declare_not_wrapped() + sys.stderr.write( + 'Could not write virtual accessor method %s.%s: %s\n' + % (klass, meth.name, str(ex))) + return methods + + def write_virtuals(self): + ''' + Write _wrap_FooBar__proxy_do_zbr() reverse wrapers for + GObject virtuals + ''' + klass = self.objinfo.c_name + virtuals = [] + for meth in self.parser.find_virtuals(self.objinfo): + method_name = self.objinfo.c_name + "__proxy_do_" + meth.name + if self.overrides.is_ignored(method_name): + continue + try: + if self.overrides.is_overriden(method_name): + if not self.overrides.is_already_included(method_name): + data = self.overrides.override(method_name) + self.write_function(method_name, data) + else: + # write virtual proxy ... + ret, props = argtypes.matcher.get_reverse_ret(meth.ret) + wrapper = reversewrapper.ReverseWrapper( + '_wrap_' + method_name, is_static=True) + wrapper.set_return_type(ret(wrapper, **props)) + wrapper.add_parameter(reversewrapper.PyGObjectMethodParam( + wrapper, "self", method_name="do_" + meth.name, + c_type=(klass + ' *'))) + for param in meth.params: + handler, props = argtypes.matcher.get_reverse( + param.ptype) + props["direction"] = param.pdir + props["nullok"] = param.pnull + wrapper.add_parameter(handler(wrapper, + param.pname, **props)) + buf = reversewrapper.MemoryCodeSink() + wrapper.generate(buf) + self.fp.write(buf.flush()) + virtuals.append((fixname(meth.name), '_wrap_' + method_name)) + vproxies_coverage.declare_wrapped() + except argtypes.ArgTypeError, ex: + vproxies_coverage.declare_not_wrapped() + virtuals.append((fixname(meth.name), None)) + sys.stderr.write('Could not write virtual proxy %s.%s: %s\n' + % (klass, meth.name, str(ex))) + if virtuals: + # Write a 'pygtk class init' function for this object, + # except when the object type is explicitly ignored (like + # GtkPlug and GtkSocket on win32). + if self.overrides.is_ignored(self.objinfo.typecode): + return + class_cast_macro = self.objinfo.typecode.replace( + '_TYPE_', '_', 1) + "_CLASS" + cast_macro = self.objinfo.typecode.replace('_TYPE_', '_', 1) + funcname = "__%s_class_init" % klass + self.objinfo.class_init_func = funcname + have_implemented_virtuals = not not [True + for name, cname in virtuals + if cname is not None] + self.fp.write( + ('\nstatic int\n' + '%(funcname)s(gpointer gclass, PyTypeObject *pyclass)\n' + '{\n') % vars()) + + if have_implemented_virtuals: + self.fp.write(' PyObject *o;\n') + self.fp.write( + ' %(klass)sClass *klass = ' + '%(class_cast_macro)s(gclass);\n' + ' PyObject *gsignals = ' + 'PyDict_GetItemString(pyclass->tp_dict, "__gsignals__");\n' + % vars()) + + for name, cname in virtuals: + do_name = 'do_' + name + if cname is None: + self.fp.write('\n /* overriding %(do_name)s ' + 'is currently not supported */\n' % vars()) + else: + self.fp.write(''' + o = PyObject_GetAttrString((PyObject *) pyclass, "%(do_name)s"); + if (o == NULL) + PyErr_Clear(); + else { + if (!PyObject_TypeCheck(o, &PyCFunction_Type) + && !(gsignals && PyDict_GetItemString(gsignals, "%(name)s"))) + klass->%(name)s = %(cname)s; + Py_DECREF(o); + } +''' % vars()) + self.fp.write(' return 0;\n}\n') + + def write_getsets(self): + lower_name = self.get_lower_name() + getsets_name = lower_name + '_getsets' + getterprefix = '_wrap_' + lower_name + '__get_' + setterprefix = '_wrap_' + lower_name + '__set_' + + # no overrides for the whole function. If no fields, + # don't write a func + if not self.objinfo.fields: + return '0' + getsets = [] + for ftype, cfname in self.objinfo.fields: + fname = cfname.replace('.', '_') + gettername = '0' + settername = '0' + attrname = self.objinfo.c_name + '.' + fname + if self.overrides.attr_is_overriden(attrname): + code = self.overrides.attr_override(attrname) + self.write_function(attrname, code) + if string.find(code, getterprefix + fname) >= 0: + gettername = getterprefix + fname + if string.find(code, setterprefix + fname) >= 0: + settername = setterprefix + fname + if gettername == '0': + try: + funcname = getterprefix + fname + info = argtypes.WrapperInfo() + handler = argtypes.matcher.get(ftype) + # for attributes, we don't own the "return value" + handler.write_return(ftype, 0, info) + self.fp.write(self.getter_tmpl % + { 'funcname': funcname, + 'varlist': info.varlist, + 'field': self.get_field_accessor(cfname), + 'codeafter': info.get_codeafter() }) + gettername = funcname + except argtypes.ArgTypeError, ex: + sys.stderr.write( + "Could not write getter for %s.%s: %s\n" + % (self.objinfo.c_name, fname, str(ex))) + if gettername != '0' or settername != '0': + getsets.append(' { "%s", (getter)%s, (setter)%s },\n' % + (fixname(fname), gettername, settername)) + + if not getsets: + return '0' + self.fp.write('static const PyGetSetDef %s[] = {\n' % getsets_name) + for getset in getsets: + self.fp.write(getset) + self.fp.write(' { NULL, (getter)0, (setter)0 },\n') + self.fp.write('};\n\n') + + return getsets_name + + def _write_get_symbol_names(self, writer, functions): + self.fp.write("""static PyObject * +_wrap__get_symbol_names(PyObject *self) +{ + PyObject *pylist = PyList_New(0); + +""") + for obj, bases in writer.get_classes(): + self.fp.write(' PyList_Append(pylist, ' + 'PyString_FromString("%s"));\n' % (obj.name)) + + for name, cname, flags, docstring in functions: + self.fp.write(' PyList_Append(pylist, ' + 'PyString_FromString("%s"));\n' % (name)) + + for enum in writer.get_enums(): + self.fp.write(' PyList_Append(pylist, ' + 'PyString_FromString("%s"));\n' % (enum.name)) + for nick, value in enum.values: + name = value[len(self.overrides.modulename)+1:] + self.fp.write(' PyList_Append(pylist, ' + 'PyString_FromString("%s"));\n' % (name)) + + self.fp.write(" return pylist;\n}\n\n"); + + def _write_get_symbol(self, writer, functions): + self.fp.write("""static PyObject * +_wrap__get_symbol(PyObject *self, PyObject *args) +{ + PyObject *d; + char *name; + static PyObject *modulename = NULL; + static PyObject *module = NULL; + static char *strip_prefix = "%s"; + + if (!PyArg_ParseTuple(args, "Os", &d, &name)) + return NULL; + + if (!modulename) + modulename = PyString_FromString("%s"); + + if (!module) + module = PyDict_GetItemString(d, "__module__"); + +""" % (self.overrides.modulename.upper() + '_', + self.overrides.modulename)) + + first = True + # Classes / GObjects + for obj, bases in writer.get_classes(): + if first: + self.fp.write(' if (!strcmp(name, "%s")) {\n' % obj.name) + first = False + else: + self.fp.write(' } else if (!strcmp(name, "%s")) {\n' % obj.name) + self.fp.write( + ' return (PyObject*)pygobject_lookup_class(%s);\n' % + obj.typecode) + self.fp.write(' }\n') + + # Functions + for name, cname, flags, docstring in functions: + self.fp.write(' else if (!strcmp(name, "%s")) {\n' % name) + self.fp.write(' static PyMethodDef ml = { ' + '"%s", (PyCFunction)%s, %s, "%s"};\n' % ( + name, cname, flags, docstring)) + self.fp.write(' return PyCFunction_NewEx(&ml, NULL, modulename);\n') + self.fp.write(' }\n') + + # Enums + def write_enum(enum, returnobj=False): + if returnobj: + ret = 'return ' + else: + ret = '' + if enum.deftype == 'enum': + self.fp.write( + ' %spyg_enum_add(module, "%s", strip_prefix, %s);\n' + % (ret, enum.name, enum.typecode)) + else: + self.fp.write( + ' %spyg_flags_add(module, "%s", strip_prefix, %s);\n' + % (ret, enum.name, enum.typecode)) + + strip_len = len(self.overrides.modulename)+1 # GTK_ + for enum in writer.get_enums(): + # XXX: Implement without typecodes + self.fp.write(' else if (!strcmp(name, "%s")) {\n' % enum.name) + write_enum(enum, returnobj=True) + self.fp.write(' }\n') + + for nick, value in enum.values: + value = value[strip_len:] + self.fp.write(' else if (!strcmp(name, "%s")) {\n' % value) + write_enum(enum) + self.fp.write(' return PyObject_GetAttrString(module, "%s");\n' % + value) + self.fp.write(' }\n') + + self.fp.write(' return Py_None;\n}\n\n'); + + def _write_function_bodies(self): + functions = [] + # First, get methods from the defs files + for func in self.parser.find_functions(): + funcname = func.c_name + if self.overrides.is_ignored(funcname): + continue + try: + if self.overrides.is_overriden(funcname): + data = self.overrides.override(funcname) + self.write_function(funcname, data) + + methflags = self.get_methflags(funcname) + else: + # write constructor from template ... + code, methflags = self.write_function_wrapper(func, + self.function_tmpl, handle_return=1, is_method=0) + self.fp.write(code) + functions.append((func.name, '_wrap_' + funcname, + methflags, func.docstring)) + functions_coverage.declare_wrapped() + except argtypes.ArgTypeError, ex: + functions_coverage.declare_not_wrapped() + sys.stderr.write('Could not write function %s: %s\n' + % (func.name, str(ex))) + + # Now try to see if there are any defined in the override + for funcname in self.overrides.get_functions(): + try: + data = self.overrides.function(funcname) + self.write_function(funcname, data) + methflags = self.get_methflags(funcname) + functions.append((funcname, '_wrap_' + funcname, + methflags, 'NULL')) + functions_coverage.declare_wrapped() + except argtypes.ArgTypeError, ex: + functions_coverage.declare_not_wrapped() + sys.stderr.write('Could not write function %s: %s\n' + % (funcname, str(ex))) + return functions + + def write_functions(self, writer, prefix): + self.fp.write('\n/* ----------- functions ----------- */\n\n') + functions = [] + func_infos = self._write_function_bodies() + + # If we have a dynamic namespace, write symbol and attribute getter + if self.overrides.dynamicnamespace: + self._write_get_symbol_names(writer, func_infos) + self._write_get_symbol(writer, func_infos) + for obj, bases in writer.get_classes(): + self.fp.write("""static PyTypeObject * +%s_register_type(const gchar *name, PyObject *unused) +{ + PyObject *m = PyImport_ImportModule("gtk"); + PyObject *d = PyModule_GetDict(m); +""" % obj.c_name) + writer.write_class(obj, bases, indent=1) + self.fp.write( + ' return (%s)PyDict_GetItemString(d, "%s");\n' % ( + 'PyTypeObject*', obj.name)) + self.fp.write("}\n") + + functions.append(' { "_get_symbol_names", ' + '(PyCFunction)_wrap__get_symbol_names, ' + 'METH_NOARGS, NULL },\n') + functions.append(' { "_get_symbol", ' + '(PyCFunction)_wrap__get_symbol, ' + 'METH_VARARGS, NULL },\n') + else: + for name, cname, flags, docstring in func_infos: + functions.append(self.methdef_tmpl % dict(name=name, + cname=cname, + flags=flags, + docstring=docstring)) + + # write the PyMethodDef structure + functions.append(' { NULL, NULL, 0, NULL }\n') + + self.fp.write('const PyMethodDef ' + prefix + '_functions[] = {\n') + self.fp.write(string.join(functions, '')) + self.fp.write('};\n\n') + +class GObjectWrapper(Wrapper): + constructor_tmpl = ( + 'static int\n' + '_wrap_%(cname)s(PyGObject *self%(extraparams)s)\n' + '{\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' self->obj = (GObject *)%(cname)s(%(arglist)s);\n' + '%(codeafter)s\n' + ' if (!self->obj) {\n' + ' PyErr_SetString(PyExc_RuntimeError, ' + '"could not create %(typename)s object");\n' + ' return -1;\n' + ' }\n' + '%(aftercreate)s' + ' pygobject_register_wrapper((PyObject *)self);\n' + ' return 0;\n' + '}\n\n' + ) + + method_tmpl = ( + 'static PyObject *\n' + '_wrap_%(cname)s(PyGObject *self%(extraparams)s)\n' + '{\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' %(begin_allow_threads)s\n' + ' %(setreturn)s%(cname)s(%(cast)s(self->obj)%(arglist)s);\n' + ' %(end_allow_threads)s\n' + '%(codeafter)s\n' + '}\n\n' + ) + def __init__(self, parser, objinfo, overrides, fp=FileOutput(sys.stdout)): + Wrapper.__init__(self, parser, objinfo, overrides, fp) + if self.objinfo: + self.castmacro = string.replace(self.objinfo.typecode, + '_TYPE_', '_', 1) + + def get_initial_class_substdict(self): + return { 'tp_basicsize' : 'PyGObject', + 'tp_weaklistoffset' : 'offsetof(PyGObject, weakreflist)', + 'tp_dictoffset' : 'offsetof(PyGObject, inst_dict)' } + + def get_field_accessor(self, fieldname): + castmacro = string.replace(self.objinfo.typecode, '_TYPE_', '_', 1) + return '%s(pygobject_get(self))->%s' % (castmacro, fieldname) + + def get_initial_constructor_substdict(self, constructor): + substdict = Wrapper.get_initial_constructor_substdict(self, + constructor) + if not constructor.caller_owns_return: + substdict['aftercreate'] = " g_object_ref(self->obj);\n" + else: + substdict['aftercreate'] = '' + return substdict + + def get_initial_method_substdict(self, method): + substdict = Wrapper.get_initial_method_substdict(self, method) + substdict['cast'] = string.replace(self.objinfo.typecode, + '_TYPE_', '_', 1) + return substdict + + def write_default_constructor(self): + try: + parent = self.parser.find_object(self.objinfo.parent) + except ValueError: + parent = None + if parent is not None: + ## just like the constructor is inheritted, we should + # inherit the new API compatibility flag + self.objinfo.has_new_constructor_api = ( + parent.has_new_constructor_api) + elif self.objinfo.parent == 'GObject': + self.objinfo.has_new_constructor_api = True + return '0' + + def write_property_based_constructor(self, constructor): + self.objinfo.has_new_constructor_api = True + out = self.fp + print >> out, "static int" + print >> out, '_wrap_%s(PyGObject *self, PyObject *args,' \ + ' PyObject *kwargs)\n{' % constructor.c_name + if constructor.params: + s = " GType obj_type = pyg_type_from_object((PyObject *) self);" + print >> out, s + + def py_str_list_to_c(arg): + if arg: + return "{" + ", ".join( + map(lambda s: '"' + s + '"', arg)) + ", NULL }" + else: + return "{ NULL }" + + classname = '%s.%s' % (self.overrides.modulename, + self.objinfo.name) + + if constructor.params: + mandatory_arguments = [param for param in constructor.params + if not param.optional] + optional_arguments = [param for param in constructor.params + if param.optional] + arg_names = py_str_list_to_c( + [param.argname + for param in mandatory_arguments + optional_arguments]) + + prop_names = py_str_list_to_c( + [param.pname + for param in mandatory_arguments + optional_arguments]) + + print >> out, " GParameter params[%i];" % \ + len(constructor.params) + print >> out, " PyObject *parsed_args[%i] = {NULL, };" % \ + len(constructor.params) + print >> out, " char *arg_names[] = %s;" % arg_names + print >> out, " char *prop_names[] = %s;" % prop_names + print >> out, " guint nparams, i;" + print >> out + if constructor.deprecated is not None: + out.write( + ' if (PyErr_Warn(PyExc_DeprecationWarning, ' + '"%s") < 0)\n' % + constructor.deprecated) + print >> out, ' return -1;' + print >> out + out.write(" if (!PyArg_ParseTupleAndKeywords(args, kwargs, ") + template = '"' + if mandatory_arguments: + template += "O"*len(mandatory_arguments) + if optional_arguments: + template += "|" + "O"*len(optional_arguments) + template += ':%s.__init__"' % classname + print >> out, template, ", arg_names", + for i in range(len(constructor.params)): + print >> out, ", &parsed_args[%i]" % i, + + out.write( + "))\n" + " return -1;\n" + "\n" + " memset(params, 0, sizeof(GParameter)*%i);\n" + " if (!pyg_parse_constructor_args(obj_type, arg_names,\n" + " prop_names, params, \n" + " &nparams, parsed_args))\n" + " return -1;\n" + " pygobject_constructv(self, nparams, params);\n" + " for (i = 0; i < nparams; ++i)\n" + " g_value_unset(¶ms[i].value);\n" + % len(constructor.params)) + else: + out.write( + " static char* kwlist[] = { NULL };\n" + "\n") + + if constructor.deprecated is not None: + out.write( + ' if (PyErr_Warn(PyExc_DeprecationWarning, "%s") < 0)\n' + ' return -1;\n' + '\n' % constructor.deprecated) + + out.write( + ' if (!PyArg_ParseTupleAndKeywords(args, kwargs,\n' + ' ":%s.__init__",\n' + ' kwlist))\n' + ' return -1;\n' + '\n' + ' pygobject_constructv(self, 0, NULL);\n' % classname) + out.write( + ' if (!self->obj) {\n' + ' PyErr_SetString(\n' + ' PyExc_RuntimeError, \n' + ' "could not create %s object");\n' + ' return -1;\n' + ' }\n' % classname) + + if not constructor.caller_owns_return: + print >> out, " g_object_ref(self->obj);\n" + + out.write( + ' return 0;\n' + '}\n\n') + + return "_wrap_%s" % constructor.c_name + + +class GInterfaceWrapper(GObjectWrapper): + virtual_accessor_tmpl = ( + 'static PyObject *\n' + '_wrap_%(cname)s(PyObject *cls%(extraparams)s)\n' + '{\n' + ' %(vtable)s *iface;\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' iface = g_type_interface_peek(' + 'g_type_class_peek(pyg_type_from_object(cls)), %(typecode)s);\n' + ' if (iface->%(virtual)s)\n' + ' %(setreturn)siface->%(virtual)s(%(arglist)s);\n' + ' else {\n' + ' PyErr_SetString(PyExc_NotImplementedError, ' + '"interface method %(name)s not implemented");\n' + ' return NULL;\n' + ' }\n' + '%(codeafter)s\n' + '}\n\n' + ) + + def get_initial_class_substdict(self): + return { 'tp_basicsize' : 'PyObject', + 'tp_weaklistoffset' : '0', + 'tp_dictoffset' : '0'} + + def write_constructor(self): + # interfaces have no constructors ... + return '0' + def write_getsets(self): + # interfaces have no fields ... + return '0' + + def _get_class_virtual_substdict(self, meth, cname, parent): + substdict = self.get_initial_method_substdict(meth) + substdict['virtual'] = meth.name + substdict['cname'] = cname + substdict['typecode'] = self.objinfo.typecode + substdict['vtable'] = self.objinfo.vtable + return substdict + + def write_virtuals(self): + ## Now write reverse method wrappers, which let python code + ## implement interface methods. + # First, get methods from the defs files + klass = self.objinfo.c_name + proxies = [] + for meth in self.parser.find_virtuals(self.objinfo): + method_name = self.objinfo.c_name + "__proxy_do_" + meth.name + if self.overrides.is_ignored(method_name): + continue + try: + if self.overrides.is_overriden(method_name): + if not self.overrides.is_already_included(method_name): + data = self.overrides.override(method_name) + self.write_function(method_name, data) + else: + # write proxy ... + ret, props = argtypes.matcher.get_reverse_ret(meth.ret) + wrapper = reversewrapper.ReverseWrapper( + '_wrap_' + method_name, is_static=True) + wrapper.set_return_type(ret(wrapper, **props)) + wrapper.add_parameter(reversewrapper.PyGObjectMethodParam( + wrapper, "self", method_name="do_" + meth.name, + c_type=(klass + ' *'))) + for param in meth.params: + handler, props = argtypes.matcher.get_reverse( + param.ptype) + props["direction"] = param.pdir + props["nullok"] = param.pnull + wrapper.add_parameter( + handler(wrapper, param.pname, **props)) + buf = reversewrapper.MemoryCodeSink() + wrapper.generate(buf) + self.fp.write(buf.flush()) + proxies.append((fixname(meth.name), '_wrap_' + method_name)) + iproxies_coverage.declare_wrapped() + except argtypes.ArgTypeError, ex: + iproxies_coverage.declare_not_wrapped() + proxies.append((fixname(meth.name), None)) + sys.stderr.write('Could not write interface proxy %s.%s: %s\n' + % (klass, meth.name, str(ex))) + + if not proxies or not [cname for name, cname in proxies if cname]: + return + + ## Write an interface init function for this object + funcname = "__%s__interface_init" % klass + vtable = self.objinfo.vtable + self.fp.write( + '\nstatic void\n' + '%(funcname)s(%(vtable)s *iface, PyTypeObject *pytype)\n' + '{\n' + ' %(vtable)s *parent_iface = ' + 'g_type_interface_peek_parent(iface);\n' + ' PyObject *py_method;\n' + '\n' + % vars()) + + for name, cname in proxies: + do_name = 'do_' + name + if cname is None: + continue + + self.fp.write(( + ' py_method = pytype? PyObject_GetAttrString(' + '(PyObject *) pytype, "%(do_name)s") : NULL;\n' + ' if (py_method && !PyObject_TypeCheck(py_method, ' + '&PyCFunction_Type)) {\n' + ' iface->%(name)s = %(cname)s;\n' + ' } else {\n' + ' PyErr_Clear();\n' + ' if (parent_iface) {\n' + ' iface->%(name)s = parent_iface->%(name)s;\n' + ' }\n' + ' Py_XDECREF(py_method);\n' + ' }\n' + ) % vars()) + self.fp.write('}\n\n') + interface_info = "__%s__iinfo" % klass + self.fp.write(''' +static const GInterfaceInfo %s = { + (GInterfaceInitFunc) %s, + NULL, + NULL +}; +''' % (interface_info, funcname)) + self.objinfo.interface_info = interface_info + +class GBoxedWrapper(Wrapper): + constructor_tmpl = ( + 'static int\n' + '_wrap_%(cname)s(PyGBoxed *self%(extraparams)s)\n' + '{\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' self->gtype = %(typecode)s;\n' + ' self->free_on_dealloc = FALSE;\n' + ' self->boxed = %(cname)s(%(arglist)s);\n' + '%(codeafter)s\n' + ' if (!self->boxed) {\n' + ' PyErr_SetString(PyExc_RuntimeError, ' + '"could not create %(typename)s object");\n' + ' return -1;\n' + ' }\n' + ' self->free_on_dealloc = TRUE;\n' + ' return 0;\n' + '}\n\n' + ) + + method_tmpl = ( + 'static PyObject *\n' + '_wrap_%(cname)s(PyObject *self%(extraparams)s)\n' + '{\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' %(begin_allow_threads)s\n' + ' %(setreturn)s%(cname)s(pyg_boxed_get(self, ' + '%(typename)s)%(arglist)s);\n' + ' %(end_allow_threads)s\n' + '%(codeafter)s\n' + '}\n\n' + ) + + def get_initial_class_substdict(self): + return { 'tp_basicsize' : 'PyGBoxed', + 'tp_weaklistoffset' : '0', + 'tp_dictoffset' : '0' } + + def get_field_accessor(self, fieldname): + return 'pyg_boxed_get(self, %s)->%s' % (self.objinfo.c_name, fieldname) + + def get_initial_constructor_substdict(self, constructor): + substdict = Wrapper.get_initial_constructor_substdict( + self, constructor) + substdict['typecode'] = self.objinfo.typecode + return substdict + +class GPointerWrapper(GBoxedWrapper): + constructor_tmpl = ( + 'static int\n' + '_wrap_%(cname)s(PyGPointer *self%(extraparams)s)\n' + '{\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' self->gtype = %(typecode)s;\n' + ' self->pointer = %(cname)s(%(arglist)s);\n' + '%(codeafter)s\n' + ' if (!self->pointer) {\n' + ' PyErr_SetString(PyExc_RuntimeError, ' + '"could not create %(typename)s object");\n' + ' return -1;\n' + ' }\n' + ' return 0;\n' + '}\n\n' + ) + + method_tmpl = ( + 'static PyObject *\n' + '_wrap_%(cname)s(PyObject *self%(extraparams)s)\n' + '{\n' + '%(varlist)s' + '%(parseargs)s' + '%(codebefore)s' + ' %(setreturn)s%(cname)s(pyg_pointer_get(self, ' + '%(typename)s)%(arglist)s);\n' + '%(codeafter)s\n' + '}\n\n' + ) + + def get_initial_class_substdict(self): + return { 'tp_basicsize' : 'PyGPointer', + 'tp_weaklistoffset' : '0', + 'tp_dictoffset' : '0' } + + def get_field_accessor(self, fieldname): + return 'pyg_pointer_get(self, %s)->%s' % (self.objinfo.c_name, + fieldname) + + def get_initial_constructor_substdict(self, constructor): + substdict = Wrapper.get_initial_constructor_substdict( + self, constructor) + substdict['typecode'] = self.objinfo.typecode + return substdict + +class SourceWriter: + def __init__(self, parser, overrides, prefix, fp=FileOutput(sys.stdout)): + self.parser = parser + self.overrides = overrides + self.prefix = prefix + self.fp = fp + + def write(self, py_ssize_t_clean=False): + argtypes.py_ssize_t_clean = py_ssize_t_clean + + self.write_headers(py_ssize_t_clean) + self.write_imports() + self.write_type_declarations() + self.write_body() + self.write_classes() + + wrapper = Wrapper(self.parser, None, self.overrides, self.fp) + wrapper.write_functions(self, self.prefix) + + if not self.overrides.dynamicnamespace: + self.write_enums() + self.write_extension_init() + self.write_registers() + + argtypes.py_ssize_t_clean = False + + def write_headers(self, py_ssize_t_clean): + self.fp.write('/* -- THIS FILE IS GENERATED - DO NOT EDIT */') + self.fp.write('/* -*- Mode: C; c-basic-offset: 4 -*- */\n\n') + if py_ssize_t_clean: + self.fp.write('#define PY_SSIZE_T_CLEAN\n') + self.fp.write('#include \n\n\n') + if py_ssize_t_clean: + self.fp.write(''' + +#if PY_VERSION_HEX < 0x02050000 +typedef int Py_ssize_t; +#define PY_SSIZE_T_MAX INT_MAX +#define PY_SSIZE_T_MIN INT_MIN +typedef inquiry lenfunc; +typedef intargfunc ssizeargfunc; +typedef intobjargproc ssizeobjargproc; +#endif + +''') + self.fp.write(self.overrides.get_headers()) + self.fp.resetline() + self.fp.write('\n\n') + + def write_imports(self): + self.fp.write('/* ---------- types from other modules ---------- */\n') + for module, pyname, cname, importing_for in self.overrides.get_imports(): + if importing_for is None or is_registered_object(importing_for): + self.fp.write('static PyTypeObject *_%s;\n' % cname) + self.fp.write('#define %s (*_%s)\n' % (cname, cname)) + self.fp.write('\n\n') + + def write_type_declarations(self): + #todo use 'static' if used only in one file + self.fp.write('/* ---------- forward type declarations ---------- */\n') + for obj in self.parser.boxes: + if not self.overrides.is_type_ignored(obj.c_name): + self.fp.write('PyTypeObject G_GNUC_INTERNAL Py' + obj.c_name + '_Type;\n') + for obj in self.parser.objects: + if not self.overrides.is_type_ignored(obj.c_name): + self.fp.write('PyTypeObject G_GNUC_INTERNAL Py' + obj.c_name + '_Type;\n') + for interface in self.parser.interfaces: + if not self.overrides.is_type_ignored(interface.c_name): + self.fp.write('PyTypeObject G_GNUC_INTERNAL Py' + interface.c_name + '_Type;\n') + self.fp.write('\n') + + def write_body(self): + self.fp.write(self.overrides.get_body()) + self.fp.resetline() + self.fp.write('\n\n') + + def _sort_parent_children(self, objects): + objects = list(objects) + modified = True + while modified: + modified = False + parent_index = None + child_index = None + for i, obj in enumerate(objects): + if obj.parent == 'GObject': + continue + if obj.parent not in [info.c_name for info in objects[:i]]: + for j, info in enumerate(objects[i+1:]): + if info.c_name == obj.parent: + parent_index = i + 1 + j + child_index = i + break + else: + continue + break + if child_index is not None and parent_index is not None: + if child_index != parent_index: + objects.insert(child_index, objects.pop(parent_index)) + modified = True + return objects + + def write_classes(self): + ## Sort the objects, so that we generate code for the parent types + ## before their children. + objects = self._sort_parent_children(self.parser.objects) + + for klass, items in ((GBoxedWrapper, self.parser.boxes), + (GPointerWrapper, self.parser.pointers), + (GObjectWrapper, objects), + (GInterfaceWrapper, self.parser.interfaces)): + for item in items: + instance = klass(self.parser, item, self.overrides, self.fp) + instance.write_class() + self.fp.write('\n') + + def get_enums(self): + enums = [] + for enum in self.parser.enums: + if self.overrides.is_type_ignored(enum.c_name): + continue + enums.append(enum) + return enums + + def write_enums(self): + if not self.parser.enums: + return + + self.fp.write('\n/* ----------- enums and flags ----------- */\n\n') + self.fp.write( + 'void\n' + self.prefix + + '_add_constants(PyObject *module, const gchar *strip_prefix)\n{\n') + + self.fp.write( + '#ifdef VERSION\n' + ' PyModule_AddStringConstant(module, "__version__", VERSION);\n' + '#endif\n') + + for enum in self.get_enums(): + if enum.typecode is None: + for nick, value in enum.values: + self.fp.write( + ' PyModule_AddIntConstant(module, ' + '(char *) pyg_constant_strip_prefix("%s", strip_prefix), %s);\n' + % (value, value)) + else: + if enum.deftype == 'enum': + self.fp.write(' pyg_enum_add(module, "%s", strip_prefix, %s);\n' + % (enum.name, enum.typecode)) + else: + self.fp.write(' pyg_flags_add(module, "%s", strip_prefix, %s);\n' + % (enum.name, enum.typecode)) + + self.fp.write('\n') + self.fp.write(' if (PyErr_Occurred())\n') + self.fp.write(' PyErr_Print();\n') + self.fp.write('}\n\n') + + def write_object_imports(self, retval=''): + imports = self.overrides.get_imports()[:] + if not imports: + return + + bymod = {} + for module, pyname, cname, importing_for in imports: + if importing_for is None or is_registered_object(importing_for): + bymod.setdefault(module, []).append((pyname, cname)) + self.fp.write(' PyObject *module;\n\n') + for module in bymod: + self.fp.write( + ' if ((module = PyImport_ImportModule("%s")) != NULL) {\n' + % module) + #self.fp.write( + # ' PyObject *moddict = PyModule_GetDict(module);\n\n') + for pyname, cname in bymod[module]: + #self.fp.write( + # ' _%s = (PyTypeObject *)PyDict_GetItemString(' + # 'moddict, "%s");\n' % (cname, pyname)) + self.fp.write( + ' _%s = (PyTypeObject *)PyObject_GetAttrString(' + 'module, "%s");\n' % (cname, pyname)) + self.fp.write(' if (_%s == NULL) {\n' % cname) + self.fp.write(' PyErr_SetString(PyExc_ImportError,\n') + self.fp.write(' "cannot import name %s from %s");\n' + % (pyname, module)) + self.fp.write(' return %s;\n' % retval) + self.fp.write(' }\n') + self.fp.write(' } else {\n') + self.fp.write(' PyErr_SetString(PyExc_ImportError,\n') + self.fp.write(' "could not import %s");\n' % module) + self.fp.write(' return %s;\n' % retval) + self.fp.write(' }\n') + self.fp.write('\n') + + def write_extension_init(self): + self.fp.write('/* initialise stuff extension classes */\n') + self.fp.write('void\n' + self.prefix + '_register_classes(PyObject *d)\n{\n') + self.write_object_imports() + self.fp.write(self.overrides.get_init() + '\n') + self.fp.resetline() + + def get_classes(self): + objects = self.parser.objects[:] + pos = 0 + while pos < len(objects): + parent = objects[pos].parent + for i in range(pos+1, len(objects)): + if objects[i].c_name == parent: + objects.insert(i+1, objects[pos]) + del objects[pos] + break + else: + pos = pos + 1 + + retval = [] + for obj in objects: + if self.overrides.is_type_ignored(obj.c_name): + continue + bases = [] + if obj.parent != None: + bases.append(obj.parent) + bases = bases + obj.implements + retval.append((obj, bases)) + + return retval + + def write_registers(self): + for boxed in self.parser.boxes: + if not self.overrides.is_type_ignored(boxed.c_name): + self.fp.write(' pyg_register_boxed(d, "' + boxed.name + + '", ' + boxed.typecode + + ', &Py' + boxed.c_name + + '_Type);\n') + for pointer in self.parser.pointers: + if not self.overrides.is_type_ignored(pointer.c_name): + self.fp.write(' pyg_register_pointer(d, "' + pointer.name + + '", ' + pointer.typecode + + ', &Py' + pointer.c_name + '_Type);\n') + for interface in self.parser.interfaces: + if not self.overrides.is_type_ignored(interface.c_name): + self.fp.write(' pyg_register_interface(d, "' + + interface.name + '", '+ interface.typecode + + ', &Py' + interface.c_name + '_Type);\n') + if interface.interface_info is not None: + self.fp.write(' pyg_register_interface_info(%s, &%s);\n' % + (interface.typecode, interface.interface_info)) + + if not self.overrides.dynamicnamespace: + for obj, bases in self.get_classes(): + self.write_class(obj, bases) + else: + for obj, bases in self.get_classes(): + self.fp.write( + ' pyg_type_register_custom_callback("%s", ' + '(PyGTypeRegistrationFunction)%s_register_type, d);\n' % + (obj.c_name, obj.c_name)) + + self.fp.write('}\n') + + def _can_direct_ref(self, base): + if not self.overrides.dynamicnamespace: + return True + if base == 'GObject': + return True + obj = get_object_by_name(base) + if obj.module.lower() != self.overrides.modulename: + return True + return False + + def write_class(self, obj, bases, indent=1): + indent_str = ' ' * (indent * 4) + if bases: + bases_str = 'Py_BuildValue("(%s)"' % (len(bases) * 'O') + + for base in bases: + if self._can_direct_ref(base): + bases_str += ', &Py%s_Type' % base + else: + baseobj = get_object_by_name(base) + bases_str += ', PyObject_GetAttrString(m, "%s")' % baseobj.name + bases_str += ')' + else: + bases_str = 'NULL' + + self.fp.write( + '%(indent)spygobject_register_class(d, "%(c_name)s", %(typecode)s, &Py%(c_name)s_Type, %(bases)s);\n' + % dict(indent=indent_str, c_name=obj.c_name, typecode=obj.typecode, bases=bases_str)) + + if obj.has_new_constructor_api: + self.fp.write( + indent_str + 'pyg_set_object_has_new_constructor(%s);\n' % + obj.typecode) + else: + print >> sys.stderr, ( + "Warning: Constructor for %s needs to be updated to new API\n" + " See http://live.gnome.org/PyGTK_2fWhatsNew28" + "#update-constructors") % obj.c_name + + if obj.class_init_func is not None: + self.fp.write( + indent_str + 'pyg_register_class_init(%s, %s);\n' % + (obj.typecode, obj.class_init_func)) + +_objects = {} + +def is_registered_object(c_name): + return c_name in _objects + +def get_object_by_name(c_name): + global _objects + return _objects[c_name] + +def register_types(parser): + global _objects + for boxed in parser.boxes: + argtypes.matcher.register_boxed(boxed.c_name, boxed.typecode) + _objects[boxed.c_name] = boxed + for pointer in parser.pointers: + argtypes.matcher.register_pointer(pointer.c_name, pointer.typecode) + for obj in parser.objects: + argtypes.matcher.register_object(obj.c_name, obj.parent, obj.typecode) + _objects[obj.c_name] = obj + for iface in parser.interfaces: + argtypes.matcher.register_object(iface.c_name, None, iface.typecode) + _objects[iface.c_name] = iface + for enum in parser.enums: + if enum.deftype == 'flags': + argtypes.matcher.register_flag(enum.c_name, enum.typecode) + else: + argtypes.matcher.register_enum(enum.c_name, enum.typecode) + +usage = 'usage: codegen.py [-o overridesfile] [-p prefix] defsfile' +def main(argv): + o = override.Overrides() + prefix = 'pygtk' + outfilename = None + errorfilename = None + opts, args = getopt.getopt(argv[1:], "o:p:r:t:D:I:", + ["override=", "prefix=", "register=", "outfilename=", + "load-types=", "errorfilename=", "py_ssize_t-clean"]) + defines = {} # -Dkey[=val] options + py_ssize_t_clean = False + for opt, arg in opts: + if opt in ('-o', '--override'): + o = override.Overrides(arg) + elif opt in ('-p', '--prefix'): + prefix = arg + elif opt in ('-r', '--register'): + # Warning: user has to make sure all -D options appear before -r + p = defsparser.DefsParser(arg, defines) + p.startParsing() + register_types(p) + del p + elif opt == '--outfilename': + outfilename = arg + elif opt == '--errorfilename': + errorfilename = arg + elif opt in ('-t', '--load-types'): + globals = {} + execfile(arg, globals) + elif opt == '-D': + nameval = arg.split('=') + try: + defines[nameval[0]] = nameval[1] + except IndexError: + defines[nameval[0]] = None + elif opt == '-I': + defsparser.include_path.insert(0, arg) + elif opt == '--py_ssize_t-clean': + py_ssize_t_clean = True + if len(args) < 1: + print >> sys.stderr, usage + return 1 + if errorfilename: + sys.stderr = open(errorfilename, "w") + p = defsparser.DefsParser(args[0], defines) + if not outfilename: + outfilename = os.path.splitext(args[0])[0] + '.c' + + p.startParsing() + + register_types(p) + sw = SourceWriter(p, o, prefix, FileOutput(sys.stdout, outfilename)) + sw.write(py_ssize_t_clean) + + functions_coverage.printstats() + methods_coverage.printstats() + vproxies_coverage.printstats() + vaccessors_coverage.printstats() + iproxies_coverage.printstats() + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/codegen/createdefs.py b/codegen/createdefs.py new file mode 100755 index 0000000..84d50b1 --- /dev/null +++ b/codegen/createdefs.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +import sys + +def main(args): + output = args[1] + input = args[2:] + outfd = open(output, 'w') + outfd.write(';; -*- scheme -*-\n') + outfd.write(';; THIS FILE IS GENERATED - DO NOT EDIT\n') + for filename in input: + outfd.write('(include "%s")\n' % filename) + outfd.close() + + return 0 + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/codegen/definitions.py b/codegen/definitions.py new file mode 100644 index 0000000..aca5adb --- /dev/null +++ b/codegen/definitions.py @@ -0,0 +1,575 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +import copy +import sys + +def get_valid_scheme_definitions(defs): + return [x for x in defs if isinstance(x, tuple) and len(x) >= 2] + +def unescape(s): + s = s.replace('\r\n', '\\r\\n').replace('\t', '\\t') + return s.replace('\r', '\\r').replace('\n', '\\n') + +def make_docstring(lines): + return "(char *) " + '\n'.join(['"%s"' % unescape(s) for s in lines]) + +# New Parameter class, wich emulates a tuple for compatibility reasons +class Parameter(object): + def __init__(self, ptype, pname, pdflt, pnull, pdir=None): + self.ptype = ptype + self.pname = pname + self.pdflt = pdflt + self.pnull = pnull + self.pdir = pdir + + def __len__(self): return 4 + def __getitem__(self, i): + return (self.ptype, self.pname, self.pdflt, self.pnull)[i] + + def merge(self, old): + if old.pdflt is not None: + self.pdflt = old.pdflt + if old.pnull is not None: + self.pnull = old.pnull + +# We currently subclass 'str' to make impact on the rest of codegen as +# little as possible. Later we can subclass 'object' instead, but +# then we must find and adapt all places which expect return types to +# be strings. +class ReturnType(str): + def __new__(cls, *args, **kwds): + return str.__new__(cls, *args[:1]) + def __init__(self, type_name, optional=False): + str.__init__(self) + self.optional = optional + +# Parameter for property based constructors +class Property(object): + def __init__(self, pname, optional, argname): + self.pname = pname + self.optional = optional + self.argname = argname + + def __len__(self): return 4 + def __getitem__(self, i): + return ('', self.pname, self.optional, self.argname)[i] + + def merge(self, old): + if old.optional is not None: + self.optional = old.optional + if old.argname is not None: + self.argname = old.argname + + +class Definition(object): + docstring = "NULL" + + def py_name(self): + return '%s.%s' % (self.module, self.name) + + py_name = property(py_name) + + def __init__(self, *args): + """Create a new defs object of this type. The arguments are the + components of the definition""" + raise RuntimeError, "this is an abstract class" + + def merge(self, old): + """Merge in customisations from older version of definition""" + raise RuntimeError, "this is an abstract class" + + def write_defs(self, fp=sys.stdout): + """write out this definition in defs file format""" + raise RuntimeError, "this is an abstract class" + + def guess_return_value_ownership(self): + "return 1 if caller owns return value" + if getattr(self, 'is_constructor_of', False): + self.caller_owns_return = True + elif self.ret in ('char*', 'gchar*', 'string'): + self.caller_owns_return = True + else: + self.caller_owns_return = False + + +class ObjectDef(Definition): + def __init__(self, name, *args): + self.name = name + self.module = None + self.parent = None + self.c_name = None + self.typecode = None + self.fields = [] + self.implements = [] + self.class_init_func = None + self.has_new_constructor_api = False + for arg in get_valid_scheme_definitions(args): + if arg[0] == 'in-module': + self.module = arg[1] + elif arg[0] == 'docstring': + self.docstring = make_docstring(arg[1:]) + elif arg[0] == 'parent': + self.parent = arg[1] + elif arg[0] == 'c-name': + self.c_name = arg[1] + elif arg[0] == 'gtype-id': + self.typecode = arg[1] + elif arg[0] == 'fields': + for parg in arg[1:]: + self.fields.append((parg[0], parg[1])) + elif arg[0] == 'implements': + self.implements.append(arg[1]) + def merge(self, old): + # currently the .h parser doesn't try to work out what fields of + # an object structure should be public, so we just copy the list + # from the old version ... + self.fields = old.fields + self.implements = old.implements + def write_defs(self, fp=sys.stdout): + fp.write('(define-object ' + self.name + '\n') + if self.module: + fp.write(' (in-module "' + self.module + '")\n') + if self.parent != (None, None): + fp.write(' (parent "' + self.parent + '")\n') + for interface in self.implements: + fp.write(' (implements "' + interface + '")\n') + if self.c_name: + fp.write(' (c-name "' + self.c_name + '")\n') + if self.typecode: + fp.write(' (gtype-id "' + self.typecode + '")\n') + if self.fields: + fp.write(' (fields\n') + for (ftype, fname) in self.fields: + fp.write(' \'("' + ftype + '" "' + fname + '")\n') + fp.write(' )\n') + fp.write(')\n\n') + +class InterfaceDef(Definition): + def __init__(self, name, *args): + self.name = name + self.module = None + self.c_name = None + self.typecode = None + self.vtable = None + self.fields = [] + self.interface_info = None + for arg in get_valid_scheme_definitions(args): + if arg[0] == 'in-module': + self.module = arg[1] + elif arg[0] == 'docstring': + self.docstring = make_docstring(arg[1:]) + elif arg[0] == 'c-name': + self.c_name = arg[1] + elif arg[0] == 'gtype-id': + self.typecode = arg[1] + elif arg[0] == 'vtable': + self.vtable = arg[1] + if self.vtable is None: + self.vtable = self.c_name + "Iface" + def write_defs(self, fp=sys.stdout): + fp.write('(define-interface ' + self.name + '\n') + if self.module: + fp.write(' (in-module "' + self.module + '")\n') + if self.c_name: + fp.write(' (c-name "' + self.c_name + '")\n') + if self.typecode: + fp.write(' (gtype-id "' + self.typecode + '")\n') + fp.write(')\n\n') + +class EnumDef(Definition): + def __init__(self, name, *args): + self.deftype = 'enum' + self.name = name + self.in_module = None + self.c_name = None + self.typecode = None + self.values = [] + for arg in get_valid_scheme_definitions(args): + if arg[0] == 'in-module': + self.in_module = arg[1] + elif arg[0] == 'c-name': + self.c_name = arg[1] + elif arg[0] == 'gtype-id': + self.typecode = arg[1] + elif arg[0] == 'values': + for varg in arg[1:]: + self.values.append((varg[0], varg[1])) + def merge(self, old): + pass + def write_defs(self, fp=sys.stdout): + fp.write('(define-' + self.deftype + ' ' + self.name + '\n') + if self.in_module: + fp.write(' (in-module "' + self.in_module + '")\n') + fp.write(' (c-name "' + self.c_name + '")\n') + fp.write(' (gtype-id "' + self.typecode + '")\n') + if self.values: + fp.write(' (values\n') + for name, val in self.values: + fp.write(' \'("' + name + '" "' + val + '")\n') + fp.write(' )\n') + fp.write(')\n\n') + +class FlagsDef(EnumDef): + def __init__(self, *args): + apply(EnumDef.__init__, (self,) + args) + self.deftype = 'flags' + +class BoxedDef(Definition): + def __init__(self, name, *args): + self.name = name + self.module = None + self.c_name = None + self.typecode = None + self.copy = None + self.release = None + self.fields = [] + for arg in get_valid_scheme_definitions(args): + if arg[0] == 'in-module': + self.module = arg[1] + elif arg[0] == 'c-name': + self.c_name = arg[1] + elif arg[0] == 'gtype-id': + self.typecode = arg[1] + elif arg[0] == 'copy-func': + self.copy = arg[1] + elif arg[0] == 'release-func': + self.release = arg[1] + elif arg[0] == 'fields': + for parg in arg[1:]: + self.fields.append((parg[0], parg[1])) + def merge(self, old): + # currently the .h parser doesn't try to work out what fields of + # an object structure should be public, so we just copy the list + # from the old version ... + self.fields = old.fields + def write_defs(self, fp=sys.stdout): + fp.write('(define-boxed ' + self.name + '\n') + if self.module: + fp.write(' (in-module "' + self.module + '")\n') + if self.c_name: + fp.write(' (c-name "' + self.c_name + '")\n') + if self.typecode: + fp.write(' (gtype-id "' + self.typecode + '")\n') + if self.copy: + fp.write(' (copy-func "' + self.copy + '")\n') + if self.release: + fp.write(' (release-func "' + self.release + '")\n') + if self.fields: + fp.write(' (fields\n') + for (ftype, fname) in self.fields: + fp.write(' \'("' + ftype + '" "' + fname + '")\n') + fp.write(' )\n') + fp.write(')\n\n') + +class PointerDef(Definition): + def __init__(self, name, *args): + self.name = name + self.module = None + self.c_name = None + self.typecode = None + self.fields = [] + for arg in get_valid_scheme_definitions(args): + if arg[0] == 'in-module': + self.module = arg[1] + elif arg[0] == 'c-name': + self.c_name = arg[1] + elif arg[0] == 'gtype-id': + self.typecode = arg[1] + elif arg[0] == 'fields': + for parg in arg[1:]: + self.fields.append((parg[0], parg[1])) + def merge(self, old): + # currently the .h parser doesn't try to work out what fields of + # an object structure should be public, so we just copy the list + # from the old version ... + self.fields = old.fields + def write_defs(self, fp=sys.stdout): + fp.write('(define-pointer ' + self.name + '\n') + if self.module: + fp.write(' (in-module "' + self.module + '")\n') + if self.c_name: + fp.write(' (c-name "' + self.c_name + '")\n') + if self.typecode: + fp.write(' (gtype-id "' + self.typecode + '")\n') + if self.fields: + fp.write(' (fields\n') + for (ftype, fname) in self.fields: + fp.write(' \'("' + ftype + '" "' + fname + '")\n') + fp.write(' )\n') + fp.write(')\n\n') + +class MethodDefBase(Definition): + def __init__(self, name, *args): + dump = 0 + self.name = name + self.ret = None + self.caller_owns_return = None + self.unblock_threads = None + self.c_name = None + self.typecode = None + self.of_object = None + self.params = [] # of form (type, name, default, nullok) + self.varargs = 0 + self.deprecated = None + for arg in get_valid_scheme_definitions(args): + if arg[0] == 'of-object': + self.of_object = arg[1] + elif arg[0] == 'docstring': + self.docstring = make_docstring(arg[1:]) + elif arg[0] == 'c-name': + self.c_name = arg[1] + elif arg[0] == 'gtype-id': + self.typecode = arg[1] + elif arg[0] == 'return-type': + type_name = arg[1] + optional = False + for prop in arg[2:]: + if prop[0] == 'optional': + optional = True + self.ret = ReturnType(type_name, optional) + elif arg[0] == 'caller-owns-return': + self.caller_owns_return = arg[1] in ('t', '#t') + elif arg[0] == 'unblock-threads': + self.unblock_threads = arg[1] in ('t', '#t') + elif arg[0] == 'parameters': + for parg in arg[1:]: + ptype = parg[0] + pname = parg[1] + pdflt = None + pnull = 0 + pdir = None + for farg in parg[2:]: + assert isinstance(farg, tuple) + if farg[0] == 'default': + pdflt = farg[1] + elif farg[0] == 'null-ok': + pnull = 1 + elif farg[0] == 'direction': + pdir = farg[1] + self.params.append(Parameter(ptype, pname, pdflt, pnull, pdir)) + elif arg[0] == 'varargs': + self.varargs = arg[1] in ('t', '#t') + elif arg[0] == 'deprecated': + self.deprecated = arg[1] + else: + sys.stderr.write("Warning: %s argument unsupported.\n" + % (arg[0])) + dump = 1 + if dump: + self.write_defs(sys.stderr) + + if self.caller_owns_return is None and self.ret is not None: + self.guess_return_value_ownership() + + def merge(self, old, parmerge): + self.caller_owns_return = old.caller_owns_return + self.varargs = old.varargs + # here we merge extra parameter flags accross to the new object. + if not parmerge: + self.params = copy.deepcopy(old.params) + return + for i in range(len(self.params)): + ptype, pname, pdflt, pnull = self.params[i] + for p2 in old.params: + if p2[1] == pname: + self.params[i] = (ptype, pname, p2[2], p2[3]) + break + def _write_defs(self, fp=sys.stdout): + if self.of_object != (None, None): + fp.write(' (of-object "' + self.of_object + '")\n') + if self.c_name: + fp.write(' (c-name "' + self.c_name + '")\n') + if self.typecode: + fp.write(' (gtype-id "' + self.typecode + '")\n') + if self.caller_owns_return: + fp.write(' (caller-owns-return #t)\n') + if self.unblock_threads: + fp.write(' (unblock_threads #t)\n') + if self.ret: + fp.write(' (return-type "' + self.ret + '")\n') + if self.deprecated: + fp.write(' (deprecated "' + self.deprecated + '")\n') + if self.params: + fp.write(' (parameters\n') + for ptype, pname, pdflt, pnull in self.params: + fp.write(' \'("' + ptype + '" "' + pname +'"') + if pdflt: fp.write(' (default "' + pdflt + '")') + if pnull: fp.write(' (null-ok)') + fp.write(')\n') + fp.write(' )\n') + if self.varargs: + fp.write(' (varargs #t)\n') + fp.write(')\n\n') + + +class MethodDef(MethodDefBase): + def __init__(self, name, *args): + MethodDefBase.__init__(self, name, *args) + for item in ('c_name', 'of_object'): + if self.__dict__[item] == None: + self.write_defs(sys.stderr) + raise RuntimeError, "definition missing required %s" % (item,) + + def write_defs(self, fp=sys.stdout): + fp.write('(define-method ' + self.name + '\n') + self._write_defs(fp) + +class VirtualDef(MethodDefBase): + def write_defs(self, fp=sys.stdout): + fp.write('(define-virtual ' + self.name + '\n') + self._write_defs(fp) + +class FunctionDef(Definition): + def __init__(self, name, *args): + dump = 0 + self.name = name + self.in_module = None + self.is_constructor_of = None + self.ret = None + self.caller_owns_return = None + self.unblock_threads = None + self.c_name = None + self.typecode = None + self.params = [] # of form (type, name, default, nullok) + self.varargs = 0 + self.deprecated = None + for arg in get_valid_scheme_definitions(args): + if arg[0] == 'in-module': + self.in_module = arg[1] + elif arg[0] == 'docstring': + self.docstring = make_docstring(arg[1:]) + elif arg[0] == 'is-constructor-of': + self.is_constructor_of = arg[1] + elif arg[0] == 'c-name': + self.c_name = arg[1] + elif arg[0] == 'gtype-id': + self.typecode = arg[1] + elif arg[0] == 'return-type': + self.ret = arg[1] + elif arg[0] == 'caller-owns-return': + self.caller_owns_return = arg[1] in ('t', '#t') + elif arg[0] == 'unblock-threads': + self.unblock_threads = arg[1] in ('t', '#t') + elif arg[0] == 'parameters': + for parg in arg[1:]: + ptype = parg[0] + pname = parg[1] + pdflt = None + pnull = 0 + for farg in parg[2:]: + if farg[0] == 'default': + pdflt = farg[1] + elif farg[0] == 'null-ok': + pnull = 1 + self.params.append(Parameter(ptype, pname, pdflt, pnull)) + elif arg[0] == 'properties': + if self.is_constructor_of is None: + print >> sys.stderr, "Warning: (properties ...) "\ + "is only valid for constructors" + for prop in arg[1:]: + pname = prop[0] + optional = False + argname = pname + for farg in prop[1:]: + if farg[0] == 'optional': + optional = True + elif farg[0] == 'argname': + argname = farg[1] + self.params.append(Property(pname, optional, argname)) + elif arg[0] == 'varargs': + self.varargs = arg[1] in ('t', '#t') + elif arg[0] == 'deprecated': + self.deprecated = arg[1] + else: + sys.stderr.write("Warning: %s argument unsupported\n" + % (arg[0],)) + dump = 1 + if dump: + self.write_defs(sys.stderr) + + if self.caller_owns_return is None and self.ret is not None: + self.guess_return_value_ownership() + for item in ('c_name',): + if self.__dict__[item] == None: + self.write_defs(sys.stderr) + raise RuntimeError, "definition missing required %s" % (item,) + + _method_write_defs = MethodDef.__dict__['write_defs'] + + def merge(self, old, parmerge): + self.caller_owns_return = old.caller_owns_return + self.varargs = old.varargs + if not parmerge: + self.params = copy.deepcopy(old.params) + return + # here we merge extra parameter flags accross to the new object. + def merge_param(param): + for old_param in old.params: + if old_param.pname == param.pname: + if isinstance(old_param, Property): + # h2def never scans Property's, therefore if + # we have one it was manually written, so we + # keep it. + return copy.deepcopy(old_param) + else: + param.merge(old_param) + return param + raise RuntimeError, "could not find %s in old_parameters %r" % ( + param.pname, [p.pname for p in old.params]) + try: + self.params = map(merge_param, self.params) + except RuntimeError: + # parameter names changed and we can't find a match; it's + # safer to keep the old parameter list untouched. + self.params = copy.deepcopy(old.params) + + if not self.is_constructor_of: + try: + self.is_constructor_of = old.is_constructor_of + except AttributeError: + pass + if isinstance(old, MethodDef): + self.name = old.name + # transmogrify from function into method ... + self.write_defs = self._method_write_defs + self.of_object = old.of_object + del self.params[0] + def write_defs(self, fp=sys.stdout): + fp.write('(define-function ' + self.name + '\n') + if self.in_module: + fp.write(' (in-module "' + self.in_module + '")\n') + if self.is_constructor_of: + fp.write(' (is-constructor-of "' + self.is_constructor_of +'")\n') + if self.c_name: + fp.write(' (c-name "' + self.c_name + '")\n') + if self.typecode: + fp.write(' (gtype-id "' + self.typecode + '")\n') + if self.caller_owns_return: + fp.write(' (caller-owns-return #t)\n') + if self.unblock_threads: + fp.write(' (unblock-threads #t)\n') + if self.ret: + fp.write(' (return-type "' + self.ret + '")\n') + if self.deprecated: + fp.write(' (deprecated "' + self.deprecated + '")\n') + if self.params: + if isinstance(self.params[0], Parameter): + fp.write(' (parameters\n') + for ptype, pname, pdflt, pnull in self.params: + fp.write(' \'("' + ptype + '" "' + pname +'"') + if pdflt: fp.write(' (default "' + pdflt + '")') + if pnull: fp.write(' (null-ok)') + fp.write(')\n') + fp.write(' )\n') + elif isinstance(self.params[0], Property): + fp.write(' (properties\n') + for prop in self.params: + fp.write(' \'("' + prop.pname +'"') + if prop.optional: fp.write(' (optional)') + fp.write(')\n') + fp.write(' )\n') + else: + assert False, "strange parameter list %r" % self.params[0] + if self.varargs: + fp.write(' (varargs #t)\n') + + fp.write(')\n\n') diff --git a/codegen/defsconvert.py b/codegen/defsconvert.py new file mode 100755 index 0000000..c3c2324 --- /dev/null +++ b/codegen/defsconvert.py @@ -0,0 +1,132 @@ +#! /usr/bin/env python + +import sys +import string, re + +# ------------------ Create typecodes from typenames --------- + +_upperstr_pat1 = re.compile(r'([^A-Z])([A-Z])') +_upperstr_pat2 = re.compile(r'([A-Z][A-Z])([A-Z][0-9a-z])') +_upperstr_pat3 = re.compile(r'^([A-Z])([A-Z])') + +def to_upper_str(name): + """Converts a typename to the equivalent upercase and underscores + name. This is used to form the type conversion macros and enum/flag + name variables""" + name = _upperstr_pat1.sub(r'\1_\2', name) + name = _upperstr_pat2.sub(r'\1_\2', name) + name = _upperstr_pat3.sub(r'\1_\2', name, count=1) + return string.upper(name) + +def typecode(typename): + """create a typecode (eg. GTK_TYPE_WIDGET) from a typename""" + return string.replace(to_upper_str(typename), '_', '_TYPE_', 1) + + +STATE_START = 0 +STATE_OBJECT = 1 +STATE_INTERFACE = 2 +STATE_BOXED = 3 +STATE_ENUM = 4 +STATE_FLAGS = 5 +STATE_METHOD = 6 +STATE_FUNCTION = 7 + +def convert(infp=sys.stdin, outfp=sys.stdout): + state = STATE_START + seen_params = 0 + + line = infp.readline() + while line: + if line[:8] == '(object ': + state = STATE_OBJECT + seen_params = 0 + outfp.write('(define-object ' + line[8:]) + elif line[:11] == '(interface ': + state = STATE_INTERFACE + seen_params = 0 + outfp.write('(define-interface ' + line[11:]) + elif line[:7] == '(boxed ': + state = STATE_BOXED + seen_params = 0 + outfp.write('(define-boxed ' + line[7:]) + elif line[:6] == '(enum ': + state = STATE_ENUM + seen_params = 0 + outfp.write('(define-enum ' + line[6:]) + elif line[:7] == '(flags ': + state = STATE_FLAGS + seen_params = 0 + outfp.write('(define-flags ' + line[7:]) + elif line[:8] == '(method ': + state = STATE_METHOD + seen_params = 0 + outfp.write('(define-method ' + line[8:]) + elif line[:10] == '(function ': + state = STATE_FUNCTION + seen_params = 0 + outfp.write('(define-function ' + line[10:]) + elif line[:13] == ' (in-module ': + outfp.write(re.sub(r'^(\s+\(in-module\s+)(\w+)(.*)$', + r'\1"\2"\3', line)) + elif line[:10] == ' (parent ': + outfp.write(re.sub(r'^(\s+\(parent\s+)(\w+)(\s+\((\w+)\))?(.*)$', + r'\1"\4\2"\5', line)) + elif line[:14] == ' (implements ': + outfp.write(re.sub(r'^(\s+\(implements\s+)([^\s]+)(\s*\))$', + r'\1"\2"\3', line)) + elif line[:13] == ' (of-object ': + outfp.write(re.sub(r'^(\s+\(of-object\s+)(\w+)(\s+\((\w+)\))?(.*)$', + r'\1"\4\2"\5', line)) + elif line[:10] == ' (c-name ': + outfp.write(re.sub(r'^(\s+\(c-name\s+)([^\s]+)(\s*\))$', + r'\1"\2"\3', line)) + if state in (STATE_OBJECT, STATE_INTERFACE, STATE_BOXED, + STATE_ENUM, STATE_FLAGS): + c_name = re.match(r'^\s+\(c-name\s+([^\s]+)\s*\)$', + line).group(1) + outfp.write(' (gtype-id "%s")\n' % typecode(c_name)) + elif line[:15] == ' (return-type ': + outfp.write(re.sub(r'^(\s+\(return-type\s+)([^\s]+)(\s*\))$', + r'\1"\2"\3', line)) + elif line[:13] == ' (copy-func ': + outfp.write(re.sub(r'^(\s+\(copy-func\s+)(\w+)(.*)$', + r'\1"\2"\3', line)) + elif line[:16] == ' (release-func ': + outfp.write(re.sub(r'^(\s+\(release-func\s+)(\w+)(.*)$', + r'\1"\2"\3', line)) + elif line[:9] == ' (field ': + if not seen_params: + outfp.write(' (fields\n') + seen_params = 1 + outfp.write(re.sub(r'^\s+\(field\s+\(type-and-name\s+([^\s]+)\s+([^\s]+)\s*\)\s*\)$', + ' \'("\\1" "\\2")', line)) + elif line[:9] == ' (value ': + if not seen_params: + outfp.write(' (values\n') + seen_params = 1 + outfp.write(re.sub(r'^\s+\(value\s+\(name\s+([^\s]+)\)\s+\(c-name\s+([^\s]+)\s*\)\s*\)$', + ' \'("\\1" "\\2")', line)) + elif line[:13] == ' (parameter ': + if not seen_params: + outfp.write(' (parameters\n') + seen_params = 1 + outfp.write(re.sub(r'^\s+\(parameter\s+\(type-and-name\s+([^\s]+)\s+([^\s]+)\s*\)(\s*.*)\)$', + ' \'("\\1" "\\2"\\3)', line)) + elif line[:11] == ' (varargs ': + if seen_params: + outfp.write(' )\n') + seen_params = 0 + outfp.write(' (varargs #t)\n') + elif line[0] == ')': + if seen_params: + outfp.write(' )\n') + seen_params = 0 + state = STATE_START + outfp.write(line) + else: + outfp.write(line) + line = infp.readline() + +if __name__ == '__main__': + convert() diff --git a/codegen/defsgen.py b/codegen/defsgen.py new file mode 100755 index 0000000..6c2e63d --- /dev/null +++ b/codegen/defsgen.py @@ -0,0 +1,737 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# +# Copyright (C) 2006-2009 John Finlay. +# +# Scan the given public .h files of a GTK module (or module using +# GTK object conventions) and generates a set of scheme defs. +# +# defsgen uses the ctypes module to extract information from the installed +# module library (or libraries) to generate the object, interface, function, +# method, virtual, enum and flags defs. defsgen uses the gobject library +# g_type_* functions. defsgen will try to open the "libgobject-2.0.so" library +# if one is not specified on the command line. +# +# Basically the operation of defsgen is: +# +# - open and initialize the gobject and module libraries +# - read each .h file into a buffer which is scrubbed of extraneous data +# - find all *_get_type() functions prototypes +# - look in the module libraries for the get_type symbols +# - if found run the get_type() function to retrieve the GType +# - find the parent type name and save the object info +# - find each function prototypes in the file and check if it has a symbol in +# the module libraries - save the info if found +# - extract the virtual prototypes from the Class or Iface structs and save +# - write out the various defs. +# +# The command line options are: +# +# -l --modulelib Adds the given module library name to the list to be used +# for finding symbols. Mor ethan one modulefile may be +# specified. (required) +# -L --libgobject Specifies the name of the gobject library (optional but +# must be specified if "libgobject-2.0.so" is not availble) +# -s --separate Create separate files for objects and function/method defs +# using the given name as the base name (optional). If this +# is not specified the combined object and function defs +# will be output to sys.stdout. +# -f --defsfile Extract defs from the given file to filter the output defs +# that is don't output defs that are defined in the +# defsfile. More than one deffile may be specified. +# -D --defines Include portions of the defsfile defs that are conditional +# on the given define, for example GDK_TARGET_X11. Only +# useful with the --defsfile option +# -m --modulename The prefix to be stripped from the front of function names +# for the given module +# -p --useprefix Use the modulename prefix as a hint to split names into +# module and name for object and enum defs. Also used for +# generating type codes. +# --onlyenums Only produce defs for enums and flags +# --onlyobjdefs Only produce defs for objects +# --onlyvirtuals Only produce defs for virtuals +# --genpropgetsets Experimental option to generate prop-getset annotations. +# Not supported by codegen.py and friends. +# +# Examples: +# +# python defsgen.py -m pango -l libpango-1.0.so \ +# /usr/local/include/pango-1.0/pango/*.h >/tmp/pango.defs +# +# - Outputs all defs for the pango module.using the library module +# libpango-1.0.so. +# +# python defsgen.py -m gdk -DGDK_TARGET_X11 -l libgdk-x11-2.0.so \ +# -l libgdk_pixbuf-2.0.so -s /tmp/gdk-2.10 \ +# -f /usr/tmp/pygtk/gtk/gdk-base.defs \ +# /usr/local/include/gtk-2.0/gdk/*.h \ +# /usr/local/include/gtk-2.0/gdk-pixbuf/*.h +# +# - Outputs the gdk module defs that are not contained in the defs file +# /usr/tmp/pygtk/gtk/gdk-base.defs. Two output files are created: +# /tmp/gdk-2.10-types.defs and /tmp/gdk-2.10.defs. +# +# Based on the original h2def.py program by +# Toby D. Reeves and +# modified by James Henstridge to output stuff in +# Havoc's new defs format. Info on this format can be seen at: +# http://www.gnome.org/mailing-lists/archives/gtk-devel-list/2000-January/0085.shtml +# Updated to be PEP-8 compatible and refactored to use OOP +# Extensively modified by John Finlay to use ctypes module to extract GType +# info from the given library and to create virtual defines. +# + +import getopt +import os +import re, string +import sys +import ctypes +import defsparser + +#------------------ utility defs ----------------- + +_upperstr_pat1 = re.compile(r'([^A-Z])([A-Z])') +_upperstr_pat2 = re.compile(r'([A-Z][A-Z])([A-Z][0-9a-z])') +_upperstr_pat3 = re.compile(r'^([A-Z])([A-Z])') + +def to_upper_str(name): + """Converts a typename to the equivalent uppercase and underscores + name. This is used to form the type conversion macros and enum/flag + name variables""" + name = _upperstr_pat1.sub(r'\1_\2', name) + name = _upperstr_pat2.sub(r'\1_\2', name) + name = _upperstr_pat3.sub(r'\1_\2', name, count=1) + return name.upper() + +def typecode(typename, prefix, use_prefix): + """create a typecode (eg. GTK_TYPE_WIDGET) from a typename""" + tcode = to_upper_str(typename) + if (use_prefix and prefix and tcode.lower() != prefix + and tcode.lower().startswith(prefix)): + l = len(prefix) + tcode = tcode[:l] + '_TYPE' + tcode[l:] + else: + tcode = tcode.replace('_', '_TYPE_', 1) + return tcode + +_class_iface_pat = re.compile(r'\w+(Class|Iface)') + +def class_iface_sub(mobj): + '''Returns matched string if it matches a Class or Iface struct + otherwise returns the empty string''' + if not _class_iface_pat.match(mobj.group(1)): + return '' + return mobj.group(0) + +clean_patterns = [ + # strip comments + (re.compile(r'/\*.*?\*/', re.DOTALL), ''), + # compact continued lines + (re.compile(r"\\\n", re.MULTILINE), ''), + # remove preprocess directives + (re.compile(r"""^[#].*?$""", re.MULTILINE), ''), + # strip DECLS macros and Windows DLL API macros + (re.compile(r"""G_BEGIN_DECLS|BEGIN_LIBGTOP_DECLS|G_END_DECLS|[A-Z]+_API """, + re.MULTILINE), ''), + # remove extern "C" + (re.compile(r'^\s*(extern)\s+"C"\s+{', re.MULTILINE), ''), + # remove singleline typedefs of stucts + (re.compile(r'^typedef\s+struct\s*[^{;\n]*;\s*$', re.MULTILINE), ''), + # remove all struct definitons but those for object classes and interfaces + (re.compile(r'^struct\s+(\w+)\s+{[^}]+}\s*;\s*$', re.MULTILINE), + class_iface_sub), + # compress multiple whitespace + (re.compile(r'\s+', re.MULTILINE), ' '), + # clean up line ends + (re.compile(r';\s*', re.MULTILINE), '\n'), + (re.compile(r'^\s*', re.MULTILINE), ''), + # associate *, &, and [] with type instead of variable + (re.compile(r' \s* ([*|&]+) \s* ([(\w]+)', re.VERBOSE), r'\1 \2'), + (re.compile(r'\s+ (\w+) \[ \s* \]', re.VERBOSE), r'[] \1'), + # make return types that are const work. + (re.compile(r'\s*\*\s*G_CONST_RETURN\s*\*\s*'), '** '), + (re.compile(r'G_CONST_RETURN |const '), 'const-'), + # remove typedefs of callback types + (re.compile(r'^typedef\s+\w+\s*\*?\s*\(\s*\*\s*\w+\)\s*\([^(]*\)\n', + re.MULTILINE), ''), + #strip GSEAL macros from the middle of function declarations: + (re.compile(r"""GSEAL""", re.VERBOSE), '') + ] + +def clean_buffer(buf): + """Cleans out extraneous data leaving function prototypes, Class and Iface + structs.""" + for pat, subst in clean_patterns: + buf = pat.sub(subst, buf) + return buf + +# ------------------ utility classes ------------------------- + +class ObjDef(object): + def __init__(self, name, type_id, parent_name, parent_type, base_name): + self.name = name + self.type = type_id + self.parent_name = parent_name + self.parent_type = parent_type + self.base_name = base_name + self.props = [] + return + def __cmp__(self, other): + try: + res = cmp(self.name, other.name) + except AttributeError: + res = cmp(id(self), id(other)) + return res + def set_properties(self, gobj): + if self.base_name == 'GObject': + self.props = self._get_gobject_properties(gobj) + elif self.base_name == 'GInterface': + self.props = self._get_ginterface_properties(gobj) + + def _get_gobject_properties(self, gobj): + klass = gobj.g_type_class_ref(self.type) + num = ctypes.c_uint() + plist = gobj.g_object_class_list_properties(klass, ctypes.byref(num)) + props = [plist[i][0].name for i in range(num.value) + if self.name == gobj.g_type_name(plist[i][0].owner_type)] + return props + def _get_ginterface_properties(self, gobj): + iface = gobj.g_type_default_interface_ref(self.type) + num = ctypes.c_uint() + plist = gobj.g_object_interface_list_properties(iface, + ctypes.byref(num)) + props = [plist[i][0].name for i in range(num.value)] + return props + +# ------------------ Find object definitions ----------------- + +split_prefix_pat = re.compile('([A-Z]+[a-z]*)([A-Za-z0-9]+)') + +get_type_pat = re.compile(r'''^\s*(GType|GtkType)\s+ +([a-z]\w+_get_type)\s*(\(void\)|\(\)).*$''', re.VERBOSE | re.MULTILINE) + +defkeys = 'GBoxed GInterface GObject gpointer GEnum GFlags' + +def find_defs(buf, gobj, modlib, defs): + """Find possible gobject, gboxed, interface, gpointer, enum and flags + definitions in header files.and find parent type.""" + # find all *_get_type() functions that may represent a GObject + for m in get_type_pat.findall(buf): + func_name = m[1] + for lib in modlib: + if hasattr(lib, func_name): + objtype = apply(getattr(lib, func_name)) + obj_name = gobj.g_type_name(objtype) + parent = gobj.g_type_parent(objtype) + parent_name = gobj.g_type_name(parent) + base_name = gobj.g_type_name(gobj.g_type_fundamental(parent)) + #if gobj.g_type_is_a(parent, gobj.GObject): + # base_name = 'GObject' + if base_name in defkeys: + obj = ObjDef(obj_name, objtype, parent_name, parent, + base_name) + obj.set_properties(gobj) + defs[obj.base_name].append(obj) + break + return + +# ------------------ Find function definitions ----------------- + +arg_split_pat = re.compile("\s*,\s*") + +proto_pat=re.compile(r"""^ +\s*((?:-|\w|\&|\*)+) # return type +\s+ # skip whitespace +([a-z]\w+)\s*[(] # match the function name until the opening ( +\s*(.*?)\s*[)].* # group the function arguments +$""", re.IGNORECASE|re.VERBOSE|re.MULTILINE) + +def find_func_defs(buf, modlib, deffile, defs, verbose): + '''Find function prototypes in buf that have symbols in modlib + and save in defs.''' + funcs = defs['funcs'][deffile] = [] + for m in proto_pat.findall(buf): + ret, func, args = m + if not True in [hasattr(lib, func) for lib in modlib]: + if verbose: + sys.stderr.write('no symbol for function: ' + func + + ' from file' + deffile + '\n') + else: + args = arg_split_pat.split(args) + args = [a.replace(' ','-', a.count(' ')-1) for a in args] + funcs.append((func, ret, args)) + return + +virtual_pat = re.compile(r'''^ +\s*((?:-|\w|\&|\*)+) # return type +\s* # skip whitespace +\(\s*\*\s* # opening ( +([a-z]\w+)\) # match the function name until the closing ) +\s*\(\s*([^)]*)\).* # group the function arguments +$''', re.VERBOSE|re.MULTILINE) + +class_iface_struct_pat = re.compile( + r'^struct\s+_(\w+)(?:Class|Iface)\s+{([^}]+)}\s*$', re.MULTILINE) + +def find_virt_defs(buf, deffile, defs): + '''Find virtual function prototypes in buf and save in defs.''' + virts = defs['virts'][deffile] = [] + # get the Class or Iface structs + for m in class_iface_struct_pat.findall(buf): + objname, virtuals = m + for v in virtual_pat.findall(virtuals): + ret, func, args = v + if 'reserved' in func or args == 'void': + continue + args = arg_split_pat.split(args) + args = [a.replace(' ','-', a.count(' ')-1) for a in args] + virts.append((func, ret, args, objname)) + return + +enum_pat = re.compile(r'^\s*typedef enum\s+{\s*([^}]*)}\s*([^\s]*)$', + re.MULTILINE) +values_splitter = re.compile(r'\s*,\s', re.MULTILINE) + +def find_enums(buf, defs): + for vals, name in enum_pat.findall(buf): + if name != 'GdkCursorType': + isflags = '<<' in vals + entries = [val.split()[0] for val in values_splitter.split(vals) + if val.strip()] + if entries: + defs['untypedenums'][name] = (isflags, entries) + return + +# ------------------ write definitions ----------------- + +type_pat = re.compile(r'(?:const-)?([A-Za-z0-9]+)\*?\s+') +pointer_pat = re.compile('(.*)\*$') +func_new_pat = re.compile('(\w+)_new$') +getset_pat = re.compile(r'^(?:get|set)_(.*)$') + +def split_prefix(cname, prefix, use_prefix): + # use the module prefix to split the cname + pre = prefix.replace('_', '') + if use_prefix and cname.lower().startswith(pre): + l = len(pre) + module = cname[:l] + name = cname[l:] + else: + m = split_prefix_pat.match(cname) + if m: + module = m.group(1) + name = m.group(2) + return module, name + +class DefsWriter: + def __init__(self, defs, fp=None, prefix=None, verbose=False, + defsfiles=None, defines={}, genpropgetsets=False, + useprefix=False): + self.defs = defs + self.use_prefix = useprefix + self.objnames = reduce(list.__add__, + [[o.name for o in defs[base]] + for base in defkeys.split()[:3]]) + self.othernames = reduce(list.__add__, + [[o.name for o in defs[base]] + for base in defkeys.split()[3:]]) + self.objifacedefs = dict(reduce(list.__add__, + [[(o.name, o) for o in defs[base]] + for base in defkeys.split()[1:3]])) + self.fp = (fp, sys.stdout)[not fp] + self.prefix = prefix + self.verbose = verbose + self.genpropgetsets = genpropgetsets + self._c_names={} + for defsfile in defsfiles: + filter = defsparser.DefsParser(defsfile, defines) + filter.startParsing() + self._c_names.update(filter.c_name) + for vdef in filter.virtuals: + self._c_names[vdef.of_object + '.' + vdef.name] = None + return + + def write_func_defs(self, deffiles, onlyvirts=False): + filter = self._c_names + for deffile in deffiles: + self.fp.write('\n;; From %s\n\n' % os.path.basename(deffile)) + if not onlyvirts: + for func, ret, args in self.defs['funcs'][deffile]: + if not func in filter: + self._write_func(func, ret, args) + for virt, ret, args, objname in self.defs['virts'][deffile]: + if not objname + '.' + virt in filter: + self._write_virt(objname, virt, ret, args) + self.fp.write('\n') + return + + def write_enum_defs(self, fp=None): + fp = (fp, self.fp)[not fp] + klassptrs = {'GEnum':ctypes.POINTER(EnumClass), + 'GFlags':ctypes.POINTER(FlagsClass)} + filter = self._c_names + objs = self.defs['GEnum'] + self.defs ['GFlags'] + #objs.sort() + fp.write(';; Enumerations and Flags ...\n\n') + for obj in objs: + cname = name = obj.name + tcode = typecode(cname, self.prefix, self.use_prefix) + if cname in filter: + continue + if cname in self.defs['untypedenums']: + if tcode not in self.defs['typedefines']: + # no type define so skip and print as untyped enum + continue + self.defs['untypedenums'].pop(cname, None) + parent_name = obj.parent_name + klassptr = klassptrs[parent_name] + typename = parent_name.lower()[1:] + module = None + module, name = split_prefix(cname, self.prefix, self.use_prefix) + fp.write('(define-' + typename + ' ' + name + '\n') + if module: + fp.write(' (in-module "' + module + '")\n') + fp.write(' (c-name "' + cname + '")\n') + fp.write(' (gtype-id "' + tcode + '")\n') + fp.write(' (values\n') + classref = self.gobj.g_type_class_ref(obj.type) + itemclass = ctypes.cast(classref, klassptr).contents + for i in range(itemclass.n_values): + val = itemclass.values[i] + fp.write(' \'("%s" "%s")\n' % (val.value_nick, + val.value_name)) + fp.write(' )\n') + fp.write(')\n\n') + if self.defs['untypedenums']: + self.write_untyped_enum_defs(fp) + return + + def write_untyped_enum_defs(self, fp): + fp.write(';; Untyped enumerations and flags ...\n\n') + filter = self._c_names + for cname, (isflags, entries) in self.defs['untypedenums'].items(): + if filter and cname in filter: continue + module, name = split_prefix(cname, self.prefix, self.use_prefix) + if isflags: + fp.write('(define-flags ' + name + '\n') + else: + fp.write('(define-enum ' + name + '\n') + if module: + fp.write(' (in-module "' + module + '")\n') + fp.write(' (c-name "' + cname + '")\n') + preindex = entries[0].rfind('_') + for ent in entries[1:]: + while (preindex > 0 + and ent[:preindex] != entries[0][:preindex]): + preindex = ent[:preindex].rfind('_') + fp.write(' (values\n') + for ent in entries: + fp.write(' \'("%s" "%s")\n' % + (ent[preindex+1:].lower().replace('_', '-'), ent)) + fp.write(' )\n') + fp.write(')\n\n') + + + def _write_obj_helper(self, obj, fp): + base_name = obj.base_name.lower()[1:] + cmodule = None + cname = name = obj.name + type_id = obj.type + parent_name = obj.parent_name + cmodule, name = split_prefix(cname, self.prefix, self.use_prefix) + fp.write('(define-' + base_name + ' ' + name + '\n') + if cmodule: + fp.write(' (in-module "' + cmodule + '")\n') + if base_name == 'object': + fp.write(' (parent "' + parent_name + '")\n') + fp.write(' (c-name "' + cname + '")\n') + fp.write(' (gtype-id "' + + typecode(cname, self.prefix, self.use_prefix) + '")\n') + n = ctypes.c_uint() + ifaces = self.gobj.g_type_interfaces(type_id, ctypes.byref(n)) + for i in range(n.value): + iface_name = self.gobj.g_type_name(ifaces[i]) + if iface_name in self.interfaces: + fp.write(' (implements "%s")\n' % iface_name) + if base_name == 'interface': + prereq = self.gobj.g_type_interface_prerequisites(type_id, + ctypes.byref(n)) + for i in range(n.value): + fp.write(' (prerequisite "%s")\n' + % self.gobj.g_type_name(prereq[i])) + # should do something about accessible fields + fp.write(')\n\n') + return + + def write_obj_defs(self, fp=None): + fp = (fp, self.fp)[not fp] + fp.write(';; -*- scheme -*-\n') + filter = self._c_names + for base in defkeys.split()[:4]: + base_name = base.lower()[1:] + fp.write('; %s definitions ...\n\n' % base_name) + for obj in self.defs[base]: + if not obj.name in filter: + self._write_obj_helper(obj, fp) + return + + def _write_func(self, name, ret, args): + if len(args) >= 1: + # methods must have at least one argument + munged_name = name.replace('_', '') + m = type_pat.match(args[0]) + if m: + obj = m.group(1) + if munged_name.startswith(obj.lower()): + if obj not in self.othernames: + self._write_method(obj, name, ret, args) + return + fname = name + if self.prefix: + fname = re.sub('^'+self.prefix+'_', '', fname) + + # it is either a constructor or normal function + self.fp.write('(define-function ' + fname + '\n') + self.fp.write(' (c-name "' + name + '")\n') + + # Asume that a constructor function name + # ends with '_new' and it returns an object pointer. + m = func_new_pat.match(name) + r = pointer_pat.match(ret) + if m and r: + cname = '' + # get the type name by using the _get_type function + func = m.group(1) + '_get_type' + lib = [l for l in self.modlib if hasattr(l, func)] + if lib: + cname = self.gobj.g_type_name(apply(getattr(lib[0], func))) + if cname and self.gobj.g_type_from_name(r.group(1)): + self.fp.write(' (is-constructor-of "' + cname + '")\n') + self._write_return(ret) + self._write_arguments(args) + return + + def _write_method(self, obj, name, ret, args): + regex = ''.join([c+'_?' for c in obj.lower()]) + mname, count = re.subn(regex, '', name, 1) + if not count and self.prefix: + mname = re.sub('^'+self.prefix+'_', '', mname) + self.fp.write('(define-method ' + mname + '\n') + self.fp.write(' (of-object "' + obj + '")\n') + self.fp.write(' (c-name "' + name + '")\n') + m = getset_pat.match(mname) + if self.genpropgetsets and m and len(args[1:]) <= 1: + prop = m.group(1) + if obj in self.objifacedefs: + oidef = self.objifacedefs[obj] + if prop.replace('_', '-') in oidef.props: + self.fp.write(' (prop-getset "' + prop + '")\n') + self._write_return(ret) + self._write_arguments(args[1:]) + return + + def _write_virt(self, obj, name, ret, args): + self.fp.write('(define-virtual ' + name + '\n') + self.fp.write(' (of-object "' + obj + '")\n') + self._write_return(ret) + self._write_arguments(args[1:]) + return + + def _write_return(self, ret): + if ret == 'void': + ret = 'none' + self.fp.write(' (return-type "' + ret + '")\n') + return + + def _write_arguments(self, args): + if args and not 'void' in args: + varargs = '' + self.fp.write(' (parameters\n') + for arg in args: + if arg == '...': + varargs = ' (varargs #t)\n' + else: + tupleArg = tuple(arg.split()) + if len(tupleArg) == 2: + self.fp.write(' \'("%s" "%s")\n' % tupleArg) + self.fp.write(' )\n' + varargs) + self.fp.write(')\n\n') + +# ---------- ctypes support classes for gobject library functions ---------- + +GType = ctypes.c_uint + +class GTypeClass(ctypes.Structure): + _fields_ = [('g_type', GType)] + +class GTypeInstance(ctypes.Structure): + _fields_ = [('g_class', ctypes.POINTER(GTypeClass))] + +class EnumValue(ctypes.Structure): + _fields_ = [('value', ctypes.c_int), + ('value_name', ctypes.c_char_p), + ('value_nick', ctypes.c_char_p)] + +class FlagsValue(ctypes.Structure): + _fields_ = [('value', ctypes.c_uint), + ('value_name', ctypes.c_char_p), + ('value_nick', ctypes.c_char_p)] + +class EnumClass(ctypes.Structure): + _fields_ = [('g_type_class', GTypeClass), + ('minimum', ctypes.c_int), + ('maximum', ctypes.c_int), + ('n_values', ctypes.c_uint), + ('values', ctypes.POINTER(EnumValue))] + +class FlagsClass(ctypes.Structure): + _fields_ = [('g_type_class', GTypeClass), + ('mask', ctypes.c_uint), + ('n_values', ctypes.c_uint), + ('values', ctypes.POINTER(FlagsValue))] + +class GTypeInterface(ctypes.Structure): + _fields_ = [('g_type', GType), + ('g_instance_type', GType)] + +class GParamSpec(ctypes.Structure): + _fields_ = [('g_type_instance', GTypeInstance), + ('name', ctypes.c_char_p), + ('flags', ctypes.c_uint), + ('value_type', GType), + ('owner_type', GType)] + +# ------------------ Main function ----------------- + +def main(args): + verbose = False + all = True + onlyenums = False + onlyobjdefs = False + onlyvirtuals = False + separate = False + modulename = None + defsfiles = [] + libgobject = None + modulelibs = [] + defines = {} + genpropgetsets = False + use_prefix = False + opts, args = getopt.getopt(args[1:], 'vs:m:f:D:L:l:p', + ['onlyenums', 'onlyobjdefs', 'onlyvirtuals', + 'modulename=', 'separate=', + 'defsfile=', 'defines=', 'genpropgetsets', + 'libgobject-', 'modulelib=', 'useprefix']) + for o, v in opts: + if o == '-v': + verbose = True + if o == '--onlyenums': + onlyenums = True + all = False + if o == '--onlyvirtuals': + onlyvirtuals = True + all = False + if o == '--onlyobjdefs': + onlyobjdefs = True + all = False + if o in ('-p', '--useprefix'): + use_prefix = True + if o == '--genpropgetsets': + genpropgetsets = True + if o in ('-s', '--separate'): + separate = v + if o in ('-m', '--modulename'): + modulename = v + if o in ('-L', '--libgobject'): + libgobject = v + if o in ('-l', '--modulelib'): + modulelibs.append(v) + if o in ('-f', '--defsfile'): + defsfiles.append(v) + if o in ('-D', '--defines'): + nameval = v.split('=') + try: + defines[nameval[0]] = nameval[1] + except IndexError: + defines[nameval[0]] = None + + if not args[0:1]: + print 'Must specify at least one input file name' + return -1 + if not modulelibs: + print 'Must specify one or more modulelib names' + return -1 + + # load the gobject and module libraries and init the gtype system + if not libgobject: + if verbose: + sys.stderr.write('Using "libgobject-2.0.so" as the libobject' \ + 'library name by default\n') + gobj = ctypes.cdll.LoadLibrary('libgobject-2.0.so') + else: + gobj = ctypes.cdll.LoadLibrary(libgobject) + + modlib = [ctypes.cdll.LoadLibrary(lib) for lib in modulelibs] + + gobj.g_type_init() + gobj.g_type_name.restype = ctypes.c_char_p + gobj.g_type_from_name.argtypes = [ctypes.c_char_p] + gobj.g_type_interfaces.restype = ctypes.POINTER(ctypes.c_int) + gobj.g_type_interface_prerequisites.restype = ctypes.POINTER(ctypes.c_int) + gobj.g_object_class_list_properties.restype = ctypes.POINTER(ctypes.POINTER(GParamSpec)) + gobj.g_object_interface_list_properties.restype = ctypes.POINTER(ctypes.POINTER(GParamSpec)) + gobj.GObject = gobj.g_type_from_name('GObject') + gobj.g_object_new(gobj.GObject, None) + + defs = {} + for key in defkeys.split(): + defs[key] = [] + defs['funcs'] = {} + defs['virts'] = {} + defs['untypedenums'] = {} + defs['typedefines'] = [] + + # read in all the object and function definitions + args.sort() + type_define_pat = re.compile( + r'^#define\s+([A-Z]\S+_TYPE_\S+)\s+.*[a-z]\w+_get_type.*$', + re.MULTILINE) + for filename in args: + buf = open(filename).read() + defs['typedefines'] += type_define_pat.findall(buf) + buf = clean_buffer(buf) + find_enums(buf, defs) + find_defs(buf, gobj, modlib, defs) + find_func_defs(buf, modlib, filename, defs, verbose) + find_virt_defs(buf, filename, defs) + + for key in defkeys.split(): + defs[key].sort() + + methods = types = None + if separate: + methods = file(separate + '.defs', 'w') + types = file(separate + '-types.defs', 'w') + + dw = DefsWriter(defs, methods, prefix=modulename, verbose=verbose, + defsfiles=defsfiles, defines=defines, + genpropgetsets=genpropgetsets, useprefix=use_prefix) + dw.interfaces = [i.name for i in defs['GInterface']] + dw.gobj = gobj + dw.modlib = modlib + + if onlyobjdefs or all: + dw.write_obj_defs(types) + if separate: + print "Wrote object defs to %s-types.defs" % separate + if onlyenums or all: + dw.write_enum_defs(types) + if separate: + print "Wrote enum and flags defs to %s-types.defs" % separate + if onlyvirtuals or all: + dw.write_func_defs(args, onlyvirtuals) + if separate: + print "Wrote function and virtual defs to %s.defs" % separate + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/codegen/defsparser.py b/codegen/defsparser.py new file mode 100644 index 0000000..37ba0a2 --- /dev/null +++ b/codegen/defsparser.py @@ -0,0 +1,153 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +import os, sys +import scmexpr +from definitions import BoxedDef, EnumDef, FlagsDef, FunctionDef, \ + InterfaceDef, MethodDef, ObjectDef, PointerDef, VirtualDef + +include_path = ['.'] + +class IncludeParser(scmexpr.Parser): + """A simple parser that follows include statements automatically""" + def include(self, input_filename): + global include_path + if os.path.isabs(input_filename): + filename = input_filename + # set self.filename to the include name, to handle recursive includes + oldfile = self.filename + self.filename = filename + self.startParsing() + self.filename = oldfile + else: + inc_path = [os.path.dirname(self.filename)] + include_path + for filename in [os.path.join(path_entry, input_filename) + for path_entry in inc_path]: + if not os.path.exists(filename): + continue + # set self.filename to the include name, to handle recursive includes + oldfile = self.filename + self.filename = filename + self.startParsing() + self.filename = oldfile + break + else: + raise IOError("%s not found in include path %s" % (input_filename, inc_path)) + +class DefsParser(IncludeParser): + def __init__(self, arg, defines={}): + IncludeParser.__init__(self, arg) + self.objects = [] + self.interfaces = [] + self.enums = [] # enums and flags + self.boxes = [] # boxed types + self.pointers = [] # pointer types + self.functions = [] # functions and methods + self.virtuals = [] # virtual methods + self.c_name = {} # hash of c names of functions + self.methods = {} # hash of methods of particular objects + self.defines = defines # -Dfoo=bar options, as dictionary + + def define_object(self, *args): + odef = apply(ObjectDef, args) + self.objects.append(odef) + self.c_name[odef.c_name] = odef + def define_interface(self, *args): + idef = apply(InterfaceDef, args) + self.interfaces.append(idef) + self.c_name[idef.c_name] = idef + def define_enum(self, *args): + edef = apply(EnumDef, args) + self.enums.append(edef) + self.c_name[edef.c_name] = edef + def define_flags(self, *args): + fdef = apply(FlagsDef, args) + self.enums.append(fdef) + self.c_name[fdef.c_name] = fdef + def define_boxed(self, *args): + bdef = apply(BoxedDef, args) + self.boxes.append(bdef) + self.c_name[bdef.c_name] = bdef + def define_pointer(self, *args): + pdef = apply(PointerDef, args) + self.pointers.append(pdef) + self.c_name[pdef.c_name] = pdef + def define_function(self, *args): + fdef = apply(FunctionDef, args) + self.functions.append(fdef) + self.c_name[fdef.c_name] = fdef + def define_method(self, *args): + mdef = apply(MethodDef, args) + self.functions.append(mdef) + self.c_name[mdef.c_name] = mdef + def define_virtual(self, *args): + vdef = apply(VirtualDef, args) + self.virtuals.append(vdef) + def merge(self, old, parmerge): + for obj in self.objects: + if old.c_name.has_key(obj.c_name): + obj.merge(old.c_name[obj.c_name]) + for f in self.functions: + if old.c_name.has_key(f.c_name): + f.merge(old.c_name[f.c_name], parmerge) + + def printMissing(self, old): + for obj in self.objects: + if not old.c_name.has_key(obj.c_name): + obj.write_defs() + for f in self.functions: + if not old.c_name.has_key(f.c_name): + f.write_defs() + + def write_defs(self, fp=sys.stdout): + for obj in self.objects: + obj.write_defs(fp) + for enum in self.enums: + enum.write_defs(fp) + for boxed in self.boxes: + boxed.write_defs(fp) + for pointer in self.pointers: + pointer.write_defs(fp) + for func in self.functions: + func.write_defs(fp) + + def find_object(self, c_name): + for obj in self.objects: + if obj.c_name == c_name: + return obj + else: + raise ValueError('object %r not found' % c_name) + + def find_constructor(self, obj, overrides): + for func in self.functions: + if isinstance(func, FunctionDef) and \ + func.is_constructor_of == obj.c_name and \ + not overrides.is_ignored(func.c_name): + return func + + def find_methods(self, obj): + objname = obj.c_name + return filter(lambda func, on=objname: isinstance(func, MethodDef) and + func.of_object == on, self.functions) + + def find_virtuals(self, obj): + objname = obj.c_name + retval = filter(lambda func, on=objname: isinstance(func, VirtualDef) and + func.of_object == on, self.virtuals) + return retval + + def find_functions(self): + return filter(lambda func: isinstance(func, FunctionDef) and + not func.is_constructor_of, self.functions) + + def ifdef(self, *args): + if args[0] in self.defines: + for arg in args[1:]: + #print >> sys.stderr, "-----> Handling conditional definition (%s): %s" % (args[0], arg) + self.handle(arg) + else: + pass + #print >> sys.stderr, "-----> Conditional %s is not true" % (args[0],) + + def ifndef(self, *args): + if args[0] not in self.defines: + for arg in args[1:]: + self.handle(arg) diff --git a/codegen/docextract.py b/codegen/docextract.py new file mode 100644 index 0000000..eff8c5e --- /dev/null +++ b/codegen/docextract.py @@ -0,0 +1,448 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +'''Simple module for extracting GNOME style doc comments from C +sources, so I can use them for other purposes.''' + +import sys, os, string, re + +__all__ = ['extract'] + +class GtkDoc: + def __init__(self): + self.name = None + self.block_type = '' # The block type ('function', 'signal', 'property') + self.params = [] + self.annotations = [] + self.description = '' + self.ret = ('', []) # (return, annotations) + def set_name(self, name): + self.name = name + def set_type(self, block_type): + self.block_type = block_type + def get_type(self): + return self.block_type + def add_param(self, name, description, annotations=[]): + if name == '...': + name = 'Varargs' + self.params.append((name, description, annotations)) + def append_to_last_param(self, extra): + self.params[-1] = (self.params[-1][0], self.params[-1][1] + extra, + self.params[-1][2]) + def append_to_named_param(self, name, extra): + for i in range(len(self.params)): + if self.params[i][0] == name: + self.params[i] = (name, self.params[i][1] + extra, + self.params[i][2]) + return + # fall through to adding extra parameter ... + self.add_param(name, extra) + def add_annotation(self, annotation): + self.annotations.append(annotation) + def get_annotations(self): + return self.annotations + def append_to_description(self, extra): + self.description = self.description + extra + def get_description(self): + return self.description + def add_return(self, first_line, annotations=[]): + self.ret = (first_line, annotations) + def append_to_return(self, extra): + self.ret = (self.ret[0] + extra, self.ret[1]) + +comment_start_pattern = re.compile(r'^\s*/\*\*\s') +comment_end_pattern = re.compile(r'^\s*\*+/') +comment_line_lead_pattern = re.compile(r'^\s*\*\s*') +comment_empty_line_pattern = re.compile(r'^\s*\**\s*$') +function_name_pattern = re.compile(r'^([a-z]\w*)\s*:?(\s*\(.*\)\s*){0,2}\s*$') +signal_name_pattern = re.compile(r'^([A-Z]\w+::[a-z0-9-]+)\s*:?(\s*\(.*\)\s*){0,2}\s*$') +property_name_pattern = re.compile(r'^([A-Z]\w+:[a-z0-9-]+)\s*:?(\s*\(.*\)\s*){0,2}\s*$') +return_pattern = re.compile(r'^@?(returns:|return\s+value:)(.*\n?)$', re.IGNORECASE) +deprecated_pattern = re.compile(r'^(deprecated\s*:\s*.*\n?)$', re.IGNORECASE) +rename_to_pattern = re.compile(r'^(rename\s+to)\s*:\s*(.*\n?)$', re.IGNORECASE) +param_pattern = re.compile(r'^@(\S+)\s*:(.*\n?)$') +# Used to extract the annotations in the parameter and return descriptions +# extracted using above [param|return]_pattern patterns. +annotations_pattern = re.compile(r'^(?:(\s*\(.*\)\s*)*:)') +# Used to construct the annotation lists. +annotation_lead_pattern = re.compile(r'^\s*\(\s*(.*?)\s*\)\s*') + +# These patterns determine the identifier of the current comment block. They +# are grouped in a list for easy determination of block identifiers (in +# skip_to_identifier). The function_name_pattern should be tested for last +# because it always matches signal and property identifiers. +identifier_patterns = [ signal_name_pattern, property_name_pattern, function_name_pattern ] + +# This pattern is to match return sections that forget to have a colon (':') +# after the initial 'Return' phrase. It is not included by default in the list +# of final sections below because a lot of function descriptions begin with +# 'Returns ...' and the process_description() function would stop right at that +# first line, thinking it is a return section. +no_colon_return_pattern = re.compile(r'^@?(returns|return\s+value)\s*(.*\n?)$', re.IGNORECASE) +since_pattern = re.compile(r'^(since\s*:\s*.*\n?)$', re.IGNORECASE) + +# These patterns normally will be encountered after the description. Knowing +# the order of their appearance is difficult so this list is used to test when +# one begins and the other ends when processing the rest of the sections after +# the description. +final_section_patterns = [ return_pattern, since_pattern, deprecated_pattern, rename_to_pattern ] + +def parse_file(fp, doc_dict): + line = fp.readline() + while line: + cur_doc = GtkDoc() + line = skip_to_comment_block(fp, line) + line = skip_to_identifier(fp, line, cur_doc) + # See if the identifier is found (stored in the current GtkDoc by + # skip_to_identifier). If so, continue reading the rest of the comment + # block. + if cur_doc.name: + line = process_params(fp, line, cur_doc) + line = process_description(fp, line, cur_doc) + line = process_final_sections(fp, line, cur_doc) + # Add the current doc block to the dictionary of doc blocks. + doc_dict[cur_doc.name] = cur_doc + +# Given a list of annotations as string of the form +# '(annotation1) (annotation2) ...' return a list of annotations of the form +# [ (name1, value1), (name2, value2) ... ]. Not all annotations have values so +# the values in the list of tuples could be empty (''). +def get_annotation_list(annotations): + annotation_list = [] + while annotations: + match = annotation_lead_pattern.match(annotations) + if match: + annotation_contents = match.group(1) + name, split, value = annotation_contents.strip().partition(' ') + annotation_list.append((name, value)) + # Remove first occurrence to continue processing. + annotations = annotation_lead_pattern.sub('', annotations) + else: + break + return annotation_list + +# Given a currently read line, test that line and continue reading until the +# beginning of a comment block is found or eof is reached. Return the last +# read line. +def skip_to_comment_block(fp, line): + while line: + if comment_start_pattern.match(line): + break + line = fp.readline() + return line + +# Given the current line in a comment block, continue skipping lines until a +# non-blank line in the comment block is found or until the end of the block +# (or eof) is reached. Returns the line where reading stopped. +def skip_to_nonblank(fp, line): + while line: + if not comment_empty_line_pattern.match(line): + break + line = fp.readline() + # Stop processing if eof or end of comment block is reached. + if not line or comment_end_pattern.match(line): + break + return line + +# Given the first line of a comment block (the '/**'), see if the next +# non-blank line is the identifier of the comment block. Stop processing if +# the end of the block or eof is reached. Store the identifier (if there is +# one) and its type ('function', 'signal' or 'property') in the given GtkDoc. +# Return the line where the identifier is found or the line that stops the +# processing (if eof or the end of the comment block is found first). +def skip_to_identifier(fp, line, cur_doc): + # Skip the initial comment block line ('/**') if not eof. + if line: line = fp.readline() + + # Now skip empty lines. + line = skip_to_nonblank(fp, line) + + # See if the first non-blank line is the identifier. + if line and not comment_end_pattern.match(line): + # Remove the initial ' * ' in comment block line and see if there is an + # identifier. + line = comment_line_lead_pattern.sub('', line) + for pattern in identifier_patterns: + match = pattern.match(line) + if match: + # Set the GtkDoc name. + cur_doc.set_name(match.group(1)) + # Get annotations and add them to the GtkDoc. + annotations = get_annotation_list(match.group(2)) + for annotation in annotations: + cur_doc.add_annotation(annotation) + # Set the GtkDoc type. + if pattern == signal_name_pattern: + cur_doc.set_type('signal') + elif pattern == property_name_pattern: + cur_doc.set_type('property') + elif pattern == function_name_pattern: + cur_doc.set_type('function') + return line + return line + +# Given a currently read line (presumably the identifier line), read the next +# lines, testing to see if the lines are part of parameter descriptions. If +# so, store the parameter descriptions in the given doc block. Stop on eof and +# return the last line that stops the processing. +def process_params(fp, line, cur_doc): + # Skip the identifier line if not eof. Also skip any blank lines in the + # comment block. Return if eof or the end of the comment block are + # encountered. + if line: line = fp.readline() + line = skip_to_nonblank(fp, line) + if not line or comment_end_pattern.match(line): + return line + + # Remove initial ' * ' in first non-empty comment block line. + line = comment_line_lead_pattern.sub('', line) + + # Now process possible parameters as long as no eof or the end of the + # param section is not reached (which could be triggered by anything that + # doesn't match a '@param:..." line, even the end of the comment block). + match = param_pattern.match(line) + while line and match: + description = match.group(2) + + # First extract the annotations from the description and save them. + annotations = [] + annotation_match = annotations_pattern.match(description) + if annotation_match: + annotations = get_annotation_list(annotation_match.group(1)) + # Remove the annotations from the description + description = annotations_pattern.sub('', description) + + # Default to appending lines to current parameter. + append_func = cur_doc.append_to_last_param + + # See if the return has been included as part of the parameter + # section and make sure that lines are added to the GtkDoc return if + # so. + if match.group(1).lower() == "returns": + cur_doc.add_return(description, annotations) + append_func = cur_doc.append_to_return + # If not, just add it as a regular parameter. + else: + cur_doc.add_param(match.group(1), description, annotations) + + # Now read lines and append them until next parameter, beginning of + # description (an empty line), the end of the comment block or eof. + line = fp.readline() + while line: + # Stop processing if end of comment block or a blank comment line + # is encountered. + if comment_empty_line_pattern.match(line) or \ + comment_end_pattern.match(line): + break + + # Remove initial ' * ' in comment block line. + line = comment_line_lead_pattern.sub('', line) + + # Break from current param processing if a new one is + # encountered. + if param_pattern.match(line): break; + + # Otherwise, just append the current line and get the next line. + append_func(line) + line = fp.readline() + + # Re-evaluate match for while condition + match = param_pattern.match(line) + + # End by returning the current line. + return line + +# Having processed parameters, read the following lines into the description of +# the current doc block until the end of the comment block, the end of file or +# a return section is encountered. +def process_description(fp, line, cur_doc): + # First skip empty lines returning on eof or end of comment block. + line = skip_to_nonblank(fp, line) + if not line or comment_end_pattern.match(line): + return line + + # Remove initial ' * ' in non-empty comment block line. + line = comment_line_lead_pattern.sub('', line) + + # Also remove possible 'Description:' prefix. + if line[:12] == 'Description:': line = line[12:] + + # Used to tell if the previous line was blank and a return section + # uncommonly marked with 'Returns ...' instead of 'Returns: ...' has + # started (assume it is non-empty to begin with). + prev_line = 'non-empty' + + # Now read lines until a new section (like a return or a since section) is + # encountered. + while line: + # See if the description section has ended (if the line begins with + # 'Returns ...' and the previous line was empty -- this loop replaces + # empty lines with a newline). + if no_colon_return_pattern.match(line) and prev_line == '\n': + return line + # Or if one of the patterns of the final sections match + for pattern in final_section_patterns: + if pattern.match(line): + return line + + # If not, append lines to description in the doc comment block. + cur_doc.append_to_description(line) + + prev_line = line + line = fp.readline() + + # Stop processing on eof or at the end of comment block. + if not line or comment_end_pattern.match(line): + return line + + # Remove initial ' * ' in line so that the text can be appended to the + # description of the comment block and make sure that if the line is + # empty it be interpreted as a newline. + line = comment_line_lead_pattern.sub('', line) + if not line: line = '\n' + +# Given the line that ended the description (the first line of one of the final +# sections) process the final sections ('Returns:', 'Since:', etc.) until the +# end of the comment block or eof. Return the line that ends the processing. +def process_final_sections(fp, line, cur_doc): + while line and not comment_end_pattern.match(line): + # Remove leading ' * ' from current non-empty comment line. + line = comment_line_lead_pattern.sub('', line) + # Temporarily append the no colon return pattern to the final section + # patterns now that the description has been processed. It will be + # removed after the for loop below executes so that future descriptions + # that begin with 'Returns ...' are not interpreted as a return + # section. + final_section_patterns.append(no_colon_return_pattern) + for pattern in final_section_patterns: + match = pattern.match(line) + if match: + if pattern == return_pattern or \ + pattern == no_colon_return_pattern: + # Dealing with a 'Returns:' so first extract the + # annotations from the description and save them. + description = match.group(2) + annotations = [] + annotation_match = \ + annotations_pattern.match(description) + if annotation_match: + annotations = \ + get_annotation_list(annotation_match.group(1)) + # Remove the annotations from the description + description = annotations_pattern.sub('', description) + + # Now add the return. + cur_doc.add_return(description, annotations) + # In case more lines need to be appended. + append_func = cur_doc.append_to_return + elif pattern == rename_to_pattern: + # Dealing with a 'Rename to:' section (GObjectIntrospection + # annotation) so no further lines will be appended but this + # single one (and only to the annotations). + append_func = None + cur_doc.add_annotation((match.group(1), + match.group(2))) + else: + # For all others ('Since:' and 'Deprecated:') just append + # the line to the description for now. + cur_doc.append_to_description(line) + # In case more lines need to be appended. + append_func = cur_doc.append_to_description + + # Stop final section pattern matching for loop since a match + # has already been found. + break + + # Remove the no colon return pattern (which was temporarily added in + # the just executed loop) from the list of final section patterns. + final_section_patterns.pop() + + line = fp.readline() + + # Now continue appending lines to current section until a new one is + # found or an eof or the end of the comment block is encountered. + finished = False + while not finished and line and \ + not comment_end_pattern.match(line): + # Remove leading ' * ' from line and make sure that if it is empty, + # it be interpreted as a newline. + line = comment_line_lead_pattern.sub('', line) + if not line: line = '\n' + + for pattern in final_section_patterns: + if pattern.match(line): + finished = True + break + + # Break out of loop if a new section is found (determined in above + # inner loop). + if finished: break + + # Now it's safe to append line. + if append_func: append_func(line) + + # Get the next line to continue processing. + line = fp.readline() + + return line + +def parse_dir(dir, doc_dict): + for file in os.listdir(dir): + if file in ('.', '..'): continue + path = os.path.join(dir, file) + if os.path.isdir(path): + parse_dir(path, doc_dict) + if len(file) > 2 and file[-2:] == '.c': + sys.stderr.write("Processing " + path + '\n') + parse_file(open(path, 'r'), doc_dict) + +def extract(dirs, doc_dict=None): + if not doc_dict: doc_dict = {} + for dir in dirs: + parse_dir(dir, doc_dict) + return doc_dict + +tmpl_section_pattern = re.compile(r'^$') +def parse_tmpl(fp, doc_dict): + cur_doc = None + + line = fp.readline() + while line: + match = tmpl_section_pattern.match(line) + if match: + cur_doc = None # new input shouldn't affect the old doc dict + sect_type = match.group(1) + sect_name = match.group(2) + + if sect_type == 'FUNCTION': + cur_doc = doc_dict.get(sect_name) + if not cur_doc: + cur_doc = GtkDoc() + cur_doc.set_name(sect_name) + doc_dict[sect_name] = cur_doc + elif line == '\n': + cur_doc = None # don't worry about unused params. + elif cur_doc: + if line[:10] == '@Returns: ': + if string.strip(line[10:]): + cur_doc.append_to_return(line[10:]) + elif line[0] == '@': + pos = string.find(line, ':') + if pos >= 0: + cur_doc.append_to_named_param(line[1:pos], line[pos+1:]) + else: + cur_doc.append_to_description(line) + else: + cur_doc.append_to_description(line) + + line = fp.readline() + +def extract_tmpl(dirs, doc_dict=None): + if not doc_dict: doc_dict = {} + for dir in dirs: + for file in os.listdir(dir): + if file in ('.', '..'): continue + path = os.path.join(dir, file) + if os.path.isdir(path): + continue + if len(file) > 2 and file[-2:] == '.sgml': + parse_tmpl(open(path, 'r'), doc_dict) + return doc_dict diff --git a/codegen/docextract_to_xml.py b/codegen/docextract_to_xml.py new file mode 100755 index 0000000..7ac1053 --- /dev/null +++ b/codegen/docextract_to_xml.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# +# This litte script outputs the C doc comments to an XML format. +# So far it's only used by gtkmm (The C++ bindings). Murray Cumming. +# Usage example: +# # ./docextract_to_xml.py -s /gnome/head/cvs/gtk+/gtk/ -s /gnome/head/cvs/gtk+/docs/reference/gtk/tmpl/ > gtk_docs.xml + +import getopt +import re +import string +import sys + +import docextract + +def usage(): + sys.stderr.write('usage: docextract_to_xml.py ' + + '[-s /src/dir | --source-dir=/src/dir] ' + + '[-a | --with-annotations] [-p | --with-properties] ' + + '[-i | --with-signals ]\n') + sys.exit(1) + +# Translates special texts to &... HTML acceptable format. Also replace +# occurrences of '/*' and '*/' with '/ *' and '* /' respectively to avoid +# comment errors (note the spaces). Some function descriptions include C++ +# multi-line comments which cause errors when the description is included in a +# C++ Doxygen comment block. +def escape_text(unescaped_text): + # Escape every "&" not part of an entity reference + escaped_text = re.sub(r'&(?![A-Za-z]+;)', '&', unescaped_text) + + # These weird entities turn up in the output... + escaped_text = string.replace(escaped_text, '—', '—') + escaped_text = string.replace(escaped_text, '*', '*') + escaped_text = string.replace(escaped_text, '%', '%') + escaped_text = string.replace(escaped_text, '@', '@') + escaped_text = string.replace(escaped_text, '#', '#') + escaped_text = string.replace(escaped_text, ' ', ' ') + # This represents a '/' before or after an '*' so replace with slash but + # with spaces. + escaped_text = string.replace(escaped_text, '/', ' / ') + + # Escape for both tag contents and attribute values + escaped_text = string.replace(escaped_text, '<', '<') + escaped_text = string.replace(escaped_text, '>', '>') + escaped_text = string.replace(escaped_text, '"', '"') + + # Replace C++ comment begin and ends to ones that don't affect Doxygen. + escaped_text = string.replace(escaped_text, '/*', '/ *') + escaped_text = string.replace(escaped_text, '*/', '* /') + + return escaped_text + +def print_annotations(annotations): + for annotation in annotations: + print "" + \ + escape_text(annotation[1]) + "" + +if __name__ == '__main__': + try: + opts, args = getopt.getopt(sys.argv[1:], "d:s:o:api", + ["source-dir=", "with-annotations", + "with-properties", "with-signals"]) + except getopt.error, e: + sys.stderr.write('docextract_to_xml.py: %s\n' % e) + usage() + source_dirs = [] + with_annotations = False + with_signals = False + with_properties = False + for opt, arg in opts: + if opt in ('-s', '--source-dir'): + source_dirs.append(arg) + if opt in ('-a', '--with-annotations'): + with_annotations = True + if opt in ('-p', '--with-properties'): + with_properties = True + if opt in ('-i', '--with-signals'): + with_signals = True + if len(args) != 0: + usage() + + docs = docextract.extract(source_dirs); + docextract.extract_tmpl(source_dirs, docs); #Try the tmpl sgml files too. + + # print d.docs + + if docs: + + print "" + + for name, value in docs.items(): + # Get the type of comment block ('function', 'signal' or + # 'property') (the value is a GtkDoc). + block_type = value.get_type() + + # Skip signals if the option was not specified. + if block_type == 'signal' and not with_signals: + continue + # Likewise for properties. + elif block_type == 'property' and not with_properties: + continue + + print "<" + block_type + " name=\"" + escape_text(name) + "\">" + + print "" + print escape_text(value.get_description()) + print "" + + # Loop through the parameters if not dealing with a property: + if block_type != 'property': + print "" + for name, description, annotations in value.params: + print "" + print "" + escape_text(description) + "" + + if with_annotations: + print_annotations(annotations) + + print "" + + print "" + + # Show the return-type (also if not dealing with a property): + if with_annotations: + print "" + print "" + escape_text(value.ret[0]) + \ + "" + print_annotations(value.ret[1]) + print "" + else: + print "" + escape_text(value.ret[0]) + "" + + if with_annotations: + print_annotations(value.get_annotations()) + + print "\n" + + print "" diff --git a/codegen/docgen.py b/codegen/docgen.py new file mode 100755 index 0000000..b9e2f67 --- /dev/null +++ b/codegen/docgen.py @@ -0,0 +1,766 @@ +#!/usr/bin/env python +import getopt +import os +import re +import sys + +import definitions +import defsparser +import docextract +import override + + +class Node: + + def __init__(self, name, interfaces=[]): + self.name = name + self.interfaces = interfaces + self.subclasses = [] + + def add_child(self, node): + self.subclasses.append(node) + + +def build_object_tree(parser): + # reorder objects so that parent classes come first ... + objects = parser.objects[:] + pos = 0 + while pos < len(objects): + parent = objects[pos].parent + for i in range(pos+1, len(objects)): + if objects[i].c_name == parent: + objects.insert(i+1, objects[pos]) + del objects[pos] + break + else: + pos = pos + 1 + + root = Node(None) + nodes = {None: root} + for obj_def in objects: + parent_name = obj_def.parent + if parent_name == 'GObject': + parent_name = None + parent_node = nodes[parent_name] + node = Node(obj_def.c_name, obj_def.implements) + parent_node.add_child(node) + nodes[node.name] = node + + if parser.interfaces: + interfaces = Node('gobject.GInterface') + root.add_child(interfaces) + nodes[interfaces.name] = interfaces + for obj_def in parser.interfaces: + node = Node(obj_def.c_name) + interfaces.add_child(node) + nodes[node.name] = node + + if parser.boxes: + boxed = Node('gobject.GBoxed') + root.add_child(boxed) + nodes[boxed.name] = boxed + for obj_def in parser.boxes: + node = Node(obj_def.c_name) + boxed.add_child(node) + nodes[node.name] = node + + if parser.pointers: + pointers = Node('gobject.GPointer') + root.add_child(pointers) + nodes[pointers.name] = pointers + for obj_def in parser.pointers: + node = Node(obj_def.c_name) + pointers.add_child(node) + nodes[node.name] = node + + return root + + +class DocWriter: + + def __init__(self): + self._fp = None + # parse the defs file + self.parser = defsparser.DefsParser(()) + self.overrides = override.Overrides() + self.classmap = {} + self.docs = {} + + def add_sourcedirs(self, source_dirs): + self.docs = docextract.extract(source_dirs, self.docs) + + def add_tmpldirs(self, tmpl_dirs): + self.docs = docextract.extract_tmpl(tmpl_dirs, self.docs) + + def add_docs(self, defs_file, overrides_file, module_name): + '''parse information about a given defs file''' + self.parser.filename = defs_file + self.parser.startParsing(defs_file) + if overrides_file: + self.overrides.handle_file(overrides_file) + + for obj in (self.parser.objects + self.parser.interfaces + + self.parser.boxes + self.parser.pointers): + if not obj.c_name in self.classmap: + self.classmap[obj.c_name] = '%s.%s' % ( + module_name, obj.name) + + def pyname(self, name): + return self.classmap.get(name, name) + + def _compare(self, obja, objb): + return cmp(self.pyname(obja.c_name), self.pyname(objb.c_name)) + + def output_docs(self, output_prefix): + files = {} + + # class hierarchy + hierarchy = build_object_tree(self.parser) + filename = self.create_filename('hierarchy', output_prefix) + self._fp = open(filename, 'w') + self.write_full_hierarchy(hierarchy) + self._fp.close() + + obj_defs = (self.parser.objects + self.parser.interfaces + + self.parser.boxes + self.parser.pointers) + obj_defs.sort(self._compare) + + for obj_def in obj_defs: + filename = self.create_filename(obj_def.c_name, output_prefix) + self._fp = open(filename, 'w') + if isinstance(obj_def, definitions.ObjectDef): + self.output_object_docs(obj_def) + elif isinstance(obj_def, definitions.InterfaceDef): + self.output_interface_docs(obj_def) + elif isinstance(obj_def, definitions.BoxedDef): + self.output_boxed_docs(obj_def) + elif isinstance(obj_def, definitions.PointerDef): + self.output_boxed_docs(obj_def) + self._fp.close() + files[os.path.basename(filename)] = obj_def + + if not files: + return + + output_filename = self.create_toc_filename(output_prefix) + self._fp = open(output_filename, 'w') + self.output_toc(files) + self._fp.close() + + def output_object_docs(self, obj_def): + self.write_class_header(obj_def.c_name) + + self.write_heading('Synopsis') + self.write_synopsis(obj_def) + self.close_section() + + # construct the inheritence hierarchy ... + ancestry = [(obj_def.c_name, obj_def.implements)] + try: + parent = obj_def.parent + while parent != None: + if parent == 'GObject': + ancestry.append(('GObject', [])) + parent = None + else: + parent_def = self.parser.find_object(parent) + ancestry.append((parent_def.c_name, parent_def.implements)) + parent = parent_def.parent + except ValueError: + pass + ancestry.reverse() + self.write_heading('Ancestry') + self.write_hierarchy(obj_def.c_name, ancestry) + self.close_section() + + constructor = self.parser.find_constructor(obj_def, self.overrides) + if constructor: + self.write_heading('Constructor') + self.write_constructor(constructor, + self.docs.get(constructor.c_name, None)) + self.close_section() + + methods = self.parser.find_methods(obj_def) + methods = filter(lambda meth, self=self: + not self.overrides.is_ignored(meth.c_name), methods) + if methods: + self.write_heading('Methods') + for method in methods: + self.write_method(method, self.docs.get(method.c_name, None)) + self.close_section() + + self.write_class_footer(obj_def.c_name) + + def get_methods_for_object(self, obj_def): + methods = [] + for method in self.parser.find_methods(obj_def): + if not self.overrides.is_ignored(method.c_name): + methods.append(method) + return methods + + def output_interface_docs(self, int_def): + self.write_class_header(int_def.c_name) + + self.write_heading('Synopsis') + self.write_synopsis(int_def) + self.close_section() + + methods = self.get_methods_for_object(int_def) + if methods: + self.write_heading('Methods') + for method in methods: + self.write_method(method, self.docs.get(method.c_name, None)) + self.close_section() + self.write_class_footer(int_def.c_name) + + def output_boxed_docs(self, box_def): + self.write_class_header(box_def.c_name) + + self.write_heading('Synopsis') + self.write_synopsis(box_def) + self.close_section() + + constructor = self.parser.find_constructor(box_def, self.overrides) + if constructor: + self.write_heading('Constructor') + self.write_constructor(constructor, + self.docs.get(constructor.c_name, None)) + self.close_section() + + methods = self.get_methods_for_object(box_def) + if methods: + self.write_heading('Methods') + for method in methods: + self.write_method(method, self.docs.get(method.c_name, None)) + self.close_section() + + self.write_class_footer(box_def.c_name) + + def output_toc(self, files): + self._fp.write('TOC\n\n') + for filename in sorted(files): + obj_def = files[filename] + self._fp.write(obj_def.c_name + ' - ' + filename + '\n') + + # override the following to create a more complex output format + + def create_filename(self, obj_name, output_prefix): + '''Create output filename for this particular object''' + return output_prefix + '-' + obj_name.lower() + '.txt' + + def create_toc_filename(self, output_prefix): + return self.create_filename(self, 'docs', output_prefix) + + def write_full_hierarchy(self, hierarchy): + + def handle_node(node, indent=''): + for child in node.subclasses: + self._fp.write(indent + node.name) + if node.interfaces: + self._fp.write(' (implements ') + self._fp.write(', '.join(node.interfaces)) + self._fp.write(')\n') + else: + self._fp.write('\n') + handle_node(child, indent + ' ') + handle_node(hierarchy) + + def serialize_params(self, func_def): + params = [] + for param in func_def.params: + params.append(param[1]) + return ', '.join(params) + + # these need to handle default args ... + + def create_constructor_prototype(self, func_def): + return '%s(%s)' % (func_def.is_constructor_of, + self.serialize_params(func_def)) + + def create_function_prototype(self, func_def): + return '%s(%s)' % (func_def.name, + self.serialize_params(func_def)) + + def create_method_prototype(self, meth_def): + return '%s.%s(%s)' % (meth_def.of_object, + meth_def.name, + self.serialize_params(meth_def)) + + def write_class_header(self, obj_name): + self._fp.write('Class %s\n' % obj_name) + self._fp.write('======%s\n\n' % ('=' * len(obj_name))) + + def write_class_footer(self, obj_name): + pass + + def write_heading(self, text): + self._fp.write('\n' + text + '\n' + ('-' * len(text)) + '\n') + + def close_section(self): + pass + + def write_synopsis(self, obj_def): + self._fp.write('class %s' % obj_def.c_name) + if isinstance(obj_def, definitions.ObjectDef): + bases = [] + if obj_def.parent: + bases.append(obj_def.parent) + bases = bases = obj_def.implements + if bases: + self._fp.write('(%s)' % ', '.join(bases, )) + self._fp.write(':\n') + + constructor = self.parser.find_constructor(obj_def, self.overrides) + if constructor: + prototype = self.create_constructor_prototype(constructor) + self._fp.write(' def %s\n' % prototype) + + for method in self.get_methods_for_object(obj_def): + prototype = self.create_method_prototype(method) + self._fp.write(' def %s\n' % prototype) + + def write_hierarchy(self, obj_name, ancestry): + indent = '' + for name, interfaces in ancestry: + self._fp.write(indent + '+-- ' + name) + if interfaces: + self._fp.write(' (implements ') + self._fp.write(', '.join(interfaces)) + self._fp.write(')\n') + else: + self._fp.write('\n') + indent = indent + ' ' + self._fp.write('\n') + + def write_constructor(self, func_def, func_doc): + prototype = self.create_constructor_prototype(func_def) + self._fp.write(prototype + '\n\n') + for type, name, dflt, null in func_def.params: + self.write_parameter(name, func_doc) + self.write_return_value(func_def, func_doc) + if func_doc and func_doc.description: + self._fp.write(func_doc.description) + self._fp.write('\n\n\n') + + def write_method(self, meth_def, func_doc): + prototype = self.create_method_prototype(meth_def) + self._fp.write(prototype + '\n\n') + for type, name, dflt, null in meth_def.params: + self.write_parameter(name, func_doc) + self.write_return_value(meth_def, func_doc) + if func_doc and func_doc.description: + self._fp.write('\n') + self._fp.write(func_doc.description) + self._fp.write('\n\n') + + def write_parameter(self, param_name, func_doc): + if func_doc: + descr = func_doc.get_param_description(param_name) + else: + descr = 'a ' + type + self._fp.write(' ' + param_name + ': ' + descr + '\n') + + def write_return_value(self, meth_def, func_doc): + if meth_def.ret and meth_def.ret != 'none': + if func_doc and func_doc.ret: + descr = func_doc.ret + else: + descr = 'a ' + meth_def.ret + self._fp.write(' Returns: ' + descr + '\n') + +CLASS_HEADER_TEMPLATE = """ + + %(name)s + 3 + %(miscinfo)s + + + + %(name)s + + +""" +VARIABLE_TEMPLATE = """ + %(parameter)s : + %(description)s + +""" + +DOCBOOK_HEADER = """ + +""" + + +class DocbookDocWriter(DocWriter): + + def __init__(self): + DocWriter.__init__(self) + + self._function_pat = re.compile(r'(\w+)\s*\(\)') + self._parameter_pat = re.compile(r'\@(\w+)') + self._constant_pat = re.compile(r'\%(-?\w+)') + self._symbol_pat = re.compile(r'#([\w-]+)') + + self._transtable = ['-'] * 256 + # make string -> reference translation func + for digit in '0123456789': + self._transtable[ord(digit)] = digit + + for letter in 'abcdefghijklmnopqrstuvwxyz': + self._transtable[ord(letter)] = letter + self._transtable[ord(letter.upper())] = letter + self._transtable = ''.join(self._transtable) + + def create_filename(self, obj_name, output_prefix): + '''Create output filename for this particular object''' + stem = output_prefix + '-' + obj_name.lower() + return stem + '.xml' + + def create_toc_filename(self, output_prefix): + return self.create_filename('classes', output_prefix) + + def make_class_ref(self, obj_name): + return 'class-' + obj_name.translate(self._transtable) + + def make_method_ref(self, meth_def): + return 'method-%s--%s' % ( + meth_def.of_object.translate(self._transtable), + meth_def.name.translate(self._transtable)) + + def _format_function(self, match): + info = self.parser.c_name.get(match.group(1), None) + if info: + if isinstance(info, defsparser.FunctionDef): + return self._format_funcdef(info) + if isinstance(info, defsparser.MethodDef): + return self._format_method(info) + + # fall through through + return '%s()' % (match.group(1), ) + + def _format_funcdef(self, info): + if info.is_constructor_of is not None: + # should have a link here + return '%s()' % ( + self.pyname(info.is_constructor_of), ) + else: + return '%s()' % (info.name, ) + + def _format_param(self, match): + return '%s' % (match.group(1), ) + + def _format_const(self, match): + return '%s' % (match.group(1), ) + + def _format_method(self, info): + return ('' + '%s.%s' + '') % (self.make_method_ref(info), + self.pyname(info.of_object), + info.name) + + def _format_object(self, info): + return ('' + '%s' + '') % (self.make_class_ref(info.c_name), + self.pyname(info.c_name)) + + def _format_symbol(self, match): + info = self.parser.c_name.get(match.group(1), None) + if info: + if isinstance(info, defsparser.FunctionDef): + return self._format_funcdef(info) + elif isinstance(info, defsparser.MethodDef): + return self._format_method(info) + elif isinstance(info, (defsparser.ObjectDef, + defsparser.InterfaceDef, + defsparser.BoxedDef, + defsparser.PointerDef)): + return self._format_object(info) + + # fall through through + return '%s' % (match.group(1), ) + + def reformat_text(self, text, singleline=0): + # replace special strings ... + text = self._function_pat.sub(self._format_function, text) + text = self._parameter_pat.sub(self._format_param, text) + text = self._constant_pat.sub(self._format_const, text) + text = self._symbol_pat.sub(self._format_symbol, text) + + # don't bother with expansion for single line text. + if singleline: + return text + + lines = text.strip().split('\n') + for index in range(len(lines)): + if lines[index].strip() == '': + lines[index] = '\n' + continue + return '%s' % ('\n'.join(lines), ) + + # write out hierarchy + + def write_full_hierarchy(self, hierarchy): + + def handle_node(node, indent=''): + if node.name: + self._fp.write('%s%s' % + (indent, self.make_class_ref(node.name), + self.pyname(node.name))) + if node.interfaces: + self._fp.write(' (implements ') + for i in range(len(node.interfaces)): + self._fp.write('%s' % + (self.make_class_ref(node.interfaces[i]), + self.pyname(node.interfaces[i]))) + if i != len(node.interfaces) - 1: + self._fp.write(', ') + self._fp.write(')\n') + else: + self._fp.write('\n') + + indent = indent + ' ' + node.subclasses.sort(lambda a, b: + cmp(self.pyname(a.name), self.pyname(b.name))) + for child in node.subclasses: + handle_node(child, indent) + + self._fp.write(DOCBOOK_HEADER) + self._fp.write('') + handle_node(hierarchy) + self._fp.write('\n') + + # these need to handle default args ... + + def create_constructor_prototype(self, func_def): + xml = ['\n'] + xml.append(' __init__\n') + for type, name, dflt, null in func_def.params: + xml.append(' ') + xml.append(name) + xml.append('') + if dflt: + xml.append('') + xml.append(dflt) + xml.append('') + xml.append('\n') + if not func_def.params: + xml.append(' ') + xml.append(' ') + return ''.join(xml) + + def create_function_prototype(self, func_def): + xml = ['\n \n'] + xml.append(' ') + xml.append(func_def.name) + xml.append('\n') + for type, name, dflt, null in func_def.params: + xml.append(' ') + xml.append(name) + xml.append('') + if dflt: + xml.append('') + xml.append(dflt) + xml.append('') + xml.append('\n') + if not func_def.params: + xml.append(' \n ') + return ''.join(xml) + + def create_method_prototype(self, meth_def, addlink=0): + xml = ['\n'] + xml.append(' ') + if addlink: + xml.append('' % self.make_method_ref(meth_def)) + xml.append(self.pyname(meth_def.name)) + if addlink: + xml.append('') + xml.append('\n') + for type, name, dflt, null in meth_def.params: + xml.append(' ') + xml.append(name) + xml.append('') + if dflt: + xml.append('') + xml.append(dflt) + xml.append('') + xml.append('\n') + if not meth_def.params: + xml.append(' ') + xml.append(' ') + return ''.join(xml) + + def write_class_header(self, obj_name): + self._fp.write(DOCBOOK_HEADER) + self._fp.write(CLASS_HEADER_TEMPLATE % dict( + entryid=self.make_class_ref(obj_name), + name=self.pyname(obj_name), + miscinfo="PyGTK Docs")) + + def write_class_footer(self, obj_name): + self._fp.write('\n') + + def write_heading(self, text): + self._fp.write(' \n') + self._fp.write(' ' + text + '\n\n') + + def close_section(self): + self._fp.write(' \n') + + def write_synopsis(self, obj_def): + self._fp.write('\n') + self._fp.write(' %s\n' + % self.pyname(obj_def.c_name)) + if isinstance(obj_def, definitions.ObjectDef): + if obj_def.parent: + self._fp.write(' %s' + '\n' + % (self.make_class_ref(obj_def.parent), + self.pyname(obj_def.parent))) + for base in obj_def.implements: + self._fp.write(' %s' + '\n' + % (self.make_class_ref(base), self.pyname(base))) + elif isinstance(obj_def, definitions.InterfaceDef): + self._fp.write(' gobject.GInterface' + '\n') + elif isinstance(obj_def, definitions.BoxedDef): + self._fp.write(' gobject.GBoxed' + '\n') + elif isinstance(obj_def, definitions.PointerDef): + self._fp.write(' gobject.GPointer' + '\n') + + constructor = self.parser.find_constructor(obj_def, self.overrides) + if constructor: + self._fp.write( + '%s\n' % self.create_constructor_prototype(constructor)) + for method in self.get_methods_for_object(obj_def): + self._fp.write( + '%s\n' % self.create_method_prototype(method, addlink=1)) + self._fp.write('\n\n') + + def write_hierarchy(self, obj_name, ancestry): + self._fp.write('') + indent = '' + for name, interfaces in ancestry: + self._fp.write( + '%s+-- %s' % + (indent, self.make_class_ref(name), self.pyname(name))) + if interfaces: + self._fp.write(' (implements ') + for i in range(len(interfaces)): + self._fp.write('%s' % + (self.make_class_ref(interfaces[i]), + self.pyname(interfaces[i]))) + if i != len(interfaces) - 1: + self._fp.write(', ') + self._fp.write(')\n') + else: + self._fp.write('\n') + indent = indent + ' ' + self._fp.write('\n\n') + + def write_params(self, params, ret, func_doc): + if not params and (not ret or ret == 'none'): + return + self._fp.write(' \n') + for type, name, dflt, null in params: + if func_doc: + descr = func_doc.get_param_description(name).strip() + else: + descr = 'a ' + type + self._fp.write(VARIABLE_TEMPLATE % dict( + parameter=name, + description=self.reformat_text(descr, singleline=1))) + if ret and ret != 'none': + if func_doc and func_doc.ret: + descr = func_doc.ret.strip() + else: + descr = 'a ' + ret + self._fp.write(VARIABLE_TEMPLATE % dict( + parameter='Returns', + description=self.reformat_text(descr, singleline=1))) + self._fp.write(' \n') + + def write_constructor(self, func_def, func_doc): + prototype = self.create_constructor_prototype(func_def) + self._fp.write('%s\n' % prototype) + self.write_params(func_def.params, func_def.ret, func_doc) + + if func_doc and func_doc.description: + self._fp.write(self.reformat_text(func_doc.description)) + self._fp.write('\n\n\n') + + def write_method(self, meth_def, func_doc): + self._fp.write(' \n' % ( + self.make_method_ref(meth_def), )) + self._fp.write(' %s.%s\n\n' % ( + self.pyname(meth_def.of_object), + meth_def.name)) + prototype = self.create_method_prototype(meth_def) + self._fp.write('%s\n' % prototype) + self.write_params(meth_def.params, meth_def.ret, func_doc) + if func_doc and func_doc.description: + self._fp.write(self.reformat_text(func_doc.description)) + self._fp.write(' \n\n\n') + + def output_toc(self, files, fp=sys.stdout): + self._fp.write(DOCBOOK_HEADER) + + #self._fp.write('\n') + #self._fp.write(' Class Documentation\n') + #for filename, obj_def in files: + # self._fp.write('&' + + # obj_def.c_name.translate(self._transtable) + ';\n') + #self._fp.write('\n') + + self._fp.write('\n') + self._fp.write(' Class Reference\n') + for filename in sorted(files): + self._fp.write(' \n' % filename) + self._fp.write('\n') + + +def main(args): + try: + opts, args = getopt.getopt(args[1:], "d:s:o:", + ["defs-file=", "override=", "source-dir=", + "output-prefix="]) + except getopt.error, e: + sys.stderr.write('docgen.py: %s\n' % e) + sys.stderr.write( + 'usage: docgen.py -d file.defs [-s /src/dir] [-o output-prefix]\n') + return 1 + + defs_file = None + overrides_file = None + source_dirs = [] + output_prefix = 'docs' + for opt, arg in opts: + if opt in ('-d', '--defs-file'): + defs_file = arg + if opt in ('--override', ): + overrides_file = arg + elif opt in ('-s', '--source-dir'): + source_dirs.append(arg) + elif opt in ('-o', '--output-prefix'): + output_prefix = arg + if len(args) != 0 or not defs_file: + sys.stderr.write( + 'usage: docgen.py -d file.defs [-s /src/dir] [-o output-prefix]\n') + return 1 + + d = DocbookDocWriter() + d.add_sourcedirs(source_dirs) + d.add_docs(defs_file, overrides_file, 'gio') + d.output_docs(output_prefix) + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/codegen/h2def.py b/codegen/h2def.py new file mode 100755 index 0000000..17617fa --- /dev/null +++ b/codegen/h2def.py @@ -0,0 +1,631 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +# GPL'ed +# Toby D. Reeves +# +# Modified by James Henstridge to output stuff in +# Havoc's new defs format. Info on this format can be seen at: +# http://mail.gnome.org/archives/gtk-devel-list/2000-January/msg00070.html +# Updated to be PEP-8 compatible and refactored to use OOP +# +# Scan the given public .h files of a GTK module (or module using +# GTK object conventions) and generates a set of scheme defs. +# +# h2def searches through a header file looking for function prototypes and +# generates a scheme style defenition for each prototype. +# Basically the operation of h2def is: +# +# - read each .h file into a buffer which is scrubbed of extraneous data +# - find all object defenitions: +# - find all structures that may represent a GtkObject +# - find all structures that might represent a class +# - find all structures that may represent a GtkObject subclass +# - find all structures that might represent a class/Iface inherited from +# GTypeInterface +# - find all enum defenitions +# - write out the defs +# +# The command line options are: +# +# -s --separate Create separate files for objects and function/method defs +# using the given name as the base name (optional). If this +# is not specified the combined object and function defs +# will be output to sys.stdout. +# -f --defsfilter Extract defs from the given file to filter the output defs +# that is don't output defs that are defined in the +# defsfile. More than one deffile may be specified. +# -m --modulename The prefix to be stripped from the front of function names +# for the given module +# -n --namespace The module or namespace name to be used, for example +# WebKit where h2def is unable to detect the module name +# automatically. it also sets the gtype-id prefix. +# --onlyenums Only produce defs for enums and flags +# --onlyobjdefs Only produce defs for objects +# -v Verbose output +# +# Examples: +# +# python h2def.py /usr/local/include/pango-1.0/pango/*.h >/tmp/pango.defs +# +# - Outputs all defs for the pango module. +# +# python h2def.py -m gdk -s /tmp/gdk-2.10 \ +# -f /usr/tmp/pygtk/gtk/gdk-base.defs \ +# /usr/local/include/gtk-2.0/gdk/*.h \ +# /usr/local/include/gtk-2.0/gdk-pixbuf/*.h +# +# - Outputs the gdk module defs that are not contained in the defs file +# /usr/tmp/pygtk/gtk/gdk-base.defs. Two output files are created: +# /tmp/gdk-2.10-types.defs and /tmp/gdk-2.10.defs. +# +# python h2def.py -n WebKit /usr/incude/webkit-1.0/webkit/*.h \ +# >/tmp/webkit.defs +# +# - Outputs all the defs for webkit module, setting the module name to WebKit +# and the gtype-id prefix to WEBKIT_ which can't be detected automatically. +# + +import getopt +import os +import re +import string +import sys + +import defsparser + +# ------------------ Create typecodes from typenames --------- + +_upperstr_pat1 = re.compile(r'([^A-Z])([A-Z])') +_upperstr_pat2 = re.compile(r'([A-Z][A-Z])([A-Z][0-9a-z])') +_upperstr_pat3 = re.compile(r'^([A-Z])([A-Z])') + +def to_upper_str(name): + """Converts a typename to the equivalent upercase and underscores + name. This is used to form the type conversion macros and enum/flag + name variables""" + name = _upperstr_pat1.sub(r'\1_\2', name) + name = _upperstr_pat2.sub(r'\1_\2', name) + name = _upperstr_pat3.sub(r'\1_\2', name, count=1) + return string.upper(name) + +def typecode(typename, namespace=None): + """create a typecode (eg. GTK_TYPE_WIDGET) from a typename""" + if namespace: + return string.replace(string.upper(namespace) + "_" + to_upper_str(typename[len(namespace):]), '_', '_TYPE_', 1) + + return string.replace(to_upper_str(typename), '_', '_TYPE_', 1) + + +# ------------------ Find object definitions ----------------- +# Strips the comments from buffer +def strip_comments(buf): + parts = [] + lastpos = 0 + while 1: + pos = string.find(buf, '/*', lastpos) + if pos >= 0: + parts.append(buf[lastpos:pos]) + pos = string.find(buf, '*/', pos) + if pos >= 0: + lastpos = pos + 2 + else: + break + else: + parts.append(buf[lastpos:]) + break + return string.join(parts, '') + +# Strips the dll API from buffer, for example WEBKIT_API +def strip_dll_api(buf): + pat = re.compile("[A-Z]*_API ") + buf = pat.sub("", buf) + return buf + +obj_name_pat = "[A-Z][a-z]*[A-Z][A-Za-z0-9]*" + +split_prefix_pat = re.compile('([A-Z]+[a-z]*)([A-Za-z0-9]+)') + +def find_obj_defs(buf, objdefs=[]): + """ + Try to find object definitions in header files. + """ + + # filter out comments from buffer. + buf = strip_comments(buf) + + # filter out dll api + buf = strip_dll_api(buf) + + maybeobjdefs = [] # contains all possible objects from file + + # first find all structures that look like they may represent a GtkObject + pat = re.compile("struct\s+_(" + obj_name_pat + ")\s*{\s*" + + "(" + obj_name_pat + ")\s+", re.MULTILINE) + pos = 0 + while pos < len(buf): + m = pat.search(buf, pos) + if not m: break + maybeobjdefs.append((m.group(1), m.group(2))) + pos = m.end() + + # handle typedef struct { ... } style struct defs. + pat = re.compile("typedef struct\s+[_\w]*\s*{\s*" + + "(" + obj_name_pat + ")\s+[^}]*}\s*" + + "(" + obj_name_pat + ")\s*;", re.MULTILINE) + pos = 0 + while pos < len(buf): + m = pat.search(buf, pos) + if not m: break + maybeobjdefs.append((m.group(2), m.group(1))) + pos = m.end() + + # now find all structures that look like they might represent a class: + pat = re.compile("struct\s+_(" + obj_name_pat + ")Class\s*{\s*" + + "(" + obj_name_pat + ")Class\s+", re.MULTILINE) + pos = 0 + while pos < len(buf): + m = pat.search(buf, pos) + if not m: break + t = (m.group(1), m.group(2)) + # if we find an object structure together with a corresponding + # class structure, then we have probably found a GtkObject subclass. + if t in maybeobjdefs: + objdefs.append(t) + pos = m.end() + + pat = re.compile("typedef struct\s+[_\w]*\s*{\s*" + + "(" + obj_name_pat + ")Class\s+[^}]*}\s*" + + "(" + obj_name_pat + ")Class\s*;", re.MULTILINE) + pos = 0 + while pos < len(buf): + m = pat.search(buf, pos) + if not m: break + t = (m.group(2), m.group(1)) + # if we find an object structure together with a corresponding + # class structure, then we have probably found a GtkObject subclass. + if t in maybeobjdefs: + objdefs.append(t) + pos = m.end() + + # now find all structures that look like they might represent + # a class inherited from GTypeInterface: + pat = re.compile("struct\s+_(" + obj_name_pat + ")Class\s*{\s*" + + "GTypeInterface\s+", re.MULTILINE) + pos = 0 + while pos < len(buf): + m = pat.search(buf, pos) + if not m: break + t = (m.group(1), '') + t2 = (m.group(1)+'Class', 'GTypeInterface') + # if we find an object structure together with a corresponding + # class structure, then we have probably found a GtkObject subclass. + if t2 in maybeobjdefs: + objdefs.append(t) + pos = m.end() + + # now find all structures that look like they might represent + # an Iface inherited from GTypeInterface: + pat = re.compile("struct\s+_(" + obj_name_pat + ")Iface\s*{\s*" + + "GTypeInterface\s+", re.MULTILINE) + pos = 0 + while pos < len(buf): + m = pat.search(buf, pos) + if not m: break + t = (m.group(1), '') + t2 = (m.group(1)+'Iface', 'GTypeInterface') + # if we find an object structure together with a corresponding + # class structure, then we have probably found a GtkObject subclass. + if t2 in maybeobjdefs: + objdefs.append(t) + pos = m.end() + +def sort_obj_defs(objdefs): + objdefs.sort() # not strictly needed, but looks nice + pos = 0 + while pos < len(objdefs): + klass,parent = objdefs[pos] + for i in range(pos+1, len(objdefs)): + # parent below subclass ... reorder + if objdefs[i][0] == parent: + objdefs.insert(i+1, objdefs[pos]) + del objdefs[pos] + break + else: + pos = pos + 1 + return objdefs + +# ------------------ Find enum definitions ----------------- + +def find_enum_defs(buf, enums=[]): + # strip comments + # bulk comments + buf = strip_comments(buf) + + # strip dll api macros + buf = strip_dll_api(buf) + + # strip # directives + pat = re.compile(r"""^[#].*?$""", re.MULTILINE) + buf = pat.sub('', buf) + + buf = re.sub('\n', ' ', buf) + + enum_pat = re.compile(r'enum\s*{([^}]*)}\s*([A-Z][A-Za-z]*)(\s|;)') + splitter = re.compile(r'\s*,\s', re.MULTILINE) + pos = 0 + while pos < len(buf): + m = enum_pat.search(buf, pos) + if not m: break + + name = m.group(2) + vals = m.group(1) + isflags = string.find(vals, '<<') >= 0 + entries = [] + for val in splitter.split(vals): + if not string.strip(val): continue + entries.append(string.split(val)[0]) + if name != 'GdkCursorType': + enums.append((name, isflags, entries)) + + pos = m.end() + +# ------------------ Find function definitions ----------------- + +def clean_func(buf): + """ + Ideally would make buf have a single prototype on each line. + Actually just cuts out a good deal of junk, but leaves lines + where a regex can figure prototypes out. + """ + # bulk comments + buf = strip_comments(buf) + + # dll api + buf = strip_dll_api(buf) + + # compact continued lines + pat = re.compile(r"""\\\n""", re.MULTILINE) + buf = pat.sub('', buf) + + # Preprocess directives + pat = re.compile(r"""^[#].*?$""", re.MULTILINE) + buf = pat.sub('', buf) + + #typedefs, stucts, and enums + pat = re.compile(r"""^(typedef|struct|enum)(\s|.|\n)*?;\s*""", + re.MULTILINE) + buf = pat.sub('', buf) + + #strip DECLS macros + pat = re.compile(r"""G_BEGIN_DECLS|BEGIN_LIBGTOP_DECLS""", re.MULTILINE) + buf = pat.sub('', buf) + + #extern "C" + pat = re.compile(r"""^\s*(extern)\s+\"C\"\s+{""", re.MULTILINE) + buf = pat.sub('', buf) + + #multiple whitespace + pat = re.compile(r"""\s+""", re.MULTILINE) + buf = pat.sub(' ', buf) + + #clean up line ends + pat = re.compile(r""";\s*""", re.MULTILINE) + buf = pat.sub('\n', buf) + buf = buf.lstrip() + + #associate *, &, and [] with type instead of variable + #pat = re.compile(r'\s+([*|&]+)\s*(\w+)') + pat = re.compile(r' \s* ([*|&]+) \s* (\w+)', re.VERBOSE) + buf = pat.sub(r'\1 \2', buf) + pat = re.compile(r'\s+ (\w+) \[ \s* \]', re.VERBOSE) + buf = pat.sub(r'[] \1', buf) + + # make return types that are const work. + buf = re.sub(r'\s*\*\s*G_CONST_RETURN\s*\*\s*', '** ', buf) + buf = string.replace(buf, 'G_CONST_RETURN ', 'const-') + buf = string.replace(buf, 'const ', 'const-') + + #strip GSEAL macros from the middle of function declarations: + pat = re.compile(r"""GSEAL""", re.VERBOSE) + buf = pat.sub('', buf) + + return buf + +proto_pat=re.compile(r""" +(?P(-|\w|\&|\*)+\s*) # return type +\s+ # skip whitespace +(?P\w+)\s*[(] # match the function name until the opening ( +\s*(?P.*?)\s*[)] # group the function arguments +""", re.IGNORECASE|re.VERBOSE) +#""" +arg_split_pat = re.compile("\s*,\s*") + +get_type_pat = re.compile(r'(const-)?([A-Za-z0-9]+)\*?\s+') +pointer_pat = re.compile('.*\*$') +func_new_pat = re.compile('(\w+)_new$') + +class DefsWriter: + def __init__(self, fp=None, prefix=None, ns=None, verbose=False, + defsfilter=None): + if not fp: + fp = sys.stdout + + self.fp = fp + self.prefix = prefix + self.namespace = ns + self.verbose = verbose + + self._enums = {} + self._objects = {} + self._functions = {} + if defsfilter: + filter = defsparser.DefsParser(defsfilter) + filter.startParsing() + for func in filter.functions + filter.methods.values(): + self._functions[func.c_name] = func + for obj in filter.objects + filter.boxes + filter.interfaces: + self._objects[obj.c_name] = obj + for obj in filter.enums: + self._enums[obj.c_name] = obj + + def write_def(self, deffile): + buf = open(deffile).read() + + self.fp.write('\n;; From %s\n\n' % os.path.basename(deffile)) + self._define_func(buf) + self.fp.write('\n') + + def write_enum_defs(self, enums, fp=None): + if not fp: + fp = self.fp + + fp.write(';; Enumerations and flags ...\n\n') + trans = string.maketrans(string.uppercase + '_', + string.lowercase + '-') + filter = self._enums + for cname, isflags, entries in enums: + if filter: + if cname in filter: + continue + name = cname + module = None + if self.namespace: + module = self.namespace + name = cname[len(self.namespace):] + else: + m = split_prefix_pat.match(cname) + if m: + module = m.group(1) + name = m.group(2) + if isflags: + fp.write('(define-flags ' + name + '\n') + else: + fp.write('(define-enum ' + name + '\n') + if module: + fp.write(' (in-module "' + module + '")\n') + fp.write(' (c-name "' + cname + '")\n') + fp.write(' (gtype-id "' + typecode(cname, self.namespace) + '")\n') + prefix = entries[0] + for ent in entries: + # shorten prefix til we get a match ... + # and handle GDK_FONT_FONT, GDK_FONT_FONTSET case + while ((len(prefix) and prefix[-1] != '_') or ent[:len(prefix)] != prefix + or len(prefix) >= len(ent)): + prefix = prefix[:-1] + prefix_len = len(prefix) + fp.write(' (values\n') + for ent in entries: + fp.write(' \'("%s" "%s")\n' % + (string.translate(ent[prefix_len:], trans), ent)) + fp.write(' )\n') + fp.write(')\n\n') + + def write_obj_defs(self, objdefs, fp=None): + if not fp: + fp = self.fp + + fp.write(';; -*- scheme -*-\n') + fp.write('; object definitions ...\n') + + filter = self._objects + for klass, parent in objdefs: + if filter: + if klass in filter: + continue + if self.namespace: + cname = klass[len(self.namespace):] + cmodule = self.namespace + else: + m = split_prefix_pat.match(klass) + cname = klass + cmodule = None + if m: + cmodule = m.group(1) + cname = m.group(2) + fp.write('(define-object ' + cname + '\n') + if cmodule: + fp.write(' (in-module "' + cmodule + '")\n') + if parent: + fp.write(' (parent "' + parent + '")\n') + fp.write(' (c-name "' + klass + '")\n') + fp.write(' (gtype-id "' + typecode(klass, self.namespace) + '")\n') + # should do something about accessible fields + fp.write(')\n\n') + + def _define_func(self, buf): + buf = clean_func(buf) + buf = string.split(buf,'\n') + filter = self._functions + for p in buf: + if not p: + continue + m = proto_pat.match(p) + if m == None: + if self.verbose: + sys.stderr.write('No match:|%s|\n' % p) + continue + func = m.group('func') + if func[0] == '_': + continue + if filter: + if func in filter: + continue + ret = m.group('ret') + args = m.group('args') + args = arg_split_pat.split(args) + for i in range(len(args)): + spaces = string.count(args[i], ' ') + if spaces > 1: + args[i] = string.replace(args[i], ' ', '-', spaces - 1) + + self._write_func(func, ret, args) + + def _write_func(self, name, ret, args): + if len(args) >= 1: + # methods must have at least one argument + munged_name = name.replace('_', '') + m = get_type_pat.match(args[0]) + if m: + obj = m.group(2) + if munged_name[:len(obj)] == obj.lower(): + self._write_method(obj, name, ret, args) + return + + if self.prefix: + l = len(self.prefix) + if name[:l] == self.prefix and name[l] == '_': + fname = name[l+1:] + else: + fname = name + else: + fname = name + + # it is either a constructor or normal function + self.fp.write('(define-function ' + fname + '\n') + self.fp.write(' (c-name "' + name + '")\n') + + # Hmmm... Let's asume that a constructor function name + # ends with '_new' and it returns a pointer. + m = func_new_pat.match(name) + if pointer_pat.match(ret) and m: + cname = '' + for s in m.group(1).split ('_'): + cname += s.title() + if cname != '': + self.fp.write(' (is-constructor-of "' + cname + '")\n') + + self._write_return(ret) + self._write_arguments(args) + + def _write_method(self, obj, name, ret, args): + regex = string.join(map(lambda x: x+'_?', string.lower(obj)),'') + mname = re.sub(regex, '', name, 1) + if self.prefix: + l = len(self.prefix) + 1 + if mname[:l] == self.prefix and mname[l+1] == '_': + mname = mname[l+1:] + self.fp.write('(define-method ' + mname + '\n') + self.fp.write(' (of-object "' + obj + '")\n') + self.fp.write(' (c-name "' + name + '")\n') + self._write_return(ret) + self._write_arguments(args[1:]) + + def _write_return(self, ret): + if ret != 'void': + self.fp.write(' (return-type "' + ret + '")\n') + else: + self.fp.write(' (return-type "none")\n') + + def _write_arguments(self, args): + is_varargs = 0 + has_args = len(args) > 0 + for arg in args: + if arg == '...': + is_varargs = 1 + elif arg in ('void', 'void '): + has_args = 0 + if has_args: + self.fp.write(' (parameters\n') + for arg in args: + if arg != '...': + tupleArg = tuple(string.split(arg)) + if len(tupleArg) == 2: + self.fp.write(' \'("%s" "%s")\n' % tupleArg) + self.fp.write(' )\n') + if is_varargs: + self.fp.write(' (varargs #t)\n') + self.fp.write(')\n\n') + +# ------------------ Main function ----------------- + +def main(args): + verbose = False + onlyenums = False + onlyobjdefs = False + separate = False + modulename = None + namespace = None + defsfilter = None + opts, args = getopt.getopt(args[1:], 'vs:m:n:f:', + ['onlyenums', 'onlyobjdefs', + 'modulename=', 'namespace=', + 'separate=', 'defsfilter=']) + for o, v in opts: + if o == '-v': + verbose = True + if o == '--onlyenums': + onlyenums = True + if o == '--onlyobjdefs': + onlyobjdefs = True + if o in ('-s', '--separate'): + separate = v + if o in ('-m', '--modulename'): + modulename = v + if o in ('-n', '--namespace'): + namespace = v + if o in ('-f', '--defsfilter'): + defsfilter = v + + if not args[0:1]: + print 'Must specify at least one input file name' + return -1 + + # read all the object definitions in + objdefs = [] + enums = [] + for filename in args: + buf = open(filename).read() + find_obj_defs(buf, objdefs) + find_enum_defs(buf, enums) + objdefs = sort_obj_defs(objdefs) + + if separate: + methods = file(separate + '.defs', 'w') + types = file(separate + '-types.defs', 'w') + + dw = DefsWriter(methods, prefix=modulename, ns=namespace, + verbose=verbose, defsfilter=defsfilter) + dw.write_obj_defs(objdefs, types) + dw.write_enum_defs(enums, types) + print "Wrote %s-types.defs" % separate + + for filename in args: + dw.write_def(filename) + print "Wrote %s.defs" % separate + else: + dw = DefsWriter(prefix=modulename, ns=namespace, + verbose=verbose, defsfilter=defsfilter) + + if onlyenums: + dw.write_enum_defs(enums) + elif onlyobjdefs: + dw.write_obj_defs(objdefs) + else: + dw.write_obj_defs(objdefs) + dw.write_enum_defs(enums) + + for filename in args: + dw.write_def(filename) + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/codegen/mergedefs.py b/codegen/mergedefs.py new file mode 100755 index 0000000..773e499 --- /dev/null +++ b/codegen/mergedefs.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- + +import optparse + +import defsparser + +parser = optparse.OptionParser( + usage="usage: %prog [options] generated-defs old-defs") +parser.add_option("-p", "--merge-parameters", + help="Merge changes in function/methods parameter lists", + action="store_true", dest="parmerge", default=False) +(options, args) = parser.parse_args() + +if len(args) != 2: + parser.error("wrong number of arguments") + +newp = defsparser.DefsParser(args[0]) +oldp = defsparser.DefsParser(args[1]) + +newp.startParsing() +oldp.startParsing() + +newp.merge(oldp, options.parmerge) + +newp.write_defs() diff --git a/codegen/missingdefs.py b/codegen/missingdefs.py new file mode 100755 index 0000000..f0017e7 --- /dev/null +++ b/codegen/missingdefs.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- + +import sys +import defsparser + +if len(sys.argv) < 3: + sys.stderr.write("Usage: missingdefs.py generated-defs old-defs\n") + sys.exit(1) + +newp = defsparser.DefsParser(sys.argv[1]) +oldp = defsparser.DefsParser(sys.argv[2]) + +newp.startParsing() +oldp.startParsing() + +newp.printMissing(oldp) diff --git a/codegen/mkskel.py b/codegen/mkskel.py new file mode 100755 index 0000000..61f520b --- /dev/null +++ b/codegen/mkskel.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- + +import sys, os, getopt + +module_init_template = \ +'/* -*- Mode: C; c-basic-offset: 4 -*- */\n' + \ +'#ifdef HAVE_CONFIG_H\n' + \ +'# include "config.h"\n' + \ +'#endif\n' + \ +'#include \n' + \ +'#include \n' + \ +'\n' + \ +'/* include any extra headers needed here */\n' + \ +'\n' + \ +'void %(prefix)s_register_classes(PyObject *d);\n' + \ +'extern PyMethodDef %(prefix)s_functions[];\n' + \ +'\n' + \ +'DL_EXPORT(void)\n' + \ +'init%(module)s(void)\n' + \ +'{\n' + \ +' PyObject *m, *d;\n' + \ +'\n' + \ +' /* perform any initialisation required by the library here */\n' + \ +'\n' + \ +' m = Py_InitModule("%(module)s", %(prefix)s_functions);\n' + \ +' d = PyModule_GetDict(m);\n' + \ +'\n' + \ +' init_pygtk();\n' + \ +'\n' + \ +' %(prefix)s_register_classes(d);\n' + \ +'\n' + \ +' /* add anything else to the module dictionary (such as constants) */\n' +\ +'\n' + \ +' if (PyErr_Occurred())\n' + \ +' Py_FatalError("could not initialise module %(module)s");\n' + \ +'}\n' + +override_template = \ +'/* -*- Mode: C; c-basic-offset: 4 -*- */\n' + \ +'%%%%\n' + \ +'headers\n' + \ +'/* include any required headers here */\n' + \ +'%%%%\n' + \ +'init\n' + \ +' /* include any code here that needs to be executed before the\n' + \ +' * extension classes get initialised */\n' + \ +'%%%%\n' + \ +'\n' + \ +'/* you should add appropriate ignore, ignore-glob and\n' + \ +' * override sections here */\n' + +def open_with_backup(file): + if os.path.exists(file): + try: + os.rename(file, file+'~') + except OSError: + # fail silently if we can't make a backup + pass + return open(file, 'w') + +def write_skels(fileprefix, prefix, module): + fp = open_with_backup(fileprefix+'module.c') + fp.write(module_init_template % { 'prefix': prefix, 'module': module }) + fp.close() + fp = open_with_backup(fileprefix+'.override') + fp.write(override_template % { 'prefix': prefix, 'module': module }) + fp.close() + +if __name__ == '__main__': + opts, args = getopt.getopt(sys.argv[1:], 'f:p:m:h', + ['file-prefix=', 'prefix=', 'module=', 'help']) + fileprefix = None + prefix = None + module = None + for opt, arg in opts: + if opt in ('-f', '--file-prefix'): + fileprefix = arg + elif opt in ('-p', '--prefix'): + prefix = arg + elif opt in ('-m', '--module'): + module = arg + elif opt in ('-h', '--help'): + print 'usage: mkskel.py -f fileprefix -p prefix -m module' + sys.exit(0) + if not fileprefix or not prefix or not module: + print 'usage: mkskel.py -f fileprefix -p prefix -m module' + sys.exit(1) + write_skels(fileprefix, prefix, module) diff --git a/codegen/override.py b/codegen/override.py new file mode 100644 index 0000000..bba5e42 --- /dev/null +++ b/codegen/override.py @@ -0,0 +1,285 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- + +# this file contains code for loading up an override file. The override file +# provides implementations of functions where the code generator could not +# do its job correctly. + +import fnmatch +import os +import re +import string +import sys + +def class2cname(klass, method): + c_name = '' + for c in klass: + if c.isupper(): + c_name += '_' + c.lower() + else: + c_name += c + return c_name[1:] + '_' + method + +# import python_type as c_name [for arg_type] +# Last ('for') clause is optional. If present, the type will be +# imported only if given 'arg_type' is registered. +import_pat = re.compile(r'\s*import\s+(\S+)\.([^\s.]+)\s+as\s+(\S+)(\s+for\s+(\S+))?') + +class Overrides: + def __init__(self, filename=None): + self.modulename = None + self.ignores = {} + self.glob_ignores = [] + self.type_ignores = {} + self.overrides = {} + self.overridden = {} + self.kwargs = {} + self.noargs = {} + self.onearg = {} + self.staticmethod = {} + self.classmethod = {} + self.startlines = {} + self.override_attrs = {} + self.override_slots = {} + self.headers = '' + self.body = '' + self.init = '' + self.imports = [] + self.defines = {} + self.functions = {} + self.newstyle_constructors = {} + self.dynamicnamespace = False + if filename: + self.handle_file(filename) + + def handle_file(self, filename): + oldpath = os.getcwd() + + fp = open(filename, 'r') + dirname = os.path.dirname(os.path.abspath(filename)) + + if dirname != oldpath: + os.chdir(dirname) + + # read all the components of the file ... + bufs = [] + startline = 1 + lines = [] + line = fp.readline() + linenum = 1 + while line: + if line == '%%\n' or line == '%%': + if lines: + bufs.append((string.join(lines, ''), startline)) + startline = linenum + 1 + lines = [] + else: + lines.append(line) + line = fp.readline() + linenum = linenum + 1 + if lines: + bufs.append((string.join(lines, ''), startline)) + if not bufs: return + + for buf, startline in bufs: + self.__parse_override(buf, startline, filename) + + os.chdir(oldpath) + + def __parse_override(self, buffer, startline, filename): + pos = string.find(buffer, '\n') + if pos >= 0: + line = buffer[:pos] + rest = buffer[pos+1:] + else: + line = buffer ; rest = '' + words = string.split(line) + command = words[0] + if (command == 'ignore' or + command == 'ignore-' + sys.platform): + "ignore/ignore-platform [functions..]" + for func in words[1:]: + self.ignores[func] = 1 + for func in string.split(rest): + self.ignores[func] = 1 + elif (command == 'ignore-glob' or + command == 'ignore-glob-' + sys.platform): + "ignore-glob/ignore-glob-platform [globs..]" + for func in words[1:]: + self.glob_ignores.append(func) + for func in string.split(rest): + self.glob_ignores.append(func) + elif (command == 'ignore-type' or + command == 'ignore-type-' + sys.platform): + "ignore-type/ignore-type-platform [typenames..]" + for typename in words[1:]: + self.type_ignores[typename] = 1 + for typename in string.split(rest): + self.type_ignores[typename] = 1 + elif command == 'override': + "override function/method [kwargs|noargs|onearg] [staticmethod|classmethod]" + func = words[1] + if 'kwargs' in words[1:]: + self.kwargs[func] = 1 + elif 'noargs' in words[1:]: + self.noargs[func] = 1 + elif 'onearg' in words[1:]: + self.onearg[func] = True + + if 'staticmethod' in words[1:]: + self.staticmethod[func] = True + elif 'classmethod' in words[1:]: + self.classmethod[func] = True + if func in self.overrides: + raise RuntimeError("Function %s is being overridden more than once" % (func,)) + self.overrides[func] = rest + self.startlines[func] = (startline + 1, filename) + elif command == 'override-attr': + "override-slot Class.attr" + attr = words[1] + self.override_attrs[attr] = rest + self.startlines[attr] = (startline + 1, filename) + elif command == 'override-slot': + "override-slot Class.slot" + slot = words[1] + self.override_slots[slot] = rest + self.startlines[slot] = (startline + 1, filename) + elif command == 'headers': + "headers" + self.headers = '%s\n#line %d "%s"\n%s' % \ + (self.headers, startline + 1, filename, rest) + elif command == 'body': + "body" + self.body = '%s\n#line %d "%s"\n%s' % \ + (self.body, startline + 1, filename, rest) + elif command == 'init': + "init" + self.init = '%s\n#line %d "%s"\n%s' % \ + (self.init, startline + 1, filename, rest) + elif command == 'modulename': + "modulename name" + self.modulename = words[1] + elif command == 'include': + "include filename" + for filename in words[1:]: + self.handle_file(filename) + for filename in string.split(rest): + self.handle_file(filename) + elif command == 'import': + "import module1 [\n module2, \n module3 ...]" + for line in string.split(buffer, '\n'): + match = import_pat.match(line) + if match: + module, pyname, cname, conditional, importing_for = match.groups() + self.imports.append((module, pyname, cname, importing_for or None)) + elif command == 'define': + "define funcname [kwargs|noargs|onearg] [classmethod|staticmethod]" + "define Class.method [kwargs|noargs|onearg] [classmethod|staticmethod]" + func = words[1] + klass = None + if func.find('.') != -1: + klass, func = func.split('.', 1) + + if not self.defines.has_key(klass): + self.defines[klass] = {} + self.defines[klass][func] = rest + else: + self.functions[func] = rest + + if 'kwargs' in words[1:]: + self.kwargs[func] = 1 + elif 'noargs' in words[1:]: + self.noargs[func] = 1 + elif 'onearg' in words[1:]: + self.onearg[func] = 1 + + if 'staticmethod' in words[1:]: + self.staticmethod[func] = True + elif 'classmethod' in words[1:]: + self.classmethod[func] = True + + self.startlines[func] = (startline + 1, filename) + + elif command == 'new-constructor': + "new-constructor GType" + gtype, = words[1:] + self.newstyle_constructors[gtype] = True + elif command == 'options': + for option in words[1:]: + if option == 'dynamicnamespace': + self.dynamicnamespace = True + + def is_ignored(self, name): + if self.ignores.has_key(name): + return 1 + for glob in self.glob_ignores: + if fnmatch.fnmatchcase(name, glob): + return 1 + return 0 + + def is_type_ignored(self, name): + return name in self.type_ignores + + def is_overriden(self, name): + return self.overrides.has_key(name) + + def is_already_included(self, name): + return self.overridden.has_key(name) + + def override(self, name): + self.overridden[name] = 1 + return self.overrides[name] + + def define(self, klass, name): + self.overridden[class2cname(klass, name)] = 1 + return self.defines[klass][name] + + def function(self, name): + return self.functions[name] + + def getstartline(self, name): + return self.startlines[name] + + def wants_kwargs(self, name): + return self.kwargs.has_key(name) + + def wants_noargs(self, name): + return self.noargs.has_key(name) + + def wants_onearg(self, name): + return self.onearg.has_key(name) + + def is_staticmethod(self, name): + return self.staticmethod.has_key(name) + + def is_classmethod(self, name): + return self.classmethod.has_key(name) + + def attr_is_overriden(self, attr): + return self.override_attrs.has_key(attr) + + def attr_override(self, attr): + return self.override_attrs[attr] + + def slot_is_overriden(self, slot): + return self.override_slots.has_key(slot) + + def slot_override(self, slot): + return self.override_slots[slot] + + def get_headers(self): + return self.headers + + def get_body(self): + return self.body + + def get_init(self): + return self.init + + def get_imports(self): + return self.imports + + def get_defines_for(self, klass): + return self.defines.get(klass, {}) + + def get_functions(self): + return self.functions diff --git a/codegen/pygobject-codegen-2.0.in b/codegen/pygobject-codegen-2.0.in new file mode 100644 index 0000000..c5c912e --- /dev/null +++ b/codegen/pygobject-codegen-2.0.in @@ -0,0 +1,11 @@ +#!/bin/sh + +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +codegendir=${datadir}/pygobject/2.0/codegen + +PYTHONPATH=$codegendir +export PYTHONPATH + +exec @PYTHON@ $codegendir/codegen.py "$@" diff --git a/codegen/reversewrapper.py b/codegen/reversewrapper.py new file mode 100644 index 0000000..b96e12e --- /dev/null +++ b/codegen/reversewrapper.py @@ -0,0 +1,912 @@ +### -*- python -*- +### Code to generate "Reverse Wrappers", i.e. C->Python wrappers +### (C) 2004 Gustavo Carneiro +import argtypes +import os + +DEBUG_MODE = ('PYGTK_CODEGEN_DEBUG' in os.environ) + +def join_ctype_name(ctype, name): + '''Joins a C type and a variable name into a single string''' + if ctype[-1] != '*': + return " ".join((ctype, name)) + else: + return "".join((ctype, name)) + + +class CodeSink(object): + def __init__(self): + self.indent_level = 0 # current indent level + self.indent_stack = [] # previous indent levels + + def _format_code(self, code): + assert isinstance(code, str) + l = [] + for line in code.split('\n'): + l.append(' '*self.indent_level + line) + if l[-1]: + l.append('') + return '\n'.join(l) + + def writeln(self, line=''): + raise NotImplementedError + + def indent(self, level=4): + '''Add a certain ammount of indentation to all lines written + from now on and until unindent() is called''' + self.indent_stack.append(self.indent_level) + self.indent_level += level + + def unindent(self): + '''Revert indentation level to the value before last indent() call''' + self.indent_level = self.indent_stack.pop() + + +class FileCodeSink(CodeSink): + def __init__(self, fp): + CodeSink.__init__(self) + assert isinstance(fp, file) + self.fp = fp + + def writeln(self, line=''): + self.fp.write(self._format_code(line)) + +class MemoryCodeSink(CodeSink): + def __init__(self): + CodeSink.__init__(self) + self.lines = [] + + def writeln(self, line=''): + self.lines.append(self._format_code(line)) + + def flush_to(self, sink): + assert isinstance(sink, CodeSink) + for line in self.lines: + sink.writeln(line.rstrip()) + self.lines = [] + + def flush(self): + l = [] + for line in self.lines: + l.append(self._format_code(line)) + self.lines = [] + return "".join(l) + +class ReverseWrapper(object): + '''Object that generates a C->Python wrapper''' + def __init__(self, cname, is_static=True): + assert isinstance(cname, str) + + self.cname = cname + ## function object we will call, or object whose method we will call + self.called_pyobj = None + ## name of method of self.called_pyobj we will call + self.method_name = None + self.is_static = is_static + + self.parameters = [] + self.declarations = MemoryCodeSink() + self.post_return_code = MemoryCodeSink() + self.body = MemoryCodeSink() + self.check_exception_code = MemoryCodeSink() + self.cleanup_actions = [] + self.pyargv_items = [] + self.pyargv_optional_items = [] + self.pyret_parse_items = [] # list of (format_spec, parameter) + self.code_sinks_stack = [self.body] + + def set_call_target(self, called_pyobj, method_name=None): + assert called_pyobj is not None + assert self.called_pyobj is None + self.called_pyobj = called_pyobj + self.method_name = method_name + + def set_return_type(self, return_type): + assert isinstance(return_type, ReturnType) + self.return_type = return_type + + def add_parameter(self, param): + assert isinstance(param, Parameter) + self.parameters.append(param) + + def add_declaration(self, decl_code): + self.declarations.writeln(decl_code) + + def add_pyargv_item(self, variable, optional=False): + if optional: + self.pyargv_optional_items.append(variable) + else: + self.pyargv_items.append(variable) + + def add_pyret_parse_item(self, format_specifier, parameter, prepend=False): + if prepend: + self.pyret_parse_items.insert(0, (format_specifier, parameter)) + else: + self.pyret_parse_items.append((format_specifier, parameter)) + + + def push_code_sink(self, code_sink): + self.code_sinks_stack.insert(0, code_sink) + + def pop_code_sink(self): + return self.code_sinks_stack.pop(0) + + + def write_code(self, code, + cleanup=None, + failure_expression=None, + failure_cleanup=None, + failure_exception=None, + code_sink=None): + '''Add a chunk of code with cleanup and error handling + + This method is to be used by TypeHandlers when generating code + + Keywork arguments: + code -- code to add + cleanup -- code to cleanup any dynamic resources created by @code + (except in case of failure) (default None) + failure_expression -- C boolean expression to indicate + if anything failed (default None) + failure_cleanup -- code to cleanup any dynamic resources + created by @code in case of failure (default None) + failure_exception -- code to raise an exception in case of + failure (which will be immediately + printed and cleared), (default None) + code_sink -- "code sink" to use; by default, + ReverseWrapper.body is used, which writes the + main body of the wrapper, before calling the + python method. Alternatively, + ReverseWrapper.after_pyret_parse can be used, to + write code after the PyArg_ParseTuple that + parses the python method return value. + ''' + if code_sink is None: + code_sink = self.code_sinks_stack[0] + if code is not None: + code_sink.writeln(code) + if failure_expression is not None: + code_sink.writeln("if (%s) {" % (failure_expression,)) + code_sink.indent() + if failure_exception is None: + code_sink.writeln("if (PyErr_Occurred())") + code_sink.indent() + code_sink.writeln("PyErr_Print();") + code_sink.unindent() + else: + code_sink.writeln(failure_exception) + code_sink.writeln("PyErr_Print();") + if failure_cleanup is not None: + code_sink.writeln(failure_cleanup) + for cleanup_action in self.cleanup_actions: + code_sink.writeln(cleanup_action) + + self.push_code_sink(code_sink) + try: + self.return_type.write_error_return() + finally: + self.pop_code_sink() + + code_sink.unindent() + code_sink.writeln("}") + if cleanup is not None: + self.cleanup_actions.insert(0, cleanup) + + def generate(self, sink): + '''Generate the code into a CodeSink object''' + assert isinstance(sink, CodeSink) + + if DEBUG_MODE: + self.declarations.writeln("/* begin declarations */") + self.body.writeln("/* begin main body */") + self.post_return_code.writeln("/* begin post-return code */") + + self.add_declaration("PyGILState_STATE __py_state;") + self.write_code(code="__py_state = pyg_gil_state_ensure();", + cleanup="pyg_gil_state_release(__py_state);") + + for param in self.parameters: + param.convert_c2py() + + assert self.called_pyobj is not None,\ + "Parameters failed to provide a target function or method." + + if self.is_static: + sink.writeln('static %s' % self.return_type.get_c_type()) + else: + sink.writeln(self.return_type.get_c_type()) + c_proto_params = map(Parameter.format_for_c_proto, self.parameters) + sink.writeln("%s(%s)\n{" % (self.cname, ", ".join(c_proto_params))) + + self.return_type.write_decl() + self.add_declaration("PyObject *py_retval;") + + ## Handle number of arguments + if self.pyargv_items: + self.add_declaration("PyObject *py_args;") + py_args = "py_args" + if self.pyargv_optional_items: + self.add_declaration("int argc = %i;" % len(self.pyargv_items)) + argc = "argc" + for arg in self.pyargv_optional_items: + self.body.writeln("if (%s)" % arg) + self.body.indent() + self.body.writeln("++argc;") + self.body.unindent() + else: + argc = str(len(self.pyargv_items)) + else: + if self.pyargv_optional_items: + self.add_declaration("PyObject *py_args;") + py_args = "py_args" + self.add_declaration("int argc = 0;") + argc = "argc" + for arg in self.pyargv_optional_items: + self.body.writeln("if (%s)" % arg) + self.body.indent() + self.body.writeln("++argc;") + self.body.unindent() + else: + py_args = "NULL" + argc = None + + self.body.writeln() + + if py_args != "NULL": + self.write_code("py_args = PyTuple_New(%s);" % argc, + cleanup="Py_DECREF(py_args);") + pos = 0 + for arg in self.pyargv_items: + try: # try to remove the Py_DECREF cleanup action, if we can + self.cleanup_actions.remove("Py_DECREF(%s);" % arg) + except ValueError: # otherwise we have to Py_INCREF.. + self.body.writeln("Py_INCREF(%s);" % arg) + self.body.writeln("PyTuple_SET_ITEM(%s, %i, %s);" % (py_args, pos, arg)) + pos += 1 + for arg in self.pyargv_optional_items: + self.body.writeln("if (%s) {" % arg) + self.body.indent() + try: # try to remove the Py_DECREF cleanup action, if we can + self.cleanup_actions.remove("Py_XDECREF(%s);" % arg) + except ValueError: # otherwise we have to Py_INCREF.. + self.body.writeln("Py_INCREF(%s);" % arg) + self.body.writeln("PyTuple_SET_ITEM(%s, %i, %s);" % (py_args, pos, arg)) + self.body.unindent() + self.body.writeln("}") + pos += 1 + + self.body.writeln() + + ## Call the python method + if self.method_name is None: + self.write_code("py_retval = PyObject_Call(%s, %s);" + % (self.called_pyobj, py_args), + cleanup="Py_XDECREF(py_retval);") + self.check_exception_code.flush_to(self.body) + self.write_code(None, failure_expression="!py_retval") + + else: + self.add_declaration("PyObject *py_method;") + self.write_code("py_method = PyObject_GetAttrString(%s, \"%s\");" + % (self.called_pyobj, self.method_name), + cleanup="Py_DECREF(py_method);", + failure_expression="!py_method") + self.write_code("py_retval = PyObject_CallObject(py_method, %s);" + % (py_args,), + cleanup="Py_XDECREF(py_retval);") + self.check_exception_code.flush_to(self.body) + self.write_code(None, failure_expression="!py_retval") + + ## -- Handle the return value -- + + ## we need to check if the return_type object is prepared to cooperate with multiple return values + len_before = len(self.pyret_parse_items) + self.return_type.write_conversion() + len_after = len(self.pyret_parse_items) + assert (self.return_type.get_c_type() == 'void' + or not (len_before == len_after and len_after > 0)),\ + ("Bug in reverse wrappers: return type handler %s" + " is not prepared to cooperate multiple return values") % (type(self.return_type),) + + sink.indent() + + if self.pyret_parse_items == [("", "")]: + ## special case when there are no return parameters + self.write_code( + code=None, + failure_expression='py_retval != Py_None', + failure_exception=('PyErr_SetString(PyExc_TypeError, ' + '"virtual method should return None");')) + else: + if len(self.pyret_parse_items) == 1: + ## if retval is one item only, pack it in a tuple so we + ## can use PyArg_ParseTuple as usual.. + self.write_code('py_retval = Py_BuildValue("(N)", py_retval);') + if len(self.pyret_parse_items) > 0: + ## Parse return values using PyArg_ParseTuple + params = ["py_retval", + '"%s"' % "".join([format for format, param in self.pyret_parse_items])] + params.extend([param for format, param in self.pyret_parse_items if param]) + self.write_code(code=None, failure_expression=( + '!PyArg_ParseTuple(%s)' % (', '.join(params),))) + + if DEBUG_MODE: + self.declarations.writeln("/* end declarations */") + self.declarations.flush_to(sink) + sink.writeln() + if DEBUG_MODE: + self.body.writeln("/* end main body */") + self.body.flush_to(sink) + sink.writeln() + if DEBUG_MODE: + self.post_return_code.writeln("/* end post-return code */") + self.post_return_code.flush_to(sink) + sink.writeln() + + for cleanup_action in self.cleanup_actions: + sink.writeln(cleanup_action) + if self.return_type.get_c_type() != 'void': + sink.writeln() + sink.writeln("return retval;") + sink.unindent() + sink.writeln("}") + +class TypeHandler(object): + def __init__(self, wrapper, **props): + assert isinstance(wrapper, ReverseWrapper) + self.wrapper = wrapper + self.props = props + +class ReturnType(TypeHandler): + + supports_optional = False + + def get_c_type(self): + raise NotImplementedError + + def write_decl(self): + raise NotImplementedError + + def write_error_return(self): + '''Write "return " code in case of error''' + raise NotImplementedError + + def write_conversion(self): + '''Writes code to convert Python return value in 'py_retval' + into C 'retval'. Returns a string with C boolean expression + that determines if anything went wrong. ''' + raise NotImplementedError + +class Parameter(TypeHandler): + + def __init__(self, wrapper, name, **props): + TypeHandler.__init__(self, wrapper, **props) + self.name = name + + def get_c_type(self): + raise NotImplementedError + + def convert_c2py(self): + '''Write some code before calling the Python method.''' + pass + + def format_for_c_proto(self): + return join_ctype_name(self.get_c_type(), self.name) + + +###--- +class StringParam(Parameter): + + def get_c_type(self): + return self.props.get('c_type', 'char *').replace('const-', 'const ') + + def convert_c2py(self): + if self.props.get('optional', False): + self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) + self.wrapper.write_code(code=("if (%s)\n" + " py_%s = PyString_FromString(%s);\n" + % (self.name, self.name, self.name)), + cleanup=("Py_XDECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name, optional=True) + elif self.props.get('nullok', False): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=("if (%s)\n" + " py_%s = PyString_FromString(%s);\n" + "else {\n" + " Py_INCREF(Py_None);\n" + " py_%s = Py_None;\n" + "}\n" + % (self.name, self.name, self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + else: + self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) + self.wrapper.write_code(code=("if (%s)\n" + " py_%s = PyString_FromString(%s);\n" % + (self.name, self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name), + failure_expression=("!py_%s" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +for ctype in ('char*', 'gchar*', 'const-char*', 'char-const*', 'const-gchar*', + 'gchar-const*', 'string', 'static_string'): + argtypes.matcher.register_reverse(ctype, StringParam) +del ctype + +class StringReturn(ReturnType): + + def get_c_type(self): + return self.props.get('c_type', 'char *').replace('const-', 'const ') + #return "char *" + + def write_decl(self): + self.wrapper.add_declaration("%s retval;" % self.get_c_type()) + #self.wrapper.add_declaration("char *retval;") + + def write_error_return(self): + self.wrapper.write_code("return NULL;") + + def write_conversion(self): + self.wrapper.add_pyret_parse_item("s", "&retval", prepend=True) + self.wrapper.write_code("retval = g_strdup(retval);", code_sink=self.wrapper.post_return_code) + +for ctype in ('char*', 'gchar*', 'const-gchar*'): + argtypes.matcher.register_reverse_ret(ctype, StringReturn) +del ctype + + +class VoidReturn(ReturnType): + + def get_c_type(self): + return "void" + + def write_decl(self): + pass + + def write_error_return(self): + self.wrapper.write_code("return;") + + def write_conversion(self): + self.wrapper.add_pyret_parse_item("", "", prepend=True) + +argtypes.matcher.register_reverse_ret('void', VoidReturn) +argtypes.matcher.register_reverse_ret('none', VoidReturn) + +class GObjectParam(Parameter): + + def get_c_type(self): + return self.props.get('c_type', 'GObject *') + + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) + self.wrapper.write_code(code=("if (%s)\n" + " py_%s = pygobject_new((GObject *) %s);\n" + "else {\n" + " Py_INCREF(Py_None);\n" + " py_%s = Py_None;\n" + "}" + % (self.name, self.name, self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +argtypes.matcher.register_reverse('GObject*', GObjectParam) + +class GObjectReturn(ReturnType): + + supports_optional = True + + def get_c_type(self): + return self.props.get('c_type', 'GObject *') + + def write_decl(self): + if not self.props.get('optional'): + self.wrapper.add_declaration("%s retval;" % self.get_c_type()) + else: + self.wrapper.add_declaration("%s retval = NULL;" % self.get_c_type()) + + def write_error_return(self): + self.wrapper.write_code("return NULL;") + + def write_conversion(self): + if not self.props.get('optional'): + self.wrapper.write_code( + code=None, + failure_expression="!PyObject_TypeCheck(py_retval, &PyGObject_Type)", + failure_exception='PyErr_SetString(PyExc_TypeError, "retval should be a GObject");') + self.wrapper.write_code("retval = (%s) pygobject_get(py_retval);" + % self.get_c_type()) + self.wrapper.write_code("g_object_ref((GObject *) retval);") + else: + self.wrapper.write_code( + code=None, + failure_expression="py_retval != Py_None && !PyObject_TypeCheck(py_retval, &PyGObject_Type)", + failure_exception='PyErr_SetString(PyExc_TypeError, "retval should be None or a GObject");') + self.wrapper.write_code("if (py_retval != Py_None) {\n" + " retval = (%s) pygobject_get(py_retval);\n" + " g_object_ref((GObject *) retval);\n" + "}\n" + % self.get_c_type()) + +argtypes.matcher.register_reverse_ret('GObject*', GObjectReturn) + + + +class IntParam(Parameter): + + def get_c_type(self): + return self.props.get('c_type', 'int') + + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=("py_%s = PyInt_FromLong(%s);" % + (self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +class IntReturn(ReturnType): + def get_c_type(self): + return self.props.get('c_type', 'int') + def write_decl(self): + self.wrapper.add_declaration("%s retval;" % self.get_c_type()) + def write_error_return(self): + self.wrapper.write_code("return -G_MAXINT;") + def write_conversion(self): + self.wrapper.add_pyret_parse_item("i", "&retval", prepend=True) + +for argtype in ('int', 'gint', 'guint', 'short', 'gshort', 'gushort', 'long', + 'glong', 'gsize', 'gssize', 'guint8', 'gint8', 'guint16', + 'gint16', 'gint32', 'GTime'): + argtypes.matcher.register_reverse(argtype, IntParam) + argtypes.matcher.register_reverse_ret(argtype, IntReturn) +del argtype + +class IntPtrParam(Parameter): + def __init__(self, wrapper, name, **props): + if "direction" not in props: + raise argtypes.ArgTypeConfigurationError( + "cannot use int* parameter without direction") + if props["direction"] not in ("out", "inout"): + raise argtypes.ArgTypeConfigurationError( + "cannot use int* parameter with direction '%s'" + % (props["direction"],)) + Parameter.__init__(self, wrapper, name, **props) + def get_c_type(self): + return self.props.get('c_type', 'int*') + def convert_c2py(self): + if self.props["direction"] == "inout": + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=("py_%s = PyInt_FromLong(*%s);" % + (self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + self.wrapper.add_pyret_parse_item("i", self.name) +for argtype in ('int*', 'gint*'): + argtypes.matcher.register_reverse(argtype, IntPtrParam) +del argtype + + +class GEnumReturn(IntReturn): + def write_conversion(self): + self.wrapper.write_code( + code=None, + failure_expression=( + "pyg_enum_get_value(%s, py_retval, (gint *)&retval)" + % (self.props['typecode'],))) + +argtypes.matcher.register_reverse_ret("GEnum", GEnumReturn) + +class GEnumParam(IntParam): + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=("py_%s = pyg_enum_from_gtype(%s, %s);" % + (self.name, self.props['typecode'], self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name), + failure_expression=("!py_%s" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +argtypes.matcher.register_reverse("GEnum", GEnumParam) + +class GFlagsReturn(IntReturn): + def write_conversion(self): + self.wrapper.write_code( + code=None, + failure_expression=( + "pyg_flags_get_value(%s, py_retval, (gint *)&retval)" % + self.props['typecode'])) + +argtypes.matcher.register_reverse_ret("GFlags", GFlagsReturn) + +class GFlagsParam(IntParam): + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=( + "py_%s = pyg_flags_from_gtype(%s, %s);" % + (self.name, self.props['typecode'], self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name), + failure_expression=("!py_%s" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +argtypes.matcher.register_reverse("GFlags", GFlagsParam) + + +class GtkTreePathParam(IntParam): + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=( + "py_%s = pygtk_tree_path_to_pyobject(%s);" % + (self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name), + failure_expression=("!py_%s" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +argtypes.matcher.register_reverse("GtkTreePath*", GtkTreePathParam) + + +class GtkTreePathReturn(ReturnType): + def get_c_type(self): + return self.props.get('c_type', 'GtkTreePath *') + def write_decl(self): + self.wrapper.add_declaration("GtkTreePath * retval;") + def write_error_return(self): + self.wrapper.write_code("return NULL;") + def write_conversion(self): + self.wrapper.write_code( + "retval = pygtk_tree_path_from_pyobject(py_retval);\n", + failure_expression=('!retval'), + failure_exception=( + 'PyErr_SetString(PyExc_TypeError, "retval should be a GtkTreePath");')) + +argtypes.matcher.register_reverse_ret("GtkTreePath*", GtkTreePathReturn) + + +class BooleanReturn(ReturnType): + def get_c_type(self): + return "gboolean" + def write_decl(self): + self.wrapper.add_declaration("gboolean retval;") + self.wrapper.add_declaration("PyObject *py_main_retval;") + def write_error_return(self): + self.wrapper.write_code("return FALSE;") + def write_conversion(self): + self.wrapper.add_pyret_parse_item("O", "&py_main_retval", prepend=True) + self.wrapper.write_code( + "retval = PyObject_IsTrue(py_main_retval)? TRUE : FALSE;", + code_sink=self.wrapper.post_return_code) +argtypes.matcher.register_reverse_ret("gboolean", BooleanReturn) + +class BooleanParam(Parameter): + def get_c_type(self): + return "gboolean" + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code("py_%s = %s? Py_True : Py_False;" + % (self.name, self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +argtypes.matcher.register_reverse("gboolean", BooleanParam) + + +class DoubleParam(Parameter): + def get_c_type(self): + return self.props.get('c_type', 'gdouble') + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=("py_%s = PyFloat_FromDouble(%s);" % + (self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +class DoublePtrParam(Parameter): + def __init__(self, wrapper, name, **props): + if "direction" not in props: + raise argtypes.ArgTypeConfigurationError( + "cannot use double* parameter without direction") + if props["direction"] not in ("out", ): # inout not yet implemented + raise argtypes.ArgTypeConfigurationError( + "cannot use double* parameter with direction '%s'" + % (props["direction"],)) + Parameter.__init__(self, wrapper, name, **props) + def get_c_type(self): + return self.props.get('c_type', 'double*') + def convert_c2py(self): + self.wrapper.add_pyret_parse_item("d", self.name) +for argtype in ('double*', 'gdouble*'): + argtypes.matcher.register_reverse(argtype, DoublePtrParam) +del argtype + +class DoubleReturn(ReturnType): + def get_c_type(self): + return self.props.get('c_type', 'gdouble') + def write_decl(self): + self.wrapper.add_declaration("%s retval;" % self.get_c_type()) + def write_error_return(self): + self.wrapper.write_code("return -G_MAXFLOAT;") + def write_conversion(self): + self.wrapper.add_pyret_parse_item("d", "&retval", prepend=True) + +for argtype in ('float', 'double', 'gfloat', 'gdouble'): + argtypes.matcher.register_reverse(argtype, DoubleParam) + argtypes.matcher.register_reverse_ret(argtype, DoubleReturn) + + +class GBoxedParam(Parameter): + def get_c_type(self): + return self.props.get('c_type').replace('const-', 'const ') + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + ctype = self.get_c_type() + if ctype.startswith('const '): + ctype_no_const = ctype[len('const '):] + self.wrapper.write_code( + code=('py_%s = pyg_boxed_new(%s, (%s) %s, TRUE, TRUE);' % + (self.name, self.props['typecode'], + ctype_no_const, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + else: + self.wrapper.write_code( + code=('py_%s = pyg_boxed_new(%s, %s, FALSE, FALSE);' % + (self.name, self.props['typecode'], self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +argtypes.matcher.register_reverse("GBoxed", GBoxedParam) + + +class GBoxedReturn(ReturnType): + def get_c_type(self): + return self.props.get('c_type') + def write_decl(self): + self.wrapper.add_declaration("%s retval;" % self.get_c_type()) + def write_error_return(self): + self.wrapper.write_code("return retval;") + def write_conversion(self): + self.wrapper.write_code(code = None, + failure_expression=("!pyg_boxed_check(py_retval, %s)" % + (self.props['typecode'],)), + failure_exception=( + 'PyErr_SetString(PyExc_TypeError, "retval should be a %s");' + % (self.props['typename'],))) + self.wrapper.write_code('retval = pyg_boxed_get(py_retval, %s);' % + self.props['typename']) + +argtypes.matcher.register_reverse_ret("GBoxed", GBoxedReturn) + + +class GdkRegionPtrReturn(GBoxedReturn): + def write_error_return(self): + self.wrapper.write_code("return gdk_region_new();") + def write_conversion(self): + self.props['typecode'] = 'PYGDK_TYPE_REGION' + self.props['typename'] = 'GdkRegion' + super(GdkRegionPtrReturn, self).write_conversion() + +argtypes.matcher.register_reverse_ret("GdkRegion*", GdkRegionPtrReturn) + + +class PangoFontDescriptionReturn(GBoxedReturn): + def write_error_return(self): + self.wrapper.write_code("return pango_font_description_new();") + def write_conversion(self): + self.props['typecode'] = 'PANGO_TYPE_FONT_DESCRIPTION' + self.props['typename'] = 'PangoFontDescription' + super(PangoFontDescriptionReturn, self).write_conversion() + +argtypes.matcher.register_reverse_ret("PangoFontDescription*", + PangoFontDescriptionReturn) + + +class PangoFontMetricsReturn(GBoxedReturn): + def write_error_return(self): + self.wrapper.write_code("return pango_font_metrics_new();") + def write_conversion(self): + self.props['typecode'] = 'PANGO_TYPE_FONT_METRICS' + self.props['typename'] = 'PangoFontMetrics' + super(PangoFontMetricsReturn, self).write_conversion() + +argtypes.matcher.register_reverse_ret("PangoFontMetrics*", + PangoFontMetricsReturn) + + +class PangoLanguageReturn(GBoxedReturn): + def write_error_return(self): + self.wrapper.write_code("return pango_language_from_string(\"\");") + def write_conversion(self): + self.props['typecode'] = 'PANGO_TYPE_LANGUAGE' + self.props['typename'] = 'PangoLanguage' + super(PangoLanguageReturn, self).write_conversion() + +argtypes.matcher.register_reverse_ret("PangoLanguage*", PangoLanguageReturn) + + +class GdkRectanglePtrParam(Parameter): + def get_c_type(self): + return self.props.get('c_type').replace('const-', 'const ') + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code( + code=('py_%s = pyg_boxed_new(GDK_TYPE_RECTANGLE, %s, TRUE, TRUE);' % + (self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name)) + self.wrapper.add_pyargv_item("py_%s" % self.name) + +argtypes.matcher.register_reverse("GdkRectangle*", GdkRectanglePtrParam) +argtypes.matcher.register_reverse('GtkAllocation*', GdkRectanglePtrParam) + + +class GErrorParam(Parameter): + def get_c_type(self): + return self.props.get('c_type').replace('**', ' **') + def convert_c2py(self): + self.wrapper.write_code(code=None, + failure_expression=("pyg_gerror_exception_check(%s)" % self.name), + code_sink=self.wrapper.check_exception_code) + +argtypes.matcher.register_reverse('GError**', GErrorParam) + + +class PyGObjectMethodParam(Parameter): + def __init__(self, wrapper, name, method_name, **props): + Parameter.__init__(self, wrapper, name, **props) + self.method_name = method_name + + def get_c_type(self): + return self.props.get('c_type', 'GObject *') + + def convert_c2py(self): + self.wrapper.add_declaration("PyObject *py_%s;" % self.name) + self.wrapper.write_code(code=("py_%s = pygobject_new((GObject *) %s);" % + (self.name, self.name)), + cleanup=("Py_DECREF(py_%s);" % self.name), + failure_expression=("!py_%s" % self.name)) + self.wrapper.set_call_target("py_%s" % self.name, self.method_name) + + +class CallbackInUserDataParam(Parameter): + def __init__(self, wrapper, name, free_it, **props): + Parameter.__init__(self, wrapper, name, **props) + self.free_it = free_it + + def get_c_type(self): + return "gpointer" + + def convert_c2py(self): + self.wrapper.add_declaration("PyObject **_user_data;") + cleanup = self.free_it and ("g_free(%s);" % self.name) or None + self.wrapper.write_code(code=("_real_user_data = (PyObject **) %s;" + % self.name), + cleanup=cleanup) + + self.wrapper.add_declaration("PyObject *py_func;") + cleanup = self.free_it and "Py_DECREF(py_func);" or None + self.wrapper.write_code(code="py_func = _user_data[0];", + cleanup=cleanup) + self.wrapper.set_call_target("py_func") + + self.wrapper.add_declaration("PyObject *py_user_data;") + cleanup = self.free_it and "Py_XDECREF(py_user_data);" or None + self.wrapper.write_code(code="py_user_data = _user_data[1];", + cleanup=cleanup) + self.wrapper.add_pyargv_item("py_user_data", optional=True) + +def _test(): + import sys + + if 1: + wrapper = ReverseWrapper("this_is_the_c_function_name", is_static=True) + wrapper.set_return_type(StringReturn(wrapper)) + wrapper.add_parameter(PyGObjectMethodParam(wrapper, "self", method_name="do_xxx")) + wrapper.add_parameter(StringParam(wrapper, "param2", optional=True)) + wrapper.add_parameter(GObjectParam(wrapper, "param3")) + #wrapper.add_parameter(InoutIntParam(wrapper, "param4")) + wrapper.generate(FileCodeSink(sys.stderr)) + + if 0: + wrapper = ReverseWrapper("this_a_callback_wrapper") + wrapper.set_return_type(VoidReturn(wrapper)) + wrapper.add_parameter(StringParam(wrapper, "param1", optional=False)) + wrapper.add_parameter(GObjectParam(wrapper, "param2")) + wrapper.add_parameter(CallbackInUserDataParam(wrapper, "data", free_it=True)) + wrapper.generate(FileCodeSink(sys.stderr)) + +if __name__ == '__main__': + _test() diff --git a/codegen/scanvirtuals.py b/codegen/scanvirtuals.py new file mode 100755 index 0000000..c108737 --- /dev/null +++ b/codegen/scanvirtuals.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +import re +import sys + + +def main(): + rx = re.compile(r'^\s*([\w\s\*]+)\(\s*\*\s*(\w+)\s*\)\s*\(([^()]*)\);', + re.DOTALL|re.MULTILINE) + for f in sys.argv[1:]: + #print ";; From", f + buf = file(f).read() + for m in rx.findall(buf): + return_type = m[0].strip() + if 'typedef' in return_type: + continue + if return_type == 'void': + return_type = 'none' + return_type = return_type.replace(' ', '') + virtual_name = m[1] + if 'reserved' in virtual_name: + continue + params = [] + if not m[2]: + print >> sys.stderr, repr(m) + continue + for param in map(str.strip, m[2].split(',')): + if '*' in param: + tokens = param.split('*') + ptype = tokens[0].strip() + '*'*(len(tokens) - 1) + pname = tokens[-1].strip() + else: + if param == 'void': + continue + ptype, pname = map(str.strip, param.split()) + ptype = ptype.replace('const ', 'const-') + while '[]' in pname: + pname = pname.replace('[]', '') + ptype += '[]' + params.append((ptype, pname)) + if not params: + continue + objname = params[0][0].replace('*', '') + print '(define-virtual', virtual_name + print ' (of-object "%s")' % objname + print ' (return-type "%s")' % return_type + if len(params) > 1: + print ' (parameters' + for param in params[1:]: + print ' \'("%s" "%s")' % param + print ' )' + print ')' + +if __name__ == '__main__': + main() diff --git a/codegen/scmexpr.py b/codegen/scmexpr.py new file mode 100755 index 0000000..02f2e4b --- /dev/null +++ b/codegen/scmexpr.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- +from __future__ import generators + +import string +from cStringIO import StringIO + +class error(Exception): + def __init__(self, filename, lineno, msg): + Exception.__init__(self, msg) + self.filename = filename + self.lineno = lineno + self.msg = msg + def __str__(self): + return '%s:%d: error: %s' % (self.filename, self.lineno, self.msg) + +trans = [' '] * 256 +for i in range(256): + if chr(i) in string.letters + string.digits + '_': + trans[i] = chr(i) + else: + trans[i] = '_' +trans = string.join(trans, '') + +def parse(filename): + if isinstance(filename, str): + fp = open(filename, 'r') + else: # if not string, assume it is some kind of iterator + fp = filename + filename = getattr(fp, 'name', '') + whitespace = ' \t\n\r\x0b\x0c' + nonsymbol = whitespace + '();\'"' + stack = [] + openlines = [] + lineno = 0 + for line in fp: + pos = 0 + lineno += 1 + while pos < len(line): + if line[pos] in whitespace: # ignore whitespace + pass + elif line[pos] == ';': # comment + break + elif line[pos:pos+2] == "'(": + pass # the open parenthesis will be handled next iteration + elif line[pos] == '(': + stack.append(()) + openlines.append(lineno) + elif line[pos] == ')': + if len(stack) == 0: + raise error(filename, lineno, 'close parenthesis found when none open') + closed = stack[-1] + del stack[-1] + del openlines[-1] + if stack: + stack[-1] += (closed,) + else: + yield closed + elif line[pos] == '"': # quoted string + if not stack: + raise error(filename, lineno, + 'string found outside of s-expression') + endpos = pos + 1 + chars = [] + while endpos < len(line): + if endpos+1 < len(line) and line[endpos] == '\\': + endpos += 1 + if line[endpos] == 'n': + chars.append('\n') + elif line[endpos] == 'r': + chars.append('\r') + elif line[endpos] == 't': + chars.append('\t') + else: + chars.append('\\') + chars.append(line[endpos]) + elif line[endpos] == '"': + break + else: + chars.append(line[endpos]) + endpos += 1 + if endpos >= len(line): + raise error(filename, lineno, "unclosed quoted string") + pos = endpos + stack[-1] += (''.join(chars),) + else: # symbol/number + if not stack: + raise error(filename, lineno, + 'identifier found outside of s-expression') + endpos = pos + while endpos < len(line) and line[endpos] not in nonsymbol: + endpos += 1 + symbol = line[pos:endpos] + pos = max(pos, endpos-1) + try: symbol = int(symbol) + except ValueError: + try: symbol = float(symbol) + except ValueError: pass + stack[-1] += (symbol,) + pos += 1 + if len(stack) != 0: + msg = '%d unclosed parentheses found at end of ' \ + 'file (opened on line(s) %s)' % (len(stack), + ', '.join(map(str, openlines))) + raise error(filename, lineno, msg) + +class Parser: + def __init__(self, filename): + """Argument is either a string, a parse tree, or file object""" + self.filename = filename + def startParsing(self, filename=None): + statements = parse(filename or self.filename) + for statement in statements: + self.handle(statement) + def handle(self, tup): + cmd = string.translate(tup[0], trans) + if hasattr(self, cmd): + getattr(self, cmd)(*tup[1:]) + else: + self.unknown(tup) + def unknown(self, tup): + pass + +_testString = """; a scheme file +(define-func gdk_font_load ; a comment at end of line + GdkFont + ((string name))) + +(define-boxed GdkEvent + gdk_event_copy + gdk_event_free + "sizeof(GdkEvent)") +""" + +if __name__ == '__main__': + import sys + if sys.argv[1:]: + fp = open(sys.argv[1]) + else: + fp = StringIO(_testString) + statements = parse(fp) + for s in statements: + print `s` diff --git a/compile b/compile new file mode 100755 index 0000000..c0096a7 --- /dev/null +++ b/compile @@ -0,0 +1,143 @@ +#! /bin/sh +# Wrapper for compilers which do not understand `-c -o'. + +scriptversion=2009-10-06.20; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 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 +# . + +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 $? + ;; +esac + +ofile= +cfile= +eat= + +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 new file mode 100755 index 0000000..dc84c68 --- /dev/null +++ b/config.guess @@ -0,0 +1,1501 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-11-20' + +# 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 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, 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. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# 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 + +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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 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 + +# 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 tupples: *-*-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 ;; + *: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'` + exit ;; + 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:*:[456]) + 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:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + 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-gnu`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/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + 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="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${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-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + 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-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + 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-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + 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 ;; + 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 + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + 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 + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + 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 ;; + 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 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +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 new file mode 100644 index 0000000..061e620 --- /dev/null +++ b/config.h.in @@ -0,0 +1,80 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Use PyGI to create wrappers for introspection-enabled types */ +#undef ENABLE_PYGI + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Have libffi include files */ +#undef HAVE_FFI_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 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 new file mode 100755 index 0000000..2a55a50 --- /dev/null +++ b/config.sub @@ -0,0 +1,1705 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-11-20' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# 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 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, 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. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# 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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 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-dietlibc | linux-newlib* | 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/'` + ;; + *) + 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*) + 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 \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | 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 \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | 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 | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-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-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | 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-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | 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-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | 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-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | 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 + ;; + 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) + 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'm not sure what "Sysv32" means. Should this be sysv3.2? + 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 + ;; + mingw32) + basic_machine=i386-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-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + 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 + ;; + 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) basic_machine=powerpc-unknown + ;; + ppc-*) 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) + 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 + ;; + 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 + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-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 + ;; + 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* \ + | -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* \ + | -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* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -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 + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -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 + ;; + # 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 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + 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 new file mode 100755 index 0000000..b53dedf --- /dev/null +++ b/configure @@ -0,0 +1,16893 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.63 for pygobject 2.21.3. +# +# Report bugs to . +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 + + + + +# PATH needs CR +# 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_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 +if (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 + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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. +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); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +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 + + +# Name of the executable. +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'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +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 + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +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_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +$* +_LT_EOF + exit 0 +fi + +# 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 + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, 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= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='pygobject' +PACKAGE_TARNAME='pygobject' +PACKAGE_VERSION='2.21.3' +PACKAGE_STRING='pygobject 2.21.3' +PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject' + +ac_unique_file="gobject/gobjectmodule.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 +BUILD_GIOUNIX_FALSE +BUILD_GIOUNIX_TRUE +GIOUNIX_LIBS +GIOUNIX_CFLAGS +BUILD_GIO_FALSE +BUILD_GIO_TRUE +GIO_LIBS +GIO_CFLAGS +LIBFFI_PC +HAVE_LIBFFI_FALSE +HAVE_LIBFFI_TRUE +FFI_LIBS +FFI_CFLAGS +DATADIR +pygobject_CODEGEN_DEFINES +PYTHON_BASENAME +GLIB_MKENUMS +GOBJECT_QUERY +GLIB_GENMARSHAL +GLIB_LIBS +GLIB_CFLAGS +PKG_CONFIG +THREADING_CFLAGS +ENABLE_DOCS_FALSE +ENABLE_DOCS_TRUE +XSLTPROC +PLATFORM +PYTHON_INCLUDES +pkgpyexecdir +pyexecdir +pkgpythondir +pythondir +PYTHON_PLATFORM +PYTHON_EXEC_PREFIX +PYTHON_PREFIX +PYTHON_VERSION +PYTHON +CPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +lt_ECHO +RANLIB +AR +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +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 +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_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_static +enable_shared +with_pic +enable_fast_install +enable_dependency_tracking +with_gnu_ld +enable_libtool_lock +enable_thread +enable_docs +enable_glibtest +with_ffi +enable_pygi +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +PKG_CONFIG +FFI_CFLAGS +FFI_LIBS +GIO_CFLAGS +GIO_LIBS +GIOUNIX_CFLAGS +GIOUNIX_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=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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + 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_echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + 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_echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; + *) $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_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +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 + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + 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_echo "$as_me: error: working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + 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 2.21.3 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 2.21.3:";; + 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-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] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-thread Disable pygobject threading support + --enable-docs Enable documentation building + --disable-glibtest do not try to compile and run a test GLIB program + --enable-pygi Use PyGI to create wrappers for + introspection-enabled types + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --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 C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + PKG_CONFIG path to pkg-config utility + 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 + GIOUNIX_CFLAGS + C compiler flags for GIOUNIX, overriding pkg-config + GIOUNIX_LIBS + linker flags for GIOUNIX, 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 . +_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 2.21.3 +generated by GNU Autoconf 2.63 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 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 +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 2.21.3, which was +generated by GNU Autoconf 2.63. 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) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$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 + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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 + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + 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:$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= ;; #( + *) $as_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 + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + 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 + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + 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 + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + 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'; { (exit 1); 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 + +# 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 + + +# 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 + ac_site_file1=$CONFIG_SITE +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 -r "$ac_site_file"; then + { $as_echo "$as_me:$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" + 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. + if test -f "$cache_file"; then + { $as_echo "$as_me:$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:$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:$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:$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:$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:$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:$LINENO: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:$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. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +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 + + +ACLOCAL_AMFLAGS="-I m4 -I ." + + + + +cat >>confdefs.h <<\_ACEOF +#define PYGOBJECT_MAJOR_VERSION 2 +_ACEOF + +PYGOBJECT_MAJOR_VERSION=2 + + +cat >>confdefs.h <<\_ACEOF +#define PYGOBJECT_MINOR_VERSION 21 +_ACEOF + +PYGOBJECT_MINOR_VERSION=21 + + +cat >>confdefs.h <<\_ACEOF +#define PYGOBJECT_MICRO_VERSION 3 +_ACEOF + +PYGOBJECT_MICRO_VERSION=3 + + + +ac_config_headers="$ac_config_headers config.h" + + +am__api_version='1.11' + +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_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +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:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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:$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:$LINENO: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# 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_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5 +$as_echo "$as_me: error: unsafe absolute working directory name" >&2;} + { (exit 1); exit 1; }; };; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5 +$as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;} + { (exit 1); exit 1; }; };; +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 ( + 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 + rm -f conftest.file + 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_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +$as_echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +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 --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:$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:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:$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:$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:$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 test "${ac_cv_path_mkdir+set}" = set; 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 + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 + + 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. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:$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:$LINENO: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:$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 { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; 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:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } + 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='2.21.3' + + +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"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ $as_echo "$as_me:$LINENO: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; 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_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +$as_echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +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:$LINENO: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +$as_echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +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:$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:$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:$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:$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 + + +# 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 + + + + + + + + + + + + +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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AS+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AS="${ac_tool_prefix}as" + $as_echo "$as_me:$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:$LINENO: result: $AS" >&5 +$as_echo "$AS" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AS+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AS="as" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_AS" >&5 +$as_echo "$ac_ct_AS" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DLLTOOL+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:$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:$LINENO: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:$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:$LINENO: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:$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:$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 + + + + + + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:$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.2.6b' +macro_revision='1.3017' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +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:$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:$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='\' +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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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:$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:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$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:$LINENO: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + +# Provide some information about the compiler. +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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:$LINENO: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 + +{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:$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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +rm -f conftest$ac_cv_exeext +{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:$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 test "${ac_cv_c_compiler_gnu+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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:$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:$LINENO: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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:$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:$LINENO: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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" + 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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:$LINENO: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +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 + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; 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'. + 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 8's {/usr,}/bin/sh. + touch 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 + ;; + 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:$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:$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 test "${ac_cv_path_SED+set}" = set; 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 + $as_unset ac_script || 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" + { test -f "$ac_path_SED" && $as_test_x "$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 + ac_count=`expr $ac_count + 1` + 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_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5 +$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:$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:$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 test "${ac_cv_path_GREP+set}" = set; 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" + { test -f "$ac_path_GREP" && $as_test_x "$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 + ac_count=`expr $ac_count + 1` + 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_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; 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" + { test -f "$ac_path_EGREP" && $as_test_x "$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 + ac_count=`expr $ac_count + 1` + 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_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:$LINENO: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if test "${ac_cv_path_FGREP+set}" = set; 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" + { test -f "$ac_path_FGREP" && $as_test_x "$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 + ac_count=`expr $ac_count + 1` + 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_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:$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:$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:$LINENO: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; 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:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; 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:$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 test "${lt_cv_path_NM+set}" = set; 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:$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 "$ac_tool_prefix"; then + for ac_prog in "dumpbin -symbols" "link -dump -symbols" + 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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DUMPBIN+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:$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:$LINENO: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:$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 -symbols" "link -dump -symbols" +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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:$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:$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 + + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if test "${lt_cv_nm_interface+set}" = set; 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:4851: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:4854: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:4857: 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:$LINENO: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:$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:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; 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; + ;; + + 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 + ;; + + 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"; 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"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$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:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:$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:$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"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:$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:$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:$LINENO: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:$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 + 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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:$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:$LINENO: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; 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. + if ( 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 + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + 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 + ;; + +gnu*) + 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]) 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 Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + 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:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } +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}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AR+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:$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:$LINENO: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$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 +else + AR="$ac_cv_prog_AR" +fi + +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru + + + + + + + + + + + +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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:$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:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:$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:$LINENO: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:$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:$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 \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# 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:$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 test "${lt_cv_sys_global_symbol_pipe+set}" = set; 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};"\ +" /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 + + # 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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$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:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && 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 +#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. */ +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_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_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:$LINENO: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:$LINENO: result: ok" >&5 +$as_echo "ok" >&6; } +fi + + + + + + + + + + + + + + + + + + + + + + + +# 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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 6060 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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*) + LD="${LD-ld} -m elf_i386" + ;; + 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:$LINENO: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + lt_cv_cc_needs_belf=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_cc_needs_belf=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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:$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 + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + 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" + + + 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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DSYMUTIL+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:$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:$LINENO: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_NMEDIT+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:$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:$LINENO: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LIPO+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:$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:$LINENO: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:$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:$LINENO: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL64+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:$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:$LINENO: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:$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:$LINENO: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:$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:$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:$LINENO: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if test "${lt_cv_apple_cc_single_mod+set}" = set; 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 test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 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:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if test "${lt_cv_ld_exported_symbols_list+set}" = set; 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + lt_cv_ld_exported_symbols_list=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_ld_exported_symbols_list=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&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" != ":"; 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:$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 test "${ac_cv_prog_CPP+set}" = set; 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f 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:$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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +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:$LINENO: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 +rm -f 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +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 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +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` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = 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 +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +# Set options + + + + enable_dlopen=no + + + + # 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; pic_mode="$withval" +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:$LINENO: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if test "${lt_cv_objdir+set}" = set; 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:$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 + +# Sed substitution that helps us do robust quoting. It backslashifies +# 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' + +# 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 "X$cc_temp" | $Xsed -e 's%.*/%%' -e "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:$LINENO: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; 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:$LINENO: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; 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:$LINENO: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:$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 + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; 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:7885: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7889: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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:$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= + +{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + 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' + ;; + + 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 + 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) + 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' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # 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*) + # IBM XL C 8.0/Fortran 10.1 on PPC + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # 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='' + ;; + 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*) + 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:$LINENO: result: $lt_prog_compiler_pic" >&5 +$as_echo "$lt_prog_compiler_pic" >&6; } + + + + + + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:$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 test "${lt_cv_prog_compiler_pic_works+set}" = set; 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:8224: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:8228: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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:$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:$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 test "${lt_cv_prog_compiler_static_works+set}" = set; 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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/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:$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:$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 test "${lt_cv_prog_compiler_c_o+set}" = set; 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:8329: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:8333: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:$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 test "${lt_cv_prog_compiler_c_o+set}" = set; 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:8384: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:8388: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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:$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:$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:$LINENO: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:$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:$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_flag_spec_ld= + 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 + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = 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 + *\ [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.9.1, 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 modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_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' + 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/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + 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 + ;; + + 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) + 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= + 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; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # 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; $ECHO \"$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]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + 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; $ECHO \"$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*) + # 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= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $compiler_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 $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + 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 $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' + 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 $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 + ;; + + 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 $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 + + 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 + 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")) && (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 + 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. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +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 "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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 $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; 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. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +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 "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + 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. + 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 `$ECHO "X$deplibs" | $Xsed -e '\''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' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + 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=echo + 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 + ;; + + freebsd1*) + ld_shlibs=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 -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 -fPIC ${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 -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${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_flag_spec_ld='+b $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 -a "$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 -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${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' + ;; + *) + archive_cmds='$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 + 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 $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat >conftest.$ac_ext <<_ACEOF +int foo(void) {} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -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*) + 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" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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 "X-set_version $verstring" | $Xsed` -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 ${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 ${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:$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:$LINENO: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 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:$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:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +$as_echo "$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:$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 + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # 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 -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # 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; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +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 + 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 + 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=`$ECHO "X$lib" | $Xsed -e '\''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 + 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,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + 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="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + 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 + ;; + 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 + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # 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 + 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 + ;; + +freebsd1*) + dynamic_linker=no + ;; + +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[123]*) 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 + ;; + +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 + 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' + ;; + +interix[3-9]*) + 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' + 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 + 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 Linux ELF. +linux* | k*bsd*-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' + 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 + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then + shlibpath_overrides_runpath=yes +fi + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # 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 + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # 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;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $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' + ;; + +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 + 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 + 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 + 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 + 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 + 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 + 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:$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:$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:$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:$LINENO: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dl_dlopen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; 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 + + ;; + + *) + { $as_echo "$as_me:$LINENO: checking for shl_load" >&5 +$as_echo_n "checking for shl_load... " >&6; } +if test "${ac_cv_func_shl_load+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 (); +/* 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_shl_load || defined __stub___shl_load +choke me +#endif + +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_shl_load=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_shl_load=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +$as_echo "$ac_cv_func_shl_load" >&6; } +if test "x$ac_cv_func_shl_load" = x""yes; then + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dld_shl_load=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_shl_load=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$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" = x""yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + { $as_echo "$as_me:$LINENO: checking for dlopen" >&5 +$as_echo_n "checking for dlopen... " >&6; } +if test "${ac_cv_func_dlopen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 (); +/* 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_dlopen || defined __stub___dlopen +choke me +#endif + +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_dlopen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_dlopen=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +$as_echo "$ac_cv_func_dlopen" >&6; } +if test "x$ac_cv_func_dlopen" = x""yes; then + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dl_dlopen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_svld_dlopen=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_svld_dlopen=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = x""yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dld_dld_link=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_dld_link=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$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" = x""yes; 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:$LINENO: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self+set}" = set; 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 11187 "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 + +void fnord() { int i=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; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && 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:$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:$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 test "${lt_cv_dlopen_self_static+set}" = set; 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 11283 "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 + +void fnord() { int i=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; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && 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:$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:$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:$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:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:$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:$LINENO: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:$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:$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: + + +: ${CONFIG_LT=./config.lt} +{ $as_echo "$as_me:$LINENO: creating $CONFIG_LT" >&5 +$as_echo "$as_me: creating $CONFIG_LT" >&6;} +cat >"$CONFIG_LT" <<_LTEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate a libtool stub with the current configuration. + +lt_cl_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +## --------------------- ## +## 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 + + + + +# PATH needs CR +# 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_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 +if (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 + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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. +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); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +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 + + +# Name of the executable. +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'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +$as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 + +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="\ +pygobject config.lt 2.21.3 +configured by $0, generated by GNU Autoconf 2.63. + +Copyright (C) 2008 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=: ;; + + -*) { { $as_echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +$as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) { { $as_echo "$as_me:$LINENO: error: unrecognized argument: $1 +Try \`$0 --help' for more information." >&5 +$as_echo "$as_me: error: unrecognized argument: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + esac + shift +done + +if $lt_cl_silent; then + exec 6>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF + + +# 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' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +AS='`$ECHO "X$AS" | $Xsed -e "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "X$DLLTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' +LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +deplibs_check_method \ +file_magic_cmd \ +AR \ +AR_FLAGS \ +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 \ +SHELL \ +ECHO \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_wl \ +lt_prog_compiler_pic \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +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_flag_spec_ld \ +hardcode_libdir_separator \ +fix_srcfile_path \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$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 \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + +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' + + + +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +{ $as_echo "$as_me:$LINENO: creating $ofile" >&5 +$as_echo "$as_me: creating $ofile" >&6;} + + + # 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 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 + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Assembler program. +AS=$AS + +# DLL creation program. +DLLTOOL=$DLLTOOL + +# Object dumper program. +OBJDUMP=$OBJDUMP + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# 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 + +# 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 + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# 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 + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# 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 + +# 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 + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# 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 + +# 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 + +# 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 + +# 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 + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# 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 + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# 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 + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# 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 + +# 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 '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# 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 () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# 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 () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# 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_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}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# 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 () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -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 file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# 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 "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + +{ (exit 0); 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. +if test "$no_create" != yes; then + lt_cl_success=: + test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" + exec 5>/dev/null + $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false + exec 5>>config.log + $lt_cl_success || { (exit 1); exit 1; } +fi + +if test "x$CC" != xcc; then + { $as_echo "$as_me:$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:$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 { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; + 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:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define NO_MINUS_C_MINUS_O 1 +_ACEOF + +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 + + + + + + + + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + { $as_echo "$as_me:$LINENO: checking whether $PYTHON version >= 2.3.5" >&5 +$as_echo_n "checking whether $PYTHON version >= 2.3.5... " >&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.3.5'.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:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + { { $as_echo "$as_me:$LINENO: error: too old" >&5 +$as_echo "$as_me: error: too old" >&2;} + { (exit 1); exit 1; }; } +fi + + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + { $as_echo "$as_me:$LINENO: checking for a Python interpreter with version >= 2.3.5" >&5 +$as_echo_n "checking for a Python interpreter with version >= 2.3.5... " >&6; } +if test "${am_cv_pathless_PYTHON+set}" = set; then + $as_echo_n "(cached) " >&6 +else + + for am_cv_pathless_PYTHON in python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 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.3.5'.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:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PYTHON+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$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:$LINENO: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + + + if test "$PYTHON" = :; then + { { $as_echo "$as_me:$LINENO: error: no suitable Python interpreter found" >&5 +$as_echo "$as_me: error: no suitable Python interpreter found" >&2;} + { (exit 1); exit 1; }; } + else + + + { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON version" >&5 +$as_echo_n "checking for $am_display_PYTHON version... " >&6; } +if test "${am_cv_python_version+set}" = set; 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:$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:$LINENO: checking for $am_display_PYTHON platform" >&5 +$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } +if test "${am_cv_python_platform+set}" = set; 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:$LINENO: result: $am_cv_python_platform" >&5 +$as_echo "$am_cv_python_platform" >&6; } + PYTHON_PLATFORM=$am_cv_python_platform + + + + + { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON script directory" >&5 +$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } +if test "${am_cv_python_pythondir+set}" = set; 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:$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:$LINENO: checking for $am_display_PYTHON extension module directory" >&5 +$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } +if test "${am_cv_python_pyexecdir+set}" = set; 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:$LINENO: result: $am_cv_python_pyexecdir" >&5 +$as_echo "$am_cv_python_pyexecdir" >&6; } + pyexecdir=$am_cv_python_pyexecdir + + + + pkgpyexecdir=\${pyexecdir}/$PACKAGE + + + + fi + + + + + + + + # Find any Python interpreter. + if test -z "$PYTHON"; then + for ac_prog in python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 +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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PYTHON+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$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:$LINENO: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: no suitable Python interpreter found" >&5 +$as_echo "$as_me: error: no suitable Python interpreter found" >&2;} + { (exit 1); exit 1; }; } + else + + + { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON version" >&5 +$as_echo_n "checking for $am_display_PYTHON version... " >&6; } +if test "${am_cv_python_version+set}" = set; 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:$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:$LINENO: checking for $am_display_PYTHON platform" >&5 +$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } +if test "${am_cv_python_platform+set}" = set; 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:$LINENO: result: $am_cv_python_platform" >&5 +$as_echo "$am_cv_python_platform" >&6; } + PYTHON_PLATFORM=$am_cv_python_platform + + + + + { $as_echo "$as_me:$LINENO: checking for $am_display_PYTHON script directory" >&5 +$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } +if test "${am_cv_python_pythondir+set}" = set; 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 "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || + echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + 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:$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:$LINENO: checking for $am_display_PYTHON extension module directory" >&5 +$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } +if test "${am_cv_python_pyexecdir+set}" = set; 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 "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || + echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` + 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:$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:$LINENO: checking for headers required to compile python extensions" >&5 +$as_echo_n "checking for headers required to compile python extensions... " >&6; } +py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` +py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` +if test -x "$PYTHON-config"; then +PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` +else +PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" +if test "$py_prefix" != "$py_exec_prefix"; then + PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" +fi +fi + +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + { $as_echo "$as_me:$LINENO: result: found" >&5 +$as_echo "found" >&6; } + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { $as_echo "$as_me:$LINENO: result: not found" >&5 +$as_echo "not found" >&6; } +{ { $as_echo "$as_me:$LINENO: error: could not find Python headers" >&5 +$as_echo "$as_me: error: could not find Python headers" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.err conftest.$ac_ext +CPPFLAGS="$save_CPPFLAGS" + + +{ $as_echo "$as_me:$LINENO: checking for PySignal_SetWakeupFd in Python.h" >&5 +$as_echo_n "checking for PySignal_SetWakeupFd in Python.h... " >&6; } +py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` +if test -x "$PYTHON-config"; then +PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` +else +PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" +fi +old_CPPFLAGS=$CPPFLAGS +CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +PySignal_SetWakeupFd(0); + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + setwakeupfd_ok=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + setwakeupfd_ok=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $setwakeupfd_ok" >&5 +$as_echo "$setwakeupfd_ok" >&6; } +if test "x$setwakeupfd_ok" != xno; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PYSIGNAL_SETWAKEUPFD 1 +_ACEOF + +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 + + +# Check whether --enable-docs was given. +if test "${enable_docs+set}" = set; then + enableval=$enable_docs; enable_docs=$enableval +else + enable_docs=no +fi + +if test "${enable_docs}" != no; then + # Extract the first word of "xsltproc", so it can be a program name with args. +set dummy xsltproc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_XSLTPROC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $XSLTPROC in + [\\/]* | ?:[\\/]*) + ac_cv_path_XSLTPROC="$XSLTPROC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +XSLTPROC=$ac_cv_path_XSLTPROC +if test -n "$XSLTPROC"; then + { $as_echo "$as_me:$LINENO: result: $XSLTPROC" >&5 +$as_echo "$XSLTPROC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$XSLTPROC"; then + enable_docs=no + fi + + fi + + if test x$enable_docs != xno; then + ENABLE_DOCS_TRUE= + ENABLE_DOCS_FALSE='#' +else + ENABLE_DOCS_TRUE='#' + ENABLE_DOCS_FALSE= +fi + + + +py_mod_var=`echo thread'_' | sed 'y%./+-%__p_%'` +{ $as_echo "$as_me:$LINENO: checking for python module thread" >&5 +$as_echo_n "checking for python module thread... " >&6; } +if { as_var=py_cv_mod_$py_mod_var; eval "test \"\${$as_var+set}\" = set"; }; 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:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + enable_thread=no +fi + + +{ $as_echo "$as_me:$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:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + extra_mods= + THREADING_CFLAGS="-DDISABLE_THREADING" + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$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:$LINENO: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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:$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:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:$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:$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:$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:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$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.22.4 + { $as_echo "$as_me:$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_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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + 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, "%d.%d.%d", &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 (%d.%d.%d) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %d.%d.%d. 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 +rm -f 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +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 + +( exit $ac_status ) +no_glib=yes +fi +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext 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:$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:$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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; 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 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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="" + { { $as_echo "$as_me:$LINENO: error: maybe you want the pygobject-2-4 branch?" >&5 +$as_echo "$as_me: error: maybe you want the pygobject-2-4 branch?" >&2;} + { (exit 1); exit 1; }; } + 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` + + +pygobject_CODEGEN_DEFINES="" + + + + 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:$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:$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:$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:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FFI_CFLAGS=`$PKG_CONFIG --cflags "libffi >= 3.0" 2>/dev/null` +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:$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:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FFI_LIBS=`$PKG_CONFIG --libs "libffi >= 3.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +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 "libffi >= 3.0" 2>&1` + else + FFI_PKG_ERRORS=`$PKG_CONFIG --print-errors "libffi >= 3.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$FFI_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + have_libffi=no +elif test $pkg_failed = untried; then + have_libffi=no +else + FFI_CFLAGS=$pkg_cv_FFI_CFLAGS + FFI_LIBS=$pkg_cv_FFI_LIBS + { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: ffi requested, but not found" >&5 +$as_echo "$as_me: error: ffi requested, but not found" >&2;} + { (exit 1); exit 1; }; } +fi +if test x"$have_libffi" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FFI_H 1 +_ACEOF + + LIBFFI_PC=libffi +fi +{ $as_echo "$as_me:$LINENO: result: $have_libffi" >&5 +$as_echo "$have_libffi" >&6; } + 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:$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:$LINENO: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.22.4\"") >&5 + ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.22.4") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GIO_CFLAGS=`$PKG_CONFIG --cflags "gio-2.0 >= 2.22.4" 2>/dev/null` +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:$LINENO: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.22.4\"") >&5 + ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.22.4") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GIO_LIBS=`$PKG_CONFIG --libs "gio-2.0 >= 2.22.4" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +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 "gio-2.0 >= 2.22.4" 2>&1` + else + GIO_PKG_ERRORS=`$PKG_CONFIG --print-errors "gio-2.0 >= 2.22.4" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GIO_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + have_gio=false +elif test $pkg_failed = untried; then + have_gio=false +else + GIO_CFLAGS=$pkg_cv_GIO_CFLAGS + GIO_LIBS=$pkg_cv_GIO_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + have_gio=true +fi + + + if $have_gio; then + BUILD_GIO_TRUE= + BUILD_GIO_FALSE='#' +else + BUILD_GIO_TRUE='#' + BUILD_GIO_FALSE= +fi + +if test -n "$export_dynamic"; then + GIO_LIBS=`echo $GIO_LIBS | sed -e "s/$export_dynamic//"` +fi + + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for GIOUNIX" >&5 +$as_echo_n "checking for GIOUNIX... " >&6; } + +if test -n "$GIOUNIX_CFLAGS"; then + pkg_cv_GIOUNIX_CFLAGS="$GIOUNIX_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gio-unix-2.0 >= 2.22.4\"") >&5 + ($PKG_CONFIG --exists --print-errors "gio-unix-2.0 >= 2.22.4") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GIOUNIX_CFLAGS=`$PKG_CONFIG --cflags "gio-unix-2.0 >= 2.22.4" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GIOUNIX_LIBS"; then + pkg_cv_GIOUNIX_LIBS="$GIOUNIX_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gio-unix-2.0 >= 2.22.4\"") >&5 + ($PKG_CONFIG --exists --print-errors "gio-unix-2.0 >= 2.22.4") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GIOUNIX_LIBS=`$PKG_CONFIG --libs "gio-unix-2.0 >= 2.22.4" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +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 + GIOUNIX_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gio-unix-2.0 >= 2.22.4" 2>&1` + else + GIOUNIX_PKG_ERRORS=`$PKG_CONFIG --print-errors "gio-unix-2.0 >= 2.22.4" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GIOUNIX_PKG_ERRORS" >&5 + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + have_giounix=false +elif test $pkg_failed = untried; then + have_giounix=false +else + GIOUNIX_CFLAGS=$pkg_cv_GIOUNIX_CFLAGS + GIOUNIX_LIBS=$pkg_cv_GIOUNIX_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + have_giounix=true +fi + + + if $have_giounix; then + BUILD_GIOUNIX_TRUE= + BUILD_GIOUNIX_FALSE='#' +else + BUILD_GIOUNIX_TRUE='#' + BUILD_GIOUNIX_FALSE= +fi + +if test -n "$export_dynamic"; then + GIOUNIX_LIBS=`echo $GIOUNIX_LIBS | sed -e "s/$export_dynamic//"` +fi + +# Check whether --enable-pygi was given. +if test "${enable_pygi+set}" = set; then + enableval=$enable_pygi; enable_pygi=$enableval +else + enable_pygi=no +fi + +if test "$enable_pygi" != no; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_PYGI 1 +_ACEOF + +fi + +if test "x$GCC" = "xyes"; then + +case " $CFLAGS " in +*[\ \ ]-Wall[\ \ ]*) + ;; +*) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wall" + { $as_echo "$as_me:$LINENO: checking whether $CC understands -Wall" >&5 +$as_echo_n "checking whether $CC understands -Wall... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + jh_has_option=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + jh_has_option=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$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:$LINENO: checking whether $CC understands -fno-strict-aliasing" >&5 +$as_echo_n "checking whether $CC understands -fno-strict-aliasing... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + jh_has_option=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + jh_has_option=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$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:$LINENO: checking whether $CC understands -std=c9x" >&5 +$as_echo_n "checking whether $CC understands -std=c9x... " >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + jh_has_option=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + jh_has_option=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:$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 + +ac_config_files="$ac_config_files Makefile pygobject-2.0.pc pygobject-2.0-uninstalled.pc codegen/Makefile codegen/pygobject-codegen-2.0 docs/Makefile docs/reference/entities.docbook docs/xsl/fixxref.py glib/Makefile gobject/Makefile gio/Makefile examples/Makefile tests/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:$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= ;; #( + *) $as_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 + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:$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= +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. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + 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_echo "$as_me:$LINENO: error: conditional \"PLATFORM_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"PLATFORM_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"OS_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"OS_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${ENABLE_DOCS_TRUE}" && test -z "${ENABLE_DOCS_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_DOCS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"ENABLE_DOCS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAVE_LIBFFI_TRUE}" && test -z "${HAVE_LIBFFI_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_LIBFFI\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"HAVE_LIBFFI\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${BUILD_GIO_TRUE}" && test -z "${BUILD_GIO_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_GIO\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"BUILD_GIO\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${BUILD_GIOUNIX_TRUE}" && test -z "${BUILD_GIOUNIX_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_GIOUNIX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"BUILD_GIOUNIX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +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:$LINENO: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF || ac_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} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_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 + + + + +# PATH needs CR +# 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_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 +if (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 + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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. +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); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +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 + + +# Name of the executable. +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'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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 + +# 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 2.21.3, which was +generated by GNU Autoconf 2.63. 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 from templates according to the +current configuration. + +Usage: $0 [OPTION]... [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, 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 ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_version="\\ +pygobject config.status 2.21.3 +configured by $0, generated by GNU Autoconf 2.63, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2008 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=$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 ;; + --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"` ;; + esac + CONFIG_FILES="$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 + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { $as_echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --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_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$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' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +AS='`$ECHO "X$AS" | $Xsed -e "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "X$DLLTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' +LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +deplibs_check_method \ +file_magic_cmd \ +AR \ +AR_FLAGS \ +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 \ +SHELL \ +ECHO \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_wl \ +lt_prog_compiler_pic \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +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_flag_spec_ld \ +hardcode_libdir_separator \ +fix_srcfile_path \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$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 \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + +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' + +ac_aux_dir='$ac_aux_dir' + + + +_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-2.0.pc") CONFIG_FILES="$CONFIG_FILES pygobject-2.0.pc" ;; + "pygobject-2.0-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES pygobject-2.0-uninstalled.pc" ;; + "codegen/Makefile") CONFIG_FILES="$CONFIG_FILES codegen/Makefile" ;; + "codegen/pygobject-codegen-2.0") CONFIG_FILES="$CONFIG_FILES codegen/pygobject-codegen-2.0" ;; + "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "docs/reference/entities.docbook") CONFIG_FILES="$CONFIG_FILES docs/reference/entities.docbook" ;; + "docs/xsl/fixxref.py") CONFIG_FILES="$CONFIG_FILES docs/xsl/fixxref.py" ;; + "glib/Makefile") CONFIG_FILES="$CONFIG_FILES glib/Makefile" ;; + "gobject/Makefile") CONFIG_FILES="$CONFIG_FILES gobject/Makefile" ;; + "gio/Makefile") CONFIG_FILES="$CONFIG_FILES gio/Makefile" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "PKG-INFO") CONFIG_FILES="$CONFIG_FILES PKG-INFO" ;; + + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + 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= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + $as_echo "$as_me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# 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=' ' +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 {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } +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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + 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 >>"\$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 >>"\$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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ 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[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +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 >"$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_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} + { (exit 1); exit 1; }; } + 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_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 +$as_echo "$as_me: error: could not setup config headers machinery" >&2;} + { (exit 1); exit 1; }; } +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_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + { (exit 1); exit 1; }; };; + :[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="$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_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + ac_file_inputs="$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:$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 >"$tmp/stdin" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; + 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" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + 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:$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 "$tmp/subs.awk" >$tmp/out \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:$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 "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } + 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:$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"" || { + # Autoconf 2.62 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"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/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 + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # 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 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 + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Assembler program. +AS=$AS + +# DLL creation program. +DLLTOOL=$DLLTOOL + +# Object dumper program. +OBJDUMP=$OBJDUMP + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# 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 + +# 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 + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# 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 + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# 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 + +# 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 + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# 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 + +# 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 + +# 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 + +# 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 + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# 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 + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# 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 + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# 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 + +# 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 '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# 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 () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# 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 () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# 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_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}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# 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 () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -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 file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# 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 "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + +# 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 || { (exit 1); exit 1; } +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +echo +echo "libffi support: $have_libffi" +echo diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4146420 --- /dev/null +++ b/configure.ac @@ -0,0 +1,244 @@ +-*- mode: m4 -*- +AC_PREREQ(2.52) + +dnl the pygobject version number +m4_define(pygobject_major_version, 2) +m4_define(pygobject_minor_version, 21) +m4_define(pygobject_micro_version, 3) +m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version) + +dnl versions of packages we require ... +m4_define(glib_required_version, 2.22.4) +m4_define(gio_required_version, 2.22.4) +m4_define(giounix_required_version, 2.22.4) + +AC_INIT(pygobject, pygobject_version, + [http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject]) +AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .") +AC_CONFIG_MACRO_DIR([m4]) + +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_SRCDIR([gobject/gobjectmodule.c]) +AM_CONFIG_HEADER(config.h) + +AM_INIT_AUTOMAKE + +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") + +AC_DISABLE_STATIC + +dnl XXXX hack to kill off all the libtool tags ... +dnl it isn't like we are using C++ or Fortran. +dnl (copied from libglade/configure.in) +m4_define([_LT_AC_TAGCONFIG],[]) + +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL +dnl when using libtool 2.x create libtool early, because it's used in configure +m4_ifdef([LT_OUTPUT], [LT_OUTPUT]) +AM_PROG_CC_C_O + +JD_PATH_PYTHON(2.3.5) + +JD_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) + +AC_MSG_CHECKING([for PySignal_SetWakeupFd in Python.h]) +py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` +if test -x "$PYTHON-config"; then +PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` +else +PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" +fi +old_CPPFLAGS=$CPPFLAGS +CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES" +AC_TRY_COMPILE([#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, + AC_HELP_STRING([--disable-thread], [Disable pygobject threading support]),, + enable_thread=yes) + +dnl Building documentation +AC_ARG_ENABLE(docs, + AC_HELP_STRING([--enable-docs], [Enable documentation building]),enable_docs=$enableval, + enable_docs=no) +if test "${enable_docs}" != no; then + dnl + dnl Check for xsltproc + dnl + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test -z "$XSLTPROC"; then + enable_docs=no + fi + + dnl check for DocBook DTD and stylesheets in the local catalog. + dnl JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN], + dnl [DocBook XML DTD V4.1.2],,enable_docs=no) + dnl JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl], + dnl [DocBook XSL Stylesheets],,enable_docs=no) +fi + +AM_CONDITIONAL(ENABLE_DOCS, test x$enable_docs != xno) + +AM_CHECK_PYMOD(thread,,,enable_thread=no) + +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]) + +pygobject_CODEGEN_DEFINES="" +AC_SUBST([pygobject_CODEGEN_DEFINES]) + +AS_AC_EXPAND(DATADIR, $datadir) + +dnl libffi +AC_MSG_CHECKING(for ffi) +AC_ARG_WITH(ffi, + AC_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 + AC_DEFINE(HAVE_FFI_H,1,[Have libffi include files]) + LIBFFI_PC=libffi +fi +AC_MSG_RESULT([$have_libffi]) +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, + have_gio=true, have_gio=false) +AC_SUBST(GIO_CFLAGS) +AC_SUBST(GIO_LIBS) +AM_CONDITIONAL(BUILD_GIO, $have_gio) +if test -n "$export_dynamic"; then + GIO_LIBS=`echo $GIO_LIBS | sed -e "s/$export_dynamic//"` +fi + +dnl giounix +PKG_CHECK_MODULES(GIOUNIX, gio-unix-2.0 >= giounix_required_version, + have_giounix=true, have_giounix=false) +AC_SUBST(GIOUNIX_CFLAGS) +AC_SUBST(GIOUNIX_LIBS) +AM_CONDITIONAL(BUILD_GIOUNIX, $have_giounix) +if test -n "$export_dynamic"; then + GIOUNIX_LIBS=`echo $GIOUNIX_LIBS | sed -e "s/$export_dynamic//"` +fi + +AC_ARG_ENABLE(pygi, + AC_HELP_STRING([--enable-pygi], [Use PyGI to create wrappers for introspection-enabled types]), + enable_pygi=$enableval, + enable_pygi=no) +if test "$enable_pygi" != no; then + AC_DEFINE(ENABLE_PYGI,1,Use PyGI to create wrappers for introspection-enabled types) +fi + +dnl add required cflags ... +if test "x$GCC" = "xyes"; then + JH_ADD_CFLAG([-Wall]) + JH_ADD_CFLAG([-fno-strict-aliasing]) + + case $host_os in + solaris*) + ;; + *) + JH_ADD_CFLAG([-std=c9x]) + ;; + esac + +fi + +AC_CONFIG_FILES( + Makefile + pygobject-2.0.pc + pygobject-2.0-uninstalled.pc + codegen/Makefile + codegen/pygobject-codegen-2.0 + docs/Makefile + docs/reference/entities.docbook + docs/xsl/fixxref.py + glib/Makefile + gobject/Makefile + gio/Makefile + examples/Makefile + tests/Makefile + PKG-INFO) +AC_OUTPUT + +echo +echo "libffi support: $have_libffi" +echo diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..df8eea7 --- /dev/null +++ b/depcomp @@ -0,0 +1,630 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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 outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +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" + +# 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 + +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 -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## 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). +## - 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 -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## 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. + tr ' ' ' +' < "$tmpdepfile" | +## 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. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -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 -eq 0; then : + else + 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 ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + 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 -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + 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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + 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 -eq 0; then : + else + 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,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # 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.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + 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" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + 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:: \1 \\:p' >> "$depfile" + echo " " >> "$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.am b/docs/Makefile.am new file mode 100644 index 0000000..391eec8 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,195 @@ +REF_VERSION = $(PYGOBJECT_MAJOR_VERSION).$(PYGOBJECT_MINOR_VERSION) +FULL_VERSION = $(REF_VERSION).$(PYGOBJECT_MICRO_VERSION) + +BUILDDIR = $(top_builddir)/docs + +CSS_FILES = style.css + +HTML_FILES = \ + html/class-gobjectgboxed.html \ + html/class-gobjectginterface.html \ + html/class-gobjectgpointer.html \ + html/class-gobject.html \ + html/class-glibmaincontext.html \ + html/class-glibmainloop.html \ + html/glib-constants.html \ + html/glib-functions.html \ + html/gobject-class-reference.html \ + html/glib-class-reference.html \ + html/class-gioapplaunchcontext.html \ + html/class-gioappinfo.html \ + html/class-gioasyncresult.html \ + html/class-giobufferedinputstream.html \ + html/class-giobufferedoutputstream.html \ + html/class-giocancellable.html \ + html/class-giodatainputstream.html \ + html/class-giodataoutputstream.html \ + html/class-giodrive.html \ + html/class-gioemblem.html \ + html/class-gioemblemedicon.html \ + html/class-giofile.html \ + html/class-giofileattributeinfo.html \ + html/class-giofileenumerator.html \ + html/class-giofileicon.html \ + html/class-giofileinfo.html \ + html/class-giofileinputstream.html \ + html/class-giofilemonitor.html \ + html/class-giofileoutputstream.html \ + html/class-giofilterinputstream.html \ + html/class-giofilteroutputstream.html \ + html/class-gioicon.html \ + html/class-gioinputstream.html \ + html/class-gioloadableicon.html \ + html/class-giomemoryinputstream.html \ + html/class-giomemoryoutputstream.html \ + html/class-giomount.html \ + html/class-giomountoperation.html \ + html/class-giooutputstream.html \ + html/class-gioseekable.html \ + html/class-giosimpleasyncresult.html \ + html/class-giothemedicon.html \ + html/class-giounixinputstream.html \ + html/class-giounixoutputstream.html \ + html/class-giovolume.html \ + html/class-giovolumemonitor.html \ + html/gio-constants.html \ + html/gio-functions.html \ + html/gio-class-reference.html \ + html/giounix-class-reference.html \ + html/gobject-constants.html \ + html/gobject-functions.html \ + html/index.html \ + html/index.sgml \ + html/pygobject.devhelp \ + html/pygobject-introduction.html + + +XML_FILES = \ + reference/pygobject.xml \ + reference/pygobject-introduction.xml \ + reference/pygobject-classes.xml \ + reference/pygobject-constants.xml \ + reference/pygobject-ref.xml \ + reference/pygobject-functions.xml \ + reference/pygobject-gboxed.xml \ + reference/pygobject-ginterface.xml \ + reference/pygobject-gpointer.xml \ + reference/pyglib-classes.xml \ + reference/pyglib-constants.xml \ + reference/pyglib-functions.xml \ + reference/pyglib-maincontext.xml \ + reference/pyglib-mainloop.xml \ + reference/pygio-classes.xml \ + reference/pygiounix-classes.xml \ + reference/pygio-constants.xml \ + reference/pygio-functions.xml \ + reference/pygio-applaunchcontext.xml \ + reference/pygio-appinfo.xml \ + reference/pygio-asyncresult.xml \ + reference/pygio-bufferedinputstream.xml \ + reference/pygio-bufferedoutputstream.xml \ + reference/pygio-cancellable.xml \ + reference/pygio-datainputstream.xml \ + reference/pygio-dataoutputstream.xml \ + reference/pygio-drive.xml \ + reference/pygio-emblem.xml \ + reference/pygio-emblemedicon.xml \ + reference/pygio-file.xml \ + reference/pygio-fileattributeinfo.xml \ + reference/pygio-fileenumerator.xml \ + reference/pygio-fileicon.xml \ + reference/pygio-fileinfo.xml \ + reference/pygio-fileinputstream.xml \ + reference/pygio-filemonitor.xml \ + reference/pygio-fileoutputstream.xml \ + reference/pygio-filterinputstream.xml \ + reference/pygio-filteroutputstream.xml \ + reference/pygio-icon.xml \ + reference/pygio-inputstream.xml \ + reference/pygio-loadableicon.xml \ + reference/pygio-memoryinputstream.xml \ + reference/pygio-memoryoutputstream.xml \ + reference/pygio-mount.xml \ + reference/pygio-mountoperation.xml \ + reference/pygio-outputstream.xml \ + reference/pygio-seekable.xml \ + reference/pygio-simpleasyncresult.xml \ + reference/pygio-themedicon.xml \ + reference/pygio-unixinputstream.xml \ + reference/pygio-unixoutputstream.xml \ + reference/pygio-volume.xml \ + reference/pygio-volumemonitor.xml + +XSL_FILES = \ + xsl/common.xsl \ + xsl/devhelp.xsl \ + xsl/html.xsl \ + xsl/pdf-style.xsl \ + xsl/pdf.xsl \ + xsl/ref-html-style.xsl + +# fixxref cannot be included in XSL_FILES, because automake is touching it +# so the date is newer then the files in HTML_FILES +FIXXREF = xsl/fixxref.py + +TARGET_DIR = $(datadir)/gtk-doc/html/pygobject +CSSdir = $(TARGET_DIR) +CSS_DATA = $(CSS_FILES) + + +install-data-local: + installfiles=`echo $(srcdir)/html/*`; \ + if test "$$installfiles" = '$(srcdir)/html/*'; \ + then echo '-- Nothing to install' ; \ + else \ + $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \ + for i in $$installfiles; do \ + echo '-- Installing '$$i ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \ + done; \ + echo '-- Installing $(srcdir)/html/index.sgml' ; \ + $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \ + fi + +uninstall-local: + rm -f $(DESTDIR)$(TARGET_DIR)/* + + +XSLdir = $(datadir)/pygobject/xsl +XSL_DATA = $(XSL_FILES) $(FIXXREF) + +EXTRA_DIST = \ + $(HTML_FILES) \ + $(XML_FILES) \ + $(XSL_FILES) \ + $(FIXXREF) \ + $(CSS_FILES) + +reference/builddate.xml: + @$(PYTHON) -c 'import datetime; print datetime.date.today()' > $@ + + +if ENABLE_DOCS + +BUILT_SOURCES = reference/builddate.xml $(HTML_FILES) +CLEANFILES = reference/builddate.xml $(HTML_FILES) + + +# Do not add a builddate.xml dependency here, because the generated html +# documentation will be included in the tarball so xsltproc is not needed to +# install the documentation. Adding a builddate.xml dependency will force +# the documentation to be rebuilt when it doesn't need to be. +$(HTML_FILES): $(XML_FILES) $(XSL_FILES) + @xsltproc --nonet --xinclude -o $(BUILDDIR)/html/ \ + --path $(BUILDDIR)/reference:$(srcdir)/reference \ + --stringparam gtkdoc.bookname "pygobject" \ + --stringparam gtkdoc.version ${REF_VERSION} \ + $(srcdir)/xsl/ref-html-style.xsl \ + $(srcdir)/reference/pygobject-ref.xml + +# pdf: $(REFERENCE_DEPS) reference/builddate.xml +# xsltproc --nonet --xinclude -o pygobject-ref.fo xsl/pdf-style.xsl \ +# reference/pygobject-ref.xml +# pdfxmltex pygobject-ref.fo >output $@ + +# Do not add a builddate.xml dependency here, because the generated html +# documentation will be included in the tarball so xsltproc is not needed to +# install the documentation. Adding a builddate.xml dependency will force +# the documentation to be rebuilt when it doesn't need to be. +@ENABLE_DOCS_TRUE@$(HTML_FILES): $(XML_FILES) $(XSL_FILES) +@ENABLE_DOCS_TRUE@ @xsltproc --nonet --xinclude -o $(BUILDDIR)/html/ \ +@ENABLE_DOCS_TRUE@ --path $(BUILDDIR)/reference:$(srcdir)/reference \ +@ENABLE_DOCS_TRUE@ --stringparam gtkdoc.bookname "pygobject" \ +@ENABLE_DOCS_TRUE@ --stringparam gtkdoc.version ${REF_VERSION} \ +@ENABLE_DOCS_TRUE@ $(srcdir)/xsl/ref-html-style.xsl \ +@ENABLE_DOCS_TRUE@ $(srcdir)/reference/pygobject-ref.xml + +# pdf: $(REFERENCE_DEPS) reference/builddate.xml +# xsltproc --nonet --xinclude -o pygobject-ref.fo xsl/pdf-style.xsl \ +# reference/pygobject-ref.xml +# pdfxmltex pygobject-ref.fo >output gio.AppInfo

gio.AppInfo

gio.AppInfo — Information about an installed application and methods to launch it (with file arguments).

Synopsis

class gio.AppInfo(gobject.GInterface):
+    gio.AppInfo(commandline, application_name=None, flags=gio.APP_INFO_CREATE_NONE)
def add_supports_type(content_type)
def can_delete()
def can_remove_supports_type()
def delete()
def dup()
def equal(appinfo2)
def get_commandline()
def get_description()
def get_executable()
def get_icon()
def get_id()
def get_name()
def launch(files, launch_context)
def launch_uris(uris, launch_context)
def remove_supports_type(content_type)
def set_as_default_for_extension(extension)
def set_as_default_for_type(content_type)
def should_show()
def supports_files()
def supports_uris()
+Functions
+ 
+    def gio.app_info_get_all()
def gio.app_info_get_all_for_type(content_type)
def gio.app_info_get_default_for_type(content_type, must_support_uris)
def gio.app_info_get_default_for_uri_scheme(uri_scheme)
def gio.app_info_reset_type_association(content_type)

Ancestry

+-- gobject.GInterface
+  +-- gio.AppInfo
+

Known Implementation

+ gio.AppInfo is implemented by + gio.DesktopAppInfo +

Description

+ gio.AppInfo + and gio.AppLaunchContext + are used for describing and launching applications installed on the system. +

+ As of GLib 2.20, URIs will always be converted to POSIX paths (using + gio.File.get_path()) when using + gio.AppInfo.launch() + even if the application requested an URI and not a POSIX path. For example for an desktop-file + based application with Exec key totem %U and a single URI, sftp://foo/file.avi, then /home/user/.gvfs/sftp + on foo/file.avi will be passed. This will only work if a set of suitable GIO extensions (such as gvfs 2.26 + compiled with FUSE support), is available and operational; if this is not the case, the URI will be passed + unmodified to the application. Some URIs, such as mailto:, of course cannot be mapped to a POSIX path + (in gvfs there's no FUSE mount for it); such URIs will be passed unmodified to the application. +

+ Specifically for gvfs 2.26 and later, the POSIX URI will be mapped back to the GIO URI in the + gio.File constructors + (since gvfs implements the GVfs extension point). As such, if the application needs to examine the URI, + it needs to use + gio.File.get_uri() + or similar on + gio.File. + In other words, an application cannot assume that the URI passed to e.g. + gio.File() constructor + is equal to the result of + gio.File.get_uri(). +

Constructor

    gio.AppInfo(commandline, application_name=None, flags=gio.APP_INFO_CREATE_NONE)

commandline :

the commandline to use +

application_name :

the application name, or None to use commandline. +

flags :

flags that can specify details of the created, + from Gio AppInfo Create Flags Constants +

Returns :

a new + gio.AppInfo + for given command. +

+ Creates a new gio.AppInfo + from the given information. +

Methods

gio.AppInfo.add_supports_type

    def add_supports_type(content_type)

content_type :

A string.

+ The add_supports_type() method adds a content type + to the application information to indicate the application is capable of + opening files with the given content type. +

gio.AppInfo.can_delete

    def can_delete()

Returns :

True if appinfo can be deleted. +

+ The can_delete() method obtains the information + whether the gio.AppInfo + can be deleted. See + gio.AppInfo.delete(). +

gio.AppInfo.can_remove_supports_type

    def can_remove_supports_type()

Returns :

True if it is possible to remove + supported content types from a given appinfo, False + if not.

+ The can_remove_supports_type() method checks if a + supported content type can be removed from an application. +

gio.AppInfo.delete

    def delete()

Returns :

True if appinfo has been deleted. +

+ The delete() method tries to delete an + gio.AppInfo. +

+ On some platforms, there may be a difference between user-defined + gio.AppInfos + which can be deleted, and system-wide ones which cannot. See + gio.AppInfo.can_delete(). +

gio.AppInfo.dup

    def dup()

Returns :

A duplicate of appinfo.

+ The dup() method creates a duplicate of a + gio.AppInfo. +

gio.AppInfo.equal

    def equal(icon2)

appinfo2 :

the second + gio.AppInfo +

Returns :

True if appinfo1 is equal to appinfo2. + False otherwise.

+ The equal() method checks if two + gio.AppInfos are equal. +

gio.AppInfo.get_commandline

    def get_commandline()

Returns :

a string containing the appinfo's commandline, or + None if this information is not available. +

+ The get_commandline() method gets the + commandline with which the application will be started. +

gio.AppInfo.get_description

    def get_description()

Returns :

A string containing a description of the application + appinfo, or None if none.

+ The get_description() method gets a human-readable + description of an installed application. +

gio.AppInfo.get_executable

    def get_executable()

Returns :

a string containing the appinfo's application + binary's name. +

+ The get_description() method gets the executable's + name for the installed application. +

gio.AppInfo.get_icon

    def get_icon()

Returns :

the default + gio.Icon for appinfo. +

+ The get_icon() method gets the icon for the application. +

gio.AppInfo.get_id

    def get_id()

Returns :

a string containing the application's ID. +

+ The get_id() method gets the ID of an application. + An id is a string that identifies the application. The exact format of the + id is platform dependent. For instance, on Unix this is the desktop file id + from the xdg menu specification. +

+ Note that the returned ID may be None, depending on + how the appinfo has been constructed. +

gio.AppInfo.get_name

    def get_name()

Returns :

the name of the application for appinfo. +

+ The get_name() method gets the installed + name of the application. +

gio.AppInfo.launch

    def launch(files, launch_context)

files :

a list of gio.File objects. +

launch_context :

a gio.AppLaunchContext + or None.

Returns :

True on successful launch, + False otherwise. +

+ The launch() method launches the application. + Passes files to the launched application as arguments, using the optional + launch_context to get information about the details of the launcher + (like what screen it is on). On error, error will be set accordingly. +

+ To lauch the application without arguments pass a None for files list. +

+ Note that even if the launch is successful the application launched can fail + to start if it runs into problems during startup. There is no way to detect this. +

+ Some URIs can be changed when passed through a + gio.File + (for instance unsupported uris with strange formats like mailto:), so + if you have a textual uri you want to pass in as argument, consider using + gio.File.launch_uris() + instead. +

gio.AppInfo.launch_uris

    def launch_uris(uris, launch_context)

uris :

a list containing URIs to launch. +

launch_context :

a gio.AppLaunchContext + or None.

Returns :

True on successful launch, + False otherwise. +

+ The launch_uris() method launches the application. + Passes uris to the launched application as arguments, using the optional + launch_context to get information about the details of the launcher + (like what screen it is on). On error, error will be set accordingly. +

+ To lauch the application without arguments pass a None for files list. +

+ Note that even if the launch is successful the application launched can fail + to start if it runs into problems during startup. There is no way to detect this. +

gio.AppInfo.remove_supports_type

    def remove_supports_type(content_type)

content_type :

A string.

+ The remove_supports_type() method removes a + supported type from an application, if possible. +

gio.AppInfo.set_as_default_for_extension

    def set_as_default_for_extension(extension)

extension :

A string containing the file extension (without the dot). +

+ The set_as_default_for_extension() method sets the + application as the default handler for the given file extention. +

gio.AppInfo.set_as_default_for_type

    def set_as_default_for_type(content_type)

content_type :

The content type. +

+ The set_as_default_for_type() method sets the + application as the default handler for a given type. +

gio.AppInfo.should_show

    def should_show()

Returns :

True if the appinfo should be shown, + False otherwise. +

+ The should_show() method checks if the application + info should be shown in menus that list available applications. +

gio.AppInfo.supports_files

    def supports_files()

Returns :

True if the appinfo supports files. +

+ The supports_files() method checks if the application + accepts files as arguments. +

gio.AppInfo.supports_uris

    def supports_uris()

Returns :

True if the appinfo supports uris. +

+ The supports_uris() method checks if the application + accepts uris as arguments. +

Functions

gio.app_info_get_all

    def app_info_get_all()

Returns :

A list of gio.AppInfos. +

+ The app_info_get_all() function gets a list of all of + the applications currently registered on this system. +

+ For desktop files, this includes applications that have NoDisplay=true set or are + excluded from display by means of OnlyShowIn or NotShowIn. See + gio.AppInfo.should_show(). + The returned list does not include applications which have the Hidden key set. +

gio.app_info_get_all_for_type

    def app_info_get_all_for_type(content_type)

content_type :

the content type to find a + gio.AppInfo + for.

Returns :

A list of gio.AppInfos + for a given content type or None on error. +

+ The app_info_get_all_for_type() function gets a list of all + gio.AppInfos + for a given content type. +

gio.app_info_get_default_for_type

    def app_info_get_default_for_type(content_type, must_support_uris)

content_type :

the content type to find a + gio.AppInfo + for.

must_support_uris :

if True, the + gio.AppInfo + is expected to support URIs

Returns :

gio.AppInfo + for given content_type or None on error. +

+ The app_info_get_default_for_type() function gets the + gio.AppInfo + that correspond to a given content type. +

gio.app_info_get_default_for_uri_scheme

    def app_info_get_default_for_uri_scheme(uri_scheme)

uri_scheme :

a string containing a URI scheme.

Returns :

gio.AppInfo + for given uri_scheme or None on error. +

+ The app_info_get_default_for_uri_scheme() function gets + the default application for launching applications using this URI scheme. A URI + scheme is the initial part of the URI, up to but not including the + ':', e.g. "http", "ftp" or "sip". +

gio.app_info_reset_type_association

    def app_info_reset_type_association(content_type)

content_type :

a content type

+ The app_info_reset_type_association() function + removes all changes to the type associations done by + set_as_default_for_type(), + set_as_default_for_extension(), + add_supports_type() or + remove_supports_type(). +

diff --git a/docs/html/class-gioapplaunchcontext.html b/docs/html/class-gioapplaunchcontext.html new file mode 100644 index 0000000..32c735f --- /dev/null +++ b/docs/html/class-gioapplaunchcontext.html @@ -0,0 +1,44 @@ +gio.AppLaunchContext

gio.AppLaunchContext

gio.AppLaunchContext — Application launch context.

Synopsis

class gio.AppLaunchContext(gobject.GObject):
+    gio.AppLaunchContext()
def get_display(info, files)
def get_startup_notify_id(info, files)
def launch_failed(startup_notify_id)

Description

+ The gio.AppLaunchContext + is used for integrating the launch with the launching application. This is used to handle for + instance startup notification and launching the new application on the same screen as the launching window. +

Constructor

    gio.AppLaunchContext()

Returns :

a new + gio.AppLaunchContext. +

+ Creates a new application launch context. This is not normally used, instead + you instantiate a subclass of this, such as + gtk.gdk.AppLaunchContext. +

Methods

gio.AppLaunchContext.get_display

    def get_display(info, files)

info :

a + gio.AppInfo +

files :

a list of + gio.File + objects.

Returns :

a display string for the display. +

+ The get_display() method gets the display + string for the display. This is used to ensure new applications + are started on the same display as the launching application. +

gio.AppLaunchContext.get_startup_notify_id

    def get_startup_notify_id(info, files)

info :

a + gio.AppInfo +

files :

a list of + gio.File + objects.

Returns :

a startup notification ID for the application, + or None if not supported. +

+ The get_startup_notify_id() method initiates + startup notification for the application and returns the DESKTOP_STARTUP_ID + for the launched operation, if supported. +

+ Startup notification IDs are defined in the FreeDesktop.Org Startup Notifications standard. +

gio.AppLaunchContext.launch_failed

    def launch_failed(startup_notify_id)

startup_notify_id :

the startup notification id that was returned by + get_startup_notify_id. +

Returns :

a startup notification ID for the application, + or None if not supported. +

+ The get_startup_notify_id() method is called + when an application has failed to launch, so that it can cancel the application + startup notification started in + get_startup_notify_id +

diff --git a/docs/html/class-gioasyncresult.html b/docs/html/class-gioasyncresult.html new file mode 100644 index 0000000..39f491f --- /dev/null +++ b/docs/html/class-gioasyncresult.html @@ -0,0 +1,44 @@ +gio.AsyncResult

gio.AsyncResult

gio.AsyncResult — Asynchronous Function Results.

Synopsis

class gio.AsyncResult(gobject.GInterface):
+    def get_source_object()

Prerequisites

+ gio.AsyncResult is required by + gobject.GObject. +

Known Implementation

+ gio.AsyncResult is implemented by + gio.SimpleAsyncResult. +

Description

+ gio.AsyncResult + provides a base class for implementing asynchronous function results. +

+ Asynchronous operations are broken up into two separate operations which are chained + together by a GAsyncReadyCallback. To begin an asynchronous operation, provide a + GAsyncReadyCallback to the asynchronous function. This callback will be triggered when + the operation has completed, and will be passed a GAsyncResult instance filled with the + details of the operation's success or failure, the object the asynchronous function was + started for and any error codes returned. The asynchronous callback function is then expected + to call the corresponding "_finish()" function with the object the function was called for, + and the gio.AsyncResult + instance, and optionally, an error to grab any error conditions that may have occurred. +

+ The purpose of the "_finish()" function is to take the generic result of type GAsyncResult and + return the specific result that the operation in question yields (e.g. a + gio.FileEnumerator + for a "enumerate children" operation). If the result or error status of the operation is not needed, + there is no need to call the "_finish()" function, GIO will take care of cleaning up the result and error + information after the GAsyncReadyCallback returns. It is also allowed to take a reference to the + gio.AsyncResult + and call "_finish()" later. +

+ The callback for an asynchronous operation is called only once, and is always called, even + in the case of a cancelled operation. On cancellation the result is a gio.ERROR_CANCELLED error. +

+ Some ascynchronous operations are implemented using synchronous calls. These are run in a + separate thread, if GThread has been initialized, but otherwise they are sent to the Main Event + Loop and processed in an idle function. So, if you truly need asynchronous operations, make + sure to initialize GThread. +

Methods

gio.AsyncResult.get_source_object

    def get_source_object()

Returns :

the source object for the res. +

+ The get_source_object() method gets the source object + from a gio.AsyncResult +

diff --git a/docs/html/class-giobufferedinputstream.html b/docs/html/class-giobufferedinputstream.html new file mode 100644 index 0000000..2f2f5d6 --- /dev/null +++ b/docs/html/class-giobufferedinputstream.html @@ -0,0 +1,133 @@ +gio.BufferedInputStream

gio.BufferedInputStream

gio.BufferedInputStream — Buffered Input Stream

Synopsis

class gio.BufferedInputStream(gio.FilterInputStream):
+    gio.BufferedInputStream(base_stream)
def fill(count, cancellable=None)
def fill_async(count, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def fill_finish(result)
def get_available()
def get_buffer_size()
def read_byte(cancellable=None)
def set_buffer_size(size)
+Functions
+ 
+    def gio.buffered_input_stream_new_sized(size)

gio.BufferedInputStream Properties

"buffer-size"Read - Write - ConstructThe size of the backend buffer. Allowed values: >= 1. Default value: 4096.

Description

+ gio.BufferedInputStream + implements gio.FilterInputStream + and provides for buffered reads. +

+ By default, + gio.BufferedInputStream's + buffer size is set at 4 kilobytes. +

+ To create a buffered input stream, use + gio.BufferedInputStream(), + or gio.buffered_input_stream_new_sized() + to specify the buffer's size at construction. +

+ To get the size of a buffer within a buffered input stream, use + get_buffer_size(). + To change the size of a buffered input stream's buffer, use + set_buffer_size(). + Note that the buffer's size cannot be reduced below the size of the data within the buffer. +

Constructor

    gio.BufferedInputStream(base_stream)

base_stream :

a + gio.InputStream. +

Returns :

a new + gio.InputStream + for the given base_stream. +

+ Creates a new gio.InputStream + from the given base_stream, with a buffer set to the default size (4 kilobytes). +

Methods

gio.BufferedInputStream.fill

    def fill(count, cancellable=None)

count :

the number of bytes that will be read from the stream. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

the number of bytes read into stream's buffer, + up to count, or -1 on error. +

+ The fill() method tries to read count bytes + from the stream into the buffer. Will block during this read. +

+ If count is zero, returns zero and does nothing. A value of count + larger than G_MAXSSIZE will cause a gio.ERROR_INVALID_ARGUMENT error. +

+ On success, the number of bytes read into the buffer is returned. It + is not an error if this is not the same as the requested size, as it can + happen e.g. near the end of a file. Zero is returned on end of file + (or if count is zero), but never otherwise. +

+ If count is -1 then the attempted read size is equal to the number + of bytes that are required to fill the buffer. +

+ If cancellable is not None, then the operation can + be cancelled by triggering the cancellable object from another thread. + If the operation was cancelled, the error gio.ERROR_CANCELLED will be + returned. If an operation was partially finished when the operation was + cancelled the partial result will be returned, without an error. +

+ On error -1 is returned and error is set accordingly. +

+ For the asynchronous, non-blocking, version of this function, see + gio.BufferedInputStream.fill_async(). +

gio.BufferedInputStream.fill_async

    def fill_async(count, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

count :

the number of bytes that will be read from the stream. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The fill_async() method reads data into stream's + buffer asynchronously, up to count size. io_priority can be used to + prioritize reads. +

+ For the synchronous version of this function, see + gio.BufferedInputStream.fill(). +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set +

+ If count is -1 then the attempted read size is equal to the number of bytes + that are required to fill the buffer. +

gio.BufferedInputStream.fill_finish

    def fill_finish(result)

result :

a gio.AsyncResult. +

Returns :

the size of the read stream, or -1 on an error. +

+ The fill_finish() method finishes an asynchronous + file append operation started with + gio.BufferedInputStream.fill_async(). +

gio.BufferedInputStream.get_available

    def get_available()

Returns :

size of the available stream. +

+ The get_available() method gets the size of + the available data within the stream. +

gio.BufferedInputStream.get_buffer_size

    def get_buffer_size()

Returns :

the current buffer size. +

+ The get_buffer_size() method gets the size + of the input buffer. +

gio.BufferedInputStream.read_byte

    def read_byte(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

the byte read from the stream, or -1 on end of stream or error. +

+ The read_byte() method tries to read a single + byte from the stream or the buffer. Will block during this read. +

+ On success, the byte read from the stream is returned. On end of stream -1 + is returned but it's not an exceptional error and error is not set. +

+ If cancellable is not None, then the operation can + be cancelled by triggering the cancellable object from another thread. + If the operation was cancelled, the error gio.ERROR_CANCELLED will be + returned. If an operation was partially finished when the operation was + cancelled the partial result will be returned, without an error. +

+ On error -1 is returned and error is set accordingly. +

gio.BufferedInputStream.set_buffer_size

    def set_buffer_size(size)

size :

the new buffer size. +

+ The set_buffer_size() method sets the size + of the internal buffer of stream to size, or to the size of the contents + of the buffer. The buffer can never be resized smaller than its current contents. +

Functions

gio.buffered_input_stream_new_sized

    def buffered_input_stream_new_sized(size)

size :

the requested buffer size. +

Returns :

A new + gio.InputStream. +

+ The buffered_input_stream_new_sized() function creates + a new gio.BufferedInputStream + from the given base_stream, with a buffer set to size. +

diff --git a/docs/html/class-giobufferedoutputstream.html b/docs/html/class-giobufferedoutputstream.html new file mode 100644 index 0000000..400e153 --- /dev/null +++ b/docs/html/class-giobufferedoutputstream.html @@ -0,0 +1,62 @@ +gio.BufferedOutputStream

gio.BufferedOutputStream

gio.BufferedOutputStream — Buffered Output Stream

Synopsis

class gio.BufferedOutputStream(gio.FilterOutputStream):
+    gio.BufferedOutputStream(base_stream)
def get_auto_grow()
def get_buffer_size()
def set_auto_grow(auto_grow)
def set_buffer_size(size)
+Functions
+ 
+    def gio.buffered_output_stream_new_sized(size)

gio.BufferedOutputStream Properties

"auto-grow"Read - WriteWhether the buffer should automatically grow. Default value: False.
"buffer-size"Read - Write - ConstructThe size of the backend buffer. Allowed values: >= 1. Default value: 4096.

Description

+ gio.BufferedOutputStream + implements gio.FilterOutputStream + and provides for buffered writes. +

+ By default, + gio.BufferedOutputStream's + buffer size is set at 4 kilobytes. +

+ To create a buffered output stream, use + gio.BufferedOutputStream(), + or gio.buffered_output_stream_new_sized() + to specify the buffer's size at construction. +

+ To get the size of a buffer within a buffered output stream, use + gio.BufferedOutputStream.get_buffer_size(). + To change the size of a buffered output stream's buffer, use + gio.BufferedOutputStream.set_buffer_size(). + Note that the buffer's size cannot be reduced below the size of the data within the buffer. +

Constructor

    gio.BufferedOutputStream(base_stream)

base_stream :

a + gio.OutputStream. +

Returns :

a new + gio.OutputStream + for the given base_stream. +

+ Creates a new buffered output stream for a base stream. +

Methods

gio.BufferedOutputStream.get_auto_grow

    def get_auto_grow()

Returns :

True if the stream's + buffer automatically grows, False otherwise. +

+ The get_auto_grow() method checks if the + buffer automatically grows as data is added. +

gio.BufferedOutputStream.get_buffer_size

    def get_buffer_size()

Returns :

the current buffer size. +

+ The get_buffer_size() method gets the size + of the buffer in the stream. +

gio.BufferedOutputStream.set_auto_grow

    def set_auto_grow(auto_grow)

auto_grow :

a boolean. +

+ The set_auto_grow() method sets whether or not + the stream's buffer should automatically grow. If auto_grow is true, + then each write will just make the buffer larger, and you must manually + flush the buffer to actually write out the data to the underlying stream. +

gio.BufferedOutputStream.set_buffer_size

    def set_buffer_size(size)

size :

the new buffer size. +

+ The set_buffer_size() method sets the size of + the internal buffer to size. +

Functions

gio.buffered_output_stream_new_sized

    def buffered_output_stream_new_sized(size)

size :

the requested buffer size. +

Returns :

A new + gio.OutputStream + with an internal buffer set to size.. +

+ The buffered_output_stream_new_sized() function creates + a new gio.BufferedOutputStream + from the given base_stream, with a buffer set to size. +

diff --git a/docs/html/class-giocancellable.html b/docs/html/class-giocancellable.html new file mode 100644 index 0000000..67de087 --- /dev/null +++ b/docs/html/class-giocancellable.html @@ -0,0 +1,61 @@ +gio.Cancellable

gio.Cancellable

gio.Cancellable — Thread-safe Operation Cancellation Stack.

Synopsis

class gio.Cancellable(gobject.GObject):
+    gio.Cancellable()
def cancel()
def get_fd()
def is_cancelled()
def pop_current()
def push_current()
def reset()
def set_error_if_cancelled()
+Functions
+ 
+    def gio.cancellable_get_current()

Ancestry

+-- gobject.GObject
+  +-- gio.Cancellable
+

Description

+ The gio.Cancellable + is a thread-safe operation cancellation stack used throughout GIO to allow for + cancellation of synchronous and asynchronous operations. +

Constructor

    gio.Cancellable()

Returns :

a new + gio.Cancellable. +

+ Creates a new gio.Cancellable object. +

+ Applications that want to start one or more operations that should be cancellable should create a + gio.Cancellable + and pass it to the operations. +

+ One gio.Cancellable + can be used in multiple consecutive operations, but not in multiple concurrent operations. +

Methods

gio.Cancellable.cancel

    def cancel()

+ The cancel() method will set cancellable to cancelled, + and will emit the "cancelled" signal. (However, see the warning about race conditions + in the documentation for that signal if you are planning to connect to it.) +

+ This function is thread-safe. In other words, you can safely call it from a thread + other than the one running the operation that was passed the cancellable. +

+ The convention within gio is that cancelling an asynchronous operation causes it + to complete asynchronously. That is, if you cancel the operation from the same thread + in which it is running, then the operation's GAsyncReadyCallback will not be invoked + until the application returns to the main loop. +

gio.Cancellable.get_fd

    def get_fd()

Returns :

A valid file descriptor. -1 if the file descriptor + is not supported, or on errors.

+ The get_fd() method gets the file descriptor + for a cancellable job. This can be used to implement cancellable operations + on Unix systems. The returned fd will turn readable when cancellable is cancelled. +

gio.Cancellable.is_cancelled

    def is_cancelled()

Returns :

True if cancellable is cancelled, + False if called with None or if + item is not cancelled.

+ The get_fd() method gets the file descriptor + for a cancellable job. This can be used to implement cancellable operations + on Unix systems. The returned fd will turn readable when cancellable is cancelled. +

gio.Cancellable.pop_current

    def pop_current()

+ The pop_current() method pops cancellable off + the cancellable stack (verifying that cancellable is on the top of the stack). +

gio.Cancellable.push_current

    def push_current()

+ The push_current() method pushes cancellable onto + the cancellable stack. The current cancllable can then be recieved using + gio.cancellable_get_current(). +

gio.Cancellable.reset

    def reset()

+ The reset() method resets cancellable to its uncancelled state. +

gio.Cancellable.set_error_if_cancelled

    def set_error_if_cancelled()

Returns :

True if cancellable was cancelled, + False if it was not.

+ The set_error_if_cancelled() method, if the cancellable + is cancelled, sets the error to notify that the operation was cancelled. +

Functions

gio.cancellable_get_current

    def cancellable_get_current()

Returns :

A gio.Cancellable + from the top of the stack, or None if the stack is empty.

+ The cancellable_get_current() function gets the top cancellable from the stack. +

diff --git a/docs/html/class-giodatainputstream.html b/docs/html/class-giodatainputstream.html new file mode 100644 index 0000000..c88c2cb --- /dev/null +++ b/docs/html/class-giodatainputstream.html @@ -0,0 +1,223 @@ +gio.DataInputStream

gio.DataInputStream

gio.DataInputStream — Data Input Stream

Synopsis

class gio.DataInputStream(gio.BufferedInputStream):
+    gio.DataInputStream(base_stream)
def get_byte_order()
def get_newline_type()
def read_byte(cancellable=None)
def read_int16(cancellable=None)
def read_int32(cancellable=None)
def read_int64(cancellable=None)
def read_line(cancellable=None)
def read_line_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def read_line_finish(result)
def read_uint16(cancellable=None)
def read_uint32(cancellable=None)
def read_uint64(cancellable=None)
def read_until(stop_chars, cancellable=None)
def read_until_async(stop_chars, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def read_until_finish(result)
def set_byte_order(order)
def set_newline_type(type)

gio.DataInputStream Properties

"byte-order"Read - WriteThe byte order. Default value: gio.DATA_STREAM_BYTE_ORDER_BIG_ENDIAN.
"newline-type"Read - WriteThe accepted types of line ending. Default value: gio.DATA_STREAM_NEWLINE_TYPE_LF.

Description

+ gio.DataInputStream + implements gio.InputStream + and includes functions for reading structured data directly from a binary input stream. +

Constructor

    gio.DataInputStream(base_stream)

base_stream :

a + gio.InputStream. +

Returns :

a new + gio.DataInputStream +

+ Creates a new gio.DataInputStream + from the given base_stream. +

Methods

gio.DataInputStream.get_byte_order

    def get_byte_order()

Returns :

the stream's current + Gio Data Stream Byte Order Constants. +

+ The get_byte_order() method gets the byte + order for the data input stream. +

gio.DataInputStream.get_newline_type

    def get_newline_type()

Returns :

Gio Data Stream Newline Type Constants + for the given stream. +

+ The get_newline_type() method gets the current + newline type for the stream. +

gio.DataInputStream.read_byte

    def read_byte(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

an unsigned 8-bit/1-byte value read from the + stream or 0 if an error occurred. +

+ The read_byte() method reads an unsigned 8-bit/1-byte value from stream. +

gio.DataInputStream.read_int16

    def read_int16(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a signed 16-bit/2-byte value read from stream or 0 if an error occurred. +

+ The read_int16() method reads a 16-bit/2-byte value from stream. +

+ In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataInputStream.read_int32

    def read_int32(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a signed 32-bit/4-byte value read from the stream + or 0 if an error occurred. +

+ The read_int32() method reads a signed 32-bit/4-byte value from stream. +

+ In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataInputStream.read_int64

    def read_int64(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a signed 64-bit/8-byte value read from the stream + or 0 if an error occurred. +

+ The read_int64() method reads a signed 64-bit/8-byte value from stream. +

+ In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataInputStream.read_line

    def read_line(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a string with the line that was read in (without the newlines). + Set length to a gsize to get the length of the read line. On an error, it will return + None and error will be set. If there's no content to read, it + will still return None, but error won't be set. +

+ The read_line() reads a line from the data input stream. +

+ If cancellable is not None, then the operation can + be cancelled by triggering the cancellable object from another thread. + If the operation was cancelled, the error gio.ERROR_CANCELLED will be + returned. If an operation was partially finished when the operation was + cancelled the partial result will be returned, without an error. +

gio.DataInputStream.read_line_async

    def read_line_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The read_line_async() method is the asynchronous version of + gio.DataInputStream.read_line(). + It is an error to have two outstanding calls to this function. +

+ For the synchronous version of this function, see + gio.DataInputStream.read_line(). +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set +

gio.DataInputStream.read_line_finish

    def read_line_finish(result)

result :

a gio.AsyncResult. +

Returns :

a string with the line that was read in (without the newlines). + On an error, it will return None and error will be set. + If there's no content to read, it will still return None, + but error won't be set. +

+ The read_line_finish() method finishes an asynchronous + file append operation started with + gio.DataInputStream.read_line_async(). +

gio.DataInputStream.read_uint16

    def read_uint16(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a signed 16-bit/2-byte value read from stream or 0 if an error occurred. +

+ The read_uint16() method reads a 16-bit/2-byte value from stream. +

+ In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataInputStream.read_uint32

    def read_uint32(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a signed 32-bit/4-byte value read from the stream + or 0 if an error occurred. +

+ The read_uint32() method reads a signed 32-bit/4-byte value from stream. +

+ In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataInputStream.read_uint64

    def read_uint64(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a signed 64-bit/8-byte value read from the stream + or 0 if an error occurred. +

+ The read_uint64() method reads a signed 64-bit/8-byte value from stream. +

+ In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataInputStream.read_until

    def read_until(stop_chars, cancellable=None)

stop_chars :

characters to terminate the read. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a string with the data that was read before encountering + any of the stop characters. This function will return NULL on an error. +

+ The read_until() reads a string from the data input + stream, up to the first occurrence of any of the stop characters. +

gio.DataInputStream.read_until_async

    def read_until_async(stop_chars, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

stop_chars :

characters to terminate the read. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The read_until_async() method it's the asynchronous version of + gio.DataInputStream.read_until(). + It is an error to have two outstanding calls to this function. +

+ For the synchronous version of this function, see + gio.DataInputStream.read_until(). +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set +

+ When the operation is finished, callback will be called. You can then call + gio.DataInputStream.read_until_finish() + to get the result of the operation. +

gio.DataInputStream.read_until_finish

    def read_until_finish(result)

result :

a gio.AsyncResult. +

Returns :

a string with the data that was read before encountering + any of the stop characters. This function will return None on an error. +

+ The read_until_finish() method finishes an asynchronous + file append operation started with + gio.DataInputStream.read_until_async(). +

gio.DataInputStream.set_byte_order

    def set_byte_order(order)

order :

a + Gio Data Stream Byte Order Constants to set. +

+ The set_byte_order() method sets the byte order for + the given stream. All subsequent reads from the stream will be read in the given order. +

gio.DataInputStream.set_newline_type

    def set_newline_type(type)

type :

a + Gio Data Stream Newline Type Constants to set. +

+ The set_newline_type() method sets the newline type for the stream. +

Note

+ Note that using gio.DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a + read chunk ends in "CR" we must read an additional byte to know if this is + "CR" or "CR LF", and this might block if there is no more data availible. +
diff --git a/docs/html/class-giodataoutputstream.html b/docs/html/class-giodataoutputstream.html new file mode 100644 index 0000000..f6f9980 --- /dev/null +++ b/docs/html/class-giodataoutputstream.html @@ -0,0 +1,118 @@ +gio.DataOutputStream

gio.DataOutputStream

gio.DataOutputStream — Data Output Stream

Synopsis

class gio.DataOutputStream(gio.BufferedOutputStream):
+    gio.DataOutputStream(base_stream)
def get_byte_order()
def put_byte(cancellable=None)
def put_int16(cancellable=None)
def put_int32(cancellable=None)
def put_int64(cancellable=None)
def put_string(cancellable=None)
def put_uint16(cancellable=None)
def put_uint32(cancellable=None)
def put_uint64(cancellable=None)
def set_byte_order(order)

gio.DataOutputStream Properties

"byte-order"Read - WriteDetermines the byte ordering that is used when writing + multi-byte entities (such as integers) to the stream. + Default value: gio.DATA_STREAM_BYTE_ORDER_BIG_ENDIAN.

Description

+ gio.DataOutputStream + implements gio.InputStream + and includes functions for writing data directly to an output stream. +

Constructor

    gio.DataOutputStream(base_stream)

base_stream :

a + gio.OutputStream. +

Returns :

a new + gio.DataOutputStream +

+ Creates a new gio.DataOutputStream + from the given base_stream. +

Methods

gio.DataOutputStream.get_byte_order

    def get_byte_order()

Returns :

the stream's current + Gio Data Stream Byte Order Constants. +

+ The get_byte_order() method gets the byte + order for the stream. +

gio.DataOutputStream.put_byte

    def put_byte(data, cancellable=None)

data :

a char. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True if data was successfully added to the stream. +

+ The put_byte() method puts a byte into the output stream. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataOutputStream.put_int16

    def put_int16(data, cancellable=None)

data :

a gint16. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True if data was successfully added to the stream. +

+ The put_int16() method puts a signed 16-bit integer into the output stream. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataOutputStream.put_int32

    def put_int32(data, cancellable=None)

data :

a gint32. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True if data was successfully added to the stream. +

+ The put_int32() method puts a signed 32-bit integer into the output stream. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataOutputStream.put_int64

    def put_int64(data, cancellable=None)

data :

a gint64. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True if data was successfully added to the stream. +

+ The put_int64() method puts a signed 64-bit integer into the output stream. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataOutputStream.put_string

    def put_string(str, cancellable=None)

str :

a string. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True if string was successfully added to the stream. +

+ The put_string() method puts a string into the output stream. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataOutputStream.put_uint16

    def put_uint16(data, cancellable=None)

data :

a guint16. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True if data was successfully added to the stream. +

+ The put_uint16() method puts an unsigned 16-bit integer into the output stream. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataOutputStream.put_uint32

    def put_uint32(data, cancellable=None)

data :

a guint32. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True if data was successfully added to the stream. +

+ The put_uint32() method puts an unsigned 32-bit integer into the output stream. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataOutputStream.put_uint64

    def put_uint64(data, cancellable=None)

data :

a guint64. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True if data was successfully added to the stream. +

+ The put_uint64() method puts an unsigned 64-bit integer into the output stream. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.DataOutputStream.set_byte_order

    def set_byte_order(order)

order :

a + Gio Data Stream Byte Order Constants to set. +

+ The set_byte_order() method sets the byte order for + the given stream. All subsequent reads from the stream will be read in the given order. +

diff --git a/docs/html/class-giodrive.html b/docs/html/class-giodrive.html new file mode 100644 index 0000000..dba9dcf --- /dev/null +++ b/docs/html/class-giodrive.html @@ -0,0 +1,117 @@ +gio.Drive

gio.Drive

gio.Drive — Virtual File System drive management.

Synopsis

class gio.Drive(gobject.GInterface):
+    def can_eject()
def can_poll_for_media()
def eject(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)
def eject_finish(result)
def enumerate_identifiers()
def get_icon()
def get_identifier()
def get_name()
def get_volumes()
def has_media()
def has_volumes()
def is_media_check_automatic()
def is_media_removable()
def poll_for_media(callback, cancellable=None, user_data=None)
def poll_for_media_finish(result)

Ancestry

+-- gobject.GInterface
+  +-- gio.Drive
+

Prerequisites

+ gio.Drive requires + gobject.GObject +

Description

+ gio.Drive + - this represent a piece of hardware connected to the machine. Its generally + only created for removable hardware or hardware with removable media. +

+ gio.Drive + is a container class for GVolume objects that stem from the same piece of media. + As such, gio.Drive + abstracts a drive with (or without) removable media and provides operations for + querying whether media is available, determing whether media change is automatically + detected and ejecting the media. +

+ If the gio.Drive + reports that media isn't automatically detected, one can poll for media; typically + one should not do this periodically as a poll for media operation is potententially + expensive and may spin up the drive creating noise. +

+ For porting from GnomeVFS note that there is no equivalent of + gio.Drive + in that API. +

Methods

gio.Drive.can_eject

    def can_eject()

Returns :

True if the drive can be ejected, + False otherwise. +

+ The can_eject() method checks if a drive can be ejected. +

gio.Drive.can_poll_for_media

    def can_poll_for_media()

Returns :

True if the drive can be polled + for media changes, False otherwise. +

+ The can_poll_for_media() method checks if a drive + can be polled for media changes. +

gio.Drive.eject

    def eject(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

flags :

flags affecting the unmount if required for eject. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The eject() method asynchronously ejects a drive. +

+ When the operation is finished, callback will be called. You can then call + gio.Drive.eject_finish() + to obtain the result of the operation. +

gio.Drive.eject_finish

    def eject_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the drive has been ejected + successfully, False otherwise. +

+ The eject_finish() method finishes ejecting a drive. +

gio.Drive.enumerate_identifiers

    def enumerate_identifiers()

Returns :

a list of strings containing kinds of identifiers. +

+ The enumerate_identifiers() method gets the kinds + of identifiers that drive has. Use + gio.Drive.get_identifier() + to obtain the identifiers themselves. +

gio.Drive.get_icon

    def get_icon()

Returns :

gio.Icon + for the drive. +

+ The get_icon() method gets the icon for drive. +

gio.Drive.get_identifier

    def get_identifier()

Returns :

A string containing the requested identfier, or + None if the + gio.Drive + doesn't have this kind of identifier. +

+ The get_identifier() method gets the identifier of + the given kind for drive. +

gio.Drive.get_name

    def get_name()

Returns :

A string containing drive's name. +

+ The get_name() method gets the name of drive. +

gio.Drive.get_volumes

    def get_volumes()

Returns :

A list containing any + gio.Volume + objects on the given drive. +

+ The get_volumes() method get a list of mountable + volumes for drive. +

gio.Drive.has_media

    def has_media()

Returns :

True if drive has media, + False otherwise.

+ The has_media() method checks if the drive + has media. Note that the OS may not be polling the drive for media changes; see + gio.Drive.is_media_check_automatic() + for more details. +

gio.Drive.has_volumes

    def has_volumes()

Returns :

True if drive contains volumes, + False otherwise.

+ The has_volumes() method check if drive has any mountable volumes. +

gio.Drive.is_media_check_automatic

    def is_media_check_automatic()

Returns :

True if drive is capabable + of automatically detecting media changes, + False otherwise.

+ The is_media_check_automatic() method checks if + drive is capabable of automatically detecting media changes. +

gio.Drive.is_media_removable

    def is_media_removable()

Returns :

True if drive supports removable media, + False otherwise.

+ The is_media_removable() method checks if the + drive supports removable media. +

gio.Drive.poll_for_media

    def poll_for_media(callback, cancellable=None, user_data=None)

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The poll_for_media() method asynchronously polls + drive to see if media has been inserted or removed. +

+ When the operation is finished, callback will be called. You can then call + gio.Drive.poll_for_media_finish() + to obtain the result of the operation. +

gio.Drive.poll_for_media_finish

    def poll_for_media_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the drive has been poll_for_mediaed + successfully, False otherwise. +

+ The poll_for_media_finish() method finishes + an operation started with + gio.Drive.poll_for_media() + on a drive. +

diff --git a/docs/html/class-gioemblem.html b/docs/html/class-gioemblem.html new file mode 100644 index 0000000..0834b0f --- /dev/null +++ b/docs/html/class-gioemblem.html @@ -0,0 +1,46 @@ +gio.Emblem

gio.Emblem

gio.Emblem — An object for emblems.

Synopsis

class gio.Emblem(gobject.GObject, gio.Icon):
+    gio.Emblem(icon, origin=gio.EMBLEM_ORIGIN_UNKNOWN)
def get_icon()
def get_origin()
+Functions
+ 
+    def gio.emblem_new_with_origin(icon, origin)

Ancestry

+-- gobject.GObject
+  +-- gio.Emblem
+

Implemented Interfaces

+ gio.Emblem + implements + gio.Icon +

gio.Emblem Properties

"icon"Read - Write - Construct OnlyThe actual icon of the emblem.
"origin"Read - Write - Construct OnlyTells which origin the emblem is derived from.

Description

+ The gio.Emblem + class is an implementation of gio.Icon + that supports having an emblem, which is an icon with additional properties. + It can then be added to a + gio.EmblemedIcon. +

+ Currently, only metainformation about the emblem's origin is supported. + More may be added in the future. +

Constructor

    gio.Emblem(icon, origin=gio.EMBLEM_ORIGIN_UNKNOWN)

icon :

a + gio.Icon containing the icon. +

origin :

+ origin of the emblem. +

Returns :

a new + gio.Emblem. +

Note

+ Parameter origin is available since PyGObject 2.20. +

+ Creates a new gio.Emblem for icon. +

Methods

gio.Emblem.get_icon

    def get_icon()

Returns :

a + gio.Icon. +

+ The get_icon() method gives back the icon from emblem. +

gio.Emblem.get_origin

    def get_origin()

Returns :

the origin of the emblem. +

+ The get_origin() method gets the origin of the emblem. +

Functions

gio.emblem_new_with_origin

    def emblem_new_with_origin(icon, origin)

origin :

a Gio Emblem Origin Constants + defining the emblem's origin. +

Returns :

A gio.Emblem. +

Note

+ While this method is not deprecated, with 2.20 and up it is recommended + to use the constructor instead. +

+ The emblem_new_with_origin() function creates + a new emblem for icon. +

diff --git a/docs/html/class-gioemblemedicon.html b/docs/html/class-gioemblemedicon.html new file mode 100644 index 0000000..5c474f5 --- /dev/null +++ b/docs/html/class-gioemblemedicon.html @@ -0,0 +1,38 @@ +gio.EmblemedIcon

gio.EmblemedIcon

gio.EmblemedIcon — Icon with emblems.

Synopsis

class gio.EmblemedIcon(gobject.GObject, gio.Icon):
+    gio.EmblemedIcon(icon, emblem)
def add_emblem(emblem)
def get_icon()

Ancestry

+-- gobject.GObject
+  +-- gio.EmblemedIcon
+

Implemented Interfaces

+ gio.EmblemedIcon + implements + gio.Icon +

Description

+ The gio.EmblemedIcon + class is an implementation of gio.Icon + that supports adding an emblem to an icon. Adding multiple emblems to an icon is ensured via + gio.EmblemedIcon.add_emblem(). +

+ Note that + gio.EmblemedIcon + allows no control over the position of the emblems. See also + gio.Emblem + for more information. +

Constructor

    gio.EmblemedIcon(icon, emblem)

icon :

a + gio.Icon. +

emblem :

a + gio.Emblem. +

Returns :

a new + gio.Icon. +

+ Creates a new gio.Icon + for icon with the emblem emblem. +

Methods

gio.EmblemedIcon.add_emblem

    def add_emblem(emblem)

emblem :

a + gio.Emblem +

+ The add_emblem() method adds emblem to the + list of gio.Emblems. +

gio.EmblemedIcon.get_icon

    def get_icon()

Returns :

a + gio.Icon + that is owned by emblemed. +

+ The get_icon() method gets the main icon for emblemed. +

diff --git a/docs/html/class-giofile.html b/docs/html/class-giofile.html new file mode 100644 index 0000000..f18df5e --- /dev/null +++ b/docs/html/class-giofile.html @@ -0,0 +1,1436 @@ +gio.File

gio.File

gio.File — File and Directory Handling.

Synopsis

class gio.File(gobject.GInterface):
+    gio.File(commandline, path=None, uri=None)
def append_to(flags=gio.FILE_CREATE_NONE, cancellable=None)
def append_to_async(callback, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def append_to_finish(result)
def copy(destination, progress_callback, flags=gio.FILE_COPY_NONE, cancellable=None, user_data=None)
def copy_async(destination, callback, progress_callback=None, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None, progress_callback_data=None)
def copy_attributes(destination, flags=gio.FILE_COPY_NONE, cancellable=None)
def copy_finish(result)
def create(flags=gio.FILE_CREATE_NONE, cancellable=None)
def create_async(callback, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def create_finish(result)
def delete(cancellable=None)
def dup()
def eject_mountable(callback, flags=gio.FILE_CREATE_NONE, cancellable=None, user_data=None)
def eject_mountable_finish(result)
def enumerate_children(attributes, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def enumerate_children_async(attributes, callback, flags=gio.FILE_QUERY_INFO_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def enumerate_children_finish(result)
def equal(file2)
def find_enclosing_mount(cancellable)
def find_enclosing_mount_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def find_enclosing_mount_finish(result)
def get_basename()
def get_child(name)
def get_child_for_display_name(display_name)
def get_parent()
def get_parse_name()
def get_path()
def get_relative_path(descendant)
def get_uri()
def get_uri_scheme()
def has_prefix(prefix)
def has_uri_scheme(uri_scheme)
def is_native()
def load_contents(cancellable)
def load_contents_async(callback, cancellable=None, user_data=None)
def load_contents_finish(result)
def make_directory(cancellable=None)
def make_directory_with_parents(cancellable=None)
def make_symbolic_link(symlink_value, cancellable)
def monitor(flags=gio.FILE_MONITOR_NONE, cancellable=None)
def monitor_directory(flags, cancellable=None)
def monitor_file(flags, cancellable=None)
def mount_enclosing_volume(mount_operation, callback, flags=gio.MOUNT_MOUNT_NONE, cancellable=None, user_data=None)
def mount_enclosing_volume_finish(result)
def mount_mountable(mount_operation, callback, flags=gio.MOUNT_MOUNT_NONE, cancellable=None, user_data=None)
def mount_mountable_finish(result)
def move(destination, progress_callback, flags=gio.FILE_COPY_NONE, cancellable=None, user_data=None)
def query_default_handler(cancellable)
def query_exists(cancellable)
def query_file_type(flags, cancellable)
def query_filesystem_info(attributes, cancellable)
def query_filesystem_info_async(attributes, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def query_filesystem_info_finish(result)
def query_info(attributes, flags, cancellable)
def query_info_async(attributes, callback, flags=gio.FILE_QUERY_INFO_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def query_info_finish(result)
def query_settable_attributes(cancellable=None)
def query_writable_namespace(cancellable=None)
def read(cancellable=None)
def read_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def read_finish(result=None)
def replace(etag, make_backup, flags=gio.FILE_CREATE_NONE, cancellable=None)
def replace_async(callback, etag=None, make_backup=True, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def replace_contents(contents, etag=None, make_backup=True, flags=gio.FILE_CREATE_NONE, cancellable=None)
def replace_contents_async(contents, callback, etag=None, make_backup=True, flags=gio.FILE_CREATE_NONE, cancellable=None, user_data=None)
def replace_contents_finish(result=None)
def replace_finish(result=None)
def resolve_relative_path(relative_path)
def set_attribute(attribute, type, value_p, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def set_attribute_byte_string(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def set_attribute_int32(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def set_attribute_int64(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def set_attribute_string(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def set_attribute_uint32(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def set_attribute_uint64(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def set_attributes_async(info, callback, flags=gio.FILE_QUERY_INFO_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def set_attributes_finish(result)
def set_attributes_from_info(info, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)
def set_dispay_name(display_name, cancellable=None)
def set_display_name_async(display_name, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def set_display_name_finish(result)
def trash(cancellable=None)
def unmount_mountable(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)
def unmount_mountable_finish(cancellable=None)
+Functions
+    def gio.file_parse_name(parse_name)

Ancestry

+-- gobject.GInterface
+  +-- gio.File
+

Prerequisites

+ gio.File is implemented by + gobject.GObject +

Description

+ gio.File is a high + level abstraction for manipulating files on a virtual file system. + gio.Files are lightweight, + immutable objects that do no I/O upon creation. It is necessary to understand that + gio.File + objects do not represent files, merely an identifier for a file. All file content + I/O is implemented as streaming operations (see + gio.InputStream and + gio.OutputStream). +

+ To construct a gio.File, you can use + it's constructor either with a path, an uri or a commandline argument. + gio.file_parse_name() + from a utf8 string gotten from + gio.File.get_parse_name(). +

+ One way to think of a gio.File is as + an abstraction of a pathname. For normal files the system pathname is what is stored internally, + but as gio.Files are extensible it + could also be something else that corresponds to a pathname in a userspace implementation of a filesystem. +

+ gio.Files make up hierarchies of + directories and files that correspond to the files on a filesystem. You can move through the + file system with GFile using + gio.File.get_parent() + to get an identifier for the parent directory, + gio.File.get_child() + to get a child within a directory, + gio.File.resolve_relative_path() + to resolve a relative path between two gio.Files. + There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call + gio.File.get_parent() + on two different files. +

+ All gio.Files have a basename (get with + gio.File.get_basename() + ). These names are byte strings that are used to identify the file on the filesystem + (relative to its parent directory) and there is no guarantees that they have any particular charset + encoding or even make any sense at all. If you want to use filenames in a user interface you should + use the display name that you can get by requesting the gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with + gio.File.query_info(). + This is guaranteed to be in utf8 and can be used in a user interface. But always store the real basename or the + GFile to use to actually access the file, because there is no way to go from a display name to the actual name. +

+ Using gio.File as an identifier has the same + weaknesses as using a path in that there may be multiple aliases for the same file. For instance, + hard or soft links may cause two different gio.Files + to refer to the same file. Other possible causes for aliases are: case insensitive filesystems, short and + long names on Fat/NTFS, or bind mounts in Linux. If you want to check if two GFiles point to the same file + you can query for the gio.FILE_ATTRIBUTE_ID_FILE attribute. Note that + gio.File does some trivial canonicalization + of pathnames passed in, so that trivial differences in the path string used at creation + (duplicated slashes, slash at end of path, "." or ".." path segments, etc) does not create different + gio.Files. +

+ Many gio.File operations have both synchronous + and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply + have _async() appended to their function names. The asynchronous I/O functions call a + GAsyncReadyCallback which is then used to finalize the operation, producing a GAsyncResult + which is then passed to the function's matching _finish() operation. +

+ Some gio.File operations do not have + synchronous analogs, as they may take a very long time to finish, and blocking may leave an application + unusable. Notable cases include: + gio.File.mount_mountable() + to mount a mountable file. + gio.File.unmount_mountable() + to unmount a mountable file. + gio.File.eject_mountable() + to eject a mountable file. +

+ One notable feature of gio.Files are + entity tags, or "etags" for short. Entity tags are somewhat like a more abstract + version of the traditional mtime, and can be used to quickly determine if the file + has been modified from the version on the file system. See the HTTP 1.1 + specification for HTTP Etag headers, which are a very similar concept. +

Constructor

    gio.File(commandline, path=None, uri=None)

commandline :

a command line string. +

path :

a string containing a relative or absolute path. +

uri :

a string containing a URI. +

Returns :

a new + gio.File. +

+ Creates a new gio.File either from a commandline, + a path or an uri. +

Methods

gio.File.append_to

    def append_to(flags=gio.FILE_CREATE_NONE, cancellable=None)

flags :

a set of + Gio File Create Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a + gio.FileOutputStream + or None on error. +

+ The append_to() method gets an output stream for + appending data to the file. If the file doesn't already exist it is created. +

+ By default files created are generally readable by everyone, but if you pass + gio.FILE_CREATE_PRIVATE in flags the file will be made readable only to the + current user, to the level that is supported on the target filesystem. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If + the operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

+ Some file systems don't allow all file names, and may return an + gio.ERROR_INVALID_FILENAME error. If the file is a directory the + gio.ERROR_IS_DIRECTORY error will be returned. Other errors are possible too, + and depend on what kind of filesystem the file is on. +

gio.File.append_to_async

    def append_to_async(callback, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

flags :

a set of + Gio File Create Flags Constants. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The append_to_async() method asynchronously opens file for appending. +

+ For more details, see + gio.File.append_to() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.append_to_finish() + to get the result of the operation. +

gio.File.append_to_finish

    def append_to_finish(result)

result :

a gio.AsyncResult. +

Returns :

a valid + gio.OutputStream + or None on error. +

+ The append_to_finish() method finishes an asynchronous + file append operation started with + gio.File.append_to_async(). +

gio.File.copy

    def copy(destination, progress_callback, flags=gio.FILE_COPY_NONE, cancellable=None, user_data=None)

destination :

destination gio.File. +

progress_callback :

function to callback with progress information. +

flags :

a set of + Gio File Copy Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to the progress callback function. +

Returns :

True on success, + False otherwise. +

+ The copy() method copies the file source to + the location specified by destination. Can not handle recursive copies of directories. +

+ If the flag gio.FILE_COPY_OVERWRITE is specified an already existing + destination file is overwritten. +

+ If the flag gio.FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will + be copied as symlinks, otherwise the target of the source symlink will be copied. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

+ If progress_callback is not None, then the operation can be + monitored by setting this to a GFileProgressCallback function. user_data + will be passed to this function. It is guaranteed that this callback will be + called after all data has been transferred with the total number of bytes + copied during the operation. +

+ If the source file does not exist then the gio.ERROR_NOT_FOUND error is returned, + independent on the status of the destination. +

+ If gio.FILE_COPY_OVERWRITE is not specified and the target exists, + then the error gio.ERROR_EXISTS is returned. +

+ If trying to overwrite a file over a directory the gio.ERROR_IS_DIRECTORY error + is returned. If trying to overwrite a directory with a directory the + gio.ERROR_WOULD_MERGE error is returned. +

+ If the source is a directory and the target does not exist, or gio.FILE_COPY_OVERWRITE + is specified and the target is a file, then the gio.ERROR_WOULD_RECURSE error is returned. +

+ If you are interested in copying the + gio.File object + itself (not the on-disk file), see + gio.File.dup(). +

gio.File.copy_async

    def append_to_async(destination, callback, progress_callback=None, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None, progress_callback_data=None)

destination :

destination gio.File. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

progress_callback :

function to callback with progress information. +

flags :

a set of + Gio File Copy Flags Constants. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

progress_callback_data :

the data to pass to the progress callback function. +

+ The copy_async() method copies the file source to + the location specified by destination asynchronously. For details of the behaviour, + see gio.File.copy(). +

+ If progress_callback is not None, then that function that will + be called just like in + gio.File.copy(), + however the callback will run in the main loop, not in the thread that is doing the I/O operation. +

+ When the operation is finished, callback will be called. You can then call + gio.File.copy_finish() + to get the result of the operation. +

gio.File.copy_attributes

    def copy_attributes(destination, flags=gio.FILE_COPY_NONE, cancellable=None)

destination :

destination gio.File + to copy attributes to. +

flags :

a set of + Gio File Copy Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attributes were copied successfully, + False otherwise. +

+ The copy_attributes() method copies the file attributes + from source to destination. +

+ Normally only a subset of the file attributes are copied, those that are copies + in a normal file copy operation (which for instance does not include e.g. owner). + However if gio.FILE_COPY_ALL_METADATA is specified in flags, then all the metadata + that is possible to copy is copied. This is useful when implementing move by copy + delete source. +

gio.File.copy_finish

    def copy_finish(result)

result :

a gio.AsyncResult. +

Returns :

True on success, + False on error. +

+ The copy_finish() method finishes an asynchronous + copy operation started with + gio.File.copy_async(). +

gio.File.create

    def create(flags=gio.FILE_CREATE_NONE, cancellable=None)

flags :

a set of + Gio File Create Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a + gio.FileOutputStream + or None on error. +

+ The create() method creates a new file and returns + an output stream for writing to it. The file must not already exist. +

+ By default files created are generally readable by everyone, but if you pass + gio.FILE_CREATE_PRIVATE in flags the file will be made readable only to the + current user, to the level that is supported on the target filesystem. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

+ If a file or directory with this name already exists the gio.ERROR_EXISTS + error will be returned. Some file systems don't allow all file names, and + may return an gio.ERROR_INVALID_FILENAME error, and if the name is to long + gio.ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, + and depend on what kind of filesystem the file is on. +

gio.File.create_async

    def create_async(callback, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

flags :

a set of + Gio File Copy Flags Constants. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The create_async() method asynchronously creates a new + file and returns an output stream for writing to it. The file must not already exist. +

+ For more details, see + gio.File.create() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.create_finish() + to get the result of the operation. +

gio.File.create_finish

    def create_finish(result)

result :

a gio.AsyncResult. +

Returns :

a + gio.FileOutputStream + or None on error. +

+ The create_finish() method finishes an asynchronous + copy operation started with + gio.File.create_async(). +

gio.File.delete

    def delete(cancellable)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the file was deleted, + False otherwise. +

+ The deleted() method deletes a file. If the file is a + directory, it will only be deleted if it is empty. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.dup

    def dup()

Returns :

a new gio.File + that is a duplicate of the given gio.File. +

+ The dup() method duplicates a + gio.File + handle. This operation does not duplicate the actual file or directory represented + by the gio.File; see + gio.File.copy() + if attempting to copy a file. +

+ This call does no blocking i/o. +

gio.File.eject_mountable

    def eject_mountable(callback, flags=gio.FILE_CREATE_NONE, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

flags :

a set of + Gio File Copy Flags Constants. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The eject_mountable() method starts an asynchronous eject on a + mountable. When this operation has completed, callback will be called with + user_user data, and the operation can be finalized with + gio.File.eject_mountable_finish(). +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.File.eject_mountable_finish

    def eject_mountable_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the file was ejected successfully, + False on error. +

+ The create_finish() method finishes an asynchronous + copy operation started with + gio.File.create_async(). +

gio.File.enumerate_children

    def enumerate_children(attributes, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attributes :

an attribute query string. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a + gio.FileEnumerator + or None on error. +

+ The enumerate_children() method gets the requested information + about the files in a directory. The result is a GFileEnumerator object that will give out + gio.FileInfo objects + for all the files in the directory. +

+ The attribute value is a string that specifies the file attributes that should be gathered. + It is not an error if it's not possible to read a particular requested attribute from a file - + it just won't be set. attribute should be a comma-separated list of attribute or attribute + wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all + attributes in the standard namespace. An example attribute query be "standard::*,owner::user". + The standard attributes are available as defines, like gio.FILE_ATTRIBUTE_STANDARD_NAME. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

+ If the file does not exist, the gio.ERROR_NOT_FOUND error will be returned. If the file + is not a directory, the gio.FILE_ERROR_NOTDIR error will be returned. + Other errors are possible too. +

gio.File.enumerate_children_async

    def enumerate_children_async(attributes, callback, flags=gio.FILE_QUERY_INFO_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

attributes :

an attribute query string. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

flags :

a set of + Gio File Query Info Flags Constants. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The enumerate_children_async() method asynchronously gets the + requested information about the files in a directory. The result is a + gio.FileEnumerator + object that will give out gio.FileInfo + objects for all the files in the directory. +

+ For more details, see + enumerate_children() + which is the synchronous version of this call. +

gio.File.eject_mountable_finish

    def enumerate_children_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.FileEnumerator + or None if an error occurred. +

+ The enumerate_children_finish() method finishes an asynchronous + copy operation started with + gio.File.enumerate_children_async(). +

gio.File.equal

    def equal(file2)

file2 :

a gio.File. +

Returns :

True if file1 and file2 are equal. + False if either is not a + gio.File. +

+ The equal() method checks equality of two given + gio.Files. + Note that two gio.Files + that differ can still refer to the same file on the filesystem due to various + forms of filename aliasing. +

+ This call does no blocking i/o. +

gio.File.find_enclosing_mount

    def enumerate_children(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a + gio.Mount + or None on error. +

+ The find_enclosing_mount() method gets a + gio.Mount for the + gio.File. +

+ If the interface for file does not have a mount (e.g. possibly a remote share), + error will be set to gio.ERROR_NOT_FOUND and None will be returned. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.find_enclosing_mount_async

    def find_enclosing_mount_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The find_enclosing_mount_async() method asynchronously + gets the mount for the file. +

+ For more details, see + gio.File.find_enclosing_mount() + which is the synchronous version of this call. +

gio.File.find_enclosing_mount_finish

    def find_enclosing_mount_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.Mount + or None if an error occurred. +

+ The find_enclosing_mount_finish() method finishes an asynchronous + find mount started with + gio.File.find_enclosing_mount_async(). +

gio.File.get_basename

    def get_basename()

Returns :

string containing the + gio.File's + base name, or None if given + gio.File is invalid. +

+ The get_basename() method gets the base name + (the last component of the path) for a given + gio.File. +

+ If called for the top level of a system (such as the filesystem root or + a uri like sftp://host/) it will return a single directory separator + (and on Windows, possibly a drive letter). +

+ The base name is a byte string (*not* UTF-8). It has no defined encoding + or rules other than it may not contain zero bytes. If you want to use filenames + in a user interface you should use the display name that you can get by requesting + the gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with + gio.File.query_info(). +

+ This call does no blocking i/o. +

gio.File.get_child

    def get_child(name)

name :

string containing the child's basename. +

Returns :

a + gio.File + to a child specified by name. +

+ The get_child() method gets a child of file + with basename equal to name. +

+ Note that the file with that specific name might not exist, but you can + still have a gio.File + that points to it. You can use this for instance to create that file. +

+ This call does no blocking i/o. +

gio.File.get_child_for_display_name

    def get_child_for_display_name(display_name)

display_name :

string to a possible child. +

Returns :

a + gio.File + to the specified child or None + if the display name couldn't be converted. +

+ The get_child_for_display_name() method gets the + child of file for a given display_name (i.e. a UTF8 version of the name). + If this function fails, it returns NULL and error will be set. This is very + useful when constructing a GFile for a new file and the user entered the filename + in the user interface, for instance when you select a directory and type a filename + in the file selector. +

+ This call does no blocking i/o. +

gio.File.get_parent

    def get_parent()

Returns :

a + gio.File + structure to the parent of the given + gio.File or + None if there is no parent. +

+ The get_parent() method gets the parent directory for the file. + If the file represents the root directory of the file system, then None + will be returned. +

+ This call does no blocking i/o. +

gio.File.get_parse_name

    def get_parse_name()

Returns :

a string containing the + gio.File's parse name. +

+ The get_parse_name() method gets the parse name + of the file. A parse name is a UTF-8 string that describes the file such + that one can get the gio.File + back using + gio.file_parse_name(). +

+ This is generally used to show the gio.File + as a nice full-pathname kind of string in a user interface, like in a location entry. +

+ For local files with names that can safely be converted to UTF8 the pathname is used, + otherwise the IRI is used (a form of URI that allows UTF8 characters unescaped). +

+ This call does no blocking i/o. +

gio.File.get_path

    def get_path()

Returns :

a string containing the + gio.File's path, + or None if no such path exists. +

+ The get_path() method gets the local pathname for + gio.File, if one exists. +

+ This call does no blocking i/o. +

gio.File.get_relative_path

    def get_relative_path(descendant)

descendant :

input gio.File. +

Returns :

string with the relative path from descendant to parent, + or None if descendant doesn't have parent as prefix. +

+ The get_relative_path() method gets the path for + descendant relative to parent. +

+ This call does no blocking i/o. +

gio.File.get_uri

    def get_uri()

Returns :

a string containing the + gio.File's URI. +

+ The get_uri() method gets the URI for the file. +

+ This call does no blocking i/o. +

gio.File.get_uri_scheme

    def get_uri_scheme()

Returns :

a string containing the URI scheme for the + gio.File. +

+ The get_uri_scheme() method gets the URI scheme for a + gio.File. + RFC 3986 decodes the scheme as: +

+URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
+

+ Common schemes include "file", "http", "ftp", etc. +

+ This call does no blocking i/o. +

gio.File.has_prefix

    def has_prefix(prefix)

prefix :

input gio.File. +

Returns :

True if the files's parent, grandparent, + etc is prefix. False otherwise. +

+ The has_prefix() method checks whether file has the prefix + specified by prefix. In other word, if the names of inital elements of files pathname + match prefix. Only full pathname elements are matched, so a path like /foo is not + considered a prefix of /foobar, only of /foo/bar. +

+ This call does no blocking i/o, as it works purely on names. As such it can sometimes + return False even if file is inside a prefix (from a filesystem point + of view), because the prefix of file is an alias of prefix. +

gio.File.has_uri_scheme

    def has_uri_scheme(uri_scheme)

uri_scheme :

a string containing a URI scheme. +

Returns :

True if + gio.File's + backend supports the given URI scheme, False if URI scheme + is None, not supported, or + gio.File is invalid. +

+ The has_uri_scheme() method checks to see if a + gio.File + has a given URI scheme. +

+ This call does no blocking i/o. +

gio.File.is_native

    def is_native()

Returns :

True if file is native. +

+ The is_native() method checks to see if a file + is native to the platform. +

+ A native file s one expressed in the platform-native filename format, e.g. + "C:\Windows" or "/usr/bin/". This does not mean the file is local, as it + might be on a locally mounted remote filesystem. +

+ On some systems non-native files may be available using the native filesystem + via a userspace filesystem (FUSE), in these cases this call will return + False, but + gio.File.get_path() + will still return a native path. +

+ This call does no blocking i/o. +

gio.File.load_contents

    def load_contents(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a three tuple containing the contents of the file, + the length of the contents of the file and the current entity tag for the file. +

+ The load_contents() method loads the content of the file into memory. + The data is always zero-terminated, but this is not included in the resultant length. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.load_contents_async

    def load_contents_async(callback, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The load_contents_async() method starts an asynchronous load of the file's contents. +

+ For more details, see + gio.File.load_contents() + which is the synchronous version of this call. +

+ When the load operation has completed, callback will be called with user data. To finish + the operation, call + gio.File.load_contents_finish() + with the GAsyncResult returned by the callback. +

gio.File.load_contents_finish

    def load_contents_finish(result)

result :

a gio.AsyncResult. +

Returns :

a three tuple containing the contents of the file, + the length of the contents of the file and the current entity tag for the file. +

+ The load_contents_finish() method finishes an asynchronous + find mount started with + gio.File.load_contents_async(). +

gio.File.make_directory

    def make_directory(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True on successful creation, + False otherwise. +

+ The make_directory() method creates a directory. + Note that this will only create a child directory of the immediate parent directory + of the path or URI given by the gio.File. + To recursively create directories, see + gio.File.make_directory_with_parents(). + This function will fail if the parent directory does not exist, setting error to + gio.ERROR_NOT_FOUND. If the file system doesn't support creating directories, this + function will fail, setting error to gio.ERROR_NOT_SUPPORTED. +

+ For a local gio.File the newly + created directory will have the default (current) ownership and permissions of the current process. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.make_directory_with_parents

    def make_directory_with_parents(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if all directories have been successfully created, + False otherwise. +

+ The make_directory_with_parents() method creates a directory + and any parent directories that may not exist similar to 'mkdir -p'. If the file system + does not support creating directories, this function will fail, setting error to gio.ERROR_NOT_SUPPORTED. +

+ For a local gio.File the newly + created directories will have the default (current) ownership and permissions of the current process. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.make_symbolic_link

    def make_symbolic_link(symlink_value, cancellable=None)

symlink_value :

a string with the value of the new symlink.

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True on the creation of a new symlink, + False otherwise. +

+ The make_symbolic_link() method creates a symbolic link. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.monitor

    def monitor(flags=gio.FILE_MONITOR_NONE, cancellable=None)

flags :

+ a Gio File Monitor Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a gio.FileMonitor + for the given file, or None on error +

+ The monitor() method obtains a file or directory + monitor for the given file, depending on the type of the file. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.monitor_directory

    def monitor_directory(flags=gio.FILE_MONITOR_NONE, cancellable=None)

flags :

+ a Gio File Monitor Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a gio.FileMonitor + for the given file, or None on error +

+ The monitor_directory() method obtains a directory monitor + for the given file. This may fail if directory monitoring is not supported. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.monitor_file

    def monitor_file(flags=gio.FILE_MONITOR_NONE, cancellable=None)

flags :

+ a Gio File Monitor Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a gio.FileMonitor + for the given file, or None on error +

+ The monitor_file() method obtains a file monitor for the + given file. If no file notification mechanism exists, then regular polling + of the file is used. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.mount_enclosing_volume

    def mount_enclosing_volume(mount_operation, callback, flags=gio.FILE_COPY_NONE, cancellable=None, user_data=None)

mount_operation :

a + gio.MountOperation + or None to avoid user interaction. +

callback :

a GAsyncReadyCallback to call when the request + is satisfied, or None. +

flags :

a set of + Gio Mount Mount Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to the progress callback function. +

+ The mount_enclosing_volume() method starts a mount_operation, + mounting the volume that contains the file location. +

+ When this operation has completed, callback will be called with user_user data, + and the operation can be finalized with + gio.File.mount_enclosing_volume_finish(). +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.File.mount_enclosing_volume_finish

    def mount_enclosing_volume_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if successful. If an error has occurred, + this function will return False and set error appropriately if present. +

+ The mount_enclosing_volume_finish() method finishes an asynchronous + find mount started with + gio.File.mount_enclosing_volume(). +

gio.File.mount_mountable

    def mount_mountable(mount_operation, callback, flags=gio.FILE_COPY_NONE, cancellable=None, user_data=None)

mount_operation :

a + gio.MountOperation + or None to avoid user interaction. +

callback :

a GAsyncReadyCallback to call when the request + is satisfied, or None. +

flags :

a set of + Gio Mount Mount Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to the progress callback function. +

+ The mount_mountable() method mounts a file of type + gio.FILE_TYPE_MOUNTABLE. Using mount_operation, you can request callbacks when, + for instance, passwords are needed during authentication. +

+ When this operation has completed, callback will be called with user_user data, + and the operation can be finalized with + gio.File.mount_mountable_finish(). +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.File.mount_mountable_finish

    def mount_mountable_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.File + or None on error. +

+ The mount_mountable_finish() method finishes an asynchronous + find mount started with + gio.File.mount_mountable(). +

gio.File.move

    def copy(destination, progress_callback, flags=gio.FILE_COPY_NONE, cancellable=None, user_data=None)

destination :

destination gio.File. +

progress_callback :

function to callback with progress information. +

flags :

a set of + Gio File Copy Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to the progress callback function. +

Returns :

True on success, + False otherwise. +

+ The move() method tries to move the file or directory + source to the location specified by destination. If native move operations are + supported then this is used, otherwise a copy + delete fallback is used. The native + implementation may support moving directories (for instance on moves inside the same + filesystem), but the fallback code does not. +

+ If the flag gio.FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. +

+ If the flag gio.FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied + as symlinks, otherwise the target of the source symlink will be copied. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

+ If progress_callback is not None, then the operation can be monitored + by setting this to a GFileProgressCallback function. progress_callback_data will be passed + to this function. It is guaranteed that this callback will be called after all data has been + transferred with the total number of bytes copied during the operation. +

+ If the source file does not exist then the gio.ERROR_NOT_FOUND error is returned, + independent on the status of the destination. +

+ If gio.FILE_COPY_OVERWRITE is not specified and the target exists, then the error + gio.ERROR_EXISTS is returned. +

+ If trying to overwrite a file over a directory the gio.ERROR_IS_DIRECTORY error is returned. + If trying to overwrite a directory with a directory the gio.ERROR_WOULD_MERGE error is returned. +

+ If the source is a directory and the target does not exist, or gio.FILE_COPY_OVERWRITE is specified + and the target is a file, then the gio.ERROR_WOULD_RECURSE error may be returned + (if the native move operation isn't available). +

gio.File.query_default_handler

    def query_default_handler(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a gio.AppInfo + if the handle was found, None if there were errors. +

+ The query_default_handler() method returns the + gio.AppInfo that + is registered as the default application to handle the file specified by file. +

+ If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. +

gio.File.query_exists

    def query_exists(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the file exists (and can be detected + without error), False otherwise (or if cancelled). +

+ The query_exists() method is an tility function to check + if a particular file exists. This is implemented using + gio.File.query_info() + and as such does blocking I/O. +

+ Note that in many cases it is racy to first check for file existence and then execute + something based on the outcome of that, because the file might have been created or + removed in between the operations. The general approach to handling that is to not check, + but just do the operation and handle the errors as they come. +

+ As an example of race-free checking, take the case of reading a file, and if it doesn't + exist, creating it. There are two racy versions: read it, and on error create it; and: + check if it exists, if not create it. These can both result in two processes creating the + file (with perhaps a partially written file as the result). The correct approach is to + always try to create the file with + gio.File.create() + which will either atomically create the file or fail with a gio.ERROR_EXISTS error. +

+ However, in many cases an existence check is useful in a user interface, for instance + to make a menu item sensitive/insensitive, so that you don't have to fool users that + something is possible and then just show and error dialog. If you do this, you should + make sure to also handle the errors that can happen due to races when you execute the operation. +

gio.File.query_file_type

    def query_file_type(flags=gio.FILE_MONITOR_NONE, cancellable=None)

flags :

+ a Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

+ Gio File Type Constants +

+ The query_file_type() method it's an utility function to inspect + the Gio File Query Info Flags Constants + of a file. This is implemented using + gio.File.query_info() + and as such does blocking I/O. +

+ The primary use case of this method is to check if a file is a regular file, directory, or symlink. +

gio.File.query_filesystem_info

    def query_filesystem_info(attributes, cancellable=None)

attributes :

an attribute query string. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a gio.FileInfo + or None if there was an error. +

+ The query_filesystem_info() method it's similar to + gio.File.query_info(), + but obtains information about the filesystem the file is on, rather than the + file itself. For instance the amount of space available and the type of the filesystem. +

+ The attribute value is a string that specifies the file attributes that should be gathered. + It is not an error if it's not possible to read a particular requested attribute from a file - + it just won't be set. attribute should be a comma-separated list of attribute or attribute + wildcards. The wildcard "*" means all attributes, and a wildcard like "fs:*" means all attributes + in the fs namespace. The standard namespace for filesystem attributes is "fs". Common attributes + of interest are gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem in bytes), + gio.FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), and gio.FILE_ATTRIBUTE_FILESYSTEM_TYPE + (type of the filesystem). +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

+ If the file does not exist, the gio.ERROR_NOT_FOUND error will be returned. Other errors + are possible too, and depend on what kind of filesystem the file is on. +

gio.File.query_filesystem_info_async

    def query_filesystem_info_async(attributes, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

attributes :

an attribute query string. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The query_filesystem_info_async() method asynchronously + gets the requested information about the filesystem that the specified file is on. + The result is a GFileInfo object that contains key-value attributes + (such as type or size for the file). +

+ For more details, see + query_filesystem_info() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.query_filesystem_info_finish() + to get the result of the operation. +

gio.File.query_filesystem_info_finish

    def query_filesystem_info_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.FileInfo + or None if an error occurred. +

+ The query_filesystem_info_finish() method finishes an asynchronous + copy operation started with + gio.File.query_filesystem_info_async(). +

gio.File.query_filesystem_info

    def query_info(attributes, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attributes :

an attribute query string. +

flags :

+ a Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a gio.FileInfo + for the given file or None if there was an error. +

+ The query_info() method gets the requested + information about specified file. The result is a + gio.FileInfo + object that contains key-value attributes (such as the type or size of the file). +

+ The attribute value is a string that specifies the file attributes that should + be gathered. It is not an error if it's not possible to read a particular + requested attribute from a file - it just won't be set. attribute should be + a comma-separated list of attribute or attribute wildcards. The wildcard "*" + means all attributes, and a wildcard like "standard::*" means all attributes + in the standard namespace. An example attribute query be "standard::*,owner::user". + The standard attributes are available as defines, like gio.FILE_ATTRIBUTE_STANDARD_NAME. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

+ For symlinks, normally the information about the target of the symlink is returned, + rather than information about the symlink itself. However if you pass + gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in flags the information about + the symlink itself will be returned. Also, for symlinks that point to non-existing + files the information about the symlink itself will be returned. +

+ If the file does not exist, the gio.ERROR_NOT_FOUND error will be + returned. Other errors are possible too, and depend on what kind of + filesystem the file is on. +

gio.File.query_info_async

    def query_info_async(attributes, callback, flags=gio.FILE_QUERY_INFO_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

attributes :

an attribute query string. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

flags :

+ a Gio File Query Info Flags Constants +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The query_info_async() method asynchronously gets the + requested information about specified file. The result is a + gio.FileInfo + object that contains key-value attributes (such as type or size for the file). +

+ For more details, see + query_info() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.query_info_finish() + to get the result of the operation. +

gio.File.query_info_finish

    def query_info_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.FileInfo + for the given file or None if an error occurred. +

+ The query_info_finish() method finishes an asynchronous + copy operation started with + gio.File.query_info_async(). +

gio.File.query_settable_attributes

    def query_settable_attributes(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a list of + gio.FileAttributeInfo + describing the settable attributes. +

+ The query_settable_attributes() method obtain the + list of settable attributes for the file. +

+ Returns the type and full attribute name of all the attributes that can be + set on this file. This doesn't mean setting it will always succeed though, + you might get an access failure, or some specific file may not support a specific attribute. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.query_writable_namespace

    def query_writable_namespace(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a list of + gio.FileAttributeInfo + describing the writable namespaces. +

+ The query_writable_namespace() method obtain the + list of attribute namespaces where new attributes can be created by a user. + An example of this is extended attributes (in the "xattr" namespace). +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.read

    def read(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a + gio.FileInputStream + or None on error. +

+ The read() method opens a file for reading. The result + is a gio.FileInputStream + that can be used to read the contents of the file. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

+ If the file does not exist, the gio.ERROR_NOT_FOUND error will be returned. + If the file is a directory, the gio.ERROR_IS_DIRECTORY error will be returned. + Other errors are possible too, and depend on what kind of filesystem the file is on. +

gio.File.read_async

    def read_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The read_async() method asynchronously opens file for reading. +

+ For more details, see + read() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.read_finish() + to get the result of the operation. +

gio.File.read_finish

    def read_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.FileInputStream + file or None if an error occurred. +

+ The read_finish() method finishes an asynchronous + copy operation started with + gio.File.read_async(). +

gio.File.replace

    def replace(etag, make_backup, flags=gio.FILE_CREATE_NONE, cancellable=None)

etag :

an optional entity tag for the current + gio.File, + or None to ignore. +

make_backup :

True if a backup should be created. +

flags :

a set of + Gio File Create Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a + gio.FileOutputStream + or None on error. +

+ The replace() method returns an output stream for + overwriting the file, possibly creating a backup copy of the file first. + If the file doesn't exist, it will be created. +

+ This will try to replace the file in the safest way possible so that any + errors during the writing will not affect an already existing copy of the file. + For instance, for local files it may write to a temporary file and then atomically + rename over the destination when the stream is closed. +

+ By default files created are generally readable by everyone, but if you pass + gio.FILE_CREATE_PRIVATE in flags the file will be made readable only to + the current user, to the level that is supported on the target filesystem. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

+ If you pass in a non-None etag value, then this value is compared + to the current entity tag of the file, and if they differ an gio.ERROR_WRONG_ETAG error + is returned. This generally means that the file has been changed since you last read it. + You can get the new etag from + gio.FileOutputStream.get_etag() + after you've finished writing and closed the GFileOutputStream. When you load a new file you can use + gio.FileInputStream.query_info() + to get the etag of the file. +

+ If make_backup is True, this function will attempt to make a backup + of the current file before overwriting it. If this fails a gio.ERROR_CANT_CREATE_BACKUP + error will be returned. If you want to replace anyway, try again + with make_backup set to False. +

+ If the file is a directory the gio.ERROR_IS_DIRECTORY error will be returned, and + if the file is some other form of non-regular file then a gio.ERROR_NOT_REGULAR_FILE + error will be returned. Some file systems don't allow all file names, and may return an + gio.ERROR_INVALID_FILENAME error, and if the name is to long gio.ERROR_FILENAME_TOO_LONG + will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on. +

gio.File.replace_async

    def replace_async(callback, etag=None, make_backup=True, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

etag :

an optional entity tag for the current + gio.File, + or None to ignore. +

make_backup :

True if a backup should be created. +

flags :

a set of + Gio File Create Flags Constants +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The replace_async() method asynchronously overwrites the file, + replacing the contents, possibly creating a backup copy of the file first. +

+ For more details, see + replace() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.replace_finish() + to get the result of the operation. +

gio.File.replace_contents

    def replace_contents(contents, etag, make_backup, flags=gio.FILE_CREATE_NONE, cancellable=None)

contents :

a string containing the new contents for file. +

etag :

the old entity tag for the document + or None to ignore. +

make_backup :

True if a backup should be created. +

flags :

a set of + Gio File Create Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

the new entity tag for the document. +

+ The replace_contents() method replaces the contents + of file with contents of length bytes. If etag is specified (not NULL) any existing + file must have that etag, or the error gio.ERROR_WRONG_ETAG will be returned. +

+ If make_backup is True, this function will attempt to make a backup of file. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

+ The returned etag can be used to verify that the file hasn't changed the next time it is saved over. +

gio.File.replace_contents_async

    def replace_contents_async(contents, callback, etag=None, make_backup=True, flags=gio.FILE_CREATE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

contents :

a string containing the new contents for file. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

etag :

an optional entity tag for the current + gio.File, + or None to ignore. +

make_backup :

True if a backup should be created. +

flags :

a set of + Gio File Create Flags Constants +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The replace_contents_async() method starts an asynchronous + replacement of file with the given contents of length bytes. etag will + replace the document's current entity tag. +

+ For more details, see + replace_contents() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.replace_contents_finish() + to get the result of the operation. +

gio.File.replace_contents_finish

    def replace_contents_finish(result)

result :

a gio.AsyncResult. +

Returns :

the new entity tag for the document. +

+ The replace_contents_finish() method finishes an asynchronous + copy operation started with + gio.File.replace_contents_async(). +

gio.File.replace_finish

    def replace_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.FileOutputStream + or None if an error occurred. +

+ The replace_finish() method finishes an asynchronous + copy operation started with + gio.File.replace_async(). +

gio.File.resolve_relative_path

    def resolve_relative_path(relative_path)

relative_path :

a given relative path string. +

Returns :

a gio.File + to the resolved path. None if relative_path is None + or if file is invalid. +

+ The resolve_relative_path() method resolves a + relative path for file to an absolute path. +

+ This call does no blocking i/o. +

gio.File.set_attribute

    def set_attribute(attribute, type, value_p, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attribute :

a string containing the attribute's name. +

type :

the type of the attribute . +

value_p :

the value. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attribute was set, + False otherwise. +

+ The set_attribute() method sets an attribute in + the file with attribute name attribute to value. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.set_attribute_byte_string

    def set_attribute_byte_string(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attribute :

a string containing the attribute's name. +

value :

a string containing the attribute's new value. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attribute was set, + False otherwise. +

+ The set_attribute_byte_string() method Sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_BYTE_STRING to value. If attribute is of a different type, + this operation will fail, returning False. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.set_attribute_int32

    def set_attribute_int32(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attribute :

a string containing the attribute's name. +

value :

an int containing the attribute's new value. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attribute was set, + False otherwise. +

+ The set_attribute_int32() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_INT32 to value. If attribute is of a different type, + this operation will fail. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.set_attribute_int64

    def set_attribute_int64(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attribute :

a string containing the attribute's name. +

value :

a long containing the attribute's new value. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attribute was set, + False otherwise. +

+ The set_attribute_int64() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_INT64 to value. If attribute is of a different type, + this operation will fail. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.set_attribute_string

    def set_attribute_string(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attribute :

a string containing the attribute's name. +

value :

a string containing the attribute's new value. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attribute was set, + False otherwise. +

+ The set_attribute_string() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_STRING to value. If attribute is of a different type, + this operation will fail. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.set_attribute_uint32

    def set_attribute_uint32(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attribute :

a string containing the attribute's name. +

value :

an int containing the attribute's new value. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attribute was set, + False otherwise. +

+ The set_attribute_uint32() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_UINT32 to value. If attribute is of a different type, + this operation will fail. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.set_attribute_uint64

    def set_attribute_uint64(attribute, value, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

attribute :

a string containing the attribute's name. +

value :

a long containing the attribute's new value. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attribute was set, + False otherwise. +

+ The set_attribute_uint64() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_UINT64 to value. If attribute is of a different type, + this operation will fail. +

+ If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. +

gio.File.set_attributes_async

    def set_attributes_async(info, callback, flags=gio.FILE_QUERY_INFO_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

info :

a gio.FileInfo +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

flags :

a set of + Gio File Query Info Flags Constants +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The set_attributes_async() method asynchronously + sets the attributes of file with info. +

+ For more details, see + set_attributes_from_info() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.set_attributes_finish() + to get the result of the operation. +

gio.File.set_attributes_finish

    def set_attributes_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the attributes were set correctly, + False otherwise. +

+ The set_attributes_finish() method finishes an asynchronous + copy operation started with + gio.File.set_attributes_async(). +

gio.File.set_attributes_from_info

    def set_attributes_from_info(info, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None)

info :

a gio.FileInfo +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True if the attributes were set correctly, + False otherwise. +

+ The set_attributes_from_info() method tries to set + all attributes in the GFileInfo on the target values, not stopping on the first error. +

+ If there is any error during this operation then error will be set to the + first error. Error on particular fields are flagged by setting the "status" + field in the attribute value to gio.FILE_ATTRIBUTE_STATUS_ERROR_SETTING, + which means you can also detect further errors. +

+

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.File.set_display_name

    def set_display_name(display_name, cancellable=None)

display_name :

a string conaining the name to display. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

a gio.File + specifying what file was renamed to, or None if there was an error. +

+ The set_display_name() method renames file to + the specified display name. +

+ The display name is converted from UTF8 to the correct encoding for the + target filesystem if possible and the file is renamed to this. +

+ If you want to implement a rename operation in the user interface the + edit name (gio.FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the + initial value in the rename widget, and then the result after editing + should be passed to + gio.File.set_dispay_name(). +

+ On success the resulting converted filename is returned. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.File.set_display_name_async

    def set_display_name_async(display_name, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

display_name :

a string conaining the name to display. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The set_display_name_async() method asynchronously + sets the display name for a given GFile. +

+ For more details, see + set_display_name() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.File.set_display_name_finish() + to get the result of the operation. +

gio.File.set_display_name_finish

    def set_display_name_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.File + or None on error. +

+ The set_display_name_finish() method finishes an asynchronous + copy operation started with + gio.File.set_display_name_async(). +

gio.File.trash

    def trash(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore.

Returns :

True on successful trash, False otherwise. +

+ The trash() method sends file to the "Trashcan", if possible. + This is similar to deleting it, but the user can recover it before emptying the trashcan. + Not all file systems support trashing, so this call can return the gio.ERROR_NOT_SUPPORTED error. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

gio.File.unmount_mountable

    def unmount_mountable(callback, flags=gio.FILE_QUERY_INFO_NONE, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

flags :

a set of + Gio File Query Info Flags Constants +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The unmount_mountable() method unmounts a file of type gio.FILE_TYPE_MOUNTABLE. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

+ When the operation is finished, callback will be called. You can then call + gio.File.unmount_mountable_finish() + to get the result of the operation. +

gio.File.unmount_mountable_finish

    def unmount_mountable_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the operation finished successfully, + False otherwise. +

+ The unmount_mountable_finish() method finishes an asynchronous + copy operation started with + gio.File.unmount_mountable(). +

Functions

gio.file_parse_name

    def file_parse_name(parse_name)

parse_name :

a file name or path to be parsed. +

Returns :

a new gio.File. +

+ The parse_name() function constructs a + gio.File + with the given parse_name (i.e. something given by g_file_get_parse_name()). + This operation never fails, but the returned object might not support any I/O + operation if the parse_name cannot be parsed. +

diff --git a/docs/html/class-giofileattributeinfo.html b/docs/html/class-giofileattributeinfo.html new file mode 100644 index 0000000..d46cd57 --- /dev/null +++ b/docs/html/class-giofileattributeinfo.html @@ -0,0 +1,11 @@ +gio.FileAttributeInfo

gio.FileAttributeInfo

gio.FileAttributeInfo — Information about a specific attribute.

Synopsis

class gio.FileAttributeInfo(__builtin__.object):
+

Ancestry

+-- __builtin__.object
+  +-- gio.FileAttributeInfo
+

Description

+ The gio.FileAttributeInfo + contains information about a specific attribute. +

gio.FileAttributeInfo Attributes

"name"ReadThe name of the attribute.
"type"Readthe + Gio File Attribute Type Constants + type of the attribute.
"flags"Reada set of + Gio File Attribute Flags Constants. +
diff --git a/docs/html/class-giofileenumerator.html b/docs/html/class-giofileenumerator.html new file mode 100644 index 0000000..8d276df --- /dev/null +++ b/docs/html/class-giofileenumerator.html @@ -0,0 +1,126 @@ +gio.FileEnumerator

gio.FileEnumerator

gio.FileEnumerator — Enumerated Files Routines.

Synopsis

class gio.FileEnumerator(gobject.GObject):
+    def close(cancellable=None)
def close_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def close_finish(result)
def get_container()
def has_pending()
def is_closed()
def next_file(cancellable=None)
def next_files_async(num_files, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def next_files_finish(result)
def set_pending(pending)

gio.FileEnumerator Properties

"container"Write - Construct onlyThe container that is being enumerated.

Description

+ The gio.FileEnumerator + allows you to operate on a set of + gio.Files + returning a + gio.FileInfo + structure for each file enumerated (e.g. + gio.File.enumerate_children() + will return a The gio.FileEnumerator + for each of the children within a directory). +

+ To get the next file's information from a + The gio.FileEnumerator use + gio.FileEnumerator.next_file() + or its asynchronous version, + gio.FileEnumerator.next_files_async(). + Note that the asynchronous version will return a list of + gio.FileInfos, + whereas the synchronous will only return the next file in the enumerator. +

+ To close a gio.FileEnumerator + use close, + or its asynchronous version, + close_async. + Once a gio.FileEnumerator + is closed, no further actions may be performed on it. +

Methods

gio.FileEnumerator.close

    def close(cancellable=None)

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

Returns :

True on success or + False on error. +

+ The close() method releases all resources used by this + enumerator, making the + Gio Error Constants + return gio.ERROR_CLOSED on all calls. +

+ This will be automatically called when the last reference is dropped, + but you might want to call this function to make sure resources are released + as early as possible. +

gio.FileEnumerator.close_async

    def close_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

The + Glib Priority Constants of the request. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The close_async() method asynchronously closes the file enumerator. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned in + gio.FileEnumerator.close_finish(). +

gio.FileEnumerator.close_finish

    def close_finish(result)

result :

a GAsyncResult. +

Returns :

True if the close operation + has finished successfully.

+ The close_finish() method finishes closing a file enumerator, started from + gio.FileEnumerator.close_async(). +

+ If the file enumerator was already closed when + gio.FileEnumerator.close_async() + was called, then this function will report gio.ERROR_CLOSED in error, and return False. + If the file enumerator had pending operation when the close operation was started, then this function will report + gio.ERROR_PENDING, and return False. If cancellable was not None, then the operation + may have been cancelled by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be set, and False will be returned. +

gio.FileEnumerator.get_container

    def get_container()

Returns :

the gio.File + which is being enumerated.

+ The get_container() method gets the + gio.File + container which is being enumerated. +

gio.FileEnumerator.has_pending

    def has_pending()

Returns :

True if the enumerator has pending operations.

+ The has_pending() method checks if the file enumerator has pending operations. +

gio.FileEnumerator.is_closed

    def is_closed()

Returns :

True if the enumerator is closed.

+ The is_closed() method checks if the file enumerator has been closed. +

gio.FileEnumerator.next_file

    def next_file(cancellable=None)

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

Returns :

A gio.FileInfo + or None on error or end of enumerator. +

+ The next_file() method returns information for the next + file in the enumerated object. Will block until the information is available. + The gio.FileInfo + returned from this function will contain attributes that match the attribute string + that was passed when the GFileEnumerator was created. +

+ On error, returns None and sets error to the error. If the enumerator + is at the end, None will be returned and error will be unset. +

gio.FileEnumerator.next_files_async

    def next_files_async(num_files, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

num_files :

The number of file info objects to request. +

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

The + Glib Priority Constants of the request. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The next_files_async() method requests information for a number + of files from the enumerator asynchronously. When all i/o for the operation is finished + the callback will be called with the requested information. +

+ The callback can be called with less than num_files files in case of error or at the + end of the enumerator. In case of a partial error the callback will be called with any + succeeding items and no error, and on the next request the error will be reported. If a + request is cancelled the callback will be called with gio.ERROR_CANCELLED. +

+ During an async request no other sync and async calls are allowed, and will result in gio.ERROR_PENDING errors. +

+ Any outstanding i/o request with higher priority (lower numerical value) will be executed + before an outstanding request with lower priority. Default priority is glib.PRIORITY_DEFAULT. +

gio.FileEnumerator.next_files_finish

    def next_files_finish(result)

result :

a GAsyncResult. +

Returns :

A list of + gio.FileInfos. +

+ The next_files_finish() method finishes the + asynchronous operation started with + gio.FileEnumerator.next_files_async(). +

gio.FileEnumerator.set_pending

    def set_pending(pending)

pending :

A boolean value. +

+ The push_current() method sets the file enumerator as having pending operations. +

diff --git a/docs/html/class-giofileicon.html b/docs/html/class-giofileicon.html new file mode 100644 index 0000000..e5cdaa6 --- /dev/null +++ b/docs/html/class-giofileicon.html @@ -0,0 +1,21 @@ +gio.FileIcon

gio.FileIcon

gio.FileIcon — Icons pointing to an image file.

Synopsis

class gio.FileIcon(gobject.GObject, gio.Icon, gio.LoadableIcon):
+    gio.FileIcon(file)
def get_file()

Ancestry

+-- gobject.GObject
+  +-- gio.FileIcon
+

Description

+ The gio.FileIcon + specifies an icon by pointing to an image file to be used as icon. +

Constructor

    gio.FileIcon(file)

file :

a + gio.File +

Returns :

a new + gio.FileIcon + for the given file, or None on error. +

+ Creates a new icon for a file. +

Methods

gio.FileIcon.get_file

    def get_file()

Returns :

a + gio.File + or None. +

+ The get_file() method gets the + gio.File + associated with the given icon. +

diff --git a/docs/html/class-giofileinfo.html b/docs/html/class-giofileinfo.html new file mode 100644 index 0000000..49d5d7b --- /dev/null +++ b/docs/html/class-giofileinfo.html @@ -0,0 +1,42 @@ +gio.FileInfo

gio.FileInfo

gio.FileInfo — File Information and Attributes

Synopsis

class gio.FileInfo(gobject.GObject):
+    gio.FileInfo()
def clear_status()
def copy_into()
def dup()
def get_attribute_as_string(attribute)
def get_attribute_boolean(attribute)
def get_attribute_byte_string(attribute)
def get_attribute_data(attribute)
def get_attribute_int32(attribute)
def get_attribute_int64(attribute)
def get_attribute_object(attribute)
def get_attribute_status(attribute)
def get_attribute_string(attribute)
def get_attribute_type(attribute)
def get_attribute_uint32(attribute)
def get_attribute_uint64(attribute)
def get_content_type()
def get_display_name()
def get_edit_name()
def get_etag()
def get_file_type()
def get_icon()
def get_is_backup()
def get_is_hidden()
def get_is_symlink()
def get_modification_time()
def get_name()
def get_size()
def get_sort_order()
def get_symlink_target()
def has_attribute(attribute)
def list_attributes(name_space)
def remove_attribute(attribute)
def set_attribute(attribute, type, value_p)
def set_attribute_boolean(attribute, attr_value)
def set_attribute_byte_string(attribute, attr_value)
def set_attribute_data(attribute, attr_value)
def set_attribute_int32(attribute, attr_value)
def set_attribute_int64(attribute, attr_value)
def set_attribute_mask(mask)
def set_attribute_object(attribute, attr_value)
def set_attribute_status(attribute, attr_value)
def set_attribute_string(attribute, attr_value)
def set_attribute_uint32(attribute)
def set_attribute_uint64(attribute)
def set_content_type(content_type)
def set_display_name(display_name)
def set_edit_name(edit_name)
def set_file_type(type)
def set_icon(icon)
def set_is_hidden(is_hidden)
def set_is_symlink(is_symlink)
def set_modification_time(mtime)
def set_name(name)
def set_size(size)
def set_sort_order(sort_order)
def set_symlink_tarset(symlink_target)
def unset_attribute_mask()

Ancestry

+-- gobject.GObject
+  +-- gio.FileInfo
+

Description

+ Functionality for manipulating basic metadata for files. + gio.FileInfo + implements methods for getting information that all files should contain, + and allows for manipulation of extended attributes. +

+ See gio.FileAttribute + for more information on how GIO handles file attributes. +

+ To obtain a gio.FileInfo + for a gio.File, use + gio.File.query_info() + (or its async variant). To obtain a + gio.FileInfo + for a file input or output stream, use + gio.FileInputStream.query_info() or + gio.FileOutputStream.query_info() + (or their async variants). +

+ To change the actual attributes of a file, you should then set the attribute in the + gio.FileInfo and call + gio.File.set_attributes_from_info() or + gio.File.set_attributes_async() + on a gio.File. +

+ However, not all attributes can be changed in the file. For instance, the + actual size of a file cannot be changed via + gio.FileInfo.set_size(). You may call + gio.File.query_settable_attributes() and + gio.File.query_writable_namespace() + to discover the settable attributes of a particular file at runtime. +

+ gio.FileAttributeMatcher + allows for searching through a GFileInfo for attributes. +

Constructor

    gio.FileInfo()

Returns :

a new + gio.FileInfo +

+ Creates a new gio.FileInfo +

Methods

Unfinished section, you may want to see the relevant C API docs for methods descriptions.

diff --git a/docs/html/class-giofileinputstream.html b/docs/html/class-giofileinputstream.html new file mode 100644 index 0000000..e9fe926 --- /dev/null +++ b/docs/html/class-giofileinputstream.html @@ -0,0 +1,65 @@ +gio.FileInputStream

gio.FileInputStream

gio.FileInputStream — Base class for implementing streaming input

Synopsis

class gio.FileInputStream(gio.InputStream):
+    def query_info(attributes, cancellable=None)
def query_info_async(attributes, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def query_info_finish(result)

Implemented Interfaces

+ gio.FileInputStream + implements + gio.Seekable +

Description

+ gio.FileInputStream + provides input streams that take their content from a file. +

+ gio.FileInputStream + implements gio.Seekable, + which allows the input stream to jump to arbitrary positions in the file, provided the filesystem + of the file allows it. In addition to the generic g_seekable_ API, + gio.FileInputStream + has its own API for seeking and positioning. To find the position of a file input stream, use + gio.Seekable.tell(). + To find out if a file input stream supports seeking, use + gio.Seekable.can_seek(). + To position a file input stream, use + gio.Seekable.seek(). +

Methods

gio.FileInputStream.query_info

    def query_info(attributes, cancellable=None)

attributes :

a file attribute query string. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a gio.FileInfo, + or None on error. +

+ The query_info() method queries a file input stream + the given attributes. This function blocks while querying the stream. + For the asynchronous (non-blocking) version of this function, see + gio.FileInputStream.query_info_async(). + While the stream is blocked, the stream will set the pending flag internally, + and any other operations on the stream will fail with gio.ERROR_PENDING. +

gio.FileInputStream.query_info_async

    def query_info_async(attributes, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

attributes :

a file attribute query string. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The query_info_async() method queries the stream + information asynchronously. When the operation is finished callback will be + called. You can then call + gio.FileInputStream.query_info_finish() + to get the result of the operation. +

+ For the synchronous version of this function, see + gio.FileInputStream.query_info(). +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set +

gio.FileInputStream.query_info_finish

    def query_info_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.FileInfo, + or None on error. +

+ The query_info_finish() method finishes an asynchronous + file append operation started with + gio.FileInputStream.query_info_async(). +

diff --git a/docs/html/class-giofilemonitor.html b/docs/html/class-giofilemonitor.html new file mode 100644 index 0000000..523cc9e --- /dev/null +++ b/docs/html/class-giofilemonitor.html @@ -0,0 +1,21 @@ +gio.FileMonitor

gio.FileMonitor

gio.FileMonitor — File Monitor

Synopsis

class gio.FileMonitor(gobject.GObject):
+    def cancel()
def emit_event(child, other_file, event_type)
def is_cancelled()
def set_rate_limit(limit_msecs)

Ancestry

+-- gobject.GObject
+  +-- gio.FileMonitor
+

gio.FileMonitor Properties

"cancelled"Read + Whether the monitor has been cancelled. Default value: False. +
"rate-limit"Read/Write + The limit of the monitor to watch for changes, in milliseconds. + Allowed values: >= 0. Default value: 800. +

gio.FileMonitor Signal Prototypes

gobject.GObject Signal Prototypes

"changed"

def callback(filemonitor, file, other_file, event_type, user_param1, ...)

Description

+ The gio.FileMonitor + monitors a file or directory for changes. +

+ To obtain a gio.FileMonitor + for a file or directory, use + gio.FileMonitor.monitor(), + gio.FileMonitor.monitor_file(), or + gio.FileMonitor.monitor_directory(). +

+ To get informed about changes to the file or directory you are monitoring, + connect to the "changed" signal. +

Methods

Unfinished section, you may want to see the relevant C API docs for methods descriptions.

diff --git a/docs/html/class-giofileoutputstream.html b/docs/html/class-giofileoutputstream.html new file mode 100644 index 0000000..7ef0ad5 --- /dev/null +++ b/docs/html/class-giofileoutputstream.html @@ -0,0 +1,84 @@ +gio.FileOutputStream

gio.FileOutputStream

gio.FileOutputStream — Base class for implementing streaming input

Synopsis

class gio.FileOutputStream(gio.OutputStream):
+    def get_etag()
def query_info(attributes, cancellable=None)
def query_info_async(attributes, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def query_info_finish(result)

Implemented Interfaces

+ gio.FileOutputStream + implements + gio.Seekable +

Description

+ gio.FileOutputStream + provides output streams that write their content to a file. +

+ gio.FileOutputStream + implements gio.Seekable, + which allows the output stream to jump to arbitrary positions in the file and to truncate + the file, provided the filesystem of the file supports these operations. In addition to the + generic gio.Seekable. API, + gio.FileOutputStream + has its own API for seeking and positioning. To find the position of a file output stream, use + gio.Seekable.tell(). + To find out if a file output stream supports seeking, use + gio.Seekable.can_seek(). + To position a file output stream, use + gio.Seekable.seek(). + To find out if a file output stream supports truncating, use + gio.FileOutputStream.can_truncate(). + To truncate a file output stream, use + gio.Seekable.truncate(). +

Methods

gio.FileOutputStream.get_etag

    def get_etag()

Returns :

the entity tag for the stream. +

+ The get_etag() method gets the entity tag + for the file when it has been written. This must be called after the + stream has been written and closed, as the etag can change while writing. +

gio.FileOutputStream.query_info

    def query_info(attributes, cancellable=None)

attributes :

a file attribute query string. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a gio.FileInfo, + or None on error. +

+ The query_info() method queries a file input stream + the given attributes. This function blocks while querying the stream. + For the asynchronous (non-blocking) version of this function, see + gio.FileOutputStream.query_info_async(). + While the stream is blocked, the stream will set the pending flag internally, + and any other operations on the stream will fail with gio.ERROR_PENDING. +

+ Can fail if the stream was already closed (with error being set to gio.ERROR_CLOSED), + the stream has pending operations (with error being set to gio.ERROR_PENDING), or + if querying info is not supported for the stream's interface (with error being set to + gio.ERROR_NOT_SUPPORTED). In all cases of failure, NULL will be returned. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be set, and None will be returned. +

gio.FileOutputStream.query_info_async

    def query_info_async(attributes, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

attributes :

a file attribute query string. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The query_info_async() method queries the stream + information asynchronously. When the operation is finished callback will be + called. You can then call + gio.FileOutputStream.query_info_finish() + to get the result of the operation. +

+ For the synchronous version of this function, see + gio.FileOutputStream.query_info(). +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set +

gio.FileOutputStream.query_info_finish

    def query_info_finish(result)

result :

a gio.AsyncResult. +

Returns :

a gio.FileInfo, + or None on error. +

+ The query_info_finish() method finishes an asynchronous + file append operation started with + gio.FileOutputStream.query_info_async(). +

diff --git a/docs/html/class-giofilterinputstream.html b/docs/html/class-giofilterinputstream.html new file mode 100644 index 0000000..ebdfb0d --- /dev/null +++ b/docs/html/class-giofilterinputstream.html @@ -0,0 +1,22 @@ +gio.FilterInputStream

gio.FilterInputStream

gio.FilterInputStream — Filter Input Stream

Synopsis

class gio.FilterInputStream(gio.InputStream):
+    def get_base_stream()
def get_close_base_stream()
def set_close_base_stream(close_base)

gio.FilterInputStream Properties

"base-stream"Read - Write - Construct onlyThe underlying base stream on which the io ops will be done.
"close-base-stream"Read - Write - Construct onlyIf the base stream should be closed when the filter stream is closed. + Default value: True.

Description

+ Filter Input Stream. +

Methods

gio.FilterInputStream.get_base_stream

    def get_base_stream()

Returns :

A + gio.InputStream +

+ The get_base_stream() method gets the base + stream for the filter stream. +

gio.FilterInputStream.get_close_base_stream

    def get_close_base_stream()

Returns :

True if the base stream + will be closed. +

+ The get_close_base_stream() method returns + whether the base stream will be closed when stream is closed. +

gio.FilterInputStream.set_close_base_stream

    def set_close_base_stream(close_base)

close_base :

True to close the base stream. +

+ The set_close_base_stream() method sets whether + the base stream will be closed when stream is closed. +

diff --git a/docs/html/class-giofilteroutputstream.html b/docs/html/class-giofilteroutputstream.html new file mode 100644 index 0000000..8653c9e --- /dev/null +++ b/docs/html/class-giofilteroutputstream.html @@ -0,0 +1,22 @@ +gio.FilterOutputStream

gio.FilterOutputStream

gio.FilterOutputStream — Filter Output Stream

Synopsis

class gio.FilterOutputStream(gio.OutputStream):
+    def get_base_stream()
def get_close_base_stream()
def set_close_base_stream(close_base)

gio.FilterOutputStream Properties

"base-stream"Read - Write - Construct onlyThe underlying base stream on which the io ops will be done.
"close-base-stream"Read - Write - Construct onlyIf the base stream should be closed when the filter stream is closed. + Default value: True.

Description

+ Filter Output Stream. +

Methods

gio.FilterOutputStream.get_base_stream

    def get_base_stream()

Returns :

A + gio.OutputStream +

+ The get_base_stream() method gets the base + stream for the filter stream. +

gio.FilterOutputStream.get_close_base_stream

    def get_close_base_stream()

Returns :

True if the base stream + will be closed. +

+ The get_close_base_stream() method returns + whether the base stream will be closed when stream is closed. +

gio.FilterOutputStream.set_close_base_stream

    def set_close_base_stream(close_base)

close_base :

True to close the base stream. +

+ The set_close_base_stream() method sets whether + the base stream will be closed when stream is closed. +

diff --git a/docs/html/class-gioicon.html b/docs/html/class-gioicon.html new file mode 100644 index 0000000..aed7157 --- /dev/null +++ b/docs/html/class-gioicon.html @@ -0,0 +1,81 @@ +gio.Icon

gio.Icon

gio.Icon — Interface for icons.

Synopsis

class gio.Icon(gobject.GInterface):
+    def equal(icon2)
def to_string()
+Functions
+ 
+    def gio.icon_new_from_string()

Ancestry

+-- gobject.GInterface
+  +-- gio.Icon
+

Known Derived Interfaces

+ gio.Icon is required by + gio.LoadableIcon. +

Known Implementation

+ gio.Icon is implemented by + gio.ThemedIcon, + gio.FileIcon, + gio.Emblem, + gio.EmblemedIcon. +

Description

+ gio.Icon + is a very minimal interface for icons. It provides functions for checking + the equality of two icons, hashing of icons and serializing an icon to and from strings. +

+ gio.Icon + does not provide the actual pixmap for the icon as this is out of GIO's + scope, however implementations of + gio.Icon + may contain the name of an icon (see + gio.ThemedIcon), + or the path to an icon (see + gio.LoadableIcon). +

+ To check if two GIcons are equal, see + gio.Icon.equal(). +

+ For serializing a gio.Icon, + use gio.Icon.to_string() and + gio.Icon.new_from_string(). +

+ If your application or library provides one or more + gio.Icon + implementations you need to ensure that each GType is registered + with the type system prior to calling + gio.icon_new_from_string(). +

Methods

gio.Icon.equal

    def equal(icon2)

icon2 :

the second + gio.Icon +

+ The equal() method checks if two icons are equal. +

gio.Icon.to_string

    def to_string()

Returns :

An UTF8 string or None + if icon can't be serialized. +

+ The to_string() method generates a textual + representation of icon that can be used for serialization such as when + passing icon to a different process or saving it to persistent storage. Use + gio.icon_new_from_string() + to get icon back from the returned string. +

+ The encoding of the returned string is proprietary to GIcon except in the following two cases +

+ If icon is a gio.FileIcon, + the returned string is a native path (such as /path/to/my icon.png) without escaping + if the gio.File + for icon is a native file. If the file is not native, the returned string is the result of + gio.File.get_uri() + (such as sftp://path/to/my%20icon.png). +

+ If icon is a gio.ThemedIcon + with exactly one name, the encoding is simply the name (such as network-server). +

Functions

gio.icon_new_from_string

    def icon_new_from_string(str)

str :

A string obtained via + gio.Icon.to_string(). +

Returns :

An object implementing the + gio.Icon + interface or None if error is set. +

+ The icon_new_from_string() function generate a + gio.Icon + instance from str. This function can fail if str is not valid - see + gio.Icon.to_string() + for discussion. +

+ If your application or library provides one or more GIcon implementations you need + to ensure that each GType is registered with the type system prior to calling + gio.icon_new_from_string(). +

diff --git a/docs/html/class-gioinputstream.html b/docs/html/class-gioinputstream.html new file mode 100644 index 0000000..bb06b9b --- /dev/null +++ b/docs/html/class-gioinputstream.html @@ -0,0 +1,242 @@ +gio.InputStream

gio.InputStream

gio.InputStream — Base class for implementing streaming input

Synopsis

class gio.InputStream(gobject.GObject):
+    def clear_pending()
def close(cancellable=None)
def close_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def close_finish(result)
def has_pending()
def is_closed()
def read(count=-1, cancellable=None)
def read_async(count, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def read_finish(result)
def read_part(count=-1, cancellable=None)
def set_pending()
def skip(count, cancellable=None)
def skip_async(count, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def skip_finish(result)

Ancestry

+-- gobject.GObject
+  +-- gio.InputStream
+

Description

+ gio.InputStream + has functions to read from a stream ( + gio.InputStream.read() + ), to close a stream ( + gio.InputStream.close() + ) and to skip some content ( + gio.InputStream.skip() + ). +

+ To copy the content of an input stream to an output stream without manually + handling the reads and writes, use + gio.OutputStream.splice(). +

+ All of these functions have async variants too. +

Methods

gio.InputStream.clear_pending

    def clear_pending()

+ The clear_pending() method clears the pending flag on stream. +

gio.InputStream.close

    def close(cancellable=None)

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

True on success + False on failure. +

+ The close() method closes the stream, releasing + resources related to it. +

+ Once the stream is closed, all other operations will return gio.ERROR_CLOSED. + Closing a stream multiple times will not return an error. +

+ Streams will be automatically closed when the last reference is dropped, but + you might want to call this function to make sure resources are released as + early as possible. +

+ Some streams might keep the backing store of the stream (e.g. a file descriptor) + open after the stream is closed. See the documentation for the individual + stream for details. +

+ On failure the first error that happened will be reported, but the close operation + will finish as much as possible. A stream that failed to close will still return + gio.ERROR_CLOSED for all operations. Still, it is important to check and report + the error to the user. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. Cancelling a close will still leave + the stream closed, but some streams can use a faster close that doesn't block to e.g. + check errors. +

gio.InputStream.close_async

    def close_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The close_async() method asynchronously requests an + asynchronous closes of the stream, releasing resources related to it. +

+ For more details, see + gio.InputStream.close() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.InputStream.close_finish() + to get the result of the operation. +

gio.InputStream.close_finish

    def close_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the stream was closed successfully. +

+ The close_finish() method finishes an asynchronous + file append operation started with + gio.InputStream.close_async(). +

gio.InputStream.has_pending

    def has_pending()

Returns :

True if stream has pending actions. +

+ The has_pending() method checks if an input stream has pending actions. +

gio.InputStream.is_closed

    def is_closed()

Returns :

True if the stream is closed. +

+ The is_closed() method checks if an input stream is closed. +

gio.InputStream.read

    def read(count=-1, cancellable=None)

count :

optionally the number of bytes that will be read from the stream. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

The number of bytes read, or -1 on error. +

+ The read() method tries to read count bytes from + the stream into the buffer starting at buffer. Will block during this read. +

+ This function is similar to + gio.InputStream.read_part(), + except it tries to read as many bytes as requested, only stopping on an error or end of stream. +

+ On a successful read of count bytes, or if we reached the end of the stream, + True is returned, and bytes_read is set to the number of bytes read into buffer. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. Cancelling a close will still leave + the stream closed, but some streams can use a faster close that doesn't block to e.g. + check errors. +

+ If there is an error during the operation False is returned and error + is set to indicate the error status, bytes_read is updated to contain the number of + bytes read into buffer before the error occurred. +

gio.InputStream.read_async

    def read_async(count, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

count :

the number of bytes that will be read from the stream. +

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The read_async() method requests an asynchronous read + of count bytes from the stream into the buffer. +

+ For more details, see + gio.InputStream.read() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.InputStream.read_finish() + to get the result of the operation. +

+ During an async request no other sync and async calls are allowed, and + will result in gio.ERROR_PENDING errors. +

+ A value of count larger than G_MAXSSIZE will cause a gio.ERROR_INVALID_ARGUMENT error. +

+ On success, the number of bytes read into the buffer will be passed to the callback. + It is not an error if this is not the same as the requested size, as it can happen e.g. + near the end of a file, but generally we try to read as many bytes as requested. Zero + is returned on end of file (or if count is zero), but never otherwise. +

+ Any outstanding i/o request with higher priority (lower numerical value) will be + executed before an outstanding request with lower priority. Default priority is glib.PRIORITY_DEFAULT. +

+ The asyncronous methods have a default fallback that uses threads to implement asynchronicity, so + they are optional for inheriting classes. However, if you override one you must override all. +

gio.InputStream.read_finish

    def read_finish(result)

result :

a gio.AsyncResult. +

Returns :

The number of bytes read in, or -1 on error. +

+ The read_finish() method finishes an asynchronous + stream read operation started by + gio.InputStream.read_async(). +

gio.InputStream.read_part

    def read_part(count=-1, cancellable=None)

count :

optionally the number of bytes that will be read from the stream. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

The number of bytes read, or -1 on error. +

+ The read_part() method tries to read count bytes from + the stream into the buffer starting at buffer. Will block during this read. +

+ If count is zero returns zero and does nothing. A value of count larger than + G_MAXSSIZE will cause a gio.ERROR_INVALID_ARGUMENT error. +

+ On success, the number of bytes read into the buffer is returned. It is + not an error if this is not the same as the requested size, as it can + happen e.g. near the end of a file. Zero is returned on end of file + (or if count is zero), but never otherwise. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. Cancelling a close will still leave + the stream closed, but some streams can use a faster close that doesn't block to e.g. + check errors. +

+ On error -1 is returned and error is set accordingly. +

Note

+ This method roughly corresponds to C GIO g_input_stream_read. +

gio.InputStream.set_pending

    def set_pending()

Returns :

True if pending was previously + unset and is now set. +

+ The set_pending() method sets stream to have actions pending. + If the pending flag is already set or stream is closed, + it will return False and set error. +

gio.InputStream.skip

    def skip(count, cancellable=None)

count :

the number of bytes that will be skipped from the stream. +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

The number of bytes skipped, or -1 on error +

+ The skip() method tries to skip count bytes + from the stream. Will block during the operation. +

+ This is identical to + read(), + from a behaviour standpoint, but the bytes that are skipped are not + returned to the user. Some streams have an implementation that is more + efficient than reading the data. +

+ This function is optional for inherited classes, as the default implementation emulates it using read. +

+ If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thskip. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. Cancelling a close will still leave + the stream closed, but some streams can use a faster close that doesn't block to e.g. + check errors. +

gio.InputStream.skip_async

    def skip_async(count, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)

count :

the number of bytes that will be skipped from the stream. +

callback :

a GAsyncskipyCallback to call when the request is satisfied. +

io_priority :

the + Glib Priority Constants + of the request. +

cancellable :

optional + gio.Cancellable + object, None to ignore.

user_data :

the data to pass to callback function. +

+ The skip_async() method request an asynchronous + skip of count bytes from the stream. +

+ For more details, see + gio.InputStream.skip() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.InputStream.skip_finish() + to get the result of the operation. +

+ During an async request no other sync and async calls are allowed, and + will result in gio.ERROR_PENDING errors. +

+ A value of count larger than G_MAXSSIZE will cause a gio.ERROR_INVALID_ARGUMENT error. +

+ On success, the number of bytes skipped will be passed to the callback. It is + not an error if this is not the same as the requested size, as it can happen + e.g. near the end of a file, but generally we try to skip as many bytes as requested. + Zero is returned on end of file (or if count is zero), but never otherwise. +

+ Any outstanding i/o request with higher priority (lower numerical value) will be + executed before an outstanding request with lower priority. Default priority is glib.PRIORITY_DEFAULT. +

+ The asyncronous methods have a default fallback that uses thskips to implement asynchronicity, so + they are optional for inheriting classes. However, if you override one you must override all. +

gio.InputStream.skip_finish

    def skip_finish(result)

result :

a gio.AsyncResult. +

Returns :

The number of bytes skipped in, or -1 on error. +

+ The skip_finish() method finishes an asynchronous + stream skip operation started by + gio.InputStream.skip_async(). +

diff --git a/docs/html/class-gioloadableicon.html b/docs/html/class-gioloadableicon.html new file mode 100644 index 0000000..b894302 --- /dev/null +++ b/docs/html/class-gioloadableicon.html @@ -0,0 +1,51 @@ +gio.LoadableIcon

gio.LoadableIcon

gio.LoadableIcon — Interface for icons.

Synopsis

class gio.LoadableIcon(gobject.GInterface):
+    def load(size=0, cancellable=None)
def load_async(callback, size=0, cancellable=None, user_data=None)
def load_finish(res)

Prerequisites

+ gio.LoadableIcon requires + gio.Icon. and + gobject.GObject +

Known Implementation

+ gio.LoadableIcon is implemented by + gio.FileIcon +

Description

+ gio.LoadableIcon + extends the gio.Icon + interface and adds the ability to load icons from streams. +

Methods

gio.LoadableIcon.load

    def load(size=0, cancellable=None)

size :

an integer +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

Returns :

a 2 tuple containing a + gio.InputStream + to read the icon from and a string containing the icon type. +

+ The load() method loads a loadable icon. + For the asynchronous version of this function, see + gio.LoadableIcon.load_async(). +

gio.LoadableIcon.load_async

    def load_async(callback, size=0, cancellable=None, user_data=None)

callback :

a GAsyncReadyCallback to call when the request is satisfied. +

size :

an integer +

cancellable :

optional + gio.Cancellable + object, None to ignore. +

user_data :

the data to pass to callback function. +

+ The load_async() method loads an icon asynchronously. +

+ For more details, see + gio.LoadableIcon.load() + which is the synchronous version of this call. +

+ When the operation is finished, callback will be called. You can then call + gio.LoadableIcon.load_finish() + to get the result of the operation. +

gio.LoadableIcon.load_finish

    def load_finish(res)

res :

a + gio.AsyncResult. +

Returns :

a 2 tuple containing a + gio.InputStream + to read the icon from and a string containing the icon type. +

+ The load_finish() method finishes an asynchronous + icon load started in + gio.LoadableIcon.load_async(). +

diff --git a/docs/html/class-giomemoryinputstream.html b/docs/html/class-giomemoryinputstream.html new file mode 100644 index 0000000..b9276a9 --- /dev/null +++ b/docs/html/class-giomemoryinputstream.html @@ -0,0 +1,32 @@ +gio.MemoryInputStream

gio.MemoryInputStream

gio.MemoryInputStream — Base class for implementing streaming input

Synopsis

class gio.MemoryInputStream(gio.InputStream):
+    gio.MemoryInputStream()
def add_data(data)
+Functions
+ 
+    def gio.memory_input_stream_new_from_data(data)

Implemented Interfaces

+ gio.MemoryInputStream + implements + gio.Seekable +

Description

+ gio.MemoryInputStream + is a class for using arbitrary memory chunks as input for GIO streaming input operations. +

Constructor

    gio.MemoryInputStream(icon)

Returns :

a new + gio.MemoryInputStream. +

+ Creates an empty + gio.MemoryInputStream. +

Methods

gio.MemoryInputStream.add_data

    def add_data(data)

data :

input data. +

+ The add_data() method appends data to data + that can be read from the input stream +

Functions

gio.memory_input_stream_new_from_data

    def memory_input_stream_new_from_data(data)

data :

input data. +

Returns :

A new + gio.MemoryInputStream + read from data +

+ The memory_input_stream_new_from_data() function creates + a new gio.MemoryInputStream + with data in memory. +

diff --git a/docs/html/class-giomemoryoutputstream.html b/docs/html/class-giomemoryoutputstream.html new file mode 100644 index 0000000..cebe8e3 --- /dev/null +++ b/docs/html/class-giomemoryoutputstream.html @@ -0,0 +1,40 @@ +gio.MemoryOutputStream

gio.MemoryOutputStream

gio.MemoryOutputStream — Streaming output operations on memory chunks

Synopsis

class gio.MemoryOutputStream(gio.OutputStream):
+    gio.MemoryOutputStream()
def get_contents()
def get_data_size()
def get_size()

Implemented Interfaces

+ gio.MemoryOutputStream + implements + gio.Seekable +

Description

+ gio.MemoryOutputStream + is a class for using arbitrary memory chunks as output for GIO streaming output operations. +

Constructor

    gio.MemoryOutputStream()

Returns :

a new + gio.MemoryOutputStream. +

+ Creates a new + gio.MemoryOutputStream. +

Methods

gio.MemoryOutputStream.get_contents

    def get_contents()

Returns :

the stream's data +

+ The get_contents() method gets any loaded data + from the ostream. +

+ Note that the returned data may become invalid on the next write or truncate + operation on the stream. +

gio.MemoryOutputStream.get_data_size

    def get_data_size()

Returns :

the number of bytes written to the stream +

+ The get_data_size() method returns the number + of bytes from the start up to including the last byte written in the + stream that has not been truncated away. +

gio.MemoryOutputStream.get_size

    def get_size()

Returns :

the number of bytes allocated for the data buffer +

+ The get_size() method gets the size of the + currently allocated data area (availible from + gio.MemoryOutputStream.get_contents() + ). +

+ Note that for growable streams the returned size may become invalid on the next write or truncate operation on the stream. +

+ If you want the number of bytes currently written to the stream, use + gio.MemoryOutputStream.get_data_size(). +

diff --git a/docs/html/class-giomount.html b/docs/html/class-giomount.html new file mode 100644 index 0000000..5486311 --- /dev/null +++ b/docs/html/class-giomount.html @@ -0,0 +1,242 @@ +gio.Mount

gio.Mount

gio.Mount — Mount management

Synopsis

class gio.Mount(gobject.GInterface):
+    def can_eject()
def can_unmount()
def eject(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)
def eject_finish(result)
def get_drive()
def get_icon()
def get_name()
def get_root()
def get_uuid()
def get_volume()
def guess_content_type(callback, force_rescan, cancellable=None, user_data=None)
def guess_content_type_finish(result)
def guess_content_type_sync(force_rescan, cancellable=None)
def is_shadowed()
def remount(callback, flags=gio.MOUNT_UNMOUNT_NONE, mount_operation=None, cancellable=None, user_data=None)
def remount_finish(result)
def shadow()
def unmount(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)
def unmount_finish(result)
def unshadow()

Ancestry

+-- gobject.GInterface
+  +-- gio.Mount
+

Prerequisites

+ gio.Mount requires + gobject.GObject +

gio.Mount Signal Prototypes

gobject.GObject Signal Prototypes

"aborted"

def callback(mount, user_param1, ...)

"changed"

def callback(mount, user_param1, ...)

"unmounted"

def callback(mount, user_param1, ...)

Description

+ The gio.Mount + interface represents user-visible mounts. Note, when porting from GnomeVFS, + gio.Mount + is the moral equivalent of GnomeVFSVolume. + +

+ gio.Mount + is a "mounted" filesystem that you can access. Mounted is in quotes because + it's not the same as a unix mount, it might be a gvfs mount, but you can still + access the files on it if you use GIO. Might or might not be related to a volume object. +

+ Unmounting a GMount instance is an asynchronous operation. For more information + about asynchronous operations, see GAsyncReady and GSimpleAsyncReady. To unmount + a gio.Mount instance, + first call + g_mount_unmount() + with (at least) the GMount instance and a GAsyncReadyCallback. The callback will + be fired when the operation has resolved (either with success or failure), and a + GAsyncReady structure will be passed to the callback. That callback should then call + g_mount_unmount_finish() + with the GMount and the GAsyncReady data to see if the operation was completed successfully. + If an error is present when g_mount_unmount_finish() is called, then it will be filled + with any error information. +

Methods

gio.Mount.can_eject

    def can_eject()

Returns :

True if the mount can be ejected, + False otherwise. +

+ The can_eject() method checks if a mount can be ejected. +

gio.Mount.can_unmount

    def can_unmount()

Returns :

True if the mount can be unmounted, + False otherwise. +

+ The can_eject() method checks if a mount can be unmounted. +

gio.Mount.eject

    def eject(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

flags :

flags affecting the unmount if required for eject + Gio Mount Unmount Flags Constants. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The eject() method asynchronously ejects a mount. +

+ When the operation is finished, callback will be called. You can then call + gio.Mount.eject_finish() + to obtain the result of the operation. +

gio.Mount.eject_finish

    def eject_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the mount has been ejected + successfully, False otherwise. +

+ The eject_finish() method finishes ejecting a mount. +

gio.Mount.get_drive

    def get_drive()

Returns :

gio.Drive + or None if mount is not associated with a volume or a drive. +

+ The get_drive() method gets the drive for the mount. +

+ This is a convenience method for getting the + gio.Volume + and then using that object to get the + gio.Drive. +

gio.Mount.get_icon

    def get_icon()

Returns :

gio.Icon + for the mount. +

+ The get_icon() method gets the icon for mount. +

gio.Mount.get_name

    def get_name()

Returns :

the name for the given mount. +

+ The get_name() method gets the name of mount. +

gio.Mount.get_root

    def get_root()

Returns :

a gio.File. +

+ The get_root() method gets the root directory on mount. +

gio.Mount.get_uuid

    def get_uuid()

Returns :

the UUID for mount or None + if no UUID can be computed. +

+ The get_uuid() method gets the UUID for the mount. + The reference is typically based on the file system UUID for the mount in + question and should be considered an opaque string. Returns None + if there is no UUID available +

gio.Mount.get_volume

    def get_volume()

Returns :

a gio.Volume + or None if mount is not associated with a volume. +

+ The get_volume() method gets the volume for the mount. +

gio.Mount.guess_content_type

    def guess_content_type(callback, force_rescan, cancellable=None, user_data=None)

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

force_rescan :

Whether to force a rescan of the content. Otherwise a cached result will be used if available. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The guess_content_type() method asynchronously tries to guess the type of + content stored on mount. Returns one or more textual identifiers of well-known content + types (typically prefixed with "x-content/"), e.g. x-content/image-dcf for camera memory + cards. See the shared-mime-info specification for more on x-content types. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

+ When the operation is finished, callback will be called. You can then call + gio.Mount.guess_content_type_finish() + to obtain the result of the operation. +

gio.Mount.guess_content_type_finish

    def guess_content_type_finish(result)

result :

a gio.AsyncResult. +

Returns :

A list of types or None on error. +

+ The guess_content_type_finish() method finishes guessing content + types of mount. If any errors occured during the operation, error will be set to + contain the errors and FALSE will be returned. In particular, you may get an + gio.ERROR_NOT_SUPPORTED if the mount does not support content guessing. +

gio.Mount.guess_content_type_sync

    def guess_content_type_sync(force_rescan, cancellable=None)

force_rescan :

Whether to force a rescan of the content. Otherwise a cached result will be used if available. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

+ The guess_content_type_sync() method tries to guess + the type of content stored on mount. Returns one or more textual identifiers + of well-known content types (typically prefixed with "x-content/"), e.g. + x-content/image-dcf for camera memory cards. See the shared-mime-info specification + for more on x-content types. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

+ This is an synchronous operation and as such may block doing IO; see + gio.Mount.guess_content_type() + for the asynchronous version. +

gio.Mount.is_shadowed

    def is_shadowed()

Returns :

True if mount is shadowed. +

+ The is_shadowed() method determines if mount + is shadowed. Applications or libraries should avoid displaying mount + in the user interface if it is shadowed. +

+ A mount is said to be shadowed if there exists one or more user visible + objects (currently + gio.Mount + objects) with a root that is inside the root of mount. +

+ One application of shadow mounts is when exposing a single file system + that is used to address several logical volumes. In this situation, a + gio.VolumeMonitor + implementation would create two + gio.Volume + objects (for example, one for the camera functionality of the device + and one for a SD card reader on the device) with activation URIs + gphoto2://[usb:001,002]/store1/ and gphoto2://[usb:001,002]/store2/. + When the underlying mount (with root gphoto2://[usb:001,002]/) is + mounted, said + gio.VolumeMonitor + implementation would create two + gio.Mount + objects (each with their root matching the corresponding volume + activation root) that would shadow the original mount. +

+ The proxy monitor in GVfs 2.26 and later, automatically creates and + manage shadow mounts (and shadows the underlying mount) if the activation + root on a gio.Volume + is set. +

gio.Mount.remount

    def remount(callback, flags=gio.MOUNT_UNMOUNT_NONE, mount_operation=None, cancellable=None, user_data=None)

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

flags :

flags affecting the unmount if required for eject + Gio Mount Unmount Flags Constants. +

mount_operation :

a gio.MountOperation + or None to avoid user interaction. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The remount() method asynchronously remounts a mount. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

+ When the operation is finished, callback will be called. You can then call + gio.Mount.remount_finish() + to obtain the result of the operation. +

gio.Mount.remount_finish

    def remount_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the mount has been remounted + successfully, False otherwise. +

+ The remount_finish() method finishes remounting a mount. +

gio.Mount.shadow

    def shadow()

+ The shadow() method increments the shadow + count on mount. Usually used by + gio.VolumeMonitor + implementations when creating a shadow mount for mount, see + gio.Mount.is_shadowed() + for more information. The caller will need to emit the "changed" + signal on mount manually. +

gio.Mount.unmount

    def unmount(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

flags :

flags affecting the unmount if required for eject + Gio Mount Unmount Flags Constants. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The unmount() method asynchronously unmounts a mount. +

+ If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. +

+ When the operation is finished, callback will be called. You can then call + gio.Mount.unmount_finish() + to obtain the result of the operation. +

gio.Mount.unmount_finish

    def unmount_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the mount has been unmounted + successfully, False otherwise. +

+ The unmount_finish() method finishes unmounting a mount. +

gio.Mount.unshadow

    def unshadow()

+ The unshadow() method decrements the shadow + count on mount. Usually used by + gio.VolumeMonitor + implementations when destroying a shadow mount for mount, see + gio.Mount.is_shadowed() + for more information. The caller will need to emit the "changed" + signal on mount manually. +

Signals

The "aborted" gio.Mount Signal

    def callback(mount, user_param1, ...)

mount :

the mount

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted by the backend when e.g. a device becomes unavailable while a + mount operation is in progress. +

+ Implementations of gio.MountOperation + should handle this signal by dismissing open password dialogs. +

The "changed" gio.Mount Signal

    def callback(mount, user_param1, ...)

mount :

the mount

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when the mount has been changed. +

The "unmounted" gio.Mount Signal

    def callback(mount, user_param1, ...)

mount :

the mount

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ This signal is emitted when the + gio.Mount + have been unmounted. +

diff --git a/docs/html/class-giomountoperation.html b/docs/html/class-giomountoperation.html new file mode 100644 index 0000000..19cc014 --- /dev/null +++ b/docs/html/class-giomountoperation.html @@ -0,0 +1,123 @@ +gio.MountOperation

gio.MountOperation

gio.MountOperation — Authentication methods for mountable locations.

Synopsis

class gio.MountOperation(gobject.GObject):
+    gio.MountOperation()
def get_anonymous()
def get_choice()
def get_domain()
def get_password()
def get_password_save()
def get_username()
def replay(result)
def set_anonymous(anonymous)
def set_choice(choice)
def set_domain(domain)
def set_password(password)
def set_password_save(save)
def set_username(username)

gio.MountOperation Properties

"anonymous"Read/Write + Whether to use an anonymous user when authenticating. + Default value: False +
"choice"Read/Write + The index of the user's choice when a question is asked during + the mount operation. See the "ask-question" signal. + Allowed values: >= 0 Default value: 0 +
"domain"Read/Write + The domain to use for the mount operation. Default value: None +
"password"Read/Write + The password that is used for authentication when carrying out the + mount operation. Default value: None +
"password-save"Read/Write + Determines if and how the password information should be saved. + Default value: gio.PASSWORD_SAVE_NEVER +
"username"Read/Write + The user name that is used for authentication when carrying out the + mount operation. Default value: None +

gio.MountOperation Signal Prototypes

gobject.GObject Signal Prototypes

"aborted"

def callback(mountoperation, user_param1, ...)

"ask-password"

def callback(mountoperation, message, default_user, default_domain, flags, user_param1, ...)

"ask-question"

def callback(mountoperation, message, choices, user_param1, ...)

"reply"

def callback(mountoperation, result, user_param1, ...)

Description

+ The gio.MountOperation + provides a mechanism for authenticating mountable operations, such as loop mounting files, + hard drive partitions or server locations. +

+ Mounting operations are handed a + gio.MountOperation + that then can use if they require any privileges or authentication for their volumes to be + mounted (e.g. a hard disk partition or an encrypted filesystem), or if they are implementing + a remote server protocol which requires user credentials such as FTP or WebDAV. +

+ Users should instantiate a subclass of this that implements all the various callbacks + to show the required dialogs, such as + gtk.MountOperation. +

Constructor

    gio.MountOperation()

Returns :

a new + gio.MountOperation. +

+ Creates a new mount operation. +

Methods

gio.MountOperation.get_anonymous

    def get_anonymous()

Returns :

True if mount operation is anonymous. +

+ The get_anonymous() method check to see whether + the mount operation is being used for an anonymous user +

gio.MountOperation.get_choice

    def get_choice()

Returns :

an integer containing an index of the user's + choice from the choice's list, or 0. +

+ The get_anonymous() method gets a choice + from the mount operation. +

gio.MountOperation.get_domain

    def get_domain()

Returns :

a string set to the domain. +

+ The get_domain() method gets the domain + of the mount operation. +

gio.MountOperation.get_password

    def get_password()

Returns :

a string containing the password within + the mountoperation. +

+ The get_password() method gets a password + from the mount operation. +

gio.MountOperation.get_password_save

    def get_password_save()

Returns :

a + Gio Password Save Constants + flag. +

+ The get_password_save() method gets the state + of saving passwords for the mount operation. +

gio.MountOperation.get_username

    def get_username()

Returns :

a string containing the user name. +

+ The get_username() method get the user + name from the mount operation. +

gio.MountOperation.reply

    def reply(result)

result :

a + Gio Mount Operation Result Constants +

+ The reply() method emits the "reply" signal. +

gio.MountOperation.set_anonymous

    def set_anonymous(anonymous)

anonymous :

boolean value. +

+ The set_anonymous() method sets the mount operation + to use an anonymous user if anonymous is True. +

gio.MountOperation.set_choice

    def set_choice(choice)

choice :

an integer. +

+ The set_choice() method sets a default choice for the mount operation. +

gio.MountOperation.set_domain

    def set_domain(domain)

domain :

the domain to set. +

+ The set_domain() method sets the mount operation's domain. +

gio.MountOperation.set_password

    def set_password(password)

password :

password to set. +

+ The set_password() method sets the mount + operation's password to password. +

gio.MountOperation.set_password_save

    def set_password_save(save)

save :

a set of + Gio Password Save Constants +

+ The set_password_save() method sets the state + of saving passwords for the mount operation. +

gio.MountOperation.set_username

    def set_username(username)

username :

input username. +

+ The set_anonymous() method sets the user + name within op to username. +

Signals

The "aborted" gio.MountOperation Signal

    def callback(mountoperation, user_param1, ...)

mountoperation :

the mountoperation

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted by the backend when e.g. a device becomes unavailable while a mount operation is in progress. + Implementations of gio.MountOperation + should handle this signal by dismissing open password dialogs. +

The "ask-password" gio.MountOperation Signal

    def callback(mountoperation, message, default_user, default_domain, flags, user_param1, ...)

mountoperation :

the mountoperation

message :

string containing a message to display to the user.

default_user :

string containing the default user name.

default_domain :

string containing the default domain.

flags :

a set of + Gio Ask Password Flags Constants +

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ This signal is emitted when a mount operation asks the user for a password. + If the message contains a line break, the first line should be presented as a heading. + For example, it may be used as the primary text in a + gtk.MessageDialog. +

The "ask-question" gio.MountOperation Signal

    def callback(mountoperation, message, choices, user_param1, ...)

mountoperation :

the mountoperation

message :

string containing a message to display to the user.

choices :

a list of strings for each possible choice.

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ This signal is emitted when asking the user a question and gives a list of choices + for the user to choose from. If the message contains a line break, the first line should be + presented as a heading. For example, it may be used as the primary text in a + gtk.MessageDialog. +

The "reply" gio.MountOperation Signal

    def callback(mountoperation, result, user_param1, ...)

mountoperation :

the mountoperation

result :

a + Gio Mount Operation Result Constants + indicating how the request was handled

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ This signal is emitted when the user has replied to the mount operation. +

diff --git a/docs/html/class-giooutputstream.html b/docs/html/class-giooutputstream.html new file mode 100644 index 0000000..10b06d9 --- /dev/null +++ b/docs/html/class-giooutputstream.html @@ -0,0 +1,19 @@ +gio.OutputStream

gio.OutputStream

gio.OutputStream — Base class for implementing streaming input

Synopsis

class gio.OutputStream(gobject.GObject):
+    def clear_pending()
def close(cancellable=None)
def close_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def close_finish(result)
def flush(cancellable=None)
def flush_async(callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def flush_finish(result)
def has_pending()
def is_closed()
def set_pending()
def splice(cancellable=None, flags=gio.OUTPUT_STREAM_SPLICE_NONE)
def splice_async(source, callback, flags=gio.OUTPUT_STREAM_SPLICE_NONE, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def splice_finish(result)
def write(buffer, cancellable=None)
def write_async(buffer, callback, io_priority=glib.PRIORITY_DEFAULT, cancellable=None, user_data=None)
def write_finish(result)

Ancestry

+-- gobject.GObject
+  +-- gio.OutputStream
+

Description

+ gio.OutputStream + has functions to write from a stream ( + gio.OutputStream.write() + ), to close a stream ( + gio.OutputStream.close() + ) and to flush pending writes ( + gio.OutputStream.flush() + ). +

+ To copy the content of an input stream to an output stream without manually + handling the reads and writes, use + gio.OutputStream.splice(). +

+ All of these functions have async variants too. +

Methods

Unfinished section, you may want to see the relevant C API docs for methods descriptions.

diff --git a/docs/html/class-gioseekable.html b/docs/html/class-gioseekable.html new file mode 100644 index 0000000..8e98b67 --- /dev/null +++ b/docs/html/class-gioseekable.html @@ -0,0 +1,55 @@ +gio.Seekable

gio.Seekable

gio.Seekable — Stream seeking interface.

Synopsis

class gio.Seekable(gobject.GInterface):
+    def tell()
def can_seek()
def seek(offset, type=0, cancellable=None)
def can_truncate()
def truncate(offset, cancellable=None)

Ancestry

+-- gobject.GInterface
+  +-- gio.Seekable
+

Known Implementation

+ gio.Seekable is implemented by + gio.FileOutputStream, + gio.MemoryInputStream, + gio.FileInputStream and + gio.MemoryOutputStream. +

Description

+ gio.Seekable + is implemented by streams (implementations of + gio.InputStream or + gio.OutputStream) + that support seeking. +

Methods

gio.Seekable.tell

    def tell()

Returns :

+ the offset from the beginning of the buffer +

+ Tells the current position within the stream. +

gio.Seekable.can_seek

    def can_seek()

Returns :

True if this + gio.Seekable can be seeked with + the seek() method, False + if not.

+ The can_seek() method checks if the + seek() + can be used on this gio.Seekable. +

gio.Seekable.seek

    def seek(offset, type=0, cancellable=None)

offset :

the offset that is added to the position determined by the type parameter. +

type :

0=current position, 1=start of the file, 2=end of the file.

cancellable :

a gio.Cancellable + or None.

Returns :

True on successful seek, + False otherwise. +

+ Seeks in the stream by the given offset, modified by type. +

+ If cancellable is not None, then the + operation can be cancelled by triggering the cancellable object from another thread. +

gio.Seekable.can_truncate

    def can_truncate()

Returns :

True if this + gio.Seekable can be truncated with + the truncate() method, False + if not.

+ The can_truncate() method checks if the + truncate() + can be used on this gio.Seekable. +

gio.Seekable.truncate

    def truncate(offset, cancellable=None)

offset :

the offset at which the stream should be truncated +

cancellable :

a gio.Cancellable + or None.

Returns :

True if successful, + False otherwise. +

+ Truncates a stream with a given offset. +

+ If cancellable is not None, then the + operation can be cancelled by triggering the cancellable object from another thread. +

+ If an operation was partially finished when the operation was cancelled the + partial result will be returned, without an error. +

diff --git a/docs/html/class-giosimpleasyncresult.html b/docs/html/class-giosimpleasyncresult.html new file mode 100644 index 0000000..a9a07fe --- /dev/null +++ b/docs/html/class-giosimpleasyncresult.html @@ -0,0 +1,87 @@ +gio.SimpleAsyncResult

gio.SimpleAsyncResult

gio.SimpleAsyncResult — Simple asynchronous results implementation.

Synopsis

class gio.SimpleAsyncResult(gobject.GObject):
+    def complete()
def complete_in_idle()
def get_op_res_gboolean()
def get_op_res_gssize()
def propagate_error()
def set_handle_cancellation(handle_cancellation)
def set_op_res_gboolean(op_res)
def set_op_res_gssize(op_res)

Implemented Interface

+ gio.SimpleAsyncResult implements + gio.AsyncResult. +

Description

+ Implements gio.AsyncResult + for simple cases. Most of the time, this will be all an application needs, and will be used transparently + Because of this, GSimpleAsyncResult is used throughout GIO for handling asynchronous functions. +

+ gio.SimpleAsyncResult + handles GAsyncReadyCallbacks, error reporting, operation cancellation and the final state of an + operation, completely transparent to the application. Results can be returned as a pointer e.g. + for functions that return data that is collected asynchronously, a boolean value for checking the + success or failure of an operation, or a gssize for operations which return the number of bytes modified + by the operation; all of the simple return cases are covered. +

+ Most of the time, an application will not need to know of the details of this API; it is handled + transparently, and any necessary operations are handled by GAsyncResult's interface. However, if + implementing a new GIO module, for writing language bindings, or for complex applications that need + better control of how asynchronous operations are completed, it is important to understand this functionality. +

+ gio.SimpleAsyncResult + are tagged with the calling function to ensure that asynchronous functions and + their finishing functions are used together correctly. +

+ An asynchronous operation can be made to ignore a cancellation event by calling + gio.SimpleAsyncResult.set_handle_cancellation() + with a + gio.AsyncResult + for the operation and False. This is useful for operations that are dangerous to cancel, + such as close (which would cause a leak if cancelled before being run). +

+ gio.AsyncResult + can integrate into GLib's event loop, GMainLoop, or it can use GThreads if available. + gio.SimpleAsyncResult.complete() + will finish an I/O task directly within the main event loop. + gio.SimpleAsyncResult.complete_in_idle() + will integrate the I/O task into the main event loop as an idle function. + +

+ To set the results of an asynchronous function, + gio.SimpleAsyncResult.set_op_res_gboolean(), and + gio.SimpleAsyncResult.set_op_res_gssize() + are provided, setting the operation's result to a gboolean, or gssize, respectively. +

+ Likewise, to get the result of an asynchronous function, + gio.SimpleAsyncResult.get_op_res_gboolean() and + gio.SimpleAsyncResult.get_op_res_gssize() + are provided, getting the operation's result as a gboolean and gssize, respectively. +

Methods

gio.SimpleAsyncResult.complete

    def complete()

+ The complete() method completes an asynchronous I/O job. + Must be called in the main thread, as it invokes the callback that should be called + in the main thread. If you are in a different thread use + gio.SimpleAsyncResult.complete_in_idle(). +

gio.SimpleAsyncResult.complete_in_idle

    def complete_in_idle()

+ The complete_in_idle() method completes an asynchronous + function in the main event loop using an idle function. +

gio.SimpleAsyncResult.get_op_res_gboolean

    def get_op_res_gboolean()

Returns :

True if the operation's result was + True, False if the operation's result + was False. +

+ The get_op_res_gboolean() method gets the operation + result boolean from within the asynchronous result. +

gio.SimpleAsyncResult.get_op_res_gssize

    def get_op_res_gssize()

Returns :

a gssize returned from the asynchronous function. +

+ The get_op_res_gssize() method gets a gssize + from the asynchronous result. +

gio.SimpleAsyncResult.propagate_error

    def propagate_error()

Returns :

True if the error was propegated + to dest. False otherwise. +

+ The propagate_error() method propagates an error + from within the simple asynchronous result to a given destination. +

gio.SimpleAsyncResult.set_handle_cancellation

    def set_handle_cancellation(handle_cancellation)

handle_cancellation :

a boolean. +

+ The set_handle_cancellation() method sets whether + to handle cancellation within the asynchronous operation. +

gio.SimpleAsyncResult.set_op_res_gboolean

    def set_op_res_gboolean(op_res)

op_res :

a boolean. +

+ The set_op_res_gboolean() method sets the operation + result to a boolean within the asynchronous result. +

gio.SimpleAsyncResult.set_op_res_gssize

    def set_op_res_gssize(op_res)

op_res :

a gssize. +

+ The set_op_res_gssize() method sets the operation + result within the asynchronous result to the given op_res. +

diff --git a/docs/html/class-giothemedicon.html b/docs/html/class-giothemedicon.html new file mode 100644 index 0000000..6c2991d --- /dev/null +++ b/docs/html/class-giothemedicon.html @@ -0,0 +1,42 @@ +gio.ThemedIcon

gio.ThemedIcon

gio.ThemedIcon — Icon theming support.

Synopsis

class gio.ThemedIcon(gobject.GObject):
+    gio.ThemedIcon()
def append_name()
def get_names()
def prepend_name()

Ancestry

+-- gobject.GObject
+  +-- gio.ThemedIcon
+

gio.ThemedIcon Properties

"name"Write/Contruct Only + The icon name. Default value: None +
"names"Read/Write/Contruct Only + A list of icon names. +
"use-default-fallbacks"Read/Write/Contruct Only + Whether to use the default fallbacks found by shortening the + icon name at '-' characters. If the "names" array has more + than one element, ignores any past the first. +

Description

+ gio.ThemedIcon + is an implementation of gio.Icon + that supports icon themes. GThemedIcon contains a list of all of the icons present in an icon + theme, so that icons can be looked up quickly. +

+ gio.ThemedIcon + does not provide actual pixmaps for icons, just the icon names. Ideally something like + gtk.IconTheme.choose_icon() + should be used to resolve the list of names so that fallback icons work nicely + with themes that inherit other themes +

Constructor

    gio.ThemedIcon(name, use_default_fallbacks=False)

name :

a string containing an icon name. +

Returns :

a new + gio.ThemedIcon. +

+ Creates a new themed icon from icon name, if instead of an icon name you + provide a list of icon names, the gio.ThemedIcon + will be constructed using the items in the list. +

Methods

gio.ThemedIcon.append_name

    def append_name()

name :

name of icon to append to list of icons from within icon. +

+ The append_name() method appends a name to + the list of icons from within icon. +

gio.ThemedIcon.get_names

    def get_names()

Returns :

a list of icon names. +

+ The get_names() method gets the names + of icons from within icon. +

gio.ThemedIcon.prepend_name

    def prepend_name()

name :

name of icon to prepend to list of icons from within icon. +

+ The prepend_name() method prepends a name to + the list of icons from within icon. +

diff --git a/docs/html/class-giounixinputstream.html b/docs/html/class-giounixinputstream.html new file mode 100644 index 0000000..dce3d2f --- /dev/null +++ b/docs/html/class-giounixinputstream.html @@ -0,0 +1,37 @@ +gio.unix.InputStream

gio.unix.InputStream

gio.unix.InputStream — Streaming input operations for UNIX file descriptors.

Synopsis

class gio.unix.InputStream(gio.InputStream):
+    gio.unix.InputStream(fd, close_fd)
def get_close_fd()
def get_fd()
def set_close_fd(close_fd)

gio.unix.InputStream Properties

"close-fd"Read - WriteWhether to close the file descriptor when the stream is closed. + Default value: True.
"fd"Read - Write - Construct onlyThe file descriptor that the stream reads from. Default value: -1.

Description

+ gio.unix.InputStream + implements gio.InputStream + for reading from a UNIX file descriptor, including asynchronous operations. + The file descriptor must be selectable, so it doesn't work with opened files. +

+ Note that gio.unix.InputStream + belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file + when using it. +

Constructor

    gio.unix.InputStream(fd, close_fd)

fd :

a UNIX file descriptor. +

close_fd :

True + to close the file descriptor when done +

Returns :

a new + gio.unix.InputStream +

+ Creates a new gio.unix.InputStream + from the given fd. +

+ If close_fd is True, the file descriptor will be closed when the stream is closed. +

Methods

gio.unix.InputStream.get_close_fd

    def get_close_fd()

Returns :

True if the file descriptor is closed when done. +

+ The get_close_fd() method returns whether the file + descriptor of stream will be closed when the stream is closed. +

gio.unix.InputStream.get_fd

    def get_fd()

Returns :

The file descriptor of stream. +

+ The get_fd() method return the UNIX file descriptor + that the stream reads from. +

gio.unix.InputStream.set_close_fd

    def set_close_fd(close_fd)

close_fd :

True to close the file descriptor when done . +

+ The set_close_fd() method sets whether the file descriptor + of stream shall be closed when the stream is closed. +

diff --git a/docs/html/class-giounixoutputstream.html b/docs/html/class-giounixoutputstream.html new file mode 100644 index 0000000..4093d8f --- /dev/null +++ b/docs/html/class-giounixoutputstream.html @@ -0,0 +1,37 @@ +gio.unix.OutputStream

gio.unix.OutputStream

gio.unix.OutputStream — Streaming output operations for UNIX file descriptors.

Synopsis

class gio.unix.OutputStream(gio.OutputStream):
+    gio.unix.OutputStream(fd, close_fd)
def get_close_fd()
def get_fd()
def set_close_fd(close_fd)

gio.unix.OutputStream Properties

"close-fd"Read - WriteWhether to close the file descriptor when the stream is closed. + Default value: True.
"fd"Read - Write - Construct onlyThe file descriptor that the stream writes to. Default value: -1.

Description

+ gio.unix.OutputStream + implements gio.OutputStream + for writing to a UNIX file descriptor, including asynchronous operations. + The file descriptor must be selectable, so it doesn't work with opened files. +

+ Note that gio.unix.OutputStream + belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file + when using it. +

Constructor

    gio.unix.OutputStream(fd, close_fd)

fd :

a UNIX file descriptor. +

close_fd :

True + to close the file descriptor when done +

Returns :

a new + gio.unix.OutputStream +

+ Creates a new gio.unix.OutputStream + from the given fd. +

+ If close_fd is True, the file descriptor will be closed when the stream is closed. +

Methods

gio.unix.OutputStream.get_close_fd

    def get_close_fd()

Returns :

True if the file descriptor is closed when done. +

+ The get_close_fd() method returns whether the file + descriptor of stream will be closed when the stream is closed. +

gio.unix.OutputStream.get_fd

    def get_fd()

Returns :

The file descriptor of stream. +

+ The get_fd() method return the UNIX file descriptor + that the stream reads from. +

gio.unix.OutputStream.set_close_fd

    def set_close_fd(close_fd)

close_fd :

True to close the file descriptor when done . +

+ The set_close_fd() method sets whether the file descriptor + of stream shall be closed when the stream is closed. +

diff --git a/docs/html/class-giovolume.html b/docs/html/class-giovolume.html new file mode 100644 index 0000000..957cbad --- /dev/null +++ b/docs/html/class-giovolume.html @@ -0,0 +1,176 @@ +gio.Volume

gio.Volume

gio.Volume — Volume management.

Synopsis

class gio.Volume(gobject.GInterface):
+    def can_eject()
def can_mount()
def eject(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)
def eject_finish(result)
def enumerate_identifiers()
def get_activation_root()
def get_drive()
def get_icon()
def get_identifier()
def get_mount()
def get_name()
def get_uuid()
def mount(mount_operation, callback, flags=gio.MOUNT_MOUNT_NONE, cancellable=None, user_data=None)
def mount_finish(result)
def should_automount()

Ancestry

+-- gobject.GInterface
+  +-- gio.Volume
+

Prerequisites

+ gio.Volume requires + gobject.GObject +

gio.Volume Signal Prototypes

gobject.GObject Signal Prototypes

"changed"

def callback(volume, user_param1, ...)

"removed"

def callback(volume, user_param1, ...)

Description

+ The gio.Volume + interface represents user-visible objects that can be mounted. Note, when porting + from GnomeVFS, gio.Volume + is the moral equivalent of GnomeVFSDrive. +

+ Mounting a gio.Volume + instance is an asynchronous operation. For more information about asynchronous operations. + To mount a gio.Volume, first call + gio.Volume.mount() + with (at least) the gio.Volume + instance, optionally a + gio.MountOperation + object and a GAsyncReadyCallback. +

+ Typically, one will only want to pass None for the GMountOperation + if automounting all volumes when a desktop session starts since it's not desirable + to put up a lot of dialogs asking for credentials. +

+ The callback will be fired when the operation has resolved (either with success or failure), + and a GAsyncReady structure will be passed to the callback. That callback should then call + gio.Volume.mount_finish() + with the GVolume instance and the GAsyncReady data to see if the operation was completed + successfully. If an error is present when + gio.Volume.mount_finish() + is called, then it will be filled with any error information. +

+ It is sometimes necessary to directly access the underlying operating system object behind a volume + (e.g. for passing a volume to an application via the commandline). For this purpose, GIO allows to obtain + an 'identifier' for the volume. There can be different kinds of identifiers, such as Hal UDIs, + filesystem labels, traditional Unix devices (e.g. /dev/sda2), uuids. GIO uses predefind strings + as names for the different kinds of identifiers: + "hal-udi", "label", etc. Use + gio.Volume.get_identifier() + to obtain an identifier for a volume. +

Methods

gio.Volume.can_eject

    def can_eject()

Returns :

True if the volume can be ejected, + False otherwise. +

+ The can_eject() method checks if a volume can be ejected. +

gio.Volume.can_mount

    def can_mount()

Returns :

True if the volume can be mounted + for media changes, False otherwise. +

+ The can_mount() method checks if a volume + can be mounted. +

gio.Volume.eject

    def eject(callback, flags=gio.MOUNT_UNMOUNT_NONE, cancellable=None, user_data=None)

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

flags :

flags affecting the unmount if required for eject. +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The eject() method asynchronously ejects a volume. +

+ When the operation is finished, callback will be called. You can then call + gio.Volume.eject_finish() + to obtain the result of the operation. +

gio.Volume.eject_finish

    def eject_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the volume has been ejected + successfully, False otherwise. +

+ The eject_finish() method finishes ejecting a volume. + If any errors occured during the operation, error will be set to contain the + errors and False will be returned. +

gio.Volume.enumerate_identifiers

    def enumerate_identifiers()

Returns :

a list of strings containing kinds of identifiers. +

+ The enumerate_identifiers() method gets the kinds + of identifiers that volume has. Use + gio.Volume.get_identifier() + to obtain the identifiers themselves. +

gio.Volume.get_activation_root

    def get_activation_root()

Returns :

the activation root of volume or None. +

+ The get_activation_root() method gets the activation + root for a gio.Volume + if it is known ahead of mount time. Returns None otherwise. + If not None and if volume is mounted, then the result of + gio.Mount.get_root() + on the GMount object obtained from + gio.Volume.get_mount() + will always either be equal or a prefix of what this function returns. + In other words, in code: +

+mount = volume.get_mount() # mounted, so never None
+mount_root = mount.get_root()
+volume_activation_root = volume.get_activation_root() # assume not None
+

+ then the expression +

+volume_activation_root.has_prefix(mount_root) || volume_activation_root.equal(mount_root)
+

+ will always be True. +

+ Activation roots are typically used in + gio.VolumeMonitor + implementations to find the underlying mount to shadow, see + gio.Mount.is_shadowed() + for more details. +

gio.Volume.get_drive

    def get_drive()

Returns :

A gio.Drive + or None if volume is not associated with a drive. +

+ The get_drive() method gets the drive for the volume. +

gio.Volume.get_icon

    def get_icon()

Returns :

gio.Icon + for the volume. +

+ The get_icon() method gets the icon for volume. +

gio.Volume.get_identifier

    def get_identifier()

Returns :

A string containing the requested identfier, or + None if the + gio.Volume + doesn't have this kind of identifier. +

+ The get_identifier() method gets the identifier of + the given kind for volume. +

gio.Volume.get_mount

    def get_mount()

Returns :

A + gio.Mount + or None if volume isn't mounted. +

+ The get_mount() method gets the mount for the volume. +

gio.Volume.get_name

    def get_name()

Returns :

A string containing volume's name. +

+ The get_name() method gets the name of volume. +

gio.Volume.get_uuid

    def get_uuid()

Returns :

the UUID for volume or None + if no UUID can be computed. +

+ The get_uuid() method gets the UUID for the volume. + The reference is typically based on the file system UUID for the volume in + question and should be considered an opaque string. + Returns None if there is no UUID available. +

gio.Volume.mount

    def mount(mount_operation, callback, flags=gio.MOUNT_MOUNT_NONE, cancellable=None, user_data=None)

mount_operation :

A + gio.MountOperation + or None to avoid user interaction. +

callback :

A GAsyncReadyCallback to call when the request is satisfied. +

flags :

Flags affecting the operation +

cancellable :

Optional + gio.Cancellable + object, None to ignore. +

user_data :

The data to pass to callback function. +

+ The mount() method mounts a volume. This is an + asynchronous operation, and is finished by calling + gio.Volume.mount_finish() + with the volume and GAsyncResult returned in the callback. +

gio.Volume.mount_finish

    def mount_finish(result)

result :

a gio.AsyncResult. +

Returns :

True if the volume has been mounted + successfully, False otherwise. +

+ The mounted() method finishes mounting a volume. + If any errors occured during the operation, error will be set to contain + the errors and False will be returned. +

+ If the mount operation succeeded, + get_mount() + on volume is guaranteed to return the mount right after calling this function; + there's no need to listen for the 'mount-added' signal on + gio.VolumeMonitor. +

gio.Volume.should_automount

    def should_automount()

Returns :

True if the volume should + be automatically mounted. +

+ The should_automount() method returns whether + the volume should be automatically mounted. +

Signals

The "changed" gio.Volume Signal

    def callback(volume, user_param1, ...)

volume :

the volume

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when the volume has been changed. +

The "removed" gio.Volume Signal

    def callback(volume, user_param1, ...)

volume :

the volume

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ This signal is emitted when the + gio.Volume + have been removed. If the recipient is holding references to the object + they should release them so the object can be finalized. +

diff --git a/docs/html/class-giovolumemonitor.html b/docs/html/class-giovolumemonitor.html new file mode 100644 index 0000000..697d14f --- /dev/null +++ b/docs/html/class-giovolumemonitor.html @@ -0,0 +1,135 @@ +gio.VolumeMonitor

gio.VolumeMonitor

gio.VolumeMonitor — Volume Monitor.

Synopsis

class gio.VolumeMonitor(gobject.GObject):
+    def get_connected_drives()
def get_mount_for_uuid(uuid)
def get_mounts()
def get_volume_for_uuid(uuid)
def get_volumes()
+Functions
+    def gio.volume_monitor_adopt_orphan_mount()
def gio.volume_monitor_get()

gio.VolumeMonitor Signal Prototypes

gobject.GObject Signal Prototypes

"drive-changed"

def callback(volume_monitor, drive, user_param1, ...)

"drive-connected"

def callback(volume_monitor, drive, user_param1, ...)

"drive-disconnected"

def callback(volume_monitor, drive, user_param1, ...)

"drive-eject-button"

def callback(volume_monitor, drive, user_param1, ...)

"mount-added"

def callback(volume_monitor, mount, user_param1, ...)

"mount-changed"

def callback(volume_monitor, mount, user_param1, ...)

"mount-pre-unmount"

def callback(volume_monitor, mount, user_param1, ...)

"mount-removed"

def callback(volume_monitor, mount, user_param1, ...)

"volume-added"

def callback(volume_monitor, volume, user_param1, ...)

"volume-changed"

def callback(volume_monitor, volume, user_param1, ...)

"volume-removed"

def callback(volume_monitor, volume, user_param1, ...)

Description

+ The gio.VolumeMonitor + is for listing the user interesting devices and volumes on the computer. In other words, + what a file selector or file manager would show in a sidebar. +

Methods

gio.VolumeMonitor.get_connected_drives

    def get_connected_drives()

Returns :

a list of connected + gio.Drive objects. +

+ The get_connected_drives() method gets a list + of drives connected to the system. +

gio.VolumeMonitor.get_mount_for_uuid

    def get_mount_for_uuid(uuid)

uuid :

The UUID to look for. +

Returns :

A + gio.Mount + or None if no such mount is available. +

+ The get_mount_for_uuid() method finds a + gio.Mount + object by it's UUID (see + gio.Mount.get_uuid()) +

gio.VolumeMonitor.get_mounts

    def get_mounts()

Returns :

A list of + gio.Mount + objects. +

+ The get_mounts() method gets a list of the mounts on the system. +

gio.VolumeMonitor.get_volume_for_uuid

    def get_volume_for_uuid(uuid)

uuid :

The UUID to look for. +

Returns :

A + gio.Volume + or None if no such volume is available. +

+ The get_mount_for_uuid() method finds a + gio.Mount + object by it's UUID (see + gio.Mount.get_uuid()) +

gio.VolumeMonitor.get_volumes

    def get_volumes()

Returns :

A list of + gio.Volume + objects. +

+ The get_volumes() method gets a list of the volumes on the system. +

Functions

gio.volume_monitor_adopt_orphan_mount

    def volume_monitor_adopt_orphan_mount()

Returns :

The gio.Volume + object that is the parent for mount or None if no wants to adopt the + gio.Mount. +

Warning

This method will be deprecated starting from GIO 2.20

+ The volume_monitor_adopt_orphan_mount() function should + be called by any gio.VolumeMonitor + implementation when a new gio.Mount + object is created that is not associated with a + gio.Volume object. + It must be called just before emitting the mount_added signal. +

+ If the return value is not None, the caller must associate the returned + gio.Volume + object with the + gio.Mount. + This involves returning it in it's + gio.Mount.get_volumes() + implementation. The caller must also listen for the "removed" signal on the + returned object and give up it's reference when handling that signal +

+ Similary, if implementing + gio.volume_monitor_adopt_orphan_mount(), + the implementor must take a reference to mount and return it in it's + gio.Volume.get_mount() + implemented. Also, the implementor must listen for the "unmounted" signal + on mount and give up it's reference upon handling that signal. +

+ There are two main use cases for this function. +

+ One is when implementing a user space file system driver that reads blocks of + a block device that is already represented by the native volume monitor + (for example a CD Audio file system driver). Such a driver will generate it's own + gio.Mount + object that needs to be assoicated with the + gio.Volume + object that represents the volume. +

+ The other is for implementing a + gio.VolumeMonitor + whose sole purpose is to return + gio.Volume + objects representing entries in the users "favorite servers" list or similar. +

gio.volume_monitor_get

    def volume_monitor_get()

Returns :

A reference to the + gio.VolumeMonitor + used by gio. +

+ The volume_monitor_get() function gets the + volume monitor used by gio. +

Signals

The "drive-changed" gio.Volume Signal

    def callback(volume_monitor, drive, user_param1, ...)

volume_monitor :

the volume monitor

drive :

the drive that changed

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a drive changes. +

The "drive-connected" gio.Volume Signal

    def callback(volume_monitor, drive, user_param1, ...)

volume_monitor :

the volume monitor

drive :

the drive that was connected

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a drive is connected to the system. +

The "drive-disconnected" gio.Volume Signal

    def callback(volume_monitor, drive, user_param1, ...)

volume_monitor :

the volume monitor

drive :

the drive that was disconnected

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a drive is disconnected from the system. +

The "drive-eject-button" gio.Volume Signal

    def callback(volume_monitor, drive, user_param1, ...)

volume_monitor :

the volume monitor

drive :

the drive where the eject button was pressed

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when the eject button is pressed on drive. +

The "mount-added" gio.Volume Signal

    def callback(volume, mount, user_param1, ...)

volume_monitor :

the volume monitor

mount :

a Mount that was added.

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a mount is added. +

The "mount-changed" gio.Volume Signal

    def callback(volume_monitor, mount, user_param1, ...)

volume_monitor :

the volume monitor

mount :

the Mount that changed.

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a mount changes. +

The "mount-pre-unmount" gio.Volume Signal

    def callback(volume_monitor, mount, user_param1, ...)

volume_monitor :

the volume monitor

mount :

the Mount that is being unmounted.

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a mount is about to be removed. +

The "mount-removed" gio.Volume Signal

    def callback(volume_monitor, mount, user_param1, ...)

volume_monitor :

the volume monitor

mount :

the Mount that was removed.

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a mount is removed. +

The "volume-added" gio.Volume Signal

    def callback(volume_monitor, volume, user_param1, ...)

volume_monitor :

the volume monitor

volume :

a Volume that was added.

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a mountable volume is added to the system. +

The "volume-changed" gio.Volume Signal

    def callback(volume_monitor, volume, user_param1, ...)

volume_monitor :

the volume monitor

volume :

a Volume that changed.

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when mountable volume is changed. +

The "volume-removed" gio.Volume Signal

    def callback(volume_monitor, volume, user_param1, ...)

volume_monitor :

the volume monitor

volume :

a Volume that was removed.

user_param1 :

the first user parameter (if any) specified + with the connect() + method

... :

additional user parameters (if any)

+ Emitted when a mountable volume is removed from the system. +

diff --git a/docs/html/class-glibmaincontext.html b/docs/html/class-glibmaincontext.html new file mode 100644 index 0000000..071c992 --- /dev/null +++ b/docs/html/class-glibmaincontext.html @@ -0,0 +1,29 @@ +glib.MainContext

glib.MainContext

glib.MainContext — an object representing a set of event sources to be handled +in a glib.MainLoop.

Synopsis

class glib.MainContext:
+    glib.MainContext()
def iteration(may_block)
def pending()

Ancestry

+-- glib.MainContext
+

Description

A glib.MainContext +represents a set of event sources that can be run in a single thread. File +descriptors (plain files, pipes or sockets) and timeouts are the standard +event sources for GTK and PyGTK though +others can be added. Each event source is assigned a priority. The default +priority, glib.PRIORITY_DEFAULT, is 0. Values less +than 0 denote higher priorities. Values greater than 0 denote lower +priorities. Events from high priority sources are always processed before +events from lower priority sources. Single iterations of a glib.MainContext +can be run with the iteration() +method.

Constructor

    glib.MainContext()

Returns :

a new glib.MainContext + object.

Creates a new glib.MainContext +object.

Methods

glib.MainContext.iteration

    def iteration()

may_block :

if TRUE the call may block + waiting for an event.

Returns :

TRUE if events were + dispatched.

The iteration() method runs a single +iteration. This involves:

  • checking to see if any associated event sources are ready +to be processed;
  • then if no events sources are ready and +may_block is TRUE, waiting for a +source to become ready;
  • and finally, dispatching the highest priority events +sources that are ready

Note that even when may_block is +TRUE, it is still possible for +iteration() to return FALSE, +since the the wait may be interrupted for other reasons than an event source +becoming ready.

glib.MainContext.pending

    def pending()

Returns :

TRUE if events are + pending.

The pending() method checks if any +associated sources have pending events.

diff --git a/docs/html/class-glibmainloop.html b/docs/html/class-glibmainloop.html new file mode 100644 index 0000000..d0894dc --- /dev/null +++ b/docs/html/class-glibmainloop.html @@ -0,0 +1,38 @@ +glib.MainLoop

glib.MainLoop

glib.MainLoop — an object representing the main event loop of a PyGTK + application.

Synopsis

class glib.MainLoop:
+    glib.MainLoop(context=None, is_running=0)
def get_context()
def is_running()
def quit()
def run()

Ancestry

+-- glib.MainLoop
+

Description

glib.MainLoop +represents a main event loop. A glib.MainLoop +is created with the glib.MainLoop() +constructor. After adding the initial event sources, the run() +method is called. This continuously checks for new events from each of the +event sources and dispatches them. Finally, the processing of an event from +one of the sources leads to a call to the quit() +method to exit the main loop, and the run() +method returns.

It is possible to create new instances of glib.MainLoop +recursively. This is often used in PyGTK applications +when showing modal dialog boxes. Note that event sources are associated with +a particular glib.MainContext, +and will be checked and dispatched for all main loops associated with that +glib.MainContext.

PyGTK contains wrappers of some of these +functions, e.g. the gtk.main(), gtk.main_quit() +and gtk.events_pending() +functions.

Constructor

    glib.MainLoop(context=None, is_running=None)

context :

a glib.MainContext + or None to use the default + context.

is_running :

if TRUE indicates that the + loop is running. This is not very important since calling the run() + method will set this to TRUE + anyway.

Returns :

a new glib.MainLoop + object.

Creates a new glib.MainLoop +object.

Methods

glib.MainLoop.get_context

    def get_context()

Returns :

the glib.MainContext + the mainloop is associated with

The get_context() method returns the +glib.MainContext +that the mainloop was created with.

glib.MainLoop.is_running

    def is_running()

Returns :

TRUE if the mainloop is + currently being run.

The is_running() method checks to see +if the mainloop is currently being run via the run() +method.

glib.MainLoop.quit

    def quit()

The quit() method stops the mainloop +from running. Any subsequent calls to the run() +method will return immediately.

glib.MainLoop.run

    def run()

The run() method runs a mainloop until +the quit() +method is called. If this is called for the thread of the loop's glib.MainContext, +it will process events from the loop, otherwise it will simply wait.

diff --git a/docs/html/class-gobject.html b/docs/html/class-gobject.html new file mode 100644 index 0000000..4c1e07c --- /dev/null +++ b/docs/html/class-gobject.html @@ -0,0 +1,176 @@ +gobject.GObject

gobject.GObject

gobject.GObject — the base class

Synopsis

class gobject.GObject:
+    def get_property(property_name)
def get_properties(first_property_name, ...)
def set_property(property_name, value)
def set_properties(property_name=value, ...)
def freeze_notify()
def notify(property_name)
def thaw_notify()
def get_data(key)
def set_data(key, data)
def connect(detailed_signal, handler)
def connect_after(detailed_signal, handler)
def connect_object(detailed_signal, handler)
def connect_object_after(detailed_signal, handler)
def disconnect(handler_id)
def handler_disconnect(handler_id)
def handler_is_connected(handler_id)
def handler_block(handler_id)
def handler_unblock(handler_id)
def handler_block_by_func(callable)
def handler_unblock_by_func(callable)
def emit(detailed_signal)
def stop_emission(detailed_signal)
def emit_stop_by_name(detailed_signal)
def chain()

Ancestry

+-- gobject.GObject
+

Attributes

"props"Read/Write +

This attribute gives full access to GObject properties as + simple attributes. It can be used to iterate over all the object + properties, and can be used both on class or instance objects.

+

Examples:

+
+button = Button()
+button_label = button.props.label
+button.props.label = 'Click on this fancy button'
+for pspec in button.props:
+    print pspec
+    print button.get_property(pspec.name)
+label_pspec = Button.props.label
+button_label = button.get_property(label_pspec.name)
+              
+
"__doc__"ReadThe documentation for the object type. Uses + "__gdoc__" if no specific documentation set.
"__gdoc__"ReadThe generated documentation for the underlying GObject + type.
"__gtype__"ReadThe underlying GObject type.
"__grefcount__"ReadThe reference count for the underlying GObject.

gobject.GObject Signal Prototypes

"notify"

def callback(gobject, property_spec, user_param1, ...)

Description

The gobject.GObject + class is the base class providing the common attributes and methods for + the PyGTK classes. The gobject.GObject + class is not a user interface widget class.

The gobject.GObject + class provides the signal management methods, the object property access + methods and the object data management methods.

Methods

gobject.GObject.get_property

    def get_property(property_name)

property_name :

a string containing the property name for the +GObject

Returns :

a Python object containing the value of the +property

The get_property() method returns the +value of the property specified by property_name or +None if there is no value associated with the property.

The TypeError exception is raised +if the property name is not registered with the object class.

gobject.GObject.get_properties

    def get_properties(first_property_name, ...)

first_property_name :

a string containing the first property name for the +GObject

... :

additional property names +

Returns :

a tuple containing the property values +requested

The get_properties() method returns a tuple containing +the values of the properties requested, or +None if there is no value associated with the property.

The TypeError exception is raised +if the property name is not registered with the object class.

gobject.GObject.set_property

    def set_property(property_name, value)

property_name :

a string containing the property +name

value :

a Python object containing the property value +to be set

The set_property() method sets the +property specified by property_name to the specified +value.

The TypeError exception is raised +if the property name is not registered with the object class or if the value +specified could not be converted to the property type.

gobject.GObject.set_properties

    def set_properties(property_name=value, ...)

property_name :

the property name

value :

a Python object containing the property value +to be set

... :

additional property name and value +kwargs

The set_properties() method sets the +property specified by property_name to the specified +value, followed by pairs of property name +and value as keyword arguments.

The TypeError exception is raised +if the property name is not registered with the object class or if the value +specified could not be converted to the property type.

gobject.GObject.freeze_notify

    def freeze_notify()

The freeze_notify() method freezes the +object's property-changed notification queue so that "notify" signals are +blocked until the thaw_notify() method is +called.

gobject.GObject.notify

    def notify(property_name)

property_name :

a string containing a property +name

The notify() method causes the "notify" +signal for the property specified by property_name to +be emitted.

gobject.GObject.thaw_notify

    def thaw_notify()

The thaw_notify() method thaws the +object's property-changed notification queue so that "notify" signals are +emitted.

gobject.GObject.get_data

    def get_data(key)

key :

a string used as the key

Returns :

a Python object containing the associated +data

The get_data() method returns the +Python object associated with the specified key or +None if there is no data associated with the key or +if there is no key associated with the object.

gobject.GObject.set_data

    def set_data(key, data)

key :

a string used as a key

data :

a Python object that is the value to be +associated with the key

The set_data() method associates the +specified Python object (data) with +key.

gobject.GObject.connect

    def connect(detailed_signal, handler, ...)

detailed_signal :

a string containing the signal +name

handler :

a Python function or method +object.

... :

additional optional +parameters

Returns :

an integer identifier

The connect() method adds a function or +method (handler)to the end of the list of signal +handlers for the named detailed_signal but before the +default class signal handler. An optional set of parameters may be specified +after the handler parameter. These will all be passed +to the signal handler when invoked.

For example if a function handler was connected to a signal +using:

+  handler_id = object.connect("signal_name", handler, arg1, arg2, arg3)
+

The handler should be defined as:

+  def handler(object, arg1, arg2, arg3):
+

A method handler connected to a signal using:

+  handler_id = object.connect("signal_name", self.handler, arg1, arg2)
+

requires an additional argument when defined:

+  def handler(self, object, arg1, arg2)
+

A TypeError exception is raised +if detailed_signal identifies a signal name that is +not associated with the object.

gobject.GObject.connect_after

    def connect_after(detailed_signal, handler, ...)

detailed_signal :

a string containing the signal +name

handler :

a Python function or method +object

... :

additional optional +parameters

Returns :

an integer handler +identifier

The connect_after() method is similar +to the connect() method except that the +handler is added to the signal handler list after the +default class signal handler. Otherwise the details of +handler definition and invocation are the +same.

gobject.GObject.connect_object

    def connect_object(detailed_signal, handler, gobject)

detailed_signal :

a string containing the signal +name

handler :

a Python function or method +object

gobject :

a GObject

Returns :

an integer handler +identifier

The connect_object() method is the same +as the connect() method except that the +handler is invoked with the specified +gobject in place of the object invoking the +connect_object() method. For example, a call with a +function handler:

+  handler_id = object("signal_name", handler, gobject)
+

will cause the handler to be invoked +as:

+  handler(gobject)
+

Likewise a method handler will be invoked as:

+  self.handler(gobject)
+

This can be helpful in invoking PyGTK widget methods that +require no arguments except the widget itself (e.g. +widget.destroy()) by using the class method as the +handler. For example, a Button "clicked" signal can be set up to invoke the +Window destroy() method as:

+  handler_id = button.connect_object("clicked", Window.destroy, window)
+

When the button is clicked the handler is invoked as:

+  Window.destroy(window)
+

which is the same as:

+  window.destroy()
+

Additional arguments may be passed to the handler as with the +connect() method handler invocations.

gobject.GObject.connect_object_after

    def connect_object_after(detailed_signal, handler)

detailed_signal :

a string containing the signal +name

handler :

a Python function or method +object

gobject :

a GObject

Returns :

an integer handler +identifier

The connect_object_after() method is +similar to the connect_object() method except that +the handler is added to the signal handler list after +the default class signal handler. Otherwise the details of +handler definition and invocation are the +same.

gobject.GObject.disconnect

    def disconnect(handler_id)

handler_id :

an integer handler +identifier

The disconnect() method removes the +signal handler with the specified handler_id from the +list of signal handlers for the object.

gobject.GObject.handler_disconnect

    def handler_disconnect(handler_id)

handler_id :

an integer handler +identifier

The handler_disconnect() method removes +the signal handler with the specified handler_id from +the list of signal handlers for the object.

gobject.GObject.handler_is_connected

    def handler_is_connected(handler_id)

handler_id :

an integer handler +identifier

Returns :

TRUE if the signal handler +is connected to the object.

The handler_is_connected() method +returns TRUE if the signal handler with the specified +handler_id is connected to the object.

gobject.GObject.handler_block

    def handler_block(handler_id)

handler_id :

an integer handler +identifier

The handler_block() method blocks the +signal handler with the specified handler_id from +being invoked until it is unblocked.

gobject.GObject.handler_unblock

    def handler_unblock(handler_id)

handler_id :

an integer handler +identifier

gobject.GObject.handler_block_by_func

    def handler_block_by_func(callable)

callable :

a callable python object

The handler_block_by_func() method blocks the +all signal handler connected to a specific callable from +being invoked until the callable is unblocked.

gobject.GObject.handler_unblock_by_func

    def handler_unblock_by_func(callback)

callable :

a callable python object

The handler_unblock_by_func() method unblocks +all signal handler connected to a specified callable +thereby allowing it to be invoked when the associated signals are +emitted.

gobject.GObject.emit

    def emit(detailed_signal, ...)

detailed_signal :

a string containing the signal +name

... :

additional parameters

Returns :

a PyObject*

The emit() method causes the object to +emit the signal specified by detailed_signal. The +additional parameters must match the number and type of the required signal +handler parameters. In most cases no additional parameters are needed. for +example:

+  button.emit("clicked")
+

is all that is required to emit the "clicked" signal for a +button. The most common case requiring additional parameters occurs when +emitting an event signal; for example:

+  button.emit("button_press_event", event)
+

gobject.GObject.stop_emission

    def stop_emission(detailed_signal)

detailed_signal :

a string containing the signal +name

The stop_emission() method stops the +current emission of the signal specified by +detailed_signal. Any signal handlers in the list +still to be run will not be invoked.

gobject.GObject.emit_stop_by_name

    def emit_stop_by_name(detailed_signal)

detailed_signal :

a string containing the signal +name

The emit_stop_by_name() method stops +the current emission of the signal specified by +detailed_signal. Any signal handlers in the list +still to be run will not be invoked.

gobject.GObject.chain

    def chain(...)

... :

additional parameters

Returns :

a Python object

The chain() method does something.

Signals

The GObject "notify" Signal

    def callback(gobject, property_spec, user_param1, ...)

gobject :

the gobject that received the +signal

property_spec :

the gobject.GParamSpec of the property that was +changed

user_param1 :

the first user parameter (if any) specified +with the connect() +method

... :

additional user parameters (if +any)

The "notify" signal is emitted on a gobject when one of its +properties has been changed. Note that getting this signal doesn't guarantee +that the value of the property has actually changed, it may also be emitted +when the setter for the property is called to reinstate the previous +value. For example to be notified of the change of the title of a gtk.Window you could +connect to the "notify" signal similar to:

+  window.connect("notify::title", callback)
+
diff --git a/docs/html/class-gobjectgboxed.html b/docs/html/class-gobjectgboxed.html new file mode 100644 index 0000000..ead5e11 --- /dev/null +++ b/docs/html/class-gobjectgboxed.html @@ -0,0 +1,9 @@ +gobject.GBoxed

gobject.GBoxed

gobject.GBoxed — an object containing an opaque chunk of data

Synopsis

class gobject.GBoxed:
+    def copy()

Ancestry

+-- gobject.GBoxed
+

Description

gobject.GBoxed +is an abstract base class that encapsulates an opaque chunk of data to +provide an object-oriented interface and a type that is registered with the +GLIB type system. A boxed type is registered with +functions that provide for the copying and freeing of the underlying data +structure - this allows PyGTK to encapsulate these as Python objects.

Methods

gobject.GBoxed.copy

    def copy()

Returns :

a copy of the gobject.GBoxed + object

The copy() method makes and returns a copy of the boxed object.

diff --git a/docs/html/class-gobjectginterface.html b/docs/html/class-gobjectginterface.html new file mode 100644 index 0000000..b15ef7e --- /dev/null +++ b/docs/html/class-gobjectginterface.html @@ -0,0 +1,4 @@ +gobject.GInterface

gobject.GInterface

gobject.GInterface — an object representing a GInterface

Synopsis

class gobject.GInterface:
+

Ancestry

+-- gobject.GInterface
+

Description

gobject.GInterface +is an abstract base class that encapsulates a GInterface.

diff --git a/docs/html/class-gobjectgpointer.html b/docs/html/class-gobjectgpointer.html new file mode 100644 index 0000000..4b86cd9 --- /dev/null +++ b/docs/html/class-gobjectgpointer.html @@ -0,0 +1,8 @@ +gobject.GPointer

gobject.GPointer

gobject.GPointer — an object containing a completely opaque chunk of + data

Synopsis

class gobject.GPointer:
+

Ancestry

+-- gobject.GPointer
+

Description

gobject.GPointer +is an abstract base class that encapsulates an opaque chunk of data and +registers it with the GLIB type system. A pointer type +has no methods and generic ways of copying and freeing the data. It +shouldn't be used in PyGTK.

diff --git a/docs/html/gio-class-reference.html b/docs/html/gio-class-reference.html new file mode 100644 index 0000000..a7a8bb8 --- /dev/null +++ b/docs/html/gio-class-reference.html @@ -0,0 +1 @@ +PyGio Class Reference

PyGio Class Reference

Table of Contents

gio.AppInfo — Information about an installed application and methods to launch it (with file arguments).
gio.AppLaunchContext — Application launch context.
gio.AsyncResult — Asynchronous Function Results.
gio.BufferedInputStream — Buffered Input Stream
gio.BufferedOutputStream — Buffered Output Stream
gio.Cancellable — Thread-safe Operation Cancellation Stack.
gio.DataInputStream — Data Input Stream
gio.DataOutputStream — Data Output Stream
gio.Drive — Virtual File System drive management.
gio.Emblem — An object for emblems.
gio.EmblemedIcon — Icon with emblems.
gio.File — File and Directory Handling.
gio.FileAttributeInfo — Information about a specific attribute.
gio.FileEnumerator — Enumerated Files Routines.
gio.FileIcon — Icons pointing to an image file.
gio.FileInfo — File Information and Attributes
gio.FileInputStream — Base class for implementing streaming input
gio.FileMonitor — File Monitor
gio.FileOutputStream — Base class for implementing streaming input
gio.FilterInputStream — Filter Input Stream
gio.FilterOutputStream — Filter Output Stream
gio.Icon — Interface for icons.
gio.InputStream — Base class for implementing streaming input
gio.LoadableIcon — Interface for icons.
gio.MemoryInputStream — Base class for implementing streaming input
gio.MemoryOutputStream — Streaming output operations on memory chunks
gio.Mount — Mount management
gio.MountOperation — Authentication methods for mountable locations.
gio.OutputStream — Base class for implementing streaming input
gio.Seekable — Stream seeking interface.
gio.SimpleAsyncResult — Simple asynchronous results implementation.
gio.ThemedIcon — Icon theming support.
gio.Volume — Volume management.
gio.VolumeMonitor — Volume Monitor.
gio Functions
gio Constants — the built-in constants of the gio module
diff --git a/docs/html/gio-constants.html b/docs/html/gio-constants.html new file mode 100644 index 0000000..b1c8bb2 --- /dev/null +++ b/docs/html/gio-constants.html @@ -0,0 +1,414 @@ +gio Constants

gio Constants

gio Constants — the built-in constants of the gio module

Description

Gio Ask Password Flags Constants

+ Flags that are used to request specific information from the user, or to + notify the user of their choices in an authentication situation. +

gio.ASK_PASSWORD_ANONYMOUS_SUPPORTED

operation supports anonymous users.

gio.ASK_PASSWORD_NEED_DOMAIN

operation requires a domain.

gio.ASK_PASSWORD_NEED_PASSWORD

operation requires a password.

gio.ASK_PASSWORD_NEED_USERNAME

operation requires a username.

gio.ASK_PASSWORD_SAVING_SUPPORTED

operation supports saving settings.

Gio AppInfo Create Flags Constants

+ Flags used when creating a gio.AppInfo +

gio.APP_INFO_CREATE_NONE

No flags.

gio.APP_INFO_CREATE_NEEDS_TERMINAL

Application opens in a terminal window.

gio.APP_INFO_CREATE_SUPPORTS_URIS

Application supports URI arguments.

Gio Data Stream Byte Order Constants

+ Used to ensure proper endianness of streaming data sources across various machine architectures. +

gio.DATA_STREAM_BYTE_ORDER_BIG_ENDIAN

Selects Big Endian byte order.

gio.DATA_STREAM_BYTE_ORDER_HOST_ENDIAN

Selects endianness based on host machine's architecture.

gio.DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN

Selects Little Endian byte order.

Gio Data Stream Newline Type Constants

+ Used when checking for or setting the line endings for a given file. +

gio.DATA_STREAM_NEWLINE_TYPE_LF

Selects "LF" line endings, common on most modern UNIX platforms.

gio.DATA_STREAM_NEWLINE_TYPE_CR

Selects "CR" line endings.

gio.DATA_STREAM_NEWLINE_TYPE_CR_LF

Selects "CR, LF" line ending, common on Microsoft Windows.

gio.DATA_STREAM_NEWLINE_TYPE_ANY

Automatically try to handle any line ending type.

Gio Emblem Origin Constants

+ GEmblemOrigin is used to add information about the origin of the emblem to GEmblem. +

gio.EMBLEM_ORIGIN_DEVICE

Embleme adds device-specific information.

gio.EMBLEM_ORIGIN_LIVEMETADATA

Emblem depicts live metadata, such as "readonly".

gio.EMBLEM_ORIGIN_TAG

Emblem comes from a user-defined tag, e.g. set by nautilus (in the future).

gio.EMBLEM_ORIGIN_UNKNOWN

Emblem of unknown origin.

Gio Error Constants

+ GIOError Error codes returned by GIO functions. +

gio.ERROR_ALREADY_MOUNTED

File is already mounted.

gio.ERROR_BUSY

File is busy.

gio.ERROR_CANCELLED

Operation was cancelled. See + gio.Cancellable. +

gio.ERROR_CANT_CREATE_BACKUP

Backup couldn't be created.

gio.ERROR_CLOSED

File was closed.

gio.ERROR_EXISTS

File already exists error.

gio.ERROR_FAILED

Generic error condition for when any operation fails.

gio.ERROR_FAILED_HANDLED

Operation failed and a helper program has already interacted with + the user. Do not display any error dialog.

gio.ERROR_FILENAME_TOO_LONG

Filename is too many characters.

gio.ERROR_HOST_NOT_FOUND

Host couldn't be found (remote operations).

gio.ERROR_INVALID_ARGUMENT

Invalid argument.

gio.ERROR_INVALID_FILENAME

Filename is invalid or contains invalid characters.

gio.ERROR_IS_DIRECTORY

File is a directory error.

gio.ERROR_NOT_DIRECTORY

File is not a directory.

gio.ERROR_NOT_EMPTY

File is a directory that isn't empty.

gio.ERROR_NOT_FOUND

File not found error.

gio.ERROR_NOT_MOUNTABLE_FILE

File cannot be mounted.

gio.ERROR_NOT_MOUNTED

File isn't mounted.

gio.ERROR_NOT_REGULAR_FILE

File is not a regular file.

gio.ERROR_NOT_SUPPORTED

Operation not supported for the current backend.

gio.ERROR_NOT_SYMBOLIC_LINK

File is not a symbolic link.

gio.ERROR_NO_SPACE

No space left on drive.

gio.ERROR_PENDING

Operations are still pending.

gio.ERROR_PERMISSION_DENIED

Permission denied.

gio.ERROR_READ_ONLY

File is read only.

gio.ERROR_TIMED_OUT

Operation timed out.

gio.ERROR_TOO_MANY_LINKS

File contains too many symbolic links.

gio.ERROR_TOO_MANY_OPEN_FILES

The current process has too many files open and can't open any + more. Duplicate descriptors do count toward this limit. Since 2.20

gio.ERROR_WOULD_BLOCK

Operation would block.

gio.ERROR_WOULD_MERGE

Operation would merge files.

gio.ERROR_WOULD_RECURSE

Operation would be recursive.

gio.ERROR_WRONG_ETAG

File's Entity Tag was incorrect.

Gio File Attribute Constants

+ The file attributes. +

gio.FILE_ATTRIBUTE_STANDARD_TYPE

+ "standard::type" A key in the "standard" namespace for storing file types. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. The value for this key should contain a + Gio File Type Constants +

gio.FILE_ATTRIBUTE_STANDARD_IS_HIDDEN

+ "standard::is-hidden" A key in the "standard" namespace for checking if a file is hidden. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_STANDARD_IS_BACKUP

+ "standard::is-backup" A key in the "standard" namespace for checking if a file is a backup file. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_STANDARD_IS_SYMLINK

+ "standard::is-symlink" A key in the "standard" namespace for checking if the file is a symlink. + Typically the actual type is something else, if we followed the symlink to get the type. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL

+ "standard::is-virtual" A key in the "standard" namespace for checking if a file is virtual. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_STANDARD_NAME

+ "standard::name" A key in the "standard" namespace for getting the name of the file. + The name is the on-disk filename which may not be in any known encoding, + and can thus not be generally displayed as is. Use + gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME if you need to display the name in a user + interface. Corresponding GFileAttributeType is gio.FILE_ATTRIBUTE_TYPE_BYTE_STRING. +

gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME

+ "standard::display-name" A key in the "standard" namespace for getting the display + name of the file. A display name is guaranteed to be in UTF8 and can thus be displayed + in the UI. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_STANDARD_EDIT_NAME

+ "standard::edit-name" A key in the "standard" namespace for edit name of the file. + An edit name is similar to the display name, but it is meant to be used when you want + to rename the file in the UI. The display name might contain information you don't + want in the new filename (such as "(invalid unicode)" if the filename was in an + invalid encoding). Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_STANDARD_COPY_NAME

+ "standard::copy-name" A key in the "standard" namespace for getting the copy + name of the file. The copy name is an optional version of the name. If available + it's always in UTF8, and corresponds directly to the original filename (only transcoded + to UTF8). This is useful if you want to copy the file to another filesystem that might + have a different encoding. If the filename is not a valid string in the encoding selected + for the filesystem it is in then the copy name will not be set. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_STANDARD_ICON

+ "standard::icon" A key in the "standard" namespace for getting the icon for the file. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_OBJECT. The value for this key should contain a + gio.Icon. +

gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE

+ "standard::content-type" A key in the "standard" namespace for getting the content type of the file. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. The value for this key should contain a valid content type. +

gio.FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE

+ "standard::fast-content-type" A key in the "standard" namespace for getting the fast + content type. The fast content type isn't as reliable as the regular one, as it + only uses the filename to guess it, but it is faster to calculate than the regular + content type. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_STANDARD_SIZE

+ "standard::size" A key in the "standard" namespace for getting the file's size (in bytes). Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT64. +

gio.FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET

+ "standard::symlink-target" A key in the "standard" namespace for getting the target URI + for the file, in the case of gio.FILE_TYPE_SHORTCUT or gio.FILE_TYPE_MOUNTABLE files. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_STANDARD_SORT_ORDER

+ "standard::sort-order" A key in the "standard" namespace for setting the sort order of a file. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_INT32. An example use would be in file managers, which would use this + key to set the order files are displayed. Files with smaller sort order should be sorted first, + and files without sort order as if sort order was zero. +

gio.FILE_ATTRIBUTE_ETAG_VALUE

+ "etag::value" A key in the "etag" namespace for getting the value of the file's entity tag. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_ID_FILE

+ "id::file" A key in the "id" namespace for getting a file identifier. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. An example use would be during listing files, + to avoid recursive directory scanning. +

gio.FILE_ATTRIBUTE_ID_FILESYSTEM

+ "id::filesystem" A key in the "id" namespace for getting the file system identifier. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. An example use would be during drag and + drop to see if the source and target are on the same filesystem (default to move) or not (default to copy). +

gio.FILE_ATTRIBUTE_ACCESS_CAN_READ

+ "access::can-read" A key in the "access" namespace for getting read privileges. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to read the file. +

gio.FILE_ATTRIBUTE_ACCESS_CAN_WRITE

+ "access::can-write" A key in the "access" namespace for getting write privileges.Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to write to the file. +

gio.FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE

+ "access::can-execute" A key in the "access" namespace for getting execution privileges. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to execute the file. +

gio.FILE_ATTRIBUTE_ACCESS_CAN_DELETE

+ "access::can-delete" A key in the "access" namespace for checking deletion privileges. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to delete the file. +

gio.FILE_ATTRIBUTE_ACCESS_CAN_TRASH

+ "access::can-trash" A key in the "access" namespace for checking trashing privileges. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to move the file to the trash. +

gio.FILE_ATTRIBUTE_ACCESS_CAN_RENAME

+ "access::can-rename" A key in the "access" namespace for checking renaming privileges. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to rename the file. +

gio.FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT

+ "mountable::can-mount" A key in the "mountable" namespace for checking if + a file (of type G_FILE_TYPE_MOUNTABLE) is mountable. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT

+ "mountable::can-unmount" A key in the "mountable" namespace for checking if a file + (of type G_FILE_TYPE_MOUNTABLE) is unmountable. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT

+ "mountable::can-eject" A key in the "mountable" namespace for checking if a file + (of type G_FILE_TYPE_MOUNTABLE) can be ejected. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE

+ "mountable::unix-device" A key in the "mountable" namespace for getting the unix device. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI

+ "mountable::hal-udi" A key in the "mountable" namespace for getting the + HAL UDI for the mountable file. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_TIME_MODIFIED

+ "time::modified" A key in the "time" namespace for getting the time the file was last modified. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT64, and contains the UNIX time since the file was modified. +

gio.FILE_ATTRIBUTE_TIME_MODIFIED_USEC

+ "time::modified-usec" A key in the "time" namespace for getting the miliseconds + of the time the file was last modified. This should be used in conjunction + with G_FILE_ATTRIBUTE_TIME_MODIFIED. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_TIME_ACCESS

+ "time::access" A key in the "time" namespace for getting the time the file was last accessed. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT64, and contains the UNIX time since the file was last accessed. +

gio.FILE_ATTRIBUTE_TIME_ACCESS_USEC

+ "time::access-usec" A key in the "time" namespace for getting the microseconds of + the time the file was last accessed. This should be used in conjunction + with G_FILE_ATTRIBUTE_TIME_ACCESS. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_TIME_CHANGED

+ "time::changed" A key in the "time" namespace for getting the time the + file was last changed. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT64, and contains the UNIX time since the file was last changed. + This corresponds to the traditional UNIX ctime. +

gio.FILE_ATTRIBUTE_TIME_CHANGED_USEC

+ "time::changed-usec" A key in the "time" namespace for getting the microseconds + of the time the file was last changed. This should be used in conjunction + with G_FILE_ATTRIBUTE_TIME_CHANGED. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_TIME_CREATED

+ "time::created" A key in the "time" namespace for getting the time the file was created. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT64, and contains the UNIX time since the file was created. + This corresponds to the NTFS ctime. +

gio.FILE_ATTRIBUTE_TIME_CREATED_USEC

+ "time::created-usec" A key in the "time" namespace for getting the microseconds of the time the + file was created. This should be used in conjunction with G_FILE_ATTRIBUTE_TIME_CREATED. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_UNIX_DEVICE

+ "unix::device" A key in the "unix" namespace for getting the device id of the device the file + is located on (see stat() documentation). This attribute is only available + for UNIX file systems. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_UNIX_INODE

+ "unix::inode" A key in the "unix" namespace for getting the inode of the file. This attribute is only + available for UNIX file systems. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_UINT64. +

gio.FILE_ATTRIBUTE_UNIX_MODE

+ "unix::mode" A key in the "unix" namespace for getting the mode of the file (e.g. + whether the file is a regular file, symlink, etc). See lstat() documentation. + This attribute is only available for UNIX file systems. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_UNIX_NLINK

+ "unix::nlink" A key in the "unix" namespace for getting the number of hard links + for a file. See lstat() documentation. This attribute is only available for UNIX + file systems. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_UNIX_UID

+ "unix::uid" A key in the "unix" namespace for getting the user ID for the file. This attribute + is only available for UNIX file systems. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_UNIX_GID

+ "unix::gid" A key in the "unix" namespace for getting the group ID for the file. + This attribute is only available for UNIX file systems. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_UNIX_RDEV

+ "unix::rdev" A key in the "unix" namespace for getting the device ID for the file + (if it is a special file). See lstat() documentation. This attribute is only available + for UNIX file systems. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_UNIX_BLOCK_SIZE

+ "unix::block-size" A key in the "unix" namespace for getting the block size for + the file system. This attribute is only available for UNIX file systems. Corresponding + Gio File Attribute Type Constants + is gio.FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_UNIX_BLOCKS

+ "unix::blocks" A key in the "unix" namespace for getting the number of blocks allocated + for the file. This attribute is only available for UNIX file systems. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_UINT64. +

gio.FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT

+ "unix::is-mountpoint" A key in the "unix" namespace for checking if the file represents + a UNIX mount point. This attribute is True if the file is a UNIX mount point. + This attribute is only available for UNIX file systems. Corresponding + GFileAttributeType + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_DOS_IS_ARCHIVE

+ "dos::is-archive" A key in the "dos" namespace for checking if the file's archive + flag is set. This attribute is True if the archive flag is set. + This attribute is only available for DOS file systems. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_DOS_IS_SYSTEM

+ "dos::is-system" A key in the "dos" namespace for checking if the file's backup + flag is set. This attribute is True if the backup flag is set. + This attribute is only available for DOS file systems. Corresponding + Gio File Attribute Type Constants is + G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_OWNER_USER

+ "owner::user" A key in the "owner" namespace for getting the user name + of the file's owner. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_OWNER_USER_REAL

+ "owner::user-real" A key in the "owner" namespace for getting the real name + of the user that owns the file. Corresponding + Gio File Attribute Type Constants is + G_FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_OWNER_GROUP

+ "owner::group" A key in the "owner" namespace for getting the file owner's + group. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_THUMBNAIL_PATH

+ "thumbnail::path" A key in the "thumbnail" namespace for getting the path + to the thumbnail image. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +

gio.FILE_ATTRIBUTE_THUMBNAILING_FAILED

+ "thumbnail::failed" A key in the "thumbnail" namespace for checking if thumbnailing failed. This attribute + is True if thumbnailing failed. Corresponding + Gio File Attribute Type Constants is + G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_PREVIEW_ICON

+ "preview::icon" A key in the "preview" namespace for getting a + gio.Icon + that can be used to get preview of the file. For example, it + may be a low resolution thumbnail without metadata. Corresponding + Gio File Attribute Type Constants is + G_FILE_ATTRIBUTE_TYPE_OBJECT. The value for this key should contain a GIcon. +

gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE

+ "filesystem::size" A key in the "filesystem" namespace for getting the total + size (in bytes) of the file system, used in + query_filesystem_info(). + Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_UINT64. +

gio.FILE_ATTRIBUTE_FILESYSTEM_FREE

+ "filesystem::free" A key in the "filesystem" namespace for getting the number of bytes of free space left + on the file system. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_UINT64. +

gio.FILE_ATTRIBUTE_FILESYSTEM_TYPE

+ "filesystem::type" A key in the "filesystem" namespace for getting the file system's type. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_FILESYSTEM_READONLY

+ "filesystem::readonly" A key in the "filesystem" namespace for checking if the + file system is read only. Is set to True if the file system + is read only. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +

gio.FILE_ATTRIBUTE_GVFS_BACKEND

+ "gvfs::backend" A key in the "gvfs" namespace that gets the name of the current GVFS backend in use. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_STRING. +

gio.FILE_ATTRIBUTE_SELINUX_CONTEXT

+ "selinux::context" A key in the "selinux" namespace for getting the file's SELinux context. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_STRING. + Note that this attribute is only available if GLib has been built with SELinux support. +

gio.FILE_ATTRIBUTE_TRASH_ITEM_COUNT

+ "trash::item-count" A key in the "trash" namespace. When requested against "trash:///" returns the number + of (toplevel) items in the trash folder. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_UINT32. +

gio.FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW

+ "filesystem::use-preview" A key in the "filesystem" namespace for hinting a file manager + application whether it should preview (e.g. thumbnail) files on the file system. + The value for this key contain a GFilesystemPreviewType. +

gio.FILE_ATTRIBUTE_STANDARD_DESCRIPTION

+ "standard::description" A key in the "standard" namespace for getting the description + of the file. The description is a utf8 string that describes the file, generally containing + the filename, but can also contain furter information. Example descriptions could be + "filename (on hostname)" for a remote file or "filename (in trash)" for a + file in the trash. This is useful for instance as the window title when + displaying a directory or for a bookmarks menu. Corresponding + Gio File Attribute Type Constants + is G_FILE_ATTRIBUTE_TYPE_STRING. +

Gio File Attribute Type Constants

+ The data types for file attributes. +

gio.FILE_ATTRIBUTE_TYPE_BOOLEAN

a boolean value.

gio.FILE_ATTRIBUTE_TYPE_BYTE_STRING

a zero terminated string of non-zero bytes.

gio.FILE_ATTRIBUTE_TYPE_INT32

a signed 4-byte/32-bit integer.

gio.FILE_ATTRIBUTE_TYPE_INT64

a signed 8-byte/64-bit integer.

gio.FILE_ATTRIBUTE_TYPE_INVALID

indicates an invalid or uninitalized type.

gio.FILE_ATTRIBUTE_TYPE_OBJECT

a gobject.GObject.

gio.FILE_ATTRIBUTE_TYPE_STRING

a null terminated UTF8 string.

gio.FILE_ATTRIBUTE_TYPE_UINT32

an unsigned 4-byte/32-bit integer.

gio.FILE_ATTRIBUTE_TYPE_UINT64

an unsigned 8-byte/64-bit integer.

Gio File Attribute Flags Constants

+ Flags specifying the behaviour of an attribute. +

gio.FILE_ATTRIBUTE_INFO_NONE

no flags set.

gio.FILE_ATTRIBUTE_INFO_COPY_WITH_FILE

copy the attribute values when the file is copied.

gio.FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED

copy the attribute values when the file is moved.

Gio File Create Flags Constants

+ Flags used when an operation may create a file. +

gio.FILE_CREATE_NONE

No flags set.

gio.FILE_CREATE_PRIVATE

Create a file that can only be accessed by the current user.

gio.FILE_CREATE_REPLACE_DESTINATION

+ Replace the destination as if it didn't exist before. Don't try + to keep any old permissions, replace instead of following links. This is + generally useful if you're doing a "copy over" rather than a "save new version of" + replace operation. You can think of it as "unlink destination" before writing + to it, although the implementation may not be exactly like that. +

Gio File Copy Flags Constants

+ Flags used when copying or moving files. +

gio.FILE_COPY_NONE

No flags set.

gio.FILE_COPY_OVERWRITE

Overwrite any existing files.

gio.FILE_COPY_BACKUP

Make a backup of any existing files.

gio.FILE_COPY_NOFOLLOW_SYMLINKS

Don't follow symlinks.

gio.FILE_COPY_ALL_METADATA

Copy all file metadata instead of just default set used for copy + (see gio.FileInfo).

gio.FILE_COPY_NO_FALLBACK_FOR_MOVE

Don't use copy and delete fallback if native move not supported.

gio.FILE_COPY_TARGET_DEFAULT_PERMS

Leaves target file with default perms, instead of setting the source file perms.

Gio File Monitor Flags Constants

+ Flags used to set what a + gio.FileMonitor + will watch for. +

gio.FILE_MONITOR_NONE

No flags set.

gio.FILE_MONITOR_WATCH_MOUNTS

Watch for mount events.

Gio File Query Info Flags Constants

+ Flags used when querying a + gio.FileInfo. +

gio.FILE_QUERY_INFO_NONE

No flags set.

gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS

Don't follow symlinks.

Gio File Type Constants

+ Indicates the file's on-disk type. +

gio.FILE_TYPE_DIRECTORY

File handle represents a directory.

gio.FILE_TYPE_MOUNTABLE

File is a mountable location.

gio.FILE_TYPE_REGULAR

File handle represents a regular file.

gio.FILE_TYPE_SHORTCUT

File is a shortcut (Windows systems).

gio.FILE_TYPE_SPECIAL

File is a "special" file, such as a socket, fifo, block device, or character device.

gio.FILE_TYPE_SYMBOLIC_LINK

File handle represents a symbolic link (Unix systems).

gio.FILE_TYPE_UNKNOWN

File's type is unknown.

Gio Mount Mount Flags Constants

+ Flags used when mounting a mount. +

gio.MOUNT_MOUNT_NONE

No flags set.

Gio Mount Unmount Flags Constants

+ Flags used when unmounting a mount. +

gio.MOUNT_UNMOUNT_NONE

No flags set.

gio.MOUNT_UNMOUNT_FORCE

Unmount even if there are outstanding file operations on the mount.

Gio Mount Operation Result Constants

+ returned as a result when a request for information is send by the mounting operation. +

gio.MOUNT_OPERATION_HANDLED

The request was fulfilled and the user specified data is now available.

gio.MOUNT_OPERATION_ABORTED

The user requested the mount operation to be aborted.

gio.MOUNT_OPERATION_UNHANDLED

The request was unhandled (i.e. not implemented).

Gio Password Save Constants

+ is used to indicate the lifespan of a saved password. +

+ Gvfs stores passwords in the Gnome keyring when this flag allows it to, + and later retrieves it again from there. +

gio.PASSWORD_SAVE_FOR_SESSION

save a password for the session.

gio.PASSWORD_SAVE_NEVER

never save a password.

gio.PASSWORD_SAVE_PERMANENTLY

save a password permanently.
diff --git a/docs/html/gio-functions.html b/docs/html/gio-functions.html new file mode 100644 index 0000000..80287e6 --- /dev/null +++ b/docs/html/gio-functions.html @@ -0,0 +1,74 @@ +gio Functions

gio Functions

gio Functions

Description

+ These functions are part of the PyGObject gio module + but are not directly associated with a specific class +

Functions

gio.content_type_can_be_executable

    def content_type_can_be_executable(type)

type :

a content type string. +

Returns :

True if the file type corresponds + to a type that can be executable, False otherwise. +

+ The content_type_can_be_executable() function checks + if a content type can be executable. Note that for instance things like text files + can be executables (i.e. scripts and batch files). +

gio.content_type_equals

    def content_type_equals(type1, type2)

type1 :

a content type string. +

type2 :

a content type string. +

Returns :

True if the two strings are + identical or equivalent, False otherwise. +

+ The content_type_equals() function compares + two content types for equality. +

gio.content_type_from_mime_type

    def content_type_from_mime_type(mime_type)

mime_type :

a mime type string. +

Returns :

The content type or None when does not know. +

+ The content_type_from_mime_type() function tries + to find a content type based on the mime type name. +

gio.content_type_get_description

    def content_type_get_description(type)

type :

a content type string. +

Returns :

a short description of the content type type. +

+ The content_type_get_description() function + gets the human readable description of the content type. +

gio.content_type_get_icon

    def content_type_get_icon(type)

type :

a content type string. +

Returns :

A gio.Icon + corresponding to the content type. +

+ The content_type_get_icon() function + gets the icon for a content type. +

gio.content_type_get_mime_type

    def content_type_get_mime_type(type)

type :

a content type string. +

Returns :

the registered mime-type for the given type, + or None if unknown. +

+ The content_type_get_mime_type() function + gets the mime-type for the content type. If one is registered +

gio.content_type_guess

    def content_type_guess(filename, data, want_uncertain)

filename :

a string, or None. +

data :

a stream of data, or None. +

want_uncertain :

a flag indicating the certainty of the result. +

Returns :

a string indicating a guessed content type for the given data. +

+ The content_type_guess() function guesses + the content type based on example data. If the function is uncertain, + result_uncertain will be set to True. Either filename + or data may be None, in which case the guess will be + based solely on the other argument. +

gio.content_type_is_a

    def content_type_is_a(type, supertype)

type :

a content type string. +

supertype :

a string. +

Returns :

True if type is a kind of + supertype, False otherwise. +

+ The content_type_is_a() function determines + if type is a subset of supertype. +

gio.content_type_is_unknown

    def content_type_is_unknown(type)

type :

a content type string. +

Returns :

True if the type is the unknown type. +

+ The content_type_is_unknown() function checks if + the content type is the generic "unknown" type. On unix this is the + "application/octet-stream" mimetype, while on win32 it is "*". +

gio.content_types_get_registered

    def content_types_get_registered()

Returns :

a list of the registered content types. +

+ The content_types_get_registered() function + gets a list of strings containing all the registered content types + known to the system. +

gio.io_error_from_errno

    def io_error_from_errno(err_no)

err_no :

Error number. +

Returns :

a + Gio Error Constants +

+ The io_error_from_errno() function converts + error codes into GIO error codes. +

diff --git a/docs/html/giounix-class-reference.html b/docs/html/giounix-class-reference.html new file mode 100644 index 0000000..9a1b532 --- /dev/null +++ b/docs/html/giounix-class-reference.html @@ -0,0 +1 @@ +PyGio Unix Class Reference

PyGio Unix Class Reference

Table of Contents

gio.unix.InputStream — Streaming input operations for UNIX file descriptors.
gio.unix.OutputStream — Streaming output operations for UNIX file descriptors.
diff --git a/docs/html/glib-class-reference.html b/docs/html/glib-class-reference.html new file mode 100644 index 0000000..13ca630 --- /dev/null +++ b/docs/html/glib-class-reference.html @@ -0,0 +1,3 @@ +PyGlibClass Reference

PyGlibClass Reference

Table of Contents

glib.MainContext — an object representing a set of event sources to be handled +in a glib.MainLoop.
glib.MainLoop — an object representing the main event loop of a PyGTK + application.
glib Functions — miscellaneous functions
glib Constants — the built-in constants of the glib module
diff --git a/docs/html/glib-constants.html b/docs/html/glib-constants.html new file mode 100644 index 0000000..fd86c99 --- /dev/null +++ b/docs/html/glib-constants.html @@ -0,0 +1,40 @@ +glib Constants

glib Constants

glib Constants — the built-in constants of the glib module

Description

Glib IO Condition Constants

The IO Condition constants are a set of bit-flags that specify a +condition to watch for on an event source.

glib.IO_IN

There is data to read

glib.IO_OUT

Data can be written (without blocking).

glib.IO_PRI

There is urgent data to read.

glib.IO_ERR

Error condition.

glib.IO_HUP

Hung up (the connection has been broken, usually for + pipes and sockets).

glib.IO_NVAL

Invalid request. The file descriptor is not + open.

Glib Priority Constants

The Priority constants specify

glib.PRIORITY_HIGH

Use this for high priority event sources.

glib.PRIORITY_DEFAULT

Use this for default priority event sources. This + priority is used when adding timeout functions with the glib.timeout_add() + function. This priority is also used for events from the X + server.

glib.PRIORITY_HIGH_IDLE

Use this for high priority idle functions. For example, + glib.PRIORITY_HIGH_IDLE + 10 is used for resizing operations; + and, glib.PRIORITY_HIGH_IDLE + 20, for redrawing + operations. (This is done to ensure that any pending resizes are + processed before any pending redraws, so that widgets are not + redrawn twice unnecessarily.)

glib.PRIORITY_DEFAULT_IDLE

Use this for default priority idle functions. This + priority is used when adding idle functions with the glib.idle_add() + function.

glib.PRIORITY_LOW

Use this for very low priority background + tasks.

Glib Spawn Flag Constants

The Spawn Flag constants are a set of bit-flags that can be +passed to the glib.spawn_async() +function.

glib.SPAWN_LEAVE_DESCRIPTORS_OPEN

the parent's open file descriptors will be inherited by +the child; otherwise all descriptors except stdin/stdout/stderr will be +closed before calling exec() in the child.

glib.SPAWN_DO_NOT_REAP_CHILD

the child will not be automatically reaped; you must +call waitpid() or handle SIGCHLD +yourself, or the child will become a zombie.

glib.SPAWN_SEARCH_PATH

argv[0] need not be an absolute +path, it will be looked for in the user's PATH.

glib.SPAWN_STDOUT_TO_DEV_NULL

the child's standard output will be discarded, instead +of going to the same location as the parent's standard output.

glib.SPAWN_STDERR_TO_DEV_NULL

the child's standard error will be discarded.

glib.SPAWN_CHILD_INHERITS_STDIN

the child will inherit the parent's standard input (by +default, the child's standard input is attached to /dev/null).

glib.SPAWN_FILE_AND_ARGV_ZERO

the first element of argv is the +file to execute, while the remaining elements are the actual argument vector +to pass to the file. Normally glib.spawn_async() +uses argv[0] as the file to execute, and passes all +of argv to the child.

Glib User Directory Constants

The User Directory constants are integer values that are currently used only as arguments to + glib.get_user_special_dir() + function. See function documentation for details.

glib.USER_DIRECTORY_DESKTOP

the user's Desktop directory

glib.USER_DIRECTORY_DOCUMENTS

the user's Documents directory

glib.USER_DIRECTORY_DOWNLOAD

the user's Downloads directory

glib.USER_DIRECTORY_MUSIC

the user's Music directory

glib.USER_DIRECTORY_PICTURES

the user's Pictures directory

glib.USER_DIRECTORY_PUBLIC_SHARE

the user's shared directory

glib.USER_DIRECTORY_TEMPLATES

the user's Templates directory

glib.USER_DIRECTORY_VIDEOS

the user's Movies directory

Glib Version Constants

The Version constants specify the version of +Glib used by PyGObject as a 3-tuple containing the major, +minor and patch release numbers.

glib.glib_version

A 3-tuple containing (major, minor, patch) release + numbers of glib.

glib.pyglib_version

A 3-tuple containing (major, minor, patch) release + numbers of the python bindings.
diff --git a/docs/html/glib-functions.html b/docs/html/glib-functions.html new file mode 100644 index 0000000..b1f8138 --- /dev/null +++ b/docs/html/glib-functions.html @@ -0,0 +1,280 @@ +glib Functions

glib Functions

glib Functions — miscellaneous functions

Synopsis

+    def glib.idle_add(callback, ...)
def glib.timeout_add(interval, callback, ...)
def glib.timeout_add_seconds(interval, callback, ...)
def glib.io_add_watch(fd, condition, callback, ...)
def glib.source_remove(tag)
def glib.main_context_default()
def glib.markup_escape_text(text)
def glib.child_watch_add(pid, function, data=None, priority=glib.PRIORITY_DEFAULT)
def glib.spawn_async(argv, envp=None, working_directory=None, flags=0, child_setup=None, user_data=None, standard_input=None, standard_output=None, standard_error=None)
def glib.get_current_time()
def glib.get_user_cache_dir()
def glib.get_user_config_dir()
def glib.get_user_data_dir()
def glib.get_user_special_dir(directory)
def glib.main_depth()
def glib.threads_init()
def glib.filename_display_name(filename)
def glib.filename_display_basename(filename)
def glib.filename_from_utf8(utf8string)

Description

These functions are part of the PyGObject glib +module but are not directly associated with a specific class.

Functions

glib.idle_add

    def glib.idle_add(callback, ...)

callback :

a function to call when +PyGTK is idle

... :

optionals arguments to be passed to +callback

Returns :

an integer ID

The glib.idle_add() function adds a +function (specified by callback) to be called +whenever there are no higher priority events pending to the default main +loop. The function is given the default idle priority, +glib.PRIORITY_DEFAULT_IDLE. Additional arguments to +pass to callback can be specified after +callback. The idle priority can be specified as a +keyword-value pair with the keyword "priority". If +callback returns FALSE it is +automatically removed from the list of event sources and will not be called +again.

glib.timeout_add

    def glib.timeout_add(interval, callback, ...)

interval :

the time between calls to the function, in +milliseconds

callback :

the function to call

... :

zero or more arguments that will be passed to +callback

Returns :

an integer ID of the event +source

The glib.timeout_add() function sets a +function (specified by callback) to be called at +regular intervals (specified by interval, with the +default priority, glib.PRIORITY_DEFAULT. Additional +arguments to pass to callback can be specified after +callback. The idle priority may be specified as a +keyword-value pair with the keyword "priority".

The function is called repeatedly until it returns +FALSE, at which point the timeout is automatically +destroyed and the function will not be called again. The first call to the +function will be at the end of the first interval. Note that timeout +functions may be delayed, due to the processing of other event sources. Thus +they should not be relied on for precise timing. After each call to the +timeout function, the time of the next timeout is recalculated based on the +current time and the given interval (it does not try to 'catch up' time lost +in delays).

glib.timeout_add_seconds

    def glib.timeout_add_seconds(interval, callback, ...)

interval :

the time between calls to the function, in +seconds

callback :

the function to call

... :

zero or more arguments that will be passed to +callback

Returns :

an integer ID of the event +source

The glib.timeout_add_seconds() is similar to + glib.timeout_add() except + that interval must be specified in seconds, not + milliseconds, and the function should cause less CPU wakeups, which is important + for laptops' batteries.

Unlike glib.timeout_add(), this function operates at + whole second granularity. The initial starting point of the timer is determined + by the implementation and the implementation is expected to group multiple timers + together so that they fire all at the same time. To allow this grouping, the + interval to the first timer is rounded and can deviate up to one second from the + specified interval. Subsequent timer iterations will generally run at the + specified interval.

Note that timeout functions may be delayed, due to the processing of other + event sources. Thus they should not be relied on for precise timing. After each + call to the timeout function, the time of the next timeout is recalculated based + on the current time and the given interval.

The grouping of timers to fire at the same time results in a more power and + CPU efficient behavior so if your timer is in multiples of seconds and you don't + require the first timer exactly one second from now, the use of + glib.timeout_add_seconds() is preferred + over glib.timeout_add().

glib.io_add_watch

    def glib.io_add_watch(fd, condition, callback, ...)

fd :

a Python file object or an integer file +descriptor ID

condition :

a condition mask

callback :

a function to call

... :

additional arguments to pass to +callback

Returns :

an integer ID of the event source

The glib.io_add_watch() function +arranges for the file (specified by fd) to be +monitored by the main loop for the specified +condition. fd may be a Python +file object or an integer file descriptor. The value of condition is a +combination of:

glib.IO_IN

There is data to read.

glib.IO_OUT

Data can be written (without blocking).

glib.IO_PRI

There is urgent data to read.

glib.IO_ERR

Error condition.

glib.IO_HUP

Hung up (the connection has been broken, usually for +pipes and sockets).

Additional arguments to pass to callback +can be specified after callback. The idle priority +may be specified as a keyword-value pair with the keyword "priority". The +signature of the callback function is:

+  def callback(source, cb_condition, ...)
+

where source is +fd, the file descriptor; +cb_condition is the condition that triggered the +signal; and, ... are the zero or more arguments that +were passed to the glib.io_add_watch() +function.

If the callback function returns FALSE it +will be automatically removed from the list of event sources and will not be +called again. If it returns TRUE it will be called again +when the condition is matched.

glib.source_remove

    def glib.source_remove(tag)

tag :

an integer ID

Returns :

TRUE if the event source was +removed

The glib.source_remove() function +removes the event source specified by tag (as returned by the glib.idle_add(), +glib.timeout_add() +and glib.io_add_watch() +functions)

glib.main_context_default

    def glib.main_context_default()

Returns :

the default glib.MainContext +object

The glib.main_context_default() function +returns the default glib.MainContext object.

glib.markup_escape_text

    def glib.markup_escape_text(text)

text :

the UTF-8 string to be +escaped

Returns :

the escaped text

Note

This function is available in PyGTK 2.8 and above.

The glib.markup_escape_text() function +escapes the string specified by text so that the +markup parser will parse it verbatim. Less than, greater than, ampersand, +etc. are replaced with the corresponding entities. This function would +typically be used when writing out a file to be parsed with the markup +parser.

Note that this function doesn't protect whitespace and line +endings from being processed according to the XML rules for normalization of +line endings and attribute values.

glib.child_watch_add

    def glib.child_watch_add(pid, function, data=None, priority=glib.PRIORITY_DEFAULT)

pid :

process id of a child process to watch

function :

the function to call

data :

the optional data to pass to +function

priority :

the priority of the idle source - one of the +Glib Priority Constants

Returns :

the id of event source.

Note

This function is available in PyGTK 2.6 and above.

The glib.child_watch_add() function sets +the function specified by function to be called with +the user data specified by data when the child +indicated by pid exits. The signature for the +callback is:

+def callback(pid, condition, user_data)
+

where pid is is the child process id, +condition is the status information about the child +process and user_data is data +PyGTK supports only a single callback per process id.

glib.spawn_async

    def glib.spawn_async(argv, envp=None, working_directory=None, flags=0, child_setup=None, user_data=None, standard_input=None, standard_output=None, standard_error=None)

argv :

a sequence of strings containing the arguments +of the child process

envp :

the child's environment or +None to inherit the parent's +environment.

working_directory :

the child's current working directory, or +None to inherit parent's

flags :

flags from the Glib Spawn Flag Constants.

child_setup :

a function to run in the child just before +calling exec()

user_data :

the user data for the +child_setup function

standard_input :

if TRUE return the file +descriptor for the child's stdin

standard_output :

if TRUE return the file +descriptor for the child's stdout

standard_error :

if TRUE return the file +descriptor for the child's stderr

Returns :

a 4-tuple containing the child's process id and +the stdin, stdout and stderr file descriptor integers.

Note

This function is available in PyGTK 2.6 and above.

The glib.spawn_async() function executes +a child program asynchronously (your program will not block waiting for the +child to exit). The child program is specified by the only argument that +must be provided, argv. argv +should be a sequence of strings, to be passed as the argument vector for the +child. The first string in argv is of course the name +of the program to execute. By default, the name of the program must be a +full path; the PATH shell variable will only be searched if +you pass the glib.SPAWN_SEARCH_PATH flag in +flags. The function returns a 4-tuple containing the +child's process id and the file descriptors for the child's stdin, stdout +and stderr. The stdin, stdout and stderr file descriptors are returned only +ofthe corresponding standard_input, +standard_output or +standard_error params are +TRUE.

On Windows, the low-level child process creation API +(CreateProcess()) doesn't use argument vectors, but a +command line. The C runtime library's spawn*() family +of functions (which glib.spawn_async() +eventually calls) paste the argument vector elements into a command line, +and the C runtime startup code does a corresponding reconstruction of an +argument vector from the command line, to be passed to +main(). Complications arise when you have argument +vector elements that contain spaces of double quotes. The +spawn*() functions don't do any quoting or escaping, +but on the other hand the startup code does do unquoting and unescaping in +order to enable receiving arguments with embedded spaces or double +quotes. To work around this asymmetry, the glib.spawn_async() +function will do quoting and escaping on argument vector elements that need +it before calling the C runtime spawn() +function.

envp is a sequence of strings, where each + string has the form KEY=VALUE. This will become the + child's environment. If envp is + None or not specified, the child inherits its + parent's environment.

flags should be the bitwise +OR of the Glib Spawn Flag Constants you want to affect the +function's behaviour. The glib.SPAWN_DO_NOT_REAP_CHILD +flag means that the child will not automatically be reaped; you must use a +GChildWatch source to be notified about the death of the child +process. Eventually you must call g_spawn_close_pid() on the child_pid, in +order to free resources which may be associated with the child process. (On +Unix, using a GChildWatch source is equivalent to calling +waitpid() or handling the SIGCHLD +signal manually. On Windows, calling g_spawn_close_pid() is equivalent to +calling CloseHandle() on the process handle +returned).

glib.SPAWN_LEAVE_DESCRIPTORS_OPEN means +that the parent's open file descriptors will be inherited by the child; +otherwise all descriptors except stdin/stdout/stderr will be closed before +calling exec() in the +child. glib.SPAWN_SEARCH_PATH means that +argv[0] need not be an absolute path, it will be +looked for in the user's +PATH. glib.SPAWN_STDOUT_TO_DEV_NULL +means that the child's standard output will be discarded, instead of going +to the same location as the parent's standard output. If you use this flag, +standard_output must be +None. glib.SPAWN_STDERR_TO_DEV_NULL +means that the child's standard error will be discarded, instead of going to +the same location as the parent's standard error. If you use this flag, +standard_error must be +None. glib.SPAWN_CHILD_INHERITS_STDIN +means that the child will inherit the parent's standard input (by default, +the child's standard input is attached to +/dev/null). If you use this flag, +standard_input must be +None. glib.SPAWN_FILE_AND_ARGV_ZERO +means that the first element of argv is the file to +execute, while the remaining elements are the actual argument vector to pass +to the file. Normally the glib.spawn_async() +function uses argv[0] as the file to execute, and +passes all of argv to the child.

child_setup and +user_data are a function and user data. On POSIX +platforms, the function is called in the child after GLib has performed all +the setup it plans to perform (including creating pipes, closing file +descriptors, etc.) but before calling exec(). That is, +child_setup is called just before calling +exec() in the child. Obviously actions taken in this +function will only affect the child, not the parent. On Windows, there is no +separate fork() and exec() +functionality. Child processes are created and run right away with one API +call, +CreateProcess(). child_setup is +called in the parent process just before creating the child process. You +should carefully consider what you do in child_setup +if you intend your software to be portable to Windows.

The returned child process id can be used to send signals to the +child, or to wait for the child if you specified the +glib.SPAWN_DO_NOT_REAP_CHILD flag. On Windows, child +pid will be returned only if you specified the +glib.SPAWN_DO_NOT_REAP_CHILD flag.

The caller of the glib.spawn_async() +must close any returned file descriptors when they are no longer in +use.

If standard_input is +None, the child's standard input is attached to +/dev/null unless +glib.SPAWN_CHILD_INHERITS_STDIN is set.

If standard_error is +None, the child's standard error goes to the same +location as the parent's standard error unless +glib.SPAWN_STDERR_TO_DEV_NULL is set.

If standard_output is +None, the child's standard output goes to the same +location as the parent's standard output unless +glib.SPAWN_STDOUT_TO_DEV_NULL is set.

If an error occurs, the glib.GError exception will be +raised.

glib.get_current_time

    def glib.get_current_time()

Returns :

the current time as the number of seconds and +microseconds from the epoch.

Note

This function is available in PyGTK 2.8 and above.

The glib.get_current_time() function +reurns the current time of day as the number of seconds and microseconds +from the epoch.

glib.get_user_cache_dir

    def glib.get_user_cache_dir()

Returns :

+ a strings with a path to user's cache directory. +

Note

This function is available in PyGObject 2.18 and above.

Returns a base directory in which to store non-essential, + cached data specific to particular user.

On UNIX platforms this is determined using the mechanisms + described in the + XDG + Base Directory Specification.

glib.get_user_config_dir

    def glib.get_user_config_dir()

Returns :

+ a strings with a path to user's configuration directory. +

Note

This function is available in PyGObject 2.18 and above.

Returns a base directory in which to store user-specific + application configuration information such as user preferences + and settings.

On UNIX platforms this is determined using the mechanisms + described in the + XDG + Base Directory Specification.

glib.get_user_data_dir

    def glib.get_user_data_dir()

Returns :

+ a strings with a path to user's data directory. +

Note

This function is available in PyGObject 2.18 and above.

Returns a base directory in which to access application + data such as icons that is customized for a particular + user

On UNIX platforms this is determined using the mechanisms + described in the + XDG + Base Directory Specification.

glib.get_user_special_dir

    def glib.get_user_special_dir(directory)

directory :

+ the logical id of special directory, + see User + Directory constants for the list of supported + values +

Returns :

+ a strings with a path to the requested directory. +

Note

This function is available in PyGObject 2.18 and above.

Returns the full path of a special directory using its + logical id.

On Unix this is done using the XDG special user + directories. For compatibility with existing practise, + glib.USER_DIRECTORY_DESKTOP + falls back to $HOME/Desktop when XDG + special user directories have not been set up.

Depending on the platform, the user might be able to + change the path of the special directory without requiring the + session to restart; GLib will not reflect any change once the + special directories are loaded.

glib.main_depth

    def glib.main_depth()

Returns :

the depth of the stack of calls to the main +context.

Note

This function is available in PyGTK 2.8 and above.

The main_depth() function returns the depth +of the stack of calls in the main context. That is, when called from the +toplevel, it gives 0. When called from within a callback from the glib.MainContext.iteration() +method (or the glib.MainLoop.run() +method, etc.) it returns 1. When called from within a callback to a +recursive call to the glib.MainContext.iteration() +method), it returns 2. And so forth.

glib.threads_init

    def glib.threads_init()

Returns :

Note

This function is available in PyGTK 2.4 and above.

The threads_init() function initializes the + the use of Python threading in the glib module. This function is + different than the gtk.gdk.threads_init() + function as that function also initializes the gdk threads.

glib.signal_accumulator_true_handled

    def glib.signal_accumulator_true_handled()

Note

This function is available in PyGTK 2.8 and above.

The signal_accumulator_true_handled() + function is only used as accumulator argument when registering + signals.

glib.filename_display_name

    def glib.filename_display_name(filename)

filename :

a pathname in the file name + encoding

Returns :

an UTF8 rendition of + filename.

Note

This function is available in PyGTK 2.10 and above.

The filename_display_name() function + converts a filename into a valid UTF-8 string. The conversion is not + necessarily reversible, so you should keep the original around and use + the return value of this function only for display purposes. Unlike + g_filename_to_utf8(), the result is guaranteed to be non-None even if + the filename actually isn't in the file name encoding.

If you know the whole pathname of the file you should use the + glib.filename_display_basename() + function, since that allows location-based translation of + filenames.

glib.filename_display_basename

    def glib.filename_display_basename(filename)

filename :

an absolute pathname in the file name + encoding

Returns :

an UTF8 rendition of + filename.

Note

This function is available in PyGTK 2.10 and above.

The filename_display_basename() function + returns the display basename for the particular filename, guaranteed + to be valid UTF-8. The display name might not be identical to the + filename, for instance there might be problems converting it to UTF-8, + and some files can be translated in the display.

You must pass the whole absolute pathname to this functions so + that translation of well known locations can be done.

This function is preferred over the glib.filename_display_name() + function if you know the whole path, as it allows translation.

glib.filename_from_utf8

    def glib.filename_from_utf8(utf8string)

utf8string :

a UTF-8 encoded string.

Returns :

a filename encoded in the GLib filename + encoding.

Note

This function is available in PyGTK 2.10 and above.

The filename_from_utf8() function converts + a string from UTF-8 to the encoding GLib uses for filenames. Note that + on Windows GLib uses UTF-8 for filenames.

diff --git a/docs/html/gobject-class-reference.html b/docs/html/gobject-class-reference.html new file mode 100644 index 0000000..bbf2133 --- /dev/null +++ b/docs/html/gobject-class-reference.html @@ -0,0 +1,2 @@ +PyGObject Class Reference

PyGObject Class Reference

Table of Contents

gobject.GObject — the base class
gobject.GBoxed — an object containing an opaque chunk of data
gobject.GPointer — an object containing a completely opaque chunk of + data
gobject.GInterface — an object representing a GInterface
gobject Functions — miscellaneous functions
gobject Constants — the built-in constants of the gobject module
diff --git a/docs/html/gobject-constants.html b/docs/html/gobject-constants.html new file mode 100644 index 0000000..969e25f --- /dev/null +++ b/docs/html/gobject-constants.html @@ -0,0 +1,63 @@ +gobject Constants

gobject Constants

gobject Constants — the built-in constants of the gobject module

Description

GObject Param Flag Constants

The Param Flag constants are a set of bit-flags that specify +certain aspects of parameters that can be configured.

gobject.PARAM_READABLE

The parameter is readable

gobject.PARAM_WRITABLE

The parameter is writable

gobject.PARAM_CONSTRUCT

The parameter will be set upon object + construction

gobject.PARAM_CONSTRUCT_ONLY

The parameter will only be set upon object + construction

gobject.PARAM_LAX_VALIDATION

Upon parameter conversion strict validation is not + required

GObject Signal Flag Constants

The Signal Flag constants are a set of bit-flags that specify a +signal's behavior. The overall signal description outlines how especially +the RUN flags control the stages of a signal +emission.

gobject.SIGNAL_RUN_FIRST

Invoke the object method handler in the first emission + stage.

gobject.SIGNAL_RUN_LAST

Invoke the object method handler in the third emission + stage.

gobject.SIGNAL_RUN_CLEANUP

Invoke the object method handler in the last emission + stage.

gobject.SIGNAL_NO_RECURSE

Signals being emitted for an object while currently + being in emission for this very object will not be emitted + recursively, but instead cause the first emission to be + restarted.

gobject.SIGNAL_DETAILED

This signal supports "::detail" appendices to the + signal name upon handler connections and emissions.

gobject.SIGNAL_ACTION

Action signals are signals that may freely be emitted + on alive objects from user code via the gobject.emit() + method and friends, without the need of being embedded into + extra code that performs pre or post emission adjustments on the + object. They can also be thought of as object methods which can + be called generically by third-party code.

gobject.SIGNAL_NO_HOOKS

No emissions hooks are supported for this + signal.

GObject Spawn Flag Constants

The Spawn Flag constants are a set of bit-flags that can be +passed to the gobject.spawn_async() +function.

gobject.SPAWN_LEAVE_DESCRIPTORS_OPEN

the parent's open file descriptors will be inherited by +the child; otherwise all descriptors except stdin/stdout/stderr will be +closed before calling exec() in the child.

gobject.SPAWN_DO_NOT_REAP_CHILD

the child will not be automatically reaped; you must +call waitpid() or handle SIGCHLD +yourself, or the child will become a zombie.

gobject.SPAWN_SEARCH_PATH

argv[0] need not be an absolute +path, it will be looked for in the user's PATH.

gobject.SPAWN_STDOUT_TO_DEV_NULL

the child's standard output will be discarded, instead +of going to the same location as the parent's standard output.

gobject.SPAWN_STDERR_TO_DEV_NULL

the child's standard error will be discarded.

gobject.SPAWN_CHILD_INHERITS_STDIN

the child will inherit the parent's standard input (by +default, the child's standard input is attached to /dev/null).

gobject.SPAWN_FILE_AND_ARGV_ZERO

the first element of argv is the +file to execute, while the remaining elements are the actual argument vector +to pass to the file. Normally gobject.spawn_async() +uses argv[0] as the file to execute, and passes all +of argv to the child.

GObject Built-in Type Constants

The Built-in Type constants specify the pre-defined types used +by gobject.

gobject.TYPE_INVALID

An invalid type, used as error return value in some + functions.

gobject.TYPE_NONE

A fundamental type indicating no type.

gobject.TYPE_INTERFACE

The fundamental type from which all interfaces are + derived.

gobject.TYPE_CHAR

The fundamental type corresponding to a + character. This maps to a string in Python.

gobject.TYPE_UCHAR

The fundamental type corresponding to an unsigned + character. This maps to a string in Python.

gobject.TYPE_BOOLEAN

The fundamental type corresponding to a True or False + value. This maps to an integer in Python.

gobject.TYPE_INT

The fundamental type corresponding to an + integer. This maps to an integer in Python.

gobject.TYPE_UINT

he fundamental type corresponding to an unsigned + integer. This maps to an integer in Python.

gobject.TYPE_LONG

The fundamental type corresponding to a long + integer. This maps to an integer in Python.

gobject.TYPE_ULONG

The fundamental type corresponding to an unsigned + integer. This maps to an integer in Python.

gobject.TYPE_INT64

The fundamental type corresponding to an long long + integer. This maps to a long integer in Python.

gobject.TYPE_UINT64

The fundamental type corresponding to an unsigned long + long integer. This maps to a long integer in Python.

gobject.TYPE_ENUM

The fundamental type corresponding to an enumeration + type. This maps to an integer in Python.

gobject.TYPE_FLAGS

The fundamental type corresponding to a flag + type. This maps to an integer in Python.

gobject.TYPE_FLOAT

The fundamental type corresponding to a floating point + number. This maps to a float in Python.

gobject.TYPE_DOUBLE

The fundamental type corresponding to a double + floating point number. This maps to a float in Python.

gobject.TYPE_STRING

The fundamental type corresponding to a string.

gobject.TYPE_POINTER

The fundamental type corresponding to a pointer to an + anonymous type. This has no corresponding Python type.

gobject.TYPE_BOXED

The fundamental type corresponding to a boxed object + type.

gobject.TYPE_PARAM

The fundamental type corresponding to a GParamSpec + type.

gobject.TYPE_OBJECT

The fundamental type corresponding to a GObject + type.

gobject.TYPE_PYOBJECT

The fundamental type corresponding to a Python Object + type.

GObject Version Constants

The Version constants specify the version of +GLIB used by PyGTK as a 3-tuple containing the major, +minor and patch release numbers.

gobject.glib_version

A 3-tuple containing (major, minor, patch) release + numbers.
diff --git a/docs/html/gobject-functions.html b/docs/html/gobject-functions.html new file mode 100644 index 0000000..1f76f55 --- /dev/null +++ b/docs/html/gobject-functions.html @@ -0,0 +1,134 @@ +gobject Functions

gobject Functions

gobject Functions — miscellaneous functions

Synopsis

+    def gobject.type_name(type)
def gobject.type_from_name(type_name)
def gobject.type_parent(type)
def gobject.type_is_a(type, parent_type)
def gobject.type_children(type)
def gobject.type_interfaces(type)
def gobject.type_register(class)
def gobject.signal_new(signal_name, type, flags, return_type, param_types)
def gobject.signal_list_names(type)
def gobject.signal_list_ids(type)
def gobject.signal_lookup(name, type)
def gobject.signal_name(signal_id)
def gobject.signal_query(name, type)
def gobject.signal_query(signal_id)
def gobject.list_properties(type)
def gobject.new(type, ...)
def gobject.signal_accumulator_true_handled()
def gobject.add_emission_hook(type, name, callback, ...)
def gobject.remove_emission_hook(type, name, hook_id)
def gobject._install_metaclass(metaclass) +

Description

These functions are part of the PyGTK gobject +module but are not directly associated with a specific class.

Note

+ Many functions that previously were in this namespace got moved to glib namespace instead. They + are still available in gobject for backward compatibility, but + not documented here. If you miss documentation for some function, be sure to + check glib first. +

Functions

gobject.type_name

    def gobject.type_name(type)

type :

a GObject type, type ID or +instance

Returns :

The gobject.type_name() function returns +the unique name that is assigned to the specified +type. type can be a GObject +type, type ID or instance. This function raises a TypeError exception +if type isn't a PyGTK type.

gobject.type_from_name

    def gobject.type_from_name(type_name)

type_name :

a string containing the name of a +type

Returns :

the type ID named +type_name

The gobject.type_from_name() function +returns the type ID of the PyGTK type with the name +specified by type_name. This function raises a +RuntimeError exception if no type matches +type_name.

gobject.type_parent

    def gobject.type_parent(type)

type :

a GObject type, type ID or +instance

Returns :

the parent type ID

The gobject.type_parent() function returns +the direct parent type ID of the specified type. +type can be a GObject type, type ID or instance. If +type has no parent, i.e. is a fundamental type, the +RuntimeError exception is raised.

gobject.type_is_a

    def gobject.type_is_a(type, parent_type)

type :

a GObject type, type ID or +instance

parent_type :

a GObject type, type ID or +instance

Returns :

TRUE if +parent_type is an ancestor of +type

The gobject.type_is_a() function returns +TRUE if the specified type is a +descendant of the type specified by parent_type. This +function also returns TRUE if +parent_type is an interface and +type conforms to it.

gobject.type_children

    def gobject.type_children(type)

type :

a GObject type, type ID or +instance

Returns :

a list of the child types of +type

The gobject.type_children() function +returns a list containing the child types of the specified +type.

gobject.type_interfaces

    def gobject.type_interfaces(type)

type :

a GObject type, type ID or +instance

Returns :

a list of the interface types supported by +type

The gobject.type_interfaces() function +returns a list of the interface types supported by +type. type can be a GObject +type, type ID or instance. This function returns a RuntimeError exception if +type is not a valid type or has no interfaces.

gobject.type_register

    def gobject.type_register(class)

class :

a Python class that is a descendant of gobject.GObject

The gobject.type_register() function +registers the specified Python class as a PyGTK type. +class must be a descendant of gobject.GObject. The function generates a name for the new type.

gobject.signal_new

    def gobject.signal_new(signal_name, type, flags, return_type, param_types)

signal_name :

a string containing the name of the +signal

type :

the object type that the signal is associated +with

flags :

the signal flags

return_type :

the return type of the signal +handler

param_types :

the parameter types passed to the signal +handler

Returns :

a unique integer signal ID

The gobject.signal_new() function registers +a signal with the specified signal_name for the +specified object type. The value of +flags is a combination of:

gobject.SIGNAL_RUN_FIRST

Invoke the object method handler in the first emission +stage.

gobject.SIGNAL_RUN_LAST

Invoke the object method handler in the third emission +stage.

gobject.SIGNAL_RUN_CLEANUP

Invoke the object method handler in the last emission +stage.

gobject.SIGNAL_NO_RECURSE

Signals being emitted for an object while currently +being in emission for this very object will not be emitted recursively, but +instead cause the first emission to be restarted.

gobject.SIGNAL_DETAILED

This signal supports "::detail" appendixes to the +signal name upon handler connections and emissions.

gobject.SIGNAL_ACTION

Action signals are signals that may freely be emitted +on alive objects from user code via gobject.emit()() +and friends, without the need of being embedded into extra code that +performs pre or post emission adjustments on the object. They can also be +thought of as generically callable object methods.

gobject.SIGNAL_NO_HOOKS

No emissions hooks are supported for this +signal.

return_type is the type of the return +value from a signal handler and may be a gobject type, type ID or instance. +The param_types parameter is a list of additional +types that are passed to the signal handler. Each parameter type may be +specified as a gobject type, type ID or instance. For example, to add a +signal to the gtk.Window type called "my-signal" that calls a handler with a +gtk.Button widget and an integer value and a return value that is a +boolean, use:

+  gobject.signal_new("my_signal", gtk.Window, gobject.SIGNAL_RUN_LAST, gobject.TYPE_BOOLEAN, (gtk.Button, gobject.TYPE_INT))
+

gobject.signal_list_names

    def gobject.signal_list_names(type)

type :

a GObject type, type ID or +instance

Returns :

a list of the signal names supported by +type

The gobject.signal_list_names() function +returns a list of the names of the signals that are supported by the +specified GObject type

Note

The type keyword is available in PyGTK 2.6 and above.

gobject.signal_list_ids

    def gobject.signal_list_ids(type)

type :

a GObject type, type ID or +instance

Returns :

a list of the signal ids supported by +type

Note

This method is available in PyGTK 2.6 and above.

The gobject.signal_list_ids() function +returns a list of the integer ids of the signals that are supported by the +GObject specified by type

gobject.signal_lookup

    def gobject.signal_lookup(name, type)

name :

the name of a signal for +type

type :

a GObject type, type ID or +instance

Returns :

the integer id of a signal supported by +type or 0.

Note

This method is available in PyGTK 2.6 and above.

The gobject.signal_lookup() function +returns the id of the signal with the name specified by +name that is supported by the GObject specified +specified bytype. 0 is returned if the signal is not +found.

gobject.signal_name

    def gobject.signal_name(signal_id)

signal_id :

an integer signal id

Returns :

the name of the signal or +None.

Note

This method is available in PyGTK 2.6 and above.

The gobject.signal_name() function returns +the name of the signal that has the signal id specified by +id.

gobject.signal_query

    def gobject.signal_query(name, type)

name :

the name of a signal for +type

type :

a GObject type, type ID or +instance

Returns :

a 6-tuple containing signal information or +None

Note

This method is available in PyGTK 2.6 and above.

The gobject.signal_query() function returns +a 6-tuple containing information about the signal with the name specified by +name that is supported by the GObject specified by +type. If the signal is not found +None is returned.

The signal information 6-tuple contains:

  • the integer signal id
  • the signal name
  • the GType that the signal is registered for
  • the signal flags (see the GObject Signal Flag Constants)
  • the GType of the return from the signal callback +function
  • a tuple containing the GTypes of the parameters that are +passed to the signal callback function. Note that these may not correspond +exactly to the PyGTK signal callback parameters.

gobject.signal_query

    def gobject.signal_query(signal_id)

signal_id :

the integer id of a signal

Returns :

a 6-tuple containing signal information or +None

Note

This method is available in PyGTK 2.6 and above.

The gobject.signal_query() function returns +a 6-tuple containing information about the signal with the id specified by +signal_id. If the signal is not found +None is returned.

The signal information 6-tuple contains:

  • the integer signal id
  • the signal name
  • the GType that the signal is registered for
  • the signal flags (see the GObject Signal Flag Constants)
  • the GType of the return from the signal callback +function
  • a tuple containing the GTypes of the parameters that are +passed to the signal callback function. Note that these may not correspond +exactly to the PyGTK signal callback parameters.

gobject.list_properties

    def gobject.list_properties(type)

type :

a GObject type, type ID or +instance

Returns :

a list of the properties (as GParam objects) +supported by type

The gobject.list_properties() function +returns a list of the properties (as GParam objects) supported by +type.

gobject.new

    def gobject.new(type, ...)

type :

a GObject type, type ID or +instance

... :

zero or more property-value +pairs

Returns :

a new object if the specified +type

The gobject.new() function returns a new +object of the specified type. type must specify a +type that is a descendant of gobject.GObject. A +TypeError exception is raised if type specifies an +abstract class or a type that is not a descendant of gobject.GObject. A set +of property-value pairs may be specified to set the value of the object's +properties.

gobject.signal_accumulator_true_handled

    def gobject.signal_accumulator_true_handled()

Note

This function is available in PyGTK 2.8 and above.

The signal_accumulator_true_handled() + function is only used as accumulator argument when registering + signals.

gobject.add_emission_hook

    def gobject.add_emission_hook(type, name, callback, ...)

type :

a Python GObject instance or + type

name :

a signal name

callback :

a function

... :

zero or more extra arguments that will be + passed to callback.

Returns :

the hook id, for later use with gobject.signal_remove_emission_hook().

Note

This function is available in PyGTK 2.8 and above.

The add_emission_hook() function adds an + emission hook for the signal specified by name, + which will get called for any emission of that signal, independent of + the instance. This is possible only for signals which don't have the + gobject.SIGNAL_NO_HOOKS flag set.

gobject.remove_emission_hook

    def gobject.remove_emission_hook(type, name, hook_id)

type :

a Python GObject instance or + type

name :

a signal name

hook_id :

the id of the emission hook as returned by the + gobject.add_emission_hook()) + function.

Returns :

Note

This function is available in PyGTK 2.8 and above.

The remove_emission_hook() function deletes + an emission hook.

gobject._install_metaclass

    def gobject._install_metaclass(metaclass)

metaclass :

Note

This function is available in PyGTK 2.10 and above.

The _install_metaclass() function installs + the metaclass specified by metaclass.

diff --git a/docs/html/index.html b/docs/html/index.html new file mode 100644 index 0000000..fe8c44c --- /dev/null +++ b/docs/html/index.html @@ -0,0 +1,6 @@ +PyGObject Reference Manual

PyGObject Reference Manual

for PyGObject version 2.21.2

2010-06-10 +

Abstract

This reference describes the classes of the python gobject +module.


Table of Contents

Introduction
Reference Page Format
PyGlibClass Reference
glib.MainContext — an object representing a set of event sources to be handled +in a glib.MainLoop.
glib.MainLoop — an object representing the main event loop of a PyGTK + application.
glib Functions — miscellaneous functions
glib Constants — the built-in constants of the glib module
PyGObject Class Reference
gobject.GObject — the base class
gobject.GBoxed — an object containing an opaque chunk of data
gobject.GPointer — an object containing a completely opaque chunk of + data
gobject.GInterface — an object representing a GInterface
gobject Functions — miscellaneous functions
gobject Constants — the built-in constants of the gobject module
PyGio Class Reference
gio.AppInfo — Information about an installed application and methods to launch it (with file arguments).
gio.AppLaunchContext — Application launch context.
gio.AsyncResult — Asynchronous Function Results.
gio.BufferedInputStream — Buffered Input Stream
gio.BufferedOutputStream — Buffered Output Stream
gio.Cancellable — Thread-safe Operation Cancellation Stack.
gio.DataInputStream — Data Input Stream
gio.DataOutputStream — Data Output Stream
gio.Drive — Virtual File System drive management.
gio.Emblem — An object for emblems.
gio.EmblemedIcon — Icon with emblems.
gio.File — File and Directory Handling.
gio.FileAttributeInfo — Information about a specific attribute.
gio.FileEnumerator — Enumerated Files Routines.
gio.FileIcon — Icons pointing to an image file.
gio.FileInfo — File Information and Attributes
gio.FileInputStream — Base class for implementing streaming input
gio.FileMonitor — File Monitor
gio.FileOutputStream — Base class for implementing streaming input
gio.FilterInputStream — Filter Input Stream
gio.FilterOutputStream — Filter Output Stream
gio.Icon — Interface for icons.
gio.InputStream — Base class for implementing streaming input
gio.LoadableIcon — Interface for icons.
gio.MemoryInputStream — Base class for implementing streaming input
gio.MemoryOutputStream — Streaming output operations on memory chunks
gio.Mount — Mount management
gio.MountOperation — Authentication methods for mountable locations.
gio.OutputStream — Base class for implementing streaming input
gio.Seekable — Stream seeking interface.
gio.SimpleAsyncResult — Simple asynchronous results implementation.
gio.ThemedIcon — Icon theming support.
gio.Volume — Volume management.
gio.VolumeMonitor — Volume Monitor.
gio Functions
gio Constants — the built-in constants of the gio module
PyGio Unix Class Reference
gio.unix.InputStream — Streaming input operations for UNIX file descriptors.
gio.unix.OutputStream — Streaming output operations for UNIX file descriptors.
diff --git a/docs/html/index.sgml b/docs/html/index.sgml new file mode 100644 index 0000000..e9b5432 --- /dev/null +++ b/docs/html/index.sgml @@ -0,0 +1,532 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/html/pygobject-introduction.html b/docs/html/pygobject-introduction.html new file mode 100644 index 0000000..0f15d2f --- /dev/null +++ b/docs/html/pygobject-introduction.html @@ -0,0 +1,83 @@ +Introduction

Introduction

Table of Contents

Reference Page Format

This document describes many of the PyGObject + version 2.12 classes and their methods and associated + functions. Deprecated classes, functions and methods have been + specifically left out of this reference though classes that have become + deprecated since PyGObject 2.0 have been left in but annotated with a + deprecation warning. This document attempts to document as much of the + PyGObject API as possible but there + are undoubtedly errors and omissions. If you discover any of these please + file a bug report at bugzilla.gnome.org for the + pygobject project. Specific areas that have not been + documented include:

  • The GParamSpec class

This reference describes the API for PyGObject as + of version 2.11.0+ and assumes that the additional API changes for version + 2.12 will not be significant. There will undoubtedly be changes that are + not reflected in this reference. The differences in the API between + version 2.0 and previous versions are denoted in this reference with a + Note that describes the availability of the object, constructor, method or + function. Any of these that do not have a notation can be assumed to be + available in all versions of PyGObject from 2.0 and up. The source code + must be consulted if this reference and your version of + PyGObject seem to differ. You are encouraged to use the + latest version of PyGObject that is available. See the + PyGTK + homepage for more information and more resources on how to use + PyGObject as well as help in its development.

The Reference contains a chapter for each + PyGObject module containing the class descriptions. The + class descriptions are arranged alphabetically within the + chapters. Currently there is one module chapter:

The gobject module

The classes that are included in the +gobject module of PyGObject and are +accessed similar to: gobject.GObject. These classes are the base object +classes that the gtk and gtk.gdk +module classes are built on.

Reference Page Format

Each PyGObject class is described in a reference +page that has a number of sections in a fixed format. Each reference page +will have a subset of the following sections:

Name

The name and a one-line description of the +class.

Synopsis

A synopsis of the class and its methods and +optionally a list of associated functions.

Ancestry

The list of the parent classes of the class. This +section may not be present in all class descriptions.

Properties

A list of the properties (internal state) +supported by the class. This section may not be present in all classes. The +property descriptions include the name, the access operations (e.g. Read, +Write), and a brief description. Properties are accessed using the gobject.set_property() +and gobject.get_property() +methods that are available to every PyGObject object. This +section may not be present in all class descriptions.

Attributes

A set of internal object state data accessible as Python + attributes (e.g. object.attr). The attribute descriptions include + a name by which the attribute data is accessed, the access mode + (e.g. Read, Write), and a brief description of the attribute. Most + PyGObject classes do not support attributes so + this section is not present in most class descriptions.

Signal Prototypes

A list of the signals supported by the class including + the signal name and a synopsis of the signal handler function + prototype. This section may not be present in all class + descriptions.

Description

A description of the class and possibly some of + the methods supported by the class.

Constructor

The description of the class object constructor including + the synopsis with brief parameter descriptions and a description + of th use of the constructor. There may be more than one + constructor description if the constructor supports different + parameter lists. This section may not be present in all class + descriptions.

Methods

A list of methods supported by the class. Each method + description includes: a synopsis of the method and its parameters + as well as a brief description of each parameter and return value + (if any); and, a description of the use of the method.

Functions

A list of related functions. Each function description + includes a synopsis of the function and its parameters and return + value (if any), and a description of the use of the + function.

Signals

A list of signals including a synopsis of the signal + handler prototype function with its parameters and return value + (if any). The signal emission conditions are briefly + described. This section is not present in all class descriptions; + specifically, the gtk.gdk classes do not + usually support signals.

The function and method synopsis parameters are displayed in + bold to denote Python keyword + parameters. Also if the parameter is optional its default value will be + displayed. For example the gobject.signal_lookup() + function synopsis is:

+    def gobject.signal_lookup(name, type)
+

The parameters name and + type are keyword parameters that can be specified + in a call either by position or keyword (in which case position is not + important). The following calls have the same result:

+  id = gobject.signal_lookup("clicked", gtk.Button)
+  id = gobject.signal_lookup("clicked", type=gtk.Button)
+  id = gobject.signal_lookup(name="clicked", type=gtk.Button)
+  id = gobject.signal_lookup(type=gtk.Button, name="clicked")
+

Parameters that are not keyword parameters are displayed in +italic and must be specified positionally but may also +be optional.

diff --git a/docs/html/pygobject.devhelp b/docs/html/pygobject.devhelp new file mode 100644 index 0000000..b37be2a --- /dev/null +++ b/docs/html/pygobject.devhelp @@ -0,0 +1,525 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/reference/entities.docbook.in b/docs/reference/entities.docbook.in new file mode 100644 index 0000000..be788f8 --- /dev/null +++ b/docs/reference/entities.docbook.in @@ -0,0 +1 @@ + diff --git a/docs/reference/pygio-appinfo.xml b/docs/reference/pygio-appinfo.xml new file mode 100644 index 0000000..eaeb060 --- /dev/null +++ b/docs/reference/pygio-appinfo.xml @@ -0,0 +1,894 @@ + + + + + + gio.AppInfo + Information about an installed application and methods to launch it (with file arguments). + + + + Synopsis + + + gio.AppInfo + gobject.GInterface + + + gio.AppInfo + commandline + application_nameNone + flagsgio.APP_INFO_CREATE_NONE + + + + add_supports_type + content_type + + + can_delete + + + + can_remove_supports_type + + + + delete + + + + dup + + + + equal + appinfo2 + + + get_commandline + + + + get_description + + + + get_executable + + + + get_icon + + + + get_id + + + + get_name + + + + launch + files + launch_context + + + launch_uris + uris + launch_context + + + remove_supports_type + content_type + + + set_as_default_for_extension + extension + + + set_as_default_for_type + content_type + + + should_show + + + + supports_files + + + + supports_uris + + + + + + +Functions + + + gio.app_info_get_all + + + gio.app_info_get_all_for_type + content_type + + gio.app_info_get_default_for_type + content_type + must_support_uris + + gio.app_info_get_default_for_uri_scheme + uri_scheme + + gio.app_info_reset_type_association + content_type + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.AppInfo + + + + + + Known Implementation + + gio.AppInfo is implemented by + gio.DesktopAppInfo + + + + + Description + + + gio.AppInfo + and gio.AppLaunchContext + are used for describing and launching applications installed on the system. + + + As of GLib 2.20, URIs will always be converted to POSIX paths (using + gio.File.get_path()) when using + gio.AppInfo.launch() + even if the application requested an URI and not a POSIX path. For example for an desktop-file + based application with Exec key totem %U and a single URI, sftp://foo/file.avi, then /home/user/.gvfs/sftp + on foo/file.avi will be passed. This will only work if a set of suitable GIO extensions (such as gvfs 2.26 + compiled with FUSE support), is available and operational; if this is not the case, the URI will be passed + unmodified to the application. Some URIs, such as mailto:, of course cannot be mapped to a POSIX path + (in gvfs there's no FUSE mount for it); such URIs will be passed unmodified to the application. + + + Specifically for gvfs 2.26 and later, the POSIX URI will be mapped back to the GIO URI in the + gio.File constructors + (since gvfs implements the GVfs extension point). As such, if the application needs to examine the URI, + it needs to use + gio.File.get_uri() + or similar on + gio.File. + In other words, an application cannot assume that the URI passed to e.g. + gio.File() constructor + is equal to the result of + gio.File.get_uri(). + + + + + Constructor + + + gio.AppInfo + commandline + application_nameNone + flagsgio.APP_INFO_CREATE_NONE + + + + commandline : + the commandline to use + + + + application_name : + the application name, or None to use commandline. + + + + flags : + flags that can specify details of the created, + from + + + + Returns : + a new + gio.AppInfo + for given command. + + + + + + Creates a new gio.AppInfo + from the given information. + + + + + + Methods + + + gio.AppInfo.add_supports_type + + + add_supports_type + content_type + + + + + content_type : + A string. + + + + + The add_supports_type() method adds a content type + to the application information to indicate the application is capable of + opening files with the given content type. + + + + + gio.AppInfo.can_delete + + + can_delete + + + + + + Returns : + True if appinfo can be deleted. + + + + + + The can_delete() method obtains the information + whether the gio.AppInfo + can be deleted. See + gio.AppInfo.delete(). + + + + + gio.AppInfo.can_remove_supports_type + + + can_remove_supports_type + + + + + + Returns : + True if it is possible to remove + supported content types from a given appinfo, False + if not. + + + + + The can_remove_supports_type() method checks if a + supported content type can be removed from an application. + + + + + gio.AppInfo.delete + + + delete + + + + + + Returns : + True if appinfo has been deleted. + + + + + + The delete() method tries to delete an + gio.AppInfo. + + + On some platforms, there may be a difference between user-defined + gio.AppInfos + which can be deleted, and system-wide ones which cannot. See + gio.AppInfo.can_delete(). + + + + + gio.AppInfo.dup + + + dup + + + + + + Returns : + A duplicate of appinfo. + + + + + The dup() method creates a duplicate of a + gio.AppInfo. + + + + + gio.AppInfo.equal + + + equal + icon2 + + + + + appinfo2 : + the second + gio.AppInfo + + + + Returns : + True if appinfo1 is equal to appinfo2. + False otherwise. + + + + + The equal() method checks if two + gio.AppInfos are equal. + + + + + gio.AppInfo.get_commandline + + + get_commandline + + + + + + Returns : + a string containing the appinfo's commandline, or + None if this information is not available. + + + + + + The get_commandline() method gets the + commandline with which the application will be started. + + + + + gio.AppInfo.get_description + + + get_description + + + + + + Returns : + A string containing a description of the application + appinfo, or None if none. + + + + + The get_description() method gets a human-readable + description of an installed application. + + + + + gio.AppInfo.get_executable + + + get_executable + + + + + + Returns : + a string containing the appinfo's application + binary's name. + + + + + + The get_description() method gets the executable's + name for the installed application. + + + + + gio.AppInfo.get_icon + + + get_icon + + + + + + Returns : + the default + gio.Icon for appinfo. + + + + + + The get_icon() method gets the icon for the application. + + + + + gio.AppInfo.get_id + + + get_id + + + + + + Returns : + a string containing the application's ID. + + + + + + The get_id() method gets the ID of an application. + An id is a string that identifies the application. The exact format of the + id is platform dependent. For instance, on Unix this is the desktop file id + from the xdg menu specification. + + + Note that the returned ID may be None, depending on + how the appinfo has been constructed. + + + + + gio.AppInfo.get_name + + + get_name + + + + + + Returns : + the name of the application for appinfo. + + + + + + The get_name() method gets the installed + name of the application. + + + + + gio.AppInfo.launch + + + launch + files + launch_context + + + + + files : + a list of gio.File objects. + + + + launch_context : + a gio.AppLaunchContext + or None. + + + Returns : + True on successful launch, + False otherwise. + + + + + + The launch() method launches the application. + Passes files to the launched application as arguments, using the optional + launch_context to get information about the details of the launcher + (like what screen it is on). On error, error will be set accordingly. + + + To lauch the application without arguments pass a None for files list. + + + Note that even if the launch is successful the application launched can fail + to start if it runs into problems during startup. There is no way to detect this. + + + Some URIs can be changed when passed through a + gio.File + (for instance unsupported uris with strange formats like mailto:), so + if you have a textual uri you want to pass in as argument, consider using + gio.File.launch_uris() + instead. + + + + + gio.AppInfo.launch_uris + + + launch_uris + uris + launch_context + + + + + uris : + a list containing URIs to launch. + + + + launch_context : + a gio.AppLaunchContext + or None. + + + Returns : + True on successful launch, + False otherwise. + + + + + + The launch_uris() method launches the application. + Passes uris to the launched application as arguments, using the optional + launch_context to get information about the details of the launcher + (like what screen it is on). On error, error will be set accordingly. + + + To lauch the application without arguments pass a None for files list. + + + Note that even if the launch is successful the application launched can fail + to start if it runs into problems during startup. There is no way to detect this. + + + + + gio.AppInfo.remove_supports_type + + + remove_supports_type + content_type + + + + + content_type : + A string. + + + + + The remove_supports_type() method removes a + supported type from an application, if possible. + + + + + gio.AppInfo.set_as_default_for_extension + + + set_as_default_for_extension + extension + + + + + extension : + A string containing the file extension (without the dot). + + + + + + The set_as_default_for_extension() method sets the + application as the default handler for the given file extention. + + + + + gio.AppInfo.set_as_default_for_type + + + set_as_default_for_type + content_type + + + + + content_type : + The content type. + + + + + + The set_as_default_for_type() method sets the + application as the default handler for a given type. + + + + + gio.AppInfo.should_show + + + should_show + + + + + + Returns : + True if the appinfo should be shown, + False otherwise. + + + + + + The should_show() method checks if the application + info should be shown in menus that list available applications. + + + + + gio.AppInfo.supports_files + + + supports_files + + + + + + Returns : + True if the appinfo supports files. + + + + + + The supports_files() method checks if the application + accepts files as arguments. + + + + + gio.AppInfo.supports_uris + + + supports_uris + + + + + + Returns : + True if the appinfo supports uris. + + + + + + The supports_uris() method checks if the application + accepts uris as arguments. + + + + + + Functions + + + gio.app_info_get_all + + + app_info_get_all + + + + + + Returns : + A list of gio.AppInfos. + + + + + + The app_info_get_all() function gets a list of all of + the applications currently registered on this system. + + + For desktop files, this includes applications that have NoDisplay=true set or are + excluded from display by means of OnlyShowIn or NotShowIn. See + gio.AppInfo.should_show(). + The returned list does not include applications which have the Hidden key set. + + + + + gio.app_info_get_all_for_type + + + app_info_get_all_for_type + content_type + + + + + content_type : + the content type to find a + gio.AppInfo + for. + + + Returns : + A list of gio.AppInfos + for a given content type or None on error. + + + + + + The app_info_get_all_for_type() function gets a list of all + gio.AppInfos + for a given content type. + + + + + gio.app_info_get_default_for_type + + + app_info_get_default_for_type + content_type + must_support_uris + + + + + content_type : + the content type to find a + gio.AppInfo + for. + + + must_support_uris : + if True, the + gio.AppInfo + is expected to support URIs + + + Returns : + gio.AppInfo + for given content_type or None on error. + + + + + + The app_info_get_default_for_type() function gets the + gio.AppInfo + that correspond to a given content type. + + + + + gio.app_info_get_default_for_uri_scheme + + + app_info_get_default_for_uri_scheme + uri_scheme + + + + + uri_scheme : + a string containing a URI scheme. + + + Returns : + gio.AppInfo + for given uri_scheme or None on error. + + + + + + The app_info_get_default_for_uri_scheme() function gets + the default application for launching applications using this URI scheme. A URI + scheme is the initial part of the URI, up to but not including the + ':', e.g. "http", "ftp" or "sip". + + + + + gio.app_info_reset_type_association + + + app_info_reset_type_association + content_type + + + + + content_type : + a content type + + + + + The app_info_reset_type_association() function + removes all changes to the type associations done by + set_as_default_for_type(), + set_as_default_for_extension(), + add_supports_type() or + remove_supports_type(). + + + + diff --git a/docs/reference/pygio-applaunchcontext.xml b/docs/reference/pygio-applaunchcontext.xml new file mode 100644 index 0000000..66bb229 --- /dev/null +++ b/docs/reference/pygio-applaunchcontext.xml @@ -0,0 +1,194 @@ + + + + + + gio.AppLaunchContext + Application launch context. + + + + Synopsis + + + gio.AppLaunchContext + gobject.GObject + + + gio.AppLaunchContext + + + + + get_display + info + files + + + get_startup_notify_id + info + files + + + launch_failed + startup_notify_id + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.AppLaunchContext + + + + + + Description + + + The gio.AppLaunchContext + is used for integrating the launch with the launching application. This is used to handle for + instance startup notification and launching the new application on the same screen as the launching window. + + + + + Constructor + + + gio.AppLaunchContext + + + + + Returns : + a new + gio.AppLaunchContext. + + + + + + Creates a new application launch context. This is not normally used, instead + you instantiate a subclass of this, such as + gtk.gdk.AppLaunchContext. + + + + + + Methods + + + gio.AppLaunchContext.get_display + + + get_display + info + files + + + + + info : + a + gio.AppInfo + + + + files : + a list of + gio.File + objects. + + + Returns : + a display string for the display. + + + + + + The get_display() method gets the display + string for the display. This is used to ensure new applications + are started on the same display as the launching application. + + + + + gio.AppLaunchContext.get_startup_notify_id + + + get_startup_notify_id + info + files + + + + + info : + a + gio.AppInfo + + + + files : + a list of + gio.File + objects. + + + Returns : + a startup notification ID for the application, + or None if not supported. + + + + + + The get_startup_notify_id() method initiates + startup notification for the application and returns the DESKTOP_STARTUP_ID + for the launched operation, if supported. + + + Startup notification IDs are defined in the FreeDesktop.Org Startup Notifications standard. + + + + + gio.AppLaunchContext.launch_failed + + + launch_failed + startup_notify_id + + + + + startup_notify_id : + the startup notification id that was returned by + get_startup_notify_id. + + + + Returns : + a startup notification ID for the application, + or None if not supported. + + + + + + The get_startup_notify_id() method is called + when an application has failed to launch, so that it can cancel the application + startup notification started in + get_startup_notify_id + + + + diff --git a/docs/reference/pygio-asyncresult.xml b/docs/reference/pygio-asyncresult.xml new file mode 100644 index 0000000..abe56ce --- /dev/null +++ b/docs/reference/pygio-asyncresult.xml @@ -0,0 +1,117 @@ + + + + + + gio.AsyncResult + Asynchronous Function Results. + + + + Synopsis + + + gio.AsyncResult + gobject.GInterface + + + get_source_object + + + + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.AsyncResult + + + + + + Prerequisites + + gio.AsyncResult is required by + gobject.GObject. + + + + + Known Implementation + + gio.AsyncResult is implemented by + gio.SimpleAsyncResult. + + + + + Description + + + gio.AsyncResult + provides a base class for implementing asynchronous function results. + + + Asynchronous operations are broken up into two separate operations which are chained + together by a GAsyncReadyCallback. To begin an asynchronous operation, provide a + GAsyncReadyCallback to the asynchronous function. This callback will be triggered when + the operation has completed, and will be passed a GAsyncResult instance filled with the + details of the operation's success or failure, the object the asynchronous function was + started for and any error codes returned. The asynchronous callback function is then expected + to call the corresponding "_finish()" function with the object the function was called for, + and the gio.AsyncResult + instance, and optionally, an error to grab any error conditions that may have occurred. + + + The purpose of the "_finish()" function is to take the generic result of type GAsyncResult and + return the specific result that the operation in question yields (e.g. a + gio.FileEnumerator + for a "enumerate children" operation). If the result or error status of the operation is not needed, + there is no need to call the "_finish()" function, GIO will take care of cleaning up the result and error + information after the GAsyncReadyCallback returns. It is also allowed to take a reference to the + gio.AsyncResult + and call "_finish()" later. + + + The callback for an asynchronous operation is called only once, and is always called, even + in the case of a cancelled operation. On cancellation the result is a gio.ERROR_CANCELLED error. + + + Some ascynchronous operations are implemented using synchronous calls. These are run in a + separate thread, if GThread has been initialized, but otherwise they are sent to the Main Event + Loop and processed in an idle function. So, if you truly need asynchronous operations, make + sure to initialize GThread. + + + + + Methods + + + gio.AsyncResult.get_source_object + + + get_source_object + + + + + + Returns : + the source object for the res. + + + + + + The get_source_object() method gets the source object + from a gio.AsyncResult + + + + diff --git a/docs/reference/pygio-bufferedinputstream.xml b/docs/reference/pygio-bufferedinputstream.xml new file mode 100644 index 0000000..677b1da --- /dev/null +++ b/docs/reference/pygio-bufferedinputstream.xml @@ -0,0 +1,461 @@ + + + + + + gio.BufferedInputStream + Buffered Input Stream + + + + Synopsis + + + gio.BufferedInputStream + gio.FilterInputStream + + + gio.BufferedInputStream + base_stream + + + + fill + count + cancellableNone + + + fill_async + count + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + fill_finish + result + + + get_available + + + + get_buffer_size + + + + read_byte + cancellableNone + + + set_buffer_size + size + + + + + +Functions + + + gio.buffered_input_stream_new_sized + size + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.InputStream + +-- gio.FilterInputStream + +-- gio.BufferedInputStream + + + + + + gio.BufferedInputStream Properties + +
+ + + + + + + + "buffer-size" + Read - Write - Construct + The size of the backend buffer. Allowed values: >= 1. Default value: 4096. + + + + +
+ +
+ + + Description + + + gio.BufferedInputStream + implements gio.FilterInputStream + and provides for buffered reads. + + + By default, + gio.BufferedInputStream's + buffer size is set at 4 kilobytes. + + + To create a buffered input stream, use + gio.BufferedInputStream(), + or gio.buffered_input_stream_new_sized() + to specify the buffer's size at construction. + + + To get the size of a buffer within a buffered input stream, use + get_buffer_size(). + To change the size of a buffered input stream's buffer, use + set_buffer_size(). + Note that the buffer's size cannot be reduced below the size of the data within the buffer. + + + + + Constructor + + + gio.BufferedInputStream + base_stream + + + + base_stream : + a + gio.InputStream. + + + + Returns : + a new + gio.InputStream + for the given base_stream. + + + + + + Creates a new gio.InputStream + from the given base_stream, with a buffer set to the default size (4 kilobytes). + + + + + + Methods + + + gio.BufferedInputStream.fill + + + fill + count + cancellableNone + + + + + count : + the number of bytes that will be read from the stream. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + the number of bytes read into stream's buffer, + up to count, or -1 on error. + + + + + + The fill() method tries to read count bytes + from the stream into the buffer. Will block during this read. + + + If count is zero, returns zero and does nothing. A value of count + larger than G_MAXSSIZE will cause a gio.ERROR_INVALID_ARGUMENT error. + + + On success, the number of bytes read into the buffer is returned. It + is not an error if this is not the same as the requested size, as it can + happen e.g. near the end of a file. Zero is returned on end of file + (or if count is zero), but never otherwise. + + + If count is -1 then the attempted read size is equal to the number + of bytes that are required to fill the buffer. + + + If cancellable is not None, then the operation can + be cancelled by triggering the cancellable object from another thread. + If the operation was cancelled, the error gio.ERROR_CANCELLED will be + returned. If an operation was partially finished when the operation was + cancelled the partial result will be returned, without an error. + + + On error -1 is returned and error is set accordingly. + + + For the asynchronous, non-blocking, version of this function, see + gio.BufferedInputStream.fill_async(). + + + + + gio.BufferedInputStream.fill_async + + + fill_async + count + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + count : + the number of bytes that will be read from the stream. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The fill_async() method reads data into stream's + buffer asynchronously, up to count size. io_priority can be used to + prioritize reads. + + + For the synchronous version of this function, see + gio.BufferedInputStream.fill(). + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set + + + If count is -1 then the attempted read size is equal to the number of bytes + that are required to fill the buffer. + + + + + gio.BufferedInputStream.fill_finish + + + fill_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + the size of the read stream, or -1 on an error. + + + + + + The fill_finish() method finishes an asynchronous + file append operation started with + gio.BufferedInputStream.fill_async(). + + + + + gio.BufferedInputStream.get_available + + + get_available + + + + + + Returns : + size of the available stream. + + + + + + The get_available() method gets the size of + the available data within the stream. + + + + + gio.BufferedInputStream.get_buffer_size + + + get_buffer_size + + + + + + Returns : + the current buffer size. + + + + + + The get_buffer_size() method gets the size + of the input buffer. + + + + + gio.BufferedInputStream.read_byte + + + read_byte + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + the byte read from the stream, or -1 on end of stream or error. + + + + + + The read_byte() method tries to read a single + byte from the stream or the buffer. Will block during this read. + + + On success, the byte read from the stream is returned. On end of stream -1 + is returned but it's not an exceptional error and error is not set. + + + If cancellable is not None, then the operation can + be cancelled by triggering the cancellable object from another thread. + If the operation was cancelled, the error gio.ERROR_CANCELLED will be + returned. If an operation was partially finished when the operation was + cancelled the partial result will be returned, without an error. + + + On error -1 is returned and error is set accordingly. + + + + + gio.BufferedInputStream.set_buffer_size + + + set_buffer_size + size + + + + + size : + the new buffer size. + + + + + + The set_buffer_size() method sets the size + of the internal buffer of stream to size, or to the size of the contents + of the buffer. The buffer can never be resized smaller than its current contents. + + + + + + Functions + + + gio.buffered_input_stream_new_sized + + + buffered_input_stream_new_sized + size + + + + + size : + the requested buffer size. + + + + Returns : + A new + gio.InputStream. + + + + + + The buffered_input_stream_new_sized() function creates + a new gio.BufferedInputStream + from the given base_stream, with a buffer set to size. + + + +
diff --git a/docs/reference/pygio-bufferedoutputstream.xml b/docs/reference/pygio-bufferedoutputstream.xml new file mode 100644 index 0000000..6d7900f --- /dev/null +++ b/docs/reference/pygio-bufferedoutputstream.xml @@ -0,0 +1,275 @@ + + + + + + gio.BufferedOutputStream + Buffered Output Stream + + + + Synopsis + + + gio.BufferedOutputStream + gio.FilterOutputStream + + + gio.BufferedOutputStream + base_stream + + + + get_auto_grow + + + + get_buffer_size + + + + set_auto_grow + auto_grow + + + set_buffer_size + size + + + + + +Functions + + + gio.buffered_output_stream_new_sized + size + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.OutputStream + +-- gio.FilterOutputStream + +-- gio.BufferedOutputStream + + + + + + gio.BufferedOutputStream Properties + +
+ + + + + + + + "auto-grow" + Read - Write + Whether the buffer should automatically grow. Default value: False. + + + "buffer-size" + Read - Write - Construct + The size of the backend buffer. Allowed values: >= 1. Default value: 4096. + + + + +
+ +
+ + + Description + + + gio.BufferedOutputStream + implements gio.FilterOutputStream + and provides for buffered writes. + + + By default, + gio.BufferedOutputStream's + buffer size is set at 4 kilobytes. + + + To create a buffered output stream, use + gio.BufferedOutputStream(), + or gio.buffered_output_stream_new_sized() + to specify the buffer's size at construction. + + + To get the size of a buffer within a buffered output stream, use + gio.BufferedOutputStream.get_buffer_size(). + To change the size of a buffered output stream's buffer, use + gio.BufferedOutputStream.set_buffer_size(). + Note that the buffer's size cannot be reduced below the size of the data within the buffer. + + + + + Constructor + + + gio.BufferedOutputStream + base_stream + + + + base_stream : + a + gio.OutputStream. + + + + Returns : + a new + gio.OutputStream + for the given base_stream. + + + + + + Creates a new buffered output stream for a base stream. + + + + + + Methods + + + gio.BufferedOutputStream.get_auto_grow + + + get_auto_grow + + + + + + Returns : + True if the stream's + buffer automatically grows, False otherwise. + + + + + + The get_auto_grow() method checks if the + buffer automatically grows as data is added. + + + + + gio.BufferedOutputStream.get_buffer_size + + + get_buffer_size + + + + + + Returns : + the current buffer size. + + + + + + The get_buffer_size() method gets the size + of the buffer in the stream. + + + + + gio.BufferedOutputStream.set_auto_grow + + + set_auto_grow + auto_grow + + + + + auto_grow : + a boolean. + + + + + + The set_auto_grow() method sets whether or not + the stream's buffer should automatically grow. If auto_grow is true, + then each write will just make the buffer larger, and you must manually + flush the buffer to actually write out the data to the underlying stream. + + + + + gio.BufferedOutputStream.set_buffer_size + + + set_buffer_size + size + + + + + size : + the new buffer size. + + + + + + The set_buffer_size() method sets the size of + the internal buffer to size. + + + + + + Functions + + + gio.buffered_output_stream_new_sized + + + buffered_output_stream_new_sized + size + + + + + size : + the requested buffer size. + + + + Returns : + A new + gio.OutputStream + with an internal buffer set to size.. + + + + + + The buffered_output_stream_new_sized() function creates + a new gio.BufferedOutputStream + from the given base_stream, with a buffer set to size. + + + +
diff --git a/docs/reference/pygio-cancellable.xml b/docs/reference/pygio-cancellable.xml new file mode 100644 index 0000000..c35388d --- /dev/null +++ b/docs/reference/pygio-cancellable.xml @@ -0,0 +1,290 @@ + + + + + + gio.Cancellable + Thread-safe Operation Cancellation Stack. + + + + Synopsis + + + gio.Cancellable + gobject.GObject + + + gio.Cancellable + + + + + cancel + + + + get_fd + + + + is_cancelled + + + + pop_current + + + + push_current + + + + reset + + + + set_error_if_cancelled + + + + + + +Functions + + + gio.cancellable_get_current + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.Cancellable + + + + + + Description + + + The gio.Cancellable + is a thread-safe operation cancellation stack used throughout GIO to allow for + cancellation of synchronous and asynchronous operations. + + + + + Constructor + + + gio.Cancellable + + + + + Returns : + a new + gio.Cancellable. + + + + + + Creates a new gio.Cancellable object. + + + Applications that want to start one or more operations that should be cancellable should create a + gio.Cancellable + and pass it to the operations. + + + One gio.Cancellable + can be used in multiple consecutive operations, but not in multiple concurrent operations. + + + + + + Methods + + + gio.Cancellable.cancel + + + cancel + + + + + + + + The cancel() method will set cancellable to cancelled, + and will emit the "cancelled" signal. (However, see the warning about race conditions + in the documentation for that signal if you are planning to connect to it.) + + + This function is thread-safe. In other words, you can safely call it from a thread + other than the one running the operation that was passed the cancellable. + + + The convention within gio is that cancelling an asynchronous operation causes it + to complete asynchronously. That is, if you cancel the operation from the same thread + in which it is running, then the operation's GAsyncReadyCallback will not be invoked + until the application returns to the main loop. + + + + + gio.Cancellable.get_fd + + + get_fd + + + + + + Returns : + A valid file descriptor. -1 if the file descriptor + is not supported, or on errors. + + + + + The get_fd() method gets the file descriptor + for a cancellable job. This can be used to implement cancellable operations + on Unix systems. The returned fd will turn readable when cancellable is cancelled. + + + + + gio.Cancellable.is_cancelled + + + is_cancelled + + + + + + Returns : + True if cancellable is cancelled, + False if called with None or if + item is not cancelled. + + + + + The get_fd() method gets the file descriptor + for a cancellable job. This can be used to implement cancellable operations + on Unix systems. The returned fd will turn readable when cancellable is cancelled. + + + + + gio.Cancellable.pop_current + + + pop_current + + + + + + + + The pop_current() method pops cancellable off + the cancellable stack (verifying that cancellable is on the top of the stack). + + + + + gio.Cancellable.push_current + + + push_current + + + + + + + + The push_current() method pushes cancellable onto + the cancellable stack. The current cancllable can then be recieved using + gio.cancellable_get_current(). + + + + + gio.Cancellable.reset + + + reset + + + + + + + + The reset() method resets cancellable to its uncancelled state. + + + + + gio.Cancellable.set_error_if_cancelled + + + set_error_if_cancelled + + + + + + Returns : + True if cancellable was cancelled, + False if it was not. + + + + + The set_error_if_cancelled() method, if the cancellable + is cancelled, sets the error to notify that the operation was cancelled. + + + + + + Functions + + + gio.cancellable_get_current + + + cancellable_get_current + + + + + + Returns : + A gio.Cancellable + from the top of the stack, or None if the stack is empty. + + + + + The cancellable_get_current() function gets the top cancellable from the stack. + + + + diff --git a/docs/reference/pygio-classes.xml b/docs/reference/pygio-classes.xml new file mode 100644 index 0000000..17761f8 --- /dev/null +++ b/docs/reference/pygio-classes.xml @@ -0,0 +1,47 @@ + + + + +PyGio Class Reference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/reference/pygio-constants.xml b/docs/reference/pygio-constants.xml new file mode 100644 index 0000000..343927e --- /dev/null +++ b/docs/reference/pygio-constants.xml @@ -0,0 +1,1540 @@ + + + + + + gio Constants + the built-in constants of the gio module + + + + Synopsis + + + + + + + + + + + + + + + + + + + + + + + + + + Description + + + Gio Ask Password Flags Constants + + + Flags that are used to request specific information from the user, or to + notify the user of their choices in an authentication situation. + + + + + gio.ASK_PASSWORD_ANONYMOUS_SUPPORTED + + operation supports anonymous users. + + + + gio.ASK_PASSWORD_NEED_DOMAIN + + operation requires a domain. + + + + gio.ASK_PASSWORD_NEED_PASSWORD + + operation requires a password. + + + + gio.ASK_PASSWORD_NEED_USERNAME + + operation requires a username. + + + + gio.ASK_PASSWORD_SAVING_SUPPORTED + + operation supports saving settings. + + + + + + + Gio AppInfo Create Flags Constants + + + Flags used when creating a gio.AppInfo + + + + + gio.APP_INFO_CREATE_NONE + + No flags. + + + + gio.APP_INFO_CREATE_NEEDS_TERMINAL + + Application opens in a terminal window. + + + + gio.APP_INFO_CREATE_SUPPORTS_URIS + + Application supports URI arguments. + + + + + + + Gio Data Stream Byte Order Constants + + + Used to ensure proper endianness of streaming data sources across various machine architectures. + + + + + gio.DATA_STREAM_BYTE_ORDER_BIG_ENDIAN + + Selects Big Endian byte order. + + + + gio.DATA_STREAM_BYTE_ORDER_HOST_ENDIAN + + Selects endianness based on host machine's architecture. + + + + gio.DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN + + Selects Little Endian byte order. + + + + + + + Gio Data Stream Newline Type Constants + + + Used when checking for or setting the line endings for a given file. + + + + + gio.DATA_STREAM_NEWLINE_TYPE_LF + + Selects "LF" line endings, common on most modern UNIX platforms. + + + + gio.DATA_STREAM_NEWLINE_TYPE_CR + + Selects "CR" line endings. + + + + gio.DATA_STREAM_NEWLINE_TYPE_CR_LF + + Selects "CR, LF" line ending, common on Microsoft Windows. + + + + gio.DATA_STREAM_NEWLINE_TYPE_ANY + + Automatically try to handle any line ending type. + + + + + + + Gio Emblem Origin Constants + + + GEmblemOrigin is used to add information about the origin of the emblem to GEmblem. + + + + + gio.EMBLEM_ORIGIN_DEVICE + + Embleme adds device-specific information. + + + + gio.EMBLEM_ORIGIN_LIVEMETADATA + + Emblem depicts live metadata, such as "readonly". + + + + gio.EMBLEM_ORIGIN_TAG + + Emblem comes from a user-defined tag, e.g. set by nautilus (in the future). + + + + gio.EMBLEM_ORIGIN_UNKNOWN + + Emblem of unknown origin. + + + + + + + Gio Error Constants + + + GIOError Error codes returned by GIO functions. + + + + + gio.ERROR_ALREADY_MOUNTED + + File is already mounted. + + + + gio.ERROR_BUSY + + File is busy. + + + + gio.ERROR_CANCELLED + + Operation was cancelled. See + gio.Cancellable. + + + + + gio.ERROR_CANT_CREATE_BACKUP + + Backup couldn't be created. + + + + gio.ERROR_CLOSED + + File was closed. + + + + gio.ERROR_EXISTS + + File already exists error. + + + + gio.ERROR_FAILED + + Generic error condition for when any operation fails. + + + + gio.ERROR_FAILED_HANDLED + + Operation failed and a helper program has already interacted with + the user. Do not display any error dialog. + + + + gio.ERROR_FILENAME_TOO_LONG + + Filename is too many characters. + + + + gio.ERROR_HOST_NOT_FOUND + + Host couldn't be found (remote operations). + + + + gio.ERROR_INVALID_ARGUMENT + + Invalid argument. + + + + gio.ERROR_INVALID_FILENAME + + Filename is invalid or contains invalid characters. + + + + gio.ERROR_IS_DIRECTORY + + File is a directory error. + + + + gio.ERROR_NOT_DIRECTORY + + File is not a directory. + + + + gio.ERROR_NOT_EMPTY + + File is a directory that isn't empty. + + + + gio.ERROR_NOT_FOUND + + File not found error. + + + + gio.ERROR_NOT_MOUNTABLE_FILE + + File cannot be mounted. + + + + gio.ERROR_NOT_MOUNTED + + File isn't mounted. + + + + gio.ERROR_NOT_REGULAR_FILE + + File is not a regular file. + + + + gio.ERROR_NOT_SUPPORTED + + Operation not supported for the current backend. + + + + gio.ERROR_NOT_SYMBOLIC_LINK + + File is not a symbolic link. + + + + gio.ERROR_NO_SPACE + + No space left on drive. + + + + gio.ERROR_PENDING + + Operations are still pending. + + + + gio.ERROR_PERMISSION_DENIED + + Permission denied. + + + + gio.ERROR_READ_ONLY + + File is read only. + + + + gio.ERROR_TIMED_OUT + + Operation timed out. + + + + gio.ERROR_TOO_MANY_LINKS + + File contains too many symbolic links. + + + + gio.ERROR_TOO_MANY_OPEN_FILES + + The current process has too many files open and can't open any + more. Duplicate descriptors do count toward this limit. Since 2.20 + + + + gio.ERROR_WOULD_BLOCK + + Operation would block. + + + + gio.ERROR_WOULD_MERGE + + Operation would merge files. + + + + gio.ERROR_WOULD_RECURSE + + Operation would be recursive. + + + + gio.ERROR_WRONG_ETAG + + File's Entity Tag was incorrect. + + + + + + + Gio File Attribute Constants + + + The file attributes. + + + + + gio.FILE_ATTRIBUTE_STANDARD_TYPE + + + "standard::type" A key in the "standard" namespace for storing file types. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. The value for this key should contain a + + + + + + gio.FILE_ATTRIBUTE_STANDARD_IS_HIDDEN + + + "standard::is-hidden" A key in the "standard" namespace for checking if a file is hidden. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_STANDARD_IS_BACKUP + + + "standard::is-backup" A key in the "standard" namespace for checking if a file is a backup file. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_STANDARD_IS_SYMLINK + + + "standard::is-symlink" A key in the "standard" namespace for checking if the file is a symlink. + Typically the actual type is something else, if we followed the symlink to get the type. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL + + + "standard::is-virtual" A key in the "standard" namespace for checking if a file is virtual. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_STANDARD_NAME + + + "standard::name" A key in the "standard" namespace for getting the name of the file. + The name is the on-disk filename which may not be in any known encoding, + and can thus not be generally displayed as is. Use + gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME if you need to display the name in a user + interface. Corresponding GFileAttributeType is gio.FILE_ATTRIBUTE_TYPE_BYTE_STRING. + + + + + gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + + + "standard::display-name" A key in the "standard" namespace for getting the display + name of the file. A display name is guaranteed to be in UTF8 and can thus be displayed + in the UI. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_STANDARD_EDIT_NAME + + + "standard::edit-name" A key in the "standard" namespace for edit name of the file. + An edit name is similar to the display name, but it is meant to be used when you want + to rename the file in the UI. The display name might contain information you don't + want in the new filename (such as "(invalid unicode)" if the filename was in an + invalid encoding). Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_STANDARD_COPY_NAME + + + "standard::copy-name" A key in the "standard" namespace for getting the copy + name of the file. The copy name is an optional version of the name. If available + it's always in UTF8, and corresponds directly to the original filename (only transcoded + to UTF8). This is useful if you want to copy the file to another filesystem that might + have a different encoding. If the filename is not a valid string in the encoding selected + for the filesystem it is in then the copy name will not be set. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_STANDARD_ICON + + + "standard::icon" A key in the "standard" namespace for getting the icon for the file. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_OBJECT. The value for this key should contain a + gio.Icon. + + + + + gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE + + + "standard::content-type" A key in the "standard" namespace for getting the content type of the file. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. The value for this key should contain a valid content type. + + + + + gio.FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE + + + "standard::fast-content-type" A key in the "standard" namespace for getting the fast + content type. The fast content type isn't as reliable as the regular one, as it + only uses the filename to guess it, but it is faster to calculate than the regular + content type. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_STANDARD_SIZE + + + "standard::size" A key in the "standard" namespace for getting the file's size (in bytes). Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT64. + + + + + gio.FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET + + + "standard::symlink-target" A key in the "standard" namespace for getting the target URI + for the file, in the case of gio.FILE_TYPE_SHORTCUT or gio.FILE_TYPE_MOUNTABLE files. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_STANDARD_SORT_ORDER + + + "standard::sort-order" A key in the "standard" namespace for setting the sort order of a file. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_INT32. An example use would be in file managers, which would use this + key to set the order files are displayed. Files with smaller sort order should be sorted first, + and files without sort order as if sort order was zero. + + + + + gio.FILE_ATTRIBUTE_ETAG_VALUE + + + "etag::value" A key in the "etag" namespace for getting the value of the file's entity tag. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_ID_FILE + + + "id::file" A key in the "id" namespace for getting a file identifier. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. An example use would be during listing files, + to avoid recursive directory scanning. + + + + + gio.FILE_ATTRIBUTE_ID_FILESYSTEM + + + "id::filesystem" A key in the "id" namespace for getting the file system identifier. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. An example use would be during drag and + drop to see if the source and target are on the same filesystem (default to move) or not (default to copy). + + + + + gio.FILE_ATTRIBUTE_ACCESS_CAN_READ + + + "access::can-read" A key in the "access" namespace for getting read privileges. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to read the file. + + + + + gio.FILE_ATTRIBUTE_ACCESS_CAN_WRITE + + + "access::can-write" A key in the "access" namespace for getting write privileges.Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to write to the file. + + + + + gio.FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE + + + "access::can-execute" A key in the "access" namespace for getting execution privileges. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to execute the file. + + + + + gio.FILE_ATTRIBUTE_ACCESS_CAN_DELETE + + + "access::can-delete" A key in the "access" namespace for checking deletion privileges. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to delete the file. + + + + + gio.FILE_ATTRIBUTE_ACCESS_CAN_TRASH + + + "access::can-trash" A key in the "access" namespace for checking trashing privileges. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to move the file to the trash. + + + + + gio.FILE_ATTRIBUTE_ACCESS_CAN_RENAME + + + "access::can-rename" A key in the "access" namespace for checking renaming privileges. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. This attribute will be True + if the user is able to rename the file. + + + + + gio.FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT + + + "mountable::can-mount" A key in the "mountable" namespace for checking if + a file (of type G_FILE_TYPE_MOUNTABLE) is mountable. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT + + + "mountable::can-unmount" A key in the "mountable" namespace for checking if a file + (of type G_FILE_TYPE_MOUNTABLE) is unmountable. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT + + + "mountable::can-eject" A key in the "mountable" namespace for checking if a file + (of type G_FILE_TYPE_MOUNTABLE) can be ejected. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE + + + "mountable::unix-device" A key in the "mountable" namespace for getting the unix device. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI + + + "mountable::hal-udi" A key in the "mountable" namespace for getting the + HAL UDI for the mountable file. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_TIME_MODIFIED + + + "time::modified" A key in the "time" namespace for getting the time the file was last modified. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT64, and contains the UNIX time since the file was modified. + + + + + gio.FILE_ATTRIBUTE_TIME_MODIFIED_USEC + + + "time::modified-usec" A key in the "time" namespace for getting the miliseconds + of the time the file was last modified. This should be used in conjunction + with G_FILE_ATTRIBUTE_TIME_MODIFIED. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_TIME_ACCESS + + + "time::access" A key in the "time" namespace for getting the time the file was last accessed. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT64, and contains the UNIX time since the file was last accessed. + + + + + gio.FILE_ATTRIBUTE_TIME_ACCESS_USEC + + + "time::access-usec" A key in the "time" namespace for getting the microseconds of + the time the file was last accessed. This should be used in conjunction + with G_FILE_ATTRIBUTE_TIME_ACCESS. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_TIME_CHANGED + + + "time::changed" A key in the "time" namespace for getting the time the + file was last changed. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT64, and contains the UNIX time since the file was last changed. + This corresponds to the traditional UNIX ctime. + + + + + gio.FILE_ATTRIBUTE_TIME_CHANGED_USEC + + + "time::changed-usec" A key in the "time" namespace for getting the microseconds + of the time the file was last changed. This should be used in conjunction + with G_FILE_ATTRIBUTE_TIME_CHANGED. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_TIME_CREATED + + + "time::created" A key in the "time" namespace for getting the time the file was created. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT64, and contains the UNIX time since the file was created. + This corresponds to the NTFS ctime. + + + + + gio.FILE_ATTRIBUTE_TIME_CREATED_USEC + + + "time::created-usec" A key in the "time" namespace for getting the microseconds of the time the + file was created. This should be used in conjunction with G_FILE_ATTRIBUTE_TIME_CREATED. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_UNIX_DEVICE + + + "unix::device" A key in the "unix" namespace for getting the device id of the device the file + is located on (see stat() documentation). This attribute is only available + for UNIX file systems. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_UNIX_INODE + + + "unix::inode" A key in the "unix" namespace for getting the inode of the file. This attribute is only + available for UNIX file systems. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_UINT64. + + + + + gio.FILE_ATTRIBUTE_UNIX_MODE + + + "unix::mode" A key in the "unix" namespace for getting the mode of the file (e.g. + whether the file is a regular file, symlink, etc). See lstat() documentation. + This attribute is only available for UNIX file systems. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_UNIX_NLINK + + + "unix::nlink" A key in the "unix" namespace for getting the number of hard links + for a file. See lstat() documentation. This attribute is only available for UNIX + file systems. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_UNIX_UID + + + "unix::uid" A key in the "unix" namespace for getting the user ID for the file. This attribute + is only available for UNIX file systems. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_UNIX_GID + + + "unix::gid" A key in the "unix" namespace for getting the group ID for the file. + This attribute is only available for UNIX file systems. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_UNIX_RDEV + + + "unix::rdev" A key in the "unix" namespace for getting the device ID for the file + (if it is a special file). See lstat() documentation. This attribute is only available + for UNIX file systems. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_UNIX_BLOCK_SIZE + + + "unix::block-size" A key in the "unix" namespace for getting the block size for + the file system. This attribute is only available for UNIX file systems. Corresponding + + is gio.FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_UNIX_BLOCKS + + + "unix::blocks" A key in the "unix" namespace for getting the number of blocks allocated + for the file. This attribute is only available for UNIX file systems. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_UINT64. + + + + + gio.FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT + + + "unix::is-mountpoint" A key in the "unix" namespace for checking if the file represents + a UNIX mount point. This attribute is True if the file is a UNIX mount point. + This attribute is only available for UNIX file systems. Corresponding + GFileAttributeType + is gio.FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_DOS_IS_ARCHIVE + + + "dos::is-archive" A key in the "dos" namespace for checking if the file's archive + flag is set. This attribute is True if the archive flag is set. + This attribute is only available for DOS file systems. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_DOS_IS_SYSTEM + + + "dos::is-system" A key in the "dos" namespace for checking if the file's backup + flag is set. This attribute is True if the backup flag is set. + This attribute is only available for DOS file systems. Corresponding + is + G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_OWNER_USER + + + "owner::user" A key in the "owner" namespace for getting the user name + of the file's owner. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_OWNER_USER_REAL + + + "owner::user-real" A key in the "owner" namespace for getting the real name + of the user that owns the file. Corresponding + is + G_FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_OWNER_GROUP + + + "owner::group" A key in the "owner" namespace for getting the file owner's + group. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_THUMBNAIL_PATH + + + "thumbnail::path" A key in the "thumbnail" namespace for getting the path + to the thumbnail image. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. + + + + + gio.FILE_ATTRIBUTE_THUMBNAILING_FAILED + + + "thumbnail::failed" A key in the "thumbnail" namespace for checking if thumbnailing failed. This attribute + is True if thumbnailing failed. Corresponding + is + G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_PREVIEW_ICON + + + "preview::icon" A key in the "preview" namespace for getting a + gio.Icon + that can be used to get preview of the file. For example, it + may be a low resolution thumbnail without metadata. Corresponding + is + G_FILE_ATTRIBUTE_TYPE_OBJECT. The value for this key should contain a GIcon. + + + + + gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE + + + "filesystem::size" A key in the "filesystem" namespace for getting the total + size (in bytes) of the file system, used in + query_filesystem_info(). + Corresponding + + is G_FILE_ATTRIBUTE_TYPE_UINT64. + + + + + gio.FILE_ATTRIBUTE_FILESYSTEM_FREE + + + "filesystem::free" A key in the "filesystem" namespace for getting the number of bytes of free space left + on the file system. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_UINT64. + + + + + gio.FILE_ATTRIBUTE_FILESYSTEM_TYPE + + + "filesystem::type" A key in the "filesystem" namespace for getting the file system's type. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_FILESYSTEM_READONLY + + + "filesystem::readonly" A key in the "filesystem" namespace for checking if the + file system is read only. Is set to True if the file system + is read only. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + + + + + gio.FILE_ATTRIBUTE_GVFS_BACKEND + + + "gvfs::backend" A key in the "gvfs" namespace that gets the name of the current GVFS backend in use. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_STRING. + + + + + gio.FILE_ATTRIBUTE_SELINUX_CONTEXT + + + "selinux::context" A key in the "selinux" namespace for getting the file's SELinux context. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_STRING. + Note that this attribute is only available if GLib has been built with SELinux support. + + + + + gio.FILE_ATTRIBUTE_TRASH_ITEM_COUNT + + + "trash::item-count" A key in the "trash" namespace. When requested against "trash:///" returns the number + of (toplevel) items in the trash folder. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_UINT32. + + + + + gio.FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW + + + "filesystem::use-preview" A key in the "filesystem" namespace for hinting a file manager + application whether it should preview (e.g. thumbnail) files on the file system. + The value for this key contain a GFilesystemPreviewType. + + + + + gio.FILE_ATTRIBUTE_STANDARD_DESCRIPTION + + + "standard::description" A key in the "standard" namespace for getting the description + of the file. The description is a utf8 string that describes the file, generally containing + the filename, but can also contain furter information. Example descriptions could be + "filename (on hostname)" for a remote file or "filename (in trash)" for a + file in the trash. This is useful for instance as the window title when + displaying a directory or for a bookmarks menu. Corresponding + + is G_FILE_ATTRIBUTE_TYPE_STRING. + + + + + + + + Gio File Attribute Type Constants + + + The data types for file attributes. + + + + + gio.FILE_ATTRIBUTE_TYPE_BOOLEAN + + a boolean value. + + + + gio.FILE_ATTRIBUTE_TYPE_BYTE_STRING + + a zero terminated string of non-zero bytes. + + + + gio.FILE_ATTRIBUTE_TYPE_INT32 + + a signed 4-byte/32-bit integer. + + + + gio.FILE_ATTRIBUTE_TYPE_INT64 + + a signed 8-byte/64-bit integer. + + + + gio.FILE_ATTRIBUTE_TYPE_INVALID + + indicates an invalid or uninitalized type. + + + + gio.FILE_ATTRIBUTE_TYPE_OBJECT + + a gobject.GObject. + + + + gio.FILE_ATTRIBUTE_TYPE_STRING + + a null terminated UTF8 string. + + + + gio.FILE_ATTRIBUTE_TYPE_UINT32 + + an unsigned 4-byte/32-bit integer. + + + + gio.FILE_ATTRIBUTE_TYPE_UINT64 + + an unsigned 8-byte/64-bit integer. + + + + + + + Gio File Attribute Flags Constants + + + Flags specifying the behaviour of an attribute. + + + + + gio.FILE_ATTRIBUTE_INFO_NONE + + no flags set. + + + + gio.FILE_ATTRIBUTE_INFO_COPY_WITH_FILE + + copy the attribute values when the file is copied. + + + + gio.FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED + + copy the attribute values when the file is moved. + + + + + + + Gio File Create Flags Constants + + + Flags used when an operation may create a file. + + + + + gio.FILE_CREATE_NONE + + No flags set. + + + + gio.FILE_CREATE_PRIVATE + + Create a file that can only be accessed by the current user. + + + + gio.FILE_CREATE_REPLACE_DESTINATION + + + Replace the destination as if it didn't exist before. Don't try + to keep any old permissions, replace instead of following links. This is + generally useful if you're doing a "copy over" rather than a "save new version of" + replace operation. You can think of it as "unlink destination" before writing + to it, although the implementation may not be exactly like that. + + + + + + + + Gio File Copy Flags Constants + + + Flags used when copying or moving files. + + + + + gio.FILE_COPY_NONE + + No flags set. + + + + gio.FILE_COPY_OVERWRITE + + Overwrite any existing files. + + + + gio.FILE_COPY_BACKUP + + Make a backup of any existing files. + + + + gio.FILE_COPY_NOFOLLOW_SYMLINKS + + Don't follow symlinks. + + + + gio.FILE_COPY_ALL_METADATA + + Copy all file metadata instead of just default set used for copy + (see gio.FileInfo). + + + + gio.FILE_COPY_NO_FALLBACK_FOR_MOVE + + Don't use copy and delete fallback if native move not supported. + + + + gio.FILE_COPY_TARGET_DEFAULT_PERMS + + Leaves target file with default perms, instead of setting the source file perms. + + + + + + + Gio File Monitor Flags Constants + + + Flags used to set what a + gio.FileMonitor + will watch for. + + + + + gio.FILE_MONITOR_NONE + + No flags set. + + + + gio.FILE_MONITOR_WATCH_MOUNTS + + Watch for mount events. + + + + + + + Gio File Query Info Flags Constants + + + Flags used when querying a + gio.FileInfo. + + + + + gio.FILE_QUERY_INFO_NONE + + No flags set. + + + + gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS + + Don't follow symlinks. + + + + + + + Gio File Type Constants + + + Indicates the file's on-disk type. + + + + + gio.FILE_TYPE_DIRECTORY + + File handle represents a directory. + + + + gio.FILE_TYPE_MOUNTABLE + + File is a mountable location. + + + + gio.FILE_TYPE_REGULAR + + File handle represents a regular file. + + + + gio.FILE_TYPE_SHORTCUT + + File is a shortcut (Windows systems). + + + + gio.FILE_TYPE_SPECIAL + + File is a "special" file, such as a socket, fifo, block device, or character device. + + + + gio.FILE_TYPE_SYMBOLIC_LINK + + File handle represents a symbolic link (Unix systems). + + + + gio.FILE_TYPE_UNKNOWN + + File's type is unknown. + + + + + + + Gio Mount Mount Flags Constants + + + Flags used when mounting a mount. + + + + + gio.MOUNT_MOUNT_NONE + + No flags set. + + + + + + + Gio Mount Unmount Flags Constants + + + Flags used when unmounting a mount. + + + + + gio.MOUNT_UNMOUNT_NONE + + No flags set. + + + + gio.MOUNT_UNMOUNT_FORCE + + Unmount even if there are outstanding file operations on the mount. + + + + + + + Gio Mount Operation Result Constants + + + returned as a result when a request for information is send by the mounting operation. + + + + + gio.MOUNT_OPERATION_HANDLED + + The request was fulfilled and the user specified data is now available. + + + + gio.MOUNT_OPERATION_ABORTED + + The user requested the mount operation to be aborted. + + + + gio.MOUNT_OPERATION_UNHANDLED + + The request was unhandled (i.e. not implemented). + + + + + + + Gio Password Save Constants + + + is used to indicate the lifespan of a saved password. + + + Gvfs stores passwords in the Gnome keyring when this flag allows it to, + and later retrieves it again from there. + + + + + gio.PASSWORD_SAVE_FOR_SESSION + + save a password for the session. + + + + gio.PASSWORD_SAVE_NEVER + + never save a password. + + + + gio.PASSWORD_SAVE_PERMANENTLY + + save a password permanently. + + + + + + + diff --git a/docs/reference/pygio-datainputstream.xml b/docs/reference/pygio-datainputstream.xml new file mode 100644 index 0000000..403bb3e --- /dev/null +++ b/docs/reference/pygio-datainputstream.xml @@ -0,0 +1,799 @@ + + + + + + gio.DataInputStream + Data Input Stream + + + + Synopsis + + + gio.DataInputStream + gio.BufferedInputStream + + + gio.DataInputStream + base_stream + + + + get_byte_order + + + + get_newline_type + + + + read_byte + cancellableNone + + + read_int16 + cancellableNone + + + read_int32 + cancellableNone + + + read_int64 + cancellableNone + + + read_line + cancellableNone + + + read_line_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + read_line_finish + result + + + read_uint16 + cancellableNone + + + read_uint32 + cancellableNone + + + read_uint64 + cancellableNone + + + read_until + stop_chars + cancellableNone + + + read_until_async + stop_chars + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + read_until_finish + result + + + set_byte_order + order + + + set_newline_type + type + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.InputStream + +-- gio.FilterInputStream + +-- gio.BufferedInputStream + +-- gio.DataInputStream + + + + + + gio.DataInputStream Properties + +
+ + + + + + + + "byte-order" + Read - Write + The byte order. Default value: gio.DATA_STREAM_BYTE_ORDER_BIG_ENDIAN. + + + "newline-type" + Read - Write + The accepted types of line ending. Default value: gio.DATA_STREAM_NEWLINE_TYPE_LF. + + + + +
+ +
+ + + Description + + + gio.DataInputStream + implements gio.InputStream + and includes functions for reading structured data directly from a binary input stream. + + + + + Constructor + + + gio.DataInputStream + base_stream + + + + base_stream : + a + gio.InputStream. + + + + Returns : + a new + gio.DataInputStream + + + + + + Creates a new gio.DataInputStream + from the given base_stream. + + + + + + Methods + + + gio.DataInputStream.get_byte_order + + + get_byte_order + + + + + + Returns : + the stream's current + . + + + + + + The get_byte_order() method gets the byte + order for the data input stream. + + + + + gio.DataInputStream.get_newline_type + + + get_newline_type + + + + + + Returns : + + for the given stream. + + + + + + The get_newline_type() method gets the current + newline type for the stream. + + + + + gio.DataInputStream.read_byte + + + read_byte + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + an unsigned 8-bit/1-byte value read from the + stream or 0 if an error occurred. + + + + + + The read_byte() method reads an unsigned 8-bit/1-byte value from stream. + + + + + gio.DataInputStream.read_int16 + + + read_int16 + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a signed 16-bit/2-byte value read from stream or 0 if an error occurred. + + + + + + The read_int16() method reads a 16-bit/2-byte value from stream. + + + In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataInputStream.read_int32 + + + read_int32 + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a signed 32-bit/4-byte value read from the stream + or 0 if an error occurred. + + + + + + The read_int32() method reads a signed 32-bit/4-byte value from stream. + + + In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataInputStream.read_int64 + + + read_int64 + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a signed 64-bit/8-byte value read from the stream + or 0 if an error occurred. + + + + + + The read_int64() method reads a signed 64-bit/8-byte value from stream. + + + In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataInputStream.read_line + + + read_line + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a string with the line that was read in (without the newlines). + Set length to a gsize to get the length of the read line. On an error, it will return + None and error will be set. If there's no content to read, it + will still return None, but error won't be set. + + + + + + The read_line() reads a line from the data input stream. + + + If cancellable is not None, then the operation can + be cancelled by triggering the cancellable object from another thread. + If the operation was cancelled, the error gio.ERROR_CANCELLED will be + returned. If an operation was partially finished when the operation was + cancelled the partial result will be returned, without an error. + + + + + gio.DataInputStream.read_line_async + + + read_line_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The read_line_async() method is the asynchronous version of + gio.DataInputStream.read_line(). + It is an error to have two outstanding calls to this function. + + + For the synchronous version of this function, see + gio.DataInputStream.read_line(). + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set + + + + + gio.DataInputStream.read_line_finish + + + read_line_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a string with the line that was read in (without the newlines). + On an error, it will return None and error will be set. + If there's no content to read, it will still return None, + but error won't be set. + + + + + + The read_line_finish() method finishes an asynchronous + file append operation started with + gio.DataInputStream.read_line_async(). + + + + + gio.DataInputStream.read_uint16 + + + read_uint16 + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a signed 16-bit/2-byte value read from stream or 0 if an error occurred. + + + + + + The read_uint16() method reads a 16-bit/2-byte value from stream. + + + In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataInputStream.read_uint32 + + + read_uint32 + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a signed 32-bit/4-byte value read from the stream + or 0 if an error occurred. + + + + + + The read_uint32() method reads a signed 32-bit/4-byte value from stream. + + + In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataInputStream.read_uint64 + + + read_uint64 + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a signed 64-bit/8-byte value read from the stream + or 0 if an error occurred. + + + + + + The read_uint64() method reads a signed 64-bit/8-byte value from stream. + + + In order to get the correct byte order for this read operation, see + gio.DataInputStream.get_byte_order() + and + gio.DataInputStream.set_byte_order(). + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataInputStream.read_until + + + read_until + stop_chars + cancellableNone + + + + + stop_chars : + characters to terminate the read. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a string with the data that was read before encountering + any of the stop characters. This function will return NULL on an error. + + + + + + The read_until() reads a string from the data input + stream, up to the first occurrence of any of the stop characters. + + + + + gio.DataInputStream.read_until_async + + + read_until_async + stop_chars + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + stop_chars : + characters to terminate the read. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The read_until_async() method it's the asynchronous version of + gio.DataInputStream.read_until(). + It is an error to have two outstanding calls to this function. + + + For the synchronous version of this function, see + gio.DataInputStream.read_until(). + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set + + + When the operation is finished, callback will be called. You can then call + gio.DataInputStream.read_until_finish() + to get the result of the operation. + + + + + gio.DataInputStream.read_until_finish + + + read_until_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a string with the data that was read before encountering + any of the stop characters. This function will return None on an error. + + + + + + The read_until_finish() method finishes an asynchronous + file append operation started with + gio.DataInputStream.read_until_async(). + + + + + gio.DataInputStream.set_byte_order + + + set_byte_order + order + + + + + order : + a + to set. + + + + + + The set_byte_order() method sets the byte order for + the given stream. All subsequent reads from the stream will be read in the given order. + + + + + gio.DataInputStream.set_newline_type + + + set_newline_type + type + + + + + type : + a + to set. + + + + + + The set_newline_type() method sets the newline type for the stream. + + + Note that using gio.DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a + read chunk ends in "CR" we must read an additional byte to know if this is + "CR" or "CR LF", and this might block if there is no more data availible. + + + +
diff --git a/docs/reference/pygio-dataoutputstream.xml b/docs/reference/pygio-dataoutputstream.xml new file mode 100644 index 0000000..4cbc904 --- /dev/null +++ b/docs/reference/pygio-dataoutputstream.xml @@ -0,0 +1,504 @@ + + + + + + gio.DataOutputStream + Data Output Stream + + + + Synopsis + + + gio.DataOutputStream + gio.BufferedOutputStream + + + gio.DataOutputStream + base_stream + + + + get_byte_order + + + + put_byte + cancellableNone + + + put_int16 + cancellableNone + + + put_int32 + cancellableNone + + + put_int64 + cancellableNone + + + put_string + cancellableNone + + + put_uint16 + cancellableNone + + + put_uint32 + cancellableNone + + + put_uint64 + cancellableNone + + + set_byte_order + order + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.OutputStream + +-- gio.FilterOutputStream + +-- gio.BufferedOutputStream + +-- gio.DataOutputStream + + + + + + gio.DataOutputStream Properties + +
+ + + + + + + + "byte-order" + Read - Write + Determines the byte ordering that is used when writing + multi-byte entities (such as integers) to the stream. + Default value: gio.DATA_STREAM_BYTE_ORDER_BIG_ENDIAN. + + + + +
+ +
+ + + Description + + + gio.DataOutputStream + implements gio.InputStream + and includes functions for writing data directly to an output stream. + + + + + Constructor + + + gio.DataOutputStream + base_stream + + + + base_stream : + a + gio.OutputStream. + + + + Returns : + a new + gio.DataOutputStream + + + + + + Creates a new gio.DataOutputStream + from the given base_stream. + + + + + + Methods + + + gio.DataOutputStream.get_byte_order + + + get_byte_order + + + + + + Returns : + the stream's current + . + + + + + + The get_byte_order() method gets the byte + order for the stream. + + + + + gio.DataOutputStream.put_byte + + + put_byte + data + cancellableNone + + + + + data : + a char. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True if data was successfully added to the stream. + + + + + + The put_byte() method puts a byte into the output stream. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataOutputStream.put_int16 + + + put_int16 + data + cancellableNone + + + + + data : + a gint16. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True if data was successfully added to the stream. + + + + + + The put_int16() method puts a signed 16-bit integer into the output stream. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataOutputStream.put_int32 + + + put_int32 + data + cancellableNone + + + + + data : + a gint32. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True if data was successfully added to the stream. + + + + + + The put_int32() method puts a signed 32-bit integer into the output stream. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataOutputStream.put_int64 + + + put_int64 + data + cancellableNone + + + + + data : + a gint64. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True if data was successfully added to the stream. + + + + + + The put_int64() method puts a signed 64-bit integer into the output stream. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataOutputStream.put_string + + + put_string + str + cancellableNone + + + + + str : + a string. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True if string was successfully added to the stream. + + + + + + The put_string() method puts a string into the output stream. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataOutputStream.put_uint16 + + + put_uint16 + data + cancellableNone + + + + + data : + a guint16. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True if data was successfully added to the stream. + + + + + + The put_uint16() method puts an unsigned 16-bit integer into the output stream. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataOutputStream.put_uint32 + + + put_uint32 + data + cancellableNone + + + + + data : + a guint32. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True if data was successfully added to the stream. + + + + + + The put_uint32() method puts an unsigned 32-bit integer into the output stream. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataOutputStream.put_uint64 + + + put_uint64 + data + cancellableNone + + + + + data : + a guint64. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True if data was successfully added to the stream. + + + + + + The put_uint64() method puts an unsigned 64-bit integer into the output stream. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.DataOutputStream.set_byte_order + + + set_byte_order + order + + + + + order : + a + to set. + + + + + + The set_byte_order() method sets the byte order for + the given stream. All subsequent reads from the stream will be read in the given order. + + + +
diff --git a/docs/reference/pygio-drive.xml b/docs/reference/pygio-drive.xml new file mode 100644 index 0000000..73766cd --- /dev/null +++ b/docs/reference/pygio-drive.xml @@ -0,0 +1,546 @@ + + + + + + gio.Drive + Virtual File System drive management. + + + + Synopsis + + + gio.Drive + gobject.GInterface + + + can_eject + + + + can_poll_for_media + + + + eject + callback + flagsgio.MOUNT_UNMOUNT_NONE + cancellableNone + user_dataNone + + + eject_finish + result + + + enumerate_identifiers + + + + get_icon + + + + get_identifier + + + + get_name + + + + get_volumes + + + + has_media + + + + has_volumes + + + + is_media_check_automatic + + + + is_media_removable + + + + poll_for_media + callback + cancellableNone + user_dataNone + + + poll_for_media_finish + result + + + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.Drive + + + + + + Prerequisites + + gio.Drive requires + gobject.GObject + + + + + Description + + + gio.Drive + - this represent a piece of hardware connected to the machine. Its generally + only created for removable hardware or hardware with removable media. + + + gio.Drive + is a container class for GVolume objects that stem from the same piece of media. + As such, gio.Drive + abstracts a drive with (or without) removable media and provides operations for + querying whether media is available, determing whether media change is automatically + detected and ejecting the media. + + + If the gio.Drive + reports that media isn't automatically detected, one can poll for media; typically + one should not do this periodically as a poll for media operation is potententially + expensive and may spin up the drive creating noise. + + + For porting from GnomeVFS note that there is no equivalent of + gio.Drive + in that API. + + + + + Methods + + + gio.Drive.can_eject + + + can_eject + + + + + + Returns : + True if the drive can be ejected, + False otherwise. + + + + + + The can_eject() method checks if a drive can be ejected. + + + + + gio.Drive.can_poll_for_media + + + can_poll_for_media + + + + + + Returns : + True if the drive can be polled + for media changes, False otherwise. + + + + + + The can_poll_for_media() method checks if a drive + can be polled for media changes. + + + + + gio.Drive.eject + + + eject + + callback + + + flagsgio.MOUNT_UNMOUNT_NONE + + + cancellableNone + + + user_dataNone + + + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + flags affecting the unmount if required for eject. + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The eject() method asynchronously ejects a drive. + + + When the operation is finished, callback will be called. You can then call + gio.Drive.eject_finish() + to obtain the result of the operation. + + + + + gio.Drive.eject_finish + + + eject_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the drive has been ejected + successfully, False otherwise. + + + + + + The eject_finish() method finishes ejecting a drive. + + + + + gio.Drive.enumerate_identifiers + + + enumerate_identifiers + + + + + + Returns : + a list of strings containing kinds of identifiers. + + + + + + The enumerate_identifiers() method gets the kinds + of identifiers that drive has. Use + gio.Drive.get_identifier() + to obtain the identifiers themselves. + + + + + gio.Drive.get_icon + + + get_icon + + + + + + Returns : + gio.Icon + for the drive. + + + + + + The get_icon() method gets the icon for drive. + + + + + gio.Drive.get_identifier + + + get_identifier + + + + + + Returns : + A string containing the requested identfier, or + None if the + gio.Drive + doesn't have this kind of identifier. + + + + + + The get_identifier() method gets the identifier of + the given kind for drive. + + + + + gio.Drive.get_name + + + get_name + + + + + + Returns : + A string containing drive's name. + + + + + + The get_name() method gets the name of drive. + + + + + gio.Drive.get_volumes + + + get_volumes + + + + + + Returns : + A list containing any + gio.Volume + objects on the given drive. + + + + + + The get_volumes() method get a list of mountable + volumes for drive. + + + + + gio.Drive.has_media + + + has_media + + + + + + Returns : + True if drive has media, + False otherwise. + + + + + The has_media() method checks if the drive + has media. Note that the OS may not be polling the drive for media changes; see + gio.Drive.is_media_check_automatic() + for more details. + + + + + gio.Drive.has_volumes + + + has_volumes + + + + + + Returns : + True if drive contains volumes, + False otherwise. + + + + + The has_volumes() method check if drive has any mountable volumes. + + + + + gio.Drive.is_media_check_automatic + + + is_media_check_automatic + + + + + + Returns : + True if drive is capabable + of automatically detecting media changes, + False otherwise. + + + + + The is_media_check_automatic() method checks if + drive is capabable of automatically detecting media changes. + + + + + gio.Drive.is_media_removable + + + is_media_removable + + + + + + Returns : + True if drive supports removable media, + False otherwise. + + + + + The is_media_removable() method checks if the + drive supports removable media. + + + + + gio.Drive.poll_for_media + + + poll_for_media + + callback + + + cancellableNone + + + user_dataNone + + + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The poll_for_media() method asynchronously polls + drive to see if media has been inserted or removed. + + + When the operation is finished, callback will be called. You can then call + gio.Drive.poll_for_media_finish() + to obtain the result of the operation. + + + + + gio.Drive.poll_for_media_finish + + + poll_for_media_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the drive has been poll_for_mediaed + successfully, False otherwise. + + + + + + The poll_for_media_finish() method finishes + an operation started with + gio.Drive.poll_for_media() + on a drive. + + + + diff --git a/docs/reference/pygio-emblem.xml b/docs/reference/pygio-emblem.xml new file mode 100644 index 0000000..032b0ff --- /dev/null +++ b/docs/reference/pygio-emblem.xml @@ -0,0 +1,232 @@ + + + + + + gio.Emblem + An object for emblems. + + + + Synopsis + + + gio.Emblem + gobject.GObject + gio.Icon + + + gio.Emblem + icon + origingio.EMBLEM_ORIGIN_UNKNOWN + + + + get_icon + + + + get_origin + + + + + + +Functions + + + gio.emblem_new_with_origin + icon + origin + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.Emblem + + + + + + Implemented Interfaces + + gio.Emblem + implements + gio.Icon + + + + + gio.Emblem Properties + +
+ + + + + + + + "icon" + Read - Write - Construct Only + The actual icon of the emblem. + + + "origin" + Read - Write - Construct Only + Tells which origin the emblem is derived from. + + + + +
+ +
+ + + Description + + + The gio.Emblem + class is an implementation of gio.Icon + that supports having an emblem, which is an icon with additional properties. + It can then be added to a + gio.EmblemedIcon. + + + Currently, only metainformation about the emblem's origin is supported. + More may be added in the future. + + + + + Constructor + + + gio.Emblem + icon + origingio.EMBLEM_ORIGIN_UNKNOWN + + + + icon : + a + gio.Icon containing the icon. + + + + origin : + + origin of the emblem. + + + + Returns : + a new + gio.Emblem. + + + + + + Parameter origin is available since PyGObject 2.20. + + + + Creates a new gio.Emblem for icon. + + + + + + Methods + + + gio.Emblem.get_icon + + + get_icon + + + + + + Returns : + a + gio.Icon. + + + + + + The get_icon() method gives back the icon from emblem. + + + + + gio.Emblem.get_origin + + + get_origin + + + + + + Returns : + the origin of the emblem. + + + + + + The get_origin() method gets the origin of the emblem. + + + + + + Functions + + + gio.emblem_new_with_origin + + + emblem_new_with_origin + icon + origin + + + + + origin : + a + defining the emblem's origin. + + + + Returns : + A gio.Emblem. + + + + + + While this method is not deprecated, with 2.20 and up it is recommended + to use the constructor instead. + + + + + The emblem_new_with_origin() function creates + a new emblem for icon. + + + +
diff --git a/docs/reference/pygio-emblemedicon.xml b/docs/reference/pygio-emblemedicon.xml new file mode 100644 index 0000000..9b5ef8a --- /dev/null +++ b/docs/reference/pygio-emblemedicon.xml @@ -0,0 +1,160 @@ + + + + + + gio.EmblemedIcon + Icon with emblems. + + + + Synopsis + + + gio.EmblemedIcon + gobject.GObject + gio.Icon + + + gio.EmblemedIcon + icon + emblem + + + + + add_emblem + emblem + + + get_icon + + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.EmblemedIcon + + + + + + Implemented Interfaces + + gio.EmblemedIcon + implements + gio.Icon + + + + + Description + + + The gio.EmblemedIcon + class is an implementation of gio.Icon + that supports adding an emblem to an icon. Adding multiple emblems to an icon is ensured via + gio.EmblemedIcon.add_emblem(). + + + Note that + gio.EmblemedIcon + allows no control over the position of the emblems. See also + gio.Emblem + for more information. + + + + + Constructor + + + gio.EmblemedIcon + icon + emblem + + + + icon : + a + gio.Icon. + + + + emblem : + a + gio.Emblem. + + + + Returns : + a new + gio.Icon. + + + + + + Creates a new gio.Icon + for icon with the emblem emblem. + + + + + + Methods + + + gio.EmblemedIcon.add_emblem + + + add_emblem + emblem + + + + + emblem : + a + gio.Emblem + + + + + + The add_emblem() method adds emblem to the + list of gio.Emblems. + + + + + gio.EmblemedIcon.get_icon + + + get_icon + + + + + + Returns : + a + gio.Icon + that is owned by emblemed. + + + + + + The get_icon() method gets the main icon for emblemed. + + + + diff --git a/docs/reference/pygio-file.xml b/docs/reference/pygio-file.xml new file mode 100644 index 0000000..ac85840 --- /dev/null +++ b/docs/reference/pygio-file.xml @@ -0,0 +1,4534 @@ + + + + + + gio.File + File and Directory Handling. + + + + Synopsis + + + gio.File + gobject.GInterface + + + gio.File + commandline + pathNone + uriNone + + + + append_to + flagsgio.FILE_CREATE_NONE + cancellableNone + + + append_to_async + callback + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + append_to_finish + result + + + copy + destination + progress_callback + flagsgio.FILE_COPY_NONE + cancellableNone + user_dataNone + + + copy_async + destination + callback + progress_callbackNone + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + progress_callback_dataNone + + + copy_attributes + destination + flagsgio.FILE_COPY_NONE + cancellableNone + + + copy_finish + result + + + create + flagsgio.FILE_CREATE_NONE + cancellableNone + + + create_async + callback + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + create_finish + result + + + delete + cancellableNone + + + dup + + + + eject_mountable + callback + flagsgio.FILE_CREATE_NONE + cancellableNone + user_dataNone + + + eject_mountable_finish + result + + + enumerate_children + attributes + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + enumerate_children_async + attributes + callback + flagsgio.FILE_QUERY_INFO_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + enumerate_children_finish + result + + + equal + file2 + + + find_enclosing_mount + cancellable + + + find_enclosing_mount_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + find_enclosing_mount_finish + result + + + get_basename + + + + get_child + name + + + get_child_for_display_name + display_name + + + get_parent + + + + get_parse_name + + + + get_path + + + + get_relative_path + descendant + + + get_uri + + + + get_uri_scheme + + + + has_prefix + prefix + + + has_uri_scheme + uri_scheme + + + is_native + + + + load_contents + cancellable + + + load_contents_async + callback + cancellableNone + user_dataNone + + + load_contents_finish + result + + + make_directory + cancellableNone + + + make_directory_with_parents + cancellableNone + + + make_symbolic_link + symlink_value + cancellable + + + monitor + flagsgio.FILE_MONITOR_NONE + cancellableNone + + + monitor_directory + flags + cancellableNone + + + monitor_file + flags + cancellableNone + + + mount_enclosing_volume + mount_operation + callback + flagsgio.MOUNT_MOUNT_NONE + cancellableNone + user_dataNone + + + mount_enclosing_volume_finish + result + + + mount_mountable + mount_operation + callback + flagsgio.MOUNT_MOUNT_NONE + cancellableNone + user_dataNone + + + mount_mountable_finish + result + + + move + destination + progress_callback + flagsgio.FILE_COPY_NONE + cancellableNone + user_dataNone + + + query_default_handler + cancellable + + + query_exists + cancellable + + + query_file_type + flags + cancellable + + + query_filesystem_info + attributes + cancellable + + + query_filesystem_info_async + attributes + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + query_filesystem_info_finish + result + + + query_info + attributes + flags + cancellable + + + query_info_async + attributes + callback + flagsgio.FILE_QUERY_INFO_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + query_info_finish + result + + + query_settable_attributes + cancellableNone + + + query_writable_namespace + cancellableNone + + + read + cancellableNone + + + read_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + read_finish + resultNone + + + replace + etag + make_backup + flagsgio.FILE_CREATE_NONE + cancellableNone + + + replace_async + callback + etagNone + make_backupTrue + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + replace_contents + contents + etagNone + make_backupTrue + flagsgio.FILE_CREATE_NONE + cancellableNone + + + replace_contents_async + contents + callback + etagNone + make_backupTrue + flagsgio.FILE_CREATE_NONE + cancellableNone + user_dataNone + + + replace_contents_finish + resultNone + + + replace_finish + resultNone + + + resolve_relative_path + relative_path + + + set_attribute + attribute + type + value_p + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + set_attribute_byte_string + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + set_attribute_int32 + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + set_attribute_int64 + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + set_attribute_string + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + set_attribute_uint32 + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + set_attribute_uint64 + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + set_attributes_async + info + callback + flagsgio.FILE_QUERY_INFO_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + set_attributes_finish + result + + + set_attributes_from_info + info + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + set_dispay_name + display_name + cancellableNone + + + set_display_name_async + display_name + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + set_display_name_finish + result + + + trash + cancellableNone + + + unmount_mountable + callback + flagsgio.MOUNT_UNMOUNT_NONE + cancellableNone + user_dataNone + + + unmount_mountable_finish + cancellableNone + + + + + +Functions + + gio.file_parse_name + parse_name + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.File + + + + + + Prerequisites + + gio.File is implemented by + gobject.GObject + + + + + Description + + + gio.File is a high + level abstraction for manipulating files on a virtual file system. + gio.Files are lightweight, + immutable objects that do no I/O upon creation. It is necessary to understand that + gio.File + objects do not represent files, merely an identifier for a file. All file content + I/O is implemented as streaming operations (see + gio.InputStream and + gio.OutputStream). + + + To construct a gio.File, you can use + it's constructor either with a path, an uri or a commandline argument. + gio.file_parse_name() + from a utf8 string gotten from + gio.File.get_parse_name(). + + + One way to think of a gio.File is as + an abstraction of a pathname. For normal files the system pathname is what is stored internally, + but as gio.Files are extensible it + could also be something else that corresponds to a pathname in a userspace implementation of a filesystem. + + + gio.Files make up hierarchies of + directories and files that correspond to the files on a filesystem. You can move through the + file system with GFile using + gio.File.get_parent() + to get an identifier for the parent directory, + gio.File.get_child() + to get a child within a directory, + gio.File.resolve_relative_path() + to resolve a relative path between two gio.Files. + There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call + gio.File.get_parent() + on two different files. + + + All gio.Files have a basename (get with + gio.File.get_basename() + ). These names are byte strings that are used to identify the file on the filesystem + (relative to its parent directory) and there is no guarantees that they have any particular charset + encoding or even make any sense at all. If you want to use filenames in a user interface you should + use the display name that you can get by requesting the gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with + gio.File.query_info(). + This is guaranteed to be in utf8 and can be used in a user interface. But always store the real basename or the + GFile to use to actually access the file, because there is no way to go from a display name to the actual name. + + + Using gio.File as an identifier has the same + weaknesses as using a path in that there may be multiple aliases for the same file. For instance, + hard or soft links may cause two different gio.Files + to refer to the same file. Other possible causes for aliases are: case insensitive filesystems, short and + long names on Fat/NTFS, or bind mounts in Linux. If you want to check if two GFiles point to the same file + you can query for the gio.FILE_ATTRIBUTE_ID_FILE attribute. Note that + gio.File does some trivial canonicalization + of pathnames passed in, so that trivial differences in the path string used at creation + (duplicated slashes, slash at end of path, "." or ".." path segments, etc) does not create different + gio.Files. + + + Many gio.File operations have both synchronous + and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply + have _async() appended to their function names. The asynchronous I/O functions call a + GAsyncReadyCallback which is then used to finalize the operation, producing a GAsyncResult + which is then passed to the function's matching _finish() operation. + + + Some gio.File operations do not have + synchronous analogs, as they may take a very long time to finish, and blocking may leave an application + unusable. Notable cases include: + gio.File.mount_mountable() + to mount a mountable file. + gio.File.unmount_mountable() + to unmount a mountable file. + gio.File.eject_mountable() + to eject a mountable file. + + + One notable feature of gio.Files are + entity tags, or "etags" for short. Entity tags are somewhat like a more abstract + version of the traditional mtime, and can be used to quickly determine if the file + has been modified from the version on the file system. See the HTTP 1.1 + specification for HTTP Etag headers, which are a very similar concept. + + + + + Constructor + + + gio.File + commandline + pathNone + uriNone + + + + commandline : + a command line string. + + + + path : + a string containing a relative or absolute path. + + + + uri : + a string containing a URI. + + + + Returns : + a new + gio.File. + + + + + + Creates a new gio.File either from a commandline, + a path or an uri. + + + + + + Methods + + + gio.File.append_to + + + append_to + flagsgio.FILE_CREATE_NONE + cancellableNone + + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a + gio.FileOutputStream + or None on error. + + + + + + The append_to() method gets an output stream for + appending data to the file. If the file doesn't already exist it is created. + + + By default files created are generally readable by everyone, but if you pass + gio.FILE_CREATE_PRIVATE in flags the file will be made readable only to the + current user, to the level that is supported on the target filesystem. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If + the operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + Some file systems don't allow all file names, and may return an + gio.ERROR_INVALID_FILENAME error. If the file is a directory the + gio.ERROR_IS_DIRECTORY error will be returned. Other errors are possible too, + and depend on what kind of filesystem the file is on. + + + + + gio.File.append_to_async + + + append_to_async + callback + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + a set of + . + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The append_to_async() method asynchronously opens file for appending. + + + For more details, see + gio.File.append_to() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.append_to_finish() + to get the result of the operation. + + + + + gio.File.append_to_finish + + + append_to_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a valid + gio.OutputStream + or None on error. + + + + + + The append_to_finish() method finishes an asynchronous + file append operation started with + gio.File.append_to_async(). + + + + + gio.File.copy + + + copy + destination + progress_callback + flagsgio.FILE_COPY_NONE + cancellableNone + user_dataNone + + + + + destination : + destination gio.File. + + + + progress_callback : + function to callback with progress information. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to the progress callback function. + + + + Returns : + True on success, + False otherwise. + + + + + + The copy() method copies the file source to + the location specified by destination. Can not handle recursive copies of directories. + + + If the flag gio.FILE_COPY_OVERWRITE is specified an already existing + destination file is overwritten. + + + If the flag gio.FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will + be copied as symlinks, otherwise the target of the source symlink will be copied. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + If progress_callback is not None, then the operation can be + monitored by setting this to a GFileProgressCallback function. user_data + will be passed to this function. It is guaranteed that this callback will be + called after all data has been transferred with the total number of bytes + copied during the operation. + + + If the source file does not exist then the gio.ERROR_NOT_FOUND error is returned, + independent on the status of the destination. + + + If gio.FILE_COPY_OVERWRITE is not specified and the target exists, + then the error gio.ERROR_EXISTS is returned. + + + If trying to overwrite a file over a directory the gio.ERROR_IS_DIRECTORY error + is returned. If trying to overwrite a directory with a directory the + gio.ERROR_WOULD_MERGE error is returned. + + + If the source is a directory and the target does not exist, or gio.FILE_COPY_OVERWRITE + is specified and the target is a file, then the gio.ERROR_WOULD_RECURSE error is returned. + + + If you are interested in copying the + gio.File object + itself (not the on-disk file), see + gio.File.dup(). + + + + + gio.File.copy_async + + + append_to_async + destination + callback + progress_callbackNone + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + progress_callback_dataNone + + + + + destination : + destination gio.File. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + progress_callback : + function to callback with progress information. + + + + flags : + a set of + . + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + progress_callback_data : + the data to pass to the progress callback function. + + + + + + The copy_async() method copies the file source to + the location specified by destination asynchronously. For details of the behaviour, + see gio.File.copy(). + + + If progress_callback is not None, then that function that will + be called just like in + gio.File.copy(), + however the callback will run in the main loop, not in the thread that is doing the I/O operation. + + + When the operation is finished, callback will be called. You can then call + gio.File.copy_finish() + to get the result of the operation. + + + + + gio.File.copy_attributes + + + copy_attributes + destination + flagsgio.FILE_COPY_NONE + cancellableNone + + + + + destination : + destination gio.File + to copy attributes to. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attributes were copied successfully, + False otherwise. + + + + + + The copy_attributes() method copies the file attributes + from source to destination. + + + Normally only a subset of the file attributes are copied, those that are copies + in a normal file copy operation (which for instance does not include e.g. owner). + However if gio.FILE_COPY_ALL_METADATA is specified in flags, then all the metadata + that is possible to copy is copied. This is useful when implementing move by copy + delete source. + + + + + gio.File.copy_finish + + + copy_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True on success, + False on error. + + + + + + The copy_finish() method finishes an asynchronous + copy operation started with + gio.File.copy_async(). + + + + + gio.File.create + + + create + flagsgio.FILE_CREATE_NONE + cancellableNone + + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a + gio.FileOutputStream + or None on error. + + + + + + The create() method creates a new file and returns + an output stream for writing to it. The file must not already exist. + + + By default files created are generally readable by everyone, but if you pass + gio.FILE_CREATE_PRIVATE in flags the file will be made readable only to the + current user, to the level that is supported on the target filesystem. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + If a file or directory with this name already exists the gio.ERROR_EXISTS + error will be returned. Some file systems don't allow all file names, and + may return an gio.ERROR_INVALID_FILENAME error, and if the name is to long + gio.ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, + and depend on what kind of filesystem the file is on. + + + + + gio.File.create_async + + + create_async + callback + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + a set of + . + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The create_async() method asynchronously creates a new + file and returns an output stream for writing to it. The file must not already exist. + + + For more details, see + gio.File.create() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.create_finish() + to get the result of the operation. + + + + + gio.File.create_finish + + + create_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a + gio.FileOutputStream + or None on error. + + + + + + The create_finish() method finishes an asynchronous + copy operation started with + gio.File.create_async(). + + + + + gio.File.delete + + + delete + cancellable + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the file was deleted, + False otherwise. + + + + + + The deleted() method deletes a file. If the file is a + directory, it will only be deleted if it is empty. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.dup + + + dup + + + + + + Returns : + a new gio.File + that is a duplicate of the given gio.File. + + + + + + The dup() method duplicates a + gio.File + handle. This operation does not duplicate the actual file or directory represented + by the gio.File; see + gio.File.copy() + if attempting to copy a file. + + + This call does no blocking i/o. + + + + + gio.File.eject_mountable + + + eject_mountable + callback + flagsgio.FILE_CREATE_NONE + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + a set of + . + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The eject_mountable() method starts an asynchronous eject on a + mountable. When this operation has completed, callback will be called with + user_user data, and the operation can be finalized with + gio.File.eject_mountable_finish(). + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.eject_mountable_finish + + + eject_mountable_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the file was ejected successfully, + False on error. + + + + + + The create_finish() method finishes an asynchronous + copy operation started with + gio.File.create_async(). + + + + + gio.File.enumerate_children + + + enumerate_children + attributes + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attributes : + an attribute query string. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a + gio.FileEnumerator + or None on error. + + + + + + The enumerate_children() method gets the requested information + about the files in a directory. The result is a GFileEnumerator object that will give out + gio.FileInfo objects + for all the files in the directory. + + + The attribute value is a string that specifies the file attributes that should be gathered. + It is not an error if it's not possible to read a particular requested attribute from a file - + it just won't be set. attribute should be a comma-separated list of attribute or attribute + wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all + attributes in the standard namespace. An example attribute query be "standard::*,owner::user". + The standard attributes are available as defines, like gio.FILE_ATTRIBUTE_STANDARD_NAME. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + If the file does not exist, the gio.ERROR_NOT_FOUND error will be returned. If the file + is not a directory, the gio.FILE_ERROR_NOTDIR error will be returned. + Other errors are possible too. + + + + + gio.File.enumerate_children_async + + + enumerate_children_async + attributes + callback + flagsgio.FILE_QUERY_INFO_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + attributes : + an attribute query string. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + a set of + . + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The enumerate_children_async() method asynchronously gets the + requested information about the files in a directory. The result is a + gio.FileEnumerator + object that will give out gio.FileInfo + objects for all the files in the directory. + + + For more details, see + enumerate_children() + which is the synchronous version of this call. + + + + + gio.File.eject_mountable_finish + + + enumerate_children_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.FileEnumerator + or None if an error occurred. + + + + + + The enumerate_children_finish() method finishes an asynchronous + copy operation started with + gio.File.enumerate_children_async(). + + + + + gio.File.equal + + + equal + file2 + + + + + file2 : + a gio.File. + + + + Returns : + True if file1 and file2 are equal. + False if either is not a + gio.File. + + + + + + The equal() method checks equality of two given + gio.Files. + Note that two gio.Files + that differ can still refer to the same file on the filesystem due to various + forms of filename aliasing. + + + This call does no blocking i/o. + + + + + gio.File.find_enclosing_mount + + + enumerate_children + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a + gio.Mount + or None on error. + + + + + + The find_enclosing_mount() method gets a + gio.Mount for the + gio.File. + + + If the interface for file does not have a mount (e.g. possibly a remote share), + error will be set to gio.ERROR_NOT_FOUND and None will be returned. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.find_enclosing_mount_async + + + find_enclosing_mount_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The find_enclosing_mount_async() method asynchronously + gets the mount for the file. + + + For more details, see + gio.File.find_enclosing_mount() + which is the synchronous version of this call. + + + + + gio.File.find_enclosing_mount_finish + + + find_enclosing_mount_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.Mount + or None if an error occurred. + + + + + + The find_enclosing_mount_finish() method finishes an asynchronous + find mount started with + gio.File.find_enclosing_mount_async(). + + + + + gio.File.get_basename + + + get_basename + + + + + + Returns : + string containing the + gio.File's + base name, or None if given + gio.File is invalid. + + + + + + The get_basename() method gets the base name + (the last component of the path) for a given + gio.File. + + + If called for the top level of a system (such as the filesystem root or + a uri like sftp://host/) it will return a single directory separator + (and on Windows, possibly a drive letter). + + + The base name is a byte string (*not* UTF-8). It has no defined encoding + or rules other than it may not contain zero bytes. If you want to use filenames + in a user interface you should use the display name that you can get by requesting + the gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with + gio.File.query_info(). + + + This call does no blocking i/o. + + + + + gio.File.get_child + + + get_child + name + + + + + name : + string containing the child's basename. + + + + Returns : + a + gio.File + to a child specified by name. + + + + + + The get_child() method gets a child of file + with basename equal to name. + + + Note that the file with that specific name might not exist, but you can + still have a gio.File + that points to it. You can use this for instance to create that file. + + + This call does no blocking i/o. + + + + + gio.File.get_child_for_display_name + + + get_child_for_display_name + display_name + + + + + display_name : + string to a possible child. + + + + Returns : + a + gio.File + to the specified child or None + if the display name couldn't be converted. + + + + + + The get_child_for_display_name() method gets the + child of file for a given display_name (i.e. a UTF8 version of the name). + If this function fails, it returns NULL and error will be set. This is very + useful when constructing a GFile for a new file and the user entered the filename + in the user interface, for instance when you select a directory and type a filename + in the file selector. + + + This call does no blocking i/o. + + + + + gio.File.get_parent + + + get_parent + + + + + + Returns : + a + gio.File + structure to the parent of the given + gio.File or + None if there is no parent. + + + + + + The get_parent() method gets the parent directory for the file. + If the file represents the root directory of the file system, then None + will be returned. + + + This call does no blocking i/o. + + + + + gio.File.get_parse_name + + + get_parse_name + + + + + + Returns : + a string containing the + gio.File's parse name. + + + + + + The get_parse_name() method gets the parse name + of the file. A parse name is a UTF-8 string that describes the file such + that one can get the gio.File + back using + gio.file_parse_name(). + + + This is generally used to show the gio.File + as a nice full-pathname kind of string in a user interface, like in a location entry. + + + For local files with names that can safely be converted to UTF8 the pathname is used, + otherwise the IRI is used (a form of URI that allows UTF8 characters unescaped). + + + This call does no blocking i/o. + + + + + gio.File.get_path + + + get_path + + + + + + Returns : + a string containing the + gio.File's path, + or None if no such path exists. + + + + + + The get_path() method gets the local pathname for + gio.File, if one exists. + + + This call does no blocking i/o. + + + + + gio.File.get_relative_path + + + get_relative_path + descendant + + + + + descendant : + input gio.File. + + + + Returns : + string with the relative path from descendant to parent, + or None if descendant doesn't have parent as prefix. + + + + + + The get_relative_path() method gets the path for + descendant relative to parent. + + + This call does no blocking i/o. + + + + + gio.File.get_uri + + + get_uri + + + + + + Returns : + a string containing the + gio.File's URI. + + + + + + The get_uri() method gets the URI for the file. + + + This call does no blocking i/o. + + + + + gio.File.get_uri_scheme + + + get_uri_scheme + + + + + + Returns : + a string containing the URI scheme for the + gio.File. + + + + + + The get_uri_scheme() method gets the URI scheme for a + gio.File. + RFC 3986 decodes the scheme as: + + +URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] + + + Common schemes include "file", "http", "ftp", etc. + + + This call does no blocking i/o. + + + + + gio.File.has_prefix + + + has_prefix + prefix + + + + + prefix : + input gio.File. + + + + Returns : + True if the files's parent, grandparent, + etc is prefix. False otherwise. + + + + + + The has_prefix() method checks whether file has the prefix + specified by prefix. In other word, if the names of inital elements of files pathname + match prefix. Only full pathname elements are matched, so a path like /foo is not + considered a prefix of /foobar, only of /foo/bar. + + + This call does no blocking i/o, as it works purely on names. As such it can sometimes + return False even if file is inside a prefix (from a filesystem point + of view), because the prefix of file is an alias of prefix. + + + + + gio.File.has_uri_scheme + + + has_uri_scheme + uri_scheme + + + + + uri_scheme : + a string containing a URI scheme. + + + + Returns : + True if + gio.File's + backend supports the given URI scheme, False if URI scheme + is None, not supported, or + gio.File is invalid. + + + + + + The has_uri_scheme() method checks to see if a + gio.File + has a given URI scheme. + + + This call does no blocking i/o. + + + + + gio.File.is_native + + + is_native + + + + + + Returns : + True if file is native. + + + + + + The is_native() method checks to see if a file + is native to the platform. + + + A native file s one expressed in the platform-native filename format, e.g. + "C:\Windows" or "/usr/bin/". This does not mean the file is local, as it + might be on a locally mounted remote filesystem. + + + On some systems non-native files may be available using the native filesystem + via a userspace filesystem (FUSE), in these cases this call will return + False, but + gio.File.get_path() + will still return a native path. + + + This call does no blocking i/o. + + + + + gio.File.load_contents + + + load_contents + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a three tuple containing the contents of the file, + the length of the contents of the file and the current entity tag for the file. + + + + + + The load_contents() method loads the content of the file into memory. + The data is always zero-terminated, but this is not included in the resultant length. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.load_contents_async + + + load_contents_async + callback + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The load_contents_async() method starts an asynchronous load of the file's contents. + + + For more details, see + gio.File.load_contents() + which is the synchronous version of this call. + + + When the load operation has completed, callback will be called with user data. To finish + the operation, call + gio.File.load_contents_finish() + with the GAsyncResult returned by the callback. + + + + + gio.File.load_contents_finish + + + load_contents_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a three tuple containing the contents of the file, + the length of the contents of the file and the current entity tag for the file. + + + + + + The load_contents_finish() method finishes an asynchronous + find mount started with + gio.File.load_contents_async(). + + + + + gio.File.make_directory + + + make_directory + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True on successful creation, + False otherwise. + + + + + + The make_directory() method creates a directory. + Note that this will only create a child directory of the immediate parent directory + of the path or URI given by the gio.File. + To recursively create directories, see + gio.File.make_directory_with_parents(). + This function will fail if the parent directory does not exist, setting error to + gio.ERROR_NOT_FOUND. If the file system doesn't support creating directories, this + function will fail, setting error to gio.ERROR_NOT_SUPPORTED. + + + For a local gio.File the newly + created directory will have the default (current) ownership and permissions of the current process. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.make_directory_with_parents + + + make_directory_with_parents + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if all directories have been successfully created, + False otherwise. + + + + + + The make_directory_with_parents() method creates a directory + and any parent directories that may not exist similar to 'mkdir -p'. If the file system + does not support creating directories, this function will fail, setting error to gio.ERROR_NOT_SUPPORTED. + + + For a local gio.File the newly + created directories will have the default (current) ownership and permissions of the current process. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.make_symbolic_link + + + make_symbolic_link + symlink_value + cancellableNone + + + + + symlink_value : + a string with the value of the new symlink. + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True on the creation of a new symlink, + False otherwise. + + + + + + The make_symbolic_link() method creates a symbolic link. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.monitor + + + monitor + flagsgio.FILE_MONITOR_NONE + cancellableNone + + + + + flags : + + a + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a gio.FileMonitor + for the given file, or None on error + + + + + + The monitor() method obtains a file or directory + monitor for the given file, depending on the type of the file. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.monitor_directory + + + monitor_directory + flagsgio.FILE_MONITOR_NONE + cancellableNone + + + + + flags : + + a + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a gio.FileMonitor + for the given file, or None on error + + + + + + The monitor_directory() method obtains a directory monitor + for the given file. This may fail if directory monitoring is not supported. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.monitor_file + + + monitor_file + flagsgio.FILE_MONITOR_NONE + cancellableNone + + + + + flags : + + a + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a gio.FileMonitor + for the given file, or None on error + + + + + + The monitor_file() method obtains a file monitor for the + given file. If no file notification mechanism exists, then regular polling + of the file is used. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.mount_enclosing_volume + + + mount_enclosing_volume + mount_operation + callback + flagsgio.FILE_COPY_NONE + cancellableNone + user_dataNone + + + + + mount_operation : + a + gio.MountOperation + or None to avoid user interaction. + + + + callback : + a GAsyncReadyCallback to call when the request + is satisfied, or None. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to the progress callback function. + + + + + + The mount_enclosing_volume() method starts a mount_operation, + mounting the volume that contains the file location. + + + When this operation has completed, callback will be called with user_user data, + and the operation can be finalized with + gio.File.mount_enclosing_volume_finish(). + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.mount_enclosing_volume_finish + + + mount_enclosing_volume_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if successful. If an error has occurred, + this function will return False and set error appropriately if present. + + + + + + The mount_enclosing_volume_finish() method finishes an asynchronous + find mount started with + gio.File.mount_enclosing_volume(). + + + + + gio.File.mount_mountable + + + mount_mountable + mount_operation + callback + flagsgio.FILE_COPY_NONE + cancellableNone + user_dataNone + + + + + mount_operation : + a + gio.MountOperation + or None to avoid user interaction. + + + + callback : + a GAsyncReadyCallback to call when the request + is satisfied, or None. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to the progress callback function. + + + + + + The mount_mountable() method mounts a file of type + gio.FILE_TYPE_MOUNTABLE. Using mount_operation, you can request callbacks when, + for instance, passwords are needed during authentication. + + + When this operation has completed, callback will be called with user_user data, + and the operation can be finalized with + gio.File.mount_mountable_finish(). + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.mount_mountable_finish + + + mount_mountable_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.File + or None on error. + + + + + + The mount_mountable_finish() method finishes an asynchronous + find mount started with + gio.File.mount_mountable(). + + + + + gio.File.move + + + copy + destination + progress_callback + flagsgio.FILE_COPY_NONE + cancellableNone + user_dataNone + + + + + destination : + destination gio.File. + + + + progress_callback : + function to callback with progress information. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to the progress callback function. + + + + Returns : + True on success, + False otherwise. + + + + + + The move() method tries to move the file or directory + source to the location specified by destination. If native move operations are + supported then this is used, otherwise a copy + delete fallback is used. The native + implementation may support moving directories (for instance on moves inside the same + filesystem), but the fallback code does not. + + + If the flag gio.FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. + + + If the flag gio.FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied + as symlinks, otherwise the target of the source symlink will be copied. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + If progress_callback is not None, then the operation can be monitored + by setting this to a GFileProgressCallback function. progress_callback_data will be passed + to this function. It is guaranteed that this callback will be called after all data has been + transferred with the total number of bytes copied during the operation. + + + If the source file does not exist then the gio.ERROR_NOT_FOUND error is returned, + independent on the status of the destination. + + + If gio.FILE_COPY_OVERWRITE is not specified and the target exists, then the error + gio.ERROR_EXISTS is returned. + + + If trying to overwrite a file over a directory the gio.ERROR_IS_DIRECTORY error is returned. + If trying to overwrite a directory with a directory the gio.ERROR_WOULD_MERGE error is returned. + + + If the source is a directory and the target does not exist, or gio.FILE_COPY_OVERWRITE is specified + and the target is a file, then the gio.ERROR_WOULD_RECURSE error may be returned + (if the native move operation isn't available). + + + + + gio.File.query_default_handler + + + query_default_handler + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a gio.AppInfo + if the handle was found, None if there were errors. + + + + + + The query_default_handler() method returns the + gio.AppInfo that + is registered as the default application to handle the file specified by file. + + + If cancellable is not None, then the operation can be + cancelled by triggering the cancellable object from another thread. If the + operation was cancelled, the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.query_exists + + + query_exists + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the file exists (and can be detected + without error), False otherwise (or if cancelled). + + + + + + The query_exists() method is an tility function to check + if a particular file exists. This is implemented using + gio.File.query_info() + and as such does blocking I/O. + + + Note that in many cases it is racy to first check for file existence and then execute + something based on the outcome of that, because the file might have been created or + removed in between the operations. The general approach to handling that is to not check, + but just do the operation and handle the errors as they come. + + + As an example of race-free checking, take the case of reading a file, and if it doesn't + exist, creating it. There are two racy versions: read it, and on error create it; and: + check if it exists, if not create it. These can both result in two processes creating the + file (with perhaps a partially written file as the result). The correct approach is to + always try to create the file with + gio.File.create() + which will either atomically create the file or fail with a gio.ERROR_EXISTS error. + + + However, in many cases an existence check is useful in a user interface, for instance + to make a menu item sensitive/insensitive, so that you don't have to fool users that + something is possible and then just show and error dialog. If you do this, you should + make sure to also handle the errors that can happen due to races when you execute the operation. + + + + + gio.File.query_file_type + + + query_file_type + flagsgio.FILE_MONITOR_NONE + cancellableNone + + + + + flags : + + a + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + + + + + + + + The query_file_type() method it's an utility function to inspect + the + of a file. This is implemented using + gio.File.query_info() + and as such does blocking I/O. + + + The primary use case of this method is to check if a file is a regular file, directory, or symlink. + + + + + gio.File.query_filesystem_info + + + query_filesystem_info + attributes + cancellableNone + + + + + attributes : + an attribute query string. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a gio.FileInfo + or None if there was an error. + + + + + + The query_filesystem_info() method it's similar to + gio.File.query_info(), + but obtains information about the filesystem the file is on, rather than the + file itself. For instance the amount of space available and the type of the filesystem. + + + The attribute value is a string that specifies the file attributes that should be gathered. + It is not an error if it's not possible to read a particular requested attribute from a file - + it just won't be set. attribute should be a comma-separated list of attribute or attribute + wildcards. The wildcard "*" means all attributes, and a wildcard like "fs:*" means all attributes + in the fs namespace. The standard namespace for filesystem attributes is "fs". Common attributes + of interest are gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem in bytes), + gio.FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), and gio.FILE_ATTRIBUTE_FILESYSTEM_TYPE + (type of the filesystem). + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + If the file does not exist, the gio.ERROR_NOT_FOUND error will be returned. Other errors + are possible too, and depend on what kind of filesystem the file is on. + + + + + gio.File.query_filesystem_info_async + + + query_filesystem_info_async + attributes + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + attributes : + an attribute query string. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The query_filesystem_info_async() method asynchronously + gets the requested information about the filesystem that the specified file is on. + The result is a GFileInfo object that contains key-value attributes + (such as type or size for the file). + + + For more details, see + query_filesystem_info() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.query_filesystem_info_finish() + to get the result of the operation. + + + + + gio.File.query_filesystem_info_finish + + + query_filesystem_info_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.FileInfo + or None if an error occurred. + + + + + + The query_filesystem_info_finish() method finishes an asynchronous + copy operation started with + gio.File.query_filesystem_info_async(). + + + + + gio.File.query_filesystem_info + + + query_info + attributes + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attributes : + an attribute query string. + + + + flags : + + a + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a gio.FileInfo + for the given file or None if there was an error. + + + + + + The query_info() method gets the requested + information about specified file. The result is a + gio.FileInfo + object that contains key-value attributes (such as the type or size of the file). + + + The attribute value is a string that specifies the file attributes that should + be gathered. It is not an error if it's not possible to read a particular + requested attribute from a file - it just won't be set. attribute should be + a comma-separated list of attribute or attribute wildcards. The wildcard "*" + means all attributes, and a wildcard like "standard::*" means all attributes + in the standard namespace. An example attribute query be "standard::*,owner::user". + The standard attributes are available as defines, like gio.FILE_ATTRIBUTE_STANDARD_NAME. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + For symlinks, normally the information about the target of the symlink is returned, + rather than information about the symlink itself. However if you pass + gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in flags the information about + the symlink itself will be returned. Also, for symlinks that point to non-existing + files the information about the symlink itself will be returned. + + + If the file does not exist, the gio.ERROR_NOT_FOUND error will be + returned. Other errors are possible too, and depend on what kind of + filesystem the file is on. + + + + + gio.File.query_info_async + + + query_info_async + attributes + callback + flagsgio.FILE_QUERY_INFO_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + attributes : + an attribute query string. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + + a + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The query_info_async() method asynchronously gets the + requested information about specified file. The result is a + gio.FileInfo + object that contains key-value attributes (such as type or size for the file). + + + For more details, see + query_info() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.query_info_finish() + to get the result of the operation. + + + + + gio.File.query_info_finish + + + query_info_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.FileInfo + for the given file or None if an error occurred. + + + + + + The query_info_finish() method finishes an asynchronous + copy operation started with + gio.File.query_info_async(). + + + + + gio.File.query_settable_attributes + + + query_settable_attributes + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a list of + gio.FileAttributeInfo + describing the settable attributes. + + + + + + The query_settable_attributes() method obtain the + list of settable attributes for the file. + + + Returns the type and full attribute name of all the attributes that can be + set on this file. This doesn't mean setting it will always succeed though, + you might get an access failure, or some specific file may not support a specific attribute. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.query_writable_namespace + + + query_writable_namespace + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a list of + gio.FileAttributeInfo + describing the writable namespaces. + + + + + + The query_writable_namespace() method obtain the + list of attribute namespaces where new attributes can be created by a user. + An example of this is extended attributes (in the "xattr" namespace). + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.read + + + read + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a + gio.FileInputStream + or None on error. + + + + + + The read() method opens a file for reading. The result + is a gio.FileInputStream + that can be used to read the contents of the file. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + If the file does not exist, the gio.ERROR_NOT_FOUND error will be returned. + If the file is a directory, the gio.ERROR_IS_DIRECTORY error will be returned. + Other errors are possible too, and depend on what kind of filesystem the file is on. + + + + + gio.File.read_async + + + read_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The read_async() method asynchronously opens file for reading. + + + For more details, see + read() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.read_finish() + to get the result of the operation. + + + + + gio.File.read_finish + + + read_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.FileInputStream + file or None if an error occurred. + + + + + + The read_finish() method finishes an asynchronous + copy operation started with + gio.File.read_async(). + + + + + gio.File.replace + + + replace + etag + make_backup + flagsgio.FILE_CREATE_NONE + cancellableNone + + + + + etag : + an optional entity tag for the current + gio.File, + or None to ignore. + + + + make_backup : + True if a backup should be created. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a + gio.FileOutputStream + or None on error. + + + + + + The replace() method returns an output stream for + overwriting the file, possibly creating a backup copy of the file first. + If the file doesn't exist, it will be created. + + + This will try to replace the file in the safest way possible so that any + errors during the writing will not affect an already existing copy of the file. + For instance, for local files it may write to a temporary file and then atomically + rename over the destination when the stream is closed. + + + By default files created are generally readable by everyone, but if you pass + gio.FILE_CREATE_PRIVATE in flags the file will be made readable only to + the current user, to the level that is supported on the target filesystem. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + If you pass in a non-None etag value, then this value is compared + to the current entity tag of the file, and if they differ an gio.ERROR_WRONG_ETAG error + is returned. This generally means that the file has been changed since you last read it. + You can get the new etag from + gio.FileOutputStream.get_etag() + after you've finished writing and closed the GFileOutputStream. When you load a new file you can use + gio.FileInputStream.query_info() + to get the etag of the file. + + + If make_backup is True, this function will attempt to make a backup + of the current file before overwriting it. If this fails a gio.ERROR_CANT_CREATE_BACKUP + error will be returned. If you want to replace anyway, try again + with make_backup set to False. + + + If the file is a directory the gio.ERROR_IS_DIRECTORY error will be returned, and + if the file is some other form of non-regular file then a gio.ERROR_NOT_REGULAR_FILE + error will be returned. Some file systems don't allow all file names, and may return an + gio.ERROR_INVALID_FILENAME error, and if the name is to long gio.ERROR_FILENAME_TOO_LONG + will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on. + + + + + gio.File.replace_async + + + replace_async + callback + etagNone + make_backupTrue + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + etag : + an optional entity tag for the current + gio.File, + or None to ignore. + + + + make_backup : + True if a backup should be created. + + + + flags : + a set of + + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The replace_async() method asynchronously overwrites the file, + replacing the contents, possibly creating a backup copy of the file first. + + + For more details, see + replace() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.replace_finish() + to get the result of the operation. + + + + + gio.File.replace_contents + + + replace_contents + contents + etag + make_backup + flagsgio.FILE_CREATE_NONE + cancellableNone + + + + + contents : + a string containing the new contents for file. + + + + etag : + the old entity tag for the document + or None to ignore. + + + + make_backup : + True if a backup should be created. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + the new entity tag for the document. + + + + + + The replace_contents() method replaces the contents + of file with contents of length bytes. If etag is specified (not NULL) any existing + file must have that etag, or the error gio.ERROR_WRONG_ETAG will be returned. + + + If make_backup is True, this function will attempt to make a backup of file. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + The returned etag can be used to verify that the file hasn't changed the next time it is saved over. + + + + + gio.File.replace_contents_async + + + replace_contents_async + contents + callback + etagNone + make_backupTrue + flagsgio.FILE_CREATE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + contents : + a string containing the new contents for file. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + etag : + an optional entity tag for the current + gio.File, + or None to ignore. + + + + make_backup : + True if a backup should be created. + + + + flags : + a set of + + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The replace_contents_async() method starts an asynchronous + replacement of file with the given contents of length bytes. etag will + replace the document's current entity tag. + + + For more details, see + replace_contents() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.replace_contents_finish() + to get the result of the operation. + + + + + gio.File.replace_contents_finish + + + replace_contents_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + the new entity tag for the document. + + + + + + The replace_contents_finish() method finishes an asynchronous + copy operation started with + gio.File.replace_contents_async(). + + + + + gio.File.replace_finish + + + replace_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.FileOutputStream + or None if an error occurred. + + + + + + The replace_finish() method finishes an asynchronous + copy operation started with + gio.File.replace_async(). + + + + + gio.File.resolve_relative_path + + + resolve_relative_path + relative_path + + + + + relative_path : + a given relative path string. + + + + Returns : + a gio.File + to the resolved path. None if relative_path is None + or if file is invalid. + + + + + + The resolve_relative_path() method resolves a + relative path for file to an absolute path. + + + This call does no blocking i/o. + + + + + gio.File.set_attribute + + + set_attribute + attribute + type + value_p + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attribute : + a string containing the attribute's name. + + + + type : + the type of the attribute . + + + + value_p : + the value. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attribute was set, + False otherwise. + + + + + + The set_attribute() method sets an attribute in + the file with attribute name attribute to value. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_attribute_byte_string + + + set_attribute_byte_string + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attribute : + a string containing the attribute's name. + + + + value : + a string containing the attribute's new value. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attribute was set, + False otherwise. + + + + + + The set_attribute_byte_string() method Sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_BYTE_STRING to value. If attribute is of a different type, + this operation will fail, returning False. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_attribute_int32 + + + set_attribute_int32 + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attribute : + a string containing the attribute's name. + + + + value : + an int containing the attribute's new value. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attribute was set, + False otherwise. + + + + + + The set_attribute_int32() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_INT32 to value. If attribute is of a different type, + this operation will fail. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_attribute_int64 + + + set_attribute_int64 + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attribute : + a string containing the attribute's name. + + + + value : + a long containing the attribute's new value. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attribute was set, + False otherwise. + + + + + + The set_attribute_int64() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_INT64 to value. If attribute is of a different type, + this operation will fail. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_attribute_string + + + set_attribute_string + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attribute : + a string containing the attribute's name. + + + + value : + a string containing the attribute's new value. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attribute was set, + False otherwise. + + + + + + The set_attribute_string() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_STRING to value. If attribute is of a different type, + this operation will fail. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_attribute_uint32 + + + set_attribute_uint32 + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attribute : + a string containing the attribute's name. + + + + value : + an int containing the attribute's new value. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attribute was set, + False otherwise. + + + + + + The set_attribute_uint32() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_UINT32 to value. If attribute is of a different type, + this operation will fail. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_attribute_uint64 + + + set_attribute_uint64 + attribute + value + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + attribute : + a string containing the attribute's name. + + + + value : + a long containing the attribute's new value. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attribute was set, + False otherwise. + + + + + + The set_attribute_uint64() method sets attribute of type + gio.FILE_ATTRIBUTE_TYPE_UINT64 to value. If attribute is of a different type, + this operation will fail. + + + If cancellable is not None, then the operation can be cancelled by triggering + the cancellable object from another thread. If the operation was cancelled, the error + gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_attributes_async + + + set_attributes_async + info + callback + flagsgio.FILE_QUERY_INFO_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + info : + a gio.FileInfo + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + a set of + + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The set_attributes_async() method asynchronously + sets the attributes of file with info. + + + For more details, see + set_attributes_from_info() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.set_attributes_finish() + to get the result of the operation. + + + + + gio.File.set_attributes_finish + + + set_attributes_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the attributes were set correctly, + False otherwise. + + + + + + The set_attributes_finish() method finishes an asynchronous + copy operation started with + gio.File.set_attributes_async(). + + + + + gio.File.set_attributes_from_info + + + set_attributes_from_info + info + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + + + + + info : + a gio.FileInfo + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True if the attributes were set correctly, + False otherwise. + + + + + + The set_attributes_from_info() method tries to set + all attributes in the GFileInfo on the target values, not stopping on the first error. + + If there is any error during this operation then error will be set to the + first error. Error on particular fields are flagged by setting the "status" + field in the attribute value to gio.FILE_ATTRIBUTE_STATUS_ERROR_SETTING, + which means you can also detect further errors. + + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_display_name + + + set_display_name + display_name + cancellableNone + + + + + display_name : + a string conaining the name to display. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + a gio.File + specifying what file was renamed to, or None if there was an error. + + + + + + The set_display_name() method renames file to + the specified display name. + + + The display name is converted from UTF8 to the correct encoding for the + target filesystem if possible and the file is renamed to this. + + + If you want to implement a rename operation in the user interface the + edit name (gio.FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the + initial value in the rename widget, and then the result after editing + should be passed to + gio.File.set_dispay_name(). + + + On success the resulting converted filename is returned. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.set_display_name_async + + + set_display_name_async + display_name + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + display_name : + a string conaining the name to display. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The set_display_name_async() method asynchronously + sets the display name for a given GFile. + + + For more details, see + set_display_name() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.File.set_display_name_finish() + to get the result of the operation. + + + + + gio.File.set_display_name_finish + + + set_display_name_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.File + or None on error. + + + + + + The set_display_name_finish() method finishes an asynchronous + copy operation started with + gio.File.set_display_name_async(). + + + + + gio.File.trash + + + trash + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + Returns : + True on successful trash, False otherwise. + + + + + + The trash() method sends file to the "Trashcan", if possible. + This is similar to deleting it, but the user can recover it before emptying the trashcan. + Not all file systems support trashing, so this call can return the gio.ERROR_NOT_SUPPORTED error. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + + + gio.File.unmount_mountable + + + unmount_mountable + callback + flagsgio.FILE_QUERY_INFO_NONE + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + a set of + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The unmount_mountable() method unmounts a file of type gio.FILE_TYPE_MOUNTABLE. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + When the operation is finished, callback will be called. You can then call + gio.File.unmount_mountable_finish() + to get the result of the operation. + + + + + gio.File.unmount_mountable_finish + + + unmount_mountable_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the operation finished successfully, + False otherwise. + + + + + + The unmount_mountable_finish() method finishes an asynchronous + copy operation started with + gio.File.unmount_mountable(). + + + + + + Functions + + + gio.file_parse_name + + + file_parse_name + parse_name + + + + + parse_name : + a file name or path to be parsed. + + + + Returns : + a new gio.File. + + + + + + The parse_name() function constructs a + gio.File + with the given parse_name (i.e. something given by g_file_get_parse_name()). + This operation never fails, but the returned object might not support any I/O + operation if the parse_name cannot be parsed. + + + + diff --git a/docs/reference/pygio-fileattributeinfo.xml b/docs/reference/pygio-fileattributeinfo.xml new file mode 100644 index 0000000..4b72c27 --- /dev/null +++ b/docs/reference/pygio-fileattributeinfo.xml @@ -0,0 +1,73 @@ + + + + + + gio.FileAttributeInfo + Information about a specific attribute. + + + + Synopsis + + + gio.FileAttributeInfo + __builtin__.object + + + + + + Ancestry + ++-- __builtin__.object + +-- gio.FileAttributeInfo + + + + + + Description + + + The gio.FileAttributeInfo + contains information about a specific attribute. + + + + + gio.FileAttributeInfo Attributes + +
+ + + + + + + + "name" + Read + The name of the attribute. + + + "type" + Read + the + + type of the attribute. + + + "flags" + Read + a set of + . + + + + + +
+
+
diff --git a/docs/reference/pygio-fileenumerator.xml b/docs/reference/pygio-fileenumerator.xml new file mode 100644 index 0000000..4b16bf6 --- /dev/null +++ b/docs/reference/pygio-fileenumerator.xml @@ -0,0 +1,488 @@ + + + + + + gio.FileEnumerator + Enumerated Files Routines. + + + + Synopsis + + + gio.FileEnumerator + gobject.GObject + + + close + cancellableNone + + + close_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + close_finish + result + + + get_container + + + + has_pending + + + + is_closed + + + + next_file + cancellableNone + + + next_files_async + num_files + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + next_files_finish + result + + + set_pending + pending + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.FileEnumerator + + + + + + gio.FileEnumerator Properties + +
+ + + + + + + + "container" + Write - Construct only + The container that is being enumerated. + + + + +
+ +
+ + + Description + + + The gio.FileEnumerator + allows you to operate on a set of + gio.Files + returning a + gio.FileInfo + structure for each file enumerated (e.g. + gio.File.enumerate_children() + will return a The gio.FileEnumerator + for each of the children within a directory). + + + To get the next file's information from a + The gio.FileEnumerator use + gio.FileEnumerator.next_file() + or its asynchronous version, + gio.FileEnumerator.next_files_async(). + Note that the asynchronous version will return a list of + gio.FileInfos, + whereas the synchronous will only return the next file in the enumerator. + + + To close a gio.FileEnumerator + use close, + or its asynchronous version, + close_async. + Once a gio.FileEnumerator + is closed, no further actions may be performed on it. + + + + + Methods + + + gio.FileEnumerator.close + + + close + + cancellableNone + + + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True on success or + False on error. + + + + + + The close() method releases all resources used by this + enumerator, making the + + return gio.ERROR_CLOSED on all calls. + + + This will be automatically called when the last reference is dropped, + but you might want to call this function to make sure resources are released + as early as possible. + + + + + gio.FileEnumerator.close_async + + + close_async + + callback + + + io_priorityglib.PRIORITY_DEFAULT + + + cancellableNone + + + user_dataNone + + + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + The + of the request. + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The close_async() method asynchronously closes the file enumerator. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned in + gio.FileEnumerator.close_finish(). + + + + + gio.FileEnumerator.close_finish + + + close_finish + result + + + + + result : + a GAsyncResult. + + + + Returns : + True if the close operation + has finished successfully. + + + + + The close_finish() method finishes closing a file enumerator, started from + gio.FileEnumerator.close_async(). + + + If the file enumerator was already closed when + gio.FileEnumerator.close_async() + was called, then this function will report gio.ERROR_CLOSED in error, and return False. + If the file enumerator had pending operation when the close operation was started, then this function will report + gio.ERROR_PENDING, and return False. If cancellable was not None, then the operation + may have been cancelled by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be set, and False will be returned. + + + + + gio.FileEnumerator.get_container + + + get_container + + + + + + Returns : + the gio.File + which is being enumerated. + + + + + The get_container() method gets the + gio.File + container which is being enumerated. + + + + + gio.FileEnumerator.has_pending + + + has_pending + + + + + + Returns : + True if the enumerator has pending operations. + + + + + The has_pending() method checks if the file enumerator has pending operations. + + + + + gio.FileEnumerator.is_closed + + + is_closed + + + + + + Returns : + True if the enumerator is closed. + + + + + The is_closed() method checks if the file enumerator has been closed. + + + + + gio.FileEnumerator.next_file + + + next_file + cancellableNone + + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + Returns : + A gio.FileInfo + or None on error or end of enumerator. + + + + + + The next_file() method returns information for the next + file in the enumerated object. Will block until the information is available. + The gio.FileInfo + returned from this function will contain attributes that match the attribute string + that was passed when the GFileEnumerator was created. + + + On error, returns None and sets error to the error. If the enumerator + is at the end, None will be returned and error will be unset. + + + + + gio.FileEnumerator.next_files_async + + + next_files_async + num_files + callback + + io_priorityglib.PRIORITY_DEFAULT + + + cancellableNone + + + user_dataNone + + + + + + num_files : + The number of file info objects to request. + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + The + of the request. + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The next_files_async() method requests information for a number + of files from the enumerator asynchronously. When all i/o for the operation is finished + the callback will be called with the requested information. + + + The callback can be called with less than num_files files in case of error or at the + end of the enumerator. In case of a partial error the callback will be called with any + succeeding items and no error, and on the next request the error will be reported. If a + request is cancelled the callback will be called with gio.ERROR_CANCELLED. + + + During an async request no other sync and async calls are allowed, and will result in gio.ERROR_PENDING errors. + + + Any outstanding i/o request with higher priority (lower numerical value) will be executed + before an outstanding request with lower priority. Default priority is glib.PRIORITY_DEFAULT. + + + + + gio.FileEnumerator.next_files_finish + + + next_files_finish + result + + + + + result : + a GAsyncResult. + + + + Returns : + A list of + gio.FileInfos. + + + + + + The next_files_finish() method finishes the + asynchronous operation started with + gio.FileEnumerator.next_files_async(). + + + + + gio.FileEnumerator.set_pending + + + set_pending + pending + + + + + pending : + A boolean value. + + + + + + The push_current() method sets the file enumerator as having pending operations. + + + +
diff --git a/docs/reference/pygio-fileicon.xml b/docs/reference/pygio-fileicon.xml new file mode 100644 index 0000000..d4a443b --- /dev/null +++ b/docs/reference/pygio-fileicon.xml @@ -0,0 +1,109 @@ + + + + + + gio.FileIcon + Icons pointing to an image file. + + + + Synopsis + + + gio.FileIcon + gobject.GObject + gio.Icon + gio.LoadableIcon + + + gio.FileIcon + file + + + + get_file + + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.FileIcon + + + + + + Description + + + The gio.FileIcon + specifies an icon by pointing to an image file to be used as icon. + + + + + Constructor + + + gio.FileIcon + file + + + + file : + a + gio.File + + + + Returns : + a new + gio.FileIcon + for the given file, or None on error. + + + + + + Creates a new icon for a file. + + + + + + Methods + + + gio.FileIcon.get_file + + + get_file + + + + + + Returns : + a + gio.File + or None. + + + + + + The get_file() method gets the + gio.File + associated with the given icon. + + + + diff --git a/docs/reference/pygio-fileinfo.xml b/docs/reference/pygio-fileinfo.xml new file mode 100644 index 0000000..33eeae7 --- /dev/null +++ b/docs/reference/pygio-fileinfo.xml @@ -0,0 +1,346 @@ + + + + + + gio.FileInfo + File Information and Attributes + + + + Synopsis + + + gio.FileInfo + gobject.GObject + + + gio.FileInfo + + + + + clear_status + + + + copy_into + + + + dup + + + + get_attribute_as_string + attribute + + + get_attribute_boolean + attribute + + + get_attribute_byte_string + attribute + + + get_attribute_data + attribute + + + get_attribute_int32 + attribute + + + get_attribute_int64 + attribute + + + get_attribute_object + attribute + + + get_attribute_status + attribute + + + get_attribute_string + attribute + + + get_attribute_type + attribute + + + get_attribute_uint32 + attribute + + + get_attribute_uint64 + attribute + + + get_content_type + + + + get_display_name + + + + get_edit_name + + + + get_etag + + + + get_file_type + + + + get_icon + + + + get_is_backup + + + + get_is_hidden + + + + get_is_symlink + + + + get_modification_time + + + + get_name + + + + get_size + + + + get_sort_order + + + + get_symlink_target + + + + has_attribute + attribute + + + list_attributes + name_space + + + remove_attribute + attribute + + + set_attribute + attribute + type + value_p + + + set_attribute_boolean + attribute + attr_value + + + set_attribute_byte_string + attribute + attr_value + + + set_attribute_data + attribute + attr_value + + + set_attribute_int32 + attribute + attr_value + + + set_attribute_int64 + attribute + attr_value + + + set_attribute_mask + mask + + + set_attribute_object + attribute + attr_value + + + set_attribute_status + attribute + attr_value + + + set_attribute_string + attribute + attr_value + + + set_attribute_uint32 + attribute + + + set_attribute_uint64 + attribute + + + set_content_type + content_type + + + set_display_name + display_name + + + set_edit_name + edit_name + + + set_file_type + type + + + set_icon + icon + + + set_is_hidden + is_hidden + + + set_is_symlink + is_symlink + + + set_modification_time + mtime + + + set_name + name + + + set_size + size + + + set_sort_order + sort_order + + + set_symlink_tarset + symlink_target + + + unset_attribute_mask + + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.FileInfo + + + + + + Description + + + Functionality for manipulating basic metadata for files. + gio.FileInfo + implements methods for getting information that all files should contain, + and allows for manipulation of extended attributes. + + + See gio.FileAttribute + for more information on how GIO handles file attributes. + + + To obtain a gio.FileInfo + for a gio.File, use + gio.File.query_info() + (or its async variant). To obtain a + gio.FileInfo + for a file input or output stream, use + gio.FileInputStream.query_info() or + gio.FileOutputStream.query_info() + (or their async variants). + + + To change the actual attributes of a file, you should then set the attribute in the + gio.FileInfo and call + gio.File.set_attributes_from_info() or + gio.File.set_attributes_async() + on a gio.File. + + + However, not all attributes can be changed in the file. For instance, the + actual size of a file cannot be changed via + gio.FileInfo.set_size(). You may call + gio.File.query_settable_attributes() and + gio.File.query_writable_namespace() + to discover the settable attributes of a particular file at runtime. + + + gio.FileAttributeMatcher + allows for searching through a GFileInfo for attributes. + + + + + Constructor + + + gio.FileInfo + + + + + Returns : + a new + gio.FileInfo + + + + + + Creates a new gio.FileInfo + + + + + + Methods + Unfinished section, you may want to see the relevant C API docs for methods descriptions. + + diff --git a/docs/reference/pygio-fileinputstream.xml b/docs/reference/pygio-fileinputstream.xml new file mode 100644 index 0000000..723dc64 --- /dev/null +++ b/docs/reference/pygio-fileinputstream.xml @@ -0,0 +1,214 @@ + + + + + + gio.FileInputStream + Base class for implementing streaming input + + + + Synopsis + + + gio.FileInputStream + gio.InputStream + + + query_info + attributes + cancellableNone + + + query_info_async + attributes + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + query_info_finish + result + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.InputStream + +-- gio.FileInputStream + + + + + + Implemented Interfaces + + gio.FileInputStream + implements + gio.Seekable + + + + + Description + + + gio.FileInputStream + provides input streams that take their content from a file. + + + gio.FileInputStream + implements gio.Seekable, + which allows the input stream to jump to arbitrary positions in the file, provided the filesystem + of the file allows it. In addition to the generic g_seekable_ API, + gio.FileInputStream + has its own API for seeking and positioning. To find the position of a file input stream, use + gio.Seekable.tell(). + To find out if a file input stream supports seeking, use + gio.Seekable.can_seek(). + To position a file input stream, use + gio.Seekable.seek(). + + + + + Methods + + + gio.FileInputStream.query_info + + + query_info + attributes + cancellableNone + + + + + attributes : + a file attribute query string. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a gio.FileInfo, + or None on error. + + + + + + The query_info() method queries a file input stream + the given attributes. This function blocks while querying the stream. + For the asynchronous (non-blocking) version of this function, see + gio.FileInputStream.query_info_async(). + While the stream is blocked, the stream will set the pending flag internally, + and any other operations on the stream will fail with gio.ERROR_PENDING. + + + + + gio.FileInputStream.query_info_async + + + query_info_async + attributes + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + attributes : + a file attribute query string. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The query_info_async() method queries the stream + information asynchronously. When the operation is finished callback will be + called. You can then call + gio.FileInputStream.query_info_finish() + to get the result of the operation. + + + For the synchronous version of this function, see + gio.FileInputStream.query_info(). + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set + + + + + gio.FileInputStream.query_info_finish + + + query_info_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.FileInfo, + or None on error. + + + + + + The query_info_finish() method finishes an asynchronous + file append operation started with + gio.FileInputStream.query_info_async(). + + + + diff --git a/docs/reference/pygio-filemonitor.xml b/docs/reference/pygio-filemonitor.xml new file mode 100644 index 0000000..ef9ca33 --- /dev/null +++ b/docs/reference/pygio-filemonitor.xml @@ -0,0 +1,128 @@ + + + + + + gio.FileMonitor + File Monitor + + + + Synopsis + + + gio.FileMonitor + gobject.GObject + + + cancel + + + + emit_event + child + other_file + event_type + + + is_cancelled + + + + set_rate_limit + limit_msecs + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.FileMonitor + + + + + + gio.FileMonitor Properties + +
+ + + + + + + + "cancelled" + Read + + Whether the monitor has been cancelled. Default value: False. + + + + "rate-limit" + Read/Write + + The limit of the monitor to watch for changes, in milliseconds. + Allowed values: >= 0. Default value: 800. + + + + + +
+ +
+ + + gio.FileMonitor Signal Prototypes + + gobject.GObject Signal Prototypes + + + + "changed" + + callback + filemonitor + file + other_file + event_type + user_param1 + ... + + + + + + + + + Description + + + The gio.FileMonitor + monitors a file or directory for changes. + + + To obtain a gio.FileMonitor + for a file or directory, use + gio.FileMonitor.monitor(), + gio.FileMonitor.monitor_file(), or + gio.FileMonitor.monitor_directory(). + + + To get informed about changes to the file or directory you are monitoring, + connect to the "changed" signal. + + + + + Methods + Unfinished section, you may want to see the relevant C API docs for methods descriptions. + +
diff --git a/docs/reference/pygio-fileoutputstream.xml b/docs/reference/pygio-fileoutputstream.xml new file mode 100644 index 0000000..f4367d7 --- /dev/null +++ b/docs/reference/pygio-fileoutputstream.xml @@ -0,0 +1,257 @@ + + + + + + gio.FileOutputStream + Base class for implementing streaming input + + + + Synopsis + + + gio.FileOutputStream + gio.OutputStream + + + get_etag + + + + query_info + attributes + cancellableNone + + + query_info_async + attributes + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + query_info_finish + result + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.OutputStream + +-- gio.FileOutputStream + + + + + + Implemented Interfaces + + gio.FileOutputStream + implements + gio.Seekable + + + + + Description + + + gio.FileOutputStream + provides output streams that write their content to a file. + + + gio.FileOutputStream + implements gio.Seekable, + which allows the output stream to jump to arbitrary positions in the file and to truncate + the file, provided the filesystem of the file supports these operations. In addition to the + generic gio.Seekable. API, + gio.FileOutputStream + has its own API for seeking and positioning. To find the position of a file output stream, use + gio.Seekable.tell(). + To find out if a file output stream supports seeking, use + gio.Seekable.can_seek(). + To position a file output stream, use + gio.Seekable.seek(). + To find out if a file output stream supports truncating, use + gio.FileOutputStream.can_truncate(). + To truncate a file output stream, use + gio.Seekable.truncate(). + + + + + Methods + + + gio.FileOutputStream.get_etag + + + get_etag + + + + + + Returns : + the entity tag for the stream. + + + + + + The get_etag() method gets the entity tag + for the file when it has been written. This must be called after the + stream has been written and closed, as the etag can change while writing. + + + + + gio.FileOutputStream.query_info + + + query_info + attributes + cancellableNone + + + + + attributes : + a file attribute query string. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a gio.FileInfo, + or None on error. + + + + + + The query_info() method queries a file input stream + the given attributes. This function blocks while querying the stream. + For the asynchronous (non-blocking) version of this function, see + gio.FileOutputStream.query_info_async(). + While the stream is blocked, the stream will set the pending flag internally, + and any other operations on the stream will fail with gio.ERROR_PENDING. + + + Can fail if the stream was already closed (with error being set to gio.ERROR_CLOSED), + the stream has pending operations (with error being set to gio.ERROR_PENDING), or + if querying info is not supported for the stream's interface (with error being set to + gio.ERROR_NOT_SUPPORTED). In all cases of failure, NULL will be returned. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be set, and None will be returned. + + + + + gio.FileOutputStream.query_info_async + + + query_info_async + attributes + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + attributes : + a file attribute query string. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The query_info_async() method queries the stream + information asynchronously. When the operation is finished callback will be + called. You can then call + gio.FileOutputStream.query_info_finish() + to get the result of the operation. + + + For the synchronous version of this function, see + gio.FileOutputStream.query_info(). + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was + cancelled, the error gio.ERROR_CANCELLED will be set + + + + + gio.FileOutputStream.query_info_finish + + + query_info_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + a gio.FileInfo, + or None on error. + + + + + + The query_info_finish() method finishes an asynchronous + file append operation started with + gio.FileOutputStream.query_info_async(). + + + + diff --git a/docs/reference/pygio-filterinputstream.xml b/docs/reference/pygio-filterinputstream.xml new file mode 100644 index 0000000..e6fb90b --- /dev/null +++ b/docs/reference/pygio-filterinputstream.xml @@ -0,0 +1,152 @@ + + + + + + gio.FilterInputStream + Filter Input Stream + + + + Synopsis + + + gio.FilterInputStream + gio.InputStream + + + get_base_stream + + + + get_close_base_stream + + + + set_close_base_stream + close_base + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.InputStream + +-- gio.FilterInputStream + + + + + + gio.FilterInputStream Properties + +
+ + + + + + + + "base-stream" + Read - Write - Construct only + The underlying base stream on which the io ops will be done. + + + "close-base-stream" + Read - Write - Construct only + If the base stream should be closed when the filter stream is closed. + Default value: True. + + + + +
+ +
+ + + Description + + + Filter Input Stream. + + + + + Methods + + + gio.FilterInputStream.get_base_stream + + + get_base_stream + + + + + + Returns : + A + gio.InputStream + + + + + + The get_base_stream() method gets the base + stream for the filter stream. + + + + + gio.FilterInputStream.get_close_base_stream + + + get_close_base_stream + + + + + + Returns : + True if the base stream + will be closed. + + + + + + The get_close_base_stream() method returns + whether the base stream will be closed when stream is closed. + + + + + gio.FilterInputStream.set_close_base_stream + + + set_close_base_stream + close_base + + + + + close_base : + True to close the base stream. + + + + + + The set_close_base_stream() method sets whether + the base stream will be closed when stream is closed. + + + +
diff --git a/docs/reference/pygio-filteroutputstream.xml b/docs/reference/pygio-filteroutputstream.xml new file mode 100644 index 0000000..78feaa2 --- /dev/null +++ b/docs/reference/pygio-filteroutputstream.xml @@ -0,0 +1,152 @@ + + + + + + gio.FilterOutputStream + Filter Output Stream + + + + Synopsis + + + gio.FilterOutputStream + gio.OutputStream + + + get_base_stream + + + + get_close_base_stream + + + + set_close_base_stream + close_base + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.OutputStream + +-- gio.FilterOutputStream + + + + + + gio.FilterOutputStream Properties + +
+ + + + + + + + "base-stream" + Read - Write - Construct only + The underlying base stream on which the io ops will be done. + + + "close-base-stream" + Read - Write - Construct only + If the base stream should be closed when the filter stream is closed. + Default value: True. + + + + +
+ +
+ + + Description + + + Filter Output Stream. + + + + + Methods + + + gio.FilterOutputStream.get_base_stream + + + get_base_stream + + + + + + Returns : + A + gio.OutputStream + + + + + + The get_base_stream() method gets the base + stream for the filter stream. + + + + + gio.FilterOutputStream.get_close_base_stream + + + get_close_base_stream + + + + + + Returns : + True if the base stream + will be closed. + + + + + + The get_close_base_stream() method returns + whether the base stream will be closed when stream is closed. + + + + + gio.FilterOutputStream.set_close_base_stream + + + set_close_base_stream + close_base + + + + + close_base : + True to close the base stream. + + + + + + The set_close_base_stream() method sets whether + the base stream will be closed when stream is closed. + + + +
diff --git a/docs/reference/pygio-functions.xml b/docs/reference/pygio-functions.xml new file mode 100644 index 0000000..c690a2f --- /dev/null +++ b/docs/reference/pygio-functions.xml @@ -0,0 +1,395 @@ + + + + + + gio Functions + + + + + Synopsis + + + gio.content_type_can_be_executable + type + + gio.content_type_equals + type1 + type2 + + gio.content_type_from_mime_type + mime_type + + gio.content_type_get_description + type + + gio.content_type_get_icon + type + + gio.content_type_get_mime_type + type + + gio.content_type_guess + filename + data + want_uncertain + + gio.content_type_is_a + type + supertype + + gio.content_type_is_unknown + type + + gio.content_types_get_registered + + + gio.io_error_from_errno + err_no + + + + + + Description + + + These functions are part of the PyGObject gio module + but are not directly associated with a specific class + + + + + Functions + + + gio.content_type_can_be_executable + + + content_type_can_be_executable + type + + + + + type : + a content type string. + + + + Returns : + True if the file type corresponds + to a type that can be executable, False otherwise. + + + + + + The content_type_can_be_executable() function checks + if a content type can be executable. Note that for instance things like text files + can be executables (i.e. scripts and batch files). + + + + + gio.content_type_equals + + + content_type_equals + type1 + type2 + + + + + type1 : + a content type string. + + + + type2 : + a content type string. + + + + Returns : + True if the two strings are + identical or equivalent, False otherwise. + + + + + + The content_type_equals() function compares + two content types for equality. + + + + + gio.content_type_from_mime_type + + + content_type_from_mime_type + mime_type + + + + + mime_type : + a mime type string. + + + + Returns : + The content type or None when does not know. + + + + + + The content_type_from_mime_type() function tries + to find a content type based on the mime type name. + + + + + gio.content_type_get_description + + + content_type_get_description + type + + + + + type : + a content type string. + + + + Returns : + a short description of the content type type. + + + + + + The content_type_get_description() function + gets the human readable description of the content type. + + + + + gio.content_type_get_icon + + + content_type_get_icon + type + + + + + type : + a content type string. + + + + Returns : + A gio.Icon + corresponding to the content type. + + + + + + The content_type_get_icon() function + gets the icon for a content type. + + + + + gio.content_type_get_mime_type + + + content_type_get_mime_type + type + + + + + type : + a content type string. + + + + Returns : + the registered mime-type for the given type, + or None if unknown. + + + + + + The content_type_get_mime_type() function + gets the mime-type for the content type. If one is registered + + + + + gio.content_type_guess + + + content_type_guess + filename + data + want_uncertain + + + + + filename : + a string, or None. + + + + data : + a stream of data, or None. + + + + want_uncertain : + a flag indicating the certainty of the result. + + + + Returns : + a string indicating a guessed content type for the given data. + + + + + + The content_type_guess() function guesses + the content type based on example data. If the function is uncertain, + result_uncertain will be set to True. Either filename + or data may be None, in which case the guess will be + based solely on the other argument. + + + + + gio.content_type_is_a + + + content_type_is_a + type + supertype + + + + + type : + a content type string. + + + + supertype : + a string. + + + + Returns : + True if type is a kind of + supertype, False otherwise. + + + + + + The content_type_is_a() function determines + if type is a subset of supertype. + + + + + gio.content_type_is_unknown + + + content_type_is_unknown + type + + + + + type : + a content type string. + + + + Returns : + True if the type is the unknown type. + + + + + + The content_type_is_unknown() function checks if + the content type is the generic "unknown" type. On unix this is the + "application/octet-stream" mimetype, while on win32 it is "*". + + + + + gio.content_types_get_registered + + + content_types_get_registered + + + + + + Returns : + a list of the registered content types. + + + + + + The content_types_get_registered() function + gets a list of strings containing all the registered content types + known to the system. + + + + + gio.io_error_from_errno + + + io_error_from_errno + err_no + + + + + err_no : + Error number. + + + + Returns : + a + + + + + + + The io_error_from_errno() function converts + error codes into GIO error codes. + + + + diff --git a/docs/reference/pygio-icon.xml b/docs/reference/pygio-icon.xml new file mode 100644 index 0000000..5a32d28 --- /dev/null +++ b/docs/reference/pygio-icon.xml @@ -0,0 +1,217 @@ + + + + + + gio.Icon + Interface for icons. + + + + Synopsis + + + gio.Icon + gobject.GInterface + + + equal + icon2 + + + to_string + + + + + + +Functions + + + gio.icon_new_from_string + + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.Icon + + + + + + Known Derived Interfaces + + gio.Icon is required by + gio.LoadableIcon. + + + + + Known Implementation + + gio.Icon is implemented by + gio.ThemedIcon, + gio.FileIcon, + gio.Emblem, + gio.EmblemedIcon. + + + + + Description + + + gio.Icon + is a very minimal interface for icons. It provides functions for checking + the equality of two icons, hashing of icons and serializing an icon to and from strings. + + + gio.Icon + does not provide the actual pixmap for the icon as this is out of GIO's + scope, however implementations of + gio.Icon + may contain the name of an icon (see + gio.ThemedIcon), + or the path to an icon (see + gio.LoadableIcon). + + + + To check if two GIcons are equal, see + gio.Icon.equal(). + + + For serializing a gio.Icon, + use gio.Icon.to_string() and + gio.Icon.new_from_string(). + + + If your application or library provides one or more + gio.Icon + implementations you need to ensure that each GType is registered + with the type system prior to calling + gio.icon_new_from_string(). + + + + + Methods + + + gio.Icon.equal + + + equal + icon2 + + + + + icon2 : + the second + gio.Icon + + + + + + The equal() method checks if two icons are equal. + + + + + gio.Icon.to_string + + + to_string + + + + + + Returns : + An UTF8 string or None + if icon can't be serialized. + + + + + + The to_string() method generates a textual + representation of icon that can be used for serialization such as when + passing icon to a different process or saving it to persistent storage. Use + gio.icon_new_from_string() + to get icon back from the returned string. + + + The encoding of the returned string is proprietary to GIcon except in the following two cases + + + If icon is a gio.FileIcon, + the returned string is a native path (such as /path/to/my icon.png) without escaping + if the gio.File + for icon is a native file. If the file is not native, the returned string is the result of + gio.File.get_uri() + (such as sftp://path/to/my%20icon.png). + + + If icon is a gio.ThemedIcon + with exactly one name, the encoding is simply the name (such as network-server). + + + + + + Functions + + + gio.icon_new_from_string + + + icon_new_from_string + str + + + + + str : + A string obtained via + gio.Icon.to_string(). + + + + Returns : + An object implementing the + gio.Icon + interface or None if error is set. + + + + + + The icon_new_from_string() function generate a + gio.Icon + instance from str. This function can fail if str is not valid - see + gio.Icon.to_string() + for discussion. + + + If your application or library provides one or more GIcon implementations you need + to ensure that each GType is registered with the type system prior to calling + gio.icon_new_from_string(). + + + + diff --git a/docs/reference/pygio-inputstream.xml b/docs/reference/pygio-inputstream.xml new file mode 100644 index 0000000..1bef333 --- /dev/null +++ b/docs/reference/pygio-inputstream.xml @@ -0,0 +1,730 @@ + + + + + + gio.InputStream + Base class for implementing streaming input + + + + Synopsis + + + gio.InputStream + gobject.GObject + + + clear_pending + + + + close + cancellableNone + + + close_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + close_finish + result + + + has_pending + + + + is_closed + + + + read + count-1 + cancellableNone + + + read_async + count + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + read_finish + result + + + read_part + count-1 + cancellableNone + + + set_pending + + + + skip + count + cancellableNone + + + skip_async + count + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + skip_finish + result + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.InputStream + + + + + + Description + + + gio.InputStream + has functions to read from a stream ( + gio.InputStream.read() + ), to close a stream ( + gio.InputStream.close() + ) and to skip some content ( + gio.InputStream.skip() + ). + + + To copy the content of an input stream to an output stream without manually + handling the reads and writes, use + gio.OutputStream.splice(). + + + All of these functions have async variants too. + + + + + Methods + + + gio.InputStream.clear_pending + + + clear_pending + + + + + + + + The clear_pending() method clears the pending flag on stream. + + + + + gio.InputStream.close + + + close + cancellableNone + + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + True on success + False on failure. + + + + + + The close() method closes the stream, releasing + resources related to it. + + + Once the stream is closed, all other operations will return gio.ERROR_CLOSED. + Closing a stream multiple times will not return an error. + + + Streams will be automatically closed when the last reference is dropped, but + you might want to call this function to make sure resources are released as + early as possible. + + + Some streams might keep the backing store of the stream (e.g. a file descriptor) + open after the stream is closed. See the documentation for the individual + stream for details. + + + On failure the first error that happened will be reported, but the close operation + will finish as much as possible. A stream that failed to close will still return + gio.ERROR_CLOSED for all operations. Still, it is important to check and report + the error to the user. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. Cancelling a close will still leave + the stream closed, but some streams can use a faster close that doesn't block to e.g. + check errors. + + + + + gio.InputStream.close_async + + + close_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The close_async() method asynchronously requests an + asynchronous closes of the stream, releasing resources related to it. + + + For more details, see + gio.InputStream.close() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.InputStream.close_finish() + to get the result of the operation. + + + + + gio.InputStream.close_finish + + + close_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the stream was closed successfully. + + + + + + The close_finish() method finishes an asynchronous + file append operation started with + gio.InputStream.close_async(). + + + + + gio.InputStream.has_pending + + + has_pending + + + + + + Returns : + True if stream has pending actions. + + + + + + The has_pending() method checks if an input stream has pending actions. + + + + + gio.InputStream.is_closed + + + is_closed + + + + + + Returns : + True if the stream is closed. + + + + + + The is_closed() method checks if an input stream is closed. + + + + + gio.InputStream.read + + + read + count-1 + cancellableNone + + + + + count : + optionally the number of bytes that will be read from the stream. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + The number of bytes read, or -1 on error. + + + + + + The read() method tries to read count bytes from + the stream into the buffer starting at buffer. Will block during this read. + + + This function is similar to + gio.InputStream.read_part(), + except it tries to read as many bytes as requested, only stopping on an error or end of stream. + + + On a successful read of count bytes, or if we reached the end of the stream, + True is returned, and bytes_read is set to the number of bytes read into buffer. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. Cancelling a close will still leave + the stream closed, but some streams can use a faster close that doesn't block to e.g. + check errors. + + + If there is an error during the operation False is returned and error + is set to indicate the error status, bytes_read is updated to contain the number of + bytes read into buffer before the error occurred. + + + + + gio.InputStream.read_async + + + read_async + count + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + count : + the number of bytes that will be read from the stream. + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The read_async() method requests an asynchronous read + of count bytes from the stream into the buffer. + + + For more details, see + gio.InputStream.read() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.InputStream.read_finish() + to get the result of the operation. + + + During an async request no other sync and async calls are allowed, and + will result in gio.ERROR_PENDING errors. + + + A value of count larger than G_MAXSSIZE will cause a gio.ERROR_INVALID_ARGUMENT error. + + + On success, the number of bytes read into the buffer will be passed to the callback. + It is not an error if this is not the same as the requested size, as it can happen e.g. + near the end of a file, but generally we try to read as many bytes as requested. Zero + is returned on end of file (or if count is zero), but never otherwise. + + + Any outstanding i/o request with higher priority (lower numerical value) will be + executed before an outstanding request with lower priority. Default priority is glib.PRIORITY_DEFAULT. + + + The asyncronous methods have a default fallback that uses threads to implement asynchronicity, so + they are optional for inheriting classes. However, if you override one you must override all. + + + + + gio.InputStream.read_finish + + + read_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + The number of bytes read in, or -1 on error. + + + + + + The read_finish() method finishes an asynchronous + stream read operation started by + gio.InputStream.read_async(). + + + + + gio.InputStream.read_part + + + read_part + count-1 + cancellableNone + + + + + count : + optionally the number of bytes that will be read from the stream. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + The number of bytes read, or -1 on error. + + + + + + The read_part() method tries to read count bytes from + the stream into the buffer starting at buffer. Will block during this read. + + + If count is zero returns zero and does nothing. A value of count larger than + G_MAXSSIZE will cause a gio.ERROR_INVALID_ARGUMENT error. + + + On success, the number of bytes read into the buffer is returned. It is + not an error if this is not the same as the requested size, as it can + happen e.g. near the end of a file. Zero is returned on end of file + (or if count is zero), but never otherwise. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. Cancelling a close will still leave + the stream closed, but some streams can use a faster close that doesn't block to e.g. + check errors. + + + On error -1 is returned and error is set accordingly. + + + This method roughly corresponds to C GIO g_input_stream_read. + + + + + gio.InputStream.set_pending + + + set_pending + + + + + + Returns : + True if pending was previously + unset and is now set. + + + + + + The set_pending() method sets stream to have actions pending. + If the pending flag is already set or stream is closed, + it will return False and set error. + + + + + gio.InputStream.skip + + + skip + count + cancellableNone + + + + + count : + the number of bytes that will be skipped from the stream. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + The number of bytes skipped, or -1 on error + + + + + + The skip() method tries to skip count bytes + from the stream. Will block during the operation. + + + This is identical to + read(), + from a behaviour standpoint, but the bytes that are skipped are not + returned to the user. Some streams have an implementation that is more + efficient than reading the data. + + + This function is optional for inherited classes, as the default implementation emulates it using read. + + + If cancellable is not None, then the operation can be cancelled by + triggering the cancellable object from another thskip. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. Cancelling a close will still leave + the stream closed, but some streams can use a faster close that doesn't block to e.g. + check errors. + + + + + gio.InputStream.skip_async + + + skip_async + count + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + + + count : + the number of bytes that will be skipped from the stream. + + + + callback : + a GAsyncskipyCallback to call when the request is satisfied. + + + + io_priority : + the + + of the request. + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + user_data : + the data to pass to callback function. + + + + + + The skip_async() method request an asynchronous + skip of count bytes from the stream. + + + For more details, see + gio.InputStream.skip() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.InputStream.skip_finish() + to get the result of the operation. + + + During an async request no other sync and async calls are allowed, and + will result in gio.ERROR_PENDING errors. + + + A value of count larger than G_MAXSSIZE will cause a gio.ERROR_INVALID_ARGUMENT error. + + + On success, the number of bytes skipped will be passed to the callback. It is + not an error if this is not the same as the requested size, as it can happen + e.g. near the end of a file, but generally we try to skip as many bytes as requested. + Zero is returned on end of file (or if count is zero), but never otherwise. + + + Any outstanding i/o request with higher priority (lower numerical value) will be + executed before an outstanding request with lower priority. Default priority is glib.PRIORITY_DEFAULT. + + + The asyncronous methods have a default fallback that uses thskips to implement asynchronicity, so + they are optional for inheriting classes. However, if you override one you must override all. + + + + + gio.InputStream.skip_finish + + + skip_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + The number of bytes skipped in, or -1 on error. + + + + + + The skip_finish() method finishes an asynchronous + stream skip operation started by + gio.InputStream.skip_async(). + + + + diff --git a/docs/reference/pygio-loadableicon.xml b/docs/reference/pygio-loadableicon.xml new file mode 100644 index 0000000..93198c4 --- /dev/null +++ b/docs/reference/pygio-loadableicon.xml @@ -0,0 +1,198 @@ + + + + + + gio.LoadableIcon + Interface for icons. + + + + Synopsis + + + gio.LoadableIcon + gobject.GInterface + + + load + size0 + cancellableNone + + + load_async + callback + size0 + cancellableNone + user_dataNone + + + load_finish + res + + + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.LoadableIcon + + + + + + Prerequisites + + gio.LoadableIcon requires + gio.Icon. and + gobject.GObject + + + + + Known Implementation + + gio.LoadableIcon is implemented by + gio.FileIcon + + + + + Description + + + gio.LoadableIcon + extends the gio.Icon + interface and adds the ability to load icons from streams. + + + + + Methods + + + gio.LoadableIcon.load + + + load + size0 + cancellableNone + + + + + size : + an integer + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + Returns : + a 2 tuple containing a + gio.InputStream + to read the icon from and a string containing the icon type. + + + + + + The load() method loads a loadable icon. + For the asynchronous version of this function, see + gio.LoadableIcon.load_async(). + + + + + gio.LoadableIcon.load_async + + + load_async + callback + size0 + cancellableNone + user_dataNone + + + + + callback : + a GAsyncReadyCallback to call when the request is satisfied. + + + + size : + an integer + + + + cancellable : + optional + gio.Cancellable + object, None to ignore. + + + + user_data : + the data to pass to callback function. + + + + + + The load_async() method loads an icon asynchronously. + + + For more details, see + gio.LoadableIcon.load() + which is the synchronous version of this call. + + + When the operation is finished, callback will be called. You can then call + gio.LoadableIcon.load_finish() + to get the result of the operation. + + + + + gio.LoadableIcon.load_finish + + + load_finish + res + + + + + res : + a + gio.AsyncResult. + + + + Returns : + a 2 tuple containing a + gio.InputStream + to read the icon from and a string containing the icon type. + + + + + + The load_finish() method finishes an asynchronous + icon load started in + gio.LoadableIcon.load_async(). + + + + diff --git a/docs/reference/pygio-memoryinputstream.xml b/docs/reference/pygio-memoryinputstream.xml new file mode 100644 index 0000000..7d8cffb --- /dev/null +++ b/docs/reference/pygio-memoryinputstream.xml @@ -0,0 +1,151 @@ + + + + + + gio.MemoryInputStream + Base class for implementing streaming input + + + + Synopsis + + + gio.MemoryInputStream + gio.InputStream + + + gio.MemoryInputStream + + + + + + add_data + data + + + + + +Functions + + + gio.memory_input_stream_new_from_data + data + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.InputStream + +-- gio.MemoryInputStream + + + + + + Implemented Interfaces + + gio.MemoryInputStream + implements + gio.Seekable + + + + + Description + + + gio.MemoryInputStream + is a class for using arbitrary memory chunks as input for GIO streaming input operations. + + + + + Constructor + + + gio.MemoryInputStream + icon + + + + Returns : + a new + gio.MemoryInputStream. + + + + + + Creates an empty + gio.MemoryInputStream. + + + + + + Methods + + + gio.MemoryInputStream.add_data + + + add_data + data + + + + + data : + input data. + + + + + + The add_data() method appends data to data + that can be read from the input stream + + + + + + Functions + + + gio.memory_input_stream_new_from_data + + + memory_input_stream_new_from_data + data + + + + + data : + input data. + + + + Returns : + A new + gio.MemoryInputStream + read from data + + + + + + The memory_input_stream_new_from_data() function creates + a new gio.MemoryInputStream + with data in memory. + + + + diff --git a/docs/reference/pygio-memoryoutputstream.xml b/docs/reference/pygio-memoryoutputstream.xml new file mode 100644 index 0000000..f044496 --- /dev/null +++ b/docs/reference/pygio-memoryoutputstream.xml @@ -0,0 +1,175 @@ + + + + + + gio.MemoryOutputStream + Streaming output operations on memory chunks + + + + Synopsis + + + gio.MemoryOutputStream + gio.OutputStream + + + gio.MemoryOutputStream + + + + + + get_contents + + + + get_data_size + + + + get_size + + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.OutputStream + +-- gio.MemoryOutputStream + + + + + + Implemented Interfaces + + gio.MemoryOutputStream + implements + gio.Seekable + + + + + Description + + + gio.MemoryOutputStream + is a class for using arbitrary memory chunks as output for GIO streaming output operations. + + + + + Constructor + + + gio.MemoryOutputStream + + + + + Returns : + a new + gio.MemoryOutputStream. + + + + + + Creates a new + gio.MemoryOutputStream. + + + + + + Methods + + + gio.MemoryOutputStream.get_contents + + + get_contents + + + + + + Returns : + the stream's data + + + + + + The get_contents() method gets any loaded data + from the ostream. + + + Note that the returned data may become invalid on the next write or truncate + operation on the stream. + + + + + gio.MemoryOutputStream.get_data_size + + + get_data_size + + + + + + Returns : + the number of bytes written to the stream + + + + + + The get_data_size() method returns the number + of bytes from the start up to including the last byte written in the + stream that has not been truncated away. + + + + + gio.MemoryOutputStream.get_size + + + get_size + + + + + + Returns : + the number of bytes allocated for the data buffer + + + + + + The get_size() method gets the size of the + currently allocated data area (availible from + gio.MemoryOutputStream.get_contents() + ). + + + Note that for growable streams the returned size may become invalid on the next write or truncate operation on the stream. + + + If you want the number of bytes currently written to the stream, use + gio.MemoryOutputStream.get_data_size(). + + + + diff --git a/docs/reference/pygio-mount.xml b/docs/reference/pygio-mount.xml new file mode 100644 index 0000000..aa635d4 --- /dev/null +++ b/docs/reference/pygio-mount.xml @@ -0,0 +1,961 @@ + + + + + + gio.Mount + Mount management + + + + Synopsis + + + gio.Mount + gobject.GInterface + + + can_eject + + + can_unmount + + + + eject + callback + flagsgio.MOUNT_UNMOUNT_NONE + cancellableNone + user_dataNone + + + eject_finish + result + + + get_drive + + + + get_icon + + + + get_name + + + + get_root + + + + get_uuid + + + + get_volume + + + + guess_content_type + callback + force_rescan + cancellableNone + user_dataNone + + + guess_content_type_finish + result + + + guess_content_type_sync + force_rescan + cancellableNone + + + is_shadowed + + + + remount + callback + flagsgio.MOUNT_UNMOUNT_NONE + mount_operationNone + cancellableNone + user_dataNone + + + remount_finish + result + + + shadow + + + + unmount + callback + flagsgio.MOUNT_UNMOUNT_NONE + cancellableNone + user_dataNone + + + unmount_finish + result + + + unshadow + + + + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.Mount + + + + + + Prerequisites + + gio.Mount requires + gobject.GObject + + + + + gio.Mount Signal Prototypes + + gobject.GObject Signal Prototypes + + + + "aborted" + + callback + mount + user_param1 + ... + + + + + "changed" + + callback + mount + user_param1 + ... + + + + + "unmounted" + + callback + mount + user_param1 + ... + + + + + + + + + Description + + + The gio.Mount + interface represents user-visible mounts. Note, when porting from GnomeVFS, + gio.Mount + is the moral equivalent of GnomeVFSVolume. + + + + gio.Mount + is a "mounted" filesystem that you can access. Mounted is in quotes because + it's not the same as a unix mount, it might be a gvfs mount, but you can still + access the files on it if you use GIO. Might or might not be related to a volume object. + + + Unmounting a GMount instance is an asynchronous operation. For more information + about asynchronous operations, see GAsyncReady and GSimpleAsyncReady. To unmount + a gio.Mount instance, + first call + g_mount_unmount() + with (at least) the GMount instance and a GAsyncReadyCallback. The callback will + be fired when the operation has resolved (either with success or failure), and a + GAsyncReady structure will be passed to the callback. That callback should then call + g_mount_unmount_finish() + with the GMount and the GAsyncReady data to see if the operation was completed successfully. + If an error is present when g_mount_unmount_finish() is called, then it will be filled + with any error information. + + + + + Methods + + + gio.Mount.can_eject + + + can_eject + + + + + + Returns : + True if the mount can be ejected, + False otherwise. + + + + + + The can_eject() method checks if a mount can be ejected. + + + + + gio.Mount.can_unmount + + + can_unmount + + + + + + Returns : + True if the mount can be unmounted, + False otherwise. + + + + + + The can_eject() method checks if a mount can be unmounted. + + + + + gio.Mount.eject + + + eject + callback + flagsgio.MOUNT_UNMOUNT_NONE + cancellableNone + user_dataNone + + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + flags affecting the unmount if required for eject + . + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The eject() method asynchronously ejects a mount. + + + When the operation is finished, callback will be called. You can then call + gio.Mount.eject_finish() + to obtain the result of the operation. + + + + + gio.Mount.eject_finish + + + eject_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the mount has been ejected + successfully, False otherwise. + + + + + + The eject_finish() method finishes ejecting a mount. + + + + + gio.Mount.get_drive + + + get_drive + + + + + + Returns : + gio.Drive + or None if mount is not associated with a volume or a drive. + + + + + + The get_drive() method gets the drive for the mount. + + + This is a convenience method for getting the + gio.Volume + and then using that object to get the + gio.Drive. + + + + + gio.Mount.get_icon + + + get_icon + + + + + + Returns : + gio.Icon + for the mount. + + + + + + The get_icon() method gets the icon for mount. + + + + + gio.Mount.get_name + + + get_name + + + + + + Returns : + the name for the given mount. + + + + + + The get_name() method gets the name of mount. + + + + + gio.Mount.get_root + + + get_root + + + + + + Returns : + a gio.File. + + + + + + The get_root() method gets the root directory on mount. + + + + + gio.Mount.get_uuid + + + get_uuid + + + + + + Returns : + the UUID for mount or None + if no UUID can be computed. + + + + + + The get_uuid() method gets the UUID for the mount. + The reference is typically based on the file system UUID for the mount in + question and should be considered an opaque string. Returns None + if there is no UUID available + + + + + gio.Mount.get_volume + + + get_volume + + + + + + Returns : + a gio.Volume + or None if mount is not associated with a volume. + + + + + + The get_volume() method gets the volume for the mount. + + + + + gio.Mount.guess_content_type + + + guess_content_type + callback + force_rescan + cancellableNone + user_dataNone + + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + force_rescan : + Whether to force a rescan of the content. Otherwise a cached result will be used if available. + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The guess_content_type() method asynchronously tries to guess the type of + content stored on mount. Returns one or more textual identifiers of well-known content + types (typically prefixed with "x-content/"), e.g. x-content/image-dcf for camera memory + cards. See the shared-mime-info specification for more on x-content types. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + When the operation is finished, callback will be called. You can then call + gio.Mount.guess_content_type_finish() + to obtain the result of the operation. + + + + + gio.Mount.guess_content_type_finish + + + guess_content_type_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + A list of types or None on error. + + + + + + The guess_content_type_finish() method finishes guessing content + types of mount. If any errors occured during the operation, error will be set to + contain the errors and FALSE will be returned. In particular, you may get an + gio.ERROR_NOT_SUPPORTED if the mount does not support content guessing. + + + + + gio.Mount.guess_content_type_sync + + + guess_content_type_sync + force_rescan + cancellableNone + + + + + force_rescan : + Whether to force a rescan of the content. Otherwise a cached result will be used if available. + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + + + The guess_content_type_sync() method tries to guess + the type of content stored on mount. Returns one or more textual identifiers + of well-known content types (typically prefixed with "x-content/"), e.g. + x-content/image-dcf for camera memory cards. See the shared-mime-info specification + for more on x-content types. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + This is an synchronous operation and as such may block doing IO; see + gio.Mount.guess_content_type() + for the asynchronous version. + + + + + gio.Mount.is_shadowed + + + is_shadowed + + + + + + Returns : + True if mount is shadowed. + + + + + + The is_shadowed() method determines if mount + is shadowed. Applications or libraries should avoid displaying mount + in the user interface if it is shadowed. + + + A mount is said to be shadowed if there exists one or more user visible + objects (currently + gio.Mount + objects) with a root that is inside the root of mount. + + + One application of shadow mounts is when exposing a single file system + that is used to address several logical volumes. In this situation, a + gio.VolumeMonitor + implementation would create two + gio.Volume + objects (for example, one for the camera functionality of the device + and one for a SD card reader on the device) with activation URIs + gphoto2://[usb:001,002]/store1/ and gphoto2://[usb:001,002]/store2/. + When the underlying mount (with root gphoto2://[usb:001,002]/) is + mounted, said + gio.VolumeMonitor + implementation would create two + gio.Mount + objects (each with their root matching the corresponding volume + activation root) that would shadow the original mount. + + + The proxy monitor in GVfs 2.26 and later, automatically creates and + manage shadow mounts (and shadows the underlying mount) if the activation + root on a gio.Volume + is set. + + + + + gio.Mount.remount + + + remount + callback + flagsgio.MOUNT_UNMOUNT_NONE + mount_operationNone + cancellableNone + user_dataNone + + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + flags affecting the unmount if required for eject + . + + + + mount_operation : + a gio.MountOperation + or None to avoid user interaction. + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The remount() method asynchronously remounts a mount. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + When the operation is finished, callback will be called. You can then call + gio.Mount.remount_finish() + to obtain the result of the operation. + + + + + gio.Mount.remount_finish + + + remount_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the mount has been remounted + successfully, False otherwise. + + + + + + The remount_finish() method finishes remounting a mount. + + + + + gio.Mount.shadow + + + shadow + + + + + + + + The shadow() method increments the shadow + count on mount. Usually used by + gio.VolumeMonitor + implementations when creating a shadow mount for mount, see + gio.Mount.is_shadowed() + for more information. The caller will need to emit the "changed" + signal on mount manually. + + + + + + gio.Mount.unmount + + + unmount + callback + flagsgio.MOUNT_UNMOUNT_NONE + cancellableNone + user_dataNone + + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + flags affecting the unmount if required for eject + . + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The unmount() method asynchronously unmounts a mount. + + + If cancellable is not None, then the operation can be cancelled + by triggering the cancellable object from another thread. If the operation was cancelled, + the error gio.ERROR_CANCELLED will be returned. + + + When the operation is finished, callback will be called. You can then call + gio.Mount.unmount_finish() + to obtain the result of the operation. + + + + + gio.Mount.unmount_finish + + + unmount_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the mount has been unmounted + successfully, False otherwise. + + + + + + The unmount_finish() method finishes unmounting a mount. + + + + + gio.Mount.unshadow + + + unshadow + + + + + + + + The unshadow() method decrements the shadow + count on mount. Usually used by + gio.VolumeMonitor + implementations when destroying a shadow mount for mount, see + gio.Mount.is_shadowed() + for more information. The caller will need to emit the "changed" + signal on mount manually. + + + + + + + Signals + + + The "aborted" gio.Mount Signal + + callback + mount + user_param1 + ... + + + + + mount : + the mount + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted by the backend when e.g. a device becomes unavailable while a + mount operation is in progress. + + + Implementations of gio.MountOperation + should handle this signal by dismissing open password dialogs. + + + + The "changed" gio.Mount Signal + + callback + mount + user_param1 + ... + + + + + mount : + the mount + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when the mount has been changed. + + + + + The "unmounted" gio.Mount Signal + + callback + mount + user_param1 + ... + + + + + mount : + the mount + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + This signal is emitted when the + gio.Mount + have been unmounted. + + + + + diff --git a/docs/reference/pygio-mountoperation.xml b/docs/reference/pygio-mountoperation.xml new file mode 100644 index 0000000..34dec13 --- /dev/null +++ b/docs/reference/pygio-mountoperation.xml @@ -0,0 +1,726 @@ + + + + + + gio.MountOperation + Authentication methods for mountable locations. + + + + Synopsis + + + gio.MountOperation + gobject.GObject + + + gio.MountOperation + + + + + get_anonymous + + + + get_choice + + + + get_domain + + + + get_password + + + + get_password_save + + + + get_username + + + + replay + result + + + set_anonymous + anonymous + + + set_choice + choice + + + set_domain + domain + + + set_password + password + + + set_password_save + save + + + set_username + username + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.MountOperation + + + + + + gio.MountOperation Properties + +
+ + + + + + + + "anonymous" + Read/Write + + Whether to use an anonymous user when authenticating. + Default value: False + + + + "choice" + Read/Write + + The index of the user's choice when a question is asked during + the mount operation. See the "ask-question" signal. + Allowed values: >= 0 Default value: 0 + + + + "domain" + Read/Write + + The domain to use for the mount operation. Default value: None + + + + "password" + Read/Write + + The password that is used for authentication when carrying out the + mount operation. Default value: None + + + + "password-save" + Read/Write + + Determines if and how the password information should be saved. + Default value: gio.PASSWORD_SAVE_NEVER + + + + "username" + Read/Write + + The user name that is used for authentication when carrying out the + mount operation. Default value: None + + + + + +
+ +
+ + + gio.MountOperation Signal Prototypes + + gobject.GObject Signal Prototypes + + + + "aborted" + + callback + mountoperation + user_param1 + ... + + + + + "ask-password" + + callback + mountoperation + message + default_user + default_domain + flags + user_param1 + ... + + + + + "ask-question" + + callback + mountoperation + message + choices + user_param1 + ... + + + + + "reply" + + callback + mountoperation + result + user_param1 + ... + + + + + + + + + Description + + + The gio.MountOperation + provides a mechanism for authenticating mountable operations, such as loop mounting files, + hard drive partitions or server locations. + + + Mounting operations are handed a + gio.MountOperation + that then can use if they require any privileges or authentication for their volumes to be + mounted (e.g. a hard disk partition or an encrypted filesystem), or if they are implementing + a remote server protocol which requires user credentials such as FTP or WebDAV. + + + Users should instantiate a subclass of this that implements all the various callbacks + to show the required dialogs, such as + gtk.MountOperation. + + + + + Constructor + + + gio.MountOperation + + + + + Returns : + a new + gio.MountOperation. + + + + + + Creates a new mount operation. + + + + + + Methods + + + gio.MountOperation.get_anonymous + + + get_anonymous + + + + + + Returns : + True if mount operation is anonymous. + + + + + + The get_anonymous() method check to see whether + the mount operation is being used for an anonymous user + + + + + gio.MountOperation.get_choice + + + get_choice + + + + + + Returns : + an integer containing an index of the user's + choice from the choice's list, or 0. + + + + + + The get_anonymous() method gets a choice + from the mount operation. + + + + + gio.MountOperation.get_domain + + + get_domain + + + + + + Returns : + a string set to the domain. + + + + + + The get_domain() method gets the domain + of the mount operation. + + + + + gio.MountOperation.get_password + + + get_password + + + + + + Returns : + a string containing the password within + the mountoperation. + + + + + + The get_password() method gets a password + from the mount operation. + + + + + gio.MountOperation.get_password_save + + + get_password_save + + + + + + Returns : + a + + flag. + + + + + + The get_password_save() method gets the state + of saving passwords for the mount operation. + + + + + gio.MountOperation.get_username + + + get_username + + + + + + Returns : + a string containing the user name. + + + + + + The get_username() method get the user + name from the mount operation. + + + + + gio.MountOperation.reply + + + reply + result + + + + + result : + a + + + + + + + The reply() method emits the "reply" signal. + + + + + gio.MountOperation.set_anonymous + + + set_anonymous + anonymous + + + + + anonymous : + boolean value. + + + + + + The set_anonymous() method sets the mount operation + to use an anonymous user if anonymous is True. + + + + + gio.MountOperation.set_choice + + + set_choice + choice + + + + + choice : + an integer. + + + + + + The set_choice() method sets a default choice for the mount operation. + + + + + gio.MountOperation.set_domain + + + set_domain + domain + + + + + domain : + the domain to set. + + + + + + The set_domain() method sets the mount operation's domain. + + + + + gio.MountOperation.set_password + + + set_password + password + + + + + password : + password to set. + + + + + + The set_password() method sets the mount + operation's password to password. + + + + + gio.MountOperation.set_password_save + + + set_password_save + save + + + + + save : + a set of + + + + + + + The set_password_save() method sets the state + of saving passwords for the mount operation. + + + + + gio.MountOperation.set_username + + + set_username + username + + + + + username : + input username. + + + + + + The set_anonymous() method sets the user + name within op to username. + + + + + + Signals + + + The "aborted" gio.MountOperation Signal + + callback + mountoperation + user_param1 + ... + + + + + mountoperation : + the mountoperation + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted by the backend when e.g. a device becomes unavailable while a mount operation is in progress. + Implementations of gio.MountOperation + should handle this signal by dismissing open password dialogs. + + + + + The "ask-password" gio.MountOperation Signal + + callback + mountoperation + message + default_user + default_domain + flags + user_param1 + ... + + + + + mountoperation : + the mountoperation + + + message : + string containing a message to display to the user. + + + default_user : + string containing the default user name. + + + default_domain : + string containing the default domain. + + + flags : + a set of + + + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + This signal is emitted when a mount operation asks the user for a password. + If the message contains a line break, the first line should be presented as a heading. + For example, it may be used as the primary text in a + gtk.MessageDialog. + + + + + The "ask-question" gio.MountOperation Signal + + callback + mountoperation + message + choices + user_param1 + ... + + + + + mountoperation : + the mountoperation + + + message : + string containing a message to display to the user. + + + choices : + a list of strings for each possible choice. + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + This signal is emitted when asking the user a question and gives a list of choices + for the user to choose from. If the message contains a line break, the first line should be + presented as a heading. For example, it may be used as the primary text in a + gtk.MessageDialog. + + + + + The "reply" gio.MountOperation Signal + + callback + mountoperation + result + user_param1 + ... + + + + + mountoperation : + the mountoperation + + + result : + a + + indicating how the request was handled + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + This signal is emitted when the user has replied to the mount operation. + + + + +
diff --git a/docs/reference/pygio-outputstream.xml b/docs/reference/pygio-outputstream.xml new file mode 100644 index 0000000..00ddf2e --- /dev/null +++ b/docs/reference/pygio-outputstream.xml @@ -0,0 +1,140 @@ + + + + + + gio.OutputStream + Base class for implementing streaming input + + + + Synopsis + + + gio.OutputStream + gobject.GObject + + + clear_pending + + + + close + cancellableNone + + + close_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + close_finish + result + + + flush + cancellableNone + + + flush_async + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + flush_finish + result + + + has_pending + + + + is_closed + + + + set_pending + + + + splice + cancellableNone + flagsgio.OUTPUT_STREAM_SPLICE_NONE + + + splice_async + source + callback + flagsgio.OUTPUT_STREAM_SPLICE_NONE + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + splice_finish + result + + + write + buffer + cancellableNone + + + write_async + buffer + callback + io_priorityglib.PRIORITY_DEFAULT + cancellableNone + user_dataNone + + + write_finish + result + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.OutputStream + + + + + + Description + + + gio.OutputStream + has functions to write from a stream ( + gio.OutputStream.write() + ), to close a stream ( + gio.OutputStream.close() + ) and to flush pending writes ( + gio.OutputStream.flush() + ). + + + To copy the content of an input stream to an output stream without manually + handling the reads and writes, use + gio.OutputStream.splice(). + + + All of these functions have async variants too. + + + + + Methods + Unfinished section, you may want to see the relevant C API docs for methods descriptions. + + diff --git a/docs/reference/pygio-seekable.xml b/docs/reference/pygio-seekable.xml new file mode 100644 index 0000000..1081143 --- /dev/null +++ b/docs/reference/pygio-seekable.xml @@ -0,0 +1,231 @@ + + + + + + gio.Seekable + Stream seeking interface. + + + + Synopsis + + + gio.Seekable + gobject.GInterface + + + tell + + + + can_seek + + + + seek + offset + type0 + cancellableNone + + + + can_truncate + + + + truncate + offset + cancellableNone + + + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.Seekable + + + + + + Known Implementation + + gio.Seekable is implemented by + gio.FileOutputStream, + gio.MemoryInputStream, + gio.FileInputStream and + gio.MemoryOutputStream. + + + + + Description + + + gio.Seekable + is implemented by streams (implementations of + gio.InputStream or + gio.OutputStream) + that support seeking. + + + + + Methods + + + gio.Seekable.tell + + + tell + + + + + Returns : + + the offset from the beginning of the buffer + + + + + + Tells the current position within the stream. + + + + + gio.Seekable.can_seek + + + can_seek + + + + + Returns : + True if this + gio.Seekable can be seeked with + the seek() method, False + if not. + + + + + The can_seek() method checks if the + seek() + can be used on this gio.Seekable. + + + + gio.Seekable.seek + + + seek + offset + type0 + cancellableNone + + + + + offset : + the offset that is added to the position determined by the type parameter. + + + + type : + 0=current position, 1=start of the file, 2=end of the file. + + + cancellable : + a gio.Cancellable + or None. + + + Returns : + True on successful seek, + False otherwise. + + + + + + Seeks in the stream by the given offset, modified by type. + + + If cancellable is not None, then the + operation can be cancelled by triggering the cancellable object from another thread. + + + + gio.Seekable.can_truncate + + + can_truncate + + + + + Returns : + True if this + gio.Seekable can be truncated with + the truncate() method, False + if not. + + + + + The can_truncate() method checks if the + truncate() + can be used on this gio.Seekable. + + + + gio.Seekable.truncate + + + truncate + offset + cancellableNone + + + + + offset : + the offset at which the stream should be truncated + + + + cancellable : + a gio.Cancellable + or None. + + + Returns : + True if successful, + False otherwise. + + + + + + Truncates a stream with a given offset. + + + If cancellable is not None, then the + operation can be cancelled by triggering the cancellable object from another thread. + + + If an operation was partially finished when the operation was cancelled the + partial result will be returned, without an error. + + + + diff --git a/docs/reference/pygio-simpleasyncresult.xml b/docs/reference/pygio-simpleasyncresult.xml new file mode 100644 index 0000000..f6a0787 --- /dev/null +++ b/docs/reference/pygio-simpleasyncresult.xml @@ -0,0 +1,317 @@ + + + + + + gio.SimpleAsyncResult + Simple asynchronous results implementation. + + + + Synopsis + + + gio.SimpleAsyncResult + gobject.GObject + + + complete + + + + complete_in_idle + + + + get_op_res_gboolean + + + + get_op_res_gssize + + + + propagate_error + + + + set_handle_cancellation + handle_cancellation + + + set_op_res_gboolean + op_res + + + set_op_res_gssize + op_res + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.SimpleAsyncResult + + + + + + Implemented Interface + + gio.SimpleAsyncResult implements + gio.AsyncResult. + + + + + Description + + + Implements gio.AsyncResult + for simple cases. Most of the time, this will be all an application needs, and will be used transparently + Because of this, GSimpleAsyncResult is used throughout GIO for handling asynchronous functions. + + + gio.SimpleAsyncResult + handles GAsyncReadyCallbacks, error reporting, operation cancellation and the final state of an + operation, completely transparent to the application. Results can be returned as a pointer e.g. + for functions that return data that is collected asynchronously, a boolean value for checking the + success or failure of an operation, or a gssize for operations which return the number of bytes modified + by the operation; all of the simple return cases are covered. + + + Most of the time, an application will not need to know of the details of this API; it is handled + transparently, and any necessary operations are handled by GAsyncResult's interface. However, if + implementing a new GIO module, for writing language bindings, or for complex applications that need + better control of how asynchronous operations are completed, it is important to understand this functionality. + + + gio.SimpleAsyncResult + are tagged with the calling function to ensure that asynchronous functions and + their finishing functions are used together correctly. + + + + An asynchronous operation can be made to ignore a cancellation event by calling + gio.SimpleAsyncResult.set_handle_cancellation() + with a + gio.AsyncResult + for the operation and False. This is useful for operations that are dangerous to cancel, + such as close (which would cause a leak if cancelled before being run). + + + gio.AsyncResult + can integrate into GLib's event loop, GMainLoop, or it can use GThreads if available. + gio.SimpleAsyncResult.complete() + will finish an I/O task directly within the main event loop. + gio.SimpleAsyncResult.complete_in_idle() + will integrate the I/O task into the main event loop as an idle function. + + + + To set the results of an asynchronous function, + gio.SimpleAsyncResult.set_op_res_gboolean(), and + gio.SimpleAsyncResult.set_op_res_gssize() + are provided, setting the operation's result to a gboolean, or gssize, respectively. + + + Likewise, to get the result of an asynchronous function, + gio.SimpleAsyncResult.get_op_res_gboolean() and + gio.SimpleAsyncResult.get_op_res_gssize() + are provided, getting the operation's result as a gboolean and gssize, respectively. + + + + + Methods + + + gio.SimpleAsyncResult.complete + + + complete + + + + + + + + The complete() method completes an asynchronous I/O job. + Must be called in the main thread, as it invokes the callback that should be called + in the main thread. If you are in a different thread use + gio.SimpleAsyncResult.complete_in_idle(). + + + + + gio.SimpleAsyncResult.complete_in_idle + + + complete_in_idle + + + + + + + + The complete_in_idle() method completes an asynchronous + function in the main event loop using an idle function. + + + + + gio.SimpleAsyncResult.get_op_res_gboolean + + + get_op_res_gboolean + + + + + + Returns : + True if the operation's result was + True, False if the operation's result + was False. + + + + + + The get_op_res_gboolean() method gets the operation + result boolean from within the asynchronous result. + + + + + gio.SimpleAsyncResult.get_op_res_gssize + + + get_op_res_gssize + + + + + + Returns : + a gssize returned from the asynchronous function. + + + + + + The get_op_res_gssize() method gets a gssize + from the asynchronous result. + + + + + gio.SimpleAsyncResult.propagate_error + + + propagate_error + + + + + + Returns : + True if the error was propegated + to dest. False otherwise. + + + + + + The propagate_error() method propagates an error + from within the simple asynchronous result to a given destination. + + + + + gio.SimpleAsyncResult.set_handle_cancellation + + + set_handle_cancellation + handle_cancellation + + + + + handle_cancellation : + a boolean. + + + + + + The set_handle_cancellation() method sets whether + to handle cancellation within the asynchronous operation. + + + + + gio.SimpleAsyncResult.set_op_res_gboolean + + + set_op_res_gboolean + op_res + + + + + op_res : + a boolean. + + + + + + The set_op_res_gboolean() method sets the operation + result to a boolean within the asynchronous result. + + + + + gio.SimpleAsyncResult.set_op_res_gssize + + + set_op_res_gssize + op_res + + + + + op_res : + a gssize. + + + + + + The set_op_res_gssize() method sets the operation + result within the asynchronous result to the given op_res. + + + + diff --git a/docs/reference/pygio-themedicon.xml b/docs/reference/pygio-themedicon.xml new file mode 100644 index 0000000..fe0e44c --- /dev/null +++ b/docs/reference/pygio-themedicon.xml @@ -0,0 +1,204 @@ + + + + + + gio.ThemedIcon + Icon theming support. + + + + Synopsis + + + gio.ThemedIcon + gobject.GObject + + + gio.ThemedIcon + + + + + append_name + + + + get_names + + + + prepend_name + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.ThemedIcon + + + + + + gio.ThemedIcon Properties + +
+ + + + + + + + "name" + Write/Contruct Only + + The icon name. Default value: None + + + + "names" + Read/Write/Contruct Only + + A list of icon names. + + + + "use-default-fallbacks" + Read/Write/Contruct Only + + Whether to use the default fallbacks found by shortening the + icon name at '-' characters. If the "names" array has more + than one element, ignores any past the first. + + + + + +
+
+ + + Description + + + gio.ThemedIcon + is an implementation of gio.Icon + that supports icon themes. GThemedIcon contains a list of all of the icons present in an icon + theme, so that icons can be looked up quickly. + + + gio.ThemedIcon + does not provide actual pixmaps for icons, just the icon names. Ideally something like + gtk.IconTheme.choose_icon() + should be used to resolve the list of names so that fallback icons work nicely + with themes that inherit other themes + + + + + Constructor + + + gio.ThemedIcon + name + use_default_fallbacksFalse + + + + name : + a string containing an icon name. + + + + Returns : + a new + gio.ThemedIcon. + + + + + + Creates a new themed icon from icon name, if instead of an icon name you + provide a list of icon names, the gio.ThemedIcon + will be constructed using the items in the list. + + + + + + Methods + + + gio.ThemedIcon.append_name + + + append_name + + + + + + name : + name of icon to append to list of icons from within icon. + + + + + + The append_name() method appends a name to + the list of icons from within icon. + + + + + gio.ThemedIcon.get_names + + + get_names + + + + + + Returns : + a list of icon names. + + + + + + The get_names() method gets the names + of icons from within icon. + + + + + gio.ThemedIcon.prepend_name + + + prepend_name + + + + + + name : + name of icon to prepend to list of icons from within icon. + + + + + + The prepend_name() method prepends a name to + the list of icons from within icon. + + + +
diff --git a/docs/reference/pygio-unixinputstream.xml b/docs/reference/pygio-unixinputstream.xml new file mode 100644 index 0000000..5ef4cde --- /dev/null +++ b/docs/reference/pygio-unixinputstream.xml @@ -0,0 +1,202 @@ + + + + + + gio.unix.InputStream + Streaming input operations for UNIX file descriptors. + + + + Synopsis + + + gio.unix.InputStream + gio.InputStream + + + gio.unix.InputStream + fd + close_fd + + + + get_close_fd + + + + get_fd + + + + set_close_fd + close_fd + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.InputStream + +-- gio.unix.InputStream + + + + + + gio.unix.InputStream Properties + +
+ + + + + + + + "close-fd" + Read - Write + Whether to close the file descriptor when the stream is closed. + Default value: True. + + + "fd" + Read - Write - Construct only + The file descriptor that the stream reads from. Default value: -1. + + + + +
+ +
+ + + Description + + + gio.unix.InputStream + implements gio.InputStream + for reading from a UNIX file descriptor, including asynchronous operations. + The file descriptor must be selectable, so it doesn't work with opened files. + + + Note that gio.unix.InputStream + belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file + when using it. + + + + + Constructor + + + gio.unix.InputStream + fd + close_fd + + + + fd : + a UNIX file descriptor. + + + + close_fd : + True + to close the file descriptor when done + + + + Returns : + a new + gio.unix.InputStream + + + + + + Creates a new gio.unix.InputStream + from the given fd. + + + If close_fd is True, the file descriptor will be closed when the stream is closed. + + + + + + Methods + + + gio.unix.InputStream.get_close_fd + + + get_close_fd + + + + + + Returns : + True if the file descriptor is closed when done. + + + + + + The get_close_fd() method returns whether the file + descriptor of stream will be closed when the stream is closed. + + + + + gio.unix.InputStream.get_fd + + + get_fd + + + + + + Returns : + The file descriptor of stream. + + + + + + The get_fd() method return the UNIX file descriptor + that the stream reads from. + + + + + gio.unix.InputStream.set_close_fd + + + set_close_fd + close_fd + + + + + close_fd : + True to close the file descriptor when done . + + + + + + The set_close_fd() method sets whether the file descriptor + of stream shall be closed when the stream is closed. + + + +
diff --git a/docs/reference/pygio-unixoutputstream.xml b/docs/reference/pygio-unixoutputstream.xml new file mode 100644 index 0000000..02e4be8 --- /dev/null +++ b/docs/reference/pygio-unixoutputstream.xml @@ -0,0 +1,202 @@ + + + + + + gio.unix.OutputStream + Streaming output operations for UNIX file descriptors. + + + + Synopsis + + + gio.unix.OutputStream + gio.OutputStream + + + gio.unix.OutputStream + fd + close_fd + + + + get_close_fd + + + + get_fd + + + + set_close_fd + close_fd + + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.OutputStream + +-- gio.unix.OutputStream + + + + + + gio.unix.OutputStream Properties + +
+ + + + + + + + "close-fd" + Read - Write + Whether to close the file descriptor when the stream is closed. + Default value: True. + + + "fd" + Read - Write - Construct only + The file descriptor that the stream writes to. Default value: -1. + + + + +
+ +
+ + + Description + + + gio.unix.OutputStream + implements gio.OutputStream + for writing to a UNIX file descriptor, including asynchronous operations. + The file descriptor must be selectable, so it doesn't work with opened files. + + + Note that gio.unix.OutputStream + belongs to the UNIX-specific GIO interfaces, thus you have to use the gio-unix-2.0.pc pkg-config file + when using it. + + + + + Constructor + + + gio.unix.OutputStream + fd + close_fd + + + + fd : + a UNIX file descriptor. + + + + close_fd : + True + to close the file descriptor when done + + + + Returns : + a new + gio.unix.OutputStream + + + + + + Creates a new gio.unix.OutputStream + from the given fd. + + + If close_fd is True, the file descriptor will be closed when the stream is closed. + + + + + + Methods + + + gio.unix.OutputStream.get_close_fd + + + get_close_fd + + + + + + Returns : + True if the file descriptor is closed when done. + + + + + + The get_close_fd() method returns whether the file + descriptor of stream will be closed when the stream is closed. + + + + + gio.unix.OutputStream.get_fd + + + get_fd + + + + + + Returns : + The file descriptor of stream. + + + + + + The get_fd() method return the UNIX file descriptor + that the stream reads from. + + + + + gio.unix.OutputStream.set_close_fd + + + set_close_fd + close_fd + + + + + close_fd : + True to close the file descriptor when done . + + + + + + The set_close_fd() method sets whether the file descriptor + of stream shall be closed when the stream is closed. + + + +
diff --git a/docs/reference/pygio-volume.xml b/docs/reference/pygio-volume.xml new file mode 100644 index 0000000..cf0fa50 --- /dev/null +++ b/docs/reference/pygio-volume.xml @@ -0,0 +1,718 @@ + + + + + + gio.Volume + Volume management. + + + + Synopsis + + + gio.Volume + gobject.GInterface + + + can_eject + + + + can_mount + + + + eject + callback + flagsgio.MOUNT_UNMOUNT_NONE + cancellableNone + user_dataNone + + + eject_finish + result + + + enumerate_identifiers + + + + get_activation_root + + + + get_drive + + + + get_icon + + + + get_identifier + + + + get_mount + + + + get_name + + + + get_uuid + + + + mount + mount_operation + callback + flagsgio.MOUNT_MOUNT_NONE + cancellableNone + user_dataNone + + + mount_finish + result + + + should_automount + + + + + + + + + Ancestry + ++-- gobject.GInterface + +-- gio.Volume + + + + + + Prerequisites + + gio.Volume requires + gobject.GObject + + + + + gio.Volume Signal Prototypes + + gobject.GObject Signal Prototypes + + + + "changed" + + callback + volume + user_param1 + ... + + + + + "removed" + + callback + volume + user_param1 + ... + + + + + + + + + Description + + + The gio.Volume + interface represents user-visible objects that can be mounted. Note, when porting + from GnomeVFS, gio.Volume + is the moral equivalent of GnomeVFSDrive. + + + Mounting a gio.Volume + instance is an asynchronous operation. For more information about asynchronous operations. + To mount a gio.Volume, first call + gio.Volume.mount() + with (at least) the gio.Volume + instance, optionally a + gio.MountOperation + object and a GAsyncReadyCallback. + + + Typically, one will only want to pass None for the GMountOperation + if automounting all volumes when a desktop session starts since it's not desirable + to put up a lot of dialogs asking for credentials. + + + The callback will be fired when the operation has resolved (either with success or failure), + and a GAsyncReady structure will be passed to the callback. That callback should then call + gio.Volume.mount_finish() + with the GVolume instance and the GAsyncReady data to see if the operation was completed + successfully. If an error is present when + gio.Volume.mount_finish() + is called, then it will be filled with any error information. + + + It is sometimes necessary to directly access the underlying operating system object behind a volume + (e.g. for passing a volume to an application via the commandline). For this purpose, GIO allows to obtain + an 'identifier' for the volume. There can be different kinds of identifiers, such as Hal UDIs, + filesystem labels, traditional Unix devices (e.g. /dev/sda2), uuids. GIO uses predefind strings + as names for the different kinds of identifiers: + "hal-udi", "label", etc. Use + gio.Volume.get_identifier() + to obtain an identifier for a volume. + + + + + Methods + + + gio.Volume.can_eject + + + can_eject + + + + + + Returns : + True if the volume can be ejected, + False otherwise. + + + + + + The can_eject() method checks if a volume can be ejected. + + + + + gio.Volume.can_mount + + + can_mount + + + + + + Returns : + True if the volume can be mounted + for media changes, False otherwise. + + + + + + The can_mount() method checks if a volume + can be mounted. + + + + + gio.Volume.eject + + + eject + + callback + + + flagsgio.MOUNT_UNMOUNT_NONE + + + cancellableNone + + + user_dataNone + + + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + flags affecting the unmount if required for eject. + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The eject() method asynchronously ejects a volume. + + + When the operation is finished, callback will be called. You can then call + gio.Volume.eject_finish() + to obtain the result of the operation. + + + + + gio.Volume.eject_finish + + + eject_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the volume has been ejected + successfully, False otherwise. + + + + + + The eject_finish() method finishes ejecting a volume. + If any errors occured during the operation, error will be set to contain the + errors and False will be returned. + + + + + gio.Volume.enumerate_identifiers + + + enumerate_identifiers + + + + + + Returns : + a list of strings containing kinds of identifiers. + + + + + + The enumerate_identifiers() method gets the kinds + of identifiers that volume has. Use + gio.Volume.get_identifier() + to obtain the identifiers themselves. + + + + + gio.Volume.get_activation_root + + + get_activation_root + + + + + + Returns : + the activation root of volume or None. + + + + + + The get_activation_root() method gets the activation + root for a gio.Volume + if it is known ahead of mount time. Returns None otherwise. + If not None and if volume is mounted, then the result of + gio.Mount.get_root() + on the GMount object obtained from + gio.Volume.get_mount() + will always either be equal or a prefix of what this function returns. + In other words, in code: + + +mount = volume.get_mount() # mounted, so never None +mount_root = mount.get_root() +volume_activation_root = volume.get_activation_root() # assume not None + + + then the expression + + +volume_activation_root.has_prefix(mount_root) || volume_activation_root.equal(mount_root) + + + will always be True. + + + Activation roots are typically used in + gio.VolumeMonitor + implementations to find the underlying mount to shadow, see + gio.Mount.is_shadowed() + for more details. + + + + + gio.Volume.get_drive + + + get_drive + + + + + + Returns : + A gio.Drive + or None if volume is not associated with a drive. + + + + + + The get_drive() method gets the drive for the volume. + + + + + gio.Volume.get_icon + + + get_icon + + + + + + Returns : + gio.Icon + for the volume. + + + + + + The get_icon() method gets the icon for volume. + + + + + gio.Volume.get_identifier + + + get_identifier + + + + + + Returns : + A string containing the requested identfier, or + None if the + gio.Volume + doesn't have this kind of identifier. + + + + + + The get_identifier() method gets the identifier of + the given kind for volume. + + + + + gio.Volume.get_mount + + + get_mount + + + + + + Returns : + A + gio.Mount + or None if volume isn't mounted. + + + + + + The get_mount() method gets the mount for the volume. + + + + + gio.Volume.get_name + + + get_name + + + + + + Returns : + A string containing volume's name. + + + + + + The get_name() method gets the name of volume. + + + + + gio.Volume.get_uuid + + + get_uuid + + + + + + Returns : + the UUID for volume or None + if no UUID can be computed. + + + + + + The get_uuid() method gets the UUID for the volume. + The reference is typically based on the file system UUID for the volume in + question and should be considered an opaque string. + Returns None if there is no UUID available. + + + + + gio.Volume.mount + + + mount + + mount_operation + + + callback + + + flagsgio.MOUNT_MOUNT_NONE + + + cancellableNone + + + user_dataNone + + + + + + mount_operation : + A + gio.MountOperation + or None to avoid user interaction. + + + + callback : + A GAsyncReadyCallback to call when the request is satisfied. + + + + flags : + Flags affecting the operation + + + + cancellable : + Optional + gio.Cancellable + object, None to ignore. + + + + user_data : + The data to pass to callback function. + + + + + + The mount() method mounts a volume. This is an + asynchronous operation, and is finished by calling + gio.Volume.mount_finish() + with the volume and GAsyncResult returned in the callback. + + + + + gio.Volume.mount_finish + + + mount_finish + result + + + + + result : + a gio.AsyncResult. + + + + Returns : + True if the volume has been mounted + successfully, False otherwise. + + + + + + The mounted() method finishes mounting a volume. + If any errors occured during the operation, error will be set to contain + the errors and False will be returned. + + + If the mount operation succeeded, + get_mount() + on volume is guaranteed to return the mount right after calling this function; + there's no need to listen for the 'mount-added' signal on + gio.VolumeMonitor. + + + + + gio.Volume.should_automount + + + should_automount + + + + + + Returns : + True if the volume should + be automatically mounted. + + + + + + The should_automount() method returns whether + the volume should be automatically mounted. + + + + + + Signals + + + The "changed" gio.Volume Signal + + callback + volume + user_param1 + ... + + + + + volume : + the volume + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when the volume has been changed. + + + + + The "removed" gio.Volume Signal + + callback + volume + user_param1 + ... + + + + + volume : + the volume + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + This signal is emitted when the + gio.Volume + have been removed. If the recipient is holding references to the object + they should release them so the object can be finalized. + + + + + diff --git a/docs/reference/pygio-volumemonitor.xml b/docs/reference/pygio-volumemonitor.xml new file mode 100644 index 0000000..399d07e --- /dev/null +++ b/docs/reference/pygio-volumemonitor.xml @@ -0,0 +1,844 @@ + + + + + + gio.VolumeMonitor + Volume Monitor. + + + + Synopsis + + + gio.VolumeMonitor + gobject.GObject + + + get_connected_drives + + + + get_mount_for_uuid + uuid + + + get_mounts + + + + get_volume_for_uuid + uuid + + + get_volumes + + + + + + +Functions + + gio.volume_monitor_adopt_orphan_mount + + + gio.volume_monitor_get + + + + + + + Ancestry + ++-- gobject.GObject + +-- gio.VolumeMonitor + + + + + + gio.VolumeMonitor Signal Prototypes + + gobject.GObject Signal Prototypes + + + + "drive-changed" + + callback + volume_monitor + drive + user_param1 + ... + + + + + "drive-connected" + + callback + volume_monitor + drive + user_param1 + ... + + + + + "drive-disconnected" + + callback + volume_monitor + drive + user_param1 + ... + + + + + "drive-eject-button" + + callback + volume_monitor + drive + user_param1 + ... + + + + + "mount-added" + + callback + volume_monitor + mount + user_param1 + ... + + + + + "mount-changed" + + callback + volume_monitor + mount + user_param1 + ... + + + + + "mount-pre-unmount" + + callback + volume_monitor + mount + user_param1 + ... + + + + + "mount-removed" + + callback + volume_monitor + mount + user_param1 + ... + + + + + "volume-added" + + callback + volume_monitor + volume + user_param1 + ... + + + + + "volume-changed" + + callback + volume_monitor + volume + user_param1 + ... + + + + + "volume-removed" + + callback + volume_monitor + volume + user_param1 + ... + + + + + + + + Description + + + The gio.VolumeMonitor + is for listing the user interesting devices and volumes on the computer. In other words, + what a file selector or file manager would show in a sidebar. + + + + + Methods + + + gio.VolumeMonitor.get_connected_drives + + + get_connected_drives + + + + + + Returns : + a list of connected + gio.Drive objects. + + + + + + The get_connected_drives() method gets a list + of drives connected to the system. + + + + + gio.VolumeMonitor.get_mount_for_uuid + + + get_mount_for_uuid + uuid + + + + + uuid : + The UUID to look for. + + + + Returns : + A + gio.Mount + or None if no such mount is available. + + + + + + The get_mount_for_uuid() method finds a + gio.Mount + object by it's UUID (see + gio.Mount.get_uuid()) + + + + + gio.VolumeMonitor.get_mounts + + + get_mounts + + + + + + Returns : + A list of + gio.Mount + objects. + + + + + + The get_mounts() method gets a list of the mounts on the system. + + + + + gio.VolumeMonitor.get_volume_for_uuid + + + get_volume_for_uuid + uuid + + + + + uuid : + The UUID to look for. + + + + Returns : + A + gio.Volume + or None if no such volume is available. + + + + + + The get_mount_for_uuid() method finds a + gio.Mount + object by it's UUID (see + gio.Mount.get_uuid()) + + + + + gio.VolumeMonitor.get_volumes + + + get_volumes + + + + + + Returns : + A list of + gio.Volume + objects. + + + + + + The get_volumes() method gets a list of the volumes on the system. + + + + + + Functions + + + gio.volume_monitor_adopt_orphan_mount + + + volume_monitor_adopt_orphan_mount + + + + + + Returns : + The gio.Volume + object that is the parent for mount or None if no wants to adopt the + gio.Mount. + + + + + + This method will be deprecated starting from GIO 2.20 + + + + The volume_monitor_adopt_orphan_mount() function should + be called by any gio.VolumeMonitor + implementation when a new gio.Mount + object is created that is not associated with a + gio.Volume object. + It must be called just before emitting the mount_added signal. + + + If the return value is not None, the caller must associate the returned + gio.Volume + object with the + gio.Mount. + This involves returning it in it's + gio.Mount.get_volumes() + implementation. The caller must also listen for the "removed" signal on the + returned object and give up it's reference when handling that signal + + + Similary, if implementing + gio.volume_monitor_adopt_orphan_mount(), + the implementor must take a reference to mount and return it in it's + gio.Volume.get_mount() + implemented. Also, the implementor must listen for the "unmounted" signal + on mount and give up it's reference upon handling that signal. + + + There are two main use cases for this function. + + + One is when implementing a user space file system driver that reads blocks of + a block device that is already represented by the native volume monitor + (for example a CD Audio file system driver). Such a driver will generate it's own + gio.Mount + object that needs to be assoicated with the + gio.Volume + object that represents the volume. + + + The other is for implementing a + gio.VolumeMonitor + whose sole purpose is to return + gio.Volume + objects representing entries in the users "favorite servers" list or similar. + + + + + gio.volume_monitor_get + + + volume_monitor_get + + + + + + Returns : + A reference to the + gio.VolumeMonitor + used by gio. + + + + + + The volume_monitor_get() function gets the + volume monitor used by gio. + + + + + + Signals + + + The "drive-changed" gio.Volume Signal + + callback + volume_monitor + drive + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + drive : + the drive that changed + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a drive changes. + + + + + The "drive-connected" gio.Volume Signal + + callback + volume_monitor + drive + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + drive : + the drive that was connected + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a drive is connected to the system. + + + + + The "drive-disconnected" gio.Volume Signal + + callback + volume_monitor + drive + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + drive : + the drive that was disconnected + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a drive is disconnected from the system. + + + + + The "drive-eject-button" gio.Volume Signal + + callback + volume_monitor + drive + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + drive : + the drive where the eject button was pressed + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when the eject button is pressed on drive. + + + + + The "mount-added" gio.Volume Signal + + callback + volume + mount + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + mount : + a Mount that was added. + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a mount is added. + + + + + The "mount-changed" gio.Volume Signal + + callback + volume_monitor + mount + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + mount : + the Mount that changed. + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a mount changes. + + + + + The "mount-pre-unmount" gio.Volume Signal + + callback + volume_monitor + mount + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + mount : + the Mount that is being unmounted. + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a mount is about to be removed. + + + + + The "mount-removed" gio.Volume Signal + + callback + volume_monitor + mount + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + mount : + the Mount that was removed. + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a mount is removed. + + + + + The "volume-added" gio.Volume Signal + + callback + volume_monitor + volume + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + volume : + a Volume that was added. + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a mountable volume is added to the system. + + + + + The "volume-changed" gio.Volume Signal + + callback + volume_monitor + volume + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + volume : + a Volume that changed. + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when mountable volume is changed. + + + + + The "volume-removed" gio.Volume Signal + + callback + volume_monitor + volume + user_param1 + ... + + + + + volume_monitor : + the volume monitor + + + volume : + a Volume that was removed. + + + user_param1 : + the first user parameter (if any) specified + with the connect() + method + + + ... : + additional user parameters (if any) + + + + + Emitted when a mountable volume is removed from the system. + + + + diff --git a/docs/reference/pygiounix-classes.xml b/docs/reference/pygiounix-classes.xml new file mode 100644 index 0000000..72b0081 --- /dev/null +++ b/docs/reference/pygiounix-classes.xml @@ -0,0 +1,13 @@ + + + + +PyGio Unix Class Reference + + + + + + diff --git a/docs/reference/pyglib-classes.xml b/docs/reference/pyglib-classes.xml new file mode 100644 index 0000000..ecc4e5b --- /dev/null +++ b/docs/reference/pyglib-classes.xml @@ -0,0 +1,15 @@ + + + + +PyGlibClass Reference + + + + + + + + diff --git a/docs/reference/pyglib-constants.xml b/docs/reference/pyglib-constants.xml new file mode 100644 index 0000000..0f1bf8d --- /dev/null +++ b/docs/reference/pyglib-constants.xml @@ -0,0 +1,282 @@ + + + + + + glib Constants + the built-in constants of the glib module + + + + Synopsis + + + + + + + + + + + + + Description + + + Glib IO Condition Constants + + The IO Condition constants are a set of bit-flags that specify a +condition to watch for on an event source. + + + + glib.IO_IN + + There is data to read + + + + glib.IO_OUT + + Data can be written (without blocking). + + + + glib.IO_PRI + + There is urgent data to read. + + + + glib.IO_ERR + + Error condition. + + + + glib.IO_HUP + + Hung up (the connection has been broken, usually for + pipes and sockets). + + + + glib.IO_NVAL + + Invalid request. The file descriptor is not + open. + + + + + + + + Glib Priority Constants + + The Priority constants specify + + + + glib.PRIORITY_HIGH + + Use this for high priority event sources. + + + + glib.PRIORITY_DEFAULT + + Use this for default priority event sources. This + priority is used when adding timeout functions with the glib.timeout_add() + function. This priority is also used for events from the X + server. + + + + glib.PRIORITY_HIGH_IDLE + + Use this for high priority idle functions. For example, + glib.PRIORITY_HIGH_IDLE + 10 is used for resizing operations; + and, glib.PRIORITY_HIGH_IDLE + 20, for redrawing + operations. (This is done to ensure that any pending resizes are + processed before any pending redraws, so that widgets are not + redrawn twice unnecessarily.) + + + + glib.PRIORITY_DEFAULT_IDLE + + Use this for default priority idle functions. This + priority is used when adding idle functions with the glib.idle_add() + function. + + + + glib.PRIORITY_LOW + + Use this for very low priority background + tasks. + + + + + + + + Glib Spawn Flag Constants + + The Spawn Flag constants are a set of bit-flags that can be +passed to the glib.spawn_async() +function. + + + + glib.SPAWN_LEAVE_DESCRIPTORS_OPEN + + the parent's open file descriptors will be inherited by +the child; otherwise all descriptors except stdin/stdout/stderr will be +closed before calling exec() in the child. + + + + glib.SPAWN_DO_NOT_REAP_CHILD + + the child will not be automatically reaped; you must +call waitpid() or handle SIGCHLD +yourself, or the child will become a zombie. + + + + glib.SPAWN_SEARCH_PATH + + argv[0] need not be an absolute +path, it will be looked for in the user's PATH. + + + + glib.SPAWN_STDOUT_TO_DEV_NULL + + the child's standard output will be discarded, instead +of going to the same location as the parent's standard output. + + + + glib.SPAWN_STDERR_TO_DEV_NULL + + the child's standard error will be discarded. + + + + glib.SPAWN_CHILD_INHERITS_STDIN + + the child will inherit the parent's standard input (by +default, the child's standard input is attached to /dev/null). + + + + glib.SPAWN_FILE_AND_ARGV_ZERO + + the first element of argv is the +file to execute, while the remaining elements are the actual argument vector +to pass to the file. Normally glib.spawn_async() +uses argv[0] as the file to execute, and passes all +of argv to the child. + + + + + + + + Glib User Directory Constants + + The User Directory constants are integer values that are currently used only as arguments to + glib.get_user_special_dir() + function. See function documentation for details. + + + + glib.USER_DIRECTORY_DESKTOP + + the user's Desktop directory + + + + glib.USER_DIRECTORY_DOCUMENTS + + the user's Documents directory + + + + glib.USER_DIRECTORY_DOWNLOAD + + the user's Downloads directory + + + + glib.USER_DIRECTORY_MUSIC + + the user's Music directory + + + + glib.USER_DIRECTORY_PICTURES + + the user's Pictures directory + + + + glib.USER_DIRECTORY_PUBLIC_SHARE + + the user's shared directory + + + + glib.USER_DIRECTORY_TEMPLATES + + the user's Templates directory + + + + glib.USER_DIRECTORY_VIDEOS + + the user's Movies directory + + + + + + + Glib Version Constants + The Version constants specify the version of +Glib used by PyGObject as a 3-tuple containing the major, +minor and patch release numbers. + + + + glib.glib_version + + A 3-tuple containing (major, minor, patch) release + numbers of glib. + + + + glib.pyglib_version + + A 3-tuple containing (major, minor, patch) release + numbers of the python bindings. + + + + + + + + + diff --git a/docs/reference/pyglib-functions.xml b/docs/reference/pyglib-functions.xml new file mode 100644 index 0000000..358fa83 --- /dev/null +++ b/docs/reference/pyglib-functions.xml @@ -0,0 +1,1047 @@ + + + + + + glib Functions + miscellaneous functions + + + + Synopsis + + + + glib.idle_add + callback + ... + + glib.timeout_add + interval + callback + ... + + glib.timeout_add_seconds + interval + callback + ... + + glib.io_add_watch + fd + condition + callback + ... + + glib.source_remove + tag + + glib.main_context_default + + + glib.markup_escape_text + text + + glib.child_watch_add + pid + function + dataNone + priorityglib.PRIORITY_DEFAULT + + glib.spawn_async + argv + envpNone + working_directoryNone + flags0 + child_setupNone + user_dataNone + standard_inputNone + standard_outputNone + standard_errorNone + + glib.get_current_time + + glib.get_user_cache_dir + + glib.get_user_config_dir + + glib.get_user_data_dir + + glib.get_user_special_dir + directory + + glib.main_depth + + glib.threads_init + + glib.filename_display_name + filename + + glib.filename_display_basename + filename + + glib.filename_from_utf8 + utf8string + + + + + + Description + + These functions are part of the PyGObject glib +module but are not directly associated with a specific class. + + + + + Functions + + + glib.idle_add + + + glib.idle_add + callback + ... + + + + callback : + a function to call when +PyGTK is idle + + + ... : + optionals arguments to be passed to +callback + + + Returns : + an integer ID + + + + The glib.idle_add() function adds a +function (specified by callback) to be called +whenever there are no higher priority events pending to the default main +loop. The function is given the default idle priority, +glib.PRIORITY_DEFAULT_IDLE. Additional arguments to +pass to callback can be specified after +callback. The idle priority can be specified as a +keyword-value pair with the keyword "priority". If +callback returns FALSE it is +automatically removed from the list of event sources and will not be called +again. + + + + + glib.timeout_add + + + glib.timeout_add + interval + callback + ... + + + + interval : + the time between calls to the function, in +milliseconds + + + callback : + the function to call + + + ... : + zero or more arguments that will be passed to +callback + + + Returns : + an integer ID of the event +source + + + + The glib.timeout_add() function sets a +function (specified by callback) to be called at +regular intervals (specified by interval, with the +default priority, glib.PRIORITY_DEFAULT. Additional +arguments to pass to callback can be specified after +callback. The idle priority may be specified as a +keyword-value pair with the keyword "priority". + + The function is called repeatedly until it returns +FALSE, at which point the timeout is automatically +destroyed and the function will not be called again. The first call to the +function will be at the end of the first interval. Note that timeout +functions may be delayed, due to the processing of other event sources. Thus +they should not be relied on for precise timing. After each call to the +timeout function, the time of the next timeout is recalculated based on the +current time and the given interval (it does not try to 'catch up' time lost +in delays). + + + + + glib.timeout_add_seconds + + + glib.timeout_add_seconds + interval + callback + ... + + + + interval : + the time between calls to the function, in +seconds + + + callback : + the function to call + + + ... : + zero or more arguments that will be passed to +callback + + + Returns : + an integer ID of the event +source + + + + The glib.timeout_add_seconds() is similar to + glib.timeout_add() except + that interval must be specified in seconds, not + milliseconds, and the function should cause less CPU wakeups, which is important + for laptops' batteries. + + Unlike glib.timeout_add(), this function operates at + whole second granularity. The initial starting point of the timer is determined + by the implementation and the implementation is expected to group multiple timers + together so that they fire all at the same time. To allow this grouping, the + interval to the first timer is rounded and can deviate up to one second from the + specified interval. Subsequent timer iterations will generally run at the + specified interval. + + Note that timeout functions may be delayed, due to the processing of other + event sources. Thus they should not be relied on for precise timing. After each + call to the timeout function, the time of the next timeout is recalculated based + on the current time and the given interval. + + The grouping of timers to fire at the same time results in a more power and + CPU efficient behavior so if your timer is in multiples of seconds and you don't + require the first timer exactly one second from now, the use of + glib.timeout_add_seconds() is preferred + over glib.timeout_add(). + + + + + glib.io_add_watch + + + glib.io_add_watch + fd + condition + callback + ... + + + + fd : + a Python file object or an integer file +descriptor ID + + + condition : + a condition mask + + + callback : + a function to call + + + ... : + additional arguments to pass to +callback + + + Returns : + an integer ID of the event source + + + + The glib.io_add_watch() function +arranges for the file (specified by fd) to be +monitored by the main loop for the specified +condition. fd may be a Python +file object or an integer file descriptor. The value of condition is a +combination of: + + + + glib.IO_IN + + There is data to read. + + + + glib.IO_OUT + + Data can be written (without blocking). + + + + glib.IO_PRI + + There is urgent data to read. + + + + glib.IO_ERR + + Error condition. + + + + glib.IO_HUP + + Hung up (the connection has been broken, usually for +pipes and sockets). + + + + + Additional arguments to pass to callback +can be specified after callback. The idle priority +may be specified as a keyword-value pair with the keyword "priority". The +signature of the callback function is: + + + def callback(source, cb_condition, ...) + + + where source is +fd, the file descriptor; +cb_condition is the condition that triggered the +signal; and, ... are the zero or more arguments that +were passed to the glib.io_add_watch() +function. + + If the callback function returns FALSE it +will be automatically removed from the list of event sources and will not be +called again. If it returns TRUE it will be called again +when the condition is matched. + + + + + glib.source_remove + + + glib.source_remove + tag + + + + tag : + an integer ID + + + Returns : + TRUE if the event source was +removed + + + + The glib.source_remove() function +removes the event source specified by tag (as returned by the glib.idle_add(), +glib.timeout_add() +and glib.io_add_watch() +functions) + + + + + glib.main_context_default + + + glib.main_context_default + + + + + Returns : + the default glib.MainContext +object + + + + The glib.main_context_default() function +returns the default glib.MainContext object. + + + + + glib.markup_escape_text + + + glib.markup_escape_text + text + + + + text : + the UTF-8 string to be +escaped + + + Returns : + the escaped text + + + + + This function is available in PyGTK 2.8 and above. + + + The glib.markup_escape_text() function +escapes the string specified by text so that the +markup parser will parse it verbatim. Less than, greater than, ampersand, +etc. are replaced with the corresponding entities. This function would +typically be used when writing out a file to be parsed with the markup +parser. + + Note that this function doesn't protect whitespace and line +endings from being processed according to the XML rules for normalization of +line endings and attribute values. + + + + + glib.child_watch_add + + + glib.child_watch_add + pid + function + dataNone + priorityglib.PRIORITY_DEFAULT + + + + pid : + process id of a child process to watch + + function : + the function to call + + + data : + the optional data to pass to +function + + + priority : + the priority of the idle source - one of the + + + + Returns : + the id of event source. + + + + This function is available in PyGTK 2.6 and above. + + + The glib.child_watch_add() function sets +the function specified by function to be called with +the user data specified by data when the child +indicated by pid exits. The signature for the +callback is: + + +def callback(pid, condition, user_data) + + + where pid is is the child process id, +condition is the status information about the child +process and user_data is data +PyGTK supports only a single callback per process id. + + + + + glib.spawn_async + + + glib.spawn_async + argv + envpNone + working_directoryNone + flags0 + child_setupNone + user_dataNone + standard_inputNone + standard_outputNone + standard_errorNone + + + + argv : + a sequence of strings containing the arguments +of the child process + + + envp : + the child's environment or +None to inherit the parent's +environment. + + + working_directory : + the child's current working directory, or +None to inherit parent's + + + flags : + flags from the . + + + child_setup : + a function to run in the child just before +calling exec() + + + user_data : + the user data for the +child_setup function + + + standard_input : + if TRUE return the file +descriptor for the child's stdin + + + standard_output : + if TRUE return the file +descriptor for the child's stdout + + + standard_error : + if TRUE return the file +descriptor for the child's stderr + + + Returns : + a 4-tuple containing the child's process id and +the stdin, stdout and stderr file descriptor integers. + + + + This function is available in PyGTK 2.6 and above. + + + The glib.spawn_async() function executes +a child program asynchronously (your program will not block waiting for the +child to exit). The child program is specified by the only argument that +must be provided, argv. argv +should be a sequence of strings, to be passed as the argument vector for the +child. The first string in argv is of course the name +of the program to execute. By default, the name of the program must be a +full path; the PATH shell variable will only be searched if +you pass the glib.SPAWN_SEARCH_PATH flag in +flags. The function returns a 4-tuple containing the +child's process id and the file descriptors for the child's stdin, stdout +and stderr. The stdin, stdout and stderr file descriptors are returned only +ofthe corresponding standard_input, +standard_output or +standard_error params are +TRUE. + + On Windows, the low-level child process creation API +(CreateProcess()) doesn't use argument vectors, but a +command line. The C runtime library's spawn*() family +of functions (which glib.spawn_async() +eventually calls) paste the argument vector elements into a command line, +and the C runtime startup code does a corresponding reconstruction of an +argument vector from the command line, to be passed to +main(). Complications arise when you have argument +vector elements that contain spaces of double quotes. The +spawn*() functions don't do any quoting or escaping, +but on the other hand the startup code does do unquoting and unescaping in +order to enable receiving arguments with embedded spaces or double +quotes. To work around this asymmetry, the glib.spawn_async() +function will do quoting and escaping on argument vector elements that need +it before calling the C runtime spawn() +function. + + envp is a sequence of strings, where each + string has the form KEY=VALUE. This will become the + child's environment. If envp is + None or not specified, the child inherits its + parent's environment. + + flags should be the bitwise +OR of the you want to affect the +function's behaviour. The glib.SPAWN_DO_NOT_REAP_CHILD +flag means that the child will not automatically be reaped; you must use a +GChildWatch source to be notified about the death of the child +process. Eventually you must call g_spawn_close_pid() on the child_pid, in +order to free resources which may be associated with the child process. (On +Unix, using a GChildWatch source is equivalent to calling +waitpid() or handling the SIGCHLD +signal manually. On Windows, calling g_spawn_close_pid() is equivalent to +calling CloseHandle() on the process handle +returned). + + glib.SPAWN_LEAVE_DESCRIPTORS_OPEN means +that the parent's open file descriptors will be inherited by the child; +otherwise all descriptors except stdin/stdout/stderr will be closed before +calling exec() in the +child. glib.SPAWN_SEARCH_PATH means that +argv[0] need not be an absolute path, it will be +looked for in the user's +PATH. glib.SPAWN_STDOUT_TO_DEV_NULL +means that the child's standard output will be discarded, instead of going +to the same location as the parent's standard output. If you use this flag, +standard_output must be +None. glib.SPAWN_STDERR_TO_DEV_NULL +means that the child's standard error will be discarded, instead of going to +the same location as the parent's standard error. If you use this flag, +standard_error must be +None. glib.SPAWN_CHILD_INHERITS_STDIN +means that the child will inherit the parent's standard input (by default, +the child's standard input is attached to +/dev/null). If you use this flag, +standard_input must be +None. glib.SPAWN_FILE_AND_ARGV_ZERO +means that the first element of argv is the file to +execute, while the remaining elements are the actual argument vector to pass +to the file. Normally the glib.spawn_async() +function uses argv[0] as the file to execute, and +passes all of argv to the child. + + child_setup and +user_data are a function and user data. On POSIX +platforms, the function is called in the child after GLib has performed all +the setup it plans to perform (including creating pipes, closing file +descriptors, etc.) but before calling exec(). That is, +child_setup is called just before calling +exec() in the child. Obviously actions taken in this +function will only affect the child, not the parent. On Windows, there is no +separate fork() and exec() +functionality. Child processes are created and run right away with one API +call, +CreateProcess(). child_setup is +called in the parent process just before creating the child process. You +should carefully consider what you do in child_setup +if you intend your software to be portable to Windows. + + The returned child process id can be used to send signals to the +child, or to wait for the child if you specified the +glib.SPAWN_DO_NOT_REAP_CHILD flag. On Windows, child +pid will be returned only if you specified the +glib.SPAWN_DO_NOT_REAP_CHILD flag. + + The caller of the glib.spawn_async() +must close any returned file descriptors when they are no longer in +use. + + If standard_input is +None, the child's standard input is attached to +/dev/null unless +glib.SPAWN_CHILD_INHERITS_STDIN is set. + + If standard_error is +None, the child's standard error goes to the same +location as the parent's standard error unless +glib.SPAWN_STDERR_TO_DEV_NULL is set. + + If standard_output is +None, the child's standard output goes to the same +location as the parent's standard output unless +glib.SPAWN_STDOUT_TO_DEV_NULL is set. + + If an error occurs, the glib.GError exception will be +raised. + + + + + glib.get_current_time + + + glib.get_current_time + + + + Returns : + the current time as the number of seconds and +microseconds from the epoch. + + + + This function is available in PyGTK 2.8 and above. + + + The glib.get_current_time() function +reurns the current time of day as the number of seconds and microseconds +from the epoch. + + + + + glib.get_user_cache_dir + + + glib.get_user_cache_dir + + + + Returns : + + + a strings with a path to user's cache directory. + + + + + + This function is available in PyGObject 2.18 and above. + + + Returns a base directory in which to store non-essential, + cached data specific to particular user. + + On UNIX platforms this is determined using the mechanisms + described in the + XDG + Base Directory Specification. + + + + glib.get_user_config_dir + + + glib.get_user_config_dir + + + + Returns : + + + a strings with a path to user's configuration directory. + + + + + + This function is available in PyGObject 2.18 and above. + + + Returns a base directory in which to store user-specific + application configuration information such as user preferences + and settings. + + On UNIX platforms this is determined using the mechanisms + described in the + XDG + Base Directory Specification. + + + + glib.get_user_data_dir + + + glib.get_user_data_dir + + + + Returns : + + + a strings with a path to user's data directory. + + + + + + This function is available in PyGObject 2.18 and above. + + + Returns a base directory in which to access application + data such as icons that is customized for a particular + user + + On UNIX platforms this is determined using the mechanisms + described in the + XDG + Base Directory Specification. + + + + glib.get_user_special_dir + + + glib.get_user_special_dir + directory + + + + directory : + + + the logical id of special directory, + see User + Directory constants for the list of supported + values + + + + + Returns : + + + a strings with a path to the requested directory. + + + + + + This function is available in PyGObject 2.18 and above. + + + Returns the full path of a special directory using its + logical id. + + On Unix this is done using the XDG special user + directories. For compatibility with existing practise, + glib.USER_DIRECTORY_DESKTOP + falls back to $HOME/Desktop when XDG + special user directories have not been set up. + + Depending on the platform, the user might be able to + change the path of the special directory without requiring the + session to restart; GLib will not reflect any change once the + special directories are loaded. + + + + glib.main_depth + + + glib.main_depth + + + + Returns : + the depth of the stack of calls to the main +context. + + + + This function is available in PyGTK 2.8 and above. + + + The main_depth() function returns the depth +of the stack of calls in the main context. That is, when called from the +toplevel, it gives 0. When called from within a callback from the glib.MainContext.iteration() +method (or the glib.MainLoop.run() +method, etc.) it returns 1. When called from within a callback to a +recursive call to the glib.MainContext.iteration() +method), it returns 2. And so forth. + + + + + glib.threads_init + + + glib.threads_init + + + + + Returns : + + + + + This function is available in PyGTK 2.4 and above. + + + The threads_init() function initializes the + the use of Python threading in the glib module. This function is + different than the gtk.gdk.threads_init() + function as that function also initializes the gdk threads. + + + + + glib.signal_accumulator_true_handled + + + glib.signal_accumulator_true_handled + + + + This function is available in PyGTK 2.8 and above. + + + The signal_accumulator_true_handled() + function is only used as accumulator argument when registering + signals. + + + + + glib.filename_display_name + + + glib.filename_display_name + filename + + + + filename : + a pathname in the file name + encoding + + + Returns : + an UTF8 rendition of + filename. + + + + This function is available in PyGTK 2.10 and above. + + + The filename_display_name() function + converts a filename into a valid UTF-8 string. The conversion is not + necessarily reversible, so you should keep the original around and use + the return value of this function only for display purposes. Unlike + g_filename_to_utf8(), the result is guaranteed to be non-None even if + the filename actually isn't in the file name encoding. + + If you know the whole pathname of the file you should use the + glib.filename_display_basename() + function, since that allows location-based translation of + filenames. + + + + + glib.filename_display_basename + + + glib.filename_display_basename + filename + + + + filename : + an absolute pathname in the file name + encoding + + + Returns : + an UTF8 rendition of + filename. + + + + This function is available in PyGTK 2.10 and above. + + + The filename_display_basename() function + returns the display basename for the particular filename, guaranteed + to be valid UTF-8. The display name might not be identical to the + filename, for instance there might be problems converting it to UTF-8, + and some files can be translated in the display. + + You must pass the whole absolute pathname to this functions so + that translation of well known locations can be done. + + This function is preferred over the glib.filename_display_name() + function if you know the whole path, as it allows translation. + + + + + glib.filename_from_utf8 + + + glib.filename_from_utf8 + utf8string + + + + utf8string : + a UTF-8 encoded string. + + + Returns : + a filename encoded in the GLib filename + encoding. + + + + This function is available in PyGTK 2.10 and above. + + + The filename_from_utf8() function converts + a string from UTF-8 to the encoding GLib uses for filenames. Note that + on Windows GLib uses UTF-8 for filenames. + + + + + + diff --git a/docs/reference/pyglib-maincontext.xml b/docs/reference/pyglib-maincontext.xml new file mode 100644 index 0000000..ccb91bb --- /dev/null +++ b/docs/reference/pyglib-maincontext.xml @@ -0,0 +1,152 @@ + + + + + + glib.MainContext + + an object representing a set of event sources to be handled +in a glib.MainLoop. + + + + Synopsis + + + glib.MainContext + + glib.MainContext + + + iteration + may_block + + + pending + + + + + + + Ancestry + ++-- glib.MainContext + + + + + + Description + + A glib.MainContext +represents a set of event sources that can be run in a single thread. File +descriptors (plain files, pipes or sockets) and timeouts are the standard +event sources for GTK and PyGTK though +others can be added. Each event source is assigned a priority. The default +priority, glib.PRIORITY_DEFAULT, is 0. Values less +than 0 denote higher priorities. Values greater than 0 denote lower +priorities. Events from high priority sources are always processed before +events from lower priority sources. Single iterations of a glib.MainContext +can be run with the iteration() +method. + + + + + Constructor + + + glib.MainContext + + + + Returns : + a new glib.MainContext + object. + + + + Creates a new glib.MainContext +object. + + + + + Methods + + + glib.MainContext.iteration + + + iteration + + + + may_block : + if TRUE the call may block + waiting for an event. + + + Returns : + TRUE if events were + dispatched. + + + + The iteration() method runs a single +iteration. This involves: + + + + checking to see if any associated event sources are ready +to be processed; + + + then if no events sources are ready and +may_block is TRUE, waiting for a +source to become ready; + + + and finally, dispatching the highest priority events +sources that are ready + + + + Note that even when may_block is +TRUE, it is still possible for +iteration() to return FALSE, +since the the wait may be interrupted for other reasons than an event source +becoming ready. + + + + + glib.MainContext.pending + + + pending + + + + Returns : + TRUE if events are + pending. + + + + The pending() method checks if any +associated sources have pending events. + + + + + + diff --git a/docs/reference/pyglib-mainloop.xml b/docs/reference/pyglib-mainloop.xml new file mode 100644 index 0000000..bd12fca --- /dev/null +++ b/docs/reference/pyglib-mainloop.xml @@ -0,0 +1,202 @@ + + + + + + glib.MainLoop + + an object representing the main event loop of a PyGTK + application. + + + + Synopsis + + + glib.MainLoop + + glib.MainLoop + contextNone + is_running0 + + + get_context + + + is_running + + + quit + + + run + + + + + + + Ancestry + ++-- glib.MainLoop + + + + + + Description + + glib.MainLoop +represents a main event loop. A glib.MainLoop +is created with the glib.MainLoop() +constructor. After adding the initial event sources, the run() +method is called. This continuously checks for new events from each of the +event sources and dispatches them. Finally, the processing of an event from +one of the sources leads to a call to the quit() +method to exit the main loop, and the run() +method returns. + + It is possible to create new instances of glib.MainLoop +recursively. This is often used in PyGTK applications +when showing modal dialog boxes. Note that event sources are associated with +a particular glib.MainContext, +and will be checked and dispatched for all main loops associated with that +glib.MainContext. + + PyGTK contains wrappers of some of these +functions, e.g. the gtk.main(), gtk.main_quit() +and gtk.events_pending() +functions. + + + + + Constructor + + + glib.MainLoop + contextNone + is_runningNone + + + + context : + a glib.MainContext + or None to use the default + context. + + + is_running : + if TRUE indicates that the + loop is running. This is not very important since calling the run() + method will set this to TRUE + anyway. + + + Returns : + a new glib.MainLoop + object. + + + + Creates a new glib.MainLoop +object. + + + + + Methods + + + glib.MainLoop.get_context + + + get_context + + + + Returns : + the glib.MainContext + the mainloop is associated with + + + + The get_context() method returns the +glib.MainContext +that the mainloop was created with. + + + + + glib.MainLoop.is_running + + + is_running + + + + Returns : + TRUE if the mainloop is + currently being run. + + + + The is_running() method checks to see +if the mainloop is currently being run via the run() +method. + + + + + glib.MainLoop.quit + + + quit + + + The quit() method stops the mainloop +from running. Any subsequent calls to the run() +method will return immediately. + + + + + glib.MainLoop.run + + + run + + + The run() method runs a mainloop until +the quit() +method is called. If this is called for the thread of the loop's glib.MainContext, +it will process events from the loop, otherwise it will simply wait. + + + + + + diff --git a/docs/reference/pygobject-classes.xml b/docs/reference/pygobject-classes.xml new file mode 100644 index 0000000..17f925c --- /dev/null +++ b/docs/reference/pygobject-classes.xml @@ -0,0 +1,17 @@ + + + + +PyGObject Class Reference + + + + + + + + + + diff --git a/docs/reference/pygobject-constants.xml b/docs/reference/pygobject-constants.xml new file mode 100644 index 0000000..a8f9711 --- /dev/null +++ b/docs/reference/pygobject-constants.xml @@ -0,0 +1,390 @@ + + + + + + gobject Constants + the built-in constants of the gobject module + + + + Synopsis + + + + + + + + + + + + Description + + + GObject Param Flag Constants + + The Param Flag constants are a set of bit-flags that specify +certain aspects of parameters that can be configured. + + + + gobject.PARAM_READABLE + + The parameter is readable + + + + gobject.PARAM_WRITABLE + + The parameter is writable + + + + gobject.PARAM_CONSTRUCT + + The parameter will be set upon object + construction + + + + gobject.PARAM_CONSTRUCT_ONLY + + The parameter will only be set upon object + construction + + + + gobject.PARAM_LAX_VALIDATION + + Upon parameter conversion strict validation is not + required + + + + + + + + GObject Signal Flag Constants + + The Signal Flag constants are a set of bit-flags that specify a +signal's behavior. The overall signal description outlines how especially +the RUN flags control the stages of a signal +emission. + + + + gobject.SIGNAL_RUN_FIRST + + Invoke the object method handler in the first emission + stage. + + + + gobject.SIGNAL_RUN_LAST + + Invoke the object method handler in the third emission + stage. + + + + gobject.SIGNAL_RUN_CLEANUP + + Invoke the object method handler in the last emission + stage. + + + + gobject.SIGNAL_NO_RECURSE + + Signals being emitted for an object while currently + being in emission for this very object will not be emitted + recursively, but instead cause the first emission to be + restarted. + + + + gobject.SIGNAL_DETAILED + + This signal supports "::detail" appendices to the + signal name upon handler connections and emissions. + + + + gobject.SIGNAL_ACTION + + Action signals are signals that may freely be emitted + on alive objects from user code via the gobject.emit() + method and friends, without the need of being embedded into + extra code that performs pre or post emission adjustments on the + object. They can also be thought of as object methods which can + be called generically by third-party code. + + + + gobject.SIGNAL_NO_HOOKS + + No emissions hooks are supported for this + signal. + + + + + + + + GObject Spawn Flag Constants + + The Spawn Flag constants are a set of bit-flags that can be +passed to the gobject.spawn_async() +function. + + + + gobject.SPAWN_LEAVE_DESCRIPTORS_OPEN + + the parent's open file descriptors will be inherited by +the child; otherwise all descriptors except stdin/stdout/stderr will be +closed before calling exec() in the child. + + + + gobject.SPAWN_DO_NOT_REAP_CHILD + + the child will not be automatically reaped; you must +call waitpid() or handle SIGCHLD +yourself, or the child will become a zombie. + + + + gobject.SPAWN_SEARCH_PATH + + argv[0] need not be an absolute +path, it will be looked for in the user's PATH. + + + + gobject.SPAWN_STDOUT_TO_DEV_NULL + + the child's standard output will be discarded, instead +of going to the same location as the parent's standard output. + + + + gobject.SPAWN_STDERR_TO_DEV_NULL + + the child's standard error will be discarded. + + + + gobject.SPAWN_CHILD_INHERITS_STDIN + + the child will inherit the parent's standard input (by +default, the child's standard input is attached to /dev/null). + + + + gobject.SPAWN_FILE_AND_ARGV_ZERO + + the first element of argv is the +file to execute, while the remaining elements are the actual argument vector +to pass to the file. Normally gobject.spawn_async() +uses argv[0] as the file to execute, and passes all +of argv to the child. + + + + + + + + GObject Built-in Type Constants + + The Built-in Type constants specify the pre-defined types used +by gobject. + + + + gobject.TYPE_INVALID + + An invalid type, used as error return value in some + functions. + + + + gobject.TYPE_NONE + + A fundamental type indicating no type. + + + + gobject.TYPE_INTERFACE + + The fundamental type from which all interfaces are + derived. + + + + gobject.TYPE_CHAR + + The fundamental type corresponding to a + character. This maps to a string in Python. + + + + gobject.TYPE_UCHAR + + The fundamental type corresponding to an unsigned + character. This maps to a string in Python. + + + + gobject.TYPE_BOOLEAN + + The fundamental type corresponding to a True or False + value. This maps to an integer in Python. + + + + gobject.TYPE_INT + + The fundamental type corresponding to an + integer. This maps to an integer in Python. + + + + gobject.TYPE_UINT + + he fundamental type corresponding to an unsigned + integer. This maps to an integer in Python. + + + + gobject.TYPE_LONG + + The fundamental type corresponding to a long + integer. This maps to an integer in Python. + + + + gobject.TYPE_ULONG + + The fundamental type corresponding to an unsigned + integer. This maps to an integer in Python. + + + + gobject.TYPE_INT64 + + The fundamental type corresponding to an long long + integer. This maps to a long integer in Python. + + + + gobject.TYPE_UINT64 + + The fundamental type corresponding to an unsigned long + long integer. This maps to a long integer in Python. + + + + gobject.TYPE_ENUM + + The fundamental type corresponding to an enumeration + type. This maps to an integer in Python. + + + + gobject.TYPE_FLAGS + + The fundamental type corresponding to a flag + type. This maps to an integer in Python. + + + + gobject.TYPE_FLOAT + + The fundamental type corresponding to a floating point + number. This maps to a float in Python. + + + + gobject.TYPE_DOUBLE + + The fundamental type corresponding to a double + floating point number. This maps to a float in Python. + + + + gobject.TYPE_STRING + + The fundamental type corresponding to a string. + + + + gobject.TYPE_POINTER + + The fundamental type corresponding to a pointer to an + anonymous type. This has no corresponding Python type. + + + + gobject.TYPE_BOXED + + The fundamental type corresponding to a boxed object + type. + + + + gobject.TYPE_PARAM + + The fundamental type corresponding to a GParamSpec + type. + + + + gobject.TYPE_OBJECT + + The fundamental type corresponding to a GObject + type. + + + + gobject.TYPE_PYOBJECT + + The fundamental type corresponding to a Python Object + type. + + + + + + + + GObject Version Constants + + The Version constants specify the version of +GLIB used by PyGTK as a 3-tuple containing the major, +minor and patch release numbers. + + + + gobject.glib_version + + A 3-tuple containing (major, minor, patch) release + numbers. + + + + + + + + + diff --git a/docs/reference/pygobject-functions.xml b/docs/reference/pygobject-functions.xml new file mode 100644 index 0000000..7ca3918 --- /dev/null +++ b/docs/reference/pygobject-functions.xml @@ -0,0 +1,889 @@ + + + + + + gobject Functions + miscellaneous functions + + + + Synopsis + + + + gobject.type_name + type + + gobject.type_from_name + type_name + + gobject.type_parent + type + + gobject.type_is_a + type + parent_type + + gobject.type_children + type + + gobject.type_interfaces + type + + gobject.type_register + class + + gobject.signal_new + signal_name + type + flags + return_type + param_types + + gobject.signal_list_names + type + + gobject.signal_list_ids + type + + gobject.signal_lookup + name + type + + gobject.signal_name + signal_id + + gobject.signal_query + name + type + + gobject.signal_query + signal_id + + gobject.list_properties + type + + gobject.new + type + ... + + gobject.signal_accumulator_true_handled + + gobject.add_emission_hook + type + name + callback + ... + + gobject.remove_emission_hook + type + name + hook_id + + gobject._install_metaclass + metaclass + + + + + + + Description + + These functions are part of the PyGTK gobject +module but are not directly associated with a specific class. + + + + Many functions that previously were in this namespace got moved to glib namespace instead. They + are still available in gobject for backward compatibility, but + not documented here. If you miss documentation for some function, be sure to + check glib first. + + + + + + + Functions + + + gobject.type_name + + + gobject.type_name + type + + + + type : + a GObject type, type ID or +instance + + + Returns : + + + + + The gobject.type_name() function returns +the unique name that is assigned to the specified +type. type can be a GObject +type, type ID or instance. This function raises a TypeError exception +if type isn't a PyGTK type. + + + + + gobject.type_from_name + + + gobject.type_from_name + type_name + + + + type_name : + a string containing the name of a +type + + + Returns : + the type ID named +type_name + + + + The gobject.type_from_name() function +returns the type ID of the PyGTK type with the name +specified by type_name. This function raises a +RuntimeError exception if no type matches +type_name. + + + + + gobject.type_parent + + + gobject.type_parent + type + + + + type : + a GObject type, type ID or +instance + + + Returns : + the parent type ID + + + + The gobject.type_parent() function returns +the direct parent type ID of the specified type. +type can be a GObject type, type ID or instance. If +type has no parent, i.e. is a fundamental type, the +RuntimeError exception is raised. + + + + + gobject.type_is_a + + + gobject.type_is_a + type + parent_type + + + + type : + a GObject type, type ID or +instance + + + parent_type : + a GObject type, type ID or +instance + + + Returns : + TRUE if +parent_type is an ancestor of +type + + + + The gobject.type_is_a() function returns +TRUE if the specified type is a +descendant of the type specified by parent_type. This +function also returns TRUE if +parent_type is an interface and +type conforms to it. + + + + + gobject.type_children + + + gobject.type_children + type + + + + type : + a GObject type, type ID or +instance + + + Returns : + a list of the child types of +type + + + + The gobject.type_children() function +returns a list containing the child types of the specified +type. + + + + + gobject.type_interfaces + + + gobject.type_interfaces + type + + + + type : + a GObject type, type ID or +instance + + + Returns : + a list of the interface types supported by +type + + + + The gobject.type_interfaces() function +returns a list of the interface types supported by +type. type can be a GObject +type, type ID or instance. This function returns a RuntimeError exception if +type is not a valid type or has no interfaces. + + + + + gobject.type_register + + + gobject.type_register + class + + + + class : + a Python class that is a descendant of gobject.GObject + + + + The gobject.type_register() function +registers the specified Python class as a PyGTK type. +class must be a descendant of gobject.GObject. The function generates a name for the new type. + + + + + gobject.signal_new + + + gobject.signal_new + signal_name + type + flags + return_type + param_types + + + + signal_name : + a string containing the name of the +signal + + + type : + the object type that the signal is associated +with + + + flags : + the signal flags + + + return_type : + the return type of the signal +handler + + + param_types : + the parameter types passed to the signal +handler + + + Returns : + a unique integer signal ID + + + + The gobject.signal_new() function registers +a signal with the specified signal_name for the +specified object type. The value of +flags is a combination of: + + + + gobject.SIGNAL_RUN_FIRST + + Invoke the object method handler in the first emission +stage. + + + + gobject.SIGNAL_RUN_LAST + + Invoke the object method handler in the third emission +stage. + + + + gobject.SIGNAL_RUN_CLEANUP + + Invoke the object method handler in the last emission +stage. + + + + gobject.SIGNAL_NO_RECURSE + + Signals being emitted for an object while currently +being in emission for this very object will not be emitted recursively, but +instead cause the first emission to be restarted. + + + + gobject.SIGNAL_DETAILED + + This signal supports "::detail" appendixes to the +signal name upon handler connections and emissions. + + + + gobject.SIGNAL_ACTION + + Action signals are signals that may freely be emitted +on alive objects from user code via gobject.emit()() +and friends, without the need of being embedded into extra code that +performs pre or post emission adjustments on the object. They can also be +thought of as generically callable object methods. + + + + gobject.SIGNAL_NO_HOOKS + + No emissions hooks are supported for this +signal. + + + + + return_type is the type of the return +value from a signal handler and may be a gobject type, type ID or instance. +The param_types parameter is a list of additional +types that are passed to the signal handler. Each parameter type may be +specified as a gobject type, type ID or instance. For example, to add a +signal to the gtk.Window type called "my-signal" that calls a handler with a +gtk.Button widget and an integer value and a return value that is a +boolean, use: + + + gobject.signal_new("my_signal", gtk.Window, gobject.SIGNAL_RUN_LAST, gobject.TYPE_BOOLEAN, (gtk.Button, gobject.TYPE_INT)) + + + + + + gobject.signal_list_names + + + gobject.signal_list_names + type + + + + type : + a GObject type, type ID or +instance + + + Returns : + a list of the signal names supported by +type + + + + The gobject.signal_list_names() function +returns a list of the names of the signals that are supported by the +specified GObject type + + + The type keyword is available in PyGTK 2.6 and above. + + + + + + gobject.signal_list_ids + + + gobject.signal_list_ids + type + + + + type : + a GObject type, type ID or +instance + + + Returns : + a list of the signal ids supported by +type + + + + + This method is available in PyGTK 2.6 and above. + + + The gobject.signal_list_ids() function +returns a list of the integer ids of the signals that are supported by the +GObject specified by type + + + + + gobject.signal_lookup + + + gobject.signal_lookup + name + type + + + + name : + the name of a signal for +type + + + type : + a GObject type, type ID or +instance + + + Returns : + the integer id of a signal supported by +type or 0. + + + + + This method is available in PyGTK 2.6 and above. + + + The gobject.signal_lookup() function +returns the id of the signal with the name specified by +name that is supported by the GObject specified +specified bytype. 0 is returned if the signal is not +found. + + + + + gobject.signal_name + + + gobject.signal_name + signal_id + + + + signal_id : + an integer signal id + + + Returns : + the name of the signal or +None. + + + + + This method is available in PyGTK 2.6 and above. + + + The gobject.signal_name() function returns +the name of the signal that has the signal id specified by +id. + + + + + gobject.signal_query + + + gobject.signal_query + name + type + + + + name : + the name of a signal for +type + + + type : + a GObject type, type ID or +instance + + + Returns : + a 6-tuple containing signal information or +None + + + + + This method is available in PyGTK 2.6 and above. + + + The gobject.signal_query() function returns +a 6-tuple containing information about the signal with the name specified by +name that is supported by the GObject specified by +type. If the signal is not found +None is returned. + + The signal information 6-tuple contains: + + + + the integer signal id + + + the signal name + + + the GType that the signal is registered for + + + the signal flags (see the ) + + + the GType of the return from the signal callback +function + + + a tuple containing the GTypes of the parameters that are +passed to the signal callback function. Note that these may not correspond +exactly to the PyGTK signal callback parameters. + + + + + + + gobject.signal_query + + + gobject.signal_query + signal_id + + + + signal_id : + the integer id of a signal + + + Returns : + a 6-tuple containing signal information or +None + + + + + This method is available in PyGTK 2.6 and above. + + + The gobject.signal_query() function returns +a 6-tuple containing information about the signal with the id specified by +signal_id. If the signal is not found +None is returned. + + The signal information 6-tuple contains: + + + + the integer signal id + + + the signal name + + + the GType that the signal is registered for + + + the signal flags (see the ) + + + the GType of the return from the signal callback +function + + + a tuple containing the GTypes of the parameters that are +passed to the signal callback function. Note that these may not correspond +exactly to the PyGTK signal callback parameters. + + + + + + + gobject.list_properties + + + gobject.list_properties + type + + + + type : + a GObject type, type ID or +instance + + + Returns : + a list of the properties (as GParam objects) +supported by type + + + + The gobject.list_properties() function +returns a list of the properties (as GParam objects) supported by +type. + + + + + gobject.new + + + gobject.new + type + ... + + + + type : + a GObject type, type ID or +instance + + + ... : + zero or more property-value +pairs + + + Returns : + a new object if the specified +type + + + + The gobject.new() function returns a new +object of the specified type. type must specify a +type that is a descendant of gobject.GObject. A +TypeError exception is raised if type specifies an +abstract class or a type that is not a descendant of gobject.GObject. A set +of property-value pairs may be specified to set the value of the object's +properties. + + + + + gobject.signal_accumulator_true_handled + + + gobject.signal_accumulator_true_handled + + + + This function is available in PyGTK 2.8 and above. + + + The signal_accumulator_true_handled() + function is only used as accumulator argument when registering + signals. + + + + + gobject.add_emission_hook + + + gobject.add_emission_hook + type + name + callback + ... + + + + type : + a Python GObject instance or + type + + + name : + a signal name + + + callback : + a function + + + ... : + zero or more extra arguments that will be + passed to callback. + + + Returns : + the hook id, for later use with gobject.signal_remove_emission_hook(). + + + + This function is available in PyGTK 2.8 and above. + + + The add_emission_hook() function adds an + emission hook for the signal specified by name, + which will get called for any emission of that signal, independent of + the instance. This is possible only for signals which don't have the + gobject.SIGNAL_NO_HOOKS flag set. + + + + + gobject.remove_emission_hook + + + gobject.remove_emission_hook + type + name + hook_id + + + + type : + a Python GObject instance or + type + + + name : + a signal name + + + hook_id : + the id of the emission hook as returned by the + gobject.add_emission_hook()) + function. + + + Returns : + + + + + This function is available in PyGTK 2.8 and above. + + + The remove_emission_hook() function deletes + an emission hook. + + + + + gobject._install_metaclass + + + gobject._install_metaclass + metaclass + + + + metaclass : + + + + + This function is available in PyGTK 2.10 and above. + + + The _install_metaclass() function installs + the metaclass specified by metaclass. + + + + + + diff --git a/docs/reference/pygobject-gboxed.xml b/docs/reference/pygobject-gboxed.xml new file mode 100644 index 0000000..f7f2438 --- /dev/null +++ b/docs/reference/pygobject-gboxed.xml @@ -0,0 +1,68 @@ + + + + + + gobject.GBoxed + an object containing an opaque chunk of data + + + + Synopsis + + + gobject.GBoxed + + copy + + + + + + + Ancestry + ++-- gobject.GBoxed + + + + + + Description + + gobject.GBoxed +is an abstract base class that encapsulates an opaque chunk of data to +provide an object-oriented interface and a type that is registered with the +GLIB type system. A boxed type is registered with +functions that provide for the copying and freeing of the underlying data +structure - this allows PyGTK to encapsulate these as Python objects. + + + + + Methods + + + gobject.GBoxed.copy + + + copy + + + + Returns : + a copy of the gobject.GBoxed + object + + + + The copy() method makes and returns a copy of the boxed object. + + + + + + diff --git a/docs/reference/pygobject-ginterface.xml b/docs/reference/pygobject-ginterface.xml new file mode 100644 index 0000000..1b29ddf --- /dev/null +++ b/docs/reference/pygobject-ginterface.xml @@ -0,0 +1,38 @@ + + + + + + gobject.GInterface + + an object representing a GInterface + + + + Synopsis + + + gobject.GInterface + + + + + + Ancestry + ++-- gobject.GInterface + + + + + + Description + + gobject.GInterface +is an abstract base class that encapsulates a GInterface. + + + + diff --git a/docs/reference/pygobject-gpointer.xml b/docs/reference/pygobject-gpointer.xml new file mode 100644 index 0000000..da16954 --- /dev/null +++ b/docs/reference/pygobject-gpointer.xml @@ -0,0 +1,42 @@ + + + + + + gobject.GPointer + + an object containing a completely opaque chunk of + data + + + + Synopsis + + + gobject.GPointer + + + + + + Ancestry + ++-- gobject.GPointer + + + + + + Description + + gobject.GPointer +is an abstract base class that encapsulates an opaque chunk of data and +registers it with the GLIB type system. A pointer type +has no methods and generic ways of copying and freeing the data. It +shouldn't be used in PyGTK. + + + + diff --git a/docs/reference/pygobject-introduction.xml b/docs/reference/pygobject-introduction.xml new file mode 100644 index 0000000..fb3e6f2 --- /dev/null +++ b/docs/reference/pygobject-introduction.xml @@ -0,0 +1,222 @@ + + + + + Introduction + + This document describes many of the PyGObject + version 2.12 classes and their methods and associated + functions. Deprecated classes, functions and methods have been + specifically left out of this reference though classes that have become + deprecated since PyGObject 2.0 have been left in but annotated with a + deprecation warning. This document attempts to document as much of the + PyGObject API as possible but there + are undoubtedly errors and omissions. If you discover any of these please + file a bug report at bugzilla.gnome.org for the + pygobject project. Specific areas that have not been + documented include: + + + + The GParamSpec class + + + + This reference describes the API for PyGObject as + of version 2.11.0+ and assumes that the additional API changes for version + 2.12 will not be significant. There will undoubtedly be changes that are + not reflected in this reference. The differences in the API between + version 2.0 and previous versions are denoted in this reference with a + Note that describes the availability of the object, constructor, method or + function. Any of these that do not have a notation can be assumed to be + available in all versions of PyGObject from 2.0 and up. The source code + must be consulted if this reference and your version of + PyGObject seem to differ. You are encouraged to use the + latest version of PyGObject that is available. See the + PyGTK + homepage for more information and more resources on how to use + PyGObject as well as help in its development. + + The Reference contains a chapter for each + PyGObject module containing the class descriptions. The + class descriptions are arranged alphabetically within the + chapters. Currently there is one module chapter: + + + + The gobject module + The classes that are included in the +gobject module of PyGObject and are +accessed similar to: gobject.GObject. These classes are the base object +classes that the gtk and gtk.gdk +module classes are built on. + + + + + + + + Reference Page Format + + Each PyGObject class is described in a reference +page that has a number of sections in a fixed format. Each reference page +will have a subset of the following sections: + + + + Name + + The name and a one-line description of the +class. + + + + Synopsis + + A synopsis of the class and its methods and +optionally a list of associated functions. + + + + Ancestry + + The list of the parent classes of the class. This +section may not be present in all class descriptions. + + + + Properties + + A list of the properties (internal state) +supported by the class. This section may not be present in all classes. The +property descriptions include the name, the access operations (e.g. Read, +Write), and a brief description. Properties are accessed using the gobject.set_property() +and gobject.get_property() +methods that are available to every PyGObject object. This +section may not be present in all class descriptions. + + + + Attributes + + A set of internal object state data accessible as Python + attributes (e.g. object.attr). The attribute descriptions include + a name by which the attribute data is accessed, the access mode + (e.g. Read, Write), and a brief description of the attribute. Most + PyGObject classes do not support attributes so + this section is not present in most class descriptions. + + + + Signal Prototypes + + A list of the signals supported by the class including + the signal name and a synopsis of the signal handler function + prototype. This section may not be present in all class + descriptions. + + + + Description + A description of the class and possibly some of + the methods supported by the class. + + + + Constructor + + The description of the class object constructor including + the synopsis with brief parameter descriptions and a description + of th use of the constructor. There may be more than one + constructor description if the constructor supports different + parameter lists. This section may not be present in all class + descriptions. + + + + Methods + + A list of methods supported by the class. Each method + description includes: a synopsis of the method and its parameters + as well as a brief description of each parameter and return value + (if any); and, a description of the use of the method. + + + + Functions + + A list of related functions. Each function description + includes a synopsis of the function and its parameters and return + value (if any), and a description of the use of the + function. + + + + Signals + + A list of signals including a synopsis of the signal + handler prototype function with its parameters and return value + (if any). The signal emission conditions are briefly + described. This section is not present in all class descriptions; + specifically, the gtk.gdk classes do not + usually support signals. + + + + + The function and method synopsis parameters are displayed in + bold to denote Python keyword + parameters. Also if the parameter is optional its default value will be + displayed. For example the gobject.signal_lookup() + function synopsis is: + + + + gobject.signal_lookup + name + type + + + + The parameters name and + type are keyword parameters that can be specified + in a call either by position or keyword (in which case position is not + important). The following calls have the same result: + + + id = gobject.signal_lookup("clicked", gtk.Button) + id = gobject.signal_lookup("clicked", type=gtk.Button) + id = gobject.signal_lookup(name="clicked", type=gtk.Button) + id = gobject.signal_lookup(type=gtk.Button, name="clicked") + + + Parameters that are not keyword parameters are displayed in +italic and must be specified positionally but may also +be optional. + + + + diff --git a/docs/reference/pygobject-ref.xml b/docs/reference/pygobject-ref.xml new file mode 100644 index 0000000..5fdd80b --- /dev/null +++ b/docs/reference/pygobject-ref.xml @@ -0,0 +1,36 @@ + + +%entities; + +]> + + + + &builddate; + PyGObject Reference Manual + for version &version; + for PyGObject version &version; + + This reference describes the classes of the python gobject +module. + + + + + + + + + + + + + + + diff --git a/docs/reference/pygobject.xml b/docs/reference/pygobject.xml new file mode 100644 index 0000000..ac41e47 --- /dev/null +++ b/docs/reference/pygobject.xml @@ -0,0 +1,1016 @@ + + + + + gobject.GObject + 3 + PyGTK Docs + + + + gobject.GObject + the base class + + + + Synopsis + + + gobject.GObject + + get_property + property_name + + + get_properties + first_property_name + ... + + + set_property + property_name + value + + + set_properties + property_name + value + ... + + + freeze_notify + + + notify + property_name + + + thaw_notify + + + get_data + key + + + set_data + key + data + + + connect + detailed_signal + handler + + + connect_after + detailed_signal + handler + + + connect_object + detailed_signal + handler + + + connect_object_after + detailed_signal + handler + + + disconnect + handler_id + + + handler_disconnect + handler_id + + + handler_is_connected + handler_id + + + handler_block + handler_id + + + handler_unblock + handler_id + + + handler_block_by_func + callable + + + handler_unblock_by_func + callable + + + emit + detailed_signal + + + stop_emission + detailed_signal + + + emit_stop_by_name + detailed_signal + + + chain + + + + + + + Ancestry + ++-- gobject.GObject + + + + + + Attributes + +
+ + + + + + + + + + "props" + Read/Write + + This attribute gives full access to GObject properties as + simple attributes. It can be used to iterate over all the object + properties, and can be used both on class or instance objects. + Examples: + +button = Button() +button_label = button.props.label +button.props.label = 'Click on this fancy button' +for pspec in button.props: + print pspec + print button.get_property(pspec.name) +label_pspec = Button.props.label +button_label = button.get_property(label_pspec.name) + + + + + "__doc__" + Read + The documentation for the object type. Uses + "__gdoc__" if no specific documentation set. + + + "__gdoc__" + Read + The generated documentation for the underlying GObject + type. + + + "__gtype__" + Read + The underlying GObject type. + + + "__grefcount__" + Read + The reference count for the underlying GObject. + + + + + +
+ +
+ + + gobject.GObject Signal Prototypes + + + + + "notify" + + callback + gobject + property_spec + user_param1 + ... + + + + + + + + + Description + The gobject.GObject + class is the base class providing the common attributes and methods for + the PyGTK classes. The gobject.GObject + class is not a user interface widget class. + + The gobject.GObject + class provides the signal management methods, the object property access + methods and the object data management methods. + + + + + Methods + + + gobject.GObject.get_property + + + get_property + property_name + + + + property_name : + a string containing the property name for the +GObject + + + Returns : + a Python object containing the value of the +property + + + + The get_property() method returns the +value of the property specified by property_name or +None if there is no value associated with the property. + The TypeError exception is raised +if the property name is not registered with the object class. + + + + + gobject.GObject.get_properties + + + get_properties + first_property_name + ... + + + + first_property_name : + a string containing the first property name for the +GObject + + + ... : + additional property names + + + + Returns : + a tuple containing the property values +requested + + + + The get_properties() method returns a tuple containing +the values of the properties requested, or +None if there is no value associated with the property. + The TypeError exception is raised +if the property name is not registered with the object class. + + + + + gobject.GObject.set_property + + + set_property + property_name + value + + + + property_name : + a string containing the property +name + + + value : + a Python object containing the property value +to be set + + + + The set_property() method sets the +property specified by property_name to the specified +value. + The TypeError exception is raised +if the property name is not registered with the object class or if the value +specified could not be converted to the property type. + + + + + gobject.GObject.set_properties + + + set_properties + property_name + value + ... + + + + property_name : + the property name + + + value : + a Python object containing the property value +to be set + + + ... : + additional property name and value +kwargs + + + + The set_properties() method sets the +property specified by property_name to the specified +value, followed by pairs of property name +and value as keyword arguments. + The TypeError exception is raised +if the property name is not registered with the object class or if the value +specified could not be converted to the property type. + + + + + gobject.GObject.freeze_notify + + + freeze_notify + + + + The freeze_notify() method freezes the +object's property-changed notification queue so that "notify" signals are +blocked until the thaw_notify() method is +called. + + + + + gobject.GObject.notify + + + notify + property_name + + + + property_name : + a string containing a property +name + + + + The notify() method causes the "notify" +signal for the property specified by property_name to +be emitted. + + + + + gobject.GObject.thaw_notify + + + thaw_notify + + + + The thaw_notify() method thaws the +object's property-changed notification queue so that "notify" signals are +emitted. + + + + + gobject.GObject.get_data + + + get_data + key + + + + key : + a string used as the key + + + Returns : + a Python object containing the associated +data + + + + The get_data() method returns the +Python object associated with the specified key or +None if there is no data associated with the key or +if there is no key associated with the object. + + + + + gobject.GObject.set_data + + + set_data + key + data + + + + key : + a string used as a key + + + data : + a Python object that is the value to be +associated with the key + + + + The set_data() method associates the +specified Python object (data) with +key. + + + + + gobject.GObject.connect + + + connect + detailed_signal + handler + ... + + + + detailed_signal : + a string containing the signal +name + + + handler : + a Python function or method +object. + + + ... : + additional optional +parameters + + + Returns : + an integer identifier + + + + The connect() method adds a function or +method (handler)to the end of the list of signal +handlers for the named detailed_signal but before the +default class signal handler. An optional set of parameters may be specified +after the handler parameter. These will all be passed +to the signal handler when invoked. + For example if a function handler was connected to a signal +using: + + handler_id = object.connect("signal_name", handler, arg1, arg2, arg3) + + The handler should be defined as: + + def handler(object, arg1, arg2, arg3): + + A method handler connected to a signal using: + + handler_id = object.connect("signal_name", self.handler, arg1, arg2) + + requires an additional argument when defined: + + def handler(self, object, arg1, arg2) + + A TypeError exception is raised +if detailed_signal identifies a signal name that is +not associated with the object. + + + + + gobject.GObject.connect_after + + + connect_after + detailed_signal + handler + ... + + + + detailed_signal : + a string containing the signal +name + + + handler : + a Python function or method +object + + + ... : + additional optional +parameters + + + Returns : + an integer handler +identifier + + + + The connect_after() method is similar +to the connect() method except that the +handler is added to the signal handler list after the +default class signal handler. Otherwise the details of +handler definition and invocation are the +same. + + + + + gobject.GObject.connect_object + + + connect_object + detailed_signal + handler + gobject + + + + detailed_signal : + a string containing the signal +name + + + handler : + a Python function or method +object + + + gobject : + a GObject + + + Returns : + an integer handler +identifier + + + + The connect_object() method is the same +as the connect() method except that the +handler is invoked with the specified +gobject in place of the object invoking the +connect_object() method. For example, a call with a +function handler: + + handler_id = object("signal_name", handler, gobject) + + will cause the handler to be invoked +as: + + handler(gobject) + + Likewise a method handler will be invoked as: + + self.handler(gobject) + + This can be helpful in invoking PyGTK widget methods that +require no arguments except the widget itself (e.g. +widget.destroy()) by using the class method as the +handler. For example, a Button "clicked" signal can be set up to invoke the +Window destroy() method as: + + + handler_id = button.connect_object("clicked", Window.destroy, window) + + + When the button is clicked the handler is invoked as: + + + Window.destroy(window) + + + which is the same as: + + + window.destroy() + + + Additional arguments may be passed to the handler as with the +connect() method handler invocations. + + + + + gobject.GObject.connect_object_after + + + connect_object_after + detailed_signal + handler + + + + detailed_signal : + a string containing the signal +name + + + handler : + a Python function or method +object + + + gobject : + a GObject + + + Returns : + an integer handler +identifier + + + + The connect_object_after() method is +similar to the connect_object() method except that +the handler is added to the signal handler list after +the default class signal handler. Otherwise the details of +handler definition and invocation are the +same. + + + + + gobject.GObject.disconnect + + + disconnect + handler_id + + + + handler_id : + an integer handler +identifier + + + + The disconnect() method removes the +signal handler with the specified handler_id from the +list of signal handlers for the object. + + + + + gobject.GObject.handler_disconnect + + + handler_disconnect + handler_id + + + + handler_id : + an integer handler +identifier + + + + The handler_disconnect() method removes +the signal handler with the specified handler_id from +the list of signal handlers for the object. + + + + + gobject.GObject.handler_is_connected + + + handler_is_connected + handler_id + + + + handler_id : + an integer handler +identifier + + + Returns : + TRUE if the signal handler +is connected to the object. + + + + The handler_is_connected() method +returns TRUE if the signal handler with the specified +handler_id is connected to the object. + + + + + gobject.GObject.handler_block + + + handler_block + handler_id + + + + handler_id : + an integer handler +identifier + + + + The handler_block() method blocks the +signal handler with the specified handler_id from +being invoked until it is unblocked. + + + + + gobject.GObject.handler_unblock + + + handler_unblock + handler_id + + + + handler_id : + an integer handler +identifier + + + + + + + gobject.GObject.handler_block_by_func + + + handler_block_by_func + callable + + + + callable : + a callable python object + + + + The handler_block_by_func() method blocks the +all signal handler connected to a specific callable from +being invoked until the callable is unblocked. + + + + + gobject.GObject.handler_unblock_by_func + + + handler_unblock_by_func + callback + + + + callable : + a callable python object + + + + The handler_unblock_by_func() method unblocks +all signal handler connected to a specified callable +thereby allowing it to be invoked when the associated signals are +emitted. + + + + + gobject.GObject.emit + + + emit + detailed_signal + ... + + + + detailed_signal : + a string containing the signal +name + + + ... : + additional parameters + + + Returns : + a PyObject* + + + The emit() method causes the object to +emit the signal specified by detailed_signal. The +additional parameters must match the number and type of the required signal +handler parameters. In most cases no additional parameters are needed. for +example: + + button.emit("clicked") + + is all that is required to emit the "clicked" signal for a +button. The most common case requiring additional parameters occurs when +emitting an event signal; for example: + + button.emit("button_press_event", event) + + + + + + gobject.GObject.stop_emission + + + stop_emission + detailed_signal + + + + detailed_signal : + a string containing the signal +name + + + + The stop_emission() method stops the +current emission of the signal specified by +detailed_signal. Any signal handlers in the list +still to be run will not be invoked. + + + + + gobject.GObject.emit_stop_by_name + + + emit_stop_by_name + detailed_signal + + + + detailed_signal : + a string containing the signal +name + + + + The emit_stop_by_name() method stops +the current emission of the signal specified by +detailed_signal. Any signal handlers in the list +still to be run will not be invoked. + + + + + gobject.GObject.chain + + + chain + ... + + + + ... : + additional parameters + + + Returns : + a Python object + + + + The chain() method does something. + + + + + + + Signals + + + The GObject "notify" Signal + + + callback + gobject + property_spec + user_param1 + ... + + + + + gobject : + the gobject that received the +signal + + + property_spec : + the gobject.GParamSpec of the property that was +changed + + + user_param1 : + the first user parameter (if any) specified +with the connect() +method + + + ... : + additional user parameters (if +any) + + + + The "notify" signal is emitted on a gobject when one of its +properties has been changed. Note that getting this signal doesn't guarantee +that the value of the property has actually changed, it may also be emitted +when the setter for the property is called to reinstate the previous +value. For example to be notified of the change of the title of a gtk.Window you could +connect to the "notify" signal similar to: + + + window.connect("notify::title", callback) + + + + + + +
diff --git a/docs/style.css b/docs/style.css new file mode 100644 index 0000000..59abc74 --- /dev/null +++ b/docs/style.css @@ -0,0 +1,10 @@ +.programlisting { +font: monospace; +background-color: #E0E0E0; +padding: 5; +} + +pre.synopsis { +background-color: #E0E0E0; +padding: 5; +} diff --git a/docs/xsl/common.xsl b/docs/xsl/common.xsl new file mode 100644 index 0000000..606313f --- /dev/null +++ b/docs/xsl/common.xsl @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/docs/xsl/devhelp.xsl b/docs/xsl/devhelp.xsl new file mode 100644 index 0000000..ce27739 --- /dev/null +++ b/docs/xsl/devhelp.xsl @@ -0,0 +1,154 @@ + + + + + + + + + + + + book + + + .devhelp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + diff --git a/docs/xsl/fixxref.py b/docs/xsl/fixxref.py new file mode 100644 index 0000000..f3287b3 --- /dev/null +++ b/docs/xsl/fixxref.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- + +import getopt +import os +import re +import sys + +anchors = {} +anchor_pat = re.compile(r'''^\s*''', + re.MULTILINE | re.VERBOSE) +link_pat = re.compile(r'''(.*?) + ''', re.DOTALL | re.VERBOSE) +def scan_index_dir(idir): + for root, dirs, files in os.walk(idir): + if 'index.sgml' in files: + scan_index_file(os.path.join(root, 'index.sgml')) + return + +def scan_index_file(ifile): + buf = open(ifile).read() + for id, href in anchor_pat.findall(buf): + anchors[id] = href + +def fix_xrefs(hdir): + for f in os.listdir(hdir): + if os.path.splitext(f)[1] == '.html': + fix_html_file(os.path.join(hdir, f)) + +def link_subst(m): + id, text = m.groups() + if anchors.has_key(id): + return '' + text + '' + return text + +def fix_html_file(hfile): + buf = open(hfile).read() + buf = link_pat.sub(link_subst, buf) + open(hfile, 'w').write(buf) + +def usage(e=None): + if e: + sys.stderr.write('fixxref.py: %s\n' % e) + sys.stderr.write('usage: fixxref.py [-i index-dir] html-dir\n') + sys.exit(1) + +if __name__ == '__main__': + try: + opts, args = getopt.getopt(sys.argv[1:], "i:h:", + ["index-dir=", "html-dir="]) + except getopt.error, e: + usage(e) + + index_dirs = [] + for opt, arg in opts: + if opt in ('-i', '--index-dir'): + index_dirs.append(arg) + + if len(args) != 1: + usage() + + for idir in index_dirs: + scan_index_dir(idir) + + html_dir = args[0] + fix_xrefs(html_dir) diff --git a/docs/xsl/fixxref.py.in b/docs/xsl/fixxref.py.in new file mode 100644 index 0000000..f3287b3 --- /dev/null +++ b/docs/xsl/fixxref.py.in @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- Mode: Python; py-indent-offset: 4 -*- + +import getopt +import os +import re +import sys + +anchors = {} +anchor_pat = re.compile(r'''^\s*''', + re.MULTILINE | re.VERBOSE) +link_pat = re.compile(r'''(.*?) + ''', re.DOTALL | re.VERBOSE) +def scan_index_dir(idir): + for root, dirs, files in os.walk(idir): + if 'index.sgml' in files: + scan_index_file(os.path.join(root, 'index.sgml')) + return + +def scan_index_file(ifile): + buf = open(ifile).read() + for id, href in anchor_pat.findall(buf): + anchors[id] = href + +def fix_xrefs(hdir): + for f in os.listdir(hdir): + if os.path.splitext(f)[1] == '.html': + fix_html_file(os.path.join(hdir, f)) + +def link_subst(m): + id, text = m.groups() + if anchors.has_key(id): + return '' + text + '' + return text + +def fix_html_file(hfile): + buf = open(hfile).read() + buf = link_pat.sub(link_subst, buf) + open(hfile, 'w').write(buf) + +def usage(e=None): + if e: + sys.stderr.write('fixxref.py: %s\n' % e) + sys.stderr.write('usage: fixxref.py [-i index-dir] html-dir\n') + sys.exit(1) + +if __name__ == '__main__': + try: + opts, args = getopt.getopt(sys.argv[1:], "i:h:", + ["index-dir=", "html-dir="]) + except getopt.error, e: + usage(e) + + index_dirs = [] + for opt, arg in opts: + if opt in ('-i', '--index-dir'): + index_dirs.append(arg) + + if len(args) != 1: + usage() + + for idir in index_dirs: + scan_index_dir(idir) + + html_dir = args[0] + fix_xrefs(html_dir) diff --git a/docs/xsl/html.xsl b/docs/xsl/html.xsl new file mode 100644 index 0000000..d8fea78 --- /dev/null +++ b/docs/xsl/html.xsl @@ -0,0 +1,285 @@ + + + +]> + + + +style.css + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
  + +  
+ -- + +  
+
+ + + + + +
+ +
+
+ +
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+      class 
+      
+      
+        (
+                )
+      
+      :&RE;
+
+      
+    
+
+ + + + + + + + , + + + + + + + + + +   + + + + + + , + + + + + + + + + , + + + + + + + + + , + + + + + + + + +      + + + + + + + + +   + + + + + + +   + + + + + + = + + + + + + + void  + + + + + + + + + + + + , + + + + + + + + + + def + + ( + + ) + + + + + + + + + + ( + + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
diff --git a/docs/xsl/pdf-style.xsl b/docs/xsl/pdf-style.xsl new file mode 100644 index 0000000..d4a8e02 --- /dev/null +++ b/docs/xsl/pdf-style.xsl @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/docs/xsl/pdf.xsl b/docs/xsl/pdf.xsl new file mode 100644 index 0000000..013bfd0 --- /dev/null +++ b/docs/xsl/pdf.xsl @@ -0,0 +1,259 @@ + + + +]> + + + +0.5in + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + class + + + ( + + ) + +  : + + + + + &RE; + + + + + + + + + , + + + + + + +   + + + + + , + + + + + + + , + + + + + + + , + + + + + + +      + + + + + + + +   + + + + +   + + + + = + + + + + void  + + + + + + + + + , + + + + + + + + def + + ( + + ) + + + + + + + + + ( + + ) + + + + + + + + + + + + + diff --git a/docs/xsl/ref-html-style.xsl b/docs/xsl/ref-html-style.xsl new file mode 100644 index 0000000..a152077 --- /dev/null +++ b/docs/xsl/ref-html-style.xsl @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + <ANCHOR id=" + + " href=" + + + / + + + "> + + + + + + + + + + + + + + + + + + + diff --git a/dsextras.py b/dsextras.py new file mode 100644 index 0000000..10973e2 --- /dev/null +++ b/dsextras.py @@ -0,0 +1,457 @@ +# +# dsextras.py - Extra classes and utilities for distutils, adding +# pkg-config support + + +from distutils.command.build_ext import build_ext +from distutils.command.install_lib import install_lib +from distutils.command.install_data import install_data +from distutils.extension import Extension +import distutils.dep_util +import fnmatch +import os +import re +import string +import sys + +GLOBAL_INC = [] +GLOBAL_MACROS = [] + +def get_m4_define(varname): + """Return the value of a m4_define variable as set in configure.in.""" + pattern = re.compile("m4_define\(" + varname + "\,\s*(.+)\)") + if os.path.exists('configure.ac'): + fname = 'configure.ac' + elif os.path.exists('configure.in'): + fname = 'configure.in' + else: + raise SystemExit('could not find configure file') + + for line in open(fname).readlines(): + match_obj = pattern.match(line) + if match_obj: + return match_obj.group(1) + + return None + +def getoutput(cmd): + """Return output (stdout or stderr) of executing cmd in a shell.""" + return getstatusoutput(cmd)[1] + +def getstatusoutput(cmd): + """Return (status, output) of executing cmd in a shell.""" + if sys.platform == 'win32': + pipe = os.popen(cmd, 'r') + text = pipe.read() + sts = pipe.close() or 0 + if text[-1:] == '\n': + text = text[:-1] + return sts, text + else: + from commands import getstatusoutput + return getstatusoutput(cmd) + +def have_pkgconfig(): + """Checks for the existence of pkg-config""" + if (sys.platform == 'win32' and + os.system('pkg-config --version > NUL') == 0): + return 1 + else: + if getstatusoutput('pkg-config')[0] == 256: + return 1 + +def list_files(dir): + """List all files in a dir, with filename match support: + for example: glade/*.glade will return all files in the glade directory + that matches *.glade. It also looks up the full path""" + if dir.find(os.sep) != -1: + parts = dir.split(os.sep) + dir = string.join(parts[:-1], os.sep) + pattern = parts[-1] + else: + pattern = dir + dir = '.' + + dir = os.path.abspath(dir) + retval = [] + for file in os.listdir(dir): + if fnmatch.fnmatch(file, pattern): + retval.append(os.path.join(dir, file)) + return retval + +def pkgc_version_check(name, req_version): + """Check the existence and version number of a package: + returns 0 if not installed or too old, 1 otherwise.""" + is_installed = not os.system('pkg-config --exists %s' % name) + if not is_installed: + return 0 + + orig_version = getoutput('pkg-config --modversion %s' % name) + version = map(int, orig_version.split('.')) + pkc_version = map(int, req_version.split('.')) + + if version >= pkc_version: + return 1 + + return 0 + +def pkgc_get_libraries(name): + """returns a list of libraries as returned by pkg-config --libs-only-l""" + output = getoutput('pkg-config --libs-only-l %s' % name) + return output.replace('-l', '').split() + +def pkgc_get_library_dirs(name): + """returns a list of library dirs as returned by pkg-config --libs-only-L""" + output = getoutput('pkg-config --libs-only-L %s' % name) + return output.replace('-L', '').split() + +def pkgc_get_include_dirs(name): + """returns a list of include dirs as returned by pkg-config --cflags-only-I""" + output = getoutput('pkg-config --cflags-only-I %s' % name) + return output.replace('-I', '').split() + +class BuildExt(build_ext): + def init_extra_compile_args(self): + self.extra_compile_args = [] + if sys.platform == 'win32' and \ + self.compiler.compiler_type == 'mingw32': + # MSVC compatible struct packing is required. + # Note gcc2 uses -fnative-struct while gcc3 + # uses -mms-bitfields. Based on the version + # the proper flag is used below. + msnative_struct = { '2' : '-fnative-struct', + '3' : '-mms-bitfields' } + gcc_version = getoutput('gcc -dumpversion') + print 'using MinGW GCC version %s with %s option' % \ + (gcc_version, msnative_struct[gcc_version[0]]) + self.extra_compile_args.append(msnative_struct[gcc_version[0]]) + + def modify_compiler(self): + if sys.platform == 'win32' and \ + self.compiler.compiler_type == 'mingw32': + # Remove '-static' linker option to prevent MinGW ld + # from trying to link with MSVC import libraries. + if self.compiler.linker_so.count('-static'): + self.compiler.linker_so.remove('-static') + + def build_extensions(self): + # Init self.extra_compile_args + self.init_extra_compile_args() + # Modify default compiler settings + self.modify_compiler() + # Invoke base build_extensions() + build_ext.build_extensions(self) + + def build_extension(self, ext): + # Add self.extra_compile_args to ext.extra_compile_args + ext.extra_compile_args += self.extra_compile_args + # Generate eventual templates before building + if hasattr(ext, 'generate'): + ext.generate() + # Filter out 'c' and 'm' libs when compilic w/ msvc + if sys.platform == 'win32' and self.compiler.compiler_type == 'msvc': + save_libs = ext.libraries + ext.libraries = [lib for lib in ext.libraries + if lib not in ['c', 'm']] + else: + save_libs = ext.libraries + # Invoke base build_extension() + build_ext.build_extension(self, ext) + if save_libs != None and save_libs != ext.libraries: + ext.libraries = save_libs + +class InstallLib(install_lib): + + local_outputs = [] + local_inputs = [] + + def set_install_dir(self, install_dir): + self.install_dir = install_dir + + def get_outputs(self): + return install_lib.get_outputs(self) + self.local_outputs + + def get_inputs(self): + return install_lib.get_inputs(self) + self.local_inputs + +class InstallData(install_data): + + local_outputs = [] + local_inputs = [] + template_options = {} + + def prepare(self): + if os.name == "nt": + self.prefix = os.sep.join(self.install_dir.split(os.sep)[:-3]) + else: + # default: os.name == "posix" + self.prefix = os.sep.join(self.install_dir.split(os.sep)[:-4]) + + self.exec_prefix = '${prefix}/bin' + self.includedir = '${prefix}/include' + self.libdir = '${prefix}/lib' + self.datarootdir = '${prefix}/share' + self.datadir = '${prefix}/share' + + self.add_template_option('prefix', self.prefix) + self.add_template_option('exec_prefix', self.exec_prefix) + self.add_template_option('includedir', self.includedir) + self.add_template_option('libdir', self.libdir) + self.add_template_option('datarootdir', self.datarootdir) + self.add_template_option('datadir', self.datadir) + self.add_template_option('PYTHON', sys.executable) + self.add_template_option('THREADING_CFLAGS', '') + + def set_install_dir(self, install_dir): + self.install_dir = install_dir + + def add_template_option(self, name, value): + self.template_options['@%s@' % name] = value + + def install_template(self, filename, install_dir): + """Install template filename into target directory install_dir.""" + output_file = os.path.split(filename)[-1][:-3] + + template = open(filename).read() + for key, value in self.template_options.items(): + template = template.replace(key, value) + + output = os.path.join(install_dir, output_file) + self.mkpath(install_dir) + open(output, 'w').write(template) + self.local_inputs.append(filename) + self.local_outputs.append(output) + return output + + def get_outputs(self): + return install_data.get_outputs(self) + self.local_outputs + + def get_inputs(self): + return install_data.get_inputs(self) + self.local_inputs + +class PkgConfigExtension(Extension): + # Name of pygobject package extension depends on, can be None + pygobject_pkc = 'pygobject-2.0' + can_build_ok = None + def __init__(self, **kwargs): + name = kwargs['pkc_name'] + if 'include_dirs' in kwargs: + kwargs['include_dirs'] += self.get_include_dirs(name) + GLOBAL_INC + else: + kwargs['include_dirs'] = self.get_include_dirs(name) + GLOBAL_INC + kwargs['define_macros'] = GLOBAL_MACROS + if 'libraries' in kwargs: + kwargs['libraries'] += self.get_libraries(name) + else: + kwargs['libraries'] = self.get_libraries(name) + if 'library_dirs' in kwargs: + kwargs['library_dirs'] += self.get_library_dirs(name) + else: + kwargs['library_dirs'] = self.get_library_dirs(name) + if 'pygobject_pkc' in kwargs: + self.pygobject_pkc = kwargs.pop('pygobject_pkc') + if self.pygobject_pkc: + kwargs['include_dirs'] += self.get_include_dirs(self.pygobject_pkc) + kwargs['libraries'] += self.get_libraries(self.pygobject_pkc) + kwargs['library_dirs'] += self.get_library_dirs(self.pygobject_pkc) + self.name = kwargs['name'] + self.pkc_name = kwargs['pkc_name'] + self.pkc_version = kwargs['pkc_version'] + del kwargs['pkc_name'], kwargs['pkc_version'] + Extension.__init__(self, **kwargs) + + def get_include_dirs(self, names): + if type(names) != tuple: + names = (names,) + retval = [] + for name in names: + output = getoutput('pkg-config --cflags-only-I %s' % name) + retval.extend(output.replace('-I', '').split()) + return retval + + def get_libraries(self, names): + if type(names) != tuple: + names = (names,) + retval = [] + for name in names: + output = getoutput('pkg-config --libs-only-l %s' % name) + retval.extend(output.replace('-l', '').split()) + return retval + + def get_library_dirs(self, names): + if type(names) != tuple: + names = (names,) + retval = [] + for name in names: + output = getoutput('pkg-config --libs-only-L %s' % name) + retval.extend(output.replace('-L', '').split()) + return retval + + def can_build(self): + """If the pkg-config version found is good enough""" + if self.can_build_ok != None: + return self.can_build_ok + + if type(self.pkc_name) != tuple: + reqs = [(self.pkc_name, self.pkc_version)] + else: + reqs = zip(self.pkc_name, self.pkc_version) + + for package, version in reqs: + retval = os.system('pkg-config --exists %s' % package) + if retval: + print ("* %s.pc could not be found, bindings for %s" + " will not be built." % (package, self.name)) + self.can_build_ok = 0 + return 0 + + orig_version = getoutput('pkg-config --modversion %s' % + package) + if (map(int, orig_version.split('.')) >= + map(int, version.split('.'))): + self.can_build_ok = 1 + return 1 + else: + print "Warning: Too old version of %s" % self.pkc_name + print " Need %s, but %s is installed" % \ + (version, orig_version) + self.can_build_ok = 0 + return 0 + + def generate(self): + pass + +# The Template and TemplateExtension classes require codegen which is +# currently part of the pygtk distribution. While codegen might ultimately +# be moved to pygobject, it was decided (bug #353849) to keep the Template +# and TemplateExtension code in dsextras. In the meantime, we check for the +# availability of codegen and redirect the user to the pygtk installer if +# he/she wants to get access to Template and TemplateExtension. + +template_classes_enabled=True +codegen_error_message=""" +*************************************************************************** +Codegen could not be found on your system and is required by the +dsextras.Template and dsextras.TemplateExtension classes. codegen is part +of PyGTK. To use either Template or TemplateExtension, you should also +install PyGTK. +*************************************************************************** +""" +try: + from codegen.override import Overrides + from codegen.defsparser import DefsParser + from codegen.codegen import register_types, SourceWriter, \ + FileOutput + import codegen.createdefs +except ImportError, e: + template_classes_enabled=False + +class Template(object): + def __new__(cls,*args, **kwds): + if not template_classes_enabled: + raise NameError("'%s' is not defined\n" % cls.__name__ + + codegen_error_message) + return object.__new__(cls,*args, **kwds) + + def __init__(self, override, output, defs, prefix, + register=[], load_types=None, py_ssize_t_clean=False): + + self.override = override + self.output = output + self.prefix = prefix + self.load_types = load_types + self.py_ssize_t_clean = py_ssize_t_clean + + self.built_defs=[] + if isinstance(defs,tuple): + self.defs=defs[0] + self.built_defs.append(defs) + else: + self.defs=defs + + self.register=[] + for r in register: + if isinstance(r,tuple): + self.register.append(r[0]) + self.built_defs.append(r) + else: + self.register.append(r) + + def check_dates(self): + # Return True if files are up-to-date + files=self.register[:] + files.append(self.override) + files.append(self.defs) + + return not distutils.dep_util.newer_group(files,self.output) + + def generate_defs(self): + for (target,sources) in self.built_defs: + if distutils.dep_util.newer_group(sources,target): + # createdefs is mostly called from the CLI ! + args=['dummy',target]+sources + codegen.createdefs.main(args) + + + def generate(self): + # Generate defs files if necessary + self.generate_defs() + # ... then check the file timestamps + if self.check_dates(): + return + + for item in self.register: + dp = DefsParser(item,dict(GLOBAL_MACROS)) + dp.startParsing() + register_types(dp) + + if self.load_types: + globals = {} + execfile(self.load_types, globals) + + dp = DefsParser(self.defs,dict(GLOBAL_MACROS)) + dp.startParsing() + register_types(dp) + + fd = open(self.output, 'w') + sw = SourceWriter(dp,Overrides(self.override), + self.prefix,FileOutput(fd,self.output)) + sw.write(self.py_ssize_t_clean) + fd.close() + +class TemplateExtension(PkgConfigExtension): + def __new__(cls,*args, **kwds): + if not template_classes_enabled: + raise NameError("'%s' is not defined\n" % cls.__name__ + + codegen_error_message) + return PkgConfigExtension.__new__(cls,*args, **kwds) + + def __init__(self, **kwargs): + name = kwargs['name'] + defs = kwargs['defs'] + if isinstance(defs,tuple): + output = defs[0][:-5] + '.c' + else: + output = defs[:-5] + '.c' + override = kwargs['override'] + load_types = kwargs.get('load_types') + py_ssize_t_clean = kwargs.pop('py_ssize_t_clean',False) + self.templates = [] + self.templates.append(Template(override, output, defs, 'py' + name, + kwargs['register'], load_types, + py_ssize_t_clean)) + + del kwargs['register'], kwargs['override'], kwargs['defs'] + if load_types: + del kwargs['load_types'] + + if kwargs.has_key('output'): + kwargs['name'] = kwargs['output'] + del kwargs['output'] + + PkgConfigExtension.__init__(self, **kwargs) + + def generate(self): + map(lambda x: x.generate(), self.templates) + + diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..41cefea --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = properties.py signal.py option.py + diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..4953cdd --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,386 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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.am $(srcdir)/Makefile.in +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 = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +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@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +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@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBFFI_PC = @LIBFFI_PC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PLATFORM = @PLATFORM@ +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_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +THREADING_CFLAGS = @THREADING_CFLAGS@ +VERSION = @VERSION@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +pygobject_CODEGEN_DEFINES = @pygobject_CODEGEN_DEFINES@ +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 +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) --gnu examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu 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 +TAGS: + +ctags: CTAGS +CTAGS: + + +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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 \ + 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 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/option.py b/examples/option.py new file mode 100644 index 0000000..345517e --- /dev/null +++ b/examples/option.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# gnome-python/pygobject/examples/option.py + +from gobject.option import OptionGroup, OptionParser, make_option + +group = OptionGroup("example", "OptionGroup Example", "Shows all example options", + option_list = [ + make_option("--example", + action="store_true", + dest="example", + help="An example option."), + ]) + +parser = OptionParser("NAMES ...", + description="A simple gobject.option example.", + option_list = [ + make_option("--file", "-f", + type="filename", + action="store", + dest="file", + help="A filename option"), + # ... + ]) + +parser.add_option_group(group) + +parser.parse_args() + +print "group: example ", group.values.example +print "parser: file", parser.values.file diff --git a/examples/properties.py b/examples/properties.py new file mode 100644 index 0000000..cc05920 --- /dev/null +++ b/examples/properties.py @@ -0,0 +1,31 @@ +import gobject + +class MyObject(gobject.GObject): + + foo = gobject.property(type=str, default='bar') + boolprop = gobject.property(type=bool, default=False) + + def __init__(self): + gobject.GObject.__init__(self) + + @gobject.property + def readonly(self): + return 'readonly' + +gobject.type_register(MyObject) + +print "MyObject properties: ", list(MyObject.props) + +obj = MyObject() + +print "obj.foo ==", obj.foo + +obj.foo = 'spam' +print "obj.foo = spam" + +print "obj.foo == ", obj.foo + +print "obj.boolprop == ", obj.boolprop + +print obj.readonly +obj.readonly = 'does-not-work' diff --git a/examples/signal.py b/examples/signal.py new file mode 100644 index 0000000..26ddae9 --- /dev/null +++ b/examples/signal.py @@ -0,0 +1,28 @@ +import pygtk; pygtk.require("2.0") +import gobject + +class C(gobject.GObject): + __gsignals__ = { + 'my_signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + (gobject.TYPE_INT,)) + } + def __init__(self): + self.__gobject_init__() # default constructor using our new GType + def do_my_signal(self, arg): + print "C: class closure for `my_signal' called with argument", arg + +class D(C): + def do_my_signal(self, arg): + print "D: class closure for `my_signal' called. Chaining up to C" + C.do_my_signal(self, arg) + +def my_signal_handler(object, arg, *extra): + print "handler for `my_signal' called with argument", arg, \ + "and extra args", extra + +inst = C() +inst2 = D() + +inst.connect("my_signal", my_signal_handler, 1, 2, 3) +inst.emit("my_signal", 42) +inst2.emit("my_signal", 42) diff --git a/gio/Makefile.am b/gio/Makefile.am new file mode 100644 index 0000000..a34fd19 --- /dev/null +++ b/gio/Makefile.am @@ -0,0 +1,116 @@ +AUTOMAKE_OPTIONS = 1.7 + +PLATFORM_VERSION = 2.0 + +INCLUDES = \ + -I$(top_srcdir)/glib \ + -I$(top_srcdir)/gobject \ + $(PYTHON_INCLUDES) \ + $(PYGOBJECT_CFLAGS) \ + $(GIO_CFLAGS) + +# defs files +defsdir = $(pkgdatadir)/$(PLATFORM_VERSION)/defs +defs_DATA = + +# python +pyexec_LTLIBRARIES = + +# gio extension modules +pkgpyexecdir = $(pyexecdir)/gtk-2.0/gio +pkgpyexec_LTLIBRARIES = + +# gio python scripts +pygiodir = $(pkgpyexecdir) +pygio_PYTHON = __init__.py + +# linker flags +common_ldflags = -module -avoid-version +if PLATFORM_WIN32 +common_ldflags += -no-undefined +endif + +CLEANFILES = +EXTRA_DIST = + +# gio module +GIO_OVERRIDES = \ + gio.override \ + gappinfo.override \ + gapplaunchcontext.override \ + gbufferedinputstream.override \ + gcancellable.override \ + gdatainputstream.override \ + gdrive.override \ + gfile.override \ + gfileattribute.override \ + gfileenumerator.override \ + gfileinfo.override \ + gfileinputstream.override \ + gfileiostream.override \ + gfileoutputstream.override \ + gicon.override \ + giostream.override \ + ginputstream.override \ + gmemoryinputstream.override \ + gmemoryoutputstream.override \ + gmount.override \ + goutputstream.override \ + gresolver.override \ + gsocket.override \ + gvolume.override \ + gvolumemonitor.override + +GIO_DEFS = gio.defs gio-types.defs $(GIO_OVERRIDES) +CLEANFILES += gio.c +EXTRA_DIST += $(GIO_DEFS) $(GIO_OVERRIDES) +gio.c: $(GIO_DEFS) $(GIO_OVERRIDES) +_gio_la_CFLAGS = $(GIO_CFLAGS) +_gio_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gio +_gio_la_LIBADD = $(GIO_LIBS) $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la +_gio_la_SOURCES = \ + giomodule.c \ + pygio-utils.c \ + pygio-utils.h +nodist__gio_la_SOURCES = gio.c +if BUILD_GIO +pkgpyexec_LTLIBRARIES += _gio.la +defs_DATA += $(GIO_DEFS) +endif + +# giounix module +GIOUNIX_DEFS = unix.defs unix-types.defs unix.override +CLEANFILES += unix.c +EXTRA_DIST += $(GIOUNIX_DEFS) unix.override +unix.c: $(GIOUNIX_DEFS) unix.override +unix_la_CFLAGS = $(GIOUNIX_CFLAGS) +unix_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initunix +unix_la_LIBADD = $(GIOUNIX_LIBS) +unix_la_SOURCES = unixmodule.c +nodist_unix_la_SOURCES = unix.c +if BUILD_GIOUNIX +pkgpyexec_LTLIBRARIES += unix.la +defs_DATA += $(GIOUNIX_DEFS) +endif + + +# code generator +.defs.c: + (cd $(srcdir)\ + && $(PYTHON) $(top_srcdir)/codegen/codegen.py \ + --py_ssize_t-clean \ + --register gio-types.defs \ + --register unix-types.defs \ + --override $*.override \ + --prefix py$(*F) $*.defs) > $(*D)/gen-$(*F).c \ + && cp $(*D)/gen-$(*F).c $(*D)/$(*F).c \ + && rm -f $(*D)/gen-$(*F).c + + +if BUILD_GIO +all: $(pkgpyexec_LTLIBRARIES:.la=.so) +clean-local: + rm -f $(pkgpyexec_LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true +endif diff --git a/gio/Makefile.in b/gio/Makefile.in new file mode 100644 index 0000000..f0cd632 --- /dev/null +++ b/gio/Makefile.in @@ -0,0 +1,807 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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@ +@PLATFORM_WIN32_TRUE@am__append_1 = -no-undefined +@BUILD_GIO_TRUE@am__append_2 = _gio.la +@BUILD_GIO_TRUE@am__append_3 = $(GIO_DEFS) +@BUILD_GIOUNIX_TRUE@am__append_4 = unix.la +@BUILD_GIOUNIX_TRUE@am__append_5 = $(GIOUNIX_DEFS) +subdir = gio +DIST_COMMON = $(pygio_PYTHON) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +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__installdirs = "$(DESTDIR)$(pkgpyexecdir)" "$(DESTDIR)$(pyexecdir)" \ + "$(DESTDIR)$(pygiodir)" "$(DESTDIR)$(defsdir)" +LTLIBRARIES = $(pkgpyexec_LTLIBRARIES) $(pyexec_LTLIBRARIES) +am__DEPENDENCIES_1 = +_gio_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la +am__gio_la_OBJECTS = _gio_la-giomodule.lo _gio_la-pygio-utils.lo +nodist__gio_la_OBJECTS = _gio_la-gio.lo +_gio_la_OBJECTS = $(am__gio_la_OBJECTS) $(nodist__gio_la_OBJECTS) +_gio_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(_gio_la_CFLAGS) $(CFLAGS) \ + $(_gio_la_LDFLAGS) $(LDFLAGS) -o $@ +@BUILD_GIO_TRUE@am__gio_la_rpath = -rpath $(pkgpyexecdir) +unix_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_unix_la_OBJECTS = unix_la-unixmodule.lo +nodist_unix_la_OBJECTS = unix_la-unix.lo +unix_la_OBJECTS = $(am_unix_la_OBJECTS) $(nodist_unix_la_OBJECTS) +unix_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(unix_la_CFLAGS) $(CFLAGS) \ + $(unix_la_LDFLAGS) $(LDFLAGS) -o $@ +@BUILD_GIOUNIX_TRUE@am_unix_la_rpath = -rpath $(pkgpyexecdir) +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) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(_gio_la_SOURCES) $(nodist__gio_la_SOURCES) \ + $(unix_la_SOURCES) $(nodist_unix_la_SOURCES) +DIST_SOURCES = $(_gio_la_SOURCES) $(unix_la_SOURCES) +py_compile = $(top_srcdir)/py-compile +DATA = $(defs_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +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@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +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@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBFFI_PC = @LIBFFI_PC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PLATFORM = @PLATFORM@ +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_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +THREADING_CFLAGS = @THREADING_CFLAGS@ +VERSION = @VERSION@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +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@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ + +# gio extension modules +pkgpyexecdir = $(pyexecdir)/gtk-2.0/gio +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pygobject_CODEGEN_DEFINES = @pygobject_CODEGEN_DEFINES@ +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 = 2.0 +INCLUDES = \ + -I$(top_srcdir)/glib \ + -I$(top_srcdir)/gobject \ + $(PYTHON_INCLUDES) \ + $(PYGOBJECT_CFLAGS) \ + $(GIO_CFLAGS) + + +# defs files +defsdir = $(pkgdatadir)/$(PLATFORM_VERSION)/defs +defs_DATA = $(am__append_3) $(am__append_5) + +# python +pyexec_LTLIBRARIES = +pkgpyexec_LTLIBRARIES = $(am__append_2) $(am__append_4) + +# gio python scripts +pygiodir = $(pkgpyexecdir) +pygio_PYTHON = __init__.py + +# linker flags +common_ldflags = -module -avoid-version $(am__append_1) +CLEANFILES = gio.c unix.c +EXTRA_DIST = $(GIO_DEFS) $(GIO_OVERRIDES) $(GIOUNIX_DEFS) \ + unix.override + +# gio module +GIO_OVERRIDES = \ + gio.override \ + gappinfo.override \ + gapplaunchcontext.override \ + gbufferedinputstream.override \ + gcancellable.override \ + gdatainputstream.override \ + gdrive.override \ + gfile.override \ + gfileattribute.override \ + gfileenumerator.override \ + gfileinfo.override \ + gfileinputstream.override \ + gfileiostream.override \ + gfileoutputstream.override \ + gicon.override \ + giostream.override \ + ginputstream.override \ + gmemoryinputstream.override \ + gmemoryoutputstream.override \ + gmount.override \ + goutputstream.override \ + gresolver.override \ + gsocket.override \ + gvolume.override \ + gvolumemonitor.override + +GIO_DEFS = gio.defs gio-types.defs $(GIO_OVERRIDES) +_gio_la_CFLAGS = $(GIO_CFLAGS) +_gio_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gio +_gio_la_LIBADD = $(GIO_LIBS) $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la +_gio_la_SOURCES = \ + giomodule.c \ + pygio-utils.c \ + pygio-utils.h + +nodist__gio_la_SOURCES = gio.c + +# giounix module +GIOUNIX_DEFS = unix.defs unix-types.defs unix.override +unix_la_CFLAGS = $(GIOUNIX_CFLAGS) +unix_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initunix +unix_la_LIBADD = $(GIOUNIX_LIBS) +unix_la_SOURCES = unixmodule.c +nodist_unix_la_SOURCES = unix.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .defs .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) --gnu gio/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu gio/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-pkgpyexecLTLIBRARIES: $(pkgpyexec_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgpyexecdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgpyexecdir)" + @list='$(pkgpyexec_LTLIBRARIES)'; test -n "$(pkgpyexecdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgpyexecdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgpyexecdir)"; \ + } + +uninstall-pkgpyexecLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkgpyexec_LTLIBRARIES)'; test -n "$(pkgpyexecdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgpyexecdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgpyexecdir)/$$f"; \ + done + +clean-pkgpyexecLTLIBRARIES: + -test -z "$(pkgpyexec_LTLIBRARIES)" || rm -f $(pkgpyexec_LTLIBRARIES) + @list='$(pkgpyexec_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +install-pyexecLTLIBRARIES: $(pyexec_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pyexecdir)" || $(MKDIR_P) "$(DESTDIR)$(pyexecdir)" + @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 " $(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)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +_gio.la: $(_gio_la_OBJECTS) $(_gio_la_DEPENDENCIES) + $(_gio_la_LINK) $(am__gio_la_rpath) $(_gio_la_OBJECTS) $(_gio_la_LIBADD) $(LIBS) +unix.la: $(unix_la_OBJECTS) $(unix_la_DEPENDENCIES) + $(unix_la_LINK) $(am_unix_la_rpath) $(unix_la_OBJECTS) $(unix_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gio_la-gio.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gio_la-giomodule.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_gio_la-pygio-utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix_la-unix.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix_la-unixmodule.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +_gio_la-giomodule.lo: giomodule.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gio_la_CFLAGS) $(CFLAGS) -MT _gio_la-giomodule.lo -MD -MP -MF $(DEPDIR)/_gio_la-giomodule.Tpo -c -o _gio_la-giomodule.lo `test -f 'giomodule.c' || echo '$(srcdir)/'`giomodule.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/_gio_la-giomodule.Tpo $(DEPDIR)/_gio_la-giomodule.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='giomodule.c' object='_gio_la-giomodule.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gio_la_CFLAGS) $(CFLAGS) -c -o _gio_la-giomodule.lo `test -f 'giomodule.c' || echo '$(srcdir)/'`giomodule.c + +_gio_la-pygio-utils.lo: pygio-utils.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gio_la_CFLAGS) $(CFLAGS) -MT _gio_la-pygio-utils.lo -MD -MP -MF $(DEPDIR)/_gio_la-pygio-utils.Tpo -c -o _gio_la-pygio-utils.lo `test -f 'pygio-utils.c' || echo '$(srcdir)/'`pygio-utils.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/_gio_la-pygio-utils.Tpo $(DEPDIR)/_gio_la-pygio-utils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygio-utils.c' object='_gio_la-pygio-utils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gio_la_CFLAGS) $(CFLAGS) -c -o _gio_la-pygio-utils.lo `test -f 'pygio-utils.c' || echo '$(srcdir)/'`pygio-utils.c + +_gio_la-gio.lo: gio.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gio_la_CFLAGS) $(CFLAGS) -MT _gio_la-gio.lo -MD -MP -MF $(DEPDIR)/_gio_la-gio.Tpo -c -o _gio_la-gio.lo `test -f 'gio.c' || echo '$(srcdir)/'`gio.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/_gio_la-gio.Tpo $(DEPDIR)/_gio_la-gio.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gio.c' object='_gio_la-gio.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gio_la_CFLAGS) $(CFLAGS) -c -o _gio_la-gio.lo `test -f 'gio.c' || echo '$(srcdir)/'`gio.c + +unix_la-unixmodule.lo: unixmodule.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(unix_la_CFLAGS) $(CFLAGS) -MT unix_la-unixmodule.lo -MD -MP -MF $(DEPDIR)/unix_la-unixmodule.Tpo -c -o unix_la-unixmodule.lo `test -f 'unixmodule.c' || echo '$(srcdir)/'`unixmodule.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/unix_la-unixmodule.Tpo $(DEPDIR)/unix_la-unixmodule.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='unixmodule.c' object='unix_la-unixmodule.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(unix_la_CFLAGS) $(CFLAGS) -c -o unix_la-unixmodule.lo `test -f 'unixmodule.c' || echo '$(srcdir)/'`unixmodule.c + +unix_la-unix.lo: unix.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(unix_la_CFLAGS) $(CFLAGS) -MT unix_la-unix.lo -MD -MP -MF $(DEPDIR)/unix_la-unix.Tpo -c -o unix_la-unix.lo `test -f 'unix.c' || echo '$(srcdir)/'`unix.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/unix_la-unix.Tpo $(DEPDIR)/unix_la-unix.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='unix.c' object='unix_la-unix.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(unix_la_CFLAGS) $(CFLAGS) -c -o unix_la-unix.lo `test -f 'unix.c' || echo '$(srcdir)/'`unix.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pygioPYTHON: $(pygio_PYTHON) + @$(NORMAL_INSTALL) + test -z "$(pygiodir)" || $(MKDIR_P) "$(DESTDIR)$(pygiodir)" + @list='$(pygio_PYTHON)'; dlist=; list2=; test -n "$(pygiodir)" || list=; \ + 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)$(pygiodir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pygiodir)" || exit $$?; \ + done || exit $$?; \ + if test -n "$$dlist"; then \ + if test -z "$(DESTDIR)"; then \ + PYTHON=$(PYTHON) $(py_compile) --basedir "$(pygiodir)" $$dlist; \ + else \ + PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pygiodir)" $$dlist; \ + fi; \ + else :; fi + +uninstall-pygioPYTHON: + @$(NORMAL_UNINSTALL) + @list='$(pygio_PYTHON)'; test -n "$(pygiodir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + filesc=`echo "$$files" | sed 's|$$|c|'`; \ + fileso=`echo "$$files" | sed 's|$$|o|'`; \ + echo " ( cd '$(DESTDIR)$(pygiodir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pygiodir)" && rm -f $$files || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pygiodir)' && rm -f" $$filesc ")"; \ + cd "$(DESTDIR)$(pygiodir)" && rm -f $$filesc || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pygiodir)' && rm -f" $$fileso ")"; \ + cd "$(DESTDIR)$(pygiodir)" && rm -f $$fileso +install-defsDATA: $(defs_DATA) + @$(NORMAL_INSTALL) + test -z "$(defsdir)" || $(MKDIR_P) "$(DESTDIR)$(defsdir)" + @list='$(defs_DATA)'; test -n "$(defsdir)" || list=; \ + 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)$(defsdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(defsdir)" || exit $$?; \ + done + +uninstall-defsDATA: + @$(NORMAL_UNINSTALL) + @list='$(defs_DATA)'; test -n "$(defsdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(defsdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(defsdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(pkgpyexecdir)" "$(DESTDIR)$(pyexecdir)" "$(DESTDIR)$(pygiodir)" "$(DESTDIR)$(defsdir)"; 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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." +@BUILD_GIO_FALSE@clean-local: +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local \ + clean-pkgpyexecLTLIBRARIES clean-pyexecLTLIBRARIES \ + 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-defsDATA install-pygioPYTHON + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkgpyexecLTLIBRARIES \ + install-pyexecLTLIBRARIES + +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-defsDATA uninstall-pkgpyexecLTLIBRARIES \ + uninstall-pyexecLTLIBRARIES uninstall-pygioPYTHON + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-local clean-pkgpyexecLTLIBRARIES \ + clean-pyexecLTLIBRARIES ctags 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-defsDATA 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-pkgpyexecLTLIBRARIES \ + install-ps install-ps-am install-pyexecLTLIBRARIES \ + install-pygioPYTHON 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 uninstall \ + uninstall-am uninstall-defsDATA uninstall-pkgpyexecLTLIBRARIES \ + uninstall-pyexecLTLIBRARIES uninstall-pygioPYTHON + +gio.c: $(GIO_DEFS) $(GIO_OVERRIDES) +unix.c: $(GIOUNIX_DEFS) unix.override + +# code generator +.defs.c: + (cd $(srcdir)\ + && $(PYTHON) $(top_srcdir)/codegen/codegen.py \ + --py_ssize_t-clean \ + --register gio-types.defs \ + --register unix-types.defs \ + --override $*.override \ + --prefix py$(*F) $*.defs) > $(*D)/gen-$(*F).c \ + && cp $(*D)/gen-$(*F).c $(*D)/$(*F).c \ + && rm -f $(*D)/gen-$(*F).c + +@BUILD_GIO_TRUE@all: $(pkgpyexec_LTLIBRARIES:.la=.so) +@BUILD_GIO_TRUE@clean-local: +@BUILD_GIO_TRUE@ rm -f $(pkgpyexec_LTLIBRARIES:.la=.so) +@BUILD_GIO_TRUE@.la.so: +@BUILD_GIO_TRUE@ $(LN_S) .libs/$@ $@ || true + +# 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/gio/__init__.py b/gio/__init__.py new file mode 100644 index 0000000..c4b02bb --- /dev/null +++ b/gio/__init__.py @@ -0,0 +1,40 @@ +# -*- Mode: Python -*- +# pygobject - Python bindings for the GObject library +# Copyright (C) 2008 Johan Dahlin +# +# gio/__init__.py: initialisation file for gio 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 gobject import GObjectMeta +from _gio import * +from _gio import \ + _app_info_init, _install_app_info_meta, \ + _file_init, _install_file_meta +try: + import unix + unix # pyflakes +except ImportError: + unix = None +del _gio + +class GFileMeta(GObjectMeta): + __call__ = _file_init +_install_file_meta(GFileMeta) + +class GAppInfoMeta(GObjectMeta): + __call__ = _app_info_init +_install_app_info_meta(GAppInfoMeta) diff --git a/gio/gappinfo.override b/gio/gappinfo.override new file mode 100644 index 0000000..414769b --- /dev/null +++ b/gio/gappinfo.override @@ -0,0 +1,208 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * Copyright (C) 2008 Gian Mario Tagliaretti + * + * gappinfo.override: module overrides for GInputStream + * + * 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 + */ +%% +define _install_app_info_meta +static PyObject * +_wrap__install_app_info_meta(PyObject *self, PyObject *args) +{ + PyObject *metaclass; + + if (!PyArg_ParseTuple(args, "O", &metaclass)) + return NULL; + + Py_INCREF(metaclass); + PyGAppInfo_Type.ob_type = (PyTypeObject*)metaclass; + + Py_INCREF(Py_None); + return Py_None; +} +%% +define _app_info_init kwargs +static PyObject * +_wrap__app_info_init(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "commandline", "application_name", + "flags", NULL }; + char *commandline, *application_name = NULL; + PyObject *py_flags = NULL; + GAppInfo *ret; + GError *error = NULL; + GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s|zO:gio.AppInfo", + kwlist, + &commandline, &application_name, + &py_flags)) + return NULL; + if (py_flags && pyg_flags_get_value(G_TYPE_APP_INFO_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + return NULL; + + ret = g_app_info_create_from_commandline(commandline, + application_name, flags, &error); + + if (pyg_error_check(&error)) + return NULL; + + /* pygobject_new handles NULL checking */ + return pygobject_new((GObject *)ret); +} +%% +override g_app_info_launch_uris kwargs +static PyObject * +_wrap_g_app_info_launch_uris(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "files", "launch_context", NULL }; + + GList *file_list = NULL; + PyGObject *pycontext = NULL; + GAppLaunchContext *ctx; + PyObject *pyfile_list = Py_None; + int ret; + GError *error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|OO:gio.AppInfo.launch_uris", + kwlist, + &pyfile_list, &pycontext)) + return NULL; + + if (!pygio_check_launch_context(pycontext, &ctx)) + return NULL; + + if (pyfile_list == Py_None) + file_list = NULL; + + else if (PySequence_Check (pyfile_list)) + file_list = pygio_pylist_to_uri_glist(pyfile_list); + + else { + PyErr_SetString(PyExc_TypeError, + "file_list should be a list of strings or None"); + return NULL; + } + + ret = g_app_info_launch_uris(G_APP_INFO(self->obj), + file_list, ctx, &error); + + g_list_free(file_list); + + if (pyg_error_check(&error)) + return NULL; + + return PyBool_FromLong(ret); +} +%% +override g_app_info_launch kwargs +static PyObject * +_wrap_g_app_info_launch(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "files", "launch_context", NULL }; + + GList *file_list = NULL; + PyGObject *pycontext = NULL; + GAppLaunchContext *ctx; + PyObject *pyfile_list = Py_None; + int ret; + GError *error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|OO:gio.AppInfo.launch", + kwlist, + &pyfile_list, &pycontext)) + return NULL; + + if (!pygio_check_launch_context(pycontext, &ctx)) + return NULL; + + if (pyfile_list == Py_None) + file_list = NULL; + + else if (PySequence_Check (pyfile_list)) + file_list = pygio_pylist_to_gfile_glist(pyfile_list); + + else { + PyErr_SetString(PyExc_TypeError, + "file_list should be a list of strings or None"); + return NULL; + } + + ret = g_app_info_launch(G_APP_INFO(self->obj), + file_list, ctx, &error); + + g_list_free(file_list); + + if (pyg_error_check(&error)) + return NULL; + + return PyBool_FromLong(ret); +} +%% +override-slot GAppInfo.tp_richcompare +static PyObject * +_wrap_g_app_info_tp_richcompare(PyGObject *self, PyGObject *other, int op) +{ + PyObject *result; + + if (PyObject_TypeCheck(self, &PyGAppInfo_Type) + && PyObject_TypeCheck(other, &PyGAppInfo_Type)) { + GAppInfo *info1 = G_APP_INFO(self->obj); + GAppInfo *info2 = G_APP_INFO(other->obj); + + switch (op) { + case Py_EQ: + result = (g_app_info_equal(info1, info2) + ? Py_True : Py_False); + break; + case Py_NE: + result = (!g_app_info_equal(info1, info2) + ? Py_True : Py_False); + break; + default: + result = Py_NotImplemented; + } + } + else + result = Py_NotImplemented; + + Py_INCREF(result); + return result; +} +%% +override-slot GAppInfo.tp_repr +static PyObject * +_wrap_g_app_info_tp_repr(PyGObject *self) +{ + const char *name = g_app_info_get_name(G_APP_INFO(self->obj)); + gchar *representation; + PyObject *result; + + representation = g_strdup_printf("<%s at %p: %s>", + self->ob_type->tp_name, self, + name ? name : "UNKNOWN NAME"); + + result = PyString_FromString(representation); + g_free(representation); + return result; +} diff --git a/gio/gapplaunchcontext.override b/gio/gapplaunchcontext.override new file mode 100644 index 0000000..a10f959 --- /dev/null +++ b/gio/gapplaunchcontext.override @@ -0,0 +1,99 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Gian Mario Tagliaretti + * + * gapplaunchcontext.override: module overrides for GAppLaunchContext + * + * 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 + */ + +%% +override g_app_launch_context_get_display kwargs +static PyObject * +_wrap_g_app_launch_context_get_display(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "info", "files", NULL }; + + GList *file_list = NULL; + PyGObject *py_info; + PyObject *pyfile_list; + gchar *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!O:gio.AppLaunchContext.get_display", + kwlist, + &PyGAppInfo_Type, &py_info, &pyfile_list)) + return NULL; + + if (!PySequence_Check (pyfile_list)) { + PyErr_Format (PyExc_TypeError, + "argument must be a list or tuple of GFile objects"); + return NULL; + } + + file_list = pygio_pylist_to_gfile_glist(pyfile_list); + + ret = g_app_launch_context_get_display(G_APP_LAUNCH_CONTEXT(self->obj), + G_APP_INFO(py_info->obj), file_list); + g_list_free(file_list); + + if (ret) + return PyString_FromString(ret); + + Py_INCREF(Py_None); + return Py_None; +} +%% +override g_app_launch_context_get_startup_notify_id kwargs +static PyObject * +_wrap_g_app_launch_context_get_startup_notify_id(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "info", "files", NULL }; + + GList *file_list = NULL; + PyGObject *py_info; + PyObject *pyfile_list; + gchar *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!O:gio.AppLaunchContext.get_startup_notify_id", + kwlist, + &PyGAppInfo_Type, &py_info, &pyfile_list)) + return NULL; + + if (!PySequence_Check (pyfile_list)) { + PyErr_Format (PyExc_TypeError, + "argument must be a list or tuple of GFile objects"); + return NULL; + } + + file_list = pygio_pylist_to_gfile_glist(pyfile_list); + + ret = g_app_launch_context_get_startup_notify_id( + G_APP_LAUNCH_CONTEXT(self->obj), + G_APP_INFO(py_info->obj), file_list); + g_list_free(file_list); + + if (ret) + return PyString_FromString(ret); + + Py_INCREF(Py_None); + return Py_None; +} diff --git a/gio/gbufferedinputstream.override b/gio/gbufferedinputstream.override new file mode 100644 index 0000000..047a663 --- /dev/null +++ b/gio/gbufferedinputstream.override @@ -0,0 +1,70 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gbufferedinputstream.override: module overrides for GBufferedInputStream + * + * 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 + */ +%% +override g_buffered_input_stream_fill_async kwargs +static PyObject * +_wrap_g_buffered_input_stream_fill_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "count", "callback", "io_priority", + "cancellable", "user_data", NULL }; + long count = -1; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "lO|iOO:gio.BufferedInputStream.fill_async", + kwlist, + &count, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_buffered_input_stream_fill_async(G_BUFFERED_INPUT_STREAM(self->obj), + count, + io_priority, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gcancellable.override b/gio/gcancellable.override new file mode 100644 index 0000000..1eefb3b --- /dev/null +++ b/gio/gcancellable.override @@ -0,0 +1,38 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gcancellable.override: module overrides for GCancellable + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +%% +override g_cancellable_make_pollfd noargs +static PyObject * +_wrap_g_cancellable_make_pollfd (PyGObject *self) +{ + GPollFD pollfd; + gboolean ret; + PyGPollFD *pypollfd; + + ret = g_cancellable_make_pollfd(G_CANCELLABLE(self->obj), &pollfd); + + pypollfd = PyObject_NEW(PyGPollFD, &PyGPollFD_Type); + pypollfd->fd_obj = NULL; + pypollfd->pollfd = pollfd; + return (PyObject *) pypollfd; +} diff --git a/gio/gdatainputstream.override b/gio/gdatainputstream.override new file mode 100644 index 0000000..92b0f99 --- /dev/null +++ b/gio/gdatainputstream.override @@ -0,0 +1,250 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * Copyright (C) 2009 Paul Pogonyshev + * + * gdatainputstream.override: module overrides for GDataInputStream + * + * 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 + */ + +%% +override g_data_input_stream_read_line kwargs +static PyObject * +_wrap_g_data_input_stream_read_line(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "cancellable", NULL }; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + char *line; + gsize length; + PyObject *py_line; + GError *error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|O:gio.DataInputStream.read_line", + kwlist, &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + line = g_data_input_stream_read_line(G_DATA_INPUT_STREAM(self->obj), + &length, cancellable, &error); + if (pyg_error_check(&error)) + return NULL; + + py_line = PyString_FromStringAndSize(line, length); + g_free(line); + return py_line; +} + +%% +override g_data_input_stream_read_line_async kwargs +static PyObject * +_wrap_g_data_input_stream_read_line_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", + "cancellable", "user_data", NULL }; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:gio.DataInputStream.read_line_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_data_input_stream_read_line_async(G_DATA_INPUT_STREAM(self->obj), + io_priority, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} + +%% +override g_data_input_stream_read_line_finish kwargs +static PyObject * +_wrap_g_data_input_stream_read_line_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *result; + GError *error = NULL; + gchar *line; + gsize length; + PyObject *py_line; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:gio.DataInputStream.read_line_finish", + kwlist, &PyGAsyncResult_Type, &result)) + return NULL; + + line = g_data_input_stream_read_line_finish(G_DATA_INPUT_STREAM(self->obj), + G_ASYNC_RESULT(result->obj), + &length, + &error); + + if (pyg_error_check(&error)) + return NULL; + + py_line = PyString_FromStringAndSize(line, length); + g_free(line); + return py_line; +} + +%% +override g_data_input_stream_read_until kwargs +static PyObject * +_wrap_g_data_input_stream_read_until(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "stop_chars", "cancellable", NULL }; + const char *stop_chars; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + char *line; + gsize length; + PyObject *py_line; + GError *error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s|O:gio.DataInputStream.read_line", + kwlist, &stop_chars, &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + line = g_data_input_stream_read_until(G_DATA_INPUT_STREAM(self->obj), + stop_chars, &length, cancellable, &error); + if (pyg_error_check(&error)) + return NULL; + + py_line = PyString_FromStringAndSize(line, length); + g_free(line); + return py_line; +} + +%% +override g_data_input_stream_read_until_async kwargs +static PyObject * +_wrap_g_data_input_stream_read_until_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "stop_chars", "callback", "io_priority", + "cancellable", "user_data", NULL }; + const char *stop_chars; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|iOO:gio.DataInputStream.read_until_async", + kwlist, + &stop_chars, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_data_input_stream_read_until_async(G_DATA_INPUT_STREAM(self->obj), + stop_chars, + io_priority, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} + +%% +override g_data_input_stream_read_until_finish kwargs +static PyObject * +_wrap_g_data_input_stream_read_until_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *result; + GError *error = NULL; + gchar *line; + gsize length; + PyObject *py_line; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:gio.DataInputStream.read_until_finish", + kwlist, &PyGAsyncResult_Type, &result)) + return NULL; + + line = g_data_input_stream_read_until_finish(G_DATA_INPUT_STREAM(self->obj), + G_ASYNC_RESULT(result->obj), + &length, + &error); + + if (pyg_error_check(&error)) + return NULL; + + py_line = PyString_FromStringAndSize(line, length); + g_free(line); + return py_line; +} diff --git a/gio/gdrive.override b/gio/gdrive.override new file mode 100644 index 0000000..7961856 --- /dev/null +++ b/gio/gdrive.override @@ -0,0 +1,347 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gdrive.override: module overrides for GDrive and related 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +%% +override g_drive_get_volumes noargs +static PyObject * +_wrap_g_drive_get_volumes (PyGObject *self) +{ + GList *list, *l; + PyObject *ret; + + pyg_begin_allow_threads; + + list = g_drive_get_volumes (G_DRIVE (self->obj)); + + pyg_end_allow_threads; + + ret = PyList_New(0); + for (l = list; l; l = l->next) { + GVolume *volume = l->data; + PyObject *item = pygobject_new((GObject *)volume); + PyList_Append(ret, item); + Py_DECREF(item); + g_object_unref(volume); + } + g_list_free(list); + + return ret; +} +%% +override g_drive_eject kwargs +static PyObject * +_wrap_g_drive_eject(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOO:gio.Drive.eject", + kwlist, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (PyErr_Warn(PyExc_DeprecationWarning, + "gio.Drive.ejectis deprecated, \ + use gtk.Drive.eject_with_operation instead") < 0) + return NULL; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_drive_eject(G_DRIVE(self->obj), + flags, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_drive_poll_for_media kwargs +static PyObject * +_wrap_g_drive_poll_for_media(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OO:gio.Drive.eject", + kwlist, + ¬ify->callback, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + pyg_begin_allow_threads; + + g_drive_poll_for_media(G_DRIVE(self->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + pyg_end_allow_threads; + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override-slot GDrive.tp_repr +static PyObject * +_wrap_g_drive_tp_repr(PyGObject *self) +{ + char *name = g_drive_get_name(G_DRIVE(self->obj)); + gchar *representation; + PyObject *result; + + if (name) { + representation = g_strdup_printf("<%s at %p: %s>", self->ob_type->tp_name, self, name); + g_free(name); + } + else + representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self); + + result = PyString_FromString(representation); + g_free(representation); + return result; +} +%% +override g_drive_enumerate_identifiers noargs +static PyObject * +_wrap_g_drive_enumerate_identifiers (PyGObject *self) +{ + char **ids; + PyObject *ret; + + pyg_begin_allow_threads; + + ids = g_drive_enumerate_identifiers(G_DRIVE (self->obj)); + + pyg_end_allow_threads; + + if (ids && ids[0] != NULL) { + ret = strv_to_pylist(ids); + g_strfreev (ids); + } else { + ret = Py_None; + Py_INCREF(ret); + } + return ret; +} +%% +override g_drive_eject_with_operation kwargs +static PyObject * +_wrap_g_drive_eject_with_operation(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:gio.Drive.eject_with_operation", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_drive_eject_with_operation(G_DRIVE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_drive_start kwargs +static PyObject * +_wrap_g_drive_start(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + GDriveStartFlags flags = G_DRIVE_START_NONE; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:gio.Drive.start", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_DRIVE_START_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_drive_start(G_DRIVE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_drive_stop kwargs +static PyObject * +_wrap_g_drive_stop(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:gio.Drive.stop", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_drive_stop(G_DRIVE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gfile.override b/gio/gfile.override new file mode 100644 index 0000000..71e2d98 --- /dev/null +++ b/gio/gfile.override @@ -0,0 +1,2216 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * gfile.override: module overrides for GInputStream + * + * 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 + */ +%% +headers + +static void +file_progress_callback_marshal(goffset current_num_bytes, + goffset total_num_bytes, + PyGIONotify *notify) +{ + PyObject *ret; + PyGILState_STATE state; + + state = pyg_gil_state_ensure(); + + if (notify->data) + ret = PyObject_CallFunction(notify->callback, "(KKO)", + current_num_bytes, + total_num_bytes, + notify->data); + else + ret = PyObject_CallFunction(notify->callback, "(KK)", + current_num_bytes, + total_num_bytes); + + if (ret == NULL) + { + PyErr_Print(); + PyErr_Clear(); + } + + Py_XDECREF(ret); + pyg_gil_state_release(state); +} +%% +define _install_file_meta +static PyObject * +_wrap__install_file_meta(PyObject *self, PyObject *args) +{ + PyObject *metaclass; + + if (!PyArg_ParseTuple(args, "O", &metaclass)) + return NULL; + + Py_INCREF(metaclass); + PyGFile_Type.ob_type = (PyTypeObject*)metaclass; + + Py_INCREF(Py_None); + return Py_None; +} +%% +define _file_init kwargs +static PyObject* +_wrap__file_init(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + GFile *file; + Py_ssize_t n_args, n_kwargs; + char *arg; + PyObject *py_ret; + + n_args = PyTuple_Size(args); + n_kwargs = kwargs != NULL ? PyDict_Size(kwargs) : 0; + + if (n_args == 1 && n_kwargs == 0) { + if (!PyArg_ParseTuple(args, "s:gio.File.__init__", &arg)) + return NULL; + file = g_file_new_for_commandline_arg(arg); + } else if (n_args == 0 && n_kwargs == 1) { + if (PyDict_GetItemString(kwargs, "path")) { + char *kwlist[] = { "path", NULL }; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s:gio.File.__init__", kwlist, &arg)) + return NULL; + file = g_file_new_for_path(arg); + } else if (PyDict_GetItemString(kwargs, "uri")) { + char *kwlist[] = { "uri", NULL }; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s:gio.File.__init__", kwlist, &arg)) + return NULL; + file = g_file_new_for_uri(arg); + } else { + PyErr_Format(PyExc_TypeError, + "gio.File() got an unexpected keyword argument '%s'", + "unknown"); + return NULL; + } + } else { + PyErr_Format(PyExc_TypeError, + "gio.File() takes exactly 1 argument (%zd given)", + n_args + n_kwargs); + return NULL; + } + + if (!file) { + PyErr_SetString(PyExc_RuntimeError, + "could not create GFile object"); + return NULL; + } + + py_ret = pygobject_new((GObject *)file); + g_object_unref(file); + + return py_ret; +} +%% +override g_file_read_async kwargs +static PyObject * +_wrap_g_file_read_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", + "cancellable", "user_data", NULL }; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:File.read_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_read_async(G_FILE(self->obj), + io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_load_contents kwargs +static PyObject * +_wrap_g_file_load_contents(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "cancellable", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + gchar *contents, *etag_out; + gsize length; + GError *error = NULL; + gboolean ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|O:File.load_contents", + kwlist, + &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + pyg_begin_allow_threads; + + ret = g_file_load_contents(G_FILE(self->obj), cancellable, + &contents, &length, &etag_out, &error); + + pyg_end_allow_threads; + + if (pyg_error_check(&error)) + return NULL; + + if (ret) { + PyObject *pyret; + + pyret = Py_BuildValue("(s#ks)", contents, length, length, etag_out); + g_free(contents); + g_free(etag_out); + return pyret; + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +%% +override g_file_load_contents_async kwargs +static PyObject * +_wrap_g_file_load_contents_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OO:File.load_contents_async", + kwlist, + ¬ify->callback, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_load_contents_async(G_FILE(self->obj), + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_load_contents_finish kwargs +static PyObject * +_wrap_g_file_load_contents_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "res", NULL }; + PyGObject *res; + gchar *contents, *etag_out; + gsize length; + GError *error = NULL; + gboolean ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:File.load_contents_finish", + kwlist, + &PyGAsyncResult_Type, + &res)) + return NULL; + + ret = g_file_load_contents_finish(G_FILE(self->obj), + G_ASYNC_RESULT(res->obj), &contents, + &length, &etag_out, &error); + + if (pyg_error_check(&error)) + return NULL; + + if (ret) { + PyObject *pyret; + + pyret = Py_BuildValue("(s#ks)", contents, length, length, etag_out); + g_free(contents); + g_free(etag_out); + return pyret; + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +%% +override g_file_enumerate_children_async kwargs +static PyObject * +_wrap_g_file_enumerate_children_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "attributes", "callback", "flags", + "io_priority", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + char *attributes; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE; + GCancellable *cancellable = NULL; + PyGObject *py_cancellable = NULL; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|OiOO:gio.File.enumerate_children_async", + kwlist, + &attributes, + ¬ify->callback, + &py_flags, + &io_priority, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_QUERY_INFO_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_enumerate_children_async(G_FILE(self->obj), + attributes, + flags, + io_priority, + (GCancellable *) cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_mount_mountable kwargs +static PyObject * +_wrap_g_file_mount_mountable(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "mount_operation", "callback", "flags", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + PyGObject *py_cancellable = NULL; + GMountMountFlags flags = G_MOUNT_MOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!O|OOO:File.mount_mountable", + kwlist, + &PyGMountOperation_Type, + &mount_operation, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_mount_mountable(G_FILE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_unmount_mountable kwargs +static PyObject * +_wrap_g_file_unmount_mountable(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *py_cancellable = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOO:File.unmount_mountable", + kwlist, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_unmount_mountable(G_FILE(self->obj), + flags, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_unmount_mountable_with_operation kwargs +static PyObject * +_wrap_g_file_unmount_mountable_with_operation(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + PyGObject *py_cancellable = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:File.unmount_mountable_with_operation", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_unmount_mountable_with_operation(G_FILE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_mount_enclosing_volume kwargs +static PyObject * +_wrap_g_file_mount_enclosing_volume(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "mount_operation", "callback", "flags", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + PyGObject *py_cancellable = NULL; + GMountMountFlags flags = G_MOUNT_MOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!O|OOO:File.mount_enclosing_volume", + kwlist, + &PyGMountOperation_Type, + &mount_operation, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_mount_enclosing_volume(G_FILE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_copy kwargs +static PyObject * +_wrap_g_file_copy(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "destination", "progress_callback", + "flags", "cancellable", + "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *destination = NULL; + PyGObject *py_cancellable = NULL; + GFileCopyFlags flags = G_FILE_COPY_NONE; + GCancellable *cancellable; + int ret; + GError *error = NULL; + GFileProgressCallback callback = NULL; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!|OOOO:File.copy", + kwlist, + &PyGFile_Type, + &destination, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (pygio_notify_using_optional_callback(notify)) { + callback = (GFileProgressCallback)file_progress_callback_marshal; + if (!pygio_notify_callback_is_valid(notify)) + goto error; + } + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_COPY_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + /* No need to reference callback here, because it will be used + * only while this function is in progress. */ + + pyg_begin_allow_threads; + + ret = g_file_copy(G_FILE(self->obj), + G_FILE(destination->obj), + flags, + cancellable, + callback, + notify, + &error); + + pyg_end_allow_threads; + + if (pyg_error_check(&error)) + goto error; + + pygio_notify_free(notify); + return PyBool_FromLong(ret); + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_copy_async kwargs +static PyObject * +_wrap_g_file_copy_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "destination", "callback", "progress_callback", + "flags", "io_priority", "cancellable", + "user_data", "progress_callback_data", NULL }; + PyGIONotify *notify, *progress_notify; + PyObject *py_flags = NULL; + PyGObject *destination = NULL; + PyGObject *py_cancellable = NULL; + GFileCopyFlags flags = G_FILE_COPY_NONE; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + GFileProgressCallback progress_callback = NULL; + + /* After the creation, referencing/freeing will automatically be + * done on the master and the slave. */ + notify = pygio_notify_new(); + progress_notify = pygio_notify_new_slave(notify); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!O|OOiOOO:File.copy_async", + kwlist, + &PyGFile_Type, + &destination, + ¬ify->callback, + &progress_notify->callback, + &py_flags, + &io_priority, + &pycancellable, + ¬ify->data, + &progress_notify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + if (pygio_notify_using_optional_callback(progress_notify)) { + progress_callback = (GFileProgressCallback) file_progress_callback_marshal; + if (!pygio_notify_callback_is_valid_full(progress_notify, "progress_callback")) + goto error; + } + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_copy_async(G_FILE(self->obj), + G_FILE(destination->obj), + flags, + io_priority, + cancellable, + progress_callback, + progress_notify, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_move kwargs +static PyObject * +_wrap_g_file_move(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "destination", "progress_callback", + "flags", "cancellable", + "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *destination = NULL; + PyGObject *py_cancellable = NULL; + GFileCopyFlags flags = G_FILE_COPY_NONE; + GCancellable *cancellable; + int ret; + GError *error = NULL; + GFileProgressCallback callback = NULL; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!|OOOO:File.move", + kwlist, + &PyGFile_Type, + &destination, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (pygio_notify_using_optional_callback(notify)) { + callback = (GFileProgressCallback)file_progress_callback_marshal; + if (!pygio_notify_callback_is_valid(notify)) + goto error; + } + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_COPY_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + /* No need to reference callback here, because it will be used + * only while this function is in progress. */ + + pyg_begin_allow_threads; + + ret = g_file_move(G_FILE(self->obj), + G_FILE(destination->obj), + flags, + cancellable, + callback, + notify, + &error); + + pyg_end_allow_threads; + + if (pyg_error_check(&error)) + goto error; + + pygio_notify_free(notify); + return PyBool_FromLong(ret); + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_set_attribute kwargs +static char** +pyg_strv_from_pyobject(PyObject *value, const char *exc_msg) +{ + gchar** strv; + Py_ssize_t len, i; + PyObject* fast_seq; + + fast_seq = PySequence_Fast(value, exc_msg); + if (fast_seq == NULL) + return NULL; + + len = PySequence_Length(fast_seq); + if (len == -1) + return NULL; + + strv = g_malloc(sizeof(char*) * (len + 1)); + if (strv == NULL) { + PyErr_NoMemory(); + goto failure; + } + + for (i = 0; i < len + 1; i++) + strv[i] = NULL; + + for (i = 0; i < len; i++) { + PyObject* item = PySequence_Fast_GET_ITEM(fast_seq, i); + const char *s; + + if (!PyString_Check(item)) { + PyErr_SetString(PyExc_TypeError, exc_msg); + goto failure; + } + + s = PyString_AsString(item); + if (s == NULL) + goto failure; + + strv[i] = g_strdup(s); + if (strv[i] == NULL) { + PyErr_NoMemory(); + goto failure; + } + } + + return strv; + + failure: + g_strfreev(strv); + Py_XDECREF(fast_seq); + return NULL; +} + +static PyObject * +_wrap_g_file_set_attribute(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "attribute", "type", "value_p", + "flags", "cancellable", NULL }; + GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE; + int ret; + GCancellable *cancellable = NULL; + GError *error = NULL; + char *attribute; + PyObject *py_type = NULL, *py_flags = NULL, *value; + PyGObject *pycancellable = NULL; + GFileAttributeType type; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sOO|OO:gio.File.set_attribute", + kwlist, &attribute, &py_type, &value, + &py_flags, &pycancellable)) + return NULL; + + if (pyg_enum_get_value(G_TYPE_FILE_ATTRIBUTE_TYPE, py_type, + (gpointer)&type)) + return NULL; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_QUERY_INFO_FLAGS, py_flags, + (gpointer)&flags)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + switch (type) { + case G_FILE_ATTRIBUTE_TYPE_STRING: + { + char* s; + if (!PyString_Check(value)) { + PyErr_Format(PyExc_TypeError, + "set_attribute value must be a str when type is FILE_ATTRIBUTE_TYPE_STRING"); + return NULL; + } + + s = PyString_AsString(value); + if (s == NULL) + return NULL; + + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + s, flags, (GCancellable *) cancellable, + &error); + } + break; + + case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING: + { + char* s; + if (!PyString_Check(value)) { + PyErr_Format(PyExc_TypeError, + "set_attribute value must be a bytes instance when type is FILE_ATTRIBUTE_TYPE_BYTE_STRING"); + return NULL; + } + + s = PyString_AsString(value); + if (s == NULL) + return NULL; + + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + s, flags, (GCancellable *) cancellable, + &error); + } + break; + + + case G_FILE_ATTRIBUTE_TYPE_STRINGV: + { + gchar** strv; + + strv = pyg_strv_from_pyobject(value, "set_attribute value must be a list of strings when type is FILE_ATTRIBUTE_TYPE_STRINGV"); + if (strv == NULL) + break; + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + strv, flags, (GCancellable *) cancellable, + &error); + g_strfreev(strv); + } + break; + + case G_FILE_ATTRIBUTE_TYPE_OBJECT: + { + GObject* obj; + + if (!pygobject_check(value, &PyGObject_Type)) { + PyErr_Format(PyExc_TypeError, + "set_attribute value must be a GObject instance when type is FILE_ATTRIBUTE_TYPE_OBJECT"); + return NULL; + } + + obj = pygobject_get(value); + + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + obj, flags, (GCancellable *) cancellable, + &error); + } + break; + + case G_FILE_ATTRIBUTE_TYPE_BOOLEAN: + { + gboolean boolval; + + boolval = PyObject_IsTrue(value); + if (boolval == -1 && PyErr_Occurred()) + return NULL; + + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + &boolval, flags, (GCancellable *) cancellable, + &error); + } + break; + + case G_FILE_ATTRIBUTE_TYPE_UINT32: + { + guint32 intval; + + if (!PyInt_Check(value) && !PyLong_Check(value)) { + PyErr_Format(PyExc_TypeError, + "set_attribute value must be an int when type is FILE_ATTRIBUTE_TYPE_UINT32"); + return NULL; + } + + intval = PyLong_AsUnsignedLong(value); + if (intval == -1 && PyErr_Occurred()) + return NULL; + + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + &intval, flags, (GCancellable *) cancellable, + &error); + } + break; + + case G_FILE_ATTRIBUTE_TYPE_INT32: + { + gint32 intval; + + if (!PyInt_Check(value)) { + PyErr_Format(PyExc_TypeError, + "set_attribute value must be an int when type is FILE_ATTRIBUTE_TYPE_INT32"); + return NULL; + } + + intval = PyInt_AsLong(value); + if (intval == -1 && PyErr_Occurred()) + return NULL; + + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + &intval, flags, (GCancellable *) cancellable, + &error); + } + break; + + case G_FILE_ATTRIBUTE_TYPE_UINT64: + { + guint64 intval; + + if (!PyInt_Check(value) && !PyLong_Check(value)) { + PyErr_Format(PyExc_TypeError, + "set_attribute value must be a long int when type is FILE_ATTRIBUTE_TYPE_UINT64"); + return NULL; + } + + intval = PyLong_AsLongLong(value); + if (intval == -1 && PyErr_Occurred()) + return NULL; + + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + &intval, flags, (GCancellable *) cancellable, + &error); + } + break; + + case G_FILE_ATTRIBUTE_TYPE_INT64: + { + gint64 intval; + + if (!PyInt_Check(value) && !PyLong_Check(value)) { + PyErr_Format(PyExc_TypeError, + "set_attribute value must be a long int when type is FILE_ATTRIBUTE_TYPE_INT64"); + return NULL; + } + + intval = PyLong_AsUnsignedLongLong(value); + if (intval == -1 && PyErr_Occurred()) + return NULL; + + ret = g_file_set_attribute(G_FILE(self->obj), attribute, type, + &intval, flags, (GCancellable *) cancellable, + &error); + } + break; + + case G_FILE_ATTRIBUTE_TYPE_INVALID: + + default: + PyErr_SetString(PyExc_TypeError, + "Unknown type specified in set_attribute\n"); + return NULL; + } + + if (pyg_error_check(&error)) + return NULL; + + return PyBool_FromLong(ret); +} +%% +override g_file_query_settable_attributes kwargs +static PyObject * +_wrap_g_file_query_settable_attributes(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "cancellable", NULL }; + PyGObject *pycancellable = NULL; + GCancellable *cancellable = NULL; + GFileAttributeInfoList *ret; + GError *error = NULL; + gint i, n_infos; + GFileAttributeInfo *infos; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|O:gio.File.query_settable_attributes", + kwlist, &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + ret = g_file_query_settable_attributes(G_FILE(self->obj), + (GCancellable *) cancellable, + &error); + if (pyg_error_check(&error)) + return NULL; + + n_infos = ret->n_infos; + infos = ret->infos; + + if (n_infos > 0) { + py_ret = PyList_New(n_infos); + for (i = 0; i < n_infos; i++) { + PyList_SetItem(py_ret, i, pyg_file_attribute_info_new(&infos[i])); + } + g_file_attribute_info_list_unref(ret); + return py_ret; + + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +%% +override g_file_query_writable_namespaces kwargs +static PyObject * +_wrap_g_file_query_writable_namespaces(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "cancellable", NULL }; + PyGObject *pycancellable = NULL; + GCancellable *cancellable = NULL; + GFileAttributeInfoList *ret; + GError *error = NULL; + gint i, n_infos; + GFileAttributeInfo *infos; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|O:gio.File.query_writable_namespaces", + kwlist, &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + ret = g_file_query_writable_namespaces(G_FILE(self->obj), + (GCancellable *) cancellable, + &error); + if (pyg_error_check(&error)) + return NULL; + + n_infos = ret->n_infos; + infos = ret->infos; + + if (n_infos > 0) { + py_ret = PyList_New(n_infos); + for (i = 0; i < n_infos; i++) { + PyList_SetItem(py_ret, i, pyg_file_attribute_info_new(&infos[i])); + } + g_file_attribute_info_list_unref(ret); + return py_ret; + + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +%% +override g_file_append_to_async kwargs +static PyObject * +_wrap_g_file_append_to_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "io_priority", + "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OiOO:File.append_to_async", + kwlist, + ¬ify->callback, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_append_to_async(G_FILE(self->obj), flags, io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_create_async kwargs +static PyObject * +_wrap_g_file_create_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "io_priority", + "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OiOO:File.create_async", + kwlist, + ¬ify->callback, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_create_async(G_FILE(self->obj), flags, io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_create_readwrite_async kwargs +static PyObject * +_wrap_g_file_create_readwrite_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "io_priority", + "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OiOO:File.create_readwrite_async", + kwlist, + ¬ify->callback, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_create_readwrite_async(G_FILE(self->obj), flags, io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_open_readwrite_async kwargs +static PyObject * +_wrap_g_file_open_readwrite_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", + "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + int io_priority = G_PRIORITY_DEFAULT; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:File.open_readwrite_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_open_readwrite_async(G_FILE(self->obj), io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_replace_readwrite_async kwargs +static PyObject * +_wrap_g_file_replace_readwrite_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "etag", "make_backup", "flags", + "io_priority", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + char *etag = NULL; + gboolean make_backup = TRUE; + PyObject *py_backup = Py_True; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|zOOiOO:File.replace_readwrite_async", + kwlist, + ¬ify->callback, + &etag, &py_backup, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + make_backup = PyObject_IsTrue(py_backup) ? TRUE : FALSE; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_replace_readwrite_async(G_FILE(self->obj), etag, make_backup, flags, + io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_replace_async kwargs +static PyObject * +_wrap_g_file_replace_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "etag", "make_backup", "flags", + "io_priority", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + char *etag = NULL; + gboolean make_backup = TRUE; + PyObject *py_backup = Py_True; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|zOOiOO:File.replace_async", + kwlist, + ¬ify->callback, + &etag, &py_backup, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + make_backup = PyObject_IsTrue(py_backup) ? TRUE : FALSE; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_replace_async(G_FILE(self->obj), etag, make_backup, flags, + io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_query_info_async kwargs +static PyObject * +_wrap_g_file_query_info_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "attributes", "callback", "flags", + "io_priority", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + char *attributes; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|OiOO:File.query_info_async", + kwlist, + &attributes, + ¬ify->callback, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) { + /* To preserve compatibility with 2.16 we also allow swapped + * 'attributes' and 'callback'. FIXME: Remove for 3.0. */ + static char *old_kwlist[] = { "callback", "attributes", "flags", + "io_priority", "cancellable", "user_data", NULL }; + PyObject *exc_type, *exc_value, *exc_traceback; + + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "Os|OiOO:File.query_info_async", + old_kwlist, + ¬ify->callback, + &attributes, + &flags, &io_priority, + &pycancellable, + ¬ify->data) + || !pygio_notify_callback_is_valid(notify)) { + /* Report the error with new parameters. */ + PyErr_Restore(exc_type, exc_value, exc_traceback); + goto error; + } + + Py_XDECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_traceback); + } + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_query_info_async(G_FILE(self->obj), attributes, flags, + io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_replace_contents kwargs +static PyObject * +_wrap_g_file_replace_contents(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "contents", "etag", "make_backup", + "flags", "cancellable", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + gsize length; + gboolean make_backup = FALSE; + char *contents; + char *etag = NULL; + char *new_etag = NULL; + GError *error = NULL; + gboolean ret; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s#|zbOO:File.replace_contents", + kwlist, + &contents, + &length, + &etag, + &make_backup, + &flags, + &cancellable)) + { + return NULL; + } + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + pyg_begin_allow_threads; + + ret = g_file_replace_contents(G_FILE(self->obj), contents, length, etag, + make_backup, flags, &new_etag, cancellable, + &error); + + pyg_end_allow_threads; + + if (pyg_error_check(&error)) + return NULL; + + if (ret) { + py_ret = PyString_FromString(new_etag); + } else { + py_ret = Py_None; + Py_INCREF(py_ret); + } + + g_free(new_etag); + return py_ret; +} +%% +override g_file_replace_contents_finish kwargs +static PyObject * +_wrap_g_file_replace_contents_finish(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *res; + gchar *etag_out = NULL; + GError *error = NULL; + gboolean ret; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:File.replace_contents_finish", + kwlist, + &PyGAsyncResult_Type, + &res)) + return NULL; + + ret = g_file_replace_contents_finish(G_FILE(self->obj), + G_ASYNC_RESULT(res->obj), &etag_out, + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (ret) { + py_ret = PyString_FromString(etag_out); + return py_ret; + } else { + py_ret = Py_None; + Py_INCREF(py_ret); + } + + g_free(etag_out); + return py_ret; +} +%% +override g_file_replace_contents_async kwargs +static PyObject * +_wrap_g_file_replace_contents_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "contents", "callback", "etag", "make_backup", + "flags", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + PyGIONotify *notify; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + gsize length; + gboolean make_backup = FALSE; + char *contents; + char *etag = NULL; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s#O|zbOOO:File.replace_contents_async", + kwlist, + &contents, + &length, + ¬ify->callback, + &etag, + &make_backup, + &py_flags, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + pygio_notify_copy_buffer(notify, contents, length); + + g_file_replace_contents_async(G_FILE(self->obj), + notify->buffer, + notify->buffer_size, + etag, + make_backup, + flags, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override-slot GFile.tp_richcompare +static PyObject * +_wrap_g_file_tp_richcompare(PyGObject *self, PyGObject *other, int op) +{ + PyObject *result; + + if (PyObject_TypeCheck(self, &PyGFile_Type) + && PyObject_TypeCheck(other, &PyGFile_Type)) { + GFile *file1 = G_FILE(self->obj); + GFile *file2 = G_FILE(other->obj); + + switch (op) { + case Py_EQ: + result = (g_file_equal(file1, file2) + ? Py_True : Py_False); + break; + case Py_NE: + result = (!g_file_equal(file1, file2) + ? Py_True : Py_False); + break; + default: + result = Py_NotImplemented; + } + } + else + result = Py_NotImplemented; + + Py_INCREF(result); + return result; +} +%% +override-slot GFile.tp_hash +static long +_wrap_g_file_tp_hash(PyGObject *self) +{ + return g_file_hash(G_FILE(self->obj)); +} +%% +override-slot GFile.tp_repr +static PyObject * +_wrap_g_file_tp_repr(PyGObject *self) +{ + char *uri = g_file_get_uri(G_FILE(self->obj)); + gchar *representation; + PyObject *result; + + if (uri) { + representation = g_strdup_printf("<%s at %p: %s>", self->ob_type->tp_name, self, uri); + g_free(uri); + } + else + representation = g_strdup_printf("<%s at %p: UNKNOWN URI>", self->ob_type->tp_name, self); + + result = PyString_FromString(representation); + g_free(representation); + return result; +} +%% +override g_file_eject_mountable kwargs +static PyObject * +_wrap_g_file_eject_mountable(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", + "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOO:File.eject_mountable", + kwlist, + ¬ify->callback, + &flags, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_eject_mountable(G_FILE(self->obj), flags, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_eject_mountable_with_operation kwargs +static PyObject * +_wrap_g_file_eject_mountable_with_operation(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:File.eject_mountable_with_operation", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_eject_mountable_with_operation(G_FILE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_find_enclosing_mount_async kwargs +static PyObject * +_wrap_g_file_find_enclosing_mount_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", + "cancellable", "user_data", NULL }; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:File.enclosing_mount_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_find_enclosing_mount_async(G_FILE(self->obj), + io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_query_filesystem_info_async kwargs +static PyObject * +_wrap_g_file_query_filesystem_info_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "attributes", "callback", + "io_priority", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + char *attributes; + int io_priority = G_PRIORITY_DEFAULT; + GCancellable *cancellable = NULL; + PyGObject *py_cancellable = NULL; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|iOO:gio.File.query_filesystem_info_async", + kwlist, + &attributes, + ¬ify->callback, + &io_priority, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_query_filesystem_info_async(G_FILE(self->obj), + attributes, + io_priority, + (GCancellable *) cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_set_attributes_async kwargs +static PyObject * +_wrap_g_file_set_attributes_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "info", "callback", "flags", + "io_priority", "cancellable", "user_data", NULL }; + PyGObject *info; + PyGIONotify *notify; + GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE; + int io_priority = G_PRIORITY_DEFAULT; + GCancellable *cancellable = NULL; + PyGObject *py_cancellable = NULL; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!O|OiOO:gio.File.set_attributes_async", + kwlist, + &PyGFileInfo_Type, + &info, + ¬ify->callback, + &flags, + &io_priority, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_set_attributes_async(G_FILE(self->obj), + G_FILE_INFO(info->obj), + flags, + io_priority, + (GCancellable *) cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} + +%% +override g_file_set_attributes_finish kwargs +static PyObject * +_wrap_g_file_set_attributes_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *res; + GFileInfo *info = NULL; + GError *error = NULL; + gboolean ret; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:File.set_attributes_finish", + kwlist, + &PyGAsyncResult_Type, + &res)) + return NULL; + + ret = g_file_set_attributes_finish(G_FILE(self->obj), + G_ASYNC_RESULT(res->obj), &info, + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (ret) { + py_ret = pygobject_new((GObject *)info); + } else { + py_ret = Py_None; + Py_INCREF(py_ret); + } + + return py_ret; +} +%% +override g_file_set_display_name_async kwargs +static PyObject * +_wrap_g_file_set_display_name_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "display_name", "callback", + "io_priority", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + char *display_name; + int io_priority = G_PRIORITY_DEFAULT; + GCancellable *cancellable = NULL; + PyGObject *py_cancellable = NULL; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|iOO:gio.File.set_display_name_async", + kwlist, + &display_name, + ¬ify->callback, + &io_priority, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_set_display_name_async(G_FILE(self->obj), + display_name, + io_priority, + (GCancellable *) cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_poll_mountable kwargs +static PyObject * +_wrap_g_file_poll_mountable(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OO:File.poll_mountable", + kwlist, + ¬ify->callback, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_poll_mountable(G_FILE(self->obj), cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_start_mountable kwargs +static PyObject * +_wrap_g_file_start_mountable(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "start_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + GDriveStartFlags flags = G_DRIVE_START_NONE; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:File.start_mountable", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_DRIVE_START_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_start_mountable(G_FILE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_stop_mountable kwargs +static PyObject * +_wrap_g_file_stop_mountable(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:gio.File.stop_mountable", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_stop_mountable(G_FILE(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} + +/* GFile.load_partial_contents_async: No ArgType for GFileReadMoreCallback */ +/* GFile.load_partial_contents_finish: No ArgType for char** */ diff --git a/gio/gfileattribute.override b/gio/gfileattribute.override new file mode 100644 index 0000000..e51ec63 --- /dev/null +++ b/gio/gfileattribute.override @@ -0,0 +1,153 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Gian Mario Tagliaretti + * + * gfileattribute.override: module overrides for GFileAttribute* + * + * 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 + */ +%% +headers + +extern PyTypeObject PyGFileAttributeInfo_Type; + +typedef struct { + PyObject_HEAD + const GFileAttributeInfo *info; +} PyGFileAttributeInfo; + +static PyObject * +pygio_file_attribute_info_tp_new(PyTypeObject *type) +{ + PyGFileAttributeInfo *self; + GFileAttributeInfo *info = NULL; + + self = (PyGFileAttributeInfo *) PyObject_NEW(PyGFileAttributeInfo, + &PyGFileAttributeInfo_Type); + self->info = info; + return (PyObject *) self; +} + +static PyMethodDef pyg_file_attribute_info_methods[] = { + { NULL, 0, 0 } +}; + +static PyObject * +pyg_file_attribute_info__get_name(PyObject *self, void *closure) +{ + const gchar *ret; + + ret = ((PyGFileAttributeInfo*)self)->info->name; + if (ret) + return PyString_FromString(ret); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_file_attribute_info__get_type(PyObject *self, void *closure) +{ + gint ret; + + ret = ((PyGFileAttributeInfo*)self)->info->type; + return pyg_enum_from_gtype(G_TYPE_FILE_ATTRIBUTE_TYPE, ret); +} + +static PyObject * +pyg_file_attribute_info__get_flags(PyObject *self, void *closure) +{ + guint ret; + + ret = ((PyGFileAttributeInfo*)self)->info->flags; + return pyg_flags_from_gtype(G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, ret); +} + +static const PyGetSetDef pyg_file_attribute_info_getsets[] = { + { "name", (getter)pyg_file_attribute_info__get_name, (setter)0 }, + { "type", (getter)pyg_file_attribute_info__get_type, (setter)0 }, + { "flags", (getter)pyg_file_attribute_info__get_flags, (setter)0 }, + { NULL, (getter)0, (setter)0 }, +}; + +PyTypeObject PyGFileAttributeInfo_Type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "gio.FileAttributeInfo", /* tp_name */ + sizeof(PyGFileAttributeInfo), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + "Holds information about an attribute", /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)pyg_file_attribute_info_methods, /* tp_methods */ + 0, /* tp_members */ + (struct PyGetSetDef*)pyg_file_attribute_info_getsets, /* tp_getset */ + (PyTypeObject *)0, /* tp_base */ + (PyObject *)0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)0, /* tp_init */ + 0, /* tp_alloc */ + (newfunc)pygio_file_attribute_info_tp_new, /* tp_new */ + 0, /* tp_free */ + (inquiry)0, /* tp_is_gc */ + (PyObject *)0, /* tp_bases */ +}; + +PyObject* +pyg_file_attribute_info_new(const GFileAttributeInfo *info) +{ + PyGFileAttributeInfo *self; + + self = (PyGFileAttributeInfo *)PyObject_NEW(PyGFileAttributeInfo, + &PyGFileAttributeInfo_Type); + if (G_UNLIKELY(self == NULL)) + return NULL; + if (info) + self->info = info; + return (PyObject *)self; +} + +%% +init +if (PyType_Ready(&PyGFileAttributeInfo_Type) < 0) { + g_return_if_reached(); +} +if (PyDict_SetItemString(d, "FileAttributeInfo", + (PyObject *)&PyGFileAttributeInfo_Type) < 0) { + g_return_if_reached(); +} diff --git a/gio/gfileenumerator.override b/gio/gfileenumerator.override new file mode 100644 index 0000000..db29550 --- /dev/null +++ b/gio/gfileenumerator.override @@ -0,0 +1,184 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * gfileenumerator.override: module overrides for GFileEnumerator + * + * 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 + */ +%% +override-slot GFileEnumerator.tp_iter +static PyObject* +_wrap_g_file_enumerator_tp_iter(PyGObject *self) +{ + Py_INCREF (self); + return (PyObject *) self; +} +%% +override-slot GFileEnumerator.tp_iternext +static PyObject* +_wrap_g_file_enumerator_tp_iternext(PyGObject *iter) +{ + GFileInfo *file_info; + GError *error = NULL; + + if (!iter->obj) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + + file_info = g_file_enumerator_next_file(G_FILE_ENUMERATOR(iter->obj), + NULL, + &error); + if (pyg_error_check(&error)) { + return NULL; + } + + if (!file_info) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + + return pygobject_new((GObject*)file_info); +} +%% +override g_file_enumerator_next_files_async kwargs +static PyObject * +_wrap_g_file_enumerator_next_files_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "num_files", "callback", + "io_priority", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + int num_files; + int io_priority = G_PRIORITY_DEFAULT; + GCancellable *cancellable = NULL; + PyGObject *py_cancellable = NULL; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "iO|iOO:gio.FileEnumerator.enumerate_next_files_async", + kwlist, + &num_files, + ¬ify->callback, + &io_priority, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_enumerator_next_files_async(G_FILE_ENUMERATOR(self->obj), + num_files, + io_priority, + (GCancellable *) cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_file_enumerator_next_files_finish kwargs +static PyObject * +_wrap_g_file_enumerator_next_files_finish(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *result; + GList *next_files, *l; + GError *error = NULL; + PyObject *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:gio.FileEnumerator.next_files_finish", + kwlist, + &PyGAsyncResult_Type, &result)) + return NULL; + + next_files = g_file_enumerator_next_files_finish(G_FILE_ENUMERATOR(self->obj), + G_ASYNC_RESULT(result->obj), + &error); + if (pyg_error_check(&error)) + return NULL; + + ret = PyList_New(0); + for (l = next_files; l; l = l->next) { + GFileInfo *file_info = l->data; + PyObject *item = pygobject_new((GObject *)file_info); + PyList_Append(ret, item); + Py_DECREF(item); + g_object_unref(file_info); + } + g_list_free(next_files); + + return ret; +} +%% +override g_file_enumerator_close_async kwargs +static PyObject * +_wrap_g_file_enumerator_close_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", "cancellable", + "user_data", NULL }; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:gio.FileEnumerator.close_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_enumerator_close_async(G_FILE_ENUMERATOR(self->obj), + io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gfileinfo.override b/gio/gfileinfo.override new file mode 100644 index 0000000..730e91b --- /dev/null +++ b/gio/gfileinfo.override @@ -0,0 +1,121 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * 2009 Gian Mario Tagliaretti + * + * gfileinfo.override: module overrides for GFileInfo + * + * 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 + */ + +%% +headers + +#ifndef G_TYPE_FILE_ATTRIBUTE_MATCHER +#define G_TYPE_FILE_ATTRIBUTE_MATCHER (_g_file_attribute_matcher_get_type ()) + +static GType _g_file_attribute_matcher_get_type (void) +{ + static GType our_type = 0; + + if (our_type == 0) + our_type = g_boxed_type_register_static ("GFileAttributeMatcher", + (GBoxedCopyFunc)g_file_attribute_matcher_ref, + (GBoxedFreeFunc)g_file_attribute_matcher_unref); + + return our_type; +} +#endif + +%% +override g_file_info_list_attributes kwargs +static PyObject * +_wrap_g_file_info_list_attributes(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + char *kwlist[] = { "name_space", NULL}; + gchar *name_space = NULL; + gchar **names; + gchar **n; + PyObject *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|z:gio.FileInfo.list_attributes", + kwlist, &name_space)) + return NULL; + + names = g_file_info_list_attributes(G_FILE_INFO(self->obj), + name_space); + + ret = PyList_New(0); + n = names; + while (n && *n) { + PyObject *item = PyString_FromString(n[0]); + PyList_Append(ret, item); + Py_DECREF(item); + + n++; + } + + g_strfreev(names); + return ret; +} +%% +override g_file_info_get_modification_time noargs +static PyObject * +_wrap_g_file_info_get_modification_time(PyGObject *self, PyObject *unused) +{ + GTimeVal timeval; + + g_file_info_get_modification_time(G_FILE_INFO(self->obj), &timeval); + return pyglib_float_from_timeval(timeval); +} +%% +override g_file_info_set_modification_time kwargs +static PyObject * +_wrap_g_file_info_set_modification_time(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + char *kwlist[] = { "mtime", NULL}; + double py_mtime = 0.0; + GTimeVal ttime, *mtime; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "d:gio.FileInfo.set_modification_time", + kwlist, &py_mtime)) + return NULL; + + if (py_mtime > 0.0) { + ttime.tv_sec = (glong) py_mtime; + ttime.tv_usec = (glong)((py_mtime - ttime.tv_sec) * G_USEC_PER_SEC); + mtime = &ttime; + } else if (py_mtime == 0.0) { + mtime = NULL; + } else { + PyErr_SetString(PyExc_ValueError, "mtime must be >= 0.0"); + return NULL; + } + + g_file_info_set_modification_time(G_FILE_INFO(self->obj), mtime); + + Py_INCREF(Py_None); + return Py_None; +} + +/* GFileInfo.get_attribute_data: No ArgType for GFileAttributeType* */ +/* GFileInfo.set_attribute: No ArgType for gpointer */ diff --git a/gio/gfileinputstream.override b/gio/gfileinputstream.override new file mode 100644 index 0000000..5190a13 --- /dev/null +++ b/gio/gfileinputstream.override @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gfileinputstream.override: module overrides for GFileInputStream + * + * 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 + */ + +%% +override g_file_input_stream_query_info_async kwargs +static PyObject * +_wrap_g_file_input_stream_query_info_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "attributes", "callback", + "io_priority", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + int io_priority = G_PRIORITY_DEFAULT; + char *attributes; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|iOO:gio.FileInputStream.query_info_async", + kwlist, + &attributes, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_input_stream_query_info_async(G_FILE_INPUT_STREAM(self->obj), + attributes, io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gfileiostream.override b/gio/gfileiostream.override new file mode 100644 index 0000000..7be6124 --- /dev/null +++ b/gio/gfileiostream.override @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gfileiostream.override: module overrides for GFileIOStream + * + * 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 + */ + +%% +override g_file_io_stream_query_info_async kwargs +static PyObject * +_wrap_g_file_io_stream_query_info_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "attributes", "callback", + "io_priority", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + int io_priority = G_PRIORITY_DEFAULT; + char *attributes; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|iOO:gio.FileIOStream.query_info_async", + kwlist, + &attributes, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_io_stream_query_info_async(G_FILE_IO_STREAM(self->obj), + attributes, io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gfileoutputstream.override b/gio/gfileoutputstream.override new file mode 100644 index 0000000..c5c184d --- /dev/null +++ b/gio/gfileoutputstream.override @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gfileoutputstream.override: module overrides for GFileOuputStream + * + * 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 + */ + +%% +override g_file_output_stream_query_info_async kwargs +static PyObject * +_wrap_g_file_output_stream_query_info_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "attributes", "callback", + "io_priority", "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + int io_priority = G_PRIORITY_DEFAULT; + char *attributes; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sO|iOO:gio.FileOutputStream.query_info_async", + kwlist, + &attributes, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_file_output_stream_query_info_async(G_FILE_OUTPUT_STREAM(self->obj), + attributes, io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gicon.override b/gio/gicon.override new file mode 100644 index 0000000..c429556 --- /dev/null +++ b/gio/gicon.override @@ -0,0 +1,310 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 2008 Johan Dahlin + * + * gicon.override: module overrides for GIcon and related 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 + */ +%% +ignore-glob + g_icon_hash + g_themed_icon_new_from_names + g_themed_icon_new_with_default_fallbacks +%% +override-slot GIcon.tp_richcompare +static PyObject * +_wrap_g_icon_tp_richcompare(PyGObject *self, PyGObject *other, int op) +{ + PyObject *result; + + if (PyObject_TypeCheck(self, &PyGIcon_Type) + && PyObject_TypeCheck(other, &PyGIcon_Type)) { + GIcon *icon1 = G_ICON(self->obj); + GIcon *icon2 = G_ICON(other->obj); + + switch (op) { + case Py_EQ: + result = (g_icon_equal(icon1, icon2) + ? Py_True : Py_False); + break; + case Py_NE: + result = (!g_icon_equal(icon1, icon2) + ? Py_True : Py_False); + break; + default: + result = Py_NotImplemented; + } + } + else + result = Py_NotImplemented; + + Py_INCREF(result); + return result; +} +%% +override-slot GIcon.tp_hash +static long +_wrap_g_icon_tp_hash(PyGObject *self) +{ + return g_icon_hash(G_ICON(self->obj)); +} +%% +override g_loadable_icon_load kwargs +static PyObject * +_wrap_g_loadable_icon_load(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "size", "cancellable", NULL }; + int size = 0; + char *type = NULL; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + GError *error = NULL; + GInputStream *stream; + PyObject *result; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|iO:gio.LoadableIcon.load", + kwlist, + &size, &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + stream = g_loadable_icon_load(G_LOADABLE_ICON(self->obj), size, &type, + cancellable, &error); + if (pyg_error_check(&error)) + return NULL; + + result = Py_BuildValue("Ns", pygobject_new((GObject *) stream), type); + g_free(type); + return result; +} +%% +override g_loadable_icon_load_async kwargs +static PyObject * +_wrap_g_loadable_icon_load_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "size", "cancellable", "user_data", NULL }; + int size = 0; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:gio.LoadableIcon.load_async", + kwlist, + ¬ify->callback, &size, &pycancellable, ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_loadable_icon_load_async(G_LOADABLE_ICON(self->obj), + size, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_loadable_icon_load_finish kwargs +static PyObject * +_wrap_g_loadable_icon_load_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "res", NULL }; + PyGObject *res; + char *type = NULL; + GError *error = NULL; + GInputStream *stream; + PyObject *result; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:gio.LoadableIcon.load_finish", + kwlist, + &PyGAsyncResult_Type, &res)) + return NULL; + + stream = g_loadable_icon_load_finish(G_LOADABLE_ICON(self->obj), + G_ASYNC_RESULT(res->obj), &type, &error); + if (pyg_error_check(&error)) + return NULL; + + result = Py_BuildValue("Ns", pygobject_new((GObject *) stream), type); + g_free(type); + return result; +} +%% +override-slot GFileIcon.tp_repr +static PyObject * +_wrap_g_file_icon_tp_repr(PyGObject *self) +{ + GFile *file = g_file_icon_get_file(G_FILE_ICON(self->obj)); + char *uri = (file ? g_file_get_uri(file) : NULL); + gchar *representation; + PyObject *result; + + if (uri) { + representation = g_strdup_printf("<%s at %p: %s>", self->ob_type->tp_name, self, uri); + g_free(uri); + } + else + representation = g_strdup_printf("<%s at %p: UNKNOWN URI>", self->ob_type->tp_name, self); + + result = PyString_FromString(representation); + g_free(representation); + return result; +} +%% +new-constructor G_TYPE_THEMED_ICON +%% +override g_themed_icon_new kwargs +static int +_wrap_g_themed_icon_new(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "name", "use_default_fallbacks", NULL }; + PyObject *name; + gboolean use_default_fallbacks = FALSE; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:gio.ThemedIcon.__init__", + kwlist, &name, &use_default_fallbacks)) + return -1; + + if (PyString_Check(name)) { + pygobject_construct(self, + "name", PyString_AsString(name), + "use-default-fallbacks", use_default_fallbacks, NULL); + return 0; + } + else if (PySequence_Check(name)) { + PyObject *tuple = PySequence_Tuple(name); + + if (tuple) { + int k; + int length = PyTuple_Size(tuple); + char **names = g_new(char *, length + 1); + + for (k = 0; k < length; k++) { + PyObject *str = PyTuple_GetItem(tuple, k); + if (str && PyString_Check(str)) + names[k] = PyString_AsString(str); + else { + Py_DECREF(tuple); + g_free(names); + goto error; + } + } + + names[length] = NULL; + pygobject_construct(self, + "names", names, + "use-default-fallbacks", use_default_fallbacks, NULL); + Py_DECREF(tuple); + g_free(names); + return 0; + } + } + + error: + if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "argument 1 of gio.ThemedIcon.__init__ " + "must be either a string or a sequence of strings"); + } + return -1; +} +%% +override g_themed_icon_get_names noargs +static PyObject * +_wrap_g_themed_icon_get_names(PyGObject *self) +{ + const char * const *names; + PyObject *ret; + + names = g_themed_icon_get_names(G_THEMED_ICON(self->obj)); + + ret = PyList_New(0); + while (names && *names) { + PyObject *item = PyString_FromString(names[0]); + PyList_Append(ret, item); + Py_DECREF(item); + + names++; + } + + return ret; +} +%% +override-slot GThemedIcon.tp_repr +static PyObject * +_wrap_g_themed_icon_tp_repr(PyGObject *self) +{ + const char * const *names = g_themed_icon_get_names(G_THEMED_ICON(self->obj)); + GString *representation = g_string_new(NULL); + PyObject *result; + + g_string_append_printf(representation, "<%s at %p: ", self->ob_type->tp_name, self); + + if (names) { + gboolean first_name = TRUE; + while (*names) { + if (!first_name) + g_string_append(representation, ", "); + else + first_name = FALSE; + + g_string_append(representation, *names++); + } + } + + g_string_append(representation, ">"); + result = PyString_FromString(representation->str); + g_string_free(representation, TRUE); + return result; +} +%% +override g_emblemed_icon_get_emblems noargs +static PyObject * +_wrap_g_emblemed_icon_get_emblems(PyGObject *self) +{ + GList *list; + PyObject *ret; + + list = g_emblemed_icon_get_emblems(G_EMBLEMED_ICON(self->obj)); + + PYLIST_FROMGLIST(ret, list, pygobject_new(list_item), NULL, NULL); + + return ret; +} diff --git a/gio/ginputstream.override b/gio/ginputstream.override new file mode 100644 index 0000000..260b2fc --- /dev/null +++ b/gio/ginputstream.override @@ -0,0 +1,344 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * ginputstream.override: module overrides for GInputStream + * + * 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 + */ +%% +headers +#define BUFSIZE 8192 + +%% +override g_input_stream_read kwargs +static PyObject * +_wrap_g_input_stream_read(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "count", "cancellable", NULL }; + PyGObject *pycancellable = NULL; + PyObject *v; + GCancellable *cancellable; + long count = -1; + GError *error = NULL; + size_t bytesread, buffersize, chunksize; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|lO:InputStream.read", + kwlist, &count, + &pycancellable)) + return NULL; + + buffersize = (count < 0 ? BUFSIZE : count); + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + v = PyString_FromStringAndSize((char *)NULL, buffersize); + if (v == NULL) + return NULL; + + bytesread = 0; + for (;;) + { + pyg_begin_allow_threads; + errno = 0; + chunksize = g_input_stream_read(G_INPUT_STREAM(self->obj), + PyString_AS_STRING((PyStringObject *)v) + bytesread, + buffersize - bytesread, cancellable, + &error); + pyg_end_allow_threads; + + if (pyg_error_check(&error)) { + Py_DECREF(v); + return NULL; + } + if (chunksize == 0) { + /* End of file. */ + break; + } + + bytesread += chunksize; + if (bytesread < buffersize) { + /* g_input_stream_read() decided to not read full buffer. We + * then return early too, even if 'count' is less than 0. + */ + break; + } + + if (count < 0) { + buffersize += BUFSIZE; + if (_PyString_Resize(&v, buffersize) < 0) + return NULL; + } + else { + /* Got what was requested. */ + break; + } + } + + if (bytesread != buffersize) + _PyString_Resize(&v, bytesread); + + return v; +} +%% +override g_input_stream_read_all kwargs +static PyObject * +_wrap_g_input_stream_read_all(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "count", "cancellable", NULL }; + PyGObject *pycancellable = NULL; + PyObject *v; + GCancellable *cancellable; + long count = -1; + GError *error = NULL; + size_t bytesread, buffersize, chunksize; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|lO:InputStream.read", + kwlist, &count, + &pycancellable)) + return NULL; + + buffersize = (count < 0 ? BUFSIZE : count); + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + v = PyString_FromStringAndSize((char *)NULL, buffersize); + if (v == NULL) + return NULL; + + bytesread = 0; + for (;;) + { + pyg_begin_allow_threads; + errno = 0; + g_input_stream_read_all(G_INPUT_STREAM(self->obj), + PyString_AS_STRING((PyStringObject *)v) + bytesread, + buffersize - bytesread, + &chunksize, + cancellable, &error); + pyg_end_allow_threads; + + if (pyg_error_check(&error)) { + Py_DECREF(v); + return NULL; + } + + bytesread += chunksize; + if (bytesread < buffersize || chunksize == 0) { + /* End of file. */ + break; + } + + if (count < 0) { + buffersize += BUFSIZE; + if (_PyString_Resize(&v, buffersize) < 0) + return NULL; + } + else { + /* Got what was requested. */ + break; + } + } + + if (bytesread != buffersize) + _PyString_Resize(&v, bytesread); + + return v; +} +%% +override g_input_stream_read_async kwargs +static PyObject * +_wrap_g_input_stream_read_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "count", "callback", "io_priority", + "cancellable", "user_data", NULL }; + long count = -1; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "lO|iOO:InputStream.read_async", + kwlist, + &count, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + if (!pygio_notify_allocate_buffer(notify, count)) + goto error; + + pygio_notify_reference_callback(notify); + pygio_notify_attach_to_result(notify); + + g_input_stream_read_async(G_INPUT_STREAM(self->obj), + notify->buffer, + notify->buffer_size, + io_priority, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_input_stream_read_finish kwargs +static PyObject * +_wrap_g_input_stream_read_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *result; + GError *error = NULL; + Py_ssize_t bytesread; + PyGIONotify *notify; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:gio.InputStream.read_finish", + kwlist, &PyGAsyncResult_Type, &result)) + return NULL; + + bytesread = g_input_stream_read_finish(G_INPUT_STREAM(self->obj), + G_ASYNC_RESULT(result->obj), &error); + + if (pyg_error_check(&error)) + return NULL; + + if (bytesread == 0) + return PyString_FromString(""); + + notify = pygio_notify_get_attached(result); + return PyString_FromStringAndSize(notify->buffer, bytesread); +} +%% +override g_input_stream_close_async kwargs +static PyObject * +_wrap_g_input_stream_close_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", "cancellable", + "user_data", NULL }; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:InputStream.close_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_input_stream_close_async(G_INPUT_STREAM(self->obj), + io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_input_stream_skip_async kwargs +static PyObject * +_wrap_g_input_stream_skip_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "count", "callback", "io_priority", + "cancellable", "user_data", NULL }; + long count = -1; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "lO|iOO:InputStream.skip_async", + kwlist, + &count, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + + g_input_stream_skip_async(G_INPUT_STREAM(self->obj), + count, + io_priority, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gio-types.defs b/gio/gio-types.defs new file mode 100644 index 0000000..331e0bc --- /dev/null +++ b/gio/gio-types.defs @@ -0,0 +1,807 @@ +;; -*- scheme -*- + +; interface definitions ... + +(define-interface AppInfo + (in-module "gio") + (c-name "GAppInfo") + (gtype-id "G_TYPE_APP_INFO") +) + +(define-interface AsyncInitable + (in-module "gio") + (c-name "GAsyncInitable") + (gtype-id "G_TYPE_ASYNC_INITABLE") +) + +(define-interface AsyncResult + (in-module "gio") + (c-name "GAsyncResult") + (gtype-id "G_TYPE_ASYNC_RESULT") +) + +(define-interface Drive + (in-module "gio") + (c-name "GDrive") + (gtype-id "G_TYPE_DRIVE") +) + +(define-interface File + (docstring +"File(arg, path=None, uri=None) -> gio.File subclass\n" +"\n" +"If arg is specified; creates a GFile with the given argument from the\n" +"command line. The value of arg can be either a URI, an absolute path\n" +"or a relative path resolved relative to the current working directory.\n" +"If path is specified, create a file from an absolute or relative path.\n" +"If uri is specified, create a file from a URI.\n\n" +"This operation never fails, but the returned object might not \n" +"support any I/O operation if arg points to a malformed path.") + (in-module "gio") + (c-name "GFile") + (gtype-id "G_TYPE_FILE") +) + +(define-interface Icon + (in-module "gio") + (c-name "GIcon") + (gtype-id "G_TYPE_ICON") +) + +(define-interface Initable + (in-module "gio") + (c-name "GInitable") + (gtype-id "G_TYPE_INITABLE") +) + +(define-interface LoadableIcon + (in-module "gio") + (c-name "GLoadableIcon") + (gtype-id "G_TYPE_LOADABLE_ICON") +) + +(define-interface Mount + (in-module "gio") + (c-name "GMount") + (gtype-id "G_TYPE_MOUNT") +) + +(define-interface Seekable + (in-module "gio") + (c-name "GSeekable") + (gtype-id "G_TYPE_SEEKABLE") +) + +(define-interface SocketConnectable + (in-module "gio") + (c-name "GSocketConnectable") + (gtype-id "G_TYPE_SOCKET_CONNECTABLE") +) + +(define-interface Volume + (in-module "gio") + (c-name "GVolume") + (gtype-id "G_TYPE_VOLUME") +) + +; boxed definitions ... + +(define-boxed FileAttributeMatcher + (in-module "gio") + (c-name "GFileAttributeMatcher") + (gtype-id "G_TYPE_FILE_ATTRIBUTE_MATCHER") +) + +(define-boxed SrvTarget + (in-module "gio") + (c-name "GSrvTarget") + (gtype-id "G_TYPE_SRV_TARGET") +) + +; object definitions ... + +(define-object AppLaunchContext + (in-module "gio") + (parent "GObject") + (c-name "GAppLaunchContext") + (gtype-id "G_TYPE_APP_LAUNCH_CONTEXT") +) + +(define-object Cancellable + (in-module "gio") + (parent "GObject") + (c-name "GCancellable") + (gtype-id "G_TYPE_CANCELLABLE") +) + +(define-object Emblem + (in-module "gio") + (parent "GObject") + (c-name "GEmblem") + (gtype-id "G_TYPE_EMBLEM") +) + +(define-object EmblemedIcon + (in-module "gio") + (parent "GObject") + (c-name "GEmblemedIcon") + (gtype-id "G_TYPE_EMBLEMED_ICON") +) + +(define-object FileEnumerator + (in-module "gio") + (parent "GObject") + (c-name "GFileEnumerator") + (gtype-id "G_TYPE_FILE_ENUMERATOR") +) + +(define-object FileInfo + (in-module "gio") + (parent "GObject") + (c-name "GFileInfo") + (gtype-id "G_TYPE_FILE_INFO") +) + +(define-object FileMonitor + (in-module "gio") + (parent "GObject") + (c-name "GFileMonitor") + (gtype-id "G_TYPE_FILE_MONITOR") +) + +(define-object InputStream + (in-module "gio") + (parent "GObject") + (c-name "GInputStream") + (gtype-id "G_TYPE_INPUT_STREAM") +) + +(define-object FileInputStream + (in-module "gio") + (parent "GInputStream") + (c-name "GFileInputStream") + (gtype-id "G_TYPE_FILE_INPUT_STREAM") +) + +(define-object FileIOStream + (in-module "gio") + (parent "GIOStream") + (c-name "GFileIOStream") + (gtype-id "G_TYPE_FILE_IO_STREAM") +) + +(define-object FilterInputStream + (in-module "gio") + (parent "GInputStream") + (c-name "GFilterInputStream") + (gtype-id "G_TYPE_FILTER_INPUT_STREAM") +) + +(define-object BufferedInputStream + (in-module "gio") + (parent "GFilterInputStream") + (c-name "GBufferedInputStream") + (gtype-id "G_TYPE_BUFFERED_INPUT_STREAM") +) + +(define-object DataInputStream + (in-module "gio") + (parent "GFilterInputStream") + (c-name "GDataInputStream") + (gtype-id "G_TYPE_DATA_INPUT_STREAM") +) + +(define-object MemoryInputStream + (in-module "gio") + (parent "GInputStream") + (c-name "GMemoryInputStream") + (gtype-id "G_TYPE_MEMORY_INPUT_STREAM") +) + +(define-object MountOperation + (in-module "gio") + (parent "GObject") + (c-name "GMountOperation") + (gtype-id "G_TYPE_MOUNT_OPERATION") +) + +(define-object InetAddress + (in-module "gio") + (parent "GObject") + (c-name "GInetAddress") + (gtype-id "G_TYPE_INET_ADDRESS") +) + +(define-object InetSocketAddress + (in-module "gio") + (parent "GSocketAddress") + (c-name "GInetSocketAddress") + (gtype-id "G_TYPE_INET_SOCKET_ADDRESS") +) + +(define-object NetworkAddress + (in-module "gio") + (parent "GObject") + (c-name "GNetworkAddress") + (gtype-id "G_TYPE_NETWORK_ADDRESS") +) + +(define-object NetworkService + (in-module "gio") + (parent "GObject") + (c-name "GNetworkService") + (gtype-id "G_TYPE_NETWORK_SERVICE") +) + +(define-object Resolver + (in-module "gio") + (parent "GObject") + (c-name "GResolver") + (gtype-id "G_TYPE_RESOLVER") +) + +(define-object Socket + (in-module "gio") + (parent "GObject") + (c-name "GSocket") + (gtype-id "G_TYPE_SOCKET") +) + +(define-object SocketAddress + (in-module "gio") + (parent "GObject") + (c-name "GSocketAddress") + (gtype-id "G_TYPE_SOCKET_ADDRESS") +) + +(define-object SocketAddressEnumerator + (in-module "gio") + (parent "GObject") + (c-name "GSocketAddressEnumerator") + (gtype-id "G_TYPE_SOCKET_ADDRESS_ENUMERATOR") +) + +(define-object SocketClient + (in-module "gio") + (parent "GObject") + (c-name "GSocketClient") + (gtype-id "G_TYPE_SOCKET_CLIENT") +) + +(define-object SocketConnection + (in-module "gio") + (parent "GIOStream") + (c-name "GSocketConnection") + (gtype-id "G_TYPE_SOCKET_CONNECTION") +) + +(define-object SocketControlMessage + (in-module "gio") + (parent "GObject") + (c-name "GSocketControlMessage") + (gtype-id "G_TYPE_SOCKET_CONTROL_MESSAGE") +) + +(define-object SocketListener + (in-module "gio") + (parent "GObject") + (c-name "GSocketListener") + (gtype-id "G_TYPE_SOCKET_LISTENER") +) + +(define-object SocketService + (in-module "gio") + (parent "GSocketListener") + (c-name "GSocketService") + (gtype-id "G_TYPE_SOCKET_SERVICE") +) + +(define-object TcpConnection + (in-module "gio") + (parent "GSocketConnection") + (c-name "GTcpConnection") + (gtype-id "G_TYPE_TCP_CONNECTION") +) + +(define-object ThreadedSocketService + (in-module "gio") + (parent "GSocketService") + (c-name "GThreadedSocketService") + (gtype-id "G_TYPE_THREADED_SOCKET_SERVICE") +) + +(define-object IOStream + (in-module "gio") + (parent "GObject") + (c-name "GIOStream") + (gtype-id "G_TYPE_IO_STREAM") +) + +(define-object OutputStream + (in-module "gio") + (parent "GObject") + (c-name "GOutputStream") + (gtype-id "G_TYPE_OUTPUT_STREAM") +) + +(define-object MemoryOutputStream + (in-module "gio") + (parent "GOutputStream") + (c-name "GMemoryOutputStream") + (gtype-id "G_TYPE_MEMORY_OUTPUT_STREAM") +) + +(define-object FilterOutputStream + (in-module "gio") + (parent "GOutputStream") + (c-name "GFilterOutputStream") + (gtype-id "G_TYPE_FILTER_OUTPUT_STREAM") +) + +(define-object BufferedOutputStream + (in-module "gio") + (parent "GFilterOutputStream") + (c-name "GBufferedOutputStream") + (gtype-id "G_TYPE_BUFFERED_OUTPUT_STREAM") +) + +(define-object DataOutputStream + (in-module "gio") + (parent "GFilterOutputStream") + (c-name "GDataOutputStream") + (gtype-id "G_TYPE_DATA_OUTPUT_STREAM") +) + +(define-object FileOutputStream + (in-module "gio") + (parent "GOutputStream") + (c-name "GFileOutputStream") + (gtype-id "G_TYPE_FILE_OUTPUT_STREAM") +) + +(define-object SimpleAsyncResult + (in-module "gio") + (parent "GObject") + (c-name "GSimpleAsyncResult") + (gtype-id "G_TYPE_SIMPLE_ASYNC_RESULT") +) + +(define-object Vfs + (in-module "gio") + (parent "GObject") + (c-name "GVfs") + (gtype-id "G_TYPE_VFS") +) + +(define-object VolumeMonitor + (in-module "gio") + (parent "GObject") + (c-name "GVolumeMonitor") + (gtype-id "G_TYPE_VOLUME_MONITOR") +) + +(define-object NativeVolumeMonitor + (in-module "gio") + (parent "GVolumeMonitor") + (c-name "GNativeVolumeMonitor") + (gtype-id "G_TYPE_NATIVE_VOLUME_MONITOR") +) + +(define-object FileIcon + (in-module "gio") + (parent "GObject") + (c-name "GFileIcon") + (gtype-id "G_TYPE_FILE_ICON") + (implements "GIcon") + (implements "GLoadableIcon") +) + +(define-object ThemedIcon + (in-module "gio") + (parent "GObject") + (c-name "GThemedIcon") + (gtype-id "G_TYPE_THEMED_ICON") + (implements "GIcon") +) + + + +;; Enumerations and flags ... + +(define-flags AppInfoCreateFlags + (in-module "gio") + (c-name "GAppInfoCreateFlags") + (gtype-id "G_TYPE_APP_INFO_CREATE_FLAGS") + (values + '("none" "G_APP_INFO_CREATE_NONE") + '("needs-terminal" "G_APP_INFO_CREATE_NEEDS_TERMINAL") + '("supports-uris" "G_APP_INFO_CREATE_SUPPORTS_URIS") + ) +) + +(define-flags ConverterFlags + (in-module "gio") + (c-name "GConverterFlags") + (gtype-id "G_TYPE_CONVERTER_FLAGS") + (values + '("no-flags" "G_CONVERTER_NO_FLAGS") + '("input-at-end" "G_CONVERTER_INPUT_AT_END") + '("flush" "G_CONVERTER_FLUSH") + ) +) + +(define-enum ConverterResult + (in-module "gio") + (c-name "GConverterResult") + (gtype-id "G_TYPE_CONVERTER_RESULT") + (values + '("error" "G_CONVERTER_ERROR") + '("converted" "G_CONVERTER_CONVERTED") + '("finished" "G_CONVERTER_FINISHED") + '("flushed" "G_CONVERTER_FLUSHED") + ) +) + +(define-enum DataStreamByteOrder + (in-module "gio") + (c-name "GDataStreamByteOrder") + (gtype-id "G_TYPE_DATA_STREAM_BYTE_ORDER") + (values + '("big-endian" "G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN") + '("little-endian" "G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN") + '("host-endian" "G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN") + ) +) + +(define-enum DataStreamNewlineType + (in-module "gio") + (c-name "GDataStreamNewlineType") + (gtype-id "G_TYPE_DATA_STREAM_NEWLINE_TYPE") + (values + '("lf" "G_DATA_STREAM_NEWLINE_TYPE_LF") + '("cr" "G_DATA_STREAM_NEWLINE_TYPE_CR") + '("cr-lf" "G_DATA_STREAM_NEWLINE_TYPE_CR_LF") + '("any" "G_DATA_STREAM_NEWLINE_TYPE_ANY") + ) +) + +(define-enum FileAttributeType + (in-module "gio") + (c-name "GFileAttributeType") + (gtype-id "G_TYPE_FILE_ATTRIBUTE_TYPE") + (values + '("invalid" "G_FILE_ATTRIBUTE_TYPE_INVALID") + '("string" "G_FILE_ATTRIBUTE_TYPE_STRING") + '("byte-string" "G_FILE_ATTRIBUTE_TYPE_BYTE_STRING") + '("boolean" "G_FILE_ATTRIBUTE_TYPE_BOOLEAN") + '("uint32" "G_FILE_ATTRIBUTE_TYPE_UINT32") + '("int32" "G_FILE_ATTRIBUTE_TYPE_INT32") + '("uint64" "G_FILE_ATTRIBUTE_TYPE_UINT64") + '("int64" "G_FILE_ATTRIBUTE_TYPE_INT64") + '("object" "G_FILE_ATTRIBUTE_TYPE_OBJECT") + '("stringv" "G_FILE_ATTRIBUTE_TYPE_STRINGV") + ) +) + +(define-flags FileAttributeInfoFlags + (in-module "gio") + (c-name "GFileAttributeInfoFlags") + (gtype-id "G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS") + (values + '("none" "G_FILE_ATTRIBUTE_INFO_NONE") + '("copy-with-file" "G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE") + '("copy-when-moved" "G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED") + ) +) + +(define-enum FileAttributeStatus + (in-module "gio") + (c-name "GFileAttributeStatus") + (gtype-id "G_TYPE_FILE_ATTRIBUTE_STATUS") + (values + '("unset" "G_FILE_ATTRIBUTE_STATUS_UNSET") + '("set" "G_FILE_ATTRIBUTE_STATUS_SET") + '("error-setting" "G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING") + ) +) + +(define-flags FileQueryInfoFlags + (in-module "gio") + (c-name "GFileQueryInfoFlags") + (gtype-id "G_TYPE_FILE_QUERY_INFO_FLAGS") + (values + '("none" "G_FILE_QUERY_INFO_NONE") + '("nofollow-symlinks" "G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS") + ) +) + +(define-flags FileCreateFlags + (in-module "gio") + (c-name "GFileCreateFlags") + (gtype-id "G_TYPE_FILE_CREATE_FLAGS") + (values + '("none" "G_FILE_CREATE_NONE") + '("private" "G_FILE_CREATE_PRIVATE") + '("replace-destination" "G_FILE_CREATE_REPLACE_DESTINATION") + ) +) + +(define-enum MountMountFlags + (in-module "gio") + (c-name "GMountMountFlags") + (gtype-id "G_TYPE_MOUNT_MOUNT_FLAGS") + (values + '("none" "G_MOUNT_MOUNT_NONE") + ) +) + +(define-flags MountUnmountFlags + (in-module "gio") + (c-name "GMountUnmountFlags") + (gtype-id "G_TYPE_MOUNT_UNMOUNT_FLAGS") + (values + '("none" "G_MOUNT_UNMOUNT_NONE") + '("force" "G_MOUNT_UNMOUNT_FORCE") + ) +) + +(define-enum DriveStartFlags + (in-module "gio") + (c-name "GDriveStartFlags") + (gtype-id "G_TYPE_DRIVE_START_FLAGS") + (values + '("none" "G_DRIVE_START_NONE") + ) +) + +(define-enum DriveStartStopType + (in-module "gio") + (c-name "GDriveStartStopType") + (gtype-id "G_TYPE_DRIVE_START_STOP_TYPE") + (values + '("unknown" "G_DRIVE_START_STOP_TYPE_UNKNOWN") + '("shutdown" "G_DRIVE_START_STOP_TYPE_SHUTDOWN") + '("network" "G_DRIVE_START_STOP_TYPE_NETWORK") + '("multidisk" "G_DRIVE_START_STOP_TYPE_MULTIDISK") + '("password" "G_DRIVE_START_STOP_TYPE_PASSWORD") + ) +) + +(define-flags FileCopyFlags + (in-module "gio") + (c-name "GFileCopyFlags") + (gtype-id "G_TYPE_FILE_COPY_FLAGS") + (values + '("none" "G_FILE_COPY_NONE") + '("overwrite" "G_FILE_COPY_OVERWRITE") + '("backup" "G_FILE_COPY_BACKUP") + '("nofollow-symlinks" "G_FILE_COPY_NOFOLLOW_SYMLINKS") + '("all-metadata" "G_FILE_COPY_ALL_METADATA") + '("no-fallback-for-move" "G_FILE_COPY_NO_FALLBACK_FOR_MOVE") + '("target-default-perms" "G_FILE_COPY_TARGET_DEFAULT_PERMS") + ) +) + +(define-flags FileMonitorFlags + (in-module "gio") + (c-name "GFileMonitorFlags") + (gtype-id "G_TYPE_FILE_MONITOR_FLAGS") + (values + '("none" "G_FILE_MONITOR_NONE") + '("watch-mounts" "G_FILE_MONITOR_WATCH_MOUNTS") + ) +) + +(define-enum FileType + (in-module "gio") + (c-name "GFileType") + (gtype-id "G_TYPE_FILE_TYPE") + (values + '("unknown" "G_FILE_TYPE_UNKNOWN") + '("regular" "G_FILE_TYPE_REGULAR") + '("directory" "G_FILE_TYPE_DIRECTORY") + '("symbolic-link" "G_FILE_TYPE_SYMBOLIC_LINK") + '("special" "G_FILE_TYPE_SPECIAL") + '("shortcut" "G_FILE_TYPE_SHORTCUT") + '("mountable" "G_FILE_TYPE_MOUNTABLE") + ) +) + +(define-enum FilesystemPreviewType + (in-module "gio") + (c-name "GFilesystemPreviewType") + (gtype-id "G_TYPE_FILESYSTEM_PREVIEW_TYPE") + (values + '("if-always" "G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS") + '("if-local" "G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL") + '("never" "G_FILESYSTEM_PREVIEW_TYPE_NEVER") + ) +) + +(define-enum FileMonitorEvent + (in-module "gio") + (c-name "GFileMonitorEvent") + (gtype-id "G_TYPE_FILE_MONITOR_EVENT") + (values + '("changed" "G_FILE_MONITOR_EVENT_CHANGED") + '("changes-done-hint" "G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT") + '("deleted" "G_FILE_MONITOR_EVENT_DELETED") + '("created" "G_FILE_MONITOR_EVENT_CREATED") + '("attribute-changed" "G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED") + '("pre-unmount" "G_FILE_MONITOR_EVENT_PRE_UNMOUNT") + '("unmounted" "G_FILE_MONITOR_EVENT_UNMOUNTED") + ) +) + +(define-enum ErrorEnum + (in-module "gio") + (c-name "GIOErrorEnum") + (gtype-id "G_TYPE_IO_ERROR_ENUM") + (values + '("failed" "G_IO_ERROR_FAILED") + '("not-found" "G_IO_ERROR_NOT_FOUND") + '("exists" "G_IO_ERROR_EXISTS") + '("is-directory" "G_IO_ERROR_IS_DIRECTORY") + '("not-directory" "G_IO_ERROR_NOT_DIRECTORY") + '("not-empty" "G_IO_ERROR_NOT_EMPTY") + '("not-regular-file" "G_IO_ERROR_NOT_REGULAR_FILE") + '("not-symbolic-link" "G_IO_ERROR_NOT_SYMBOLIC_LINK") + '("not-mountable-file" "G_IO_ERROR_NOT_MOUNTABLE_FILE") + '("filename-too-long" "G_IO_ERROR_FILENAME_TOO_LONG") + '("invalid-filename" "G_IO_ERROR_INVALID_FILENAME") + '("too-many-links" "G_IO_ERROR_TOO_MANY_LINKS") + '("no-space" "G_IO_ERROR_NO_SPACE") + '("invalid-argument" "G_IO_ERROR_INVALID_ARGUMENT") + '("permission-denied" "G_IO_ERROR_PERMISSION_DENIED") + '("not-supported" "G_IO_ERROR_NOT_SUPPORTED") + '("not-mounted" "G_IO_ERROR_NOT_MOUNTED") + '("already-mounted" "G_IO_ERROR_ALREADY_MOUNTED") + '("closed" "G_IO_ERROR_CLOSED") + '("cancelled" "G_IO_ERROR_CANCELLED") + '("pending" "G_IO_ERROR_PENDING") + '("read-only" "G_IO_ERROR_READ_ONLY") + '("cant-create-backup" "G_IO_ERROR_CANT_CREATE_BACKUP") + '("wrong-etag" "G_IO_ERROR_WRONG_ETAG") + '("timed-out" "G_IO_ERROR_TIMED_OUT") + '("would-recurse" "G_IO_ERROR_WOULD_RECURSE") + '("busy" "G_IO_ERROR_BUSY") + '("would-block" "G_IO_ERROR_WOULD_BLOCK") + '("host-not-found" "G_IO_ERROR_HOST_NOT_FOUND") + '("would-merge" "G_IO_ERROR_WOULD_MERGE") + '("failed-handled" "G_IO_ERROR_FAILED_HANDLED") + '("too-many-open-files" "G_IO_ERROR_TOO_MANY_OPEN_FILES") + '("not-initialized" "G_IO_ERROR_NOT_INITIALIZED") + '("address-in-use" "G_IO_ERROR_ADDRESS_IN_USE") + '("partial-input" "G_IO_ERROR_PARTIAL_INPUT") + '("invalid-data" "G_IO_ERROR_INVALID_DATA") + ) +) + +(define-flags AskPasswordFlags + (in-module "gio") + (c-name "GAskPasswordFlags") + (gtype-id "G_TYPE_ASK_PASSWORD_FLAGS") + (values + '("need-password" "G_ASK_PASSWORD_NEED_PASSWORD") + '("need-username" "G_ASK_PASSWORD_NEED_USERNAME") + '("need-domain" "G_ASK_PASSWORD_NEED_DOMAIN") + '("saving-supported" "G_ASK_PASSWORD_SAVING_SUPPORTED") + '("anonymous-supported" "G_ASK_PASSWORD_ANONYMOUS_SUPPORTED") + ) +) + +(define-enum PasswordSave + (in-module "gio") + (c-name "GPasswordSave") + (gtype-id "G_TYPE_PASSWORD_SAVE") + (values + '("never" "G_PASSWORD_SAVE_NEVER") + '("for-session" "G_PASSWORD_SAVE_FOR_SESSION") + '("permanently" "G_PASSWORD_SAVE_PERMANENTLY") + ) +) + +(define-enum MountOperationResult + (in-module "gio") + (c-name "GMountOperationResult") + (gtype-id "G_TYPE_MOUNT_OPERATION_RESULT") + (values + '("handled" "G_MOUNT_OPERATION_HANDLED") + '("aborted" "G_MOUNT_OPERATION_ABORTED") + '("unhandled" "G_MOUNT_OPERATION_UNHANDLED") + ) +) + +(define-flags OutputStreamSpliceFlags + (in-module "gio") + (c-name "GOutputStreamSpliceFlags") + (gtype-id "G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS") + (values + '("none" "G_OUTPUT_STREAM_SPLICE_NONE") + '("close-source" "G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE") + '("close-target" "G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET") + ) +) + +(define-enum EmblemOrigin + (in-module "gio") + (c-name "GEmblemOrigin") + (gtype-id "G_TYPE_EMBLEM_ORIGIN") + (values + '("unknown" "G_EMBLEM_ORIGIN_UNKNOWN") + '("device" "G_EMBLEM_ORIGIN_DEVICE") + '("livemetadata" "G_EMBLEM_ORIGIN_LIVEMETADATA") + '("tag" "G_EMBLEM_ORIGIN_TAG") + ) +) + +(define-enum ResolverError + (in-module "gio") + (c-name "GResolverError") + (gtype-id "G_TYPE_RESOLVER_ERROR") + (values + '("not-found" "G_RESOLVER_ERROR_NOT_FOUND") + '("temporary-failure" "G_RESOLVER_ERROR_TEMPORARY_FAILURE") + '("internal" "G_RESOLVER_ERROR_INTERNAL") + ) +) + +(define-enum SocketFamily + (in-module "gio") + (c-name "GSocketFamily") + (gtype-id "G_TYPE_SOCKET_FAMILY") + (values + '("invalid" "G_SOCKET_FAMILY_INVALID") + '("unix" "G_SOCKET_FAMILY_UNIX") + '("ipv4" "G_SOCKET_FAMILY_IPV4") + '("ipv6" "G_SOCKET_FAMILY_IPV6") + ) +) + +(define-enum SocketType + (in-module "gio") + (c-name "GSocketType") + (gtype-id "G_TYPE_SOCKET_TYPE") + (values + '("invalid" "G_SOCKET_TYPE_INVALID") + '("stream" "G_SOCKET_TYPE_STREAM") + '("datagram" "G_SOCKET_TYPE_DATAGRAM") + '("seqpacket" "G_SOCKET_TYPE_SEQPACKET") + ) +) + +(define-enum SocketMsgFlags + (in-module "gio") + (c-name "GSocketMsgFlags") + (gtype-id "G_TYPE_SOCKET_MSG_FLAGS") + (values + '("none" "G_SOCKET_MSG_NONE") + '("oob" "G_SOCKET_MSG_OOB") + '("peek" "G_SOCKET_MSG_PEEK") + '("dontroute" "G_SOCKET_MSG_DONTROUTE") + ) +) + +(define-enum SocketProtocol + (in-module "gio") + (c-name "GSocketProtocol") + (gtype-id "G_TYPE_SOCKET_PROTOCOL") + (values + '("unknown" "G_SOCKET_PROTOCOL_UNKNOWN") + '("default" "G_SOCKET_PROTOCOL_DEFAULT") + '("tcp" "G_SOCKET_PROTOCOL_TCP") + '("udp" "G_SOCKET_PROTOCOL_UDP") + '("sctp" "G_SOCKET_PROTOCOL_SCTP") + ) +) + +(define-enum ZlibCompressorFormat + (in-module "gio") + (c-name "GZlibCompressorFormat") + (gtype-id "G_TYPE_ZLIB_COMPRESSOR_FORMAT") + (values + '("zlib" "G_ZLIB_COMPRESSOR_FORMAT_ZLIB") + '("gzip" "G_ZLIB_COMPRESSOR_FORMAT_GZIP") + '("raw" "G_ZLIB_COMPRESSOR_FORMAT_RAW") + ) +) diff --git a/gio/gio.defs b/gio/gio.defs new file mode 100644 index 0000000..f5a28b6 --- /dev/null +++ b/gio/gio.defs @@ -0,0 +1,7465 @@ +;; -*- scheme -*- + +(include "gio-types.defs") + +;; From gappinfo.h + +(define-function app_info_get_type + (c-name "g_app_info_get_type") + (return-type "GType") +) + +(define-function app_launch_context_get_type + (c-name "g_app_launch_context_get_type") + (return-type "GType") +) + +(define-function app_info_create_from_commandline + (c-name "g_app_info_create_from_commandline") + (is-constructor-of "GAppInfo") + (return-type "GAppInfo*") + (parameters + '("const-char*" "commandline") + '("const-char*" "application_name" (null-ok) (default "NULL")) + '("GAppInfoCreateFlags" "flags" (default "G_APP_INFO_CREATE_NONE")) + '("GError**" "error") + ) +) + +(define-method dup + (of-object "GAppInfo") + (c-name "g_app_info_dup") + (return-type "GAppInfo*") + (caller-owns-return #t) +) + +(define-method equal + (of-object "GAppInfo") + (c-name "g_app_info_equal") + (return-type "gboolean") + (parameters + '("GAppInfo*" "appinfo2") + ) +) + +(define-method get_id + (of-object "GAppInfo") + (c-name "g_app_info_get_id") + (return-type "const-char*") +) + +(define-method get_name + (of-object "GAppInfo") + (c-name "g_app_info_get_name") + (return-type "const-char*") +) + +(define-method get_description + (of-object "GAppInfo") + (c-name "g_app_info_get_description") + (return-type "const-char*") +) + +(define-method get_executable + (of-object "GAppInfo") + (c-name "g_app_info_get_executable") + (return-type "const-char*") +) + +(define-method get_icon + (of-object "GAppInfo") + (c-name "g_app_info_get_icon") + (return-type "GIcon*") +) + +;; +;; wrapped in gappinfo.override +;; +(define-method launch + (docstring + "launch (files=None, launch_context=None) -> gboolean\n" + "\n" + "Launches the application. Passes files to the launched application\n" + "as arguments, using the optional launch_context to get information\n" + "about the details of the launcher (like what screen it is on).\n" + "On error, error will be set accordingly.\n\n" + "Note that even if the launch is successful the application launched\n" + "can fail to start if it runs into problems during startup.\n" + "There is no way to detect this.\n\n" + "Some URIs can be changed when passed through a gio.File\n" + "(for instance unsupported uris with strange formats like mailto:),\n" + "so if you have a textual uri you want to pass in as argument,\n" + "consider using gio.AppInfo.launch_uris() instead." + ) + (of-object "GAppInfo") + (c-name "g_app_info_launch") + (return-type "gboolean") + (parameters + '("GList*" "files") + '("GAppLaunchContext*" "launch_context") + '("GError**" "error") + ) +) + +(define-method supports_uris + (of-object "GAppInfo") + (c-name "g_app_info_supports_uris") + (return-type "gboolean") +) + +(define-method supports_files + (of-object "GAppInfo") + (c-name "g_app_info_supports_files") + (return-type "gboolean") +) + +;; +;; wrapped in gappinfo.override +;; +(define-method launch_uris + (docstring + "launch_uris (files=None, launch_context=None) -> gboolean\n" + "\n" + "Launches the application. Passes files to the launched application\n" + "as arguments, using the optional launch_context to get information\n" + "about the details of the launcher (like what screen it is on).\n" + "On error, error will be set accordingly.\n\n" + "Note that even if the launch is successful the application launched\n" + "can fail to start if it runs into problems during startup.\n" + "There is no way to detect this.\n\n" + ) + (of-object "GAppInfo") + (c-name "g_app_info_launch_uris") + (return-type "gboolean") + (parameters + '("GList*" "uris") + '("GAppLaunchContext*" "launch_context") + '("GError**" "error") + ) +) + +(define-method should_show + (of-object "GAppInfo") + (c-name "g_app_info_should_show") + (return-type "gboolean") +) + +(define-method set_as_default_for_type + (of-object "GAppInfo") + (c-name "g_app_info_set_as_default_for_type") + (return-type "gboolean") + (parameters + '("const-char*" "content_type") + '("GError**" "error") + ) +) + +(define-method set_as_default_for_extension + (of-object "GAppInfo") + (c-name "g_app_info_set_as_default_for_extension") + (return-type "gboolean") + (parameters + '("const-char*" "extension") + '("GError**" "error") + ) +) + +(define-method add_supports_type + (of-object "GAppInfo") + (c-name "g_app_info_add_supports_type") + (return-type "gboolean") + (parameters + '("const-char*" "content_type") + '("GError**" "error") + ) +) + +(define-method can_remove_supports_type + (of-object "GAppInfo") + (c-name "g_app_info_can_remove_supports_type") + (return-type "gboolean") +) + +(define-method remove_supports_type + (of-object "GAppInfo") + (c-name "g_app_info_remove_supports_type") + (return-type "gboolean") + (parameters + '("const-char*" "content_type") + '("GError**" "error") + ) +) + +;; +;; wrapped in gio.override +;; +(define-function app_info_get_all + (c-name "g_app_info_get_all") + (return-type "GList*") +) + +;; +;; wrapped in gio.override +;; +(define-function app_info_get_all_for_type + (c-name "g_app_info_get_all_for_type") + (return-type "GList*") + (parameters + '("const-char*" "content_type") + ) +) + +(define-function app_info_get_default_for_type + (c-name "g_app_info_get_default_for_type") + (return-type "GAppInfo*") + (parameters + '("const-char*" "content_type") + '("gboolean" "must_support_uris") + ) +) + +(define-function app_info_get_default_for_uri_scheme + (c-name "g_app_info_get_default_for_uri_scheme") + (return-type "GAppInfo*") + (parameters + '("const-char*" "uri_scheme") + ) +) + +(define-function app_launch_context_new + (c-name "g_app_launch_context_new") + (is-constructor-of "GAppLaunchContext") + (return-type "GAppLaunchContext*") +) + +;; +;; wrapped in gapplaunchcontext.override +;; +(define-method get_display + (of-object "GAppLaunchContext") + (c-name "g_app_launch_context_get_display") + (return-type "char*") + (parameters + '("GAppInfo*" "info") + '("GList*" "files") + ) +) + +;; +;; wrapped in gapplaunchcontext.override +;; +(define-method get_startup_notify_id + (of-object "GAppLaunchContext") + (c-name "g_app_launch_context_get_startup_notify_id") + (return-type "char*") + (parameters + '("GAppInfo*" "info") + '("GList*" "files") + ) +) + +(define-method launch_failed + (of-object "GAppLaunchContext") + (c-name "g_app_launch_context_launch_failed") + (return-type "none") + (parameters + '("const-char*" "startup_notify_id") + ) +) + +(define-function app_info_reset_type_associations + (c-name "g_app_info_reset_type_associations") + (return-type "none") + (parameters + '("const-char*" "content_type") + ) +) + +(define-method can_delete + (of-object "GAppInfo") + (c-name "g_app_info_can_delete") + (return-type "gboolean") +) + +(define-method delete + (of-object "GAppInfo") + (c-name "g_app_info_delete") + (return-type "gboolean") +) + +(define-method get_commandline + (of-object "GAppInfo") + (c-name "g_app_info_get_commandline") + (return-type "const-char*") +) + + + +;; From gasyncinitable.h + +(define-function async_initable_get_type + (c-name "g_async_initable_get_type") + (return-type "GType") +) + +(define-method init_async + (of-object "GAsyncInitable") + (c-name "g_async_initable_init_async") + (return-type "none") + (parameters + '("int" "io_priority") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method init_finish + (of-object "GAsyncInitable") + (c-name "g_async_initable_init_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-function async_initable_new_async + (c-name "g_async_initable_new_async") + (return-type "none") + (parameters + '("GType" "object_type") + '("int" "io_priority") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + '("const-gchar*" "first_property_name") + ) + (varargs #t) +) + +(define-function async_initable_newv_async + (c-name "g_async_initable_newv_async") + (return-type "none") + (parameters + '("GType" "object_type") + '("guint" "n_parameters") + '("GParameter*" "parameters") + '("int" "io_priority") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-function async_initable_new_valist_async + (c-name "g_async_initable_new_valist_async") + (return-type "none") + (parameters + '("GType" "object_type") + '("const-gchar*" "first_property_name") + '("va_list" "var_args") + '("int" "io_priority") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method new_finish + (of-object "GAsyncInitable") + (c-name "g_async_initable_new_finish") + (return-type "GObject*") + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + + + +;; From gasyncresult.h + +(define-function async_result_get_type + (c-name "g_async_result_get_type") + (return-type "GType") +) + +(define-method get_user_data + (of-object "GAsyncResult") + (c-name "g_async_result_get_user_data") + (return-type "gpointer") +) + +(define-method get_source_object + (of-object "GAsyncResult") + (c-name "g_async_result_get_source_object") + (return-type "GObject*") +) + + + +;; From gbufferedinputstream.h + +(define-function buffered_input_stream_get_type + (c-name "g_buffered_input_stream_get_type") + (return-type "GType") +) + +(define-function buffered_input_stream_new + (c-name "g_buffered_input_stream_new") + (is-constructor-of "GBufferedInputStream") + (return-type "GInputStream*") + (properties + '("base_stream") + ) +) + +(define-function buffered_input_stream_new_sized + (c-name "g_buffered_input_stream_new_sized") + (return-type "GInputStream*") + (parameters + '("GInputStream*" "base_stream") + '("gsize" "size") + ) +) + +(define-method get_buffer_size + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_get_buffer_size") + (return-type "gsize") +) + +(define-method set_buffer_size + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_set_buffer_size") + (return-type "none") + (parameters + '("gsize" "size") + ) +) + +(define-method get_available + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_get_available") + (return-type "gsize") +) + +(define-method peek + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_peek") + (return-type "gsize") + (parameters + '("void*" "buffer") + '("gsize" "offset") + '("gsize" "count") + ) +) + +(define-method peek_buffer + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_peek_buffer") + (return-type "const-void*") + (parameters + '("gsize*" "count") + ) +) + +(define-method fill + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_fill") + (return-type "gssize") + (unblock-threads #t) + (parameters + '("gssize" "count") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method fill_async + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_fill_async") + (return-type "none") + (parameters + '("gssize" "count") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method fill_finish + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_fill_finish") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method read_byte + (of-object "GBufferedInputStream") + (c-name "g_buffered_input_stream_read_byte") + (return-type "int") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + + + +;; From gbufferedoutputstream.h + +(define-function buffered_output_stream_get_type + (c-name "g_buffered_output_stream_get_type") + (return-type "GType") +) + +(define-function buffered_output_stream_new + (c-name "g_buffered_output_stream_new") + (is-constructor-of "GBufferedOutputStream") + (return-type "GOutputStream*") + (properties + '("base_stream") + ) +) + +(define-function buffered_output_stream_new_sized + (c-name "g_buffered_output_stream_new_sized") + (return-type "GOutputStream*") + (parameters + '("GOutputStream*" "base_stream") + '("guint" "size") + ) +) + +(define-method get_buffer_size + (of-object "GBufferedOutputStream") + (c-name "g_buffered_output_stream_get_buffer_size") + (return-type "gsize") +) + +(define-method set_buffer_size + (of-object "GBufferedOutputStream") + (c-name "g_buffered_output_stream_set_buffer_size") + (return-type "none") + (parameters + '("gsize" "size") + ) +) + +(define-method get_auto_grow + (of-object "GBufferedOutputStream") + (c-name "g_buffered_output_stream_get_auto_grow") + (return-type "gboolean") +) + +(define-method set_auto_grow + (of-object "GBufferedOutputStream") + (c-name "g_buffered_output_stream_set_auto_grow") + (return-type "none") + (parameters + '("gboolean" "auto_grow") + ) +) + + + +;; From gcancellable.h + +(define-function cancellable_get_type + (c-name "g_cancellable_get_type") + (return-type "GType") +) + +(define-function cancellable_new + (c-name "g_cancellable_new") + (is-constructor-of "GCancellable") + (return-type "GCancellable*") +) + +(define-method is_cancelled + (of-object "GCancellable") + (c-name "g_cancellable_is_cancelled") + (return-type "gboolean") +) + +(define-method set_error_if_cancelled + (of-object "GCancellable") + (c-name "g_cancellable_set_error_if_cancelled") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method get_fd + (of-object "GCancellable") + (c-name "g_cancellable_get_fd") + (return-type "int") +) + +(define-method make_pollfd + (of-object "GCancellable") + (c-name "g_cancellable_make_pollfd") + (return-type "none") + (parameters + '("GPollFD*" "pollfd") + ) +) + +(define-function cancellable_get_current + (c-name "g_cancellable_get_current") + (return-type "GCancellable*") +) + +(define-method push_current + (of-object "GCancellable") + (c-name "g_cancellable_push_current") + (return-type "none") +) + +(define-method pop_current + (of-object "GCancellable") + (c-name "g_cancellable_pop_current") + (return-type "none") +) + +(define-method reset + (of-object "GCancellable") + (c-name "g_cancellable_reset") + (return-type "none") +) + +(define-method cancel + (of-object "GCancellable") + (c-name "g_cancellable_cancel") + (return-type "none") +) + +(define-method connect + (of-object "GCancellable") + (c-name "g_cancellable_connect") + (return-type "gulong") + (parameters + '("GCallback" "callback") + '("gpointer" "data") + '("GDestroyNotify" "data_destroy_func") + ) +) + +(define-method disconnect + (of-object "GCancellable") + (c-name "g_cancellable_disconnect") + (return-type "none") + (parameters + '("gulong" "handler_id") + ) +) + +(define-method release_fd + (of-object "GCancellable") + (c-name "g_cancellable_release_fd") + (return-type "none") +) + + + +;; From gcontenttype.h + +(define-function content_type_equals + (c-name "g_content_type_equals") + (return-type "gboolean") + (parameters + '("const-char*" "type1") + '("const-char*" "type2") + ) +) + +(define-function content_type_is_a + (c-name "g_content_type_is_a") + (return-type "gboolean") + (parameters + '("const-char*" "type") + '("const-char*" "supertype") + ) +) + +(define-function content_type_is_unknown + (c-name "g_content_type_is_unknown") + (return-type "gboolean") + (parameters + '("const-char*" "type") + ) +) + +(define-function content_type_get_description + (c-name "g_content_type_get_description") + (return-type "char*") + (parameters + '("const-char*" "type") + ) +) + +(define-function content_type_get_mime_type + (c-name "g_content_type_get_mime_type") + (return-type "char*") + (parameters + '("const-char*" "type") + ) +) + +(define-function content_type_get_icon + (c-name "g_content_type_get_icon") + (return-type "GIcon*") + (caller-owns-return #t) + (parameters + '("const-char*" "type") + ) +) + +(define-function content_type_can_be_executable + (c-name "g_content_type_can_be_executable") + (return-type "gboolean") + (parameters + '("const-char*" "type") + ) +) + +(define-function content_type_from_mime_type + (c-name "g_content_type_from_mime_type") + (return-type "char*") + (parameters + '("const-char*" "mime_type") + ) +) + +;; +;; wrapped in gio.override +;; +(define-function content_type_guess + (docstring +"content_type_guess([filename, data, want_uncertain]) -> mime type\n" +"\n" +"Guesses the content type based on the parameters passed.\n" +"Either filename or data must be specified\n" +"Returns a string containing the mime type.\n" +"If want_uncertain is set to True, return a tuple with the mime type and \n" +"True/False if the type guess was uncertain or not.") + (c-name "g_content_type_guess") + (return-type "char*") + (parameters + '("const-char*" "filename") + '("const-guchar*" "data") + '("gsize" "data_size") + '("gboolean*" "result_uncertain") + ) +) + +(define-function content_type_guess_for_tree + (c-name "g_content_type_guess_for_tree") + (return-type "char**") + (parameters + '("GFile*" "root") + ) +) + +;; +;; wrapped in gio.override +;; +(define-function content_types_get_registered + (c-name "g_content_types_get_registered") + (return-type "GList*") +) + + + +;; From gdatainputstream.h + +(define-function data_input_stream_get_type + (c-name "g_data_input_stream_get_type") + (return-type "GType") +) + +(define-function data_input_stream_new + (c-name "g_data_input_stream_new") + (is-constructor-of "GDataInputStream") + (return-type "GDataInputStream*") + (properties + '("base_stream") + ) +) + +(define-method set_byte_order + (of-object "GDataInputStream") + (c-name "g_data_input_stream_set_byte_order") + (return-type "none") + (parameters + '("GDataStreamByteOrder" "order") + ) +) + +(define-method get_byte_order + (of-object "GDataInputStream") + (c-name "g_data_input_stream_get_byte_order") + (return-type "GDataStreamByteOrder") +) + +(define-method set_newline_type + (of-object "GDataInputStream") + (c-name "g_data_input_stream_set_newline_type") + (return-type "none") + (parameters + '("GDataStreamNewlineType" "type") + ) +) + +(define-method get_newline_type + (of-object "GDataInputStream") + (c-name "g_data_input_stream_get_newline_type") + (return-type "GDataStreamNewlineType") +) + +(define-method read_byte + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_byte") + (return-type "guchar") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method read_int16 + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_int16") + (return-type "gint16") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method read_uint16 + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_uint16") + (return-type "guint16") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method read_int32 + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_int32") + (return-type "gint32") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method read_uint32 + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_uint32") + (return-type "guint32") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method read_int64 + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_int64") + (return-type "gint64") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method read_uint64 + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_uint64") + (return-type "guint64") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gdatainputstream.override +;; +(define-method read_line + (of-object "GDataInputStream") + (docstring + "S.read_line([cancellable]) -> str\n" + "Read a line from the stream. Return value includes ending newline\n" + "character.") + (c-name "g_data_input_stream_read_line") + (return-type "char*") + (parameters + '("gsize*" "length") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gdatainputstream.override +;; +(define-method read_until + (of-object "GDataInputStream") + (docstring + "S.read_until(stop_chars, [cancellable]) -> str\n" + "Read characters from the string, stopping at the end or upon reading\n" + "any character in stop_chars. Return value does not include the stopping\n" + "character.") + (c-name "g_data_input_stream_read_until") + (return-type "char*") + (parameters + '("const-gchar*" "stop_chars") + '("gsize*" "length") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method read_until_async + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_until_async") + (return-type "none") + (parameters + '("const-gchar*" "stop_chars") + '("gint" "io_priority") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method read_until_finish + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_until_finish") + (return-type "char*") + (parameters + '("GAsyncResult*" "result") + '("gsize*" "length") + '("GError**" "error") + ) +) + +(define-method read_line_async + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_line_async") + (return-type "none") + (parameters + '("gint" "io_priority") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method read_line_finish + (of-object "GDataInputStream") + (c-name "g_data_input_stream_read_line_finish") + (return-type "char*") + (parameters + '("GAsyncResult*" "result") + '("gsize*" "length") + '("GError**" "error") + ) +) + + + +;; From gdataoutputstream.h + +(define-function data_output_stream_get_type + (c-name "g_data_output_stream_get_type") + (return-type "GType") +) + +(define-function data_output_stream_new + (c-name "g_data_output_stream_new") + (is-constructor-of "GDataOutputStream") + (return-type "GDataOutputStream*") + (properties + '("base_stream") + ) +) + +(define-method set_byte_order + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_set_byte_order") + (return-type "none") + (parameters + '("GDataStreamByteOrder" "order") + ) +) + +(define-method get_byte_order + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_get_byte_order") + (return-type "GDataStreamByteOrder") +) + +(define-method put_byte + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_put_byte") + (return-type "gboolean") + (parameters + '("guchar" "data") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method put_int16 + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_put_int16") + (return-type "gboolean") + (parameters + '("gint16" "data") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method put_uint16 + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_put_uint16") + (return-type "gboolean") + (parameters + '("guint16" "data") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method put_int32 + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_put_int32") + (return-type "gboolean") + (parameters + '("gint32" "data") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method put_uint32 + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_put_uint32") + (return-type "gboolean") + (parameters + '("guint32" "data") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method put_int64 + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_put_int64") + (return-type "gboolean") + (parameters + '("gint64" "data") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method put_uint64 + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_put_uint64") + (return-type "gboolean") + (parameters + '("guint64" "data") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method put_string + (of-object "GDataOutputStream") + (c-name "g_data_output_stream_put_string") + (return-type "gboolean") + (parameters + '("const-char*" "str") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + + + + + + +;; From gdrive.h + +(define-function drive_get_type + (c-name "g_drive_get_type") + (return-type "GType") +) + +(define-method get_name + (of-object "GDrive") + (c-name "g_drive_get_name") + (return-type "char*") +) + +(define-method get_icon + (of-object "GDrive") + (c-name "g_drive_get_icon") + (return-type "GIcon*") + (caller-owns-return #t) +) + +(define-method has_volumes + (of-object "GDrive") + (c-name "g_drive_has_volumes") + (return-type "gboolean") +) + +;; +;; wrapped in gdrive.override +;; +(define-method get_volumes + (of-object "GDrive") + (c-name "g_drive_get_volumes") + (return-type "GList*") +) + +(define-method is_media_removable + (of-object "GDrive") + (c-name "g_drive_is_media_removable") + (return-type "gboolean") +) + +(define-method has_media + (of-object "GDrive") + (c-name "g_drive_has_media") + (return-type "gboolean") +) + +(define-method is_media_check_automatic + (of-object "GDrive") + (c-name "g_drive_is_media_check_automatic") + (return-type "gboolean") +) + +(define-method can_poll_for_media + (of-object "GDrive") + (c-name "g_drive_can_poll_for_media") + (return-type "gboolean") +) + +(define-method can_eject + (of-object "GDrive") + (c-name "g_drive_can_eject") + (return-type "gboolean") +) + +;; +;; wrapped in gdrive.override +;; +(define-method eject + (of-object "GDrive") + (c-name "g_drive_eject") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method eject_finish + (of-object "GDrive") + (c-name "g_drive_eject_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in gdrive.override +;; +(define-method poll_for_media + (of-object "GDrive") + (c-name "g_drive_poll_for_media") + (return-type "none") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method poll_for_media_finish + (of-object "GDrive") + (c-name "g_drive_poll_for_media_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method get_identifier + (of-object "GDrive") + (c-name "g_drive_get_identifier") + (return-type "char*") + (parameters + '("const-char*" "kind") + ) +) + +;; +;; wrapped in gdrive.override +;; +(define-method enumerate_identifiers + (of-object "GDrive") + (c-name "g_drive_enumerate_identifiers") + (return-type "char**") +) + +(define-method can_start + (of-object "GDrive") + (c-name "g_drive_can_start") + (return-type "gboolean") +) + +(define-method can_start_degraded + (of-object "GDrive") + (c-name "g_drive_can_start_degraded") + (return-type "gboolean") +) + +(define-method can_stop + (of-object "GDrive") + (c-name "g_drive_can_stop") + (return-type "gboolean") +) + +(define-method eject_with_operation + (of-object "GDrive") + (c-name "g_drive_eject_with_operation") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method eject_with_operation_finish + (of-object "GDrive") + (c-name "g_drive_eject_with_operation_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method get_start_stop_type + (of-object "GDrive") + (c-name "g_drive_get_start_stop_type") + (return-type "GDriveStartStopType") +) + +(define-method start + (of-object "GDrive") + (c-name "g_drive_start") + (return-type "none") + (parameters + '("GDriveStartFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method start_finish + (of-object "GDrive") + (c-name "g_drive_start_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method stop + (of-object "GDrive") + (c-name "g_drive_stop") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method stop_finish + (of-object "GDrive") + (c-name "g_drive_stop_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + + + +;; From gemblemedicon.h + +(define-function emblemed_icon_get_type + (c-name "g_emblemed_icon_get_type") + (return-type "GType") +) + +(define-function emblemed_icon_new + (c-name "g_emblemed_icon_new") + (is-constructor-of "GEmblemedIcon") + (return-type "GIcon*") + (parameters + '("GIcon*" "icon") + '("GEmblem*" "emblem") + ) +) + +(define-method get_icon + (of-object "GEmblemedIcon") + (c-name "g_emblemed_icon_get_icon") + (return-type "GIcon*") +) + +(define-method get_emblems + (of-object "GEmblemedIcon") + (c-name "g_emblemed_icon_get_emblems") + (return-type "GList*") +) + +(define-method add_emblem + (of-object "GEmblemedIcon") + (c-name "g_emblemed_icon_add_emblem") + (return-type "none") + (parameters + '("GEmblem*" "emblem") + ) +) + + + +;; From gemblem.h + +(define-function emblem_get_type + (c-name "g_emblem_get_type") + (return-type "GType") +) + +(define-function emblem_new + (c-name "g_emblem_new") + (is-constructor-of "GEmblem") + (return-type "GEmblem*") + (properties + '("icon") + '("origin" (optional)) + ) +) + +(define-function emblem_new_with_origin + (c-name "g_emblem_new_with_origin") + (return-type "GEmblem*") + (parameters + '("GIcon*" "icon") + '("GEmblemOrigin" "origin") + ) +) + +(define-method get_icon + (of-object "GEmblem") + (c-name "g_emblem_get_icon") + (return-type "GIcon*") +) + +(define-method get_origin + (of-object "GEmblem") + (c-name "g_emblem_get_origin") + (return-type "GEmblemOrigin") +) + + + +;; From gfileattribute.h + +(define-function file_attribute_info_list_new + (c-name "g_file_attribute_info_list_new") + (is-constructor-of "GFileAttributeInfoList") + (return-type "GFileAttributeInfoList*") +) + +(define-method ref + (of-object "GFileAttributeInfoList") + (c-name "g_file_attribute_info_list_ref") + (return-type "GFileAttributeInfoList*") +) + +(define-method unref + (of-object "GFileAttributeInfoList") + (c-name "g_file_attribute_info_list_unref") + (return-type "none") +) + +(define-method dup + (of-object "GFileAttributeInfoList") + (c-name "g_file_attribute_info_list_dup") + (return-type "GFileAttributeInfoList*") +) + +(define-method lookup + (of-object "GFileAttributeInfoList") + (c-name "g_file_attribute_info_list_lookup") + (return-type "const-GFileAttributeInfo*") + (parameters + '("const-char*" "name") + ) +) + +(define-method add + (of-object "GFileAttributeInfoList") + (c-name "g_file_attribute_info_list_add") + (return-type "none") + (parameters + '("const-char*" "name") + '("GFileAttributeType" "type") + '("GFileAttributeInfoFlags" "flags" (default "G_FILE_ATTRIBUTE_INFO_NONE")) + ) +) + + + +;; From gfileenumerator.h + +(define-function file_enumerator_get_type + (c-name "g_file_enumerator_get_type") + (return-type "GType") +) + +(define-method next_file + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_next_file") + (return-type "GFileInfo*") + (caller-owns-return #t) + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method close + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_close") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfileenumerator.override +;; +(define-method next_files_async + (docstring +"FE.next_files_async(num_files, callback, [io_priority, cancellable,\n" +" user_data])\n" +"Request information for a number of files from the enumerator\n" +"asynchronously. When all i/o for the operation is finished the callback\n" +"will be called with the requested information.\n" +"\n" +"The callback can be called with less than num_files files in case of error\n" +"or at the end of the enumerator. In case of a partial error the callback\n" +"will be called with any succeeding items and no error, and on the next\n" +"request the error will be reported. If a request is cancelled the callback\n" +"will be called with gio.ERROR_CANCELLED.\n" +"\n" +"During an async request no other sync and async calls are allowed, and will\n" +"result in gio.ERROR_PENDING errors.\n" +"\n" +"Any outstanding i/o request with higher priority (lower numerical value)\n" +"will be executed before an outstanding request with lower priority.\n" +"Default priority is gobject.PRIORITY_DEFAULT.") + + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_next_files_async") + (return-type "none") + (parameters + '("int" "num_files") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +;; +;; wrapped in gfileenumerator.override +;; +(define-method next_files_finish + (docstring +"FE.next_files_finish(result) -> a list of gio.FileInfos\n" +"Finishes the asynchronous operation started with\n" +"gio.FileEnumerator.next_files_async().") + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_next_files_finish") + (return-type "GList*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfileenumerator.override +;; +(define-method close_async + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_close_async") + (return-type "none") + (parameters + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method close_finish + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_close_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method is_closed + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_is_closed") + (return-type "gboolean") +) + +(define-method has_pending + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_has_pending") + (return-type "gboolean") +) + +(define-method set_pending + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_set_pending") + (return-type "none") + (parameters + '("gboolean" "pending") + ) +) + +(define-method get_container + (of-object "GFileEnumerator") + (c-name "g_file_enumerator_get_container") + (return-type "GFile*") +) + + + +;; From gfile.h + +(define-function file_get_type + (c-name "g_file_get_type") + (return-type "GType") +) + +(define-function file_new_for_path + (c-name "g_file_new_for_path") + (is-constructor-of "GFile") + (return-type "GFile*") + (parameters + '("const-char*" "path") + ) +) + +(define-function file_new_for_uri + (c-name "g_file_new_for_uri") + (is-constructor-of "GFile") + (return-type "GFile*") + (parameters + '("const-char*" "uri") + ) +) + +(define-function file_new_for_commandline_arg + (is-constructor-of "GFile") + (c-name "g_file_new_for_commandline_arg") + (return-type "GFile*") + (parameters + '("const-char*" "arg") + ) +) + +(define-function file_parse_name + (c-name "g_file_parse_name") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("const-char*" "parse_name") + ) +) + +(define-method dup + (of-object "GFile") + (c-name "g_file_dup") + (return-type "GFile*") + (caller-owns-return #t) +) + +(define-function file_hash + (c-name "g_file_hash") + (return-type "guint") + (parameters + '("gconstpointer" "file") + ) +) + +(define-method equal + (of-object "GFile") + (c-name "g_file_equal") + (return-type "gboolean") + (parameters + '("GFile*" "file2") + ) +) + +(define-method get_basename + (of-object "GFile") + (c-name "g_file_get_basename") + (return-type "char*") +) + +(define-method get_path + (of-object "GFile") + (c-name "g_file_get_path") + (return-type "char*") +) + +(define-method get_uri + (of-object "GFile") + (c-name "g_file_get_uri") + (return-type "char*") +) + +(define-method get_parse_name + (of-object "GFile") + (c-name "g_file_get_parse_name") + (return-type "char*") +) + +(define-method get_parent + (of-object "GFile") + (c-name "g_file_get_parent") + (return-type "GFile*") + (caller-owns-return #t) +) + +(define-method get_child + (of-object "GFile") + (c-name "g_file_get_child") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("const-char*" "name") + ) +) + +(define-method get_child_for_display_name + (of-object "GFile") + (c-name "g_file_get_child_for_display_name") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("const-char*" "display_name") + '("GError**" "error") + ) +) + +(define-method has_prefix + (of-object "GFile") + (c-name "g_file_has_prefix") + (return-type "gboolean") + (parameters + '("GFile*" "descendant") + ) +) + +(define-method get_relative_path + (of-object "GFile") + (c-name "g_file_get_relative_path") + (return-type "char*") + (parameters + '("GFile*" "descendant") + ) +) + +(define-method resolve_relative_path + (of-object "GFile") + (c-name "g_file_resolve_relative_path") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("const-char*" "relative_path") + ) +) + +(define-method is_native + (of-object "GFile") + (c-name "g_file_is_native") + (return-type "gboolean") +) + +(define-method has_uri_scheme + (of-object "GFile") + (c-name "g_file_has_uri_scheme") + (return-type "gboolean") + (parameters + '("const-char*" "uri_scheme") + ) +) + +(define-method get_uri_scheme + (of-object "GFile") + (c-name "g_file_get_uri_scheme") + (return-type "char*") +) + +(define-method read + (of-object "GFile") + (docstring + "F.read([cancellable]) -> input stream\n" + "Opens a file for reading. The result is a GFileInputStream that\n" + "can be used to read the contents of the file.\n" + "\n" + "If cancellable is specified, then the operation can be cancelled\n" + "by triggering the cancellable object from another thread. If the\n" + "operation was cancelled, the error gio.IO_ERROR_CANCELLED will\n" + "be returned. If the file does not exist, the gio.IO_ERROR_NOT_FOUND\n" + "error will be returned. If the file is a directory, the\n" + "gio.IO_ERROR_IS_DIRECTORY error will be returned. Other errors\n" + "are possible too, and depend on what kind of filesystem the file is on." + ) + (c-name "g_file_read") + (return-type "GFileInputStream*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method read_async + (of-object "GFile") + (docstring + "F.read_async(callback [,io_priority [,cancellable [,user_data]]])\n" + "-> start read\n" + "\n" + "For more details, see gio.File.read() which is the synchronous\n" + "version of this call. Asynchronously opens file for reading.\n" + "When the operation is finished, callback will be called.\n" + "You can then call g_file_read_finish() to get the result of the\n" + "operation.\n" + ) + (c-name "g_file_read_async") + (return-type "none") + (parameters + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method read_finish + (of-object "GFile") + (c-name "g_file_read_finish") + (return-type "GFileInputStream*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method append_to + (of-object "GFile") + (c-name "g_file_append_to") + (return-type "GFileOutputStream*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method create + (of-object "GFile") + (c-name "g_file_create") + (return-type "GFileOutputStream*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method replace + (of-object "GFile") + (c-name "g_file_replace") + (return-type "GFileOutputStream*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("const-char*" "etag") + '("gboolean" "make_backup") + '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method append_to_async + (docstring + "F.append_to_async(callback [flags, [,io_priority [,cancellable\n" + " [,user_data]]]]) -> open for append\n" + "\n" + "Asynchronously opens file for appending.\n" + "For more details, see gio.File.append_to() which is the synchronous\n" + "version of this call. When the operation is finished, callback will\n" + "be called. You can then call F.append_to_finish() to get the result\n" + "of the operation." + ) + (of-object "GFile") + (c-name "g_file_append_to_async") + (return-type "none") + (parameters + '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE")) + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method append_to_finish + (of-object "GFile") + (c-name "g_file_append_to_finish") + (return-type "GFileOutputStream*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method create_async + (docstring + "F.create_async(callback [flags, [,io_priority [,cancellable\n" + " [,user_data]]]]) -> file created\n" + "\n" + "Asynchronously creates a new file and returns an output stream for\n" + "writing to it. The file must not already exist.\n" + "For more details, see F.create() which is the synchronous\n" + "version of this call.\n" + "When the operation is finished, callback will be called. You can\n" + "then call F.create_finish() to get the result of the operation." + ) + (of-object "GFile") + (c-name "g_file_create_async") + (return-type "none") + (parameters + '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE")) + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method create_finish + (of-object "GFile") + (c-name "g_file_create_finish") + (return-type "GFileOutputStream*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method replace_async + (docstring + "F.replace_async(callback [etag, [make_backup, [flags, [io_priority,\n" + " [cancellable, [user_data]]]]]]) -> file replace\n" + "\n" + "Asynchronously overwrites the file, replacing the contents, possibly\n" + "creating a backup copy of the file first.\n" + "For more details, see F.replace() which is the synchronous\n" + "version of this call.\n" + "When the operation is finished, callback will be called. You can\n" + "then call F.replace_finish() to get the result of the operation." + ) + (of-object "GFile") + (c-name "g_file_replace_async") + (return-type "none") + (parameters + '("const-char*" "etag") + '("gboolean" "make_backup") + '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE")) + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method replace_finish + (of-object "GFile") + (c-name "g_file_replace_finish") + (return-type "GFileOutputStream*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method query_exists + (of-object "GFile") + (c-name "g_file_query_exists") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + ) +) + +(define-method query_file_type + (of-object "GFile") + (c-name "g_file_query_file_type") + (return-type "GFileType") + (parameters + '("GFileQueryInfoFlags" "flags") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + ) +) + +(define-method query_info + (of-object "GFile") + (c-name "g_file_query_info") + (return-type "GFileInfo*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("const-char*" "attributes") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method query_info_async + (docstring + "F.query_info_async(attributes, callback, [flags, [io_priority,\n" + " [cancellable, [user_data]]]]) -> query attributes\n" + "\n" + "Asynchronously gets the requested information about specified file.\n" + "The result is a GFileInfo object that contains key-value attributes\n" + "(such as type or size for the file).\n" + "For more details, see F.query_info() which is the synchronous\n" + "version of this call. \n" + "When the operation is finished, callback will be called. You can\n" + "then call F.query_info_finish() to get the result of the operation.\n" + ) + (of-object "GFile") + (c-name "g_file_query_info_async") + (return-type "none") + (parameters + '("const-char*" "attributes") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method query_info_finish + (of-object "GFile") + (c-name "g_file_query_info_finish") + (return-type "GFileInfo*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method query_filesystem_info + (of-object "GFile") + (c-name "g_file_query_filesystem_info") + (return-type "GFileInfo*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("const-char*" "attributes") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method query_filesystem_info_async + (of-object "GFile") + (c-name "g_file_query_filesystem_info_async") + (return-type "none") + (parameters + '("const-char*" "attributes") + '("int" "io_priority") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method query_filesystem_info_finish + (of-object "GFile") + (c-name "g_file_query_filesystem_info_finish") + (return-type "GFileInfo*") + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method find_enclosing_mount + (of-object "GFile") + (c-name "g_file_find_enclosing_mount") + (return-type "GMount*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method find_enclosing_mount_async + (of-object "GFile") + (c-name "g_file_find_enclosing_mount_async") + (return-type "none") + (parameters + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method find_enclosing_mount_finish + (of-object "GFile") + (c-name "g_file_find_enclosing_mount_finish") + (return-type "GMount*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method enumerate_children + (docstring +"F.enumerate_children(attributes, [flags, cancellable]) -> enumerator\n" +"Gets the requested information about the files in a directory.\n" +"The result is a gio.FileEnumerator object that will give out gio.FileInfo\n" +"objects for all the files in the directory.\n" +"The attribute value is a string that specifies the file attributes that\n" +"should be gathered. It is not an error if it's not possible to read a \n" +"particular requested attribute from a file - it just won't be set.\n" +"attribute should be a comma-separated list of attribute or attribute\n" +"wildcards. The wildcard \"*\" means all attributes, and a wildcard like\n" +"\"standard::*\" means all attributes in the standard namespace.\n" +"An example attribute query be \"standard::*,owner::user\". The standard\n" +"attributes are available as defines, like gio.FILE_ATTRIBUTE_STANDARD_NAME.\n" +"\n" +"If cancellable is not None, then the operation can be cancelled by\n" +"triggering the cancellable object from another thread. If the operation was\n" +"cancelled, the error gio.ERROR_CANCELLED will be returned.\n" +"\n" +"If the file does not exist, the gio.ERROR_NOT_FOUND error will be returned.\n" +"If the file is not a directory, the gio.FILE_ERROR_NOTDIR error will\n" +"be returned. Other errors are possible too.") + (of-object "GFile") + (c-name "g_file_enumerate_children") + (return-type "GFileEnumerator*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("const-char*" "attributes") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method enumerate_children_async + (docstring +"F.enumerate_children_async(attributes, callback,\n" +" [flags, io_priority, cancellable, user_data])\n" +"Asynchronously gets the requested information about the files in a\n" +"directory. The result is a GFileEnumerator object that will give out\n" +"GFileInfo objects for all the files in the directory.\n" +"\n" +"For more details, see gio.File.enumerate_children() which is the synchronous\n" +"version of this call.\n" +"\n" +"When the operation is finished, callback will be called. You can then call\n" +"gio.File.enumerate_children_finish() to get the result of the operation.") + (of-object "GFile") + (c-name "g_file_enumerate_children_async") + (return-type "none") + (parameters + '("const-char*" "attributes") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method enumerate_children_finish + (of-object "GFile") + (c-name "g_file_enumerate_children_finish") + (return-type "GFileEnumerator*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method set_display_name + (of-object "GFile") + (c-name "g_file_set_display_name") + (return-type "GFile*") + (unblock-threads #t) + (caller-owns-return #t) + (parameters + '("const-char*" "display_name") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method set_display_name_async + (of-object "GFile") + (c-name "g_file_set_display_name_async") + (return-type "none") + (parameters + '("const-char*" "display_name") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method set_display_name_finish + (of-object "GFile") + (c-name "g_file_set_display_name_finish") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method delete + (of-object "GFile") + (c-name "g_file_delete") + (return-type "gboolean") + (unblock-threads #t) + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method trash + (of-object "GFile") + (c-name "g_file_trash") + (return-type "gboolean") + (unblock-threads #t) + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method copy + (docstring +"F.copy(destination, [callback, flags, cancellable, user_data])\n" +"Copies the file source to the location specified by destination.\n" +"Can not handle recursive copies of directories.\n" +"\n" +"If the flag gio.FILE_COPY_OVERWRITE is specified an already existing\n" +"destination file is overwritten.\n" +"\n" +"If the flag gio.FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlink\n" +"will be copied as symlinks, otherwise the target of the source symlink\n" +"will be copied.\n" +"\n" +"If cancellable is not None, then the operation can be cancelled b\n" +"triggering the cancellable object from another thread.\n" +"If the operation was cancelled, the error gio.ERROR_CANCELLED\n" +"will be returned.\n" +"\n" +"If progress_callback is not None, then the operation can be monitored\n" +"by setting this to a callable. if specified progress_callback_data will\n" +"be passed to this function. It is guaranteed that this callback\n" +"will be called after all data has been transferred with the total number\n" +"of bytes copied during the operation.\n" +"\n" +"If the source file does not exist then the gio.ERROR_NOT_FOUND\n" +"error is returned, independent on the status of the destination.\n" +"\n" +"If gio.FILE_COPY_OVERWRITE is not specified and the target exists\n" +"then the error gio.ERROR_EXISTS is returned.\n" +"\n" +"If trying to overwrite a file over a directory the gio.ERROR_IS_DIRECTORY\n" +"error is returned. If trying to overwrite a directory with a directory\n" +"the gio.ERROR_WOULD_MERGE error is returned.\n" +"\n" +"If the source is a directory and the target does not exist\n" +"or gio.FILE_COPY_OVERWRITE is specified and the target is a file\n" +"then the gio.ERROR_WOULD_RECURSE error is returned.\n" +"\n" +"If you are interested in copying the GFile object itself\n" +"(not the on-disk file), see gio.File.dup().") + (of-object "GFile") + (c-name "g_file_copy") + (unblock-threads #t) + (return-type "gboolean") + (parameters + '("GFile*" "destination") + '("GFileCopyFlags" "flags" (default "G_FILE_COPY_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GFileProgressCallback" "progress_callback") + '("gpointer" "progress_callback_data") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method copy_async + (of-object "GFile") + (docstring + "F.copy_async(destination, callback, [flags, io_priority, user_data, cancellable, progress_callback])\n" + "-> start copy\n" + "\n" + "For more details, see gio.File.copy() which is the synchronous\n" + "version of this call. Asynchronously copies file.\n" + "When the operation is finished, callback will be called.\n" + "You can then call g_file_copy_finish() to get the result of the\n" + "operation.\n" + ) + (c-name "g_file_copy_async") + (return-type "none") + (parameters + '("GFile*" "destination") + '("GFileCopyFlags" "flags" (default "G_FILE_COPY_NONE")) + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GFileProgressCallback" "progress_callback") + '("gpointer" "progress_callback_data") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method copy_finish + (of-object "GFile") + (c-name "g_file_copy_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method move + (docstring +"F.move(destination, [callback, flags, cancellable, user_data])\n" +"Tries to move the file or directory source to the location\n" +"specified by destination. If native move operations are\n" +"supported then this is used, otherwise a copy + delete fallback\n" +"is used. The native implementation may support moving directories\n" +"(for instance on moves inside the same filesystem), but the \n" +"fallback code does not.\n" +"\n" +"If the flag gio.FILE_COPY_OVERWRITE is specified an already existing\n" +"destination file is overwritten.\n" +"\n" +"If the flag gio.FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlink\n" +"will be copied as symlinks, otherwise the target of the source symlink\n" +"will be copied.\n" +"\n" +"If cancellable is not None, then the operation can be cancelled b\n" +"triggering the cancellable object from another thread.\n" +"If the operation was cancelled, the error gio.ERROR_CANCELLED\n" +"will be returned.\n" +"\n" +"If progress_callback is not None, then the operation can be monitored\n" +"by setting this to a callable. if specified progress_callback_data will\n" +"be passed to this function. It is guaranteed that this callback\n" +"will be called after all data has been transferred with the total number\n" +"of bytes copied during the operation.\n" +"\n" +"If the source file does not exist then the gio.ERROR_NOT_FOUND\n" +"error is returned, independent on the status of the destination.\n" +"\n" +"If gio.FILE_COPY_OVERWRITE is not specified and the target exists\n" +"then the error gio.ERROR_EXISTS is returned.\n" +"\n" +"If trying to overwrite a file over a directory the gio.ERROR_IS_DIRECTORY\n" +"error is returned. If trying to overwrite a directory with a directory\n" +"the gio.ERROR_WOULD_MERGE error is returned.\n" +"\n" +"If the source is a directory and the target does not exist\n" +"or gio.FILE_COPY_OVERWRITE is specified and the target is a file\n" +"then the gio.ERROR_WOULD_RECURSE error is returned.") + (of-object "GFile") + (c-name "g_file_move") + (return-type "gboolean") + (parameters + '("GFile*" "destination") + '("GFileCopyFlags" "flags" (default "G_FILE_COPY_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GFileProgressCallback" "progress_callback") + '("gpointer" "progress_callback_data") + '("GError**" "error") + ) +) + +(define-method make_directory + (of-object "GFile") + (c-name "g_file_make_directory") + (return-type "gboolean") + (unblock-threads #t) + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method make_directory_with_parents + (of-object "GFile") + (c-name "g_file_make_directory_with_parents") + (return-type "gboolean") + (unblock-threads #t) + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method make_symbolic_link + (of-object "GFile") + (c-name "g_file_make_symbolic_link") + (return-type "gboolean") + (unblock-threads #t) + (parameters + '("const-char*" "symlink_value") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method query_settable_attributes + (docstring + "F.query_settable_attributes([cancellable]) -> list\n\n" + "Obtain the list of settable attributes for the file.\n" + "Returns the type and full attribute name of all the attributes that\n" + "can be set on this file. This doesn't mean setting it will always\n" + "succeed though, you might get an access failure, or some specific\n" + "file may not support a specific attribute.\n\n" + "If cancellable is not None, then the operation can be cancelled by\n" + "triggering the cancellable object from another thread. If the operation\n" + "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned." + ) + (of-object "GFile") + (c-name "g_file_query_settable_attributes") + (return-type "GFileAttributeInfoList*") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method query_writable_namespaces + (docstring + "F.query_writable_namespaces([cancellable]) -> list\n\n" + "Obtain the list of attribute namespaces where new attributes can\n" + "be created by a user. An example of this is extended attributes\n" + "(in the "xattr" namespace).\n" + "If cancellable is not None, then the operation can be cancelled\n" + "by triggering the cancellable object from another thread. If the\n" + "operation was cancelled, the error gio.IO_ERROR_CANCELLED\n" + "will be returned." + ) + (of-object "GFile") + (c-name "g_file_query_writable_namespaces") + (return-type "GFileAttributeInfoList*") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method set_attribute + (docstring + "F.set_attribute(attribute, type, value_p [,flags [,cancellable ]])->bool\n" + "\n" + "Sets an attribute in the file with attribute name attribute to value_p.\n" + "If cancellable is not None, then the operation can be cancelled by\n" + "triggering the cancellable object from another thread. If the operation\n" + "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned." + ) + (of-object "GFile") + (c-name "g_file_set_attribute") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("GFileAttributeType" "type") + '("gpointer" "value_p") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method set_attributes_from_info + (of-object "GFile") + (c-name "g_file_set_attributes_from_info") + (return-type "gboolean") + (parameters + '("GFileInfo*" "info") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method set_attributes_async + (of-object "GFile") + (c-name "g_file_set_attributes_async") + (return-type "none") + (parameters + '("GFileInfo*" "info") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method set_attributes_finish + (of-object "GFile") + (c-name "g_file_set_attributes_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GFileInfo**" "info") + '("GError**" "error") + ) +) + +(define-method set_attribute_string + (of-object "GFile") + (c-name "g_file_set_attribute_string") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("const-char*" "value") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method set_attribute_byte_string + (of-object "GFile") + (c-name "g_file_set_attribute_byte_string") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("const-char*" "value") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method set_attribute_uint32 + (of-object "GFile") + (c-name "g_file_set_attribute_uint32") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("guint32" "value") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method set_attribute_int32 + (of-object "GFile") + (c-name "g_file_set_attribute_int32") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("gint32" "value") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method set_attribute_uint64 + (of-object "GFile") + (c-name "g_file_set_attribute_uint64") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("guint64" "value") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method set_attribute_int64 + (of-object "GFile") + (c-name "g_file_set_attribute_int64") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("gint64" "value") + '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method mount_enclosing_volume + (docstring +"F.mount_enclosing_volume(mount_operation, callback, [cancellable,\n" +" user_data])\n" +"Starts a mount_operation, mounting the volume that contains\n" +"the file location.\n" +"\n" +"When this operation has completed, callback will be called with\n" +"user_user data, and the operation can be finalized with\n" +"gio.File.mount_enclosing_volume_finish().\n" +"\n" +"If cancellable is not None, then the operation can be cancelled\n" +"by triggering the cancellable object from another thread.\n" +"If the operation was cancelled, the error gio.ERROR_CANCELLED\n" +"will be returned.") + (of-object "GFile") + (c-name "g_file_mount_enclosing_volume") + (return-type "none") + (parameters + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method mount_enclosing_volume_finish + (of-object "GFile") + (c-name "g_file_mount_enclosing_volume_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method mount_mountable + (docstring +"F.mount_mountable(mount_operation, callback, [flags, cancellable,\n" +" user_data])\n" +"Mounts a file of type gio.FILE_TYPE_MOUNTABLE. Using mount_operation,\n" +"you can request callbacks when, for instance, passwords are needed\n" +"during authentication.\n" +"\n" +"If cancellable is not None, then the operation can be cancelled by\n" +" triggering the cancellable object from another thread. If the\n" +"operation was cancelled, the error gio.ERROR_CANCELLED will be returned.\n" +"\n" +"When the operation is finished, callback will be called. You can then\n" +"call g_file_mount_mountable_finish() to get the result of the operation.\n") + (of-object "GFile") + (c-name "g_file_mount_mountable") + (return-type "none") + (parameters + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method mount_mountable_finish + (of-object "GFile") + (c-name "g_file_mount_mountable_finish") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method unmount_mountable + (docstring +"F.unmount_mountable(callback, [flags, cancellable, user_data])\n" +"Unmounts a file of type gio.FILE_TYPE_MOUNTABLE.\n" +"\n" +"If cancellable is not None, then the operation can be cancelled by\n" +"triggering the cancellable object from another thread. If the\n" +"operation was cancelled, the error gio.ERROR_CANCELLED will be returned.\n" +"\n" +"When the operation is finished, callback will be called. You can\n" +"then call gio.File.unmount_mountable_finish() to get the\n" +"result of the operation.\n") + (of-object "GFile") + (c-name "g_file_unmount_mountable") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method unmount_mountable_finish + (of-object "GFile") + (c-name "g_file_unmount_mountable_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method eject_mountable + (of-object "GFile") + (c-name "g_file_eject_mountable") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method eject_mountable_finish + (of-object "GFile") + (c-name "g_file_eject_mountable_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + + +(define-method copy_attributes + (of-object "GFile") + (c-name "g_file_copy_attributes") + (return-type "gboolean") + (parameters + '("GFile*" "destination") + '("GFileCopyFlags" "flags" (default "G_FILE_COPY_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method monitor_directory + (of-object "GFile") + (c-name "g_file_monitor_directory") + (return-type "GFileMonitor*") + (caller-owns-return #t) + (parameters + '("GFileMonitorFlags" "flags" (default "G_FILE_MONITOR_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method monitor_file + (of-object "GFile") + (c-name "g_file_monitor_file") + (return-type "GFileMonitor*") + (caller-owns-return #t) + (parameters + '("GFileMonitorFlags" "flags" (default "G_FILE_MONITOR_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method monitor + (of-object "GFile") + (c-name "g_file_monitor") + (return-type "GFileMonitor*") + (parameters + '("GFileMonitorFlags" "flags" (default "G_FILE_MONITOR_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method query_default_handler + (of-object "GFile") + (c-name "g_file_query_default_handler") + (return-type "GAppInfo*") + (caller-owns-return #t) + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method load_contents + (docstring + "F.load_contents([cancellable]) -> contents, length, etag_out\n\n" + "Loads the content of the file into memory, returning the size of the\n" + "data. The data is always zero terminated, but this is not included\n" + "in the resultant length.\n" + "If cancellable is not None, then the operation can be cancelled by\n" + "triggering the cancellable object from another thread. If the operation\n" + "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n" + ) + (of-object "GFile") + (c-name "g_file_load_contents") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("char**" "contents") + '("gsize*" "length") + '("char**" "etag_out") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method load_contents_async + (docstring + "F.load_contents_async(callback, [cancellable, [user_data]])->start loading\n\n" + "Starts an asynchronous load of the file's contents.\n\n" + "For more details, see F.load_contents() which is the synchronous\n" + "version of this call.\n\n" + "When the load operation has completed, callback will be called with\n" + "user data. To finish the operation, call F.load_contents_finish() with\n" + "the parameter 'res' returned by the callback.\n\n" + "If cancellable is not None, then the operation can be cancelled by\n" + "triggering the cancellable object from another thread. If the operation\n" + "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n" + ) + (of-object "GFile") + (c-name "g_file_load_contents_async") + (return-type "none") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method load_contents_finish + (docstring + "F.load_contents_finish(res) -> contents, length, etag_out\n\n" + "Finishes an asynchronous load of the file's contents. The contents are\n" + "placed in contents, and length is set to the size of the contents\n" + "string. If etag_out is present, it will be set to the new entity\n" + "tag for the file.\n" + ) + (of-object "GFile") + (c-name "g_file_load_contents_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "res") + '("char**" "contents") + '("gsize*" "length") + '("char**" "etag_out") + '("GError**" "error") + ) +) + +(define-method load_partial_contents_async + (of-object "GFile") + (c-name "g_file_load_partial_contents_async") + (return-type "none") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GFileReadMoreCallback" "read_more_callback") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method load_partial_contents_finish + (of-object "GFile") + (c-name "g_file_load_partial_contents_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "res") + '("char**" "contents") + '("gsize*" "length") + '("char**" "etag_out") + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method replace_contents + (docstring + "F.replace_contents(contents, [etag, [make_backup, [flags, [cancellable]]]])\n" + "-> etag_out\n" + "\n" + "Replaces the content of the file, returning the new etag value for the\n" + "file. If an etag is specified, any existing file must have that etag, or\n" + "the error gio.IO_ERROR_WRONG_ETAG will be returned.\n" + "If make_backup is True, this method will attempt to make a backup of the\n" + "file. If cancellable is not None, then the operation can be cancelled by\n" + "triggering the cancellable object from another thread. If the operation\n" + "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n" + ) + (of-object "GFile") + (c-name "g_file_replace_contents") + (return-type "gboolean") + (parameters + '("const-char*" "contents") + '("gsize" "length") + '("const-char*" "etag") + '("gboolean" "make_backup") + '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE")) + '("char**" "new_etag") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method replace_contents_async + (docstring + "F.replace_contents_async(contents, callback, [etag, [make_backup, [flags,\n" + " [cancellable]]]]) -> etag_out\n" + "\n" + "Starts an asynchronous replacement of the file with the given contents.\n" + "For more details, see F.replace_contents() which is the synchronous\n" + "version of this call.\n\n" + "When the load operation has completed, callback will be called with\n" + "user data. To finish the operation, call F.replace_contents_finish() with\n" + "the parameter 'res' returned by the callback.\n\n" + "If cancellable is not None, then the operation can be cancelled by\n" + "triggering the cancellable object from another thread. If the operation\n" + "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n" + ) + (of-object "GFile") + (c-name "g_file_replace_contents_async") + (return-type "none") + (parameters + '("const-char*" "contents") + '("gsize" "length") + '("const-char*" "etag") + '("gboolean" "make_backup") + '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +;; +;; wrapped in gfile.override +;; +(define-method replace_contents_finish + (docstring + "F.replace_contents_finish(res) -> etag_out\n\n" + "Finishes an asynchronous replacement of the file's contents.\n" + "The new entity tag for the file is returned.\n" + ) + (of-object "GFile") + (c-name "g_file_replace_contents_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "res") + '("char**" "new_etag") + '("GError**" "error") + ) +) + +(define-method create_readwrite + (of-object "GFile") + (c-name "g_file_create_readwrite") + (return-type "GFileIOStream*") + (parameters + '("GFileCreateFlags" "flags") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method create_readwrite_async + (of-object "GFile") + (c-name "g_file_create_readwrite_async") + (return-type "none") + (parameters + '("GFileCreateFlags" "flags") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method create_readwrite_finish + (of-object "GFile") + (c-name "g_file_create_readwrite_finish") + (return-type "GFileIOStream*") + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method eject_mountable_with_operation + (of-object "GFile") + (c-name "g_file_eject_mountable_with_operation") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method eject_mountable_with_operation_finish + (of-object "GFile") + (c-name "g_file_eject_mountable_with_operation_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method open_readwrite + (of-object "GFile") + (c-name "g_file_open_readwrite") + (return-type "GFileIOStream*") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method open_readwrite_async + (of-object "GFile") + (c-name "g_file_open_readwrite_async") + (return-type "none") + (parameters + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method open_readwrite_finish + (of-object "GFile") + (c-name "g_file_open_readwrite_finish") + (return-type "GFileIOStream*") + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method poll_mountable + (of-object "GFile") + (c-name "g_file_poll_mountable") + (return-type "none") + (parameters + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method poll_mountable_finish + (of-object "GFile") + (c-name "g_file_poll_mountable_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method replace_readwrite + (of-object "GFile") + (c-name "g_file_replace_readwrite") + (return-type "GFileIOStream*") + (parameters + '("const-char*" "etag") + '("gboolean" "make_backup") + '("GFileCreateFlags" "flags") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method replace_readwrite_async + (of-object "GFile") + (c-name "g_file_replace_readwrite_async") + (return-type "none") + (parameters + '("const-char*" "etag") + '("gboolean" "make_backup") + '("GFileCreateFlags" "flags") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method replace_readwrite_finish + (of-object "GFile") + (c-name "g_file_replace_readwrite_finish") + (return-type "GFileIOStream*") + (parameters + '("GAsyncResult*" "res") + '("GError**" "error") + ) +) + +(define-method start_mountable + (of-object "GFile") + (c-name "g_file_start_mountable") + (return-type "none") + (parameters + '("GDriveStartFlags" "flags") + '("GMountOperation*" "start_operation") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method start_mountable_finish + (of-object "GFile") + (c-name "g_file_start_mountable_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method stop_mountable + (of-object "GFile") + (c-name "g_file_stop_mountable") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method stop_mountable_finish + (of-object "GFile") + (c-name "g_file_stop_mountable_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method supports_thread_contexts + (of-object "GFile") + (c-name "g_file_supports_thread_contexts") + (return-type "gboolean") +) + +(define-method unmount_mountable_with_operation + (of-object "GFile") + (c-name "g_file_unmount_mountable_with_operation") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method unmount_mountable_with_operation_finish + (of-object "GFile") + (c-name "g_file_unmount_mountable_with_operation_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + + + +;; From gfileicon.h + +(define-function file_icon_get_type + (c-name "g_file_icon_get_type") + (return-type "GType") +) + +(define-function file_icon_new + (c-name "g_file_icon_new") + (is-constructor-of "GFileIcon") + (return-type "GIcon*") + ;; Note: starting with GLib 2.18 we could use (properties ...) + ;; instead, but I don't know if it is possible to branch on version + ;; in codegen. + (parameters + '("GFile*" "file") + ) +) + +(define-method get_file + (of-object "GFileIcon") + (c-name "g_file_icon_get_file") + (return-type "GFile*") +) + + + +;; From gfileinfo.h + +(define-function file_info_get_type + (c-name "g_file_info_get_type") + (return-type "GType") +) + +(define-function file_info_new + (c-name "g_file_info_new") + (is-constructor-of "GFileInfo") + (return-type "GFileInfo*") +) + +(define-method dup + (of-object "GFileInfo") + (c-name "g_file_info_dup") + (return-type "GFileInfo*") + (caller-owns-return #t) +) + +(define-method copy_into + (of-object "GFileInfo") + (c-name "g_file_info_copy_into") + (return-type "none") + (parameters + '("GFileInfo*" "dest_info") + ) +) + +(define-method has_attribute + (of-object "GFileInfo") + (c-name "g_file_info_has_attribute") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method has_namespace + (of-object "GFileInfo") + (c-name "g_file_info_has_namespace") + (return-type "gboolean") + (parameters + '("const-char*" "name_space") + ) +) + +;; +;; wrapped in gfileinfo.override +(define-method list_attributes + (docstring + "INFO.list_attributes(name_space) -> Attribute list\n\n" + "Lists the file info structure's attributes." + ) + (of-object "GFileInfo") + (c-name "g_file_info_list_attributes") + (return-type "char**") + (parameters + '("const-char*" "name_space") + ) +) + +(define-method get_attribute_data + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_data") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("GFileAttributeType*" "type") + '("gpointer*" "value_pp") + '("GFileAttributeStatus*" "status") + ) +) + +(define-method get_attribute_type + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_type") + (return-type "GFileAttributeType") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method remove_attribute + (of-object "GFileInfo") + (c-name "g_file_info_remove_attribute") + (return-type "none") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_status + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_status") + (return-type "GFileAttributeStatus") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method set_attribute_status + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_status") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + '("GFileAttributeStatus" "status") + ) +) + +(define-method get_attribute_as_string + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_as_string") + (return-type "char*") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_string + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_string") + (return-type "const-char*") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_byte_string + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_byte_string") + (return-type "const-char*") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_boolean + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_boolean") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_uint32 + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_uint32") + (return-type "guint32") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_int32 + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_int32") + (return-type "gint32") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_uint64 + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_uint64") + (return-type "guint64") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_int64 + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_int64") + (return-type "gint64") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_object + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_object") + (return-type "GObject*") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method get_attribute_stringv + (of-object "GFileInfo") + (c-name "g_file_info_get_attribute_stringv") + (return-type "char**") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method set_attribute + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("GFileAttributeType" "type") + '("gpointer" "value_p") + ) +) + +(define-method set_attribute_string + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_string") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("const-char*" "attr_value") + ) +) + +(define-method set_attribute_byte_string + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_byte_string") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("const-char*" "attr_value") + ) +) + +(define-method set_attribute_boolean + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_boolean") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("gboolean" "attr_value") + ) +) + +(define-method set_attribute_uint32 + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_uint32") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("guint32" "attr_value") + ) +) + +(define-method set_attribute_int32 + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_int32") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("gint32" "attr_value") + ) +) + +(define-method set_attribute_uint64 + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_uint64") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("guint64" "attr_value") + ) +) + +(define-method set_attribute_int64 + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_int64") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("gint64" "attr_value") + ) +) + +(define-method set_attribute_object + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_object") + (return-type "none") + (parameters + '("const-char*" "attribute") + '("GObject*" "attr_value") + ) +) + +(define-method clear_status + (of-object "GFileInfo") + (c-name "g_file_info_clear_status") + (return-type "none") +) + +(define-method get_file_type + (of-object "GFileInfo") + (c-name "g_file_info_get_file_type") + (return-type "GFileType") +) + +(define-method get_is_hidden + (of-object "GFileInfo") + (c-name "g_file_info_get_is_hidden") + (return-type "gboolean") +) + +(define-method get_is_backup + (of-object "GFileInfo") + (c-name "g_file_info_get_is_backup") + (return-type "gboolean") +) + +(define-method get_is_symlink + (of-object "GFileInfo") + (c-name "g_file_info_get_is_symlink") + (return-type "gboolean") +) + +(define-method get_name + (of-object "GFileInfo") + (c-name "g_file_info_get_name") + (return-type "const-char*") +) + +(define-method get_display_name + (of-object "GFileInfo") + (c-name "g_file_info_get_display_name") + (return-type "const-char*") +) + +(define-method get_edit_name + (of-object "GFileInfo") + (c-name "g_file_info_get_edit_name") + (return-type "const-char*") +) + +(define-method get_icon + (of-object "GFileInfo") + (c-name "g_file_info_get_icon") + (return-type "GIcon*") +) + +(define-method get_content_type + (of-object "GFileInfo") + (c-name "g_file_info_get_content_type") + (return-type "const-char*") +) + +(define-method get_size + (of-object "GFileInfo") + (c-name "g_file_info_get_size") + (return-type "goffset") +) + +;; +;; wrapped in gfileinfo.override +;; +(define-method get_modification_time + (docstring +"INFO.get_modification_time() -> modification time\n" +"Returns the modification time, in UNIX time format\n") + (of-object "GFileInfo") + (c-name "g_file_info_get_modification_time") + (return-type "none") + (parameters + '("GTimeVal*" "result") + ) +) + +(define-method get_symlink_target + (of-object "GFileInfo") + (c-name "g_file_info_get_symlink_target") + (return-type "const-char*") +) + +(define-method get_etag + (of-object "GFileInfo") + (c-name "g_file_info_get_etag") + (return-type "const-char*") +) + +(define-method get_sort_order + (of-object "GFileInfo") + (c-name "g_file_info_get_sort_order") + (return-type "gint32") +) + +(define-method set_attribute_mask + (of-object "GFileInfo") + (c-name "g_file_info_set_attribute_mask") + (return-type "none") + (parameters + '("GFileAttributeMatcher*" "mask") + ) +) + +(define-method unset_attribute_mask + (of-object "GFileInfo") + (c-name "g_file_info_unset_attribute_mask") + (return-type "none") +) + +(define-method set_file_type + (of-object "GFileInfo") + (c-name "g_file_info_set_file_type") + (return-type "none") + (parameters + '("GFileType" "type") + ) +) + +(define-method set_is_hidden + (of-object "GFileInfo") + (c-name "g_file_info_set_is_hidden") + (return-type "none") + (parameters + '("gboolean" "is_hidden") + ) +) + +(define-method set_is_symlink + (of-object "GFileInfo") + (c-name "g_file_info_set_is_symlink") + (return-type "none") + (parameters + '("gboolean" "is_symlink") + ) +) + +(define-method set_name + (of-object "GFileInfo") + (c-name "g_file_info_set_name") + (return-type "none") + (parameters + '("const-char*" "name") + ) +) + +(define-method set_display_name + (of-object "GFileInfo") + (c-name "g_file_info_set_display_name") + (return-type "none") + (parameters + '("const-char*" "display_name") + ) +) + +(define-method set_edit_name + (of-object "GFileInfo") + (c-name "g_file_info_set_edit_name") + (return-type "none") + (parameters + '("const-char*" "edit_name") + ) +) + +(define-method set_icon + (of-object "GFileInfo") + (c-name "g_file_info_set_icon") + (return-type "none") + (parameters + '("GIcon*" "icon") + ) +) + +(define-method set_content_type + (of-object "GFileInfo") + (c-name "g_file_info_set_content_type") + (return-type "none") + (parameters + '("const-char*" "content_type") + ) +) + +(define-method set_size + (of-object "GFileInfo") + (c-name "g_file_info_set_size") + (return-type "none") + (parameters + '("goffset" "size") + ) +) + +(define-method set_modification_time + (of-object "GFileInfo") + (c-name "g_file_info_set_modification_time") + (return-type "none") + (parameters + '("GTimeVal*" "mtime") + ) +) + +(define-method set_symlink_target + (of-object "GFileInfo") + (c-name "g_file_info_set_symlink_target") + (return-type "none") + (parameters + '("const-char*" "symlink_target") + ) +) + +(define-method set_sort_order + (of-object "GFileInfo") + (c-name "g_file_info_set_sort_order") + (return-type "none") + (parameters + '("gint32" "sort_order") + ) +) + +(define-function file_attribute_matcher_new + (c-name "g_file_attribute_matcher_new") + (is-constructor-of "GFileAttributeMatcher") + (return-type "GFileAttributeMatcher*") + (parameters + '("const-char*" "attributes") + ) +) + +(define-method ref + (of-object "GFileAttributeMatcher") + (c-name "g_file_attribute_matcher_ref") + (return-type "GFileAttributeMatcher*") +) + +(define-method unref + (of-object "GFileAttributeMatcher") + (c-name "g_file_attribute_matcher_unref") + (return-type "none") +) + +(define-method matches + (of-object "GFileAttributeMatcher") + (c-name "g_file_attribute_matcher_matches") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method matches_only + (of-object "GFileAttributeMatcher") + (c-name "g_file_attribute_matcher_matches_only") + (return-type "gboolean") + (parameters + '("const-char*" "attribute") + ) +) + +(define-method enumerate_namespace + (of-object "GFileAttributeMatcher") + (c-name "g_file_attribute_matcher_enumerate_namespace") + (return-type "gboolean") + (parameters + '("const-char*" "ns") + ) +) + +(define-method enumerate_next + (of-object "GFileAttributeMatcher") + (c-name "g_file_attribute_matcher_enumerate_next") + (return-type "const-char*") +) + + + +;; From gfileinputstream.h + +(define-function file_input_stream_get_type + (c-name "g_file_input_stream_get_type") + (return-type "GType") +) + +(define-method query_info + (of-object "GFileInputStream") + (c-name "g_file_input_stream_query_info") + (return-type "GFileInfo*") + (parameters + '("char*" "attributes") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method query_info_async + (of-object "GFileInputStream") + (c-name "g_file_input_stream_query_info_async") + (return-type "none") + (parameters + '("char*" "attributes") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method query_info_finish + (of-object "GFileInputStream") + (c-name "g_file_input_stream_query_info_finish") + (return-type "GFileInfo*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + + + +;; From gfileiostream.h + +(define-function file_io_stream_get_type + (c-name "g_file_io_stream_get_type") + (return-type "GType") +) + +(define-method query_info + (of-object "GFileIOStream") + (c-name "g_file_io_stream_query_info") + (return-type "GFileInfo*") + (parameters + '("const-char*" "attributes") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method query_info_async + (of-object "GFileIOStream") + (c-name "g_file_io_stream_query_info_async") + (return-type "none") + (parameters + '("const-char*" "attributes") + '("int" "io_priority") + '("GCancellable*" "cancellable") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method query_info_finish + (of-object "GFileIOStream") + (c-name "g_file_io_stream_query_info_finish") + (return-type "GFileInfo*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method get_etag + (of-object "GFileIOStream") + (c-name "g_file_io_stream_get_etag") + (return-type "char*") +) + + + + +;; From gfilemonitor.h + +(define-function file_monitor_get_type + (c-name "g_file_monitor_get_type") + (return-type "GType") +) + +(define-method cancel + (of-object "GFileMonitor") + (c-name "g_file_monitor_cancel") + (return-type "gboolean") +) + +(define-method is_cancelled + (of-object "GFileMonitor") + (c-name "g_file_monitor_is_cancelled") + (return-type "gboolean") +) + +(define-method set_rate_limit + (of-object "GFileMonitor") + (c-name "g_file_monitor_set_rate_limit") + (return-type "none") + (parameters + '("int" "limit_msecs") + ) +) + +(define-method emit_event + (of-object "GFileMonitor") + (c-name "g_file_monitor_emit_event") + (return-type "none") + (parameters + '("GFile*" "file") + '("GFile*" "other_file") + '("GFileMonitorEvent" "event_type") + ) +) + + + +;; From gfilenamecompleter.h + +(define-function filename_completer_get_type + (c-name "g_filename_completer_get_type") + (return-type "GType") +) + +(define-function filename_completer_new + (c-name "g_filename_completer_new") + (is-constructor-of "GFilenameCompleter") + (return-type "GFilenameCompleter*") +) + +(define-method get_completion_suffix + (of-object "GFilenameCompleter") + (c-name "g_filename_completer_get_completion_suffix") + (return-type "char*") + (parameters + '("const-char*" "initial_text") + ) +) + +(define-method get_completions + (of-object "GFilenameCompleter") + (c-name "g_filename_completer_get_completions") + (return-type "char**") + (parameters + '("const-char*" "initial_text") + ) +) + +(define-method set_dirs_only + (of-object "GFilenameCompleter") + (c-name "g_filename_completer_set_dirs_only") + (return-type "none") + (parameters + '("gboolean" "dirs_only") + ) +) + + + +;; From gfileoutputstream.h + +(define-function file_output_stream_get_type + (c-name "g_file_output_stream_get_type") + (return-type "GType") +) + +(define-method query_info + (of-object "GFileOutputStream") + (c-name "g_file_output_stream_query_info") + (return-type "GFileInfo*") + (parameters + '("char*" "attributes") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method query_info_async + (of-object "GFileOutputStream") + (c-name "g_file_output_stream_query_info_async") + (return-type "none") + (parameters + '("char*" "attributes") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method query_info_finish + (of-object "GFileOutputStream") + (c-name "g_file_output_stream_query_info_finish") + (return-type "GFileInfo*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method get_etag + (of-object "GFileOutputStream") + (c-name "g_file_output_stream_get_etag") + (return-type "char*") +) + + +;; From gfilterinputstream.h + +(define-function filter_input_stream_get_type + (c-name "g_filter_input_stream_get_type") + (return-type "GType") +) + +(define-method get_base_stream + (of-object "GFilterInputStream") + (c-name "g_filter_input_stream_get_base_stream") + (return-type "GInputStream*") +) + +(define-method get_close_base_stream + (of-object "GFilterInputStream") + (c-name "g_filter_input_stream_get_close_base_stream") + (return-type "gboolean") +) + +(define-method set_close_base_stream + (of-object "GFilterInputStream") + (c-name "g_filter_input_stream_set_close_base_stream") + (return-type "none") + (parameters + '("gboolean" "close_base") + ) +) + + + +;; From gfilteroutputstream.h + +(define-function filter_output_stream_get_type + (c-name "g_filter_output_stream_get_type") + (return-type "GType") +) + +(define-method get_base_stream + (of-object "GFilterOutputStream") + (c-name "g_filter_output_stream_get_base_stream") + (return-type "GOutputStream*") +) + +(define-method get_close_base_stream + (of-object "GFilterOutputStream") + (c-name "g_filter_output_stream_get_close_base_stream") + (return-type "gboolean") +) + +(define-method set_close_base_stream + (of-object "GFilterOutputStream") + (c-name "g_filter_output_stream_set_close_base_stream") + (return-type "none") + (parameters + '("gboolean" "close_base") + ) +) + + + +;; From gicon.h + +(define-function icon_get_type + (c-name "g_icon_get_type") + (return-type "GType") +) + +(define-function icon_hash + (c-name "g_icon_hash") + (return-type "guint") + (parameters + '("gconstpointer" "icon") + ) +) + +(define-method equal + (of-object "GIcon") + (c-name "g_icon_equal") + (return-type "gboolean") + (parameters + '("GIcon*" "icon2") + ) +) + +(define-method to_string + (of-object "GIcon") + (c-name "g_icon_to_string") + (return-type "gchar*") +) + +(define-function icon_new_for_string + (c-name "g_icon_new_for_string") + (return-type "GIcon*") + (parameters + '("const-gchar*" "str") + '("GError**" "error") + ) +) + + + +;; From ginetsocketaddress.h + +(define-function inet_socket_address_get_type + (c-name "g_inet_socket_address_get_type") + (return-type "GType") +) + +(define-function inet_socket_address_new + (c-name "g_inet_socket_address_new") + (is-constructor-of "GInetSocketAddress") + (return-type "GSocketAddress*") + (parameters + '("GInetAddress*" "address") + '("guint16" "port") + ) +) + +(define-method get_address + (of-object "GInetSocketAddress") + (c-name "g_inet_socket_address_get_address") + (return-type "GInetAddress*") +) + +(define-method get_port + (of-object "GInetSocketAddress") + (c-name "g_inet_socket_address_get_port") + (return-type "guint16") +) + + + +;; From ginputstream.h + +(define-function input_stream_get_type + (c-name "g_input_stream_get_type") + (return-type "GType") +) + +;; +;; wrapped in ginputstream.override +;; +;; Note: the following two methods are renamed for consistency with +;; Python file objects' read(). I.e. g_input_stream_read_all() is +;; more like Python file.read(), so it is renamed read(). Since now +;; there is a name clash, g_input_stream_read() is renamed +;; read_part(). +(define-method read_part + (of-object "GInputStream") + (docstring + "STREAM.read_part([count, [cancellable]]) -> string\n" + "\n" + "Read 'count' bytes from the stream. If 'count' is not specified or is\n" + "omitted, read until the end of the stream. This method is allowed to\n" + "stop at any time after reading at least 1 byte from the stream. E.g.\n" + "when reading over a (relatively slow) HTTP connection, it will often\n" + "stop after receiving one packet. Therefore, to reliably read requested\n" + "number of bytes, you need to use a loop. See also gio.InputStream.read\n" + "for easier to use (though less efficient) method.\n" + "\n" + "Note: this method roughly corresponds to C GIO g_input_stream_read." + ) + (c-name "g_input_stream_read") + (return-type "gssize") + (parameters + '("void*" "buffer") + '("gsize" "count") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in ginputstream.override +;; +;; See comments before the previous method definition. +(define-method read + (of-object "GInputStream") + (docstring + "STREAM.read([count, [cancellable]]) -> string\n" + "\n" + "Read 'count' bytes from the stream. If 'count' is not specified or is\n" + "omitted, read until the end of the stream. This method will stop only\n" + "after reading requested number of bytes, reaching end of stream or\n" + "triggering an I/O error. See also gio.InputStream.read_part for more\n" + "efficient, but more cumbersome to use method.\n" + "\n" + "Note: this method roughly corresponds to C GIO g_input_stream_read_all.\n" + "It was renamed for consistency with Python standard file.read." + ) + (c-name "g_input_stream_read_all") + (return-type "gboolean") + (parameters + '("void*" "buffer") + '("gsize" "count") + '("gsize*" "bytes_read") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method skip + (of-object "GInputStream") + (c-name "g_input_stream_skip") + (return-type "gssize") + (parameters + '("gsize" "count") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method close + (of-object "GInputStream") + (c-name "g_input_stream_close") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in ginputstream.override +;; +(define-method read_async + (of-object "GInputStream") + (c-name "g_input_stream_read_async") + (return-type "none") + (parameters + '("void*" "buffer") + '("gsize" "count") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +;; +;; wrapped in ginputstream.override +;; +(define-method read_finish + (of-object "GInputStream") + (c-name "g_input_stream_read_finish") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method skip_async + (of-object "GInputStream") + (c-name "g_input_stream_skip_async") + (return-type "none") + (parameters + '("gsize" "count") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method skip_finish + (of-object "GInputStream") + (c-name "g_input_stream_skip_finish") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in ginputstream.override +;; +(define-method close_async + (of-object "GInputStream") + (c-name "g_input_stream_close_async") + (return-type "none") + (parameters + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method close_finish + (of-object "GInputStream") + (c-name "g_input_stream_close_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method is_closed + (of-object "GInputStream") + (c-name "g_input_stream_is_closed") + (return-type "gboolean") +) + +(define-method has_pending + (of-object "GInputStream") + (c-name "g_input_stream_has_pending") + (return-type "gboolean") +) + +(define-method set_pending + (of-object "GInputStream") + (c-name "g_input_stream_set_pending") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method clear_pending + (of-object "GInputStream") + (c-name "g_input_stream_clear_pending") + (return-type "none") +) + + + +;; From gioalias.h + + + +;; From gioenumtypes.h + +(define-function app_info_create_flags_get_type + (c-name "g_app_info_create_flags_get_type") + (return-type "GType") +) + +(define-function data_stream_byte_order_get_type + (c-name "g_data_stream_byte_order_get_type") + (return-type "GType") +) + +(define-function data_stream_newline_type_get_type + (c-name "g_data_stream_newline_type_get_type") + (return-type "GType") +) + +(define-function file_query_info_flags_get_type + (c-name "g_file_query_info_flags_get_type") + (return-type "GType") +) + +(define-function file_create_flags_get_type + (c-name "g_file_create_flags_get_type") + (return-type "GType") +) + +(define-function file_copy_flags_get_type + (c-name "g_file_copy_flags_get_type") + (return-type "GType") +) + +(define-function file_monitor_flags_get_type + (c-name "g_file_monitor_flags_get_type") + (return-type "GType") +) + +(define-function file_attribute_type_get_type + (c-name "g_file_attribute_type_get_type") + (return-type "GType") +) + +(define-function file_attribute_info_flags_get_type + (c-name "g_file_attribute_info_flags_get_type") + (return-type "GType") +) + +(define-function file_attribute_status_get_type + (c-name "g_file_attribute_status_get_type") + (return-type "GType") +) + +(define-function file_type_get_type + (c-name "g_file_type_get_type") + (return-type "GType") +) + +(define-function file_monitor_event_get_type + (c-name "g_file_monitor_event_get_type") + (return-type "GType") +) + +(define-function io_error_enum_get_type + (c-name "g_io_error_enum_get_type") + (return-type "GType") +) + +(define-function ask_password_flags_get_type + (c-name "g_ask_password_flags_get_type") + (return-type "GType") +) + +(define-function password_save_get_type + (c-name "g_password_save_get_type") + (return-type "GType") +) + +(define-function output_stream_splice_flags_get_type + (c-name "g_output_stream_splice_flags_get_type") + (return-type "GType") +) + + + +;; From gioerror.h + +(define-function io_error_quark + (c-name "g_io_error_quark") + (return-type "GQuark") +) + +(define-function io_error_from_errno + (c-name "g_io_error_from_errno") + (return-type "GIOErrorEnum") + (parameters + '("gint" "err_no") + ) +) + + + +;; From gio.h + + + +;; From gio-marshal.h + + + +;; From giomodule.h + +(define-function io_module_get_type + (c-name "g_io_module_get_type") + (return-type "GType") +) + +(define-function io_module_new + (c-name "g_io_module_new") + (is-constructor-of "GIoModule") + (return-type "GIOModule*") + (parameters + '("const-gchar*" "filename") + ) +) + +(define-function io_modules_load_all_in_directory + (c-name "g_io_modules_load_all_in_directory") + (return-type "GList*") + (parameters + '("const-char*" "dirname") + ) +) + +(define-method load + (of-object "GIOModule") + (c-name "g_io_module_load") + (return-type "none") +) + +(define-method unload + (of-object "GIOModule") + (c-name "g_io_module_unload") + (return-type "none") +) + + + +;; From gioscheduler.h + +(define-function io_scheduler_push_job + (c-name "g_io_scheduler_push_job") + (return-type "none") + (parameters + '("GIOSchedulerJobFunc" "job_func") + '("gpointer" "user_data") + '("GDestroyNotify" "notify") + '("gint" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + ) +) + +(define-function io_scheduler_cancel_all_jobs + (c-name "g_io_scheduler_cancel_all_jobs") + (return-type "none") +) + +(define-method send_to_mainloop + (of-object "GIOSchedulerJob") + (c-name "g_io_scheduler_job_send_to_mainloop") + (return-type "gboolean") + (parameters + '("GSourceFunc" "func") + '("gpointer" "user_data") + '("GDestroyNotify" "notify") + ) +) + +(define-method send_to_mainloop_async + (of-object "GIOSchedulerJob") + (c-name "g_io_scheduler_job_send_to_mainloop_async") + (return-type "none") + (parameters + '("GSourceFunc" "func") + '("gpointer" "user_data") + '("GDestroyNotify" "notify") + ) +) + + + +;; From gloadableicon.h + +(define-function loadable_icon_get_type + (c-name "g_loadable_icon_get_type") + (return-type "GType") +) + +;; +;; wrapped in gicon.override +;; +(define-method load + (of-object "GLoadableIcon") + (docstring + "ICON.load([size, [cancellable]]) -> input stream, type\n" + "\n" + "Opens a stream of icon data for reading. The result is a tuple of\n" + "gio.InputStream and type (either a string or None). The stream can\n" + "be read to retrieve icon data.\n" + "\n" + ;; Note: this is just a guess, GIO docs say nothing at the moment. + "Optional size is a hint at desired icon size. Not all implementations\n" + "support it and the hint will be just ignored in such cases.\n" + "If cancellable is specified, then the operation can be cancelled\n" + "by triggering the cancellable object from another thread. See\n" + "gio.File.read for details." + ) + (c-name "g_loadable_icon_load") + (return-type "GInputStream*") + (parameters + '("int" "size") + '("char**" "type") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in gicon.override +;; +(define-method load_async + (of-object "GLoadableIcon") + (docstring + "ICON.load_async(callback, [size, [cancellable, [user_data]]])\n" + "-> start loading\n" + "\n" + "For more information, see gio.LoadableIcon.load() which is the\n" + "synchronous version of this call. Asynchronously opens icon data for\n" + "reading. When the operation is finished, callback will be called.\n" + "You can then call gio.LoadableIcon.load_finish() to get the result of\n" + "the operation.\n" + ) + (c-name "g_loadable_icon_load_async") + (return-type "none") + (parameters + '("int" "size") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +;; +;; wrapped in gicon.override +;; +(define-method load_finish + (docstring + "F.load_finish(res) -> start loading\n" + "\n" + "Finish asynchronous icon loading operation. Must be called from callback\n" + "as specified to gio.LoadableIcon.load_async. Returns a tuple of\n" + "gio.InputStream and type, just as gio.LoadableIcon.load." + ) + (of-object "GLoadableIcon") + (c-name "g_loadable_icon_load_finish") + (return-type "GInputStream*") + (parameters + '("GAsyncResult*" "res") + '("char**" "type") + '("GError**" "error") + ) +) + + + +;; From ginetaddress.h + +(define-function inet_address_get_type + (c-name "g_inet_address_get_type") + (return-type "GType") +) + +(define-function inet_address_new_from_string + (c-name "g_inet_address_new_from_string") + (return-type "GInetAddress*") + (parameters + '("const-gchar*" "string") + ) +) + +(define-function inet_address_new_from_bytes + (c-name "g_inet_address_new_from_bytes") + (return-type "GInetAddress*") + (parameters + '("const-guint8*" "bytes") + '("GSocketFamily" "family") + ) +) + +(define-function inet_address_new_loopback + (c-name "g_inet_address_new_loopback") + (return-type "GInetAddress*") + (parameters + '("GSocketFamily" "family") + ) +) + +(define-function inet_address_new_any + (c-name "g_inet_address_new_any") + (return-type "GInetAddress*") + (parameters + '("GSocketFamily" "family") + ) +) + +(define-method to_string + (of-object "GInetAddress") + (c-name "g_inet_address_to_string") + (return-type "gchar*") +) + + +;; FIXME codegen barfs on this one +;; +;;(define-method to_bytes +;; (of-object "GInetAddress") +;; (c-name "g_inet_address_to_bytes") +;; (return-type "const-guint8*") +;;) + +(define-method get_native_size + (of-object "GInetAddress") + (c-name "g_inet_address_get_native_size") + (return-type "gsize") +) + +(define-method get_family + (of-object "GInetAddress") + (c-name "g_inet_address_get_family") + (return-type "GSocketFamily") +) + +(define-method get_is_any + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_any") + (return-type "gboolean") +) + +(define-method get_is_loopback + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_loopback") + (return-type "gboolean") +) + +(define-method get_is_link_local + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_link_local") + (return-type "gboolean") +) + +(define-method get_is_site_local + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_site_local") + (return-type "gboolean") +) + +(define-method get_is_multicast + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_multicast") + (return-type "gboolean") +) + +(define-method get_is_mc_global + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_mc_global") + (return-type "gboolean") +) + +(define-method get_is_mc_link_local + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_mc_link_local") + (return-type "gboolean") +) + +(define-method get_is_mc_node_local + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_mc_node_local") + (return-type "gboolean") +) + +(define-method get_is_mc_org_local + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_mc_org_local") + (return-type "gboolean") +) + +(define-method get_is_mc_site_local + (of-object "GInetAddress") + (c-name "g_inet_address_get_is_mc_site_local") + (return-type "gboolean") +) + + + +;; From ginitable.h + +(define-function initable_get_type + (c-name "g_initable_get_type") + (return-type "GType") +) + +(define-method init + (of-object "GInitable") + (c-name "g_initable_init") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-function initable_new + (c-name "g_initable_new") + (return-type "gpointer") + (parameters + '("GType" "object_type") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + '("const-gchar*" "first_property_name") + ) + (varargs #t) +) + +(define-function initable_newv + (c-name "g_initable_newv") + (return-type "gpointer") + (parameters + '("GType" "object_type") + '("guint" "n_parameters") + '("GParameter*" "parameters") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-function initable_new_valist + (c-name "g_initable_new_valist") + (return-type "GObject*") + (parameters + '("GType" "object_type") + '("const-gchar*" "first_property_name") + '("va_list" "var_args") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + + + +;; From giostream.h + +(define-function io_stream_get_type + (c-name "g_io_stream_get_type") + (return-type "GType") +) + +(define-method get_input_stream + (of-object "GIOStream") + (c-name "g_io_stream_get_input_stream") + (return-type "GInputStream*") +) + +(define-method get_output_stream + (of-object "GIOStream") + (c-name "g_io_stream_get_output_stream") + (return-type "GOutputStream*") +) + +(define-method close + (of-object "GIOStream") + (c-name "g_io_stream_close") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method close_async + (of-object "GIOStream") + (c-name "g_io_stream_close_async") + (return-type "none") + (parameters + '("int" "io_priority") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method close_finish + (of-object "GIOStream") + (c-name "g_io_stream_close_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method is_closed + (of-object "GIOStream") + (c-name "g_io_stream_is_closed") + (return-type "gboolean") +) + +(define-method has_pending + (of-object "GIOStream") + (c-name "g_io_stream_has_pending") + (return-type "gboolean") +) + +(define-method set_pending + (of-object "GIOStream") + (c-name "g_io_stream_set_pending") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method clear_pending + (of-object "GIOStream") + (c-name "g_io_stream_clear_pending") + (return-type "none") +) + + + +;; From glocaldirectorymonitor.h + +(define-function local_directory_monitor_get_type + (c-name "g_local_directory_monitor_get_type") + (return-type "GType") +) + + + +;; From glocalfileenumerator.h + + + +;; From glocalfile.h + + + +;; From glocalfileinfo.h + + + +;; From glocalfileinputstream.h + + + +;; From glocalfilemonitor.h + +(define-function local_file_monitor_get_type + (c-name "g_local_file_monitor_get_type") + (return-type "GType") +) + + + +;; From glocalfileoutputstream.h + + + +;; From glocalvfs.h + + + +;; From gmemoryinputstream.h + +(define-function memory_input_stream_get_type + (c-name "g_memory_input_stream_get_type") + (return-type "GType") +) + +(define-function memory_input_stream_new + (c-name "g_memory_input_stream_new") + (is-constructor-of "GMemoryInputStream") + (return-type "GInputStream*") +) + +(define-function memory_input_stream_new_from_data + (c-name "g_memory_input_stream_new_from_data") + (return-type "GInputStream*") + (parameters + '("const-void*" "data") + '("gssize" "len") + '("GDestroyNotify" "destroy") + ) +) + +;; +;; wrapped in ginputstream.override +;; +(define-method add_data + (of-object "GMemoryInputStream") + (c-name "g_memory_input_stream_add_data") + (return-type "none") + (parameters + '("const-void*" "data") + '("gssize" "len") + '("GDestroyNotify" "destroy") + ) +) + + + +;; From gmemoryoutputstream.h + +(define-function memory_output_stream_get_type + (c-name "g_memory_output_stream_get_type") + (return-type "GType") +) + +;; +;; wrapped in goutputstream.override +;; +(define-function memory_output_stream_new + (c-name "g_memory_output_stream_new") + (is-constructor-of "GMemoryOutputStream") + (return-type "GOutputStream*") + (parameters + '("gpointer" "data") + '("gsize" "len") + '("GReallocFunc" "realloc_fn") + '("GDestroyNotify" "destroy") + ) +) + +;; +;; wrapped in goutputstream.override +;; +;; Note: name clash with gobject.GObject.get_data; renamed. +(define-method get_contents + (of-object "GMemoryOutputStream") + (c-name "g_memory_output_stream_get_data") + (return-type "gpointer") +) + +(define-method get_size + (of-object "GMemoryOutputStream") + (c-name "g_memory_output_stream_get_size") + (return-type "gsize") +) + +(define-method get_data_size + (of-object "GMemoryOutputStream") + (c-name "g_memory_output_stream_get_data_size") + (return-type "gsize") +) + + + +;; From gmount.h + +(define-function mount_get_type + (c-name "g_mount_get_type") + (return-type "GType") +) + +(define-method get_root + (of-object "GMount") + (c-name "g_mount_get_root") + (return-type "GFile*") + (caller-owns-return #t) +) + +(define-method get_name + (of-object "GMount") + (c-name "g_mount_get_name") + (return-type "char*") +) + +(define-method get_icon + (of-object "GMount") + (c-name "g_mount_get_icon") + (return-type "GIcon*") + (caller-owns-return #t) +) + +(define-method get_uuid + (of-object "GMount") + (c-name "g_mount_get_uuid") + (return-type "char*") +) + +(define-method get_volume + (of-object "GMount") + (c-name "g_mount_get_volume") + (return-type "GVolume*") + (caller-owns-return #t) +) + +(define-method get_drive + (of-object "GMount") + (c-name "g_mount_get_drive") + (return-type "GDrive*") + (caller-owns-return #t) +) + +(define-method can_unmount + (of-object "GMount") + (c-name "g_mount_can_unmount") + (return-type "gboolean") +) + +(define-method can_eject + (of-object "GMount") + (c-name "g_mount_can_eject") + (return-type "gboolean") +) + +;; +;; wrapped in gio.override +;; +(define-method unmount + (docstring +"M.unmount(callback, [flags, cancellable, user_data])\n" +"Unmounts a mount. This is an asynchronous operation, and is finished\n" +"by calling gio.Mount.unmount_finish() with the mount and gio.AsyncResults\n" +"data returned in the callback." +) + (of-object "GMount") + (c-name "g_mount_unmount") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method unmount_finish + (of-object "GMount") + (c-name "g_mount_unmount_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in gio.override +;; +(define-method eject + (docstring +"F.eject(callback, [flags, cancellable, user_data])\n" +"Ejects a volume.\n" +"\n" +"If cancellable is not None, then the operation can be cancelled by\n" +"triggering the cancellable object from another thread. If the\n" +"operation was cancelled, the error gio.ERROR_CANCELLED will be returned.\n" +"\n" +"When the operation is finished, callback will be called. You can\n" +"then call gio.Volume.eject_finish() to get the result of the operation.\n") + (of-object "GMount") + (c-name "g_mount_eject") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method eject_finish + (of-object "GMount") + (c-name "g_mount_eject_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in gio.override +;; +(define-method remount + (of-object "GMount") + (docstring + "M.remount(callback, [flags, [mount_operation, [cancellable, [user_data]]]])\n" + "Remounts a mount. This is an asynchronous operation, and is finished by\n" + "calling gio.Mount.remount_finish with the mount and gio.AsyncResults data\n" + "returned in the callback.") + (c-name "g_mount_remount") + (return-type "none") + (parameters + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method remount_finish + (of-object "GMount") + (c-name "g_mount_remount_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method guess_content_type + (of-object "GMount") + (c-name "g_mount_guess_content_type") + (return-type "none") + (parameters + '("gboolean" "force_rescan") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method guess_content_type_finish + (of-object "GMount") + (c-name "g_mount_guess_content_type_finish") + (return-type "gchar**") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method guess_content_type_sync + (of-object "GMount") + (c-name "g_mount_guess_content_type_sync") + (return-type "gchar**") + (parameters + '("gboolean" "force_rescan") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method is_shadowed + (of-object "GMount") + (c-name "g_mount_is_shadowed") + (return-type "gboolean") +) + +(define-method shadow + (of-object "GMount") + (c-name "g_mount_shadow") + (return-type "none") +) + +(define-method unshadow + (of-object "GMount") + (c-name "g_mount_unshadow") + (return-type "none") +) + +(define-method unmount_with_operation + (of-object "GMount") + (c-name "g_mount_unmount_with_operation") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method unmount_with_operation_finish + (of-object "GMount") + (c-name "g_mount_unmount_with_operation_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method eject_with_operation + (of-object "GMount") + (c-name "g_mount_eject_with_operation") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method eject_with_operation_finish + (of-object "GMount") + (c-name "g_mount_eject_with_operation_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + + + +;; From gmountoperation.h + +(define-function mount_operation_get_type + (c-name "g_mount_operation_get_type") + (return-type "GType") +) + +(define-function mount_operation_new + (c-name "g_mount_operation_new") + (is-constructor-of "GMountOperation") + (return-type "GMountOperation*") +) + +(define-method get_username + (of-object "GMountOperation") + (c-name "g_mount_operation_get_username") + (return-type "const-char*") +) + +(define-method set_username + (of-object "GMountOperation") + (c-name "g_mount_operation_set_username") + (return-type "none") + (parameters + '("const-char*" "username") + ) +) + +(define-method get_password + (of-object "GMountOperation") + (c-name "g_mount_operation_get_password") + (return-type "const-char*") +) + +(define-method set_password + (of-object "GMountOperation") + (c-name "g_mount_operation_set_password") + (return-type "none") + (parameters + '("const-char*" "password") + ) +) + +(define-method get_anonymous + (of-object "GMountOperation") + (c-name "g_mount_operation_get_anonymous") + (return-type "gboolean") +) + +(define-method set_anonymous + (of-object "GMountOperation") + (c-name "g_mount_operation_set_anonymous") + (return-type "none") + (parameters + '("gboolean" "anonymous") + ) +) + +(define-method get_domain + (of-object "GMountOperation") + (c-name "g_mount_operation_get_domain") + (return-type "const-char*") +) + +(define-method set_domain + (of-object "GMountOperation") + (c-name "g_mount_operation_set_domain") + (return-type "none") + (parameters + '("const-char*" "domain") + ) +) + +(define-method get_password_save + (of-object "GMountOperation") + (c-name "g_mount_operation_get_password_save") + (return-type "GPasswordSave") +) + +(define-method set_password_save + (of-object "GMountOperation") + (c-name "g_mount_operation_set_password_save") + (return-type "none") + (parameters + '("GPasswordSave" "save") + ) +) + +(define-method get_choice + (of-object "GMountOperation") + (c-name "g_mount_operation_get_choice") + (return-type "int") +) + +(define-method set_choice + (of-object "GMountOperation") + (c-name "g_mount_operation_set_choice") + (return-type "none") + (parameters + '("int" "choice") + ) +) + +(define-method reply + (of-object "GMountOperation") + (c-name "g_mount_operation_reply") + (return-type "none") + (parameters + '("GMountOperationResult" "result") + ) +) + + + +;; From gnativevolumemonitor.h + +(define-function native_volume_monitor_get_type + (c-name "g_native_volume_monitor_get_type") + (return-type "GType") +) + + + +;; From gnetworkaddress.h + +(define-function network_address_get_type + (c-name "g_network_address_get_type") + (return-type "GType") +) + +(define-function network_address_new + (c-name "g_network_address_new") + (is-constructor-of "GNetworkAddress") + (return-type "GSocketConnectable*") + (parameters + '("const-gchar*" "hostname") + '("guint16" "port") + ) +) + +(define-function network_address_parse + (c-name "g_network_address_parse") + (return-type "GSocketConnectable*") + (parameters + '("const-gchar*" "host_and_port") + '("guint16" "default_port") + '("GError**" "error") + ) +) + +(define-method get_hostname + (of-object "GNetworkAddress") + (c-name "g_network_address_get_hostname") + (return-type "const-gchar*") +) + +(define-method get_port + (of-object "GNetworkAddress") + (c-name "g_network_address_get_port") + (return-type "guint16") +) + + + +;; From gnetworkservice.h + +(define-function network_service_get_type + (c-name "g_network_service_get_type") + (return-type "GType") +) + +(define-function network_service_new + (c-name "g_network_service_new") + (is-constructor-of "GNetworkService") + (return-type "GSocketConnectable*") + (parameters + '("const-gchar*" "service") + '("const-gchar*" "protocol") + '("const-gchar*" "domain") + ) +) + +(define-method get_service + (of-object "GNetworkService") + (c-name "g_network_service_get_service") + (return-type "const-gchar*") +) + +(define-method get_protocol + (of-object "GNetworkService") + (c-name "g_network_service_get_protocol") + (return-type "const-gchar*") +) + +(define-method get_domain + (of-object "GNetworkService") + (c-name "g_network_service_get_domain") + (return-type "const-gchar*") +) + + + +;; From goutputstream.h + +(define-function output_stream_get_type + (c-name "g_output_stream_get_type") + (return-type "GType") +) + +;; +;; wrapped in goutputstream.override +;; +;; Note: the following two methods are renamed for consistency with +;; Python file objects' write(). I.e. g_output_stream_write_all() is +;; more like Python file.write(), so it is renamed write(). Since now +;; there is a name clash, g_output_stream_write() is renamed +;; write_part(). +(define-method write_part + (of-object "GOutputStream") + (docstring + "STREAM.write_part(buffer, [cancellable]) -> int\n" + "\n" + "Write the bytes in 'buffer' to the stream. Return the number of bytes\n" + "successfully written. This method is allowed to stop at any time after\n" + "writing at least 1 byte. Therefore, to reliably write the whole buffer,\n" + "you need to use a loop. See also gio.OutputStream.write for easier to\n" + "use (though less efficient) method.\n" + "\n" + "Note: this method roughly corresponds to C GIO g_output_stream_write." + ) + (c-name "g_output_stream_write") + (return-type "gssize") + (parameters + '("const-void*" "buffer") + '("gsize" "count") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in goutputstream.override +;; +;; See comments before the previous method definition. +(define-method write + (of-object "GOutputStream") + "STREAM.write(buffer, [cancellable]) -> int\n" + "\n" + "Write the bytes in 'buffer' to the stream. Return the number of bytes\n" + "successfully written. This method will stop only after writing the whole\n" + "buffer or triggering an I/O error. See also gio.OutputStream.write_part\n" + "for more efficient, but more cumbersome to use method.\n" + "\n" + "Note: this method roughly corresponds to C GIO g_output_stream_write_all.\n" + "It was renamed for consistency with Python standard file.write." + (c-name "g_output_stream_write_all") + (return-type "gboolean") + (parameters + '("const-void*" "buffer") + '("gsize" "count") + '("gsize*" "bytes_written") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method splice + (of-object "GOutputStream") + (c-name "g_output_stream_splice") + (return-type "gssize") + (parameters + '("GInputStream*" "source") + '("GOutputStreamSpliceFlags" "flags" (default "G_OUTPUT_STREAM_SPLICE_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method flush + (of-object "GOutputStream") + (c-name "g_output_stream_flush") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method close + (of-object "GOutputStream") + (c-name "g_output_stream_close") + (return-type "gboolean") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +;; +;; wrapped in goutputstream.override +;; +(define-method write_async + (of-object "GOutputStream") + (docstring +"S.write_async(buffer, callback [,io_priority] [,cancellable] [,user_data])\n" +"\n" +"Request an asynchronous write of count bytes from buffer into the stream.\n" +"When the operation is finished callback will be called. You can then call\n" +"gio.OutputStream.write_finish() to get the result of the operation.\n" +"On success, the number of bytes written will be passed to the callback.\n" +"It is not an error if this is not the same as the requested size, as it can\n" +"happen e.g. on a partial I/O error, but generally tries to write as many \n" +"bytes as requested.\n" +"For the synchronous, blocking version of this function, see\n" +"gio.OutputStream.write().\n") + (c-name "g_output_stream_write_async") + (return-type "none") + (parameters + '("const-void*" "buffer") + '("gsize" "count") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method write_finish + (of-object "GOutputStream") + (c-name "g_output_stream_write_finish") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method splice_async + (of-object "GOutputStream") + (c-name "g_output_stream_splice_async") + (return-type "none") + (parameters + '("GInputStream*" "source") + '("GOutputStreamSpliceFlags" "flags" (default "G_OUTPUT_STREAM_SPLICE_NONE")) + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method splice_finish + (of-object "GOutputStream") + (c-name "g_output_stream_splice_finish") + (return-type "gssize") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method flush_async + (of-object "GOutputStream") + (c-name "g_output_stream_flush_async") + (return-type "none") + (parameters + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method flush_finish + (of-object "GOutputStream") + (c-name "g_output_stream_flush_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in goutputstream.override +;; +(define-method close_async + (of-object "GOutputStream") + (c-name "g_output_stream_close_async") + (return-type "none") + (parameters + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method close_finish + (of-object "GOutputStream") + (c-name "g_output_stream_close_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method is_closed + (of-object "GOutputStream") + (c-name "g_output_stream_is_closed") + (return-type "gboolean") +) + +(define-method has_pending + (of-object "GOutputStream") + (c-name "g_output_stream_has_pending") + (return-type "gboolean") +) + +(define-method set_pending + (of-object "GOutputStream") + (c-name "g_output_stream_set_pending") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method clear_pending + (of-object "GOutputStream") + (c-name "g_output_stream_clear_pending") + (return-type "none") +) + + + +;; From gresolver.h + +(define-function resolver_get_type + (c-name "g_resolver_get_type") + (return-type "GType") +) + +(define-function resolver_get_default + (c-name "g_resolver_get_default") + (return-type "GResolver*") +) + +(define-method set_default + (of-object "GResolver") + (c-name "g_resolver_set_default") + (return-type "none") +) + +(define-method lookup_by_name + (of-object "GResolver") + (c-name "g_resolver_lookup_by_name") + (return-type "GList*") + (parameters + '("const-gchar*" "hostname") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method lookup_by_name_async + (of-object "GResolver") + (c-name "g_resolver_lookup_by_name_async") + (return-type "none") + (parameters + '("const-gchar*" "hostname") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method lookup_by_name_finish + (of-object "GResolver") + (c-name "g_resolver_lookup_by_name_finish") + (return-type "GList*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-function resolver_free_addresses + (c-name "g_resolver_free_addresses") + (return-type "none") + (parameters + '("GList*" "addresses") + ) +) + +(define-method lookup_by_address + (of-object "GResolver") + (c-name "g_resolver_lookup_by_address") + (return-type "gchar*") + (parameters + '("GInetAddress*" "address") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method lookup_by_address_async + (of-object "GResolver") + (c-name "g_resolver_lookup_by_address_async") + (return-type "none") + (parameters + '("GInetAddress*" "address") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method lookup_by_address_finish + (of-object "GResolver") + (c-name "g_resolver_lookup_by_address_finish") + (return-type "gchar*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method lookup_service + (of-object "GResolver") + (c-name "g_resolver_lookup_service") + (return-type "GList*") + (parameters + '("const-gchar*" "service") + '("const-gchar*" "protocol") + '("const-gchar*" "domain") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method lookup_service_async + (of-object "GResolver") + (c-name "g_resolver_lookup_service_async") + (return-type "none") + (parameters + '("const-gchar*" "service") + '("const-gchar*" "protocol") + '("const-gchar*" "domain") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method lookup_service_finish + (of-object "GResolver") + (c-name "g_resolver_lookup_service_finish") + (return-type "GList*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-function resolver_free_targets + (c-name "g_resolver_free_targets") + (return-type "none") + (parameters + '("GList*" "targets") + ) +) + +(define-function resolver_error_quark + (c-name "g_resolver_error_quark") + (return-type "GQuark") +) + + + +;; From gseekable.h + +(define-function seekable_get_type + (c-name "g_seekable_get_type") + (return-type "GType") +) + +(define-method tell + (of-object "GSeekable") + (c-name "g_seekable_tell") + (return-type "goffset") +) + +(define-method can_seek + (of-object "GSeekable") + (c-name "g_seekable_can_seek") + (return-type "gboolean") +) + +(define-method seek + (of-object "GSeekable") + (c-name "g_seekable_seek") + (return-type "gboolean") + (parameters + '("goffset" "offset") + '("GSeekType" "type" (default "G_SEEK_SET")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method can_truncate + (of-object "GSeekable") + (c-name "g_seekable_can_truncate") + (return-type "gboolean") +) + +(define-method truncate + (of-object "GSeekable") + (c-name "g_seekable_truncate") + (return-type "gboolean") + (parameters + '("goffset" "offset") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + + + +;; From gsimpleasyncresult.h + +(define-function simple_async_result_get_type + (c-name "g_simple_async_result_get_type") + (return-type "GType") +) + +(define-function simple_async_result_new + (c-name "g_simple_async_result_new") + (is-constructor-of "GSimpleAsyncResult") + (return-type "GSimpleAsyncResult*") + (parameters + '("GObject*" "source_object") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + '("gpointer" "source_tag") + ) +) + +(define-function simple_async_result_new_error + (c-name "g_simple_async_result_new_error") + (return-type "GSimpleAsyncResult*") + (parameters + '("GObject*" "source_object") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + '("GQuark" "domain") + '("gint" "code") + '("const-char*" "format") + ) + (varargs #t) +) + +(define-function simple_async_result_new_from_error + (c-name "g_simple_async_result_new_from_error") + (return-type "GSimpleAsyncResult*") + (parameters + '("GObject*" "source_object") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + '("GError*" "error") + ) +) + +(define-method set_op_res_gpointer + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_set_op_res_gpointer") + (return-type "none") + (parameters + '("gpointer" "op_res") + '("GDestroyNotify" "destroy_op_res") + ) +) + +(define-method get_op_res_gpointer + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_get_op_res_gpointer") + (return-type "gpointer") +) + +(define-method set_op_res_gssize + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_set_op_res_gssize") + (return-type "none") + (parameters + '("gssize" "op_res") + ) +) + +(define-method get_op_res_gssize + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_get_op_res_gssize") + (return-type "gssize") +) + +(define-method set_op_res_gboolean + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_set_op_res_gboolean") + (return-type "none") + (parameters + '("gboolean" "op_res") + ) +) + +(define-method get_op_res_gboolean + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_get_op_res_gboolean") + (return-type "gboolean") +) + +(define-method get_source_tag + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_get_source_tag") + (return-type "gpointer") +) + +(define-method set_handle_cancellation + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_set_handle_cancellation") + (return-type "none") + (parameters + '("gboolean" "handle_cancellation") + ) +) + +(define-method complete + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_complete") + (return-type "none") +) + +(define-method complete_in_idle + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_complete_in_idle") + (return-type "none") +) + +(define-method run_in_thread + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_run_in_thread") + (return-type "none") + (parameters + '("GSimpleAsyncThreadFunc" "func") + '("int" "io_priority" (default "G_PRIORITY_DEFAULT")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + ) +) + +(define-method set_from_error + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_set_from_error") + (return-type "none") + (parameters + '("GError*" "error") + ) +) + +(define-method propagate_error + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_propagate_error") + (return-type "gboolean") + (parameters + '("GError**" "dest") + ) +) + +(define-method set_error + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_set_error") + (return-type "none") + (parameters + '("GQuark" "domain") + '("gint" "code") + '("const-char*" "format") + ) + (varargs #t) +) + +(define-method set_error_va + (of-object "GSimpleAsyncResult") + (c-name "g_simple_async_result_set_error_va") + (return-type "none") + (parameters + '("GQuark" "domain") + '("gint" "code") + '("const-char*" "format") + '("va_list" "args") + ) +) + +(define-function simple_async_report_error_in_idle + (c-name "g_simple_async_report_error_in_idle") + (return-type "none") + (parameters + '("GObject*" "object") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + '("GQuark" "domain") + '("gint" "code") + '("const-char*" "format") + ) + (varargs #t) +) + +(define-function simple_async_report_gerror_in_idle + (c-name "g_simple_async_report_gerror_in_idle") + (return-type "none") + (parameters + '("GObject*" "object") + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + '("GError*" "error") + ) +) + + + +;; From gsocketaddressenumerator.h + +(define-function socket_address_enumerator_get_type + (c-name "g_socket_address_enumerator_get_type") + (return-type "GType") +) + +(define-method next + (of-object "GSocketAddressEnumerator") + (c-name "g_socket_address_enumerator_next") + (return-type "GSocketAddress*") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method next_async + (of-object "GSocketAddressEnumerator") + (c-name "g_socket_address_enumerator_next_async") + (return-type "none") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method next_finish + (of-object "GSocketAddressEnumerator") + (c-name "g_socket_address_enumerator_next_finish") + (return-type "GSocketAddress*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + + + +;; From gsocketaddress.h + +(define-function socket_address_get_type + (c-name "g_socket_address_get_type") + (return-type "GType") +) + +(define-method get_family + (of-object "GSocketAddress") + (c-name "g_socket_address_get_family") + (return-type "GSocketFamily") +) + +(define-function socket_address_new_from_native + (c-name "g_socket_address_new_from_native") + (return-type "GSocketAddress*") + (parameters + '("gpointer" "native") + '("gsize" "len") + ) +) + +(define-method to_native + (of-object "GSocketAddress") + (c-name "g_socket_address_to_native") + (return-type "gboolean") + (parameters + '("gpointer" "dest") + '("gsize" "destlen") + '("GError**" "error") + ) +) + +(define-method get_native_size + (of-object "GSocketAddress") + (c-name "g_socket_address_get_native_size") + (return-type "gssize") +) + + + +;; From gsocketclient.h + +(define-function socket_client_get_type + (c-name "g_socket_client_get_type") + (return-type "GType") +) + +(define-function socket_client_new + (c-name "g_socket_client_new") + (is-constructor-of "GSocketClient") + (return-type "GSocketClient*") +) + +(define-method get_family + (of-object "GSocketClient") + (c-name "g_socket_client_get_family") + (return-type "GSocketFamily") +) + +(define-method set_family + (of-object "GSocketClient") + (c-name "g_socket_client_set_family") + (return-type "none") + (parameters + '("GSocketFamily" "family") + ) +) + +(define-method get_socket_type + (of-object "GSocketClient") + (c-name "g_socket_client_get_socket_type") + (return-type "GSocketType") +) + +(define-method set_socket_type + (of-object "GSocketClient") + (c-name "g_socket_client_set_socket_type") + (return-type "none") + (parameters + '("GSocketType" "type") + ) +) + +(define-method get_protocol + (of-object "GSocketClient") + (c-name "g_socket_client_get_protocol") + (return-type "GSocketProtocol") +) + +(define-method set_protocol + (of-object "GSocketClient") + (c-name "g_socket_client_set_protocol") + (return-type "none") + (parameters + '("GSocketProtocol" "protocol") + ) +) + +(define-method get_local_address + (of-object "GSocketClient") + (c-name "g_socket_client_get_local_address") + (return-type "GSocketAddress*") +) + +(define-method set_local_address + (of-object "GSocketClient") + (c-name "g_socket_client_set_local_address") + (return-type "none") + (parameters + '("GSocketAddress*" "address") + ) +) + +(define-method connect + (of-object "GSocketClient") + (c-name "g_socket_client_connect") + (return-type "GSocketConnection*") + (parameters + '("GSocketConnectable*" "connectable") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method connect_to_host + (of-object "GSocketClient") + (c-name "g_socket_client_connect_to_host") + (return-type "GSocketConnection*") + (parameters + '("const-gchar*" "host_and_port") + '("guint16" "default_port") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method connect_to_service + (of-object "GSocketClient") + (c-name "g_socket_client_connect_to_service") + (return-type "GSocketConnection*") + (parameters + '("const-gchar*" "domain") + '("const-gchar*" "service") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method connect_async + (of-object "GSocketClient") + (c-name "g_socket_client_connect_async") + (return-type "none") + (parameters + '("GSocketConnectable*" "connectable") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method connect_finish + (of-object "GSocketClient") + (c-name "g_socket_client_connect_finish") + (return-type "GSocketConnection*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method connect_to_host_async + (of-object "GSocketClient") + (c-name "g_socket_client_connect_to_host_async") + (return-type "none") + (parameters + '("const-gchar*" "host_and_port") + '("guint16" "default_port") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method connect_to_host_finish + (of-object "GSocketClient") + (c-name "g_socket_client_connect_to_host_finish") + (return-type "GSocketConnection*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +(define-method connect_to_service_async + (of-object "GSocketClient") + (c-name "g_socket_client_connect_to_service_async") + (return-type "none") + (parameters + '("const-gchar*" "domain") + '("const-gchar*" "service") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method connect_to_service_finish + (of-object "GSocketClient") + (c-name "g_socket_client_connect_to_service_finish") + (return-type "GSocketConnection*") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + + + +;; From gsocketconnectable.h + +(define-function socket_connectable_get_type + (c-name "g_socket_connectable_get_type") + (return-type "GType") +) + +(define-method enumerate + (of-object "GSocketConnectable") + (c-name "g_socket_connectable_enumerate") + (return-type "GSocketAddressEnumerator*") +) + + + +;; From gsocketconnection.h + +(define-function socket_connection_get_type + (c-name "g_socket_connection_get_type") + (return-type "GType") +) + +(define-method get_socket + (of-object "GSocketConnection") + (c-name "g_socket_connection_get_socket") + (return-type "GSocket*") +) + +(define-method get_local_address + (of-object "GSocketConnection") + (c-name "g_socket_connection_get_local_address") + (return-type "GSocketAddress*") + (parameters + '("GError**" "error") + ) +) + +(define-method get_remote_address + (of-object "GSocketConnection") + (c-name "g_socket_connection_get_remote_address") + (return-type "GSocketAddress*") + (parameters + '("GError**" "error") + ) +) + +(define-function socket_connection_factory_register_type + (c-name "g_socket_connection_factory_register_type") + (return-type "none") + (parameters + '("GType" "g_type") + '("GSocketFamily" "family") + '("GSocketType" "type") + '("gint" "protocol") + ) +) + +(define-function socket_connection_factory_lookup_type + (c-name "g_socket_connection_factory_lookup_type") + (return-type "GType") + (parameters + '("GSocketFamily" "family") + '("GSocketType" "type") + '("gint" "protocol_id") + ) +) + +(define-method connection_factory_create_connection + (of-object "GSocket") + (c-name "g_socket_connection_factory_create_connection") + (return-type "GSocketConnection*") +) + + + +;; From gsocketcontrolmessage.h + +(define-function socket_control_message_get_type + (c-name "g_socket_control_message_get_type") + (return-type "GType") +) + +(define-method get_size + (of-object "GSocketControlMessage") + (c-name "g_socket_control_message_get_size") + (return-type "gsize") +) + +(define-method get_level + (of-object "GSocketControlMessage") + (c-name "g_socket_control_message_get_level") + (return-type "int") +) + +(define-method get_msg_type + (of-object "GSocketControlMessage") + (c-name "g_socket_control_message_get_msg_type") + (return-type "int") +) + +(define-method serialize + (of-object "GSocketControlMessage") + (c-name "g_socket_control_message_serialize") + (return-type "none") + (parameters + '("gpointer" "data") + ) +) + +(define-function socket_control_message_deserialize + (c-name "g_socket_control_message_deserialize") + (return-type "GSocketControlMessage*") + (parameters + '("int" "level") + '("int" "type") + '("gsize" "size") + '("gpointer" "data") + ) +) + + + +;; From gsocket.h + +(define-function socket_get_type + (c-name "g_socket_get_type") + (return-type "GType") +) + +(define-function socket_new + (c-name "g_socket_new") + (is-constructor-of "GSocket") + (return-type "GSocket*") + (parameters + '("GSocketFamily" "family") + '("GSocketType" "type") + '("GSocketProtocol" "protocol") + '("GError**" "error") + ) +) + +(define-function socket_new_from_fd + (c-name "g_socket_new_from_fd") + (return-type "GSocket*") + (parameters + '("gint" "fd") + '("GError**" "error") + ) +) + +(define-method get_fd + (of-object "GSocket") + (c-name "g_socket_get_fd") + (return-type "int") +) + +(define-method get_family + (of-object "GSocket") + (c-name "g_socket_get_family") + (return-type "GSocketFamily") +) + +(define-method get_socket_type + (of-object "GSocket") + (c-name "g_socket_get_socket_type") + (return-type "GSocketType") +) + +(define-method get_protocol + (of-object "GSocket") + (c-name "g_socket_get_protocol") + (return-type "GSocketProtocol") +) + +(define-method get_local_address + (of-object "GSocket") + (c-name "g_socket_get_local_address") + (return-type "GSocketAddress*") + (parameters + '("GError**" "error") + ) +) + +(define-method get_remote_address + (of-object "GSocket") + (c-name "g_socket_get_remote_address") + (return-type "GSocketAddress*") + (parameters + '("GError**" "error") + ) +) + +(define-method set_blocking + (of-object "GSocket") + (c-name "g_socket_set_blocking") + (return-type "none") + (parameters + '("gboolean" "blocking") + ) +) + +(define-method get_blocking + (of-object "GSocket") + (c-name "g_socket_get_blocking") + (return-type "gboolean") +) + +(define-method set_keepalive + (of-object "GSocket") + (c-name "g_socket_set_keepalive") + (return-type "none") + (parameters + '("gboolean" "keepalive") + ) +) + +(define-method get_keepalive + (of-object "GSocket") + (c-name "g_socket_get_keepalive") + (return-type "gboolean") +) + +(define-method get_listen_backlog + (of-object "GSocket") + (c-name "g_socket_get_listen_backlog") + (return-type "gint") +) + +(define-method set_listen_backlog + (of-object "GSocket") + (c-name "g_socket_set_listen_backlog") + (return-type "none") + (parameters + '("gint" "backlog") + ) +) + +(define-method is_connected + (of-object "GSocket") + (c-name "g_socket_is_connected") + (return-type "gboolean") +) + +(define-method bind + (of-object "GSocket") + (c-name "g_socket_bind") + (return-type "gboolean") + (parameters + '("GSocketAddress*" "address") + '("gboolean" "allow_reuse") + '("GError**" "error") + ) +) + +(define-method connect + (of-object "GSocket") + (c-name "g_socket_connect") + (return-type "gboolean") + (parameters + '("GSocketAddress*" "address") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method check_connect_result + (of-object "GSocket") + (c-name "g_socket_check_connect_result") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method condition_check + (of-object "GSocket") + (c-name "g_socket_condition_check") + (return-type "GIOCondition") + (parameters + '("GIOCondition" "condition") + ) +) + +(define-method condition_wait + (of-object "GSocket") + (c-name "g_socket_condition_wait") + (return-type "gboolean") + (parameters + '("GIOCondition" "condition") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method accept + (of-object "GSocket") + (c-name "g_socket_accept") + (return-type "GSocket*") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method listen + (of-object "GSocket") + (c-name "g_socket_listen") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method receive + (of-object "GSocket") + (c-name "g_socket_receive") + (return-type "gssize") + (parameters + '("gchar*" "buffer") + '("gsize" "size") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method receive_from + (of-object "GSocket") + (c-name "g_socket_receive_from") + (return-type "gssize") + (parameters + '("GSocketAddress**" "address") + '("gchar*" "buffer") + '("gsize" "size") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method send + (of-object "GSocket") + (c-name "g_socket_send") + (return-type "gssize") + (parameters + '("const-gchar*" "buffer") + '("gsize" "size") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method send_to + (of-object "GSocket") + (c-name "g_socket_send_to") + (return-type "gssize") + (parameters + '("GSocketAddress*" "address") + '("const-gchar*" "buffer") + '("gsize" "size") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method receive_message + (of-object "GSocket") + (c-name "g_socket_receive_message") + (return-type "gssize") + (parameters + '("GSocketAddress**" "address") + '("GInputVector*" "vectors") + '("gint" "num_vectors") + '("GSocketControlMessage***" "messages") + '("gint*" "num_messages") + '("gint*" "flags") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method send_message + (of-object "GSocket") + (c-name "g_socket_send_message") + (return-type "gssize") + (parameters + '("GSocketAddress*" "address") + '("GOutputVector*" "vectors") + '("gint" "num_vectors") + '("GSocketControlMessage**" "messages") + '("gint" "num_messages") + '("gint" "flags") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method close + (of-object "GSocket") + (c-name "g_socket_close") + (return-type "gboolean") + (parameters + '("GError**" "error") + ) +) + +(define-method shutdown + (of-object "GSocket") + (c-name "g_socket_shutdown") + (return-type "gboolean") + (parameters + '("gboolean" "shutdown_read") + '("gboolean" "shutdown_write") + '("GError**" "error") + ) +) + +(define-method is_closed + (of-object "GSocket") + (c-name "g_socket_is_closed") + (return-type "gboolean") +) + +(define-method create_source + (of-object "GSocket") + (c-name "g_socket_create_source") + (return-type "GSource*") + (parameters + '("GIOCondition" "condition") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + ) +) + +(define-method speaks_ipv4 + (of-object "GSocket") + (c-name "g_socket_speaks_ipv4") + (return-type "gboolean") +) + + + +;; From gsocketlistener.h + +(define-function socket_listener_get_type + (c-name "g_socket_listener_get_type") + (return-type "GType") +) + +(define-function socket_listener_new + (c-name "g_socket_listener_new") + (is-constructor-of "GSocketListener") + (return-type "GSocketListener*") +) + +(define-method set_backlog + (of-object "GSocketListener") + (c-name "g_socket_listener_set_backlog") + (return-type "none") + (parameters + '("int" "listen_backlog") + ) +) + +(define-method add_socket + (of-object "GSocketListener") + (c-name "g_socket_listener_add_socket") + (return-type "gboolean") + (parameters + '("GSocket*" "socket") + '("GObject*" "source_object") + '("GError**" "error") + ) +) + +(define-method add_address + (of-object "GSocketListener") + (c-name "g_socket_listener_add_address") + (return-type "gboolean") + (parameters + '("GSocketAddress*" "address") + '("GSocketType" "type") + '("GSocketProtocol" "protocol") + '("GObject*" "source_object") + '("GSocketAddress**" "effective_address") + '("GError**" "error") + ) +) + +(define-method add_inet_port + (of-object "GSocketListener") + (c-name "g_socket_listener_add_inet_port") + (return-type "gboolean") + (parameters + '("guint16" "port") + '("GObject*" "source_object") + '("GError**" "error") + ) +) + +(define-method accept_socket + (of-object "GSocketListener") + (c-name "g_socket_listener_accept_socket") + (return-type "GSocket*") + (parameters + '("GObject**" "source_object") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method accept_socket_async + (of-object "GSocketListener") + (c-name "g_socket_listener_accept_socket_async") + (return-type "none") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method accept_socket_finish + (of-object "GSocketListener") + (c-name "g_socket_listener_accept_socket_finish") + (return-type "GSocket*") + (parameters + '("GAsyncResult*" "result") + '("GObject**" "source_object") + '("GError**" "error") + ) +) + +(define-method accept + (of-object "GSocketListener") + (c-name "g_socket_listener_accept") + (return-type "GSocketConnection*") + (parameters + '("GObject**" "source_object") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GError**" "error") + ) +) + +(define-method accept_async + (of-object "GSocketListener") + (c-name "g_socket_listener_accept_async") + (return-type "none") + (parameters + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method accept_finish + (of-object "GSocketListener") + (c-name "g_socket_listener_accept_finish") + (return-type "GSocketConnection*") + (parameters + '("GAsyncResult*" "result") + '("GObject**" "source_object") + '("GError**" "error") + ) +) + +(define-method close + (of-object "GSocketListener") + (c-name "g_socket_listener_close") + (return-type "none") +) + + + +;; From gsocketservice.h + +(define-function socket_service_get_type + (c-name "g_socket_service_get_type") + (return-type "GType") +) + +(define-function socket_service_new + (c-name "g_socket_service_new") + (is-constructor-of "GSocketService") + (return-type "GSocketService*") +) + +(define-method start + (of-object "GSocketService") + (c-name "g_socket_service_start") + (return-type "none") +) + +(define-method stop + (of-object "GSocketService") + (c-name "g_socket_service_stop") + (return-type "none") +) + +(define-method is_active + (of-object "GSocketService") + (c-name "g_socket_service_is_active") + (return-type "gboolean") +) + + + +;; From gsrvtarget.h + +(define-function srv_target_get_type + (c-name "g_srv_target_get_type") + (return-type "GType") +) + +(define-function srv_target_new + (c-name "g_srv_target_new") + (is-constructor-of "GSrvTarget") + (return-type "GSrvTarget*") + (parameters + '("const-gchar*" "hostname") + '("guint16" "port") + '("guint16" "priority") + '("guint16" "weight") + ) +) + +(define-method copy + (of-object "GSrvTarget") + (c-name "g_srv_target_copy") + (return-type "GSrvTarget*") +) + +(define-method free + (of-object "GSrvTarget") + (c-name "g_srv_target_free") + (return-type "none") +) + +(define-method get_hostname + (of-object "GSrvTarget") + (c-name "g_srv_target_get_hostname") + (return-type "const-gchar*") +) + +(define-method get_port + (of-object "GSrvTarget") + (c-name "g_srv_target_get_port") + (return-type "guint16") +) + +(define-method get_priority + (of-object "GSrvTarget") + (c-name "g_srv_target_get_priority") + (return-type "guint16") +) + +(define-method get_weight + (of-object "GSrvTarget") + (c-name "g_srv_target_get_weight") + (return-type "guint16") +) + +(define-function srv_target_list_sort + (c-name "g_srv_target_list_sort") + (return-type "GList*") + (parameters + '("GList*" "targets") + ) +) + + + +;; From gthemedicon.h + +(define-function themed_icon_get_type + (c-name "g_themed_icon_get_type") + (return-type "GType") +) + +(define-function themed_icon_new + (c-name "g_themed_icon_new") + (is-constructor-of "GThemedIcon") + (return-type "GIcon*") + (properties + '("name" (argname "iconname")) + ) +) + +(define-function themed_icon_new_with_default_fallbacks + (c-name "g_themed_icon_new_with_default_fallbacks") + (return-type "GIcon*") + (parameters + '("const-char*" "iconname") + ) +) + +(define-function themed_icon_new_from_names + (c-name "g_themed_icon_new_from_names") + (return-type "GIcon*") + (parameters + '("char**" "iconnames") + '("int" "len") + ) +) + +(define-method prepend_name + (of-object "GThemedIcon") + (c-name "g_themed_icon_prepend_name") + (return-type "none") + (parameters + '("const-char*" "iconname") + ) +) + +;; +;; wrapped in gicon.override +;; +(define-method get_names + (c-name "g_themed_icon_get_names") + (of-object "GThemedIcon") + (return-type "const-gchar*-const*") +) + +(define-method append_name + (c-name "g_themed_icon_append_name") + (of-object "GThemedIcon") + (return-type "none") + (parameters + '("char*" "iconname") + ) +) + + + +;; From gthreadedsocketservice.h + +(define-function threaded_socket_service_get_type + (c-name "g_threaded_socket_service_get_type") + (return-type "GType") +) + +(define-function threaded_socket_service_new + (c-name "g_threaded_socket_service_new") + (is-constructor-of "GThreadedSocketService") + (return-type "GSocketService*") + (parameters + '("int" "max_threads") + ) +) + + + +;; From gunixinputstream.h + +(define-function unix_input_stream_get_type + (c-name "g_unix_input_stream_get_type") + (return-type "GType") +) + +(define-function unix_input_stream_new + (c-name "g_unix_input_stream_new") + (is-constructor-of "GUnixInputStream") + (return-type "GInputStream*") + (parameters + '("int" "fd") + '("gboolean" "close_fd_at_close") + ) +) + + + +;; From gvfs.h + +(define-function vfs_get_type + (c-name "g_vfs_get_type") + (return-type "GType") +) + +(define-method is_active + (of-object "GVfs") + (c-name "g_vfs_is_active") + (return-type "gboolean") +) + +(define-method get_file_for_path + (of-object "GVfs") + (c-name "g_vfs_get_file_for_path") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("const-char*" "path") + ) +) + +(define-method get_file_for_uri + (of-object "GVfs") + (c-name "g_vfs_get_file_for_uri") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("const-char*" "uri") + ) +) + +(define-method parse_name + (of-object "GVfs") + (c-name "g_vfs_parse_name") + (return-type "GFile*") + (caller-owns-return #t) + (parameters + '("const-char*" "parse_name") + ) +) + +(define-function vfs_get_default + (c-name "g_vfs_get_default") + (return-type "GVfs*") +) + +(define-function vfs_get_local + (c-name "g_vfs_get_local") + (return-type "GVfs*") +) + +;; +;; wrapped in gio.override +;; +(define-method get_supported_uri_schemes + (docstring +"VFS.get_supported_uri_schemes() -> [uri, ..]\n" +"Gets a list of URI schemes supported by vfs.") + (of-object "GVfs") + (c-name "g_vfs_get_supported_uri_schemes") + (return-type "const-char*-const*") +) + + + +;; From gwin32appinfo.h + +(define-function win32_app_info_get_type + (c-name "g_win32_app_info_get_type") + (return-type "GType") +) + + + +;; From gvolume.h + +(define-function volume_get_type + (c-name "g_volume_get_type") + (return-type "GType") +) + +(define-method get_name + (of-object "GVolume") + (c-name "g_volume_get_name") + (return-type "char*") +) + +(define-method get_icon + (of-object "GVolume") + (c-name "g_volume_get_icon") + (return-type "GIcon*") + (caller-owns-return #t) +) + +(define-method get_uuid + (of-object "GVolume") + (c-name "g_volume_get_uuid") + (return-type "char*") +) + +(define-method get_drive + (of-object "GVolume") + (c-name "g_volume_get_drive") + (return-type "GDrive*") + (caller-owns-return #t) +) + +(define-method get_mount + (of-object "GVolume") + (c-name "g_volume_get_mount") + (return-type "GMount*") + (caller-owns-return #t) +) + +(define-method can_mount + (of-object "GVolume") + (c-name "g_volume_can_mount") + (return-type "gboolean") +) + +(define-method can_eject + (of-object "GVolume") + (c-name "g_volume_can_eject") + (return-type "gboolean") +) + +(define-method should_automount + (of-object "GVolume") + (c-name "g_volume_should_automount") + (return-type "gboolean") +) + +;; +;; wrapped in gvolume.override +;; +(define-method mount + (of-object "GVolume") + (c-name "g_volume_mount") + (return-type "none") + (parameters + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method mount_finish + (of-object "GVolume") + (c-name "g_volume_mount_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + +;; +;; wrapped in gvolume.override +;; +(define-method eject + (of-object "GVolume") + (c-name "g_volume_eject") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE")) + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method eject_finish + (of-object "GVolume") + (c-name "g_volume_eject_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) + (deprecated "use gio.Drive.eject_with_operation_finish instead.") +) + +(define-method get_identifier + (of-object "GVolume") + (c-name "g_volume_get_identifier") + (return-type "char*") + (parameters + '("const-char*" "kind") + ) +) + +;; +;; wrapped in gvolume.override +;; +(define-method enumerate_identifiers + (of-object "GVolume") + (c-name "g_volume_enumerate_identifiers") + (return-type "char**") +) + +(define-method get_activation_root + (of-object "GVolume") + (c-name "g_volume_get_activation_root") + (return-type "GFile*") +) + +(define-method eject_with_operation + (of-object "GVolume") + (c-name "g_volume_eject_with_operation") + (return-type "none") + (parameters + '("GMountUnmountFlags" "flags") + '("GMountOperation*" "mount_operation") + '("GCancellable*" "cancellable" (null-ok) (default "NULL")) + '("GAsyncReadyCallback" "callback") + '("gpointer" "user_data") + ) +) + +(define-method eject_with_operation_finish + (of-object "GVolume") + (c-name "g_volume_eject_with_operation_finish") + (return-type "gboolean") + (parameters + '("GAsyncResult*" "result") + '("GError**" "error") + ) +) + + + +;; From gvolumemonitor.h + +(define-function volume_monitor_get_type + (c-name "g_volume_monitor_get_type") + (return-type "GType") +) + +(define-function volume_monitor_get + (c-name "g_volume_monitor_get") + (return-type "GVolumeMonitor*") +) + +;; +;; wrapped in gvolumemonitor.override +;; +(define-method get_connected_drives + (of-object "GVolumeMonitor") + (c-name "g_volume_monitor_get_connected_drives") + (return-type "GList*") +) + +;; +;; wrapped in gvolumemonitor.override +;; +(define-method get_volumes + (of-object "GVolumeMonitor") + (c-name "g_volume_monitor_get_volumes") + (return-type "GList*") +) + +;; +;; wrapped in gvolumemonitor.override +;; +(define-method get_mounts + (of-object "GVolumeMonitor") + (c-name "g_volume_monitor_get_mounts") + (return-type "GList*") +) + +(define-method get_volume_for_uuid + (of-object "GVolumeMonitor") + (c-name "g_volume_monitor_get_volume_for_uuid") + (return-type "GVolume*") + (caller-owns-return #t) + (parameters + '("const-char*" "uuid") + ) +) + +(define-method get_mount_for_uuid + (of-object "GVolumeMonitor") + (c-name "g_volume_monitor_get_mount_for_uuid") + (return-type "GMount*") + (caller-owns-return #t) + (parameters + '("const-char*" "uuid") + ) +) + +(define-function volume_monitor_adopt_orphan_mount + (c-name "g_volume_monitor_adopt_orphan_mount") + (return-type "GVolume*") + (parameters + '("GMount*" "mount") + ) +) + diff --git a/gio/gio.override b/gio/gio.override new file mode 100644 index 0000000..6d001b9 --- /dev/null +++ b/gio/gio.override @@ -0,0 +1,404 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 2008 Johan Dahlin + * + * gio.override: module wrapping the GIO 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 + */ +%% +modulename gio +%% +import gobject.GObject as PyGObject_Type +import glib.PollFD as PyGPollFD_Type +%% +headers +#define NO_IMPORT_PYGOBJECT +#include +#include +#include "pygio-utils.h" +#include "pyglib.h" +#include "pygsource.h" + +#define BUFSIZE 8192 + +typedef struct _PyGIONotify PyGIONotify; + +struct _PyGIONotify { + gboolean referenced; + PyObject *callback; + PyObject *data; + gboolean attach_self; + gpointer buffer; + gsize buffer_size; + + /* If a structure has any 'slaves', those will reference their + * callbacks and be freed together with the 'master'. */ + PyGIONotify *slaves; +}; + +static GQuark +pygio_notify_get_internal_quark(void) +{ + static GQuark quark = 0; + if (!quark) + quark = g_quark_from_string("pygio::notify"); + return quark; +} + +static PyGIONotify * +pygio_notify_new(void) +{ + return g_slice_new0(PyGIONotify); +} + +static PyGIONotify * +pygio_notify_new_slave(PyGIONotify* master) +{ + PyGIONotify *slave = pygio_notify_new(); + + while (master->slaves) + master = master->slaves; + master->slaves = slave; + + return slave; +} + +static gboolean +pygio_notify_using_optional_callback(PyGIONotify *notify) +{ + if (notify->callback) + return TRUE; + else { + notify->data = NULL; + return FALSE; + } +} + +static gboolean +pygio_notify_callback_is_valid_full(PyGIONotify *notify, const gchar *name) +{ + if (!notify->callback) { + PyErr_SetString(PyExc_RuntimeError, "internal error: callback is not set"); + return FALSE; + } + + if (!PyCallable_Check(notify->callback)) { + gchar *error_message = g_strdup_printf("%s argument not callable", name); + + PyErr_SetString(PyExc_TypeError, error_message); + g_free(error_message); + return FALSE; + } + + return TRUE; +} + +static gboolean +pygio_notify_callback_is_valid(PyGIONotify *notify) +{ + return pygio_notify_callback_is_valid_full(notify, "callback"); +} + +static void +pygio_notify_reference_callback(PyGIONotify *notify) +{ + if (!notify->referenced) { + notify->referenced = TRUE; + Py_XINCREF(notify->callback); + Py_XINCREF(notify->data); + + if (notify->slaves) + pygio_notify_reference_callback(notify->slaves); + } +} + +static void +pygio_notify_copy_buffer(PyGIONotify *notify, gpointer buffer, gsize buffer_size) +{ + if (buffer_size > 0) { + notify->buffer = g_slice_copy(buffer_size, buffer); + notify->buffer_size = buffer_size; + } +} + +static gboolean +pygio_notify_allocate_buffer(PyGIONotify *notify, gsize buffer_size) +{ + if (buffer_size > 0) { + notify->buffer = g_slice_alloc(buffer_size); + if (!notify->buffer) { + PyErr_Format(PyExc_MemoryError, "failed to allocate %d bytes", buffer_size); + return FALSE; + } + + notify->buffer_size = buffer_size; + } + + return TRUE; +} + +static void +pygio_notify_attach_to_result(PyGIONotify *notify) +{ + notify->attach_self = TRUE; +} + +static PyGIONotify * +pygio_notify_get_attached(PyGObject *result) +{ + return g_object_get_qdata(G_OBJECT(result->obj), pygio_notify_get_internal_quark()); +} + +static void +pygio_notify_free(PyGIONotify *notify) +{ + if (notify) { + if (notify->slaves) + pygio_notify_free(notify->slaves); + + if (notify->referenced) { + PyGILState_STATE state; + + state = pyg_gil_state_ensure(); + Py_XDECREF(notify->callback); + Py_XDECREF(notify->data); + pyg_gil_state_release(state); + } + + if (notify->buffer) + g_slice_free1(notify->buffer_size, notify->buffer); + + g_slice_free(PyGIONotify, notify); + } +} + +static void +async_result_callback_marshal(GObject *source_object, + GAsyncResult *result, + PyGIONotify *notify) +{ + PyObject *ret; + PyGILState_STATE state; + + state = pyg_gil_state_ensure(); + + if (!notify->referenced) + g_warning("pygio_notify_reference_callback() hasn't been called before using the structure"); + + if (notify->attach_self) { + g_object_set_qdata_full(G_OBJECT(result), pygio_notify_get_internal_quark(), + notify, (GDestroyNotify) pygio_notify_free); + } + + if (notify->data) + ret = PyEval_CallFunction(notify->callback, "NNO", + pygobject_new(source_object), + pygobject_new((GObject *)result), + notify->data); + else + ret = PyObject_CallFunction(notify->callback, "NN", + pygobject_new(source_object), + pygobject_new((GObject *)result)); + + if (ret == NULL) { + PyErr_Print(); + PyErr_Clear(); + } + + Py_XDECREF(ret); + + /* Otherwise the structure is attached to 'result' and will be + * freed when that object dies. */ + if (!notify->attach_self) + pygio_notify_free(notify); + + pyg_gil_state_release(state); +} +%% +include + gappinfo.override + gapplaunchcontext.override + gbufferedinputstream.override + gcancellable.override + gdatainputstream.override + gdrive.override + gfile.override + gfileattribute.override + gfileenumerator.override + gfileinfo.override + gfileinputstream.override + gfileiostream.override + gfileoutputstream.override + gicon.override + giostream.override + gmemoryinputstream.override + gmemoryoutputstream.override + gmount.override + ginputstream.override + goutputstream.override + gresolver.override + gsocket.override + gvolume.override + gvolumemonitor.override +%% +ignore-glob + *_get_type + *free + *_ref + *_unref + g_async_result_get_user_data + g_file_new_from_commandline_arg + g_file_new_from_path + g_file_new_from_uri + g_file_hash + g_io_error_quark + g_simple_async_result_new_error + g_simple_async_report_error_in_idle + g_simple_async_result_set_op_res_gpointer + g_simple_async_result_get_op_res_gpointer + g_simple_async_result_get_source_tag + g_simple_async_result_run_in_thread + g_simple_async_result_set_from_error + g_simple_async_result_set_error + g_simple_async_result_set_error_va + g_io_module* + g_io_scheduler_* +%% +override g_app_info_get_all noargs +static PyObject * +_wrap_g_app_info_get_all (PyGObject *self) +{ + GList *list, *l; + PyObject *ret; + + list = g_app_info_get_all (); + + ret = PyList_New(0); + for (l = list; l; l = l->next) { + GObject *obj = l->data; + PyObject *item = pygobject_new(obj); + PyList_Append(ret, item); + Py_DECREF(item); + } + g_list_free(list); + + return ret; +} +%% +override g_app_info_get_all_for_type args +static PyObject * +_wrap_g_app_info_get_all_for_type (PyGObject *self, PyObject *args) +{ + GList *list, *l; + PyObject *ret; + gchar *type; + + if (!PyArg_ParseTuple (args, "s:app_info_get_all_for_type", &type)) + return NULL; + + list = g_app_info_get_all_for_type (type); + + ret = PyList_New(0); + for (l = list; l; l = l->next) { + GObject *obj = l->data; + PyObject *item = pygobject_new(obj); + PyList_Append(ret, item); + Py_DECREF(item); + } + g_list_free(list); + + return ret; +} +%% +override g_content_type_guess kwargs +static PyObject * +_wrap_g_content_type_guess(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + char *kwlist[] = {"filename", "data", "want_uncertain", NULL}; + char *filename = NULL, *data = NULL, *type; + int data_size = 0; + gboolean result_uncertain, want_uncertain = FALSE; + PyObject *ret; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, + "|zz#i:g_content_type_guess", + kwlist, + &filename, &data, &data_size, + &want_uncertain)) + return NULL; + + if (!filename && !data) { + PyErr_SetString(PyExc_TypeError, "need at least one argument"); + return NULL; + } + + type = g_content_type_guess(filename, (guchar *) data, + data_size, &result_uncertain); + + if (want_uncertain) { + ret = Py_BuildValue("zN", type, PyBool_FromLong(result_uncertain)); + + } else { + ret = PyString_FromString(type); + } + + g_free(type); + return ret; +} +%% +override g_vfs_get_supported_uri_schemes noargs +static PyObject * +_wrap_g_vfs_get_supported_uri_schemes(PyGObject *self) +{ + const char * const *names; + PyObject *ret; + + names = g_vfs_get_supported_uri_schemes(G_VFS(self->obj)); + + ret = PyList_New(0); + while (names && *names) { + PyObject *item = PyString_FromString(names[0]); + PyList_Append(ret, item); + Py_DECREF(item); + + names++; + } + + return ret; +} +%% +override g_content_types_get_registered noargs +static PyObject * +_wrap_g_content_types_get_registered(PyObject *self) +{ + GList *list, *l; + PyObject *ret; + + list = g_content_types_get_registered(); + + ret = PyList_New(0); + for (l = list; l; l = l->next) { + char *content_type = l->data; + PyObject *string = PyString_FromString(content_type); + PyList_Append(ret, string); + Py_DECREF(string); + g_free(content_type); + } + g_list_free(list); + + return ret; +} diff --git a/gio/giomodule.c b/gio/giomodule.c new file mode 100644 index 0000000..409aeef --- /dev/null +++ b/gio/giomodule.c @@ -0,0 +1,205 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * giomodule.c: module wrapping the GIO 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 "config.h" +#endif +#include +#include +#include + +#include + +#define PYGIO_MAJOR_VERSION PYGOBJECT_MAJOR_VERSION +#define PYGIO_MINOR_VERSION PYGOBJECT_MINOR_VERSION +#define PYGIO_MICRO_VERSION PYGOBJECT_MICRO_VERSION + +/* include any extra headers needed here */ + +void pygio_register_classes(PyObject *d); +void pygio_add_constants(PyObject *module, const gchar *strip_prefix); + +extern PyMethodDef pygio_functions[]; + +DL_EXPORT(void) +init_gio(void) +{ + PyObject *m, *d; + PyObject *tuple; + PyObject *e; + /* perform any initialisation required by the library here */ + + m = Py_InitModule("gio._gio", pygio_functions); + d = PyModule_GetDict(m); + + g_type_init(); + pyglib_init(); + + init_pygobject_check(2, 15, 2); + + pygio_register_classes(d); + pygio_add_constants(m, "G_IO_"); + + PyModule_AddStringConstant(m, "ERROR", g_quark_to_string(G_IO_ERROR)); + e = pyglib_register_exception_for_domain("gio.Error", G_IO_ERROR); + PyDict_SetItemString(d, "Error", e); + Py_DECREF(e); + + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_TYPE", + G_FILE_ATTRIBUTE_STANDARD_TYPE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_IS_HIDDEN", + G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_IS_BACKUP", + G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_IS_SYMLINK", + G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL", + G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_NAME", + G_FILE_ATTRIBUTE_STANDARD_NAME); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME", + G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_EDIT_NAME", + G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_COPY_NAME", + G_FILE_ATTRIBUTE_STANDARD_COPY_NAME); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_DESCRIPTION", + G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_ICON", + G_FILE_ATTRIBUTE_STANDARD_ICON); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE", + G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE", + G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_SIZE", + G_FILE_ATTRIBUTE_STANDARD_SIZE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET", + G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_TARGET_URI", + G_FILE_ATTRIBUTE_STANDARD_TARGET_URI); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_STANDARD_SORT_ORDER", + G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ETAG_VALUE", + G_FILE_ATTRIBUTE_ETAG_VALUE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ID_FILE", + G_FILE_ATTRIBUTE_ID_FILE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ID_FILESYSTEM", + G_FILE_ATTRIBUTE_ID_FILESYSTEM); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ACCESS_CAN_READ", + G_FILE_ATTRIBUTE_ACCESS_CAN_READ); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ACCESS_CAN_WRITE", + G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE", + G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ACCESS_CAN_DELETE", + G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ACCESS_CAN_TRASH", + G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_ACCESS_CAN_RENAME", + G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT", + G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT", + G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT", + G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE", + G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI", + G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TIME_MODIFIED", + G_FILE_ATTRIBUTE_TIME_MODIFIED); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TIME_MODIFIED_USEC", + G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TIME_ACCESS", + G_FILE_ATTRIBUTE_TIME_ACCESS); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TIME_ACCESS_USEC", + G_FILE_ATTRIBUTE_TIME_ACCESS_USEC); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TIME_CHANGED", + G_FILE_ATTRIBUTE_TIME_CHANGED); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TIME_CHANGED_USEC", + G_FILE_ATTRIBUTE_TIME_CHANGED_USEC); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TIME_CREATED", + G_FILE_ATTRIBUTE_TIME_CREATED); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TIME_CREATED_USEC", + G_FILE_ATTRIBUTE_TIME_CREATED_USEC); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_DEVICE", + G_FILE_ATTRIBUTE_UNIX_DEVICE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_INODE", + G_FILE_ATTRIBUTE_UNIX_INODE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_MODE", + G_FILE_ATTRIBUTE_UNIX_MODE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_NLINK", + G_FILE_ATTRIBUTE_UNIX_NLINK); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_UID", + G_FILE_ATTRIBUTE_UNIX_UID); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_GID", + G_FILE_ATTRIBUTE_UNIX_GID); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_RDEV", + G_FILE_ATTRIBUTE_UNIX_RDEV); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_BLOCK_SIZE", + G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_BLOCKS", + G_FILE_ATTRIBUTE_UNIX_BLOCKS); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT", + G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_DOS_IS_ARCHIVE", + G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_DOS_IS_SYSTEM", + G_FILE_ATTRIBUTE_DOS_IS_SYSTEM); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_OWNER_USER", + G_FILE_ATTRIBUTE_OWNER_USER); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_OWNER_USER_REAL", + G_FILE_ATTRIBUTE_OWNER_USER_REAL); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_OWNER_GROUP", + G_FILE_ATTRIBUTE_OWNER_GROUP); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_THUMBNAIL_PATH", + G_FILE_ATTRIBUTE_THUMBNAIL_PATH); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_THUMBNAILING_FAILED", + G_FILE_ATTRIBUTE_THUMBNAILING_FAILED); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_FILESYSTEM_SIZE", + G_FILE_ATTRIBUTE_FILESYSTEM_SIZE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_FILESYSTEM_FREE", + G_FILE_ATTRIBUTE_FILESYSTEM_FREE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_FILESYSTEM_TYPE", + G_FILE_ATTRIBUTE_FILESYSTEM_TYPE); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_FILESYSTEM_READONLY", + G_FILE_ATTRIBUTE_FILESYSTEM_READONLY); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW", + G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_GVFS_BACKEND", + G_FILE_ATTRIBUTE_GVFS_BACKEND); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_SELINUX_CONTEXT", + G_FILE_ATTRIBUTE_SELINUX_CONTEXT); + PyModule_AddStringConstant(m, "FILE_ATTRIBUTE_TRASH_ITEM_COUNT", + G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT); + + PyModule_AddStringConstant(m, "ERROR", g_quark_to_string(G_IO_ERROR)); + + /* pygio version */ + tuple = Py_BuildValue ("(iii)", + PYGIO_MAJOR_VERSION, + PYGIO_MINOR_VERSION, + PYGIO_MICRO_VERSION); + PyDict_SetItemString(d, "pygio_version", tuple); + Py_DECREF(tuple); +} + diff --git a/gio/giostream.override b/gio/giostream.override new file mode 100644 index 0000000..29ec801 --- /dev/null +++ b/gio/giostream.override @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * giostream.override: module overrides for GIOStream + * + * 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 + */ + +%% +override g_io_stream_close_async kwargs +static PyObject * +_wrap_g_io_stream_close_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", "cancellable", + "user_data", NULL }; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:IOStream.close_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_io_stream_close_async(G_IO_STREAM(self->obj), + io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gmemoryinputstream.override b/gio/gmemoryinputstream.override new file mode 100644 index 0000000..0495338 --- /dev/null +++ b/gio/gmemoryinputstream.override @@ -0,0 +1,91 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gmemoryinputstream.override: module overrides for GMemoryInputStream + * + * 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 + */ +%% +override g_memory_input_stream_add_data kwargs +static PyObject * +_wrap_g_memory_input_stream_add_data(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "data", NULL }; + PyObject *data; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:gio.MemoryInputStream.add_data", + kwlist, &data)) + return NULL; + + if (data != Py_None) { + char *copy; + int length; + + if (!PyString_Check(data)) { + PyErr_SetString(PyExc_TypeError, "data must be a string or None"); + return NULL; + } + + length = PyString_Size(data); + copy = g_malloc(length); + memcpy(copy, PyString_AsString(data), length); + + g_memory_input_stream_add_data(G_MEMORY_INPUT_STREAM(self->obj), + copy, length, (GDestroyNotify) g_free); + } + + Py_INCREF(Py_None); + return Py_None; +} +%% +override g_memory_input_stream_new_from_data kwargs +static PyObject * +_wrap_g_memory_input_stream_new_from_data(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "data", NULL }; + PyObject *data; + GInputStream *stream = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O:gio.memory_input_stream_new_from_data", + kwlist, &data)) + return NULL; + + if (data != Py_None) { + char *copy; + int length; + + if (!PyString_Check(data)) { + PyErr_SetString(PyExc_TypeError, "data must be a string or None"); + return NULL; + } + + length = PyString_Size(data); + copy = g_malloc(length); + memcpy(copy, PyString_AsString(data), length); + + stream = g_memory_input_stream_new_from_data(copy, length, + (GDestroyNotify) g_free); + } + + return pygobject_new((GObject *)stream); +} diff --git a/gio/gmemoryoutputstream.override b/gio/gmemoryoutputstream.override new file mode 100644 index 0000000..7614045 --- /dev/null +++ b/gio/gmemoryoutputstream.override @@ -0,0 +1,45 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * gmemoryoutputstream.override: module overrides for GMemoryOutputStream + * + * 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 + */ +%% +override g_memory_output_stream_new noargs +static int +_wrap_g_memory_output_stream_new(PyGObject *self) +{ + self->obj = (GObject *)g_memory_output_stream_new(NULL, 0, g_realloc, g_free); + + if (!self->obj) { + PyErr_SetString(PyExc_RuntimeError, "could not create gio.MemoryOutputStream object"); + return -1; + } + + pygobject_register_wrapper((PyObject *)self); + return 0; +} +%% +override g_memory_output_stream_get_data noargs +static PyObject * +_wrap_g_memory_output_stream_get_data(PyGObject *self) +{ + GMemoryOutputStream *stream = G_MEMORY_OUTPUT_STREAM(self->obj); + return PyString_FromStringAndSize(g_memory_output_stream_get_data(stream), + g_seekable_tell(G_SEEKABLE(stream))); +} diff --git a/gio/gmount.override b/gio/gmount.override new file mode 100644 index 0000000..9fb0828 --- /dev/null +++ b/gio/gmount.override @@ -0,0 +1,454 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gmount.override: module overrides for GMount + * + * 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 + */ +%% +override g_mount_guess_content_type kwargs +static PyObject * +_wrap_g_mount_guess_content_type(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "force_rescan", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + gboolean force_rescan; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "Oi|OO:Mount.guess_content_type", + kwlist, + ¬ify->callback, + &force_rescan, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_mount_guess_content_type(G_MOUNT(self->obj), + force_rescan, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_mount_guess_content_type_finish kwargs +static PyObject * +_wrap_g_mount_guess_content_type_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *result; + GError *error = NULL; + char **ret; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:Mount.guess_content_type_finish", + kwlist, + &PyGAsyncResult_Type, + &result)) + return NULL; + + ret = g_mount_guess_content_type_finish(G_MOUNT(self->obj), + G_ASYNC_RESULT(result->obj), &error); + + if (pyg_error_check(&error)) + return NULL; + + if (ret && ret[0] != NULL) { + py_ret = strv_to_pylist(ret); + g_strfreev (ret); + } else { + py_ret = Py_None; + Py_INCREF(py_ret); + } + return py_ret; +} +%% +override g_mount_guess_content_type_sync kwargs +static PyObject * +_wrap_g_mount_guess_content_type_sync(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "force_rescan", "cancellable", NULL }; + gboolean force_rescan; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + GError *error = NULL; + char **ret; + PyObject *py_ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "i|O:Mount.guess_content_type_sync", + kwlist, + &force_rescan, + &py_cancellable)) + return NULL; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + return NULL; + + ret = g_mount_guess_content_type_sync(G_MOUNT(self->obj), force_rescan, + cancellable, &error); + + if (pyg_error_check(&error)) + return NULL; + + if (ret && ret[0] != NULL) { + py_ret = strv_to_pylist(ret); + g_strfreev (ret); + } else { + py_ret = Py_None; + Py_INCREF(py_ret); + } + return py_ret; +} +%% +override g_mount_remount kwargs +static PyObject * +_wrap_g_mount_remount(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + PyObject *py_mount_operation = Py_None; + GMountOperation *mount_operation = NULL; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:gio.Mount.remount", + kwlist, + ¬ify->callback, + &py_flags, + &py_mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_mount_operation != Py_None) { + if (!pygobject_check(py_mount_operation, &PyGMountOperation_Type)) { + PyErr_SetString(PyExc_TypeError, + "mount_operation must be a gio.MountOperation or None"); + goto error; + } + + mount_operation = G_MOUNT_OPERATION(pygobject_get(py_mount_operation)); + } + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + pyg_begin_allow_threads; + + g_mount_remount(G_MOUNT(self->obj), + flags, + mount_operation, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + pyg_end_allow_threads; + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_mount_unmount kwargs +static PyObject * +_wrap_g_mount_unmount(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *py_cancellable = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOO:gio.Mount.unmount", + kwlist, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + pyg_begin_allow_threads; + + g_mount_unmount(G_MOUNT(self->obj), + flags, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + pyg_end_allow_threads; + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_mount_eject kwargs +static PyObject * +_wrap_g_mount_eject(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOO:gio.Mount.eject", + kwlist, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer) &flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + pyg_begin_allow_threads; + + g_mount_eject(G_MOUNT(self->obj), + flags, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + pyg_end_allow_threads; + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override-slot GMount.tp_repr +static PyObject * +_wrap_g_mount_tp_repr(PyGObject *self) +{ + char *name = g_mount_get_name(G_MOUNT(self->obj)); + char *uuid = g_mount_get_uuid(G_MOUNT(self->obj)); + gchar *representation; + PyObject *result; + + if (name) { + if (uuid) { + representation = g_strdup_printf("<%s at %p: %s (%s)>", + self->ob_type->tp_name, self, name, uuid); + } + else { + representation = g_strdup_printf("<%s at %p: %s>", + self->ob_type->tp_name, self, name); + } + } + else + representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self); + + g_free(name); + g_free(uuid); + + result = PyString_FromString(representation); + g_free(representation); + return result; +} +%% +override g_mount_unmount_with_operation kwargs +static PyObject * +_wrap_g_mount_unmount_with_operation(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + PyGObject *py_cancellable = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:gio.Mount.unmount_with_operation", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_mount_unmount_with_operation(G_MOUNT(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_mount_eject_with_operation kwargs +static PyObject * +_wrap_g_mount_eject_with_operation(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + PyGObject *py_cancellable = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:gio.Mount.eject_with_operation", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_mount_eject_with_operation(G_MOUNT(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/goutputstream.override b/gio/goutputstream.override new file mode 100644 index 0000000..337a84c --- /dev/null +++ b/gio/goutputstream.override @@ -0,0 +1,292 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * goutputstream.override: module overrides for GOutputStream + * + * 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 + */ +%% +override g_output_stream_write kwargs +static PyObject * +_wrap_g_output_stream_write(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "buffer", "cancellable", NULL }; + PyGObject *pycancellable = NULL; + gchar *buffer; + long count = 0; + GCancellable *cancellable; + GError *error = NULL; + gssize written; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s#|O!:OutputStream.write", + kwlist, &buffer, &count, + &PyGCancellable_Type, &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + pyg_begin_allow_threads; + written = g_output_stream_write(G_OUTPUT_STREAM(self->obj), + buffer, count, cancellable, &error); + pyg_end_allow_threads; + + if (pyg_error_check(&error)) + return NULL; + + return PyInt_FromLong(written); +} +%% +override g_output_stream_write_all kwargs +static PyObject * +_wrap_g_output_stream_write_all(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "buffer", "cancellable", NULL }; + PyGObject *pycancellable = NULL; + gchar *buffer; + long count = 0; + GCancellable *cancellable; + GError *error = NULL; + gsize written; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s#|O!:OutputStream.write", + kwlist, &buffer, &count, + &PyGCancellable_Type, &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + pyg_begin_allow_threads; + g_output_stream_write_all(G_OUTPUT_STREAM(self->obj), + buffer, count, &written, cancellable, &error); + pyg_end_allow_threads; + + if (pyg_error_check(&error)) + return NULL; + + return PyInt_FromLong(written); +} +%% +override g_output_stream_write_async kwargs +static PyObject * +_wrap_g_output_stream_write_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "buffer", "callback", "io_priority", "cancellable", + "user_data", NULL }; + gchar *buffer; + long count = -1; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s#O|iOO:OutputStream.write_async", + kwlist, &buffer, + &count, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + pygio_notify_copy_buffer(notify, buffer, count); + + g_output_stream_write_async(G_OUTPUT_STREAM(self->obj), + notify->buffer, + notify->buffer_size, + io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_output_stream_close_async kwargs +static PyObject * +_wrap_g_output_stream_close_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", + "cancellable", "user_data", NULL }; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:OutputStream.close_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_output_stream_close_async(G_OUTPUT_STREAM(self->obj), + io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_output_stream_flush_async kwargs +static PyObject * +_wrap_g_output_stream_flush_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "io_priority", + "cancellable", "user_data", NULL }; + int io_priority = G_PRIORITY_DEFAULT; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|iOO:OutputStream.flush_async", + kwlist, + ¬ify->callback, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_output_stream_flush_async(G_OUTPUT_STREAM(self->obj), + io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_output_stream_splice_async kwargs +static PyObject * +_wrap_g_output_stream_splice_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "source", "callback", "flags", "io_priority", + "cancellable", "user_data", NULL }; + + int io_priority = G_PRIORITY_DEFAULT; + GOutputStreamSpliceFlags flags = G_OUTPUT_STREAM_SPLICE_NONE; + PyObject *py_flags = NULL; + PyGObject *source; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + PyGIONotify *notify; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!O|OiOO:OutputStream.splice_async", + kwlist, + &PyGInputStream_Type, + &source, + ¬ify->callback, + &py_flags, + &io_priority, + &pycancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_output_stream_splice_async(G_OUTPUT_STREAM(self->obj), + G_INPUT_STREAM(source->obj), flags, io_priority, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} + +/* GOutputStream.write_all: No ArgType for const-void* */ diff --git a/gio/gresolver.override b/gio/gresolver.override new file mode 100644 index 0000000..ddde73b --- /dev/null +++ b/gio/gresolver.override @@ -0,0 +1,312 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gresolver.override: module overrides for GResolver + * + * 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 + */ +%% +override g_resolver_lookup_by_name kwargs +static PyObject * +_wrap_g_resolver_lookup_by_name(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "hostname", "cancellable", NULL }; + gchar *hostname; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + GList *addr; + GError *error = NULL; + PyObject *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s|O:gio.Resolver.lookup_by_name", + kwlist, + &hostname, + &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + addr = g_resolver_lookup_by_name(G_RESOLVER(self->obj), + hostname, cancellable, &error); + + if (addr) { + PYLIST_FROMGLIST(ret, addr, pygobject_new(list_item), g_resolver_free_addresses, NULL); + return ret; + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +%% +override g_resolver_lookup_by_name_async kwargs +static PyObject * +_wrap_g_resolver_lookup_by_name_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "hostname", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + gchar *hostname; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "Os|OO:gio.Resolver.lookup_by_name_async", + kwlist, + ¬ify->callback, + &hostname, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_resolver_lookup_by_name_async(G_RESOLVER(self->obj), + hostname, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_resolver_lookup_by_name_finish kwargs +static PyObject * +_wrap_g_resolver_lookup_by_name_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *result; + GList *addr; + PyObject *ret; + GError *error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:gio.Resolver.lookup_by_name_finish", + kwlist, + &PyGAsyncResult_Type, + &result)) + return NULL; + + addr = g_resolver_lookup_by_name_finish(G_RESOLVER(self->obj), + G_ASYNC_RESULT(result->obj), + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (addr) { + PYLIST_FROMGLIST(ret, addr, pygobject_new(list_item), + g_resolver_free_addresses, NULL); + return ret; + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +%% +override g_resolver_lookup_by_address_async kwargs +static PyObject * +_wrap_g_resolver_lookup_by_address_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "address", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *address; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "OO|OO:gio.Resolver.lookup_by_address_async", + kwlist, + ¬ify->callback, + &address, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_resolver_lookup_by_address_async(G_RESOLVER(self->obj), + G_INET_ADDRESS(address->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_resolver_lookup_service kwargs +static PyObject * +_wrap_g_resolver_lookup_service(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "service", "protocol", + "domain", "cancellable", NULL }; + gchar *service, *protocol, *domain; + PyGObject *pycancellable = NULL; + GCancellable *cancellable; + GList *targets; + GError *error = NULL; + PyObject *ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sss|O:gio.Resolver.lookup_service", + kwlist, + &service, + &protocol, + &domain, + &pycancellable)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + targets = g_resolver_lookup_service(G_RESOLVER(self->obj), + service, protocol, domain, + cancellable, &error); + + if (targets) { + PYLIST_FROMGLIST(ret, targets, + pyg_boxed_new(G_TYPE_SRV_TARGET, list_item, TRUE, TRUE), + g_resolver_free_targets, NULL); + return ret; + } else { + Py_INCREF(Py_None); + return Py_None; + } +} +%% +override g_resolver_lookup_service_async kwargs +static PyObject * +_wrap_g_resolver_lookup_service_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "service", "protocol", "domain", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + gchar *service, *protocol, *domain; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "Osss|OO:gio.Resolver.lookup_service_async", + kwlist, + ¬ify->callback, + &service, + &protocol, + &domain, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_resolver_lookup_service_async(G_RESOLVER(self->obj), + service, protocol, domain, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_resolver_lookup_service_finish kwargs +static PyObject * +_wrap_g_resolver_lookup_service_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + PyGObject *result; + GList *targets; + PyObject *ret; + GError *error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:gio.Resolver.lookup_service_finish", + kwlist, + &PyGAsyncResult_Type, + &result)) + return NULL; + + targets = g_resolver_lookup_service_finish(G_RESOLVER(self->obj), + G_ASYNC_RESULT(result->obj), + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (targets) { + PYLIST_FROMGLIST(ret, targets, + pyg_boxed_new(G_TYPE_SRV_TARGET, list_item, TRUE, TRUE), + g_resolver_free_targets, NULL); + return ret; + } else { + Py_INCREF(Py_None); + return Py_None; + } +} diff --git a/gio/gsocket.override b/gio/gsocket.override new file mode 100644 index 0000000..8f66653 --- /dev/null +++ b/gio/gsocket.override @@ -0,0 +1,575 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2009 Gian Mario Tagliaretti + * + * gsocket.override: module overrides for GSocket and related 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +%% +override g_socket_condition_check kwargs +static PyObject * +_wrap_g_socket_condition_check(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "condition", NULL }; + gint condition, ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "i:gio.Socket.condition_check", + kwlist, &condition)) + return NULL; + + ret = g_socket_condition_check(G_SOCKET(self->obj), condition); + + return pyg_flags_from_gtype(G_TYPE_IO_CONDITION, ret); +} +%% +override g_socket_condition_wait kwargs +static PyObject * +_wrap_g_socket_condition_wait(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "condition", "cancellable", NULL }; + gboolean ret; + gint condition; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + GError *error; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "i|O:gio.Socket.condition_wait", + kwlist, &condition, &cancellable)) + return NULL; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + return NULL; + + ret = g_socket_condition_wait(G_SOCKET(self->obj), condition, + cancellable, &error); + + return PyBool_FromLong(ret); +} +%% +override g_socket_address_enumerator_next_async kwargs +static PyObject * +_wrap_g_socket_address_enumerator_next_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OO:gio.SocketAddressEnumerator.next_async", + kwlist, + ¬ify->callback, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_socket_address_enumerator_next_async(G_SOCKET_ADDRESS_ENUMERATOR(self->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_socket_client_connect_async kwargs +static PyObject * +_wrap_g_socket_client_connect_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "connectable", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + PyGObject *py_connectable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "OO|OO:gio.SocketClient.connect_async", + kwlist, + ¬ify->callback, + &py_connectable, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_socket_client_connect_async(G_SOCKET_CLIENT(self->obj), + G_SOCKET_CONNECTABLE(py_connectable->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_socket_client_connect_to_host_async kwargs +static PyObject * +_wrap_g_socket_client_connect_to_host_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "host_and_port", "default_port", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + gchar *host_and_port; + guint16 default_port; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "OsH|OO:gio.SocketClient.connect_to_host_async", + kwlist, + ¬ify->callback, + &host_and_port, + &default_port, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_socket_client_connect_to_host_async(G_SOCKET_CLIENT(self->obj), + host_and_port, default_port, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_socket_client_connect_to_service_async kwargs +static PyObject * +_wrap_g_socket_client_connect_to_service_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "domain", "service", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + gchar *domain, *service; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "Oss|OO:gio.SocketClient.connect_to_service_async", + kwlist, + ¬ify->callback, + &domain, + &service, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_socket_client_connect_to_service_async(G_SOCKET_CLIENT(self->obj), + domain, service, + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_socket_listener_add_address kwargs +static PyObject * +_wrap_g_socket_listener_add_address(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "address", "type", "protocol", + "source_object", NULL }; + GSocketProtocol protocol; + PyObject *py_type = NULL, *py_protocol = NULL; + GError *error = NULL; + gboolean ret; + GSocketType type; + GSocketAddress *effective_address; + PyGObject *address, *py_source_object = NULL; + GObject *source_object; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!OO|O!:gio.SocketListener.add_address", + kwlist, + &PyGSocketAddress_Type, &address, + &py_type, &py_protocol, + &PyGObject_Type, &source_object, + &PyGSocketAddress_Type, &effective_address)) + return NULL; + + if (pyg_enum_get_value(G_TYPE_SOCKET_TYPE, py_type, (gpointer)&type)) + return NULL; + + if (pyg_enum_get_value(G_TYPE_SOCKET_PROTOCOL, py_protocol, (gpointer)&protocol)) + return NULL; + + if (py_source_object == NULL || (PyObject*)py_source_object == Py_None) + source_object = NULL; + else if (pygobject_check(py_source_object, &PyGObject_Type)) + source_object = G_OBJECT(py_source_object->obj); + else { + PyErr_SetString(PyExc_TypeError, "source_object should be a gobject.GObject or None"); + return NULL; + } + + ret = g_socket_listener_add_address(G_SOCKET_LISTENER(self->obj), + G_SOCKET_ADDRESS(address->obj), + type, protocol, + source_object, + &effective_address, + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (ret) + return pygobject_new((GObject *)effective_address); + else { + Py_INCREF(Py_None); + return Py_None; + } +} +%% +override g_socket_listener_accept kwargs +static PyObject * +_wrap_g_socket_listener_accept(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "cancellable", NULL }; + GError *error = NULL; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + PyObject *py_connection, *py_source_object; + GObject *source_object; + GSocketConnection *connection; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"|O:gio.SocketListener.accept", + kwlist, + &py_cancellable)) + return NULL; + + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + return NULL; + + connection = g_socket_listener_accept(G_SOCKET_LISTENER(self->obj), + &source_object, + cancellable, + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (connection) + py_connection = pygobject_new((GObject *)connection); + else { + py_connection = Py_None; + Py_INCREF(py_connection); + } + + if (source_object) + py_source_object = pygobject_new((GObject *)source_object); + else { + py_source_object= Py_None; + Py_INCREF(py_source_object); + } + return Py_BuildValue("(NN)", py_connection, py_source_object); +} +%% +override g_socket_listener_accept_async kwargs +static PyObject * +_wrap_g_socket_listener_accept_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OO:gio.SocketListener.accept_async", + kwlist, + ¬ify->callback, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_socket_listener_accept_async(G_SOCKET_LISTENER(self->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_socket_listener_accept_finish kwargs +static PyObject * +_wrap_g_socket_listener_accept_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + GError *error = NULL; + PyGObject *result; + PyObject *py_connection, *py_source_object; + GObject *source_object; + GSocketConnection *connection; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:gio.SocketListener.accept_finish", + kwlist, + &PyGAsyncResult_Type, &result)) + return NULL; + + connection = g_socket_listener_accept_finish(G_SOCKET_LISTENER(self->obj), + G_ASYNC_RESULT(result->obj), + &source_object, + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (connection) + py_connection = pygobject_new((GObject *)connection); + else { + py_connection = Py_None; + Py_INCREF(py_connection); + } + + if (source_object) + py_source_object = pygobject_new((GObject *)source_object); + else { + py_source_object= Py_None; + Py_INCREF(py_source_object); + } + return Py_BuildValue("(NN)", py_connection, py_source_object); +} +%% +override g_socket_listener_accept_socket kwargs +static PyObject * +_wrap_g_socket_listener_accept_socket(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "cancellable", NULL }; + GError *error = NULL; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + PyObject *py_socket, *py_source_object; + GObject *source_object; + GSocket *socket; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"|O:gio.SocketListener.accept_socket", + kwlist, + &py_cancellable)) + return NULL; + + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + return NULL; + + socket = g_socket_listener_accept_socket(G_SOCKET_LISTENER(self->obj), + &source_object, + cancellable, + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (socket) + py_socket = pygobject_new((GObject *)socket); + else { + py_socket = Py_None; + Py_INCREF(py_socket); + } + + if (source_object) + py_source_object = pygobject_new((GObject *)source_object); + else { + py_source_object= Py_None; + Py_INCREF(py_source_object); + } + return Py_BuildValue("(NN)", py_socket, py_source_object); +} +%% +override g_socket_listener_accept_socket_async kwargs +static PyObject * +_wrap_g_socket_listener_accept_socket_async(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyGObject *py_cancellable = NULL; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OO:gio.SocketListener.accept_socket_async", + kwlist, + ¬ify->callback, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_socket_listener_accept_socket_async(G_SOCKET_LISTENER(self->obj), + cancellable, + (GAsyncReadyCallback) async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_socket_listener_accept_socket_finish kwargs +static PyObject * +_wrap_g_socket_listener_accept_socket_finish(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "result", NULL }; + GError *error = NULL; + PyGObject *result; + PyObject *py_socket, *py_source_object; + GObject *source_object; + GSocket *socket; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:gio.SocketListener.accept_socket_finish", + kwlist, + &PyGAsyncResult_Type, &result)) + return NULL; + + socket = g_socket_listener_accept_socket_finish(G_SOCKET_LISTENER(self->obj), + G_ASYNC_RESULT(result->obj), + &source_object, + &error); + + if (pyg_error_check(&error)) + return NULL; + + if (socket) + py_socket = pygobject_new((GObject *)socket); + else { + py_socket= Py_None; + Py_INCREF(py_socket); + } + + if (source_object) + py_source_object = pygobject_new((GObject *)source_object); + else { + py_source_object= Py_None; + Py_INCREF(py_source_object); + } + return Py_BuildValue("(NN)", py_socket, py_source_object); +} + +/* Could not write method GSocketAddress.to_native: No ArgType for gpointer */ +/* Could not write method GSocket.receive_from: No ArgType for GSocketAddress** */ +/* Could not write method GSocket.receive_message: No ArgType for GSocketAddress** */ +/* Could not write method GSocket.send_message: No ArgType for GOutputVector* */ +/* Could not write method GSocket.create_source: No ArgType for GIOCondition */ +/* Could not write method GSocketControlMessage.serialize: No ArgType for gpointer */ +/* Could not write function socket_address_new_from_native: No ArgType for gpointer */ +/* Could not write function socket_control_message_deserialize: No ArgType for gpointer */ diff --git a/gio/gvolume.override b/gio/gvolume.override new file mode 100644 index 0000000..89c27e4 --- /dev/null +++ b/gio/gvolume.override @@ -0,0 +1,237 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * gvolume.override: module overrides for GVolume + * + * 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 + */ +%% +override g_volume_mount kwargs +static PyObject * +_wrap_g_volume_mount(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "mount_operation", "callback", "flags", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *py_mount_operation = NULL; + GMountOperation *mount_operation = NULL; + PyGObject *py_cancellable = NULL; + GMountMountFlags flags = G_MOUNT_MOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "OO|OOO:Volume.mount", + kwlist, + &py_mount_operation, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if ((PyObject *)py_mount_operation == Py_None) + mount_operation = NULL; + + else if (py_mount_operation && pygobject_check(py_mount_operation, + &PyGMountOperation_Type)) + mount_operation = G_MOUNT_OPERATION(py_mount_operation->obj); + + else if (py_mount_operation) { + PyErr_SetString(PyExc_TypeError, + "mount_operation should be a GMountOperation or None"); + return NULL; + } + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_volume_mount(G_VOLUME(self->obj), + flags, + mount_operation, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override g_volume_eject kwargs +static PyObject * +_wrap_g_volume_eject(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *py_cancellable = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOO:Volume.eject", + kwlist, + ¬ify->callback, + &py_flags, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_volume_eject(G_VOLUME(self->obj), + flags, + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} +%% +override-slot GVolume.tp_repr +static PyObject * +_wrap_g_volume_tp_repr(PyGObject *self) +{ + char *name = g_volume_get_name(G_VOLUME(self->obj)); + gchar *representation; + PyObject *result; + + if (name) { + representation = g_strdup_printf("<%s at %p: %s>", self->ob_type->tp_name, self, name); + g_free(name); + } + else + representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self); + + result = PyString_FromString(representation); + g_free(representation); + return result; +} +%% +override g_volume_enumerate_identifiers noargs +static PyObject * +_wrap_g_volume_enumerate_identifiers (PyGObject *self) +{ + char **ids; + PyObject *ret; + + pyg_begin_allow_threads; + + ids = g_volume_enumerate_identifiers(G_VOLUME (self->obj)); + + pyg_end_allow_threads; + + if (ids && ids[0] != NULL) { + ret = strv_to_pylist(ids); + g_strfreev (ids); + } else { + ret = Py_None; + Py_INCREF(ret); + } + return ret; +} +%% +override g_volume_eject_with_operation kwargs +static PyObject * +_wrap_g_volume_eject_with_operation(PyGObject *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "mount_operation", + "cancellable", "user_data", NULL }; + PyGIONotify *notify; + PyObject *py_flags = NULL; + PyGObject *mount_operation; + PyGObject *py_cancellable = NULL; + GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE; + GCancellable *cancellable; + + notify = pygio_notify_new(); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OOOO:gio.Volume.eject_with_operation", + kwlist, + ¬ify->callback, + &py_flags, + &mount_operation, + &py_cancellable, + ¬ify->data)) + goto error; + + if (!pygio_notify_callback_is_valid(notify)) + goto error; + + if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS, + py_flags, (gpointer)&flags)) + goto error; + + if (!pygio_check_cancellable(py_cancellable, &cancellable)) + goto error; + + pygio_notify_reference_callback(notify); + + g_volume_eject_with_operation(G_VOLUME(self->obj), + flags, + G_MOUNT_OPERATION(mount_operation->obj), + cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; + + error: + pygio_notify_free(notify); + return NULL; +} diff --git a/gio/gvolumemonitor.override b/gio/gvolumemonitor.override new file mode 100644 index 0000000..4ffedf3 --- /dev/null +++ b/gio/gvolumemonitor.override @@ -0,0 +1,94 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * gvolumemonitor.override: module overrides for GVolumeMonitor + * + * 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 + */ +%% +override-slot GVolumeMonitor.tp_new +static PyObject * +_wrap_g_volume_monitor_tp_new(PyObject *type, PyObject *args, PyObject *kwargs) +{ + return pygobject_new(G_OBJECT(g_volume_monitor_get())); +} +%% +override g_volume_monitor_get_connected_drives noargs +static PyObject * +_wrap_g_volume_monitor_get_connected_drives (PyGObject *self) +{ + GList *list, *l; + PyObject *ret; + + list = g_volume_monitor_get_connected_drives (G_VOLUME_MONITOR (self->obj)); + + ret = PyList_New(0); + for (l = list; l; l = l->next) { + GDrive *drive = l->data; + PyObject *item = pygobject_new((GObject *)drive); + PyList_Append(ret, item); + Py_DECREF(item); + g_object_unref(drive); + } + g_list_free(list); + + return ret; +} +%% +override g_volume_monitor_get_volumes noargs +static PyObject * +_wrap_g_volume_monitor_get_volumes (PyGObject *self) +{ + GList *list, *l; + PyObject *ret; + + list = g_volume_monitor_get_volumes (G_VOLUME_MONITOR (self->obj)); + + ret = PyList_New(0); + for (l = list; l; l = l->next) { + GVolume *volume = l->data; + PyObject *item = pygobject_new((GObject *)volume); + PyList_Append(ret, item); + Py_DECREF(item); + g_object_unref(volume); + } + g_list_free(list); + + return ret; +} +%% +override g_volume_monitor_get_mounts noargs +static PyObject * +_wrap_g_volume_monitor_get_mounts (PyGObject *self) +{ + GList *list, *l; + PyObject *ret; + + list = g_volume_monitor_get_mounts (G_VOLUME_MONITOR (self->obj)); + + ret = PyList_New(0); + for (l = list; l; l = l->next) { + GMount *mount = l->data; + PyObject *item = pygobject_new((GObject *)mount); + PyList_Append(ret, item); + Py_DECREF(item); + g_object_unref(mount); + } + g_list_free(list); + + return ret; +} diff --git a/gio/pygio-utils.c b/gio/pygio-utils.c new file mode 100644 index 0000000..be41453 --- /dev/null +++ b/gio/pygio-utils.c @@ -0,0 +1,208 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 2008 Johan Dahlin + * Copyright (C) 2008 Gian Mario Tagliaretti + * + * giomodule.c: module wrapping the GIO 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 + */ + +#include "pygio-utils.h" + +/** + * pygio_check_cancellable: + * @pycancellable: + * @cancellable: + * + * Returns: + */ +gboolean +pygio_check_cancellable(PyGObject *pycancellable, + GCancellable **cancellable) +{ + if (pycancellable == NULL || (PyObject*)pycancellable == Py_None) + *cancellable = NULL; + else if (pygobject_check(pycancellable, &PyGCancellable_Type)) + *cancellable = G_CANCELLABLE(pycancellable->obj); + else + { + PyErr_SetString(PyExc_TypeError, + "cancellable should be a gio.Cancellable"); + return FALSE; + } + return TRUE; +} + +/** + * pygio_check_launch_context: + * @pycontext: + * @context: + * + * Returns: + */ +gboolean +pygio_check_launch_context(PyGObject *pycontext, + GAppLaunchContext **context) +{ + if (pycontext == NULL || (PyObject*)pycontext == Py_None) + *context = NULL; + else if (pygobject_check(pycontext, &PyGAppLaunchContext_Type)) + *context = G_APP_LAUNCH_CONTEXT(pycontext->obj); + else + { + PyErr_SetString(PyExc_TypeError, + "launch_context should be a GAppLaunchContext or None"); + return FALSE; + } + return TRUE; +} + +/** + * pygio_pylist_to_gfile_glist: + * @pyfile_list: + * + * Returns: + */ +GList * +pygio_pylist_to_gfile_glist(PyObject *pyfile_list) +{ + GList *file_list = NULL; + PyObject *item; + int len, i; + + len = PySequence_Size(pyfile_list); + for (i = 0; i < len; i++) { + item = PySequence_GetItem(pyfile_list, i); + if (!PyObject_TypeCheck(item, &PyGFile_Type)) { + PyErr_SetString(PyExc_TypeError, + "files must be a list or tuple of GFile"); + g_list_free(file_list); + return NULL; + } + file_list = g_list_prepend(file_list, ((PyGObject *)item)->obj); + } + file_list = g_list_reverse(file_list); + + return file_list; +} + +/** + * pygio_pylist_to_uri_glist: + * @pyfile_list: + * + * Returns: + */ +GList * +pygio_pylist_to_uri_glist(PyObject *pyfile_list) +{ + GList *file_list = NULL; + PyObject *item; + int len, i; + + len = PySequence_Size(pyfile_list); + for (i = 0; i < len; i++) { + item = PySequence_GetItem(pyfile_list, i); + if (!PyString_Check(item)) { + PyErr_SetString(PyExc_TypeError, + "files must be strings"); + g_list_free(file_list); + return NULL; + } + file_list = g_list_prepend(file_list, PyString_AsString(item)); + } + file_list = g_list_reverse(file_list); + + return file_list; +} + +/** + * strv_to_pylist: + * @strv: array of strings + * + * Returns: A python list of strings + */ +PyObject * +strv_to_pylist (char **strv) +{ + gsize len, i; + PyObject *list; + + len = strv ? g_strv_length (strv) : 0; + list = PyList_New (len); + + for (i = 0; i < len; i++) + PyList_SetItem (list, i, PyString_FromString (strv[i])); + + return list; +} + +/** + * pylist_to_strv: + * @strvp: a pointer to an array where return strings. + * + * Returns: TRUE if the list of strings could be converted, FALSE otherwise. + */ +gboolean +pylist_to_strv (PyObject *list, + char ***strvp) +{ + int i, len; + char **ret; + + *strvp = NULL; + + if (list == Py_None) + return TRUE; + + if (!PySequence_Check (list)) + { + PyErr_Format (PyExc_TypeError, "argument must be a list or tuple of strings"); + return FALSE; + } + + if ((len = PySequence_Size (list)) < 0) + return FALSE; + + ret = g_new (char*, len + 1); + for (i = 0; i <= len; ++i) + ret[i] = NULL; + + for (i = 0; i < len; ++i) + { + PyObject *item = PySequence_GetItem (list, i); + + if (!item) + { + g_strfreev (ret); + return FALSE; + } + + if (!PyString_Check (item)) + { + Py_DECREF (item); + g_strfreev (ret); + PyErr_Format (PyExc_TypeError, "argument must be a list of strings"); + return FALSE; + } + + ret[i] = g_strdup (PyString_AsString (item)); + Py_DECREF (item); + } + + *strvp = ret; + return TRUE; +} diff --git a/gio/pygio-utils.h b/gio/pygio-utils.h new file mode 100644 index 0000000..76bfde3 --- /dev/null +++ b/gio/pygio-utils.h @@ -0,0 +1,49 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 2008 Johan Dahlin + * + * giomodule.c: module wrapping the GIO 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 __PYGIO_UTILS_H__ +#define __PYGIO_UTILS_H__ + +#define NO_IMPORT_PYGOBJECT +#include +#include +#include + +extern PyTypeObject PyGCancellable_Type; +extern PyTypeObject PyGAppLaunchContext_Type; +extern PyTypeObject PyGFile_Type; + +gboolean pygio_check_cancellable(PyGObject *pycancellable, + GCancellable **cancellable); + +gboolean pygio_check_launch_context(PyGObject *pycontext, + GAppLaunchContext **context); + +GList* pygio_pylist_to_gfile_glist(PyObject *pycontext); + +GList* pygio_pylist_to_uri_glist(PyObject *pycontext); + +PyObject* strv_to_pylist (char **strv); + +gboolean pylist_to_strv (PyObject *list, char ***strvp); + +#endif /* __PYGIO_UTILS_H__ */ diff --git a/gio/unix-types.defs b/gio/unix-types.defs new file mode 100644 index 0000000..ed1ed9f --- /dev/null +++ b/gio/unix-types.defs @@ -0,0 +1,55 @@ +;; -*- scheme -*- + +(define-object Connection + (in-module "giounix") + (parent "GSocketConnection") + (c-name "GUnixConnection") + (gtype-id "G_TYPE_UNIX_CONNECTION") +) + +(define-object DesktopAppInfo + (docstring + "DesktopAppInfo(desktop_id) -> gio.unix.DesktopAppInfo\n\n" + "gio.Unix.DesktopAppInfo is an implementation of gio.AppInfo\n" + "based on desktop files." + ) + (in-module "giounix") + (parent "GObject") + (c-name "GDesktopAppInfo") + (gtype-id "G_TYPE_DESKTOP_APP_INFO") +) + +(define-object FDMessage + (in-module "giounix") + (parent "GSocketControlMessage") + (c-name "GUnixFDMessage") + (gtype-id "G_TYPE_UNIX_FD_MESSAGE") +) + +(define-object InputStream + (in-module "giounix") + (parent "GInputStream") + (c-name "GUnixInputStream") + (gtype-id "G_TYPE_UNIX_INPUT_STREAM") +) + +(define-object OutputStream + (in-module "giounix") + (parent "GOutputStream") + (c-name "GUnixOutputStream") + (gtype-id "G_TYPE_UNIX_OUTPUT_STREAM") +) + +(define-pointer MountEntry + (in-module "giounix") + (c-name "GUnixMountEntry") + (gtype-id "GIO_UNIX_MOUNT_ENTRY_TYPE") +) + +(define-object SocketAddress + (in-module "giounix") + (parent "GSocketAddress") + (c-name "GUnixSocketAddress") + (gtype-id "G_TYPE_UNIX_SOCKET_ADDRESS") +) + diff --git a/gio/unix.defs b/gio/unix.defs new file mode 100644 index 0000000..ff43ed6 --- /dev/null +++ b/gio/unix.defs @@ -0,0 +1,475 @@ +;; -*- scheme -*- + +(include "unix-types.defs") + +;; From gunixconnection.h + +(define-function g_unix_connection_get_type + (c-name "g_unix_connection_get_type") + (return-type "GType") +) + +(define-method send_fd + (of-object "GUnixConnection") + (c-name "g_unix_connection_send_fd") + (return-type "gboolean") + (parameters + '("gint" "fd") + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + +(define-method receive_fd + (of-object "GUnixConnection") + (c-name "g_unix_connection_receive_fd") + (return-type "gint") + (parameters + '("GCancellable*" "cancellable") + '("GError**" "error") + ) +) + + + +;; From gdesktopappinfo.h + +(define-function desktop_app_info_get_type + (c-name "g_desktop_app_info_get_type") + (return-type "GType") +) + +(define-function desktop_app_info_new_from_filename + (c-name "g_desktop_app_info_new_from_filename") + (return-type "GDesktopAppInfo*") + (parameters + '("const-char*" "filename") + ) +) + +(define-function g_desktop_app_info_new_from_keyfile + (c-name "g_desktop_app_info_new_from_keyfile") + (return-type "GDesktopAppInfo*") + (parameters + '("GKeyFile*" "key_file") + ) +) + +(define-function desktop_app_info_new + (c-name "g_desktop_app_info_new") + (is-constructor-of "GDesktopAppInfo") + (return-type "GDesktopAppInfo*") + (parameters + '("const-char*" "desktop_id") + ) +) + +(define-method get_is_hidden + (of-object "GDesktopAppInfo") + (c-name "g_desktop_app_info_get_is_hidden") + (return-type "gboolean") +) + +(define-function desktop_app_info_set_desktop_env + (c-name "g_desktop_app_info_set_desktop_env") + (return-type "none") + (parameters + '("const-char*" "desktop_env") + ) +) + + + +;; From gunixfdmessage.h + +(define-function g_unix_fd_message_get_type + (c-name "g_unix_fd_message_get_type") + (return-type "GType") +) + +(define-function g_unix_fd_message_new + (c-name "g_unix_fd_message_new") + (is-constructor-of "GUnixFdMessage") + (return-type "GSocketControlMessage*") +) + +(define-method steal_fds + (of-object "GUnixFDMessage") + (c-name "g_unix_fd_message_steal_fds") + (return-type "gint*") + (parameters + '("gint*" "length") + ) +) + +(define-method append_fd + (of-object "GUnixFDMessage") + (c-name "g_unix_fd_message_append_fd") + (return-type "gboolean") + (parameters + '("gint" "fd") + '("GError**" "error") + ) +) + + + +;; From gunixmounts.h + +(define-function unix_mount_free + (c-name "g_unix_mount_free") + (return-type "none") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-method free + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_free") + (return-type "none") +) + +(define-function unix_mount_compare + (c-name "g_unix_mount_compare") + (return-type "gint") + (parameters + '("GUnixMountEntry*" "mount1") + '("GUnixMountEntry*" "mount2") + ) +) + +(define-function unix_mount_get_mount_path + (c-name "g_unix_mount_get_mount_path") + (return-type "const-char*") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-function unix_mount_get_device_path + (c-name "g_unix_mount_get_device_path") + (return-type "const-char*") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-function unix_mount_get_fs_type + (c-name "g_unix_mount_get_fs_type") + (return-type "const-char*") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-function unix_mount_is_readonly + (c-name "g_unix_mount_is_readonly") + (return-type "gboolean") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-function unix_mount_is_system_internal + (c-name "g_unix_mount_is_system_internal") + (return-type "gboolean") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-function unix_mount_guess_can_eject + (c-name "g_unix_mount_guess_can_eject") + (return-type "gboolean") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-function unix_mount_guess_should_display + (c-name "g_unix_mount_guess_should_display") + (return-type "gboolean") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-function unix_mount_guess_name + (c-name "g_unix_mount_guess_name") + (return-type "char*") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-function unix_mount_guess_icon + (c-name "g_unix_mount_guess_icon") + (return-type "GIcon*") + (parameters + '("GUnixMountEntry*" "mount_entry") + ) +) + +(define-method compare + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_compare") + (return-type "gint") + (parameters + '("GUnixMountPoint*" "mount2") + ) +) + +(define-method get_mount_path + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_get_mount_path") + (return-type "const-char*") +) + +(define-method get_device_path + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_get_device_path") + (return-type "const-char*") +) + +(define-method get_fs_type + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_get_fs_type") + (return-type "const-char*") +) + +(define-method is_readonly + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_is_readonly") + (return-type "gboolean") +) + +(define-method is_user_mountable + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_is_user_mountable") + (return-type "gboolean") +) + +(define-method is_loopback + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_is_loopback") + (return-type "gboolean") +) + +(define-method guess_can_eject + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_guess_can_eject") + (return-type "gboolean") +) + +(define-method guess_name + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_guess_name") + (return-type "char*") +) + +(define-method guess_icon + (of-object "GUnixMountPoint") + (c-name "g_unix_mount_point_guess_icon") + (return-type "GIcon*") +) + +(define-function unix_mount_points_get + (c-name "g_unix_mount_points_get") + (return-type "GList*") + (parameters + '("guint64*" "time_read") + ) +) + +(define-function unix_mounts_get + (c-name "g_unix_mounts_get") + (return-type "GList*") + (parameters + '("guint64*" "time_read") + ) +) + +(define-function unix_mount_at + (c-name "g_unix_mount_at") + (return-type "GUnixMountEntry*") + (parameters + '("const-char*" "mount_path") + '("guint64*" "time_read") + ) +) + +(define-function unix_mounts_changed_since + (c-name "g_unix_mounts_changed_since") + (return-type "gboolean") + (parameters + '("guint64" "time") + ) +) + +(define-function unix_mount_points_changed_since + (c-name "g_unix_mount_points_changed_since") + (return-type "gboolean") + (parameters + '("guint64" "time") + ) +) + +(define-function unix_mount_monitor_get_type + (c-name "g_unix_mount_monitor_get_type") + (return-type "GType") +) + +(define-function unix_mount_monitor_new + (c-name "g_unix_mount_monitor_new") + (is-constructor-of "GUnixMountMonitor") + (return-type "GUnixMountMonitor*") +) + +(define-method set_rate_limit + (of-object "GUnixMountMonitor") + (c-name "g_unix_mount_monitor_set_rate_limit") + (return-type "none") + (parameters + '("int" "limit_msec") + ) +) + +(define-function unix_is_mount_path_system_internal + (c-name "g_unix_is_mount_path_system_internal") + (return-type "gboolean") + (parameters + '("const-char*" "mount_path") + ) +) + + + +;; From gunixinputstream.h + +(define-function unix_input_stream_get_type + (c-name "g_unix_input_stream_get_type") + (return-type "GType") +) + +(define-function unix_input_stream_new + (c-name "g_unix_input_stream_new") + (is-constructor-of "GUnixInputStream") + (return-type "GInputStream*") + (parameters + '("int" "fd") + '("gboolean" "close_fd_at_close") + ) +) + +(define-method set_close_fd + (of-object "GUnixInputStream") + (c-name "g_unix_input_stream_set_close_fd") + (return-type "none") + (parameters + '("gboolean" "close_fd") + ) +) + +(define-method get_close_fd + (of-object "GUnixInputStream") + (c-name "g_unix_input_stream_get_close_fd") + (return-type "gboolean") +) + +(define-method get_fd + (of-object "GUnixInputStream") + (c-name "g_unix_input_stream_get_fd") + (return-type "gint") +) + + + +;; From gunixoutputstream.h + +(define-function unix_output_stream_get_type + (c-name "g_unix_output_stream_get_type") + (return-type "GType") +) + +(define-function unix_output_stream_new + (c-name "g_unix_output_stream_new") + (is-constructor-of "GUnixOutputStream") + (return-type "GOutputStream*") + (parameters + '("int" "fd") + '("gboolean" "close_fd_at_close") + ) +) + +(define-method set_close_fd + (of-object "GUnixOutputStream") + (c-name "g_unix_output_stream_set_close_fd") + (return-type "none") + (parameters + '("gboolean" "close_fd") + ) +) + +(define-method get_close_fd + (of-object "GUnixOutputStream") + (c-name "g_unix_output_stream_get_close_fd") + (return-type "gboolean") +) + +(define-method get_fd + (of-object "GUnixOutputStream") + (c-name "g_unix_output_stream_get_fd") + (return-type "gint") +) + + + +;; From gunixsocketaddress.h + +(define-function g_unix_socket_address_get_type + (c-name "g_unix_socket_address_get_type") + (return-type "GType") +) + +(define-function g_unix_socket_address_new + (c-name "g_unix_socket_address_new") + (is-constructor-of "GUnixSocketAddress") + (return-type "GSocketAddress*") + (parameters + '("const-gchar*" "path") + ) +) + +(define-function g_unix_socket_address_new_abstract + (c-name "g_unix_socket_address_new_abstract") + (return-type "GSocketAddress*") + (parameters + '("const-gchar*" "path") + '("int" "path_len") + ) +) + +(define-method get_path + (of-object "GUnixSocketAddress") + (c-name "g_unix_socket_address_get_path") + (return-type "const-char*") +) + +(define-method get_path_len + (of-object "GUnixSocketAddress") + (c-name "g_unix_socket_address_get_path_len") + (return-type "gsize") +) + +(define-method get_is_abstract + (of-object "GUnixSocketAddress") + (c-name "g_unix_socket_address_get_is_abstract") + (return-type "gboolean") +) + +(define-function g_unix_socket_address_abstract_names_supported + (c-name "g_unix_socket_address_abstract_names_supported") + (return-type "gboolean") +) + diff --git a/gio/unix.override b/gio/unix.override new file mode 100644 index 0000000..aebc6fc --- /dev/null +++ b/gio/unix.override @@ -0,0 +1,62 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * unixmodule.c: module wrapping the GIO UNIX 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 + */ +%% +headers +#define NO_IMPORT_PYGOBJECT +#include +#include +#include +#include +#include +#include +#define GIO_COMPILATION +#include +#undef GIO_COMPILATION +#include +#include + +#define GIO_UNIX_MOUNT_ENTRY_TYPE (_gio_unix_mount_entry_get_type ()) + +static GType _gio_unix_mount_entry_get_type (void) +{ + static GType our_type = 0; + + if (our_type == 0) + our_type = g_pointer_type_register_static ("GUnixMountEntry"); + + return our_type; +} + +%% +modulename gio.unix +%% +import gobject.GObject as PyGObject_Type +import gio.InputStream as PyGInputStream_Type +import gio.OutputStream as PyGOutputStream_Type +import gio.SocketAddress as PyGSocketAddress_Type +import gio.Cancellable as PyGCancellable_Type +import gio.SocketConnection as PyGSocketConnection_Type +import gio.SocketControlMessage as PyGSocketControlMessage_Type +%% +ignore-glob + *_get_type +%% diff --git a/gio/unixmodule.c b/gio/unixmodule.c new file mode 100644 index 0000000..7a49856 --- /dev/null +++ b/gio/unixmodule.c @@ -0,0 +1,52 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for GObject + * Copyright (C) 2008 Johan Dahlin + * + * unixmodule.c: module wrapping the GIO UNIX 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 "config.h" +#endif +#include +#include + +#include + +/* include any extra headers needed here */ + +void pyunix_register_classes(PyObject *d); +void pyunix_add_constants(PyObject *module, const gchar *strip_prefix); + +extern PyMethodDef pyunix_functions[]; + +DL_EXPORT(void) +initunix(void) +{ + PyObject *m, *d; + + /* perform any initialisation required by the library here */ + + m = Py_InitModule("gio.unix", pyunix_functions); + d = PyModule_GetDict(m); + + init_pygobject(); + + pyunix_register_classes(d); + +} + diff --git a/glib/Makefile.am b/glib/Makefile.am new file mode 100644 index 0000000..d230da4 --- /dev/null +++ b/glib/Makefile.am @@ -0,0 +1,59 @@ +AUTOMAKE_OPTIONS = 1.7 +INCLUDES = $(PYTHON_INCLUDES) $(GLIB_CFLAGS) -DPY_SSIZE_T_CLEAN + +pkgincludedir = $(includedir)/pygtk-2.0 +pkginclude_HEADERS = pyglib.h + +lib_LTLIBRARIES = libpyglib-2.0-@PYTHON_BASENAME@.la + +pkgpyexecdir = $(pyexecdir)/gtk-2.0 + +pyglibdir = $(pkgpyexecdir)/glib +pyglib_PYTHON = \ + __init__.py \ + option.py +pyglib_LTLIBRARIES = _glib.la + +common_ldflags = -module -avoid-version +if PLATFORM_WIN32 +common_ldflags += -no-undefined +endif + +libpyglib_2_0_@PYTHON_BASENAME@_la_CFLAGS = $(GLIB_CFLAGS) +libpyglib_2_0_@PYTHON_BASENAME@_la_LIBADD = $(GLIB_LIBS) $(FFI_LIBS) +libpyglib_2_0_@PYTHON_BASENAME@_la_SOURCES = \ + pyglib.c \ + pyglib.h \ + pyglib-private.h \ + pyglib-python-compat.h + +_glib_la_CFLAGS = $(GLIB_CFLAGS) +_glib_la_LDFLAGS = $(common_ldflags) -export-symbols-regex "_glib|PyInit__glib" +_glib_la_LIBADD = $(GLIB_LIBS) libpyglib-2.0-@PYTHON_BASENAME@.la +_glib_la_SOURCES = \ + glibmodule.c \ + pygiochannel.c \ + pygiochannel.h \ + pygoptioncontext.c \ + pygoptioncontext.h \ + pygoptiongroup.c \ + pygoptiongroup.h \ + pygmaincontext.c \ + pygmaincontext.h \ + pygmainloop.c \ + pygmainloop.h \ + pygsource.c \ + pygsource.h \ + pygspawn.c \ + pygspawn.h + +if PLATFORM_WIN32 +_glib_la_CFLAGS += -DPLATFORM_WIN32 +endif + + +all: $(pyglib_LTLIBRARIES:.la=.so) +clean-local: + rm -f $(pyglib_LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true diff --git a/glib/Makefile.in b/glib/Makefile.in new file mode 100644 index 0000000..634bdce --- /dev/null +++ b/glib/Makefile.in @@ -0,0 +1,787 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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@ +@PLATFORM_WIN32_TRUE@am__append_1 = -no-undefined +@PLATFORM_WIN32_TRUE@am__append_2 = -DPLATFORM_WIN32 +subdir = glib +DIST_COMMON = $(pkginclude_HEADERS) $(pyglib_PYTHON) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pyglibdir)" \ + "$(DESTDIR)$(pyglibdir)" "$(DESTDIR)$(pkgincludedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(pyglib_LTLIBRARIES) +am__DEPENDENCIES_1 = +_glib_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + libpyglib-2.0-@PYTHON_BASENAME@.la +am__glib_la_OBJECTS = _glib_la-glibmodule.lo _glib_la-pygiochannel.lo \ + _glib_la-pygoptioncontext.lo _glib_la-pygoptiongroup.lo \ + _glib_la-pygmaincontext.lo _glib_la-pygmainloop.lo \ + _glib_la-pygsource.lo _glib_la-pygspawn.lo +_glib_la_OBJECTS = $(am__glib_la_OBJECTS) +_glib_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(_glib_la_CFLAGS) $(CFLAGS) \ + $(_glib_la_LDFLAGS) $(LDFLAGS) -o $@ +libpyglib_2_0_@PYTHON_BASENAME@_la_DEPENDENCIES = \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libpyglib_2_0_@PYTHON_BASENAME@_la_OBJECTS = \ + libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.lo +libpyglib_2_0_@PYTHON_BASENAME@_la_OBJECTS = \ + $(am_libpyglib_2_0_@PYTHON_BASENAME@_la_OBJECTS) +libpyglib_2_0_@PYTHON_BASENAME@_la_LINK = $(LIBTOOL) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libpyglib_2_0_@PYTHON_BASENAME@_la_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +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) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(_glib_la_SOURCES) \ + $(libpyglib_2_0_@PYTHON_BASENAME@_la_SOURCES) +DIST_SOURCES = $(_glib_la_SOURCES) \ + $(libpyglib_2_0_@PYTHON_BASENAME@_la_SOURCES) +py_compile = $(top_srcdir)/py-compile +HEADERS = $(pkginclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkgincludedir = $(includedir)/pygtk-2.0 +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +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@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +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@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBFFI_PC = @LIBFFI_PC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PLATFORM = @PLATFORM@ +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_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +THREADING_CFLAGS = @THREADING_CFLAGS@ +VERSION = @VERSION@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +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@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = $(pyexecdir)/gtk-2.0 +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pygobject_CODEGEN_DEFINES = @pygobject_CODEGEN_DEFINES@ +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 +INCLUDES = $(PYTHON_INCLUDES) $(GLIB_CFLAGS) -DPY_SSIZE_T_CLEAN +pkginclude_HEADERS = pyglib.h +lib_LTLIBRARIES = libpyglib-2.0-@PYTHON_BASENAME@.la +pyglibdir = $(pkgpyexecdir)/glib +pyglib_PYTHON = \ + __init__.py \ + option.py + +pyglib_LTLIBRARIES = _glib.la +common_ldflags = -module -avoid-version $(am__append_1) +libpyglib_2_0_@PYTHON_BASENAME@_la_CFLAGS = $(GLIB_CFLAGS) +libpyglib_2_0_@PYTHON_BASENAME@_la_LIBADD = $(GLIB_LIBS) $(FFI_LIBS) +libpyglib_2_0_@PYTHON_BASENAME@_la_SOURCES = \ + pyglib.c \ + pyglib.h \ + pyglib-private.h \ + pyglib-python-compat.h + +_glib_la_CFLAGS = $(GLIB_CFLAGS) $(am__append_2) +_glib_la_LDFLAGS = $(common_ldflags) -export-symbols-regex "_glib|PyInit__glib" +_glib_la_LIBADD = $(GLIB_LIBS) libpyglib-2.0-@PYTHON_BASENAME@.la +_glib_la_SOURCES = \ + glibmodule.c \ + pygiochannel.c \ + pygiochannel.h \ + pygoptioncontext.c \ + pygoptioncontext.h \ + pygoptiongroup.c \ + pygoptiongroup.h \ + pygmaincontext.c \ + pygmaincontext.h \ + pygmainloop.c \ + pygmainloop.h \ + pygsource.c \ + pygsource.h \ + pygspawn.c \ + pygspawn.h + +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) --gnu glib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu 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) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @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 " $(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)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +install-pyglibLTLIBRARIES: $(pyglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pyglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pyglibdir)" + @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 " $(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)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +_glib.la: $(_glib_la_OBJECTS) $(_glib_la_DEPENDENCIES) + $(_glib_la_LINK) -rpath $(pyglibdir) $(_glib_la_OBJECTS) $(_glib_la_LIBADD) $(LIBS) +libpyglib-2.0-@PYTHON_BASENAME@.la: $(libpyglib_2_0_@PYTHON_BASENAME@_la_OBJECTS) $(libpyglib_2_0_@PYTHON_BASENAME@_la_DEPENDENCIES) + $(libpyglib_2_0_@PYTHON_BASENAME@_la_LINK) -rpath $(libdir) $(libpyglib_2_0_@PYTHON_BASENAME@_la_OBJECTS) $(libpyglib_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-pygiochannel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygmaincontext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygmainloop.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-pygsource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygspawn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +_glib_la-glibmodule.lo: glibmodule.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_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__mv) $(DEPDIR)/_glib_la-glibmodule.Tpo $(DEPDIR)/_glib_la-glibmodule.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glibmodule.c' object='_glib_la-glibmodule.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-glibmodule.lo `test -f 'glibmodule.c' || echo '$(srcdir)/'`glibmodule.c + +_glib_la-pygiochannel.lo: pygiochannel.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygiochannel.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygiochannel.Tpo -c -o _glib_la-pygiochannel.lo `test -f 'pygiochannel.c' || echo '$(srcdir)/'`pygiochannel.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/_glib_la-pygiochannel.Tpo $(DEPDIR)/_glib_la-pygiochannel.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygiochannel.c' object='_glib_la-pygiochannel.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygiochannel.lo `test -f 'pygiochannel.c' || echo '$(srcdir)/'`pygiochannel.c + +_glib_la-pygoptioncontext.lo: pygoptioncontext.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_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__mv) $(DEPDIR)/_glib_la-pygoptioncontext.Tpo $(DEPDIR)/_glib_la-pygoptioncontext.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygoptioncontext.c' object='_glib_la-pygoptioncontext.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_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@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_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__mv) $(DEPDIR)/_glib_la-pygoptiongroup.Tpo $(DEPDIR)/_glib_la-pygoptiongroup.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygoptiongroup.c' object='_glib_la-pygoptiongroup.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygoptiongroup.lo `test -f 'pygoptiongroup.c' || echo '$(srcdir)/'`pygoptiongroup.c + +_glib_la-pygmaincontext.lo: pygmaincontext.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygmaincontext.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygmaincontext.Tpo -c -o _glib_la-pygmaincontext.lo `test -f 'pygmaincontext.c' || echo '$(srcdir)/'`pygmaincontext.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/_glib_la-pygmaincontext.Tpo $(DEPDIR)/_glib_la-pygmaincontext.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygmaincontext.c' object='_glib_la-pygmaincontext.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygmaincontext.lo `test -f 'pygmaincontext.c' || echo '$(srcdir)/'`pygmaincontext.c + +_glib_la-pygmainloop.lo: pygmainloop.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygmainloop.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygmainloop.Tpo -c -o _glib_la-pygmainloop.lo `test -f 'pygmainloop.c' || echo '$(srcdir)/'`pygmainloop.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/_glib_la-pygmainloop.Tpo $(DEPDIR)/_glib_la-pygmainloop.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygmainloop.c' object='_glib_la-pygmainloop.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygmainloop.lo `test -f 'pygmainloop.c' || echo '$(srcdir)/'`pygmainloop.c + +_glib_la-pygsource.lo: pygsource.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygsource.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygsource.Tpo -c -o _glib_la-pygsource.lo `test -f 'pygsource.c' || echo '$(srcdir)/'`pygsource.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/_glib_la-pygsource.Tpo $(DEPDIR)/_glib_la-pygsource.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygsource.c' object='_glib_la-pygsource.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygsource.lo `test -f 'pygsource.c' || echo '$(srcdir)/'`pygsource.c + +_glib_la-pygspawn.lo: pygspawn.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_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__mv) $(DEPDIR)/_glib_la-pygspawn.Tpo $(DEPDIR)/_glib_la-pygspawn.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygspawn.c' object='_glib_la-pygspawn.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygspawn.lo `test -f 'pygspawn.c' || echo '$(srcdir)/'`pygspawn.c + +libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.lo: pyglib.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpyglib_2_0_@PYTHON_BASENAME@_la_CFLAGS) $(CFLAGS) -MT libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.lo -MD -MP -MF $(DEPDIR)/libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.Tpo -c -o libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.lo `test -f 'pyglib.c' || echo '$(srcdir)/'`pyglib.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.Tpo $(DEPDIR)/libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pyglib.c' object='libpyglib_2_0_@PYTHON_BASENAME@_la-pyglib.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpyglib_2_0_@PYTHON_BASENAME@_la_CFLAGS) $(CFLAGS) -c -o libpyglib_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) + test -z "$(pyglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pyglibdir)" + @list='$(pyglib_PYTHON)'; dlist=; list2=; test -n "$(pyglibdir)" || list=; \ + 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 \ + if test -z "$(DESTDIR)"; then \ + PYTHON=$(PYTHON) $(py_compile) --basedir "$(pyglibdir)" $$dlist; \ + else \ + PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pyglibdir)" $$dlist; \ + fi; \ + else :; fi + +uninstall-pyglibPYTHON: + @$(NORMAL_UNINSTALL) + @list='$(pyglib_PYTHON)'; test -n "$(pyglibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + filesc=`echo "$$files" | sed 's|$$|c|'`; \ + fileso=`echo "$$files" | sed 's|$$|o|'`; \ + echo " ( cd '$(DESTDIR)$(pyglibdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pyglibdir)" && rm -f $$files || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pyglibdir)' && rm -f" $$filesc ")"; \ + cd "$(DESTDIR)$(pyglibdir)" && rm -f $$filesc || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pyglibdir)' && rm -f" $$fileso ")"; \ + cd "$(DESTDIR)$(pyglibdir)" && rm -f $$fileso +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pyglibdir)" "$(DESTDIR)$(pyglibdir)" "$(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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-pkgincludeHEADERS 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-pkgincludeHEADERS \ + uninstall-pyglibLTLIBRARIES uninstall-pyglibPYTHON + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-local \ + clean-pyglibLTLIBRARIES ctags 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-pkgincludeHEADERS 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 uninstall uninstall-am uninstall-libLTLIBRARIES \ + uninstall-pkgincludeHEADERS uninstall-pyglibLTLIBRARIES \ + uninstall-pyglibPYTHON + + +all: $(pyglib_LTLIBRARIES:.la=.so) +clean-local: + rm -f $(pyglib_LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true + +# 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/glib/__init__.py b/glib/__init__.py new file mode 100644 index 0000000..b114cb9 --- /dev/null +++ b/glib/__init__.py @@ -0,0 +1,25 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# pygobject - Python bindings for the GObject library +# Copyright (C) 2006-2008 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 glib._glib import * +_PyGLib_API = _glib._PyGLib_API + +del _glib diff --git a/glib/glibmodule.c b/glib/glibmodule.c new file mode 100644 index 0000000..f794d5d --- /dev/null +++ b/glib/glibmodule.c @@ -0,0 +1,896 @@ +/* -*- 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 "pygiochannel.h" +#include "pygmaincontext.h" +#include "pygmainloop.h" +#include "pygoptioncontext.h" +#include "pygoptiongroup.h" +#include "pygsource.h" +#include "pygspawn.h" + +#define PYGLIB_MAJOR_VERSION PYGOBJECT_MAJOR_VERSION +#define PYGLIB_MINOR_VERSION PYGOBJECT_MINOR_VERSION +#define PYGLIB_MICRO_VERSION PYGOBJECT_MICRO_VERSION + + +/* ---------------- glib module functions -------------------- */ + +struct _PyGChildData { + PyObject *func; + PyObject *data; +}; + +static gint +get_handler_priority(gint *priority, PyObject *kwargs) +{ + Py_ssize_t len, pos; + PyObject *key, *val; + + /* no keyword args? leave as default */ + if (kwargs == NULL) return 0; + + len = PyDict_Size(kwargs); + if (len == 0) return 0; + + if (len != 1) { + PyErr_SetString(PyExc_TypeError, + "expecting at most one keyword argument"); + return -1; + } + pos = 0; + PyDict_Next(kwargs, &pos, &key, &val); + if (!_PyUnicode_Check(key)) { + PyErr_SetString(PyExc_TypeError, + "keyword argument name is not a string"); + return -1; + } + + if (strcmp(_PyUnicode_AsString(key), "priority") != 0) { + PyErr_SetString(PyExc_TypeError, + "only 'priority' keyword argument accepted"); + return -1; + } + + *priority = _PyLong_AsLong(val); + if (PyErr_Occurred()) { + PyErr_Clear(); + PyErr_SetString(PyExc_ValueError, "could not get priority value"); + return -1; + } + return 0; +} + +static PyObject * +pyglib_threads_init(PyObject *unused, PyObject *args, PyObject *kwargs) +{ + if (!pyglib_enable_threads()) + return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyglib_idle_add(PyObject *self, PyObject *args, PyObject *kwargs) +{ + PyObject *first, *callback, *cbargs = NULL, *data; + gint len, priority = G_PRIORITY_DEFAULT_IDLE; + guint handler_id; + + len = PyTuple_Size(args); + if (len < 1) { + PyErr_SetString(PyExc_TypeError, + "idle_add requires at least 1 argument"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 1); + if (!PyArg_ParseTuple(first, "O:idle_add", &callback)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "first argument not callable"); + return NULL; + } + if (get_handler_priority(&priority, kwargs) < 0) + return NULL; + + cbargs = PySequence_GetSlice(args, 1, len); + if (cbargs == NULL) + return NULL; + + data = Py_BuildValue("(ON)", callback, cbargs); + if (data == NULL) + return NULL; + handler_id = g_idle_add_full(priority, + _pyglib_handler_marshal, data, + _pyglib_destroy_notify); + return _PyLong_FromLong(handler_id); +} + + +static PyObject * +pyglib_timeout_add(PyObject *self, PyObject *args, PyObject *kwargs) +{ + PyObject *first, *callback, *cbargs = NULL, *data; + gint len, priority = G_PRIORITY_DEFAULT; + guint interval, handler_id; + + len = PyTuple_Size(args); + if (len < 2) { + PyErr_SetString(PyExc_TypeError, + "timeout_add requires at least 2 args"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 2); + if (!PyArg_ParseTuple(first, "IO:timeout_add", &interval, &callback)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "second argument not callable"); + return NULL; + } + if (get_handler_priority(&priority, kwargs) < 0) + return NULL; + + cbargs = PySequence_GetSlice(args, 2, len); + if (cbargs == NULL) + return NULL; + + data = Py_BuildValue("(ON)", callback, cbargs); + if (data == NULL) + return NULL; + handler_id = g_timeout_add_full(priority, interval, + _pyglib_handler_marshal, data, + _pyglib_destroy_notify); + return _PyLong_FromLong(handler_id); +} + +static PyObject * +pyglib_timeout_add_seconds(PyObject *self, PyObject *args, PyObject *kwargs) +{ + PyObject *first, *callback, *cbargs = NULL, *data; + gint len, priority = G_PRIORITY_DEFAULT; + guint interval, handler_id; + + len = PyTuple_Size(args); + if (len < 2) { + PyErr_SetString(PyExc_TypeError, + "timeout_add_seconds requires at least 2 args"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 2); + if (!PyArg_ParseTuple(first, "IO:timeout_add_seconds", &interval, &callback)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "second argument not callable"); + return NULL; + } + if (get_handler_priority(&priority, kwargs) < 0) + return NULL; + + cbargs = PySequence_GetSlice(args, 2, len); + if (cbargs == NULL) + return NULL; + + data = Py_BuildValue("(ON)", callback, cbargs); + if (data == NULL) + return NULL; + handler_id = g_timeout_add_seconds_full(priority, interval, + _pyglib_handler_marshal, data, + _pyglib_destroy_notify); + return _PyLong_FromLong(handler_id); +} + +static gboolean +iowatch_marshal(GIOChannel *source, + GIOCondition condition, + gpointer user_data) +{ + PyGILState_STATE state; + PyObject *tuple, *func, *firstargs, *args, *ret; + gboolean res; + + g_return_val_if_fail(user_data != NULL, FALSE); + + state = pyglib_gil_state_ensure(); + + tuple = (PyObject *)user_data; + func = PyTuple_GetItem(tuple, 0); + + /* arg vector is (fd, condtion, *args) */ + firstargs = Py_BuildValue("(Oi)", PyTuple_GetItem(tuple, 1), condition); + args = PySequence_Concat(firstargs, PyTuple_GetItem(tuple, 2)); + Py_DECREF(firstargs); + + ret = PyObject_CallObject(func, args); + Py_DECREF(args); + if (!ret) { + PyErr_Print(); + res = FALSE; + } else { + if (ret == Py_None) { + if (PyErr_Warn(PyExc_Warning, + "glib.io_add_watch callback returned None; " + "should return True/False")) { + PyErr_Print(); + } + } + res = PyObject_IsTrue(ret); + Py_DECREF(ret); + } + + pyglib_gil_state_release(state); + + return res; +} + +static PyObject * +pyglib_io_add_watch(PyObject *self, PyObject *args, PyObject *kwargs) +{ + PyObject *first, *pyfd, *callback, *cbargs = NULL, *data; + gint fd, priority = G_PRIORITY_DEFAULT, condition; + Py_ssize_t len; + GIOChannel *iochannel; + guint handler_id; + + len = PyTuple_Size(args); + if (len < 3) { + PyErr_SetString(PyExc_TypeError, + "io_add_watch requires at least 3 args"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 3); + if (!PyArg_ParseTuple(first, "OiO:io_add_watch", &pyfd, &condition, + &callback)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + fd = PyObject_AsFileDescriptor(pyfd); + if (fd < 0) { + return NULL; + } + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "third argument not callable"); + return NULL; + } + if (get_handler_priority(&priority, kwargs) < 0) + return NULL; + + cbargs = PySequence_GetSlice(args, 3, len); + if (cbargs == NULL) + return NULL; + data = Py_BuildValue("(OON)", callback, pyfd, cbargs); + if (data == NULL) + return NULL; + iochannel = g_io_channel_unix_new(fd); + handler_id = g_io_add_watch_full(iochannel, priority, condition, + iowatch_marshal, data, + (GDestroyNotify)_pyglib_destroy_notify); + g_io_channel_unref(iochannel); + + return _PyLong_FromLong(handler_id); +} + +static PyObject * +pyglib_source_remove(PyObject *self, PyObject *args) +{ + guint tag; + + if (!PyArg_ParseTuple(args, "i:source_remove", &tag)) + return NULL; + + return PyBool_FromLong(g_source_remove(tag)); +} + +static PyObject * +pyglib_main_context_default(PyObject *unused) +{ + return pyglib_main_context_new(g_main_context_default()); +} + +static void +child_watch_func(GPid pid, gint status, gpointer data) +{ + struct _PyGChildData *child_data = (struct _PyGChildData *) data; + PyObject *retval; + PyGILState_STATE gil; + + gil = pyglib_gil_state_ensure(); + if (child_data->data) + retval = PyObject_CallFunction(child_data->func, "iiO", pid, status, + child_data->data); + else + retval = PyObject_CallFunction(child_data->func, "ii", pid, status); + + if (retval) + Py_DECREF(retval); + else + PyErr_Print(); + + pyglib_gil_state_release(gil); +} + +static void +child_watch_dnotify(gpointer data) +{ + struct _PyGChildData *child_data = (struct _PyGChildData *) data; + Py_DECREF(child_data->func); + Py_XDECREF(child_data->data); + g_slice_free(struct _PyGChildData, child_data); +} + + +static PyObject * +pyglib_child_watch_add(PyObject *unused, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "pid", "function", "data", "priority", NULL }; + guint id; + gint priority = G_PRIORITY_DEFAULT; + int pid; + PyObject *func, *user_data = NULL; + struct _PyGChildData *child_data; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "iO|Oi:glib.child_watch_add", kwlist, + &pid, &func, &user_data, &priority)) + return NULL; + if (!PyCallable_Check(func)) { + PyErr_SetString(PyExc_TypeError, + "glib.child_watch_add: second argument must be callable"); + return NULL; + } + + child_data = g_slice_new(struct _PyGChildData); + child_data->func = func; + child_data->data = user_data; + Py_INCREF(child_data->func); + if (child_data->data) + Py_INCREF(child_data->data); + id = g_child_watch_add_full(priority, pid, child_watch_func, + child_data, child_watch_dnotify); + return _PyLong_FromLong(id); +} + +static PyObject * +pyglib_markup_escape_text(PyObject *unused, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "text", NULL }; + char *text_in, *text_out; + Py_ssize_t text_size; + PyObject *retval; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s#:glib.markup_escape_text", kwlist, + &text_in, &text_size)) + return NULL; + + text_out = g_markup_escape_text(text_in, text_size); + retval = _PyUnicode_FromString(text_out); + g_free(text_out); + return retval; +} + +static PyObject * +pyglib_get_current_time(PyObject *unused) +{ + GTimeVal timeval; + + g_get_current_time(&timeval); + return pyglib_float_from_timeval(timeval); +} + +static PyObject* +pyglib_get_user_cache_dir(PyObject *self) +{ + const char *path = g_get_user_cache_dir(); + + if (path) + return _PyUnicode_FromString(path); + else { + Py_INCREF(Py_None); + return Py_None; + } +} + +static PyObject* +pyglib_get_user_config_dir(PyObject *self) +{ + const char *path = g_get_user_config_dir(); + + if (path) + return _PyUnicode_FromString(path); + else { + Py_INCREF(Py_None); + return Py_None; + } +} + +static PyObject* +pyglib_get_user_data_dir(PyObject *self) +{ + const char *path = g_get_user_data_dir(); + + if (path) + return _PyUnicode_FromString(path); + else { + Py_INCREF(Py_None); + return Py_None; + } +} + +static PyObject * +pyglib_get_user_special_dir(PyObject *unused, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "directory", NULL }; + guint directory; + const char *path; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "i:glib.get_user_special_dir", kwlist, + &directory)) + return NULL; + + path = g_get_user_special_dir(directory); + if (path) + return _PyUnicode_FromString(path); + else { + Py_INCREF(Py_None); + return Py_None; + } +} + +static PyObject * +pyglib_main_depth(PyObject *unused) +{ + return _PyLong_FromLong(g_main_depth()); +} + +static PyObject * +pyglib_filename_display_name(PyObject *self, PyObject *args) +{ + PyObject *py_display_name; + char *filename, *display_name; + + if (!PyArg_ParseTuple(args, "s:glib.filename_display_name", + &filename)) + return NULL; + + display_name = g_filename_display_name(filename); + py_display_name = PyUnicode_DecodeUTF8(display_name, + strlen(display_name), NULL); + g_free(display_name); + return py_display_name; +} + +static PyObject * +pyglib_filename_display_basename(PyObject *self, PyObject *args) +{ + PyObject *py_display_basename; + char *filename, *display_basename; + + if (!PyArg_ParseTuple(args, "s:glib.filename_display_basename", + &filename)) + return NULL; + + display_basename = g_filename_display_basename(filename); + py_display_basename = PyUnicode_DecodeUTF8(display_basename, + strlen(display_basename), NULL); + g_free(display_basename); + return py_display_basename; +} + +static PyObject * +pyglib_filename_from_utf8(PyObject *self, PyObject *args) +{ + char *filename, *utf8string; + Py_ssize_t utf8string_len; + gsize bytes_written; + GError *error = NULL; + PyObject *py_filename; + + if (!PyArg_ParseTuple(args, "s#:glib.filename_from_utf8", + &utf8string, &utf8string_len)) + return NULL; + + filename = g_filename_from_utf8(utf8string, utf8string_len, + NULL, &bytes_written, &error); + if (pyglib_error_check(&error)) { + g_free(filename); + return NULL; + } + py_filename = _PyUnicode_FromStringAndSize(filename, bytes_written); + g_free(filename); + return py_filename; +} + + +static PyObject* +pyglib_get_application_name(PyObject *self) +{ + const char *name; + + name = g_get_application_name(); + if (!name) { + Py_INCREF(Py_None); + return Py_None; + } + return _PyUnicode_FromString(name); +} + +static PyObject* +pyglib_set_application_name(PyObject *self, PyObject *arg) +{ + if (!PyString_Check(arg)) { + PyErr_Format(PyExc_TypeError, + "first argument must be a string, not '%s'", + PyString_AS_STRING(PyObject_Repr(arg))); + return NULL; + } + g_set_application_name(PyString_AS_STRING(arg)); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +pyglib_get_prgname(PyObject *self) +{ + char *name; + + name = g_get_prgname(); + if (!name) { + Py_INCREF(Py_None); + return Py_None; + } + return _PyUnicode_FromString(name); +} + +static PyObject* +pyglib_set_prgname(PyObject *self, PyObject *arg) +{ + if (!PyString_Check(arg)) { + PyErr_Format(PyExc_TypeError, + "first argument must be a string, not '%s'", + PyString_AS_STRING(PyObject_Repr(arg))); + return NULL; + } + g_set_prgname(PyString_AS_STRING(arg)); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyglib_find_program_in_path(PyObject *unused, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "program", NULL }; + char *program, *ret; + PyObject *retval; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "s:glib.find_program_in_path", kwlist, + &program)) + return NULL; + + ret = g_find_program_in_path(program); + retval = _PyUnicode_FromString(ret); + g_free(ret); + return retval; +} + +static PyMethodDef _glib_functions[] = { + { "threads_init", + (PyCFunction) pyglib_threads_init, METH_NOARGS, + "threads_init()\n" + "Initialize GLib for use from multiple threads. If you also use GTK+\n" + "itself (i.e. GUI, not just PyGObject), use gtk.gdk.threads_init()\n" + "instead." }, + { "idle_add", + (PyCFunction)pyglib_idle_add, METH_VARARGS|METH_KEYWORDS, + "idle_add(callable, user_data=None, priority=None) -> source id\n" + " callable receives (user_data)\n" + "Adds a callable to be called whenever there are no higher priority\n" + "events pending to the default main loop." }, + { "timeout_add", + (PyCFunction)pyglib_timeout_add, METH_VARARGS|METH_KEYWORDS, + "timeout_add(interval, callable, user_data=None,\n" + " priority=None) -> source id\n" + " callable receives (user_data)\n" + "Sets a callable be called repeatedly until it returns False." }, + { "timeout_add_seconds", + (PyCFunction)pyglib_timeout_add_seconds, METH_VARARGS|METH_KEYWORDS, + "timeout_add(interval, callable, user_data=None,\n" + " priority=None) -> source_id\n" + " callable receives (user_data)\n" + "Sets a callable be called repeatedly until it returns False.\n" + "Use this if you want to have a timer in the \"seconds\" range\n" + "and do not care about the exact time of the first call of the\n" + "timer, use this for more efficient system power usage." }, + { "io_add_watch", + (PyCFunction)pyglib_io_add_watch, METH_VARARGS|METH_KEYWORDS, + "io_add_watch(fd, condition, callback, user_data=None) -> source id\n" + " callable receives (fd, condition, user_data)\n" + "Arranges for the fd to be monitored by the main loop for the\n" + "specified condition. Condition is a combination of glib.IO_IN,\n" + "glib.IO_OUT, glib.IO_PRI, gio.IO_ERR and gio.IO_HUB.\n" }, + { "child_watch_add", + (PyCFunction)pyglib_child_watch_add, METH_VARARGS|METH_KEYWORDS, + "child_watch_add(pid, callable, user_data=None,\n" + "priority=None) -> source id\n" + " callable receives (pid, condition, user_data)\n" + "Sets the function specified by function to be called with the user\n" + "data specified by data when the child indicated by pid exits.\n" + "Condition is a combination of glib.IO_IN, glib.IO_OUT, glib.IO_PRI,\n" + "gio.IO_ERR and gio.IO_HUB." }, + { "source_remove", + (PyCFunction)pyglib_source_remove, METH_VARARGS, + "source_remove(source_id) -> True if removed\n" + "Removes the event source specified by source id as returned by the\n" + "glib.idle_add(), glib.timeout_add() or glib.io_add_watch()\n" + "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." }, + { "main_context_default", + (PyCFunction)pyglib_main_context_default, METH_NOARGS, + "main_context_default() -> a main context\n" + "Returns the default main context. This is the main context used\n" + "for main loop functions when a main loop is not explicitly specified." }, + { "main_depth", + (PyCFunction)pyglib_main_depth, METH_NOARGS, + "main_depth() -> stack depth\n" + "Returns the depth of the stack of calls in the main context." }, + { "filename_display_name", + (PyCFunction)pyglib_filename_display_name, METH_VARARGS }, + { "filename_display_basename", + (PyCFunction)pyglib_filename_display_basename, METH_VARARGS }, + { "filename_from_utf8", + (PyCFunction)pyglib_filename_from_utf8, METH_VARARGS }, + { "get_application_name", + (PyCFunction)pyglib_get_application_name, METH_NOARGS }, + { "set_application_name", + (PyCFunction)pyglib_set_application_name, METH_O }, + { "get_prgname", + (PyCFunction)pyglib_get_prgname, METH_NOARGS }, + { "set_prgname", + (PyCFunction)pyglib_set_prgname, METH_O }, + { "get_current_time", + (PyCFunction)pyglib_get_current_time, METH_NOARGS }, + { "get_user_cache_dir", + (PyCFunction)pyglib_get_user_cache_dir, METH_NOARGS }, + { "get_user_config_dir", + (PyCFunction)pyglib_get_user_config_dir, METH_NOARGS }, + { "get_user_data_dir", + (PyCFunction)pyglib_get_user_data_dir, METH_NOARGS }, + { "get_user_special_dir", + (PyCFunction)pyglib_get_user_special_dir, METH_VARARGS|METH_KEYWORDS }, + { "markup_escape_text", + (PyCFunction)pyglib_markup_escape_text, METH_VARARGS|METH_KEYWORDS }, + { "find_program_in_path", + (PyCFunction)pyglib_find_program_in_path, METH_VARARGS|METH_KEYWORDS }, + { NULL, NULL, 0 } +}; + +/* ----------------- glib module initialisation -------------- */ + +static struct _PyGLib_Functions pyglib_api = { + FALSE, /* threads_enabled */ + NULL, /* gerror_exception */ + NULL, /* block_threads */ + NULL /* unblock_threads */ +}; + +static void +pyglib_register_api(PyObject *d) +{ + PyObject *o; + + /* for addon libraries ... */ + PyDict_SetItemString(d, "_PyGLib_API", + o=PyCObject_FromVoidPtr(&pyglib_api,NULL)); + 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("glib.GError", PyExc_RuntimeError, dict); + Py_DECREF(dict); + + PyDict_SetItemString(d, "GError", gerror_class); + pyglib_api.gerror_exception = gerror_class; +} + +static void +pyglib_register_version_tuples(PyObject *d) +{ + PyObject *o; + + /* glib version */ + o = Py_BuildValue("(iii)", glib_major_version, glib_minor_version, + glib_micro_version); + PyDict_SetItemString(d, "glib_version", o); + Py_DECREF(o); + + /* pyglib version */ + o = Py_BuildValue("(iii)", + PYGLIB_MAJOR_VERSION, + PYGLIB_MINOR_VERSION, + PYGLIB_MICRO_VERSION); + PyDict_SetItemString(d, "pyglib_version", o); + Py_DECREF(o); +} + +static void +pyglib_register_constants(PyObject *m) +{ + PyModule_AddIntConstant(m, "SPAWN_LEAVE_DESCRIPTORS_OPEN", + G_SPAWN_LEAVE_DESCRIPTORS_OPEN); + PyModule_AddIntConstant(m, "SPAWN_DO_NOT_REAP_CHILD", + G_SPAWN_DO_NOT_REAP_CHILD); + PyModule_AddIntConstant(m, "SPAWN_SEARCH_PATH", + G_SPAWN_SEARCH_PATH); + PyModule_AddIntConstant(m, "SPAWN_STDOUT_TO_DEV_NULL", + G_SPAWN_STDOUT_TO_DEV_NULL); + PyModule_AddIntConstant(m, "SPAWN_STDERR_TO_DEV_NULL", + G_SPAWN_STDERR_TO_DEV_NULL); + PyModule_AddIntConstant(m, "SPAWN_CHILD_INHERITS_STDIN", + G_SPAWN_CHILD_INHERITS_STDIN); + PyModule_AddIntConstant(m, "SPAWN_FILE_AND_ARGV_ZERO", + G_SPAWN_FILE_AND_ARGV_ZERO); + + PyModule_AddIntConstant(m, "PRIORITY_HIGH", + G_PRIORITY_HIGH); + PyModule_AddIntConstant(m, "PRIORITY_DEFAULT", + G_PRIORITY_DEFAULT); + PyModule_AddIntConstant(m, "PRIORITY_HIGH_IDLE", + G_PRIORITY_HIGH_IDLE); + PyModule_AddIntConstant(m, "PRIORITY_DEFAULT_IDLE", + G_PRIORITY_DEFAULT_IDLE); + PyModule_AddIntConstant(m, "PRIORITY_LOW", + G_PRIORITY_LOW); + + PyModule_AddIntConstant(m, "IO_IN", G_IO_IN); + PyModule_AddIntConstant(m, "IO_OUT", G_IO_OUT); + PyModule_AddIntConstant(m, "IO_PRI", G_IO_PRI); + PyModule_AddIntConstant(m, "IO_ERR", G_IO_ERR); + PyModule_AddIntConstant(m, "IO_HUP", G_IO_HUP); + PyModule_AddIntConstant(m, "IO_NVAL", G_IO_NVAL); + + PyModule_AddIntConstant(m, "IO_STATUS_ERROR", + G_IO_STATUS_ERROR); + PyModule_AddIntConstant(m, "IO_STATUS_NORMAL", + G_IO_STATUS_NORMAL); + PyModule_AddIntConstant(m, "IO_STATUS_EOF", + G_IO_STATUS_EOF); + PyModule_AddIntConstant(m, "IO_STATUS_AGAIN", + G_IO_STATUS_AGAIN); + PyModule_AddIntConstant(m, "IO_FLAG_APPEND", + G_IO_FLAG_APPEND); + PyModule_AddIntConstant(m, "IO_FLAG_NONBLOCK", + G_IO_FLAG_NONBLOCK); + PyModule_AddIntConstant(m, "IO_FLAG_IS_READABLE", + G_IO_FLAG_IS_READABLE); + PyModule_AddIntConstant(m, "IO_FLAG_IS_WRITEABLE", + G_IO_FLAG_IS_WRITEABLE); + PyModule_AddIntConstant(m, "IO_FLAG_IS_SEEKABLE", + G_IO_FLAG_IS_SEEKABLE); + PyModule_AddIntConstant(m, "IO_FLAG_MASK", + G_IO_FLAG_MASK); + PyModule_AddIntConstant(m, "IO_FLAG_GET_MASK", + G_IO_FLAG_GET_MASK); + PyModule_AddIntConstant(m, "IO_FLAG_SET_MASK", + G_IO_FLAG_SET_MASK); + + PyModule_AddIntConstant(m, "OPTION_FLAG_HIDDEN", + G_OPTION_FLAG_HIDDEN); + PyModule_AddIntConstant(m, "OPTION_FLAG_IN_MAIN", + G_OPTION_FLAG_IN_MAIN); + PyModule_AddIntConstant(m, "OPTION_FLAG_REVERSE", + G_OPTION_FLAG_REVERSE); + PyModule_AddIntConstant(m, "OPTION_FLAG_NO_ARG", + G_OPTION_FLAG_NO_ARG); + PyModule_AddIntConstant(m, "OPTION_FLAG_FILENAME", + G_OPTION_FLAG_FILENAME); + PyModule_AddIntConstant(m, "OPTION_FLAG_OPTIONAL_ARG", + G_OPTION_FLAG_OPTIONAL_ARG); + PyModule_AddIntConstant(m, "OPTION_FLAG_NOALIAS", + G_OPTION_FLAG_NOALIAS); + + PyModule_AddIntConstant(m, "OPTION_ERROR_UNKNOWN_OPTION", + G_OPTION_ERROR_UNKNOWN_OPTION); + PyModule_AddIntConstant(m, "OPTION_ERROR_BAD_VALUE", + G_OPTION_ERROR_BAD_VALUE); + PyModule_AddIntConstant(m, "OPTION_ERROR_FAILED", + G_OPTION_ERROR_FAILED); + + PyModule_AddIntConstant(m, "USER_DIRECTORY_DESKTOP", + G_USER_DIRECTORY_DESKTOP); + PyModule_AddIntConstant(m, "USER_DIRECTORY_DOCUMENTS", + G_USER_DIRECTORY_DOCUMENTS); + PyModule_AddIntConstant(m, "USER_DIRECTORY_DOWNLOAD", + G_USER_DIRECTORY_DOWNLOAD); + PyModule_AddIntConstant(m, "USER_DIRECTORY_MUSIC", + G_USER_DIRECTORY_MUSIC); + PyModule_AddIntConstant(m, "USER_DIRECTORY_PICTURES", + G_USER_DIRECTORY_PICTURES); + PyModule_AddIntConstant(m, "USER_DIRECTORY_PUBLIC_SHARE", + G_USER_DIRECTORY_PUBLIC_SHARE); + PyModule_AddIntConstant(m, "USER_DIRECTORY_TEMPLATES", + G_USER_DIRECTORY_TEMPLATES); + PyModule_AddIntConstant(m, "USER_DIRECTORY_VIDEOS", + G_USER_DIRECTORY_VIDEOS); + + PyModule_AddStringConstant(m, "OPTION_REMAINING", + G_OPTION_REMAINING); + PyModule_AddStringConstant(m, "OPTION_ERROR", + (char*) g_quark_to_string(G_OPTION_ERROR)); +} + +PYGLIB_MODULE_START(_glib, "glib._glib") +{ + PyObject *d = PyModule_GetDict(module); + + pyglib_register_constants(module); + pyglib_register_api(d); + pyglib_register_error(d); + pyglib_register_version_tuples(d); + pyglib_iochannel_register_types(d); + pyglib_mainloop_register_types(d); + pyglib_maincontext_register_types(d); + pyglib_source_register_types(d); + pyglib_spawn_register_types(d); + pyglib_option_context_register_types(d); + pyglib_option_group_register_types(d); +} +PYGLIB_MODULE_END diff --git a/glib/option.py b/glib/option.py new file mode 100644 index 0000000..027752f --- /dev/null +++ b/glib/option.py @@ -0,0 +1,350 @@ +# -*- Mode: Python -*- +# pygobject - Python bindings for the GObject library +# Copyright (C) 2006 Johannes Hoelzl +# +# glib/option.py: GOption command line parser +# +# 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 + +"""GOption command line parser + +Extends optparse to use the GOptionGroup, GOptionEntry and GOptionContext +objects. So it is possible to use the gtk, gnome_program and gstreamer command +line groups and contexts. + +Use this interface instead of the raw wrappers of GOptionContext and +GOptionGroup in glib. +""" + +import sys +import optparse +from optparse import OptParseError, OptionError, OptionValueError, \ + BadOptionError, OptionConflictError + +import glib +_glib = sys.modules['glib._glib'] + +__all__ = [ + "OptParseError", + "OptionError", + "OptionValueError", + "BadOptionError", + "OptionConflictError" + "Option", + "OptionGroup", + "OptionParser", + "make_option", +] + +class Option(optparse.Option): + """Represents a command line option + + To use the extended possibilities of the GOption API Option + (and make_option) are extended with new types and attributes. + + Types: + 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. + + 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. + + For further help, see optparse.Option. + """ + TYPES = optparse.Option.TYPES + ( + 'filename', + ) + + ATTRS = optparse.Option.ATTRS + [ + 'hidden', + 'in_main', + 'optional_arg', + ] + + REMAINING = '--' + _glib.OPTION_REMAINING + + def __init__(self, *args, **kwargs): + optparse.Option.__init__(self, *args, **kwargs) + if not self._long_opts: + raise ValueError("%s at least one long option name.") + + if len(self._long_opts) < len(self._short_opts): + raise ValueError( + "%s at least more long option names than short option names.") + + if not self.help: + raise ValueError("%s needs a help message.", self._long_opts[0]) + + + def _set_opt_string(self, opts): + if self.REMAINING in opts: + self._long_opts.append(self.REMAINING) + optparse.Option._set_opt_string(self, opts) + if len(self._short_opts) > len(self._long_opts): + raise OptionError("goption.Option needs more long option names " + "than short option names") + + def _to_goptionentries(self): + flags = 0 + + if self.hidden: + self.flags |= _glib.OPTION_FLAG_HIDDEN + + if self.in_main: + self.flags |= _glib.OPTION_FLAG_IN_MAIN + + if self.takes_value(): + if self.optional_arg: + flags |= _glib.OPTION_FLAG_OPTIONAL_ARG + else: + flags |= _glib.OPTION_FLAG_NO_ARG + + if self.type == 'filename': + flags |= _glib.OPTION_FLAG_FILENAME + + for (long_name, short_name) in zip(self._long_opts, self._short_opts): + yield (long_name[2:], short_name[1], flags, self.help, self.metavar) + + for long_name in self._long_opts[len(self._short_opts):]: + yield (long_name[2:], '\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. + + To pass a OptionGroup into a function which expects a GOptionGroup (e.g. + gnome_program_init() ). OptionGroup.get_option_group() can be used. + + For further help, see optparse.OptionGroup. + """ + def __init__(self, name, description, help_description="", + option_list=None, defaults=None, + translation_domain=None): + optparse.OptionContainer.__init__(self, Option, 'error', description) + self.name = name + self.parser = None + self.help_description = help_description + if defaults: + self.defaults = defaults + + self.values = None + + self.translation_domain = translation_domain + + if option_list: + for option in option_list: + self.add_option(option) + + def _create_option_list(self): + self.option_list = [] + self._create_option_mappings() + + def _to_goptiongroup(self, parser): + def callback(option_name, option_value, group): + if option_name.startswith('--'): + opt = self._long_opt[option_name] + else: + opt = self._short_opt[option_name] + + try: + opt.process(option_name, option_value, self.values, parser) + except OptionValueError: + error = sys.exc_info()[1] + gerror = _glib.GError(str(error)) + gerror.domain = _glib.OPTION_ERROR + gerror.code = _glib.OPTION_ERROR_BAD_VALUE + gerror.message = str(error) + raise gerror + + group = _glib.OptionGroup(self.name, self.description, + self.help_description, callback) + if self.translation_domain: + group.set_translation_domain(self.translation_domain) + + entries = [] + for option in self.option_list: + entries.extend(option._to_goptionentries()) + group.add_entries(entries) + + return group + + def get_option_group(self, parser = None): + """ Returns the corresponding GOptionGroup object. + + Can be used as parameter for gnome_program_init(), gtk_init(). + """ + self.set_values_to_defaults() + return self._to_goptiongroup(parser) + + def set_values_to_defaults(self): + for option in self.option_list: + default = self.defaults.get(option.dest) + if isinstance(default, basestring): + opt_str = option.get_opt_string() + self.defaults[option.dest] = option.check_value( + opt_str, default) + self.values = optparse.Values(self.defaults) + +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. + + 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. + + OptionParser.add_option_group() does not only accept OptionGroup instances + but also glib.OptionGroup, which is returned by gtk_get_option_group(). + + Only glib.option.OptionGroup and glib.option.Option instances should + be passed as groups and options. + + For further help, see optparse.OptionParser. + """ + + def __init__(self, *args, **kwargs): + if 'option_class' not in kwargs: + kwargs['option_class'] = Option + self.help_enabled = kwargs.pop('help_enabled', True) + self.ignore_unknown_options = kwargs.pop('ignore_unknown_options', + False) + optparse.OptionParser.__init__(self, add_help_option=False, + *args, **kwargs) + + def set_usage(self, usage): + if usage is None: + self.usage = '' + elif usage.startswith("%prog"): + self.usage = usage[len("%prog"):] + else: + self.usage = usage + + def _to_goptioncontext(self, values): + if self.description: + parameter_string = self.usage + " - " + self.description + else: + parameter_string = self.usage + context = _glib.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): + g_group = option_group + else: + g_group = option_group.get_option_group(self) + context.add_group(g_group) + + def callback(option_name, option_value, group): + if option_name.startswith('--'): + opt = self._long_opt[option_name] + else: + opt = self._short_opt[option_name] + opt.process(option_name, option_value, values, self) + + main_group = _glib.OptionGroup(None, None, None, callback) + main_entries = [] + for option in self.option_list: + main_entries.extend(option._to_goptionentries()) + main_group.add_entries(main_entries) + context.set_main_group(main_group) + + return context + + def add_option_group(self, *args, **kwargs): + if isinstance(args[0], basestring): + optparse.OptionParser.add_option_group(self, + OptionGroup(self, *args, **kwargs)) + return + elif len(args) == 1 and not kwargs: + if isinstance(args[0], OptionGroup): + if not args[0].parser: + args[0].parser = self + if args[0].parser is not self: + raise ValueError("invalid OptionGroup (wrong parser)") + if isinstance(args[0], _glib.OptionGroup): + self.option_groups.append(args[0]) + return + optparse.OptionParser.add_option_group(self, *args, **kwargs) + + def _get_all_options(self): + options = self.option_list[:] + for group in self.option_groups: + if isinstance(group, optparse.OptionGroup): + options.extend(group.option_list) + return options + + def _process_args(self, largs, rargs, values): + context = self._to_goptioncontext(values) + + # _process_args() returns the remaining parameters in rargs. + # The prepended program name is used to all g_set_prgname() + # The program name is cut away so it doesn't appear in the result. + 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: + error = sys.exc_info()[1] + if error.domain != _glib.OPTION_ERROR: + raise + if error.code == _glib.OPTION_ERROR_BAD_VALUE: + raise OptionValueError(error.message) + elif error.code == _glib.OPTION_ERROR_UNKNOWN_OPTION: + raise BadOptionError(error.message) + elif error.code == _glib.OPTION_ERROR_FAILED: + raise OptParseError(error.message) + else: + raise + + for group in self.option_groups: + 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/glib/pygiochannel.c b/glib/pygiochannel.c new file mode 100644 index 0000000..4c935e8 --- /dev/null +++ b/glib/pygiochannel.c @@ -0,0 +1,740 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include /* for PyMemberDef */ + +#include "pyglib.h" +#include "pyglib-private.h" +#include "pygsource.h" + +typedef struct { + PyObject_HEAD + GIOChannel *channel; + int softspace; /* to make print >> chan, "foo" ... work */ +} PyGIOChannel; + +PYGLIB_DEFINE_TYPE("glib.IOChannel", PyGIOChannel_Type, PyGIOChannel) + +static PyObject* +py_io_channel_next(PyGIOChannel *self) +{ + PyObject* ret_obj = NULL; + gsize length = 0, terminator_pos; + gchar *str_return = NULL; + GError *error = NULL; + GIOStatus status; + + status = g_io_channel_read_line(self->channel, &str_return, &length, + &terminator_pos, &error); + if (pyglib_error_check(&error)) + return NULL; + + if (status == G_IO_STATUS_EOF) { + PyErr_SetString(PyExc_StopIteration, "EOF"); + return NULL; + } + + ret_obj = _PyUnicode_FromStringAndSize(str_return, length); + g_free(str_return); + return ret_obj; +} + +static int +py_io_channel_compare(PyGIOChannel *self, PyGIOChannel *v) +{ + if (self->channel == v->channel) return 0; + if (self->channel > v->channel) return -1; + return 1; +} + +static PyObject* +py_io_channel_get_iter(PyObject *self) +{ + Py_INCREF(self); + return self; +} + +static long +py_io_channel_hash(PyGIOChannel *self) +{ + return (long) self->channel; +} + +static void +py_io_channel_dealloc(PyGIOChannel *self) +{ + if (self->channel) + g_io_channel_unref(self->channel); + PyObject_DEL(self); +} + +static PyObject* +py_io_channel_shutdown(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "flush", NULL }; + GIOStatus ret; + PyObject* flush = Py_True; + GError* error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:glib.IOChannel.shutdown", kwlist, &flush)) + return NULL; + + ret = g_io_channel_shutdown(self->channel, PyObject_IsTrue(flush), &error); + if (pyglib_error_check(&error)) + return NULL; + + return _PyLong_FromLong(ret); +} + +/* character encoding conversion involved functions. + */ + +static PyObject* +py_io_channel_set_buffer_size(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "size", NULL }; + int size; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:glib.IOChannel.set_buffer_size", kwlist, &size)) + return NULL; + + g_io_channel_set_buffer_size(self->channel, size); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +py_io_channel_get_buffer_size(PyGIOChannel* self) +{ + return _PyLong_FromLong(g_io_channel_get_buffer_size(self->channel)); +} + +static PyObject* +py_io_channel_set_buffered(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "buffered", NULL }; + int buffered; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:glib.IOChannel.set_buffered", kwlist, &buffered)) + return NULL; + + g_io_channel_set_buffered(self->channel, buffered); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +py_io_channel_get_buffered(PyGIOChannel* self) +{ + return _PyLong_FromLong(g_io_channel_get_buffered(self->channel)); +} + +static PyObject* +py_io_channel_set_encoding(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "encoding", NULL }; + const char* encoding; + GError* error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "z:glib.IOChannel.set_encoding", kwlist, &encoding)) + return NULL; + + g_io_channel_set_encoding(self->channel, encoding, &error); + if (pyglib_error_check(&error)) + return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +py_io_channel_get_encoding(PyGIOChannel* self) +{ + const char* encoding = g_io_channel_get_encoding(self->channel); + + if (encoding == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + + return _PyUnicode_FromString(encoding); +} + +#define CHUNK_SIZE (8 * 1024) + +static PyObject* +py_io_channel_read_chars(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "max_count", NULL }; + int max_count = -1; + PyObject* ret_obj = NULL; + gsize total_read = 0; + GError* error = NULL; + GIOStatus status = G_IO_STATUS_NORMAL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:glib.IOChannel.read", kwlist, &max_count)) + return NULL; + + if (max_count == 0) + return _PyUnicode_FromString(""); + + while (status == G_IO_STATUS_NORMAL + && (max_count == -1 || total_read < max_count)) { + gsize single_read; + char* buf; + gsize buf_size; + + 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 = _PyUnicode_FromStringAndSize((char *)NULL, buf_size); + if (ret_obj == NULL) + goto failure; + } + else if (buf_size + total_read > _PyUnicode_GET_SIZE(ret_obj)) { + if (_PyUnicode_Resize(&ret_obj, buf_size + total_read) == -1) + goto failure; + } + + buf = _PyUnicode_AS_STRING(ret_obj) + total_read; + + pyglib_unblock_threads(); + status = g_io_channel_read_chars(self->channel, buf, buf_size, + &single_read, &error); + pyglib_block_threads(); + if (pyglib_error_check(&error)) + goto failure; + + total_read += single_read; + } + + if ( total_read != _PyUnicode_GET_SIZE(ret_obj) ) { + if (_PyUnicode_Resize(&ret_obj, total_read) == -1) + goto failure; + } + return ret_obj; + + failure: + Py_XDECREF(ret_obj); + return NULL; +} + +static PyObject* +py_io_channel_write_chars(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "buf", NULL }; + const char* buf; + Py_ssize_t buf_len; + gsize count; + GError* error = NULL; + GIOStatus status; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#:glib.IOChannel.write", + kwlist, &buf, &buf_len)) + return NULL; + + pyglib_unblock_threads(); + status = g_io_channel_write_chars(self->channel, buf, buf_len, &count, &error); + pyglib_block_threads(); + if (pyglib_error_check(&error)) + return NULL; + + return _PyLong_FromLong(count); +} + +static PyObject* +py_io_channel_write_lines(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "lines", NULL }; + char *buf; + Py_ssize_t buf_len; + gsize count; + GError* error = NULL; + GIOStatus status; + PyObject *iter, *value, *pylines; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:glib.IOChannel.writelines", + kwlist, &pylines)) + return NULL; + + iter = PyObject_GetIter(pylines); + + while (1) { + value = PyIter_Next(iter); + if (PyErr_ExceptionMatches(PyExc_StopIteration)) { + PyErr_Clear(); + goto normal_exit; + } + if (!_PyUnicode_Check(value)) { + PyErr_SetString(PyExc_TypeError, "glib.IOChannel.writelines must" + " be sequence/iterator of strings"); + Py_DECREF(iter); + return NULL; + } + _PyUnicode_AsStringAndSize(value, &buf, &buf_len); + pyglib_unblock_threads(); + status = g_io_channel_write_chars(self->channel, buf, buf_len, &count, &error); + pyglib_unblock_threads(); + Py_DECREF(value); + if (pyglib_error_check(&error)) { + Py_DECREF(iter); + return NULL; + } + } +normal_exit: + Py_DECREF(iter); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +py_io_channel_flush(PyGIOChannel* self) +{ + GError* error = NULL; + GIOStatus status; + + pyglib_unblock_threads(); + status = g_io_channel_flush(self->channel, &error); + pyglib_block_threads(); + if (pyglib_error_check(&error)) + return NULL; + + return _PyLong_FromLong(status); +} + +static PyObject* +py_io_channel_set_flags(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "flags", NULL }; + GIOFlags flags; + GIOStatus status; + GError* error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:glib.IOChannel.set_flags", + kwlist, &flags)) + return NULL; + + status = g_io_channel_set_flags(self->channel, flags, &error); + if (pyglib_error_check(&error)) + return NULL; + + return _PyLong_FromLong(status); +} + +static PyObject* +py_io_channel_get_flags(PyGIOChannel* self) +{ + return _PyLong_FromLong(g_io_channel_get_flags(self->channel)); +} + +static PyObject* +py_io_channel_get_buffer_condition(PyGIOChannel* self) +{ + return _PyLong_FromLong(g_io_channel_get_buffer_condition(self->channel)); +} + +static PyObject* +py_io_channel_set_close_on_unref(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "do_close", NULL }; + PyObject *do_close; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:glib.IOChannel.set_close_on_unref", + kwlist, &do_close)) + return NULL; + + g_io_channel_set_close_on_unref(self->channel, PyObject_IsTrue(do_close)); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* +py_io_channel_get_close_on_unref(PyGIOChannel* self) +{ + if (g_io_channel_get_close_on_unref(self->channel)) { + Py_INCREF(Py_True); + return Py_True; + } else { + Py_INCREF(Py_False); + return Py_False; + } +} + +typedef struct { + PyObject *callback; + PyObject *iochannel; + PyObject *user_data; +} PyGIOWatchData; + +static void +pyg_iowatch_data_free(PyGIOWatchData *data) +{ + Py_DECREF(data->callback); + Py_XDECREF(data->user_data); + Py_DECREF(data->iochannel); + g_slice_free(PyGIOWatchData, data); +} + +static gboolean +pyg_iowatch_marshal(GIOChannel *source, + GIOCondition condition, + gpointer user_data) +{ + PyObject *ret; + gboolean res; + PyGIOWatchData *data = (PyGIOWatchData *) user_data; + PyGILState_STATE state; + + g_return_val_if_fail(user_data != NULL, FALSE); + g_return_val_if_fail(((PyGIOChannel *) data->iochannel)->channel == source, + FALSE); + + state = pyglib_gil_state_ensure(); + + if (data->user_data) + ret = PyObject_CallFunction(data->callback, "OiO", data->iochannel, + condition, data->user_data); + else + ret = PyObject_CallFunction(data->callback, "Oi", data->iochannel, + condition); + + if (!ret) { + PyErr_Print(); + res = FALSE; + } else { + res = PyObject_IsTrue(ret); + Py_DECREF(ret); + } + pyglib_gil_state_release(state); + + return res; +} + + + +static PyObject * +py_io_channel_add_watch(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "condition", "callback", "user_data", "priority", NULL }; + PyObject *callback, *user_data = NULL; + int priority = G_PRIORITY_DEFAULT, condition; + GIOChannel *iochannel = NULL; + guint handler_id; + PyGIOWatchData *data; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "iO|Oi:glib.IOChannel.add_watch", + kwlist, &condition, &callback, + &user_data, &priority)) + return NULL; + + iochannel = ((PyGIOChannel *) self)->channel; + + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "second must be callable"); + return NULL; + } + + data = g_slice_new(PyGIOWatchData); + data->callback = callback; Py_INCREF(callback); + data->user_data = user_data; Py_XINCREF(user_data); + data->iochannel = self; Py_INCREF(self); + + handler_id = g_io_add_watch_full(((PyGIOChannel *) self)->channel, + priority, condition, + pyg_iowatch_marshal, data, + (GDestroyNotify) pyg_iowatch_data_free); + return PyLong_FromUnsignedLong(handler_id); +} + + +#ifdef G_OS_WIN32 + +static PyObject * +py_io_channel_win32_poll(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "fds", "timeout", NULL }; + GPollFD *pollfd; + PyObject *pyfds, *pyfd; + guint len, i; + gint timeout = -1; + gint result; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!|i:glib.IOChannel.win32_poll", + kwlist, &PyList_Type, &pyfds, &timeout)) + return NULL; + + len = PyList_Size(pyfds); + pollfd = g_newa(GPollFD, len); + for (i = 0; i < len; ++i) { + pyfd = PyList_GET_ITEM(pyfds, i); + if (!PyObject_TypeCheck(pyfd, &PyGPollFD_Type)) { + PyErr_SetString(PyExc_TypeError, "'fds' must be a list of glib.PollFD objects"); + return NULL; + } + pollfd[i] = ((PyGPollFD *) pyfd)->pollfd; + } + + result = g_io_channel_win32_poll(pollfd, len, timeout); + for (i = 0; i < len; ++i) { + pyfd = PyList_GET_ITEM(pyfds, i); + ((PyGPollFD *) pyfd)->pollfd = pollfd[i]; + } + return _PyLong_FromLong(result); +} + +static PyObject * +py_io_channel_win32_make_pollfd(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "condition", NULL }; + int condition; + GPollFD pollfd; + PyGPollFD *pypollfd; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "i:glib.IOChannel.win32_make_pollfd", + kwlist, &condition)) + return NULL; + + g_io_channel_win32_make_pollfd(((PyGIOChannel *) self)->channel, + condition, &pollfd); + pypollfd = PyObject_NEW(PyGPollFD, &PyGPollFD_Type); + pypollfd->pollfd = pollfd; + return (PyObject *) pypollfd; +} +#endif /* def G_OS_WIN32 */ + + +static PyObject* +py_io_channel_read_line(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "size", NULL }; + PyObject* ret_obj = NULL; + gsize length = 0, terminator_pos; + gchar *str_return = NULL; + GError *error = NULL; + gint size_hint = -1; + GIOStatus status; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:glib.IOChannel.readline", kwlist, + &size_hint)) + return NULL; + + status = g_io_channel_read_line(self->channel, &str_return, &length, + &terminator_pos, &error); + if (pyglib_error_check(&error)) + return NULL; + ret_obj = _PyUnicode_FromStringAndSize(str_return, length); + g_free(str_return); + return ret_obj; +} + +static PyObject* +py_io_channel_read_lines(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "size", NULL }; + PyObject *line = NULL; + gsize length = 0, terminator_pos; + gchar *str_return = NULL; + GError *error = NULL; + gint size_hint = -1; + GIOStatus status = G_IO_STATUS_NORMAL; + PyObject *list; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:glib.IOChannel.readlines", kwlist, + &size_hint)) + return NULL; + + list = PyList_New(0); + while (status == G_IO_STATUS_NORMAL) { + status = g_io_channel_read_line(self->channel, &str_return, &length, + &terminator_pos, &error); + if (pyglib_error_check(&error)) { + Py_DECREF(line); + return NULL; + } + line = _PyUnicode_FromStringAndSize(str_return, length); + g_free(str_return); + if (PyList_Append(list, line)) { + Py_DECREF(line); + Py_DECREF(list); + return NULL; + } + } + return list; +} + + +static PyObject* +py_io_channel_seek(PyGIOChannel* self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "offset", "whence", NULL }; + gint64 offset; + int whence = 0; + GIOStatus status; + GSeekType seek_type; + GError* error = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "L|i:glib.IOChannel.seek", + kwlist, &offset, &whence)) + return NULL; + + switch (whence) + { + case 0: seek_type = G_SEEK_SET; break; + case 1: seek_type = G_SEEK_CUR; break; + case 2: seek_type = G_SEEK_END; break; + default: + PyErr_SetString(PyExc_ValueError, "invalid 'whence' value"); + return NULL; + } + + status = g_io_channel_seek_position(self->channel, offset, + seek_type, &error); + if (pyglib_error_check(&error)) + return NULL; + + return _PyLong_FromLong(status); +} + +#if 0 // Not wrapped +void g_io_channel_set_line_term (GIOChannel *channel, + const gchar *line_term, + gint length); + +G_CONST_RETURN gchar* g_io_channel_get_line_term (GIOChannel *channel, + gint *length); + + + +GIOStatus g_io_channel_read_line_string (GIOChannel *channel, + GString *buffer, + gsize *terminator_pos, + GError **error); +GIOStatus g_io_channel_read_to_end (GIOChannel *channel, + gchar **str_return, + gsize *length, + GError **error); +GIOStatus g_io_channel_read_unichar (GIOChannel *channel, + gunichar *thechar, + GError **error); +GIOStatus g_io_channel_write_unichar (GIOChannel *channel, + gunichar thechar, + GError **error); +#endif // Not wrapped + +static PyMemberDef py_io_channel_members[] = { + { "softspace", T_INT, offsetof(PyGIOChannel, softspace), 0, NULL }, + { NULL, 0, 0, 0, NULL } +}; + +static PyMethodDef py_io_channel_methods[] = { + { "close", (PyCFunction)py_io_channel_shutdown, METH_KEYWORDS }, + { "flush", (PyCFunction)py_io_channel_flush, METH_NOARGS }, + { "set_encoding", (PyCFunction)py_io_channel_set_encoding, METH_KEYWORDS }, + { "get_encoding", (PyCFunction)py_io_channel_get_encoding, METH_NOARGS }, + { "set_buffered", (PyCFunction)py_io_channel_set_buffered, METH_KEYWORDS }, + { "get_buffered", (PyCFunction)py_io_channel_get_buffered, METH_NOARGS }, + { "set_buffer_size", (PyCFunction)py_io_channel_set_buffer_size, METH_KEYWORDS }, + { "get_buffer_size", (PyCFunction)py_io_channel_get_buffer_size, METH_NOARGS }, + { "read", (PyCFunction)py_io_channel_read_chars, METH_KEYWORDS }, + { "readline", (PyCFunction)py_io_channel_read_line, METH_KEYWORDS }, + { "readlines", (PyCFunction)py_io_channel_read_lines, METH_KEYWORDS }, + { "write", (PyCFunction)py_io_channel_write_chars, METH_KEYWORDS }, + { "writelines", (PyCFunction)py_io_channel_write_lines, METH_KEYWORDS }, + { "set_flags", (PyCFunction)py_io_channel_set_flags, METH_KEYWORDS }, + { "get_flags", (PyCFunction)py_io_channel_get_flags, METH_NOARGS }, + { "get_buffer_condition", (PyCFunction)py_io_channel_get_buffer_condition, METH_NOARGS }, + { "set_close_on_unref", (PyCFunction)py_io_channel_set_close_on_unref, METH_KEYWORDS }, + { "get_close_on_unref", (PyCFunction)py_io_channel_get_close_on_unref, METH_NOARGS }, + { "add_watch", (PyCFunction)py_io_channel_add_watch, METH_KEYWORDS }, + { "seek", (PyCFunction)py_io_channel_seek, METH_KEYWORDS }, +#ifdef G_OS_WIN32 + { "win32_make_pollfd", (PyCFunction)py_io_channel_win32_make_pollfd, METH_KEYWORDS }, + { "win32_poll", (PyCFunction)py_io_channel_win32_poll, METH_KEYWORDS|METH_STATIC }, +#endif + { NULL, NULL, 0 } +}; + + +static int +py_io_channel_init(PyGIOChannel *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "filedes", "filename", "mode", +#ifdef G_OS_WIN32 + "hwnd", +#endif + NULL }; + int fd = -1; + char *mode = "r", *filename = NULL; + GError *error = NULL; +#ifdef G_OS_WIN32 + guint hwnd = 0; +#endif + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iss" +#ifdef G_OS_WIN32 + "I" +#endif + ":glib.IOChannel.__init__", + kwlist, &fd, &filename, &mode +#ifdef G_OS_WIN32 + , &hwnd +#endif + )) + return -1; + + if (fd != -1) + self->channel = g_io_channel_unix_new(fd); + else if (filename != NULL) { + self->channel = g_io_channel_new_file(filename, mode, &error); + if (pyglib_error_check(&error)) + return -1; + } +#ifdef G_OS_WIN32 + else if (hwnd != 0) { + self->channel = g_io_channel_win32_new_messages(hwnd); + } +#endif + else { +#ifdef G_OS_WIN32 + PyErr_SetString(PyExc_TypeError, "either a valid file descriptor, " + "file name, or window handle must be supplied"); +#else + PyErr_SetString(PyExc_TypeError, "either a valid file descriptor " + "or file name must be supplied"); +#endif + return -1; + } + return 0; +} + +void +pyglib_iochannel_register_types(PyObject *d) +{ + PyGIOChannel_Type.tp_init = (initproc)py_io_channel_init; + PyGIOChannel_Type.tp_dealloc = (destructor)py_io_channel_dealloc; + PyGIOChannel_Type.tp_flags = Py_TPFLAGS_DEFAULT; + PyGIOChannel_Type.tp_members = py_io_channel_members; + PyGIOChannel_Type.tp_methods = py_io_channel_methods; + PyGIOChannel_Type.tp_hash = (hashfunc)py_io_channel_hash; + PyGIOChannel_Type.tp_compare = (cmpfunc)py_io_channel_compare; + PyGIOChannel_Type.tp_iter = (getiterfunc)py_io_channel_get_iter; + PyGIOChannel_Type.tp_iternext = (iternextfunc)py_io_channel_next; + + PYGLIB_REGISTER_TYPE(d, PyGIOChannel_Type, "IOChannel"); +} diff --git a/glib/pygiochannel.h b/glib/pygiochannel.h new file mode 100644 index 0000000..9b03edd --- /dev/null +++ b/glib/pygiochannel.h @@ -0,0 +1,29 @@ +/* -*- 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 __PYG_IOCHANNEL_H__ +#define __PYG_IOCHANNEL_H__ + +extern PyTypeObject PyGIOChannel_Type; + +void pyglib_iochannel_register_types(PyObject *d); + +#endif /* __PYG_IOCHANNEL_H__ */ diff --git a/glib/pyglib-private.h b/glib/pyglib-private.h new file mode 100644 index 0000000..8b033e1 --- /dev/null +++ b/glib/pyglib-private.h @@ -0,0 +1,46 @@ +/* -*- 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; +}; + +gboolean _pyglib_handler_marshal(gpointer user_data); +void _pyglib_destroy_notify(gpointer user_data); + +G_END_DECLS + +#endif /* __PYGLIB_PRIVATE_H__ */ + + diff --git a/glib/pyglib-python-compat.h b/glib/pyglib-python-compat.h new file mode 100644 index 0000000..915a912 --- /dev/null +++ b/glib/pyglib-python-compat.h @@ -0,0 +1,120 @@ +/* -*- 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__ + +/* Python 2.3 does not define Py_CLEAR */ +#ifndef Py_CLEAR +#define Py_CLEAR(op) \ + do { \ + if (op) { \ + PyObject *tmp = (PyObject *)(op); \ + (op) = NULL; \ + Py_DECREF(tmp); \ + } \ + } while (0) +#endif + +/* Compilation on Python 2.4 */ +#if PY_VERSION_HEX < 0x02050000 +typedef int Py_ssize_t; +#define PY_SSIZE_T_MAX INT_MAX +#define PY_SSIZE_T_MIN INT_MIN +typedef inquiry lenfunc; +#endif + +/* Compilation on Python 2.x */ +#if PY_VERSION_HEX < 0x03000000 +#define RO READONLY +#define _PyUnicode_Check PyString_Check +#define _PyUnicode_AsString PyString_AsString +#define _PyUnicode_AsStringAndSize PyString_AsStringAndSize +#define _PyUnicode_FromString PyString_FromString +#define _PyUnicode_FromStringAndSize PyString_FromStringAndSize +#define _PyUnicode_FromFormat PyString_FromFormat +#define _PyUnicode_AS_STRING PyString_AS_STRING +#define _PyUnicode_GET_SIZE PyString_GET_SIZE +#define _PyUnicode_Resize _PyString_Resize +#define _PyUnicode_Type PyString_Type +#define _PyLong_Check PyInt_Check +#define _PyLong_FromLong PyInt_FromLong +#define _PyLong_AsLong PyInt_AsLong +#define _PyLongObject PyIntObject +#define _PyLong_Type PyInt_Type +#define _PyLong_AS_LONG PyInt_AS_LONG +#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) +#else +#undef PYGLIB_MODULE_START +#undef PYGLIB_MODULE_END +#undef PYGLIB_DEFINE_TYPE +#undef PYGLIB_REGISTER_TYPE + +#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) \ +{ \ + 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 _PyUnicode_Check PyUnicode_Check +#define _PyUnicode_AsString PyUnicode_AsString +#define _PyUnicode_AsStringAndSize(obj, buf, size) PyUnicode_AsStringAndSize(obj, size) +#define _PyUnicode_FromString PyUnicode_FromString +#define _PyUnicode_FromStringAndSize PyUnicode_FromStringAndSize +#define _PyUnicode_FromFormat PyUnicode_FromFormat +#define _PyUnicode_AS_STRING _PyUnicode_AsString +#define _PyUnicode_GET_SIZE PyUnicode_GET_SIZE +#define _PyUnicode_Resize PyUnicode_Resize +#define _PyUnicode_Type PyUnicode_Type +#define _PyLong_Check PyLong_Check +#define _PyLong_FromLong PyLong_FromLong +#define _PyLong_AsLong PyLong_AsLong +#define _PyLong_AS_LONG PyLong_AS_LONG +#define _PyLongObject PyLongObject +#define _PyLong_Type PyLong_Type +#endif + +#endif /* __PYGLIB_PYTHON_COMPAT_H__ */ diff --git a/glib/pyglib.c b/glib/pyglib.c new file mode 100644 index 0000000..a1bdbb9 --- /dev/null +++ b/glib/pyglib.c @@ -0,0 +1,577 @@ +/* -*- 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 "pygmaincontext.h" +#include "pygoptioncontext.h" +#include "pygoptiongroup.h" + +static struct _PyGLib_Functions *_PyGLib_API; +static int pyglib_thread_state_tls_key; +static PyObject *exception_table = NULL; + +static PyTypeObject *_PyGMainContext_Type; +#define PyGMainContext_Type (*_PyGMainContext_Type) + +static PyTypeObject *_PyGOptionGroup_Type; +#define PyGOptionGroup_Type (*_PyGOptionGroup_Type) + +static PyTypeObject *_PyGOptionContext_Type; +#define PyGOptionContext_Type (*_PyGOptionContext_Type) + +void +pyglib_init(void) +{ + PyObject *glib, *cobject; + + glib = PyImport_ImportModule("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 glib (error was: %s)", + _PyUnicode_AsString(py_orig_exc)); + Py_DECREF(py_orig_exc); + } else { + PyErr_SetString(PyExc_ImportError, + "could not import glib (no error given)"); + } + return; + } + + cobject = PyObject_GetAttrString(glib, "_PyGLib_API"); + if (cobject && PyCObject_Check(cobject)) + _PyGLib_API = (struct _PyGLib_Functions *) PyCObject_AsVoidPtr(cobject); + else { + PyErr_SetString(PyExc_ImportError, + "could not import glib (could not find _PyGLib_API object)"); + Py_DECREF(glib); + return; + } + + _PyGMainContext_Type = (PyTypeObject*)PyObject_GetAttrString(glib, "MainContext"); + _PyGOptionGroup_Type = (PyTypeObject*)PyObject_GetAttrString(glib, "OptionGroup"); + _PyGOptionContext_Type = (PyTypeObject*)PyObject_GetAttrString(glib, "OptionContext"); +} + +void +pyglib_init_internal(PyObject *api) +{ + _PyGLib_API = (struct _PyGLib_Functions *) PyCObject_AsVoidPtr(api); +} + +gboolean +pyglib_threads_enabled(void) +{ + g_return_val_if_fail (_PyGLib_API != NULL, FALSE); + + return _PyGLib_API->threads_enabled; +} + +PyGILState_STATE +pyglib_gil_state_ensure(void) +{ + g_return_val_if_fail (_PyGLib_API != NULL, PyGILState_LOCKED); + + if (!_PyGLib_API->threads_enabled) + return PyGILState_LOCKED; + + return PyGILState_Ensure(); +} + +void +pyglib_gil_state_release(PyGILState_STATE state) +{ + g_return_if_fail (_PyGLib_API != NULL); + + if (!_PyGLib_API->threads_enabled) + return; + + PyGILState_Release(state); +} + +/** + * pyglib_enable_threads: + * + * Returns: TRUE if threading is enabled, FALSE otherwise. + * + */ +#ifdef DISABLE_THREADING +gboolean +pyglib_enable_threads(void) +{ + PyErr_SetString(PyExc_RuntimeError, + "pyglib threading disabled at compile time"); + return FALSE; +} + +void +_pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback) +{ + /* Ignore, threads cannot be enabled. */ +} + +#else + +static GSList *thread_enabling_callbacks = NULL; + +/* Enable threading; note that the GIL must be held by the current + * thread when this function is called + */ +gboolean +pyglib_enable_threads(void) +{ + GSList *callback; + + g_return_val_if_fail (_PyGLib_API != NULL, FALSE); + + if (_PyGLib_API->threads_enabled) + return TRUE; + + PyEval_InitThreads(); + if (!g_threads_got_initialized) + g_thread_init(NULL); + + _PyGLib_API->threads_enabled = TRUE; + pyglib_thread_state_tls_key = PyThread_create_key(); + + for (callback = thread_enabling_callbacks; callback; callback = callback->next) + ((PyGLibThreadsEnabledFunc) callback->data) (); + + g_slist_free(thread_enabling_callbacks); + return TRUE; +} + +void +_pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback) +{ + if (callback && !pyglib_threads_enabled()) + thread_enabling_callbacks = g_slist_append(thread_enabling_callbacks, callback); +} +#endif + +int +pyglib_gil_state_ensure_py23 (void) +{ + return PyGILState_Ensure(); +} + +void +pyglib_gil_state_release_py23 (int flag) +{ + PyGILState_Release(flag); +} + +/** + * pyglib_block_threads: + * + */ +void +pyglib_block_threads(void) +{ + g_return_if_fail (_PyGLib_API != NULL); + + if (_PyGLib_API->block_threads != NULL) + (* _PyGLib_API->block_threads)(); +} + +/** + * pyglib_unblock_threads: + * + */ +void +pyglib_unblock_threads(void) +{ + g_return_if_fail (_PyGLib_API != NULL); + if (_PyGLib_API->unblock_threads != NULL) + (* _PyGLib_API->unblock_threads)(); +} + +/** + * pyglib_set_thread_block_funcs: + * + * hooks to register handlers for getting GDK threads to cooperate + * with python threading + */ +void +pyglib_set_thread_block_funcs (PyGLibThreadBlockFunc block_threads_func, + PyGLibThreadBlockFunc unblock_threads_func) +{ + g_return_if_fail (_PyGLib_API != NULL); + + _PyGLib_API->block_threads = block_threads_func; + _PyGLib_API->unblock_threads = unblock_threads_func; +} + + +/** + * 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_type; + PyObject *exc_instance; + PyObject *d; + + g_return_val_if_fail(error != NULL, FALSE); + + if (*error == NULL) + return FALSE; + + state = pyglib_gil_state_ensure(); + + exc_type = _PyGLib_API->gerror_exception; + if (exception_table != NULL) + { + PyObject *item; + item = PyDict_GetItem(exception_table, _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=_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=_PyLong_FromLong((*error)->code)); + Py_DECREF(d); + + if ((*error)->message) { + PyObject_SetAttrString(exc_instance, "message", + d=_PyUnicode_FromString((*error)->message)); + Py_DECREF(d); + } else { + PyObject_SetAttrString(exc_instance, "message", Py_None); + } + + 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 || !_PyUnicode_Check(py_message)) { + bad_gerror_message = "glib.GError instances must have a 'message' string attribute"; + goto bad_gerror; + } + + py_domain = PyObject_GetAttrString(value, "domain"); + if (!py_domain || !_PyUnicode_Check(py_domain)) { + bad_gerror_message = "glib.GError instances must have a 'domain' string attribute"; + Py_DECREF(py_message); + goto bad_gerror; + } + + py_code = PyObject_GetAttrString(value, "code"); + if (!py_code || !_PyLong_Check(py_code)) { + bad_gerror_message = "glib.GError instances must have a 'code' int attribute"; + Py_DECREF(py_message); + Py_DECREF(py_domain); + goto bad_gerror; + } + + g_set_error(error, g_quark_from_string(_PyUnicode_AsString(py_domain)), + _PyLong_AsLong(py_code), _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, 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, + _PyLong_FromLong(error_domain), + exception); + + return exception; +} + +/** + * pyglib_main_context_new: + * @context: a GMainContext. + * + * Creates a wrapper for a GMainContext. + * + * Returns: the GMainContext wrapper. + */ +PyObject * +pyglib_main_context_new(GMainContext *context) +{ + PyGMainContext *self; + + self = (PyGMainContext *)PyObject_NEW(PyGMainContext, + &PyGMainContext_Type); + if (self == NULL) + return NULL; + + self->context = g_main_context_ref(context); + return (PyObject *)self; +} + +/** + * 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) +{ + PyGOptionGroup *self; + + self = (PyGOptionGroup *)PyObject_NEW(PyGOptionGroup, + &PyGOptionGroup_Type); + if (self == NULL) + return NULL; + + self->group = group; + self->other_owner = TRUE; + self->is_in_context = FALSE; + + return (PyObject *)self; +} + +/** + * pyglib_option_context_new: + * @context: a GOptionContext + * + * Returns: A new GOptionContext wrapper. + */ +PyObject * +pyglib_option_context_new (GOptionContext *context) +{ + PyGOptionContext *self; + + self = (PyGOptionContext *)PyObject_NEW(PyGOptionContext, + &PyGOptionContext_Type); + if (self == NULL) + return NULL; + + self->context = context; + self->main_group = NULL; + + return (PyObject *)self; +} + +/** + * pyglib_option_context_new: + * @context: a GTimeVal struct + * + * Converts a GTimeVal struct to a python float + * + * Returns: a float representing the timeval + */ +PyObject * +pyglib_float_from_timeval(GTimeVal timeval) +{ + double ret; + ret = (double)timeval.tv_sec + (double)timeval.tv_usec * 0.000001; + return PyFloat_FromDouble(ret); +} + + +/****** 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; +} + + diff --git a/glib/pyglib.h b/glib/pyglib.h new file mode 100644 index 0000000..84bb36c --- /dev/null +++ b/glib/pyglib.h @@ -0,0 +1,94 @@ +/* -*- 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); +PyGILState_STATE pyglib_gil_state_ensure(void); +void pyglib_gil_state_release(PyGILState_STATE state); +int pyglib_enable_threads(void); +gboolean pyglib_error_check(GError **error); +gboolean pyglib_gerror_exception_check(GError **error); +PyObject *pyglib_register_exception_for_domain(gchar *name, + gint error_domain); +gboolean pyglib_threads_enabled(void); +PyObject * pyglib_main_context_new(GMainContext *context); +void pyglib_set_thread_block_funcs(PyGLibThreadBlockFunc block_threads_func, + PyGLibThreadBlockFunc unblock_threads_func); +void pyglib_block_threads(void); +void pyglib_unblock_threads(void); +PyObject * pyglib_option_context_new(GOptionContext *context); +PyObject * pyglib_option_group_new(GOptionGroup *group); +GOptionGroup * pyglib_option_group_transfer_group(PyObject *self); +PyObject * pyglib_float_from_timeval(GTimeVal timeval); + +/* Private: for gobject <-> glib interaction only. */ +void _pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback); + +#define pyglib_begin_allow_threads \ + G_STMT_START { \ + PyThreadState *_save = NULL; \ + if (pyglib_threads_enabled()) \ + _save = PyEval_SaveThread(); + +#define pyglib_end_allow_threads \ + if (pyglib_threads_enabled()) \ + PyEval_RestoreThread(_save); \ + } G_STMT_END + +#define PYGLIB_MODULE_START(symbol, modname) \ +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); + +G_END_DECLS + +#endif /* __PYGLIB_H__ */ + diff --git a/glib/pygmaincontext.c b/glib/pygmaincontext.c new file mode 100644 index 0000000..186215a --- /dev/null +++ b/glib/pygmaincontext.c @@ -0,0 +1,99 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * + * pygmaincontext.c: GMainContext wrapper + * + * 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 "pygmaincontext.h" +#include "pyglib.h" +#include "pyglib-private.h" + +PYGLIB_DEFINE_TYPE("glib.MainContext", PyGMainContext_Type, PyGMainContext) + +static int +pyg_main_context_init(PyGMainContext *self) +{ + self->context = g_main_context_new(); + return 0; +} + +static void +pyg_main_context_dealloc(PyGMainContext *self) +{ + if (self->context != NULL) { + g_main_context_unref(self->context); + self->context = NULL; + } + + PyObject_Del(self); +} + +static int +pyg_main_context_compare(PyGMainContext *self, PyGMainContext *v) +{ + if (self->context == v->context) return 0; + if (self->context > v->context) return -1; + return 1; +} + +static PyObject * +_wrap_g_main_context_iteration (PyGMainContext *self, PyObject *args) +{ + gboolean ret, may_block = TRUE; + + if (!PyArg_ParseTuple(args, "|i:GMainContext.iteration", + &may_block)) + return NULL; + + pyglib_begin_allow_threads; + ret = g_main_context_iteration(self->context, may_block); + pyglib_end_allow_threads; + + return PyBool_FromLong(ret); +} + +static PyObject * +_wrap_g_main_context_pending (PyGMainContext *self) +{ + return PyBool_FromLong(g_main_context_pending(self->context)); +} + +static PyMethodDef _PyGMainContext_methods[] = { + { "iteration", (PyCFunction)_wrap_g_main_context_iteration, METH_VARARGS }, + { "pending", (PyCFunction)_wrap_g_main_context_pending, METH_NOARGS }, + { NULL, NULL, 0 } +}; + +void +pyglib_maincontext_register_types(PyObject *d) +{ + PyGMainContext_Type.tp_dealloc = (destructor)pyg_main_context_dealloc; + PyGMainContext_Type.tp_compare = (cmpfunc)pyg_main_context_compare; + PyGMainContext_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; + PyGMainContext_Type.tp_methods = _PyGMainContext_methods; + PyGMainContext_Type.tp_init = (initproc)pyg_main_context_init; + PYGLIB_REGISTER_TYPE(d, PyGMainContext_Type, "MainContext"); +} diff --git a/glib/pygmaincontext.h b/glib/pygmaincontext.h new file mode 100644 index 0000000..038cb37 --- /dev/null +++ b/glib/pygmaincontext.h @@ -0,0 +1,40 @@ +/* -*- 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 __PYG_MAINCONTEXT_H__ +#define __PYG_MAINCONTEXT_H__ + +#include +#include + +typedef struct { + PyObject_HEAD + GMainContext *context; +} PyGMainContext; + +extern PyTypeObject PyGMainContext_Type; + +PyObject * pyglib_main_context_new(GMainContext *context); + +void pyglib_maincontext_register_types(PyObject *d); + +#endif /* __PYG_MAINCONTEXT_H__ */ + diff --git a/glib/pygmainloop.c b/glib/pygmainloop.c new file mode 100644 index 0000000..d9f048c --- /dev/null +++ b/glib/pygmainloop.c @@ -0,0 +1,354 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * Copyright (C) 2004 Johan Dahlin + * + * pygmainloop.c: GMainLoop wrapper + * + * 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 "pygmainloop.h" +#include "pygmaincontext.h" +#include "pyglib.h" +#include "pyglib-private.h" + +static int pipe_fds[2]; + +typedef struct { + GSource source; + GPollFD fd; +} PySignalWatchSource; + +#ifdef DISABLE_THREADING +static GMainLoop *pyg_current_main_loop = NULL;; + +static inline GMainLoop * +pyg_save_current_main_loop (GMainLoop *main_loop) +{ + GMainLoop *retval = pyg_current_main_loop; + + g_return_val_if_fail(main_loop != NULL, NULL); + + pyg_current_main_loop = g_main_loop_ref(main_loop); + + return retval; +} + +static inline void +pyg_restore_current_main_loop (GMainLoop *main_loop) +{ + if (pyg_current_main_loop != NULL) + g_main_loop_unref(pyg_current_main_loop); + pyg_current_main_loop = main_loop; +} + +static inline GMainLoop * +pyg_get_current_main_loop (void) +{ + return pyg_current_main_loop; +} +#else /* !defined(#ifndef DISABLE_THREADING) */ + +static int pyg_current_main_loop_key = -1; + +static inline GMainLoop * +pyg_save_current_main_loop (GMainLoop *main_loop) +{ + GMainLoop *retval; + + g_return_val_if_fail(main_loop != NULL, NULL); + + if (pyg_current_main_loop_key == -1) + pyg_current_main_loop_key = PyThread_create_key(); + + retval = PyThread_get_key_value(pyg_current_main_loop_key); + PyThread_delete_key_value(pyg_current_main_loop_key); + PyThread_set_key_value(pyg_current_main_loop_key, + g_main_loop_ref(main_loop)); + + return retval; +} + +static inline void +pyg_restore_current_main_loop (GMainLoop *main_loop) +{ + GMainLoop *prev; + + g_return_if_fail (pyg_current_main_loop_key != -1); + + prev = PyThread_get_key_value(pyg_current_main_loop_key); + if (prev != NULL) + g_main_loop_unref(prev); + PyThread_delete_key_value(pyg_current_main_loop_key); + if (main_loop != NULL) + PyThread_set_key_value(pyg_current_main_loop_key, main_loop); +} + +static inline GMainLoop * +pyg_get_current_main_loop (void) +{ + if (pyg_current_main_loop_key == -1) + return NULL; + return PyThread_get_key_value(pyg_current_main_loop_key); +} +#endif /* DISABLE_THREADING */ + +static gboolean +pyg_signal_watch_prepare(GSource *source, + int *timeout) +{ + /* Python only invokes signal handlers from the main thread, + * so if a thread other than the main thread receives the signal + * from the kernel, PyErr_CheckSignals() from that thread will + * do nothing. + */ + +#ifdef HAVE_PYSIGNAL_SETWAKEUPFD + return FALSE; +#else /* !HAVE_PYSIGNAL_SETWAKEUPFD */ + /* On Windows g_poll() won't be interrupted by a signal + * (AFAIK), so we need the timeout there too, even if there's + * only one thread. + */ +#ifndef PLATFORM_WIN32 + if (!pyglib_threads_enabled()) + return FALSE; +#endif /* PLATFORM_WIN32 */ + + /* If we're using 2.5 or an earlier version of python we + * will default to a timeout every second, be aware, + * this will cause unnecessary wakeups, see + * http://bugzilla.gnome.org/show_bug.cgi?id=481569 + */ + *timeout = 1000; + return FALSE; +#endif /* HAVE_PYSIGNAL_SETWAKEUPFD */ +} + +static gboolean +pyg_signal_watch_check(GSource *source) +{ + PyGILState_STATE state; + GMainLoop *main_loop; + +#ifdef HAVE_PYSIGNAL_SETWAKEUPFD + PySignalWatchSource *real_source = (PySignalWatchSource *)source; + GPollFD *poll_fd = &real_source->fd; + unsigned char dummy; + if (poll_fd->revents & G_IO_IN) + read(poll_fd->fd, &dummy, 1); +#endif + + state = pyglib_gil_state_ensure(); + + main_loop = pyg_get_current_main_loop(); + + if (PyErr_CheckSignals() == -1 && main_loop != NULL) { + PyErr_SetNone(PyExc_KeyboardInterrupt); + g_main_loop_quit(main_loop); + } + + pyglib_gil_state_release(state); + + return FALSE; +} + +static gboolean +pyg_signal_watch_dispatch(GSource *source, + GSourceFunc callback, + gpointer user_data) +{ + /* We should never be dispatched */ + g_assert_not_reached(); + return TRUE; +} + +static GSourceFuncs pyg_signal_watch_funcs = +{ + pyg_signal_watch_prepare, + pyg_signal_watch_check, + pyg_signal_watch_dispatch +}; + +static GSource * +pyg_signal_watch_new(void) +{ + GSource *source = g_source_new(&pyg_signal_watch_funcs, + sizeof(PySignalWatchSource)); + +#ifdef HAVE_PYSIGNAL_SETWAKEUPFD + PySignalWatchSource *real_source = (PySignalWatchSource *)source; + int flag; + + /* Unfortunately we need to create a new pipe here instead of + * reusing the pipe inside the GMainContext. + * Ideally an api should be added to GMainContext which allows us + * to reuse that pipe which would suit us perfectly fine. + * XXX More efficient than a pipe, we could use an eventfd on Linux + * kernels that support it. + */ + gint already_piped = (pipe_fds[0] > 0); + if (!already_piped) { + if (pipe(pipe_fds) < 0) + g_error("Cannot create main loop pipe: %s\n", + g_strerror(errno)); + + /* Make the write end of the fd non blocking */ + flag = fcntl(pipe_fds[1], F_GETFL, 0); + flag |= O_NONBLOCK; + fcntl(pipe_fds[1], F_SETFL, flag); + } + + real_source->fd.fd = pipe_fds[0]; + real_source->fd.events = G_IO_IN | G_IO_HUP | G_IO_ERR; + g_source_add_poll(source, &real_source->fd); + + if (!already_piped) + PySignal_SetWakeupFd(pipe_fds[1]); +#endif + return source; +} + +PYGLIB_DEFINE_TYPE("glib.MainLoop", PyGMainLoop_Type, PyGMainLoop) + +static int +pyg_main_loop_init(PyGMainLoop *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "context", "is_running", NULL }; + PyObject *py_context = Py_None; + int is_running = 0; + GMainContext *context; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|Ob:GMainLoop.__init__", + kwlist, &py_context, &is_running)) + return -1; + + if (!PyObject_TypeCheck(py_context, &PyGMainContext_Type) && + py_context != Py_None) { + PyErr_SetString(PyExc_TypeError, + "context must be a glib.MainContext or None"); + return -1; + } + + if (py_context != Py_None) { + context = ((PyGMainContext*)py_context)->context; + } else { + context = NULL; + } + + self->loop = g_main_loop_new(context, is_running); + + self->signal_source = pyg_signal_watch_new(); + g_source_attach(self->signal_source, context); + g_source_unref(self->signal_source); + + return 0; +} + +static void +pyg_main_loop_dealloc(PyGMainLoop *self) +{ + if (self->signal_source != NULL) { + g_source_destroy(self->signal_source); + self->signal_source = NULL; + } + + if (self->loop != NULL) { + g_main_loop_unref(self->loop); + self->loop = NULL; + } + + PyObject_Del(self); +} + +static int +pyg_main_loop_compare(PyGMainLoop *self, PyGMainLoop *v) +{ + if (self->loop == v->loop) return 0; + if (self->loop > v->loop) return -1; + return 1; +} + +static PyObject * +_wrap_g_main_loop_get_context (PyGMainLoop *loop) +{ + return pyglib_main_context_new(g_main_loop_get_context(loop->loop)); +} + +static PyObject * +_wrap_g_main_loop_is_running (PyGMainLoop *self) +{ + return PyBool_FromLong(g_main_loop_is_running(self->loop)); +} + +static PyObject * +_wrap_g_main_loop_quit (PyGMainLoop *self) +{ + g_main_loop_quit(self->loop); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +_wrap_g_main_loop_run (PyGMainLoop *self) +{ + GMainLoop *prev_loop; + + prev_loop = pyg_save_current_main_loop(self->loop); + + pyglib_begin_allow_threads; + g_main_loop_run(self->loop); + pyglib_end_allow_threads; + + pyg_restore_current_main_loop(prev_loop); + + if (PyErr_Occurred()) + return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef _PyGMainLoop_methods[] = { + { "get_context", (PyCFunction)_wrap_g_main_loop_get_context, METH_NOARGS }, + { "is_running", (PyCFunction)_wrap_g_main_loop_is_running, METH_NOARGS }, + { "quit", (PyCFunction)_wrap_g_main_loop_quit, METH_NOARGS }, + { "run", (PyCFunction)_wrap_g_main_loop_run, METH_NOARGS }, + { NULL, NULL, 0 } +}; + +void +pyglib_mainloop_register_types(PyObject *d) +{ + PyGMainLoop_Type.tp_dealloc = (destructor)pyg_main_loop_dealloc; + PyGMainLoop_Type.tp_compare = (cmpfunc)pyg_main_loop_compare; + PyGMainLoop_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; + PyGMainLoop_Type.tp_methods = _PyGMainLoop_methods; + PyGMainLoop_Type.tp_init = (initproc)pyg_main_loop_init; + PYGLIB_REGISTER_TYPE(d, PyGMainLoop_Type, "MainLoop"); +} diff --git a/glib/pygmainloop.h b/glib/pygmainloop.h new file mode 100644 index 0000000..dec82d8 --- /dev/null +++ b/glib/pygmainloop.h @@ -0,0 +1,36 @@ +/* -*- 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 __PYG_MAINLOOP_H__ +#define __PYG_MAINLOOP_H__ + +typedef struct { + PyObject_HEAD + GMainLoop *loop; + GSource *signal_source; +} PyGMainLoop; + +extern PyTypeObject PyGMainLoop_Type; + +void pyglib_mainloop_register_types(PyObject *d); + +#endif /* __PYG_MAINLOOP_H__ */ + diff --git a/glib/pygoptioncontext.c b/glib/pygoptioncontext.c new file mode 100644 index 0000000..92ba901 --- /dev/null +++ b/glib/pygoptioncontext.c @@ -0,0 +1,312 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 2006 Johannes Hoelzl + * + * pygoptioncontext.c: GOptionContext wrapper + * + * 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 "pyglib-private.h" +#include "pygoptioncontext.h" + +PYGLIB_DEFINE_TYPE("glib.OptionContext", PyGOptionContext_Type, PyGOptionContext) + +static int +pyg_option_context_init(PyGOptionContext *self, + PyObject *args, + PyObject *kwargs) +{ + char *parameter_string; + + if (!PyArg_ParseTuple(args, "s:glib.GOptionContext.__init__", + ¶meter_string)) + return -1; + + self->context = g_option_context_new(parameter_string); + return 0; +} + +static void +pyg_option_context_dealloc(PyGOptionContext *self) +{ + Py_CLEAR(self->main_group); + + if (self->context != NULL) + { + GOptionContext *tmp = self->context; + self->context = NULL; + g_option_context_free(tmp); + } + + PyObject_Del(self); +} + +static PyObject * +pyg_option_context_parse(PyGOptionContext *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "argv", NULL }; + PyObject *arg; + PyObject *new_argv, *argv; + Py_ssize_t argv_length, pos; + gint argv_length_int; + char **argv_content, **original; + GError *error = NULL; + gboolean result; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GOptionContext.parse", + kwlist, &argv)) + return NULL; + + if (!PyList_Check(argv)) + { + PyErr_SetString(PyExc_TypeError, + "GOptionContext.parse expects a list of strings."); + return NULL; + } + + argv_length = PyList_Size(argv); + if (argv_length == -1) + { + PyErr_SetString(PyExc_TypeError, + "GOptionContext.parse expects a list of strings."); + return NULL; + } + + argv_content = g_new(char*, argv_length + 1); + argv_content[argv_length] = NULL; + for (pos = 0; pos < argv_length; pos++) + { + arg = PyList_GetItem(argv, pos); + argv_content[pos] = g_strdup(_PyUnicode_AsString(arg)); + if (argv_content[pos] == NULL) + { + g_strfreev(argv_content); + return NULL; + } + } + original = g_strdupv(argv_content); + + g_assert(argv_length <= G_MAXINT); + argv_length_int = argv_length; + pyglib_begin_allow_threads; + result = g_option_context_parse(self->context, &argv_length_int, &argv_content, + &error); + pyglib_end_allow_threads; + argv_length = argv_length_int; + + if (!result) + { + g_strfreev(argv_content); + g_strfreev(original); + pyglib_error_check(&error); + return NULL; + } + + new_argv = PyList_New(g_strv_length(argv_content)); + for (pos = 0; pos < argv_length; pos++) + { + arg = _PyUnicode_FromString(argv_content[pos]); + PyList_SetItem(new_argv, pos, arg); + } + + g_strfreev(original); + g_strfreev(argv_content); + return new_argv; +} + +static PyObject * +pyg_option_context_set_help_enabled(PyGOptionContext *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "help_enable", NULL }; + + PyObject *help_enabled; + if (! PyArg_ParseTupleAndKeywords(args, kwargs, + "O:GOptionContext.set_help_enabled", + kwlist, &help_enabled)) + return NULL; + + g_option_context_set_help_enabled(self->context, PyObject_IsTrue(help_enabled)); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_option_context_get_help_enabled(PyGOptionContext *self) +{ + return PyBool_FromLong(g_option_context_get_help_enabled(self->context)); +} + +static PyObject * +pyg_option_context_set_ignore_unknown_options(PyGOptionContext *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "ignore_unknown_options", NULL }; + PyObject *ignore_unknown_options; + + if (! PyArg_ParseTupleAndKeywords(args, kwargs, + "O:GOptionContext.set_ignore_unknown_options", + kwlist, &ignore_unknown_options)) + return NULL; + + g_option_context_set_ignore_unknown_options(self->context, + PyObject_IsTrue(ignore_unknown_options)); + + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_option_context_get_ignore_unknown_options(PyGOptionContext *self) +{ + return PyBool_FromLong( + g_option_context_get_ignore_unknown_options(self->context)); +} + +static PyObject * +pyg_option_context_set_main_group(PyGOptionContext *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "group", NULL }; + GOptionGroup *g_group; + PyObject *group; + + if (! PyArg_ParseTupleAndKeywords(args, kwargs, + "O:GOptionContext.set_main_group", + kwlist, &group)) + return NULL; + + if (PyObject_IsInstance(group, (PyObject*) &PyGOptionGroup_Type) != 1) { + PyErr_SetString(PyExc_TypeError, + "GOptionContext.set_main_group expects a GOptionGroup."); + return NULL; + } + + g_group = pyglib_option_group_transfer_group(group); + if (g_group == NULL) + { + PyErr_SetString(PyExc_RuntimeError, + "Group is already in a OptionContext."); + return NULL; + } + + g_option_context_set_main_group(self->context, g_group); + + Py_INCREF(group); + self->main_group = (PyGOptionGroup*) group; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_option_context_get_main_group(PyGOptionContext *self) +{ + if (self->main_group == NULL) + { + Py_INCREF(Py_None); + return Py_None; + } + Py_INCREF(self->main_group); + return (PyObject*) self->main_group; +} + +static PyObject * +pyg_option_context_add_group(PyGOptionContext *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "group", NULL }; + GOptionGroup *g_group; + PyObject *group; + + if (! PyArg_ParseTupleAndKeywords(args, kwargs, + "O:GOptionContext.add_group", + kwlist, &group)) + return NULL; + + if (PyObject_IsInstance(group, (PyObject*) &PyGOptionGroup_Type) != 1) { + PyErr_SetString(PyExc_TypeError, + "GOptionContext.add_group expects a GOptionGroup."); + return NULL; + } + + g_group = pyglib_option_group_transfer_group(group); + if (g_group == NULL) + { + PyErr_SetString(PyExc_RuntimeError, + "Group is already in a OptionContext."); + return NULL; + } + Py_INCREF(group); + + g_option_context_add_group(self->context, g_group); + + Py_INCREF(Py_None); + return Py_None; +} + +static int +pyg_option_context_compare(PyGOptionContext *self, PyGOptionContext *context) +{ + if (self->context == context->context) return 0; + if (self->context > context->context) + return 1; + return -1; +} + +static PyObject * +pyg_option_get_context(PyGOptionContext *self) +{ + return PyCObject_FromVoidPtr(self->context, NULL); +} + +static PyMethodDef pyg_option_context_methods[] = { + { "parse", (PyCFunction)pyg_option_context_parse, METH_VARARGS | METH_KEYWORDS }, + { "set_help_enabled", (PyCFunction)pyg_option_context_set_help_enabled, METH_VARARGS | METH_KEYWORDS }, + { "get_help_enabled", (PyCFunction)pyg_option_context_get_help_enabled, METH_NOARGS }, + { "set_ignore_unknown_options", (PyCFunction)pyg_option_context_set_ignore_unknown_options, METH_VARARGS | METH_KEYWORDS }, + { "get_ignore_unknown_options", (PyCFunction)pyg_option_context_get_ignore_unknown_options, METH_NOARGS }, + { "set_main_group", (PyCFunction)pyg_option_context_set_main_group, METH_VARARGS | METH_KEYWORDS }, + { "get_main_group", (PyCFunction)pyg_option_context_get_main_group, METH_NOARGS }, + { "add_group", (PyCFunction)pyg_option_context_add_group, METH_VARARGS | METH_KEYWORDS }, + { "_get_context", (PyCFunction)pyg_option_get_context, METH_NOARGS }, + { NULL, NULL, 0 }, +}; + +void +pyglib_option_context_register_types(PyObject *d) +{ + PyGOptionContext_Type.tp_dealloc = (destructor)pyg_option_context_dealloc; + PyGOptionContext_Type.tp_compare = (cmpfunc)pyg_option_context_compare; + 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"); +} diff --git a/glib/pygoptioncontext.h b/glib/pygoptioncontext.h new file mode 100644 index 0000000..85d0a47 --- /dev/null +++ b/glib/pygoptioncontext.h @@ -0,0 +1,37 @@ +/* -*- 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 __PYG_OPTIONCONTEXT_H__ +#define __PYG_OPTIONCONTEXT_H__ + +#include "pygoptiongroup.h" + +extern PyTypeObject PyGOptionContext_Type; + +typedef struct { + PyObject_HEAD + PyGOptionGroup *main_group; + GOptionContext *context; +} PyGOptionContext; + +void pyglib_option_context_register_types(PyObject *d); + +#endif /* __PYG_OPTIONCONTEXT_H__ */ diff --git a/glib/pygoptiongroup.c b/glib/pygoptiongroup.c new file mode 100644 index 0000000..70e4529 --- /dev/null +++ b/glib/pygoptiongroup.c @@ -0,0 +1,270 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygobject - Python bindings for the GLib, GObject and GIO + * Copyright (C) 2006 Johannes Hoelzl + * + * pygoptiongroup.c: GOptionContext and GOptionGroup wrapper + * + * 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 "pyglib-private.h" +#include "pygoptiongroup.h" + +PYGLIB_DEFINE_TYPE("glib.OptionGroup", PyGOptionGroup_Type, PyGOptionGroup) + +static gboolean +check_if_owned(PyGOptionGroup *self) +{ + if (self->other_owner) + { + PyErr_SetString(PyExc_ValueError, "The GOptionGroup was not created by " + "glib.OptionGroup(), so operation is not possible."); + return TRUE; + } + return FALSE; +} + +static void +destroy_g_group(PyGOptionGroup *self) +{ + PyGILState_STATE state; + state = pyglib_gil_state_ensure(); + + self->group = NULL; + Py_CLEAR(self->callback); + g_slist_foreach(self->strings, (GFunc) g_free, NULL); + g_slist_free(self->strings); + self->strings = NULL; + + if (self->is_in_context) + { + Py_DECREF(self); + } + + pyglib_gil_state_release(state); +} + +static int +pyg_option_group_init(PyGOptionGroup *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "name", "description", "help_description", + "callback", NULL }; + char *name, *description, *help_description; + PyObject *callback; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "zzzO:GOptionGroup.__init__", + kwlist, &name, &description, + &help_description, &callback)) + return -1; + + self->group = g_option_group_new(name, description, help_description, + self, (GDestroyNotify) destroy_g_group); + self->other_owner = FALSE; + self->is_in_context = FALSE; + + Py_INCREF(callback); + self->callback = callback; + + return 0; +} + +static void +pyg_option_group_dealloc(PyGOptionGroup *self) +{ + if (!self->other_owner && !self->is_in_context) + { + GOptionGroup *tmp = self->group; + self->group = NULL; + if (tmp) + g_option_group_free(tmp); + } + + PyObject_Del(self); +} + +static gboolean +arg_func(const gchar *option_name, + const gchar *value, + PyGOptionGroup *self, + GError **error) +{ + PyObject *ret; + PyGILState_STATE state; + gboolean no_error; + + state = pyglib_gil_state_ensure(); + + if (value == NULL) + ret = PyObject_CallFunction(self->callback, "sOO", + option_name, Py_None, self); + else + ret = PyObject_CallFunction(self->callback, "ssO", + option_name, value, self); + + if (ret != NULL) + { + Py_DECREF(ret); + no_error = TRUE; + } else + no_error = pyglib_gerror_exception_check(error) != -1; + + pyglib_gil_state_release(state); + return no_error; +} + +static PyObject * +pyg_option_group_add_entries(PyGOptionGroup *self, PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "entries", NULL }; + gssize entry_count, pos; + PyObject *entry_tuple, *list; + GOptionEntry *entries; + + if (check_if_owned(self)) + return NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GOptionGroup.add_entries", + kwlist, &list)) + return NULL; + + if (!PyList_Check(list)) + { + PyErr_SetString(PyExc_TypeError, + "GOptionGroup.add_entries expected a list of entries"); + return NULL; + } + + entry_count = PyList_Size(list); + if (entry_count == -1) + { + PyErr_SetString(PyExc_TypeError, + "GOptionGroup.add_entries expected a list of entries"); + return NULL; + } + + entries = g_new0(GOptionEntry, entry_count + 1); + for (pos = 0; pos < entry_count; pos++) + { + gchar *long_name, *description, *arg_description; + entry_tuple = PyList_GetItem(list, pos); + if (!PyTuple_Check(entry_tuple)) + { + PyErr_SetString(PyExc_TypeError, "GOptionGroup.add_entries " + "expected a list of entries"); + g_free(entries); + return NULL; + } + if (!PyArg_ParseTuple(entry_tuple, "scisz", + &long_name, + &(entries[pos].short_name), + &(entries[pos].flags), + &description, + &arg_description)) + { + PyErr_SetString(PyExc_TypeError, "GOptionGroup.add_entries " + "expected a list of entries"); + g_free(entries); + return NULL; + } + long_name = g_strdup(long_name); + self->strings = g_slist_prepend(self->strings, long_name); + entries[pos].long_name = long_name; + + description = g_strdup(description); + self->strings = g_slist_prepend(self->strings, description); + entries[pos].description = description; + + arg_description = g_strdup(arg_description); + self->strings = g_slist_prepend(self->strings, arg_description); + entries[pos].arg_description = arg_description; + + entries[pos].arg = G_OPTION_ARG_CALLBACK; + entries[pos].arg_data = arg_func; + } + + g_option_group_add_entries(self->group, entries); + + g_free(entries); + + Py_INCREF(Py_None); + return Py_None; +} + + +static PyObject * +pyg_option_group_set_translation_domain(PyGOptionGroup *self, + PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "domain", NULL }; + char *domain; + + if (check_if_owned(self)) + return NULL; + + if (self->group == NULL) + { + PyErr_SetString(PyExc_RuntimeError, + "The corresponding GOptionGroup was already freed, " + "probably through the release of GOptionContext"); + return NULL; + } + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "z:GOptionGroup.set_translate_domain", + kwlist, &domain)) + return NULL; + + g_option_group_set_translation_domain(self->group, domain); + + Py_INCREF(Py_None); + return Py_None; +} + +static int +pyg_option_group_compare(PyGOptionGroup *self, PyGOptionGroup *group) +{ + if (self->group == group->group) + return 0; + + if (self->group > group->group) + return 1; + + return -1; +} + +static PyMethodDef pyg_option_group_methods[] = { + { "add_entries", (PyCFunction)pyg_option_group_add_entries, METH_VARARGS | METH_KEYWORDS }, + { "set_translation_domain", (PyCFunction)pyg_option_group_set_translation_domain, METH_VARARGS | METH_KEYWORDS }, + { NULL, NULL, 0 }, +}; + +void +pyglib_option_group_register_types(PyObject *d) +{ + PyGOptionGroup_Type.tp_dealloc = (destructor)pyg_option_group_dealloc; + PyGOptionGroup_Type.tp_compare = (cmpfunc)pyg_option_group_compare; + 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"); +} diff --git a/glib/pygoptiongroup.h b/glib/pygoptiongroup.h new file mode 100644 index 0000000..cba6a79 --- /dev/null +++ b/glib/pygoptiongroup.h @@ -0,0 +1,40 @@ +/* -*- 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 __PYG_OPTIONGROUP_H__ +#define __PYG_OPTIONGROUP_H__ + +extern PyTypeObject PyGOptionGroup_Type; + +typedef struct { + PyObject_HEAD + GOptionGroup *group; + gboolean other_owner, is_in_context; + PyObject *callback; + GSList *strings; /* all strings added with the entries, are freed on + GOptionGroup.destroy() */ +} PyGOptionGroup; + +void pyglib_option_group_register_types(PyObject *d); + +#endif /* __PYG_OPTIONGROUP_H__ */ + + diff --git a/glib/pygsource.c b/glib/pygsource.c new file mode 100644 index 0000000..298b928 --- /dev/null +++ b/glib/pygsource.c @@ -0,0 +1,723 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * Copyright (C) 2005 Oracle + * + * Author: Manish Singh + * + * pygsource.c: GSource wrapper + * + * 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 /* for PyMemberDef */ +#include "pyglib.h" +#include "pyglib-private.h" +#include "pygmaincontext.h" +#include "pygsource.h" + +#define CHECK_DESTROYED(self, ret) G_STMT_START { \ + if ((self)->source == NULL) { \ + PyErr_SetString(PyExc_RuntimeError, "source is destroyed"); \ + return (ret); \ + } \ +} G_STMT_END + + +typedef struct { + PyObject_HEAD + GSource *source; + PyObject *inst_dict; + PyObject *weakreflist; + gboolean python_source; +} PyGSource; + +typedef struct +{ + GSource source; + PyObject *obj; +} PyGRealSource; + +/* glib.Source */ + +PYGLIB_DEFINE_TYPE("glib.Source", PyGSource_Type, PyGSource) + +static PyObject * +source_repr(PyGSource *self, const char *type) +{ + gchar buf[256], *desc; + + if (self->source) { + if (g_source_get_context(self->source)) + desc = "attached"; + else + desc = "unattached"; + } else { + desc = "destroyed"; + } + + if (type) + g_snprintf(buf, sizeof(buf), "<%s glib %s source at 0x%lx>", + desc, type, (long) self); + else + g_snprintf(buf, sizeof(buf), "<%s glib source at 0x%lx>", + desc, (long) self); + + return _PyUnicode_FromString(buf); +} + +static PyObject * +pyg_source_attach(PyGSource *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "context", NULL }; + PyGMainContext *py_context = NULL; + GMainContext *context = NULL; + guint id; + + if (!PyArg_ParseTupleAndKeywords (args, kwargs, + "|O!:attach", kwlist, + &PyGMainContext_Type, &py_context)) + return NULL; + + if (py_context) + context = py_context->context; + + CHECK_DESTROYED(self, NULL); + + if (self->python_source) { + PyGRealSource *pysource = (PyGRealSource *)self->source; + Py_INCREF(pysource->obj); + } + + id = g_source_attach(self->source, context); + return _PyLong_FromLong(id); +} + +static PyObject * +pyg_source_destroy(PyGSource *self) +{ + CHECK_DESTROYED(self, NULL); + + if (self->python_source && self->source->context) { + PyGRealSource *pysource = (PyGRealSource *)self->source; + Py_DECREF(pysource->obj); + } + + g_source_destroy(self->source); + self->source = NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_source_set_callback(PyGSource *self, PyObject *args) +{ + PyObject *first, *callback, *cbargs = NULL, *data; + gint len; + + CHECK_DESTROYED(self, NULL); + + len = PyTuple_Size (args); + if (len < 1) { + PyErr_SetString(PyExc_TypeError, + "set_callback requires at least 1 argument"); + return NULL; + } + + first = PySequence_GetSlice(args, 0, 1); + if (!PyArg_ParseTuple(first, "O:set_callback", &callback)) { + Py_DECREF (first); + return NULL; + } + Py_DECREF(first); + + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "first argument not callable"); + return NULL; + } + + cbargs = PySequence_GetSlice(args, 1, len); + if (cbargs == NULL) + return NULL; + + data = Py_BuildValue("(ON)", callback, cbargs); + if (data == NULL) + return NULL; + + g_source_set_callback(self->source, + _pyglib_handler_marshal, data, + _pyglib_destroy_notify); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_source_get_context(PyGSource *self) +{ + GMainContext *context; + + CHECK_DESTROYED(self, NULL); + + context = g_source_get_context(self->source); + + if (context) { + return pyglib_main_context_new(context); + } else { + Py_INCREF(Py_None); + return Py_None; + } +} + +static PyObject * +pyg_source_add_poll(PyGSource *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "fd", NULL }; + PyGPollFD *fd; + + if (!self->python_source) { + PyErr_SetString(PyExc_TypeError, + "add_poll can only be used with sources " + "implemented in python"); + return NULL; + } + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:add_poll", kwlist, + &PyGPollFD_Type, &fd)) + return NULL; + + CHECK_DESTROYED(self, NULL); + + g_source_add_poll(self->source, &fd->pollfd); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_source_remove_poll(PyGSource *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "fd", NULL }; + PyGPollFD *fd; + + if (!self->python_source) { + PyErr_SetString(PyExc_TypeError, + "remove_poll can only be used with sources " + "implemented in python"); + return NULL; + } + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O!:remove_poll", kwlist, + &PyGPollFD_Type, &fd)) + return NULL; + + CHECK_DESTROYED(self, NULL); + + g_source_remove_poll(self->source, &fd->pollfd); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_source_get_current_time(PyGSource *self) +{ + GTimeVal timeval; + double ret; + + CHECK_DESTROYED(self, NULL); + + g_source_get_current_time(self->source, &timeval); + ret = (double)timeval.tv_sec + (double)timeval.tv_usec * 0.000001; + return PyFloat_FromDouble(ret); +} + +static PyMethodDef pyg_source_methods[] = { + { "attach", (PyCFunction)pyg_source_attach, METH_KEYWORDS }, + { "destroy", (PyCFunction)pyg_source_destroy, METH_NOARGS }, + { "set_callback", (PyCFunction)pyg_source_set_callback, METH_VARARGS }, + { "get_context", (PyCFunction)pyg_source_get_context, METH_NOARGS }, + { "add_poll", (PyCFunction)pyg_source_add_poll, METH_KEYWORDS }, + { "remove_poll", (PyCFunction)pyg_source_remove_poll, METH_KEYWORDS }, + { "get_current_time", (PyCFunction)pyg_source_get_current_time, METH_NOARGS }, + { NULL, NULL, 0 } +}; + +static PyObject * +pyg_source_get_dict(PyGSource *self, void *closure) +{ + if (self->inst_dict == NULL) { + self->inst_dict = PyDict_New(); + if (self->inst_dict == NULL) + return NULL; + } + + Py_INCREF(self->inst_dict); + return self->inst_dict; +} + +static PyObject * +pyg_source_get_priority(PyGSource *self, void *closure) +{ + CHECK_DESTROYED(self, NULL); + + return _PyLong_FromLong(g_source_get_priority(self->source)); +} + +static int +pyg_source_set_priority(PyGSource *self, PyObject *value, void *closure) +{ + CHECK_DESTROYED(self, -1); + + if (value == NULL) { + PyErr_SetString(PyExc_TypeError, "cannot delete priority"); + return -1; + } + + if (!_PyLong_Check(value)) { + PyErr_SetString(PyExc_TypeError, "type mismatch"); + return -1; + } + + g_source_set_priority(self->source, _PyLong_AsLong(value)); + + return 0; +} + +static PyObject * +pyg_source_get_can_recurse(PyGSource *self, void *closure) +{ + CHECK_DESTROYED(self, NULL); + + return PyBool_FromLong(g_source_get_can_recurse(self->source)); +} + +static int +pyg_source_set_can_recurse(PyGSource *self, PyObject *value, void *closure) +{ + CHECK_DESTROYED(self, -1); + + if (value == NULL) { + PyErr_SetString(PyExc_TypeError, "cannot delete can_recurse"); + return -1; + } + + g_source_set_can_recurse(self->source, PyObject_IsTrue(value)); + + return 0; +} + +static PyObject * +pyg_source_get_id(PyGSource *self, void *closure) +{ + CHECK_DESTROYED(self, NULL); + + if (g_source_get_context(self->source) == NULL) { + PyErr_SetString(PyExc_RuntimeError, "source is not attached"); + return NULL; + } + + return _PyLong_FromLong(g_source_get_id(self->source)); +} + +static PyGetSetDef pyg_source_getsets[] = { + { "__dict__", (getter)pyg_source_get_dict, (setter)0 }, + {"priority", (getter)pyg_source_get_priority, (setter)pyg_source_set_priority }, + {"can_recurse", (getter)pyg_source_get_can_recurse, (setter)pyg_source_set_can_recurse }, + {"id", (getter)pyg_source_get_id, (setter)0 }, + {NULL, 0, 0} +}; + +static PyObject * +pyg_source_repr(PyGSource *self) +{ + return source_repr(self, NULL); +} + +static int +pyg_source_traverse(PyGSource *self, visitproc visit, void *arg) +{ + int ret = 0; + + if (self->inst_dict) ret = visit(self->inst_dict, arg); + if (ret != 0) return ret; + + return 0; +} + +static int +pyg_source_clear(PyGSource *self) +{ + PyObject *tmp; + + tmp = self->inst_dict; + self->inst_dict = NULL; + Py_XDECREF(tmp); + + if (self->source) { + g_source_unref(self->source); + self->source = NULL; + } + + return 0; +} + +static void +pyg_source_dealloc(PyGSource *self) +{ + PyObject_ClearWeakRefs((PyObject *)self); + + PyObject_GC_UnTrack((PyObject *)self); + + pyg_source_clear(self); + + PyObject_GC_Del(self); +} + +static gboolean +pyg_source_prepare(GSource *source, gint *timeout) +{ + PyGRealSource *pysource = (PyGRealSource *)source; + PyObject *t; + gboolean ret = FALSE; + gboolean got_err = TRUE; + PyGILState_STATE state; + + state = pyglib_gil_state_ensure(); + + t = PyObject_CallMethod(pysource->obj, "prepare", NULL); + + if (t == NULL) { + goto bail; + } else if (!PyObject_IsTrue(t)) { + got_err = FALSE; + goto bail; + } else if (!PyTuple_Check(t)) { + PyErr_SetString(PyExc_TypeError, + "source prepare function must return a tuple or False"); + goto bail; + } else if (PyTuple_Size(t) != 2) { + PyErr_SetString(PyExc_TypeError, + "source prepare function return tuple must be exactly " + "2 elements long"); + goto bail; + } + + ret = PyObject_IsTrue(PyTuple_GET_ITEM(t, 0)); + *timeout = _PyLong_AsLong(PyTuple_GET_ITEM(t, 1)); + + if (*timeout == -1 && PyErr_Occurred()) { + ret = FALSE; + goto bail; + } + + got_err = FALSE; + +bail: + if (got_err) + PyErr_Print(); + + Py_XDECREF(t); + + pyglib_gil_state_release(state); + + return ret; +} + +static gboolean +pyg_source_check(GSource *source) +{ + PyGRealSource *pysource = (PyGRealSource *)source; + PyObject *t; + gboolean ret; + PyGILState_STATE state; + + state = pyglib_gil_state_ensure(); + + t = PyObject_CallMethod(pysource->obj, "check", NULL); + + if (t == NULL) { + PyErr_Print(); + ret = FALSE; + } else { + ret = PyObject_IsTrue(t); + Py_DECREF(t); + } + + pyglib_gil_state_release(state); + + return ret; +} + +static gboolean +pyg_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(); + + if (callback) { + tuple = user_data; + + func = PyTuple_GetItem(tuple, 0); + args = PyTuple_GetItem(tuple, 1); + } else { + func = Py_None; + args = Py_None; + } + + t = PyObject_CallMethod(pysource->obj, "dispatch", "OO", func, args); + + if (t == NULL) { + PyErr_Print(); + ret = FALSE; + } else { + ret = PyObject_IsTrue(t); + Py_DECREF(t); + } + + pyglib_gil_state_release(state); + + return ret; +} + +static void +pyg_source_finalize(GSource *source) +{ + PyGRealSource *pysource = (PyGRealSource *)source; + PyObject *func, *t; + PyGILState_STATE state; + + state = pyglib_gil_state_ensure(); + + func = PyObject_GetAttrString(pysource->obj, "finalize"); + if (func) { + t = PyObject_CallObject(func, NULL); + Py_DECREF(func); + + if (t == NULL) { + PyErr_Print(); + } else { + Py_DECREF(t); + } + } + + pyglib_gil_state_release(state); +} + +static GSourceFuncs pyg_source_funcs = +{ + pyg_source_prepare, + pyg_source_check, + pyg_source_dispatch, + pyg_source_finalize +}; + +static int +pyg_source_init(PyGSource *self, PyObject *args, PyObject *kwargs) +{ + PyGRealSource *pysource; + + self->source = g_source_new(&pyg_source_funcs, sizeof(PyGRealSource)); + + pysource = (PyGRealSource *)self->source; + pysource->obj = (PyObject*)self; + + self->inst_dict = NULL; + self->weakreflist = NULL; + + self->python_source = TRUE; + + return 0; +} + +static void +pyg_source_free(PyObject *op) +{ + PyObject_GC_Del(op); +} + +/* glib.Idle */ + +PYGLIB_DEFINE_TYPE("glib.Idle", PyGIdle_Type, PyGSource) + +static PyObject * +pyg_idle_repr(PyGSource *self) +{ + return source_repr(self, "idle"); +} + +static int +pyg_idle_init(PyGSource *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "priority", NULL }; + gint priority = G_PRIORITY_DEFAULT_IDLE; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|i:glib.Idle.__init__", kwlist, + &priority)) + return -1; + + self->source = g_idle_source_new (); + + if (priority != G_PRIORITY_DEFAULT_IDLE) + g_source_set_priority(self->source, priority); + + self->inst_dict = NULL; + self->weakreflist = NULL; + + self->python_source = FALSE; + + return 0; +} + +/* glib.Timeout */ + +PYGLIB_DEFINE_TYPE("glib.Timeout", PyGTimeout_Type, PyGSource) + +static PyObject * +pyg_timeout_repr(PyGSource *self) +{ + return source_repr(self, "timeout"); +} + +static int +pyg_timeout_init(PyGSource *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "interval", "priority", NULL }; + gint priority = G_PRIORITY_DEFAULT; + guint interval; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "I|i:glib.Timeout.__init__", kwlist, + &interval, &priority)) + return -1; + + self->source = g_timeout_source_new(interval); + + if (priority != G_PRIORITY_DEFAULT) + g_source_set_priority(self->source, priority); + + self->inst_dict = NULL; + self->weakreflist = NULL; + + self->python_source = FALSE; + + return 0; +} + +/* glib.PollFD */ + +PYGLIB_DEFINE_TYPE("glib.PollFD", PyGPollFD_Type, PyGPollFD) + +static PyMemberDef pyg_poll_fd_members[] = { + { "fd", T_INT, offsetof(PyGPollFD, pollfd.fd), READONLY }, + { "events", T_USHORT, offsetof(PyGPollFD, pollfd.events), READONLY }, + { "revents", T_USHORT, offsetof(PyGPollFD, pollfd.revents), READONLY }, + { NULL, 0, 0, 0 } +}; + +static void +pyg_poll_fd_dealloc(PyGPollFD *self) +{ + Py_XDECREF(self->fd_obj); + PyObject_DEL(self); +} + +static PyObject * +pyg_poll_fd_repr(PyGPollFD *self) +{ + return _PyUnicode_FromFormat("", + self->pollfd.fd, self->pollfd.events, + (long)self); +} + +static int +pyg_poll_fd_init(PyGPollFD *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "fd", "events", NULL }; + PyObject *o; + gint fd; + gushort events; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "OH:glib.PollFD.__init__", kwlist, + &o, &events)) + return -1; + + fd = PyObject_AsFileDescriptor(o); + if (fd == -1) + return -1; + + self->pollfd.fd = fd; + self->pollfd.events = events; + self->pollfd.revents = 0; + + Py_INCREF(o); + self->fd_obj = o; + + return 0; +} + +void +pyglib_source_register_types(PyObject *d) +{ + PyGSource_Type.tp_flags = (Py_TPFLAGS_DEFAULT | + Py_TPFLAGS_BASETYPE | + Py_TPFLAGS_HAVE_GC); + PyGSource_Type.tp_init = (initproc)pyg_source_init; + PyGSource_Type.tp_free = (freefunc)pyg_source_free; + PyGSource_Type.tp_dealloc = (destructor)pyg_source_dealloc; + PyGSource_Type.tp_methods = pyg_source_methods; + PyGSource_Type.tp_repr = (reprfunc)pyg_source_repr; + PyGSource_Type.tp_traverse = (traverseproc)pyg_source_traverse; + PyGSource_Type.tp_clear = (inquiry)pyg_source_clear; + PyGSource_Type.tp_getset = pyg_source_getsets; + PyGSource_Type.tp_weaklistoffset = offsetof(PyGSource, weakreflist); + PyGSource_Type.tp_dictoffset = offsetof(PyGSource, inst_dict); + PYGLIB_REGISTER_TYPE(d, PyGSource_Type, "Source"); + + PyGIdle_Type.tp_repr = (reprfunc)pyg_idle_repr; + PyGIdle_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; + PyGIdle_Type.tp_base = (PyTypeObject *)&PyGSource_Type; + PyGIdle_Type.tp_init = (initproc)pyg_idle_init; + PYGLIB_REGISTER_TYPE(d, PyGIdle_Type, "Idle"); + + PyGTimeout_Type.tp_repr = (reprfunc)pyg_timeout_repr; + PyGTimeout_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; + PyGTimeout_Type.tp_base = (PyTypeObject *)&PyGSource_Type; + PyGTimeout_Type.tp_init = (initproc)pyg_timeout_init; + PYGLIB_REGISTER_TYPE(d, PyGTimeout_Type, "Timeout"); + + PyGPollFD_Type.tp_dealloc = (destructor)pyg_poll_fd_dealloc; + PyGPollFD_Type.tp_repr = (reprfunc)pyg_poll_fd_repr; + PyGPollFD_Type.tp_flags = Py_TPFLAGS_DEFAULT; + PyGPollFD_Type.tp_members = pyg_poll_fd_members; + PyGPollFD_Type.tp_init = (initproc)pyg_poll_fd_init; + PYGLIB_REGISTER_TYPE(d, PyGPollFD_Type, "PollFD"); +} diff --git a/glib/pygsource.h b/glib/pygsource.h new file mode 100644 index 0000000..bf2c673 --- /dev/null +++ b/glib/pygsource.h @@ -0,0 +1,39 @@ +/* -*- 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 __PYG_SOURCE_H__ +#define __PYG_SOURCE_H__ + +extern PyTypeObject PyGSource_Type; +extern PyTypeObject PyGIdle_Type; +extern PyTypeObject PyGTimeout_Type; +extern PyTypeObject PyGPollFD_Type; + +typedef struct +{ + PyObject_HEAD + GPollFD pollfd; + PyObject *fd_obj; +} PyGPollFD; + +void pyglib_source_register_types(PyObject *d); + +#endif /* __PYG_SOURCE_H__ */ diff --git a/glib/pygspawn.c b/glib/pygspawn.c new file mode 100644 index 0000000..cded501 --- /dev/null +++ b/glib/pygspawn.c @@ -0,0 +1,263 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pyglib - Python bindings for GLib toolkit. + * Copyright (C) 1998-2003 James Henstridge + * 2004-2008 Johan Dahlin + * + * pygspawn.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 + */ + +#include +#include + +#include "pyglib.h" +#include "pyglib-private.h" + +struct _PyGChildSetupData { + PyObject *func; + PyObject *data; +}; + +PYGLIB_DEFINE_TYPE("glib.Pid", PyGPid_Type, _PyLongObject) + +static PyObject * +pyg_pid_close(PyObject *self, PyObject *args, PyObject *kwargs) +{ + g_spawn_close_pid(_PyLong_AsLong(self)); + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef pyg_pid_methods[] = { + { "close", (PyCFunction)pyg_pid_close, METH_NOARGS }, + { NULL, NULL, 0 } +}; + +static void +pyg_pid_free(PyObject *gpid) +{ + g_spawn_close_pid((GPid) _PyLong_AsLong(gpid)); + _PyLong_Type.tp_free((void *) gpid); +} + +static int +pyg_pid_tp_init(PyObject *self, PyObject *args, PyObject *kwargs) +{ + PyErr_SetString(PyExc_TypeError, "glib.Pid cannot be manually instantiated"); + return -1; +} + +PyObject * +pyg_pid_new(GPid pid) +{ + _PyLongObject *pygpid; + pygpid = PyObject_NEW(_PyLongObject, &PyGPid_Type); + +#if PY_VERSION_HEX >= 0x03000000 +# warning "FIXME: figure out how to subclass long" +#else + pygpid->ob_ival = pid; +#endif + return (PyObject *) pygpid; +} + +static void +_pyg_spawn_async_callback(gpointer user_data) +{ + struct _PyGChildSetupData *data; + PyObject *retval; + PyGILState_STATE gil; + + data = (struct _PyGChildSetupData *) user_data; + gil = pyglib_gil_state_ensure(); + if (data->data) + retval = PyObject_CallFunction(data->func, "O", data->data); + else + retval = PyObject_CallFunction(data->func, NULL); + if (retval) + Py_DECREF(retval); + else + PyErr_Print(); + Py_DECREF(data->func); + Py_XDECREF(data->data); + g_slice_free(struct _PyGChildSetupData, data); + pyglib_gil_state_release(gil); +} + +PyObject * +pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "argv", "envp", "working_directory", "flags", + "child_setup", "user_data", "standard_input", + "standard_output", "standard_error", NULL }; + PyObject *pyargv, *pyenvp = NULL; + char **argv, **envp = NULL; + PyObject *func = Py_None, *user_data = NULL; + char *working_directory = NULL; + int flags = 0, _stdin = -1, _stdout = -1, _stderr = -1; + PyObject *pystdin = NULL, *pystdout = NULL, *pystderr = NULL; + gint *standard_input, *standard_output, *standard_error; + struct _PyGChildSetupData *callback_data = NULL; + GError *error = NULL; + GPid child_pid = -1; + Py_ssize_t len, i; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OsiOOOOO:glib.spawn_async", + kwlist, + &pyargv, &pyenvp, &working_directory, &flags, + &func, &user_data, + &pystdin, &pystdout, &pystderr)) + return NULL; + + if (pystdin && PyObject_IsTrue(pystdin)) + standard_input = &_stdin; + else + standard_input = NULL; + + if (pystdout && PyObject_IsTrue(pystdout)) + standard_output = &_stdout; + else + standard_output = NULL; + + if (pystderr && PyObject_IsTrue(pystderr)) + standard_error = &_stderr; + else + standard_error = NULL; + + /* parse argv */ + if (!PySequence_Check(pyargv)) { + PyErr_SetString(PyExc_TypeError, + "glib.spawn_async: " + "first argument must be a sequence of strings"); + return NULL; + } + len = PySequence_Length(pyargv); + argv = g_new0(char *, len + 1); + for (i = 0; i < len; ++i) { + PyObject *tmp = PySequence_ITEM(pyargv, i); + if (!_PyUnicode_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, + "glib.spawn_async: " + "first argument must be a sequence of strings"); + g_free(argv); + Py_XDECREF(tmp); + return NULL; + } + argv[i] = _PyUnicode_AsString(tmp); + Py_DECREF(tmp); + } + + /* parse envp */ + if (pyenvp) { + if (!PySequence_Check(pyenvp)) { + PyErr_SetString(PyExc_TypeError, + "glib.spawn_async: " + "second argument must be a sequence of strings"); + g_free(argv); + return NULL; + } + len = PySequence_Length(pyenvp); + envp = g_new0(char *, len + 1); + for (i = 0; i < len; ++i) { + PyObject *tmp = PySequence_ITEM(pyenvp, i); + if (!_PyUnicode_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, + "glib.spawn_async: " + "second argument must be a sequence of strings"); + g_free(envp); + Py_XDECREF(tmp); + g_free(argv); + return NULL; + } + envp[i] = _PyUnicode_AsString(tmp); + Py_DECREF(tmp); + } + } + + if (func != Py_None) { + if (!PyCallable_Check(func)) { + PyErr_SetString(PyExc_TypeError, "child_setup parameter must be callable or None"); + g_free(argv); + if (envp) + g_free(envp); + return NULL; + } + callback_data = g_slice_new(struct _PyGChildSetupData); + callback_data->func = func; + callback_data->data = user_data; + Py_INCREF(callback_data->func); + if (callback_data->data) + Py_INCREF(callback_data->data); + } + + if (!g_spawn_async_with_pipes(working_directory, argv, envp, flags, + (func != Py_None ? _pyg_spawn_async_callback : NULL), + callback_data, &child_pid, + standard_input, + standard_output, + standard_error, + &error)) + + + { + g_free(argv); + if (envp) g_free(envp); + if (callback_data) { + Py_DECREF(callback_data->func); + Py_XDECREF(callback_data->data); + g_slice_free(struct _PyGChildSetupData, callback_data); + } + pyglib_error_check(&error); + return NULL; + } + g_free(argv); + if (envp) g_free(envp); + + if (standard_input) + pystdin = _PyLong_FromLong(*standard_input); + else { + Py_INCREF(Py_None); + pystdin = Py_None; + } + + if (standard_output) + pystdout = _PyLong_FromLong(*standard_output); + else { + Py_INCREF(Py_None); + pystdout = Py_None; + } + + if (standard_error) + pystderr = _PyLong_FromLong(*standard_error); + else { + Py_INCREF(Py_None); + pystderr = Py_None; + } + + return Py_BuildValue("NNNN", pyg_pid_new(child_pid), pystdin, pystdout, pystderr); +} + +void +pyglib_spawn_register_types(PyObject *d) +{ + 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; + PYGLIB_REGISTER_TYPE(d, PyGPid_Type, "Pid"); +} diff --git a/glib/pygspawn.h b/glib/pygspawn.h new file mode 100644 index 0000000..2e8dd3c --- /dev/null +++ b/glib/pygspawn.h @@ -0,0 +1,32 @@ +/* -*- 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 __PYG_PID_H__ +#define __PYG_PID_H__ + +PyObject * pyg_pid_new(GPid pid); +void pyglib_spawn_register_types(PyObject *d); + +PyObject * pyglib_spawn_async(PyObject *self, PyObject *args, PyObject *kwargs); + + +#endif /* __PYG_PID_H__ */ + diff --git a/gobject/Makefile.am b/gobject/Makefile.am new file mode 100644 index 0000000..aff1609 --- /dev/null +++ b/gobject/Makefile.am @@ -0,0 +1,67 @@ +AUTOMAKE_OPTIONS = 1.7 +PLATFORM_VERSION = 2.0 + +pkgincludedir = $(includedir)/pygtk-$(PLATFORM_VERSION) +pkginclude_HEADERS = pygobject.h + +pkgpyexecdir = $(pyexecdir)/gtk-2.0 + +# gobject python scripts +pygobjectdir = $(pkgpyexecdir)/gobject +pygobject_PYTHON = \ + __init__.py \ + constants.py \ + propertyhelper.py +pygobject_LTLIBRARIES = _gobject.la + +common_ldflags = -module -avoid-version +if PLATFORM_WIN32 +common_ldflags += -no-undefined +endif + +_gobject_la_CFLAGS = \ + -I$(top_srcdir)/glib \ + $(PYTHON_INCLUDES) \ + $(FFI_CFLAGS) \ + $(GLIB_CFLAGS) \ + -DPY_SSIZE_T_CLEAN +_gobject_la_LDFLAGS = $(common_ldflags) -export-symbols-regex "_gobject|PyInit__gobject" +_gobject_la_LIBADD = \ + $(GLIB_LIBS) \ + $(FFI_LIBS) \ + $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.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 \ + pygi-external.h + +if HAVE_LIBFFI +_gobject_la_SOURCES += ffi-marshaller.c ffi-marshaller.h +endif + +if PLATFORM_WIN32 +_gobject_la_CFLAGS += -DPLATFORM_WIN32 +endif + + +all: $(pygobject_LTLIBRARIES:.la=.so) +clean-local: + rm -f $(pygobject_LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true diff --git a/gobject/Makefile.in b/gobject/Makefile.in new file mode 100644 index 0000000..ef997d9 --- /dev/null +++ b/gobject/Makefile.in @@ -0,0 +1,747 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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@ +@PLATFORM_WIN32_TRUE@am__append_1 = -no-undefined +@HAVE_LIBFFI_TRUE@am__append_2 = ffi-marshaller.c ffi-marshaller.h +@PLATFORM_WIN32_TRUE@am__append_3 = -DPLATFORM_WIN32 +subdir = gobject +DIST_COMMON = $(pkginclude_HEADERS) $(pygobject_PYTHON) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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__installdirs = "$(DESTDIR)$(pygobjectdir)" \ + "$(DESTDIR)$(pygobjectdir)" "$(DESTDIR)$(pkgincludedir)" +LTLIBRARIES = $(pygobject_LTLIBRARIES) +am__DEPENDENCIES_1 = +_gobject_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la +am___gobject_la_SOURCES_DIST = 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 pygi-external.h ffi-marshaller.c \ + ffi-marshaller.h +@HAVE_LIBFFI_TRUE@am__objects_1 = _gobject_la-ffi-marshaller.lo +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 \ + $(am__objects_1) +_gobject_la_OBJECTS = $(am__gobject_la_OBJECTS) +_gobject_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gobject_la_CFLAGS) \ + $(CFLAGS) $(_gobject_la_LDFLAGS) $(LDFLAGS) -o $@ +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) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(_gobject_la_SOURCES) +DIST_SOURCES = $(am___gobject_la_SOURCES_DIST) +py_compile = $(top_srcdir)/py-compile +HEADERS = $(pkginclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkgincludedir = $(includedir)/pygtk-$(PLATFORM_VERSION) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +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@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +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@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBFFI_PC = @LIBFFI_PC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PLATFORM = @PLATFORM@ +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_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +THREADING_CFLAGS = @THREADING_CFLAGS@ +VERSION = @VERSION@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +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@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = $(pyexecdir)/gtk-2.0 +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pygobject_CODEGEN_DEFINES = @pygobject_CODEGEN_DEFINES@ +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 = 2.0 +pkginclude_HEADERS = pygobject.h + +# gobject python scripts +pygobjectdir = $(pkgpyexecdir)/gobject +pygobject_PYTHON = \ + __init__.py \ + constants.py \ + propertyhelper.py + +pygobject_LTLIBRARIES = _gobject.la +common_ldflags = -module -avoid-version $(am__append_1) +_gobject_la_CFLAGS = -I$(top_srcdir)/glib $(PYTHON_INCLUDES) \ + $(FFI_CFLAGS) $(GLIB_CFLAGS) -DPY_SSIZE_T_CLEAN \ + $(am__append_3) +_gobject_la_LDFLAGS = $(common_ldflags) -export-symbols-regex "_gobject|PyInit__gobject" +_gobject_la_LIBADD = \ + $(GLIB_LIBS) \ + $(FFI_LIBS) \ + $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.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 \ + pygi-external.h $(am__append_2) +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) --gnu gobject/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu 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) + test -z "$(pygobjectdir)" || $(MKDIR_P) "$(DESTDIR)$(pygobjectdir)" + @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 " $(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)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +_gobject.la: $(_gobject_la_OBJECTS) $(_gobject_la_DEPENDENCIES) + $(_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-ffi-marshaller.Plo@am__quote@ +@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +_gobject_la-gobjectmodule.lo: gobjectmodule.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-gobjectmodule.Tpo $(DEPDIR)/_gobject_la-gobjectmodule.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gobjectmodule.c' object='_gobject_la-gobjectmodule.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-pygboxed.Tpo $(DEPDIR)/_gobject_la-pygboxed.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygboxed.c' object='_gobject_la-pygboxed.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-pygenum.Tpo $(DEPDIR)/_gobject_la-pygenum.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygenum.c' object='_gobject_la-pygenum.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-pygflags.Tpo $(DEPDIR)/_gobject_la-pygflags.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygflags.c' object='_gobject_la-pygflags.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-pyginterface.Tpo $(DEPDIR)/_gobject_la-pyginterface.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pyginterface.c' object='_gobject_la-pyginterface.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-pygobject.Tpo $(DEPDIR)/_gobject_la-pygobject.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygobject.c' object='_gobject_la-pygobject.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-pygparamspec.Tpo $(DEPDIR)/_gobject_la-pygparamspec.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygparamspec.c' object='_gobject_la-pygparamspec.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-pygpointer.Tpo $(DEPDIR)/_gobject_la-pygpointer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygpointer.c' object='_gobject_la-pygpointer.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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@ $(LIBTOOL) --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__mv) $(DEPDIR)/_gobject_la-pygtype.Tpo $(DEPDIR)/_gobject_la-pygtype.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pygtype.c' object='_gobject_la-pygtype.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --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 + +_gobject_la-ffi-marshaller.lo: ffi-marshaller.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -MT _gobject_la-ffi-marshaller.lo -MD -MP -MF $(DEPDIR)/_gobject_la-ffi-marshaller.Tpo -c -o _gobject_la-ffi-marshaller.lo `test -f 'ffi-marshaller.c' || echo '$(srcdir)/'`ffi-marshaller.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/_gobject_la-ffi-marshaller.Tpo $(DEPDIR)/_gobject_la-ffi-marshaller.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ffi-marshaller.c' object='_gobject_la-ffi-marshaller.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(_gobject_la_CFLAGS) $(CFLAGS) -c -o _gobject_la-ffi-marshaller.lo `test -f 'ffi-marshaller.c' || echo '$(srcdir)/'`ffi-marshaller.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pygobjectPYTHON: $(pygobject_PYTHON) + @$(NORMAL_INSTALL) + test -z "$(pygobjectdir)" || $(MKDIR_P) "$(DESTDIR)$(pygobjectdir)" + @list='$(pygobject_PYTHON)'; dlist=; list2=; test -n "$(pygobjectdir)" || list=; \ + 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 \ + if test -z "$(DESTDIR)"; then \ + PYTHON=$(PYTHON) $(py_compile) --basedir "$(pygobjectdir)" $$dlist; \ + else \ + PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pygobjectdir)" $$dlist; \ + fi; \ + else :; fi + +uninstall-pygobjectPYTHON: + @$(NORMAL_UNINSTALL) + @list='$(pygobject_PYTHON)'; test -n "$(pygobjectdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + filesc=`echo "$$files" | sed 's|$$|c|'`; \ + fileso=`echo "$$files" | sed 's|$$|o|'`; \ + echo " ( cd '$(DESTDIR)$(pygobjectdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pygobjectdir)" && rm -f $$files || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pygobjectdir)' && rm -f" $$filesc ")"; \ + cd "$(DESTDIR)$(pygobjectdir)" && rm -f $$filesc || exit $$?; \ + echo " ( cd '$(DESTDIR)$(pygobjectdir)' && rm -f" $$fileso ")"; \ + cd "$(DESTDIR)$(pygobjectdir)" && rm -f $$fileso +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" + @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ + 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|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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 +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-local clean-pygobjectLTLIBRARIES ctags \ + 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 uninstall uninstall-am \ + uninstall-pkgincludeHEADERS uninstall-pygobjectLTLIBRARIES \ + uninstall-pygobjectPYTHON + + +all: $(pygobject_LTLIBRARIES:.la=.so) +clean-local: + rm -f $(pygobject_LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true + +# 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/gobject/__init__.py b/gobject/__init__.py new file mode 100644 index 0000000..d5aec45 --- /dev/null +++ b/gobject/__init__.py @@ -0,0 +1,117 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# pygobject - Python bindings for the GObject library +# Copyright (C) 2006 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 + +from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, \ + io_add_watch, source_remove, child_watch_add, markup_escape_text, \ + get_current_time, filename_display_name, filename_display_basename, \ + filename_from_utf8, get_application_name, set_application_name, \ + get_prgname, set_prgname, main_depth, Pid, GError, glib_version, \ + MainLoop, MainContext, main_context_default, IOChannel, Source, Idle, \ + Timeout, PollFD, OptionGroup, OptionContext, option +from glib import SPAWN_LEAVE_DESCRIPTORS_OPEN, SPAWN_DO_NOT_REAP_CHILD, \ + SPAWN_SEARCH_PATH, SPAWN_STDOUT_TO_DEV_NULL, SPAWN_STDERR_TO_DEV_NULL, \ + SPAWN_CHILD_INHERITS_STDIN, SPAWN_FILE_AND_ARGV_ZERO, PRIORITY_HIGH, \ + PRIORITY_DEFAULT, PRIORITY_HIGH_IDLE, PRIORITY_DEFAULT_IDLE, \ + PRIORITY_LOW, IO_IN, IO_OUT, IO_PRI, IO_ERR, IO_HUP, IO_NVAL, \ + IO_STATUS_ERROR, IO_STATUS_NORMAL, IO_STATUS_EOF, IO_STATUS_AGAIN, \ + IO_FLAG_APPEND, IO_FLAG_NONBLOCK, IO_FLAG_IS_READABLE, \ + IO_FLAG_IS_WRITEABLE, IO_FLAG_IS_SEEKABLE, IO_FLAG_MASK, \ + IO_FLAG_GET_MASK, IO_FLAG_SET_MASK, OPTION_FLAG_HIDDEN, \ + OPTION_FLAG_IN_MAIN, OPTION_FLAG_REVERSE, OPTION_FLAG_NO_ARG, \ + OPTION_FLAG_FILENAME, OPTION_FLAG_OPTIONAL_ARG, OPTION_FLAG_NOALIAS, \ + OPTION_ERROR_UNKNOWN_OPTION, OPTION_ERROR_BAD_VALUE, \ + OPTION_ERROR_FAILED, OPTION_REMAINING, OPTION_ERROR + +from gobject.constants import * +from gobject._gobject import * +_PyGObject_API = _gobject._PyGObject_API + +from gobject.propertyhelper import property + +sys.modules['gobject.option'] = option + +class GObjectMeta(type): + "Metaclass for automatically registering GObject classes" + def __init__(cls, name, bases, dict_): + type.__init__(cls, name, bases, dict_) + cls._install_properties() + cls._type_register(cls.__dict__) + + def _install_properties(cls): + gproperties = getattr(cls, '__gproperties__', {}) + + props = [] + for name, prop in cls.__dict__.items(): + if isinstance(prop, property): # not same as the built-in + if name in gproperties: + raise ValueError + prop.name = name + gproperties[name] = prop.get_pspec_args() + props.append(prop) + + if not props: + return + + cls.__gproperties__ = gproperties + + if ('do_get_property' in cls.__dict__ or + 'do_set_property' in cls.__dict__): + for prop in props: + if (prop.getter != prop._default_getter or + prop.setter != prop._default_setter): + raise TypeError( + "GObject subclass %r defines do_get/set_property" + " and it also uses a property which a custom setter" + " or getter. This is not allowed" % ( + cls.__name__,)) + + def obj_get_property(self, pspec): + name = pspec.name.replace('-', '_') + prop = getattr(cls, name, None) + if prop: + return prop.getter(self) + cls.do_get_property = obj_get_property + + def obj_set_property(self, pspec, value): + name = pspec.name.replace('-', '_') + prop = getattr(cls, name, None) + if prop: + prop.setter(self, value) + cls.do_set_property = obj_set_property + + def _type_register(cls, namespace): + ## don't register the class if already registered + if '__gtype__' in namespace: + return + + if not ('__gproperties__' in namespace or + '__gsignals__' in namespace or + '__gtype_name__' in namespace): + return + + type_register(cls, namespace.get('__gtype_name__')) +_gobject._install_metaclass(GObjectMeta) + +del _gobject diff --git a/gobject/constants.py b/gobject/constants.py new file mode 100644 index 0000000..a6d3ce9 --- /dev/null +++ b/gobject/constants.py @@ -0,0 +1,83 @@ +# -*- 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 + +import sys + +import gobject._gobject +_gobject = sys.modules['gobject._gobject'] + +# TYPE_INVALID defined in gobjectmodule.c +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_UNICHAR = TYPE_UINT + +# do a little dance to maintain API compatibility +# as these were origianally defined here, and are +# now defined in gobjectmodule.c +G_MINFLOAT = _gobject.G_MINFLOAT +G_MAXFLOAT = _gobject.G_MAXFLOAT +G_MINDOUBLE = _gobject.G_MINDOUBLE +G_MAXDOUBLE = _gobject.G_MAXDOUBLE +G_MINSHORT = _gobject.G_MINSHORT +G_MAXSHORT = _gobject.G_MAXSHORT +G_MAXUSHORT = _gobject.G_MAXUSHORT +G_MININT = _gobject.G_MININT +G_MAXINT = _gobject.G_MAXINT +G_MAXUINT = _gobject.G_MAXUINT +G_MINLONG = _gobject.G_MINLONG +G_MAXLONG = _gobject.G_MAXLONG +G_MAXULONG = _gobject.G_MAXULONG +G_MININT8 = _gobject.G_MININT8 +G_MAXINT8 = _gobject.G_MAXINT8 +G_MAXUINT8 = _gobject.G_MAXUINT8 +G_MININT16 = _gobject.G_MININT16 +G_MAXINT16 = _gobject.G_MAXINT16 +G_MAXUINT16 = _gobject.G_MAXUINT16 +G_MININT32 = _gobject.G_MININT32 +G_MAXINT32 = _gobject.G_MAXINT32 +G_MAXUINT32 = _gobject.G_MAXUINT32 +G_MININT64 = _gobject.G_MININT64 +G_MAXINT64 = _gobject.G_MAXINT64 +G_MAXUINT64 = _gobject.G_MAXUINT64 +G_MAXSIZE = _gobject.G_MAXSIZE +G_MAXSSIZE = _gobject.G_MAXSSIZE +G_MINOFFSET = _gobject.G_MINOFFSET +G_MAXOFFSET = _gobject.G_MAXOFFSET + diff --git a/gobject/ffi-marshaller.c b/gobject/ffi-marshaller.c new file mode 100644 index 0000000..60cfc34 --- /dev/null +++ b/gobject/ffi-marshaller.c @@ -0,0 +1,194 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 2007 Johan Dahlin + * + * ffi-marshaller: Generic CMarshaller using libffi + * + * 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 +#include + +static ffi_type * +g_value_to_ffi_type (const GValue *gvalue, gpointer *value) +{ + ffi_type *rettype = NULL; + GType type = g_type_fundamental (G_VALUE_TYPE (gvalue)); + g_assert (type != G_TYPE_INVALID); + + switch (type) { + case G_TYPE_BOOLEAN: + case G_TYPE_CHAR: + case G_TYPE_INT: + rettype = &ffi_type_sint; + *value = (gpointer)&(gvalue->data[0].v_int); + break; + case G_TYPE_UCHAR: + case G_TYPE_UINT: + rettype = &ffi_type_uint; + *value = (gpointer)&(gvalue->data[0].v_uint); + break; + case G_TYPE_STRING: + case G_TYPE_OBJECT: + case G_TYPE_BOXED: + case G_TYPE_POINTER: + rettype = &ffi_type_pointer; + *value = (gpointer)&(gvalue->data[0].v_pointer); + break; + case G_TYPE_FLOAT: + rettype = &ffi_type_float; + *value = (gpointer)&(gvalue->data[0].v_float); + break; + case G_TYPE_DOUBLE: + rettype = &ffi_type_double; + *value = (gpointer)&(gvalue->data[0].v_double); + break; + case G_TYPE_LONG: + rettype = &ffi_type_slong; + *value = (gpointer)&(gvalue->data[0].v_long); + break; + case G_TYPE_ULONG: + rettype = &ffi_type_ulong; + *value = (gpointer)&(gvalue->data[0].v_ulong); + break; + case G_TYPE_INT64: + rettype = &ffi_type_sint64; + *value = (gpointer)&(gvalue->data[0].v_int64); + break; + case G_TYPE_UINT64: + rettype = &ffi_type_uint64; + *value = (gpointer)&(gvalue->data[0].v_uint64); + break; + default: + rettype = &ffi_type_pointer; + *value = NULL; + g_warning ("Unsupported fundamental type: %s", g_type_name (type)); + break; + } + return rettype; +} + +static void +g_value_from_ffi_type (GValue *gvalue, gpointer *value) +{ + switch (g_type_fundamental (G_VALUE_TYPE (gvalue))) { + case G_TYPE_INT: + g_value_set_int (gvalue, *(gint*)value); + break; + case G_TYPE_FLOAT: + g_value_set_float (gvalue, *(gfloat*)value); + break; + case G_TYPE_DOUBLE: + g_value_set_double (gvalue, *(gdouble*)value); + break; + case G_TYPE_BOOLEAN: + g_value_set_boolean (gvalue, *(gboolean*)value); + break; + case G_TYPE_STRING: + g_value_set_string (gvalue, *(gchar**)value); + break; + case G_TYPE_CHAR: + g_value_set_char (gvalue, *(gchar*)value); + break; + case G_TYPE_UCHAR: + g_value_set_uchar (gvalue, *(guchar*)value); + break; + case G_TYPE_UINT: + g_value_set_uint (gvalue, *(guint*)value); + break; + case G_TYPE_POINTER: + g_value_set_pointer (gvalue, *(gpointer*)value); + break; + case G_TYPE_LONG: + g_value_set_long (gvalue, *(glong*)value); + break; + case G_TYPE_ULONG: + g_value_set_ulong (gvalue, *(gulong*)value); + break; + case G_TYPE_INT64: + g_value_set_int64 (gvalue, *(gint64*)value); + break; + case G_TYPE_UINT64: + g_value_set_uint64 (gvalue, *(guint64*)value); + break; + case G_TYPE_BOXED: + g_value_set_boxed (gvalue, *(gpointer*)value); + break; + default: + g_warning ("Unsupported fundamental type: %s", + g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue)))); + } + +} + +void +g_cclosure_marshal_generic_ffi (GClosure *closure, + GValue *return_gvalue, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + ffi_type *rtype; + void *rvalue; + int n_args; + ffi_type **atypes; + void **args; + int i; + ffi_cif cif; + GCClosure *cc = (GCClosure*) closure; + + if (return_gvalue && G_VALUE_TYPE (return_gvalue)) + { + rtype = g_value_to_ffi_type (return_gvalue, &rvalue); + } + else + { + rtype = &ffi_type_void; + } + + rvalue = g_alloca (MAX (rtype->size, sizeof (ffi_arg))); + + n_args = n_param_values + 1; + atypes = g_alloca (sizeof (ffi_type *) * n_args); + args = g_alloca (sizeof (gpointer) * n_args); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + atypes[n_args-1] = g_value_to_ffi_type (param_values + 0, + &args[n_args-1]); + atypes[0] = &ffi_type_pointer; + args[0] = &closure->data; + } + else + { + atypes[0] = g_value_to_ffi_type (param_values + 0, &args[0]); + atypes[n_args-1] = &ffi_type_pointer; + args[n_args-1] = &closure->data; + } + + for (i = 1; i < n_args - 1; i++) + atypes[i] = g_value_to_ffi_type (param_values + i, &args[i]); + + if (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, n_args, rtype, atypes) != FFI_OK) + return; + + ffi_call (&cif, marshal_data ? marshal_data : cc->callback, rvalue, args); + + if (return_gvalue && G_VALUE_TYPE (return_gvalue)) + g_value_from_ffi_type (return_gvalue, rvalue); +} diff --git a/gobject/ffi-marshaller.h b/gobject/ffi-marshaller.h new file mode 100644 index 0000000..aac18bd --- /dev/null +++ b/gobject/ffi-marshaller.h @@ -0,0 +1,31 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 2007 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 _FFI_MARSHALLER_H_ +#define _FFI_MARSHALLER_H_ + +void g_cclosure_marshal_generic_ffi (GClosure *closure, + GValue *return_gvalue, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + +#endif /* _FFI_MARSHALLER_H_ */ diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c new file mode 100644 index 0000000..09244b8 --- /dev/null +++ b/gobject/gobjectmodule.c @@ -0,0 +1,2659 @@ +/* -*- 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 "pygobject-private.h" +#include "pygboxed.h" +#include "pygenum.h" +#include "pygflags.h" +#include "pyginterface.h" +#include "pygparamspec.h" +#include "pygpointer.h" +#include "pygtype.h" + +#ifdef HAVE_FFI_H +#include "ffi-marshaller.h" +static GSignalCMarshaller marshal_generic = g_cclosure_marshal_generic_ffi; +#else +static GSignalCMarshaller marshal_generic = 0; +#endif + +static PyObject *_pyg_signal_accumulator_true_handled_func; +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: + * @block_threads_func: a function to block Python threads. + * @unblock_threads_func: a function to unblock Python threads. + * + * an interface to allow pygtk to add hooks to handle threading + * similar to the old PyGTK 0.6.x releases. May not work quite right + * anymore. + */ +static void +pyg_set_thread_block_funcs (PyGThreadBlockFunc block_threads_func, + PyGThreadBlockFunc unblock_threads_func) +{ + g_return_if_fail(pygobject_api_functions.block_threads == NULL && + pygobject_api_functions.unblock_threads == NULL); + + pygobject_api_functions.block_threads = block_threads_func; + pygobject_api_functions.unblock_threads = unblock_threads_func; + pyglib_set_thread_block_funcs(block_threads_func, + unblock_threads_func); +} + +/** + * 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 _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; +#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 = _pyg_type_from_name(name); + if (type != 0) + return pyg_type_wrapper_new(type); + PyErr_Format(PyExc_RuntimeError, "%s: unknown type name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + name); + return NULL; +} + +static PyObject * +pyg_type_parent (PyObject *self, PyObject *args) +{ + PyObject *gtype; + GType type, parent; +#if 0 + if (PyErr_Warn(PyExc_DeprecationWarning, + "gobject.type_parent is deprecated; " + "use GType.parent instead")) + return NULL; +#endif + if (!PyArg_ParseTuple(args, "O:gobject.type_parent", >ype)) + return NULL; + if ((type = pyg_type_from_object(gtype)) == 0) + return NULL; + parent = g_type_parent(type); + if (parent != 0) + return pyg_type_wrapper_new(parent); + PyErr_SetString(PyExc_RuntimeError, "no parent for type"); + 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 PyObject * +pyg_type_children (PyObject *self, PyObject *args) +{ + PyObject *gtype, *list; + GType type, *children; + guint n_children, i; +#if 0 + if (PyErr_Warn(PyExc_DeprecationWarning, + "gobject.type_children is deprecated; " + "use GType.children instead")) + return NULL; +#endif + if (!PyArg_ParseTuple(args, "O:gobject.type_children", >ype)) + return NULL; + if ((type = pyg_type_from_object(gtype)) == 0) + return NULL; + children = g_type_children(type, &n_children); + if (children) { + list = PyList_New(0); + for (i = 0; i < n_children; i++) { + PyObject *o; + PyList_Append(list, o=pyg_type_wrapper_new(children[i])); + Py_DECREF(o); + } + g_free(children); + return list; + } + PyErr_SetString(PyExc_RuntimeError, "invalid type, or no children"); + return NULL; +} + +static PyObject * +pyg_type_interfaces (PyObject *self, PyObject *args) +{ + PyObject *gtype, *list; + GType type, *interfaces; + guint n_interfaces, i; +#if 0 + if (PyErr_Warn(PyExc_DeprecationWarning, + "gobject.type_interfaces is deprecated; " + "use GType.interfaces instead")) + return NULL; +#endif + if (!PyArg_ParseTuple(args, "O:gobject.type_interfaces", >ype)) + return NULL; + if ((type = pyg_type_from_object(gtype)) == 0) + return NULL; + interfaces = g_type_interfaces(type, &n_interfaces); + if (interfaces) { + list = PyList_New(0); + for (i = 0; i < n_interfaces; i++) { + PyObject *o; + PyList_Append(list, o=pyg_type_wrapper_new(interfaces[i])); + Py_DECREF(o); + } + g_free(interfaces); + return list; + } + PyErr_SetString(PyExc_RuntimeError, "invalid type, or no interfaces"); + return NULL; +} + +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); +} + +static void +pyg_object_class_init(GObjectClass *class, PyObject *py_class) +{ + class->set_property = pyg_object_set_property; + class->get_property = pyg_object_get_property; +} + +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 = _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 == _pyg_signal_accumulator_true_handled_func) + accumulator = g_signal_accumulator_true_handled; + else { + 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, + 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 (GType instance_type, PyObject *signals) +{ + gboolean ret = TRUE; + GObjectClass *oclass; + Py_ssize_t pos = 0; + PyObject *key, *value, *overridden_signals = NULL; + + overridden_signals = PyDict_New(); + oclass = g_type_class_ref(instance_type); + 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_AsString (key); + + if (value == Py_None || + (_PyUnicode_Check(value) && + !strcmp(_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; + } + g_type_class_unref(oclass); + 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, + (gint *)&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; + pspec = g_param_spec_pointer (prop_name, nick, blurb, flags); + break; + case G_TYPE_OBJECT: + if (!PyArg_ParseTuple(args, "")) + return NULL; + pspec = g_param_spec_object (prop_name, nick, blurb, prop_type, 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; +} + +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 (!_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, + _PyLong_AsLong(item)); + + return pspec; +} + +static gboolean +add_properties (GType instance_type, PyObject *properties) +{ + gboolean ret = TRUE; + GObjectClass *oclass; + Py_ssize_t pos = 0; + PyObject *key, *value; + + oclass = g_type_class_ref(instance_type); + 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 (!_PyUnicode_Check(key)) { + PyErr_SetString(PyExc_TypeError, + "__gproperties__ keys must be strings"); + ret = FALSE; + break; + } + prop_name = _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 (!_PyLong_Check(item)) { + PyErr_SetString(PyExc_TypeError, + "last element in __gproperties__ value tuple must be an int"); + ret = FALSE; + break; + } + flags = _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(oclass, 1, pspec); + } else { + PyObject *type, *value, *traceback; + ret = FALSE; + PyErr_Fetch(&type, &value, &traceback); + if (_PyUnicode_Check(value)) { + char msg[256]; + g_snprintf(msg, 256, + "%s (while registering property '%s' for GType '%s')", + _PyUnicode_AsString(value), + prop_name, g_type_name(instance_type)); + Py_DECREF(value); + value = _PyUnicode_FromString(msg); + } + PyErr_Restore(type, value, traceback); + break; + } + } + + g_type_class_unref(oclass); + return ret; +} + +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 && _PyUnicode_Check(module)) { + type_name = g_strconcat(_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 (_pyg_type_from_name(type_name) == 0) + break; /* we now have a unique name */ + ++name_serial; + } + + return type_name; +} + + +static GStaticPrivate pygobject_contruction_wrapper = G_STATIC_PRIVATE_INIT; + +static inline void +pygobject_init_wrapper_set(PyObject *wrapper) +{ + g_static_private_set(&pygobject_contruction_wrapper, wrapper, NULL); +} + +static inline PyObject * +pygobject_init_wrapper_get(void) +{ + return (PyObject *) g_static_private_get(&pygobject_contruction_wrapper); +} + +static void +pygobject__g_instance_init(GTypeInstance *instance, + gpointer g_class) +{ + GObject *object = (GObject *) instance; + PyObject *wrapper, *args, *kwargs; + + if (!g_type_get_qdata(G_OBJECT_TYPE(object), + pygobject_has_updated_constructor_key)) + return; + + 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, FALSE, g_class); + 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, gboolean new_interfaces, + 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) { + guint k; + PyObject *base = PyTuple_GET_ITEM(bases, i); + GType itype; + gboolean is_new = TRUE; + 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; + + for (k = 0; k < n_parent_interfaces; ++k) { + if (parent_interfaces[k] == itype) { + is_new = FALSE; + break; + } + } + + if ((new_interfaces && !is_new) || (!new_interfaces && is_new)) + 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, *gsignals, *gproperties, *overridden_signals; + GType parent_type, instance_type; + GType *parent_interfaces; + guint n_parent_interfaces; + GTypeQuery query; + gpointer gclass; + gpointer has_new_constructor_api; + 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 (type_name == NULL) + g_free(new_type_name); + 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)); + return -1; + } + + /* store pointer to the class with the GType */ + Py_INCREF(class); + g_type_set_qdata(instance_type, g_quark_from_string("PyGObject::class"), + class); + + /* set new value of __gtype__ on class */ + gtype = pyg_type_wrapper_new(instance_type); + PyDict_SetItemString(class->tp_dict, "__gtype__", gtype); + Py_DECREF(gtype); + + /* propagate new constructor API compatility flag from parent to child type */ + has_new_constructor_api = + g_type_get_qdata(parent_type, + pygobject_has_updated_constructor_key); + if (has_new_constructor_api != NULL) + g_type_set_qdata(instance_type, pygobject_has_updated_constructor_key, + has_new_constructor_api); + + /* 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: Interfaces to be implemented are searched twice. First + * we register interfaces that are already implemented by a parent + * type. The second time, the remaining interfaces are + * registered, i.e. the ones that are not implemented by a parent + * type. In between these two loops, properties and signals are + * registered. It has to be done this way, in two steps, + * otherwise glib will complain. If registering all interfaces + * always before properties, you get an error like: + * + * ../gobject:121: Warning: Object class + * test_interface+MyObject doesn't implement property + * 'some-property' from interface 'TestInterface' + * + * If, on the other hand, you register interfaces after + * registering the properties, you get something like: + * + * ../gobject:121: Warning: cannot add interface type + * `TestInterface' to type `test_interface+MyUnknown', since + * type `test_interface+MyUnknown' already conforms to + * interface + * + * This looks like a GLib quirk, but no bug has been filed + * upstream. However we have a unit test for this particular + * problem, which can be found in test_interfaces.py, class + * TestInterfaceImpl. + * + * See also comment above pyg_type_add_interfaces(). + */ + pyg_type_add_interfaces(class, instance_type, class->tp_bases, FALSE, + parent_interfaces, n_parent_interfaces); + + /* we look this up in the instance dictionary, so we don't + * accidentally get a parent type's __gsignals__ attribute. */ + gsignals = PyDict_GetItemString(class->tp_dict, "__gsignals__"); + if (gsignals) { + if (!PyDict_Check(gsignals)) { + PyErr_SetString(PyExc_TypeError, + "__gsignals__ attribute not a dict!"); + g_free(parent_interfaces); + return -1; + } + if (!(overridden_signals = add_signals(instance_type, gsignals))) { + g_free(parent_interfaces); + return -1; + } + if (PyDict_SetItemString(class->tp_dict, "__gsignals__", + overridden_signals)) { + g_free(parent_interfaces); + return -1; + } + Py_DECREF(overridden_signals); + } else { + PyErr_Clear(); + } + + /* we look this up in the instance dictionary, so we don't + * accidentally get a parent type's __gsignals__ attribute. */ + gproperties = PyDict_GetItemString(class->tp_dict, "__gproperties__"); + if (gproperties) { + if (!PyDict_Check(gproperties)) { + PyErr_SetString(PyExc_TypeError, + "__gproperties__ attribute not a dict!"); + g_free(parent_interfaces); + return -1; + } + if (!add_properties(instance_type, gproperties)) { + g_free(parent_interfaces); + return -1; + } + PyDict_DelItemString(class->tp_dict, "__gproperties__"); + /* Borrowed reference. Py_DECREF(gproperties); */ + } else { + PyErr_Clear(); + } + + /* Register new interfaces, that are _not_ already defined by + * the parent type. FIXME: See above. + */ + pyg_type_add_interfaces(class, instance_type, class->tp_bases, TRUE, + parent_interfaces, n_parent_interfaces); + + gclass = g_type_class_ref(instance_type); + 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 (gsignals) + PyDict_DelItemString(class->tp_dict, "__gsignals__"); + + 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 _PyLong_FromLong(signal_id); + PyErr_SetString(PyExc_RuntimeError, "could not create signal"); + return NULL; +} + +static PyObject * +pyg_signal_list_names (PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "type", NULL }; + PyObject *py_itype, *list; + GObjectClass *class = NULL; + GType itype; + guint n; + guint *ids; + guint i; + gpointer iface = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O:gobject.signal_list_names", + kwlist, &py_itype)) + return NULL; + 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); + } + + ids = g_signal_list_ids(itype, &n); + + list = PyTuple_New((gint)n); + if (list != NULL) { + for (i = 0; i < n; i++) + PyTuple_SetItem(list, i, + _PyUnicode_FromString(g_signal_name(ids[i]))); + } + + g_free(ids); + if (class) + g_type_class_unref(class); + else + g_type_default_interface_unref(iface); + + return list; +} + +static PyObject * +pyg_signal_list_ids (PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "type", NULL }; + PyObject *py_itype, *list; + GObjectClass *class = NULL; + GType itype; + guint n; + guint *ids; + guint i; + gpointer iface = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O:gobject.signal_list_ids", + kwlist, &py_itype)) + return NULL; + 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); + } + + ids = g_signal_list_ids(itype, &n); + + list = PyTuple_New((gint)n); + if (list == NULL) { + g_free(ids); + g_type_class_unref(class); + return NULL; + } + + for (i = 0; i < n; i++) + PyTuple_SetItem(list, i, _PyLong_FromLong(ids[i])); + g_free(ids); + if (class) + g_type_class_unref(class); + else + g_type_default_interface_unref(iface); + + return list; +} + +static PyObject * +pyg_signal_lookup (PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "name", "type", NULL }; + PyObject *py_itype; + GObjectClass *class = NULL; + GType itype; + gchar *signal_name; + guint id; + gpointer iface = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO:gobject.signal_lookup", + kwlist, &signal_name, &py_itype)) + return NULL; + 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); + + if (class) + g_type_class_unref(class); + else + g_type_default_interface_unref(iface); + return _PyLong_FromLong(id); +} + +static PyObject * +pyg_signal_name (PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "signal_id", NULL }; + const gchar *signal_name; + guint id; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:gobject.signal_name", + kwlist, &id)) + return NULL; + signal_name = g_signal_name(id); + if (signal_name) + return _PyUnicode_FromString(signal_name); + + Py_INCREF(Py_None); + return Py_None; +} + +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, _PyLong_FromLong(query.signal_id)); + PyTuple_SET_ITEM(py_query, 1, _PyUnicode_FromString(query.signal_name)); + PyTuple_SET_ITEM(py_query, 2, pyg_type_wrapper_new(query.itype)); + PyTuple_SET_ITEM(py_query, 3, _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; + int 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 (kwargs) { + Py_ssize_t pos = 0; + PyObject *key; + PyObject *value; + + params = g_new0(GParameter, PyDict_Size(kwargs)); + while (PyDict_Next (kwargs, &pos, &key, &value)) { + GParamSpec *pspec; + const gchar *key_str = _PyUnicode_AsString (key); + + pspec = g_object_class_find_property (class, key_str); + if (!pspec) { + PyErr_Format(PyExc_TypeError, + "gobject `%s' doesn't support property `%s'", + g_type_name(type), key_str); + goto cleanup; + } + g_value_init(¶ms[n_params].value, + G_PARAM_SPEC_VALUE_TYPE(pspec)); + if (pyg_param_gvalue_from_pyobject(¶ms[n_params].value, + 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))); + goto cleanup; + } + params[n_params].name = g_strdup(key_str); + n_params++; + } + } + + 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) { + self = (PyGObject *) pygobject_new_full((GObject *)obj, FALSE, NULL); + 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); +} + +static PyObject * +pyg_threads_init (PyObject *unused, PyObject *args, PyObject *kwargs) +{ + if (!pyglib_enable_threads()) + return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +/* Only for backwards compatibility */ +int +pygobject_enable_threads(void) +{ + if (!pyglib_enable_threads()) + return -1; + return 0; +} + +static void +pyg_note_threads_enabled(void) +{ + pygobject_api_functions.threads_enabled = TRUE; +} + +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; + 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)) { + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + name); + 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_remove_emission_hook(PyGObject *self, PyObject *args) +{ + PyObject *pygtype; + char *name; + guint signal_id; + gulong hook_id; + GType gtype; + + if (!PyArg_ParseTuple(args, "Osk:gobject.remove_emission_hook", + &pygtype, &name, &hook_id)) + return NULL; + + if ((gtype = pyg_type_from_object(pygtype)) == 0) { + return NULL; + } + + if (!g_signal_parse_name(name, gtype, &signal_id, NULL, TRUE)) { + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + name); + return NULL; + } + + g_signal_remove_emission_hook(signal_id, hook_id); + + Py_INCREF(Py_None); + return Py_None; +} + +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 PyMethodDef _gobject_functions[] = { + { "type_name", pyg_type_name, METH_VARARGS }, + { "type_from_name", pyg_type_from_name, METH_VARARGS }, + { "type_parent", pyg_type_parent, METH_VARARGS }, + { "type_is_a", pyg_type_is_a, METH_VARARGS }, + { "type_children", pyg_type_children, METH_VARARGS }, + { "type_interfaces", pyg_type_interfaces, METH_VARARGS }, + { "type_register", _wrap_pyg_type_register, METH_VARARGS }, + { "signal_new", pyg_signal_new, METH_VARARGS }, + { "signal_list_names", + (PyCFunction)pyg_signal_list_names, METH_VARARGS|METH_KEYWORDS }, + { "signal_list_ids", + (PyCFunction)pyg_signal_list_ids, METH_VARARGS|METH_KEYWORDS }, + { "signal_lookup", + (PyCFunction)pyg_signal_lookup, METH_VARARGS|METH_KEYWORDS }, + { "signal_name", + (PyCFunction)pyg_signal_name, METH_VARARGS|METH_KEYWORDS }, + { "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 }, + { "threads_init", + (PyCFunction)pyg_threads_init, 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 }, + { "remove_emission_hook", + (PyCFunction)pyg_remove_emission_hook, METH_VARARGS }, + { "_install_metaclass", + (PyCFunction)pyg__install_metaclass, METH_O }, + + { 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; +} + +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); + 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; +} + +/* This function is mostly juste copy-paste from g_object_new, but + * calls pygobject_constructv instead of g_object_newv */ +int +pygobject_construct(PyGObject *self, const char *first_property_name, ...) +{ + va_list var_args; + GObjectClass *class; + GParameter *params; + const gchar *name; + guint n_params = 0, n_alloced_params = 16; + GType object_type = pyg_type_from_object((PyObject *) self); + int retval; + + if (!first_property_name) + return pygobject_constructv(self, 0, NULL); + + va_start(var_args, first_property_name); + class = g_type_class_ref(object_type); + + params = g_new(GParameter, n_alloced_params); + name = first_property_name; + while (name) + { + gchar *error = NULL; + GParamSpec *pspec = g_object_class_find_property(class, name); + + if (!pspec) + { + g_warning("%s: object class `%s' has no property named `%s'", + G_STRFUNC, + g_type_name(object_type), + name); + break; + } + if (n_params >= n_alloced_params) + { + n_alloced_params += 16; + params = g_renew(GParameter, params, n_alloced_params); + } + params[n_params].name = name; + params[n_params].value.g_type = 0; + g_value_init(¶ms[n_params].value, G_PARAM_SPEC_VALUE_TYPE(pspec)); + G_VALUE_COLLECT(¶ms[n_params].value, var_args, 0, &error); + if (error) + { + g_warning("%s: %s", G_STRFUNC, error); + g_free(error); + g_value_unset(¶ms[n_params].value); + break; + } + n_params++; + name = va_arg(var_args, gchar*); + } + + retval = pygobject_constructv(self, n_params, params); + + while (n_params--) + g_value_unset(¶ms[n_params].value); + g_free(params); + va_end(var_args); + g_type_class_unref(class); + return retval; +} + +void +pyg_set_object_has_new_constructor(GType type) +{ + g_type_set_qdata(type, pygobject_has_updated_constructor_key, GINT_TO_POINTER(1)); +} + +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; +} + +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_register_sinkfunc, + 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, + + FALSE, /* 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, + pygobject_constructv, + pygobject_construct, + pyg_set_object_has_new_constructor, + + add_warning_redirection, + disable_warning_redirections, + + pyg_type_register_custom_callback, + pyg_gerror_exception_check, + + pyglib_option_group_new + +}; + +/* for addon libraries ... */ +static void +pygobject_register_api(PyObject *d) +{ + PyObject *api; + + api = PyCObject_FromVoidPtr(&pygobject_api_functions,NULL); + 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_MINLONG", PyLong_FromLong(G_MINLONG)); + PyModule_AddObject(m, "G_MAXLONG", PyLong_FromLong(G_MAXLONG)); + PyModule_AddObject(m, "G_MAXULONG", PyLong_FromUnsignedLong(G_MAXULONG)); + PyModule_AddIntConstant(m, "G_MININT8", G_MININT8); + PyModule_AddIntConstant(m, "G_MAXINT8", G_MAXINT8); + PyModule_AddIntConstant(m, "G_MAXUINT8", G_MAXUINT8); + PyModule_AddIntConstant(m, "G_MININT16", G_MININT16); + PyModule_AddIntConstant(m, "G_MAXINT16", G_MAXINT16); + PyModule_AddIntConstant(m, "G_MAXUINT16", G_MAXUINT16); + PyModule_AddIntConstant(m, "G_MININT32", G_MININT32); + PyModule_AddIntConstant(m, "G_MAXINT32", G_MAXINT32); + PyModule_AddObject(m, "G_MININT64", PyLong_FromLongLong(G_MININT64)); + PyModule_AddObject(m, "G_MAXINT64", PyLong_FromLongLong(G_MAXINT64)); + PyModule_AddObject(m, "G_MAXUINT64", PyLong_FromUnsignedLongLong(G_MAXUINT64)); +#if PY_VERSION_HEX < 0x02050000 /* 2.3, 2.4 */ + PyModule_AddObject(m, "G_MAXSIZE", PyLong_FromUnsignedLongLong(G_MAXSIZE)); + PyModule_AddObject(m, "G_MAXSSIZE", PyLong_FromUnsignedLongLong(G_MAXSSIZE)); +#elif PY_VERSION_HEX < 0x02060000 /* 2.5 */ + PyModule_AddObject(m, "G_MAXSIZE", _PyLong_FromSize_t(G_MAXSIZE)); + PyModule_AddObject(m, "G_MAXSSIZE", _PyLong_FromSsize_t(G_MAXSSIZE)); +#else /* 2.6+ */ + PyModule_AddObject(m, "G_MAXSIZE", PyLong_FromSize_t(G_MAXSIZE)); + PyModule_AddObject(m, "G_MAXSSIZE", PyLong_FromSsize_t(G_MAXSSIZE)); +#endif + PyModule_AddObject(m, "G_MINOFFSET", PyLong_FromLongLong(G_MINOFFSET)); + PyModule_AddObject(m, "G_MAXOFFSET", PyLong_FromLongLong(G_MAXOFFSET)); + + /* in order for test_properties to pass, G_MAXUINT must be initialized using + PyLong_FromUnsignedLong, despite AFAICT it is unecessary for 32bit int types. + In the interests of consistancy I did the same for MAXUINT32 */ + PyModule_AddObject(m, "G_MAXUINT32", PyLong_FromUnsignedLong(G_MAXUINT32)); + PyModule_AddObject(m, "G_MAXUINT", PyLong_FromUnsignedLong(G_MAXUINT)); + + PyModule_AddIntConstant(m, "SIGNAL_RUN_FIRST", G_SIGNAL_RUN_FIRST); + PyModule_AddIntConstant(m, "SIGNAL_RUN_LAST", G_SIGNAL_RUN_LAST); + PyModule_AddIntConstant(m, "SIGNAL_RUN_CLEANUP", G_SIGNAL_RUN_CLEANUP); + PyModule_AddIntConstant(m, "SIGNAL_NO_RECURSE", G_SIGNAL_NO_RECURSE); + PyModule_AddIntConstant(m, "SIGNAL_DETAILED", G_SIGNAL_DETAILED); + PyModule_AddIntConstant(m, "SIGNAL_ACTION", G_SIGNAL_ACTION); + PyModule_AddIntConstant(m, "SIGNAL_NO_HOOKS", G_SIGNAL_NO_HOOKS); + + PyModule_AddIntConstant(m, "PARAM_READABLE", G_PARAM_READABLE); + PyModule_AddIntConstant(m, "PARAM_WRITABLE", G_PARAM_WRITABLE); + PyModule_AddIntConstant(m, "PARAM_CONSTRUCT", G_PARAM_CONSTRUCT); + PyModule_AddIntConstant(m, "PARAM_CONSTRUCT_ONLY", G_PARAM_CONSTRUCT_ONLY); + PyModule_AddIntConstant(m, "PARAM_LAX_VALIDATION", G_PARAM_LAX_VALIDATION); + 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(); +#ifdef HAVE_FFI_H + PyDict_SetItemString(features, "generic-c-marshaller", Py_True); +#endif + 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); + + /* backwards compatibility */ + PyDict_SetItemString(d, "pygtk_version", tuple); + Py_DECREF(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._gobject") +{ + PyObject *d; + + g_type_init(); + 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); + + /* signal registration recognizes this special accumulator 'constant' */ + _pyg_signal_accumulator_true_handled_func = \ + PyDict_GetItemString(d, "signal_accumulator_true_handled"); + + pygobject_api_functions.threads_enabled = pyglib_threads_enabled(); + _pyglib_notify_on_enabling_threads(pyg_note_threads_enabled); +} +PYGLIB_MODULE_END diff --git a/gobject/propertyhelper.py b/gobject/propertyhelper.py new file mode 100644 index 0000000..e299273 --- /dev/null +++ b/gobject/propertyhelper.py @@ -0,0 +1,298 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# pygobject - Python bindings for the GObject library +# Copyright (C) 2007 Johan Dahlin +# +# gobject/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 +# 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 + +import sys + +import gobject._gobject +_gobject = sys.modules['gobject._gobject'] + +from gobject.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 +from gobject.constants import \ + G_MINFLOAT, G_MAXFLOAT, G_MINDOUBLE, G_MAXDOUBLE, \ + G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \ + 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) + + >>> obj = MyObject() + >>> obj.prop = 'value' + + >>> obj.prop + 'value' + + The API is similar to the builtin property: + + class AnotherObject(gobject.GObject): + @gobject.property + def prop(self): + return ... + + Which will create a read-only property called prop. + """ + + class __metaclass__(type): + def __repr__(self): + return "" + + def __init__(self, getter=None, setter=None, type=None, default=None, + nick='', blurb='', flags=_gobject.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 bick: 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) + """ + + if getter and not setter: + setter = self._readonly_setter + elif setter and not getter: + getter = self._writeonly_getter + elif not setter and not getter: + getter = self._default_getter + setter = self._default_setter + self.getter = getter + self.setter = setter + + if type is None: + type = object + self.type = self._type_from_python(type) + self.default = self._get_default(default) + self._check_default() + + if not isinstance(nick, basestring): + raise TypeError("nick must be a string") + self.nick = nick + + if not isinstance(blurb, basestring): + raise TypeError("blurb must be a string") + self.blurb = blurb + + if flags < 0 or flags > 32: + raise TypeError("invalid flag value: %r" % (flags,)) + self.flags = flags + + if minimum is not None: + if minimum < self._get_minimum(): + raise TypeError( + "Minimum for type %s cannot be lower than %d" % ( + self.type, self._get_minimum())) + else: + minimum = self._get_minimum() + self.minimum = minimum + if maximum is not None: + if maximum > self._get_maximum(): + raise TypeError( + "Maximum for type %s cannot be higher than %d" % ( + self.type, self._get_maximum())) + else: + maximum = self._get_maximum() + self.maximum = maximum + + self.name = None + + self._values = {} + self._exc = None + + def __repr__(self): + return '' % ( + self.name or '(uninitialized)', + _gobject.type_name(self.type)) + + def __get__(self, instance, klass): + if instance is None: + return self + + self._exc = None + value = instance.get_property(self.name) + if self._exc: + exc = self._exc + self._exc = None + raise exc + + return value + + def __set__(self, instance, value): + if instance is None: + raise TypeError + + self._exc = None + instance.set_property(self.name, value) + if self._exc: + exc = self._exc + self._exc = None + raise exc + + def _type_from_python(self, type): + if type == int: + return TYPE_INT + elif type == bool: + return TYPE_BOOLEAN + elif type == long: + return TYPE_LONG + elif type == float: + return TYPE_DOUBLE + elif type == str: + return TYPE_STRING + elif type == object: + return TYPE_PYOBJECT + elif type == _gobject.GObject: + return TYPE_OBJECT + elif type in [TYPE_NONE, TYPE_INTERFACE, TYPE_CHAR, TYPE_UCHAR, + TYPE_INT, TYPE_UINT, TYPE_BOOLEAN, TYPE_LONG, + TYPE_ULONG, TYPE_INT64, TYPE_UINT64, TYPE_ENUM, + TYPE_FLAGS, TYPE_FLOAT, TYPE_DOUBLE, TYPE_POINTER, + TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, TYPE_STRING, + TYPE_PYOBJECT]: + return type + else: + raise TypeError("Unsupported type: %r" % (type,)) + + def _get_default(self, default): + ptype = self.type + if default is not None: + return default + + if ptype in [TYPE_INT, TYPE_UINT, TYPE_LONG, TYPE_ULONG, + TYPE_INT64, TYPE_UINT64]: + return 0 + elif ptype == TYPE_STRING: + return '' + elif ptype == TYPE_FLOAT or ptype == TYPE_DOUBLE: + return 0.0 + else: + return None + + def _check_default(self): + ptype = self.type + default = self.default + if (ptype == TYPE_BOOLEAN and (default not in (True, False))): + raise TypeError( + "default must be True or False, not %r" % (default,)) + elif ptype == TYPE_PYOBJECT: + if default is not None: + raise TypeError("object types does not have default values") + + def _get_minimum(self): + ptype = self.type + if ptype in [TYPE_UINT, TYPE_ULONG, TYPE_UINT64]: + return 0 + # Remember that G_MINFLOAT and G_MINDOUBLE are something different. + elif ptype == TYPE_FLOAT: + return -G_MAXFLOAT + elif ptype == TYPE_DOUBLE: + return -G_MAXDOUBLE + elif ptype == TYPE_INT: + return G_MININT + elif ptype == TYPE_LONG: + return G_MINLONG + elif ptype == TYPE_INT64: + return -2 ** 62 - 1 + + return None + + def _get_maximum(self): + ptype = self.type + if ptype == TYPE_UINT: + return G_MAXUINT + elif ptype == TYPE_ULONG: + return G_MAXULONG + elif ptype == TYPE_INT64: + return 2 ** 62 - 1 + elif ptype == TYPE_UINT64: + return 2 ** 63 - 1 + elif ptype == TYPE_FLOAT: + return G_MAXFLOAT + elif ptype == TYPE_DOUBLE: + return G_MAXDOUBLE + elif ptype == TYPE_INT: + return G_MAXINT + elif ptype == TYPE_LONG: + return G_MAXLONG + + return None + + # + # Getter and Setter + # + + def _default_setter(self, instance, value): + self._values[instance] = value + + def _default_getter(self, instance): + return self._values.get(instance, self.default) + + def _readonly_setter(self, instance, value): + self._exc = TypeError("%s property of %s is read-only" % ( + self.name, type(instance).__name__)) + + def _writeonly_getter(self, instance): + self._exc = TypeError("%s property of %s is write-only" % ( + self.name, type(instance).__name__)) + + # + # Public API + # + + def get_pspec_args(self): + ptype = self.type + if ptype in [TYPE_INT, TYPE_UINT, TYPE_LONG, TYPE_ULONG, + TYPE_INT64, TYPE_UINT64, TYPE_FLOAT, TYPE_DOUBLE]: + args = self._get_minimum(), self._get_maximum(), self.default + elif ptype == TYPE_STRING or ptype == TYPE_BOOLEAN: + args = (self.default,) + elif ptype == TYPE_PYOBJECT: + args = () + elif ptype == TYPE_OBJECT: + args = () + else: + raise NotImplementedError(ptype) + + return (self.type, self.nick, self.blurb) + args + (self.flags,) diff --git a/gobject/pygboxed.c b/gobject/pygboxed.c new file mode 100644 index 0000000..87695eb --- /dev/null +++ b/gobject/pygboxed.c @@ -0,0 +1,228 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * + * pygboxed.c: wrapper for GBoxed + * + * 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 "pygboxed.h" + +#include "pygi-external.h" + +GQuark pygboxed_type_key; +GQuark pygboxed_marshal_key; + +PYGLIB_DEFINE_TYPE("gobject.GBoxed", PyGBoxed_Type, PyGBoxed); + +static void +pyg_boxed_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); + } + + Py_TYPE(self)->tp_free((PyObject *)self); +} + +static int +pyg_boxed_compare(PyGBoxed *self, PyGBoxed *v) +{ + if (self->boxed == v->boxed) return 0; + if (self->boxed > v->boxed) return -1; + return 1; +} + +static long +pyg_boxed_hash(PyGBoxed *self) +{ + return (long)self->boxed; +} + +static PyObject * +pyg_boxed_repr(PyGBoxed *self) +{ + gchar buf[128]; + + g_snprintf(buf, sizeof(buf), "<%s at 0x%lx>", g_type_name(self->gtype), + (long)self->boxed); + return _PyUnicode_FromString(buf); +} + +static int +pyg_boxed_init(PyGBoxed *self, PyObject *args, PyObject *kwargs) +{ + gchar buf[512]; + + if (!PyArg_ParseTuple(args, ":GBoxed.__init__")) + return -1; + + self->boxed = NULL; + self->gtype = 0; + self->free_on_dealloc = FALSE; + + g_snprintf(buf, sizeof(buf), "%s can not be constructed", + Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_NotImplementedError, buf); + return -1; +} + +static void +pyg_boxed_free(PyObject *op) +{ + PyObject_FREE(op); +} + +static PyObject * +pyg_boxed_copy(PyGBoxed *self) +{ + return pyg_boxed_new (self->gtype, self->boxed, TRUE, TRUE); +} + + + +static PyMethodDef pygboxed_methods[] = { + { "copy", (PyCFunction) pyg_boxed_copy, METH_NOARGS }, + { NULL, NULL, 0 } +}; + + +/** + * pyg_register_boxed: + * @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. + * @type: the wrapper class. + * + * Registers a wrapper for a boxed type. The wrapper class will be a + * subclass of gobject.GBoxed, and a reference to the wrapper class + * will be stored in the provided module dictionary. + */ +void +pyg_register_boxed(PyObject *dict, const gchar *class_name, + GType boxed_type, PyTypeObject *type) +{ + PyObject *o; + + g_return_if_fail(dict != NULL); + 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; + + Py_TYPE(type) = &PyType_Type; + type->tp_base = &PyGBoxed_Type; + + if (PyType_Ready(type) < 0) { + g_warning("could not get type `%s' ready", type->tp_name); + return; + } + + PyDict_SetItemString(type->tp_dict, "__gtype__", + o=pyg_type_wrapper_new(boxed_type)); + Py_DECREF(o); + + g_type_set_qdata(boxed_type, pygboxed_type_key, type); + + PyDict_SetItemString(dict, (char *)class_name, (PyObject *)type); +} + +/** + * pyg_boxed_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. + * @own_ref: whether the boxed wrapper should own the boxed value. + * + * Creates a wrapper for a boxed value. If @copy_boxed is set to + * True, the wrapper will hold a copy of the value, instead of the + * value itself. If @own_ref is True, then the value held by the + * 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. + */ +PyObject * +pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed, + gboolean own_ref) +{ + PyGILState_STATE state; + PyGBoxed *self; + PyTypeObject *tp; + + 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(); + + if (!boxed) { + Py_INCREF(Py_None); + pyglib_gil_state_release(state); + return Py_None; + } + + tp = g_type_get_qdata(boxed_type, pygboxed_type_key); + + if (!tp) + tp = (PyTypeObject *)pygi_type_import_by_g_type(boxed_type); + + if (!tp) + tp = (PyTypeObject *)&PyGBoxed_Type; /* fallback */ + + self = (PyGBoxed *)tp->tp_alloc(tp, 0); + + if (self == NULL) { + pyglib_gil_state_release(state); + return NULL; + } + + if (copy_boxed) + boxed = g_boxed_copy(boxed_type, boxed); + self->boxed = boxed; + self->gtype = boxed_type; + self->free_on_dealloc = own_ref; + + pyglib_gil_state_release(state); + + return (PyObject *)self; +} + +void +pygobject_boxed_register_types(PyObject *d) +{ + 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_compare = (cmpfunc)pyg_boxed_compare; + PyGBoxed_Type.tp_repr = (reprfunc)pyg_boxed_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); +} diff --git a/gobject/pygboxed.h b/gobject/pygboxed.h new file mode 100644 index 0000000..8433b9d --- /dev/null +++ b/gobject/pygboxed.h @@ -0,0 +1,27 @@ +/* -*- 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_BOXED_H__ +#define __PYGOBJECT_BOXED_H__ + +void pygobject_boxed_register_types(PyObject *d); + +#endif /* __PYGOBJECT_BOXED_H__ */ diff --git a/gobject/pygenum.c b/gobject/pygenum.c new file mode 100644 index 0000000..027dbd4 --- /dev/null +++ b/gobject/pygenum.c @@ -0,0 +1,356 @@ +/* -*- 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 wrapper + * + * 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 "pygi-external.h" + +GQuark pygenum_class_key; + +PYGLIB_DEFINE_TYPE("gobject.GEnum", PyGEnum_Type, PyGEnum); + +static PyObject * +pyg_enum_richcompare(PyGEnum *self, PyObject *other, int op) +{ + static char warning[256]; + + if (!_PyLong_Check(other)) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + + if (PyObject_TypeCheck(other, &PyGEnum_Type) && ((PyGEnum*)other)->gtype != self->gtype) { + g_snprintf(warning, sizeof(warning), "comparing different enum types: %s and %s", + g_type_name(self->gtype), g_type_name(((PyGEnum*)other)->gtype)); + if (PyErr_Warn(PyExc_Warning, warning)) + return NULL; + } + + return pyg_integer_richcompare((PyObject *)self, other, op); +} + +static PyObject * +pyg_enum_repr(PyGEnum *self) +{ + GEnumClass *enum_class; + const char *value; + guint index; + static char tmp[256]; + + enum_class = g_type_class_ref(self->gtype); + g_assert(G_IS_ENUM_CLASS(enum_class)); + + for (index = 0; index < enum_class->n_values; index++) + if (_PyLong_AS_LONG(self) == enum_class->values[index].value) + break; + value = enum_class->values[index].value_name; + if (value) + sprintf(tmp, "", value, g_type_name(self->gtype)); + else + sprintf(tmp, "", _PyLong_AS_LONG(self), g_type_name(self->gtype)); + + g_type_class_unref(enum_class); + + return _PyUnicode_FromString(tmp); +} + +static PyObject * +pyg_enum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "value", NULL }; + long value; + PyObject *pytc, *values, *ret, *intvalue; + GType gtype; + GEnumClass *eclass; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l", kwlist, &value)) + return NULL; + + pytc = PyObject_GetAttrString((PyObject *)type, "__gtype__"); + if (!pytc) + return NULL; + + if (!PyObject_TypeCheck(pytc, &PyGTypeWrapper_Type)) { + Py_DECREF(pytc); + PyErr_SetString(PyExc_TypeError, + "__gtype__ attribute not a typecode"); + return NULL; + } + + gtype = pyg_type_from_object(pytc); + Py_DECREF(pytc); + + eclass = G_ENUM_CLASS(g_type_class_ref(gtype)); + + /* A check that 0 < value < eclass->n_values was here but got + * removed: enumeration values do not need to be consequitive, + * e.g. GtkPathPriorityType values are not. + */ + + values = PyObject_GetAttrString((PyObject *)type, "__enum_values__"); + if (!values) { + g_type_class_unref(eclass); + return NULL; + } + + /* Note that size of __enum_values__ dictionary can easily be less + * than 'n_values'. This happens if some values of the enum are + * numerically equal, e.g. gtk.ANCHOR_N == gtk.ANCHOR_NORTH. + * Johan said that "In retrospect, using a dictionary to store the + * values might not have been that good", but we need to keep + * backward compatibility. + */ + if (!PyDict_Check(values) || PyDict_Size(values) > eclass->n_values) { + PyErr_SetString(PyExc_TypeError, "__enum_values__ badly formed"); + Py_DECREF(values); + g_type_class_unref(eclass); + return NULL; + } + + g_type_class_unref(eclass); + + intvalue = _PyLong_FromLong(value); + ret = PyDict_GetItem(values, intvalue); + Py_DECREF(intvalue); + Py_DECREF(values); + if (ret) + Py_INCREF(ret); + else + PyErr_Format(PyExc_ValueError, "invalid enum value: %ld", value); + + return ret; +} + +PyObject* +pyg_enum_from_gtype (GType gtype, int value) +{ + PyObject *pyclass, *values, *retval, *intvalue; + + g_return_val_if_fail(gtype != G_TYPE_INVALID, NULL); + + /* Get a wrapper class by: + * 1. check for one attached to the gtype + * 2. lookup one in a typelib + * 3. creating a new one + */ + pyclass = (PyObject*)g_type_get_qdata(gtype, pygenum_class_key); + if (!pyclass) + pyclass = pygi_type_import_by_g_type(gtype); + if (!pyclass) + pyclass = pyg_enum_add(NULL, g_type_name(gtype), NULL, gtype); + if (!pyclass) + return _PyLong_FromLong(value); + + values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, + "__enum_values__"); + intvalue = _PyLong_FromLong(value); + retval = PyDict_GetItem(values, intvalue); + Py_DECREF(intvalue); + if (!retval) { + PyErr_Clear(); + retval = ((PyTypeObject *)pyclass)->tp_alloc((PyTypeObject *)pyclass, 0); + g_assert(retval != NULL); + +#if PY_VERSION_HEX >= 0x03000000 +# warning "FIXME: figure out how to subclass long" +#else + ((_PyLongObject*)retval)->ob_ival = value; +#endif + ((PyGFlags*)retval)->gtype = gtype; + //return _PyLong_FromLong(value); + } + + Py_INCREF(retval); + return retval; +} + +PyObject * +pyg_enum_add (PyObject * module, + const char * typename, + const char * strip_prefix, + GType gtype) +{ + PyGILState_STATE state; + PyObject *instance_dict, *stub, *values, *o; + GEnumClass *eclass; + int i; + + g_return_val_if_fail(typename != NULL, NULL); + if (!g_type_is_a(gtype, G_TYPE_ENUM)) { + g_warning("Trying to register gtype '%s' as enum when in fact it is of type '%s'", + g_type_name(gtype), g_type_name(G_TYPE_FUNDAMENTAL(gtype))); + return NULL; + } + + state = pyglib_gil_state_ensure(); + + instance_dict = PyDict_New(); + stub = PyObject_CallFunction((PyObject *)&PyType_Type, "s(O)O", + typename, (PyObject *)&PyGEnum_Type, + instance_dict); + Py_DECREF(instance_dict); + if (!stub) { + PyErr_SetString(PyExc_RuntimeError, "can't create const"); + pyglib_gil_state_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__", + _PyUnicode_FromString(PyModule_GetName(module))); + + g_type_set_qdata(gtype, pygenum_class_key, stub); + + o = pyg_type_wrapper_new(gtype); + PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict, "__gtype__", o); + Py_DECREF(o); + + if (module) { + /* Add it to the module name space */ + PyModule_AddObject(module, (char*)typename, stub); + Py_INCREF(stub); + } + + /* Register enum values */ + eclass = G_ENUM_CLASS(g_type_class_ref(gtype)); + + values = PyDict_New(); + for (i = 0; i < eclass->n_values; i++) { + PyObject *item, *intval; + + item = ((PyTypeObject *)stub)->tp_alloc((PyTypeObject *)stub, 0); +#if PY_VERSION_HEX >= 0x03000000 +# warning "FIXME: figure out how to subclass long" +#else + ((_PyLongObject*)item)->ob_ival = eclass->values[i].value; +#endif + ((PyGEnum*)item)->gtype = gtype; + + intval = _PyLong_FromLong(eclass->values[i].value); + PyDict_SetItem(values, intval, item); + Py_DECREF(intval); + + if (module) { + char *prefix; + + prefix = g_strdup(pyg_constant_strip_prefix(eclass->values[i].value_name, strip_prefix)); + PyModule_AddObject(module, prefix, item); + g_free(prefix); + + Py_INCREF(item); + } + } + + PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict, + "__enum_values__", values); + Py_DECREF(values); + + g_type_class_unref(eclass); + + pyglib_gil_state_release(state); + return stub; +} + +static PyObject * +pyg_enum_reduce(PyObject *self, PyObject *args) +{ + if (!PyArg_ParseTuple(args, ":GEnum.__reduce__")) + return NULL; + + return Py_BuildValue("(O(i)O)", Py_TYPE(self), _PyLong_AsLong(self), + PyObject_GetAttrString(self, "__dict__")); +} + +static PyObject * +pyg_enum_get_value_name(PyGEnum *self, void *closure) +{ + GEnumClass *enum_class; + GEnumValue *enum_value; + PyObject *retval; + + enum_class = g_type_class_ref(self->gtype); + g_assert(G_IS_ENUM_CLASS(enum_class)); + + enum_value = g_enum_get_value(enum_class, _PyLong_AS_LONG(self)); + + retval = _PyUnicode_FromString(enum_value->value_name); + g_type_class_unref(enum_class); + + return retval; +} + +static PyObject * +pyg_enum_get_value_nick(PyGEnum *self, void *closure) +{ + GEnumClass *enum_class; + GEnumValue *enum_value; + PyObject *retval; + + enum_class = g_type_class_ref(self->gtype); + g_assert(G_IS_ENUM_CLASS(enum_class)); + + enum_value = g_enum_get_value(enum_class, _PyLong_AS_LONG(self)); + + retval = _PyUnicode_FromString(enum_value->value_nick); + g_type_class_unref(enum_class); + + return retval; +} + + +static PyMethodDef pyg_enum_methods[] = { + { "__reduce__", (PyCFunction)pyg_enum_reduce, METH_VARARGS }, + { NULL, NULL, 0 } +}; + +static PyGetSetDef pyg_enum_getsets[] = { + { "value_name", (getter)pyg_enum_get_value_name, (setter)0 }, + { "value_nick", (getter)pyg_enum_get_value_nick, (setter)0 }, + { NULL, 0, 0 } +}; + +void +pygobject_enum_register_types(PyObject *d) +{ + pygenum_class_key = g_quark_from_static_string("PyGEnum::class"); + + PyGEnum_Type.tp_base = &_PyLong_Type; + 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; + PyGEnum_Type.tp_new = pyg_enum_new; + PYGOBJECT_REGISTER_GTYPE(d, PyGEnum_Type, "GEnum", G_TYPE_ENUM); + +} diff --git a/gobject/pygenum.h b/gobject/pygenum.h new file mode 100644 index 0000000..0558831 --- /dev/null +++ b/gobject/pygenum.h @@ -0,0 +1,27 @@ +/* -*- 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_ENUM_H__ +#define __PYGOBJECT_ENUM_H__ + +void pygobject_enum_register_types(PyObject *d); + +#endif /* __PYGOBJECT_ENUM_H__ */ diff --git a/gobject/pygflags.c b/gobject/pygflags.c new file mode 100644 index 0000000..1865abb --- /dev/null +++ b/gobject/pygflags.c @@ -0,0 +1,491 @@ +/* -*- 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: GFlags wrapper + * + * 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 "pygflags.h" + +#include "pygi-external.h" + +GQuark pygflags_class_key; + +PYGLIB_DEFINE_TYPE("gobject.GFlags", PyGFlags_Type, PyGFlags); + +static PyObject * +pyg_flags_richcompare(PyGFlags *self, PyObject *other, int op) +{ + static char warning[256]; + + if (!_PyLong_Check(other)) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + + if (PyObject_TypeCheck(other, &PyGFlags_Type) && ((PyGFlags*)other)->gtype != self->gtype) { + g_snprintf(warning, sizeof(warning), "comparing different flags types: %s and %s", + g_type_name(self->gtype), g_type_name(((PyGFlags*)other)->gtype)); + if (PyErr_Warn(PyExc_Warning, warning)) + return NULL; + } + + return pyg_integer_richcompare((PyObject *)self, other, op); +} + +static char * +generate_repr(GType gtype, int value) +{ + GFlagsClass *flags_class; + char *retval = NULL, *tmp; + int i; + + flags_class = g_type_class_ref(gtype); + g_assert(G_IS_FLAGS_CLASS(flags_class)); + + for (i = 0; i < flags_class->n_values; i++) { + /* Some types (eg GstElementState in GStreamer 0.8) has flags with 0 values, + * we're just ignore them for now otherwise they'll always show up + */ + if (flags_class->values[i].value == 0) + continue; + + if ((value & flags_class->values[i].value) == flags_class->values[i].value) { + if (retval) { + tmp = g_strdup_printf("%s | %s", retval, flags_class->values[i].value_name); + g_free(retval); + retval = tmp; + } else { + retval = g_strdup_printf("%s", flags_class->values[i].value_name); + } + } + } + + g_type_class_unref(flags_class); + + return retval; +} + +static PyObject * +pyg_flags_repr(PyGFlags *self) +{ + char *tmp, *retval; + PyObject *pyretval; + + tmp = generate_repr(self->gtype, _PyLong_AS_LONG(self)); + + if (tmp) + retval = g_strdup_printf("", tmp, + g_type_name(self->gtype)); + else + retval = g_strdup_printf("", _PyLong_AS_LONG(self), + g_type_name(self->gtype)); + g_free(tmp); + + pyretval = _PyUnicode_FromString(retval); + g_free(retval); + + return pyretval; +} + +static PyObject * +pyg_flags_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "value", NULL }; + long value; + PyObject *pytc, *values, *ret, *pyint; + GType gtype; + GFlagsClass *eclass; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l", kwlist, &value)) + return NULL; + + pytc = PyObject_GetAttrString((PyObject *)type, "__gtype__"); + if (!pytc) + return NULL; + + if (!PyObject_TypeCheck(pytc, &PyGTypeWrapper_Type)) { + Py_DECREF(pytc); + PyErr_SetString(PyExc_TypeError, + "__gtype__ attribute not a typecode"); + return NULL; + } + + gtype = pyg_type_from_object(pytc); + Py_DECREF(pytc); + + eclass = G_FLAGS_CLASS(g_type_class_ref(gtype)); + + values = PyObject_GetAttrString((PyObject *)type, "__flags_values__"); + if (!values) { + g_type_class_unref(eclass); + return NULL; + } + + if (!PyDict_Check(values) || PyDict_Size(values) != eclass->n_values) { + PyErr_SetString(PyExc_TypeError, "__flags_values__ badly formed"); + Py_DECREF(values); + g_type_class_unref(eclass); + return NULL; + } + + g_type_class_unref(eclass); + + pyint = _PyLong_FromLong(value); + ret = PyDict_GetItem(values, pyint); + Py_DECREF(pyint); + Py_DECREF(values); + + if (ret) + Py_INCREF(ret); + else + PyErr_Format(PyExc_ValueError, "invalid flag value: %ld", value); + return ret; +} + +PyObject* +pyg_flags_from_gtype (GType gtype, int value) +{ + PyObject *pyclass, *values, *retval, *pyint; + + g_return_val_if_fail(gtype != G_TYPE_INVALID, NULL); + + /* Get a wrapper class by: + * 1. check for one attached to the gtype + * 2. lookup one in a typelib + * 3. creating a new one + */ + pyclass = (PyObject*)g_type_get_qdata(gtype, pygflags_class_key); + if (!pyclass) + pyclass = pygi_type_import_by_g_type(gtype); + if (!pyclass) + pyclass = pyg_flags_add(NULL, g_type_name(gtype), NULL, gtype); + if (!pyclass) + return _PyLong_FromLong(value); + + values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, + "__flags_values__"); + pyint = _PyLong_FromLong(value); + retval = PyDict_GetItem(values, pyint); + Py_DECREF(pyint); + + if (!retval) { + PyErr_Clear(); + + retval = ((PyTypeObject *)pyclass)->tp_alloc((PyTypeObject *)pyclass, 0); + g_assert(retval != NULL); + +#if PY_VERSION_HEX >= 0x03000000 +# warning "FIXME: figure out how to subclass long" +#else + ((_PyLongObject*)retval)->ob_ival = value; +#endif + ((PyGFlags*)retval)->gtype = gtype; + } else { + Py_INCREF(retval); + } + return retval; +} + +PyObject * +pyg_flags_add (PyObject * module, + const char * typename, + const char * strip_prefix, + GType gtype) +{ + PyGILState_STATE state; + PyObject *instance_dict, *stub, *values, *o; + GFlagsClass *eclass; + int i; + + g_return_val_if_fail(typename != NULL, NULL); + if (!g_type_is_a(gtype, G_TYPE_FLAGS)) { + g_warning("Trying to register gtype '%s' as flags when in fact it is of type '%s'", + g_type_name(gtype), g_type_name(G_TYPE_FUNDAMENTAL(gtype))); + return NULL; + } + + state = pyglib_gil_state_ensure(); + + instance_dict = PyDict_New(); + stub = PyObject_CallFunction((PyObject *)&PyType_Type, "s(O)O", + typename, (PyObject *)&PyGFlags_Type, + instance_dict); + Py_DECREF(instance_dict); + if (!stub) { + PyErr_SetString(PyExc_RuntimeError, "can't create const"); + pyglib_gil_state_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__", + _PyUnicode_FromString(PyModule_GetName(module))); + + /* Add it to the module name space */ + PyModule_AddObject(module, (char*)typename, stub); + Py_INCREF(stub); + } + g_type_set_qdata(gtype, pygflags_class_key, stub); + + o = pyg_type_wrapper_new(gtype); + PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict, "__gtype__", o); + Py_DECREF(o); + + /* Register flag values */ + eclass = G_FLAGS_CLASS(g_type_class_ref(gtype)); + + values = PyDict_New(); + for (i = 0; i < eclass->n_values; i++) { + PyObject *item, *intval; + + item = ((PyTypeObject *)stub)->tp_alloc((PyTypeObject *)stub, 0); +#if PY_VERSION_HEX >= 0x03000000 +# warning "FIXME: figure out how to subclass long" +#else + ((_PyLongObject*)item)->ob_ival = eclass->values[i].value; +#endif + ((PyGFlags*)item)->gtype = gtype; + + intval = _PyLong_FromLong(eclass->values[i].value); + PyDict_SetItem(values, intval, item); + Py_DECREF(intval); + + if (module) { + char *prefix; + + prefix = g_strdup(pyg_constant_strip_prefix(eclass->values[i].value_name, strip_prefix)); + PyModule_AddObject(module, prefix, item); + g_free(prefix); + + Py_INCREF(item); + } + } + + PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict, + "__flags_values__", values); + Py_DECREF(values); + + g_type_class_unref(eclass); + + pyglib_gil_state_release(state); + + return stub; +} + +static PyObject * +pyg_flags_and(PyGFlags *a, PyGFlags *b) +{ + if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) + return _PyLong_Type.tp_as_number->nb_and((PyObject*)a, + (PyObject*)b); + + return pyg_flags_from_gtype(a->gtype, + _PyLong_AS_LONG(a) & _PyLong_AS_LONG(b)); +} + +static PyObject * +pyg_flags_or(PyGFlags *a, PyGFlags *b) +{ + if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) + return _PyLong_Type.tp_as_number->nb_or((PyObject*)a, + (PyObject*)b); + + return pyg_flags_from_gtype(a->gtype, _PyLong_AS_LONG(a) | _PyLong_AS_LONG(b)); +} + +static PyObject * +pyg_flags_xor(PyGFlags *a, PyGFlags *b) +{ + if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) + return _PyLong_Type.tp_as_number->nb_xor((PyObject*)a, + (PyObject*)b); + + return pyg_flags_from_gtype(a->gtype, + _PyLong_AS_LONG(a) ^ _PyLong_AS_LONG(b)); + +} + +static PyObject * +pyg_flags_warn (PyObject *self, PyObject *args) +{ + if (PyErr_Warn(PyExc_Warning, "unsupported arithmetic operation for flags type")) + return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pyg_flags_get_first_value_name(PyGFlags *self, void *closure) +{ + GFlagsClass *flags_class; + GFlagsValue *flags_value; + PyObject *retval; + + 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, _PyLong_AS_LONG(self)); + if (flags_value) + retval = _PyUnicode_FromString(flags_value->value_name); + else { + retval = Py_None; + Py_INCREF(Py_None); + } + g_type_class_unref(flags_class); + + return retval; +} + +static PyObject * +pyg_flags_get_first_value_nick(PyGFlags *self, void *closure) +{ + GFlagsClass *flags_class; + GFlagsValue *flags_value; + PyObject *retval; + + 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, _PyLong_AS_LONG(self)); + if (flags_value) + retval = _PyUnicode_FromString(flags_value->value_nick); + else { + retval = Py_None; + Py_INCREF(Py_None); + } + g_type_class_unref(flags_class); + + return retval; +} + +static PyObject * +pyg_flags_get_value_names(PyGFlags *self, void *closure) +{ + GFlagsClass *flags_class; + PyObject *retval; + int 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 ((_PyLong_AS_LONG(self) & flags_class->values[i].value) == flags_class->values[i].value) + PyList_Append(retval, _PyUnicode_FromString(flags_class->values[i].value_name)); + + g_type_class_unref(flags_class); + + return retval; +} + +static PyObject * +pyg_flags_get_value_nicks(PyGFlags *self, void *closure) +{ + GFlagsClass *flags_class; + PyObject *retval; + int 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 ((_PyLong_AS_LONG(self) & flags_class->values[i].value) == flags_class->values[i].value) + PyList_Append(retval, _PyUnicode_FromString(flags_class->values[i].value_nick)); + + g_type_class_unref(flags_class); + + return retval; +} + +static PyGetSetDef pyg_flags_getsets[] = { + { "first_value_name", (getter)pyg_flags_get_first_value_name, (setter)0 }, + { "first_value_nick", (getter)pyg_flags_get_first_value_nick, (setter)0 }, + { "value_names", (getter)pyg_flags_get_value_names, (setter)0 }, + { "value_nicks", (getter)pyg_flags_get_value_nicks, (setter)0 }, + { NULL, 0, 0 } +}; + +static PyNumberMethods pyg_flags_as_number = { + (binaryfunc)pyg_flags_warn, /* nb_add */ + (binaryfunc)pyg_flags_warn, /* nb_subtract */ + (binaryfunc)pyg_flags_warn, /* nb_multiply */ + (binaryfunc)pyg_flags_warn, /* nb_divide */ + (binaryfunc)pyg_flags_warn, /* nb_remainder */ + (binaryfunc)pyg_flags_warn, /* nb_divmod */ + (ternaryfunc)pyg_flags_warn, /* nb_power */ + 0, /* nb_negative */ + 0, /* nb_positive */ + 0, /* nb_absolute */ + 0, /* nb_nonzero */ + 0, /* nb_invert */ + 0, /* nb_lshift */ + 0, /* nb_rshift */ + (binaryfunc)pyg_flags_and, /* nb_and */ + (binaryfunc)pyg_flags_xor, /* nb_xor */ + (binaryfunc)pyg_flags_or, /* nb_or */ + 0, /* nb_coerce */ + 0, /* nb_int */ + 0, /* nb_long */ + 0, /* nb_float */ + 0, /* nb_oct */ + 0, /* nb_hex */ + 0, /* nb_inplace_add */ + 0, /* nb_inplace_subtract */ + 0, /* nb_inplace_multiply */ + 0, /* nb_inplace_divide */ + 0, /* nb_inplace_remainder */ + 0, /* nb_inplace_power */ + 0, /* nb_inplace_lshift */ + 0, /* nb_inplace_rshift */ + 0, /* nb_inplace_and */ + 0, /* nb_inplace_xor */ + 0, /* nb_inplace_or */ + 0, /* nb_floor_divide */ + 0, /* nb_true_divide */ + 0, /* nb_inplace_floor_divide */ + 0, /* nb_inplace_true_divide */ +}; + +void +pygobject_flags_register_types(PyObject *d) +{ + pygflags_class_key = g_quark_from_static_string("PyGFlags::class"); + + PyGFlags_Type.tp_base = &_PyLong_Type; + 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; + PyGFlags_Type.tp_new = pyg_flags_new; + PYGOBJECT_REGISTER_GTYPE(d, PyGFlags_Type, "GFlags", G_TYPE_FLAGS); +} diff --git a/gobject/pygflags.h b/gobject/pygflags.h new file mode 100644 index 0000000..e93265c --- /dev/null +++ b/gobject/pygflags.h @@ -0,0 +1,27 @@ +/* -*- 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/gobject/pygi-external.h b/gobject/pygi-external.h new file mode 100644 index 0000000..b369dca --- /dev/null +++ b/gobject/pygi-external.h @@ -0,0 +1,67 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * vim: tabstop=4 shiftwidth=4 expandtab + */ + +#ifndef _PYGI_EXTERNAL_H_ +#define _PYGI_EXTERNAL_H_ + +#include +#include + +struct PyGI_API { + PyObject* (*type_import_by_g_type) (GType g_type); +}; + +static struct PyGI_API *PyGI_API = NULL; + +static int +_pygi_import (void) +{ +#if ENABLE_PYGI + PyObject *module; + PyObject *api; + + if (PyGI_API != NULL) { + return 1; + } + + module = PyImport_ImportModule("gi"); + if (module == NULL) { + PyErr_Clear(); + return -1; + } + + api = PyObject_GetAttrString(module, "_API"); + if (api == NULL) { + PyErr_Clear(); + Py_DECREF(module); + return -1; + } + if (!PyCObject_Check(api)) { + Py_DECREF(module); + Py_DECREF(api); + PyErr_Format(PyExc_TypeError, "gi._API must be cobject, not %s", + api->ob_type->tp_name); + return -1; + } + + PyGI_API = (struct PyGI_API *)PyCObject_AsVoidPtr(api); + + Py_DECREF(module); + + return 0; +#else + return -1; +#endif /* ENABLE_PYGI */ +} + +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); +} + +#endif /* _PYGI_EXTERNAL_H_ */ diff --git a/gobject/pyginterface.c b/gobject/pyginterface.c new file mode 100644 index 0000000..29af546 --- /dev/null +++ b/gobject/pyginterface.c @@ -0,0 +1,122 @@ +/* -*- 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 + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "pyglib.h" +#include "pygobject-private.h" + +GQuark pyginterface_type_key; +GQuark pyginterface_info_key; + +PYGLIB_DEFINE_TYPE("gobject.GInterface", PyGInterface_Type, PyObject) + +static int +pyg_interface_init(PyObject *self, PyObject *args, PyObject *kwargs) +{ + gchar buf[512]; + + if (!PyArg_ParseTuple(args, ":GInterface.__init__")) + return -1; + + g_snprintf(buf, sizeof(buf), "%s can not be constructed", + Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_NotImplementedError, buf); + return -1; +} + +static void +pyg_interface_free(PyObject *op) +{ + PyObject_FREE(op); +} + +/** + * pyg_register_interface: + * @dict: a module dictionary. + * @class_name: the class name for the wrapper class. + * @gtype: the GType of the interface. + * @type: the wrapper class for the interface. + * + * Registers a Python class as the wrapper for a GInterface. As a + * convenience it will also place a reference to the wrapper class in + * the provided module dictionary. + */ +void +pyg_register_interface(PyObject *dict, const gchar *class_name, + GType gtype, PyTypeObject *type) +{ + PyObject *o; + + Py_TYPE(type) = &PyType_Type; + type->tp_base = &PyGInterface_Type; + + if (PyType_Ready(type) < 0) { + g_warning("could not ready `%s'", type->tp_name); + return; + } + + if (gtype) { + o = pyg_type_wrapper_new(gtype); + PyDict_SetItemString(type->tp_dict, "__gtype__", o); + Py_DECREF(o); + } + + 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); +} + +const GInterfaceInfo * +pyg_lookup_interface_info(GType gtype) +{ + return g_type_get_qdata(gtype, pyginterface_info_key); +} + +void +pygobject_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"); + + 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; + + PYGOBJECT_REGISTER_GTYPE(d, PyGInterface_Type, "GInterface", G_TYPE_INTERFACE) + + PyDict_SetItemString(PyGInterface_Type.tp_dict, "__doc__", + pyg_object_descr_doc_get()); + PyDict_SetItemString(PyGInterface_Type.tp_dict, "__gdoc__", + pyg_object_descr_doc_get()); + +} diff --git a/gobject/pyginterface.h b/gobject/pyginterface.h new file mode 100644 index 0000000..0f390c2 --- /dev/null +++ b/gobject/pyginterface.h @@ -0,0 +1,40 @@ +/* -*- 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_INTERFACE_H__ +#define __PYGOBJECT_INTERFACE_H__ + +extern GQuark pyginterface_type_key; +extern GQuark pyginterface_info_key; + +extern PyTypeObject PyGInterface_Type; + +void pyg_register_interface(PyObject *dict, + const gchar *class_name, + GType gtype, + PyTypeObject *type); +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); + +#endif /* __PYGOBJECT_INTERFACE_H__ */ diff --git a/gobject/pygobject-private.h b/gobject/pygobject-private.h new file mode 100644 index 0000000..2a09eed --- /dev/null +++ b/gobject/pygobject-private.h @@ -0,0 +1,229 @@ +#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; +#define pyg_block_threads() G_STMT_START { \ + if (pygobject_api_functions.block_threads != NULL) \ + (* pygobject_api_functions.block_threads)(); \ + } G_STMT_END +#define pyg_unblock_threads() G_STMT_START { \ + if (pygobject_api_functions.unblock_threads != NULL) \ + (* pygobject_api_functions.unblock_threads)(); \ + } G_STMT_END + +#define pyg_threads_enabled (pygobject_api_functions.threads_enabled) + + +#define pyg_gil_state_ensure() (pygobject_api_functions.threads_enabled? (PyGILState_Ensure()) : 0) +#define pyg_gil_state_release(state) G_STMT_START { \ + if (pygobject_api_functions.threads_enabled) \ + PyGILState_Release(state); \ + } G_STMT_END + +#define pyg_begin_allow_threads \ + G_STMT_START { \ + PyThreadState *_save = NULL; \ + if (pygobject_api_functions.threads_enabled) \ + _save = PyEval_SaveThread(); +#define pyg_end_allow_threads \ + if (pygobject_api_functions.threads_enabled) \ + PyEval_RestoreThread(_save); \ + } G_STMT_END + + +#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; + +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); +int pygobject_construct (PyGObject *self, + const char *first_property_name, + ...); +void pyg_set_object_has_new_constructor (GType gtype); + +PyObject *pyg_integer_richcompare(PyObject *v, + PyObject *w, + int op); + +gboolean pyg_gerror_exception_check(GError **error); + +/* from pygtype.h */ +extern PyTypeObject PyGTypeWrapper_Type; + +PyObject *pyg_type_wrapper_new (GType type); +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, gint *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); +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 sink, gpointer g_class); +void pygobject_sink (GObject *obj); +PyTypeObject *pygobject_lookup_class (GType gtype); +void pygobject_watch_closure (PyObject *self, GClosure *closure); +void pygobject_register_sinkfunc(GType type, + void (* sinkfunc)(GObject *object)); +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 { + _PyLongObject parent; + GType gtype; +} PyGFlags; + +extern PyTypeObject PyGFlags_Type; + +#define PyGFlags_Check(x) (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, + int value); + +/* pygenum */ +#define PyGEnum_Check(x) (g_type_is_a(((PyGFlags*)x)->gtype, G_TYPE_ENUM)) + +typedef struct { + _PyLongObject parent; + 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 GHashTable *custom_type_registration; +void pyg_type_register_custom_callback(const gchar *type_name, + PyGTypeRegistrationFunction callback, + gpointer data); +PyTypeObject * pyg_type_get_custom(const gchar *name); +GType _pyg_type_from_name(const gchar *name); + +/* 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)); +} + + +#endif diff --git a/gobject/pygobject.c b/gobject/pygobject.c new file mode 100644 index 0000000..2671fa9 --- /dev/null +++ b/gobject/pygobject.c @@ -0,0 +1,2326 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * + * pygobject.c: wrapper for the GObject type. + * + * 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 "pyginterface.h" +#include "pygparamspec.h" + +#include "pygi-external.h" + + +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 inline PyGObjectData * pyg_object_peek_inst_data(GObject *obj); +static PyObject * pygobject_weak_ref_new(GObject *obj, PyObject *callback, PyObject *user_data); +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, + gboolean check_for_present); +GType PY_TYPE_OBJECT = 0; +GQuark pygobject_class_key; +GQuark pygobject_class_init_key; +GQuark pygobject_wrapper_key; +GQuark pygobject_has_updated_constructor_key; +GQuark pygobject_instance_data_key; + + +/* -------------- class <-> wrapper manipulation --------------- */ + +void +pygobject_data_free(PyGObjectData *data) +{ + PyGILState_STATE state = pyglib_gil_state_ensure(); + GSList *closures, *tmp; + Py_DECREF(data->type); + tmp = closures = data->closures; +#ifndef NDEBUG + data->closures = NULL; + data->type = NULL; +#endif + pyg_begin_allow_threads; + while (tmp) { + GClosure *closure = tmp->data; + + /* we get next item first, because the current link gets + * invalidated by pygobject_unwatch_closure */ + tmp = tmp->next; + g_closure_invalidate(closure); + } + pyg_end_allow_threads; + + if (data->closures != NULL) + g_warning("invalidated all closures, but data->closures != NULL !"); + + g_free(data); + pyglib_gil_state_release(state); +} + +static inline PyGObjectData * +pygobject_data_new(void) +{ + PyGObjectData *data; + data = g_new0(PyGObjectData, 1); + return data; +} + +static inline PyGObjectData * +pygobject_get_inst_data(PyGObject *self) +{ + PyGObjectData *inst_data; + + if (G_UNLIKELY(!self->obj)) + return NULL; + inst_data = g_object_get_qdata(self->obj, pygobject_instance_data_key); + if (inst_data == NULL) + { + inst_data = pygobject_data_new(); + + inst_data->type = Py_TYPE(self); + Py_INCREF((PyObject *) inst_data->type); + + g_object_set_qdata_full(self->obj, pygobject_instance_data_key, + inst_data, (GDestroyNotify) pygobject_data_free); + } + return inst_data; +} + + +typedef struct { + GType type; + void (* sinkfunc)(GObject *object); +} SinkFunc; +static GArray *sink_funcs = NULL; + +GHashTable *custom_type_registration = NULL; + +PyTypeObject *PyGObject_MetaType = NULL; + +/** + * pygobject_sink: + * @obj: a GObject + * + * As Python handles reference counting for us, the "floating + * reference" code in GTK is not all that useful. In fact, it can + * cause leaks. This function should be called to remove the floating + * references on objects on construction. + **/ +void +pygobject_sink(GObject *obj) +{ + if (sink_funcs) { + gint i; + + for (i = 0; i < sink_funcs->len; i++) { + if (g_type_is_a(G_OBJECT_TYPE(obj), + g_array_index(sink_funcs, SinkFunc, i).type)) { + g_array_index(sink_funcs, SinkFunc, i).sinkfunc(obj); + return; + } + } + } + if (G_IS_INITIALLY_UNOWNED(obj) && !g_object_is_floating(obj)) { + /* GtkWindow and GtkInvisible does not return a ref to caller of + * g_object_new. + */ + g_object_ref(obj); + } else if (g_object_is_floating(obj)) { + g_object_ref_sink(obj); + } +} + +/** + * pygobject_register_sinkfunc: + * type: the GType the sink function applies to. + * sinkfunc: a function to remove the floating reference on an object. + * + * As Python handles reference counting for us, the "floating + * reference" code in GTK is not all that useful. In fact, it can + * cause leaks. For this reason, PyGTK removes the floating + * references on objects on construction. + * + * The sinkfunc should be able to remove the floating reference on + * instances of the given type, or any subclasses. + * + * Deprecated: Since 2.22, sinkfuncs are not needed. + */ +void +pygobject_register_sinkfunc(GType type, void (* sinkfunc)(GObject *object)) +{ + SinkFunc sf; + + g_message ("pygobject_register_sinkfunc is deprecated (%s)", + g_type_name(type)); + +#if 0 + g_return_if_fail(G_TYPE_IS_OBJECT(type)); +#endif + g_return_if_fail(sinkfunc != NULL); + + if (!sink_funcs) + sink_funcs = g_array_new(FALSE, FALSE, sizeof(SinkFunc)); + + sf.type = type; + sf.sinkfunc = sinkfunc; + g_array_append_val(sink_funcs, sf); +} + +typedef struct { + PyObject_HEAD + GParamSpec **props; + guint n_props; + guint index; +} PyGPropsIter; + +PYGLIB_DEFINE_TYPE("gobject.GPropsIter", PyGPropsIter_Type, PyGPropsIter); + +static void +pyg_props_iter_dealloc(PyGPropsIter *self) +{ + g_free(self->props); + PyObject_Del((PyObject*) self); +} + +static PyObject* +pygobject_props_iter_next(PyGPropsIter *iter) +{ + if (iter->index < iter->n_props) + return pyg_param_spec_new(iter->props[iter->index++]); + else { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } +} + +typedef struct { + PyObject_HEAD + /* a reference to the object containing the properties */ + PyGObject *pygobject; + GType gtype; +} PyGProps; + +static void +PyGProps_dealloc(PyGProps* self) +{ + PyGObject *tmp; + + PyObject_GC_UnTrack((PyObject*)self); + + tmp = self->pygobject; + self->pygobject = NULL; + Py_XDECREF(tmp); + + PyObject_GC_Del((PyObject*)self); +} + +static PyObject* +build_parameter_list(GObjectClass *class) +{ + GParamSpec **props; + guint n_props = 0, i; + PyObject *prop_str; + PyObject *props_list; + + props = g_object_class_list_properties(class, &n_props); + props_list = PyList_New(n_props); + for (i = 0; i < n_props; i++) { + char *name; + name = g_strdup(g_param_spec_get_name(props[i])); + /* hyphens cannot belong in identifiers */ + g_strdelimit(name, "-", '_'); + prop_str = _PyUnicode_FromString(name); + + PyList_SetItem(props_list, i, prop_str); + g_free(name); + } + + if (props) + g_free(props); + + return props_list; +} + +static PyObject* +PyGProps_getattro(PyGProps *self, PyObject *attr) +{ + char *attr_name; + GObjectClass *class; + GParamSpec *pspec; + GValue value = { 0, }; + PyObject *ret; + + attr_name = _PyUnicode_AsString(attr); + if (!attr_name) { + PyErr_Clear(); + return PyObject_GenericGetAttr((PyObject *)self, attr); + } + + class = g_type_class_ref(self->gtype); + + if (!strcmp(attr_name, "__members__")) { + return build_parameter_list(class); + } + + pspec = g_object_class_find_property(class, attr_name); + g_type_class_unref(class); + + if (!pspec) { + 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 we're doing it without an instance, return a GParamSpec */ + if (!self->pygobject) { + return pyg_param_spec_new(pspec); + } + + g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); + pyg_begin_allow_threads; + g_object_get_property(self->pygobject->obj, attr_name, &value); + pyg_end_allow_threads; + ret = pyg_param_gvalue_as_pyobject(&value, TRUE, pspec); + g_value_unset(&value); + + return ret; +} + +static gboolean +set_property_from_pspec(GObject *obj, + char *attr_name, + GParamSpec *pspec, + PyObject *pvalue) +{ + GValue value = { 0, }; + + if (pspec->flags & G_PARAM_CONSTRUCT_ONLY) { + PyErr_Format(PyExc_TypeError, + "property '%s' can only be set in constructor", + attr_name); + return FALSE; + } + + if (!(pspec->flags & G_PARAM_WRITABLE)) { + PyErr_Format(PyExc_TypeError, + "property '%s' is not writable", attr_name); + return FALSE; + } + + g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); + if (pyg_param_gvalue_from_pyobject(&value, pvalue, pspec) < 0) { + PyErr_SetString(PyExc_TypeError, + "could not convert argument to correct param type"); + return FALSE; + } + + pyg_begin_allow_threads; + g_object_set_property(obj, attr_name, &value); + pyg_end_allow_threads; + + g_value_unset(&value); + + return TRUE; +} + +PYGLIB_DEFINE_TYPE("gobject.GProps", PyGProps_Type, PyGProps); + +static int +PyGProps_setattro(PyGProps *self, PyObject *attr, PyObject *pvalue) +{ + GParamSpec *pspec; + char *attr_name; + GObject *obj; + + if (pvalue == NULL) { + PyErr_SetString(PyExc_TypeError, "properties cannot be " + "deleted"); + return -1; + } + + attr_name = _PyUnicode_AsString(attr); + if (!attr_name) { + PyErr_Clear(); + return PyObject_GenericSetAttr((PyObject *)self, attr, pvalue); + } + + if (!self->pygobject) { + PyErr_SetString(PyExc_TypeError, + "cannot set GOject properties without an instance"); + return -1; + } + + obj = self->pygobject->obj; + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(obj), attr_name); + if (!pspec) { + return PyObject_GenericSetAttr((PyObject *)self, attr, pvalue); + } + + if (!set_property_from_pspec(obj, attr_name, pspec, pvalue)) + return -1; + + return 0; +} + +static int +pygobject_props_traverse(PyGProps *self, visitproc visit, void *arg) +{ + if (self->pygobject && visit((PyObject *) self->pygobject, arg) < 0) + return -1; + return 0; +} + +static PyObject* +pygobject_props_get_iter(PyGProps *self) +{ + PyGPropsIter *iter; + GObjectClass *class; + + iter = PyObject_NEW(PyGPropsIter, &PyGPropsIter_Type); + class = g_type_class_ref(self->gtype); + iter->props = g_object_class_list_properties(class, &iter->n_props); + iter->index = 0; + g_type_class_unref(class); + return (PyObject *) iter; +} + +static Py_ssize_t +PyGProps_length(PyGProps *self) +{ + GObjectClass *class; + GParamSpec **props; + guint n_props; + + class = g_type_class_ref(self->gtype); + props = g_object_class_list_properties(class, &n_props); + g_type_class_unref(class); + g_free(props); + + return (Py_ssize_t)n_props; +} + +static PySequenceMethods _PyGProps_as_sequence = { + (lenfunc) PyGProps_length, + 0, + 0, + 0, + 0, + 0, + 0 +}; + +PYGLIB_DEFINE_TYPE("gobject.GPropsDescr", PyGPropsDescr_Type, PyObject); + +static PyObject * +pyg_props_descr_descr_get(PyObject *self, PyObject *obj, PyObject *type) +{ + PyGProps *gprops; + + gprops = PyObject_GC_New(PyGProps, &PyGProps_Type); + if (obj == NULL || obj == Py_None) { + gprops->pygobject = NULL; + gprops->gtype = pyg_type_from_object(type); + } else { + if (!PyObject_IsInstance(obj, (PyObject *) &PyGObject_Type)) { + PyErr_SetString(PyExc_TypeError, "cannot use GObject property" + " descriptor on non-GObject instances"); + return NULL; + } + Py_INCREF(obj); + gprops->pygobject = (PyGObject *) obj; + gprops->gtype = pyg_type_from_object(obj); + } + return (PyObject *) gprops; +} + +/** + * pygobject_register_class: + * @dict: the module dictionary. A reference to the type will be stored here. + * @type_name: not used ? + * @gtype: the GType of the GObject subclass. + * @type: the Python type object for this wrapper. + * @static_bases: a tuple of Python type objects that are the bases of + * this type + * + * This function is used to register a Python type as the wrapper for + * a particular GObject subclass. It will also insert a reference to + * the wrapper class into the module dictionary passed as a reference, + * which simplifies initialisation. + */ +void +pygobject_register_class(PyObject *dict, const gchar *type_name, + GType gtype, PyTypeObject *type, + PyObject *static_bases) +{ + PyObject *o; + const char *class_name, *s; + PyObject *runtime_bases; + PyObject *bases_list, *bases, *mod_name; + int i; + + class_name = type->tp_name; + s = strrchr(class_name, '.'); + if (s != NULL) + class_name = s + 1; + + runtime_bases = pyg_type_get_bases(gtype); + if (static_bases) { + PyTypeObject *py_parent_type = (PyTypeObject *) PyTuple_GET_ITEM(static_bases, 0); + bases_list = PySequence_List(static_bases); + /* we start at index 1 because we want to skip the primary + * base, otherwise we might get MRO conflict */ + for (i = 1; i < PyTuple_GET_SIZE(runtime_bases); ++i) + { + PyObject *base = PyTuple_GET_ITEM(runtime_bases, i); + int contains = PySequence_Contains(bases_list, base); + if (contains < 0) + PyErr_Print(); + else if (!contains) { + if (!PySequence_Contains(py_parent_type->tp_mro, base)) { +#if 0 + g_message("Adding missing base %s to type %s", + ((PyTypeObject *)base)->tp_name, type->tp_name); +#endif + PyList_Append(bases_list, base); + } + } + } + bases = PySequence_Tuple(bases_list); + Py_DECREF(bases_list); + Py_DECREF(runtime_bases); + } else + bases = runtime_bases; + + Py_TYPE(type) = PyGObject_MetaType; + type->tp_bases = bases; + if (G_LIKELY(bases)) { + type->tp_base = (PyTypeObject *)PyTuple_GetItem(bases, 0); + Py_INCREF(type->tp_base); + } + + pygobject_inherit_slots(type, bases, TRUE); + + if (PyType_Ready(type) < 0) { + g_warning ("couldn't make the type `%s' ready", type->tp_name); + return; + } + + /* Set type.__module__ to the name of the module, + * otherwise it'll default to 'gobject', see #376099 + */ + s = strrchr(type->tp_name, '.'); + if (s != NULL) { + mod_name = _PyUnicode_FromStringAndSize(type->tp_name, (int)(s - type->tp_name)); + PyDict_SetItemString(type->tp_dict, "__module__", mod_name); + Py_DECREF(mod_name); + } + + if (gtype) { + o = pyg_type_wrapper_new(gtype); + PyDict_SetItemString(type->tp_dict, "__gtype__", o); + Py_DECREF(o); + + /* stash a pointer to the python class with the GType */ + Py_INCREF(type); + g_type_set_qdata(gtype, pygobject_class_key, type); + } + + /* set up __doc__ descriptor on type */ + PyDict_SetItemString(type->tp_dict, "__doc__", + pyg_object_descr_doc_get()); + + PyDict_SetItemString(dict, (char *)class_name, (PyObject *)type); +} + +static void +pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref) +{ + PyGObject *self = (PyGObject*) data; + PyGILState_STATE state; + + state = pyglib_gil_state_ensure(); + + if (is_last_ref) + Py_DECREF(self); + else + Py_INCREF(self); + + pyglib_gil_state_release(state); +} + + /* Called when the inst_dict is first created; switches the + reference counting strategy to start using toggle ref to keep the + wrapper alive while the GObject lives. In contrast, while + 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) +{ + g_assert(self->obj->ref_count >= 1); + + if (self->private_flags.flags & PYGOBJECT_USING_TOGGLE_REF) + return; /* already using toggle ref */ + 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_unref(self->obj); +} + +/** + * pygobject_register_wrapper: + * @self: the wrapper instance + * + * In the constructor of PyGTK wrappers, this function should be + * called after setting the obj member. It will tie the wrapper + * instance to the GObject so that the same wrapper instance will + * always be used for this GObject instance. + */ +void +pygobject_register_wrapper(PyObject *self) +{ + PyGObject *gself; + + g_return_if_fail(self != NULL); + g_return_if_fail(PyObject_TypeCheck(self, &PyGObject_Type)); + + gself = (PyGObject *)self; + + pygobject_sink(gself->obj); + 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); +} + +static PyObject * +pyg_type_get_bases(GType gtype) +{ + GType *interfaces, parent_type, interface_type; + guint n_interfaces; + PyTypeObject *py_parent_type, *py_interface_type; + PyObject *bases; + int i; + + if (G_UNLIKELY(gtype == G_TYPE_OBJECT)) + return NULL; + + /* Lookup the parent type */ + parent_type = g_type_parent(gtype); + py_parent_type = pygobject_lookup_class(parent_type); + interfaces = g_type_interfaces(gtype, &n_interfaces); + bases = PyTuple_New(n_interfaces + 1); + /* We will always put the parent at the first position in bases */ + Py_INCREF(py_parent_type); /* PyTuple_SetItem steals a reference */ + PyTuple_SetItem(bases, 0, (PyObject *) py_parent_type); + + /* And traverse interfaces */ + if (n_interfaces) { + for (i = 0; i < n_interfaces; i++) { + interface_type = interfaces[i]; + py_interface_type = pygobject_lookup_class(interface_type); + Py_INCREF(py_interface_type); /* PyTuple_SetItem steals a reference */ + PyTuple_SetItem(bases, i + 1, (PyObject *) py_interface_type); + } + } + g_free(interfaces); + return bases; +} + +/** + * pygobject_new_with_interfaces + * @gtype: the GType of the GObject subclass. + * + * Creates a new PyTypeObject from the given GType with interfaces attached in + * bases. + * + * Returns: a PyTypeObject for the new type or NULL if it couldn't be created + */ +PyTypeObject * +pygobject_new_with_interfaces(GType gtype) +{ + PyGILState_STATE state; + PyObject *o; + PyTypeObject *type; + PyObject *dict; + PyTypeObject *py_parent_type; + PyObject *bases; + PyObject *modules, *module; + gchar *type_name, *mod_name, *gtype_name; + + state = pyglib_gil_state_ensure(); + + bases = pyg_type_get_bases(gtype); + py_parent_type = (PyTypeObject *) PyTuple_GetItem(bases, 0); + + dict = PyDict_New(); + + o = pyg_type_wrapper_new(gtype); + PyDict_SetItemString(dict, "__gtype__", o); + Py_DECREF(o); + + /* 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); + } + + type = (PyTypeObject*)PyObject_CallFunction((PyObject *) Py_TYPE(py_parent_type), + "sNN", type_name, bases, dict); + g_free(type_name); + + if (type == NULL) { + PyErr_Print(); + pyglib_gil_state_release(state); + return NULL; + } + + /* Workaround python tp_(get|set)attr slot inheritance bug. + * Fixes bug #144135. */ + if (!type->tp_getattr && py_parent_type->tp_getattr) { + type->tp_getattro = NULL; + type->tp_getattr = py_parent_type->tp_getattr; + } + if (!type->tp_setattr && py_parent_type->tp_setattr) { + type->tp_setattro = NULL; + type->tp_setattr = py_parent_type->tp_setattr; + } + /* override more python stupid hacks behind our back */ + type->tp_dealloc = py_parent_type->tp_dealloc; + type->tp_alloc = py_parent_type->tp_alloc; + type->tp_free = py_parent_type->tp_free; + type->tp_traverse = py_parent_type->tp_traverse; + type->tp_clear = py_parent_type->tp_clear; + + pygobject_inherit_slots(type, bases, FALSE); + + if (PyType_Ready(type) < 0) { + g_warning ("couldn't make the type `%s' ready", type->tp_name); + pyglib_gil_state_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); + + return type; +} + +/* Pick appropriate value for given slot (at slot_offset inside + * PyTypeObject structure). It must be a pointer, e.g. a pointer to a + * function. We use the following heuristic: + * + * - Scan all types listed as bases of the type. + * - If for exactly one base type slot value is non-NULL and + * different from that of 'object' and 'GObject', set current type + * slot into that value. + * - Otherwise (if there is more than one such base type or none at + * all) don't touch it and live with Python default. + * + * The intention here is to propagate slot from custom wrappers to + * wrappers created at runtime when appropriate. We prefer to be on + * the safe side, so if there is potential collision (more than one + * custom slot value), we discard custom overrides altogether. + * + * When registering type with pygobject_register_class(), i.e. a type + * that has been manually created (likely with Codegen help), + * `check_for_present' should be set to TRUE. In this case, the + * function will never overwrite any non-NULL slots already present in + * the type. If `check_for_present' is FALSE, such non-NULL slots are + * though to be set by Python interpreter and so will be overwritten + * if heuristic above says so. + */ +static void +pygobject_inherit_slots(PyTypeObject *type, PyObject *bases, gboolean check_for_present) +{ + static int slot_offsets[] = { offsetof(PyTypeObject, tp_richcompare), + offsetof(PyTypeObject, tp_compare), + offsetof(PyTypeObject, tp_hash), + offsetof(PyTypeObject, tp_iter), + offsetof(PyTypeObject, tp_repr), + offsetof(PyTypeObject, tp_str), + offsetof(PyTypeObject, tp_print) }; + int i; + + /* Happens when registering gobject.GObject itself, at least. */ + if (!bases) + return; + + for (i = 0; i < G_N_ELEMENTS(slot_offsets); ++i) + pygobject_find_slot_for(type, bases, slot_offsets[i], check_for_present); +} + +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)) + + void *found_slot = NULL; + int num_bases = PyTuple_Size(bases); + int i; + + if (check_for_present && TYPE_SLOT(type) != NULL) { + /* We are requested to check if there is any custom slot value + * in this type already and there actually is. Don't + * overwrite it. + */ + return; + } + + for (i = 0; i < num_bases; ++i) { + PyTypeObject *base_type = (PyTypeObject *) PyTuple_GetItem(bases, i); + void *slot = TYPE_SLOT(base_type); + + if (slot == NULL) + continue; + if (slot == TYPE_SLOT(&PyGObject_Type) || + slot == TYPE_SLOT(&PyBaseObject_Type)) + continue; + + if (found_slot != NULL && found_slot != slot) { + /* We have a conflict: more than one base use different + * custom slots. To be on the safe side, we bail out. + */ + return; + } + + found_slot = slot; + } + + /* Only perform the final assignment if at least one base has a + * custom value. Otherwise just leave this type's slot untouched. + */ + if (found_slot != NULL) + TYPE_SLOT(type) = found_slot; + +#undef TYPE_SLOT +} + +/** + * pygobject_lookup_class: + * @gtype: the GType of the GObject subclass. + * + * This function looks up the wrapper class used to represent + * instances of a GObject represented by @gtype. If no wrapper class + * or interface has been registered for the given GType, then a new + * type will be created. + * + * Returns: The wrapper class for the GObject or NULL if the + * GType has no registered type and a new type couldn't be created + */ +PyTypeObject * +pygobject_lookup_class(GType gtype) +{ + PyTypeObject *py_type; + + if (gtype == G_TYPE_INTERFACE) + return &PyGInterface_Type; + + py_type = pyg_type_get_custom(g_type_name(gtype)); + if (py_type) + return py_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); + + if (py_type == NULL) + py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype); + + if (py_type == NULL) { + py_type = pygobject_new_with_interfaces(gtype); + g_type_set_qdata(gtype, pyginterface_type_key, py_type); + } + } + + return py_type; +} + +/** + * pygobject_new_full: + * @obj: a GObject instance. + * @sink: whether to sink any floating reference found on the GObject. DEPRECATED. + * @g_class: the GObjectClass + * + * This function gets a reference to a wrapper for the given GObject + * instance. If a wrapper has already been created, a new reference + * to that wrapper will be returned. Otherwise, a wrapper instance + * will be created. + * + * Returns: a reference to the wrapper for the GObject. + */ +PyObject * +pygobject_new_full(GObject *obj, gboolean sink, gpointer g_class) +{ + PyGObject *self; + + if (obj == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + + /* we already have a wrapper for this object -- return it. */ + self = (PyGObject *)g_object_get_qdata(obj, pygobject_wrapper_key); + if (self != NULL) { + Py_INCREF(self); + } else { + /* create wrapper */ + PyGObjectData *inst_data = pyg_object_peek_inst_data(obj); + PyTypeObject *tp; + if (inst_data) + tp = inst_data->type; + else { + if (g_class) + tp = pygobject_lookup_class(G_OBJECT_CLASS_TYPE(g_class)); + else + tp = pygobject_lookup_class(G_OBJECT_TYPE(obj)); + } + g_assert(tp != NULL); + + /* need to bump type refcount if created with + pygobject_new_with_interfaces(). fixes bug #141042 */ + if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) + Py_INCREF(tp); + self = PyObject_GC_New(PyGObject, tp); + if (self == NULL) + return NULL; + self->inst_dict = NULL; + self->weakreflist = NULL; + self->private_flags.flags = 0; + self->obj = obj; + g_object_ref(obj); + pygobject_register_wrapper((PyObject *)self); + PyObject_GC_Track((PyObject *)self); + } + + return (PyObject *)self; +} + + +PyObject * +pygobject_new(GObject *obj) +{ + return pygobject_new_full(obj, TRUE, NULL); +} + +static void +pygobject_unwatch_closure(gpointer data, GClosure *closure) +{ + PyGObjectData *inst_data = data; + + inst_data->closures = g_slist_remove (inst_data->closures, closure); +} + +/** + * pygobject_watch_closure: + * @self: a GObject wrapper instance + * @closure: a GClosure to watch + * + * Adds a closure to the list of watched closures for the wrapper. + * The closure must be one returned by pyg_closure_new(). When the + * cycle GC traverses the wrapper instance, it will enumerate the + * references to Python objects stored in watched closures. If the + * cycle GC tells the wrapper to clear itself, the watched closures + * will be invalidated. + */ +void +pygobject_watch_closure(PyObject *self, GClosure *closure) +{ + PyGObject *gself; + PyGObjectData *data; + + g_return_if_fail(self != NULL); + g_return_if_fail(PyObject_TypeCheck(self, &PyGObject_Type)); + g_return_if_fail(closure != NULL); + + gself = (PyGObject *)self; + data = pygobject_get_inst_data(gself); + 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); +} + +/* -------------- PyGObject behaviour ----------------- */ + +PYGLIB_DEFINE_TYPE("gobject.GObject", PyGObject_Type, PyGObject); + +static void +pygobject_dealloc(PyGObject *self) +{ + PyObject_ClearWeakRefs((PyObject *)self); + PyObject_GC_UnTrack((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 */ + pygobject_get_inst_data(self); + pygobject_clear(self); + /* the following causes problems with subclassed types */ + /* Py_TYPE(self)->tp_free((PyObject *)self); */ + PyObject_GC_Del(self); +} + +static int +pygobject_compare(PyGObject *self, PyGObject *v) +{ + if (self->obj == v->obj) return 0; + if (self->obj > v->obj) return -1; + return 1; +} + +static long +pygobject_hash(PyGObject *self) +{ + return (long)self->obj; +} + +static PyObject * +pygobject_repr(PyGObject *self) +{ + gchar buf[256]; + + 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 _PyUnicode_FromString(buf); +} + + +static int +pygobject_traverse(PyGObject *self, visitproc visit, void *arg) +{ + int ret = 0; + GSList *tmp; + PyGObjectData *data = pygobject_get_inst_data(self); + + if (self->inst_dict) ret = visit(self->inst_dict, arg); + if (ret != 0) return ret; + + if (data) { + + for (tmp = data->closures; tmp != NULL; tmp = tmp->next) { + PyGClosure *closure = tmp->data; + + if (closure->callback) ret = visit(closure->callback, arg); + if (ret != 0) return ret; + + if (closure->extra_args) ret = visit(closure->extra_args, arg); + if (ret != 0) return ret; + + if (closure->swap_data) ret = visit(closure->swap_data, arg); + if (ret != 0) return ret; + } + } + return ret; +} + +static inline int +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); + self->private_flags.flags &= ~PYGOBJECT_USING_TOGGLE_REF; + } else { + pyg_begin_allow_threads; + g_object_unref(self->obj); + pyg_end_allow_threads; + } + self->obj = NULL; + } + Py_CLEAR(self->inst_dict); + return 0; +} + +static void +pygobject_free(PyObject *op) +{ + PyObject_GC_Del(op); +} + + +/* ---------------- PyGObject methods ----------------- */ + +static int +pygobject_init(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + GType object_type; + guint n_params = 0, i; + GParameter *params = NULL; + GObjectClass *class; + + if (!PyArg_ParseTuple(args, ":GObject.__init__", &object_type)) + return -1; + + object_type = pyg_type_from_object((PyObject *)self); + if (!object_type) + return -1; + + if (G_TYPE_IS_ABSTRACT(object_type)) { + PyErr_Format(PyExc_TypeError, "cannot create instance of abstract " + "(non-instantiable) type `%s'", g_type_name(object_type)); + return -1; + } + + if ((class = g_type_class_ref (object_type)) == NULL) { + PyErr_SetString(PyExc_TypeError, + "could not get a reference to type class"); + return -1; + } + + if (kwargs) { + Py_ssize_t pos = 0; + PyObject *key; + PyObject *value; + + params = g_new0(GParameter, PyDict_Size(kwargs)); + while (PyDict_Next (kwargs, &pos, &key, &value)) { + GParamSpec *pspec; + gchar *key_str = _PyUnicode_AsString(key); + + pspec = g_object_class_find_property (class, key_str); + if (!pspec) { + PyErr_Format(PyExc_TypeError, + "object of type `%s' doesn't support property `%s'", + g_type_name(object_type), key_str); + goto cleanup; + } + g_value_init(¶ms[n_params].value, + G_PARAM_SPEC_VALUE_TYPE(pspec)); + if (pyg_value_from_pyobject(¶ms[n_params].value, value)) { + PyErr_Format(PyExc_TypeError, + "could not convert value for property `%s'", + key_str); + goto cleanup; + } + params[n_params].name = g_strdup(key_str); + n_params++; + } + } + if (pygobject_constructv(self, n_params, params)) + 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); + + return (self->obj) ? 0 : -1; +} + +static PyObject * +pygobject__gobject_init__(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + if (pygobject_init(self, args, kwargs) < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; +} + +#define CHECK_GOBJECT(self) \ + if (!G_IS_OBJECT(self->obj)) { \ + PyErr_Format(PyExc_TypeError, \ + "object at %p of type %s is not initialized", \ + self, Py_TYPE(self)->tp_name); \ + return NULL; \ + } + +static PyObject * +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; + + 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)); + pyg_begin_allow_threads; + g_object_get_property(self->obj, param_name, &value); + pyg_end_allow_threads; + ret = pyg_param_gvalue_as_pyobject(&value, TRUE, pspec); + g_value_unset(&value); + return ret; +} + +static PyObject * +pygobject_get_properties(PyGObject *self, PyObject *args) +{ + GObjectClass *class; + int len, i; + PyObject *tuple; + + if ((len = PyTuple_Size(args)) < 1) { + PyErr_SetString(PyExc_TypeError, "requires at least one argument"); + return NULL; + } + + 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 (!_PyUnicode_Check(py_property)) { + PyErr_SetString(PyExc_TypeError, + "Expected string argument for property."); + return NULL; + } + + property_name = _PyUnicode_AsString(py_property); + + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(self->obj), + 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; + } + g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec)); + + pyg_begin_allow_threads; + g_object_get_property(self->obj, property_name, &value); + pyg_end_allow_threads; + + item = pyg_value_as_pyobject(&value, TRUE); + PyTuple_SetItem(tuple, i, item); + + g_value_unset(&value); + } + + return tuple; +} + +static PyObject * +pygobject_set_property(PyGObject *self, PyObject *args) +{ + gchar *param_name; + GParamSpec *pspec; + PyObject *pvalue; + + if (!PyArg_ParseTuple(args, "sO:GObject.set_property", ¶m_name, + &pvalue)) + 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 (!set_property_from_pspec(self->obj, param_name, pspec, pvalue)) + return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_set_properties(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + GObjectClass *class; + Py_ssize_t pos; + PyObject *value; + PyObject *key; + PyObject *result = NULL; + + CHECK_GOBJECT(self); + + class = G_OBJECT_GET_CLASS(self->obj); + + g_object_freeze_notify (G_OBJECT(self->obj)); + pos = 0; + + while (kwargs && PyDict_Next (kwargs, &pos, &key, &value)) { + gchar *key_str = _PyUnicode_AsString(key); + GParamSpec *pspec; + + pspec = g_object_class_find_property(class, key_str); + if (!pspec) { + gchar buf[512]; + + g_snprintf(buf, sizeof(buf), + "object `%s' doesn't support property `%s'", + g_type_name(G_OBJECT_TYPE(self->obj)), key_str); + PyErr_SetString(PyExc_TypeError, buf); + goto exit; + } + + if (!set_property_from_pspec(G_OBJECT(self->obj), key_str, pspec, value)) + goto exit; + } + + result = Py_None; + + exit: + g_object_thaw_notify (G_OBJECT(self->obj)); + Py_XINCREF(result); + return result; +} + +static PyObject * +pygobject_freeze_notify(PyGObject *self, PyObject *args) +{ + if (!PyArg_ParseTuple(args, ":GObject.freeze_notify")) + return NULL; + + CHECK_GOBJECT(self); + + g_object_freeze_notify(self->obj); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_notify(PyGObject *self, PyObject *args) +{ + char *property_name; + + if (!PyArg_ParseTuple(args, "s:GObject.notify", &property_name)) + return NULL; + + CHECK_GOBJECT(self); + + g_object_notify(self->obj, property_name); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_thaw_notify(PyGObject *self, PyObject *args) +{ + if (!PyArg_ParseTuple(args, ":GObject.thaw_notify")) + return NULL; + + CHECK_GOBJECT(self); + + g_object_thaw_notify(self->obj); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_get_data(PyGObject *self, PyObject *args) +{ + char *key; + GQuark quark; + PyObject *data; + + if (!PyArg_ParseTuple(args, "s:GObject.get_data", &key)) + return NULL; + + CHECK_GOBJECT(self); + + quark = g_quark_from_string(key); + data = g_object_get_qdata(self->obj, quark); + if (!data) data = Py_None; + Py_INCREF(data); + return data; +} + +static PyObject * +pygobject_set_data(PyGObject *self, PyObject *args) +{ + char *key; + GQuark quark; + PyObject *data; + + if (!PyArg_ParseTuple(args, "sO:GObject.set_data", &key, &data)) + return NULL; + + CHECK_GOBJECT(self); + + quark = g_quark_from_string(key); + Py_INCREF(data); + g_object_set_qdata_full(self->obj, quark, data, pyg_destroy_notify); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_connect(PyGObject *self, PyObject *args) +{ + PyObject *first, *callback, *extra_args; + gchar *name; + guint sigid, len; + gulong handlerid; + GQuark detail = 0; + GClosure *closure; + + len = PyTuple_Size(args); + if (len < 2) { + PyErr_SetString(PyExc_TypeError, + "GObject.connect requires at least 2 arguments"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 2); + if (!PyArg_ParseTuple(first, "sO:GObject.connect", &name, &callback)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "second argument must be callable"); + return NULL; + } + + CHECK_GOBJECT(self); + + if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj), + &sigid, &detail, TRUE)) { + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + name); + return NULL; + } + extra_args = PySequence_GetSlice(args, 2, len); + if (extra_args == NULL) + return NULL; + closure = pyg_closure_new(callback, extra_args, NULL); + pygobject_watch_closure((PyObject *)self, closure); + handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail, + closure, FALSE); + Py_DECREF(extra_args); + return PyLong_FromUnsignedLong(handlerid); +} + +static PyObject * +pygobject_connect_after(PyGObject *self, PyObject *args) +{ + PyObject *first, *callback, *extra_args; + gchar *name; + guint sigid; + gulong handlerid; + Py_ssize_t len; + GQuark detail; + GClosure *closure; + + len = PyTuple_Size(args); + if (len < 2) { + PyErr_SetString(PyExc_TypeError, + "GObject.connect_after requires at least 2 arguments"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 2); + if (!PyArg_ParseTuple(first, "sO:GObject.connect_after", + &name, &callback)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "second argument must be callable"); + return NULL; + } + + CHECK_GOBJECT(self); + + if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj), + &sigid, &detail, TRUE)) { + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + name); + return NULL; + } + extra_args = PySequence_GetSlice(args, 2, len); + if (extra_args == NULL) + return NULL; + closure = pyg_closure_new(callback, extra_args, NULL); + pygobject_watch_closure((PyObject *)self, closure); + handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail, + closure, TRUE); + Py_DECREF(extra_args); + return PyLong_FromUnsignedLong(handlerid); +} + +static PyObject * +pygobject_connect_object(PyGObject *self, PyObject *args) +{ + PyObject *first, *callback, *extra_args, *object; + gchar *name; + guint sigid; + gulong handlerid; + Py_ssize_t len; + GQuark detail; + GClosure *closure; + + len = PyTuple_Size(args); + if (len < 3) { + PyErr_SetString(PyExc_TypeError, + "GObject.connect_object requires at least 3 arguments"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 3); + if (!PyArg_ParseTuple(first, "sOO:GObject.connect_object", + &name, &callback, &object)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "second argument must be callable"); + return NULL; + } + + CHECK_GOBJECT(self); + + if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj), + &sigid, &detail, TRUE)) { + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + name); + return NULL; + } + extra_args = PySequence_GetSlice(args, 3, len); + if (extra_args == NULL) + return NULL; + closure = pyg_closure_new(callback, extra_args, object); + pygobject_watch_closure((PyObject *)self, closure); + handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail, + closure, FALSE); + Py_DECREF(extra_args); + return PyLong_FromUnsignedLong(handlerid); +} + +static PyObject * +pygobject_connect_object_after(PyGObject *self, PyObject *args) +{ + PyObject *first, *callback, *extra_args, *object; + gchar *name; + guint sigid; + gulong handlerid; + Py_ssize_t len; + GQuark detail; + GClosure *closure; + + len = PyTuple_Size(args); + if (len < 3) { + PyErr_SetString(PyExc_TypeError, + "GObject.connect_object_after requires at least 3 arguments"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 3); + if (!PyArg_ParseTuple(first, "sOO:GObject.connect_object_after", + &name, &callback, &object)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "second argument must be callable"); + return NULL; + } + + CHECK_GOBJECT(self); + + if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj), + &sigid, &detail, TRUE)) { + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + name); + return NULL; + } + extra_args = PySequence_GetSlice(args, 3, len); + if (extra_args == NULL) + return NULL; + closure = pyg_closure_new(callback, extra_args, object); + pygobject_watch_closure((PyObject *)self, closure); + handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail, + closure, TRUE); + Py_DECREF(extra_args); + return PyLong_FromUnsignedLong(handlerid); +} + +static PyObject * +pygobject_disconnect(PyGObject *self, PyObject *args) +{ + gulong handler_id; + + if (!PyArg_ParseTuple(args, "k:GObject.disconnect", &handler_id)) + return NULL; + + CHECK_GOBJECT(self); + + g_signal_handler_disconnect(self->obj, handler_id); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_handler_is_connected(PyGObject *self, PyObject *args) +{ + gulong handler_id; + + if (!PyArg_ParseTuple(args, "k:GObject.handler_is_connected", &handler_id)) + return NULL; + + + CHECK_GOBJECT(self); + + return PyBool_FromLong(g_signal_handler_is_connected(self->obj, handler_id)); +} + +static PyObject * +pygobject_handler_block(PyGObject *self, PyObject *args) +{ + gulong handler_id; + + if (!PyArg_ParseTuple(args, "k:GObject.handler_block", &handler_id)) + return NULL; + + CHECK_GOBJECT(self); + + g_signal_handler_block(self->obj, handler_id); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_handler_unblock(PyGObject *self, PyObject *args) +{ + gulong handler_id; + + if (!PyArg_ParseTuple(args, "k:GObject.handler_unblock", &handler_id)) + return NULL; + g_signal_handler_unblock(self->obj, handler_id); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_emit(PyGObject *self, PyObject *args) +{ + guint signal_id, i; + Py_ssize_t len; + GQuark detail; + PyObject *first, *py_ret; + gchar *name; + GSignalQuery query; + GValue *params, ret = { 0, }; + + len = PyTuple_Size(args); + if (len < 1) { + PyErr_SetString(PyExc_TypeError,"GObject.emit needs at least one arg"); + return NULL; + } + first = PySequence_GetSlice(args, 0, 1); + if (!PyArg_ParseTuple(first, "s:GObject.emit", &name)) { + Py_DECREF(first); + return NULL; + } + Py_DECREF(first); + + CHECK_GOBJECT(self); + + if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj), + &signal_id, &detail, TRUE)) { + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + name); + return NULL; + } + g_signal_query(signal_id, &query); + if (len != query.n_params + 1) { + gchar buf[128]; + + g_snprintf(buf, sizeof(buf), + "%d parameters needed for signal %s; %ld given", + query.n_params, name, (long int) (len - 1)); + PyErr_SetString(PyExc_TypeError, buf); + return NULL; + } + + params = g_new0(GValue, query.n_params + 1); + g_value_init(¶ms[0], G_OBJECT_TYPE(self->obj)); + g_value_set_object(¶ms[0], G_OBJECT(self->obj)); + + for (i = 0; i < query.n_params; i++) + g_value_init(¶ms[i + 1], + query.param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE); + for (i = 0; i < query.n_params; i++) { + PyObject *item = PyTuple_GetItem(args, i+1); + + if (pyg_value_from_pyobject(¶ms[i+1], item) < 0) { + gchar buf[128]; + g_snprintf(buf, sizeof(buf), + "could not convert type %s to %s required for parameter %d", + Py_TYPE(item)->tp_name, + g_type_name(G_VALUE_TYPE(¶ms[i+1])), i); + PyErr_SetString(PyExc_TypeError, buf); + + for (i = 0; i < query.n_params + 1; i++) + g_value_unset(¶ms[i]); + + g_free(params); + return NULL; + } + } + + if (query.return_type != G_TYPE_NONE) + g_value_init(&ret, query.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE); + + g_signal_emitv(params, signal_id, detail, &ret); + + 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) { + py_ret = pyg_value_as_pyobject(&ret, TRUE); + g_value_unset(&ret); + } else { + Py_INCREF(Py_None); + py_ret = Py_None; + } + + return py_ret; +} + +static PyObject * +pygobject_stop_emission(PyGObject *self, PyObject *args) +{ + gchar *signal; + guint signal_id; + GQuark detail; + + if (!PyArg_ParseTuple(args, "s:GObject.stop_emission", &signal)) + return NULL; + + CHECK_GOBJECT(self); + + if (!g_signal_parse_name(signal, G_OBJECT_TYPE(self->obj), + &signal_id, &detail, TRUE)) { + PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)self)), + signal); + return NULL; + } + g_signal_stop_emission(self->obj, signal_id, detail); + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +pygobject_chain_from_overridden(PyGObject *self, PyObject *args) +{ + GSignalInvocationHint *ihint; + guint signal_id, i; + Py_ssize_t len; + PyObject *py_ret; + const gchar *name; + GSignalQuery query; + GValue *params, ret = { 0, }; + + CHECK_GOBJECT(self); + + ihint = g_signal_get_invocation_hint(self->obj); + if (!ihint) { + PyErr_SetString(PyExc_TypeError, "could not find signal invocation " + "information for this object."); + return NULL; + } + + signal_id = ihint->signal_id; + name = g_signal_name(signal_id); + + len = PyTuple_Size(args); + if (signal_id == 0) { + PyErr_SetString(PyExc_TypeError, "unknown signal name"); + return NULL; + } + g_signal_query(signal_id, &query); + if (len != query.n_params) { + gchar buf[128]; + + g_snprintf(buf, sizeof(buf), + "%d parameters needed for signal %s; %ld given", + query.n_params, name, (long int) len); + PyErr_SetString(PyExc_TypeError, buf); + return NULL; + } + params = g_new0(GValue, query.n_params + 1); + g_value_init(¶ms[0], G_OBJECT_TYPE(self->obj)); + g_value_set_object(¶ms[0], G_OBJECT(self->obj)); + + for (i = 0; i < query.n_params; i++) + g_value_init(¶ms[i + 1], + query.param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE); + for (i = 0; i < query.n_params; i++) { + PyObject *item = PyTuple_GetItem(args, i); + + if (pyg_boxed_check(item, (query.param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE))) { + g_value_set_static_boxed(¶ms[i+1], pyg_boxed_get(item, void)); + } + else if (pyg_value_from_pyobject(¶ms[i+1], item) < 0) { + gchar buf[128]; + + g_snprintf(buf, sizeof(buf), + "could not convert type %s to %s required for parameter %d", + Py_TYPE(item)->tp_name, + g_type_name(G_VALUE_TYPE(¶ms[i+1])), i); + PyErr_SetString(PyExc_TypeError, buf); + for (i = 0; i < query.n_params + 1; i++) + g_value_unset(¶ms[i]); + g_free(params); + return NULL; + } + } + if (query.return_type != G_TYPE_NONE) + g_value_init(&ret, query.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE); + g_signal_chain_from_overridden(params, &ret); + for (i = 0; i < query.n_params + 1; i++) + g_value_unset(¶ms[i]); + g_free(params); + if (query.return_type != G_TYPE_NONE) { + py_ret = pyg_value_as_pyobject(&ret, TRUE); + g_value_unset(&ret); + } else { + Py_INCREF(Py_None); + py_ret = Py_None; + } + return py_ret; +} + + +static PyObject * +pygobject_weak_ref(PyGObject *self, PyObject *args) +{ + int len; + PyObject *callback = NULL, *user_data = NULL; + PyObject *retval; + + CHECK_GOBJECT(self); + + if ((len = PySequence_Length(args)) >= 1) { + callback = PySequence_ITEM(args, 0); + user_data = PySequence_GetSlice(args, 1, len); + } + retval = pygobject_weak_ref_new(self->obj, callback, user_data); + Py_XDECREF(callback); + Py_XDECREF(user_data); + return retval; +} + + +static PyObject * +pygobject_copy(PyGObject *self) +{ + PyErr_SetString(PyExc_TypeError, + "gobject.GObject descendants' instances are non-copyable"); + return NULL; +} + +static PyObject * +pygobject_deepcopy(PyGObject *self, PyObject *args) +{ + PyErr_SetString(PyExc_TypeError, + "gobject.GObject descendants' instances are non-copyable"); + return NULL; +} + + +static PyObject * +pygobject_disconnect_by_func(PyGObject *self, PyObject *args) +{ + PyObject *pyfunc = NULL; + GClosure *closure = NULL; + guint retval; + + CHECK_GOBJECT(self); + + if (!PyArg_ParseTuple(args, "O:GObject.disconnect_by_func", &pyfunc)) + return NULL; + + if (!PyCallable_Check(pyfunc)) { + PyErr_SetString(PyExc_TypeError, "first argument must be callable"); + return NULL; + } + + closure = gclosure_from_pyfunc(self, pyfunc); + if (!closure) { + PyErr_Format(PyExc_TypeError, "nothing connected to %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)pyfunc))); + return NULL; + } + + retval = g_signal_handlers_disconnect_matched(self->obj, + G_SIGNAL_MATCH_CLOSURE, + 0, 0, + closure, + NULL, NULL); + return _PyLong_FromLong(retval); +} + +static PyObject * +pygobject_handler_block_by_func(PyGObject *self, PyObject *args) +{ + PyObject *pyfunc = NULL; + GClosure *closure = NULL; + guint retval; + + CHECK_GOBJECT(self); + + if (!PyArg_ParseTuple(args, "O:GObject.handler_block_by_func", &pyfunc)) + return NULL; + + if (!PyCallable_Check(pyfunc)) { + PyErr_SetString(PyExc_TypeError, "first argument must be callable"); + return NULL; + } + + closure = gclosure_from_pyfunc(self, pyfunc); + if (!closure) { + PyErr_Format(PyExc_TypeError, "nothing connected to %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)pyfunc))); + return NULL; + } + + retval = g_signal_handlers_block_matched(self->obj, + G_SIGNAL_MATCH_CLOSURE, + 0, 0, + closure, + NULL, NULL); + return _PyLong_FromLong(retval); +} + +static PyObject * +pygobject_handler_unblock_by_func(PyGObject *self, PyObject *args) +{ + PyObject *pyfunc = NULL; + GClosure *closure = NULL; + guint retval; + + CHECK_GOBJECT(self); + + if (!PyArg_ParseTuple(args, "O:GObject.handler_unblock_by_func", &pyfunc)) + return NULL; + + if (!PyCallable_Check(pyfunc)) { + PyErr_SetString(PyExc_TypeError, "first argument must be callable"); + return NULL; + } + + closure = gclosure_from_pyfunc(self, pyfunc); + if (!closure) { + PyErr_Format(PyExc_TypeError, "nothing connected to %s", + _PyUnicode_AsString(PyObject_Repr((PyObject*)pyfunc))); + return NULL; + } + + retval = g_signal_handlers_unblock_matched(self->obj, + G_SIGNAL_MATCH_CLOSURE, + 0, 0, + closure, + NULL, NULL); + return _PyLong_FromLong(retval); +} + +static PyMethodDef pygobject_methods[] = { + { "__gobject_init__", (PyCFunction)pygobject__gobject_init__, + METH_VARARGS|METH_KEYWORDS }, + { "get_property", (PyCFunction)pygobject_get_property, METH_VARARGS }, + { "get_properties", (PyCFunction)pygobject_get_properties, METH_VARARGS }, + { "set_property", (PyCFunction)pygobject_set_property, METH_VARARGS }, + { "set_properties", (PyCFunction)pygobject_set_properties, METH_KEYWORDS }, + { "freeze_notify", (PyCFunction)pygobject_freeze_notify, METH_VARARGS }, + { "notify", (PyCFunction)pygobject_notify, METH_VARARGS }, + { "thaw_notify", (PyCFunction)pygobject_thaw_notify, METH_VARARGS }, + { "get_data", (PyCFunction)pygobject_get_data, METH_VARARGS }, + { "set_data", (PyCFunction)pygobject_set_data, METH_VARARGS }, + { "connect", (PyCFunction)pygobject_connect, METH_VARARGS }, + { "connect_after", (PyCFunction)pygobject_connect_after, METH_VARARGS }, + { "connect_object", (PyCFunction)pygobject_connect_object, METH_VARARGS }, + { "connect_object_after", (PyCFunction)pygobject_connect_object_after, METH_VARARGS }, + { "disconnect", (PyCFunction)pygobject_disconnect, METH_VARARGS }, + { "disconnect_by_func", (PyCFunction)pygobject_disconnect_by_func, METH_VARARGS }, + { "handler_disconnect", (PyCFunction)pygobject_disconnect, METH_VARARGS }, + { "handler_is_connected", (PyCFunction)pygobject_handler_is_connected, METH_VARARGS }, + { "handler_block", (PyCFunction)pygobject_handler_block, METH_VARARGS }, + { "handler_unblock", (PyCFunction)pygobject_handler_unblock,METH_VARARGS }, + { "handler_block_by_func", (PyCFunction)pygobject_handler_block_by_func, METH_VARARGS }, + { "handler_unblock_by_func", (PyCFunction)pygobject_handler_unblock_by_func, METH_VARARGS }, + { "emit", (PyCFunction)pygobject_emit, METH_VARARGS }, + { "stop_emission", (PyCFunction)pygobject_stop_emission, METH_VARARGS }, + { "emit_stop_by_name", (PyCFunction)pygobject_stop_emission,METH_VARARGS }, + { "chain", (PyCFunction)pygobject_chain_from_overridden,METH_VARARGS }, + { "weak_ref", (PyCFunction)pygobject_weak_ref, METH_VARARGS }, + { "__copy__", (PyCFunction)pygobject_copy, METH_NOARGS }, + { "__deepcopy__", (PyCFunction)pygobject_deepcopy, METH_VARARGS }, + { NULL, NULL, 0 } +}; + + +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); + } + Py_INCREF(self->inst_dict); + return self->inst_dict; +} + +static PyObject * +pygobject_get_refcount(PyGObject *self, void *closure) +{ + return _PyLong_FromLong(self->obj->ref_count); +} + +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); + } + return res; +} + +static PyGetSetDef pygobject_getsets[] = { + { "__dict__", (getter)pygobject_get_dict, (setter)0 }, + { "__grefcount__", (getter)pygobject_get_refcount, (setter)0, }, + { NULL, 0, 0 } +}; + +/* ------------------------------------ */ +/* ****** GObject weak reference ****** */ +/* ------------------------------------ */ + +typedef struct { + PyObject_HEAD + GObject *obj; + PyObject *callback; + PyObject *user_data; + gboolean have_floating_ref; +} PyGObjectWeakRef; + +PYGLIB_DEFINE_TYPE("gobject.GObjectWeakRef", PyGObjectWeakRef_Type, PyGObjectWeakRef); + +static int +pygobject_weak_ref_traverse(PyGObjectWeakRef *self, visitproc visit, void *arg) +{ + if (self->callback && visit(self->callback, arg) < 0) + return -1; + if (self->user_data && visit(self->user_data, arg) < 0) + return -1; + return 0; +} + +static void +pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy) +{ + self->obj = NULL; + if (self->callback) { + PyObject *retval; + PyGILState_STATE state = pyglib_gil_state_ensure(); + retval = PyObject_Call(self->callback, self->user_data, NULL); + if (retval) { + if (retval != Py_None) + PyErr_Format(PyExc_TypeError, + "GObject weak notify callback returned a value" + " of type %s, should return None", + Py_TYPE(retval)->tp_name); + Py_DECREF(retval); + PyErr_Print(); + } else + PyErr_Print(); + Py_CLEAR(self->callback); + Py_CLEAR(self->user_data); + if (self->have_floating_ref) { + self->have_floating_ref = FALSE; + Py_DECREF((PyObject *) self); + } + pyglib_gil_state_release(state); + } +} + +static inline int +pygobject_weak_ref_clear(PyGObjectWeakRef *self) +{ + Py_CLEAR(self->callback); + Py_CLEAR(self->user_data); + if (self->obj) { + g_object_weak_unref(self->obj, (GWeakNotify) pygobject_weak_ref_notify, self); + self->obj = NULL; + } + return 0; +} + +static void +pygobject_weak_ref_dealloc(PyGObjectWeakRef *self) +{ + PyObject_GC_UnTrack((PyObject *)self); + pygobject_weak_ref_clear(self); + PyObject_GC_Del(self); +} + +static PyObject * +pygobject_weak_ref_new(GObject *obj, PyObject *callback, PyObject *user_data) +{ + PyGObjectWeakRef *self; + + self = PyObject_GC_New(PyGObjectWeakRef, &PyGObjectWeakRef_Type); + self->callback = callback; + self->user_data = user_data; + Py_XINCREF(self->callback); + Py_XINCREF(self->user_data); + self->obj = obj; + g_object_weak_ref(self->obj, (GWeakNotify) pygobject_weak_ref_notify, self); + if (callback != NULL) { + /* when we have a callback, we should INCREF the weakref + * object to make it stay alive even if it goes out of scope */ + self->have_floating_ref = TRUE; + Py_INCREF((PyObject *) self); + } + return (PyObject *) self; +} + +static PyObject * +pygobject_weak_ref_unref(PyGObjectWeakRef *self, PyObject *args) +{ + if (!self->obj) { + PyErr_SetString(PyExc_ValueError, "weak ref already unreffed"); + return NULL; + } + g_object_weak_unref(self->obj, (GWeakNotify) pygobject_weak_ref_notify, self); + self->obj = NULL; + if (self->have_floating_ref) { + self->have_floating_ref = FALSE; + Py_DECREF(self); + } + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef pygobject_weak_ref_methods[] = { + { "unref", (PyCFunction)pygobject_weak_ref_unref, METH_NOARGS}, + { NULL, NULL, 0} +}; + +static PyObject * +pygobject_weak_ref_call(PyGObjectWeakRef *self, PyObject *args, PyObject *kw) +{ + static char *argnames[] = {NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kw, ":__call__", argnames)) + return NULL; + + if (self->obj) + return pygobject_new_full(self->obj, FALSE, NULL); + else { + Py_INCREF(Py_None); + return Py_None; + } +} + +static gpointer +pyobject_copy(gpointer boxed) +{ + PyObject *object = boxed; + + Py_INCREF(object); + return object; +} + +static void +pyobject_free(gpointer boxed) +{ + PyObject *object = boxed; + PyGILState_STATE state; + + state = pyglib_gil_state_ensure(); + Py_DECREF(object); + pyglib_gil_state_release(state); +} + +void +pygobject_object_register_types(PyObject *d) +{ + PyObject *o, *descr; + + pygobject_class_key = g_quark_from_static_string("PyGObject::class"); + pygobject_class_init_key = g_quark_from_static_string("PyGObject::class-init"); + pygobject_wrapper_key = g_quark_from_static_string("PyGObject::wrapper"); + pygobject_has_updated_constructor_key = + g_quark_from_static_string("PyGObject::has-updated-constructor"); + pygobject_instance_data_key = g_quark_from_static_string("PyGObject::instance-data"); + + /* GObject */ + if (!PY_TYPE_OBJECT) + PY_TYPE_OBJECT = g_boxed_type_register_static("PyObject", + pyobject_copy, + pyobject_free); + PyGObject_Type.tp_dealloc = (destructor)pygobject_dealloc; + PyGObject_Type.tp_compare = (cmpfunc)pygobject_compare; + PyGObject_Type.tp_repr = (reprfunc)pygobject_repr; + PyGObject_Type.tp_hash = (hashfunc)pygobject_hash; + PyGObject_Type.tp_setattro = (setattrofunc)pygobject_setattro; + PyGObject_Type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | + Py_TPFLAGS_HAVE_GC); + PyGObject_Type.tp_traverse = (traverseproc)pygobject_traverse; + PyGObject_Type.tp_clear = (inquiry)pygobject_clear; + PyGObject_Type.tp_weaklistoffset = offsetof(PyGObject, weakreflist); + PyGObject_Type.tp_methods = pygobject_methods; + PyGObject_Type.tp_getset = pygobject_getsets; + PyGObject_Type.tp_dictoffset = offsetof(PyGObject, inst_dict); + PyGObject_Type.tp_init = (initproc)pygobject_init; + PyGObject_Type.tp_free = (freefunc)pygobject_free; + PyGObject_Type.tp_alloc = PyType_GenericAlloc; + PyGObject_Type.tp_new = PyType_GenericNew; + pygobject_register_class(d, "GObject", G_TYPE_OBJECT, + &PyGObject_Type, NULL); + PyDict_SetItemString(PyGObject_Type.tp_dict, "__gdoc__", + pyg_object_descr_doc_get()); + pyg_set_object_has_new_constructor(G_TYPE_OBJECT); + + /* GProps */ + PyGProps_Type.tp_dealloc = (destructor)PyGProps_dealloc; + PyGProps_Type.tp_as_sequence = (PySequenceMethods*)&_PyGProps_as_sequence; + PyGProps_Type.tp_getattro = (getattrofunc)PyGProps_getattro; + PyGProps_Type.tp_setattro = (setattrofunc)PyGProps_setattro; + PyGProps_Type.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC; + PyGProps_Type.tp_doc = "The properties of the GObject accessible as " + "Python attributes."; + PyGProps_Type.tp_traverse = (traverseproc)pygobject_props_traverse; + PyGProps_Type.tp_iter = (getiterfunc)pygobject_props_get_iter; + if (PyType_Ready(&PyGProps_Type) < 0) + return; + + /* 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; + descr = PyObject_New(PyObject, &PyGPropsDescr_Type); + PyDict_SetItemString(PyGObject_Type.tp_dict, "props", descr); + PyDict_SetItemString(PyGObject_Type.tp_dict, "__module__", + o=_PyUnicode_FromString("gobject._gobject")); + Py_DECREF(o); + + /* GPropsIter */ + PyGPropsIter_Type.tp_dealloc = (destructor)pyg_props_iter_dealloc; + PyGPropsIter_Type.tp_flags = Py_TPFLAGS_DEFAULT; + PyGPropsIter_Type.tp_doc = "GObject properties iterator"; + PyGPropsIter_Type.tp_iternext = (iternextfunc)pygobject_props_iter_next; + if (PyType_Ready(&PyGPropsIter_Type) < 0) + return; + + PyGObjectWeakRef_Type.tp_dealloc = (destructor)pygobject_weak_ref_dealloc; + PyGObjectWeakRef_Type.tp_call = (ternaryfunc)pygobject_weak_ref_call; + PyGObjectWeakRef_Type.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC; + PyGObjectWeakRef_Type.tp_doc = "A GObject weak reference"; + PyGObjectWeakRef_Type.tp_traverse = (traverseproc)pygobject_weak_ref_traverse; + PyGObjectWeakRef_Type.tp_clear = (inquiry)pygobject_weak_ref_clear; + PyGObjectWeakRef_Type.tp_methods = pygobject_weak_ref_methods; + if (PyType_Ready(&PyGObjectWeakRef_Type) < 0) + return; + PyDict_SetItemString(d, "GObjectWeakRef", (PyObject *) &PyGObjectWeakRef_Type); +} diff --git a/gobject/pygobject.h b/gobject/pygobject.h new file mode 100644 index 0000000..85d8bca --- /dev/null +++ b/gobject/pygobject.h @@ -0,0 +1,636 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- */ +#ifndef _PYGOBJECT_H_ +#define _PYGOBJECT_H_ + +#include + +#include +#include + +G_BEGIN_DECLS + +/* This is deprecated, don't use */ +#define PYGIL_API_IS_BUGGY FALSE + + /* PyGClosure is a _private_ structure */ +typedef void (* PyClosureExceptionHandler) (GValue *ret, guint n_param_values, const GValue *params); +typedef struct _PyGClosure PyGClosure; +typedef struct _PyGObjectData PyGObjectData; + +struct _PyGClosure { + GClosure closure; + PyObject *callback; + PyObject *extra_args; /* tuple of extra args to pass to callback */ + PyObject *swap_data; /* other object for gtk_signal_connect__object */ + PyClosureExceptionHandler exception_handler; +}; + +typedef enum { + PYGOBJECT_USING_TOGGLE_REF = 1 << 0 +} PyGObjectFlags; + + /* closures is just an alias for what is found in the + * PyGObjectData */ +typedef struct { + PyObject_HEAD + GObject *obj; + PyObject *inst_dict; /* the instance dictionary -- must be last */ + PyObject *weakreflist; /* list of weak references */ + + /*< private >*/ + /* using union to preserve ABI compatibility (structure size + * must not change) */ + union { + GSList *closures; /* stale field; no longer updated DO-NOT-USE! */ + PyGObjectFlags flags; + } private_flags; + +} PyGObject; + +#define pygobject_get(v) (((PyGObject *)(v))->obj) +#define pygobject_check(v,base) (PyObject_TypeCheck(v,base)) + +typedef struct { + PyObject_HEAD + gpointer boxed; + GType gtype; + gboolean free_on_dealloc; +} PyGBoxed; + +#define pyg_boxed_get(v,t) ((t *)((PyGBoxed *)(v))->boxed) +#define pyg_boxed_check(v,typecode) (PyObject_TypeCheck(v, &PyGBoxed_Type) && ((PyGBoxed *)(v))->gtype == typecode) + +typedef struct { + PyObject_HEAD + gpointer pointer; + GType gtype; +} PyGPointer; + +#define pyg_pointer_get(v,t) ((t *)((PyGPointer *)(v))->pointer) +#define pyg_pointer_check(v,typecode) (PyObject_TypeCheck(v, &PyGPointer_Type) && ((PyGPointer *)(v))->gtype == typecode) + +typedef void (*PyGFatalExceptionFunc) (void); +typedef void (*PyGThreadBlockFunc) (void); + +typedef struct { + PyObject_HEAD + GParamSpec *pspec; +} PyGParamSpec; + +#define PyGParamSpec_Get(v) (((PyGParamSpec *)v)->pspec) +#define PyGParamSpec_Check(v) (PyObject_TypeCheck(v, &PyGParamSpec_Type)) + +typedef int (*PyGClassInitFunc) (gpointer gclass, PyTypeObject *pyclass); +typedef PyTypeObject * (*PyGTypeRegistrationFunction) (const gchar *name, + gpointer data); + +struct _PyGObject_Functions { + /* + * All field names in here are considered private, + * use the macros below instead, which provides stability + */ + void (* register_class)(PyObject *dict, const gchar *class_name, + GType gtype, PyTypeObject *type, PyObject *bases); + void (* register_wrapper)(PyObject *self); + void (* register_sinkfunc)(GType type, + void (* sinkfunc)(GObject *object)); + PyTypeObject *(* lookup_class)(GType type); + PyObject *(* newgobj)(GObject *obj); + + GClosure *(* closure_new)(PyObject *callback, PyObject *extra_args, + PyObject *swap_data); + void (* object_watch_closure)(PyObject *self, GClosure *closure); + GDestroyNotify destroy_notify; + + GType (* type_from_object)(PyObject *obj); + PyObject *(* type_wrapper_new)(GType type); + + gint (* enum_get_value)(GType enum_type, PyObject *obj, gint *val); + gint (* flags_get_value)(GType flag_type, PyObject *obj, gint *val); + void (* register_gtype_custom)(GType gtype, + PyObject *(* from_func)(const GValue *value), + int (* to_func)(GValue *value, PyObject *obj)); + int (* value_from_pyobject)(GValue *value, PyObject *obj); + PyObject *(* value_as_pyobject)(const GValue *value, gboolean copy_boxed); + + void (* register_interface)(PyObject *dict, const gchar *class_name, + GType gtype, PyTypeObject *type); + + PyTypeObject *boxed_type; + void (* register_boxed)(PyObject *dict, const gchar *class_name, + GType boxed_type, PyTypeObject *type); + PyObject *(* boxed_new)(GType boxed_type, gpointer boxed, + gboolean copy_boxed, gboolean own_ref); + + PyTypeObject *pointer_type; + void (* register_pointer)(PyObject *dict, const gchar *class_name, + GType pointer_type, PyTypeObject *type); + PyObject *(* pointer_new)(GType boxed_type, gpointer pointer); + + void (* enum_add_constants)(PyObject *module, GType enum_type, + const gchar *strip_prefix); + void (* flags_add_constants)(PyObject *module, GType flags_type, + const gchar *strip_prefix); + + const gchar *(* constant_strip_prefix)(const gchar *name, + const gchar *strip_prefix); + + gboolean (* error_check)(GError **error); + + /* hooks to register handlers for getting GDK threads to cooperate + * with python threading */ + void (* set_thread_block_funcs) (PyGThreadBlockFunc block_threads_func, + PyGThreadBlockFunc unblock_threads_func); + PyGThreadBlockFunc block_threads; + PyGThreadBlockFunc unblock_threads; + PyTypeObject *paramspec_type; + PyObject *(* paramspec_new)(GParamSpec *spec); + GParamSpec *(*paramspec_get)(PyObject *tuple); + int (*pyobj_to_unichar_conv)(PyObject *pyobj, void* ptr); + gboolean (*parse_constructor_args)(GType obj_type, + char **arg_names, + char **prop_names, + GParameter *params, + guint *nparams, + PyObject **py_args); + PyObject *(* param_gvalue_as_pyobject) (const GValue* gvalue, + gboolean copy_boxed, + const GParamSpec* pspec); + int (* gvalue_from_param_pyobject) (GValue* value, + PyObject* py_obj, + const GParamSpec* pspec); + PyTypeObject *enum_type; + PyObject *(*enum_add)(PyObject *module, + const char *type_name_, + const char *strip_prefix, + GType gtype); + PyObject* (*enum_from_gtype)(GType gtype, int value); + + PyTypeObject *flags_type; + PyObject *(*flags_add)(PyObject *module, + const char *type_name_, + const char *strip_prefix, + GType gtype); + PyObject* (*flags_from_gtype)(GType gtype, int value); + + gboolean threads_enabled; + int (*enable_threads) (void); + + int (*gil_state_ensure) (void); + void (*gil_state_release) (int flag); + + void (*register_class_init) (GType gtype, PyGClassInitFunc class_init); + void (*register_interface_info) (GType gtype, const GInterfaceInfo *info); + void (*closure_set_exception_handler) (GClosure *closure, PyClosureExceptionHandler handler); + int (*pygobject_constructv) (PyGObject *self, + guint n_parameters, + GParameter *parameters); + int (*pygobject_construct) (PyGObject *self, + const char *first_property_name, + ...); + void (*set_object_has_new_constructor) (GType type); + + void (*add_warning_redirection) (const char *domain, + PyObject *warning); + void (*disable_warning_redirections) (void); + void (*type_register_custom)(const gchar *type_name, + PyGTypeRegistrationFunction callback, + gpointer data); + gboolean (*gerror_exception_check) (GError **error); + PyObject* (*option_group_new) (GOptionGroup *group); +}; + +#ifndef _INSIDE_PYGOBJECT_ + +#if defined(NO_IMPORT) || defined(NO_IMPORT_PYGOBJECT) +extern struct _PyGObject_Functions *_PyGObject_API; +#else +struct _PyGObject_Functions *_PyGObject_API; +#endif + +#define pygobject_register_class (_PyGObject_API->register_class) +#define pygobject_register_wrapper (_PyGObject_API->register_wrapper) +/* This is deprecated, sinkfuncs are not needed anymore */ +#define pygobject_register_sinkfunc (_PyGObject_API->register_sinkfunc) +#define pygobject_lookup_class (_PyGObject_API->lookup_class) +#define pygobject_new (_PyGObject_API->newgobj) +#define pyg_closure_new (_PyGObject_API->closure_new) +#define pygobject_watch_closure (_PyGObject_API->object_watch_closure) +#define pyg_closure_set_exception_handler (_PyGObject_API->closure_set_exception_handler) +#define pyg_destroy_notify (_PyGObject_API->destroy_notify) +#define pyg_type_from_object (_PyGObject_API->type_from_object) +#define pyg_type_wrapper_new (_PyGObject_API->type_wrapper_new) +#define pyg_enum_get_value (_PyGObject_API->enum_get_value) +#define pyg_flags_get_value (_PyGObject_API->flags_get_value) +/* This is deprecated, call pyg_register_gtype_custom directly instead */ +#define pyg_register_boxed_custom pyg_register_gtype_custom +#define pyg_register_gtype_custom (_PyGObject_API->register_gtype_custom) +#define pyg_value_from_pyobject (_PyGObject_API->value_from_pyobject) +#define pyg_value_as_pyobject (_PyGObject_API->value_as_pyobject) +#define pyg_register_interface (_PyGObject_API->register_interface) +#define PyGBoxed_Type (*_PyGObject_API->boxed_type) +#define pyg_register_boxed (_PyGObject_API->register_boxed) +#define pyg_boxed_new (_PyGObject_API->boxed_new) +#define PyGPointer_Type (*_PyGObject_API->pointer_type) +#define pyg_register_pointer (_PyGObject_API->register_pointer) +#define pyg_pointer_new (_PyGObject_API->pointer_new) +#define pyg_enum_add_constants (_PyGObject_API->enum_add_constants) +#define pyg_flags_add_constants (_PyGObject_API->flags_add_constants) +#define pyg_constant_strip_prefix (_PyGObject_API->constant_strip_prefix) +#define pyg_error_check (_PyGObject_API->error_check) +#define pyg_set_thread_block_funcs (_PyGObject_API->set_thread_block_funcs) +#define PyGParamSpec_Type (*_PyGObject_API->paramspec_type) +#define pyg_param_spec_new (_PyGObject_API->paramspec_new) +#define pyg_param_spec_from_object (_PyGObject_API->paramspec_get) +#define pyg_pyobj_to_unichar_conv (_PyGObject_API->pyobj_to_unichar_conv) +#define pyg_parse_constructor_args (_PyGObject_API->parse_constructor_args) +#define pyg_param_gvalue_as_pyobject (_PyGObject_API->value_as_pyobject) +#define pyg_param_gvalue_from_pyobject (_PyGObject_API->gvalue_from_param_pyobject) +#define PyGEnum_Type (*_PyGObject_API->enum_type) +#define pyg_enum_add (_PyGObject_API->enum_add) +#define pyg_enum_from_gtype (_PyGObject_API->enum_from_gtype) +#define PyGFlags_Type (*_PyGObject_API->flags_type) +#define pyg_flags_add (_PyGObject_API->flags_add) +#define pyg_flags_from_gtype (_PyGObject_API->flags_from_gtype) +#define pyg_enable_threads (_PyGObject_API->enable_threads) +#define pyg_gil_state_ensure (_PyGObject_API->gil_state_ensure) +#define pyg_gil_state_release (_PyGObject_API->gil_state_release) +#define pyg_register_class_init (_PyGObject_API->register_class_init) +#define pyg_register_interface_info (_PyGObject_API->register_interface_info) +#define pygobject_construct (_PyGObject_API->pygobject_construct) +#define pygobject_constructv (_PyGObject_API->pygobject_constructv) +#define pyg_set_object_has_new_constructor (_PyGObject_API->set_object_has_new_constructor) +#define pyg_add_warning_redirection (_PyGObject_API->add_warning_redirection) +#define pyg_disable_warning_redirections (_PyGObject_API->disable_warning_redirections) +#define pyg_type_register_custom_callback (_PyGObject_API->type_register_custom) +#define pyg_gerror_exception_check (_PyGObject_API->gerror_exception_check) +#define pyg_option_group_new (_PyGObject_API->option_group_new) + +#define pyg_block_threads() G_STMT_START { \ + if (_PyGObject_API->block_threads != NULL) \ + (* _PyGObject_API->block_threads)(); \ + } G_STMT_END +#define pyg_unblock_threads() G_STMT_START { \ + if (_PyGObject_API->unblock_threads != NULL) \ + (* _PyGObject_API->unblock_threads)(); \ + } G_STMT_END + +#define pyg_threads_enabled (_PyGObject_API->threads_enabled) + +#define pyg_begin_allow_threads \ + G_STMT_START { \ + PyThreadState *_save = NULL; \ + if (_PyGObject_API->threads_enabled) \ + _save = PyEval_SaveThread(); +#define pyg_end_allow_threads \ + if (_PyGObject_API->threads_enabled) \ + PyEval_RestoreThread(_save); \ + } G_STMT_END + + +/** + * pygobject_init: + * @req_major: minimum version major number, or -1 + * @req_minor: minimum version minor number, or -1 + * @req_micro: minimum version micro number, or -1 + * + * Imports and initializes the 'gobject' python module. Can + * optionally check for a required minimum version if @req_major, + * @req_minor, and @req_micro are all different from -1. + * + * Returns: a new reference to the gobject module on success, NULL in + * case of failure (and raises ImportError). + **/ +static inline PyObject * +pygobject_init(int req_major, int req_minor, int req_micro) +{ + PyObject *gobject, *cobject; + + gobject = PyImport_ImportModule("gobject"); + if (!gobject) { + 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 gobject (error was: %s)", + PyString_AsString(py_orig_exc)); + Py_DECREF(py_orig_exc); + } else { + PyErr_SetString(PyExc_ImportError, + "could not import gobject (no error given)"); + } + return NULL; + } + + cobject = PyObject_GetAttrString(gobject, "_PyGObject_API"); + if (cobject && PyCObject_Check(cobject)) + _PyGObject_API = (struct _PyGObject_Functions *) PyCObject_AsVoidPtr(cobject); + else { + PyErr_SetString(PyExc_ImportError, + "could not import gobject (could not find _PyGObject_API object)"); + Py_DECREF(gobject); + return NULL; + } + + if (req_major != -1) + { + int found_major, found_minor, found_micro; + PyObject *version; + + version = PyObject_GetAttrString(gobject, "pygobject_version"); + if (!version) + version = PyObject_GetAttrString(gobject, "pygtk_version"); + if (!version) { + PyErr_SetString(PyExc_ImportError, + "could not import gobject (version too old)"); + Py_DECREF(gobject); + return NULL; + } + if (!PyArg_ParseTuple(version, "iii", + &found_major, &found_minor, &found_micro)) { + PyErr_SetString(PyExc_ImportError, + "could not import gobject (version has invalid format)"); + Py_DECREF(version); + Py_DECREF(gobject); + return NULL; + } + Py_DECREF(version); + if (req_major != found_major || + req_minor > found_minor || + (req_minor == found_minor && req_micro > found_micro)) { + PyErr_Format(PyExc_ImportError, + "could not import gobject (version mismatch, %d.%d.%d is required, " + "found %d.%d.%d)", req_major, req_minor, req_micro, + found_major, found_minor, found_micro); + Py_DECREF(gobject); + return NULL; + } + } + return gobject; +} + +/* deprecated macro, use pygobject_init() instead. */ +#define init_pygobject() G_STMT_START { \ + if (!pygobject_init(-1, -1, -1)) \ + return; \ +} G_STMT_END + +/* deprecated macro, use pygobject_init() instead. */ +#define init_pygobject_check(req_major, req_minor, req_micro) G_STMT_START { \ + if (!pygobject_init(req_major, req_minor, req_micro)) \ + return; \ +} G_STMT_END + +/** + * PYLIST_FROMGLIBLIST: + * @type: the type of the GLib list e.g. #GList or #GSList + * @prefix: the prefix of functions that manipulate a list of the type + * given by type. + * + * A macro that creates a type specific code block which converts a GLib + * list (#GSList or #GList) to a Python list. The first two args of the macro + * are used to specify the type and list function prefix so that the type + * specific macros can be generated. + * + * The rest of the args are for the standard args for the type specific + * macro(s) created from this macro. + */ + #define PYLIST_FROMGLIBLIST(type,prefix,py_list,list,item_convert_func,\ + list_free,list_item_free) \ +G_STMT_START \ +{ \ + gint i, len; \ + PyObject *item; \ + void (*glib_list_free)(type*) = list_free; \ + GFunc glib_list_item_free = (GFunc)list_item_free; \ + \ + len = prefix##_length(list); \ + py_list = PyList_New(len); \ + for (i = 0; i < len; i++) { \ + gpointer list_item = prefix##_nth_data(list, i); \ + \ + item = item_convert_func; \ + PyList_SetItem(py_list, i, item); \ + } \ + if (glib_list_item_free != NULL) \ + prefix##_foreach(list, glib_list_item_free, NULL); \ + if (glib_list_free != NULL) \ + glib_list_free(list); \ +} G_STMT_END + +/** + * PYLIST_FROMGLIST: + * @py_list: the name of the Python list + * + * @list: the #GList to be converted to a Python list + * + * @item_convert_func: the function that converts a list item to a Python + * object. The function must refer to the list item using "@list_item" and + * must return a #PyObject* object. An example conversion function is: + * [[ + * PyString_FromString(list_item) + * ]] + * A more elaborate function is: + * [[ + * pyg_boxed_new(GTK_TYPE_RECENT_INFO, list_item, TRUE, TRUE) + * ]] + * @list_free: the name of a function that takes a single arg (the list) and + * frees its memory. Can be NULL if the list should not be freed. An example + * is: + * [[ + * g_list_free + * ]] + * @list_item_free: the name of a #GFunc function that frees the memory used + * by the items in the list or %NULL if the list items do not have to be + * freed. A simple example is: + * [[ + * g_free + * ]] + * + * A macro that adds code that converts a #GList to a Python list. + * + */ +#define PYLIST_FROMGLIST(py_list,list,item_convert_func,list_free,\ + list_item_free) \ + PYLIST_FROMGLIBLIST(GList,g_list,py_list,list,item_convert_func,\ + list_free,list_item_free) + +/** + * PYLIST_FROMGSLIST: + * @py_list: the name of the Python list + * + * @list: the #GSList to be converted to a Python list + * + * @item_convert_func: the function that converts a list item to a Python + * object. The function must refer to the list item using "@list_item" and + * must return a #PyObject* object. An example conversion function is: + * [[ + * PyString_FromString(list_item) + * ]] + * A more elaborate function is: + * [[ + * pyg_boxed_new(GTK_TYPE_RECENT_INFO, list_item, TRUE, TRUE) + * ]] + * @list_free: the name of a function that takes a single arg (the list) and + * frees its memory. Can be %NULL if the list should not be freed. An example + * is: + * [[ + * g_list_free + * ]] + * @list_item_free: the name of a #GFunc function that frees the memory used + * by the items in the list or %NULL if the list items do not have to be + * freed. A simple example is: + * [[ + * g_free + * ]] + * + * A macro that adds code that converts a #GSList to a Python list. + * + */ +#define PYLIST_FROMGSLIST(py_list,list,item_convert_func,list_free,\ + list_item_free) \ + PYLIST_FROMGLIBLIST(GSList,g_slist,py_list,list,item_convert_func,\ + list_free,list_item_free) + +/** + * PYLIST_ASGLIBLIST + * @type: the type of the GLib list e.g. GList or GSList + * @prefix: the prefix of functions that manipulate a list of the type + * given by type e.g. g_list or g_slist + * + * A macro that creates a type specific code block to be used to convert a + * Python list to a GLib list (GList or GSList). The first two args of the + * macro are used to specify the type and list function prefix so that the + * type specific macros can be generated. + * + * The rest of the args are for the standard args for the type specific + * macro(s) created from this macro. + */ +#define PYLIST_ASGLIBLIST(type,prefix,py_list,list,check_func,\ + convert_func,child_free_func,errormsg,errorreturn) \ +G_STMT_START \ +{ \ + Py_ssize_t i, n_list; \ + GFunc glib_child_free_func = (GFunc)child_free_func; \ + \ + if (!(py_list = PySequence_Fast(py_list, ""))) { \ + errormsg; \ + return errorreturn; \ + } \ + n_list = PySequence_Fast_GET_SIZE(py_list); \ + for (i = 0; i < n_list; i++) { \ + PyObject *py_item = PySequence_Fast_GET_ITEM(py_list, i); \ + \ + if (!check_func) { \ + if (glib_child_free_func) \ + prefix##_foreach(list, glib_child_free_func, NULL); \ + prefix##_free(list); \ + Py_DECREF(py_list); \ + errormsg; \ + return errorreturn; \ + } \ + list = prefix##_prepend(list, convert_func); \ + }; \ + Py_DECREF(py_list); \ + list = prefix##_reverse(list); \ +} \ +G_STMT_END +/** + * PYLIST_ASGLIST + * @py_list: the Python list to be converted + * @list: the #GList list to be converted + * @check_func: the expression that takes a #PyObject* arg (must be named + * @py_item) and returns an int value indicating if the Python object matches + * the required list item type (0 - %False or 1 - %True). An example is: + * [[ + * (PyString_Check(py_item)||PyUnicode_Check(py_item)) + * ]] + * @convert_func: the function that takes a #PyObject* arg (must be named + * py_item) and returns a pointer to the converted list object. An example + * is: + * [[ + * pygobject_get(py_item) + * ]] + * @child_free_func: the name of a #GFunc function that frees a GLib list + * item or %NULL if the list item does not have to be freed. This function is + * used to help free the items in a partially created list if there is an + * error. An example is: + * [[ + * g_free + * ]] + * @errormsg: a function that sets up a Python error message. An example is: + * [[ + * PyErr_SetString(PyExc_TypeError, "strings must be a sequence of" "strings + * or unicode objects") + * ]] + * @errorreturn: the value to return if an error occurs, e.g.: + * [[ + * %NULL + * ]] + * + * A macro that creates code that converts a Python list to a #GList. The + * returned list must be freed using the appropriate list free function when + * it's no longer needed. If an error occurs the child_free_func is used to + * release the memory used by the list items and then the list memory is + * freed. + */ +#define PYLIST_ASGLIST(py_list,list,check_func,convert_func,child_free_func,\ + errormsg,errorreturn) \ + PYLIST_ASGLIBLIST(GList,g_list,py_list,list,check_func,convert_func,\ + child_free_func,errormsg,errorreturn) + +/** + * PYLIST_ASGSLIST + * @py_list: the Python list to be converted + * @list: the #GSList list to be converted + * @check_func: the expression that takes a #PyObject* arg (must be named + * @py_item) and returns an int value indicating if the Python object matches + * the required list item type (0 - %False or 1 - %True). An example is: + * [[ + * (PyString_Check(py_item)||PyUnicode_Check(py_item)) + * ]] + * @convert_func: the function that takes a #PyObject* arg (must be named + * py_item) and returns a pointer to the converted list object. An example + * is: + * [[ + * pygobject_get(py_item) + * ]] + * @child_free_func: the name of a #GFunc function that frees a GLib list + * item or %NULL if the list item does not have to be freed. This function is + * used to help free the items in a partially created list if there is an + * error. An example is: + * [[ + * g_free + * ]] + * @errormsg: a function that sets up a Python error message. An example is: + * [[ + * PyErr_SetString(PyExc_TypeError, "strings must be a sequence of" "strings + * or unicode objects") + * ]] + * @errorreturn: the value to return if an error occurs, e.g.: + * [[ + * %NULL + * ]] + * + * A macro that creates code that converts a Python list to a #GSList. The + * returned list must be freed using the appropriate list free function when + * it's no longer needed. If an error occurs the child_free_func is used to + * release the memory used by the list items and then the list memory is + * freed. + */ +#define PYLIST_ASGSLIST(py_list,list,check_func,convert_func,child_free_func,\ + errormsg,errorreturn) \ + PYLIST_ASGLIBLIST(GSList,g_slist,py_list,list,check_func,convert_func,\ + child_free_func,errormsg,errorreturn) + +#endif /* !_INSIDE_PYGOBJECT_ */ + +G_END_DECLS + +#endif /* !_PYGOBJECT_H_ */ diff --git a/gobject/pygparamspec.c b/gobject/pygparamspec.c new file mode 100644 index 0000000..be3840b --- /dev/null +++ b/gobject/pygparamspec.c @@ -0,0 +1,397 @@ +/* -*- 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 int +pyg_param_spec_compare(PyGParamSpec *self, PyGParamSpec *v) +{ + if (self->pspec == v->pspec) return 0; + if (self->pspec > v->pspec) return -1; + return 1; +} + +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 _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 _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 _PyUnicode_FromFormat( + "%c", G_PARAM_SPEC_CHAR(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return _PyLong_FromLong(G_PARAM_SPEC_CHAR(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return _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 _PyUnicode_FromFormat( + "%c", G_PARAM_SPEC_UCHAR(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return _PyLong_FromLong(G_PARAM_SPEC_UCHAR(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return _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 _PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->default_value); + } else if (!strcmp(attr, "minimum")) { + return _PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->minimum); + } else if (!strcmp(attr, "maximum")) { + return _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 _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_firth", "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_compare = (cmpfunc)pyg_param_spec_compare; + 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/gobject/pygparamspec.h b/gobject/pygparamspec.h new file mode 100644 index 0000000..64aab0c --- /dev/null +++ b/gobject/pygparamspec.h @@ -0,0 +1,31 @@ +/* -*- 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_PARAMSPEC_H__ +#define __PYGOBJECT_PARAMSPEC_H__ + +extern PyTypeObject PyGParamSpec_Type; +PyObject * pyg_param_spec_new (GParamSpec *pspec); + +void pygobject_paramspec_register_types(PyObject *d); + +#endif /* __PYGOBJECT_PARAMSPEC_H__ */ diff --git a/gobject/pygpointer.c b/gobject/pygpointer.c new file mode 100644 index 0000000..5f6417f --- /dev/null +++ b/gobject/pygpointer.c @@ -0,0 +1,193 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- + * pygtk- Python bindings for the GTK toolkit. + * Copyright (C) 1998-2003 James Henstridge + * + * pygpointer.c: wrapper for GPointer + * + * 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 "pygpointer.h" + +#include "pygi-external.h" + + +GQuark pygpointer_class_key; + +PYGLIB_DEFINE_TYPE("gobject.GPointer", PyGPointer_Type, PyGPointer); + +static void +pyg_pointer_dealloc(PyGPointer *self) +{ + Py_TYPE(self)->tp_free((PyObject *)self); +} + +static int +pyg_pointer_compare(PyGPointer *self, PyGPointer *v) +{ + if (self->pointer == v->pointer) return 0; + if (self->pointer > v->pointer) return -1; + return 1; +} + +static long +pyg_pointer_hash(PyGPointer *self) +{ + return (long)self->pointer; +} + +static PyObject * +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 _PyUnicode_FromString(buf); +} + +static int +pyg_pointer_init(PyGPointer *self, PyObject *args, PyObject *kwargs) +{ + gchar buf[512]; + + if (!PyArg_ParseTuple(args, ":GPointer.__init__")) + return -1; + + self->pointer = NULL; + self->gtype = 0; + + g_snprintf(buf, sizeof(buf), "%s can not be constructed", + Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_NotImplementedError, buf); + return -1; +} + +static void +pyg_pointer_free(PyObject *op) +{ + PyObject_FREE(op); +} + +/** + * pyg_register_pointer: + * @dict: the module dictionary to store the wrapper class. + * @class_name: the Python name for the wrapper class. + * @pointer_type: the GType of the pointer type being wrapped. + * @type: the wrapper class. + * + * Registers a wrapper for a pointer type. The wrapper class will be + * a subclass of gobject.GPointer, and a reference to the wrapper + * class will be stored in the provided module dictionary. + */ +void +pyg_register_pointer(PyObject *dict, const gchar *class_name, + GType pointer_type, PyTypeObject *type) +{ + PyObject *o; + + g_return_if_fail(dict != NULL); + g_return_if_fail(class_name != NULL); + g_return_if_fail(pointer_type != 0); + + if (!type->tp_dealloc) type->tp_dealloc = (destructor)pyg_pointer_dealloc; + + Py_TYPE(type) = &PyType_Type; + type->tp_base = &PyGPointer_Type; + + if (PyType_Ready(type) < 0) { + g_warning("could not get type `%s' ready", type->tp_name); + return; + } + + PyDict_SetItemString(type->tp_dict, "__gtype__", + o=pyg_type_wrapper_new(pointer_type)); + Py_DECREF(o); + + g_type_set_qdata(pointer_type, pygpointer_class_key, type); + + PyDict_SetItemString(dict, (char *)class_name, (PyObject *)type); +} + +/** + * pyg_pointer_new: + * @pointer_type: the GType of the pointer value. + * @pointer: the pointer value. + * + * Creates a wrapper for a pointer value. Since G_TYPE_POINTER types + * don't register any information about how to copy/free them, there + * is no guarantee that the pointer will remain valid, and there is + * nothing registered to release the pointer when the pointer goes out + * of scope. This is why we don't recommend people use these types. + * + * Returns: the boxed wrapper. + */ +PyObject * +pyg_pointer_new(GType pointer_type, gpointer pointer) +{ + PyGILState_STATE state; + PyGPointer *self; + PyTypeObject *tp; + g_return_val_if_fail(pointer_type != 0, NULL); + + state = pyglib_gil_state_ensure(); + + if (!pointer) { + Py_INCREF(Py_None); + pyglib_gil_state_release(state); + return Py_None; + } + + tp = g_type_get_qdata(pointer_type, pygpointer_class_key); + + if (!tp) + tp = (PyTypeObject *)pygi_type_import_by_g_type(pointer_type); + + if (!tp) + tp = (PyTypeObject *)&PyGPointer_Type; /* fallback */ + self = PyObject_NEW(PyGPointer, tp); + + pyglib_gil_state_release(state); + + if (self == NULL) + return NULL; + + self->pointer = pointer; + self->gtype = pointer_type; + + return (PyObject *)self; +} + +void +pygobject_pointer_register_types(PyObject *d) +{ + pygpointer_class_key = g_quark_from_static_string("PyGPointer::class"); + + PyGPointer_Type.tp_dealloc = (destructor)pyg_pointer_dealloc; + PyGPointer_Type.tp_compare = (cmpfunc)pyg_pointer_compare; + PyGPointer_Type.tp_repr = (reprfunc)pyg_pointer_repr; + PyGPointer_Type.tp_hash = (hashfunc)pyg_pointer_hash; + 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); +} diff --git a/gobject/pygpointer.h b/gobject/pygpointer.h new file mode 100644 index 0000000..f2923da --- /dev/null +++ b/gobject/pygpointer.h @@ -0,0 +1,27 @@ +/* -*- 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_POINTER_H__ +#define __PYGOBJECT_POINTER_H__ + +void pygobject_pointer_register_types(PyObject *d); + +#endif /* __PYGOBJECT_POINTER_H__ */ diff --git a/gobject/pygtype.c b/gobject/pygtype.c new file mode 100644 index 0000000..5550ce8 --- /dev/null +++ b/gobject/pygtype.c @@ -0,0 +1,1779 @@ +/* -*- 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 int +pyg_type_wrapper_compare(PyGTypeWrapper *self, PyGTypeWrapper *v) +{ + if (self->type == v->type) return 0; + if (self->type > v->type) return -1; + return 1; +} + +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 _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 = _pyg_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: + * 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) +{ + 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 == &PyLong_Type) + return G_TYPE_LONG; + 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_AsString(obj); + + type = _pyg_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(); + PyErr_SetString(PyExc_TypeError, "could not get typecode from object"); + return 0; +} + +/* -------------- 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 (_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)); + } + /* 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 (_PyUnicode_Check(obj)) { + GEnumValue *info; + char *str = _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, gint *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)) { + *val = _PyLong_AsLong(obj); + res = 0; + } else if (PyLong_Check(obj)) { + *val = PyLong_AsLongLong(obj); + res = 0; + } else if (_PyUnicode_Check(obj)) { + GFlagsValue *info; + char *str = _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 = _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; +} + +/** + * pyg_value_from_pyobject: + * @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(GValue *value, PyObject *obj) +{ + PyObject *tmp; + + switch (G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value))) { + case G_TYPE_INTERFACE: + /* we only handle interface types that have a GObject prereq */ + if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT)) { + if (obj == Py_None) + g_value_set_object(value, NULL); + else { + if (!PyObject_TypeCheck(obj, &PyGObject_Type)) { + return -1; + } + if (!G_TYPE_CHECK_INSTANCE_TYPE(pygobject_get(obj), + G_VALUE_TYPE(value))) { + return -1; + } + g_value_set_object(value, pygobject_get(obj)); + } + } else { + return -1; + } + break; + case G_TYPE_CHAR: + if ((tmp = PyObject_Str(obj))) + g_value_set_char(value, _PyUnicode_AsString(tmp)[0]); + else { + PyErr_Clear(); + return -1; + } + Py_DECREF(tmp); + break; + case G_TYPE_UCHAR: + if (_PyLong_Check(obj)) { + glong val; + val = _PyLong_AsLong(obj); + if (val >= 0 && val <= 255) + g_value_set_uchar(value, (guchar)_PyLong_AsLong (obj)); + else + return -1; + } else if ((tmp = PyObject_Str(obj))) { + g_value_set_uchar(value, _PyUnicode_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, _PyLong_AsLong(obj)); + break; + case G_TYPE_UINT: + { + if (_PyLong_Check(obj)) { + glong val; + + val = _PyLong_AsLong(obj); + if (val >= 0 && val <= G_MAXUINT) + g_value_set_uint(value, (guint)val); + else + return -1; + } else { + g_value_set_uint(value, PyLong_AsUnsignedLong(obj)); + } + } + break; + case G_TYPE_LONG: + g_value_set_long(value, _PyLong_AsLong(obj)); + break; + case G_TYPE_ULONG: + { + if (_PyLong_Check(obj)) { + glong val; + + val = _PyLong_AsLong(obj); + if (val >= 0) + g_value_set_ulong(value, (gulong)val); + else + return -1; + } else { + g_value_set_ulong(value, PyLong_AsUnsignedLong(obj)); + } + } + 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) { + PyErr_Clear(); + return -1; + } + g_value_set_enum(value, val); + } + break; + case G_TYPE_FLAGS: + { + gint val = 0; + if (pyg_flags_get_value(G_VALUE_TYPE(value), obj, &val) < 0) { + PyErr_Clear(); + 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 if ((tmp = PyObject_Str(obj))) { + g_value_set_string(value, _PyUnicode_AsString(tmp)); + Py_DECREF(tmp); + } else { + PyErr_Clear(); + return -1; + } + 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 (PyCObject_Check(obj)) + g_value_set_pointer(value, PyCObject_AsVoidPtr(obj)); + else + 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)) { + PyErr_Clear(); + 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 (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 (_PyUnicode_Check(obj) && + G_VALUE_HOLDS(value, G_TYPE_GSTRING)) { + GString *string; + char *buffer; + Py_ssize_t len; + if (_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 (PyCObject_Check(obj)) + g_value_set_boxed(value, PyCObject_AsVoidPtr(obj)); + else + return -1; + break; + } + case G_TYPE_PARAM: + if (PyGParamSpec_Check(obj)) + g_value_set_param(value, PyCObject_AsVoidPtr(obj)); + else + 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 + return -1; + break; + default: + { + PyGTypeMarshal *bm; + if ((bm = pyg_type_lookup(G_VALUE_TYPE(value))) != NULL) + return bm->tovalue(value, obj); + break; + } + } + if (PyErr_Occurred()) { + g_value_unset(value); + PyErr_Clear(); + return -1; + } + return 0; +} + +/** + * 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_char(value); + return _PyUnicode_FromStringAndSize((char *)&val, 1); + } + case G_TYPE_UCHAR: { + guint8 val = g_value_get_uchar(value); + return _PyUnicode_FromStringAndSize((char *)&val, 1); + } + case G_TYPE_BOOLEAN: { + return PyBool_FromLong(g_value_get_boolean(value)); + } + case G_TYPE_INT: + return _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 _PyLong_FromLong((glong) g_value_get_uint(value)); +#else + return PyLong_FromUnsignedLong((gulong) g_value_get_uint(value)); +#endif + } + case G_TYPE_LONG: + return _PyLong_FromLong(g_value_get_long(value)); + case G_TYPE_ULONG: + { + gulong val = g_value_get_ulong(value); + + if (val <= G_MAXLONG) + return _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 _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 _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 _PyUnicode_FromString(str); + Py_INCREF(Py_None); + return Py_None; + } + case G_TYPE_POINTER: + 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 = _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)); + 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 (return_value && pyg_value_from_pyobject(return_value, ret) != 0) { + 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 (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_Cmp(pyclosure->callback, func, &res); + 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 = _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); + } +} + +/** + * pyg_type_registration_callback + * @gtypename: type name + * @callback: function to run + * + */ +typedef struct { + PyGTypeRegistrationFunction callback; + gpointer data; +} CustomTypeData; + +void +pyg_type_register_custom_callback(const gchar *typename, + PyGTypeRegistrationFunction callback, + gpointer user_data) +{ + CustomTypeData *data; + + if (!custom_type_registration) + custom_type_registration = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_free); + + data = g_new (CustomTypeData, 1); + data->callback = callback; + data->data = user_data; + + g_hash_table_insert(custom_type_registration, + g_strdup(typename), + data); +} + +PyTypeObject * +pyg_type_get_custom(const gchar *name) +{ + CustomTypeData *data; + PyTypeObject *retval; + + if (!custom_type_registration) + return NULL; + + data = g_hash_table_lookup(custom_type_registration, name); + if (!data) + return NULL; + + retval = data->callback(name, data->data); + + g_hash_table_remove(custom_type_registration, name); + + return retval; +} + +GType +_pyg_type_from_name(const gchar *name) +{ + GType type; + + type = g_type_from_name(name); + if (type == G_TYPE_INVALID) { + pyg_type_get_custom(name); + type = g_type_from_name(name); + } + + return type; +} + +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, _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 (!_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(_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_compare = (cmpfunc)pyg_type_wrapper_compare; + 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/gobject/pygtype.h b/gobject/pygtype.h new file mode 100644 index 0000000..2f9e7ad --- /dev/null +++ b/gobject/pygtype.h @@ -0,0 +1,28 @@ +/* -*- 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/install-sh b/install-sh new file mode 100755 index 0000000..6781b98 --- /dev/null +++ b/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # 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 + 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 + 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 + trap '(exit $?); exit' 1 2 13 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 starting with `-'. + 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 + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # 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-writeable 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 -z "$d" && 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 new file mode 100755 index 0000000..a72f2fd --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,8406 @@ +# Generated from ltmain.m4sh. + +# ltmain.sh (GNU libtool) 2.2.6b +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 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 +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long 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. +# 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.2.6b +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=2.2.6b +TIMESTAMP="" +package_revision=1.3017 + +# 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 + +# NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +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 + +$lt_unset CDPATH + + + + + +: ${CP="cp -f"} +: ${ECHO="echo"} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${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_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 "X${1}" | $Xsed -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 "X${1}" | $Xsed -e "$basename"` +} + +# Generated shell functions inserted here. + +# 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" + +# The name of this program: +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: +func_dirname_and_basename "$progpath" +progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac + +# 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=: + 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' + +# 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${mode+: }$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_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname${mode+: }$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 "X$my_directory_path" | $Xsed -e "$dirname"` + done + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e '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 "X$my_tmpdir" | $Xsed +} + + +# 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 "X$1" | $Xsed -e "$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 "X$1" | $Xsed \ + -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_version +# Echo version message to standard output and exit. +func_version () +{ + $SED -n '/^# '$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 () +{ + $SED -n '/^# Usage:/,/# -h/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + $ECHO + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help +# Echo long help message to standard output and exit. +func_help () +{ + $SED -n '/^# Usage:/,/# Report bugs to/ { + 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 --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + }' < "$progpath" + exit $? +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + func_error "missing argument for $1" + exit_cmd=exit +} + +exit_cmd=: + + + + + +# Check that we have a working $ECHO. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell, and then maybe $ECHO will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </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 +} + +# Parse options once, thoroughly. This comes as soon as possible in +# the script to make things like `libtool --version' happen quickly. +{ + + # 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 + + # Parse non-mode specific arguments: + while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --config) func_config ;; + + --debug) preserve_args="$preserve_args $opt" + func_echo "enabling shell trace mode" + opt_debug='set -x' + $opt_debug + ;; + + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break + execute_dlfiles="$execute_dlfiles $1" + shift + ;; + + --dry-run | -n) opt_dry_run=: ;; + --features) func_features ;; + --finish) mode="finish" ;; + + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break + case $1 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 + + mode="$1" + shift + ;; + + --preserve-dup-deps) + opt_duplicate_deps=: ;; + + --quiet|--silent) preserve_args="$preserve_args $opt" + opt_silent=: + ;; + + --verbose| -v) preserve_args="$preserve_args $opt" + opt_silent=false + ;; + + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break + preserve_args="$preserve_args $opt $1" + func_enable_tag "$1" # tagname is set here + shift + ;; + + # Separate optargs to long options: + -dlopen=*|--mode=*|--tag=*) + func_opt_split "$opt" + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + shift + ;; + + -\?|-h) func_usage ;; + --help) opt_help=: ;; + --version) func_version ;; + + -*) func_fatal_help "unrecognized option \`$opt'" ;; + + *) nonopt="$opt" + break + ;; + esac + done + + + 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_duplicate_deps + ;; + esac + + # Having warned about all mis-specified options, bail out if + # anything was wrong. + $exit_cmd $EXIT_FAILURE +} + +# 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 +} + + +## ----------- ## +## Main. ## +## ----------- ## + +$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 + + test -z "$mode" && func_fatal_error "error: you must specify a MODE." + + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$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=$mode' for more information." +} + + +# 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_ltwrapper_scriptname_result="" + if func_ltwrapper_executable_p "$1"; then + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + fi +} + +# 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_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_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + 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 "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + # 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_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case "$@ " in + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + # 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 <?"'"'"' &()|`$[]' \ + && 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 "X$srcfile" | $Xsed -e 's%^.*/%%' -e '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 + removelist="$removelist $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + removelist="$removelist $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + 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 + command="$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 + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$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 "$mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $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 building PIC objects only + -prefer-non-pic try to building 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 + +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 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 + -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 + +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 \`$mode'" + ;; + esac + + $ECHO + $ECHO "Try \`$progname --help' for more information about other modes." + + exit $? +} + + # Now that we've collected a possible --mode arg, show help if necessary + $opt_help && func_mode_help + + +# 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 $execute_dlfiles; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + # 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 + dir="$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 + -*) ;; + *) + # 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_quote_for_eval "$file" + args="$args $func_quote_for_eval_result" + 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 "$mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + 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" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + $ECHO "X----------------------------------------------------------------------" | $Xsed + $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 "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS +} + +test "$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. + $ECHO "X$nonopt" | $GREP shtool >/dev/null; 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" + install_prog="$install_prog$func_quote_for_eval_result" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + install_prog="$install_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 -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. + staticlibs="$staticlibs $file" + ;; + + *.la) + # 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 "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -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 "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "X$relink_command" | $Xsed -e "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_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" && staticlibs="$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 "X$lib" | $Xsed -e '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 "X$relink_command" | $Xsed -e '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 "X$file$stripped_ext" | $Xsed -e "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_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $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 "$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 + +/* 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 "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_verbose "extracting global C symbols from \`$progfile'" + $opt_dry_run || eval "$NM $progfile | $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" + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + 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; +" + case $host in + *cygwin* | *mingw* | *cegcc* ) + $ECHO >> "$output_objdir/$my_dlsyms" "\ +/* DATA imports from DLLs on WIN32 con't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs. */" + lt_dlsym_const= ;; + *osf5*) + echo >> "$output_objdir/$my_dlsyms" "\ +/* This system does not cope well with relocations in const data */" + lt_dlsym_const= ;; + *) + lt_dlsym_const=const ;; + esac + + $ECHO >> "$output_objdir/$my_dlsyms" "\ +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) ;; + *) symtab_cflags="$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 "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "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 "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "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. +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 + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | + $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_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + 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 | $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 | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + + +# func_emit_wrapper_part1 [arg=no] +# +# Emit the first part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part1 () +{ + func_emit_wrapper_part1_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part1_arg1=$1 + fi + + $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. +Xsed='${SED} -e 1s/^X//' +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 + ECHO=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$ECHO works! + : + else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $ECHO "\ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e '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 \"X\$file\" | \$Xsed -e '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 \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done +" +} +# end: func_emit_wrapper_part1 + +# func_emit_wrapper_part2 [arg=no] +# +# Emit the second part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part2 () +{ + func_emit_wrapper_part2_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part2_arg1=$1 + fi + + $ECHO "\ + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_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 \"X\$thisdir\" | \$Xsed -e '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" + + # 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 \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 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\ +" +} +# end: func_emit_wrapper_part2 + + +# 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=no + if test -n "$1" ; then + func_emit_wrapper_arg1=$1 + fi + + # split this up so that func_emit_cwrapperexe_src + # can call each part independently. + func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" + func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" +} + + +# func_to_host_path arg +# +# Convert paths to host format when used with build tools. +# Intended for use with "native" mingw (where libtool itself +# is running under the msys shell), or in the following cross- +# build environments: +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# where wine is equipped with the `winepath' executable. +# In the native mingw case, the (msys) shell automatically +# converts paths for any non-msys applications it launches, +# but that facility isn't available from inside the cwrapper. +# Similar accommodations are necessary for $host mingw and +# $build cygwin. Calling this function does no harm for other +# $host/$build combinations not listed above. +# +# ARG is the path (on $build) that should be converted to +# the proper representation for $host. The result is stored +# in $func_to_host_path_result. +func_to_host_path () +{ + func_to_host_path_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + case $build in + *mingw* ) # actually, msys + # awkward: cmd appends spaces to result + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_path_tmp1=`( cmd //c echo "$1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_path_tmp1=`cygpath -w "$1"` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # Unfortunately, winepath does not exit with a non-zero + # error code, so we are forced to check the contents of + # stdout. On the other hand, if the command is not + # found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both + # error code of zero AND non-empty stdout, which explains + # the odd construction: + func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + else + # Allow warning below. + func_to_host_path_result="" + fi + ;; + esac + if test -z "$func_to_host_path_result" ; then + func_error "Could not determine host path corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_path_result="$1" + fi + ;; + esac + fi +} +# end: func_to_host_path + +# func_to_host_pathlist arg +# +# Convert pathlists to host format when used with build tools. +# See func_to_host_path(), above. This function supports the +# following $build/$host combinations (but does no harm for +# combinations not listed here): +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# +# 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. +# +# ARG is a pathlist (on $build) that should be converted to +# the proper representation on $host. The result is stored +# in $func_to_host_pathlist_result. +func_to_host_pathlist () +{ + func_to_host_pathlist_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # 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_to_host_pathlist_tmp2="$1" + # Once set for this call, this variable should not be + # reassigned. It is used in tha fallback case. + func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e 's|^:*||' -e 's|:*$||'` + case $build in + *mingw* ) # Actually, msys. + # Awkward: cmd appends spaces to result. + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # unfortunately, winepath doesn't convert pathlists + func_to_host_pathlist_result="" + func_to_host_pathlist_oldIFS=$IFS + IFS=: + for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do + IFS=$func_to_host_pathlist_oldIFS + if test -n "$func_to_host_pathlist_f" ; then + func_to_host_path "$func_to_host_pathlist_f" + if test -n "$func_to_host_path_result" ; then + if test -z "$func_to_host_pathlist_result" ; then + func_to_host_pathlist_result="$func_to_host_path_result" + else + func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" + fi + fi + fi + IFS=: + done + IFS=$func_to_host_pathlist_oldIFS + ;; + esac + if test -z "$func_to_host_pathlist_result" ; then + func_error "Could not determine the host path(s) corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This may break if $1 contains DOS-style drive + # specifications. The fix is not to complicate the expression + # below, but for the user to provide a working wine installation + # with winepath so that path translation in the cross-to-mingw + # case works properly. + lt_replace_pathsep_nix_to_dos="s|:|;|g" + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_replace_pathsep_nix_to_dos"` + fi + # Now, add the leading and trailing path separators back + case "$1" in + :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" + ;; + esac + case "$1" in + *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" + ;; + esac + ;; + esac + fi +} +# end: func_to_host_pathlist + +# 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 +# define setmode _setmode +#else +# include +# include +# ifdef __CYGWIN__ +# include +# define HAVE_SETENV +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#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 + +#ifdef _MSC_VER +# define S_IXUSR _S_IEXEC +# define stat _stat +# ifndef _INTPTR_T_DEFINED +# define intptr_t int +# endif +#endif + +#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 */ + +#ifdef __CYGWIN__ +# define FOPEN_WB "wb" +#endif + +#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) + +#undef LTWRAPPER_DEBUGPRINTF +#if defined DEBUGWRAPPER +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args +static void +ltwrapper_debugprintf (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); +} +#else +# define LTWRAPPER_DEBUGPRINTF(args) +#endif + +const char *program_name = NULL; + +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_fatal (const char *message, ...); +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_opt_process_env_set (const char *arg); +void lt_opt_process_env_prepend (const char *arg); +void lt_opt_process_env_append (const char *arg); +int lt_split_name_value (const char *arg, char** name, char** value); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); + +static const char *script_text_part1 = +EOF + + func_emit_wrapper_part1 yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" + cat <"))); + for (i = 0; i < newargc; i++) + { + LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + } + +EOF + + case $host_os in + mingw*) + cat <<"EOF" + /* execv doesn't actually work on mingw as expected on unix */ + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + return 127; + } + return rval; +EOF + ;; + *) + cat <<"EOF" + execv (lt_argv_zero, newargz); + return rval; /* =127, but avoids unused variable warning */ +EOF + ;; + esac + + cat <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 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; + + LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + 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; + + LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", + wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + + 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 ("getcwd failed"); + 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 ("getcwd failed"); + 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) + { + LTWRAPPER_DEBUGPRINTF (("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 + { + char *errstr = strerror (errno); + lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal ("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; +} + +static void +lt_error_core (int exit_status, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} + +void +lt_setenv (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", + (name ? name : ""), + (value ? 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; +} + +int +lt_split_name_value (const char *arg, char** name, char** value) +{ + const char *p; + int len; + if (!arg || !*arg) + return 1; + + p = strchr (arg, (int)'='); + + if (!p) + return 1; + + *value = xstrdup (++p); + + len = strlen (arg) - strlen (*value); + *name = XMALLOC (char, len); + strncpy (*name, arg, len-1); + (*name)[len - 1] = '\0'; + + return 0; +} + +void +lt_opt_process_env_set (const char *arg) +{ + char *name = NULL; + char *value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); + } + + lt_setenv (name, value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_prepend (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_append (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 1); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? 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) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? 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 +} +# end: func_emit_cwrapperexe_src + +# 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 + 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 + 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 + dlfiles="$dlfiles $arg" + else + dlprefiles="$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 "*) ;; + *) deplibs="$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 +# moreargs="$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 + dlfiles="$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. + dlprefiles="$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 "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + weak_libs="$weak_libs $arg" + prev= + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$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 + ;; + + -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" + dir=$func_stripname_result + if test -z "$dir"; 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 + # 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 "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$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*) + # 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 + deplibs="$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 + deplibs="$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) + compiler_flags="$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) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) new_inherited_linker_flags="$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_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$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" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$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" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" + linker_flags="$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" + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + objs="$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 + dlfiles="$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. + dlprefiles="$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. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + 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 \"X\${$shlibpath_var}\" \| \$Xsed -e \'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" + # 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_duplicate_deps ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$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 "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$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% $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= + case $lib in + *.la) func_source "$lib" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + case " $weak_libs " in + *" $deplib_base "*) ;; + *) deplibs="$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) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$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 "*) ;; + * ) new_inherited_linker_flags="$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" + newlib_search_path="$newlib_search_path $func_stripname_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" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + dir=$func_stripname_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$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 \"X$deplib\"" 2>/dev/null | $Xsed -e 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. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$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 "X$inherited_linker_flags" | $Xsed -e '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 "*) ;; + *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e '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" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$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. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + 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. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$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 "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$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 + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$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 + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$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" && \ + dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + 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 + newlib_search_path="$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" + newlib_search_path="$newlib_search_path $func_stripname_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_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$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:"*) ;; + *) temp_rpath="$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 "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$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 + notinst_deplibs="$notinst_deplibs $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + notinst_deplibs="$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 "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$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 "$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$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$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:"*) ;; + *) compile_shlibpath="$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:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$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:"*) ;; + *) finalize_shlibpath="$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 + [\\/]*) + add_dir="$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 "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$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" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + 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 + compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + linker_flags="$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 "X $new_inherited_linker_flags" | $Xsed -e '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 "*) ;; + *) lib_search_path="$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 "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$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 + tmp_libs="$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" + objs="$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!" + libobjs="$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 + 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|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 + ;; + 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) + 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. + verstring="$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" + libobjs="$libobjs $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$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 + removelist="$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 + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` + # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` + # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "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 + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$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 "*) ;; + *) dlfiles="$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 "*) ;; + *) dlprefiles="$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*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$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 + deplibs="$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` + 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 "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$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. + newdeplibs="$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 "*) + newdeplibs="$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 \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$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. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ + -e 's/ -lc$//' -e '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 "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + done + fi + if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | + $GREP . >/dev/null; then + $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 + fi + ;; + 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 "X $newdeplibs" | $Xsed -e '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 "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO "X $deplibs" | $Xsed -e '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 "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$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 + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$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 + 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"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$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" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$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 "$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 + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$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" + delfiles="$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 cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + func_len " $cmd" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_show_eval "$cmd" 'exit $?' + 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 "X$include_expsyms" | $Xsed | $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 + delfiles="$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 "*) ;; + *) + tmp_deplibs="$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" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$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\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$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 + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + + # 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 + $ECHO "$obj" >> $output + done + $ECHO ')' >> $output + delfiles="$delfiles $output" + 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 + $ECHO "$obj" >> $output + done + delfiles="$delfiles $output" + output=$firstobj\"$file_list_spec$output\" + 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. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$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~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + delfiles="$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 "$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 "X$include_expsyms" | $Xsed | $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 + delfiles="$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" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + libobjs="$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 "$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 "$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 "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$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 "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e '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]) + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e '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 "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$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 "*) ;; + *) finalize_rpath="$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"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$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;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$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"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$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 "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$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 + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *cegcc) + # Disable wrappers for cegcc, we are cross compiling anyway. + wrappers_required=no + ;; + *) + 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 "X$compile_command" | $Xsed -e '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=$?' + + # 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 + rpath="$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 + rpath="$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 "X$link_command" | $Xsed -e '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 $?' + 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 "X$compile_var$compile_command$compile_rpath" | $Xsed -e '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 "X$link_command" | $Xsed -e '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 $?' + + # 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 "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $ECHO for shipping. + if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$ECHO "X$ECHO" | $Xsed -e "$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 + oldobjs="$oldobjs $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$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" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + oldobjs="$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" + generated="$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" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + 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 + 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 "X$relink_command" | $Xsed -e "$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" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$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" + newdlfiles="$newdlfiles $libdir/$name" + ;; + *) newdlfiles="$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" + newdlprefiles="$newdlprefiles $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 + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + 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 "$mode" = link || test "$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) RM="$RM $arg"; rmforce=yes ;; + -*) RM="$RM $arg" ;; + *) files="$files $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + 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 + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${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 + rmfiles="$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 + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$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 + rmfiles="$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 + rmfiles="$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 + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + objdir="$origobjdir" + + # 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 "$mode" = uninstall || test "$mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$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 new file mode 100644 index 0000000..0c71173 --- /dev/null +++ b/m4/as-ac-expand.m4 @@ -0,0 +1,40 @@ +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 new file mode 100644 index 0000000..222e4b0 --- /dev/null +++ b/m4/jhflags.m4 @@ -0,0 +1,21 @@ +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 new file mode 100644 index 0000000..671cde1 --- /dev/null +++ b/m4/libtool.m4 @@ -0,0 +1,7360 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 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 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 56 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_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 + +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 "X$cc_temp" | $Xsed -e 's%.*/%%' -e "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 +_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_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])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 +_LT_PROG_ECHO_BACKSLASH + +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 + +# Sed substitution that helps us do robust quoting. It backslashifies +# 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' + +# 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_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 "X$][$1" | $Xsed -e "$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 "X$" | $Xsed -e "$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' + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$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 "X\\\\\$\$var"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\[$]0 --fallback-echo"')dnl " + lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` + ;; +esac + +_LT_OUTPUT_LIBTOOL_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]) +cat >"$CONFIG_LT" <<_LTEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate a libtool stub with the current configuration. + +lt_cl_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AS_SHELL_SANITIZE +_AS_PREPARE + +exec AS_MESSAGE_FD>&1 +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) 2008 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. +if test "$no_create" != yes; then + 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) +fi +])# 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 '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_XSI_SHELLFNS + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + 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)], + [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 + + +# _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([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)]) +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], []) + + +# _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 test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 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" + ]) + 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" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES +# -------------------------- +# 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 + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + _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=echo + _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 +# ----------------------- +# 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. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +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 "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_SHELL_INIT + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[_LT_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +[$]* +_LT_EOF + exit 0 +fi + +# 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 + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(lt_ECHO) +]) +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], + [An echo program that does not interpret backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _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 __oline__ "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*) + LD="${LD-ld} -m elf_i386" + ;; + 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 + ;; +sparc*-*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*) LD="${LD-ld} -m elf64_sparc" ;; + *) + 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_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[AC_CHECK_TOOL(AR, ar, false) +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1]) + +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 \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi +_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_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:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/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; + ;; + + 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 + ;; + + 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"; 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"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$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 __oline__ "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 + +void fnord() { int i=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; + /* 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:__oline__: $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:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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 +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 + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # 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 -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # 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; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +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 + 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 + 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=`$ECHO "X$lib" | $Xsed -e '\''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 + 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,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + 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="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + 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 + ;; + 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 + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # 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 + 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 + ;; + +freebsd1*) + dynamic_linker=no + ;; + +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[[123]]*) 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 + ;; + +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 + 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' + ;; + +interix[[3-9]]*) + 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' + 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 + 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 Linux ELF. +linux* | k*bsd*-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' + 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 + 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], + [shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # 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 + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # 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;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $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' + ;; + +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 + 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 + 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 + 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 + 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 + 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 + 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([], [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 + +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 + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + 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 + ;; + +gnu*) + 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]) 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 Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + 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_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_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. + AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) + 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:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: $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:__oline__: 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_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-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 + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + _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([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};"\ +" /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 + + # 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 +#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. */ +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_save_LIBS="$LIBS" + lt_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_save_LIBS" + CFLAGS="$lt_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 + +_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_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)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) +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)= + ;; + 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 + ;; + 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) + 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*) + # IBM XL 8.0 on PPC + _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*) + ;; + *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*) + # 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' + ;; + + 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 + 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) + 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' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # 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*) + # IBM XL C 8.0/Fortran 10.1 on PPC + _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)='-Wl,' + ;; + *Sun\ F*) + # 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)='' + ;; + 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*) + _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_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) + +# +# 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]) + +# +# 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_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' + 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 + 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")) && ([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*) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] +], [ + 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_flag_spec_ld, $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 + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = 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 + *\ [[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.9.1, 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 modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_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(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/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + + 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 + ;; + + 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) + 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= + 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; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # 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; $ECHO \"$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]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + 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; $ECHO \"$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*) + # 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)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_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 $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + 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 $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' + 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 $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 + ;; + + 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 $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 + + 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 + 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")) && ([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 + 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 + _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 $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; 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 + _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' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _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. + _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 `$ECHO "X$deplibs" | $Xsed -e '\''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(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + 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 + ;; + + freebsd1*) + _LT_TAGVAR(ld_shlibs, $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 -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 -fPIC ${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 -a "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${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_flag_spec_ld, $1)='+b $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 -a "$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 -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${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' + ;; + *) + _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 $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE(int foo(void) {}, + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + ) + LDFLAGS="$save_LDFLAGS" + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -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" && $ECHO "X-set_version $verstring" | $Xsed` -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*) + 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" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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 "X-set_version $verstring" | $Xsed` -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 ${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 ${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_MSG_CHECKING([whether -lc should be explicitly linked in]) + $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_TAGVAR(archive_cmds_need_lc, $1)=no + else + _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* + AC_MSG_RESULT([$_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_flag_spec_ld], [1], + [[If ld is used when linking, 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([], [fix_srcfile_path], [1], + [Fix the shell variable $srcfile for the compiler]) +_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([], [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_PROG_CXX +# ------------ +# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ +# compiler, we have our own version here. +m4_defun([_LT_PROG_CXX], +[ +pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) +AC_PROG_CXX +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 +popdef([AC_MSG_ERROR]) +])# _LT_PROG_CXX + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_CXX], []) + + +# _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], +[AC_REQUIRE([_LT_PROG_CXX])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl + +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_flag_spec_ld, $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(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_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++"} + 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 -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -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 "\-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 + _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 $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; 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 + _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' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _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*) + # _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(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 + ;; + 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 + ;; + + freebsd[[12]]*) + # 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 + ;; + + gnu*) + ;; + + 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; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${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; $ECHO "X$list" | $Xsed' + ;; + *) + 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 -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${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" && $ECHO "X-set_version $verstring" | $Xsed` -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 -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -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) + 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; $ECHO "X$list" | $Xsed' + + _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 | $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 | $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 | $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 | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 will 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; $ECHO \"$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=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + xl*) + # 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; $ECHO \"$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='echo' + + # 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=echo + 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" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -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" && $ECHO "X-set_version $verstring" | $Xsed` -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 "X-set_version $verstring" | $Xsed` -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=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + 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" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${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 "\-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*) + # 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='echo' + + # 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 -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 -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 "\-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 "\-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(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 + 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_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 +# 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 +]) +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 $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 + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p 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 + ;; + + *.$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 + +# 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*) + # 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_PROG_F77 +# ------------ +# Since AC_PROG_F77 is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_F77], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) +AC_PROG_F77 +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_F77 + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_F77], []) + + +# _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_REQUIRE([_LT_PROG_F77])dnl +AC_LANG_PUSH(Fortran 77) + +_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_flag_spec_ld, $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(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 + CC=${F77-"f77"} + 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" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_PROG_FC +# ----------- +# Since AC_PROG_FC is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_FC], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) +AC_PROG_FC +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_FC + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_FC], []) + + +# _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_REQUIRE([_LT_PROG_FC])dnl +AC_LANG_PUSH(Fortran) + +_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_flag_spec_ld, $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(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 + CC=${FC-"f95"} + 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" +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_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +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 + +## 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" +])# _LT_LANG_GCJ_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_GCC=$GCC +GCC= +CC=${RC-"windres"} +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" +])# _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_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_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"}, \ + = c,a/b,, \ + && 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_XSI_SHELLFNS +# --------------------- +# Bourne and XSI compatible variants of some useful shell functions. +m4_defun([_LT_PROG_XSI_SHELLFNS], +[case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# 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 () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# 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 () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# 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_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}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $[*] )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# 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 () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -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 file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +dnl func_dirname_and_basename +dnl A portable version of this function is already defined in general.m4sh +dnl so there is no need for it here. + +# 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 "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[[^=]]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$[@]"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]+=\$[2]" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]=\$$[1]\$[2]" +} + +_LT_EOF + ;; + esac +]) diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 new file mode 100644 index 0000000..34151a3 --- /dev/null +++ b/m4/ltoptions.m4 @@ -0,0 +1,368 @@ +# Helper functions for option handling. -*- 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 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], [0], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [0], [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], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [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 new file mode 100644 index 0000000..9000a05 --- /dev/null +++ b/m4/ltsugar.m4 @@ -0,0 +1,123 @@ +# 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 new file mode 100644 index 0000000..f3c5309 --- /dev/null +++ b/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# 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. + +# Generated from ltversion.in. + +# serial 3017 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.2.6b]) +m4_define([LT_PACKAGE_REVISION], [1.3017]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.2.6b' +macro_revision='1.3017' +_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 new file mode 100644 index 0000000..637bb20 --- /dev/null +++ b/m4/lt~obsolete.m4 @@ -0,0 +1,92 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007 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 4 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_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) +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])]) diff --git a/m4/python.m4 b/m4/python.m4 new file mode 100644 index 0000000..bdc8ee6 --- /dev/null +++ b/m4/python.m4 @@ -0,0 +1,257 @@ +## 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 +py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` +py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` +if test -x "$PYTHON-config"; then +PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` +else +PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" +if test "$py_prefix" != "$py_exec_prefix"; then + PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" +>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" +]) + +# 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], + [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl +python2.1 python2.0]) + + 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 + +]) + +dnl a macro to check for ability to create python extensions +dnl JD_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) +dnl function also defines PYTHON_INCLUDES +AC_DEFUN([JD_CHECK_PYTHON_HEADERS], +[AC_REQUIRE([AM_PATH_PYTHON]) +AC_MSG_CHECKING(for headers required to compile python extensions) +dnl deduce PYTHON_INCLUDES +py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` +py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` +if test -x "$PYTHON-config"; then +PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` +else +PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" +if test "$py_prefix" != "$py_exec_prefix"; then + PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" +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" +]) diff --git a/missing b/missing new file mode 100755 index 0000000..28055d2 --- /dev/null +++ b/missing @@ -0,0 +1,376 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. +# Originally 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 + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +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 + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# 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/packaging/pygobject-rpmlintrc b/packaging/pygobject-rpmlintrc new file mode 100644 index 0000000..5e73e43 --- /dev/null +++ b/packaging/pygobject-rpmlintrc @@ -0,0 +1,3 @@ +# This line is mandatory to access the configuration functions +from Config import * +addFilter("pygobject2.* devel-file-in-non-devel-package") diff --git a/packaging/pygobject.changes b/packaging/pygobject.changes new file mode 100644 index 0000000..bfd1a0f --- /dev/null +++ b/packaging/pygobject.changes @@ -0,0 +1,2 @@ +* Wed Jul 25th 2012 Prajwal Mohan +- renaming pygobject2.spec to pygobject.spec. renamging pygobject2-rpmlintre to pygoject-rpmlintrc diff --git a/packaging/pygobject.spec b/packaging/pygobject.spec new file mode 100644 index 0000000..b75e029 --- /dev/null +++ b/packaging/pygobject.spec @@ -0,0 +1,119 @@ +%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} + +# Last updated for version 2.19.0 +%define glib2_version 2.16.0 +%define python2_version 2.3.5 + +### Abstract ### + +Name: pygobject +Version: 2.21.3 +Release: 1.1 +License: LGPLv2+ +Group: Development/Languages +Summary: Python bindings for GObject +URL: http://www.pygtk.org/ +Source0: %{name}-%{version}.tar.bz2 +Source101: %{name}-rpmlintrc + + +### Build Dependencies ### + +BuildRequires: automake +BuildRequires: glib2-devel >= %{glib2_version} +BuildRequires: libtool +BuildRequires: python-devel >= %{python2_version} + +%description +The %{name} package provides a convenient wrapper for the GObject library +for use in Python programs. + +%package codegen +Summary: The code generation program for PyGObject +Group: Development/Languages + +%description codegen +The package contains the C code generation program for PyGObject. + +%package devel +Summary: Development files for building add-on libraries +Group: Development/Languages +Requires: %{name} = %{version}-%{release} +Requires: %{name}-codegen = %{version}-%{release} +Requires: %{name}-doc = %{version}-%{release} +Requires: glib2-devel +Requires: pkgconfig + +%description devel +This package contains files required to build wrappers for %{name}-based +libraries such as pygtk2. + +%package doc +Summary: Documentation files for %{name} +Group: Development/Languages + +%description doc +This package contains documentation files for %{name}. + +%prep +%setup -q + +%build +%configure --enable-thread +export tagname=CC +make LIBTOOL=/usr/bin/libtool + +%install +rm -rf $RPM_BUILD_ROOT +export tagname=CC +make LIBTOOL=/usr/bin/libtool DESTDIR=$RPM_BUILD_ROOT install +find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f + +rm examples/Makefile* + +%clean +rm -fr $RPM_BUILD_ROOT + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(644, root, root, 755) +%doc AUTHORS NEWS README + +%{_libdir}/libpyglib-2.0-python.so* +%dir %{python_sitearch}/gtk-2.0 +%{python_sitearch}/gtk-2.0/dsextras.* +%{python_sitearch}/pygtk.* + +%defattr(755, root, root, 755) +%{python_sitearch}/gtk-2.0/gio +#%{python_sitearch}/gtk-2.0/girepository +%{python_sitearch}/gtk-2.0/glib +%{python_sitearch}/gtk-2.0/gobject + +%files codegen +%defattr(755, root, root, 755) +%{_bindir}/pygobject-codegen-2.0 +%defattr(644, root, root, 755) +%dir %{_datadir}/pygobject/2.0 +%{_datadir}/pygobject/2.0/codegen + +%files devel +%defattr(644, root, root, 755) +%dir %{_datadir}/pygobject +%dir %{_includedir}/pygtk-2.0 +%{_datadir}/pygobject/2.0/defs +#%{_includedir}/pygobject/bank.h +%{_includedir}/pygtk-2.0/pyglib.h +%{_includedir}/pygtk-2.0/pygobject.h +%{_libdir}/pkgconfig/pygobject-2.0.pc + +%files doc +%defattr(644, root, root, 755) +%doc examples +%{_datadir}/gtk-doc/html/pygobject +%{_datadir}/pygobject/xsl + diff --git a/py-compile b/py-compile new file mode 100755 index 0000000..3f9d05b --- /dev/null +++ b/py-compile @@ -0,0 +1,146 @@ +#!/bin/sh +# py-compile - Compile a Python program + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 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 + +basedir= +destdir= +files= +while test $# -ne 0; do + case "$1" in + --basedir) + basedir=$2 + if test -z "$basedir"; then + echo "$0: Missing argument to --basedir." 1>&2 + exit 1 + fi + shift + ;; + --destdir) + destdir=$2 + if test -z "$destdir"; then + echo "$0: Missing argument to --destdir." 1>&2 + exit 1 + fi + shift + ;; + -h|--h*) + 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|--v*) + echo "py-compile $scriptversion" + exit $? + ;; + *) + files="$files $1" + ;; + esac + shift +done + +if test -z "$files"; then + echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 + exit 1 +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 + +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() + 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 + +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() + 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-2.0-uninstalled.pc.in b/pygobject-2.0-uninstalled.pc.in new file mode 100644 index 0000000..3fb6288 --- /dev/null +++ b/pygobject-2.0-uninstalled.pc.in @@ -0,0 +1,19 @@ +Name: PyGObject +Description: Python bindings for GObject +Requires: gobject-2.0 +Requires.private: @LIBFFI_PC@ +Version: @VERSION@ +Cflags: -I${pc_top_builddir}/${pcfiledir}/gobject + +# you can use the --variable=pygtkincludedir argument to +# pkg-config to get this value. You might want to use this to +# install additional headers. +pygtkincludedir=${pc_top_builddir}/${pcfiledir}/gobject +xslfiles=${pc_top_builddir}/${pcfiledir}/docs/xsl + +# same here. Useful when calling the code generator in addon packages. +defsdir=${pc_top_builddir}/${pcfiledir}/gio +fixxref=${pc_top_builddir}/${pcfiledir}/docs/xsl/fixxref.py +codegendir=${pc_top_builddir}/${pcfiledir}/codegen +pygdocs=${pc_top_builddir}/${pcfiledir}/docs +datadir=${pc_top_builddir}/pygobject-@VERSION@ diff --git a/pygobject-2.0.pc.in b/pygobject-2.0.pc.in new file mode 100644 index 0000000..5188a12 --- /dev/null +++ b/pygobject-2.0.pc.in @@ -0,0 +1,22 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ +libdir=@libdir@ + +# you can use the --variable=pygtkincludedir argument to +# pkg-config to get this value. You might want to use this to +# install additional headers. +pygtkincludedir=${includedir}/pygtk-2.0 +fixxref=${datadir}/pygobject/xsl/fixxref.py +pygdocs=${datadir}/gtk-doc/html/pygobject +defsdir=${datadir}/pygobject/2.0/defs +codegendir=${datadir}/pygobject/2.0/codegen + +Name: PyGObject +Description: Python bindings for GObject +Requires: gobject-2.0 +Requires.private: @LIBFFI_PC@ +Version: @VERSION@ +Cflags: -I${pygtkincludedir} diff --git a/pygobject_postinstall.py b/pygobject_postinstall.py new file mode 100644 index 0000000..487828e --- /dev/null +++ b/pygobject_postinstall.py @@ -0,0 +1,72 @@ + +"""pygobject is now installed on your machine. + +Local configuration files were successfully updated.""" + +import os, re, sys + +pkgconfig_file = os.path.normpath( + os.path.join(sys.prefix, + 'lib/pkgconfig/pygobject-2.0.pc')) + +prefix_pattern=re.compile("^prefix=.*") +version_pattern=re.compile("Version: ([0-9]+\.[0-9]+\.[0-9]+)") + +def replace_prefix(s): + if prefix_pattern.match(s): + s='prefix='+sys.prefix.replace("\\","/")+'\n' + s=s.replace("@DATADIR@", + os.path.join(sys.prefix,'share').replace("\\","/")) + + return s + +def get_doc_url(pkgconfig_file, base_url): + try: + f = open(pkgconfig_file).read() + ver = version_pattern.search(f).groups()[0] + majv,minv,micv = ver.split('.') + doc_url = "%s/%s.%s/" % (base_url,majv,minv) + except: + doc_url = base_url + "/stable/" + return doc_url + +# TODO : Check that shortcuts are created system-wide when the user +# has admin rights (hint: see pywin32 postinstall) +def create_shortcuts(): + progs_folder= get_special_folder_path("CSIDL_COMMON_PROGRAMS") + site_packages_dir = os.path.join(sys.prefix , 'lib','site-packages') + + pygtk_shortcuts = os.path.join(progs_folder, 'PyGTK') + if not os.path.isdir(pygtk_shortcuts): + os.mkdir(pygtk_shortcuts) + + # link to specific documentation version by parsing the + # pkgconfig file + doc_url = get_doc_url(pkgconfig_file, + "http://library.gnome.org/devel/pygobject") + pygobject_doc_link=os.path.join(pygtk_shortcuts, + 'PyGObject Documentation.lnk') + if os.path.isfile(pygobject_doc_link): + os.remove(pygobject_doc_link) + create_shortcut(doc_url,'PyGObject Documentation',pygobject_doc_link) + +def remove_shortcuts(): + pygtk_shortcuts = os.path.join( + get_special_folder_path('CSIDL_COMMON_PROGRAMS'), 'PyGTK') + os.remove(os.path.join(pygtk_shortcuts,'PyGObject Documentation.lnk')) + try: + os.rmdir(pygtk_shortcuts) + except OSError, e: + # Directory is not empty, so leave it like that ! + pass + +if len(sys.argv) == 2: + if sys.argv[1] == "-install": + # fixup the pkgconfig file + lines=open(pkgconfig_file).readlines() + open(pkgconfig_file, 'w').writelines(map(replace_prefix,lines)) + # TODO: Add an installer option for shortcut creation + create_shortcuts() + print __doc__ + elif sys.argv[1] == "-remove": + remove_shortcuts() diff --git a/pygtk.py b/pygtk.py new file mode 100644 index 0000000..e061b88 --- /dev/null +++ b/pygtk.py @@ -0,0 +1,95 @@ +# -*- Mode: Python; py-indent-offset: 4 -*- +# pygtk - Python bindings for the GTK+ widget set. +# Copyright (C) 1998-2002 James Henstridge +# +# pygtk.py: pygtk version selection 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 + +import fnmatch +import glob +import os +import os.path +import sys + +__all__ = ['require'] + +_our_dir = os.path.dirname(os.path.abspath(os.path.normpath(__file__))) +_pygtk_2_0_dir = os.path.normpath('%s/gtk-2.0' % _our_dir) + +_pygtk_dir_pat = 'gtk-[0-9].[0-9]' + +_pygtk_required_version = None + +def _get_available_versions(): + versions = {} + for dir in sys.path: + if not dir: + dir = os.getcwd() + + if not os.path.isdir(dir): + continue + + # if the dir is a pygtk dir, skip it + if fnmatch.fnmatchcase(os.path.basename(dir), _pygtk_dir_pat): + continue + + for filename in glob.glob(os.path.join(dir, _pygtk_dir_pat)): + pathname = os.path.join(dir, filename) + + # skip non directories + if not os.path.isdir(pathname): + continue + + # skip empty directories + if not os.listdir(pathname): + continue + + if not versions.has_key(filename[-3:]): + versions[filename[-3:]] = pathname + return versions + +def require20(): + if _pygtk_2_0_dir not in sys.path: + sys.path.insert(0, _pygtk_2_0_dir) + +def require(version): + if version == '2.0': + return require20() + + global _pygtk_required_version + + if _pygtk_required_version != None: + assert _pygtk_required_version == version, \ + "a different version of gtk was already required" + return + + assert not sys.modules.has_key('gtk'), \ + "pygtk.require() must be called before importing gtk" + + versions = _get_available_versions() + assert versions.has_key(version), \ + "required version '%s' not found on system" % version + + # remove any pygtk dirs first ... + for dir in sys.path: + if fnmatch.fnmatchcase(os.path.basename(dir), _pygtk_dir_pat): + sys.path.remove(dir) + + # prepend the pygtk path ... + sys.path.insert(0, versions[version]) + + _pygtk_required_version = version diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..0999c00 --- /dev/null +++ b/setup.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +# +# setup.py - distutils configuration for pygobject +# +"""Python Bindings for GObject.""" + +from distutils.command.build import build +from distutils.command.build_clib import build_clib +from distutils.sysconfig import get_python_inc +from distutils.core import setup +import glob +import os +import sys + +from dsextras import get_m4_define, getoutput, have_pkgconfig, \ + GLOBAL_INC, GLOBAL_MACROS, InstallLib, InstallData, BuildExt, \ + PkgConfigExtension, TemplateExtension, \ + pkgc_get_libraries, pkgc_get_library_dirs, pkgc_get_include_dirs + +if '--yes-i-know-its-not-supported' in sys.argv: + sys.argv.remove('--yes-i-know-its-not-supported') +else: + print '*'*70 + print 'Building PyGObject using distutils is NOT SUPPORTED.' + print "It's mainly included to be able to easily build win32 installers" + print "You may continue, but only if you agree to not ask any questions" + print "To build PyGObject in a supported way, read the INSTALL file" + print + print "Build fixes are of course welcome and should be filed in bugzilla" + print '*'*70 + input = raw_input('Not supported, ok [y/N]? ') + if not input.startswith('y'): + raise SystemExit("Aborted") + +MIN_PYTHON_VERSION = (2, 3, 5) + +MAJOR_VERSION = int(get_m4_define('pygobject_major_version')) +MINOR_VERSION = int(get_m4_define('pygobject_minor_version')) +MICRO_VERSION = int(get_m4_define('pygobject_micro_version')) + +VERSION = "%d.%d.%d" % (MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION) + +GLIB_REQUIRED = get_m4_define('glib_required_version') + +PYGOBJECT_SUFFIX = '2.0' +PYGOBJECT_SUFFIX_LONG = 'gtk-' + PYGOBJECT_SUFFIX + +GLOBAL_INC += ['gobject'] +GLOBAL_MACROS += [('PYGOBJECT_MAJOR_VERSION', MAJOR_VERSION), + ('PYGOBJECT_MINOR_VERSION', MINOR_VERSION), + ('PYGOBJECT_MICRO_VERSION', MICRO_VERSION)] + +if sys.platform == 'win32': + GLOBAL_MACROS.append(('VERSION', '"""%s"""' % VERSION)) +else: + raise SystemExit("Error: distutils build only supported on windows") + +if sys.version_info[:3] < MIN_PYTHON_VERSION: + raise SystemExit("Python %s or higher is required, %s found" % ( + ".".join(map(str,MIN_PYTHON_VERSION)), + ".".join(map(str,sys.version_info[:3])))) + +if not have_pkgconfig(): + raise SystemExit("Error, could not find pkg-config") + +DEFS_DIR = os.path.join('share', 'pygobject', PYGOBJECT_SUFFIX, 'defs') +INCLUDE_DIR = os.path.join('include', 'pygtk-%s' % PYGOBJECT_SUFFIX) + +class PyGObjectInstallLib(InstallLib): + def run(self): + + # Install pygtk.pth, pygtk.py[c] and templates + self.install_pth() + self.install_pygtk() + + # Modify the base installation dir + install_dir = os.path.join(self.install_dir, PYGOBJECT_SUFFIX_LONG) + self.set_install_dir(install_dir) + + InstallLib.run(self) + + def install_pth(self): + """Write the pygtk.pth file""" + file = os.path.join(self.install_dir, 'pygtk.pth') + self.mkpath(self.install_dir) + open(file, 'w').write(PYGOBJECT_SUFFIX_LONG) + self.local_outputs.append(file) + self.local_inputs.append('pygtk.pth') + + def install_pygtk(self): + """install pygtk.py in the right place.""" + self.copy_file('pygtk.py', self.install_dir) + pygtk = os.path.join(self.install_dir, 'pygtk.py') + self.byte_compile([pygtk]) + self.local_outputs.append(pygtk) + self.local_inputs.append('pygtk.py') + +class PyGObjectInstallData(InstallData): + def run(self): + self.add_template_option('VERSION', VERSION) + self.add_template_option('FFI_LIBS', '') + self.add_template_option('LIBFFI_PC', '') + self.prepare() + + # Install templates + self.install_templates() + + InstallData.run(self) + + def install_templates(self): + self.install_template('pygobject-2.0.pc.in', + os.path.join(self.install_dir, + 'lib', 'pkgconfig')) + +class PyGObjectBuild(build): + enable_threading = 1 +PyGObjectBuild.user_options.append(('enable-threading', None, + 'enable threading support')) + +# glib +glib = PkgConfigExtension(name='glib._glib', + pkc_name='glib-2.0', + pkc_version=GLIB_REQUIRED, + pygobject_pkc=None, + include_dirs=['glib'], + libraries=['pyglib'], + sources=['glib/glibmodule.c', + 'glib/pygiochannel.c', + 'glib/pygmaincontext.c', + 'glib/pygmainloop.c', + 'glib/pygoptioncontext.c', + 'glib/pygoptiongroup.c', + 'glib/pygsource.c', + 'glib/pygspawn.c', + ]) + +# GObject +gobject = PkgConfigExtension(name='gobject._gobject', + pkc_name='gobject-2.0', + pkc_version=GLIB_REQUIRED, + pygobject_pkc=None, + include_dirs=['glib'], + libraries=['pyglib'], + sources=['gobject/gobjectmodule.c', + 'gobject/pygboxed.c', + 'gobject/pygenum.c', + 'gobject/pygflags.c', + 'gobject/pyginterface.c', + 'gobject/pygobject.c', + 'gobject/pygparamspec.c', + 'gobject/pygpointer.c', + 'gobject/pygtype.c', + ]) + +# gio +gio = TemplateExtension(name='gio', + pkc_name='gio-2.0', + pkc_version=GLIB_REQUIRED, + output='gio._gio', + defs=('gio/gio.defs', ['gio/gio-types.defs']), + include_dirs=['glib'], + libraries=['pyglib'], + sources=['gio/giomodule.c', + 'gio/gio.c', + 'gio/pygio-utils.c'], + register=[('gio/gio.defs', ['gio/gio-types.defs'])], + override='gio/gio.override') + +clibs = [] +data_files = [] +ext_modules = [] + +#Install dsextras and codegen so that the pygtk installer +#can find them +py_modules = ['dsextras'] +packages = ['codegen'] + +if glib.can_build(): + #It would have been nice to create another class, such as PkgConfigCLib to + #encapsulate this dictionary, but it is impossible. build_clib.py does + #a dumb check to see if its only arguments are a 2-tuple containing a + #string and a Dictionary type - which makes it impossible to hide behind a + #subclass + # + #So we are stuck with this ugly thing + clibs.append(( + 'pyglib',{ + 'sources':['glib/pyglib.c'], + 'macros':GLOBAL_MACROS, + 'include_dirs': + ['glib', get_python_inc()]+pkgc_get_include_dirs('glib-2.0')})) + #this library is not installed, so probbably should not include its header + #data_files.append((INCLUDE_DIR, ('glib/pyglib.h',))) + + ext_modules.append(glib) + py_modules += ['glib.__init__', 'glib.option'] +else: + raise SystemExit("ERROR: Nothing to do, glib could not be found and is essential.") + +if gobject.can_build(): + ext_modules.append(gobject) + data_files.append((INCLUDE_DIR, ('gobject/pygobject.h',))) + py_modules += ['gobject.__init__', 'gobject.propertyhelper', 'gobject.constants'] +else: + raise SystemExit("ERROR: Nothing to do, gobject could not be found and is essential.") + +if gio.can_build(): + ext_modules.append(gio) + py_modules += ['gio.__init__'] + data_files.append((DEFS_DIR,('gio/gio-types.defs',))) +else: + raise SystemExit("ERROR: Nothing to do, gio could not be found and is essential.") + +# Threading support +if '--disable-threading' in sys.argv: + sys.argv.remove('--disable-threading') + enable_threading = False +else: + if '--enable-threading' in sys.argv: + sys.argv.remove('--enable-threading') + try: + import thread + except ImportError: + print "Warning: Could not import thread module, disabling threading" + enable_threading = False + else: + enable_threading = True + +if enable_threading: + name = 'gthread-2.0' + for module in ext_modules: + raw = getoutput('pkg-config --libs-only-l %s' % name) + for arg in raw.split(): + if arg.startswith('-l'): + module.libraries.append(arg[2:]) + else: + module.extra_link_args.append(arg) + raw = getoutput('pkg-config --cflags-only-I %s' % name) + for arg in raw.split(): + if arg.startswith('-I'): + module.include_dirs.append(arg[2:]) + else: + module.extra_compile_args.append(arg) +else: + GLOBAL_MACROS.append(('DISABLE_THREADING', 1)) + + +doclines = __doc__.split("\n") + +options = {"bdist_wininst": {"install_script": "pygobject_postinstall.py"}} + +setup(name="pygobject", + url='http://www.pygtk.org/', + version=VERSION, + license='LGPL', + platforms=['yes'], + maintainer="Johan Dahlin", + maintainer_email="johan@gnome.org", + description = doclines[0], + long_description = "\n".join(doclines[2:]), + py_modules=py_modules, + packages=packages, + ext_modules=ext_modules, + libraries=clibs, + data_files=data_files, + scripts = ["pygobject_postinstall.py"], + options=options, + cmdclass={'install_lib': PyGObjectInstallLib, + 'install_data': PyGObjectInstallData, + 'build_clib' : build_clib, + 'build_ext': BuildExt, + 'build': PyGObjectBuild}) diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..fcdffe1 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,63 @@ +INCLUDES = \ + -I$(top_srcdir)/gobject \ + $(PYTHON_INCLUDES) \ + $(GLIB_CFLAGS) + +EXTRA_DIST = \ + $(tests) \ + common.py \ + runtests.py \ + testmodule.py \ + test-floating.h \ + test-thread.h \ + test-unknown.h + +noinst_LTLIBRARIES = testhelper.la +linked_LIBS = testhelper.la + +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 + +tests = \ + test_gicon.py \ + test_gio.py \ + test_gobject.py \ + test_interface.py \ + test_mainloop.py \ + test_properties.py \ + test_signal.py \ + test_subprocess.py \ + test_unknown.py \ + test_source.py + +# This is a hack to make sure a shared library is built +testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES) + $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS) + +check-local: $(top_srcdir)/glib/__init__.py $(top_srcdir)/gobject/__init__.py $(top_srcdir)/gio/__init__.py + @if test "$(top_builddir)" != "$(top_srcdir)"; then \ + cp $(top_srcdir)/glib/*.py $(top_builddir)/glib; \ + cp $(top_srcdir)/gobject/*.py $(top_builddir)/gobject; \ + cp $(top_srcdir)/gio/*.py $(top_builddir)/gio; \ + fi + @$(PYTHON) $(srcdir)/runtests.py $(top_builddir) $(top_srcdir) + @if test "$(top_builddir)" != "$(top_srcdir)"; then \ + rm -f $(top_builddir)/glib/*.py; \ + rm -f $(top_builddir)/gobject/*.py; \ + rm -f $(top_builddir)/gio/*.py; \ + fi + @rm -fr $(top_builddir)/glib/*.pyc + @rm -fr $(top_builddir)/gobject/*.pyc + @rm -fr $(top_builddir)/gio/*.pyc + + +all: $(LTLIBRARIES:.la=.so) +clean-local: + rm -f $(LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..7e77581 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,569 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +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 = tests +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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 = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +testhelper_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_testhelper_la_OBJECTS = testhelpermodule.lo test-floating.lo \ + test-thread.lo test-unknown.lo +testhelper_la_OBJECTS = $(am_testhelper_la_OBJECTS) +testhelper_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(testhelper_la_LDFLAGS) $(LDFLAGS) -o $@ +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) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(testhelper_la_SOURCES) +DIST_SOURCES = $(testhelper_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +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@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +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@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBFFI_PC = @LIBFFI_PC@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +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_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PLATFORM = @PLATFORM@ +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_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +THREADING_CFLAGS = @THREADING_CFLAGS@ +VERSION = @VERSION@ +XSLTPROC = @XSLTPROC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +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@ +lt_ECHO = @lt_ECHO@ +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@ +pygobject_CODEGEN_DEFINES = @pygobject_CODEGEN_DEFINES@ +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@ +INCLUDES = \ + -I$(top_srcdir)/gobject \ + $(PYTHON_INCLUDES) \ + $(GLIB_CFLAGS) + +EXTRA_DIST = \ + $(tests) \ + common.py \ + runtests.py \ + testmodule.py \ + test-floating.h \ + test-thread.h \ + test-unknown.h + +noinst_LTLIBRARIES = testhelper.la +linked_LIBS = testhelper.la +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 + +tests = \ + test_gicon.py \ + test_gio.py \ + test_gobject.py \ + test_interface.py \ + test_mainloop.py \ + test_properties.py \ + test_signal.py \ + test_subprocess.py \ + test_unknown.py \ + test_source.py + +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) --gnu tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu 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-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-floating.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-thread.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unknown.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhelpermodule.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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 +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + 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" + +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: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +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-noinstLTLIBRARIES 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 all all-am check check-am check-local clean \ + clean-generic clean-libtool clean-local \ + clean-noinstLTLIBRARIES ctags 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 uninstall uninstall-am + + +# This is a hack to make sure a shared library is built +testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES) + $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS) + +check-local: $(top_srcdir)/glib/__init__.py $(top_srcdir)/gobject/__init__.py $(top_srcdir)/gio/__init__.py + @if test "$(top_builddir)" != "$(top_srcdir)"; then \ + cp $(top_srcdir)/glib/*.py $(top_builddir)/glib; \ + cp $(top_srcdir)/gobject/*.py $(top_builddir)/gobject; \ + cp $(top_srcdir)/gio/*.py $(top_builddir)/gio; \ + fi + @$(PYTHON) $(srcdir)/runtests.py $(top_builddir) $(top_srcdir) + @if test "$(top_builddir)" != "$(top_srcdir)"; then \ + rm -f $(top_builddir)/glib/*.py; \ + rm -f $(top_builddir)/gobject/*.py; \ + rm -f $(top_builddir)/gio/*.py; \ + fi + @rm -fr $(top_builddir)/glib/*.pyc + @rm -fr $(top_builddir)/gobject/*.pyc + @rm -fr $(top_builddir)/gio/*.pyc + +all: $(LTLIBRARIES:.la=.so) +clean-local: + rm -f $(LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true + +# 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/common.py b/tests/common.py new file mode 100644 index 0000000..a6fa73d --- /dev/null +++ b/tests/common.py @@ -0,0 +1,48 @@ +import os +import sys + +def importModules(buildDir, srcDir): + # Be very careful when you change this code, it's + # fragile and the order is really significant + + sys.path.insert(0, srcDir) + sys.path.insert(0, buildDir) + sys.path.insert(0, os.path.join(buildDir, 'glib')) + sys.path.insert(0, os.path.join(buildDir, 'gobject')) + sys.path.insert(0, os.path.join(buildDir, 'gio')) + + # testhelper + sys.path.insert(0, os.path.join(buildDir, 'tests')) + sys.argv.append('--g-fatal-warnings') + + testhelper = importModule('testhelper', '.') + glib = importModule('glib', buildDir, 'glib') + gobject = importModule('gobject', buildDir, 'gobject') + gio = importModule('gio', buildDir, 'gio') + + globals().update(locals()) + + os.environ['PYGTK_USE_GIL_STATE_API'] = '' + gobject.threads_init() + +def importModule(module, directory, name=None): + global isDistCheck + + origName = module + if not name: + name = module + '.la' + + try: + obj = __import__(module, {}, {}, '') + except ImportError, e: + raise SystemExit('%s could not be imported: %s' % (origName, e)) + + location = obj.__file__ + + current = os.getcwd() + expected = os.path.abspath(os.path.join(current, location)) + current = os.path.abspath(location) + if current != expected: + raise AssertionError('module %s imported from wrong location. Expected %s, got %s' % ( + module, expected, current)) + return obj diff --git a/tests/runtests.py b/tests/runtests.py new file mode 100644 index 0000000..da5ade0 --- /dev/null +++ b/tests/runtests.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +import glob +import os +import sys +import unittest + +import common + +program = None +if len(sys.argv) == 3: + buildDir = sys.argv[1] + srcDir = sys.argv[2] +else: + if len(sys.argv) == 2: + program = sys.argv[1] + if program.endswith('.py'): + program = program[:-3] + buildDir = '..' + srcDir = '.' + +common.importModules(buildDir=buildDir, + srcDir=srcDir) + +SKIP_FILES = ['common', 'runtests'] + +dir = os.path.split(os.path.abspath(__file__))[0] +os.chdir(dir) + +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(): + if program and program not in name: + continue + suite.addTest(loader.loadTestsFromName(name)) + +testRunner = unittest.TextTestRunner() +testRunner.run(suite) diff --git a/tests/test-floating.c b/tests/test-floating.c new file mode 100644 index 0000000..918a42d --- /dev/null +++ b/tests/test-floating.c @@ -0,0 +1,95 @@ +/* + * test-floating.c - Source for TestFloatingWithSinkFunc and TestFloatingWithoutSinkFunc + * Copyright (C) 2010 Collabora Ltd. + * + * 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 + */ + +#include "test-floating.h" + +/* TestFloatingWithSinkFunc */ + +G_DEFINE_TYPE(TestFloatingWithSinkFunc, test_floating_with_sink_func, G_TYPE_INITIALLY_UNOWNED) + +static void +test_floating_with_sink_func_finalize (GObject *gobject) +{ + TestFloatingWithSinkFunc *object = TEST_FLOATING_WITH_SINK_FUNC (gobject); + + if (g_object_is_floating (object)) + { + g_warning ("A floating object was finalized. This means that someone\n" + "called g_object_unref() on an object that had only a floating\n" + "reference; the initial floating reference is not owned by anyone\n" + "and must be removed with g_object_ref_sink()."); + } + + G_OBJECT_CLASS (test_floating_with_sink_func_parent_class)->finalize (gobject); +} + +static void +test_floating_with_sink_func_class_init (TestFloatingWithSinkFuncClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = test_floating_with_sink_func_finalize; +} + +static void +test_floating_with_sink_func_init (TestFloatingWithSinkFunc *self) +{ +} + +void +sink_test_floating_with_sink_func (GObject *object) +{ + if (g_object_is_floating(object)) { + g_object_ref_sink(object); + } +} + +/* TestFloatingWithoutSinkFunc */ + +G_DEFINE_TYPE(TestFloatingWithoutSinkFunc, test_floating_without_sink_func, G_TYPE_INITIALLY_UNOWNED) + +static void +test_floating_without_sink_func_finalize (GObject *gobject) +{ + TestFloatingWithoutSinkFunc *object = TEST_FLOATING_WITHOUT_SINK_FUNC (gobject); + + if (g_object_is_floating (object)) + { + g_warning ("A floating object was finalized. This means that someone\n" + "called g_object_unref() on an object that had only a floating\n" + "reference; the initial floating reference is not owned by anyone\n" + "and must be removed without g_object_ref_sink()."); + } + + G_OBJECT_CLASS (test_floating_without_sink_func_parent_class)->finalize (gobject); +} + +static void +test_floating_without_sink_func_class_init (TestFloatingWithoutSinkFuncClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = test_floating_without_sink_func_finalize; +} + +static void +test_floating_without_sink_func_init (TestFloatingWithoutSinkFunc *self) +{ +} + diff --git a/tests/test-floating.h b/tests/test-floating.h new file mode 100644 index 0000000..e53df32 --- /dev/null +++ b/tests/test-floating.h @@ -0,0 +1,60 @@ +/* + * test-floating.h - Header for TestFloatingWithSinkFunc and TestFloatingWithoutSinkFunc + * Copyright (C) 2010 Collabora Ltd. + * + * 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 + */ + +#include + +/* TestFloatingWithSinkFunc */ + +typedef struct { + GInitiallyUnowned parent; +} TestFloatingWithSinkFunc; + +typedef struct { + GInitiallyUnownedClass parent_class; +} TestFloatingWithSinkFuncClass; + +#define TEST_TYPE_FLOATING_WITH_SINK_FUNC (test_floating_with_sink_func_get_type()) +#define TEST_FLOATING_WITH_SINK_FUNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_FLOATING_WITH_SINK_FUNC, TestFloatingWithSinkFunc)) +#define TEST_FLOATING_WITH_SINK_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_FLOATING_WITH_SINK_FUNC, TestFloatingWithSinkFuncClass)) +#define TEST_IS_FLOATING_WITH_SINK_FUNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_FLOATING_WITH_SINK_FUNC)) +#define TEST_IS_FLOATING_WITH_SINK_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TEST_TYPE_FLOATING_WITH_SINK_FUNC)) +#define TEST_FLOATING_WITH_SINK_FUNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TEST_TYPE_FLOATING_WITH_SINK_FUNC, TestFloatingWithSinkFuncClass)) + +GType test_floating_with_sink_func_get_type (void); +void sink_test_floating_with_sink_func (GObject *object); + +/* TestFloatingWithoutSinkFunc */ + +typedef struct { + GInitiallyUnowned parent; +} TestFloatingWithoutSinkFunc; + +typedef struct { + GInitiallyUnownedClass parent_class; +} TestFloatingWithoutSinkFuncClass; + +#define TEST_TYPE_FLOATING_WITHOUT_SINK_FUNC (test_floating_without_sink_func_get_type()) +#define TEST_FLOATING_WITHOUT_SINK_FUNC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_FLOATING_WITHOUT_SINK_FUNC, TestFloatingWithoutSinkFunc)) +#define TEST_FLOATING_WITHOUT_SINK_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_FLOATING_WITHOUT_SINK_FUNC, TestFloatingWithoutSinkFuncClass)) +#define TEST_IS_FLOATING_WITHOUT_SINK_FUNC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_FLOATING_WITHOUT_SINK_FUNC)) +#define TEST_IS_FLOATING_WITHOUT_SINK_FUNC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TEST_TYPE_FLOATING_WITHOUT_SINK_FUNC)) +#define TEST_FLOATING_WITHOUT_SINK_FUNC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TEST_TYPE_FLOATING_WITHOUT_SINK_FUNC, TestFloatingWithoutSinkFuncClass)) + +GType test_floating_without_sink_func_get_type (void); + diff --git a/tests/test-thread.c b/tests/test-thread.c new file mode 100644 index 0000000..0f5b909 --- /dev/null +++ b/tests/test-thread.c @@ -0,0 +1,64 @@ +#include "test-thread.h" + +enum +{ + /* methods */ + SIGNAL_EMIT_SIGNAL, + SIGNAL_FROM_THREAD, + LAST_SIGNAL +}; + +static guint test_thread_signals[LAST_SIGNAL] = { 0 }; + +typedef enum { + TEST_THREAD_A, + TEST_THREAD_B +} ThreadEnumType; + +static GType +test_thread_enum_get_type (void) +{ + static GType enum_type = 0; + static GEnumValue enum_values[] = { + {TEST_THREAD_A, "TEST_THREAD_A", "a as in apple"}, + {0, NULL, NULL}, + }; + + if (!enum_type) { + enum_type = + g_enum_register_static ("TestThreadEnum", enum_values); + } + return enum_type; +} + +G_DEFINE_TYPE(TestThread, test_thread, G_TYPE_OBJECT); + +static void +other_thread_cb (TestThread *self) +{ + g_signal_emit_by_name (self, "from-thread", 0, NULL); + g_thread_exit (0); +} + +static void +test_thread_emit_signal (TestThread *self) +{ + self->thread = g_thread_create ((GThreadFunc)other_thread_cb, + self, TRUE, NULL); +} + +static void test_thread_init (TestThread *self) {} +static void test_thread_class_init (TestThreadClass *klass) +{ + test_thread_signals[SIGNAL_EMIT_SIGNAL] = + g_signal_new ("emit-signal", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (TestThreadClass, emit_signal), + NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + test_thread_signals[SIGNAL_FROM_THREAD] = + g_signal_new ("from-thread", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (TestThreadClass, from_thread), + NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, + test_thread_enum_get_type ()); + + klass->emit_signal = test_thread_emit_signal; +} diff --git a/tests/test-thread.h b/tests/test-thread.h new file mode 100644 index 0000000..db12fe4 --- /dev/null +++ b/tests/test-thread.h @@ -0,0 +1,22 @@ +#include + +typedef struct { + GObject parent; + GThread *thread; +} TestThread; + +typedef struct { + GObjectClass parent_class; + void (*emit_signal) (TestThread *sink); + void (*from_thread) (TestThread *sink); +} TestThreadClass; + +GType test_thread_get_type (void); + +#define TEST_TYPE_THREAD (test_thread_get_type()) +#define TEST_THREAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_THREAD, TestTHREAD)) +#define TEST_THREAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_THREAD, TestTHREADClass)) +#define TEST_IS_THREAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_THREAD)) +#define TEST_IS_THREAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TEST_TYPE_THREAD)) +#define TEST_THREAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TEST_TYPE_THREAD, TestTHREADClass)) + diff --git a/tests/test-unknown.c b/tests/test-unknown.c new file mode 100644 index 0000000..85aba73 --- /dev/null +++ b/tests/test-unknown.c @@ -0,0 +1,113 @@ +#include "test-unknown.h" + +enum { + PROP_SOME_PROPERTY = 1, +}; + + +static void +test_interface_base_init (gpointer g_iface) +{ + static gboolean initialized = FALSE; + + if (!initialized) + { + g_object_interface_install_property (g_iface, + g_param_spec_string ("some-property", + "some-property", + "A simple test property", + NULL, + G_PARAM_READWRITE)); + initialized = TRUE; + } +} + + +GType +test_interface_get_type (void) +{ + static GType gtype = 0; + + if (!gtype) + { + static const GTypeInfo info = + { + sizeof (TestInterfaceIface), /* class_size */ + test_interface_base_init, /* base_init */ + NULL, /* base_finalize */ + NULL, + NULL, /* class_finalize */ + NULL, /* class_data */ + 0, + 0, /* n_preallocs */ + NULL + }; + + gtype = + g_type_register_static (G_TYPE_INTERFACE, "TestInterface", + &info, 0); + + g_type_interface_add_prerequisite (gtype, G_TYPE_OBJECT); + } + + return gtype; +} + +void test_unknown_iface_method (TestInterface *iface) +{ +} + +static void +test_unknown_test_interface_init (TestInterfaceIface *iface) +{ + iface->iface_method = test_unknown_iface_method; +} + +G_DEFINE_TYPE_WITH_CODE (TestUnknown, test_unknown, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (TEST_TYPE_INTERFACE, + test_unknown_test_interface_init)); + +static void test_unknown_init (TestUnknown *self) {} + + +static void +test_unknown_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + +} + +static void +test_unknown_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + +} + +static void test_unknown_class_init (TestUnknownClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass*) klass; + + gobject_class->get_property = test_unknown_get_property; + gobject_class->set_property = test_unknown_set_property; + + + g_object_class_install_property (G_OBJECT_CLASS (klass), + PROP_SOME_PROPERTY, + g_param_spec_string ("some-property", + "some-property", + "A simple test property", + NULL, + G_PARAM_READWRITE)); +} + +void test_interface_iface_method (TestInterface *instance) +{ + TestInterfaceIface *iface = TEST_INTERFACE_GET_IFACE (instance); + + (* iface->iface_method) (instance); +} diff --git a/tests/test-unknown.h b/tests/test-unknown.h new file mode 100644 index 0000000..e0f51a2 --- /dev/null +++ b/tests/test-unknown.h @@ -0,0 +1,40 @@ +#include + +/* TestUnknown */ + +typedef struct { + GObject parent; +} TestUnknown; + +typedef struct { + GObjectClass parent_class; +} TestUnknownClass; + +#define TEST_TYPE_UNKNOWN (test_unknown_get_type()) +#define TEST_UNKNOWN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_UNKNOWN, TestUnknown)) +#define TEST_UNKNOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_UNKNOWN, TestUnknownClass)) +#define TEST_IS_UNKNOWN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_UNKNOWN)) +#define TEST_IS_UNKNOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TEST_TYPE_UNKNOWN)) +#define TEST_UNKNOWN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TEST_TYPE_UNKNOWN, TestUnknownClass)) + +GType test_unknown_get_type (void); + +/* TestInterface */ +typedef struct _TestInterface TestInterface; +typedef struct _TestInterfaceIface TestInterfaceIface; + +struct _TestInterfaceIface +{ + GTypeInterface g_iface; + /* VTable */ + void (* iface_method) (TestInterface *iface); +}; + +#define TEST_TYPE_INTERFACE (test_interface_get_type ()) +#define TEST_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_INTERFACE, TestInterface)) +#define TEST_IS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_INTERFACE)) +#define TEST_INTERFACE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_INTERFACE, TestInterfaceIface)) + +GType test_interface_get_type (void); + +void test_interface_iface_method (TestInterface *iface); diff --git a/tests/test_gicon.py b/tests/test_gicon.py new file mode 100644 index 0000000..5ce7ece --- /dev/null +++ b/tests/test_gicon.py @@ -0,0 +1,111 @@ +# -*- Mode: Python -*- + +import os +import unittest + +from common import gio, glib + + +class TestIcon(unittest.TestCase): + def test_eq(self): + self.assertEquals(gio.FileIcon(gio.File('foo.png')), + gio.FileIcon(gio.File('foo.png'))) + self.assertEquals(gio.ThemedIcon('foo'), + gio.ThemedIcon('foo')) + + self.assertNotEqual(gio.FileIcon(gio.File('foo.png')), + gio.FileIcon(gio.File('bar.png'))) + self.assertNotEquals(gio.ThemedIcon('foo'), + gio.ThemedIcon('bar')) + self.assertNotEquals(gio.FileIcon(gio.File('foo.png')), + gio.ThemedIcon('foo')) + + def test_hash(self): + self.assertEquals(hash(gio.FileIcon(gio.File('foo.png'))), + hash(gio.FileIcon(gio.File('foo.png')))) + self.assertEquals(hash(gio.ThemedIcon('foo')), + hash(gio.ThemedIcon('foo'))) + +class TestLoadableIcon(unittest.TestCase): + def setUp(self): + self.file = open('temp.svg', 'w') + self.svg = ('' + '' + '') + self.file.write(self.svg) + self.file.close() + self.icon = gio.FileIcon(gio.File('temp.svg')) + + def tearDown(self): + if os.path.exists('temp.svg'): + os.unlink('temp.svg') + + def test_load(self): + stream, type = self.icon.load() + try: + self.assert_(isinstance(stream, gio.InputStream)) + self.assertEquals(self.svg, stream.read()) + finally: + stream.close() + + def test_load_async(self): + def callback(icon, result): + try: + stream, type = icon.load_finish(result) + self.assert_(isinstance(stream, gio.InputStream)) + self.assertEquals(self.svg, stream.read()) + finally: + loop.quit() + stream.close() + + self.icon.load_async(callback) + + loop = glib.MainLoop() + loop.run() + +class TestFileIcon(unittest.TestCase): + def test_constructor(self): + file = gio.File('foo.png') + self.assert_(file is gio.FileIcon(file).get_file()) + +class TestThemedIcon(unittest.TestCase): + def setUp(self): + self.icon = gio.ThemedIcon("open") + + def test_constructor(self): + have_use_default_fallbacks = ('use_default_fallbacks' + in gio.ThemedIcon.props.__members__) + icon = gio.ThemedIcon('foo') + self.assertEquals(['foo'], icon.props.names) + self.assert_(not have_use_default_fallbacks + or not icon.props.use_default_fallbacks) + + icon = gio.ThemedIcon(['foo', 'bar', 'baz']) + self.assertEquals(['foo', 'bar', 'baz'], icon.props.names) + self.assert_(not have_use_default_fallbacks + or not icon.props.use_default_fallbacks) + + icon = gio.ThemedIcon('xxx-yyy-zzz', True) + self.assertEquals(['xxx-yyy-zzz', 'xxx-yyy', 'xxx'], icon.props.names) + self.assert_(not have_use_default_fallbacks + or icon.props.use_default_fallbacks) + + def test_constructor_illegals(self): + self.assertRaises(TypeError, lambda: gio.ThemedIcon(42)) + self.assertRaises(TypeError, lambda: gio.ThemedIcon(['foo', 42, 'bar'])) + + def test_get_names(self): + self.assertEquals(self.icon.get_names(), ['open']) + + def test_append_name(self): + self.assertEquals(self.icon.get_names(), ['open']) + self.icon.append_name('close') + self.assertEquals(self.icon.get_names(), ['open', 'close']) + +class TestEmblemedIcon(unittest.TestCase): + def test_emblemed_icon(self): + icon = gio.FileIcon(gio.File('foo.png')) + emblem = gio.Emblem(icon) + emblemed = gio.EmblemedIcon(icon, emblem) + self.assertEquals(emblemed.get_emblems()[0], emblem) diff --git a/tests/test_gio.py b/tests/test_gio.py new file mode 100644 index 0000000..feafc70 --- /dev/null +++ b/tests/test_gio.py @@ -0,0 +1,1137 @@ +# -*- Mode: Python -*- + +import os +import unittest + +from common import gio, glib + + +class TestFile(unittest.TestCase): + def setUp(self): + self._f = open("file.txt", "w+") + self.file = gio.File("file.txt") + + def tearDown(self): + self._f.close() + if os.path.exists('file.txt'): + os.unlink("file.txt") + + def testReadAsync(self): + self._f.write("testing") + self._f.seek(0) + + def callback(file, result): + try: + stream = file.read_finish(result) + self.failUnless(isinstance(stream, gio.InputStream)) + self.assertEquals(stream.read(), "testing") + finally: + loop.quit() + + self.file.read_async(callback) + + loop = glib.MainLoop() + loop.run() + + def testAppendToAsync(self): + self._f.write("append_to ") + self._f.close() + + def callback(file, result): + try: + stream = file.append_to_finish(result) + self.failUnless(isinstance(stream, gio.OutputStream)) + w = stream.write("testing") + cont, leng, etag = self.file.load_contents() + self.assertEqual(cont, "append_to testing") + finally: + loop.quit() + + self.file.append_to_async(callback, gio.FILE_CREATE_NONE, + glib.PRIORITY_HIGH) + + loop = glib.MainLoop() + loop.run() + + def testAppendToAsyncNoargs(self): + self._f.write("append_to ") + self._f.close() + + def callback(file, result): + try: + stream = file.append_to_finish(result) + self.failUnless(isinstance(stream, gio.OutputStream)) + w = stream.write("testing") + cont, leng, etag = self.file.load_contents() + self.assertEqual(cont, "append_to testing") + finally: + loop.quit() + + self.file.append_to_async(callback) + + loop = glib.MainLoop() + loop.run() + + def testCreateAsync(self): + def callback(file, result): + try: + stream = file.create_finish(result) + self.failUnless(isinstance(stream, gio.OutputStream)) + w = stream.write("testing") + cont, leng, etag = file.load_contents() + self.assertEqual(cont, "testing") + finally: + if os.path.exists('temp.txt'): + os.unlink("temp.txt") + loop.quit() + + gfile = gio.File("temp.txt") + gfile.create_async(callback, gio.FILE_CREATE_NONE, + glib.PRIORITY_HIGH) + + loop = glib.MainLoop() + loop.run() + + def testCreateReadWriteAsync(self): + def callback(file, result): + try: + iostream = file.create_readwrite_finish(result) + self.failUnless(isinstance(iostream, gio.FileIOStream)) + + ostream = iostream.get_output_stream() + self.failUnless(isinstance(ostream, gio.OutputStream)) + + w = ostream.write("testing") + cont, leng, etag = file.load_contents() + self.assertEqual(cont, "testing") + finally: + if os.path.exists('temp.txt'): + os.unlink("temp.txt") + loop.quit() + + gfile = gio.File("temp.txt") + gfile.create_readwrite_async(callback, gio.FILE_CREATE_NONE, + glib.PRIORITY_HIGH) + + loop = glib.MainLoop() + loop.run() + + def testCreateAsyncNoargs(self): + def callback(file, result): + try: + stream = file.create_finish(result) + self.failUnless(isinstance(stream, gio.OutputStream)) + w = stream.write("testing") + cont, leng, etag = file.load_contents() + self.assertEqual(cont, "testing") + finally: + if os.path.exists('temp.txt'): + os.unlink("temp.txt") + loop.quit() + + gfile = gio.File("temp.txt") + gfile.create_async(callback) + + loop = glib.MainLoop() + loop.run() + + def testReplaceAsync(self): + self._f.write("testing") + self._f.close() + + def callback(file, result): + try: + stream = file.replace_finish(result) + self.failUnless(isinstance(stream, gio.OutputStream)) + stream.write("some new string") + stream.close() + cont, leng, etag = file.load_contents() + self.assertEqual(cont, "some new string") + finally: + loop.quit() + + + self.file.replace_async(callback, None, True, gio.FILE_CREATE_NONE, + glib.PRIORITY_HIGH) + + loop = glib.MainLoop() + loop.run() + + def testReplaceAsyncNoargs(self): + self._f.write("testing") + self._f.close() + + def callback(file, result): + try: + stream = file.replace_finish(result) + self.failUnless(isinstance(stream, gio.OutputStream)) + stream.write("some new string") + stream.close() + cont, leng, etag = file.load_contents() + self.assertEqual(cont, "some new string") + finally: + loop.quit() + + + self.file.replace_async(callback) + + loop = glib.MainLoop() + loop.run() + + def testReadAsyncError(self): + self.assertRaises(TypeError, self.file.read_async) + self.assertRaises(TypeError, self.file.read_async, "foo", "bar") + self.assertRaises(TypeError, self.file.read_async, "foo", + priority="bar") + self.assertRaises(TypeError, self.file.read_async, "foo", + priority="bar") + self.assertRaises(TypeError, self.file.read_async, "foo", + priority=1, cancellable="bar") + self.assertRaises(TypeError, self.file.read_async, "foo", 1, "bar") + + def testConstructor(self): + for gfile in [gio.File("/"), + gio.File("file:///"), + gio.File(uri="file:///"), + gio.File(path="/"), + gio.File(u"/"), + gio.File(path=u"/")]: + self.failUnless(isinstance(gfile, gio.File)) + self.assertEquals(gfile.get_path(), "/") + self.assertEquals(gfile.get_uri(), "file:///") + + def testConstructorError(self): + self.assertRaises(TypeError, gio.File) + self.assertRaises(TypeError, gio.File, 1) + self.assertRaises(TypeError, gio.File, "foo", "bar") + self.assertRaises(TypeError, gio.File, foo="bar") + self.assertRaises(TypeError, gio.File, uri=1) + self.assertRaises(TypeError, gio.File, path=1) + + def testLoadContents(self): + self._f.write("testing load_contents") + self._f.seek(0) + c = gio.Cancellable() + cont, leng, etag = self.file.load_contents(cancellable=c) + self.assertEqual(cont, "testing load_contents") + self.assertEqual(leng, 21) + self.assertNotEqual(etag, '') + + def testLoadContentsAsync(self): + self._f.write("testing load_contents_async") + self._f.seek(0) + + def callback(contents, result): + try: + cont, leng, etag = contents.load_contents_finish(result) + self.assertEqual(cont, "testing load_contents_async") + self.assertEqual(leng, 27) + self.assertNotEqual(etag, '') + finally: + loop.quit() + + canc = gio.Cancellable() + self.file.load_contents_async(callback, cancellable=canc) + + loop = glib.MainLoop() + loop.run() + + def testQueryInfoAsync(self): + def callback(file, result): + try: + info = file.query_info_finish(result) + self.failUnless(isinstance(info, gio.FileInfo)) + self.failUnless(info.get_name(), "file.txt") + finally: + loop.quit() + + self.file.query_info_async("standard", callback) + + loop = glib.MainLoop() + loop.run() + + def testMountMountable(self): + gfile = gio.File('localtest:') + def unmount_done(mount, result): + try: + retval = mount.unmount_finish(result) + self.failUnless(retval) + finally: + loop.quit() + + def mount_enclosing_volume_done(gfile, result): + try: + try: + retval = gfile.mount_enclosing_volume_finish(result) + except gio.Error, e: + # If we run the tests too fast + if e.code == gio.ERROR_ALREADY_MOUNTED: + print ('WARNING: testfile is already mounted, ' + 'skipping test') + loop.quit() + return + raise + self.failUnless(retval) + finally: + try: + mount = gfile.find_enclosing_mount() + except gio.Error: + loop.quit() + return + mount.unmount(unmount_done) + + mount_operation = gio.MountOperation() + gfile.mount_enclosing_volume(mount_operation, + mount_enclosing_volume_done) + + loop = glib.MainLoop() + loop.run() + + def testCopy(self): + if os.path.exists('copy.txt'): + os.unlink("copy.txt") + + source = gio.File('file.txt') + destination = gio.File('copy.txt') + try: + retval = source.copy(destination) + self.failUnless(retval) + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + finally: + os.unlink("copy.txt") + + self.called = False + def callback(current, total): + self.called = True + source = gio.File('file.txt') + destination = gio.File('copy.txt') + try: + retval = source.copy(destination, callback) + self.failUnless(retval) + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + self.failUnless(self.called) + finally: + os.unlink("copy.txt") + + def test_copy_async(self): + if os.path.exists('copy.txt'): + os.unlink("copy.txt") + + source = gio.File('file.txt') + destination = gio.File('copy.txt') + + def copied(source_, result): + try: + self.assert_(source_ is source) + self.failUnless(source_.copy_finish(result)) + finally: + loop.quit() + + def progress(current, total): + self.assert_(isinstance(current, long)) + self.assert_(isinstance(total, long)) + self.assert_(0 <= current <= total) + + try: + loop = glib.MainLoop() + source.copy_async(destination, copied, progress_callback = progress) + loop.run() + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + finally: + os.unlink("copy.txt") + + # See bug 546591. + def test_copy_progress(self): + source = gio.File('file.txt') + destination = gio.File('copy.txt') + + def progress(current, total): + self.assert_(isinstance(current, long)) + self.assert_(isinstance(total, long)) + self.assert_(0 <= current <= total) + + try: + retval = source.copy(destination, + flags=gio.FILE_COPY_OVERWRITE, + progress_callback=progress) + self.failUnless(retval) + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + finally: + os.unlink("copy.txt") + + def testMove(self): + if os.path.exists('move.txt'): + os.unlink("move.txt") + + source = gio.File('file.txt') + destination = gio.File('move.txt') + retval = source.move(destination) + self.failUnless(retval) + + self.failIf(os.path.exists('file.txt')) + self.failUnless(os.path.exists('move.txt')) + + self.called = False + def callback(current, total): + self.called = True + source = gio.File('move.txt') + destination = gio.File('move-2.txt') + try: + retval = source.move(destination, callback) + self.failUnless(retval) + + self.failIf(os.path.exists('move.txt')) + self.failUnless(os.path.exists('move-2.txt')) + self.failUnless(self.called) + finally: + os.unlink("move-2.txt") + + def testInfoList(self): + infolist = self.file.query_settable_attributes() + for info in infolist: + if info.name == "time::modified": + self.assertEqual(info.type, gio.FILE_ATTRIBUTE_TYPE_UINT64) + self.assertEqual(info.name, "time::modified") + self.assertEqual(info.flags, + gio.FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED | + gio.FILE_ATTRIBUTE_INFO_COPY_WITH_FILE) + + def testQueryWritableNamespaces(self): + infolist = self.file.query_writable_namespaces() + for info in infolist: + if info.name == "xattr": + self.assertEqual(info.type, gio.FILE_ATTRIBUTE_TYPE_STRING) + + def testSetAttribute(self): + self._f.write("testing attributes") + self._f.seek(0) + infolist = self.file.query_settable_attributes() + + self.assertNotEqual(len(infolist), 0) + + for info in infolist: + if info.name == "time::modified-usec": + ret = self.file.set_attribute("time::modified-usec", + gio.FILE_ATTRIBUTE_TYPE_UINT32, + 10, gio.FILE_QUERY_INFO_NONE) + self.assertEqual(ret, True) + + def testSetAttributesAsync(self): + def callback(gfile, result): + try: + info = gfile.set_attributes_finish(result) + usec = info.get_attribute_uint32("time::modified-usec") + self.assertEqual(usec, 10) + finally: + loop.quit() + + info = gio.FileInfo() + info.set_attribute_uint32("time::modified-usec", 10) + + canc = gio.Cancellable() + self.file.set_attributes_async(info, callback) + + loop = glib.MainLoop() + loop.run() + + def testReplaceContents(self): + self.file.replace_contents("testing replace_contents") + cont, leng, etag = self.file.load_contents() + self.assertEqual(cont, "testing replace_contents") + + caught = False + try: + self.file.replace_contents("this won't work", etag="wrong") + except gio.Error, e: + self.assertEqual(e.code, gio.ERROR_WRONG_ETAG) + caught = True + self.failUnless(caught) + + self.file.replace_contents("testing replace_contents again", etag=etag) + cont, leng, etag = self.file.load_contents() + self.assertEqual(cont, "testing replace_contents again") + + self.file.replace_contents("testing replace_contents yet again", etag=None) + cont, leng, etag = self.file.load_contents() + self.assertEqual(cont, "testing replace_contents yet again") + + def testReplaceContentsAsync(self): + + def callback(contents, result): + try: + newetag = contents.replace_contents_finish(result) + cont, leng, etag = self.file.load_contents() + self.assertEqual(cont, "testing replace_contents_async") + self.assertEqual(leng, 30) + self.assertEqual(etag, newetag) + self.assertNotEqual(newetag, '') + finally: + loop.quit() + + canc = gio.Cancellable() + self.file.replace_contents_async("testing replace_contents_async", callback, cancellable=canc) + + loop = glib.MainLoop() + loop.run() + + def test_eq(self): + self.assertEqual(gio.File('foo'), + gio.File('foo')) + self.assertNotEqual(gio.File('foo'), + gio.File('bar')) + + def test_hash(self): + self.assertEquals(hash(gio.File('foo')), + hash(gio.File('foo'))) + + def testSetDisplayNameAsync(self): + def callback(gfile, result): + try: + new_gfile = gfile.set_display_name_finish(result) + new_name = new_gfile.get_basename() + self.assertEqual(new_name, "new.txt") + deleted = new_gfile.delete() + self.assertEqual(deleted, True) + finally: + loop.quit() + + canc = gio.Cancellable() + self.file.set_display_name_async("new.txt", callback, cancellable=canc) + + loop = glib.MainLoop() + loop.run() + +class TestGFileEnumerator(unittest.TestCase): + def setUp(self): + self.file = gio.File(".") + + def testEnumerateChildren(self): + enumerator = self.file.enumerate_children( + "standard::*", gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) + for file_info in enumerator: + if file_info.get_name() == 'test_gio.py': + break + else: + raise AssertionError + + def testEnumerateChildrenAsync(self): + def callback(gfile, result): + try: + for file_info in gfile.enumerate_children_finish(result): + if file_info.get_name() == 'test_gio.py': + break + else: + raise AssertionError + finally: + loop.quit() + + self.file.enumerate_children_async( + "standard::*", callback) + loop = glib.MainLoop() + loop.run() + + def testNextFilesAsync(self): + def callback(enumerator, result): + try: + for file_info in enumerator.next_files_finish(result): + if file_info.get_name() == 'test_gio.py': + break + else: + raise AssertionError + finally: + loop.quit() + + enumerator = self.file.enumerate_children( + "standard::*", gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) + enumerator.next_files_async(1000, callback) + loop = glib.MainLoop() + loop.run() + + def testCloseFilesAsync(self): + def callback(enumerator, result): + try: + enumerator.close_finish(result) + finally: + loop.quit() + + enumerator = self.file.enumerate_children( + "standard::*", gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS) + + enumerator.close_async(callback) + + loop = glib.MainLoop() + loop.run() + + +class TestInputStream(unittest.TestCase): + def setUp(self): + self._f = open("inputstream.txt", "w+") + self._f.write("testing") + self._f.seek(0) + self.stream = gio.unix.InputStream(self._f.fileno(), False) + + def tearDown(self): + self._f.close() + os.unlink("inputstream.txt") + + def testRead(self): + self.assertEquals(self.stream.read(), "testing") + + self.stream = gio.MemoryInputStream() + self.assertEquals(self.stream.read(), '') + + self.stream = gio.MemoryInputStream() + some_data = open("test_gio.py", "rb").read() + self.stream.add_data(some_data) + self.assertEquals(self.stream.read(), some_data) + + stream = gio.MemoryInputStream() + stream.add_data(some_data) + self.assertEquals(self._read_in_loop(stream, + lambda: stream.read(50), + 50), + some_data) + + def testSkip(self): + self.stream.skip(2) + res = self.stream.read() + self.assertEqual(res, "sting") + + def testSkipAsync(self): + def callback(stream, result): + try: + size = stream.skip_finish(result) + self.assertEqual(size, 2) + res = stream.read() + self.assertEqual(res, "sting") + finally: + loop.quit() + + self.stream.skip_async(2, callback) + + loop = glib.MainLoop() + loop.run() + + def test_read_part(self): + self.assertEquals(self._read_in_loop(self.stream, + lambda: self.stream.read_part()), + 'testing') + + stream = gio.MemoryInputStream() + some_data = open('test_gio.py', 'rb').read() + stream.add_data(some_data) + self.assertEquals(self._read_in_loop(stream, + lambda: stream.read_part(50), + 50), + some_data) + + def _read_in_loop(self, stream, reader, size_limit=0): + read_data = '' + while True: + read_part = reader() + if read_part: + read_data += read_part + if size_limit > 0: + self.assert_(len(read_part) <= size_limit, + '%d <= %d' % (len(read_part), size_limit)) + else: + return read_data + + def testReadAsync(self): + def callback(stream, result): + self.assertEquals(result.get_op_res_gssize(), 7) + try: + data = stream.read_finish(result) + self.assertEquals(data, "testing") + stream.close() + finally: + loop.quit() + + self.stream.read_async(7, callback) + + loop = glib.MainLoop() + loop.run() + + def testReadAsyncError(self): + self.count = 0 + def callback(stream, result): + try: + self.count += 1 + if self.count == 1: + return + self.assertRaises(gio.Error, stream.read_finish, result) + finally: + loop.quit() + + self.stream.read_async(10240, callback) + self.stream.read_async(10240, callback) + + loop = glib.MainLoop() + loop.run() + + self.assertEquals(self.count, 2) + + self.assertRaises(TypeError, self.stream.read_async) + self.assertRaises(TypeError, self.stream.read_async, "foo") + self.assertRaises(TypeError, self.stream.read_async, 1024, "bar") + self.assertRaises(TypeError, self.stream.read_async, 1024, + priority="bar") + self.assertRaises(TypeError, self.stream.read_async, 1024, + priority="bar") + self.assertRaises(TypeError, self.stream.read_async, 1024, + priority=1, cancellable="bar") + self.assertRaises(TypeError, self.stream.read_async, 1024, 1, "bar") + + + # FIXME: this makes 'make check' freeze + def _testCloseAsync(self): + def callback(stream, result): + try: + self.failUnless(stream.close_finish(result)) + finally: + loop.quit() + + self.stream.close_async(callback) + + loop = glib.MainLoop() + loop.run() + + +class TestDataInputStream(unittest.TestCase): + def setUp(self): + self.base_stream = gio.MemoryInputStream() + self.data_stream = gio.DataInputStream(self.base_stream) + + def test_read_line(self): + self.base_stream.add_data('foo\nbar\n\nbaz') + self.assertEquals('foo', self.data_stream.read_line()) + self.assertEquals('bar', self.data_stream.read_line()) + self.assertEquals('', self.data_stream.read_line()) + self.assertEquals('baz', self.data_stream.read_line()) + + def test_read_line_async(self): + def do_read_line_async(): + loop = glib.MainLoop() + line = [] + + def callback(stream, result): + try: + line.append(stream.read_line_finish(result)) + finally: + loop.quit() + + self.data_stream.read_line_async(callback) + loop.run() + return line[0] + + self.base_stream.add_data('foo\nbar\n\nbaz') + self.assertEquals('foo', do_read_line_async()) + self.assertEquals('bar', do_read_line_async()) + self.assertEquals('', do_read_line_async()) + self.assertEquals('baz', do_read_line_async()) + + def test_read_until(self): + self.base_stream.add_data('sentence.end of line\nthe rest') + self.assertEquals('sentence', self.data_stream.read_until('.!?')) + self.assertEquals('end of line', self.data_stream.read_until('\n\r')) + self.assertEquals('the rest', self.data_stream.read_until('#$%^&')) + + def test_read_until_async(self): + def do_read_until_async(stop_chars): + loop = glib.MainLoop() + data = [] + + def callback(stream, result): + try: + data.append(stream.read_until_finish(result)) + finally: + loop.quit() + + self.data_stream.read_until_async(stop_chars, callback) + loop.run() + return data[0] + + # Note the weird difference between synchronous and + # asynchronous version. See bug #584284. + self.base_stream.add_data('sentence.end of line\nthe rest') + self.assertEquals('sentence', do_read_until_async('.!?')) + self.assertEquals('.end of line', do_read_until_async('\n\r')) + self.assertEquals('\nthe rest', do_read_until_async('#$%^&')) + + +class TestMemoryInputStream(unittest.TestCase): + def setUp(self): + self.stream = gio.MemoryInputStream() + + def test_add_data(self): + self.stream.add_data('foobar') + self.assertEquals('foobar', self.stream.read()) + + self.stream.add_data('ham ') + self.stream.add_data(None) + self.stream.add_data('spam') + self.assertEquals('ham spam', self.stream.read()) + + def test_new_from_data(self): + stream = gio.memory_input_stream_new_from_data('spam') + self.assertEquals('spam', stream.read()) + + +class TestOutputStream(unittest.TestCase): + def setUp(self): + self._f = open("outputstream.txt", "w") + self.stream = gio.unix.OutputStream(self._f.fileno(), False) + + def tearDown(self): + self._f.close() + os.unlink("outputstream.txt") + + def testWrite(self): + self.stream.write("testing") + self.stream.close() + self.failUnless(os.path.exists("outputstream.txt")) + self.assertEquals(open("outputstream.txt").read(), "testing") + + def test_write_part(self): + stream = gio.MemoryOutputStream() + some_data = open('test_gio.py', 'rb').read() + buffer = some_data + + # In fact this makes only one looping (memory stream is fast, + # write_part behaves just like write), but let's still be + # complete. + while buffer: + written = stream.write_part(buffer) + if written == len(buffer): + break + else: + buffer = buffer[written:] + + self.assertEquals(stream.get_contents(), some_data) + + def testWriteAsync(self): + def callback(stream, result): + self.assertEquals(result.get_op_res_gssize(), 7) + try: + self.assertEquals(stream.write_finish(result), 7) + self.failUnless(os.path.exists("outputstream.txt")) + self.assertEquals(open("outputstream.txt").read(), "testing") + finally: + loop.quit() + + self.stream.write_async("testing", callback) + + loop = glib.MainLoop() + loop.run() + + def testWriteAsyncError(self): + def callback(stream, result): + self.assertEquals(result.get_op_res_gssize(), 0) + try: + self.assertRaises(gio.Error, stream.write_finish, result) + finally: + loop.quit() + + self.stream.close() + self.stream.write_async("testing", callback) + + loop = glib.MainLoop() + loop.run() + + self.assertRaises(TypeError, self.stream.write_async) + self.assertRaises(TypeError, self.stream.write_async, 1138) + self.assertRaises(TypeError, self.stream.write_async, "foo", "bar") + self.assertRaises(TypeError, self.stream.write_async, "foo", + priority="bar") + self.assertRaises(TypeError, self.stream.write_async, "foo", + priority="bar") + self.assertRaises(TypeError, self.stream.write_async, "foo", + priority=1, cancellable="bar") + self.assertRaises(TypeError, self.stream.write_async, "foo", 1, "bar") + + # FIXME: this makes 'make check' freeze + def _testCloseAsync(self): + def callback(stream, result): + try: + self.failUnless(stream.close_finish(result)) + finally: + loop.quit() + + self.stream.close_async(callback) + + loop = glib.MainLoop() + loop.run() + + def testFlushAsync(self): + def callback(stream, result): + try: + self.failUnless(stream.flush_finish(result)) + finally: + loop.quit() + + self.stream.flush_async(callback) + + loop = glib.MainLoop() + loop.run() + + def testSpliceAsync(self): + _f = open("stream.txt", "w+") + _f.write("testing") + _f.seek(0) + instream = gio.unix.InputStream(_f.fileno(), False) + + def callback(stream, result): + try: + size = stream.splice_finish(result) + self.assertEqual(size, 7) + + finally: + os.unlink("stream.txt") + loop.quit() + + self.stream.splice_async(instream, callback) + + loop = glib.MainLoop() + loop.run() + +class TestMemoryOutputStream(unittest.TestCase): + def setUp(self): + self.stream = gio.MemoryOutputStream() + + def test_get_contents(self): + self.stream.write('foobar') + self.assertEquals('foobar', self.stream.get_contents()) + + self.stream.write('baz') + self.assertEquals('foobarbaz', self.stream.get_contents()) + + +class TestVolumeMonitor(unittest.TestCase): + def setUp(self): + self.monitor = gio.volume_monitor_get() + + def testGetConnectedDrives(self): + drives = self.monitor.get_connected_drives() + self.failUnless(isinstance(drives, list)) + + def testGetVolumes(self): + volumes = self.monitor.get_volumes() + self.failUnless(isinstance(volumes, list)) + + def testGetMounts(self): + mounts = self.monitor.get_mounts() + self.failUnless(isinstance(mounts, list)) + if not mounts: + return + + self.failUnless(isinstance(mounts[0], gio.Mount)) + # Bug 538601 + icon = mounts[0].get_icon() + if not icon: + return + self.failUnless(isinstance(icon, gio.Icon)) + + +class TestContentTypeGuess(unittest.TestCase): + def testFromName(self): + mime_type = gio.content_type_guess('diagram.svg') + self.assertEquals('image/svg+xml', mime_type) + + def testFromContents(self): + mime_type = gio.content_type_guess(data='') + self.assertEquals('text/html', mime_type) + + def testFromContentsUncertain(self): + mime_type, result_uncertain = gio.content_type_guess( + data='', want_uncertain=True) + self.assertEquals('text/html', mime_type) + self.assertEquals(bool, type(result_uncertain)) + + +class TestFileInfo(unittest.TestCase): + def setUp(self): + self.fileinfo = gio.File("test_gio.py").query_info("*") + + def testListAttributes(self): + attributes = self.fileinfo.list_attributes("standard") + self.failUnless(attributes) + self.failUnless('standard::name' in attributes) + + def testGetModificationTime(self): + mtime = self.fileinfo.get_modification_time() + self.assertEqual(type(mtime), float) + + def testSetModificationTime(self): + self.fileinfo.set_modification_time(1000) + mtime = self.fileinfo.get_modification_time() + self.assertEqual(mtime, 1000) + + +class TestAppInfo(unittest.TestCase): + def setUp(self): + self.appinfo = gio.AppInfo("does-not-exist") + + def testSimple(self): + self.assertEquals(self.appinfo.get_description(), + "Custom definition for does-not-exist") + + def test_eq(self): + info1 = gio.app_info_get_all()[0] + info2 = info1.dup() + self.assert_(info1 is not info2) + self.assertEquals(info1, info2) + + self.assertNotEqual(gio.app_info_get_all()[0], gio.app_info_get_all()[1]) + +class TestVfs(unittest.TestCase): + def setUp(self): + self.vfs = gio.vfs_get_default() + + def testGetSupportedURISchemes(self): + result = self.vfs.get_supported_uri_schemes() + self.failUnless(type(result), []) + +class TestVolume(unittest.TestCase): + def setUp(self): + self.monitor = gio.volume_monitor_get() + + def testVolumeEnumerate(self): + volumes = self.monitor.get_volumes() + self.failUnless(isinstance(volumes, list)) + for v in volumes: + if v is not None: + ids = v.enumerate_identifiers() + self.failUnless(isinstance(ids, list)) + for id in ids: + if id is not None: + self.failUnless(isinstance(id, str)) + +class TestFileInputStream(unittest.TestCase): + def setUp(self): + self._f = open("file.txt", "w+") + self._f.write("testing") + self._f.seek(0) + self.file = gio.File("file.txt") + + def tearDown(self): + self._f.close() + if os.path.exists('file.txt'): + os.unlink("file.txt") + + def testQueryInfoAsync(self): + def callback(stream, result): + try: + info = stream.query_info_finish(result) + self.failUnless(isinstance(info, gio.FileInfo)) + self.failUnless(info.get_attribute_uint64("standard::size"), 7) + finally: + loop.quit() + + inputstream = self.file.read() + inputstream.query_info_async("standard", callback) + + loop = glib.MainLoop() + loop.run() + +class TestFileOutputStream(unittest.TestCase): + def setUp(self): + self._f = open("file.txt", "w+") + self._f.write("testing") + self._f.seek(0) + self.file = gio.File("file.txt") + + def tearDown(self): + self._f.close() + if os.path.exists('file.txt'): + os.unlink("file.txt") + + def testQueryInfoAsync(self): + def callback(stream, result): + try: + info = stream.query_info_finish(result) + self.failUnless(isinstance(info, gio.FileInfo)) + self.failUnless(info.get_attribute_uint64("standard::size"), 7) + finally: + loop.quit() + + outputstream = self.file.append_to() + outputstream.query_info_async("standard", callback) + + loop = glib.MainLoop() + loop.run() + +class TestBufferedInputStream(unittest.TestCase): + def setUp(self): + self._f = open("buffer.txt", "w+") + self._f.write("testing") + self._f.seek(0) + stream = gio.unix.InputStream(self._f.fileno(), False) + self.buffered = gio.BufferedInputStream(stream) + + def tearDown(self): + self._f.close() + os.unlink("buffer.txt") + + def test_fill_async(self): + def callback(stream, result): + try: + size = stream.fill_finish(result) + self.failUnlessEqual(size, 4) + finally: + loop.quit() + + self.buffered.fill_async(4, callback) + + loop = glib.MainLoop() + loop.run() + +class TestIOStream(unittest.TestCase): + def setUp(self): + self.file = gio.File("file.txt") + self.iofile = self.file.create_readwrite(gio.FILE_CREATE_NONE) + + def tearDown(self): + if os.path.exists('file.txt'): + os.unlink("file.txt") + + def testIOStreamCloseAsync(self): + def callback(stream, result): + try: + self.failUnless(stream.close_finish(result)) + finally: + loop.quit() + + self.iofile.close_async(callback) + + loop = glib.MainLoop() + loop.run() + + + def testQueryInfoAsync(self): + def callback(stream, result): + try: + info = stream.query_info_finish(result) + self.failUnless(isinstance(info, gio.FileInfo)) + self.failUnless(info.get_attribute_uint64("standard::size"), 7) + finally: + loop.quit() + + ostream = self.iofile.get_output_stream() + ostream.write("testing") + + self.iofile.query_info_async("standard", callback) + + loop = glib.MainLoop() + loop.run() diff --git a/tests/test_gobject.py b/tests/test_gobject.py new file mode 100644 index 0000000..d91f3ad --- /dev/null +++ b/tests/test_gobject.py @@ -0,0 +1,29 @@ +# -*- Mode: Python -*- + +import unittest + +from common import gobject, testhelper + + +class TestGObjectAPI(unittest.TestCase): + def testGObjectModule(self): + obj = gobject.GObject() + self.assertEquals(obj.__module__, + 'gobject._gobject') + self.assertEquals(obj.__grefcount__, 1) + + +class TestFloating(unittest.TestCase): + def testFloatingWithSinkFunc(self): + obj = testhelper.FloatingWithSinkFunc() + self.assertEquals(obj.__grefcount__, 1) + + obj = gobject.new(testhelper.FloatingWithSinkFunc) + self.assertEquals(obj.__grefcount__, 1) + + def testFloatingWithoutSinkFunc(self): + obj = testhelper.FloatingWithoutSinkFunc() + self.assertEquals(obj.__grefcount__, 1) + + obj = gobject.new(testhelper.FloatingWithoutSinkFunc) + self.assertEquals(obj.__grefcount__, 1) diff --git a/tests/test_interface.py b/tests/test_interface.py new file mode 100644 index 0000000..d959791 --- /dev/null +++ b/tests/test_interface.py @@ -0,0 +1,45 @@ +import unittest + +from common import gobject, testhelper + +GUnknown = gobject.type_from_name("TestUnknown") +Unknown = GUnknown.pytype + + +class MyUnknown(Unknown, testhelper.Interface): + some_property = gobject.property(type=str) + + def __init__(self): + Unknown.__init__(self) + self.called = False + + def do_iface_method(self): + self.called = True + Unknown.do_iface_method(self) +gobject.type_register(MyUnknown) + + +class MyObject(gobject.GObject, testhelper.Interface): + some_property = gobject.property(type=str) + + def __init__(self): + gobject.GObject.__init__(self) + self.called = False + + def do_iface_method(self): + self.called = True +gobject.type_register(MyObject) + + +class TestIfaceImpl(unittest.TestCase): + + def testReImplementInterface(self): + m = MyUnknown() + m.iface_method() + self.assertEqual(m.called, True) + + def testImplementInterface(self): + m = MyObject() + m.iface_method() + self.assertEqual(m.called, True) + diff --git a/tests/test_mainloop.py b/tests/test_mainloop.py new file mode 100644 index 0000000..95e5f78 --- /dev/null +++ b/tests/test_mainloop.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +import exceptions +import os +import sys +import select +import unittest + +from common import glib + +class TestMainLoop(unittest.TestCase): + def testExceptionHandling(self): + pipe_r, pipe_w = os.pipe() + + pid = os.fork() + if pid == 0: + os.close(pipe_w) + select.select([pipe_r], [], []) + os.close(pipe_r) + os._exit(1) + + def child_died(pid, status, loop): + loop.quit() + raise Exception("deadbabe") + + loop = glib.MainLoop() + glib.child_watch_add(pid, child_died, loop) + + os.close(pipe_r) + os.write(pipe_w, "Y") + os.close(pipe_w) + + def excepthook(type, value, traceback): + assert type is exceptions.Exception + assert value.args[0] == "deadbabe" + sys.excepthook = excepthook + + got_exception = False + try: + loop.run() + except: + got_exception = True + + # + # The exception should be handled (by printing it) + # immediately on return from child_died() rather + # than here. See bug #303573 + # + sys.excepthook = sys.__excepthook__ + assert not got_exception + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_properties.py b/tests/test_properties.py new file mode 100644 index 0000000..ccfcb34 --- /dev/null +++ b/tests/test_properties.py @@ -0,0 +1,376 @@ + +import struct +import unittest + +import gobject +from gobject import GObject, GType, GEnum, new, PARAM_READWRITE, \ + PARAM_CONSTRUCT, PARAM_READABLE, PARAM_WRITABLE, PARAM_CONSTRUCT_ONLY +from gobject.constants import \ + TYPE_INT, TYPE_UINT, TYPE_LONG, \ + TYPE_ULONG, TYPE_INT64, TYPE_UINT64 +from gobject.constants import \ + G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \ + G_MAXULONG + +class PropertyObject(GObject): + normal = gobject.property(type=str) + construct = gobject.property( + type=str, + flags=PARAM_READWRITE|PARAM_CONSTRUCT, default='default') + construct_only = gobject.property( + type=str, + flags=PARAM_READWRITE|PARAM_CONSTRUCT_ONLY) + uint64 = gobject.property( + type=TYPE_UINT64, flags=PARAM_READWRITE|PARAM_CONSTRUCT) + +class TestProperties(unittest.TestCase): + def testGetSet(self): + obj = PropertyObject() + obj.props.normal = "value" + self.assertEqual(obj.props.normal, "value") + + def testListWithInstance(self): + obj = PropertyObject() + self.failUnless(hasattr(obj.props, "normal")) + + def testListWithoutInstance(self): + self.failUnless(hasattr(PropertyObject.props, "normal")) + + def testSetNoInstance(self): + def set(obj): + obj.props.normal = "foobar" + + self.assertRaises(TypeError, set, PropertyObject) + + def testIterator(self): + for obj in (PropertyObject.props, PropertyObject().props): + for pspec in obj: + gtype = GType(pspec) + self.assertEqual(gtype.parent.name, 'GParam') + self.failUnless(pspec.name in ['normal', + 'construct', + 'construct-only', + 'uint64']) + self.assertEqual(len(obj), 4) + + def testNormal(self): + obj = new(PropertyObject, normal="123") + self.assertEqual(obj.props.normal, "123") + obj.set_property('normal', '456') + self.assertEqual(obj.props.normal, "456") + obj.props.normal = '789' + self.assertEqual(obj.props.normal, "789") + + def testConstruct(self): + obj = new(PropertyObject, construct="123") + self.assertEqual(obj.props.construct, "123") + obj.set_property('construct', '456') + self.assertEqual(obj.props.construct, "456") + obj.props.construct = '789' + self.assertEqual(obj.props.construct, "789") + + def testConstructOnly(self): + obj = new(PropertyObject, construct_only="123") + self.assertEqual(obj.props.construct_only, "123") + self.assertRaises(TypeError, + setattr, obj.props, 'construct_only', '456') + self.assertRaises(TypeError, + obj.set_property, 'construct-only', '456') + + def testUint64(self): + obj = new(PropertyObject) + self.assertEqual(obj.props.uint64, 0) + obj.props.uint64 = 1L + self.assertEqual(obj.props.uint64, 1L) + obj.props.uint64 = 1 + self.assertEqual(obj.props.uint64, 1L) + + self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1L) + self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1) + + def testUInt64DefaultValue(self): + try: + class TimeControl(GObject): + __gproperties__ = { + 'time': (TYPE_UINT64, 'Time', 'Time', + 0L, (1<<64) - 1, 0L, + PARAM_READABLE) + } + except OverflowError, ex: + self.fail(str(ex)) + + def testRange(self): + # kiwi code + def max(c): + return 2 ** ((8 * struct.calcsize(c)) - 1) - 1 + def umax(c): + return 2 ** (8 * struct.calcsize(c)) - 1 + + maxint = max('i') + minint = -maxint - 1 + maxuint = umax('I') + maxlong = max('l') + minlong = -maxlong - 1 + maxulong = umax('L') + maxint64 = max('q') + minint64 = -maxint64 - 1 + maxuint64 = umax('Q') + + types = dict(int=(TYPE_INT, minint, maxint), + uint=(TYPE_UINT, 0, maxuint), + long=(TYPE_LONG, minlong, maxlong), + ulong=(TYPE_ULONG, 0, maxulong), + int64=(TYPE_INT64, minint64, maxint64), + uint64=(TYPE_UINT64, 0, maxuint64)) + + def build_gproperties(types): + d = {} + for key, (gtype, min, max) in types.items(): + d[key] = (gtype, 'blurb', 'desc', min, max, 0, + PARAM_READABLE | PARAM_WRITABLE) + return d + + class RangeCheck(GObject): + __gproperties__ = build_gproperties(types) + + def __init__(self): + self.values = {} + GObject.__init__(self) + + def do_set_property(self, pspec, value): + self.values[pspec.name] = value + + def do_get_property(self, pspec): + return self.values.get(pspec.name, pspec.default_value) + + self.assertEqual(RangeCheck.props.int.minimum, minint) + self.assertEqual(RangeCheck.props.int.maximum, maxint) + self.assertEqual(RangeCheck.props.uint.minimum, 0) + self.assertEqual(RangeCheck.props.uint.maximum, maxuint) + self.assertEqual(RangeCheck.props.long.minimum, minlong) + self.assertEqual(RangeCheck.props.long.maximum, maxlong) + self.assertEqual(RangeCheck.props.ulong.minimum, 0) + self.assertEqual(RangeCheck.props.ulong.maximum, maxulong) + self.assertEqual(RangeCheck.props.int64.minimum, minint64) + self.assertEqual(RangeCheck.props.int64.maximum, maxint64) + self.assertEqual(RangeCheck.props.uint64.minimum, 0) + self.assertEqual(RangeCheck.props.uint64.maximum, maxuint64) + + obj = RangeCheck() + for key, (gtype, min, max) in types.items(): + self.assertEqual(obj.get_property(key), + getattr(RangeCheck.props, key).default_value) + + obj.set_property(key, min) + self.assertEqual(obj.get_property(key), min) + + obj.set_property(key, max) + self.assertEqual(obj.get_property(key), max) + + + def testMulti(self): + obj = PropertyObject() + obj.set_properties(normal="foo", + uint64=7) + normal, uint64 = obj.get_properties("normal", "uint64") + self.assertEqual(normal, "foo") + self.assertEqual(uint64, 7) + +class TestProperty(unittest.TestCase): + def testSimple(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) + + self.failUnless(hasattr(C.props, 'str')) + self.failUnless(hasattr(C.props, 'int')) + self.failUnless(hasattr(C.props, 'float')) + self.failUnless(hasattr(C.props, 'long')) + + o = C() + self.assertEqual(o.str, '') + o.str = 'str' + self.assertEqual(o.str, 'str') + + self.assertEqual(o.int, 0) + o.int = 1138 + self.assertEqual(o.int, 1138) + + self.assertEqual(o.float, 0.0) + o.float = 3.14 + self.assertEqual(o.float, 3.14) + + self.assertEqual(o.long, 0L) + o.long = 100L + self.assertEqual(o.long, 100L) + + def testCustomGetter(self): + class C(gobject.GObject): + def get_prop(self): + return 'value' + prop = gobject.property(getter=get_prop) + + o = C() + self.assertEqual(o.prop, 'value') + self.assertRaises(TypeError, setattr, o, 'prop', 'xxx') + + def testCustomSetter(self): + class C(gobject.GObject): + def set_prop(self, value): + self._value = value + prop = gobject.property(setter=set_prop) + + def __init__(self): + self._value = None + gobject.GObject.__init__(self) + + o = C() + self.assertEquals(o._value, None) + o.prop = 'bar' + self.assertEquals(o._value, 'bar') + self.assertRaises(TypeError, getattr, o, 'prop') + + def testErrors(self): + self.assertRaises(TypeError, gobject.property, type='str') + self.assertRaises(TypeError, gobject.property, nick=False) + self.assertRaises(TypeError, gobject.property, blurb=False) + # this never fail while bool is a subclass of int + # >>> bool.__bases__ + # (,) + # self.assertRaises(TypeError, gobject.property, type=bool, default=0) + self.assertRaises(TypeError, gobject.property, type=bool, default='ciao mamma') + self.assertRaises(TypeError, gobject.property, type=bool) + self.assertRaises(TypeError, gobject.property, type=GEnum) + self.assertRaises(TypeError, gobject.property, type=GEnum, default=0) + self.assertRaises(TypeError, gobject.property, type=object, default=0) + self.assertRaises(TypeError, gobject.property, type=complex) + self.assertRaises(TypeError, gobject.property, flags=-10) + + def testDefaults(self): + p1 = gobject.property(type=bool, default=True) + p2 = gobject.property(type=bool, default=False) + + def testNameWithUnderscore(self): + class C(gobject.GObject): + prop_name = gobject.property(type=int) + o = C() + o.prop_name = 10 + self.assertEqual(o.prop_name, 10) + + def testRange(self): + maxint64 = 2 ** 62 - 1 + minint64 = -2 ** 62 - 1 + maxuint64 = 2 ** 63 - 1 + + 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, minint64, maxint64), + (TYPE_UINT64, 0, maxuint64), + ] + + for gtype, min, max in types: + # Normal, everything is alright + prop = gobject.property(type=gtype, minimum=min, maximum=max) + subtype = type('', (gobject.GObject,), + dict(prop=prop)) + self.assertEqual(subtype.props.prop.minimum, min) + self.assertEqual(subtype.props.prop.maximum, max) + + # Lower than minimum + self.assertRaises(TypeError, + gobject.property, type=gtype, minimum=min-1, + maximum=max) + + # Higher than maximum + self.assertRaises(TypeError, + gobject.property, type=gtype, minimum=min, + maximum=max+1) + + def testMultipleInstances(self): + class C(gobject.GObject): + prop = gobject.property(type=str, default='default') + + o1 = C() + o2 = C() + self.assertEqual(o1.prop, 'default') + self.assertEqual(o2.prop, 'default') + o1.prop = 'value' + self.assertEqual(o1.prop, 'value') + self.assertEqual(o2.prop, 'default') + + def testObjectProperty(self): + class PropertyObject(GObject): + obj = gobject.property(type=GObject) + + pobj1 = PropertyObject() + obj1_hash = hash(pobj1) + pobj2 = PropertyObject() + + pobj2.obj = pobj1 + del pobj1 + pobj1 = pobj2.obj + self.assertEqual(hash(pobj1), obj1_hash) + + def testPropertySubclass(self): + # test for #470718 + class A(GObject): + prop1 = gobject.property(type=int) + + class B(A): + prop2 = gobject.property(type=int) + + b = B() + b.prop2 = 10 + self.assertEquals(b.prop2, 10) + b.prop1 = 20 + self.assertEquals(b.prop1, 20) + + def testPropertySubclassCustomSetter(self): + # test for #523352 + class A(GObject): + def get_first(self): + return 'first' + first = gobject.property(type=str, getter=get_first) + + class B(A): + def get_second(self): + return 'second' + second = gobject.property(type=str, getter=get_second) + + a = A() + self.assertEquals(a.first, 'first') + self.assertRaises(TypeError, setattr, a, 'first', 'foo') + + b = B() + self.assertEquals(b.first, 'first') + self.assertRaises(TypeError, setattr, b, 'first', 'foo') + self.assertEquals(b.second, 'second') + self.assertRaises(TypeError, setattr, b, 'second', 'foo') + + def testPropertySubclassCustomSetterError(self): + try: + class A(GObject): + def get_first(self): + return 'first' + first = gobject.property(type=str, getter=get_first) + + def do_get_property(self, pspec): + pass + except TypeError: + pass + else: + raise AssertionError + + # Bug 587637. + def test_float_min(self): + gobject.property(type=float, minimum=-1) + gobject.property(type=gobject.TYPE_FLOAT, minimum=-1) + gobject.property(type=gobject.TYPE_DOUBLE, minimum=-1) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_signal.py b/tests/test_signal.py new file mode 100644 index 0000000..96e0731 --- /dev/null +++ b/tests/test_signal.py @@ -0,0 +1,393 @@ +# -*- Mode: Python -*- + +import gc +import unittest +import sys + +from common import gobject, testhelper + +class C(gobject.GObject): + __gsignals__ = { 'my_signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + (gobject.TYPE_INT,)) } + def do_my_signal(self, arg): + self.arg = arg + +class D(C): + def do_my_signal(self, arg2): + self.arg2 = arg2 + C.do_my_signal(self, arg2) + +class TestSignalCreation(unittest.TestCase): + # Bug 540376. + def test_illegals(self): + self.assertRaises(TypeError, lambda: gobject.signal_new('test', + None, + 0, + gobject.TYPE_NONE, + (gobject.TYPE_LONG,))) + + +class TestChaining(unittest.TestCase): + def setUp(self): + self.inst = C() + self.inst.connect("my_signal", self.my_signal_handler_cb, 1, 2, 3) + + def my_signal_handler_cb(self, *args): + assert len(args) == 5 + assert isinstance(args[0], C) + assert args[0] == self.inst + + assert isinstance(args[1], int) + assert args[1] == 42 + + assert args[2:] == (1, 2, 3) + + def testChaining(self): + self.inst.emit("my_signal", 42) + assert self.inst.arg == 42 + + def testChaining(self): + inst2 = D() + inst2.emit("my_signal", 44) + assert inst2.arg == 44 + assert inst2.arg2 == 44 + +# This is for bug 153718 +class TestGSignalsError(unittest.TestCase): + def testInvalidType(self, *args): + def foo(): + class Foo(gobject.GObject): + __gsignals__ = None + self.assertRaises(TypeError, foo) + gc.collect() + + def testInvalidName(self, *args): + def foo(): + class Foo(gobject.GObject): + __gsignals__ = {'not-exists' : 'override'} + self.assertRaises(TypeError, foo) + gc.collect() + +class TestGPropertyError(unittest.TestCase): + def testInvalidType(self, *args): + def foo(): + class Foo(gobject.GObject): + __gproperties__ = None + self.assertRaises(TypeError, foo) + gc.collect() + + def testInvalidName(self, *args): + def foo(): + class Foo(gobject.GObject): + __gproperties__ = { None: None } + + self.assertRaises(TypeError, foo) + gc.collect() + +class TestList(unittest.TestCase): + def testListObject(self): + self.assertEqual(gobject.signal_list_names(C), ('my-signal',)) + + +def my_accumulator(ihint, return_accu, handler_return, user_data): + """An accumulator that stops emission when the sum of handler + returned values reaches 3""" + assert user_data == "accum data" + if return_accu >= 3: + return False, return_accu + return True, return_accu + handler_return + +class Foo(gobject.GObject): + __gsignals__ = { + 'my-acc-signal': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_INT, + (), my_accumulator, "accum data"), + 'my-other-acc-signal': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_BOOLEAN, + (), gobject.signal_accumulator_true_handled) + } + +class TestAccumulator(unittest.TestCase): + + def testAccumulator(self): + inst = Foo() + inst.connect("my-acc-signal", lambda obj: 1) + inst.connect("my-acc-signal", lambda obj: 2) + ## the value returned in the following handler will not be + ## considered, because at this point the accumulator already + ## reached its limit. + inst.connect("my-acc-signal", lambda obj: 3) + retval = inst.emit("my-acc-signal") + self.assertEqual(retval, 3) + + def testAccumulatorTrueHandled(self): + inst = Foo() + inst.connect("my-other-acc-signal", self._true_handler1) + inst.connect("my-other-acc-signal", self._true_handler2) + ## the following handler will not be called because handler2 + ## returns True, so it should stop the emission. + inst.connect("my-other-acc-signal", self._true_handler3) + self.__true_val = None + inst.emit("my-other-acc-signal") + self.assertEqual(self.__true_val, 2) + + def _true_handler1(self, obj): + self.__true_val = 1 + return False + def _true_handler2(self, obj): + self.__true_val = 2 + return True + def _true_handler3(self, obj): + self.__true_val = 3 + return False + +class E(gobject.GObject): + __gsignals__ = { 'signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + ()) } + def __init__(self): + gobject.GObject.__init__(self) + self.status = 0 + + def do_signal(self): + assert self.status == 0 + self.status = 1 + +class F(gobject.GObject): + __gsignals__ = { 'signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + ()) } + def __init__(self): + gobject.GObject.__init__(self) + self.status = 0 + + def do_signal(self): + self.status += 1 + +class TestEmissionHook(unittest.TestCase): + def testAdd(self): + self.hook = True + e = E() + e.connect('signal', self._callback) + gobject.add_emission_hook(E, "signal", self._emission_hook) + e.emit('signal') + self.assertEqual(e.status, 3) + + def testRemove(self): + self.hook = False + e = E() + e.connect('signal', self._callback) + hook_id = gobject.add_emission_hook(E, "signal", self._emission_hook) + gobject.remove_emission_hook(E, "signal", hook_id) + e.emit('signal') + self.assertEqual(e.status, 3) + + def _emission_hook(self, e): + self.assertEqual(e.status, 1) + e.status = 2 + + def _callback(self, e): + if self.hook: + self.assertEqual(e.status, 2) + else: + self.assertEqual(e.status, 1) + e.status = 3 + + def testCallbackReturnFalse(self): + self.hook = False + obj = F() + def _emission_hook(obj): + obj.status += 1 + return False + hook_id = gobject.add_emission_hook(obj, "signal", _emission_hook) + obj.emit('signal') + obj.emit('signal') + self.assertEqual(obj.status, 3) + + def testCallbackReturnTrue(self): + self.hook = False + obj = F() + def _emission_hook(obj): + obj.status += 1 + return True + hook_id = gobject.add_emission_hook(obj, "signal", _emission_hook) + obj.emit('signal') + obj.emit('signal') + gobject.remove_emission_hook(obj, "signal", hook_id) + self.assertEqual(obj.status, 4) + + def testCallbackReturnTrueButRemove(self): + self.hook = False + obj = F() + def _emission_hook(obj): + obj.status += 1 + return True + hook_id = gobject.add_emission_hook(obj, "signal", _emission_hook) + obj.emit('signal') + gobject.remove_emission_hook(obj, "signal", hook_id) + obj.emit('signal') + self.assertEqual(obj.status, 3) + +class TestClosures(unittest.TestCase): + def setUp(self): + self.count = 0 + + def _callback(self, e): + self.count += 1 + + def testDisconnect(self): + e = E() + e.connect('signal', self._callback) + e.disconnect_by_func(self._callback) + e.emit('signal') + self.assertEqual(self.count, 0) + + def testHandlerBlock(self): + e = E() + e.connect('signal', self._callback) + e.handler_block_by_func(self._callback) + e.emit('signal') + self.assertEqual(self.count, 0) + + def testHandlerUnBlock(self): + e = E() + signal_id = e.connect('signal', self._callback) + e.handler_block(signal_id) + e.handler_unblock_by_func(self._callback) + e.emit('signal') + self.assertEqual(self.count, 1) + + def testHandlerBlockMethod(self): + # Filed as #375589 + class A: + def __init__(self): + self.a = 0 + + def callback(self, o): + self.a = 1 + o.handler_block_by_func(self.callback) + + inst = A() + e = E() + e.connect("signal", inst.callback) + e.emit('signal') + self.assertEqual(inst.a, 1) + gc.collect() + + def testGString(self): + class C(gobject.GObject): + __gsignals__ = { 'my_signal': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_GSTRING, + (gobject.TYPE_GSTRING,)) } + def __init__(self, test): + gobject.GObject.__init__(self) + self.test = test + def do_my_signal(self, data): + self.data = data + self.test.assertEqual(len(data), 3) + return ''.join([data[2], data[1], data[0]]) + c = C(self) + data = c.emit("my_signal", "\01\00\02") + self.assertEqual(data, "\02\00\01") + +class SigPropClass(gobject.GObject): + __gsignals__ = { 'my_signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + (gobject.TYPE_INT,)) } + + __gproperties__ = { + 'foo': (str, None, None, '', gobject.PARAM_WRITABLE|gobject.PARAM_CONSTRUCT), + } + + signal_emission_failed = False + + def do_my_signal(self, arg): + self.arg = arg + + def do_set_property(self, pspec, value): + if pspec.name == 'foo': + self._foo = value + else: + raise AttributeError, 'unknown property %s' % pspec.name + try: + self.emit("my-signal", 1) + except TypeError: + self.signal_emission_failed = True + + +class TestSigProp(unittest.TestCase): + def testEmitInPropertySetter(self): + obj = SigPropClass() + self.failIf(obj.signal_emission_failed) + +f = gobject.SIGNAL_RUN_FIRST +l = gobject.SIGNAL_RUN_LAST +float = gobject.TYPE_FLOAT +double = gobject.TYPE_DOUBLE +uint = gobject.TYPE_UINT +ulong = gobject.TYPE_ULONG + +class CM(gobject.GObject): + __gsignals__ = dict( + test1=(f, None, ()), + test2=(l, None, (str,)), + test3=(l, int, (double,)), + test4=(f, None, (bool, long, float, double, int, uint, ulong)), + test_float=(l, float, (float,)), + test_double=(l, double, (double, )), + test_string=(l, str, (str, )), + test_object=(l, object, (object, )), + ) + +class _TestCMarshaller: + def setUp(self): + self.obj = CM() + testhelper.connectcallbacks(self.obj) + + def testTest1(self): + self.obj.emit("test1") + + def testTest2(self): + self.obj.emit("test2", "string") + + def testTest3(self): + rv = self.obj.emit("test3", 42.0) + self.assertEqual(rv, 20) + + def testTest4(self): + self.obj.emit("test4", True, 10L, 3.14, 1.78, 20, 30L, 31L) + + def testTestReturnFloat(self): + rv = self.obj.emit("test-float", 1.234) + self.failUnless(rv >= 1.233999 and rv <= 1.2400001, rv) + + def testTestReturnDouble(self): + rv = self.obj.emit("test-double", 1.234) + self.assertEqual(rv, 1.234) + + def testTestReturnString(self): + rv = self.obj.emit("test-string", "str") + self.assertEqual(rv, "str") + + def testTestReturnObject(self): + rv = self.obj.emit("test-object", self) + self.assertEqual(rv, self) + +if 'generic-c-marshaller' in gobject.features: + class TestCMarshaller(_TestCMarshaller, unittest.TestCase): + pass +else: + print + print '** WARNING: LIBFFI disabled, not testing' + print + +# Test for 374653 +class TestPyGValue(unittest.TestCase): + def testNoneNULLBoxedConversion(self): + class C(gobject.GObject): + __gsignals__ = dict(my_boxed_signal=( + gobject.SIGNAL_RUN_LAST, + gobject.type_from_name('GStrv'), ())) + + obj = C() + obj.connect('my-boxed-signal', lambda obj: None) + sys.last_type = None + obj.emit('my-boxed-signal') + assert not sys.last_type + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_source.py b/tests/test_source.py new file mode 100644 index 0000000..abe2f69 --- /dev/null +++ b/tests/test_source.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python + +import unittest + +from common import glib + + +class Idle(glib.Idle): + def __init__(self, loop): + glib.Idle.__init__(self) + self.count = 0 + self.set_callback(self.callback, loop) + + def callback(self, loop): + self.count += 1 + return True + + +class MySource(glib.Source): + def __init__(self): + glib.Source.__init__(self) + + def prepare(self): + return True, 0 + + def check(self): + return True + + def dispatch(self, callback, args): + return callback(*args) + + +class TestSource(unittest.TestCase): + def timeout_callback(self, loop): + loop.quit() + + def my_callback(self, loop): + self.pos += 1 + return True + + def setup_timeout(self, loop): + timeout = glib.Timeout(500) + timeout.set_callback(self.timeout_callback, loop) + timeout.attach() + + def testSources(self): + loop = glib.MainLoop() + + self.setup_timeout(loop) + + idle = Idle(loop) + idle.attach() + + self.pos = 0 + + m = MySource() + m.set_callback(self.my_callback, loop) + m.attach() + + loop.run() + + assert self.pos >= 0 and idle.count >= 0 + + def testSourcePrepare(self): + # this test may not terminate if prepare() is wrapped incorrectly + dispatched = [False] + loop = glib.MainLoop() + + class CustomTimeout(glib.Source): + def prepare(self): + return (False, 10) + + def check(self): + return True + + def dispatch(self, callback, args): + dispatched[0] = True + + loop.quit() + + return False + + source = CustomTimeout() + + source.attach() + source.set_callback(dir) + + loop.run() + + assert dispatched[0] + + +class TestTimeout(unittest.TestCase): + def test504337(self): + timeout_source = glib.Timeout(20) + idle_source = glib.Idle() + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py new file mode 100644 index 0000000..1522edb --- /dev/null +++ b/tests/test_subprocess.py @@ -0,0 +1,27 @@ +# -*- Mode: Python -*- + +import sys +import unittest + +from common import glib + + +class TestProcess(unittest.TestCase): + + def _child_watch_cb(self, pid, condition, data): + self.data = data + self.loop.quit() + + def testChildWatch(self): + self.data = None + self.loop = glib.MainLoop() + argv = [sys.executable, '-c', 'import sys'] + pid, stdin, stdout, stderr = glib.spawn_async( + argv, flags=glib.SPAWN_DO_NOT_REAP_CHILD) + pid.close() + glib.child_watch_add(pid, self._child_watch_cb, 12345) + self.loop.run() + self.assertEqual(self.data, 12345) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_unknown.py b/tests/test_unknown.py new file mode 100644 index 0000000..d65bb89 --- /dev/null +++ b/tests/test_unknown.py @@ -0,0 +1,15 @@ + +import unittest + +from common import gobject, testhelper + +TestInterface = gobject.GType.from_name('TestInterface') + + +class TestUnknown(unittest.TestCase): + def testFoo(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) diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c new file mode 100644 index 0000000..21679bc --- /dev/null +++ b/tests/testhelpermodule.c @@ -0,0 +1,679 @@ +#include "pygobject.h" +#include + +#include "test-thread.h" +#include "test-unknown.h" +#include "test-floating.h" + +static PyTypeObject *_PyGObject_Type; +#define PyGObject_Type (*_PyGObject_Type) + +static PyObject * _wrap_TestInterface__do_iface_method(PyObject *cls, + PyObject *args, + PyObject *kwargs); + +GType +test_type_get_type(void) +{ + static GType gtype = 0; + GType parent_type; + + if (gtype == 0) + { + GTypeInfo *type_info; + GTypeQuery query; + + parent_type = g_type_from_name("PyGObject"); + if (parent_type == 0) + g_error("could not get PyGObject from testmodule"); + + 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; + + gtype = g_type_register_static(parent_type, + "TestType", type_info, 0); + if (!gtype) + g_error("Could not register TestType"); + } + + return gtype; +} + +#define TYPE_TEST (test_type_get_type()) + +static PyObject * +_wrap_get_test_thread (PyObject * self) +{ + GObject *obj; + + test_thread_get_type(); + g_assert (g_type_is_a (TEST_TYPE_THREAD, G_TYPE_OBJECT)); + obj = g_object_new (TEST_TYPE_THREAD, NULL); + g_assert (obj != NULL); + + return pygobject_new(obj); +} + +static PyObject * +_wrap_get_unknown (PyObject * self) +{ + GObject *obj; + obj = g_object_new (TEST_TYPE_UNKNOWN, NULL); + return pygobject_new(obj); +} + +static PyObject * +_wrap_create_test_type (PyObject * self) +{ + GObject *obj; + PyObject *rv; + obj = g_object_new(TYPE_TEST, NULL); + rv = pygobject_new(obj); + g_object_unref(obj); + return rv; +} + +static PyObject * +_wrap_test_g_object_new (PyObject * self) +{ + GObject *obj; + PyObject *rv; + + obj = g_object_new(g_type_from_name("PyGObject"), NULL); + rv = PyInt_FromLong(obj->ref_count); /* should be == 2 at this point */ + g_object_unref(obj); + return rv; +} + +/* TestUnknown */ +static PyObject * +_wrap_test_interface_iface_method(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,":", kwlist)) + return NULL; + + test_interface_iface_method(TEST_INTERFACE(self->obj)); + + Py_INCREF(Py_None); + return Py_None; +} + +static const PyMethodDef _PyTestInterface_methods[] = { + { "iface_method", (PyCFunction)_wrap_test_interface_iface_method, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "do_iface_method", (PyCFunction)_wrap_TestInterface__do_iface_method, METH_VARARGS|METH_KEYWORDS|METH_CLASS, + NULL }, + { NULL, NULL, 0, NULL } +}; + +/* TestInterface */ +PyTypeObject PyTestInterface_Type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "test.Interface", /* tp_name */ + sizeof(PyObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ + (PyNumberMethods*)0, /* tp_as_number */ + (PySequenceMethods*)0, /* tp_as_sequence */ + (PyMappingMethods*)0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)_PyTestInterface_methods, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)0, /* tp_init */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ + (freefunc)0, /* tp_free */ + (inquiry)0 /* tp_is_gc */ + + + +}; + +static PyObject * +_wrap_TestInterface__do_iface_method(PyObject *cls, PyObject *args, PyObject *kwargs) +{ + TestInterfaceIface *iface; + static char *kwlist[] = { "self", NULL }; + PyGObject *self; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:TestInterface.iface_method", kwlist, &PyTestInterface_Type, &self)) + return NULL; + + iface = g_type_interface_peek(g_type_class_peek(pyg_type_from_object(cls)), + TEST_TYPE_INTERFACE); + if (iface->iface_method) + iface->iface_method(TEST_INTERFACE(self->obj)); + else { + PyErr_SetString(PyExc_NotImplementedError, + "interface method TestInterface.iface_method not implemented"); + return NULL; + } + Py_INCREF(Py_None); + return Py_None; +} + +PyTypeObject PyTestUnknown_Type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "testhelper.Unknown", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ + (PyNumberMethods*)0, /* tp_as_number */ + (PySequenceMethods*)0, /* tp_as_sequence */ + (PyMappingMethods*)0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ + offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)0, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ + offsetof(PyGObject, inst_dict), /* tp_dictoffset */ + (initproc)0, /* tp_init */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ + (freefunc)0, /* tp_free */ + (inquiry)0 /* tp_is_gc */ +}; + + +static void +_wrap_TestInterface__proxy_do_iface_method(TestInterface *self) +{ + PyGILState_STATE __py_state; + PyObject *py_self; + PyObject *py_retval; + PyObject *py_args; + PyObject *py_method; + + __py_state = pyg_gil_state_ensure(); + py_self = pygobject_new((GObject *) self); + if (!py_self) { + if (PyErr_Occurred()) + PyErr_Print(); + pyg_gil_state_release(__py_state); + return; + } + py_args = PyTuple_New(0); + py_method = PyObject_GetAttrString(py_self, "do_iface_method"); + if (!py_method) { + if (PyErr_Occurred()) + PyErr_Print(); + Py_DECREF(py_args); + Py_DECREF(py_self); + pyg_gil_state_release(__py_state); + return; + } + py_retval = PyObject_CallObject(py_method, py_args); + if (!py_retval) { + if (PyErr_Occurred()) + PyErr_Print(); + Py_DECREF(py_method); + Py_DECREF(py_args); + Py_DECREF(py_self); + pyg_gil_state_release(__py_state); + return; + } + if (py_retval != Py_None) { + if (PyErr_Occurred()) + PyErr_Print(); + PyErr_SetString(PyExc_TypeError, "retval should be None"); + Py_DECREF(py_retval); + Py_DECREF(py_method); + Py_DECREF(py_args); + Py_DECREF(py_self); + pyg_gil_state_release(__py_state); + return; + } + + Py_DECREF(py_retval); + Py_DECREF(py_method); + Py_DECREF(py_args); + Py_DECREF(py_self); + pyg_gil_state_release(__py_state); +} + +static void +__TestInterface__interface_init(TestInterfaceIface *iface, + PyTypeObject *pytype) +{ + TestInterfaceIface *parent_iface = g_type_interface_peek_parent(iface); + PyObject *py_method; + + py_method = pytype ? PyObject_GetAttrString((PyObject *) pytype, + "do_iface_method") : NULL; + + if (py_method && !PyObject_TypeCheck(py_method, &PyCFunction_Type)) { + iface->iface_method = _wrap_TestInterface__proxy_do_iface_method; + } else { + PyErr_Clear(); + if (parent_iface) { + iface->iface_method = parent_iface->iface_method; + } + Py_XDECREF(py_method); + } +} + +static const GInterfaceInfo __TestInterface__iinfo = { + (GInterfaceInitFunc) __TestInterface__interface_init, + NULL, + NULL +}; + +/* TestFloatingWithSinkFunc */ + +PyTypeObject PyTestFloatingWithSinkFunc_Type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "testhelper.FloatingWithSinkFunc", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ + (PyNumberMethods*)0, /* tp_as_number */ + (PySequenceMethods*)0, /* tp_as_sequence */ + (PyMappingMethods*)0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ + offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)0, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ + offsetof(PyGObject, inst_dict), /* tp_dictoffset */ + (initproc)0, /* tp_init */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ + (freefunc)0, /* tp_free */ + (inquiry)0 /* tp_is_gc */ +}; + +/* TestFloatingWithoutSinkFunc */ + +PyTypeObject PyTestFloatingWithoutSinkFunc_Type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "testhelper.FloatingWithoutSinkFunc", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ + (PyNumberMethods*)0, /* tp_as_number */ + (PySequenceMethods*)0, /* tp_as_sequence */ + (PyMappingMethods*)0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ + offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)0, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ + offsetof(PyGObject, inst_dict), /* tp_dictoffset */ + (initproc)0, /* tp_init */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ + (freefunc)0, /* tp_free */ + (inquiry)0 /* tp_is_gc */ +}; + +#include +#include + +static void +test1_callback (GObject *object, char *data) +{ + g_return_if_fail (G_IS_OBJECT (object)); + g_return_if_fail (!strcmp (data, "user-data")); +} + +static void +test1_callback_swapped (char *data, GObject *object) +{ + g_return_if_fail (G_IS_OBJECT (object)); + g_return_if_fail (!strcmp (data, "user-data")); +} + +static void +test2_callback (GObject *object, char *string) +{ + g_return_if_fail (G_IS_OBJECT (object)); + g_return_if_fail (!strcmp (string, "string")); +} + +static int +test3_callback (GObject *object, double d) +{ + g_return_val_if_fail (G_IS_OBJECT (object), -1); + g_return_val_if_fail (d == 42.0, -1); + + return 20; +} + +static void +test4_callback (GObject *object, + gboolean b, long l, float f, double d, guint uint, gulong ulong, + gpointer user_data) +{ + g_return_if_fail (b == TRUE); + g_return_if_fail (l == 10L); + g_return_if_fail (f <= 3.14001 && f >= 3.13999); + g_return_if_fail (d == 1.78); + g_return_if_fail (uint == 20); + g_return_if_fail (ulong == 30L); +} + +static float +test_float_callback (GObject *object, float f) +{ + g_return_val_if_fail (G_IS_OBJECT (object), -1); + g_return_val_if_fail (f <= 1.234001 && f >= 1.123999, -1); + + return f; +} + +static double +test_double_callback (GObject *object, double d) +{ + g_return_val_if_fail (G_IS_OBJECT (object), -1); + g_return_val_if_fail (d <= 1.234001 && d >= 1.123999, -1); + + return d; +} + +static char * +test_string_callback (GObject *object, char *s) +{ + g_return_val_if_fail (G_IS_OBJECT (object), NULL); + g_return_val_if_fail (!strcmp(s, "str"), NULL); + + return g_strdup (s); +} + +static GObject * +test_object_callback (GObject *object, GObject *o) +{ + g_return_val_if_fail (G_IS_OBJECT (object), NULL); + + return o; +} + +void +connectcallbacks (GObject *object) +{ + + gchar *data = "user-data"; + + g_signal_connect (G_OBJECT (object), + "test1", + G_CALLBACK (test1_callback), + data); + g_signal_connect_swapped (G_OBJECT (object), + "test1", + G_CALLBACK (test1_callback_swapped), + data); + g_signal_connect (G_OBJECT (object), + "test2", + G_CALLBACK (test2_callback), + NULL); + g_signal_connect (G_OBJECT (object), + "test3", + G_CALLBACK (test3_callback), + NULL); + g_signal_connect (G_OBJECT (object), + "test4", + G_CALLBACK (test4_callback), + NULL); + g_signal_connect (G_OBJECT (object), + "test_float", + G_CALLBACK (test_float_callback), + NULL); + g_signal_connect (G_OBJECT (object), + "test_double", + G_CALLBACK (test_double_callback), + NULL); + g_signal_connect (G_OBJECT (object), + "test_string", + G_CALLBACK (test_string_callback), + NULL); + g_signal_connect (G_OBJECT (object), + "test_object", + G_CALLBACK (test_object_callback), + NULL); +} + +static PyObject * +_wrap_connectcallbacks(PyObject * self, PyObject *args) +{ + PyGObject *obj; + + if (!PyArg_ParseTuple(args, "O", &obj)) + return NULL; + + connectcallbacks (G_OBJECT (obj->obj)); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +_wrap_test_value(PyObject *self, PyObject *args) +{ + GValue tvalue = {0,}, *value = &tvalue; + PyObject *obj; + + if (!PyArg_ParseTuple(args, "O", &obj)) + return NULL; + + g_value_init(value, G_TYPE_VALUE); + if (pyg_value_from_pyobject(value, obj)) { + PyErr_SetString(PyExc_TypeError, "Could not convert to GValue"); + return NULL; + } + + return pyg_value_as_pyobject(value, FALSE); +} + +static PyObject * +_wrap_test_value_array(PyObject *self, PyObject *args) +{ + GValue tvalue = {0,}, *value = &tvalue; + PyObject *obj; + + if (!PyArg_ParseTuple(args, "O", &obj)) + return NULL; + + g_value_init(value, G_TYPE_VALUE_ARRAY); + if (pyg_value_from_pyobject(value, obj)) { + PyErr_SetString(PyExc_TypeError, "Could not convert to GValueArray"); + return NULL; + } + + return pyg_value_as_pyobject(value, FALSE); +} + +static PyObject * +_wrap_test_gerror_exception(PyObject *self, PyObject *args) +{ + PyObject *py_method; + PyObject *py_args; + PyObject *py_ret; + GError *err = NULL; + + if (!PyArg_ParseTuple(args, "O", &py_method)) + return NULL; + + py_args = PyTuple_New(0); + py_ret = PyObject_CallObject(py_method, py_args); + if (pyg_gerror_exception_check(&err)) { + pyg_error_check(&err); + return NULL; + } + + Py_DECREF(py_method); + Py_DECREF(py_args); + Py_DECREF(py_ret); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef testhelper_functions[] = { + { "get_test_thread", (PyCFunction)_wrap_get_test_thread, METH_NOARGS }, + { "get_unknown", (PyCFunction)_wrap_get_unknown, METH_NOARGS }, + { "create_test_type", (PyCFunction)_wrap_create_test_type, 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 }, + { "test_gerror_exception", (PyCFunction)_wrap_test_gerror_exception, METH_VARARGS }, + { NULL, NULL } +}; + +void +inittesthelper () +{ + PyObject *m, *d; + PyObject *module; + + g_thread_init(NULL); + init_pygobject(); + m = Py_InitModule ("testhelper", testhelper_functions); + + d = PyModule_GetDict(m); + + if ((module = PyImport_ImportModule("gobject")) != NULL) { + PyObject *moddict = PyModule_GetDict(module); + + _PyGObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "GObject"); + if (_PyGObject_Type == NULL) { + PyErr_SetString(PyExc_ImportError, + "cannot import name GObject from gobject"); + return ; + } + } else { + PyErr_SetString(PyExc_ImportError, + "could not import gobject"); + return ; + } + + /* TestInterface */ + pyg_register_interface(d, "Interface", TEST_TYPE_INTERFACE, + &PyTestInterface_Type); + pyg_register_interface_info(TEST_TYPE_INTERFACE, &__TestInterface__iinfo); + + + /* TestUnknown */ + pygobject_register_class(d, "Unknown", TEST_TYPE_UNKNOWN, + &PyTestUnknown_Type, + Py_BuildValue("(O)", + &PyGObject_Type, + &PyTestInterface_Type)); + pyg_set_object_has_new_constructor(TEST_TYPE_UNKNOWN); + //pyg_register_class_init(TEST_TYPE_UNKNOWN, __GtkUIManager_class_init); + + /* TestFloatingWithSinkFunc */ + pygobject_register_class(d, "FloatingWithSinkFunc", TEST_TYPE_FLOATING_WITH_SINK_FUNC, + &PyTestFloatingWithSinkFunc_Type, + Py_BuildValue("(O)", + &PyGObject_Type)); + pyg_set_object_has_new_constructor(TEST_TYPE_FLOATING_WITH_SINK_FUNC); + pygobject_register_sinkfunc(TEST_TYPE_FLOATING_WITH_SINK_FUNC, sink_test_floating_with_sink_func); + + /* TestFloatingWithoutSinkFunc */ + pygobject_register_class(d, "FloatingWithoutSinkFunc", TEST_TYPE_FLOATING_WITHOUT_SINK_FUNC, + &PyTestFloatingWithoutSinkFunc_Type, + Py_BuildValue("(O)", + &PyGObject_Type)); + pyg_set_object_has_new_constructor(TEST_TYPE_FLOATING_WITHOUT_SINK_FUNC); +} + diff --git a/tests/testmodule.py b/tests/testmodule.py new file mode 100644 index 0000000..5fc29b3 --- /dev/null +++ b/tests/testmodule.py @@ -0,0 +1,21 @@ +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] -- 2.7.4