%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__/progress.cpython-312.pyc

�

��kd������dZdZdZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZddlmZddlmZdd	lmZdd
lmZd�Zej8d�Zej8d
�ZdZej@ejBejDejFejHejJejLd�Z'e(d�dzZ)Gd�dejTjVjX�Z-Gd�dejTjVj\�Z/Gd�de/�Z0Gd�de1�Z2Gd�de2�Z3Gd�de3�Z4Gd�de4�Z5Gd �d!e4�Z6y)"z$Progress handlers for APT operationsz%Sebastian Heinlein <devel@glatzor.de>)�DaemonAcquireProgress�DaemonOpenProgress�DaemonInstallProgress�DaemonDpkgInstallProgress�DaemonForkProgress�DaemonDpkgRecoverProgress�N)�GLib�)�enums)�lock)�mainloop)�IsoCodesc��|S�N�)�ss �4/usr/lib/python3/dist-packages/aptdaemon/progress.py�<lambda>r*s��a��zAptDaemon.WorkerzAptDaemon.Worker.TerminaliX)�install�	configure�remove�trigproc�purge�	disappear�upgrade�z\[[;?0-9]*[A-Za-z]c�&�eZdZdZdd�Zdd�Zd�Zy)rz*Handles the progress of the cache opening.c�:�tjjjj	|�||_dD�cgc]
}|||z
|zz��c}|_t|�|_|jjd�|_
d|_||_ycc}w)aRInitialize a new DaemonOpenProgress instance.

        Keyword arguments:
        transaction -- corresponding transaction D-Bus object
        begin -- begin of the progress range (defaults to 0)
        end -- end of the progress range (defaults to 100)
        quiet -- do not emit any progress information for the transaction
        )g�?��?g�?��?r!rN)�apt�progress�base�
OpProgress�__init__�_transaction�steps�float�progress_begin�pop�progress_end�quiet)�self�transaction�begin�endr-�modifiers      rr&zDaemonOpenProgress.__init__@s���	�����$�$�-�-�d�3�'���'E�F�#��s�U�{�h�6�6�F��
�$�E�l��� �J�J�N�N�1�-�����
���
��Fs�BNc��|xs|j}|dkrEt|j|dz|j|jz
zz�}|j|k(ryd}||_|j
s||j_yy)zpCallback for progress updates.

        Keyword argument:
        percent - current progress in percent
        �e�dN)�percent�intr*r,r#r-r')r.r6r#s   r�updatezDaemonOpenProgress.updateTs����)�T�\�\���S�=��4�.�.�'�C�-� �-�-��0C�0C�C�2E�E�F�H��}�}��(���H� ��
��z�z�)1�D���&�rc���|j|_|j|_	|jj	d�|_y#t
j
d�YyxYw)zXCallback after completing a step.

        Sets the progress range to the next interval.rz0An additional step to open the cache is requiredN)r,r#r*r(r+�log�warning�r.s r�donezDaemonOpenProgress.donegsO��
�)�)��
�"�/�/���	L� $�
�
���q� 1�D���	L��K�K�J�K�s� A�A)rr5Fr)�__name__�
__module__�__qualname__�__doc__r&r8r=rrrrr<s��4��(2�&Lrrc�V�eZdZdZdd�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)rz-
    Handle the package download process
    c��tjjjj	|�||_||_||_d|_y)Nr)r"r#r$�AcquireProgressr&r/r,r*�r.r/r0r1s    rr&zDaemonAcquireProgress.__init__ys?�������)�)�2�2�4�8�&������#�����
rc��|jjtjjk(r(t
j}|jj}�n|jjtjjk(rt
j}n�|jjtjjk(rt
j}n�|jjtjjk(rt
j}nR|jjtjjk(rt
j}nt
j }|jjtjjk7r-|jj"r|jj"}n/|jj$r|jj$}nd}|j&||j(||jjz||jj*z|f|j,_y)N�)�owner�status�apt_pkg�AcquireItem�	STAT_DONEr�
DOWNLOAD_DONE�filesize�STAT_AUTH_ERROR�DOWNLOAD_AUTH_ERROR�
STAT_FETCHING�DOWNLOAD_FETCHING�
STAT_ERROR�DOWNLOAD_ERROR�	STAT_IDLE�
DOWNLOAD_IDLE�DOWNLOAD_NETWORK_ERROR�
error_text�mode�uri�	shortdesc�partialsizer/�progress_download)r.�item�
total_size�current_sizerI�msgs      r�_emit_acquire_itemz(DaemonAcquireProgress._emit_acquire_item�s����:�:���� 3� 3� =� =�=��(�(�F��:�:�.�.�L�
�Z�Z�
�
�'�"5�"5�"E�"E�
E��.�.�F�
�Z�Z�
�
�'�"5�"5�"C�"C�
C��,�,�F�
�Z�Z�
�
�'�"5�"5�"@�"@�
@��)�)�F�
�Z�Z�
�
�'�"5�"5�"?�"?�
?��(�(�F��1�1�F��J�J����!4�!4�!>�!>�>��
�
�%�%��*�*�'�'�C�
�Z�Z�_�_��*�*�/�/�C��C��H�H�f�d�n�n�����,�,�,��4�:�:�1�1�1��	.����*rc�p�t�}|D]Y}|jjr&|j|jj��?|j|j��[|rL|j
j
ddt|��ddj|�iz}||j
_	yy)�$Emit the transaction status details.zDownloading %(files)s�files� N)
�setrH�id�addr[r/�ngettext�len�join�status_details)r.�items�namesr^ras     r�_emit_status_detailsz*DaemonAcquireProgress._emit_status_details�s�������	*�D��z�z�}�}��	�	�$�*�*�-�-�(��	�	�$�.�.�)�		*�
��"�"�+�+�,C�,C�,/��J�8�;B�;>�8�8�E�?�;L�L�C�/2�D���+�
rc�&�|j|�y)z<Invoked when an item is successfully and completely fetched.N�rb�r.r^s  rr=zDaemonAcquireProgress.done��������%rc�&�|j|�y)z*Invoked when an item could not be fetched.Nrrrss  r�failzDaemonAcquireProgress.fail�rtrc�&�|j|�y)z0Invoked when some of the item's data is fetched.Nrrrss  r�fetchzDaemonAcquireProgress.fetch�rtrc�&�|j|�y)z�Invoked when an item is confirmed to be up-to-date.

        Invoked when an item is confirmed to be up-to-date. For instance,
        when an HTTP download is informed that the file on the server was
        not modified.
        Nrrrss  r�ims_hitzDaemonAcquireProgress.ims_hit�s��	
����%rc��|jjry|j|j|j|j
|j|jf|j_|j|jzdzt|j
|jz�z}t|j|dz|j|jz
zz�}|j|kDrd|j_
n||j_
||_
g}|jD][}|js�|j!|j|j"|j$�|j'|j��]|j)|�t+j,�j/�rEt+j,�j1�t+j,�j/�r�Ey)z'Callback to update progress informationFgY@r5r4T)r/�	cancelled�
current_items�total_items�
current_bytes�total_bytes�current_cps�elapsed_time�progress_detailsr)r7r*r,r#�workers�current_itemrbr_r`�appendrpr	�main_context_default�pending�	iteration)r.rHr6r#rn�workers      r�pulsezDaemonAcquireProgress.pulse�s������%�%��-1�-?�-?�-1�-=�-=�-1�-?�-?�-1�-=�-=�-1�-=�-=�-1�->�->�-@����)��'�'�$�*<�*<�<��E���)�)�D�,<�,<�<�=�>���t�*�*�W�s�]��)�)�D�,?�,?�?�.A�A�B���=�=�8�#�(+�D���%�(0�D���%�$�D�M����m�m�	.�F��&�&���#�#�F�$7�$7�$*�$5�$5�$*�$7�$7�
9�
�L�L��,�,�-�
	.�	
�!�!�%�(��'�'�)�1�1�3��%�%�'�1�1�3��'�'�)�1�1�3�rc�d�tj|j_d|j_y�z*Callback at the beginning of the operationTN)r�STATUS_DOWNLOADINGr/rI�cancellabler<s r�startzDaemonAcquireProgress.start�s$��"'�":�":�����'+����$rc�~�d|j_|j|j_d|j_y)�$Callback at the end of the operation)rrrrgrFN)r/r�r,r#r�r<s r�stopzDaemonAcquireProgress.stop�s2��,@����)�$(�$5�$5����!�',����$rc��||f|j_d|j_tj|j_|jjr9t
j�j�|jjr�9tj|j_|jjryy)zCallback for media changesTF)r/�required_medium�pausedr�STATUS_WAITING_MEDIUMrIr	r�r�r�r|)r.�medium�drives   r�media_changez"DaemonAcquireProgress.media_change�s���+1�5�=����(�"&�����"'�"=�"=��������%�%��%�%�'�1�1�3����%�%�"'�":�":��������%�%��rN�rr5�rr)r>r?r@rAr&rbrpr=rvrxrzr�r�r�r�rrrrrus?�����<2� &�&�&�&�!�F,�
-�
rrc�,�eZdZdZdd�Zd�Zd�Zdd�Zy)	�DaemonAcquireRepoProgressz*Handle the repository information downloadc��tj||||�tddd��|_tdd�|_d|_y)N�iso_639�iso_639_1_code�iso_639_2T_code)�tag�fallback_tag�iso_3166�alpha_2_coder4)rr&r�	languages�regionsr#rEs    rr&z"DaemonAcquireRepoProgress.__init__s@���&�&�t�[�%��E�!�)�1A�/@�B����
�N�;�����
rc�d�tj|j_d|j_yr�)r�STATUS_DOWNLOADING_REPOr/rIr�r<s rr�zDaemonAcquireRepoProgress.start	s$��"'�"?�"?�����'+����$rc��t�}|D]A}	|j|jj�djd�d��C|rJ|j
jddt|��dj|�z}||j
_
yy#t$r-|j|j
j
d��Y��wxYw)rdr�://����local repositoryzDownloading from %srfN)rgri�description�split�
IndexErrorr/�gettextrjrkrlrm)r.rn�reposr^ras     rrpz.DaemonAcquireRepoProgress._emit_status_detailss�������	H�D�
H��	�	�$�*�*�0�0�2�1�5�;�;�E�B�2�F�G�	H���"�"�+�+�,A�,A�,/��J�8�:=�(�(�5�/�J�C�/2�D���+���	�
H��	�	�$�*�*�2�2�3E�F�G�
H�s�>B�3C�Cc�>
�|jjtjjk(r(t
j}|jj}�n|jjtjjk(rt
j}n�|jjtjjk(rt
j}n�|jjtjjk(rt
j}nR|jjtjjk(rt
j}nt
j }|jjtjjk7r-|jj"r|jj"}n/|jj$r|jj$}nd}|j&j)�dd\}}	|j)d�d}|�d|��}	|j0dk(r |j,j/d	�|	z}�n(|j0d
k(r |j,j/d�|	z}�n�|j0dk(r |j,j/d
�|	z}�n�|j0j3d�r |j,j/d�|	z}�n�|j0j3d�r |j,j/d�|	z}�nT|j0dk(r |j,j/d�|	z}�n%|j0j3d�r�|j0j)dd�d}
	|
j)d�\}
}|j6j9|
|j,j:�}|j<j9||j,j:�}
|r$|
r"|j,j/d�||
|	fz}nP|r!|j,j/d�||	fz}n-|j,j/d�|
|	fz}n|j0}|j>||||jjz||jj@z|f|j,_!y#t*$r|j,j/d�}Y���wxYw#t4$rd}Y��_wxYw)NrGr�r�r
r�rf�	InReleasezStructure of %s�ReleasezDescription of %szRelease.gpgzDescription signature of %s�PackageszAvailable packages from %s�SourceszAvailable sources from %s�TranslationIndexzAvailable translations from %szTranslation-�-r��_z Translations for %s (%s) from %szTranslations for %s from %szTranslations (%s) from %s)"rHrIrJrKrLrrMrNrOrPrQrRrSrTrUrVrWrXrYr�r�r�r/r�r[�
startswith�
ValueErrorr��get_localised_name�localer�rZr\r])r.r^r_r`rIra�host�dist�desc�repo�	lang_code�region_code�lang�regions              rrbz,DaemonAcquireRepoProgress._emit_acquire_item sC���:�:���� 3� 3� =� =�=��(�(�F��:�:�.�.�L�
�Z�Z�
�
�'�"5�"5�"E�"E�
E��.�.�F�
�Z�Z�
�
�'�"5�"5�"C�"C�
C��,�,�F�
�Z�Z�
�
�'�"5�"5�"@�"@�
@��)�)�F�
�Z�Z�
�
�'�"5�"5�"?�"?�
?��(�(�F��1�1�F��J�J����!4�!4�!>�!>�>��
�
�%�%��*�*�'�'�C�
�Z�Z�_�_��*�*�/�/�C��C��%�%�+�+�-�a��2�
��d�	@��:�:�e�$�Q�'�D�
��%���>�>�[�(��#�#�+�+�,=�>��E�D�
�^�^�y�
(��#�#�+�+�,?�@�4�G�D�
�^�^�}�
,��#�#�+�+�-4�5�7;�<�D�
�^�^�
&�
&�z�
2��#�#�+�+�,�.�04�5�D�
�^�^�
&�
&�y�
1��#�#�+�+�+�-�/3�4�D�
�^�^�1�
1��#�#�+�+�-1�2�48�9�D�
�^�^�
&�
&�~�
6����,�,�S�!�4�R�8�I�
#�)2����)=�&�	�;��>�>�4�4�Y�59�5E�5E�5L�5L�N�D��\�\�4�4�[�59�5E�5E�5L�5L�N�F����'�'�/�/�6�8�;?���:N�O����'�'�/�/�15�6�9=�t��E��
�'�'�/�/�15�6�9B�D�8I�J���>�>�D��H�H�f�d�J����1D�1D�$D��4�:�:�1�1�1�3�.8����*��o�	@��#�#�+�+�,>�?�D�	@��>�
#�"��
#�s$� S"�(T
�"$T
�	T
�
T�TNr�r�)r>r?r@rAr&r�rprbrrrr�r��s��4��,�
2�$U8rr�c�`�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)ra	Forks and executes a given method in the child process while
    monitoring the output and return state.

    During the run() call the mainloop will be iterated.

    Furthermore a status file descriptor is available to communicate
    with the child process.
    c�r�||_d|_d|_||_||_d|_d|_d|_tj�\|_
|_ttd�r@tj|jd�tj|jd�d|_d|_y)NrGrr��set_inheritableT)r/rIr#r*r,�_child_exit�
last_activity�	child_pid�os�pipe�status_parent_fd�status_child_fd�hasattrr��output�_line_bufferrEs    rr&zDaemonForkProgress.__init__�s���&��������
�#���������������68�g�g�i�3���t�3��2�(�)����t�4�4�d�;����t�3�3�T�:������rc�&�|j�|Sr)�start_updater<s r�	__enter__zDaemonForkProgress.__enter__�s�������rc�$�|j�yr)�
finish_update)r.�etype�evalue�etbs    r�__exit__zDaemonForkProgress.__exit__�s�����rc���tjd�tj|j_d|j_tj�|_tj�|_	y)NzStart updateT)
r:�debugr�STATUS_COMMITTINGr/rI�
term_attached�timer��
start_timer<s rr�zDaemonForkProgress.start_update�sK���	�	�.�!�"'�"9�"9�����)-����&�!�Y�Y�[����)�)�+��rc�&�d|j_y)r�FN)r/r�r<s rr�z DaemonForkProgress.finish_update�s��).����&rc�b�||�tjd�tjd�y)z�Call the given method or function with the
        corrsponding arguments in the child process.

        This method should be replace in subclasses.
        r rN)r��sleepr��_exit)r.�method�argss   r�_childzDaemonForkProgress._child�s!��	��
��
�
�3��
����rc	�H	�tjd�d}|jjr�	t	j
|jjtjtjztjz�}tj|�}tj|tj�|j!�}|dk(r�t	j"|j$�	|j'�|j(|i|��t1j2d�t	j4t6j8j:�n&||_t	j"|j>�tjd|�g}t@jBt@jDzt@jFz}|jjr?|jItAjJ|t@jL||jN��|jItAjJ|jPt@jL||jR|��|jItAjTt@jL||jV��|jItAjJ|j$t@jLt@jB|jX��|jZdk(r2tAj\�j_�|jZdk(r�2|D]}tAj`|��|r&	tjb|tjd�|jP|j$|fD]}		t	j"|	��t	jh|jZ�S#ttjf$rd|j_Y��CwxYw#t*$rt-j.�Y��wxYw#t1j2d�t	j4t6j8j:�wxYw#tj$rY��wxYw#ttff$rY��wxYw)zxSetup monitoring, fork and call the self._child() method in the
        child process with the given arguments.
        �RunNrGrr
z
Child pid: %sr�)5r:r�r/�terminalr��open�O_RDWR�O_NOCTTY�
O_NONBLOCK�termios�	tcgetattr�tty�setraw�TCSANOW�OSError�error�_fork�closer��_setup_childr��	Exception�	traceback�	print_excr�r�r�rJ�PackageManager�
RESULT_FAILEDr�r�r	�IO_IN�IO_ERR�IO_HUPr��io_add_watch�PRIORITY_HIGH_IDLE�_copy_io�	master_fd�_copy_io_master�child_watch_add�_on_child_exit�_on_status_updater�r�r��
source_remove�	tcsetattr�	TCSADRAIN�	TypeError�WEXITSTATUS)
r.r��kwargs�terminal_fd�
terminal_attr�pid�watchers�flagsrh�fds
          r�runzDaemonForkProgress.run�s{��	�	�	�%�������$�$�	
/�!�g�g�d�&6�&6�&?�&?�&(�i�i�"�+�+�&=��
�
�&M�O�� '� 1� 1�+� >�
��
�
�;����8��j�j�l���!�8��H�H�T�*�*�+�
?��!�!�#�����T�,�V�,�
�
�
�1�
�����/�/�=�=�>� �D�N��H�H�T�)�)�*��	�	�/�3�'����
�
�T�[�[�(�4�;�;�6�����$�$��O�O�D�-�-�k�.2�.E�.E�.3�.2�m�m�=�
>�	����)�)�$�.�.�*.�*A�*A�5�*.�*>�*>��M�	N�	���� � ��!8�!8�!$�d�&9�&9�
;�	<�	����)�)�$�*?�*?�*.�*A�*A�*.�*�*�*.�*@�*@�B�	C����"�$��%�%�'�1�1�3����"�$��	#�B����r�"�	#��
��!�!�+�w�/@�/@�"/�1�
�>�>�4�#8�#8�+�F�	�B�
������	�
�~�~�d�.�.�/�/��w�W�]�]�+�
/�,.�� � �)�
/���
&��#�#�%�
&���
�
�1�
�����/�/�=�=�>��D�=�=�
��
���Y�'�
��
�s[�BO�7"P	� %Q4�"R�*P�P�	P*�&P-�)P*�*P-�-AQ1�4R�
R�R!� R!c�>�tjd|�||_y)NzChild exited: %sF)r:r�r�)r.r�	conditions   rrz!DaemonForkProgress._on_child_exit�s���	�	�$�i�0�$���rc��y)z�Callback for changes on the status file descriptor.

        The method has to return True to keep the monitoring alive. If
        it returns False the monitoring will stop.

        Replace this method in your subclass if you use the status fd.
        Fr)r.�sourcers   rrz$DaemonForkProgress._on_status_update�s��rc�>�tj�\}|_|S)zgFork and create a master/slave pty pair by which the forked process
        can be controlled.
        )r��forkptyr)r.rs  rr�zDaemonForkProgress._fork	s��!�j�j�l���T�^��
rc��d�}tjtj|�tjt_tj�dtjd<tjtjd�|jjr*tjd|jj�|jjs-tjdd�tjdd�ntjd	d
�|jjrxtjd|jj�tjdd
�t j"t$j&k(rCtjdd�n,|jjstjdd�|jj(r4t*j,j/d|jj(�d|jj0�d|jj2�d�}t*j,j/d|�y)z+Setup the environment of the child process.c�^�tjtjj�yr)r�r�rJrr)�signum�frames  r�interrupt_handlerz:DaemonForkProgress._setup_child.<locals>.interrupt_handlers��
�H�H�W�+�+�9�9�:r�1�DPKG_UNTRANSLATED_MESSAGES�C�LANG�APT_LISTCHANGES_FRONTEND�none�APT_LISTBUGS_FRONTEND�TERM�linux�DEBCONF_PIPE�DEBIAN_FRONTEND�passthrough�
DEBCONF_DEBUG�.�noninteractivezAcquire::http::Proxyzaptdaemon role='z
' sender='�'zCommandLine::AsStringN)�signal�SIGINT�sys�__excepthook__�
excepthookr
�quitr��environr��	setlocale�LC_ALLr/�putenvr��debconfr:�level�logging�DEBUG�
http_proxyrJ�configrg�role�sender)r.r$�cmds   rr�zDaemonForkProgress._setup_childs���	;�
	�
�
�f�m�m�%6�7��+�+����
�
��47��
�
�/�0��������,����"�"��I�I�f�d�.�.�5�5�6����(�(�
�I�I�0�&�9��I�I�-�v�6��I�I�f�g�&����#�#��I�I�n�d�&6�&6�&>�&>�?��I�I�'��7��y�y�G�M�M�)��	�	�/�3�/��!�!�*�*��I�I�'�)9�:����&�&��N�N���5�#�/�/�:�:�
<��48�3C�3C�3H�3H�37�3C�3C�3J�3J�L�������2�C�8rc��|tjk(r�tj�|_	t	j
|d�}|jdd�}|dk(r\tjtd|j�}|r-tj|�|xj|dzz
c_d|_
n|xj|z
c_
|r	t	j ||�yy	t	j"|�y	#t$rtjd�YywxYw#t$rtjd�YywxYw#t$rYy	wxYw)
Nr
zFaild to read from masterT�UTF-8�ignore�
rGz'Failed to write to controlling terminalF)r	rr�r�r��readr�r:r��decode�re�sub�REGEX_ANSI_ESCAPE_CODEr��log_terminalr��writer�)r.rr�target�	char_byte�char�lines       rr	z"DaemonForkProgress._copy_io_master>s,����
�
�"�!%����D��
��G�G�F�A�.�	�
�#�#�G�X�6�D��t�|��v�v�4�b�$�:K�:K�L��� �&�&�t�,��K�K�4�$�;�.�K�$&��!��!�!�T�)�!��I��H�H�V�Y�/��	��H�H�V����3�
��	�	�5�6��
��"�I��I�I�G�H��I��
�	���	�s5�C>�D"�(E�>D�D�"E�E�	E�Ec�~�|tjk(r�	tj|d�}tj|j
|�|jjr8|jjr"d|j_	d|j_ytj|�y#t$rY�!wxYw)Nr
FT)r	rr�rLrRrr/r��config_file_conflict�config_file_conflict_resolutionr�r�)r.rrrUs    rrzDaemonForkProgress._copy_io^s�����
�
�"�
��w�w�v�q�)���������.�
�$�$�+�+��(�(�=�=�GK�D�$�$�D�.3�D�$�$�+��
��������
��
�s�6B0�0	B<�;B<N)�2r5)r>r?r@rAr&r�r�r�r�r�rrrr�r�r	rrrrrrxsL���� ��&�/��I0�V�
��,9�\�@rrc�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
rz>Progress to execute APT package operations in a child process.c�j�tj|�tjj	�yr)rr�r�status_lock�releaser<s rr�z"DaemonInstallProgress.start_updatets"���'�'��-���� � �"rc��tj|�tj|jtj
�y)r�N)rr�r�
wait_for_lockr/r]r<s rr�z#DaemonInstallProgress.finish_updatexs,���(�(��.����4�+�+�T�-=�-=�>rc���	|j|j�}tj|�y#tjtj
j�YyxYwr)�
do_installr�r�r�rJrr)r.�pm�ress   rr�zDaemonInstallProgress._child}sG��	��-�-�� 4� 4�5�C�
�H�H�S�M��	;��H�H�W�+�+�9�9�:�s	�3�/A$c�X�tjd�d}	|jd�sTtj�|_|tj|d�jdd�z
}|jd�s�T	|jdd	�\}}}}|j�}|dk(r|j||��nh|dk(rOtjd
|�}	|	�rJ|	jd�|	jd�}}
|j|
|��n|dk(�r|j!d�rt"j$}�n�|j!d�rt"j&}�n�|j!d�rt"j(}�n�|j!d�rt"j*}�nf|j!d�rt"j,}�nC|j!d�rt"j.}�n |j!d�rt"j0}n�|j!d�rt"j2}n�|j!d�rt"j4}n�|j!d�rt"j6}n�|j!d�rt"j8}nv|j!d�rt"j:}nT|j!d�rt"j<}n2|j!d�rt"j>}nt"j@}|jC|tE|�|�|jtFztj�krF|jHr:tjKdtF�tjL|jHd�y
#YyxYw#t$rYy
wxYw) z)Parse messages from APT on the status fd.�UpdateInterfacerGrKr
rIrJF�:�T�pmerror�
pmconffile�\s*'(.*)'\s*'(.*)'.*r��pmstatus�
Installing�	Installed�ConfiguringzPreparing to configurezPreparing for removal of�Removing�RemovedzPreparing to completely removezCompletely removingzCompletely removed�	Unpacking�	PreparingzNoting disappearance of�Runningz#Killing child since timeout of %s s�)'r:r��endswithr�r�r�rLrMr�r��strip�_errorrN�match�group�	_conffiler�r�PKG_INSTALLING�
PKG_INSTALLED�PKG_CONFIGURING�PKG_PREPARING_CONFIGURE�PKG_PREPARING_REMOVE�PKG_REMOVING�PKG_REMOVED�PKG_PREPARING_PURGE�PKG_PURGING�
PKG_PURGED�
PKG_UNPACKING�PKG_PREPARING_INSTALL�PKG_DISAPPEARING�PKG_RUNNING_TRIGGER�PKG_UNKNOWN�_status_changedr)�INSTALL_TIMEOUTr��critical�kill)
r.rr�
status_msgrI�pkgr6�message_raw�messagery�new�old�status_enums
             rrz'DaemonInstallProgress._on_status_update�s����	�	�#�$��
�	� �)�)�$�/�%)�Y�Y�[��"��b�g�g�f�a�0�7�7���J�J�
�!�)�)�$�/�
	�2<�2B�2B�3��2J�/�V�S�'�;��#�#�%���Y���K�K��W�%�
�|�
#��H�H�7��E�E�� �;�;�q�>�5�;�;�q�>�S�����s�C�(�
�z�
!��!�!�,�/�#�2�2���#�#�K�0�#�1�1���#�#�M�2�#�3�3���#�#�$<�=�#�;�;���#�#�$>�?�#�8�8���#�#�J�/�#�0�0���#�#�I�.�#�/�/���#�#�$D�E�#�7�7���#�#�$9�:�#�/�/���#�#�$8�9�#�.�.���#�#�K�0�#�1�1���#�#�K�0�#�9�9���#�#�$=�>�#�4�4���#�#�I�.�#�7�7��#�/�/��� � ��e�G�n�k�B�����0�4�9�9�;�>�����L�L�>�(�
*��G�G�D�N�N�B�'���q	����	��	�s�A$N�?N�N�	N)�(N)c��tjd|||�|j|dz|j|jz
zz}|j|kr!t|�|j_||_tj|�}|jj|�|z}||j_
||f|j_y)z%Callback to update status informationzAPT status: %s, %s, %sr5N)r:r�r*r,r#r7r/r�get_package_status_from_enumr�rm�progress_package)r.r�r6r�r#r�ras       rr�z%DaemonInstallProgress._status_changed�s����	�	�*�C��+�F��&�&��3��$�:K�:K�:>�:M�:M�;N�*O�O���=�=�8�#�(+�H�
�D���%�$�D�M��1�1�+�>�����&�&�t�,�s�2��*-����'�-0�+�,>����)rc��tjd|�d|�d��||f|j_d|j_t
j|j_|jjr9tj�j�|jjr�9tjd|jj�|jjdk(r!tj|jd�n9|jjdk(r tj|jd	�d
|j_d
|j_t
j |j_y)z#Callback for a config file conflictzConfig file prompt: 'z' (�)TzSending config file answer: %s�replacesy
�keepsn
N)r:r;r/rXr�r�!STATUS_WAITING_CONFIG_FILE_PROMPTrIr	r�r�r�rYr�rRrr�)r.�currentr�s   rr{zDaemonInstallProgress._conffile�s�����w��D�E�18�#�����-�"&�����"'�"I�"I��������%�%��%�%�'�1�1�3����%�%��	�	�2��"�"�B�B�	D����;�;�y�H��H�H�T�^�^�V�,�
�
�
�
=�
=��
G��H�H�T�^�^�V�,�;?����8�04����-�"'�"9�"9�����rc�8�tj|�d|���y)zCallback for an errorz: N)r:r�)r.r�ras   rrxzDaemonInstallProgress._error�s������c�*�+rN)r>r?r@rAr�r�r�rr�r{rxrrrrrps*��H�#�?�
�@�D?� �&,rrc�$�eZdZdZdd�Zd�Zd�Zy)rz9Progress handler for a local Debian package installation.c�4�tj||||�yr)rr&rEs    rr&z"DaemonDpkgInstallProgress.__init__�s���&�&�t�[�%��Erc�x�tjddt|j�g}|j	tjjd��|jjs|j	ddg�|j	d|g�tjtjdg|���y)N�Dir::Bin::DPkg�--status-fdz
DPkg::Options�--force-confdef�--force-confoldz-i�
rJrD�strr��extend�
value_listr/r�r��execlp)r.�debfiler�s   rr�z DaemonDpkgInstallProgress._child�s������/�0�-��D�(�(�)�+�����G�N�N�-�-�o�>�?����(�(��K�K�*�,=�>�?����T�7�O�$�
�	�	�'�.�.�!1�2�:�T�:rc���tjd�d}	|jd�s;|tj|d�jdd�z
}|jd�s�;	|j
dd	�D�cgc]}|j���}}|ddk(ry|d
dk(r|j|d|d	�y
|d
dk(rOtjd|d	�}|r4|jd�|jd
�}}|j||�y
|ddk(r#	t|d}	|j%|d
d|	�y
#YyxYwcc}w#t$rYy
wxYw#t$rt j"}	Y�MwxYw)NrfrGrKr
rIrJFrgrhTrrIr�r��conffilerk�
processingr4)r:r�rvr�rLrMr�rwr�rxrNryrzr{�MAP_DPKG_STAGE�KeyErrorr�PKG_UNKONWNr�)
r.rr�
status_rawrrIryr�r�r�s
          rrz+DaemonDpkgInstallProgress._on_status_update�s����	�	�#�$��
�	� �)�)�$�/��b�g�g�f�a�0�7�7���J�J�
�!�)�)�$�/�	�)3�)9�)9�#�q�)A�B�A�a�g�g�i�B�F�B��!�9�� ��a�y�G�#����F�1�I�v�a�y�1�����j�(����!;�V�A�Y�G���$�{�{�1�~�u�{�{�1�~��C��N�N�3��,��
�A�Y�,�
&�
0�,�V�A�Y�7��
� � ����C��=���9	���B���	��	��*�
0�#�/�/��
0�sB�AE�&E�:E�E�E�E�E�	E�E�E7�6E7N)r4r4)r>r?r@rAr&r�rrrrrr�s��C�F�;�"rrc��eZdZdZd�Zy)rz-Progress handler for dpkg --confiure -a call.c�V�tjddt|j�ddg}|j	tjjd��|jjs|j	ddg�tjtjdg|���y)	NzDir::Bin::Dpkgr�z--configurez-az
Dpkg::Optionsr�r�r�r�)r.r�s  rr�z DaemonDpkgRecoverProgress._child(s������/�0�-��D�(�(�)�=�$�@�����G�N�N�-�-�o�>�?����(�(��K�K�*�,=�>�?�
�	�	�'�.�.�!1�2�:�T�:rN�r>r?r@rAr�rrrrr$s
��7�;rrc��eZdZdZd�Zy)�DaemonDpkgReconfigureProgressz+Progress handler for dpkg-reconfigure call.c��dg}|dk7r|jd|g�|j|�tjdg|���y)Nz/usr/sbin/dpkg-reconfigure�defaultz
--priority)r�r�r�)r.�packages�priorityr�s    rr�z$DaemonDpkgReconfigureProgress._child5sA��,�-���y� ��K�K��x�0�1����H��
�	�	�.�6��6rNr�rrrr�r�1s
��5�7rr�)7rA�
__author__�__all__r�rAr��platformrNr5r7r�r�r�r�rJ�apt.progress.baser"�apt.debfile�
gi.repositoryr	rGrr�loopr
�utilsrr��	getLoggerr:rQr�r|r~r�r�r�r��
PKG_UPGRADINGr��chrrPr#r$r%rrDrr��objectrrrrr�rrr�<module>r�sr��+�5�
�>����	��	�
�
����
������������g���*�+�� �w� � �!<�=����"�1�1�$�4�4�!�.�.�#�7�7� �,�,�$�5�5�"�0�0�
2���R��#7�7��6L����*�*�5�5�6L�rF�C�L�L�-�-�=�=�F�Rw8� 5�w8�tu��u�p|,�.�|,�~2� 5�2�j
;� 9�
;�	7�$=�	7r

Zerion Mini Shell 1.0