Mini Shell

Direktori : /proc/self/root/lib64/python3.6/site-packages/pyanaconda/__pycache__/
Upload File :
Current File : //proc/self/root/lib64/python3.6/site-packages/pyanaconda/__pycache__/safe_dbus.cpython-36.pyc

3

C��e��@sxdZddlZejdd�ddlmZddlZddlmZddlm	Z	Gdd	�d	e
�ZGd
d�de�Zdd
�Z
dd�ZdS)z?Module providing thread-safe and mainloop-safe DBus operations.�N�Gioz2.0)r)�GError)�DEFAULT_DBUS_TIMEOUTc@seZdZdZdS)�
SafeDBusErrorz,Class for exceptions defined in this module.N)�__name__�
__module__�__qualname__�__doc__�r
r
�!/usr/lib64/python3.6/safe_dbus.pyrsrc@seZdZdZdS)�
DBusCallErrorz:Class for the errors related to calling methods over DBus.N)rrrr	r
r
r
rr%srcCs�d}dtjkr*tj�}tjttjd��zdy.tjjtjtj	j
d�tjjtjj
Bdd�}Wn0tk
r�}ztdj|���WYdd}~XnXWd|dk	r�tj|�X|j�r�td��|S)a�
    Get a connection handle for the per-user-login-session message bus.

    !!! RUN THIS EARLY !!! like, before any other threads start. Connections to
    the session bus must be made with the effective UID of the login user,
    which in live installs is not the UID of anaconda. This means we need to
    call seteuid in this method, and doing that after threads have started will
    probably do something weird.

    Live installs use consolehelper to run as root, which sets the original
    UID in $USERHELPER_UID.

    :return: the session connection handle
    :rtype: Gio.DBusConnection
    :raise DBusCallError: if some DBus related error appears
    :raise OSError: if unable to set the effective UID
    NZUSERHELPER_UIDz$Unable to connect to session bus: {}zConnection is closed)�os�environ�geteuid�seteuid�intrZDBusConnectionZnew_for_address_syncZdbus_address_get_for_bus_syncZBusTypeZSESSIONZDBusConnectionFlagsZAUTHENTICATION_CLIENTZMESSAGE_BUS_CONNECTIONrr�format�	is_closed)Zold_euid�
connection�gerrr
r
r�get_new_session_connection+s"
$rc	Cs�|j�rtd��y"|j|||||dtjjtd�	}Wn>tk
rp}z"d|||t|�f}t|��WYdd}~XnX|dkr�d|||f}t|��|j	�S)av
    Safely call a given method on a given object of a given service over DBus
    passing given arguments. If a connection is given, it is used, otherwise a
    new connection is established. Safely means that it is a synchronous,
    thread-safe call not using any main loop.

    :param service: DBus service to use
    :type service: str
    :param obj_path: object path of the object to call method on
    :type obj_path: str
    :param iface: interface to use
    :type iface: str
    :param method: name of the method to call
    :type method: str
    :param args: arguments to pass to the method
    :type args: GVariant
    :param connection: connection to use
    :type connection: Gio.DBusConnection
    :return: unpacked value returned by the method
    :rtype: tuple with elements that depend on the method
    :raise DBusCallError: if some DBus related error appears

    zConnection is closedNz4Failed to call %s method on %s with %s arguments: %sz0No return from %s method on %s with %s arguments)
rr�	call_syncrZ
DBusCallFlagsZNONErr�str�unpack)	ZserviceZobj_pathZiface�method�argsr�retr�msgr
r
rrUsr)r	ZgiZrequire_versionZ
gi.repositoryrr
Zpyanaconda.core.glibrZpyanaconda.core.constantsr�	Exceptionrrrrr
r
r
r�<module>s*