summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2013-05-08 08:51:06 +0100
committerSimon McVittie <smcv@debian.org>2013-05-08 08:51:06 +0100
commitd4a5aea36c3756f9f76198dc06a012bab26a4c4d (patch)
treebc7a6187362c0eabe5993c004fe0dd80e5915ccb
parent10ab6e03bf37927814e8083185cd5b3983e7725a (diff)
parentd0d5b5be685dc4c16b21c54335becc87ca4d6f58 (diff)
Imported Upstream version 1.2.0upstream/1.2.0upstream
-rw-r--r--COPYING3
-rw-r--r--ChangeLog298
-rw-r--r--Makefile.in4
-rw-r--r--NEWS38
-rw-r--r--_dbus_bindings/Makefile.am20
-rw-r--r--_dbus_bindings/Makefile.in28
-rw-r--r--_dbus_bindings/abstract.c2
-rw-r--r--_dbus_bindings/bytes.c2
-rw-r--r--_dbus_bindings/compat-internal.h19
-rw-r--r--_dbus_bindings/containers.c2
-rw-r--r--_dbus_bindings/float.c2
-rw-r--r--_dbus_bindings/message-append.c64
-rw-r--r--_dbus_bindings/server.c81
-rw-r--r--_dbus_bindings/signature.c2
-rw-r--r--_dbus_bindings/types-internal.h1
-rw-r--r--_dbus_glib_bindings/Makefile.am22
-rw-r--r--_dbus_glib_bindings/Makefile.in29
-rw-r--r--aclocal.m418
-rw-r--r--config.h.in12
-rwxr-xr-xconfigure199
-rw-r--r--configure.ac31
-rw-r--r--dbus/_version.py4
-rw-r--r--dbus/exceptions.py27
-rw-r--r--dbus/gi_service.py4
-rw-r--r--dbus/gobject_service.py4
-rw-r--r--examples/Makefile.in2
-rw-r--r--m4/Makefile.in2
-rw-r--r--test/Makefile.am2
-rw-r--r--test/Makefile.in4
-rw-r--r--test/cross-test-client.py5
-rw-r--r--test/cross-test-server.py5
-rwxr-xr-xtest/run-test.sh47
-rwxr-xr-xtest/run-with-tmp-session-bus.sh16
-rwxr-xr-xtest/test-client.py10
-rw-r--r--test/test-exception-py2.py62
-rw-r--r--test/test-exception-py3.py31
-rw-r--r--test/test-p2p.py5
-rw-r--r--test/test-signals.py5
-rwxr-xr-xtest/test-standalone.py41
-rw-r--r--tools/Makefile.in2
40 files changed, 835 insertions, 320 deletions
diff --git a/COPYING b/COPYING
index 2f6323c..3180f9b 100644
--- a/COPYING
+++ b/COPYING
@@ -1,5 +1,6 @@
As of version 0.82.4, dbus-python is released under the following permissive
-non-copyleft license (the same one used for D-Bus core):
+non-copyleft license (the same one that was proposed for D-Bus core but
+wasn't achieved):
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
diff --git a/ChangeLog b/ChangeLog
index 3c62eed..788d4e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,301 @@
+commit d0d5b5be685dc4c16b21c54335becc87ca4d6f58
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2013-05-08 08:49:58 +0100
+
+ distribute new tests
+
+ test/Makefile.am | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit bd6aac594c72d32057a5821fcedb2d36644526aa
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2013-05-08 08:48:28 +0100
+
+ 1.2.0
+
+ NEWS | 10 +++++++++-
+ configure.ac | 6 +++---
+ 2 files changed, 12 insertions(+), 4 deletions(-)
+
+commit 9b26cf8238a7d432fe96a50a75008aa6bce110da
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2013-05-08 08:38:22 +0100
+
+ Add support for skipping tests, and use it
+
+ Now that Python 2.6 isn't a supported version in Debian, it doesn't
+ get a gi module, but we can still get some minimal test coverage.
+
+ test/cross-test-client.py | 5 ++++-
+ test/cross-test-server.py | 5 ++++-
+ test/run-test.sh | 37 ++++++++++++++++++++++++++++---------
+ test/run-with-tmp-session-bus.sh | 14 +++++++++++++-
+ test/test-client.py | 6 +++++-
+ test/test-p2p.py | 5 ++++-
+ test/test-signals.py | 5 ++++-
+ 7 files changed, 62 insertions(+), 15 deletions(-)
+
+commit 0872782255fdbaeda64311a298664597e59ba94f
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2013-05-08 08:37:13 +0100
+
+ utf8 test: pass when used with dbus 1.6.10, 1.7.2
+
+ We used to reject noncharacters, but now we accept them.
+
+ test/test-standalone.py | 41 +++++++++++++++++++++++++----------------
+ 1 file changed, 25 insertions(+), 16 deletions(-)
+
+commit f909f596705f62a5218cf16d61433364fe2f8168
+Author: Marko Lindqvist <cazfi74 gmail com>
+Date: 2013-05-07 20:16:20 +0100
+
+ Replace AM_CONFIG_HEADER with AC_CONFIG_HEADERS
+
+ This has been (silently!) deprecated since 2002 and was removed from
+ Automake 1.13.
+
+ [added commit message -smcv]
+ Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 423ee853dfbb4ee9ed89a21e1cf2b6a928e2fc4d
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2013-04-22 17:40:51 +0100
+
+ Use GObject.__class__ instead of GObjectMeta
+
+ In pygobject 3.8, GObjectMeta is no longer available via
+ gi.repository.GObject. What we actually want is "the metaclass of
+ GObject", so, say so.
+
+ NEWS | 3 +++
+ dbus/gi_service.py | 4 ++--
+ dbus/gobject_service.py | 4 ++--
+ 3 files changed, 7 insertions(+), 4 deletions(-)
+
+commit c9ad0a3909c80c09d33b21db6cb46cfee4489010
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2013-04-22 15:47:06 +0100
+
+ Unset DBUS_STARTER_ADDRESS, DBUS_STARTER_BUS_TYPE
+
+ See <https://bugs.freedesktop.org/show_bug.cgi?id=63119>.
+
+ test/run-with-tmp-session-bus.sh | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit 121c294b1853a280b01e0504eb1828c6d0e07bbc
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2013-04-22 15:44:57 +0100
+
+ Require D-Bus 1.6, drop fallback paths
+
+ NEWS | 6 +++++
+ _dbus_bindings/compat-internal.h | 19 ---------------
+ _dbus_bindings/message-append.c | 48 --------------------------------------
+ configure.ac | 11 +--------
+ 4 files changed, 7 insertions(+), 77 deletions(-)
+
+commit c57c4d281369589b636aee928238b7cf6e42e00f
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-10-23 19:34:35 +0100
+
+ NEWS
+
+ NEWS | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+commit f52465232234ae71fa16741abcd57aab155949ad
+Author: Thiago Macieira <thiago.macieira@intel.com>
+Date: 2012-10-23 11:12:21 -0700
+
+ Update the confusing notice of what license dbus-python is under
+
+ We tried to change the license for the D-Bus core too but were unable
+ to reach all copyright holders. The MIT license was the suggested new
+ license and all reached parties had agreed to.
+
+ Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
+
+ COPYING | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit d262628e89115bbcc33c439c77d33733c4a23491
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-10-16 18:33:08 +0100
+
+ DBusException: override both __str__ and __unicode__
+
+ Avoid chaining up to the superclass, because that behaves particularly
+ oddly. This fixes regression test failures: str(some_dbus_exception) was no
+ longer prefixed with the D-Bus error name under Python 2.
+
+ Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55899
+
+ dbus/exceptions.py | 28 +++++++++++++++++-----------
+ 1 file changed, 17 insertions(+), 11 deletions(-)
+
+commit 544e05a16e55dad7e666baabfb665997a79d6580
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-10-16 18:31:43 +0100
+
+ Slightly better test coverage
+
+ test/test-client.py | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+commit efdd1823239b02fe5a39e766cbd7597e6c3fcb96
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-10-16 17:52:36 +0100
+
+ Use a form of assertRaises() that works in Python 2.6
+
+ test/test-exception-py2.py | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+commit 83615efbed565a689008b00a4ac82fc0fc4e5603
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-10-16 17:52:22 +0100
+
+ Skip test_dbus_exception_convert_str_fail under unusual default encodings
+
+ This would actually work fine if the default encoding was UTF-8 or
+ Latin-1 or something.
+
+ test/test-exception-py2.py | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+commit 09b540bd55fb2fca14d4df7e0c520b8ba0ce4646
+Author: Michael Vogt <mvo@ubuntu.com>
+Date: 2012-10-12 13:37:51 +0200
+
+ Support unicode messages for DBusException in Python 2
+
+ [commit message amended -smcv]
+ Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55899
+ Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
+
+ dbus/exceptions.py | 23 ++++++++++++++++--
+ test/run-test.sh | 6 +++++
+ test/test-exception-py2.py | 58 ++++++++++++++++++++++++++++++++++++++++++++
+ test/test-exception-py3.py | 31 +++++++++++++++++++++++
+ 4 files changed, 116 insertions(+), 2 deletions(-)
+
+commit 5558ee11313fd929ed6aeb22228e89de2263e520
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-07-04 12:17:10 +0100
+
+ Link Python extensions differently on Windows
+
+ _dbus_bindings/Makefile.am | 14 ++++++++++++++
+ _dbus_glib_bindings/Makefile.am | 14 ++++++++++++++
+ configure.ac | 13 +++++++++++++
+ 3 files changed, 41 insertions(+)
+
+commit ec2671485a23090c470180eb297e67b86638d9b5
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-07-04 12:15:16 +0100
+
+ Replace incorrect AM_LDFLAGS usage with a proper AM_LDFLAGS/LIBADD split
+
+ _dbus_bindings/Makefile.am | 6 +++++-
+ _dbus_glib_bindings/Makefile.am | 8 +++++++-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+commit 9c02d05642c8f99e3fe61804bcc33df380ebd5b1
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-07-04 20:27:12 +0100
+
+ run-test.sh: don't go via make to run the cross-test
+
+ Based on a patch from Christoph Höger.
+
+ Bug: https://bugs.freedesktop.org/show_bug.cgi?id=51725
+
+ test/run-test.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit e8a507570e12778a0f325786fcf9f5f768019118
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-07-04 19:49:13 +0100
+
+ NEWS
+
+ NEWS | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+commit f3199102a68c72460fd0a025ab966557a0996223
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-07-04 19:49:07 +0100
+
+ Don't include stdint.h
+
+ Every use here turns out to be unnecessary, some compilers *still*
+ don't have it after more than a decade in ISO C, and if we need
+ fixed-length integer types we can use the ones from D-Bus.
+
+ _dbus_bindings/abstract.c | 2 --
+ _dbus_bindings/bytes.c | 2 --
+ _dbus_bindings/containers.c | 2 --
+ _dbus_bindings/float.c | 2 --
+ _dbus_bindings/signature.c | 2 --
+ _dbus_bindings/types-internal.h | 1 -
+ 6 files changed, 11 deletions(-)
+
+commit 6f5ec9552ca169b66b338698850a125151e3599c
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-07-04 19:36:26 +0100
+
+ Re-indent now that the indentation is unecessary
+
+ _dbus_bindings/server.c | 61 ++++++++++++++++++++++-------------------------
+ 1 file changed, 29 insertions(+), 32 deletions(-)
+
+commit 5b79604a6d1eb11268293342d19da633e5eedaa4
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-07-04 19:35:43 +0100
+
+ Avoid variable-length arrays, which MSVC *still* doesn't support
+
+ Based on patches from Christoph Höger.
+
+ Bug: https://bugs.freedesktop.org/show_bug.cgi?id=51725
+
+ _dbus_bindings/message-append.c | 16 +++++++++++++---
+ _dbus_bindings/server.c | 30 ++++++++++++++++++++----------
+ 2 files changed, 33 insertions(+), 13 deletions(-)
+
+commit bdc48547078b8ba09856c81b7c4f148fb163c01b
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-07-04 19:19:12 +0100
+
+ Use AC_C_INLINE to make sure "inline" works
+
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 3d23ff9e91151c2fb8e5ccb74067ff7ad6df3067
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-06-25 21:20:12 +0100
+
+ reset to unreleased
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 86b978042fa23d9b262cb0baa40398e21ddb0530
+Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: 2012-06-25 21:19:35 +0100
+
+ prepare release
+
+ NEWS | 4 +++-
+ configure.ac | 4 ++--
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
commit f6066573d25508f5cbbc5c12254086d419bb8828
Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: 2012-06-25 17:01:51 +0100
diff --git a/Makefile.in b/Makefile.in
index 8ff549a..d472bf1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -829,7 +829,7 @@ distcheck: dist
*.zip*) \
unzip $(distdir).zip ;;\
esac
- chmod -R a-w $(distdir); chmod a+w $(distdir)
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
diff --git a/NEWS b/NEWS
index 4ab62bf..896e821 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,39 @@
+D-Bus Python Bindings 1.2.0 (2013-05-07)
+========================================
+
+The "compile like it's 1998" release.
+
+Dependencies:
+
+• libdbus 1.6 or later is now required.
+
+Enhancements:
+
+• Unicode Corrigendum 9: when used with a suitable version of libdbus
+ (1.6.10 or later, or 1.7.2 or later), noncharacters in strings are
+ now accepted
+
+Fixes:
+
+• Support DBusException('something with non—ASCII') under Python 2
+ (Michael Vogt, smcv; fd.o #55899)
+
+• Correct some misleading wording in COPYING which was written under the
+ assumption that libdbus could actually be relicensed to MIT/X11
+ (Thiago Macieira)
+
+• Avoid variable-length arrays, because MSVC++ is still stuck in 1998
+ (based on patches from Christoph Höger, fd.o #51725)
+
+• Remove unnecessary uses of stdint.h (fd.o #51725)
+
+• Add support for Unix compilers not supporting 'inline', for completeness
+
+• Use GObject.__class__ instead of GObjectMeta, which can no longer be
+ imported from gi.repository.GObject in pygobject 3.8
+
+• Fix autoreconfiscation on Automake 1.13 (Marko Lindqvist, fd.o #59006)
+
D-Bus Python Bindings 1.1.1 (2012-06-25)
========================================
@@ -5,7 +41,7 @@ The "Lemonade Sky" release.
Dependencies:
-* libdbus 1.6 or later is now recommended. It is not strictly required yet.
+• libdbus 1.6 or later is now recommended. It is not strictly required yet.
Fixes:
diff --git a/_dbus_bindings/Makefile.am b/_dbus_bindings/Makefile.am
index 2a5ec28..42c9f91 100644
--- a/_dbus_bindings/Makefile.am
+++ b/_dbus_bindings/Makefile.am
@@ -3,7 +3,25 @@ pyexec_LTLIBRARIES = _dbus_bindings.la
AM_CPPFLAGS = -I$(top_srcdir)/include $(DBUS_CFLAGS) $(PYTHON_INCLUDES)
AM_LDFLAGS = -module -avoid-version \
-export-symbols-regex \(PyInit__\|init_\)dbus_bindings \
- $(DBUS_LIBS)
+ $(NULL)
+
+libadd = $(DBUS_LIBS)
+
+if WINDOWS
+# Win32 DLLs can't have undefined symbols (so this needs explicit linking
+# against the Python DLL), and Python expects extensions to be *.pyd
+# instead of *.dll
+AM_LDFLAGS += \
+ -no-undefined \
+ -shrext ".pyd" \
+ $(NULL)
+
+libadd += \
+ $(PYTHON_LIBS) \
+ $(NULL)
+endif
+
+_dbus_bindings_la_LIBADD = $(libadd)
_dbus_bindings_la_SOURCES = \
abstract.c \
bus.c \
diff --git a/_dbus_bindings/Makefile.in b/_dbus_bindings/Makefile.in
index 97d72c0..40d264c 100644
--- a/_dbus_bindings/Makefile.in
+++ b/_dbus_bindings/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -51,6 +51,19 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+
+# Win32 DLLs can't have undefined symbols (so this needs explicit linking
+# against the Python DLL), and Python expects extensions to be *.pyd
+# instead of *.dll
+@WINDOWS_TRUE@am__append_1 = \
+@WINDOWS_TRUE@ -no-undefined \
+@WINDOWS_TRUE@ -shrext ".pyd" \
+@WINDOWS_TRUE@ $(NULL)
+
+@WINDOWS_TRUE@am__append_2 = \
+@WINDOWS_TRUE@ $(PYTHON_LIBS) \
+@WINDOWS_TRUE@ $(NULL)
+
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/tools/check-coding-style.mk
subdir = _dbus_bindings
@@ -99,7 +112,10 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(pyexecdir)"
LTLIBRARIES = $(pyexec_LTLIBRARIES)
-_dbus_bindings_la_LIBADD =
+am__DEPENDENCIES_1 =
+@WINDOWS_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+_dbus_bindings_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__dbus_bindings_la_OBJECTS = abstract.lo bus.lo bytes.lo conn.lo \
conn-methods.lo containers.lo debug.lo exceptions.lo float.lo \
generic.lo int.lo unixfd.lo libdbusconn.lo mainloop.lo \
@@ -286,10 +302,10 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pyexec_LTLIBRARIES = _dbus_bindings.la
AM_CPPFLAGS = -I$(top_srcdir)/include $(DBUS_CFLAGS) $(PYTHON_INCLUDES)
-AM_LDFLAGS = -module -avoid-version \
- -export-symbols-regex \(PyInit__\|init_\)dbus_bindings \
- $(DBUS_LIBS)
-
+AM_LDFLAGS = -module -avoid-version -export-symbols-regex \
+ \(PyInit__\|init_\)dbus_bindings $(NULL) $(am__append_1)
+libadd = $(DBUS_LIBS) $(am__append_2)
+_dbus_bindings_la_LIBADD = $(libadd)
_dbus_bindings_la_SOURCES = \
abstract.c \
bus.c \
diff --git a/_dbus_bindings/abstract.c b/_dbus_bindings/abstract.c
index f2cbebc..2e6f438 100644
--- a/_dbus_bindings/abstract.c
+++ b/_dbus_bindings/abstract.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/bytes.c b/_dbus_bindings/bytes.c
index fc490d9..51c1cd8 100644
--- a/_dbus_bindings/bytes.c
+++ b/_dbus_bindings/bytes.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/compat-internal.h b/_dbus_bindings/compat-internal.h
index 143f23a..535439c 100644
--- a/_dbus_bindings/compat-internal.h
+++ b/_dbus_bindings/compat-internal.h
@@ -30,23 +30,4 @@
#include "config.h"
#include "dbus_bindings-internal.h"
-#ifndef HAVE_DBUSBASICVALUE
-typedef union {
- dbus_bool_t bool_val;
- double dbl;
- dbus_uint16_t u16;
- dbus_int16_t i16;
- dbus_uint32_t u32;
- dbus_int32_t i32;
-#if defined(DBUS_HAVE_INT64) && defined(HAVE_LONG_LONG)
- dbus_uint64_t u64;
- dbus_int64_t i64;
-#endif
- const char *str;
- unsigned char byt;
- float f;
- int fd;
-} DBusBasicValue;
-#endif
-
#endif
diff --git a/_dbus_bindings/containers.c b/_dbus_bindings/containers.c
index 9e57243..1ac6063 100644
--- a/_dbus_bindings/containers.c
+++ b/_dbus_bindings/containers.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/float.c b/_dbus_bindings/float.c
index 9ea8413..f540f5b 100644
--- a/_dbus_bindings/float.c
+++ b/_dbus_bindings/float.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/message-append.c b/_dbus_bindings/message-append.c
index e519ae2..89ca746 100644
--- a/_dbus_bindings/message-append.c
+++ b/_dbus_bindings/message-append.c
@@ -569,60 +569,12 @@ _message_iter_append_string(DBusMessageIter *appender,
return -1;
/* Validate UTF-8, strictly */
-#ifdef HAVE_DBUS_VALIDATE_UTF8
if (!dbus_validate_utf8(s, NULL)) {
PyErr_SetString(PyExc_UnicodeError, "String parameters "
"to be sent over D-Bus must be valid UTF-8 "
"with no noncharacter code points");
return -1;
}
-#else
- {
- PyObject *back_to_unicode;
- PyObject *utf32;
- Py_ssize_t i;
-
- /* This checks for syntactically valid UTF-8, but does not check
- * for noncharacters (U+nFFFE, U+nFFFF for any n, or U+FDD0..U+FDEF).
- */
- back_to_unicode = PyUnicode_DecodeUTF8(s, PyBytes_GET_SIZE(utf8),
- "strict");
-
- if (!back_to_unicode) {
- return -1;
- }
-
- utf32 = PyUnicode_AsUTF32String(back_to_unicode);
- Py_CLEAR(back_to_unicode);
-
- if (!utf32) {
- return -1;
- }
-
- for (i = 0; i < PyBytes_GET_SIZE(utf32) / 4; i++) {
- dbus_uint32_t *p;
-
- p = (dbus_uint32_t *) (PyBytes_AS_STRING(utf32)) + i;
-
- if (/* noncharacters U+nFFFE, U+nFFFF */
- (*p & 0xFFFF) == 0xFFFE ||
- (*p & 0xFFFF) == 0xFFFF ||
- /* noncharacters U+FDD0..U+FDEF */
- (*p >= 0xFDD0 && *p <= 0xFDEF) ||
- /* surrogates U+D800..U+DBFF (low), U+DC00..U+DFFF (high) */
- (*p >= 0xD800 && *p <= 0xDFFF) ||
- (*p >= 0x110000)) {
- Py_CLEAR(utf32);
- PyErr_SetString(PyExc_UnicodeError, "String parameters "
- "to be sent over D-Bus must be valid UTF-8 "
- "with no noncharacter code points");
- return -1;
- }
- }
-
- Py_CLEAR(utf32);
- }
-#endif
DBG("Performing actual append: string (from unicode) %s", s);
if (!dbus_message_iter_append_basic(appender, sig_type, &s)) {
@@ -962,6 +914,7 @@ _message_iter_append_variant(DBusMessageIter *appender, PyObject *obj)
int ret;
long variant_level;
dbus_bool_t dummy;
+ DBusMessageIter *variant_iters = NULL;
/* Separate the object into the contained object, and the number of
* variants it's wrapped in. */
@@ -987,10 +940,17 @@ _message_iter_append_variant(DBusMessageIter *appender, PyObject *obj)
dbus_signature_iter_init(&obj_sig_iter, obj_sig_str);
- { /* scope for variant_iters */
- DBusMessageIter variant_iters[variant_level];
+ {
long i;
+ variant_iters = calloc (variant_level, sizeof (DBusMessageIter));
+
+ if (!variant_iters) {
+ PyErr_NoMemory();
+ ret = -1;
+ goto out;
+ }
+
for (i = 0; i < variant_level; i++) {
DBusMessageIter *child = &variant_iters[i];
/* The first is a special case: its parent is the iter passed in
@@ -1038,10 +998,12 @@ _message_iter_append_variant(DBusMessageIter *appender, PyObject *obj)
goto out;
}
}
-
}
out:
+ if (variant_iters != NULL)
+ free (variant_iters);
+
Py_CLEAR(obj_sig);
return ret;
}
diff --git a/_dbus_bindings/server.c b/_dbus_bindings/server.c
index cb489f6..07652c4 100644
--- a/_dbus_bindings/server.c
+++ b/_dbus_bindings/server.c
@@ -88,6 +88,9 @@ DBusPyServer_set_auth_mechanisms(Server *self,
PyObject *fast_seq = NULL, *references = NULL;
Py_ssize_t length;
Py_ssize_t i;
+ /* a mutable array of constant strings */
+ const char **list = NULL;
+ dbus_bool_t ret = FALSE;
fast_seq = PySequence_Fast(auth_mechanisms,
"Expecting sequence for auth_mechanisms parameter");
@@ -97,49 +100,53 @@ DBusPyServer_set_auth_mechanisms(Server *self,
length = PySequence_Fast_GET_SIZE(fast_seq);
- /* scope for list */
- {
- const char *list[length + 1];
-
- if (!(references = PyTuple_New(length)))
- goto error;
-
- for (i = 0; i < length; ++i) {
- PyObject *am, *am_as_bytes;
-
- am = PySequence_Fast_GET_ITEM(auth_mechanisms, i);
- if (!am) goto error;
-
- if (PyUnicode_Check(am)) {
- am_as_bytes = PyUnicode_AsUTF8String(am);
- if (!am_as_bytes)
- goto error;
- }
- else {
- am_as_bytes = am;
- Py_INCREF(am_as_bytes);
- }
- list[i] = PyBytes_AsString(am_as_bytes);
- if (!list[i])
- goto error;
-
- PyTuple_SET_ITEM(references, i, am_as_bytes);
- }
+ list = calloc (length + 1, sizeof (char *));
- list[length] = NULL;
+ if (!list) {
+ PyErr_NoMemory();
+ goto finally;
+ }
- Py_BEGIN_ALLOW_THREADS
- dbus_server_set_auth_mechanisms(self->server, list);
- Py_END_ALLOW_THREADS
+ if (!(references = PyTuple_New(length)))
+ goto finally;
+
+ for (i = 0; i < length; ++i) {
+ PyObject *am, *am_as_bytes;
+
+ am = PySequence_Fast_GET_ITEM(auth_mechanisms, i);
+ if (!am)
+ goto finally;
+
+ if (PyUnicode_Check(am)) {
+ am_as_bytes = PyUnicode_AsUTF8String(am);
+ if (!am_as_bytes)
+ goto finally;
+ }
+ else {
+ am_as_bytes = am;
+ Py_INCREF(am_as_bytes);
+ }
+ list[i] = PyBytes_AsString(am_as_bytes);
+ if (!list[i])
+ goto finally;
+
+ PyTuple_SET_ITEM(references, i, am_as_bytes);
}
+ list[length] = NULL;
+
+ Py_BEGIN_ALLOW_THREADS
+ dbus_server_set_auth_mechanisms(self->server, list);
+ Py_END_ALLOW_THREADS
+
+ ret = TRUE;
+
+finally:
+ if (list)
+ free (list);
Py_CLEAR(fast_seq);
Py_CLEAR(references);
- return TRUE;
- error:
- Py_CLEAR(fast_seq);
- Py_CLEAR(references);
- return FALSE;
+ return ret;
}
/* Return a new reference to a Python Server or subclass corresponding
diff --git a/_dbus_bindings/signature.c b/_dbus_bindings/signature.c
index 766fd8e..fa8f937 100644
--- a/_dbus_bindings/signature.c
+++ b/_dbus_bindings/signature.c
@@ -26,8 +26,6 @@
#include <Python.h>
#include <structmember.h>
-#include <stdint.h>
-
#include "dbus_bindings-internal.h"
#include "types-internal.h"
diff --git a/_dbus_bindings/types-internal.h b/_dbus_bindings/types-internal.h
index 8a715d4..2024803 100644
--- a/_dbus_bindings/types-internal.h
+++ b/_dbus_bindings/types-internal.h
@@ -24,7 +24,6 @@
*/
#include <Python.h>
-#include <stdint.h>
/* In Python2 >= 2.6 this aliases PyString to PyBytes. There is no PyString
* in Python 3, so this allows the C extension to be compilable in both Python
diff --git a/_dbus_glib_bindings/Makefile.am b/_dbus_glib_bindings/Makefile.am
index 2e10426..ead49da 100644
--- a/_dbus_glib_bindings/Makefile.am
+++ b/_dbus_glib_bindings/Makefile.am
@@ -4,6 +4,26 @@ AM_CPPFLAGS = -I$(top_srcdir)/include $(DBUS_CFLAGS) $(DBUS_GLIB_CFLAGS) \
$(PYTHON_INCLUDES)
AM_LDFLAGS = -module -avoid-version \
-export-symbols-regex \(PyInit__\|init_\)dbus_glib_bindings \
- $(DBUS_LIBS) $(DBUS_GLIB_LIBS)
+ $(NULL)
+libadd = \
+ $(DBUS_LIBS) \
+ $(DBUS_GLIB_LIBS) \
+ $(NULL)
+
+if WINDOWS
+# Win32 DLLs can't have undefined symbols (so this needs explicit linking
+# against the Python DLL), and Python expects extensions to be *.pyd
+# instead of *.dll
+AM_LDFLAGS += \
+ -no-undefined \
+ -shrext ".pyd" \
+ $(NULL)
+
+libadd += \
+ $(PYTHON_LIBS) \
+ $(NULL)
+endif
+
+_dbus_glib_bindings_la_LIBADD = $(libadd)
_dbus_glib_bindings_la_SOURCES = module.c
diff --git a/_dbus_glib_bindings/Makefile.in b/_dbus_glib_bindings/Makefile.in
index c8b4ae3..8e0fe95 100644
--- a/_dbus_glib_bindings/Makefile.in
+++ b/_dbus_glib_bindings/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -51,6 +51,19 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+
+# Win32 DLLs can't have undefined symbols (so this needs explicit linking
+# against the Python DLL), and Python expects extensions to be *.pyd
+# instead of *.dll
+@WINDOWS_TRUE@am__append_1 = \
+@WINDOWS_TRUE@ -no-undefined \
+@WINDOWS_TRUE@ -shrext ".pyd" \
+@WINDOWS_TRUE@ $(NULL)
+
+@WINDOWS_TRUE@am__append_2 = \
+@WINDOWS_TRUE@ $(PYTHON_LIBS) \
+@WINDOWS_TRUE@ $(NULL)
+
subdir = _dbus_glib_bindings
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -98,7 +111,11 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(pyexecdir)"
LTLIBRARIES = $(pyexec_LTLIBRARIES)
-_dbus_glib_bindings_la_LIBADD =
+am__DEPENDENCIES_1 =
+@WINDOWS_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_2)
+_dbus_glib_bindings_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__dbus_glib_bindings_la_OBJECTS = module.lo
_dbus_glib_bindings_la_OBJECTS = $(am__dbus_glib_bindings_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@@ -283,10 +300,10 @@ pyexec_LTLIBRARIES = _dbus_glib_bindings.la
AM_CPPFLAGS = -I$(top_srcdir)/include $(DBUS_CFLAGS) $(DBUS_GLIB_CFLAGS) \
$(PYTHON_INCLUDES)
-AM_LDFLAGS = -module -avoid-version \
- -export-symbols-regex \(PyInit__\|init_\)dbus_glib_bindings \
- $(DBUS_LIBS) $(DBUS_GLIB_LIBS)
-
+AM_LDFLAGS = -module -avoid-version -export-symbols-regex \
+ \(PyInit__\|init_\)dbus_glib_bindings $(NULL) $(am__append_1)
+libadd = $(DBUS_LIBS) $(DBUS_GLIB_LIBS) $(NULL) $(am__append_2)
+_dbus_glib_bindings_la_LIBADD = $(libadd)
_dbus_glib_bindings_la_SOURCES = module.c
all: all-am
diff --git a/aclocal.m4 b/aclocal.m4
index 6db1241..0da84bc 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11.5 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
@@ -198,7 +198,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.5], [],
+m4_if([$1], [1.11.6], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -214,7 +214,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.5])dnl
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
@@ -576,18 +576,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 8
-
-# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
-AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
diff --git a/config.h.in b/config.h.in
index 72d1bc1..ec4592e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -9,12 +9,6 @@
/* dbus-python minor version */
#undef DBUS_PYTHON_MINOR_VERSION
-/* Define to 1 if the system has the type `DBusBasicValue'. */
-#undef HAVE_DBUSBASICVALUE
-
-/* Define to 1 if you have the `dbus_validate_utf8' function. */
-#undef HAVE_DBUS_VALIDATE_UTF8
-
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -78,3 +72,9 @@
/* Version number of package */
#undef VERSION
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
diff --git a/configure b/configure
index 1198f36..5d12d09 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dbus-python 1.1.1.
+# Generated by GNU Autoconf 2.69 for dbus-python 1.2.0.
#
# Report bugs to <http://bugs.freedesktop.org/enter_bug.cgi?product=dbus&component=python>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='dbus-python'
PACKAGE_TARNAME='dbus-python'
-PACKAGE_VERSION='1.1.1'
-PACKAGE_STRING='dbus-python 1.1.1'
+PACKAGE_VERSION='1.2.0'
+PACKAGE_STRING='dbus-python 1.2.0'
PACKAGE_BUGREPORT='http://bugs.freedesktop.org/enter_bug.cgi?product=dbus&component=python'
PACKAGE_URL=''
@@ -704,6 +704,8 @@ LDFLAGS
CFLAGS
CC
LIBTOOL
+WINDOWS_FALSE
+WINDOWS_TRUE
host_os
host_vendor
host_cpu
@@ -1356,7 +1358,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures dbus-python 1.1.1 to adapt to many kinds of systems.
+\`configure' configures dbus-python 1.2.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1426,7 +1428,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dbus-python 1.1.1:";;
+ short | recursive ) echo "Configuration of dbus-python 1.2.0:";;
esac
cat <<\_ACEOF
@@ -1554,7 +1556,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dbus-python configure 1.1.1
+dbus-python configure 1.2.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1828,65 +1830,11 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
-
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=no"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof ($2))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
- eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dbus-python $as_me 1.1.1, which was
+It was created by dbus-python $as_me 1.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2281,14 +2229,14 @@ $as_echo "#define DBUS_PYTHON_MAJOR_VERSION 1" >>confdefs.h
DBUS_PYTHON_MAJOR_VERSION=1
-$as_echo "#define DBUS_PYTHON_MINOR_VERSION 1" >>confdefs.h
+$as_echo "#define DBUS_PYTHON_MINOR_VERSION 2" >>confdefs.h
-DBUS_PYTHON_MINOR_VERSION=1
+DBUS_PYTHON_MINOR_VERSION=2
-$as_echo "#define DBUS_PYTHON_MICRO_VERSION 1" >>confdefs.h
+$as_echo "#define DBUS_PYTHON_MICRO_VERSION 0" >>confdefs.h
-DBUS_PYTHON_MICRO_VERSION=1
+DBUS_PYTHON_MICRO_VERSION=0
@@ -2762,7 +2710,7 @@ fi
# Define the identity of the package.
PACKAGE='dbus-python'
- VERSION='1.1.1'
+ VERSION='1.2.0'
cat >>confdefs.h <<_ACEOF
@@ -2875,6 +2823,28 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+# mingw32, mingw-w64 are native Windows; for our purposes, Cygwin isn't
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for native Windows host" >&5
+$as_echo_n "checking for native Windows host... " >&6; }
+case "$host" in
+ (*-*-mingw*)
+ windows=yes
+ ;;
+ (*)
+ windows=no
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $windows" >&5
+$as_echo "$windows" >&6; }
+ if test "x$windows" = xyes; then
+ WINDOWS_TRUE=
+ WINDOWS_FALSE='#'
+else
+ WINDOWS_TRUE='#'
+ WINDOWS_FALSE=
+fi
+
+
# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then :
enableval=$enable_static; p=${PACKAGE-default}
@@ -11512,6 +11482,48 @@ if test "$am_t" != yes; then
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
@@ -12334,12 +12346,12 @@ if test -n "$DBUS_CFLAGS"; then
pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1 >= 1.4\""; } >&5
- ($PKG_CONFIG --exists --print-errors "dbus-1 >= 1.4") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1 >= 1.6\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "dbus-1 >= 1.6") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1 >= 1.4" 2>/dev/null`
+ pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1 >= 1.6" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -12351,12 +12363,12 @@ if test -n "$DBUS_LIBS"; then
pkg_cv_DBUS_LIBS="$DBUS_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1 >= 1.4\""; } >&5
- ($PKG_CONFIG --exists --print-errors "dbus-1 >= 1.4") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1 >= 1.6\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "dbus-1 >= 1.6") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1 >= 1.4" 2>/dev/null`
+ pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1 >= 1.6" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -12377,14 +12389,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dbus-1 >= 1.4" 2>&1`
+ DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dbus-1 >= 1.6" 2>&1`
else
- DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dbus-1 >= 1.4" 2>&1`
+ DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dbus-1 >= 1.6" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$DBUS_PKG_ERRORS" >&5
- as_fn_error $? "Package requirements (dbus-1 >= 1.4) were not met:
+ as_fn_error $? "Package requirements (dbus-1 >= 1.6) were not met:
$DBUS_PKG_ERRORS
@@ -12508,35 +12520,6 @@ $as_echo "yes" >&6; }
fi
-dbuspy_save_CFLAGS="$CFLAGS"
-dbuspy_save_LIBS="$LIBS"
-CFLAGS="$CFLAGS $DBUS_CFLAGS"
-LIBS="$CFLAGS $DBUS_LIBS"
-ac_fn_c_check_type "$LINENO" "DBusBasicValue" "ac_cv_type_DBusBasicValue" "#include <dbus/dbus.h>
-"
-if test "x$ac_cv_type_DBusBasicValue" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DBUSBASICVALUE 1
-_ACEOF
-
-
-fi
-
-for ac_func in dbus_validate_utf8
-do :
- ac_fn_c_check_func "$LINENO" "dbus_validate_utf8" "ac_cv_func_dbus_validate_utf8"
-if test "x$ac_cv_func_dbus_validate_utf8" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_DBUS_VALIDATE_UTF8 1
-_ACEOF
-
-fi
-done
-
-CFLAGS="$dbuspy_save_CFLAGS"
-LIBS="$dbuspy_save_LIBS"
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands " >&5
$as_echo_n "checking to see if compiler understands ... " >&6; }
@@ -12970,6 +12953,10 @@ else
am__EXEEXT_FALSE=
fi
+if test -z "${WINDOWS_TRUE}" && test -z "${WINDOWS_FALSE}"; then
+ as_fn_error $? "conditional \"WINDOWS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
as_fn_error $? "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -13387,7 +13374,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dbus-python $as_me 1.1.1, which was
+This file was extended by dbus-python $as_me 1.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -13453,7 +13440,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-dbus-python config.status 1.1.1
+dbus-python config.status 1.2.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 1ce8965..4f535b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,8 +5,8 @@ dnl If not 1, append datestamp to the version number
m4_define(dbus_python_released, 1)
dnl The dbus-python version number (must actually be numeric at the moment)
m4_define(dbus_python_major_version, 1)
-m4_define(dbus_python_minor_version, 1)
-m4_define(dbus_python_micro_version, 1)
+m4_define(dbus_python_minor_version, 2)
+m4_define(dbus_python_micro_version, 0)
m4_define(dbus_python_maybe_datestamp,
m4_esyscmd([if test x]dbus_python_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
@@ -29,13 +29,26 @@ AC_DEFINE(DBUS_PYTHON_MICRO_VERSION, dbus_python_micro_version, [dbus-python mic
AC_SUBST(DBUS_PYTHON_MICRO_VERSION, dbus_python_micro_version)
AC_CONFIG_SRCDIR([_dbus_bindings/module.c])
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([1.9 -Wno-portability])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
+# mingw32, mingw-w64 are native Windows; for our purposes, Cygwin isn't
+AC_MSG_CHECKING([for native Windows host])
+case "$host" in
+ (*-*-mingw*)
+ windows=yes
+ ;;
+ (*)
+ windows=no
+ ;;
+esac
+AC_MSG_RESULT([$windows])
+AM_CONDITIONAL([WINDOWS], [test "x$windows" = xyes])
+
AC_DISABLE_STATIC
dnl XXXX hack to kill off all the libtool tags ...
@@ -45,6 +58,7 @@ m4_define([_LT_AC_TAGCONFIG],[])
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
+AC_C_INLINE
AM_PATH_PYTHON([2.6])
@@ -154,18 +168,9 @@ AC_SUBST([RST2HTMLFLAGS])
AM_CONDITIONAL([ENABLE_API_DOCS], [test "$enable_api_docs" != no])
AM_CONDITIONAL([ENABLE_DOCS], [test "$enable_html_docs" != no])
-PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.4])
+PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6])
PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.70])
-dbuspy_save_CFLAGS="$CFLAGS"
-dbuspy_save_LIBS="$LIBS"
-CFLAGS="$CFLAGS $DBUS_CFLAGS"
-LIBS="$CFLAGS $DBUS_LIBS"
-AC_CHECK_TYPES([DBusBasicValue], [], [], [#include <dbus/dbus.h>])
-AC_CHECK_FUNCS([dbus_validate_utf8])
-CFLAGS="$dbuspy_save_CFLAGS"
-LIBS="$dbuspy_save_LIBS"
-
TP_COMPILER_WARNINGS([CFLAGS_WARNINGS], [test] dbus_python_released [= 0],
[all \
extra \
diff --git a/dbus/_version.py b/dbus/_version.py
index 4a304ed..47d0153 100644
--- a/dbus/_version.py
+++ b/dbus/_version.py
@@ -1,3 +1,3 @@
# dbus/_version.py. Generated from _version.py.in by configure.
-version = (1, 1, 1)
-__version__ = "1.1.1"
+version = (1, 2, 0)
+__version__ = "1.2.0"
diff --git a/dbus/exceptions.py b/dbus/exceptions.py
index 5283369..0930425 100644
--- a/dbus/exceptions.py
+++ b/dbus/exceptions.py
@@ -27,6 +27,8 @@ __all__ = ('DBusException', 'MissingErrorHandlerException',
'IntrospectionParserException', 'UnknownMethodException',
'NameExistsException')
+from dbus._compat import is_py3
+
class DBusException(Exception):
@@ -49,7 +51,22 @@ class DBusException(Exception):
% ', '.join(kwargs.keys()))
Exception.__init__(self, *args)
+ def __unicode__(self):
+ """Return a unicode error"""
+ # We can't just use Exception.__unicode__ because it chains up weirdly.
+ # https://code.launchpad.net/~mvo/ubuntu/quantal/dbus-python/lp846044/+merge/129214
+ if len(self.args) > 1:
+ s = unicode(self.args)
+ else:
+ s = ''.join(self.args)
+
+ if self._dbus_error_name is not None:
+ return '%s: %s' % (self._dbus_error_name, s)
+ else:
+ return s
+
def __str__(self):
+ """Return a str error"""
s = Exception.__str__(self)
if self._dbus_error_name is not None:
return '%s: %s' % (self._dbus_error_name, s)
@@ -57,9 +74,17 @@ class DBusException(Exception):
return s
def get_dbus_message(self):
- s = Exception.__str__(self)
+ if len(self.args) > 1:
+ if is_py3:
+ s = str(self.args)
+ else:
+ s = unicode(self.args)
+ else:
+ s = ''.join(self.args)
+
if isinstance(s, bytes):
return s.decode('utf-8', 'replace')
+
return s
def get_dbus_name(self):
diff --git a/dbus/gi_service.py b/dbus/gi_service.py
index 924442f..2703289 100644
--- a/dbus/gi_service.py
+++ b/dbus/gi_service.py
@@ -37,12 +37,12 @@ import dbus.service
# `ExportedGObjectType` as its metaclass, which is sufficient to make it work
# correctly.
-class ExportedGObjectType(GObject.GObjectMeta, dbus.service.InterfaceType):
+class ExportedGObjectType(GObject.GObject.__class__, dbus.service.InterfaceType):
"""A metaclass which inherits from both GObjectMeta and
`dbus.service.InterfaceType`. Used as the metaclass for `ExportedGObject`.
"""
def __init__(cls, name, bases, dct):
- GObject.GObjectMeta.__init__(cls, name, bases, dct)
+ GObject.GObject.__class__.__init__(cls, name, bases, dct)
dbus.service.InterfaceType.__init__(cls, name, bases, dct)
diff --git a/dbus/gobject_service.py b/dbus/gobject_service.py
index 1c96546..ef16009 100644
--- a/dbus/gobject_service.py
+++ b/dbus/gobject_service.py
@@ -40,12 +40,12 @@ else:
import dbus.service
-class ExportedGObjectType(gobject.GObjectMeta, dbus.service.InterfaceType):
+class ExportedGObjectType(gobject.GObject.__class__, dbus.service.InterfaceType):
"""A metaclass which inherits from both GObjectMeta and
`dbus.service.InterfaceType`. Used as the metaclass for `ExportedGObject`.
"""
def __init__(cls, name, bases, dct):
- gobject.GObjectMeta.__init__(cls, name, bases, dct)
+ gobject.GObject.__class__.__init__(cls, name, bases, dct)
dbus.service.InterfaceType.__init__(cls, name, bases, dct)
class ExportedGObject(gobject.GObject, dbus.service.Object):
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 41adf36..9d4067b 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
diff --git a/m4/Makefile.in b/m4/Makefile.in
index b98683e..dad596c 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
diff --git a/test/Makefile.am b/test/Makefile.am
index 345d6da..e9f9016 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -8,6 +8,8 @@ EXTRA_DIST = \
run-test.sh \
run-with-tmp-session-bus.sh \
test-client.py \
+ test-exception-py2.py \
+ test-exception-py3.py \
test-p2p.py \
test-service.py \
test-signals.py \
diff --git a/test/Makefile.in b/test/Makefile.in
index aa05ea7..e1e486b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -306,6 +306,8 @@ EXTRA_DIST = \
run-test.sh \
run-with-tmp-session-bus.sh \
test-client.py \
+ test-exception-py2.py \
+ test-exception-py3.py \
test-p2p.py \
test-service.py \
test-signals.py \
diff --git a/test/cross-test-client.py b/test/cross-test-client.py
index 75c4119..f42e785 100644
--- a/test/cross-test-client.py
+++ b/test/cross-test-client.py
@@ -23,7 +23,10 @@
from __future__ import print_function, unicode_literals
import logging
-from gi.repository import GObject as gobject
+try:
+ from gi.repository import GObject as gobject
+except ImportError:
+ raise SystemExit(77)
from dbus import (
Array, Boolean, Byte, ByteArray, Double, Int16, Int32, Int64,
diff --git a/test/cross-test-server.py b/test/cross-test-server.py
index 4098120..4b9ba92 100644
--- a/test/cross-test-server.py
+++ b/test/cross-test-server.py
@@ -23,7 +23,10 @@
from __future__ import print_function
import logging
-from gi.repository import GObject as gobject
+try:
+ from gi.repository import GObject as gobject
+except ImportError:
+ raise SystemExit(77)
import dbus.glib
from dbus import SessionBus
diff --git a/test/run-test.sh b/test/run-test.sh
index 79efaff..2daecbd 100755
--- a/test/run-test.sh
+++ b/test/run-test.sh
@@ -26,6 +26,8 @@
export DBUS_FATAL_WARNINGS=1
ulimit -c unlimited
+skipped=
+
function die()
{
if ! test -z "$DBUS_SESSION_BUS_PID" ; then
@@ -67,6 +69,12 @@ echo "DBUS_TOP_BUILDDIR=$DBUS_TOP_BUILDDIR"
echo "PYTHONPATH=$PYTHONPATH"
echo "PYTHON=$PYTHON"
+# the exceptions handling test is version specific
+PYMAJOR=$($PYTHON -c 'import sys;print(sys.version_info[0])')
+PYTEST=test-exception-py$PYMAJOR.py
+echo "running $PYTEST"
+$PYTHON "$DBUS_TOP_SRCDIR"/test/$PYTEST || die "$PYTEST failed"
+
echo "running test-standalone.py"
$PYTHON "$DBUS_TOP_SRCDIR"/test/test-standalone.py || die "test-standalone.py failed"
@@ -88,16 +96,22 @@ $PYTHON "$DBUS_TOP_SRCDIR"/test/test-unusable-main-loop.py || die "... failed"
echo "running cross-test (for better diagnostics use mjj29's dbus-test)"
-${MAKE:-make} -s cross-test-server > "$DBUS_TOP_BUILDDIR"/test/cross-server.log&
+$PYTHON "$DBUS_TOP_SRCDIR"/test/cross-test-server.py > "$DBUS_TOP_BUILDDIR"/test/cross-server.log&
sleep 1
-${MAKE:-make} -s cross-test-client > "$DBUS_TOP_BUILDDIR"/test/cross-client.log
+$PYTHON "$DBUS_TOP_SRCDIR"/test/cross-test-client.py > "$DBUS_TOP_BUILDDIR"/test/cross-client.log
+e=$?
-if grep . "$DBUS_TOP_BUILDDIR"/test/cross-client.log >/dev/null; then
+if test $e = 77; then
+ : # skipped
+elif grep . "$DBUS_TOP_BUILDDIR"/test/cross-client.log >/dev/null; then
: # OK
else
die "cross-test client produced no output"
fi
-if grep . "$DBUS_TOP_BUILDDIR"/test/cross-server.log >/dev/null; then
+
+if test $e = 77; then
+ : # skipped
+elif grep . "$DBUS_TOP_BUILDDIR"/test/cross-server.log >/dev/null; then
: # OK
else
die "cross-test server produced no output"
@@ -114,16 +128,27 @@ else
echo " - cross-test server reported no untested functions"
fi
-echo "running test-client.py"
-$PYTHON "$DBUS_TOP_SRCDIR"/test/test-client.py || die "test-client.py failed"
-echo "running test-signals.py"
-$PYTHON "$DBUS_TOP_SRCDIR"/test/test-signals.py || die "test-signals.py failed"
-
-echo "running test-p2p.py"
-$PYTHON "$DBUS_TOP_SRCDIR"/test/test-p2p.py || die "... failed"
+for script in test-client.py test-signals.py test-p2p.py; do
+ echo "running ${script}"
+ $PYTHON "$DBUS_TOP_SRCDIR"/test/${script}
+ e=$?
+ case "$e" in
+ (77)
+ echo "SKIP: ${script} not run, dependencies missing?"
+ skipped=1
+ ;;
+ (0)
+ echo "PASS: ${script}"
+ ;;
+ (*)
+ die "${script} failed"
+ esac
+done
rm -f "$DBUS_TOP_BUILDDIR"/test/test-service.log
rm -f "$DBUS_TOP_BUILDDIR"/test/cross-client.log
rm -f "$DBUS_TOP_BUILDDIR"/test/cross-server.log
rm -f "$DBUS_TOP_BUILDDIR"/test/monitor.log
+
+if test -n $skipped; then exit 77; fi
exit 0
diff --git a/test/run-with-tmp-session-bus.sh b/test/run-with-tmp-session-bus.sh
index e767f2d..48f48b0 100755
--- a/test/run-with-tmp-session-bus.sh
+++ b/test/run-with-tmp-session-bus.sh
@@ -47,6 +47,8 @@ trap 'die "Received SIGINT"' SIGINT
CONFIG_FILE="$DBUS_TOP_BUILDDIR"/test/tmp-session-bus.conf
+unset DBUS_STARTER_ADDRESS
+unset DBUS_STARTER_BUS_TYPE
unset DBUS_SESSION_BUS_ADDRESS
unset DBUS_SESSION_BUS_PID
@@ -61,7 +63,19 @@ echo "Started bus pid $DBUS_SESSION_BUS_PID at $DBUS_SESSION_BUS_ADDRESS" >&2
# Execute wrapped script
echo "Running: $WRAPPED_SCRIPT $*" >&2
-"$WRAPPED_SCRIPT" "$@" || die "script \"$WRAPPED_SCRIPT\" failed"
+"$WRAPPED_SCRIPT" "$@"
+e=$?
+
+case "$e" in
+ (77)
+ echo "script \"$WRAPPED_SCRIPT\" skipped" >&2
+ ;;
+ (0)
+ ;;
+ (*)
+ die "script \"$WRAPPED_SCRIPT\" failed"
+ ;;
+esac
kill -TERM "$DBUS_SESSION_BUS_PID" \
|| die "Message bus vanished! should not have happened" \
diff --git a/test/test-client.py b/test/test-client.py
index dc2be4e..1c8d7b4 100755
--- a/test/test-client.py
+++ b/test/test-client.py
@@ -39,7 +39,11 @@ import dbus.glib
import dbus.service
from dbus._compat import is_py2, is_py3
-from gi.repository import GObject as gobject
+
+try:
+ from gi.repository import GObject as gobject
+except ImportError:
+ raise SystemExit(77)
logging.basicConfig()
@@ -563,6 +567,8 @@ class TestDBusBindings(unittest.TestCase):
self.iface.RaiseDBusExceptionNoTraceback()
except Exception as e:
self.assertTrue(isinstance(e, dbus.DBusException), e.__class__)
+ self.assertEqual(e.get_dbus_name(),
+ 'com.example.Networking.ServerError')
self.assertEqual(str(e),
'com.example.Networking.ServerError: '
'Server not responding')
@@ -573,6 +579,8 @@ class TestDBusBindings(unittest.TestCase):
self.iface.RaiseDBusExceptionWithTraceback()
except Exception as e:
self.assertTrue(isinstance(e, dbus.DBusException), e.__class__)
+ self.assertEqual(e.get_dbus_name(),
+ 'com.example.Misc.RealityFailure')
self.assertTrue(str(e).startswith('com.example.Misc.RealityFailure: '
'Traceback '),
'Wanted a traceback but got:\n%s' % str(e))
diff --git a/test/test-exception-py2.py b/test/test-exception-py2.py
new file mode 100644
index 0000000..02cf93d
--- /dev/null
+++ b/test/test-exception-py2.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import sys
+import unittest
+
+import dbus
+
+# from test-service.py
+class ServiceError(dbus.DBusException):
+ """Exception representing a normal "environmental" error"""
+ include_traceback = False
+ _dbus_error_name = 'com.example.Networking.ServerError'
+
+
+class DBusExceptionTestCase(unittest.TestCase):
+ """Test the DBusException str/unicode behavior with py2"""
+
+ def test_dbus_exception_normal(self):
+ """Test the normal Exception behavior"""
+ e = dbus.exceptions.DBusException("baaa")
+ msg = e.get_dbus_message()
+ self.assertEqual(msg, u"baaa")
+
+ def test_dbus_exception_unicode(self):
+ """Test that DBusExceptions that take a py2 unicode work"""
+ e = dbus.exceptions.DBusException(u"bäää")
+ msg = e.get_dbus_message()
+ self.assertEqual(msg, u"bäää")
+
+ def test_dbus_exception_convert_str(self):
+ """Test that converting a DBusException to str() works as expected"""
+ e = dbus.exceptions.DBusException(u"bxxx")
+ self.assertEqual(str(e), "bxxx")
+
+ def test_dbus_exception_convert_str_fail(self):
+ """Test that a non-ascii Exception fails to convert to str"""
+ if sys.getdefaultencoding() == 'ascii':
+ self.assertRaises(UnicodeEncodeError,
+ lambda: str(dbus.exceptions.DBusException(u"bä")))
+ else:
+ self.skipTest("you're using a weird non-ascii "
+ "sys.getdefaultencoding()")
+
+ def test_dbus_exception_convert_unicode(self):
+ """Test that converting a DBusEception to unicode works"""
+ e = dbus.exceptions.DBusException(u"bäää")
+ self.assertEqual(e.get_dbus_message(), u"bäää")
+ self.assertEqual(e.__unicode__(), u"bäää")
+ self.assertEqual(unicode(e), u"bäää")
+
+ def test_subclass_exception_unicode(self):
+ """Test that DBusExceptions that take a py2 unicode work"""
+ e = ServiceError(u"bäää")
+ msg = e.get_dbus_message()
+ self.assertEqual(msg, u"bäää")
+ self.assertEqual(
+ unicode(e), u"com.example.Networking.ServerError: bäää")
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/test/test-exception-py3.py b/test/test-exception-py3.py
new file mode 100644
index 0000000..eddb45a
--- /dev/null
+++ b/test/test-exception-py3.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import unittest
+
+import dbus
+
+# from test-service.py
+class ServiceError(dbus.DBusException):
+ """Exception representing a normal "environmental" error"""
+ include_traceback = False
+ _dbus_error_name = 'com.example.Networking.ServerError'
+
+
+class DBusExceptionTestCase(unittest.TestCase):
+
+ def test_dbus_exception(self):
+ e = dbus.exceptions.DBusException("bäää")
+ msg = e.get_dbus_message()
+ self.assertEqual(msg, "bäää")
+ self.assertEqual(str(e), "bäää")
+
+ def test_subclass_exception(self):
+ e = ServiceError("bäää")
+ msg = e.get_dbus_message()
+ self.assertEqual(msg, "bäää")
+ self.assertEqual(str(e), "com.example.Networking.ServerError: bäää")
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/test/test-p2p.py b/test/test-p2p.py
index 772c4ba..c029c34 100644
--- a/test/test-p2p.py
+++ b/test/test-p2p.py
@@ -36,8 +36,11 @@ import dbus.glib
import dbus.service
from dbus._compat import is_py2
-from gi.repository import GObject as gobject
+try:
+ from gi.repository import GObject as gobject
+except ImportError:
+ raise SystemExit(77)
logging.basicConfig()
logging.getLogger().setLevel(1)
diff --git a/test/test-signals.py b/test/test-signals.py
index 3dab2ce..dd9e348 100644
--- a/test/test-signals.py
+++ b/test/test-signals.py
@@ -36,8 +36,11 @@ import dbus
import _dbus_bindings
import dbus.glib
import dbus.service
-from gi.repository import GObject as gobject
+try:
+ from gi.repository import GObject as gobject
+except ImportError:
+ raise SystemExit(77)
logging.basicConfig()
logging.getLogger().setLevel(1)
diff --git a/test/test-standalone.py b/test/test-standalone.py
index 584ba4f..459a41d 100755
--- a/test/test-standalone.py
+++ b/test/test-standalone.py
@@ -438,6 +438,28 @@ class TestMessageMarshalling(unittest.TestCase):
for bad in [
uni(0xD800),
utf8(0xed, 0xa0, 0x80),
+ ]:
+ s = SignalMessage('/', 'foo.bar', 'baz')
+ try:
+ s.append(bad, signature='s')
+ except UnicodeError:
+ pass
+ else:
+ raise AssertionError('Appending %r should fail' % bad)
+ for good in [
+ uni(0xfdcf),
+ uni(0xfdf0),
+ uni(0xfeff),
+ uni(0x0001feff),
+ uni(0x00020000),
+ uni(0x0007feff),
+ uni(0x00080000),
+ uni(0x0010feff),
+ ]:
+ s = SignalMessage('/', 'foo.bar', 'baz')
+ s.append(good, signature='s')
+ s.append(good.encode('utf-8'), signature='s')
+ for noncharacter in [
uni(0xFDD0),
utf8(0xef, 0xb7, 0x90),
uni(0xFDD7),
@@ -463,24 +485,11 @@ class TestMessageMarshalling(unittest.TestCase):
]:
s = SignalMessage('/', 'foo.bar', 'baz')
try:
- s.append(bad, signature='s')
+ s.append(noncharacter, signature='s')
except UnicodeError:
- pass
+ pass # libdbus < 1.6.10 disallows noncharacters
else:
- raise AssertionError('Appending %r should fail' % bad)
- for good in [
- uni(0xfdcf),
- uni(0xfdf0),
- uni(0xfeff),
- uni(0x0001feff),
- uni(0x00020000),
- uni(0x0007feff),
- uni(0x00080000),
- uni(0x0010feff),
- ]:
- s = SignalMessage('/', 'foo.bar', 'baz')
- s.append(good, signature='s')
- s.append(good.encode('utf-8'), signature='s')
+ pass # libdbus >= 1.6.10 allows noncharacters
class TestMatching(unittest.TestCase):
def setUp(self):
diff --git a/tools/Makefile.in b/tools/Makefile.in
index f0e2325..fa07926 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,