diff -Nru pydbus-0.6.0/debian/changelog pydbus-0.6.0.1/debian/changelog --- pydbus-0.6.0/debian/changelog 2017-02-24 17:53:49.000000000 +0000 +++ pydbus-0.6.0.1/debian/changelog 2017-02-24 17:53:49.000000000 +0000 @@ -1,4 +1,4 @@ -pydbus (0.6.0-1) zesty; urgency=medium +pydbus (0.6.0.1) zesty; urgency=medium * Uploaded to the repository. diff -Nru pydbus-0.6.0/debian/control pydbus-0.6.0.1/debian/control --- pydbus-0.6.0/debian/control 2017-02-24 17:53:49.000000000 +0000 +++ pydbus-0.6.0.1/debian/control 2017-02-24 17:53:49.000000000 +0000 @@ -5,20 +5,17 @@ Build-Depends: dbus, debhelper (>= 10), dh-python, - python-all, + python2.7, + python-dev, python-gi, python-setuptools, Standards-Version: 3.9.8 Homepage: https://github.com/LEW21/pydbus -Testsuite: autopkgtest -Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/pydbus.git -Vcs-Browser: https://anonscm.debian.org/git/python-modules/packages/pydbus.git/ Package: python-pydbus Architecture: all Multi-Arch: foreign Depends: python-gi, ${misc:Depends}, ${python:Depends} -Suggests: python-pydbus-doc Description: Pythonic D-Bus library (Python 2) pydbus provides a pythonic interface to the D-Bus message bus system. pydbus can be used to access remote objects diff -Nru pydbus-0.6.0/debian/.git-dpm pydbus-0.6.0.1/debian/.git-dpm --- pydbus-0.6.0/debian/.git-dpm 2016-12-28 10:30:31.000000000 +0000 +++ pydbus-0.6.0.1/debian/.git-dpm 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -# see git-dpm(1) from git-dpm package -9b3b40cf5b3ae18767621154ea6ce8ecfd40461d -9b3b40cf5b3ae18767621154ea6ce8ecfd40461d -9b3b40cf5b3ae18767621154ea6ce8ecfd40461d -9b3b40cf5b3ae18767621154ea6ce8ecfd40461d -pydbus_0.6.0.orig.tar.gz -62a39a7b0627ba00eab9800ca49698f408cb0b81 -2083046 -debianTag="debian/%e%v" -patchedTag="patched/%e%v" -upstreamTag="upstream/%e%u" diff -Nru pydbus-0.6.0/debian/rules pydbus-0.6.0.1/debian/rules --- pydbus-0.6.0/debian/rules 2017-02-24 17:53:49.000000000 +0000 +++ pydbus-0.6.0.1/debian/rules 2017-02-24 17:53:49.000000000 +0000 @@ -6,13 +6,6 @@ %: dh $@ --with python2 --buildsystem=pybuild -override_dh_installdocs: - rst2html --report="error" README.rst README.html - rst2html doc/tutorial.rst doc/tutorial.html - dh_installdocs - override_dh_auto_clean: dh_auto_clean rm -rf pydbus.egg-info - rm -f README.html - rm -f doc/tutorial.html diff -Nru pydbus-0.6.0/debian/source/format pydbus-0.6.0.1/debian/source/format --- pydbus-0.6.0/debian/source/format 2016-12-28 10:30:31.000000000 +0000 +++ pydbus-0.6.0.1/debian/source/format 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -3.0 (quilt) diff -Nru pydbus-0.6.0/debian/watch pydbus-0.6.0.1/debian/watch --- pydbus-0.6.0/debian/watch 2017-01-12 23:56:10.000000000 +0000 +++ pydbus-0.6.0.1/debian/watch 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -version=4 -opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%pydbus-$1.tar.gz%" \ - https://github.com/LEW21/pydbus/releases \ - (?:.*?/)?v?(\d[\d.]*)\.tar\.gz Binary files /tmp/tmpPr5z5d/XkvzshCFCj/pydbus-0.6.0/doc/tabcomp/s1.png and /tmp/tmpPr5z5d/LX_KxLAwZQ/pydbus-0.6.0.1/doc/tabcomp/s1.png differ Binary files /tmp/tmpPr5z5d/XkvzshCFCj/pydbus-0.6.0/doc/tabcomp/s2.png and /tmp/tmpPr5z5d/LX_KxLAwZQ/pydbus-0.6.0.1/doc/tabcomp/s2.png differ Binary files /tmp/tmpPr5z5d/XkvzshCFCj/pydbus-0.6.0/doc/tabcomp/s3.png and /tmp/tmpPr5z5d/LX_KxLAwZQ/pydbus-0.6.0.1/doc/tabcomp/s3.png differ Binary files /tmp/tmpPr5z5d/XkvzshCFCj/pydbus-0.6.0/doc/tabcomp/s4.png and /tmp/tmpPr5z5d/LX_KxLAwZQ/pydbus-0.6.0.1/doc/tabcomp/s4.png differ Binary files /tmp/tmpPr5z5d/XkvzshCFCj/pydbus-0.6.0/doc/tabcomp/s5.png and /tmp/tmpPr5z5d/LX_KxLAwZQ/pydbus-0.6.0.1/doc/tabcomp/s5.png differ Binary files /tmp/tmpPr5z5d/XkvzshCFCj/pydbus-0.6.0/doc/tabcomp/s6.png and /tmp/tmpPr5z5d/LX_KxLAwZQ/pydbus-0.6.0.1/doc/tabcomp/s6.png differ Binary files /tmp/tmpPr5z5d/XkvzshCFCj/pydbus-0.6.0/doc/tabcomp/s7.png and /tmp/tmpPr5z5d/LX_KxLAwZQ/pydbus-0.6.0.1/doc/tabcomp/s7.png differ diff -Nru pydbus-0.6.0/doc/tabcomp/tabcomp.html pydbus-0.6.0.1/doc/tabcomp/tabcomp.html --- pydbus-0.6.0/doc/tabcomp/tabcomp.html 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/doc/tabcomp/tabcomp.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,317 +0,0 @@ - - -pydbus tab completion demo - - - - -
- - - - - - - -TAB -N -y - -
- - - \ No newline at end of file diff -Nru pydbus-0.6.0/doc/tutorial.rst pydbus-0.6.0.1/doc/tutorial.rst --- pydbus-0.6.0/doc/tutorial.rst 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/doc/tutorial.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,409 +0,0 @@ -=============== -pydbus tutorial -=============== - -:Author: `Linus Lewandowski`_ -:Based on: python-dbus tutorial by Simon McVittie, `Collabora Ltd.`_ (2006-06-14) -:Date: 2016-09-26 - -.. _`Collabora Ltd.`: http://www.collabora.co.uk/ -.. _`Linus Lewandowski`: http://lew21.net/ - -This tutorial requires Python 2.7 or up, and ``pydbus`` 0.6 or up. - -.. contents:: - -.. -------------------------------------------------------------------- - -.. _Bus object: -.. _Bus objects: - -Connecting to the Bus -===================== - -Applications that use D-Bus typically connect to a *bus daemon*, which -forwards messages between the applications. To use D-Bus, you need to create a -``Bus`` object representing the connection to the bus daemon. - -There are generally two bus daemons you may be interested in. Each user -login session should have a *session bus*, which is local to that -session. It's used to communicate between desktop applications. Connect -to the session bus by creating a ``SessionBus`` object:: - - from pydbus import SessionBus - - session_bus = SessionBus() - -The *system bus* is global and usually started during boot; it's used to -communicate with system services like systemd_, udev_ and NetworkManager_. -To connect to the system bus, create a ``SystemBus`` object:: - - from pydbus import SystemBus - - system_bus = SystemBus() - -Of course, you can connect to both in the same application. - -For special purposes, you might use a non-default Bus using the Bus class. - -.. _systemd: - https://www.freedesktop.org/wiki/Software/systemd/ -.. _udev: - https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html -.. _NetworkManager: - https://wiki.gnome.org/Projects/NetworkManager - -.. -------------------------------------------------------------------- - -D-Bus objects -============= - -D-Bus applications can export objects for other applications' use. To -start working with an object in another application, you need to know: - -* The *bus name*. This identifies which application you want to - communicate with. You'll usually identify applications by a - *well-known name*, which is a dot-separated string starting with a - reversed domain name, such as ``org.freedesktop.NetworkManager`` - or ``com.example.WordProcessor``. - -* The *object path*. Applications can export many objects - for - instance, example.com's word processor might provide an object - representing the word processor application itself and an object for - each document window opened, or it might also provide an object for - each paragraph within a document. - - To identify which one you want to interact with, you use an object path, - a slash-separated string resembling a filename. For instance, example.com's - word processor might provide an object at ``/`` representing the word - processor itself, and objects at ``/documents/123`` and - ``/documents/345`` representing opened document windows. - -All objects have methods, properties and signals. - -Setting up an event loop -======================== - -To handle signals emitted by exported objects, or to export your own objects, you need to setup an event loop. - -The only main loop supported by ``pydbus`` is GLib.MainLoop. - -GLib.MainLoop -------------- - -To create the loop object use:: - - from gi.repository import GLib - - loop = GLib.MainLoop() - -To execute the loop use:: - - loop.run() - -While ``loop.run()`` is executing, GLib will watch for signals you're subscribed to, or accesses to objects you exported, and execute correct callbacks when appropriate. To stop, call ``loop.quit()``. - -.. _proxy object: - -Accessing exported objects -========================== - -To interact with a remote object, you use a *proxy object*. This is a -Python object which acts as a proxy or "stand-in" for the remote object - -when you call a method on a proxy object, this causes dbus-python to make -a method call on the remote object, passing back any return values from -the remote object's method as the return values of the proxy method call. - -Obtaining proxy objects ------------------------ - -.. _bus.get: - -To obtain a proxy object, call the ``get`` method on the ``Bus``. -For example, NetworkManager_ has the well-known name -``org.freedesktop.NetworkManager`` and exports an object whose object -path is ``/org/freedesktop/NetworkManager``, plus an object per network -interface at object paths like -``/org/freedesktop/NetworkManager/Devices/eth0``. You can get a proxy -for the object representing eth0 like this:: - - from pydbus import SystemBus - bus = SystemBus() - proxy = bus.get('org.freedesktop.NetworkManager', - '/org/freedesktop/NetworkManager/Devices/0') - -pydbus has implemented shortcuts for the most common cases. If you -start the bus name with "." (".NetworkManager"), "org.freedesktop" will -become automatically prepended. If you specify a relative object path -(without the leading "/"), the bus name transformed to a path format -will get prepended ("/org/freedesktop/NetworkManager/"). If you don't -specify the object path at all, the transformed bus name will be used -automatically ("/org/freedesktop/NetworkManager"). Therefore, you may -rewrite the above code as:: - - from pydbus import SystemBus - bus = SystemBus() - dev = bus.get('.NetworkManager', 'Devices/0') - -Object API ------------ - -To see the API of a specific proxy object, use help():: - - help(dev) - -To call a method:: - - dev.Disconnect() - -To read a property:: - - print(dev.Autoconnect) - -To set a property:: - - dev.Autoconnect = True - -.. _signal.connect: - -To subscribe to a signal:: - - dev.StateChanged.connect(print) - loop.run() - -connect() returns a Subscription object with a disconnect() method, that can be used to stop watching the signal. Also, it can be used as a context manager (with the ''with'' statement), to automatically disconnect at the end of the scope. - -.. _onSignal: - -Alternatively, you can set the on`Signal` property:: - - dev.onStateChanged = print - loop.run() - -This way, you can unsubscribe from the signal by setting the property to None. - -However, don't mix subscriptions in one of those ways with unsubscribtions -in another, it won't work. - -See also -~~~~~~~~ - -See the examples in ``examples/systemctl.py`` and ``tests/gnome_music.py``. - -Interfaces ----------- -D-Bus uses *interfaces* to provide a namespacing mechanism for methods, -signals and properties. An interface is a group of related methods, signals -and properties, identified by a name which is a series of dot-separated components -starting with a reversed domain name. For instance, each NetworkManager_ -object representing a network interface implements the interface -``org.freedesktop.NetworkManager.Device``, which has methods like -``Disconnect``. - -An object may have multiple interfaces. They may be incompatible, for example -when using some sort of API versioning. By default, pydbus merges all the -interfaces to offer a single proxy object's API, but it's possible to obtain -a view providing only a single interface:: - - dev = bus.get('.NetworkManager', 'Devices/0') - dev_api = dev['org.freedesktop.NetworkManager.Device'] - -You may use all of the proxy object members described in the previous chapter -on the dev_api too. - -.. _bus.subscribe: - -Signal matching ---------------- - -You may also match the signals using a pattern. -See ``help(bus.subscribe)`` for more details. - -.. -------------------------------------------------------------------- - -Exporting own objects -===================== - -Objects made available to other applications over D-Bus are said to be -*exported*. - -To export objects, the Bus needs to be connected to an event loop - see -section `Setting up an event loop`_. Exported methods will only be called, -and queued signals will only be sent, while the event loop is running. - -Class preparation ------------------ - -To prepare a class for exporting on the Bus, provide the dbus introspection XML -in a ''dbus'' class property or in its ''docstring''. For example:: - - from pydbus.generic import signal - - class Example(object): - """ - - - - - - - - - - - - """ - - def EchoString(self, s): - """returns whatever is passed to it""" - return s - - def __init__(self): - self._someProperty = "initial value" - - @property - def SomeProperty(self): - return self._someProperty - - @SomeProperty.setter - def SomeProperty(self, value): - self._someProperty = value - self.PropertiesChanged("net.lew21.pydbus.TutorialExample", {"SomeProperty": self.SomeProperty}, []) - - PropertiesChanged = signal() - -If you don't want to put XML in a Python file, you can add XML files to your Python package and use them this way:: - - import pkg_resources - - ifaces = ["org.mpris.MediaPlayer2", "org.mpris.MediaPlayer2.Player", "org.mpris.MediaPlayer2.Playlists", "org.mpris.MediaPlayer2.TrackList"] - MediaPlayer2.dbus = [pkg_resources.resource_string(__name__, "mpris/" + iface + ".xml").decode("utf-8") for iface in ifaces] - - -.. _bus.publish: - -Object publication ------------------- - -To publish an object, use the ``bus.publish`` method:: - - bus.publish("net.lew21.pydbus.TutorialExample", Example()) - loop.run() - -Here, publish() both binds the service to the net.lew21.pydbus.TutorialExample -bus name, and exports the object as /net/lew21/pydbus/TutorialExample. - -Note, that you can use the publish() method only once per a bus name -that you want to bind. However, you can use it to export multiple objects -- by passing them in additional parameters to the method:: - - bus.publish("net.lew21.pydbus.TutorialExample", - Example(), - ("Subdir1", Example()), - ("Subdir2", Example()), - ("Subdir2/Whatever", Example()) - ) - loop.run() - -The 2nd, 3rd, ... arguments can be objects or tuples of a path and a object. -``bus.publish()`` uses the same path-deducing (and bus-name-deducing) logic that's -used in ``bus.get()``, so you may use relative paths or absolute paths, depending -on your needs. - -Like ``signal.connect()``, ``bus.publish()`` returns an object with an ``unpublish()`` -method, that can be used as a context manager. - -See also -~~~~~~~~ - -See the example in ``examples/clientserver/server.py``. - -.. _bus.request_name: -.. _bus.register_object: - -Lower level API ---------------- - -Sometimes, you can't just publish everything in one call, you need more control -over the process of binding a name and exporting single objects. - -In this case, you can use ``bus.request_name()`` and ``bus.register_object()`` yourself. -See ``help(bus.request_name)`` and ``help(bus.register_object)`` for details. - -.. -------------------------------------------------------------------- - -Data types -========== - -Unlike Python, D-Bus is statically typed. Each method and signal takes arguments of predefined types; each method returns value(s) of predefined types; and each property has a predefined type. You can't dynamically change those types. - -D-Bus has an introspection mechanism, which ``pydbus`` uses to discover -the correct argument types. Python types are converted into the right -D-Bus data types automatically, if possible; ``TypeError`` is raised -if the type is inappropriate. - -Container types ---------------- - -D-Bus supports four container types: array (a variable-length sequence of the -same type), struct (a fixed-length sequence whose members may have -different types), dictionary (a mapping from values of the same basic type to -values of the same type), and variant (a container which may hold any -D-Bus type, including another variant). - -Arrays are represented by Python lists. The signature of an array is 'ax' -where 'x' represents the signature of one item. For instance, you could -also have 'as' (array of strings) or 'a(ii)' (array of structs each -containing two 32-bit integers). - -Structs are represented by Python tuples. The signature of a struct -consists of the signatures of the contents, in parentheses - for instance -'(is)' is the signature of a struct containing a 32-bit integer and a string. - -Dictionaries are represented by Python dictionaries. -The signature of a dictionary is 'a{xy}' where 'x' represents the -signature of the keys (which may not be a container type) and 'y' -represents the signature of the values. For instance, -'a{s(ii)}' is a dictionary where the keys are strings and the values are -structs containing two 32-bit integers. - -Return values -------------- - -If a D-Bus method returns no value, the Python proxy method will return ``None``. - -If a D-Bus method returns a single value, it will be returned directly. - -Otherwise, Python proxy method will return a tuple containing all the values. - -.. -------------------------------------------------------------------- - -License for this document -========================= - -Copyright 2006-2007 `Collabora Ltd.`_ - -Copyright 2016 `Linus Lewandowski`_ - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, copy, -modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -.. - vim:set ft=rst sw=4 sts=4 et tw=72: diff -Nru pydbus-0.6.0/examples/clientserver/client.py pydbus-0.6.0.1/examples/clientserver/client.py --- pydbus-0.6.0/examples/clientserver/client.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/examples/clientserver/client.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -#!/usr/bin/env python - -# Based on http://stackoverflow.com/questions/22390064/use-dbus-to-just-send-a-message-in-python - -# Python script to call the methods of the DBUS Test Server - -from pydbus import SessionBus - -#get the session bus -bus = SessionBus() -#get the object -the_object = bus.get("net.lew21.pydbus.ClientServerExample") - -#call the methods and print the results -reply = the_object.Hello() -print(reply) - -reply = the_object.EchoString("test 123") -print(reply) - -the_object.Quit() diff -Nru pydbus-0.6.0/examples/clientserver/server.py pydbus-0.6.0.1/examples/clientserver/server.py --- pydbus-0.6.0/examples/clientserver/server.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/examples/clientserver/server.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -# Based on http://stackoverflow.com/questions/22390064/use-dbus-to-just-send-a-message-in-python - -# Python DBUS Test Server -# runs until the Quit() method is called via DBUS - -from gi.repository import GLib -from pydbus import SessionBus - -loop = GLib.MainLoop() - -class MyDBUSService(object): - """ - - - - - - - - - - - - - """ - - def Hello(self): - """returns the string 'Hello, World!'""" - return "Hello, World!" - - def EchoString(self, s): - """returns whatever is passed to it""" - return s - - def Quit(self): - """removes this object from the DBUS connection and exits""" - loop.quit() - -bus = SessionBus() -bus.publish("net.lew21.pydbus.ClientServerExample", MyDBUSService()) -loop.run() diff -Nru pydbus-0.6.0/examples/notifications_server.py pydbus-0.6.0.1/examples/notifications_server.py --- pydbus-0.6.0/examples/notifications_server.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/examples/notifications_server.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -from gi.repository import GLib -from pydbus import SessionBus -from pydbus.generic import signal - -class Notifications(object): - """ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - """ - - NotificationClosed = signal() - ActionInvoked = signal() - - def Notify(self, app_name, replaces_id, app_icon, summary, body, actions, hints, timeout): - print("Notification: {} {} {} {} {} {} {} {}".format(app_name, replaces_id, app_icon, summary, body, actions, hints, timeout)) - return 4 # chosen by fair dice roll. guaranteed to be random. - - def CloseNotification(self, id): - pass - - def GetCapabilities(self): - return [] - - def GetServerInformation(self): - return ("pydbus.examples.notifications_server", "pydbus", "?", "1.1") - -bus = SessionBus() -bus.publish("org.freedesktop.Notifications", Notifications()) -loop = GLib.MainLoop() -loop.run() diff -Nru pydbus-0.6.0/examples/polkit/dbus.conf pydbus-0.6.0.1/examples/polkit/dbus.conf --- pydbus-0.6.0/examples/polkit/dbus.conf 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/examples/polkit/dbus.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff -Nru pydbus-0.6.0/examples/polkit/service.py pydbus-0.6.0.1/examples/polkit/service.py --- pydbus-0.6.0/examples/polkit/service.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/examples/polkit/service.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -from pydbus import SystemBus -from gi.repository import GLib -import logging - -loop = GLib.MainLoop() - -class TestObject(object): - dbus = ''' - - - - - - - - - ''' - def TestAuth(self, interactive, dbus_context): - if dbus_context.is_authorized('org.freedesktop.policykit.exec', {'polkit.icon': 'abcd', 'aaaa': 'zzzz'}, interactive=interactive): - return "OK" - else: - return "Forbidden" - -with SystemBus() as bus: - with bus.publish("net.lew21.pydbus.PolkitExample", TestObject()): - logging.info("Started.") - loop.run() diff -Nru pydbus-0.6.0/examples/systemctl.py pydbus-0.6.0.1/examples/systemctl.py --- pydbus-0.6.0/examples/systemctl.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/examples/systemctl.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -from pydbus import SystemBus - -bus = SystemBus() - -systemd = bus.get(".systemd1") -#systemd = bus.get("org.freedesktop.systemd1") - -manager = systemd[".Manager"] -#manager = systemd["org.freedesktop.systemd1.Manager"] -#manager = systemd # works but may break if systemd adds another interface - -import sys - -try: - if len(sys.argv) < 2: - for unit in manager.ListUnits(): - print(unit) - else: - if sys.argv[1] == "--help": - help(manager) - else: - command = sys.argv[1] - command = "".join(x.capitalize() for x in command.split("-")) - result = getattr(manager, command)(*sys.argv[2:]) - - for var in result: - if type(var) == list: - for line in var: - print(line) - else: - print(var) -except Exception as e: - print(e) - -""" -Examples: - -python -m pydbus.examples.systemctl -sudo python -m pydbus.examples.systemctl start-unit cups.service replace -""" diff -Nru pydbus-0.6.0/.gitignore pydbus-0.6.0.1/.gitignore --- pydbus-0.6.0/.gitignore 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -bin/ -build/ -develop-eggs/ -dist/ -eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.cache -nosetests.xml -coverage.xml - -# Translations -*.mo - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# Rope -.ropeproject - -# Django stuff: -*.log -*.pot - -# Sphinx documentation -docs/_build/ diff -Nru pydbus-0.6.0/README.rst pydbus-0.6.0.1/README.rst --- pydbus-0.6.0/README.rst 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/README.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -pydbus -====== -.. image:: https://travis-ci.org/LEW21/pydbus.svg?branch=master - :target: https://travis-ci.org/LEW21/pydbus -.. image:: https://badge.fury.io/py/pydbus.svg - :target: https://badge.fury.io/py/pydbus - -Pythonic DBus library. - -Changelog: https://github.com/LEW21/pydbus/releases - -Requirements ------------- -* Python 2.7+ - but works best on 3.4+ (help system is nicer there) -* PyGI_ (not packaged on pypi, you need to install it from your distribution's repository - it's usually called python-gi, python-gobject or pygobject) -* GLib_ 2.46+ and girepository_ 1.46+ (Ubuntu 16.04+) - for object publication support - -.. _PyGI: https://wiki.gnome.org/Projects/PyGObject -.. _GLib: https://developer.gnome.org/glib/ -.. _girepository: https://wiki.gnome.org/Projects/GObjectIntrospection - -Examples --------- - -Send a desktop notification -~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. code-block:: python - - from pydbus import SessionBus - - bus = SessionBus() - notifications = bus.get('.Notifications') - - notifications.Notify('test', 0, 'dialog-information', "Hello World!", "pydbus works :)", [], {}, 5000) - -List systemd units -~~~~~~~~~~~~~~~~~~ -.. code-block:: python - - from pydbus import SystemBus - - bus = SystemBus() - systemd = bus.get(".systemd1") - - for unit in systemd.ListUnits(): - print(unit) - -Start or stop systemd unit -~~~~~~~~~~~~~~~~~~ -.. code-block:: python - - from pydbus import SystemBus - - bus = SystemBus() - systemd = bus.get(".systemd1") - - job1 = systemd.StopUnit("ssh.service", "fail") - job2 = systemd.StartUnit("ssh.service", "fail") - -Watch for new systemd jobs -~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. code-block:: python - - from pydbus import SystemBus - from gi.repository import GLib - - bus = SystemBus() - systemd = bus.get(".systemd1") - - systemd.JobNew.connect(print) - GLib.MainLoop().run() - - # or - - systemd.onJobNew = print - GLib.MainLoop().run() - -View object's API -~~~~~~~~~~~~~~~~~ -.. code-block:: python - - from pydbus import SessionBus - - bus = SessionBus() - notifications = bus.get('.Notifications') - - help(notifications) - -More examples & documentation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The Tutorial_ contains more examples and docs. - -.. _Tutorial: https://github.com/LEW21/pydbus/blob/master/doc/tutorial.rst - -Copyright Information ---------------------- - -Copyright (C) 2014, 2015, 2016 Linus Lewandowski - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA diff -Nru pydbus-0.6.0/setup.py pydbus-0.6.0.1/setup.py --- pydbus-0.6.0/setup.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/setup.py 2017-02-24 17:53:49.000000000 +0000 @@ -2,14 +2,10 @@ from setuptools import setup -with open('README.rst') as f: - readme = f.read() - setup( name = "pydbus", version = "0.6.0", description = "Pythonic DBus library", - long_description = readme, author = "Linus Lewandowski", author_email = "linus@lew21.net", url = "https://github.com/LEW21/pydbus", @@ -26,10 +22,6 @@ 'Natural Language :: English', 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)', 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7' ] diff -Nru pydbus-0.6.0/tests/context.py pydbus-0.6.0.1/tests/context.py --- pydbus-0.6.0/tests/context.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/context.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -from pydbus import SessionBus, connect -import os - -DBUS_SESSION_BUS_ADDRESS = os.getenv("DBUS_SESSION_BUS_ADDRESS") - -with connect(DBUS_SESSION_BUS_ADDRESS) as bus: - bus.dbus - -del bus._dbus -try: - bus.dbus - assert(False) -except RuntimeError: - pass - -with SessionBus() as bus: - pass - -# SessionBus() and SystemBus() are not closed automatically, so this should work: -bus.dbus - -with bus.request_name("net.lew21.Test"): - pass - -with bus.request_name("net.lew21.Test"): - pass - -with bus.request_name("net.lew21.Test"): - try: - bus.request_name("net.lew21.Test") - assert(False) - except RuntimeError: - pass - -with bus.watch_name("net.lew21.Test"): - pass - -with bus.subscribe(sender="net.lew21.Test"): - pass diff -Nru pydbus-0.6.0/tests/gnome_music.py pydbus-0.6.0.1/tests/gnome_music.py --- pydbus-0.6.0/tests/gnome_music.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/gnome_music.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -from __future__ import print_function -from pydbus import SessionBus -from gi.repository import GLib -import subprocess -from time import sleep - -loop = GLib.MainLoop() - -subprocess.Popen("gnome-music") -sleep(5) -print("Waiting for GNOME Music to start...") - -b = SessionBus() -m = b.get("org.mpris.MediaPlayer2.GnomeMusic", "/org/mpris/MediaPlayer2") - -m.PropertiesChanged.connect(print) - -m.ActivatePlaylist(m.GetPlaylists(0, 5, "Alphabetical", 0)[0][0]) - -m.Play() -sleep(1) -assert(m.PlaybackStatus == "Playing") - -m.Pause() -assert(m.PlaybackStatus == "Paused") - -m.Play() -assert(m.PlaybackStatus == "Playing") - -t = m.Metadata["xesam:title"] - -m.Next() - -assert(m.Metadata["xesam:title"] != t) - -m.Previous() - -assert(m.Metadata["xesam:title"] == t) - -oldLoopStatus = m.LoopStatus - -m.LoopStatus = "None" -assert(m.LoopStatus == "None") - -m.LoopStatus = "Track" -assert(m.LoopStatus == "Track") - -m.LoopStatus = oldLoopStatus - -GLib.timeout_add_seconds(2, lambda: loop.quit()) -loop.run() diff -Nru pydbus-0.6.0/tests/identifier.py pydbus-0.6.0.1/tests/identifier.py --- pydbus-0.6.0/tests/identifier.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/identifier.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -from __future__ import print_function -from pydbus.identifier import filter_identifier -import sys - -tests = [ - ("abc", "abc"), - ("a_bC", "a_bC"), - ("a-b_c", "a_b_c"), - ("a@bc", "abc"), - ("!@#$%^&*", ""), -] - -ret = 0 -for input, output in tests: - if not filter_identifier(input) == output: - print("ERROR: filter(" + input + ") returned: " + filter_identifier(input), file=sys.stderr) - ret = 1 - -sys.exit(ret) diff -Nru pydbus-0.6.0/tests/__init__.py pydbus-0.6.0.1/tests/__init__.py --- pydbus-0.6.0/tests/__init__.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ - diff -Nru pydbus-0.6.0/tests/publish_multiface.py pydbus-0.6.0.1/tests/publish_multiface.py --- pydbus-0.6.0/tests/publish_multiface.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/publish_multiface.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -from pydbus import SessionBus -from gi.repository import GLib -from threading import Thread -import sys - -done = 0 -loop = GLib.MainLoop() - -class TestObject(object): - ''' - - - - - - - - - - - - - ''' - def Method1(self): - global done - done += 1 - if done == 2: - loop.quit() - return "M1" - - def Method2(self): - global done - done += 1 - if done == 2: - loop.quit() - return "M2" - -bus = SessionBus() - -with bus.publish("net.lew21.pydbus.tests.expose_multiface", TestObject()): - remote = bus.get("net.lew21.pydbus.tests.expose_multiface") - - def t1_func(): - print(remote.Method1()) - print(remote.Method2()) - - t1 = Thread(None, t1_func) - t1.daemon = True - - def handle_timeout(): - print("ERROR: Timeout.") - sys.exit(1) - - GLib.timeout_add_seconds(2, handle_timeout) - - t1.start() - - loop.run() - - t1.join() diff -Nru pydbus-0.6.0/tests/publish_properties.py pydbus-0.6.0.1/tests/publish_properties.py --- pydbus-0.6.0/tests/publish_properties.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/publish_properties.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -from pydbus import SessionBus, Variant -from gi.repository import GLib -from threading import Thread -import sys - -done = 0 -loop = GLib.MainLoop() - -class TestObject(object): - ''' - - - - - - - - - ''' - def __init__(self): - self.Foo = "foo" - self.Foobar = "foobar" - - def Quit(self): - loop.quit() - -bus = SessionBus() - -with bus.publish("net.lew21.pydbus.tests.publish_properties", TestObject()): - remote = bus.get("net.lew21.pydbus.tests.publish_properties") - remote_iface = remote['net.lew21.pydbus.tests.publish_properties'] - - def t1_func(): - for obj in [remote, remote_iface]: - assert(obj.Foo == "foo") - assert(obj.Foobar == "foobar") - obj.Foobar = "barfoo" - assert(obj.Foobar == "barfoo") - obj.Foobar = "foobar" - assert(obj.Foobar == "foobar") - obj.Bar = "rab" - - remote.Foobar = "barfoo" - - try: - remote.Get("net.lew21.pydbus.tests.publish_properties", "Bar") - assert(False) - except GLib.GError: - pass - try: - remote.Set("net.lew21.pydbus.tests.publish_properties", "Foo", Variant("s", "haxor")) - assert(False) - except GLib.GError: - pass - assert(remote.GetAll("net.lew21.pydbus.tests.publish_properties") == {'Foobar': 'barfoo', 'Foo': 'foo'}) - remote.Quit() - - t1 = Thread(None, t1_func) - t1.daemon = True - - def handle_timeout(): - print("ERROR: Timeout.") - sys.exit(1) - - GLib.timeout_add_seconds(2, handle_timeout) - - t1.start() - - loop.run() - - t1.join() diff -Nru pydbus-0.6.0/tests/publish.py pydbus-0.6.0.1/tests/publish.py --- pydbus-0.6.0/tests/publish.py 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/publish.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -from pydbus import SessionBus -from gi.repository import GLib -from threading import Thread -import sys - -done = 0 -loop = GLib.MainLoop() - -class TestObject(object): - ''' - - - - - - - - - - ''' - def __init__(self, id): - self.id = id - - def HelloWorld(self, a, b): - res = self.id + ": " + a + str(b) - global done - done += 1 - if done == 2: - loop.quit() - print(res) - return res - -bus = SessionBus() - -with bus.publish("net.lew21.pydbus.Test", TestObject("Main"), ("Lol", TestObject("Lol"))): - remoteMain = bus.get("net.lew21.pydbus.Test") - remoteLol = bus.get("net.lew21.pydbus.Test", "Lol") - - def t1_func(): - print(remoteMain.HelloWorld("t", 1)) - - def t2_func(): - print(remoteLol.HelloWorld("t", 2)) - - t1 = Thread(None, t1_func) - t2 = Thread(None, t2_func) - t1.daemon = True - t2.daemon = True - - def handle_timeout(): - print("ERROR: Timeout.") - sys.exit(1) - - GLib.timeout_add_seconds(2, handle_timeout) - - t1.start() - t2.start() - - loop.run() - - t1.join() - t2.join() diff -Nru pydbus-0.6.0/tests/py2.7-ubuntu-14.04.dockerfile pydbus-0.6.0.1/tests/py2.7-ubuntu-14.04.dockerfile --- pydbus-0.6.0/tests/py2.7-ubuntu-14.04.dockerfile 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/py2.7-ubuntu-14.04.dockerfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -FROM ubuntu:14.04 -RUN apt-get update - -RUN apt-get install -y dbus python-gi python-pip psmisc python-dev dbus-x11 -RUN python2 --version -RUN pip2 install greenlet - -ADD . /root/ -RUN cd /root && python2 setup.py install - -RUN /root/tests/run.sh python2 dontpublish diff -Nru pydbus-0.6.0/tests/py2.7-ubuntu-16.04.dockerfile pydbus-0.6.0.1/tests/py2.7-ubuntu-16.04.dockerfile --- pydbus-0.6.0/tests/py2.7-ubuntu-16.04.dockerfile 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/py2.7-ubuntu-16.04.dockerfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -FROM ubuntu:16.04 -RUN apt-get update - -RUN apt-get install -y dbus python-gi python-pip psmisc dbus-x11 -RUN python2 --version -RUN pip2 install greenlet - -ADD . /root/ -RUN cd /root && python2 setup.py install - -RUN /root/tests/run.sh python2 diff -Nru pydbus-0.6.0/tests/py3.4-ubuntu-14.04.dockerfile pydbus-0.6.0.1/tests/py3.4-ubuntu-14.04.dockerfile --- pydbus-0.6.0/tests/py3.4-ubuntu-14.04.dockerfile 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/py3.4-ubuntu-14.04.dockerfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -FROM ubuntu:14.04 -RUN apt-get update - -RUN apt-get install -y dbus python3-gi python3-pip psmisc python3-dev dbus-x11 -RUN python3 --version -RUN pip3 install greenlet - -ADD . /root/ -RUN cd /root && python3 setup.py install - -RUN /root/tests/run.sh python3 dontpublish diff -Nru pydbus-0.6.0/tests/py3.5-ubuntu-16.04.dockerfile pydbus-0.6.0.1/tests/py3.5-ubuntu-16.04.dockerfile --- pydbus-0.6.0/tests/py3.5-ubuntu-16.04.dockerfile 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/py3.5-ubuntu-16.04.dockerfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -FROM ubuntu:16.04 -RUN apt-get update - -RUN apt-get install -y dbus python3-gi python3-pip psmisc dbus-x11 -RUN python3 --version -RUN pip3 install greenlet - -ADD . /root/ -RUN cd /root && python3 setup.py install - -RUN /root/tests/run.sh python3 diff -Nru pydbus-0.6.0/tests/run.sh pydbus-0.6.0.1/tests/run.sh --- pydbus-0.6.0/tests/run.sh 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/tests/run.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -#!/bin/sh -set -e - -TESTS_DIR=$(dirname "$0") -eval `dbus-launch --sh-syntax` - -trap 'kill -TERM $DBUS_SESSION_BUS_PID' EXIT - -PYTHON=${1:-python} - -"$PYTHON" $TESTS_DIR/context.py -"$PYTHON" $TESTS_DIR/identifier.py -if [ "$2" != "dontpublish" ] -then - "$PYTHON" $TESTS_DIR/publish.py - "$PYTHON" $TESTS_DIR/publish_properties.py - "$PYTHON" $TESTS_DIR/publish_multiface.py -fi diff -Nru pydbus-0.6.0/.travis.yml pydbus-0.6.0.1/.travis.yml --- pydbus-0.6.0/.travis.yml 2016-12-18 16:27:02.000000000 +0000 +++ pydbus-0.6.0.1/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -sudo: required - -env: - - distribution: ubuntu - version: 16.04 - python: 3.5 - - distribution: ubuntu - version: 16.04 - python: 2.7 - - distribution: ubuntu - version: 14.04 - python: 3.4 - - distribution: ubuntu - version: 14.04 - python: 2.7 - -services: - - docker - -before_install: - - "docker pull ${distribution}:${version}" - -script: - - "docker build --file=tests/py${python}-${distribution}-${version}.dockerfile ."