--- /dev/null
+*.bak
+*.lo
+*.o
+*.orig
+*.pyc
+*.rej
+*.so
+*.la
+*.tab.c
+*~
+.*.sw[nop]
+*.gir
+*.typelib
+*.dll
+*.dylib
+.DS_STORE
+.deps
+.libs
+.idea
+.cache
+.pytest_cache
+gschemas.compiled
+pygobject-*.tar.xz
+Makefile
+Makefile.in
+/.dirstamp
+/ChangeLog
+/GPATH
+/GRTAGS
+/GSYMS
+/GTAGS
+/ID
+/INSTALL
+/PKG-INFO
+/TAGS
+/_libs
+/aclocal.m4
+/autom4te.cache
+/autoscan.log
+/compile
+/config.cache
+/config.guess
+/config.h
+/config.h.in
+/config.log
+/config.lt
+/config.status
+/config.status.lineno
+/config.sub
+/configure
+/configure.lineno
+/configure.scan
+/depcomp
+/gtk-doc.make
+/install-sh
+/libtool
+/ltmain.sh
+/m4/libtool.m4
+/m4/ltoptions.m4
+/m4/ltsugar.m4
+/m4/ltversion.m4
+/m4/lt~obsolete.m4
+/m4/glib-2.0.m4
+/m4/pkg.m4
+/m4/ax_*.m4
+/missing
+/mkinstalldirs
+/omf.make
+/py-compile
+/pygobject-3.0-uninstalled.pc
+/pygobject-3.0.pc
+/pygobject-*-coverage*
+/so_locations
+/stamp-h1
+/tags
+/xmldocs.make
+/tmp/*
+/build/
+/dist/
+/pygobject.egg-info/
+/MANIFEST
+/docs/_build
+/PyGObject.egg-info/
+*.pyd
+*.dll.a
+.coverage
export CFLAGS="-coverage -ftest-coverage -fprofile-arcs -Werror"
# MESON
-/usr/bin/python3 -m pip install --user git+https://github.com/mesonbuild/meson.git
+/usr/bin/python3 -m pip install --user meson
export PATH="${HOME}/.local/bin:${PATH}"
export PKG_CONFIG_PATH="$(python -c 'import sys; sys.stdout.write(sys.prefix)')/lib/pkgconfig"
# pycairo install under PyPy doesn't install a .pc file
+3.30.2 - 2018-11-11
+-------------------
+
+* tests: Fix some test with newer glib.
+* overrides: Fix crash when using non-ascii text with.
+ Gtk.Builder.add_from_string/add_objects_from_string. :issue:`255`
+* Various meson/distutils build fixes for MSVC.
+ :mr:`91` (:user:`Chun-wei Fan <fanc999>`)
+* foreign-cairo: Fix cairo marshalling not using the foreign converters in
+ some cases. :issue:`260`
+* build: setup.py reproducible build fixes.
+ :mr:`94` (:user:`Bernhard M. Wiedemann <bmwiedemann>`)
+
+
3.30.1 - 2018-09-14
-------------------
+++ /dev/null
-Metadata-Version: 1.2
-Name: PyGObject
-Version: 3.30.1
-Summary: Python bindings for GObject Introspection
-Home-page: https://pygobject.readthedocs.io
-Author: James Henstridge
-Author-email: james@daa.com.au
-Maintainer: Simon Feltman
-Maintainer-email: sfeltman@src.gnome.org
-License: GNU LGPL
-Description: .. image:: https://pygobject.readthedocs.io/en/latest/_images/pygobject.svg
- :align: center
- :width: 400px
- :height: 98px
-
- |
-
- **PyGObject** is a Python package which provides bindings for `GObject
- <https://developer.gnome.org/gobject/stable/>`__ based libraries such as `GTK+
- <https://www.gtk.org/>`__, `GStreamer <https://gstreamer.freedesktop.org/>`__,
- `WebKitGTK+ <https://webkitgtk.org/>`__, `GLib
- <https://developer.gnome.org/glib/stable/>`__, `GIO
- <https://developer.gnome.org/gio/stable/>`__ and many more.
-
- It supports Linux, Windows and macOS and works with **Python 2.7+**, **Python
- 3.5+**, **PyPy** and **PyPy3**. PyGObject, including this documentation, is
- licensed under the **LGPLv2.1+**.
-
-
- ----
-
- For more information visit https://pygobject.readthedocs.io
-
-Platform: POSIX, Windows
-Classifier: Development Status :: 5 - Production/Stable
-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
+++ /dev/null
-Metadata-Version: 1.2
-Name: PyGObject
-Version: 3.30.1
-Summary: Python bindings for GObject Introspection
-Home-page: https://pygobject.readthedocs.io
-Author: James Henstridge
-Author-email: james@daa.com.au
-Maintainer: Simon Feltman
-Maintainer-email: sfeltman@src.gnome.org
-License: GNU LGPL
-Description: .. image:: https://pygobject.readthedocs.io/en/latest/_images/pygobject.svg
- :align: center
- :width: 400px
- :height: 98px
-
- |
-
- **PyGObject** is a Python package which provides bindings for `GObject
- <https://developer.gnome.org/gobject/stable/>`__ based libraries such as `GTK+
- <https://www.gtk.org/>`__, `GStreamer <https://gstreamer.freedesktop.org/>`__,
- `WebKitGTK+ <https://webkitgtk.org/>`__, `GLib
- <https://developer.gnome.org/glib/stable/>`__, `GIO
- <https://developer.gnome.org/gio/stable/>`__ and many more.
-
- It supports Linux, Windows and macOS and works with **Python 2.7+**, **Python
- 3.5+**, **PyPy** and **PyPy3**. PyGObject, including this documentation, is
- licensed under the **LGPLv2.1+**.
-
-
- ----
-
- For more information visit https://pygobject.readthedocs.io
-
-Platform: POSIX, Windows
-Classifier: Development Status :: 5 - Production/Stable
-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
+++ /dev/null
-.gitlab-ci.yml
-COPYING
-MANIFEST.in
-NEWS
-PKG-INFO.in
-README.rst
-meson.build
-meson_options.txt
-pygobject-3.0.pc.in
-pygobject.doap
-setup.cfg
-setup.py
-.gitlab-ci/Dockerfile
-.gitlab-ci/Dockerfile.old
-.gitlab-ci/README.rst
-.gitlab-ci/coverage-docker.sh
-.gitlab-ci/fixup-cov-paths.py
-.gitlab-ci/run-docker-old.sh
-.gitlab-ci/run-docker.sh
-.gitlab-ci/test-docker-old.sh
-.gitlab-ci/test-docker.sh
-.gitlab-ci/test-flatpak.sh
-.gitlab-ci/test-msys2.sh
-PyGObject.egg-info/PKG-INFO
-PyGObject.egg-info/SOURCES.txt
-PyGObject.egg-info/dependency_links.txt
-PyGObject.egg-info/not-zip-safe
-PyGObject.egg-info/requires.txt
-PyGObject.egg-info/top_level.txt
-docs/Makefile
-docs/bugs_repo.rst
-docs/changelog.rst
-docs/conf.py
-docs/contact.rst
-docs/extra.css
-docs/further.rst
-docs/getting_started.rst
-docs/icons.rst
-docs/index.rst
-docs/maintguide.rst
-docs/packagingguide.rst
-docs/devguide/building_testing.rst
-docs/devguide/dev_environ.rst
-docs/devguide/index.rst
-docs/devguide/override_guidelines.rst
-docs/devguide/overview.rst
-docs/devguide/style_guide.rst
-docs/guide/cairo_integration.rst
-docs/guide/debug_profile.rst
-docs/guide/deploy.rst
-docs/guide/faq.rst
-docs/guide/index.rst
-docs/guide/porting.rst
-docs/guide/testing.rst
-docs/guide/threading.rst
-docs/guide/api/api.rst
-docs/guide/api/basic_types.rst
-docs/guide/api/error_handling.rst
-docs/guide/api/flags_enums.rst
-docs/guide/api/gobject.rst
-docs/guide/api/index.rst
-docs/guide/api/properties.rst
-docs/guide/api/signals.rst
-docs/guide/code/cairo-demo.py
-docs/guide/images/cairo_integration.png
-docs/images/LICENSE
-docs/images/favicon.ico
-docs/images/logo.svg
-docs/images/overview.dia
-docs/images/overview.svg
-docs/images/pygobject-small.svg
-docs/images/pygobject.svg
-docs/images/start_linux.png
-docs/images/start_macos.png
-docs/images/start_windows.png
-examples/cairo-demo.py
-examples/option.py
-examples/properties.py
-examples/signal.py
-examples/demo/demo.py
-examples/demo/demos/__init__.py
-examples/demo/demos/appwindow.py
-examples/demo/demos/assistant.py
-examples/demo/demos/builder.py
-examples/demo/demos/button_box.py
-examples/demo/demos/clipboard.py
-examples/demo/demos/colorselector.py
-examples/demo/demos/combobox.py
-examples/demo/demos/dialogs.py
-examples/demo/demos/drawingarea.py
-examples/demo/demos/expander.py
-examples/demo/demos/flowbox.py
-examples/demo/demos/images.py
-examples/demo/demos/infobars.py
-examples/demo/demos/links.py
-examples/demo/demos/menus.py
-examples/demo/demos/pickers.py
-examples/demo/demos/pixbuf.py
-examples/demo/demos/printing.py
-examples/demo/demos/rotatedtext.py
-examples/demo/demos/test.py
-examples/demo/demos/Css/__init__.py
-examples/demo/demos/Css/css_accordion.py
-examples/demo/demos/Css/css_basics.py
-examples/demo/demos/Css/css_multiplebgs.py
-examples/demo/demos/Entry/__init__.py
-examples/demo/demos/Entry/entry_buffer.py
-examples/demo/demos/Entry/entry_completion.py
-examples/demo/demos/Entry/search_entry.py
-examples/demo/demos/IconView/__init__.py
-examples/demo/demos/IconView/iconviewbasics.py
-examples/demo/demos/IconView/iconviewedit.py
-examples/demo/demos/TreeView/__init__.py
-examples/demo/demos/TreeView/liststore.py
-examples/demo/demos/TreeView/treemodel_filelist.py
-examples/demo/demos/TreeView/treemodel_filetree.py
-examples/demo/demos/TreeView/treemodel_large.py
-examples/demo/demos/data/alphatest.png
-examples/demo/demos/data/apple-red.png
-examples/demo/demos/data/background.jpg
-examples/demo/demos/data/brick.png
-examples/demo/demos/data/brick2.png
-examples/demo/demos/data/css_accordion.css
-examples/demo/demos/data/css_basics.css
-examples/demo/demos/data/css_multiplebgs.css
-examples/demo/demos/data/cssview.css
-examples/demo/demos/data/demo.gresource
-examples/demo/demos/data/demo.gresource.xml
-examples/demo/demos/data/demo.ui
-examples/demo/demos/data/floppybuddy.gif
-examples/demo/demos/data/gnome-applets.png
-examples/demo/demos/data/gnome-calendar.png
-examples/demo/demos/data/gnome-foot.png
-examples/demo/demos/data/gnome-fs-directory.png
-examples/demo/demos/data/gnome-fs-regular.png
-examples/demo/demos/data/gnome-gimp.png
-examples/demo/demos/data/gnome-gmush.png
-examples/demo/demos/data/gnome-gsame.png
-examples/demo/demos/data/gnu-keys.png
-examples/demo/demos/data/gtk-logo-rgb.gif
-examples/demo/demos/data/reset.css
-gi/__init__.py
-gi/_compat.py
-gi/_constants.py
-gi/_error.py
-gi/_gtktemplate.py
-gi/_option.py
-gi/_ossighelper.py
-gi/_propertyhelper.py
-gi/_signalhelper.py
-gi/docstring.py
-gi/gimodule.c
-gi/gimodule.h
-gi/importer.py
-gi/meson.build
-gi/module.py
-gi/pygboxed.c
-gi/pygboxed.h
-gi/pygenum.c
-gi/pygenum.h
-gi/pygflags.c
-gi/pygflags.h
-gi/pygi-argument.c
-gi/pygi-argument.h
-gi/pygi-array.c
-gi/pygi-array.h
-gi/pygi-basictype.c
-gi/pygi-basictype.h
-gi/pygi-boxed.c
-gi/pygi-boxed.h
-gi/pygi-cache.c
-gi/pygi-cache.h
-gi/pygi-ccallback.c
-gi/pygi-ccallback.h
-gi/pygi-closure.c
-gi/pygi-closure.h
-gi/pygi-enum-marshal.c
-gi/pygi-enum-marshal.h
-gi/pygi-error.c
-gi/pygi-error.h
-gi/pygi-foreign-api.h
-gi/pygi-foreign-cairo.c
-gi/pygi-foreign.c
-gi/pygi-foreign.h
-gi/pygi-hashtable.c
-gi/pygi-hashtable.h
-gi/pygi-info.c
-gi/pygi-info.h
-gi/pygi-invoke-state-struct.h
-gi/pygi-invoke.c
-gi/pygi-invoke.h
-gi/pygi-list.c
-gi/pygi-list.h
-gi/pygi-marshal-cleanup.c
-gi/pygi-marshal-cleanup.h
-gi/pygi-object.c
-gi/pygi-object.h
-gi/pygi-property.c
-gi/pygi-property.h
-gi/pygi-python-compat.h
-gi/pygi-repository.c
-gi/pygi-repository.h
-gi/pygi-resulttuple.c
-gi/pygi-resulttuple.h
-gi/pygi-signal-closure.c
-gi/pygi-signal-closure.h
-gi/pygi-source.c
-gi/pygi-source.h
-gi/pygi-struct-marshal.c
-gi/pygi-struct-marshal.h
-gi/pygi-struct.c
-gi/pygi-struct.h
-gi/pygi-type.c
-gi/pygi-type.h
-gi/pygi-util.c
-gi/pygi-util.h
-gi/pygi-value.c
-gi/pygi-value.h
-gi/pyginterface.c
-gi/pyginterface.h
-gi/pygobject-internal.h
-gi/pygobject-object.c
-gi/pygobject-object.h
-gi/pygobject.h
-gi/pygoptioncontext.c
-gi/pygoptioncontext.h
-gi/pygoptiongroup.c
-gi/pygoptiongroup.h
-gi/pygparamspec.c
-gi/pygparamspec.h
-gi/pygpointer.c
-gi/pygpointer.h
-gi/pygspawn.c
-gi/pygspawn.h
-gi/pygtkcompat.py
-gi/types.py
-gi/overrides/GIMarshallingTests.py
-gi/overrides/GLib.py
-gi/overrides/GObject.py
-gi/overrides/Gdk.py
-gi/overrides/GdkPixbuf.py
-gi/overrides/Gio.py
-gi/overrides/Gtk.py
-gi/overrides/Pango.py
-gi/overrides/__init__.py
-gi/overrides/keysyms.py
-gi/overrides/meson.build
-gi/repository/__init__.py
-gi/repository/meson.build
-pygtkcompat/__init__.py
-pygtkcompat/generictreemodel.py
-pygtkcompat/meson.build
-pygtkcompat/pygtkcompat.py
-subprojects/glib.wrap
-subprojects/gobject-introspection.wrap
-subprojects/libffi.wrap
-subprojects/pycairo.wrap
-tests/__init__.py
-tests/conftest.py
-tests/gimarshallingtestsextra.c
-tests/gimarshallingtestsextra.h
-tests/helper.py
-tests/meson.build
-tests/org.gnome.test.gschema.xml
-tests/regressextra.c
-tests/regressextra.h
-tests/runtests.py
-tests/test-floating.c
-tests/test-floating.h
-tests/test-thread.c
-tests/test-thread.h
-tests/test-unknown.c
-tests/test-unknown.h
-tests/test_atoms.py
-tests/test_cairo.py
-tests/test_docstring.py
-tests/test_error.py
-tests/test_everything.py
-tests/test_fields.py
-tests/test_gdbus.py
-tests/test_generictreemodel.py
-tests/test_gi.py
-tests/test_gio.py
-tests/test_glib.py
-tests/test_gobject.py
-tests/test_gtk_template.py
-tests/test_gtype.py
-tests/test_import_machinery.py
-tests/test_interface.py
-tests/test_internal_api.py
-tests/test_iochannel.py
-tests/test_mainloop.py
-tests/test_object_marshaling.py
-tests/test_option.py
-tests/test_ossig.py
-tests/test_overrides_gdk.py
-tests/test_overrides_gdkpixbuf.py
-tests/test_overrides_gio.py
-tests/test_overrides_glib.py
-tests/test_overrides_gtk.py
-tests/test_overrides_pango.py
-tests/test_properties.py
-tests/test_pycapi.py
-tests/test_pygtkcompat.py
-tests/test_repository.py
-tests/test_resulttuple.py
-tests/test_signal.py
-tests/test_source.py
-tests/test_subprocess.py
-tests/test_thread.py
-tests/test_typeclass.py
-tests/test_unknown.py
-tests/testhelpermodule.c
-tests/valgrind.supp
-tests/gi/overrides/Regress.py
-tests/gi/overrides/__init__.py
-tools/pygi-convert.sh
\ No newline at end of file
+++ /dev/null
-pycairo>=1.11.1
+++ /dev/null
-gi
-pygtkcompat
version_info = _gi.pygobject_version[:]
__version__ = "{0}.{1}.{2}".format(*version_info)
+_gi.register_foreign()
+
class _DummyStaticModule(types.ModuleType):
__path__ = None
{ "source_set_callback", (PyCFunction) pygi_source_set_callback, METH_VARARGS },
{ "io_channel_read", (PyCFunction) pyg_channel_read, METH_VARARGS },
{ "require_foreign", (PyCFunction) pygi_require_foreign, METH_VARARGS | METH_KEYWORDS },
+ { "register_foreign", (PyCFunction) pygi_register_foreign, METH_NOARGS },
{ "spawn_async",
(PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS,
"spawn_async(argv, envp=None, working_directory=None,\n"
if not isinstance(buffer, string_types):
raise TypeError('buffer must be a string')
- length = len(buffer.encode('UTF-8'))
+ length = _get_utf8_length(buffer)
return Gtk.UIManager.add_ui_from_string(self, buffer, length)
__all__.append('MenuItem')
+def _get_utf8_length(string):
+ if not isinstance(string, string_types):
+ raise TypeError('must be a string')
+ if not isinstance(string, bytes):
+ string = string.encode("utf-8")
+ return len(string)
+
+
class Builder(Gtk.Builder):
def connect_signals(self, obj_or_map):
"""Connect signals specified by this builder to a name, handler mapping.
if not isinstance(buffer, string_types):
raise TypeError('buffer must be a string')
- length = len(buffer)
+ length = _get_utf8_length(buffer)
return Gtk.Builder.add_from_string(self, buffer, length)
if not isinstance(buffer, string_types):
raise TypeError('buffer must be a string')
- length = len(buffer)
+ length = _get_utf8_length(buffer)
return Gtk.Builder.add_objects_from_string(self, buffer, length, object_ids)
*(ffi_arg *) retval = arg->v_uint;
break;
default:
- *(ffi_arg *) retval = arg->v_pointer;
+ *(ffi_arg *) retval = (ffi_arg) arg->v_pointer;
break;
}
break;
}
default:
- *(ffi_arg *) retval = arg->v_pointer;
+ *(ffi_arg *) retval = (ffi_arg) arg->v_pointer;
break;
}
}
static PyMethodDef _gi_cairo_functions[] = { {0,} };
PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
{
+ PyObject *gobject_mod;
+
#if PY_VERSION_HEX < 0x03000000
Pycairo_IMPORT;
#else
if (Pycairo_CAPI == NULL)
return PYGLIB_MODULE_ERROR_RETURN;
- pygobject_init (3, 13, 2);
+ gobject_mod = pygobject_init (3, 13, 2);
+ if (gobject_mod == NULL)
+ return PYGLIB_MODULE_ERROR_RETURN;
+ Py_DECREF (gobject_mod);
pygi_register_foreign_struct ("cairo",
"Matrix",
return 0;
}
+
+
+PyObject *pygi_register_foreign (PyObject *self, PyObject *args)
+{
+ /* We need to try loading the foreign modules upfront so the GType
+ * converters are registered:
+ * https://gitlab.gnome.org/GNOME/pygobject/issues/260
+ */
+ PyObject *mod = pygi_struct_foreign_load_module ("cairo");
+ if (mod == NULL)
+ PyErr_Clear ();
+ else
+ Py_DECREF (mod);
+
+ Py_RETURN_NONE;
+}
int pygi_foreign_init (void);
+PyObject *pygi_register_foreign (PyObject *self, PyObject *args);
+
#endif /* __PYGI_FOREIGN_H__ */
project('pygobject', 'c',
- version : '3.30.1',
+ version : '3.30.2',
meson_version : '>= 0.46.0',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized'])
with_pycairo = get_option('pycairo')
+cc = meson.get_compiler('c')
+
if with_pycairo
- cairo_dep = dependency('cairo')
- cairo_gobject_dep = dependency('cairo-gobject')
+ cairo_dep = dependency('cairo', required: cc.get_id() != 'msvc')
+ cairo_gobject_dep = dependency('cairo-gobject', required: cc.get_id() != 'msvc')
+
+ if cc.get_id() == 'msvc' and (not cairo_gobject_dep.found() or not cairo_dep.found())
+ if cc.has_header('cairo.h') and cc.has_header ('cairo-gobject.h')
+ cairo_dep = cc.find_library ('cairo')
+ cairo_gobject_dep = cc.find_library ('cairo-gobject')
+ endif
+ endif
if python.language_version().version_compare('>= 3.0')
pycairo_name = 'py3cairo'
)
endif
-cc = meson.get_compiler('c')
+main_c_args = []
+if cc.get_id() == 'msvc'
+ main_c_args += [ '-FImsvc_recommended_pragmas.h' ]
+else
+ main_c_args += [
+ '-Wall',
+ '-Warray-bounds',
+ '-Wcast-align',
+ '-Wdeclaration-after-statement',
+ '-Wduplicated-branches',
+ '-Wextra',
+ '-Wformat=2',
+ '-Wformat-nonliteral',
+ '-Wformat-security',
+ '-Wimplicit-function-declaration',
+ '-Winit-self',
+ '-Wjump-misses-init',
+ '-Wlogical-op',
+ '-Wmissing-declarations',
+ '-Wmissing-format-attribute',
+ '-Wmissing-include-dirs',
+ '-Wmissing-noreturn',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wnull-dereference',
+ '-Wold-style-definition',
+ '-Wpacked',
+ '-Wpointer-arith',
+ '-Wrestrict',
+ '-Wreturn-type',
+ '-Wshadow',
+ '-Wsign-compare',
+ '-Wstrict-aliasing',
+ '-Wstrict-prototypes',
+ '-Wundef',
+ '-Wunused-but-set-variable',
+ '-Wwrite-strings',
+ ]
-main_c_args = [
- '-Wall',
- '-Warray-bounds',
- '-Wcast-align',
- '-Wdeclaration-after-statement',
- '-Wduplicated-branches',
- '-Wextra',
- '-Wformat=2',
- '-Wformat-nonliteral',
- '-Wformat-security',
- '-Wimplicit-function-declaration',
- '-Winit-self',
- '-Wjump-misses-init',
- '-Wlogical-op',
- '-Wmissing-declarations',
- '-Wmissing-format-attribute',
- '-Wmissing-include-dirs',
- '-Wmissing-noreturn',
- '-Wmissing-prototypes',
- '-Wnested-externs',
- '-Wnull-dereference',
- '-Wold-style-definition',
- '-Wpacked',
- '-Wpointer-arith',
- '-Wrestrict',
- '-Wreturn-type',
- '-Wshadow',
- '-Wsign-compare',
- '-Wstrict-aliasing',
- '-Wstrict-prototypes',
- '-Wundef',
- '-Wunused-but-set-variable',
- '-Wwrite-strings',
-]
-
-main_c_args += [
- '-Wno-incompatible-pointer-types-discards-qualifiers',
- '-Wno-missing-field-initializers',
- '-Wno-unused-parameter',
- '-Wno-discarded-qualifiers',
- '-Wno-sign-conversion',
- '-Wno-cast-function-type',
- '-Wno-int-conversion',
-]
-
-main_c_args += [
- '-fno-strict-aliasing',
- '-fvisibility=hidden',
-]
-
-if not ['3.3', '3.4'].contains(python.language_version())
main_c_args += [
- '-Wswitch-default',
+ '-Wno-incompatible-pointer-types-discards-qualifiers',
+ '-Wno-missing-field-initializers',
+ '-Wno-unused-parameter',
+ '-Wno-discarded-qualifiers',
+ '-Wno-sign-conversion',
+ '-Wno-cast-function-type',
+ '-Wno-int-conversion',
+ ]
+
+ main_c_args += [
+ '-fno-strict-aliasing',
+ '-fvisibility=hidden',
]
-endif
-main_c_args = cc.get_supported_arguments(main_c_args)
+ if not ['3.3', '3.4'].contains(python.language_version())
+ main_c_args += [
+ '-Wswitch-default',
+ ]
+ endif
+
+ main_c_args = cc.get_supported_arguments(main_c_args)
+endif
pyext_c_args = ['-DPY_SSIZE_T_CLEAN']
[flake8]
-ignore = E501,E123,E124,E402,E731,E722
-exclude = subprojects
+ignore=E501,E123,E124,E402,E731,E722,W504
+exclude=subprojects
[coverage:run]
-branch = True
-include =
- gi/*
- tests/*
- pygtkcompat/*
-
-[egg_info]
-tag_build =
-tag_date = 0
-
+branch=True
+include=
+ gi/*
+ tests/*
+ pygtkcompat/*
import tarfile
import sysconfig
import tempfile
+import posixpath
+
from email import parser
try:
from distutils.spawn import find_executable
-PYGOBJECT_VERISON = "3.30.1"
+PYGOBJECT_VERISON = "3.30.2"
GLIB_VERSION_REQUIRED = "2.38.0"
GI_VERSION_REQUIRED = "1.46.0"
PYCAIRO_VERSION_REQUIRED = "1.11.1"
"""
if compiler.compiler_type == "msvc":
- # TODO
+ # TODO, not much of need for now.
return []
extra = []
self.build_temp = None
self.build_base = None
self.force = False
+ self.extra_defines = []
def finalize_options(self):
self.set_undefined_options(
else:
compiler.shared_lib_extension = ".so"
+ if compiler.compiler_type == "msvc":
+ g_ir_scanner_cmd = [sys.executable, g_ir_scanner]
+ else:
+ g_ir_scanner_cmd = [g_ir_scanner]
+
def build_ext(ext):
- if compiler.compiler_type == "msvc":
- raise Exception("MSVC support not implemented")
libname = compiler.shared_object_filename(ext.name)
ext_paths = [os.path.join(tests_dir, libname)]
if os.name == "nt":
- implibname = libname + ".a"
+ if compiler.compiler_type == "msvc":
+ # MSVC: Get rid of the 'lib' prefix and the .dll
+ # suffix from libname, and append .lib so
+ # that we get the right .lib filename to
+ # pass to g-ir-scanner with --library
+ implibname = libname[3:libname.rfind(".dll")] + '.lib'
+ else:
+ implibname = libname + ".a"
ext_paths.append(os.path.join(tests_dir, implibname))
if self._newer_group(ext.sources + ext.depends, *ext_paths):
+ # MSVC: We need to define _GI_EXTERN explcitly so that
+ # symbols get exported properly
+ if compiler.compiler_type == "msvc":
+ self.extra_defines = [('_GI_EXTERN',
+ '__declspec(dllexport)extern')]
objects = compiler.compile(
ext.sources,
output_dir=self.build_temp,
- include_dirs=ext.include_dirs)
+ include_dirs=ext.include_dirs,
+ macros=self.extra_defines)
if os.name == "nt":
- postargs = ["-Wl,--out-implib=%s" %
- os.path.join(tests_dir, implibname)]
+ if compiler.compiler_type == "msvc":
+ postargs = ["-implib:%s" %
+ os.path.join(tests_dir, implibname)]
+ else:
+ postargs = ["-Wl,--out-implib=%s" %
+ os.path.join(tests_dir, implibname)]
else:
postargs = []
add_ext_pkg_config_dep(ext, compiler.compiler_type, "gio-2.0")
ext_paths = build_ext(ext)
- gir_path = os.path.join(tests_dir, "GIMarshallingTests-1.0.gir")
- typelib_path = os.path.join(
+ # We want to always use POSIX-style paths for g-ir-compiler
+ # because it expects the input .gir file and .typelib file to use
+ # POSIX-style paths, otherwise it fails
+ gir_path = posixpath.join(
+ tests_dir, "GIMarshallingTests-1.0.gir")
+ typelib_path = posixpath.join(
tests_dir, "GIMarshallingTests-1.0.typelib")
+ gimarshal_g_ir_scanner_cmd = g_ir_scanner_cmd + [
+ "--no-libtool",
+ "--include=Gio-2.0",
+ "--namespace=GIMarshallingTests",
+ "--nsversion=1.0",
+ "--symbol-prefix=gi_marshalling_tests",
+ "--warn-all",
+ "--warn-error",
+ "--library-path=%s" % tests_dir,
+ "--library=gimarshallingtests",
+ "--pkg=glib-2.0",
+ "--pkg=gio-2.0",
+ "--cflags-begin",
+ "-I%s" % gi_tests_dir,
+ "--cflags-end",
+ "--output=%s" % gir_path,
+ ]
+
if self._newer_group(ext_paths, gir_path):
- subprocess.check_call([
- g_ir_scanner,
- "--no-libtool",
- "--include=Gio-2.0",
- "--namespace=GIMarshallingTests",
- "--nsversion=1.0",
- "--symbol-prefix=gi_marshalling_tests",
- "--warn-all",
- "--warn-error",
- "--library-path=%s" % tests_dir,
- "--library=gimarshallingtests",
- "--pkg=glib-2.0",
- "--pkg=gio-2.0",
- "--cflags-begin",
- "-I%s" % gi_tests_dir,
- "--cflags-end",
- "--output=%s" % gir_path,
- ] + ext.sources + ext.depends)
+ subprocess.check_call(gimarshal_g_ir_scanner_cmd +
+ ext.sources + ext.depends)
if self._newer_group([gir_path], typelib_path):
subprocess.check_call([
add_ext_pkg_config_dep(ext, compiler.compiler_type, "cairo-gobject")
ext_paths = build_ext(ext)
- gir_path = os.path.join(tests_dir, "Regress-1.0.gir")
- typelib_path = os.path.join(tests_dir, "Regress-1.0.typelib")
+ # We want to always use POSIX-style paths for g-ir-compiler
+ # because it expects the input .gir file and .typelib file to use
+ # POSIX-style paths, otherwise it fails
+ gir_path = posixpath.join(tests_dir, "Regress-1.0.gir")
+ typelib_path = posixpath.join(tests_dir, "Regress-1.0.typelib")
+ regress_g_ir_scanner_cmd = g_ir_scanner_cmd + [
+ "--no-libtool",
+ "--include=cairo-1.0",
+ "--include=Gio-2.0",
+ "--namespace=Regress",
+ "--nsversion=1.0",
+ "--warn-all",
+ "--warn-error",
+ "--library-path=%s" % tests_dir,
+ "--library=regress",
+ "--pkg=glib-2.0",
+ "--pkg=gio-2.0"]
if self._newer_group(ext_paths, gir_path):
- subprocess.check_call([
- g_ir_scanner,
- "--no-libtool",
- "--include=cairo-1.0",
- "--include=Gio-2.0",
- "--namespace=Regress",
- "--nsversion=1.0",
- "--warn-all",
- "--warn-error",
- "--library-path=%s" % tests_dir,
- "--library=regress",
- "--pkg=glib-2.0",
- "--pkg=gio-2.0",
- "--pkg=cairo",
- "--pkg=cairo-gobject",
- "--output=%s" % gir_path,
- ] + ext.sources + ext.depends)
+ # MSVC: We don't normally have the pkg-config files for
+ # cairo and cairo-gobject, so use --extra-library
+ # instead of --pkg to pass those to the linker, so that
+ # g-ir-scanner won't fail due to linker errors
+ if compiler.compiler_type == "msvc":
+ regress_g_ir_scanner_cmd += [
+ "--extra-library=cairo",
+ "--extra-library=cairo-gobject"]
+
+ else:
+ regress_g_ir_scanner_cmd += [
+ "--pkg=cairo",
+ "--pkg=cairo-gobject"]
+
+ regress_g_ir_scanner_cmd += ["--output=%s" % gir_path]
+
+ subprocess.check_call(regress_g_ir_scanner_cmd +
+ ext.sources + ext.depends)
if self._newer_group([gir_path], typelib_path):
subprocess.check_call([
def add_ext_compiler_flags(ext, compiler, _cache={}):
- cache_key = compiler.compiler[0]
- if cache_key not in _cache:
-
- args = [
- "-Wall",
- "-Warray-bounds",
- "-Wcast-align",
- "-Wdeclaration-after-statement",
- "-Wduplicated-branches",
- "-Wextra",
- "-Wformat=2",
- "-Wformat-nonliteral",
- "-Wformat-security",
- "-Wimplicit-function-declaration",
- "-Winit-self",
- "-Wjump-misses-init",
- "-Wlogical-op",
- "-Wmissing-declarations",
- "-Wmissing-format-attribute",
- "-Wmissing-include-dirs",
- "-Wmissing-noreturn",
- "-Wmissing-prototypes",
- "-Wnested-externs",
- "-Wnull-dereference",
- "-Wold-style-definition",
- "-Wpacked",
- "-Wpointer-arith",
- "-Wrestrict",
- "-Wreturn-type",
- "-Wshadow",
- "-Wsign-compare",
- "-Wstrict-aliasing",
- "-Wstrict-prototypes",
- "-Wundef",
- "-Wunused-but-set-variable",
- "-Wwrite-strings",
- ]
+ if compiler.compiler_type == "msvc":
+ # MSVC: Just force-include msvc_recommended_pragmas.h so that
+ # we can look out for compiler warnings that we really
+ # want to look out for, and filter out those that don't
+ # really matter to us.
+ ext.extra_compile_args += ['-FImsvc_recommended_pragmas.h']
+ else:
+ cache_key = compiler.compiler[0]
+ if cache_key not in _cache:
+
+ args = [
+ "-Wall",
+ "-Warray-bounds",
+ "-Wcast-align",
+ "-Wdeclaration-after-statement",
+ "-Wduplicated-branches",
+ "-Wextra",
+ "-Wformat=2",
+ "-Wformat-nonliteral",
+ "-Wformat-security",
+ "-Wimplicit-function-declaration",
+ "-Winit-self",
+ "-Wjump-misses-init",
+ "-Wlogical-op",
+ "-Wmissing-declarations",
+ "-Wmissing-format-attribute",
+ "-Wmissing-include-dirs",
+ "-Wmissing-noreturn",
+ "-Wmissing-prototypes",
+ "-Wnested-externs",
+ "-Wnull-dereference",
+ "-Wold-style-definition",
+ "-Wpacked",
+ "-Wpointer-arith",
+ "-Wrestrict",
+ "-Wreturn-type",
+ "-Wshadow",
+ "-Wsign-compare",
+ "-Wstrict-aliasing",
+ "-Wstrict-prototypes",
+ "-Wundef",
+ "-Wunused-but-set-variable",
+ "-Wwrite-strings",
+ ]
+
+ if sys.version_info[:2] != (3, 4):
+ args += [
+ "-Wswitch-default",
+ ]
- if sys.version_info[:2] != (3, 4):
args += [
- "-Wswitch-default",
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-parameter",
+ "-Wno-discarded-qualifiers",
+ "-Wno-sign-conversion",
+ "-Wno-cast-function-type",
+ "-Wno-int-conversion",
]
- args += [
- "-Wno-incompatible-pointer-types-discards-qualifiers",
- "-Wno-missing-field-initializers",
- "-Wno-unused-parameter",
- "-Wno-discarded-qualifiers",
- "-Wno-sign-conversion",
- "-Wno-cast-function-type",
- "-Wno-int-conversion",
- ]
-
- # silence clang for unused gcc CFLAGS added by Debian
- args += [
- "-Wno-unused-command-line-argument",
- ]
+ # silence clang for unused gcc CFLAGS added by Debian
+ args += [
+ "-Wno-unused-command-line-argument",
+ ]
- args += [
- "-fno-strict-aliasing",
- "-fvisibility=hidden",
- ]
+ args += [
+ "-fno-strict-aliasing",
+ "-fvisibility=hidden",
+ ]
- # force GCC to use colors
- if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
- args.append("-fdiagnostics-color")
+ # force GCC to use colors
+ if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
+ args.append("-fdiagnostics-color")
- _cache[cache_key] = filter_compiler_arguments(compiler, args)
+ _cache[cache_key] = filter_compiler_arguments(compiler, args)
- ext.extra_compile_args += _cache[cache_key]
+ ext.extra_compile_args += _cache[cache_key]
du_build_ext = get_command_class("build_ext")
gi_ext = Extension(
name='gi._gi',
- sources=sources,
+ sources=sorted(sources),
include_dirs=[script_dir, gi_dir],
depends=list_headers(script_dir) + list_headers(gi_dir),
define_macros=[("PY_SSIZE_T_CLEAN", None)],
--- /dev/null
+glib
+libffi
+gobject-introspection
+pycairo
self.settings.reset('test-enum')
def test_iter(self):
- assert list(self.settings) == [
+ assert set(list(self.settings)) == set([
'test-tuple', 'test-array', 'test-boolean', 'test-string',
- 'test-enum', 'test-range']
+ 'test-enum', 'test-range'])
def test_get_set(self):
for key in self.settings:
[]),
}
+ def test_add_from_string(self):
+ builder = Gtk.Builder()
+ builder.add_from_string(u"")
+ builder.add_from_string("")
+
+ def get_example(string):
+ return u"""\
+<interface>
+ <menu id="appmenu">
+ <section>
+ <item>
+ <attribute name="label">%s</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>""" % string
+
+ builder.add_from_string(get_example(u"ä" * 1000))
+
+ builder = Gtk.Builder()
+ builder.add_objects_from_string(u"", [''])
+ builder.add_objects_from_string("", [''])
+ builder.add_objects_from_string(get_example(u"ä" * 1000), [''])
+
def test_extract_handler_and_args_object(self):
class Obj():
pass