diff options
author | Simon McVittie <smcv@debian.org> | 2022-09-06 18:41:10 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2022-09-06 18:41:10 +0100 |
commit | ff0e1a783c4ddc6eb8607bf3606f33e55ec4efe2 (patch) | |
tree | 2dbdb6d69c6763728bf1a16e2d5d492826e9c967 | |
parent | 3d6743b54823fa1ced92f261122f33353c0b46c2 (diff) | |
parent | 4837813dc5c950ea6bacba5c651d9bdae9b0a93a (diff) |
Update upstream source from tag 'upstream/1.3.0'
Update to upstream version '1.3.0'
with Debian dir feb067669f6b4e5fe3ac9f9ab7e45657dcc59eff
-rw-r--r-- | .version | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 6 | ||||
-rw-r--r-- | MANIFEST | 7 | ||||
-rw-r--r-- | MANIFEST.in | 7 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | Makefile.in | 20 | ||||
-rw-r--r-- | NEWS | 28 | ||||
-rw-r--r-- | PKG-INFO | 56 | ||||
-rw-r--r-- | config.h.in | 9 | ||||
-rwxr-xr-x | configure | 38 | ||||
-rw-r--r-- | configure.ac | 14 | ||||
-rw-r--r-- | dbus_bindings/message-get-args.c | 8 | ||||
-rw-r--r-- | dbus_bindings/unixfd.c | 6 | ||||
-rw-r--r-- | dbus_python.egg-info/PKG-INFO | 56 | ||||
-rw-r--r-- | dbus_python.egg-info/SOURCES.txt | 189 | ||||
-rw-r--r-- | dbus_python.egg-info/dependency_links.txt | 1 | ||||
-rw-r--r-- | dbus_python.egg-info/top_level.txt | 3 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | meson_options.txt | 7 | ||||
-rw-r--r-- | pyproject.toml | 50 | ||||
-rw-r--r-- | setup.cfg | 40 | ||||
-rwxr-xr-x | setup.py | 100 | ||||
-rw-r--r-- | subprojects/dbus-gmain/Makefile.in | 3 | ||||
-rw-r--r-- | test/meson.build | 4 | ||||
-rwxr-xr-x | test/test-client.py | 56 | ||||
-rwxr-xr-x | test/test-standalone.py | 3 |
26 files changed, 285 insertions, 435 deletions
@@ -1 +1 @@ -1.2.19 +1.3.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e5acfc..9f4352f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -167,7 +167,8 @@ so you should have an issue number or a merge request ID to refer to. #### Pre-release steps * Make sure CI (currently Gitlab-CI) is passing -* Update `NEWS` and the version number in `configure.ac`, and commit them +* Update `NEWS` and the version numbers in **both** `configure.ac` + and `meson.build`, and commit them #### Building and uploading the release @@ -187,4 +188,5 @@ twine upload ${builddir}/dbus-python-${version}.tar.gz{,.asc} #### Post-release steps * Announce the new release to the D-Bus mailing list -* Update `NEWS` and the version number in `configure.ac`, and commit them +* Update `NEWS` and the version number in `configure.ac` and `meson.build`, + and commit them @@ -12,7 +12,6 @@ MANIFEST.in Makefile.am Makefile.in NEWS -PKG-INFO README aclocal.m4 build-aux/compile @@ -75,10 +74,6 @@ dbus_bindings/types-internal.h dbus_bindings/unixfd.c dbus_bindings/validation.c dbus_glib_bindings/module.c -dbus_python.egg-info/PKG-INFO -dbus_python.egg-info/SOURCES.txt -dbus_python.egg-info/dependency_links.txt -dbus_python.egg-info/top_level.txt doc/API_CHANGES.txt doc/PY3PORT.txt doc/_static/.gitignore @@ -136,6 +131,8 @@ m4/lt~obsolete.m4 m4/pkg.m4 meson.build meson_options.txt +pyproject.toml +setup.cfg setup.py subprojects/dbus-gmain/AUTHORS subprojects/dbus-gmain/CONTRIBUTING.md diff --git a/MANIFEST.in b/MANIFEST.in index abbf24b..0a73249 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,7 +12,6 @@ include MANIFEST.in include Makefile.am include Makefile.in include NEWS -include PKG-INFO include README include aclocal.m4 include build-aux/compile @@ -75,10 +74,6 @@ include dbus_bindings/types-internal.h include dbus_bindings/unixfd.c include dbus_bindings/validation.c include dbus_glib_bindings/module.c -include dbus_python.egg-info/PKG-INFO -include dbus_python.egg-info/SOURCES.txt -include dbus_python.egg-info/dependency_links.txt -include dbus_python.egg-info/top_level.txt include doc/API_CHANGES.txt include doc/PY3PORT.txt include doc/_static/.gitignore @@ -136,6 +131,8 @@ include m4/lt~obsolete.m4 include m4/pkg.m4 include meson.build include meson_options.txt +include pyproject.toml +include setup.cfg include setup.py include subprojects/dbus-gmain/AUTHORS include subprojects/dbus-gmain/CONTRIBUTING.md diff --git a/Makefile.am b/Makefile.am index 3b00991..5d2f7ea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,6 +39,8 @@ EXTRA_DIST = \ examples/unix-fd-service.py \ meson.build \ meson_options.txt \ + pyproject.toml \ + setup.cfg \ setup.py \ test/TestSuitePythonService.service.in \ test/compiled.test.in \ @@ -370,14 +372,11 @@ dist-hook: echo $(VERSION) > $(distdir)/.version touch $(distdir)/MANIFEST touch $(distdir)/MANIFEST.in - ( cd $(distdir) && $(PYTHON) setup.py egg_info ) - cp $(distdir)/dbus_python.egg-info/PKG-INFO $(distdir) ( cd $(distdir) && find -type d -o -print ) | \ LC_ALL=C sort | \ $(SED) -e 's|^\./||' \ > $(distdir)/MANIFEST sed -e 's/.*/include &/' < $(distdir)/MANIFEST > $(distdir)/MANIFEST.in - cp $(distdir)/MANIFEST $(distdir)/dbus_python.egg-info/SOURCES.txt maintainer-upload: rsync -tvpP --chmod=ugo=r $(DIST_ARCHIVES) $(DIST_ARCHIVES:%=%.asc) \ diff --git a/Makefile.in b/Makefile.in index c9928f8..b34f0d2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -624,9 +624,6 @@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ -DBUS_PYTHON_MAJOR_VERSION = @DBUS_PYTHON_MAJOR_VERSION@ -DBUS_PYTHON_MICRO_VERSION = @DBUS_PYTHON_MICRO_VERSION@ -DBUS_PYTHON_MINOR_VERSION = @DBUS_PYTHON_MINOR_VERSION@ DBUS_RUN_SESSION = @DBUS_RUN_SESSION@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -780,13 +777,13 @@ EXTRA_DIST = .reuse/dep5 AUTHORS CONTRIBUTING.md COPYING \ examples/gconf-proxy-service2.py \ examples/list-system-services.py examples/unix-fd-client.py \ examples/unix-fd-service.py meson.build meson_options.txt \ - setup.py test/TestSuitePythonService.service.in \ - test/compiled.test.in test/installable/meson.build \ - test/meson.build test/py.test.in test/sh.test.in \ - test/tmp-session-bus.conf.in tools/check-c-style.sh \ - tools/check-coding-style.mk tools/check-py-style.sh \ - tools/check-whitespace.sh $(sphinx_sources) doc/redirects \ - doc/redirects.py $(NULL) + pyproject.toml setup.cfg setup.py \ + test/TestSuitePythonService.service.in test/compiled.test.in \ + test/installable/meson.build test/meson.build test/py.test.in \ + test/sh.test.in test/tmp-session-bus.conf.in \ + tools/check-c-style.sh tools/check-coding-style.mk \ + tools/check-py-style.sh tools/check-whitespace.sh \ + $(sphinx_sources) doc/redirects doc/redirects.py $(NULL) # === C code === AM_CPPFLAGS = \ @@ -2437,14 +2434,11 @@ dist-hook: echo $(VERSION) > $(distdir)/.version touch $(distdir)/MANIFEST touch $(distdir)/MANIFEST.in - ( cd $(distdir) && $(PYTHON) setup.py egg_info ) - cp $(distdir)/dbus_python.egg-info/PKG-INFO $(distdir) ( cd $(distdir) && find -type d -o -print ) | \ LC_ALL=C sort | \ $(SED) -e 's|^\./||' \ > $(distdir)/MANIFEST sed -e 's/.*/include &/' < $(distdir)/MANIFEST > $(distdir)/MANIFEST.in - cp $(distdir)/MANIFEST $(distdir)/dbus_python.egg-info/SOURCES.txt maintainer-upload: rsync -tvpP --chmod=ugo=r $(DIST_ARCHIVES) $(DIST_ARCHIVES:%=%.asc) \ @@ -1,20 +1,30 @@ -dbus Python Bindings 1.3.0 (UNRELEASED) +dbus Python Bindings 1.3.0 (2022-09-06) ======================================= Dependencies: • Python 3, version 3.5 or later, is required. - A security-supported version (currently 3.6 or later) is recommended. + An upstream-supported version (currently 3.7 or later) is strongly + recommended, and a future version of dbus-python is likely to require + Python 3.7 or later. Python 2 is no longer supported. -• Installing from source code can be done with either Autotools or Meson. -• Installing from PyPI using pip still relies on Autotools for now. + +• Installing from source code using Meson requires Python 3.5 or later + and Meson 0.56.2 or later. This is now the recommended build system. + +• Installing from source code using Autotools requires Python 3.5 or later. + The Autotools build system is likely to be removed in a future version. + +• Installing from PyPI using pip or from source code via setup.py + requires Python 3.7 or later, Meson 0.60.3 or later, meson-python 0.8.1 + or later, and their dependencies (ninja, patchelf, setuptools, wheel). API changes: • dbus.gobject_service, dbus.types.UTF8String and the utf8_strings keyword argument were only usable with Python 2, and therefore have been removed, along with the rest of the special cases for Python 2. - (dbus-python!115; Simon McVittie) + (dbus-python!15; Simon McVittie) Enhancements: @@ -30,6 +40,14 @@ Enhancements: Fixes: +• Raise ValueError instead of crashing with assertion failure when a + Unix fd index number is greater than the number of fds actually attached + to the message (firewalld#985; Simon McVittie) + +• Raise ValueError instead of crashing with assertion failure when + a negative number is passed to the UnixFd constructor + (related to firewalld#985; Simon McVittie) + • Fix undefined escape sequences in docstrings (dbus-python#40; Jason A. Yundt) diff --git a/PKG-INFO b/PKG-INFO deleted file mode 100644 index f27b16d..0000000 --- a/PKG-INFO +++ /dev/null @@ -1,56 +0,0 @@ -Metadata-Version: 2.1 -Name: dbus-python -Version: 1.2.19 -Summary: Python bindings for libdbus -Home-page: http://www.freedesktop.org/wiki/Software/DBusBindings/#python -Maintainer: The D-Bus maintainers -Maintainer-email: dbus@lists.freedesktop.org -License: Expat (MIT/X11) -Download-URL: http://dbus.freedesktop.org/releases/dbus-python/ -Platform: UNKNOWN -Classifier: Development Status :: 7 - Inactive -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: C -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Topic :: Software Development :: Object Brokering -License-File: COPYING -License-File: AUTHORS - -======================================= -dbus-python_: Python bindings for D-Bus -======================================= - -.. _dbus-python: http://www.freedesktop.org/wiki/Software/DBusBindings#python - -dbus-python is the original Python binding for ``dbus``, the reference -implementation of the D-Bus protocol. - -Online documentation can be found at -<http://dbus.freedesktop.org/doc/dbus-python/>. - -Problems and alternatives -========================= - -dbus-python might not be the best D-Bus binding for you to use. dbus-python -does not follow the principle of "In the face of ambiguity, refuse the -temptation to guess", and can't be changed to not do so without seriously -breaking compatibility. - -In addition, it uses libdbus (which has known problems with multi-threaded -use) and attempts to be main-loop-agnostic (which means you have to select -a suitable main loop for your application). - -Alternative ways to get your Python code onto D-Bus include: - -* GDBus, part of the GIO module of `GLib`_, via GObject-Introspection and - `PyGI`_ (uses the GLib main loop and object model) - -* QtDBus, part of `Qt`_, via `PyQt`_ (uses the Qt main loop and object model) - -.. _GLib: http://developer.gnome.org/glib/ -.. _PyGI: https://live.gnome.org/PyGObject -.. _Qt: https://www.qt.io -.. _PyQT: http://www.riverbankcomputing.co.uk/software/pyqt/intro - - diff --git a/config.h.in b/config.h.in index 369d527..1fa36fb 100644 --- a/config.h.in +++ b/config.h.in @@ -1,14 +1,5 @@ /* config.h.in. Generated from configure.ac by autoheader. */ -/* dbus-python major version */ -#undef DBUS_PYTHON_MAJOR_VERSION - -/* dbus-python micro version */ -#undef DBUS_PYTHON_MICRO_VERSION - -/* dbus-python minor version */ -#undef DBUS_PYTHON_MINOR_VERSION - /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for dbus-python 1.2.19. +# Generated by GNU Autoconf 2.71 for dbus-python 1.3.0. # # Report bugs to <https://gitlab.freedesktop.org/dbus/dbus-python/-/issues/new>. # @@ -622,8 +622,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dbus-python' PACKAGE_TARNAME='dbus-python' -PACKAGE_VERSION='1.2.19' -PACKAGE_STRING='dbus-python 1.2.19' +PACKAGE_VERSION='1.3.0' +PACKAGE_STRING='dbus-python 1.3.0' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/dbus/dbus-python/-/issues/new' PACKAGE_URL='' @@ -771,9 +771,6 @@ CPPFLAGS LDFLAGS CFLAGS CC -DBUS_PYTHON_MICRO_VERSION -DBUS_PYTHON_MINOR_VERSION -DBUS_PYTHON_MAJOR_VERSION MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE @@ -1416,7 +1413,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.2.19 to adapt to many kinds of systems. +\`configure' configures dbus-python 1.3.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1487,7 +1484,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dbus-python 1.2.19:";; + short | recursive ) echo "Configuration of dbus-python 1.3.0:";; esac cat <<\_ACEOF @@ -1644,7 +1641,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dbus-python configure 1.2.19 +dbus-python configure 1.3.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1862,7 +1859,7 @@ 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.2.19, which was +It was created by dbus-python $as_me 1.3.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -2708,21 +2705,6 @@ fi -printf "%s\n" "#define DBUS_PYTHON_MAJOR_VERSION 1" >>confdefs.h - -DBUS_PYTHON_MAJOR_VERSION=1 - - -printf "%s\n" "#define DBUS_PYTHON_MINOR_VERSION 2" >>confdefs.h - -DBUS_PYTHON_MINOR_VERSION=2 - - -printf "%s\n" "#define DBUS_PYTHON_MICRO_VERSION 19" >>confdefs.h - -DBUS_PYTHON_MICRO_VERSION=19 - - ac_config_headers="$ac_config_headers config.h" @@ -4491,7 +4473,7 @@ fi # Define the identity of the package. PACKAGE='dbus-python' - VERSION='1.2.19' + VERSION='1.3.0' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -16709,7 +16691,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.2.19, which was +This file was extended by dbus-python $as_me 1.3.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16777,7 +16759,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -dbus-python config.status 1.2.19 +dbus-python config.status 1.3.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 02b7714..7d4b0e0 100644 --- a/configure.ac +++ b/configure.ac @@ -3,14 +3,8 @@ AC_PREREQ(2.59c) # Copyright 2006-2022 Collabora Ltd. # SPDX-License-Identifier: MIT -dnl The dbus-python version number -m4_define(dbus_python_major_version, 1) -m4_define(dbus_python_minor_version, 2) dnl Micro version is odd for non-releases -m4_define(dbus_python_micro_version, 19) - -AC_INIT([dbus-python], - dbus_python_major_version.dbus_python_minor_version.dbus_python_micro_version, +AC_INIT([dbus-python], [1.3.0], [https://gitlab.freedesktop.org/dbus/dbus-python/-/issues/new]) AC_CONFIG_MACRO_DIR([m4]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) @@ -25,12 +19,6 @@ m4_pattern_forbid([^AX_(COMPILER_FLAGS|IS_RELEASE|PYTHON_DEVEL|PYTHON_MODULE)\b] AM_MAINTAINER_MODE([enable]) AX_IS_RELEASE([micro-version]) -AC_DEFINE(DBUS_PYTHON_MAJOR_VERSION, dbus_python_major_version, [dbus-python major version]) -AC_SUBST(DBUS_PYTHON_MAJOR_VERSION, dbus_python_major_version) -AC_DEFINE(DBUS_PYTHON_MINOR_VERSION, dbus_python_minor_version, [dbus-python minor version]) -AC_SUBST(DBUS_PYTHON_MINOR_VERSION, dbus_python_minor_version) -AC_DEFINE(DBUS_PYTHON_MICRO_VERSION, dbus_python_micro_version, [dbus-python micro version]) -AC_SUBST(DBUS_PYTHON_MICRO_VERSION, dbus_python_micro_version) AC_CONFIG_SRCDIR([dbus_bindings/module.c]) AC_CONFIG_HEADERS(config.h) diff --git a/dbus_bindings/message-get-args.c b/dbus_bindings/message-get-args.c index 6dad272..628a616 100644 --- a/dbus_bindings/message-get-args.c +++ b/dbus_bindings/message-get-args.c @@ -307,7 +307,15 @@ _message_iter_get_pyobject(DBusMessageIter *iter, #ifdef DBUS_TYPE_UNIX_FD case DBUS_TYPE_UNIX_FD: DBG("%s", "found an unix fd"); + /* Note that this can return an invalid fd (less than 0) if the + * sender has included an index numerically greater than the + * number of fds that were attached out-of-band to the message. + * libdbus cannot send messages like this, but GDBus can. */ dbus_message_iter_get_basic(iter, &u.fd); + if (u.fd < 0) { + PyErr_Format(PyExc_ValueError, "invalid file descriptor in message"); + break; + } args = Py_BuildValue("(i)", u.fd); if (args) { ret = PyObject_Call((PyObject *)&DBusPyUnixFd_Type, args, diff --git a/dbus_bindings/unixfd.c b/dbus_bindings/unixfd.c index 63a2402..e515cd3 100644 --- a/dbus_bindings/unixfd.c +++ b/dbus_bindings/unixfd.c @@ -62,9 +62,9 @@ typedef struct { } UnixFdObject; /* Return values: - * -2 - the long value overflows an int + * -2 - the long value is not plausible as a file descriptor * -1 - Python failed producing a long (or in Python 2 an int) - * 0 - success + * 0 - success (value might not *actually* be a fd, but it *could* be) * 1 - arg is not a long (or in Python 2 an int) * * Or to summarize: @@ -89,7 +89,7 @@ make_fd(PyObject *arg, int *fd) return 1; } /* Check for int overflow. */ - if (fd_arg < INT_MIN || fd_arg > INT_MAX) { + if (fd_arg < 0 || fd_arg > INT_MAX) { PyErr_Format(PyExc_ValueError, "int is outside fd range"); return -2; } diff --git a/dbus_python.egg-info/PKG-INFO b/dbus_python.egg-info/PKG-INFO deleted file mode 100644 index f27b16d..0000000 --- a/dbus_python.egg-info/PKG-INFO +++ /dev/null @@ -1,56 +0,0 @@ -Metadata-Version: 2.1 -Name: dbus-python -Version: 1.2.19 -Summary: Python bindings for libdbus -Home-page: http://www.freedesktop.org/wiki/Software/DBusBindings/#python -Maintainer: The D-Bus maintainers -Maintainer-email: dbus@lists.freedesktop.org -License: Expat (MIT/X11) -Download-URL: http://dbus.freedesktop.org/releases/dbus-python/ -Platform: UNKNOWN -Classifier: Development Status :: 7 - Inactive -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: C -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Topic :: Software Development :: Object Brokering -License-File: COPYING -License-File: AUTHORS - -======================================= -dbus-python_: Python bindings for D-Bus -======================================= - -.. _dbus-python: http://www.freedesktop.org/wiki/Software/DBusBindings#python - -dbus-python is the original Python binding for ``dbus``, the reference -implementation of the D-Bus protocol. - -Online documentation can be found at -<http://dbus.freedesktop.org/doc/dbus-python/>. - -Problems and alternatives -========================= - -dbus-python might not be the best D-Bus binding for you to use. dbus-python -does not follow the principle of "In the face of ambiguity, refuse the -temptation to guess", and can't be changed to not do so without seriously -breaking compatibility. - -In addition, it uses libdbus (which has known problems with multi-threaded -use) and attempts to be main-loop-agnostic (which means you have to select -a suitable main loop for your application). - -Alternative ways to get your Python code onto D-Bus include: - -* GDBus, part of the GIO module of `GLib`_, via GObject-Introspection and - `PyGI`_ (uses the GLib main loop and object model) - -* QtDBus, part of `Qt`_, via `PyQt`_ (uses the Qt main loop and object model) - -.. _GLib: http://developer.gnome.org/glib/ -.. _PyGI: https://live.gnome.org/PyGObject -.. _Qt: https://www.qt.io -.. _PyQT: http://www.riverbankcomputing.co.uk/software/pyqt/intro - - diff --git a/dbus_python.egg-info/SOURCES.txt b/dbus_python.egg-info/SOURCES.txt deleted file mode 100644 index b408a35..0000000 --- a/dbus_python.egg-info/SOURCES.txt +++ /dev/null @@ -1,189 +0,0 @@ -.reuse/dep5 -.version -AUTHORS -CONTRIBUTING.md -COPYING -ChangeLog -LICENSES/GPL-3.0-or-later.txt -LICENSES/LicenseRef-AutoconfArchiveException.txt -LICENSES/MIT.txt -MANIFEST -MANIFEST.in -Makefile.am -Makefile.in -NEWS -PKG-INFO -README -aclocal.m4 -build-aux/compile -build-aux/config.guess -build-aux/config.sub -build-aux/depcomp -build-aux/install-sh -build-aux/ltmain.sh -build-aux/missing -build-aux/py-compile -build-aux/tap-driver.sh -build-aux/test-driver -config.h.in -configure -configure.ac -dbus-python.pc.in -dbus/__init__.py -dbus/_compat.py -dbus/_dbus.py -dbus/_expat_introspect_parser.py -dbus/bus.py -dbus/connection.py -dbus/decorators.py -dbus/exceptions.py -dbus/gi_service.py -dbus/glib.py -dbus/lowlevel.py -dbus/mainloop/__init__.py -dbus/mainloop/glib.py -dbus/proxies.py -dbus/server.py -dbus/service.py -dbus/types.py -dbus_bindings/abstract.c -dbus_bindings/bus.c -dbus_bindings/bytes.c -dbus_bindings/compat-internal.h -dbus_bindings/conn-internal.h -dbus_bindings/conn-methods.c -dbus_bindings/conn.c -dbus_bindings/containers.c -dbus_bindings/dbus_bindings-internal.h -dbus_bindings/debug.c -dbus_bindings/exceptions.c -dbus_bindings/float.c -dbus_bindings/generic.c -dbus_bindings/int.c -dbus_bindings/libdbusconn.c -dbus_bindings/mainloop.c -dbus_bindings/message-append.c -dbus_bindings/message-get-args.c -dbus_bindings/message-internal.h -dbus_bindings/message.c -dbus_bindings/module.c -dbus_bindings/pending-call.c -dbus_bindings/server.c -dbus_bindings/signature.c -dbus_bindings/string.c -dbus_bindings/types-internal.h -dbus_bindings/unixfd.c -dbus_bindings/validation.c -dbus_glib_bindings/module.c -dbus_python.egg-info/PKG-INFO -dbus_python.egg-info/SOURCES.txt -dbus_python.egg-info/dependency_links.txt -dbus_python.egg-info/top_level.txt -doc/API_CHANGES.txt -doc/PY3PORT.txt -doc/_static/.gitignore -doc/conf.py -doc/dbus.bus.rst -doc/dbus.connection.rst -doc/dbus.decorators.rst -doc/dbus.exceptions.rst -doc/dbus.gi_service.rst -doc/dbus.glib.rst -doc/dbus.gobject_service.rst -doc/dbus.lowlevel.rst -doc/dbus.mainloop.rst -doc/dbus.proxies.rst -doc/dbus.rst -doc/dbus.server.rst -doc/dbus.service.rst -doc/dbus.types.rst -doc/index.rst -doc/maintainer-update-website.sh -doc/meson.build -doc/news.rst -doc/redirects -doc/redirects.py -doc/tutorial.txt -examples/example-async-client.py -examples/example-client.py -examples/example-service.py -examples/example-signal-emitter.py -examples/example-signal-recipient.py -examples/gconf-proxy-client.py -examples/gconf-proxy-service2.py -examples/list-system-services.py -examples/unix-fd-client.py -examples/unix-fd-service.py -include/dbus/dbus-python.h -m4/ax_append_compile_flags.m4 -m4/ax_append_flag.m4 -m4/ax_append_link_flags.m4 -m4/ax_check_compile_flag.m4 -m4/ax_check_link_flag.m4 -m4/ax_compiler_flags.m4 -m4/ax_compiler_flags_cflags.m4 -m4/ax_compiler_flags_gir.m4 -m4/ax_compiler_flags_ldflags.m4 -m4/ax_is_release.m4 -m4/ax_python_devel.m4 -m4/ax_python_module.m4 -m4/ax_require_defined.m4 -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 -m4/pkg.m4 -meson.build -meson_options.txt -setup.py -subprojects/dbus-gmain/AUTHORS -subprojects/dbus-gmain/CONTRIBUTING.md -subprojects/dbus-gmain/COPYING -subprojects/dbus-gmain/LICENSES/AFL-2.1.txt -subprojects/dbus-gmain/LICENSES/GPL-2.0-or-later.txt -subprojects/dbus-gmain/LICENSES/MIT.txt -subprojects/dbus-gmain/Makefile.am -subprojects/dbus-gmain/Makefile.in -subprojects/dbus-gmain/README.md -subprojects/dbus-gmain/dbus-gmain.c -subprojects/dbus-gmain/dbus-gmain/dbus-gmain.h -subprojects/dbus-gmain/meson.build -subprojects/dbus-gmain/meson_options.txt -subprojects/dbus-gmain/tests/30574.c -subprojects/dbus-gmain/tests/meson.build -subprojects/dbus-gmain/tests/test-thread-client.c -subprojects/dbus-gmain/tests/test-thread-server.c -subprojects/dbus-gmain/tests/test-thread.h -subprojects/dbus-gmain/tests/use-as-subproject.py -subprojects/dbus-gmain/tests/use-as-subproject/README -subprojects/dbus-gmain/tests/use-as-subproject/meson.build -subprojects/dbus-gmain/tests/use-as-subproject/use-dbus-gmain.c -subprojects/dbus-gmain/tests/util.c -subprojects/dbus-gmain/tests/util.h -test/TestSuitePythonService.service.in -test/compiled.test.in -test/cross-test-client.py -test/cross-test-server.py -test/crosstest.py -test/dbus_py_test.c -test/dbus_test_utils.py -test/import-repeatedly.c -test/installable/meson.build -test/meson.build -test/py.test.in -test/run-test.sh -test/sh.test.in -test/test-client.py -test/test-exception-py3.py -test/test-p2p.py -test/test-service.py -test/test-signals.py -test/test-standalone.py -test/test-unusable-main-loop.py -test/tmp-session-bus.conf.in -test/wait-for-name.py -tools/check-c-style.sh -tools/check-coding-style.mk -tools/check-py-style.sh -tools/check-whitespace.sh diff --git a/dbus_python.egg-info/dependency_links.txt b/dbus_python.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/dbus_python.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/dbus_python.egg-info/top_level.txt b/dbus_python.egg-info/top_level.txt deleted file mode 100644 index 7d64792..0000000 --- a/dbus_python.egg-info/top_level.txt +++ /dev/null @@ -1,3 +0,0 @@ -_dbus_bindings -_dbus_glib_bindings -dbus diff --git a/meson.build b/meson.build index 727c085..abd5681 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,7 @@ project( 'warning_level=2', ], meson_version: '>=0.56', - version: '1.2.19', + version: '1.3.0', ) pc_mod = import('pkgconfig') diff --git a/meson_options.txt b/meson_options.txt index 7dc5218..b45debb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,6 +16,13 @@ option( ) option( + 'installed_tests_subdir', + type: 'string', + value: '', + description: 'Suffix to make installed-tests from multiple builds co-installable', +) + +option( 'python', type: 'string', value: '', diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3949d8f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,50 @@ +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: MIT + +[build-system] +build-backend = 'mesonpy' +requires = [ + 'meson-python>=0.8.1', + 'meson>=0.60.0', + 'ninja', + 'patchelf', + 'setuptools', + 'wheel', +] + +[project] +name = 'dbus-python' +license = { text = 'Expat (MIT/X11)' } +description = 'Python bindings for libdbus' +maintainers = [ + { name = 'The D-Bus maintainers', email = 'dbus@lists.freedesktop.org' }, +] +requires-python = '>=3.7' +readme = { file = 'README', content-type = 'text/x-rst' } +keywords = ['dbus', 'D-Bus'] +classifiers = [ + 'Development Status :: 7 - Inactive', + 'License :: OSI Approved :: MIT License', + 'Programming Language :: C', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: Implementation :: CPython', + 'Topic :: Software Development :: Object Brokering', +] +dynamic = [ + 'version' +] + +[project.optional-dependencies] +doc = [ + 'sphinx', + 'sphinx_rtd_theme', +] +test = [ + 'tap.py', +] + +[project.urls] +homepage = 'http://www.freedesktop.org/wiki/Software/DBusBindings/#python' +download = 'http://dbus.freedesktop.org/releases/dbus-python/' +source = 'https://gitlab.freedesktop.org/dbus/dbus-python/' +tracker = 'https://gitlab.freedesktop.org/dbus/dbus-python/-/issues' diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1c5a0cb --- /dev/null +++ b/setup.cfg @@ -0,0 +1,40 @@ +# Copyright 2022 Collabora Ltd. +# SPDX-License-Identifier: MIT + +[options] +python_requires = >=3.7 +setup_requires = + meson-python>=0.8.1 + meson>=0.60.3 + ninja + patchelf + setuptools + wheel +zip_safe = False + +[metadata] +name = dbus-python +license = Expat (MIT/X11) +description = Python bindings for libdbus +maintainer = The D-Bus maintainers +maintainer_email = dbus@lists.freedesktop.org +long_description = file: README +keywords = + dbus + D-Bus +classifiers = + Development Status :: 7 - Inactive + License :: OSI Approved :: MIT License + Programming Language :: C + Programming Language :: Python :: 3 + Programming Language :: Python :: Implementation :: CPython + Topic :: Software Development :: Object Brokering +url = http://www.freedesktop.org/wiki/Software/DBusBindings/#python +download_url = http://dbus.freedesktop.org/releases/dbus-python/ + +[options.extras_require] +doc = + sphinx + sphinx_rtd_theme +test = + tap.py @@ -33,41 +33,83 @@ import os import subprocess import sys + +if ( + os.environ.get('DBUS_PYTHON_USE_AUTOTOOLS', '') + or sys.version_info < (3, 7) +): + use_autotools = True + setup_requires = ['setuptools', 'wheel'] +else: + use_autotools = False + setup_requires = ['meson>=0.60.0', 'ninja', 'setuptools', 'wheel'] + if os.path.exists('.version'): version = open('.version').read().strip() -else: +elif use_autotools: version = subprocess.check_output(['autoconf', '--trace', 'AC_INIT:$2', 'configure.ac']).decode('utf-8').strip() +else: + with open('meson.build') as reader: + for line in reader: + if line.strip().replace(' ', '').startswith('version:'): + version = line.split(':', 1)[1] + version = version.replace(',', '') + version = version.replace('"', '') + version = version.replace("'", '') + break + else: + raise AssertionError('Cannot find version in meson.build') class Build(Distribution().get_command_class('build')): - """Dummy version of distutils build which runs an Autotools build system - instead. + """Dummy version of distutils build which runs an Autotools or Meson + build system instead. """ def run(self): srcdir = os.getcwd() builddir = os.path.join(srcdir, self.build_temp) - configure = os.path.join(srcdir, 'configure') mkpath(builddir) - if not os.path.exists(configure): - configure = os.path.join(srcdir, 'autogen.sh') + if use_autotools: + configure = os.path.join(srcdir, 'configure') + + if not os.path.exists(configure): + configure = os.path.join(srcdir, 'autogen.sh') - subprocess.check_call([ - configure, - '--disable-maintainer-mode', - 'PYTHON=' + sys.executable, - # Put the documentation, etc. out of the way: we only want - # the Python code and extensions - '--prefix=' + os.path.join(builddir, 'prefix'), - ], - cwd=builddir) - make_args = [ - 'pythondir=' + os.path.join(srcdir, self.build_lib), - 'pyexecdir=' + os.path.join(srcdir, self.build_lib), - ] - subprocess.check_call(['make', '-C', builddir] + make_args) - subprocess.check_call(['make', '-C', builddir, 'install'] + make_args) + subprocess.check_call([ + configure, + '--disable-maintainer-mode', + 'PYTHON=' + sys.executable, + # Put the documentation, etc. out of the way: we only want + # the Python code and extensions + '--prefix=' + os.path.join(builddir, 'prefix'), + ], + cwd=builddir) + make_args = [ + 'pythondir=' + os.path.join(srcdir, self.build_lib), + 'pyexecdir=' + os.path.join(srcdir, self.build_lib), + ] + subprocess.check_call(['make', '-C', builddir] + make_args) + subprocess.check_call(['make', '-C', builddir, 'install'] + make_args) + else: + subprocess.check_call( + [ + sys.executable, + '-m', 'mesonbuild.mesonmain', + '--prefix=' + os.path.join(builddir, 'prefix'), + '-Ddoc=false', + '-Dinstalled_tests=false', + '-Dpython=' + sys.executable, + '-Dpython.platlibdir=' + os.path.join(srcdir, self.build_lib), + '-Dpython.purelibdir=' + os.path.join(srcdir, self.build_lib), + '-Dtests=false', + srcdir, + builddir, + ] + ) + subprocess.check_call(['meson', 'compile', '-C', builddir]) + subprocess.check_call(['meson', 'install', '-C', builddir]) class BuildExt(Distribution().get_command_class('build_ext')): def run(self): @@ -85,27 +127,13 @@ dbus_glib_bindings = Extension('_dbus_glib_bindings', setup( name='dbus-python', version=version, - description='Python bindings for libdbus', - long_description=open('README').read(), - maintainer='The D-Bus maintainers', - maintainer_email='dbus@lists.freedesktop.org', - download_url='http://dbus.freedesktop.org/releases/dbus-python/', - url='http://www.freedesktop.org/wiki/Software/DBusBindings/#python', packages=['dbus'], ext_modules=[dbus_bindings, dbus_glib_bindings], - license='Expat (MIT/X11)', - classifiers=[ - 'Development Status :: 7 - Inactive', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: C', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: Implementation :: CPython', - 'Topic :: Software Development :: Object Brokering', - ], cmdclass={ 'build': Build, 'build_py': BuildPy, 'build_ext': BuildExt, }, + setup_requires=setup_requires, tests_require=['tap.py'], ) diff --git a/subprojects/dbus-gmain/Makefile.in b/subprojects/dbus-gmain/Makefile.in index e60b4ed..7f0affe 100644 --- a/subprojects/dbus-gmain/Makefile.in +++ b/subprojects/dbus-gmain/Makefile.in @@ -461,9 +461,6 @@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ -DBUS_PYTHON_MAJOR_VERSION = @DBUS_PYTHON_MAJOR_VERSION@ -DBUS_PYTHON_MICRO_VERSION = @DBUS_PYTHON_MICRO_VERSION@ -DBUS_PYTHON_MINOR_VERSION = @DBUS_PYTHON_MINOR_VERSION@ DBUS_RUN_SESSION = @DBUS_RUN_SESSION@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ diff --git a/test/meson.build b/test/meson.build index 3539f8d..7c2db7b 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,9 +1,9 @@ # Copyright 2022 Collabora Ltd. # SPDX-License-Identifier: MIT -installed_testdir = get_option('libexecdir') / 'installed-tests' / meson.project_name() +installed_testdir = get_option('libexecdir') / 'installed-tests' / meson.project_name() / get_option('installed_tests_subdir') installed_test_testdir = installed_testdir / 'test' -installed_test_metadir = get_option('datadir') / 'installed-tests' / meson.project_name() +installed_test_metadir = get_option('datadir') / 'installed-tests' / meson.project_name() / get_option('installed_tests_subdir') test_env = environment() test_env.set('DBUS_TOP_SRCDIR', meson.project_source_root()) test_env.set('DBUS_TOP_BUILDDIR', meson.project_build_root()) diff --git a/test/test-client.py b/test/test-client.py index 3b1114d..9641125 100755 --- a/test/test-client.py +++ b/test/test-client.py @@ -31,6 +31,7 @@ import unittest import time import logging import weakref +import sys import dbus import _dbus_bindings @@ -40,7 +41,7 @@ import dbus.service import dbus_test_utils try: - from gi.repository import GLib + from gi.repository import GLib, Gio except ImportError: print('1..0 # SKIP cannot import GLib') raise SystemExit(0) @@ -618,6 +619,59 @@ class TestDBusBindings(unittest.TestCase): else: raise AssertionError('Wanted an exception') + @unittest.skipIf(sys.platform.startswith("win"), "requires Unix") + def test_invalid_fd_index(self) -> None: + # libdbus cannot call a method containing fd indexes that are + # out-of-range for the number of fds attached to the message, + # but Gio can. + gdbus_conn = Gio.bus_get_sync(Gio.BusType.SESSION, None) + + try: + results, fds = gdbus_conn.call_with_unix_fd_list_sync( + NAME, OBJECT, IFACE, 'EchoVariant', + GLib.Variant('(v)', (GLib.Variant.new_handle(42),)), + GLib.VariantType('(v)'), + Gio.DBusCallFlags.NONE, + -1, + Gio.UnixFDList.new(), + None, + ) + except GLib.GError as e: + self.assertEqual( + Gio.dbus_error_get_remote_error(e), + 'org.freedesktop.DBus.Python.ValueError', + ) + self.assertIn( + 'invalid file descriptor in message', str(e), + ) + else: + raise AssertionError('Wanted an exception') + + plain_fd = os.open('/dev/null', os.O_RDONLY) + expected_stat = os.fstat(plain_fd) + + try: + # Check that the server can do a similar operation with valid + # fds, and has not crashed + for i in range(2): + fds_in = Gio.UnixFDList.new() + self.assertEqual(fds_in.append(plain_fd), 0) + results, fds_out = gdbus_conn.call_with_unix_fd_list_sync( + NAME, OBJECT, IFACE, 'EchoVariant', + GLib.Variant('(v)', (GLib.Variant.new_handle(0),)), + GLib.VariantType('(v)'), + Gio.DBusCallFlags.NONE, + -1, + fds_in, + None, + ) + self.assertEqual(results[0], 0) + fd = fds_out.peek_fds()[0] + actual_stat = os.fstat(fd) + self.assertEqual(expected_stat, actual_stat) + finally: + os.close(plain_fd) + """ Remove this for now class TestDBusPythonToGLibBindings(unittest.TestCase): def setUp(self): diff --git a/test/test-standalone.py b/test/test-standalone.py index 157ec4a..c091228 100755 --- a/test/test-standalone.py +++ b/test/test-standalone.py @@ -560,6 +560,9 @@ class TestMessageMarshalling(unittest.TestCase): finally: os.close(plain_fd) + with self.assertRaises(ValueError): + types.UnixFd(-1) + class TestMatching(unittest.TestCase): def setUp(self): from _dbus_bindings import SignalMessage |