Imported Upstream version 3.30.2 upstream/3.30.2
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 25 Nov 2020 05:47:38 +0000 (14:47 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 25 Nov 2020 05:47:38 +0000 (14:47 +0900)
23 files changed:
.gitignore [new file with mode: 0644]
.gitlab-ci/test-docker.sh
NEWS
PKG-INFO [deleted file]
PyGObject.egg-info/PKG-INFO [deleted file]
PyGObject.egg-info/SOURCES.txt [deleted file]
PyGObject.egg-info/dependency_links.txt [deleted file]
PyGObject.egg-info/not-zip-safe [deleted file]
PyGObject.egg-info/requires.txt [deleted file]
PyGObject.egg-info/top_level.txt [deleted file]
gi/__init__.py
gi/gimodule.c
gi/overrides/Gtk.py
gi/pygi-closure.c
gi/pygi-foreign-cairo.c
gi/pygi-foreign.c
gi/pygi-foreign.h
meson.build
setup.cfg
setup.py
subprojects/.gitignore [new file with mode: 0644]
tests/test_gio.py
tests/test_overrides_gtk.py

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..ea4475d
--- /dev/null
@@ -0,0 +1,86 @@
+*.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
index 1a6dddb89b8139b8e942a02f6be3a0234f108ab6..141d65423e168e96ed9ef1f090b3a359c8c98880 100755 (executable)
@@ -27,7 +27,7 @@ python -m pip install flake8 pytest pytest-faulthandler 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
diff --git a/NEWS b/NEWS
index 00a08bbf8532231a11356178d5cbb1db884cb7e4..bc4b973054c6f82a9e67c116f45aa662a2060a77 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+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
 -------------------
 
diff --git a/PKG-INFO b/PKG-INFO
deleted file mode 100644 (file)
index 8c50c5e..0000000
--- a/PKG-INFO
+++ /dev/null
@@ -1,42 +0,0 @@
-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
diff --git a/PyGObject.egg-info/PKG-INFO b/PyGObject.egg-info/PKG-INFO
deleted file mode 100644 (file)
index 8c50c5e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-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
diff --git a/PyGObject.egg-info/SOURCES.txt b/PyGObject.egg-info/SOURCES.txt
deleted file mode 100644 (file)
index ae9b52d..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-.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
diff --git a/PyGObject.egg-info/dependency_links.txt b/PyGObject.egg-info/dependency_links.txt
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/PyGObject.egg-info/not-zip-safe b/PyGObject.egg-info/not-zip-safe
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/PyGObject.egg-info/requires.txt b/PyGObject.egg-info/requires.txt
deleted file mode 100644 (file)
index 2d8fd4a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-pycairo>=1.11.1
diff --git a/PyGObject.egg-info/top_level.txt b/PyGObject.egg-info/top_level.txt
deleted file mode 100644 (file)
index 25cbcf7..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-gi
-pygtkcompat
index 212136e5776e962a9c970da4d8ebdbccf775978f..bdfd5a9911b0e48fe15c01336ec44b46002ab483 100644 (file)
@@ -62,6 +62,8 @@ _gobject.pygobject_version = _gi.pygobject_version
 version_info = _gi.pygobject_version[:]
 __version__ = "{0}.{1}.{2}".format(*version_info)
 
+_gi.register_foreign()
+
 
 class _DummyStaticModule(types.ModuleType):
     __path__ = None
index e46af02cccc15216f7c644336f0abf6097ae2101..3a616165bb4982e7692fec311d5e18f92b4cd9a5 100644 (file)
@@ -2279,6 +2279,7 @@ static PyMethodDef _gi_functions[] = {
     { "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"
index 05da18aaf23d5f0d49defddc7fa5d2a1673c6d6a..0a0714d7f57cc9addd1eb10d2ac3e07038b2aad2 100644 (file)
@@ -412,7 +412,7 @@ if Gtk._version in ("2.0", "3.0"):
             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)
 
@@ -462,6 +462,14 @@ MenuItem = override(MenuItem)
 __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.
@@ -481,7 +489,7 @@ class Builder(Gtk.Builder):
         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)
 
@@ -489,7 +497,7 @@ class Builder(Gtk.Builder):
         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)
 
index 3299d1be895a15a0857991bb9f19720cda3c5ed4..136eec647297ec7cee3f265917fd435c998ae1fd 100644 (file)
@@ -104,14 +104,14 @@ _pygi_closure_assign_pyobj_to_retval (gpointer retval,
                     *(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;
       }
 }
index c398cb72a4302bd885718ac2bbed5f83e6bc5aec..718f9a0f9690b03f1e3c80a047e658a959df22b6 100644 (file)
@@ -539,6 +539,8 @@ cairo_matrix_release (GIBaseInfo *base_info,
 static PyMethodDef _gi_cairo_functions[] = { {0,} };
 PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
 {
+    PyObject *gobject_mod;
+
 #if PY_VERSION_HEX < 0x03000000
     Pycairo_IMPORT;
 #else
@@ -548,7 +550,10 @@ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
     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",
index 7db28fd785a5887918ae6bfae459312cc11443d7..80a19f7c6d156adf5d52102febee80de7136b297 100644 (file)
@@ -217,3 +217,19 @@ pygi_foreign_init (void)
 
     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;
+}
index c155e4fc9514a4a1b6d16d446d5735b7fedb0e29..d4c50dde8e2a8c350e60ec415683cad8a5f84a6d 100644 (file)
@@ -50,4 +50,6 @@ PyObject *pygi_require_foreign    (PyObject *self,
 
 int pygi_foreign_init (void);
 
+PyObject *pygi_register_foreign (PyObject *self, PyObject *args);
+
 #endif /* __PYGI_FOREIGN_H__ */
index b2af788c5c87da052ace481ba1150fd0909e3018..5bf596809f728cb186cf8f6c3ff1f65fed7073ea 100644 (file)
@@ -1,5 +1,5 @@
 project('pygobject', 'c',
-  version : '3.30.1',
+  version : '3.30.2',
   meson_version : '>= 0.46.0',
   default_options : [ 'warning_level=1',
                       'buildtype=debugoptimized'])
@@ -37,9 +37,18 @@ ffi_dep = dependency('libffi', version : '>= 3.0',
 
 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'
@@ -55,65 +64,68 @@ if with_pycairo
   )
 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']
 
index 2f80f5931a0cb2e76203f27445eb76064ea6da24..33186d68441cea578ab55058061e425a4af08588 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,15 +1,10 @@
 [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/*
index 464097962deac650485596e463fba5f9c7a4314d..1a6620a862462f77215e7232e2b785df5fbbe3f6 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,8 @@ import subprocess
 import tarfile
 import sysconfig
 import tempfile
+import posixpath
+
 from email import parser
 
 try:
@@ -39,7 +41,7 @@ from distutils import dir_util, log
 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"
@@ -214,7 +216,7 @@ def filter_compiler_arguments(compiler, args):
     """
 
     if compiler.compiler_type == "msvc":
-        # TODO
+        # TODO, not much of need for now.
         return []
 
     extra = []
@@ -377,6 +379,7 @@ class build_tests(Command):
         self.build_temp = None
         self.build_base = None
         self.force = False
+        self.extra_defines = []
 
     def finalize_options(self):
         self.set_undefined_options(
@@ -441,25 +444,45 @@ class build_tests(Command):
         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 = []
 
@@ -492,29 +515,35 @@ class build_tests(Command):
         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([
@@ -543,27 +572,43 @@ class build_tests(Command):
         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([
@@ -878,76 +923,83 @@ def add_ext_pkg_config_dep(ext, compiler_type, name):
 
 
 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")
@@ -1121,7 +1173,7 @@ def main():
 
     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)],
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644 (file)
index 0000000..e3ab765
--- /dev/null
@@ -0,0 +1,4 @@
+glib
+libffi
+gobject-introspection
+pycairo
index b5fcdf3cff41723332d54833611ec78ee1d30b02..f3111ea3a04ecb0c624ef1463776e82916c25733 100644 (file)
@@ -67,9 +67,9 @@ class TestGSettings(unittest.TestCase):
         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:
index 1e3655250c271b24fd5dec5e14d90731fae48562..c515e513dec20f9f90b31efc4278ef0f70b209f6 100644 (file)
@@ -822,6 +822,30 @@ class TestBuilder(unittest.TestCase):
                             []),
         }
 
+    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