ó
    8.õg…/  ã                  ó¬   • S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
/ SQr " S S5      r " S S5      r " S	 S
5      r " S S5      rg)zªBase classes for progress reporting.

Custom progress classes should inherit from these classes. They can also be
used as dummy progress classes which simply do nothing.
é    )ÚannotationsN)ÚAcquireProgressÚCdromProgressÚInstallProgressÚ
OpProgressc                  óˆ   • \ rS rSrSrS=r=r=r=rr	S=r
=rrSS jrSS jrSS jrSS jrSS	 jrSS
 jrSS jrSS jrSrg)r   é(   z«Monitor object for downloads controlled by the Acquire class.

This is an mostly abstract class. You should subclass it and implement the
methods to get something useful.
ç        r   c                ó   • g)z<Invoked when an item is successfully and completely fetched.N© ©ÚselfÚitems     Ú3/usr/lib/python3/dist-packages/apt/progress/base.pyÚdoneÚAcquireProgress.done2   ó   � ó    c                ó   • g)z*Invoked when an item could not be fetched.Nr   r   s     r   ÚfailÚAcquireProgress.fail5   r   r   c                ó   • g)z0Invoked when some of the item's data is fetched.Nr   r   s     r   ÚfetchÚAcquireProgress.fetch8   r   r   c                ó   • g)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.
Nr   r   s     r   Úims_hitÚAcquireProgress.ims_hit;   r   r   c                ó   • g)a»  Prompt the user to change the inserted removable media.

The parameter 'media' decribes the name of the media type that
should be changed, whereas the parameter 'drive' should be the
identifying name of the drive whose media should be changed.

This method should not return until the user has confirmed to the user
interface that the media change is complete. It must return True if
the user confirms the media change, or False to cancel it.
Fr   )r   ÚmediaÚdrives      r   Úmedia_changeÚAcquireProgress.media_changeC   s   € ð r   c                ó   • g)aO  Periodically invoked while the Acquire process is underway.

This method gets invoked while the Acquire progress given by the
parameter 'owner' is underway. It should display information about
the current state.

This function returns a boolean value indicating whether the
acquisition should be continued (True) or cancelled (False).
Tr   )r   Úowners     r   ÚpulseÚAcquireProgress.pulseP   s   € ð r   c                ót   • SU l         SU l        SU l        SU l        SU l        SU l        SU l        SU l        g)z0Invoked when the Acquire process starts running.r
   r   N©Úcurrent_bytesÚcurrent_cpsÚcurrent_itemsÚelapsed_timeÚfetched_bytesÚ
last_bytesÚtotal_bytesÚtotal_items©r   s    r   ÚstartÚAcquireProgress.start\   sC   € ð !ˆÔØˆÔØˆÔØˆÔØ ˆÔØˆŒØˆÔØˆÕr   c                ó   • g)z/Invoked when the Acquire process stops running.Nr   r1   s    r   ÚstopÚAcquireProgress.stoph   r   r   r(   N)r   zapt_pkg.AcquireItemDescÚreturnÚNone)r   Ústrr    r9   r7   Úbool)r$   zapt_pkg.Acquirer7   r:   ©r7   r8   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r)   r*   r-   r.   r/   r+   r,   r0   r   r   r   r   r!   r%   r2   r5   Ú__static_attributes__r   r   r   r   r   (   s\   † ñð NQÐP€MÐP�KÐP -ÐP°*¸{Ø12Ð2€MÐ2�L ;ôKô9ô?ôôô
ô
÷>r   r   c                  ó:   • \ rS rSrSrSrS	S jrS
S jrSS jrSr	g)r   él   zúBase class for reporting the progress of adding a cdrom.

Can be used with apt_pkg.Cdrom to produce an utility like apt-cdrom. The
attribute 'total_steps' defines the total number of steps and can be used
in update() to display the current progress.
r   c                ó   • g)zxAsk for the name of the cdrom.

If a name has been provided, return it. Otherwise, return None to
cancel the operation.
Nr   r1   s    r   Úask_cdrom_nameÚCdromProgress.ask_cdrom_namev   r   r   c                ó   • g)zqAsk for the CD-ROM to be changed.

Return True once the cdrom has been changed or False to cancel the
operation.
Fr   r1   s    r   Úchange_cdromÚCdromProgress.change_cdrom}   s   € ð r   c                ó   • g)zªPeriodically invoked to update the interface.

The string 'text' defines the text which should be displayed. The
integer 'current' defines the number of completed steps.
Nr   )r   ÚtextÚcurrents      r   ÚupdateÚCdromProgress.update…   r   r   r   N)r7   z
str | None)r7   r:   )rK   r9   rL   Úintr7   r8   )
r<   r=   r>   r?   r@   Útotal_stepsrE   rH   rM   rA   r   r   r   r   r   l   s   † ñð €Kôô÷r   r   c                  ó²   • \ rS rSrSrSu  rrrrSS jr	SS jr
SS jrSS jrSS jrSS	 jrSS
 jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSrg)r   é�   z4Class to report the progress of installing packages.)r   r
   gš™™™™™¹?Ú c                ó\  • [         R                  " 5       u  U l        U l        [         R                  " U R                  S5      U l        [         R                  " U R                  S5      U l        [        R                  " U R                  [        R                  [         R                  5        g )NÚwÚr)
ÚosÚpipeÚstatusfdÚwritefdÚfdopenÚwrite_streamÚstatus_streamÚfcntlÚF_SETFLÚ
O_NONBLOCKr1   s    r   Ú__init__ÚInstallProgress.__init__’   s`   € Ü(*¯ª«	Ñ%ˆŒ˜œä+-¯9ª9°T·\±\À3Ó+GˆÔÜ,.¯IªI°d·m±mÀSÓ,IˆÔÜ�Š�D—M‘M¤5§=¡=´"·-±-Õ@r   c                ó   • g)z(Abstract) Start update.Nr   r1   s    r   Ústart_updateÚInstallProgress.start_update™   r   r   c                ó   • g)z+(Abstract) Called when update has finished.Nr   r1   s    r   Úfinish_updateÚInstallProgress.finish_updateœ   r   r   c                ó   • U $ ©Nr   r1   s    r   Ú	__enter__ÚInstallProgress.__enter__Ÿ   s   € Øˆr   c                ól   • U R                   R                  5         U R                  R                  5         g rj   )r\   Úcloser]   )r   ÚtypeÚvalueÚ	tracebacks       r   Ú__exit__ÚInstallProgress.__exit__¢   s&   € Ø×Ñ×ÑÔ!Ø×Ñ× Ñ Õ"r   c                ó   • g)z>(Abstract) Called when a error is detected during the install.Nr   )r   ÚpkgÚerrormsgs      r   ÚerrorÚInstallProgress.error¦   r   r   c                ó   • g)zA(Abstract) Called when a conffile question from dpkg is detected.Nr   )r   rL   Únews      r   ÚconffileÚInstallProgress.conffile©   r   r   c                ó   • g)z.(Abstract) Called when the APT status changed.Nr   )r   ru   ÚpercentÚstatuss       r   Ústatus_changeÚInstallProgress.status_change¬   r   r   c                ó   • g)z/(Abstract) Called when the dpkg status changed.Nr   )r   ru   r   s      r   Údpkg_status_changeÚ"InstallProgress.dpkg_status_change¯   r   r   c                ó   • g)zÚ(Abstract) Sent just before a processing stage starts.

The parameter 'stage' is one of "upgrade", "install"
(both sent before unpacking), "configure", "trigproc", "remove",
"purge". This method is used for dpkg only.
Nr   )r   ru   Ústages      r   Ú
processingÚInstallProgress.processing²   r   r   c                ó
  • U R                  5       nUS:X  a`   [        R                  " U R                  S5         [        R
                  " UR                  U R                  R                  5       5      5        X l        U R)                  5       n[        R*                  " U5      $ ! [         a     Nvf = f! [         ab    [        R
                  " [        R                  " [        R                  SSS[        U R                  R                  5       5      SU5      5         N§[         a[  n[        R                  R                  SU-  5        [        R
                  " [         R"                  R$                  5         SnAGNSnAff = f)a¡  Install using the object 'obj'.

This functions runs install actions. The parameter 'obj' may either
be a PackageManager object in which case its do_install() method is
called or the path to a deb file.

If the object is a PackageManager, the functions returns the result
of calling its do_install() method. Otherwise, the function returns
the exit status of dpkg. In both cases, 0 means that there were no
problems.
r   TÚdpkgz--status-fdz-iz%s
N)ÚforkrW   Úset_inheritablerZ   ÚAttributeErrorÚ_exitÚ
do_installr\   ÚfilenoÚspawnlpÚP_WAITr9   Ú	ExceptionÚsysÚstderrÚwriteÚapt_pkgÚPackageManagerÚRESULT_FAILEDÚ	child_pidÚ
wait_childÚWEXITSTATUS)r   ÚobjÚpidÚeÚress        r   ÚrunÚInstallProgress.runº   s!  € ð �i‰i‹kˆØ�!‹8ðô ×"Ò" 4§<¡<°Ô6ð?Ü—’˜Ÿ™¨×(9Ñ(9×(@Ñ(@Ó(BÓCÔDð" ŒØ�o‰oÓˆÜ�~Š~˜cÓ"Ð"øô7 "ó Ùðûô "ó Ü—’Ü—J’JÜŸ	™	ØØØ%Ü˜D×-Ñ-×4Ñ4Ó6Ó7ØØóö
ô ó ?Ü—
‘
× Ñ  ¨!¡Ô,Ü—’œ×/Ñ/×=Ñ=×>Ò>ûð?ús0   ˜!B# º=B3 Â#
B0Â/B0Â3A)FÄ	FÄ'AE=Å=Fc                ó,   • [         R                  " 5       $ )zFork.)rW   r‹   r1   s    r   r‹   ÚInstallProgress.forkê   s   € ä�wŠw‹yÐr   c                óp  •  U R                   R                  5       nS=n=n=n=pgUR                  S5      (       a   UR                  SS5      u  pCpeO†UR                  S5      (       a   UR                  SS5      u  pspEOYUR                  S5      (       aC  UR                  SS5      u  pEnU R                  UR                  5       UR                  5       5        UR                  5       nUR                  5       nUR                  5       nUS	:X  d  US
:X  a  U R                  X55        gUS:X  d  US:X  aP  [        R                  " SU5      nU(       a1  U R!                  UR#                  S5      UR#                  S5      5        ggUS:X  ay  [%        U5      U R&                  :w  d  XPR(                  :w  aP  U R+                  U[%        U5      UR                  5       5        [%        U5      U l        UR                  5       U l        ggUS:X  a  U R-                  X45        gg! [         a[  nUR                  [        R                  :w  a3  UR                  [        R
                  :w  a  [        UR                  5         SnAgSnAff = f! [         a     gf = f! [         a    UR                  SS5      u  psn GNÜf = f)zUpdate the interface.NrS   ÚpmÚ:é   r   é   r‡   Úpmerrorrw   zconffile-promptÚ
pmconffilez\s*'(.*)'\s*'(.*)'.*é   Úpmstatus)r]   ÚreadlineÚOSErrorÚerrnoÚEAGAINÚEWOULDBLOCKÚprintÚstrerrorÚ
startswithÚsplitÚ
ValueErrorr‡   Ústriprw   ÚreÚmatchr{   ÚgroupÚfloatr~   r   r€   rƒ   )	r   ÚlineÚerrÚpkgnamer   Ú
status_strr~   Úbaserº   s	            r   Úupdate_interfaceÚ InstallProgress.update_interfaceî   sP  € ð	Ø×%Ñ%×.Ñ.Ó0ˆDð :<Ð;ˆÐ;�&Ð;˜:Ð;¨à�?‰?˜4× Ñ ðØ9=¿¹ÀCÈÓ9KÑ6� '¨:ð �_‰_˜X×&Ñ&ð=Ø6:·j±jÀÀaÓ6HÑ3� ¨
ð �_‰_˜\×*Ñ*Ø,0¯J©J°s¸AÓ,>Ñ)ˆV Ø�O‰O˜GŸM™M›O¨Z×-=Ñ-=Ó-?Ô@ð —-‘-“/ˆØ×%Ñ%Ó'ˆ
Ø—‘“ˆà�YÓ &¨GÓ"3Ø�J‰J�wÕ+ØÐ(Ó(¨F°lÓ,BÜ—H’HÐ5°zÓBˆEÞØ—‘˜eŸk™k¨!›n¨e¯k©k¸!«nÕ=ð à�zÓ!ä�W‹~ §¡Ó-°¿{¹{Ó1JØ×"Ñ" 7¬E°'«N¸J×<LÑ<LÓ<NÔOÜ$ W›~�”Ø(×.Ñ.Ó0�•ð 2Kð �XÓØ×#Ñ# GÕ4ð øôQ ó 	à�y‰yœEŸL™LÓ(¨S¯Y©Y¼%×:KÑ:KÓ-KÜ�c—l‘lÔ#Üûð		ûô ó áðûô ó =Ø*.¯*©*°S¸!Ó*<Ñ'�£ð=ús;   ‚H ¼J Á)J È
I?È$AI:É:I?Ê
JÊJÊJ5Ê4J5c                ó@  • Su  p  [         R                   " U R                  // / U R                  5        U R                  5          [        R                  " U R                  [        R                  5      u  pXR                  :X  a   U$  M†  ! [         a-  nUR                  u  pEU[
        R                  :w  a  e  SnAN‰SnAff = f! [         aM  nUR
                  [
        R                  :X  a   SnAU$ UR
                  [
        R                  :w  a  e  SnANŽSnAff = f)zïWait for child progress to exit.

This method is responsible for calling update_interface() from time to
time. It exits once the child has exited. The return values is the
full status returned from os.waitpid() (not only the return code).
)r   r   N)Úselectr]   Úselect_timeoutr¯   Úargsr°   ÚEINTRrÂ   rW   Úwaitpidrš   ÚWNOHANGÚECHILD)r   rž   r    rw   Úerrno_Ú_errstrr¾   s          r   r›   ÚInstallProgress.wait_child  sö   € ð ‰
ˆØðÜ—’˜t×1Ñ1Ð2°B¸¸D×<OÑ<OÔPð ×!Ñ!Ô#ðÜŸZšZ¨¯©¼¿
¹
ÓC‘
�ØŸ.™.Ó(Øð ˆ
ð )ñ øô ó Ø$)§J¡JÑ!�ØœUŸ[™[Ó(Øô )ûðûô ó Ø—9‘9¤§¡Ó,Ûð ˆ
ð —9‘9¤§¡Ó+Øô ,ûðús6   ‡.B ÁA C Â
CÂ#B>Â>CÃ
DÃDÃ4DÄD)rš   r~   r   r]   rY   r\   rZ   Nr;   )r7   r   )ro   Úobjectrp   rÏ   rq   rÏ   r7   r8   )ru   r9   rv   r9   r7   r8   )rL   r9   rz   r9   r7   r8   )ru   r9   r~   r¼   r   r9   r7   r8   )ru   r9   r   r9   r7   r8   )ru   r9   r†   r9   r7   r8   )r�   z$apt_pkg.PackageManager | bytes | strr7   rO   )r7   rO   )r<   r=   r>   r?   r@   rš   r~   rÆ   r   ra   rd   rg   rk   rr   rw   r{   r€   rƒ   r‡   r¡   r‹   rÂ   r›   rA   r   r   r   r   r   �   s^   † Ù>à1@Ñ.€Iˆw˜¨ôAô'ô:ôô#ôMôPô=ô>ôô.#ô`ô-5÷^r   r   c                  ó>   • \ rS rSrSrSu  rrrrSS	S jjr	S
S jr
Srg)r   i;  z^Monitor objects for operations.

Display the progress of operations such as opening the cache.)FrS   r
   rS   Nc                ó   • Ub  Xl         gg)zŒCalled periodically to update the user interface.

You may use the optional argument 'percent' to set the attribute
'percent' in this call.
N©r~   )r   r~   s     r   rM   ÚOpProgress.updateB  s   € ð ÑØ"�Lð r   c                ó   • g)z,Called once an operation has been completed.Nr   r1   s    r   r   ÚOpProgress.doneK  r   r   rÒ   rj   )r~   zfloat | Noner7   r8   r;   )r<   r=   r>   r?   r@   Úmajor_changeÚopr~   ÚsuboprM   r   rA   r   r   r   r   r   ;  s"   † ñEð (:Ñ$€L�"�g˜uö#÷;r   r   )r@   Ú
__future__r   r°   r^   ÚiorW   r¹   rÅ   r”   r—   Ú__all__r   r   r   r   r   r   r   Ú<module>rÜ      s[   ðñ(õ
 #ã Û Û 	Û 	Û 	Û Û 
ã â
O€÷A>ñ A>÷Hñ ÷Bkñ k÷\;ò ;r   