1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-05 18:45:01 +01:00
Files
atomic/atomic_client.py
Cleber Rosa 54e0023f47 Imports: general reorganization
As per PEP8[1], there are basically three distinct groups of modules:

 1) standard library imports
 2) related third party imports
 3) local application/library specific imports

With that classification, we can give a general and consistent order
to the module imports.

The use of relative imports (the "dot" notation) for local modules
is indeed a matter of taste, but backed by PEP-0328[1] and already
used on Atomic/__init__.py.

[1] - https://www.python.org/dev/peps/pep-0008/#imports
[2] - https://www.python.org/dev/peps/pep-0328/

Signed-off-by: Cleber Rosa <crosa@redhat.com>
2015-11-19 19:47:42 -02:00

36 lines
966 B
Python

import sys
import dbus
import dbus.service
import dbus.mainloop.glib
from slip.dbus import polkit
class AtomicDBus (object):
def __init__(self):
self.bus = dbus.SystemBus()
self.dbus_object = self.bus.get_object("org.atomic",
"/org/atomic/object")
@polkit.enable_proxy
def version(self, image, recurse):
ret = self.dbus_object.version(image, recurse,
dbus_interface="org.atomic")
return ret
@polkit.enable_proxy
def verify(self, image):
ret = self.dbus_object.verify(image, dbus_interface="org.atomic")
return ret
if __name__ == "__main__":
try:
dbus_proxy = AtomicDBus()
resp = dbus_proxy.version(sys.argv[1:], True)
for r in resp:
for v in r["Version"]:
print(v["Id"], v["Version"], v["Tag"])
except dbus.DBusException as e:
print (e)