%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/aptdaemon/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/aptdaemon/__pycache__/client.cpython-312.pyc

�

��kd_%��J�dZddlZddlZddlZddlZddlZddlZddlZejjjd��ddlm
Z
mZddlmZddlmZddlZdd	lmZdd
lmZmZdZdZGd
�de
j4�ZGd�de�Zeedd���Zd�Zdd�Z y)z�
The module provides a client to the PackageKit DBus interface. It allows to
perform basic package manipulation tasks in a cross distribution way, e.g.
to search for packages, install packages or codecs.
�NT)�set_as_default)�GObject�GLib�)�enums)�debconf)�	deferable)�convert_dbus_exception�TransactionFailed)�AptTransaction�	AptClient�get_transaction�
get_aptdaemoni�Qc
�@
�eZdZdZidej
jejejff�dej
jejejejejejejejejff�dej
jejejff�dej
jejejff�dej
jejejejff�dej
jejejff�dej
jejejff�d	ej
jejejff�d
ej
jejejff�dej
jejejff�dej
jejejff�d
ej
jejejff�dej
jejejejejejejejff�dej
jejejejejejejejff�dej
jejejejejejejejff�dej
jejejff�dej
jejdf�ej
jejdfej
jejejffej
jejejffej
jejejffej
jejejffej
jejejffej
jejejffej
jejejejffej
jejejejffd�	�Z
ej�Zd�Zd*d�Zd�Zd�Zd�Zeed+d���Zeed+d���Zeed+d���Zeed+d���Zeed+d���Zeed+d ���Zee	d+d!���Zee	d+d"���Zee		d+d#���Z eed$���Z!eed+d%���Z"d&�Z#eed+d'���Z$eed+d(���Z%ee		d+d)���Z&y),ra�-Represents an aptdaemon transaction.

    .. note:: This class cannot be inherited since it makes use of
              a metaclass.

    .. signal:: allow-unauthenticated -> allow

        The signal is emitted when :attr:`allow_unauthenticated` changed.

        :param allow: If unauthenticated packages are allowed to be installed.

    .. signal:: cancellable-changed -> cancellable

        The signal is emitted when :attr:`cancellable` changed.

        :param cancellable: If the transaction can be cancelled now.

    .. signal:: config-file-conflict -> cur, new

        The signal is emitted when :attr:`config_file_conflict` changed.

        :param cur: The path to the current configuration file.
        :param new: The path to the new configuration file.

    .. signal:: debconf-socket-changed -> path

        The signal is emitted when :attr:`debconf_socket` changed.

        :param path: The path to the socket which will be used to forward
            debconf communication to the user session.

    .. signal:: dependencies-changed -> installs, re-installs, removals,                                         purges, upgrades, downgrades, kepts

        The signal is emitted when :attr:`dependencies` changed.

        Most likely after :meth:`simulate()` was called.

        :param installs: List of package which will be installed.
        :param reinstalls: List of package which will be re-installed.
        :param removals: List of package which will be removed,
        :param purges: List of package which will be removed including
            configuration files.
        :param upgrades: List of package which will be upgraded.
        :param downgrades: List of package which will be downgraded to an older
            version.
        :param kepts: List of package which will be skipped from upgrading.

    .. signal:: download-changed -> download

        The signal is emitted when :attr:`download` changed.

        :param download: Download size integer in Bytes.

    .. signal:: error -> error_code, error_details

        The signal is emitted when an error occured.

        :param error_code: The error code enumeration, e.g.
             :data:`aptdaemon.enums.ERROR_NO_CACHE`.
        :param error_details: The error description string.

    .. signal:: finished -> exit_state

        The signal is emitted when the transaction is completed or has
        failed.

        :param exit_state: The exit status enumeration string.

    .. signal:: http-proxy-changed -> uri

        The signal is emitted when :attr:`http_proxy` changed.

        :param uri: The URI of the proxy server, e.g. "http://proxy:8080".

    .. signal:: locale-changed -> locale

        The signal is emitted when :attr:`locale` changed.

        :param locale: The language which should be used for messages,
            eg. "de_DE".

    .. signal:: meta-data-changed -> meta_data

        The signal is emitted when :attr:`meta_data` changed.

        :param meta_data: The latest meta data dictionary.

    .. signal:: medium-required -> name, device

        The signal is emitted when :attr:`required_medium` changed.

        :param name: The name of the volume.
        :param device: The path of the device in which the volume should
            be inserted.

    .. signal:: remove-obsoleted-depends-changed -> remove

        The signal is emitted when :attr:`remove_obsoleted_depends` changed.

        :param remove: If obsolete dependencies should also be removed.

    .. signal:: role-changed -> role

        The signal is emitted when :attr:`role` changed.

        :param role: The new role enum, e.g.
            :data:`~aptdaemon.enums.ROLE_UPDATE_CACHE`.

    .. signal:: space-changed -> space

        The signal is emitted when :attr:`space` changed.
        Most likely after :meth:`simulate()` was called.

        :param space: Required disk space integer in Bytes. Can be negative
            if disk space will be freed.

    .. signal:: packages-changed -> installs, re-installs, removals,                                     purges, upgrades, downgrades

        The signal is emitted when :attr:`packages` changed.

        :param installs: List of package which will be installed.
        :param reinstalls: List of package which will be re-installed.
        :param removals: List of package which will be removed,
        :param purges: List of package which will be removed including
            configuration files.
        :param upgrades: List of package which will be upgraded.
        :param downgrades: List of package which will be downgraded to an older
            version.

    .. signal:: paused

        The signal is emitted when the transaction was paused.
        See :attr:`paused` and :sig:`resumed`.

    .. signal:: progress-changed -> progress

        The signal is emitted when :attr:`progress` changed.

        :param progress: The progress integer.

    .. signal:: progress-details-changed -> current_items, total_items,                                             currenty_bytes, total_bytes,                                             current_cps, eta

        The signal is emitted when detailed information of the progress
        is available.

        :param current_items: The number of already processed items.
        :param total_items: The number of all items.
        :param current_bytes: The number of already downloaded byte.
        :param total_bytes: The number of bytes which have to be downloaded
            totally.
        :param current_cps: The current download speed in bytes per second.
        :param eta: The elapsed time in seconds to accomplish the task.

    .. signal:: progress-download-changed -> uri, short_desc, total_size,                                              current_size, msg

        The signal is emitted when progress information about a single
        download is available.

        :param uri: The URI of the file which is downloaded.
        :param status: The status of the downloade, e.g.
            :data:`~aptdaemon.enums.DOWNLOAD_AUTH_FAILED`.
        :param short_desc: A short description of the file.
        :param total_size: The size of the file in Bytes.
        :param current_size: How much of the file in Bytes has already be
            downloaded.
        :param msg: The status or error description.

    .. signal:: resumed

        The signal is emitted when a paused transaction was resumed.
        See :attr:`paused` and :sig:`paused`.

    .. signal:: terminal-changed -> path

        The signal is emitted when :attr:`terminal` changed.

        :param path: The path to the slave end of the controlling terminal
            for the underlying dpkg call.

    .. signal:: terminal-attached-changed -> attached

        The signal is emitted when :attr:`term_attached` changed.

        :param attached: If the controlling terminal can be used.

    .. signal:: unauthenticated-changed -> unauthenticated

        The signal is emitted when :attr:`unauthenticated` changed.

        :param unauthenticated: List of unauthenticated packages.

    .. attribute:: cancellable

        If the transaction can be currently cancelled.

    .. attribute:: config_file_conflict

        If there is a conflict in the configuration file handling during
        an installation this attribute contains a tuple of the path to the
        current and the new temporary configuration file.

        The :meth:`resolve_config_file_conflict()` can be used to
        resolve the conflict and continue the processing of the
        transaction.

    .. attribute:: dependencies

        List of dependencies lists in the following order: packages to
        install, to re-install, to remove, to purge, to upgrade,
        to downgrade and to keep.

        You have to call :meth:`simulate()` to calculate the
        dependencies before the transaction will be executed.

    .. attribute:: download

        The number of Bytes which have to be downloaed.

        You have to call :meth:`simulate()` to calculate the
        download size before the transaction will be executed.

    .. attribute:: error

        In the case of a failed transaction this attribute holds the
        corresponding :exc:`errors.TransactionFailed` instance.

    .. attribute:: error_code

        In the case of a failed transaction this attribute is set to the
        underlying error code, e.g.
        :data:`enums.ERROR_PACKAGE_DOWNLOAD_FAILED`.

    .. attribute:: error_details

        In the case of a failed transaction this attribute contains a
        detailed error message in the language of the transaction.

    .. attribute:: exit

        Contains the exit status enum if the transaction has been completed,
        e.g. :data:`enums.EXIT_SUCCESS` or :data:`enums.EXIT_FAILED`.

    .. attribute:: http_proxy

        The URI to the http proxy server which should be used only for this
        transaction, e.g. "http://proxy:8080". It is recommended to set
        the system wide proxy server instead of setting this attribute
        for every transaction.

        See :meth:`set_http_proxy()`.

    .. attribute:: meta_data

        Dictionary of optional meta data which can be set by client
        applications. See :meth:`set_meta_data()`.

    .. attribute:: packages

       List of package lists which will be explicitly changed in the
       following order: packages to install, to re-install, to remove,
       to purge, to upgrade, to downgrade.

    .. attribute:: paused

        If the transaction is currently paused, e.g. it is required to
        insert a medium to install from.

    .. attribute:: progress

        An integer ranging from 0 to 101 to describe the progress of the
        transaction.

        .. note:: A value of 101 indicates that there cannot be made any
                  assumptions on the progress of the transaction.

    .. attribute:: remove_obsoleted_depends

        If dependencies which have been required by a removed package only
        should be removed, too.

    .. attribute:: required_medium

        If a medium should be inserted to continue the fetch phase of a
        transaction, this attribute contains a tuple of the device path of
        of the drive which should be used and secondly of the name of the
        medium.

        The :func:`provide_medium()` method should be used to notify aptdaemon
        about an inserted medium and to continue processing the transaction.

    .. attribute:: role

        The kind of action which is performed by the transaction, e.g.
        :data:`enums.ROLE_UPGRADE_SYSTEM`.

    .. attribute:: space

        The required disk space in Bytes. Will be negative if space is
        freed.

        You have to call :meth:`simulate()` to calculate the
        download size before the transaction will be executed.

    .. attribute:: status

        The enum of the current status, e.g.
        :data:`enums.STATUS_DOWNLOADING`.

    .. attribute:: status_details

        A string describing the current status of the transaction.

    .. attribute:: tid

        The unique identifier of the transaction. It is also the D-Bus path
        of the corresponding transaction object.

    .. attribute:: term_attached

        If the the package manager can be controlled using the controlling
        terminal specified by :func:`set_terminal()`.

    .. attribute:: unauthenticated

        List of packages which are going to be installed but are not
        downloaded from an authenticated repository.

        You have to call :meth:`simulate()` to calculate the
        dependencies before the transaction will be executed.
    �finished�dependencies-changed�download-changed�
space-changed�error�role-changed�terminal-attached-changed�cancellable-changed�meta-data-changed�status-changed�status-details-changed�progress-changed�progress-details-changed�progress-download-changed�packages-changed�unauthenticated-changed�paused�)	�resumed�allow-unauthenticated-changed� remove-obsoleted-depends-changed�locale-changed�terminal-changed�debconf-socket-changed�http-proxy-changed�medium-required�config-file-conflictc��	tj|S#t$r<tjj
||g|��i|��}|tj|<|cYSwxYw)z&Cache transactions with identical tid.)r�
_tid_cache�KeyErrorr�Object�__new__)�cls�tid�args�kwargs�values     �2/usr/lib/python3/dist-packages/aptdaemon/client.pyr0zAptTransaction.__new__�s\��	�!�,�,�S�1�1���	��N�N�*�*�3��E�d�E�f�E�E�-2�N�%�%�c�*��L�	�s��AA�ANc�H�tjj|�||_tj|_d|_d|_d|_tj|_
d|_d|_d|_
d|_d|_d|_d|_d|_d|_gggggggg|_gggggg|_g|_i|_d|_d|_i|_d|_d|_d|_g|_d|_|stAjB�}|jEd|�|_#tAjH|jFd�|_%|jMd|jN�|_(|jJjSd|jT�|_+y)NF�r�org.debian.apt�org.debian.apt.transaction�PropertyChanged),r�__init__r2r�
ROLE_UNSET�roler�
error_code�
error_details�EXIT_UNFINISHED�exit�cancellable�
term_attached�required_medium�config_file_conflict�status�status_details�progressr!�
http_proxy�dependencies�packages�unauthenticated�	meta_data�remove_obsoleted_depends�download�	downloads�space�locale�_method�_args�_debconf_helper�dbus�	SystemBus�
get_object�_proxy�	Interface�_iface�watch_name_owner�_on_name_owner_changed�_owner_watcher�connect_to_signal�_on_property_changed�_signal_matcher)�selfr2�buss   r6r<zAptTransaction.__init__�s������ � ��&�����$�$��	���
����!����)�)��	� ���"���#���$(��!���� �����
���������R��R��R�8����R��R��,��
�!������(-��%���
������
���������
�#�����.�.�"�C��n�n�%5�s�;����n�n�T�[�[�2N�O���!�2�2�3C�37�3N�3N�P���
�K�K�)�)�*;�*.�*C�*C�
E�	
��c��|dk(r�|jtjk(rg|jdtjdf�|jdd�|jdd�|jdtj
�yyy)	z(Fail the transaction if the daemon died.r8�ErrorzIt seems that the daemon died.�CancellableF�TerminalAttached�	ExitStateN)rBrrAra�ERROR_DAEMON_DIED�EXIT_FAILED)rc�
connections  r6r^z%AptTransaction._on_name_owner_changed%s������	�	�U�-B�-B� B��%�%�g��0G�0G�18�09�
:�
�%�%�m�U�;��%�%�&8�%�@��%�%�k�5�3D�3D�E�
!C�rec��|dk(r||_|jd|�y6|dk(r||_|jd|�y6|dk(r|jd|�y6|dk(r|jd|�||_y6|d	k(r|jd
|�y6|dk(r|jd|�y6|d
k(r||_|jdg|���y6|dk(r||_|jdg|���y6|dk(r||_|jd|�y6|dk(r||_|jd|�y6|dk(r||_|jd|�y6|dk(r||_	|jd|�y6|dk(r||_
|jd|�y6|dk(r4|\}}}}}}|r(|||||f|j|<|jdg|���y6y6|dk(r||_|jd|�y6|dk(r!||_
|d k7r|jd!g|���y6y6|d"k(r||_|jd#|�y6|d$k(r-||_|r|jd%�y6|jd&�y6|d'k(r!||_|d k7r|jd(g|���y6y6|d)k(r|jd*g|���y6|d+k(r||_|jd,|�y6|d-k(r||_|jd.|�y6|d/k(r||_|jd0|�y6|d1k(rX|\|_|_|j(d2k7r9t-|j(|j*�|_|jd3g|���y6y6|d4k(r�|t0j2k7ru||j4k7re||_|j6r|j6j9�|j;�|j=|j>|j>�5�y6y6y6y6)7z(Callback for the PropertyChanged signal.rirrhr�
DebconfSocketr(�RemoveObsoletedDependsr%�AllowUnauthenticatedr$�Terminalr'�Dependenciesr�Packagesr�Unauthenticatedr �Localer&�Roler�Statusr�
StatusDetailsr�ProgressDownloadr�Progressr�ConfigFileConflict)r8r8r+�MetaDatar�Pausedr!r#�RequiredMediumr*�ProgressDetailsr�Downloadr�Spacer�	HttpProxyr)rgr8rrj��
reply_handler�
error_handlerN) rD�emitrCrOrKrLrMrSr>rGrHrQrIrFrNr!rErPrRrJr?r@rrrrArBrV�stop�_disconnect_from_dbus�sync�_on_final_sync_done)	rc�
property_namer5�urirG�desc�sizerP�msgs	         r6raz#AptTransaction._on_property_changed/s����.�.�!&�D���I�I�1�5�9�
�m�
+�$�D���I�I�+�U�3�
�o�
-��I�I�.��6�
�6�
6��I�I�8�%�@�,1�D�)�
�4�
4��I�I�5�u�=�
�j�
(��I�I�(�%�0�
�n�
,� %�D���D�I�I�,�5�u�5�
�j�
(�!�D�M��D�I�I�(�1�5�1�
�/�
/�#(�D� ��I�I�/��7�
�h�
&��D�K��I�I�&��.�
�f�
$��D�I��I�I�n�e�,�
�h�
&��D�K��I�I�&��.�
�o�
-�"'�D���I�I�.��6�
�0�
0�5:�2�C���t�X�s��'-�t�T�8�S�&I����s�#���	�	�5�>��>���j�
(�!�D�M��I�I�(�%�0�
�2�
2�(-�D�%��� ���	�	�0�9�5�9�!�
�j�
(�"�D�N��I�I�)�5�1�
�h�
&��D�K���	�	�(�#��	�	�)�$�
�.�
.�#(�D� ��� ���	�	�+�4�e�4�!�
�/�
/��D�I�I�0�9�5�9�
�j�
(�!�D�M��I�I�(�%�0�
�g�
%��D�J��I�I�o�u�-�
�k�
)�#�D�O��I�I�*�E�2�
�g�
%�27�/�D�O�T�/����"�$�.�t���/3�/A�/A�C��
���	�	�'�*�E�*�%��k�
)���-�-�-�%�4�9�9�2D�!��	��'�'��(�(�-�-�/��*�*�,��	�	��(@�(@�(,�(@�(@��B�3E�-�*rec�p�|jj�|jd|j�y)Nr)r_�cancelr�rB)rc�datas  r6r�z"AptTransaction._on_final_sync_done�s&�����"�"�$��	�	�*�d�i�i�(rec�������fd�}�r0|r.�jjdtj||��y�jjdtj��}||�y)aySync the properties of the transaction with the daemon.

        This method is called automatically on the creation of the
        AptTransaction instance.

        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException
        c�p��|j�D]\}}�j||���r	���yy�N)�itemsra)�	prop_dictr�r5r�rcs   ��r6�sync_propertiesz,AptTransaction.sync.<locals>.sync_properties�s@���(1���(9�
@�$�
�u��)�)�-��?�
@���d�#�rer:��dbus_interfacer�r�)r�N)rZ�GetAllrW�PROPERTIES_IFACE)rcr�r�r��
propertiess``   r6r�zAptTransaction.sync�si���"	$�
�]��K�K���;�.2�.C�.C�-<�-:�
�
<�
���+�+�,�#�4�4�,�6�J�
�J�'rec��	|jj|j||t��S#t$r}|r	||�n�Yd}~yd}~wwxYw)a4Chain this transaction after the given one. The transaction will
        fail if the previous one fails.

        To start processing of the chain you have to call :meth:`run()`
        of the first transaction. The others will be queued after it
        automatically.

        :param transaction: An AptTransaction on which this one depends.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException
         �r�r��timeoutN)r\�RunAfterr2�_APTDAEMON_DBUS_TIMEOUT�	Exception)rc�transactionr�r�rs     r6�	run_afterzAptTransaction.run_after�sY��(		��;�;�'�'����6C�6C�0G�(�I�
I���	���e�$��%��	�s�,/�	A�A	�	Ac��	|jj||t��S#t$r}|r	||�n�Yd}~yd}~wwxYw)a&Queue the transaction for processing.

        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.TransactionFailed, dbus.DBusException
        r�N)r\�Runr�r�)rcr�r�rs    r6�runzAptTransaction.run�sP��	��;�;�?�?��1>�+B�#�D�
D���	���e�$��%��	�s�!$�	A�>�Ac�>�|jj||��y)a�Simulate the transaction to calculate the dependencies, the
        required download size and the required disk space.

        The corresponding properties of the AptTransaction will be updated.

        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.TransactionFailed, dbus.DBusException
        r�N)r\�Simulate�rcr�r�s   r6�simulatezAptTransaction.simulate�s ��"	
�����=�+8�	�	:rec�>�|jj||��y)a!Cancel the running transaction.

        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.NotAuthorizedError, dbus.DBusException
        r�N)r\�Cancelr�s   r6r�zAptTransaction.cancel�s ��	
������)6�	�	8rec�|����r��fd�}nd}�jjdd|tj||��y)a�Use the given http proxy for downloading packages in this
        transaction.

        :param proxy: The URL of the proxy server, e.g. "http://proxy:8080"
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.NotAuthorizedError, dbus.DBusException
            aptdaemon.errors.ForeignTransaction,
        c������Sr�r"�r�rcs��r6�<lambda>z/AptTransaction.set_http_proxy.<locals>.<lambda>����]�4�%8�reNr:r�r��rZ�SetrWr�)rc�proxyr�r��_reply_handlers` `  r6�set_http_proxyzAptTransaction.set_http_proxys=���"�8�N�!�N������4�k�5�'+�'<�'<�&4�&3�	�	5rec�|����r��fd�}nd}�jjdd|tj||��y)a�Include no longer required dependencies which have been installed
        automatically when removing packages.

        :param remove_obsoleted_depends: If obsolete dependencies should be
            also removed.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.ForeignTransaction, dbus.DBusException
        c������Sr�r"r�s��r6r�z=AptTransaction.set_remove_obsoleted_depends.<locals>.<lambda>9r�reNr:rpr�r�)rcrOr�r�r�s` `  r6�set_remove_obsoleted_dependsz+AptTransaction.set_remove_obsoleted_depends&s?���$�8�N�!�N������4�0�2J�'+�'<�'<�&4�&3�		�	5rec�|����r��fd�}nd}�jjdd|tj||��y)aAllow to install unauthenticated packages.

        Unauthenticated packages are from the repository of a vendor whose
        key hasn't been installed. By default this is not allowed.

        :param allow_unauthenticated: If unauthenticated packages can be
            installed.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.ForeignTransaction, dbus.DBusException
        c������Sr�r"r�s��r6r�z:AptTransaction.set_allow_unauthenticated.<locals>.<lambda>Wr�reNr:rqr�r�)rc�allow_unauthenticatedr�r�r�s` `  r6�set_allow_unauthenticatedz(AptTransaction.set_allow_unauthenticatedBs?���(�8�N�!�N������4�.�0E�'+�'<�'<�&4�&3�		�	5rec������r��fd�}nd}dtj�z}tjj|�r0�jjdd|tj||��ytj|��_
�jjdd�jjtj||���jj�y)a�Setup a debconf frontend to answer questions of the maintainer
        scripts.

        Debian allows packages to interact with the user during installation,
        configuration and removal phase via debconf. Aptdaemon forwards the
        communication to a debconf instance running as the user of the
        client application.

        :param frontend: The name of the debconf frontend which should be
            launched, e.g. gnome or kde. Defaults to gnome.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.ForeignTransaction, dbus.DBusException
         c������Sr�r"r�s��r6r�z5AptTransaction.set_debconf_frontend.<locals>.<lambda>xr�reNz/run/user/%d/pk-debconf-socketr:ror�)
�os�getuid�path�existsrZr�rWr�r�DebconfProxyrV�socket_path�start)rc�frontendr�r�r��	pk_sockets` `   r6�set_debconf_frontendz#AptTransaction.set_debconf_frontend`s����.�8�N�!�N�4�r�y�y�{�B�	�
�7�7�>�>�)�$��K�K�O�O�8�/��#�4�4�,�+�	
�
-�

�&�3�3�H�=��������4�o��,�,�8�8�'+�'<�'<�&4�&3�		�	5�
	
���"�"�$rec�����|jdd��|jdd�}�r��fd�}nd}tj|d��}�jj	dd|tj
||�	�y)
a�Store additional meta information of the transaction in the
        MetaData property of the transaction.

        The method accepts key=value pairs. The key has to be prefixed with
        an underscore separated identifier of the client application.

        In the following example Software-Center sets an application name
        and icon:

        >>> Transaction.set_meta_data(sc_icon="shiny", sc_app="xterm")

        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.ForeignTransaction, dbus.DBusException
        r�Nr�c������Sr�r"r�s��r6r�z.AptTransaction.set_meta_data.<locals>.<lambda>�r�re�sv)�	signaturer:r}r�)�poprW�
DictionaryrZr�r�)rcr4r�r�rNr�s`    @r6�
set_meta_datazAptTransaction.set_meta_data�sm���.�
�
�?�D�9�
��
�
�?�D�9�
��8�N�!�N��O�O�F�d�;�	������4�j�)�'+�'<�'<�&4�&3�	�	5rec�|����r��fd�}nd}�jjdd|tj||��y)a<Allow to set a controlling terminal for the underlying dpkg call.

        See the source code of gtk3widgets.AptTerminal or console.ConsoleClient
        as example.

        >>> master, slave = pty.openpty()
        >>> transaction.set_terminal(os.ttyname(slave))

        :param terminal: The slave end of a tty.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.ForeignTransaction, dbus.DBusException
        c������Sr�r"r�s��r6r�z-AptTransaction.set_terminal.<locals>.<lambda>�r�reNr:rrr�r�)rc�ttynamer�r�r�s` `  r6�set_terminalzAptTransaction.set_terminal�s=���*�8�N�!�N������4�j�'�'+�'<�'<�&4�&3�	�	5rec�V�t|d�r|jj�|`yy)z0Stop monitoring the progress of the transaction.rbN)�hasattrrb�remove)rcs r6r�z$AptTransaction._disconnect_from_dbus�s*���4�*�+�� � �'�'�)��$�,rec�|����r��fd�}nd}�jjdd|tj||��y)akSet the language for status and error messages.

        :param locale: The locale name, e.g. de_DE@UTF-8.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.ForeignTransaction, dbus.DBusException
        c������Sr�r"r�s��r6r�z+AptTransaction.set_locale.<locals>.<lambda>�r�reNr:rvr�r�)rc�locale_namer�r�r�s` `  r6�
set_localezAptTransaction.set_locale�s=����8�N�!�N������4�h��'+�'<�'<�&4�&3�	�	5rec�@�|jj|||��y)a�Continue a paused transaction which waits for a medium to install
        from.

        :param medium: The name of the provided medium.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.ForeignTransaction, dbus.DBusException
         r�N)r\�
ProvideMedium)rc�mediumr�r�s    r6�provide_mediumzAptTransaction.provide_medium�s"�� 	
���!�!�&�
�0=�	"�	?rec�B�|jj||||��y)aContinue a paused transaction which waits for the resolution of a
        configuration file conflict.

        :param config: The path to the current version of the configuration
            file.
        :param answer: Can be either "keep" or "replace".
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: aptdaemon.errors.ForeignTransaction, dbus.DBusException
         r�N)r\�ResolveConfigFileConflict)rc�config�answerr�r�s     r6�resolve_config_file_conflictz+AptTransaction.resolve_config_file_conflict�s&��&	
���-�-�f�f�<I�<I�	.�	Krer��NN)'�__name__�
__module__�__qualname__�__doc__r�SignalFlags�	RUN_FIRST�	TYPE_NONE�TYPE_STRING�
TYPE_PYOBJECT�
TYPE_INT64�TYPE_BOOLEAN�TYPE_INT�__gsignals__�weakref�WeakValueDictionaryr-r0r<r^rar�r	r
r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r"rer6rr6s���N�`
f�J��!4�!4�!>�!>�!(�!2�!2�")�"5�"5�!7�!9�f�+�W�-@�-@�-J�-J�-4�->�->�.5�.C�.C�.5�.C�.C�.5�.C�.C�.5�.C�.C�.5�.C�.C�.5�.C�.C�.5�.C�.C�
.E�-F�f�'��)<�)<�)F�)F�)0�):�):�*1�*<�*<�)>�)@�f�$�g�&9�&9�&C�&C�&-�&7�&7�'.�'9�'9�&;�&=�f�$�g�1�1�;�;�%�/�/�&�2�2�G�4G�4G�H�J�%f�*#�W�%8�%8�%B�%B�%,�%6�%6�&-�&9�&9�%;�%=�+f�00�'�2E�2E�2O�2O�29�2C�2C�3:�3G�3G�2I�2K�1f�6*�G�,?�,?�,I�,I�,3�,=�,=�-4�-A�-A�,C�,E�7f�<(�'�*=�*=�*G�*G�*1�*;�*;�+2�+@�+@�*B�*D�=f�B%�w�':�':�'D�'D�'.�'8�'8�(/�(;�(;�'=�'?�Cf�H-�w�/B�/B�/L�/L�/6�/@�/@�07�0C�0C�/E�/G�If�N'��)<�)<�)F�)F�)0�):�):�*1�*:�*:�)<�)>�Of�T/��1D�1D�1N�1N�18�1B�1B�29�2B�2B�29�2B�2B�29�2D�2D�29�2D�2D�29�2B�2B�29�2D�2D�2F�1G�Uf�d0�'�2E�2E�2O�2O�29�2C�2C�3:�3F�3F�3:�3F�3F�3:�3F�3F�3:�3E�3E�3:�3E�3E�3:�3F�3F�3H�2I�ef�t'��)<�)<�)F�)F�)0�):�):�*1�*?�*?�*1�*?�*?�*1�*?�*?�*1�*?�*?�*1�*?�*?�*1�*?�*?�*A�)B�uf�D.��0C�0C�0M�0M�07�0A�0A�18�1F�1F�0H�0J�Ef�J�w�2�2�<�<�&�0�0�!�#�Kf�P!(� 3� 3� =� =� '� 1� 1� "� $�7>�6I�6I�6S�6S�6=�6G�6G�7>�7K�7K�6M�6O� �+�+�5�5��)�)� �-�-�/�91�(/�':�':�'D�'D�'.�'8�'8�(/�(;�(;�'=�'?�*1�)<�)<�)F�)F�)0�):�):�*1�*=�*=�)?�)A�07�/B�/B�/L�/L�/6�/@�/@�07�0C�0C�/E�/G�,3�+>�+>�+H�+H�+2�+<�+<�,3�,?�,?�+A�+C�)0�(;�(;�(E�(E�(/�(9�(9�)0�)<�)<�)0�)<�)<�)>�(?�.5�-@�-@�-J�-J�-4�->�->�.5�.A�.A�.5�.A�.A�.C�-D�Ef�L�P-��,�,�.�J��(E�TF�ZB�x)���(���(�>������:������,��:���:�$��
8���
8���5���5�0��GK�5���5�4��DH�5���5�8��;?�+/�)%���)%�V��5���5�B��5���5�8%���5���5�,��?���?�"��IM�37�K���Krerc�r�eZdZdZdd�Zedd��Zee		dd���Zee		dd���Z	ee			dd���Z
ee		dd���Zee		dd	���Zee		dd
���Z
ee		dd���Zee		dd���Zee		dd
���Zee		dd���Zee		dd���Zee		dd���Zee		dd���Zee		dd���Zee		dd���Zeedd���Zee		dd���Zd�Zej6d��Zy) r
z)Provides a complete client for aptdaemon.Nc���|r||_ntj�|_	dtj�z|_d|_y#t$rd|_Yd|_ywxYw)z Return a new AptClient instance.z%s.%sN)rdrWrXrS�getdefaultlocale�_locale�
ValueError�terminal)rcrds  r6r<zAptClient.__init__s\����D�H��~�~�'�D�H�	 �"�V�%<�%<�%>�>�D�L���
���	 ��D�L���
�	 �s�A	�	A#�"A#c�V�t|j�}|j||��}|S)auGet the list of the installed vendor keys which are used to
        authenticate packages.

        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: Fingerprints of all installed vendor keys.
        r�)rrd�GetTrustedVendorKeys)rcr�r��daemon�keyss     r6�get_trusted_vendor_keysz!AptClient.get_trusted_vendor_keys(s2�� �t�x�x�(���*�*��9F�+�H���rec�.�|jd|g|||�S)a�Create a new transaction to apply all avaibale upgrades.

        :param safe_mode: If True only already installed packages will be
            updated. Updates which require to remove installed packages or to
            install additional packages will be skipped.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a
            defer.Deferred. This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �
UpgradeSystem��_run_transaction)rc�	safe_mode�waitr�r�s     r6�upgrade_systemzAptClient.upgrade_system=s&��.�$�$�_�y�k�%)�=�-�I�	Irec�.�|jd|g|||�S)alCreate a new transaction to install the given packages from the
        reporitories.

        The version number and target release of the packages can be specified
        using the traditional apt-get syntax, e.g. "xterm=281.1" to force
        installing the version 281.1 of xterm or "xterm/experimental" to
        force installing xterm from the experimental release.

        :param package_names: List of names of the packages which should be
            installed.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a
            defer.Deferred. This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �InstallPackagesr�rc�
package_namesrr�r�s     r6�install_packageszAptClient.install_packagesWs'��8�$�$�%6���%)�=�-�I�	Irec
	�B�|sdg}|jd||||||g|||	�S)a�Create a new transaction to enable a repository.

        :param src_type: The type of the repository (deb, deb-src).
        :param uri: The main repository URI
           (e.g. http://archive.ubuntu.com/ubuntu)
        :param dist: The distribution to use (e.g. stable or lenny-backports).
        :param comps: List of components (e.g. main, restricted).
        :param comment: A comment which should be added to the sources.list.
        :param sourcesfile: (Optoinal) filename in sources.list.d.

        :param wait: if True run the transaction immediately and return
            its exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        r8�
AddRepositoryr)
rc�src_typer��dist�comps�comment�sourcesfilerr�r�s
          r6�add_repositoryzAptClient.add_repositoryvs?��:��D�E��$�$�_�&.��T�5�'�&1�&3�%)�=�-�I�	Irec�0�|jd||g|||�S)a�Create a new transaction to download and install the key of a
        software vendor. The key is used to authenticate packages of the
        vendor.

        :param keyid: The id of the GnuPG key (e.g. 0x0EB12F05)
        :param keyserver: The server to get the key from (e.g.
            keyserver.ubuntu.com)

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �AddVendorKeyFromKeyserverr)rc�keyid�	keyserverrr�r�s      r6�add_vendor_key_from_keyserverz'AptClient.add_vendor_key_from_keyserver�s+��2�$�$�%@�&+�Y�%7�%)�=�-�I�	Irec�.�|jd|g|||�S)aQCreate a new transaction to install the key file of a software
        vendor. The key is used to authenticate packages of the vendor.

        :param path: The absolute path to the key file.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �AddVendorKeyFromFiler)rcr�rr�r�s     r6�add_vendor_key_from_filez"AptClient.add_vendor_key_from_file�s'��,�$�$�%;�d�V�%)�=�-�I�	Irec�.�|jd|g|||�S)arCreate a new transaction to remove the key of a software vendor
        from the list of trusted ones.

        The key is used to authenticate the origin of packages.

        :param fingerprint: The fingerprint of the key.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �RemoveVendorKeyr)rc�fingerprintrr�r�s     r6�remove_vendor_keyzAptClient.remove_vendor_key�s'��0�$�$�%6��
�%)�=�-�I�	Irec�d�tjdd�}|r�|jtjj	|d��rStj|d�tjj	dtjj|��}|jd||g|||�S)a�Create a new transaction to install a local package file.

        :param path: The absolute path to the .deb-file.
        :param force: Force the installation of a .deb-file even if it
            violates the quality standard defined in the packaging policy.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �HOMENz.gvfsz/tmp�InstallFile)	r��getenv�
startswithr��join�shutil�copy�basenamer)rcr��forcerr�r��homes       r6�install_filezAptClient.install_file�s���4�y�y���&���D�O�O�B�G�G�L�L��w�$?�@��K�K��f�%��7�7�<�<�����(8�(8��(>�?�D��$�$�]�T�5�M�%)�=�-�I�	Irec�.�|jd|g|||�S)a7Create a new transaction to upgrade installed packages.

        The version number and target release of the packages can be specified
        using the traditional apt-get syntax, e.g. "xterm=281.1" to force
        installing the version 281.1 of xterm or "xterm/experimental" to
        force installing xterm from the experimental release.

        :param package_names: The list of package which should be upgraded.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �UpgradePackagesrrs     r6�upgrade_packageszAptClient.upgrade_packagess'��4�$�$�%6���%)�=�-�I�	Irec�.�|jd|g|||�S)aCreate a new transaction to remove installed packages.

        :param package_names: The list of packages which should be removed.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �RemovePackagesrrs     r6�remove_packageszAptClient.remove_packages)s'��*�$�$�%5�
��%)�=�-�I�	Irec
�r�d�}
||||||fD�cgc]
}|
|���}}|jd||||	�Scc}w)aCreate a new transaction to perform a complex package management
        task which allows to install, remove, upgrade or downgrade several
        packages at the same time.

        The version number and target release of the packages can be specified
        using the traditional apt-get syntax, e.g. "xterm=281.1" to force
        installing the version 281.1 of xterm or "xterm/experimental" to
        force installing xterm from the experimental release.

        :param install: List of packages to install.
        :param reinstall: List of packages to re-install.
        :param remove: List of packages to remove.
        :param purge: List of packages to purge.
        :param upgrade: List of packages to upgrade.
        :param downgrade: List of packages to downgrade. The version of the
            package has to be appended to the name separated by a "=", e.g.
            "xterm=272-1".

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        c��|sdgS|S)Nr8r")�lsts r6�check_empty_listz3AptClient.commit_packages.<locals>.check_empty_listes����t���
re�CommitPackagesr)
rc�install�	reinstallr��purge�upgrade�	downgraderr�r�r8r7�pkgss
             r6�commit_packageszAptClient.commit_packagesAsd��H	�
3:�9�f�27��)�2M�N�#� ��%�N��N��$�$�%5�t�%)�=�-�I�	I��Ns�4c�,�|jdg|||�S)a*Create a new transaction to fix unsatisfied dependencies of
        already installed packages.

        Corresponds to the ``apt-get -f install`` call.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �FixBrokenDependsr�rcrr�r�s    r6�fix_broken_dependszAptClient.fix_broken_dependsos%��,�$�$�%7��%)�=�-�I�	Irec�0�|jd||g|||�S)a�Create a new transaction to reconfigure already installed packages.

        Corresponds to the ``dpkg-reconfigure`` call.

        :param packages: List of package names which should be reconfigured.
        :param priority: The minimum priority of question that will be
            displayed.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �Reconfigurer)rcrL�priorityrr�r�s      r6�reconfigurezAptClient.reconfigure�s)��2�$�$�]�X�x�4H�$�%2�M�C�	Crec�,�|jdg|||�S)aCreate a new transaction to complete a previous interrupted
        installation.

        Corresponds to the ``dpkg --confgiure -a`` call.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �FixIncompleteInstallrrCs    r6�fix_incomplete_installz AptClient.fix_incomplete_install�s%��,�$�$�%;�R��%2�M�C�	Crec�\�|r|jd|g|||�S|jdg|||�S)a+Create a new transaction to update the package cache.

        The repositories will be queried for installable packages.

        :param sources_list: Path to a sources.list which contains repositories
            that should be updated only. The other repositories will
            be ignored in this case. Can be either the file name of a snippet
            in /etc/apt/sources.list.d or an absolute path.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �UpdateCachePartially�UpdateCacher)rc�sources_listrr�r�s     r6�update_cachezAptClient.update_cache�sM��4��(�(�)?�*6���)6�
�G�
G��(�(���D�)6�
�G�
Grec�.�|jd|g|||�S)a7Create a new transaction to enable the component of the
        distribution repository.

        :param component: The name of the component, e.g. main or universe.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �EnableDistroComponentr)rc�	componentrr�r�s     r6�enable_distro_componentz!AptClient.enable_distro_component�s'��,�$�$�%<�y�k�%)�=�-�I�	Irec�,�|jdg|||�S)a�Remove all downloaded files.

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �CleanrrCs    r6�cleanzAptClient.clean�s"��$�$�$�W�b�$�
�%2�4�	4rec�2�|jd|||g|||�S)a�Install a license key to use a piece of proprietary software.

        :param pkg_name: The package which requires the license
        :param json_token: The oauth token in json format
        :param server_name: The server name (ubuntu-procduction,
            ubuntu-staging)

        :param wait: if True run the transaction immediately and return its
            exit state instead of the transaction itself.
        :param reply_handler: Callback function. If specified in combination
            with error_handler the method will be called asynchrounsouly.
        :param error_handler: Errback function. In case of an error the given
            callback gets the corresponding exception instance.
        :param defer: Run the method asynchrounsly and return a defer.Deferred.
            This options is only available as a keyword.

        :raises: dbus.DBusException

        :returns: An AptTransaction instance.
        �
AddLicenseKeyr)rc�pkg_name�
json_token�server_namerr�r�s       r6�add_license_keyzAptClient.add_license_key
s+��0�$�$�_�&.�
�K�%H�%)�=�%2�4�	4rec����|xr�}	|j||||�}|r)�fd�}	|j|�|j|	�|St	j
�}
t
|d�s|
jd�t
|d�s�t|jtj�r|jj�|j}|jr|j�|rX|jtj k(r/|
jd�|jtj k(r�/|jS|S#t$r}|r
�|�Yd}~y�d}~wwxYw)Nc�d��	|j�y#t$r}�|�Yd}~yd}~wwxYw)z4Convert the DeferredException to a normal exception.N)�raise_exceptionr�)rr�s �r6�on_errorz,AptClient._run_transaction.<locals>.on_error7s/���)��)�)�+�� �)�!�%�(�(��)�s��	/�*�/�resultT)�_run_transaction_helperr��
add_callbacks�add_errbackr�main_context_defaultr��	iteration�
isinstancerb�defer�DeferredExceptionr`rrBrrA)rc�method_namer3rr�r��async_�deferredrra�context�transs     `      r6rzAptClient._run_transaction*s8����0�=��	��3�3�K��t�4:�<�H��
)�
�"�"�=�1�� � ��*��O��/�/�1�G��h��1��!�!�$�'��h��1��(�/�/�5�+B�+B�C����/�/�1��O�O�E��{�{��k�k�!���j�j�E�$9�$9�9��%�%�d�+��j�j�E�$9�$9�9��z�z�!����G�	���e�$����	�s�E�	E"�
E�E�E"c#�"�K�t|j�}|j|�}|r;tj�}|||j
|jtd��|��}n||dti�}t||j�}	|jr|	j|j���|jr|	j|j���|	j���|rv|rttj��|	jd�fd��}
|	j������t!j"|
�tj$|	j&�n|r|	j���tj$|	�y�w)N)r�r�r�r�rc�P��|tjk7xr�j|�Sr�)rrA�callback)rorB�
deferred_waits  �r6r�z3AptClient._run_transaction_helper.<locals>.<lambda>js)���!%��)>�)>�!>�">�!.�!7�!7��!=�re)rrd�get_dbus_methodri�Deferredrr�errbackr�rr�r�r�r�r��connectr�r�
source_remove�return_valuerB)rcrkr3rrlr�dbus_methodrmr2ro�sigrss           @r6rcz!AptClient._run_transaction_helperUs;������t�x�x�(���,�,�[�9����~�~�'�H��9=�'/�&7�&7�&.�&6�&6� 7�
9�!�.�C��t�E�-D�E�C��s�D�H�H�-���<�<��"�"�4�<�<�0�0��=�=��$�$�T�]�]�3�3��j�j�l���F�!�N�N�,�M��-�-�
�!?�@�C��)�)�+�������s�#����u�z�z�*�
��)�)�+��
���5�!�s�FFr�r�)TFNN)FNN)Nr8r8FNN)FFNN)�defaultFNN)NFNN)r�r�r�r�r<r
rr	r	rrrrr"r.r1r4r@rDrHrKrPrTrWr]rri�inline_callbacksrcr"rer6r
r
s���3������(��GK�%)�I���I�0��HL�'+�I���I�:��FH�AE�%)� I��� I�D��CH�HL�I���I�6��GK�/3�I���I�.��GK�(,�I���I�2��HL�#'�I���I�>��HL�'+�I���I�6��27�:>�I���I�,��=A�&*�*I���*I�X��;?�)-�I���I�.��-6�BF�C���C�4��?C�-1�C���C�.��38�7;�G���G�@��6;�BF�I���I�.��4���4�&��FK�:>�4���4�6)�V���"��"rer
c��|stj�}t||�}|r|r|j||��y|j�|S)aGet an existing transaction by its identifier.

    :param tid: The identifer and D-Bus path of the transaction
        e.g. /org/debian/apt/transaction/78904e5f9fa34098879e768032789109
    :param bus: Optionally the D-Bus on which aptdaemon listens. Defaults
        to the system bus.

    :param reply_handler: Callback function. If specified in combination
        with error_handler the method will be called asynchrounsouly.
    :param error_handler: Errback function. In case of an error the given
        callback gets the corresponding exception instance.
    :param defer: Run the method asynchrounsly and return a defer.Deferred.
        This options is only available as a keyword.

    :raises: dbus.DBusException

    :returns: An AptTransaction instance.
    r�N)rWrXrr�)r2rdr�r�ros     r6rrvsB��*��n�n����3��$�E���
�
�
��m�
�L�
�
�
���rec�D�dD]}|dkr	d||fzcS|dz}�d|dfzS)z�Returns a human friendly string for a given byte size.

    Note: The bytes are skipped from the returned unit: 1024 returns 1K
    )r8�K�M�Gg�@z%3.1f%s�Tr")�bytes�units  r6�get_size_stringr��sC��
$����6�>���t�}�,�,�
�������s�|�#�#rec�|�|stj�}tj|jddd�d�S)z�Get the daemon D-Bus interface.

    :param bus: Optionally the D-Bus on which aptdaemon listens. Defaults
        to the system bus.

    :raises: dbus.DBusException

    :returns: An dbus.Interface instance.
    r9z/org/debian/aptF)rWrXr[rY)rds r6rr�s=����n�n����>�>�#�.�.�)9�):�).�0�+�,�,re)NNNr�)!r�rS�os.pathr�r)r��sysrW�dbus.mainloop.glib�mainloop�glib�
DBusGMainLoop�
gi.repositoryrrr8rrri�defer.utilsr	�errorsr
r�__all__r�r/r�objectr
rr�rr"rer6�<module>r�s����6��
��
����
�
��� � �� �5�'����!�=�
M�� ��^K�W�^�^�^K�B\	"��\	"�~������:	$�,re

Zerion Mini Shell 1.0