403Webshell
Server IP : 209.205.66.10  /  Your IP : 216.73.216.173
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ammon 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User :  ( 1006)
PHP Version : 8.5.8
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/aptdaemon/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/aptdaemon/__pycache__/progress.cpython-310.pyc
o

T@3b���@s�dZdZdZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZddlmZddlmZdd	lmZdd
lmZdd�Ze�d
�Ze�d�ZdZej ej!ej"ej#ej$ej%ej&d�Z'e(d�dZ)Gdd�dej*j+j,�Z-Gdd�dej*j+j.�Z/Gdd�de/�Z0Gdd�de1�Z2Gdd�de2�Z3Gdd�de3�Z4Gdd �d e4�Z5Gd!d"�d"e4�Z6dS)#z$Progress handlers for APT operationsz%Sebastian Heinlein <devel@glatzor.de>)�DaemonAcquireProgress�DaemonOpenProgress�DaemonInstallProgress�DaemonDpkgInstallProgress�DaemonForkProgress�DaemonDpkgRecoverProgress�N)�GLib�)�enums)�lock)�mainloop)�IsoCodescCs|S�N�)�srr�4/usr/lib/python3/dist-packages/aptdaemon/progress.py�<lambda>*srzAptDaemon.WorkerzAptDaemon.Worker.TerminaliX)�install�	configure�remove�trigproc�purge�	disappear�upgrade�z\[[;?0-9]*[A-Za-z]c@s,eZdZdZddd�Zd
dd	�Zd
d�ZdS)rz*Handles the progress of the cache opening.r�dFcsTtjjj�|�||_��fdd�dD�|_t��|_|j�	d�|_
d|_||_dS)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
        csg|]
}���|�qSrr)�.0�modifier��begin�endrr�
<listcomp>Ks�z/DaemonOpenProgress.__init__.<locals>.<listcomp>)g�?��?g�?��?r#rN)�apt�progress�base�
OpProgress�__init__�_transaction�steps�float�progress_begin�pop�progress_end�quiet)�self�transactionrr r/rrrr(@s	�

zDaemonOpenProgress.__init__NcCs`|p|j}|dkr t|j|d|j|j�}|j|krdSnd}||_|js.||j_dSdS)zpCallback for progress updates.

        Keyword argument:
        percent - current progress in percent
        �erN)�percent�intr,r.r%r/r))r0r3r%rrr�updateTs

�
��zDaemonOpenProgress.updatecCs<|j|_|j|_z
|j�d�|_WdSt�d�YdS)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�r0rrr�donegszDaemonOpenProgress.done)rrFr)�__name__�
__module__�__qualname__�__doc__r(r5r9rrrrr<s


rc@sleZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rz-
    Handle the package download process
    rrcCs,tjjj�|�||_||_||_d|_dS)Nr)r$r%r&�AcquireProgressr(r1r.r,�r0r1rr rrrr(ys

zDaemonAcquireProgress.__init__cCs�|jjtjjkrtj}|jj}n3|jjtjjkrtj	}n'|jjtjj
kr(tj}n|jjtjjkr4tj
}n|jjtjjkr@tj}ntj}|jjtjjkrT|jjrT|jj}n|jjr]|jj}nd}|j||j||jjB||jjB|f|j_dS)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�partialsizer1�progress_download)r0�item�
total_size�current_sizerB�msgrrr�_emit_acquire_item�s0
�




�z(DaemonAcquireProgress._emit_acquire_itemcCsjt�}|D]}|jjr|�|jj�q|�|j�q|r3|j�ddt|��dd�|�i}||j_	dSdS)�$Emit the transaction status details.zDownloading %(files)s�files� N)
�setrA�id�addrTr1�ngettext�len�join�status_details)r0�items�namesrWrZrrr�_emit_status_details�s ����z*DaemonAcquireProgress._emit_status_detailscC�|�|�dS)z<Invoked when an item is successfully and completely fetched.N�r[�r0rWrrrr9��zDaemonAcquireProgress.donecCri)z*Invoked when an item could not be fetched.Nrjrkrrr�fail�rlzDaemonAcquireProgress.failcCri)z0Invoked when some of the item's data is fetched.Nrjrkrrr�fetch�rlzDaemonAcquireProgress.fetchcCri)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.
        Nrjrkrrr�ims_hit�szDaemonAcquireProgress.ims_hitcCs�|jjrdS|j|j|j|j|j|jf|j_|j|jdt	|j|j�}t
|j|d|j|j�}|j
|kr?d|j_
n||j_
||_
g}|jD]}|jsQqK|�|j|j|j�|�|j�qK|�|�t����ryt����t����smdS)z'Callback to update progress informationFgY@rr2T)r1�	cancelled�
current_items�total_items�
current_bytes�total_bytes�current_cps�elapsed_time�progress_detailsr+r4r,r.r%�workers�current_itemr[rXrY�appendrhr�main_context_default�pending�	iteration)r0rAr3r%rf�workerrrr�pulse�sB��
�


�
�zDaemonAcquireProgress.pulsecC�tj|j_d|j_dS�z*Callback at the beginning of the operationTN)r
�STATUS_DOWNLOADINGr1rB�cancellabler8rrr�start��
zDaemonAcquireProgress.startcCsd|j_|j|j_d|j_dS)�$Callback at the end of the operation)rrrrgrFN)r1rwr.r%r�r8rrr�stop�s
zDaemonAcquireProgress.stopcCsT||f|j_d|j_tj|j_|jjrt����|jjstj	|j_|jj
r(dSdS)zCallback for media changesTF)r1�required_medium�pausedr
�STATUS_WAITING_MEDIUMrBrr{r}r�rp)r0�medium�driverrr�media_change�s
�
z"DaemonAcquireProgress.media_changeN�rr�rr)r:r;r<r=r(r[rhr9rmrnrorr�r�r�rrrrrus

	#rc@s4eZdZdZd
dd�Zdd�Zdd	�Zdd
d�ZdS)�DaemonAcquireRepoProgressz*Handle the repository information downloadrrcCs6t�||||�tdddd�|_tdd�|_d|_dS)N�iso_639�iso_639_1_code�iso_639_2T_code)�tag�fallback_tag�iso_3166�alpha_2_coder2)rr(r
�	languages�regionsr%r?rrrr(s�
z"DaemonAcquireRepoProgress.__init__cCr�r�)r
�STATUS_DOWNLOADING_REPOr1rBr�r8rrrr�	r�zDaemonAcquireRepoProgress.startc	Cs�t�}|D]%}z|�|j��d�d�d�Wqty*|�|j�d��Yqw|rB|j�ddt|��d�	|�}||j_
dSdS)r\r�://����local repositoryzDownloading from %sr^N)r_ra�description�split�
IndexErrorr1�gettextrbrcrdre)r0rf�reposrWrZrrrrhs "����z.DaemonAcquireRepoProgress._emit_status_detailscCs�|jjtjjkrtj}|jj}n3|jjtjjkrtj	}n'|jjtjj
kr(tj}n|jjtjjkr4tj
}n|jjtjjkr@tj}ntj}|jjtjjkrT|jjrT|jj}n|jjr]|jj}nd}|j��dd�\}}z	|�d�d}Wnty�|j�d�}Ynwd||f}	|jdkr�|j�d	�|	}n�|jd
kr�|j�d�|	}n�|jdkr�|j�d
�|	}n�|j�d�r�|j�d�|	}n�|j�d�r�|j�d�|	}nt|jdkr�|j�d�|	}nf|j�d��rB|j�dd�d}
z	|
�d�\}
}Wnt�yd}Ynw|j�|
|jj�}|j�||jj�}
|�r)|
�r)|j�d�||
|	f}n|�r7|j�d�||	f}n|j�d�|
|	f}n|j}|j||||jjB||jj B|f|j_!dS)Nr@r�r�r	r�z%s %s�	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)"rArBrCrDrEr
rFrGrHrIrJrKrLrMrNrOrPrQrRr�r�r�r1r�rT�
startswith�
ValueErrorr��get_localised_name�localer�rSrUrV)r0rWrXrYrBrZ�host�dist�desc�repo�	lang_code�region_code�lang�regionrrrr[ s�
�

�



�����

������
�
��z,DaemonAcquireRepoProgress._emit_acquire_itemNr�r�)r:r;r<r=r(r�rhr[rrrrr��s
r�c@szeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) 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.
    �2rcCsv||_d|_d|_||_||_d|_d|_d|_t�	�\|_
|_ttd�r3t�
|j
d�t�
|jd�d|_d|_dS)Nr@rr��set_inheritableT)r1rBr%r,r.�_child_exit�
last_activity�	child_pid�os�pipe�status_parent_fd�status_child_fd�hasattrr��output�_line_bufferr?rrrr(�s

zDaemonForkProgress.__init__cCs|��|Sr)�start_updater8rrr�	__enter__�szDaemonForkProgress.__enter__cCs|��dSr)�
finish_update)r0�etype�evalue�etbrrr�__exit__�szDaemonForkProgress.__exit__cCs4t�d�tj|j_d|j_t��|_t��|_	dS)NzStart updateT)
r6�debugr
�STATUS_COMMITTINGr1rB�
term_attached�timer��
start_timer8rrrr��s



zDaemonForkProgress.start_updatecCsd|j_dS)r�FN)r1r�r8rrrr��sz DaemonForkProgress.finish_updatecGs ||�t�d�t�d�dS)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)r0�method�argsrrr�_child�s
zDaemonForkProgress._childc

OsXt�d�d}|jjr9zt�|jjtjtjBtjB�}t	�
|�}t�|t	j
�Wntt	jfy8d|j_Ynw|��}|dkrt�|j�z*z|��|j|i|��Wn
tyct��YnwWt�d�t�tjj�nt�d�t�tjj�w||_t�|j�t�d|�g}t j!t j"Bt j#B}|jjr�|�$t �%|t j&||j'��|�$t �%|j(t j&||j)|��|�$t �*t j&||j+��|�$t �%|jt j&t j!|j,��|j-dkr�t �.��/�|j-dks�|D]}t �0|�q�|�rz
t	�1|t	j2|�Wnt	j�yYnw|j(|j|fD]}	zt�|	�W�qtt3f�y%Y�qwt�4|j-�S)zxSetup monitoring, fork and call the self._child() method in the
        child process with the given arguments.
        �RunNr@rr	z
Child pid: %sr�)5r6r�r1�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�rC�PackageManager�
RESULT_FAILEDr�r�r�IO_IN�IO_ERR�IO_HUPrz�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)
r0r��kwargs�terminal_fd�
terminal_attr�pid�watchers�flagsr`�fdrrr�run�s�

�
���

�
�����

�
���zDaemonForkProgress.runcCst�d|�||_dS)NzChild exited: %sF)r6r�r�)r0r��	conditionrrrr��sz!DaemonForkProgress._on_child_exitcCsdS)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)r0�sourcerrrrr��sz$DaemonForkProgress._on_status_updatecCst��\}|_|S)zgFork and create a master/slave pty pair by which the forked process
        can be controlled.
        )r��forkptyr�)r0r�rrrr�	szDaemonForkProgress._forkcCsdd�}t�tj|�tjt_t��dtjd<t	�
t	jd�|jj	r+t�
d|jj	�|jjs<t�
dd�t�
d	d�nt�
d
d�|jjrat�
d|jj�t�
d
d�tjtjkr`t�
dd�n
|jjskt�
d
d�|jjrxtj�d|jj�d|jj|jjf}tj�d|�dS)z+Setup the environment of the child process.cSst�tjj�dSr)r�r�rCr�r�)�signum�framerrr�interrupt_handlersz:DaemonForkProgress._setup_child.<locals>.interrupt_handler�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='%s' sender='%s'zCommandLine::AsStringN)�signal�SIGINT�sys�__excepthook__�
excepthookr�quitr��environr��	setlocale�LC_ALLr1�putenvr��debconfr6�level�logging�DEBUG�
http_proxyrC�configr_�role�sender)r0r�cmdrrrr�s8
���zDaemonForkProgress._setup_childcCs�|tjkrlt��|_zt�|d�}Wnty!t�d�YdSw|�	dd�}|dkrHt
�td|j
�}|rDt�|�|j|d7_d|_
n|j
|7_
|rjz	t�||�WdStyit�d�YdSwdSzt�|�Wd	Sty~Yd	Sw)
Nr	zFaild to read from masterT�UTF-8�ignore�
r@z'Failed to write to controlling terminalF)rr�r�r�r��readr�r6r��decode�re�sub�REGEX_ANSI_ESCAPE_CODEr��log_terminalr��writer�)r0rr�target�	char_byte�char�linerrrr�>s@


�
����z"DaemonForkProgress._copy_io_mastercCsn|tjkr0zt�|d�}t�|j|�Wn	tyYnw|jjr.|jj	r.d|j_
d|j_dSt�|�dS)Nr	FT)rr�r�r,r2r�r�r1r��config_file_conflict�config_file_conflict_resolutionr�)r0rrr5rrrr�^s
��
zDaemonForkProgress._copy_ioN)r�r)r:r;r<r=r(r�r�r�r�r�rr�r�r�r�r�r�rrrrrxs
	
K
. rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rz>Progress to execute APT package operations in a child process.cCst�|�tj��dSr)rr�r�status_lock�releaser8rrrr�ts
z"DaemonInstallProgress.start_updatecCst�|�t�|jtj�dS)r�N)rr�r�
wait_for_lockr1r9r8rrrr�xs
z#DaemonInstallProgress.finish_updatecCs:z|�|j�}Wn
t�tjj�YdSt�|�dSr)�
do_installr�r�r�rCr�r�)r0�pm�resrrrr�}s
zDaemonInstallProgress._childc
Cs4t�d�d}z|�d�s#t��|_|t�|d��dd�7}|�d�r
WnYdSz|�dd	�\}}}}Wn
t	yAYd
Sw|�
�}|dkrQ|�||�n�|dkrot�
d
|�}	|	rn|	�d�|	�d�}
}|�|
|�n�|dkr�|�d�r|tj}nx|�d�r�tj}no|�d�r�tj}nf|�d�r�tj}n]|�d�r�tj}nT|�d�r�tj}nK|�d�r�tj}nB|�d�r�tj}n9|�d�r�tj}n0|�d�r�tj}n'|�d�r�tj}n|�d�r�tj}n|�d�r�tj}n|�d�r�tj}ntj }|�!|t"|�|�|jt#t��k�r|j$�rt�%dt#�t�&|j$d�d
S) z)Parse messages from APT on the status fd.�UpdateInterfacer@r+r	r)r*F�:�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�)'r6r��endswithr�r�r�r,r-r�r��strip�_errorr.�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)
r0rr�
status_msgrB�pkgr3�message_raw�messagerR�new�old�status_enumrrrr��s~



����













��z'DaemonInstallProgress._on_status_updatecCsxt�d|||�|j|d|j|j}|j|kr#t|�|j_||_t�|�}|j�	|�|}||j_
||f|j_dS)z%Callback to update status informationzAPT status: %s, %s, %srN)r6r�r,r.r%r4r1r
�get_package_status_from_enumr�re�progress_package)r0rir3rnr%r�rZrrrrd�s�

z%DaemonInstallProgress._status_changedcCs�t�d||f�||f|j_d|j_tj|j_|jjr&t�	��
�|jjst�d|jj�|jjdkr<t
�|jd�n
|jjdkrIt
�|jd�d|j_d|j_tj|j_dS)	z#Callback for a config file conflictzConfig file prompt: '%s' (%s)TzSending config file answer: %s�replacesy
�keepsn
N)r6r7r1r7r�r
�!STATUS_WAITING_CONFIG_FILE_PROMPTrBrr{r}r�r8r�r2r�r�)r0�currentrlrrrrT�s$
��
zDaemonInstallProgress._conffilecCst�d||f�dS)zCallback for an errorz%s: %sN)r6rf)r0rirZrrrrQ�szDaemonInstallProgress._errorN)r:r;r<r=r�r�r�r�rdrTrQrrrrrpsBrc@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)rz9Progress handler for a local Debian package installation.r2cCst�||||�dSr)rr(r?rrrr(�sz"DaemonDpkgInstallProgress.__init__cCshtjddt|j�g}|�tj�d��|jjs|�ddg�|�d|g�tj	tjdg|�R�dS)N�Dir::Bin::DPkg�--status-fdz
DPkg::Options�--force-confdef�--force-confoldz-i�
rCr%�strr��extend�
value_listr1r�r��execlp)r0�debfiler�rrrr��s
�z DaemonDpkgInstallProgress._childc	Cs>t�d�d}z|�d�s|t�|d��dd�7}|�d�r
WnYdSz
dd	�|�d
d�D�}Wn
ty=YdSw|d
dkry|ddkrV|�|d|d�dS|ddkrwt	�
d|d�}|rw|�d�|�d�}}|�||�dS|d
dkr�zt
|d}Wnty�tj}Ynw|�|dd|�dS)Nr?r@r+r	r)r*FcSsg|]}|���qSr)rP)rrrrrr!sz?DaemonDpkgInstallProgress._on_status_update.<locals>.<listcomp>r@rATrrBr�r��conffilerD�
processingr2)r6r�rOr�r,r-r�r�rQr.rRrSrT�MAP_DPKG_STAGE�KeyErrorr
�PKG_UNKONWNrd)	r0rr�
status_rawrBrRrlrmrnrrrr��s@


���	��
�z+DaemonDpkgInstallProgress._on_status_updateN)r2r2)r:r;r<r=r(r�r�rrrrr�s

	rc@�eZdZdZdd�ZdS)rz-Progress handler for dpkg --confiure -a call.cCs^tjddt|j�ddg}|�tj�d��|jjs!|�ddg�tj	tjdg|�R�dS)	NzDir::Bin::Dpkgrvz--configurez-az
Dpkg::Optionsrwrxrury)r0r�rrrr�(s
�z DaemonDpkgRecoverProgress._childN�r:r;r<r=r�rrrrr$�rc@r�)�DaemonDpkgReconfigureProgressz+Progress handler for dpkg-reconfigure call.cCs<dg}|dkr|�d|g�|�|�tjdg|�R�dS)Nz/usr/sbin/dpkg-reconfigure�defaultz
--priority)r{r�r})r0�packages�priorityr�rrrr�5s

z$DaemonDpkgReconfigureProgress._childNr�rrrrr�1r�r�)7r=�
__author__�__all__r�r"r��platformr.rrr�r�r�r�rC�apt.progress.baser$�apt.debfile�
gi.repositoryrr@r
r�loopr�utilsr
r��	getLoggerr6r1rerUrWrZrbr]ra�
PKG_UPGRADINGr��chrr0r%r&r'rr>rr��objectrrrrr�rrrr�<module>sZ


�9
zy5

Youez - 2016 - github.com/yon3zu
LinuXploit