+commit 5dc113283c0a721c4027026bb8de7243585f1289
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Fri Feb 20 21:59:10 2015 -0800
+
+ Ignore deprecation warning for g_option_group_free()
+
+ gi/pygoptiongroup.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+commit d8961622ea748c42171bdb4703e70022035ec3cc
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Fri Feb 20 21:52:58 2015 -0800
+
+ tests: Make get_all_dependendencies() test more robust
+
+ Replace array comparison with checking if individual items are in
+ the array.
+ This solves a problem where the returned array might be in a
+ different order
+ as well as future proofs the test in case more dependencies are added.
+
+ tests/test_import_machinery.py | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+commit b10ab49afb97655507e2d3b92f621387287a2928
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Fri Feb 20 20:16:35 2015 -0800
+
+ tests: Fix PEP8 error with commented code in test
+
+ tests/test_gi.py | 1 -
+ 1 file changed, 1 deletion(-)
+
+commit 60de632153a693fb2b0f2ce26208c6ff668bdf4d
+Author: Garrett Regier <garrett.regier@riftio.com>
+Date: Tue Jan 27 10:39:53 2015 -0800
+
+ Avoid copying bytearrays from Python to C when transfer nothing
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=743278
+
+ gi/pygi-array.c | 23 +++++++++++++++++++----
+ tests/test_gi.py | 14 +++++++++++++-
+ 2 files changed, 32 insertions(+), 5 deletions(-)
+
+commit a4160892dd28ab1d656cef4d4059f3b3f95caf4a
+Author: Garrett Regier <garrett.regier@riftio.com>
+Date: Mon Jan 19 14:53:53 2015 -0800
+
+ Allows passing arguments to opaque Boxed types
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=743214
+
+ gi/pygi-info.c | 7 +++++++
+ gi/types.py | 10 +++++++++-
+ tests/test_everything.py | 9 +++++++++
+ tests/test_glib.py | 6 +++---
+ 4 files changed, 28 insertions(+), 4 deletions(-)
+
+commit ef3bff4e570363e4f383d4cdae9cecd4073b03d8
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sat Jan 24 20:01:00 2015 +0100
+
+ Emit ImportWarning when gi.require_version() is not used
+
+ gi tries to import the latest version of typelibs which can cause
+ existing code to break when a newer typelib is released.
+ Emit an ImportWarning when gi.require_version() is not used to give
+ developers this awareness so they can future proof their code.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=727379
+
+ gi/importer.py | 99
+ +++++++++++++++++++++++++++++++++++++++++-
+ gi/pygi-repository.c | 35 +++++++++++++++
+ tests/compat_test_pygtk.py | 7 ++-
+ tests/test_atoms.py | 6 ++-
+ tests/test_import_machinery.py | 22 ++++++++++
+ tests/test_overrides_gtk.py | 7 ++-
+ tests/test_overrides_pango.py | 5 ++-
+ tests/test_properties.py | 5 ++-
+ tests/test_repository.py | 10 +++++
+ 9 files changed, 187 insertions(+), 9 deletions(-)
+
+commit 149c31beced944c72fba6ca6e096c81c1100ea2b
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Tue Dec 2 15:38:57 2014 +0100
+
+ Refactor overrides import/modules
+
+ Removes Registry and DynamicModule in favor of a simple module
+ wrapper that
+ contains only overrides and falls back to the introspection module.
+ Moves all the overrides logic into gi.overrides; Speeds up module
+ attribute access
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=736678
+
+ gi/importer.py | 11 ++--
+ gi/module.py | 68 ---------------------
+ gi/overrides/__init__.py | 131
+ ++++++++++++++++++++++++++++++-----------
+ tests/test_gi.py | 4 --
+ tests/test_import_machinery.py | 32 +++++++---
+ 5 files changed, 126 insertions(+), 120 deletions(-)
+
+commit 4d0ab13a8461f781986accc637fada3909cfb91a
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu Aug 21 15:11:39 2014 -0700
+
+ Replace statically bound GLib.Variant.new_tuple() with GI
+
+ Remove the static implementation of _wrap_pyg_variant_new_tuple with
+ usage of the dynamic version coming from GI. Array marshalling has
+ drastically improved in recent years making the dynamic version usable
+ with a small compatibility shim for the arguments.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=735199
+
+ gi/gimodule.c | 39 ---------------------------------------
+ gi/overrides/GLib.py | 12 +++++-------
+ 2 files changed, 5 insertions(+), 46 deletions(-)
+
+commit 17ec0d39069b7a4cc19691ea1284f821caf84d24
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Wed Sep 10 13:30:48 2014 -0700
+
+ overrides: Add Gdk.EventTouch union discrimination
+
+ Add EventTouch to get/setattr pass-through to support BEGIN,
+ UPDATE, END,
+ and CANCEL touch event types. Ensure Gdk.Event methods get_state(),
+ get_axis(), get_coords(), and get_root_coords() are patched onto
+ Gdk.EventTouch.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=736380
+
+ gi/overrides/Gdk.py | 5 +++++
+ tests/test_overrides_gdk.py | 12 ++++++++++++
+ 2 files changed, 17 insertions(+)
+
+commit 16408a81713157cdf1e3b6bd74bd53e816e9dfda
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sat Jan 3 17:20:14 2015 -0800
+
+ tests: Update pixbuf loader test to not raise exception when closing
+
+ GdkPixbuf commit:
+ https://git.gnome.org/browse/gdk-pixbuf/commit/?id=447bd32650af
+ changed the close() method to raise if the a loader is prematurely
+ closed.
+ Update the test to write a 1x1 PNG stream to ensure close() will
+ succeed.
+
+ tests/compat_test_pygtk.py | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+commit fd3935541ab4baddb504e000ec659b80923afa13
+Author: Murray Cumming <murrayc@murrayc.com>
+Date: Tue Dec 2 19:55:51 2014 +0100
+
+ PyGObjectFlags: Remove a trailing comma on the enum.
+
+ Because this produces a g++ pedantic warning.
+
+ gi/pygobject.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 3b70f5bc8e59e49795fcaa7b285aeff0c4565a04
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Mon Oct 27 20:19:23 2014 -0700
+
+ Remove redefinitions of function and vfunc cache typedefs
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=737874
+
+ gi/pygi-cache.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+commit cec9c2b253bdbc1e6493630c533acf6bb4509114
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Mon Sep 22 13:26:24 2014 -0700
+
+ configure.ac: post release version bump to 3.15.0
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
commit f20df385f480b65a8128986ce3df4022b324ade0
Author: Simon Feltman <sfeltman@src.gnome.org>
Date: Mon Sep 22 12:38:35 2014 -0700
+3.15.0 20-Feb-2015
+ - Avoid copying bytearrays from Python to C when transfer nothing (Garrett Regier) (#743278)
+ - Allows passing arguments to opaque Boxed types (Garrett Regier) (#743214)
+ - Emit ImportWarning when gi.require_version() is not used (Christoph Reiter) (#727379)
+ - Refactor overrides import/modules (Christoph Reiter) (#736678)
+ - Replace statically bound GLib.Variant.new_tuple() with GI (Simon Feltman) (#735199)
+ - overrides: Add Gdk.EventTouch union discrimination (Simon Feltman) (#736380)
+ - PyGObjectFlags: Remove a trailing comma on the enum. (Murray Cumming)
+ - Remove redefinitions of function and vfunc cache typedefs (Simon Feltman) (#737874)
+
3.14.0 22-Sep-2014
- configure.ac: pre release version bump to 3.14.0 (Simon Feltman)
Metadata-Version: 1.0
Name: PyGObject
-Version: 3.14.0
+Version: 3.15.0
Summary: Python bindings for GObject
Home-page: http://www.pygtk.org/
Author: James Henstridge
Maintainer: Simon Feltman
Maintainer-email: sfeltman@src.gnome.org
License: GNU LGPL
-Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.14/pygobject-3.14.0.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.15/pygobject-3.15.0.tar.gz
Description: Python bindings for GLib and GObject
Platform: POSIX, Windows
Classifier: Development Status :: 5 - Production/Stable
# gnome-compiler-flags.m4
#
-# serial 2
+# serial 4
#
dnl GNOME_COMPILE_WARNINGS
dnl Additional warning/error flags can be passed as an optional second argument.
dnl
dnl For example: GNOME_COMPILE_WARNINGS([maximum],[-Werror=some-flag -Wfoobar])
-AC_DEFUN([GNOME_COMPILE_WARNINGS],[
+AU_DEFUN([GNOME_COMPILE_WARNINGS],[
dnl ******************************
dnl More compiler warnings
dnl ******************************
-Werror=format-security \
-Werror=format=2 \
-Werror=missing-include-dirs \
+ -Werror=return-type \
"
dnl Additional warning or error flags provided by the module author to
WARN_CFLAGS="$tested_warning_flags $complCFLAGS"
AC_SUBST(WARN_CFLAGS)
-])
+],
+[[$0: This macro is deprecated. You should use AX_COMPILER_FLAGS instead and
+eliminate use of --enable-iso-c.
+See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
dnl For C++, do basically the same thing.
-AC_DEFUN([GNOME_CXX_WARNINGS],[
+AU_DEFUN([GNOME_CXX_WARNINGS],[
AC_ARG_ENABLE(cxx-warnings,
AS_HELP_STRING([--enable-cxx-warnings=@<:@no/minimum/yes@:>@]
[Turn on compiler warnings.]),,
WARN_CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
AC_SUBST(WARN_CXXFLAGS)
-])
+],
+[[$0: This macro is deprecated. You should use AX_COMPILER_FLAGS instead and
+eliminate use of --enable-iso-cxx.
+See: http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html#ax_compiler_flags]])
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
#! /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, 2010,
-# 2011, 2012, 2013 Free Software Foundation, Inc.
+# Copyright 1992-2014 Free Software Foundation, Inc.
-timestamp='2012-12-29'
+timestamp='2014-03-23'
# 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
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
-# Originally written by Per Bothner.
+# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
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, 2009, 2010, 2011,
-2012, 2013 Free Software Foundation, Inc.
+Copyright 1992-2014 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."
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ LIBC=gnu
+
+ eval $set_cc_for_build
+ cat <<-EOF > $dummy.c
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #else
+ LIBC=gnu
+ #endif
+ EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ ;;
+esac
+
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
- i*:MSYS*:*)
+ *:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
exit ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
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}
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
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}"
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
- or32:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ openrisc*:Linux:*:*)
+ echo or1k-unknown-linux-${LIBC}
+ exit ;;
+ or32:Linux:*:* | or1k*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
+ echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
+ echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
+ echo powerpc-unknown-linux-${LIBC}
+ exit ;;
+ ppc64le:Linux:*:*)
+ echo powerpc64le-unknown-linux-${LIBC}
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
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
+ eval $set_cc_for_build
+ if test "$UNAME_PROCESSOR" = unknown ; then
+ UNAME_PROCESSOR=powerpc
+ fi
+ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ fi
+ elif test "$UNAME_PROCESSOR" = i386 ; then
+ # Avoid executing cc on OS X 10.9, as it ships with a stub
+ # that puts up a graphical alert prompting to install
+ # developer tools. Any system running Mac OS X 10.7 or
+ # later (Darwin 11 and later) is required to have a 64-bit
+ # processor. This is not true of the ARM version of Darwin
+ # that Apple uses in portable devices.
+ UNAME_PROCESSOR=x86_64
+ fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
exit ;;
esac
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#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 <sys/param.h>
- 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 <sys/param.h>
-# 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 <<EOF
$0: unable to guess system type
#! /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, 2010,
-# 2011, 2012, 2013 Free Software Foundation, Inc.
+# Copyright 1992-2014 Free Software Foundation, Inc.
-timestamp='2012-12-29'
+timestamp='2014-07-28'
# 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
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-2012, 2013 Free Software Foundation, Inc.
+Copyright 1992-2014 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."
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc \
+ | arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \
- | c4x | clipper \
+ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
- | nios | nios2 \
+ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
- | open8 \
- | or32 \
+ | open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
- | clipper-* | craynv-* | cydra-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
+ | or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
os=-mingw64
;;
mingw32)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
basic_machine=powerpc-unknown
os=-morphos
;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ os=-moxiebox
+ ;;
msdos)
basic_machine=i386-pc
os=-msdos
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-msys
;;
mvs)
-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* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -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*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
c4x-* | tic4x-*)
os=-coff
;;
+ c8051-*)
+ os=-elf
+ ;;
hexagon-*)
os=-elf
;;
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.14.0.
+# Generated by GNU Autoconf 2.69 for pygobject 3.15.0.
#
# Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
#
# Identity of this package.
PACKAGE_NAME='pygobject'
PACKAGE_TARNAME='pygobject'
-PACKAGE_VERSION='3.14.0'
-PACKAGE_STRING='pygobject 3.14.0'
+PACKAGE_VERSION='3.15.0'
+PACKAGE_STRING='pygobject 3.15.0'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
PACKAGE_URL='https://wiki.gnome.org/Projects/PyGObject/'
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures pygobject 3.14.0 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.15.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pygobject 3.14.0:";;
+ short | recursive ) echo "Configuration of pygobject 3.15.0:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pygobject configure 3.14.0
+pygobject configure 3.15.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by pygobject $as_me 3.14.0, which was
+It was created by pygobject $as_me 3.15.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
PYGOBJECT_MAJOR_VERSION=3
-$as_echo "#define PYGOBJECT_MINOR_VERSION 14" >>confdefs.h
+$as_echo "#define PYGOBJECT_MINOR_VERSION 15" >>confdefs.h
-PYGOBJECT_MINOR_VERSION=14
+PYGOBJECT_MINOR_VERSION=15
$as_echo "#define PYGOBJECT_MICRO_VERSION 0" >>confdefs.h
# Define the identity of the package.
PACKAGE='pygobject'
- VERSION='3.14.0'
+ VERSION='3.15.0'
cat >>confdefs.h <<_ACEOF
-Werror=format-security \
-Werror=format=2 \
-Werror=missing-include-dirs \
+ -Werror=return-type \
"
additional_flags=""
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by pygobject $as_me 3.14.0, which was
+This file was extended by pygobject $as_me 3.15.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-pygobject config.status 3.14.0
+pygobject config.status 3.15.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
dnl the pygobject version number
m4_define(pygobject_major_version, 3)
-m4_define(pygobject_minor_version, 14)
+m4_define(pygobject_minor_version, 15)
m4_define(pygobject_micro_version, 0)
m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
#endif
static PyObject *
-_wrap_pyg_variant_new_tuple (PyObject *self, PyObject *args)
-{
- PyObject *py_values;
- GVariant **values = NULL;
- GVariant *variant = NULL;
- PyObject *py_variant = NULL;
- PyObject *py_type;
- gssize i;
-
- if (!PyArg_ParseTuple (args, "O!:variant_new_tuple",
- &PyTuple_Type, &py_values)) {
- return NULL;
- }
-
- py_type = _pygi_type_import_by_name ("GLib", "Variant");
-
- values = g_newa (GVariant*, PyTuple_Size (py_values));
-
- for (i = 0; i < PyTuple_Size (py_values); i++) {
- PyObject *value = PyTuple_GET_ITEM (py_values, i);
-
- if (!PyObject_IsInstance (value, py_type)) {
- PyErr_Format (PyExc_TypeError, "argument %" G_GSSIZE_FORMAT " is not a GLib.Variant", i);
- return NULL;
- }
-
- values[i] = pyg_pointer_get (value, GVariant);
- }
-
- variant = g_variant_new_tuple (values, PyTuple_Size (py_values));
- g_variant_ref_sink (variant);
-
- py_variant = _pygi_struct_new ( (PyTypeObject *) py_type, variant, FALSE);
-
- return py_variant;
-}
-
-static PyObject *
_wrap_pyg_variant_type_from_string (PyObject *self, PyObject *args)
{
char *type_string;
{ "register_interface_info", (PyCFunction) _wrap_pyg_register_interface_info, METH_VARARGS },
{ "hook_up_vfunc_implementation", (PyCFunction) _wrap_pyg_hook_up_vfunc_implementation, METH_VARARGS },
- { "variant_new_tuple", (PyCFunction) _wrap_pyg_variant_new_tuple, METH_VARARGS },
{ "variant_type_from_string", (PyCFunction) _wrap_pyg_variant_type_from_string, METH_VARARGS },
{ "source_new", (PyCFunction) _wrap_pyg_source_new, METH_NOARGS },
{ "source_set_callback", (PyCFunction) pyg_source_set_callback, METH_VARARGS },
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2005-2009 Johan Dahlin <johan@gnome.org>
+# 2015 Christoph Reiter
#
# importer.py: dynamic importer for introspected libraries.
#
from __future__ import absolute_import
import sys
+import warnings
+from contextlib import contextmanager
+import gi
from ._gi import Repository
-from .module import DynamicModule
+from .module import get_introspection_module
+from .overrides import load_overrides
repository = Repository.get_default()
+
+# only for backwards compatibility
modules = {}
+def _get_all_dependencies(namespace):
+ """Like get_dependencies() but will recurse and get all dependencies.
+ The namespace has to be loaded before this can be called.
+
+ ::
+
+ _get_all_dependencies('Gtk') -> ['Atk-1.0', 'GObject-2.0', ...]
+ """
+
+ todo = repository.get_dependencies(namespace)
+ dependencies = []
+
+ while todo:
+ current = todo.pop()
+ if current in dependencies:
+ continue
+ ns, version = current.split("-", 1)
+ todo.extend(repository.get_dependencies(ns))
+ dependencies.append(current)
+
+ return dependencies
+
+
+# See _check_require_version()
+_active_imports = []
+_implicit_required = {}
+
+
+@contextmanager
+def _check_require_version(namespace, stacklevel):
+ """A context manager which tries to give helpful warnings
+ about missing gi.require_version() which could potentially
+ break code if only an older version than expected is installed
+ or a new version gets introduced.
+
+ ::
+
+ with _check_require_version("Gtk", stacklevel):
+ load_namespace_and_overrides()
+ """
+
+ global _active_imports, _implicit_required
+
+ # This keeps track of the recursion level so we only check for
+ # explicitly imported namespaces and not the ones imported in overrides
+ _active_imports.append(namespace)
+
+ try:
+ yield
+ except:
+ raise
+ else:
+ # Keep track of all dependency versions forced due to this import, so
+ # we don't warn for them in the future. This mirrors the import
+ # behavior where importing will get an older version if a previous
+ # import depended on it.
+ for dependency in _get_all_dependencies(namespace):
+ ns, version = dependency.split("-", 1)
+ _implicit_required[ns] = version
+ finally:
+ _active_imports.remove(namespace)
+
+ # Warn in case:
+ # * this namespace was explicitly imported
+ # * the version wasn't forced using require_version()
+ # * the version wasn't forced implicitly by a previous import
+ # * this namespace isn't part of glib (we have bigger problems if
+ # versions change there)
+ is_explicit_import = not _active_imports
+ version_required = gi.get_required_version(namespace) is not None
+ version_implicit = namespace in _implicit_required
+ is_in_glib = namespace in ("GLib", "GObject", "Gio")
+
+ if is_explicit_import and not version_required and \
+ not version_implicit and not is_in_glib:
+ version = repository.get_version(namespace)
+ warnings.warn(
+ "%(namespace)s was imported without specifying a version first. "
+ "Use gi.require_version('%(namespace)s', '%(version)s') before "
+ "import to ensure that the right version gets loaded."
+ % {"namespace": namespace, "version": version},
+ ImportWarning, stacklevel=stacklevel)
+
+
class DynamicImporter(object):
# Note: see PEP302 for the Importer Protocol implemented below.
return sys.modules[fullname]
path, namespace = fullname.rsplit('.', 1)
- dynamic_module = DynamicModule(namespace)
- modules[namespace] = dynamic_module
+
+ # we want the warning to point to the line doing the import
+ if sys.version_info >= (3, 0):
+ stacklevel = 10
+ else:
+ stacklevel = 4
+ with _check_require_version(namespace, stacklevel=stacklevel):
+ introspection_module = get_introspection_module(namespace)
+ dynamic_module = load_overrides(introspection_module)
dynamic_module.__file__ = '<%s>' % fullname
dynamic_module.__loader__ = self
-
sys.modules[fullname] = dynamic_module
- dynamic_module._load()
return dynamic_module
from __future__ import absolute_import
import sys
-import types
import importlib
_have_py3 = (sys.version_info[0] >= 3)
from string import maketrans
import gi
-from .overrides import registry
from ._gi import \
Repository, \
module = IntrospectionModule(namespace, version)
_introspection_modules[namespace] = module
return module
-
-
-class DynamicModule(types.ModuleType):
- """A module composed of an IntrospectionModule and an overrides module.
-
- DynamicModule wraps up an IntrospectionModule and an overrides module
- into a single accessible module. This is what is returned from statements
- like "from gi.repository import Foo". Accessing attributes on a DynamicModule
- will first look overrides (or the gi.overrides.registry cache) and then
- in the introspection module if it was not found as an override.
- """
- def __init__(self, namespace):
- self._namespace = namespace
- self._introspection_module = None
- self._overrides_module = None
- self.__path__ = None
-
- def _load(self):
- self._introspection_module = get_introspection_module(self._namespace)
- try:
- self._overrides_module = importlib.import_module('gi.overrides.' + self._namespace)
- except ImportError:
- self._overrides_module = None
-
- self.__path__ = repository.get_typelib_path(self._namespace)
- if _have_py3:
- # get_typelib_path() delivers bytes, not a string
- self.__path__ = self.__path__.decode('UTF-8')
-
- def __getattr__(self, name):
- if self._overrides_module is not None:
- override_exports = getattr(self._overrides_module, '__all__', ())
- if name in override_exports:
- return getattr(self._overrides_module, name, None)
- else:
- # check the registry just in case the module hasn't loaded yet
- # TODO: Only gtypes are registered in the registry right now
- # but it would be nice to register all overrides and
- # get rid of the module imports. We might actually see a
- # speedup.
- key = '%s.%s' % (self._namespace, name)
- if key in registry:
- return registry[key]
-
- return getattr(self._introspection_module, name)
-
- def __dir__(self):
- # Python's default dir() is just dir(self.__class__) + self.__dict__.keys()
- result = set(dir(self.__class__))
- result.update(self.__dict__.keys())
-
- result.update(dir(self._introspection_module))
- override_exports = getattr(self._overrides_module, '__all__', ())
- result.update(override_exports)
- return list(result)
-
- def __repr__(self):
- path = repository.get_typelib_path(self._namespace)
- if _have_py3:
- # get_typelib_path() delivers bytes, not a string
- path = path.decode('UTF-8')
-
- return "<%s.%s %r from %r>" % (self.__class__.__module__,
- self.__class__.__name__,
- self._namespace,
- path)
import sys
from ..module import get_introspection_module
-from .._gi import (variant_new_tuple, variant_type_from_string, source_new,
+from .._gi import (variant_type_from_string, source_new,
source_set_callback, io_channel_read)
from ..overrides import override, deprecated
from gi import PyGIDeprecationWarning, version_info
v.format_string = format_string
return v
+ @staticmethod
+ def new_tuple(*elements):
+ return GLib.Variant.new_tuple(elements)
+
def __del__(self):
self.unref()
return res
-@classmethod
-def new_tuple(cls, *elements):
- return variant_new_tuple(elements)
-
-
def get_string(self):
value, length = GLib.Variant.get_string(self)
return value
-setattr(Variant, 'new_tuple', new_tuple)
setattr(Variant, 'get_string', get_string)
__all__.append('Variant')
Gdk.EventType.DROP_FINISHED: 'dnd',
Gdk.EventType.CLIENT_EVENT: 'client',
Gdk.EventType.VISIBILITY_NOTIFY: 'visibility',
+ Gdk.EventType.TOUCH_BEGIN: 'touch',
+ Gdk.EventType.TOUCH_UPDATE: 'touch',
+ Gdk.EventType.TOUCH_END: 'touch',
+ Gdk.EventType.TOUCH_CANCEL: 'touch',
}
if Gdk._version == '2.0':
'EventVisibility',
'EventMotion',
'EventButton',
+ 'EventTouch',
'EventScroll',
'EventKey',
'EventCrossing',
import types
import warnings
+import importlib
+import sys
from gi import PyGIDeprecationWarning
from gi._gi import CallableInfo
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
-registry = None
-
def wraps(wrapped):
def assign(wrapper):
return assign
-class _Registry(dict):
- def __setitem__(self, key, value):
- """We do checks here to make sure only submodules of the override
- module are added. Key and value should be the same object and come
- from the gi.override module.
+class OverridesProxyModule(types.ModuleType):
+ """Wraps a introspection module and contains all overrides"""
- We add the override to the dict as "override_module.name". For instance
- if we were overriding Gtk.Button you would retrive it as such:
- registry['Gtk.Button']
- """
- if not key == value:
- raise KeyError('You have tried to modify the registry. This should only be done by the override decorator')
+ def __init__(self, introspection_module):
+ super(OverridesProxyModule, self).__init__(
+ introspection_module.__name__)
+ self._introspection_module = introspection_module
- try:
- info = getattr(value, '__info__')
- except AttributeError:
- raise TypeError('Can not override a type %s, which is not in a gobject introspection typelib' % value.__name__)
+ def __getattr__(self, name):
+ return getattr(self._introspection_module, name)
- if not value.__module__.startswith('gi.overrides'):
- raise KeyError('You have tried to modify the registry outside of the overrides module. '
- 'This is not allowed (%s, %s)' % (value, value.__module__))
+ def __dir__(self):
+ result = set(dir(self.__class__))
+ result.update(self.__dict__.keys())
+ result.update(dir(self._introspection_module))
+ return sorted(result)
+
+ def __repr__(self):
+ return "<%s %r>" % (type(self).__name__, self._introspection_module)
- g_type = info.get_g_type()
- assert g_type != TYPE_NONE
- if g_type != TYPE_INVALID:
- g_type.pytype = value
- # strip gi.overrides from module name
- module = value.__module__[13:]
- key = "%s.%s" % (module, value.__name__)
- super(_Registry, self).__setitem__(key, value)
+def load_overrides(introspection_module):
+ """Loads overrides for an introspection module.
- def register(self, override_class):
- self[override_class] = override_class
+ Either returns the same module again in case there are no overrides or a
+ proxy module including overrides. Doesn't cache the result.
+ """
+
+ namespace = introspection_module.__name__.rsplit(".", 1)[-1]
+ module_key = 'gi.repository.' + namespace
+
+ # We use sys.modules so overrides can import from gi.repository
+ # but restore everything at the end so this doesn't have any side effects
+ has_old = module_key in sys.modules
+ old_module = sys.modules.get(module_key)
+
+ proxy = OverridesProxyModule(introspection_module)
+ sys.modules[module_key] = proxy
+
+ # backwards compat:
+ # gedit uses gi.importer.modules['Gedit']._introspection_module
+ from ..importer import modules
+ assert hasattr(proxy, "_introspection_module")
+ modules[namespace] = proxy
+
+ try:
+ try:
+ override_mod = importlib.import_module('gi.overrides.' + namespace)
+ except ImportError:
+ return introspection_module
+ finally:
+ del modules[namespace]
+ del sys.modules[module_key]
+ if has_old:
+ sys.modules[module_key] = old_module
+
+ override_all = []
+ if hasattr(override_mod, "__all__"):
+ override_all = override_mod.__all__
+
+ for var in override_all:
+ try:
+ item = getattr(override_mod, var)
+ except (AttributeError, TypeError):
+ # Gedit puts a non-string in __all__, so catch TypeError here
+ continue
+ setattr(proxy, var, item)
+
+ return proxy
class overridefunc(object):
def __init__(self, func):
if not isinstance(func, CallableInfo):
raise TypeError("func must be a gi function, got %s" % func)
- from ..importer import modules
+
module_name = func.__module__.rsplit('.', 1)[-1]
- self.module = modules[module_name]._introspection_module
+ self.module = sys.modules["gi.repository." + module_name]
def __call__(self, func):
setattr(self.module, func.__name__, func)
return func
-registry = _Registry()
-
def override(type_):
- """Decorator for registering an override"""
+ """Decorator for registering an override.
+
+ Other than objects added to __all__, these can get referenced in the same
+ override module via the gi.repository module (get_parent_for_object() does
+ for example), so they have to be added to the module immediately.
+ """
+
if isinstance(type_, (types.FunctionType, CallableInfo)):
return overridefunc(type_)
else:
- registry.register(type_)
+ try:
+ info = getattr(type_, '__info__')
+ except AttributeError:
+ raise TypeError(
+ 'Can not override a type %s, which is not in a gobject '
+ 'introspection typelib' % type_.__name__)
+
+ if not type_.__module__.startswith('gi.overrides'):
+ raise KeyError(
+ 'You have tried override outside of the overrides module. '
+ 'This is not allowed (%s, %s)' % (type_, type_.__module__))
+
+ g_type = info.get_g_type()
+ assert g_type != TYPE_NONE
+ if g_type != TYPE_INVALID:
+ g_type.pytype = type_
+
+ namespace = type_.__module__.rsplit(".", 1)[-1]
+ module = sys.modules["gi.repository." + namespace]
+ setattr(module, type_.__name__, type_)
+
return type_
GArray *array_ = NULL;
PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache;
PyGIArgGArray *array_cache = (PyGIArgGArray *)arg_cache;
+ GITransfer cleanup_transfer = arg_cache->transfer;
if (py_arg == Py_None) {
if (sequence_cache->item_cache->type_tag == GI_TYPE_TAG_UINT8 &&
PYGLIB_PyBytes_Check (py_arg)) {
- memcpy(array_->data, PYGLIB_PyBytes_AsString (py_arg), length);
+ gchar *data = PYGLIB_PyBytes_AsString (py_arg);
+
+ /* Avoid making a copy if the data
+ * is not transferred to the C function
+ * and cannot not be modified by it.
+ */
+ if (array_cache->array_type == GI_ARRAY_TYPE_C &&
+ arg_cache->transfer == GI_TRANSFER_NOTHING &&
+ !array_cache->is_zero_terminated) {
+ g_free (array_->data);
+ array_->data = data;
+ cleanup_transfer = GI_TRANSFER_EVERYTHING;
+ } else {
+ memcpy (array_->data, data, length);
+ }
array_->len = length;
if (array_cache->is_zero_terminated) {
/* If array_ has been created with zero_termination, space for the
*/
arg->v_pointer = array_->data;
- if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) {
+ if (cleanup_transfer == GI_TRANSFER_EVERYTHING) {
g_array_free (array_, FALSE);
*cleanup_data = NULL;
} else {
} else {
arg->v_pointer = array_;
- if (arg_cache->transfer == GI_TRANSFER_NOTHING) {
+ if (cleanup_transfer == GI_TRANSFER_NOTHING) {
/* Free everything in cleanup. */
*cleanup_data = array_;
- } else if (arg_cache->transfer == GI_TRANSFER_CONTAINER) {
+ } else if (cleanup_transfer == GI_TRANSFER_CONTAINER) {
/* Make a shallow copy so we can free the elements later in cleanup
* because it is possible invoke will free the list before our cleanup. */
*cleanup_data = is_ptr_array ?
GICallableInfo *callable_info);
};
-typedef struct _PyGIFunctionCache {
+struct _PyGIFunctionCache {
PyGICallableCache callable_cache;
/* An invoker with ffi_cif already setup */
PyGIInvokeState *state,
PyObject *py_args,
PyObject *py_kwargs);
-} PyGIFunctionCache;
+} ;
-typedef struct _PyGIVFuncCache {
+struct _PyGIVFuncCache {
PyGIFunctionWithInstanceCache fwi_cache;
GIBaseInfo *info;
-} PyGIVFuncCache;
+};
gboolean
return _make_infos_tuple (self, g_union_info_get_n_methods, g_union_info_get_method);
}
+static PyObject *
+_wrap_g_union_info_get_size (PyGIBaseInfo *self)
+{
+ return PYGLIB_PyLong_FromSize_t (g_union_info_get_size (self->info));
+}
+
static PyMethodDef _PyGIUnionInfo_methods[] = {
{ "get_fields", (PyCFunction) _wrap_g_union_info_get_fields, METH_NOARGS },
{ "get_methods", (PyCFunction) _wrap_g_union_info_get_methods, METH_NOARGS },
+ { "get_size", (PyCFunction) _wrap_g_union_info_get_size, METH_NOARGS },
{ NULL, NULL, 0 }
};
return py_namespaces;
}
+static PyObject *
+_wrap_g_irepository_get_dependencies (PyGIRepository *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "namespace", NULL };
+ const char *namespace_;
+ char **namespaces;
+ PyObject *py_namespaces;
+ gssize i;
+
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs,
+ "s:Repository.get_dependencies", kwlist, &namespace_)) {
+ return NULL;
+ }
+
+ py_namespaces = PyList_New (0);
+ /* Returns NULL in case of no dependencies */
+ namespaces = g_irepository_get_dependencies (self->repository, namespace_);
+ if (namespaces == NULL) {
+ return py_namespaces;
+ }
+
+ for (i = 0; namespaces[i] != NULL; i++) {
+ PyObject *py_namespace = PYGLIB_PyUnicode_FromString (namespaces[i]);
+ PyList_Append (py_namespaces, py_namespace);
+ Py_DECREF(py_namespace);
+ }
+
+ g_strfreev (namespaces);
+
+ return py_namespaces;
+}
+
static PyMethodDef _PyGIRepository_methods[] = {
{ "enumerate_versions", (PyCFunction) _wrap_g_irepository_enumerate_versions, METH_VARARGS | METH_KEYWORDS },
{ "get_default", (PyCFunction) _wrap_g_irepository_get_default, METH_STATIC | METH_NOARGS },
{ "get_typelib_path", (PyCFunction) _wrap_g_irepository_get_typelib_path, METH_VARARGS | METH_KEYWORDS },
{ "get_version", (PyCFunction) _wrap_g_irepository_get_version, METH_VARARGS | METH_KEYWORDS },
{ "get_loaded_namespaces", (PyCFunction) _wrap_g_irepository_get_loaded_namespaces, METH_NOARGS },
+ { "get_dependencies", (PyCFunction) _wrap_g_irepository_get_dependencies, METH_VARARGS | METH_KEYWORDS },
{ NULL, NULL, 0 }
};
typedef enum {
PYGOBJECT_USING_TOGGLE_REF = 1 << 0,
PYGOBJECT_IS_FLOATING_REF = 1 << 1,
- PYGOBJECT_GOBJECT_WAS_FLOATING = 1 << 2,
+ PYGOBJECT_GOBJECT_WAS_FLOATING = 1 << 2
} PyGObjectFlags;
/* closures is just an alias for what is found in the
{
GOptionGroup *tmp = self->group;
self->group = NULL;
- if (tmp)
+ if (tmp) {
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_option_group_free(tmp);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+ }
}
PyObject_Del(self);
return bases
+def nothing(*args, **kwargs):
+ pass
+
+
class StructMeta(type, MetaClassHelper):
"""Meta class used for GI Struct based types."""
for method_info in cls.__info__.get_methods():
if method_info.is_constructor() and \
method_info.__name__ == 'new' and \
- not method_info.get_arguments():
+ (not method_info.get_arguments() or
+ cls.__info__.get_size() == 0):
cls.__new__ = staticmethod(method_info)
+ # Boxed will raise an exception
+ # if arguments are given to __init__
+ cls.__init__ = nothing
break
@property
import unittest
import contextlib
+import base64
+import gi
from gi.repository import GLib
try:
+ try:
+ gi.require_version("Gtk", "3.0")
+ except ValueError as e:
+ raise ImportError(e)
+ from gi.repository import Gtk
from gi.repository import Pango
from gi.repository import Atk
from gi.repository import Gdk
- from gi.repository import Gtk
(Atk, Gtk, Pango) # pyflakes
import pygtkcompat
gtk.gdk.Pixbuf()
def test_pixbuf_loader(self):
+ # load a 1x1 pixel PNG from memory
+ data = base64.b64decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP4n8Dw'
+ 'HwAGIAJf85Z3XgAAAABJRU5ErkJggg==')
loader = gtk.gdk.PixbufLoader('png')
+ loader.write(data)
loader.close()
+ pixbuf = loader.get_pixbuf()
+ self.assertEqual(pixbuf.get_width(), 1)
+ self.assertEqual(pixbuf.get_height(), 1)
+
def test_pixbuf_formats(self):
formats = gtk.gdk.pixbuf_get_formats()
self.assertEqual(type(formats[0]), dict)
import unittest
try:
- from gi.repository import Atk, Gdk, Gtk
+ import gi
+ gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk, Atk, Gdk
(Atk, Gdk) # pyflakes
-except:
+except (ValueError, ImportError):
Gdk = None
self.assertTrue(boxed42_2.equals(boxed42))
self.assertTrue(boxed42.equals(boxed42))
+ def test_boxed_b_constructor(self):
+ with warnings.catch_warnings(record=True) as warn:
+ warnings.simplefilter('always')
+ boxed = Everything.TestBoxedB(42, 47)
+ self.assertTrue(issubclass(warn[0].category, TypeError))
+
+ self.assertEqual(boxed.some_int8, 0)
+ self.assertEqual(boxed.some_long, 0)
+
def test_boxed_c_equality(self):
boxed = Everything.TestBoxedC()
# TestBoxedC uses refcounting, so we know that
self.assertEqual(b'\x001\xFF3', GIMarshallingTests.bytearray_full_return())
def test_bytearray_none_in(self):
- GIMarshallingTests.bytearray_none_in(b'\x00\x31\xFF\x33')
+ b = b'\x00\x31\xFF\x33'
+ ba = GLib.ByteArray.new_take(b)
+
+ # b should always have the same value even
+ # though the generated GByteArray is being modified
+ GIMarshallingTests.bytearray_none_in(b)
+ GIMarshallingTests.bytearray_none_in(b)
+
+ # The GByteArray is just a bytes
+ # thus it will not reflect any changes
+ GIMarshallingTests.bytearray_none_in(ba)
+ GIMarshallingTests.bytearray_none_in(ba)
class TestGList(unittest.TestCase):
object_ = self.SubObject(int=1)
self.assertEqual(object_.vfunc_return_value_only(), 2121)
- def test_dynamic_module(self):
- from gi.module import DynamicModule
- self.assertTrue(isinstance(GObject, DynamicModule))
-
def test_subobject_non_vfunc_do_method(self):
class PythonObjectWithNonVFuncDoMethod(object):
def do_not_a_vfunc(self):
self.assertGreaterEqual(minor, 0)
self.assertGreaterEqual(micro, 0)
- def test_timezone_constructor_error(self):
- self.assertRaisesRegexp(TypeError, '.*constructor.*help\(GLib.TimeZone\).*',
- GLib.TimeZone)
+ def test_timezone_constructor(self):
+ timezone = GLib.TimeZone("+05:21")
+ self.assertEqual(timezone.get_offset(0), ((5 * 60) + 21) * 60)
def test_source_attach_implicit_context(self):
context = GLib.MainContext.default()
import gi.overrides
import gi.module
+import gi.importer
try:
from gi.repository import Regress
Regress = None
-class TestRegistry(unittest.TestCase):
+class TestOverrides(unittest.TestCase):
+
def test_non_gi(self):
class MyClass:
pass
# https://bugzilla.gnome.org/show_bug.cgi?id=680913
self.assertEqual(Regress.REGRESS_OVERRIDE, 42)
+ def test_load_overrides(self):
+ mod = gi.module.get_introspection_module('GIMarshallingTests')
+ mod_override = gi.overrides.load_overrides(mod)
+ self.assertTrue(mod_override is not mod)
+ self.assertTrue(mod_override._introspection_module is mod)
+ self.assertEqual(mod_override.OVERRIDES_CONSTANT, 7)
+ self.assertEqual(mod.OVERRIDES_CONSTANT, 42)
+
+ def test_load_no_overrides(self):
+ mod_key = "gi.overrides.GIMarshallingTests"
+ had_mod = mod_key in sys.modules
+ old_mod = sys.modules.get(mod_key)
+ try:
+ # this makes override import fail
+ sys.modules[mod_key] = None
+ mod = gi.module.get_introspection_module('GIMarshallingTests')
+ mod_override = gi.overrides.load_overrides(mod)
+ self.assertTrue(mod_override is mod)
+ finally:
+ del sys.modules[mod_key]
+ if had_mod:
+ sys.modules[mod_key] = old_mod
+
class TestModule(unittest.TestCase):
# Tests for gi.module
mod2 = gi.module.get_introspection_module(mod_name)
self.assertTrue(mod1 is mod2)
- # Using a DynamicModule will use get_introspection_module internally
- # in its _load method.
- mod_overridden = gi.module.DynamicModule(mod_name)
- mod_overridden._load()
- self.assertTrue(mod1 is mod_overridden._introspection_module)
-
# Restore the previous cache
gi.module._introspection_modules = old_modules
self.assertTrue('introspection typelib' not in exception_string)
else:
self.assertTrue('introspection typelib' in exception_string)
+
+ def test__get_all_dependencies(self):
+ get_all_dependencies = gi.importer._get_all_dependencies
+ deps = set(get_all_dependencies("Regress"))
+
+ self.assertTrue('Gio-2.0' in deps)
+ self.assertTrue('GObject-2.0' in deps)
+ self.assertTrue('GLib-2.0' in deps)
+ self.assertTrue('cairo-1.0' in deps)
+
+ def test_require_version_warning(self):
+ check = gi.importer._check_require_version
+
+ # make sure it doesn't fail at least
+ with check("GLib", 1):
+ from gi.repository import GLib
+ GLib
+
+ # make sure the exception propagates
+ with self.assertRaises(ImportError):
+ with check("InvalidGObjectRepositoryModuleName", 1):
+ from gi.repository import InvalidGObjectRepositoryModuleName
+ InvalidGObjectRepositoryModuleName
event.type = Gdk.EventType.SCROLL
self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar'))
+ def test_event_touch(self):
+ event = Gdk.Event.new(Gdk.EventType.TOUCH_BEGIN)
+ self.assertEqual(event.type, Gdk.EventType.TOUCH_BEGIN)
+
+ # emulating_pointer is unique to touch events
+ self.assertFalse(event.emulating_pointer)
+ self.assertFalse(event.touch.emulating_pointer)
+
+ event.emulating_pointer = True
+ self.assertTrue(event.emulating_pointer)
+ self.assertTrue(event.touch.emulating_pointer)
+
def test_event_setattr(self):
event = Gdk.Event.new(Gdk.EventType.DRAG_MOTION)
event.x_root, event.y_root = 0, 5
from compathelper import _unicode, _bytes
+import gi
import gi.overrides
import gi.types
from gi.repository import GLib, GObject
try:
- from gi.repository import GdkPixbuf, Gdk, Gtk
+ gi.require_version('Gtk', '3.0')
+ gi.require_version('GdkPixbuf', '2.0')
+ from gi.repository import Gtk, GdkPixbuf, Gdk
Gtk # pyflakes
PyGTKDeprecationWarning = Gtk.PyGTKDeprecationWarning
-except ImportError:
+except (ValueError, ImportError):
Gtk = None
PyGTKDeprecationWarning = None
import unittest
try:
+ import gi
+ gi.require_version('Pango', '1.0')
+ gi.require_version('PangoCairo', '1.0')
from gi.repository import Pango
from gi.repository import PangoCairo
Pango
PangoCairo
-except ImportError:
+except (ValueError, ImportError):
Pango = None
PangoCairo = None
import types
import unittest
+import gi
from gi.repository import GObject
from gi.repository.GObject import GType, new, PARAM_READWRITE, \
PARAM_CONSTRUCT, PARAM_READABLE, PARAM_WRITABLE, PARAM_CONSTRUCT_ONLY
from gi.repository import Gio
from gi.repository import GLib
+gi.require_version('GIMarshallingTests', '1.0')
from gi.repository import GIMarshallingTests
from gi import _propertyhelper as propertyhelper
try:
+ gi.require_version('Regress', '1.0')
from gi.repository import Regress
has_regress = True
-except ImportError:
+except (ValueError, ImportError):
has_regress = False
if sys.version_info < (3, 0):
import unittest
import collections
+import gi
+
+gi.require_version('GIRepository', '2.0')
+
import gi._gi as GIRepository
from gi.module import repository as repo
from gi.repository import GObject
class Test(unittest.TestCase):
def setUp(self):
+ repo.require('GLib')
repo.require('GObject')
repo.require('GIMarshallingTests')
+ def test_repo_get_dependencies(self):
+ self.assertRaises(TypeError, repo.get_dependencies)
+ self.assertEqual(repo.get_dependencies("GLib"), [])
+ self.assertEqual(repo.get_dependencies("GObject"), ["GLib-2.0"])
+
def test_arg_info(self):
func_info = repo.find_by_name('GIMarshallingTests', 'array_fixed_out_struct')
args = func_info.get_arguments()