+
    jc@                     ^   ^RI Ht ^RI Ht ^RIHt ^ RIt^ RIH	t	 ^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^RIHt  ]P&                  ! ]P(                  R4       ]P*                  ! 4       w  tt]'       g4   R	t]P2                  ! R
R4        ]P&                  ! ]P4                  R4       ]P8                  ! R]P:                  ! 4       ,          4       R t ! R R]P>                  P@                  PB                  4      t! ! R R]P>                  P@                  PD                  4      t" ! R R]#4      t$ ! R R]#4      t% ! R R]	4      t&]! R4      ]! R4      ]! R4      ]! R4      ]! R4      3  ! R R]#4      t'R#    ]P0                  ! R4       R	t EL$; i  ]P6                   d     Li ; i)   )gettext)ngettext)getN)Enum)apport_pkgfailure zgetting the encoding failedzutf-8LC_CTYPEzC.UTF-8zlocale: '%s' '%s'c                   \        V 4      p V R,          pV R,          ^,          pV ^<,          ^<,          pV ^<,          pV^ 8X  d   ^pRRRRRRRR/pV^ 8  d   \        RRV4      V,          VR&   V^ 8  d   \        RR	V4      V,          VR&   V^ 8  d   \        R
RV4      V,          VR&   \        RRV4      V,          VR&   V^ 8  d*   VR,          R8X  d
   VR,          # \        R4      V,          # V^8  d
   VR,          # V^ 8  d*   VR,          R8X  d
   VR,          # \        R4      V,          # V^ 8  d
   VR,          # VR,          # )z:return the time a bit fuzzy (no seconds if time > 60 secs str_daysr   	str_hoursstr_minutesstr_secondsz%li dayz%li daysz%li hourz	%li hoursz
%li minutez%li minutesz
%li secondz%li secondsz%(str_days)s %(str_hours)sz%(str_hours)s %(str_minutes)si  iQ )intr   _)secdayshoursminutessecondsmaps   &     =/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeView.pyFuzzyTimeToStrr   ;   sm    	C#	x$
,
%"WN'"H'\G r

"
"	
# 
AXyT:TAC
O
QY
;>FCq[!,}gFPC]GDwN#m 
AX
;2: )*S00qy{qy
=R; ,-33{}	]	    c                   l   a a ] tR t^t oV 3R ltV 3R ltV 3R ltR tR	V 3R lltR t	R t
RtVtV ;t# )
AcquireProgressc                :   < \         \        V `  4        R V n        R# )        N)superr   __init__	est_speedself	__class__s   &r   r   AcquireProgress.__init__   s    	/4)+DNr   c                d   < \         \        V `  4        R V n        R V n        R V n        RV n        R# )r   FN)r   r   startr    etapercentrelease_file_download_errorr!   s   &r   r&   AcquireProgress.start   s-    	/4&(DNDHDL',D$r   c                L  < \         \        V `  WW44       V\        P                  8X  dz   \
        P                  ! R V,          4       VP                  R4      '       g   VP                  R4      '       d-   R F$  pVP                  V4      '       g   K  RV n	         R# 	  R# R# R# )z update_status: dlFailed on '%s' zRelease.gpgReleaseTN)httpftpmirror)
r   r   update_statusapt_pkgSTAT_FAILEDloggingwarningendswith
startswithr)   )r"   uridescr
shortDescrstatusnetr#   s   &&&&& r   r0   AcquireProgress.update_status   s    	/4.s:N $$$oo83>?	m	$	$Y(?(? +C^^C  /3D, + )@ %r   c                    R # )T )r"   args   &&r   pulse_itemsAcquireProgress.pulse_items   s    r   c                  < \         \        V `  V4       V P                  V P                  ,           R ,          \        V P                  V P                  ,           4      ,          V n        V P                  V P                  8  d*   V P                  V P                  ,           R,          V n
        V P                  ^ 8  d=   V P                  V P                  ,
          \        V P                  4      ,          V n        R# )g      Y@g       @T)r   r   pulsecurrent_bytescurrent_itemsfloattotal_bytestotal_itemsr(   current_cpsr    r'   )r"   ownerr#   s   &&r   rC   AcquireProgress.pulse   s    	/4&u-((4+=+==F$**T-=-==>?DL$..(t'7'77<dn!##d&8&88(()*dhr   c                     V P                   ^ 8g  # )    )r    r"   s   &r   isDownloadSpeedEstimated(AcquireProgress.isDownloadSpeedEstimated   s    NNa r   c                    V P                   ^ 8X  d;   VR,          pVR,          p\        R4      \        V4      \        V4      3,          pV# \        R4      \        WP                   ,          4      ,          pV# )z get the estimated download time z_This download will take about %s with a 40Mbit connection and about %s with a 5Mbit connection.z7This download will take about %s with your connection. g    #Ag    SA)r    r   r   )r"   required_download	time5Mbit
time40Mbitss   &&   r   estimatedDownloadTime%AcquireProgress.estimatedDownloadTime   st    ~~#]3i$n5j	
 3 
47Ej7QSabkSl6m
nah	
CD~VghvhvVvGwwAHr   )r    r'   r(   r)   N)__name__
__module____qualname____firstlineno__r   r&   r0   r@   rC   rO   rV   __static_attributes____classdictcell____classcell__)r#   __classdict__s   @@r   r   r      s-     -	!
 
r   r   c                   <   a  ] tR t^t o RtR tR tR tR tRt	V t
R# )InstallProgresszVBase class for InstallProgress that supports some fancy
stuff like apport integration
c                z    \         P                  P                  P                  P	                  V 4       R V n        R # rX   )aptprogressbaserb   r   	master_fdrN   s   &r   r   InstallProgress.__init__   s'    LL%%..t4DNr   c                `     \         P                   ! V P                  .. . V P                  4       V P                  4         \        P                  ! V P                  \        P                  4      w  r#W P                  8X  d    V# K    \         P                   d2   pTP                  ^ ,          \
        P                  8w  d   h  Rp?LRp?ii ; i  \         dR   pTP
                  \
        P                  8w  d   h TP
                  \
        P                  8X  d    Rp?X#  Rp?EK'  Rp?ii ; i)z~Wait for child progress to exit.

The return values is the full status returned from os.waitpid()
(not only the return code).
N)selectstatusfdselect_timeouterrorargserrnoEINTRupdate_interfaceoswaitpid	child_pidWNOHANGOSErrorECHILD)r"   epidress   &   r   
wait_childInstallProgress.wait_child   s     mmT]]ORT5H5HI 


!::dnnbjjAjs& j '  ekk) *  EKK'ELL(j )s0   .B AC C'C		CD-?D((D-c                   V P                  4       pV^ 8X  df   \        P                  ! \        P                  \        P                  4        VP	                  V P
                  4      p\        P                  ! X4       W n        \        P"                  ! V P%                  4       4      pV#   \         d   p\        RT4       \        P                  ! R4       \        RR4      ;_uu_ 4       pTP                  \        T4      4       RRR4       M  + '       g   i     M; i\        P                  ! TP                  4        Rp?LRp?ii ; i)rM   z!Exception during pm.DoInstall(): zException during pm.DoInstall()z./var/run/ubuntu-release-upgrader-apt-exceptionwN)forksignalSIGPIPESIG_IGN
do_installwritefd	Exceptionprintr3   	exceptionopenwritestrrr   _exitRESULT_FAILEDrt   WEXITSTATUSr{   )r"   pmry   rz   rx   fs   &&    r   runInstallProgress.run   s    
))+C
ax mmFNN6>>2#mmDLL) 	hhsmN
..*
+CJ  #115;<B3GG1GGCFO HGGG
!!""#s0   B) )E46E*D	ED(EEc                   \         P                  P                  P                  P	                  WV4       \
        P                  ! RV: RV: R24       RV9   d    \        P                  P                  V4      pVP                  R4      ^ ,          P                  4       '       d(   RP                  VP                  R4      R,          4      pRV9   d   VP                  R4      ^ ,          p\        W4       R# )	zinstall error from a package z!got an error from dpkg for pkg: 'z': ''/-:r   NNr   N)rd   re   rf   rb   rm   r3   rr   pathbasenamesplitisdigitjoinr   )r"   pkgerrormsgs   &&&r   rm   InstallProgress.error   s    LL%%++Dx@MM#xPQ
czGGS!c
yy~a  ""JJsyy~b)*c
czIIcN1cc$r   )rt   rg   N)rY   rZ   r[   r\   __doc__r   r{   r   rm   r]   r^   r`   s   @r   rb   rb      s#     0&% %r   rb   c                   *   a  ] tR t^t o RR ltRtV tR# )DumbTerminalc                0    ^ RI pVP                  V4       R# )z6expects a command in the subprocess style (as a list) N)
subprocesscall)r"   cmdhiddenr   s   &&& r   r   DumbTerminal.call   s    r   r>   NF)rY   rZ   r[   r\   r   r]   r^   r   s   @r   r   r      s      r   r   c                   2   a  ] tR t^t o R tR tR tRtV tR# )SampleHtmlViewc                    R # rX   r>   )r"   urls   &&r   r   SampleHtmlView.open   s    r   c                    R # rX   r>   rN   s   &r   showSampleHtmlView.show       
r   c                    R # rX   r>   rN   s   &r   hideSampleHtmlView.hide   r   r   r>   N)	rY   rZ   r[   r\   r   r   r   r]   r^   r   s   @r   r   r      s      r   r   c                   2    ] tR tRt^t^t^t^t^t^t	^t
RtR# )Stepi  r>   N)rY   rZ   r[   r\   PREPAREMODIFY_SOURCESFETCHINSTALLCLEANUPREBOOTNr]   r>   r   r   r   r     s%    GNEGGF	Ar   r   zPreparing to upgradezGetting new software channelszGetting new packageszInstalling the upgradeszCleaning upc                      a  ] tR tRt o RtR tR tR tRR ltR t	R	 t
R
 tR tR tR tR tRR ltRR ltRR ltR tR tR tRR ltRR ltR tRR ltRtV tR# )DistUpgradeViewi  z!abstraction for the upgrade view c                    R V n         R# )FN)needs_screenrN   s   &r   r   DistUpgradeView.__init__  s    !r   c                R    \         P                  P                  P                  4       # )z4return a OpProgress() subclass for the given graphic)rd   re   rf   
OpProgressrN   s   &r   getOpCacheProgress"DistUpgradeView.getOpCacheProgress  s    ||  ++--r   c                    \        4       # )z"return an acquire progress object )r   rN   s   &r   getAcquireProgress"DistUpgradeView.getAcquireProgress        r   Nc                    \        4       # )z!return a install progress object )rb   )r"   caches   &&r   getInstallProgress"DistUpgradeView.getInstallProgress   r   r   c                    \        4       # rX   )r   rN   s   &r   getTerminalDistUpgradeView.getTerminal#  s
    ~r   c                    \        4       # rX   )r   rN   s   &r   getHtmlViewDistUpgradeView.getHtmlView%  s    r   c                    R# )zGupdate the current status of the distUpgrade based
on the current view
Nr>   )r"   msgs   &&r   updateStatusDistUpgradeView.updateStatus'  s     	r   c                    R# )z7provide a visual feedback that the upgrade was aborted Nr>   rN   s   &r   abortDistUpgradeView.abort,      r   c                L    \        4       P                  VP                  4       R# )zwe have 6 steps current for a upgrade:
1. Analyzing the system
2. Updating repository information
3. fetch packages
3. Performing the upgrade
4. Post upgrade stuff
5. Complete
N)get_telemetry	add_stagenamer"   steps   &&r   setStepDistUpgradeView.setStep/  s     	!!$)),r   c                    R# )z!hide a certain step from the GUI Nr>   r   s   &&r   hideStepDistUpgradeView.hideStep:  r   r   c                    R# )z!show a certain step from the GUI Nr>   r   s   &&r   showStepDistUpgradeView.showStep=  r   r   c                   RV n         . V n        . V n        . V n        . V n        . V n        . V n        V EFC  pVP                  '       d   V P                  P                  V4       K3  VP                  '       d   V P                  P                  V4       Kb  VP                  '       d   V P                  P                  V4       K  VP                  '       dq   VP                  P                  P                  VP                  4      '       d   V P
                  P                  V4       K  V P                  P                  V4       EK  VP                   '       g   EK(  V P                  P                  V4       EKF  	  V P                  V P                  ,           V n        V P                  P#                  4        V P                  P#                  4        V P                  P#                  4        V P
                  P#                  4        V P                  P#                  4        Rp\%        V P                  4      \%        V P
                  4      ,           p\%        V P                  4      \%        V P                  4      ,           p	\%        V P                  4      p
V^ 8  d%   V\'        RRV4      V,          ,          pVR,          pV	^ 8  d%   V\'        RRV	4      V	,          ,          pVR,          pV
^ 8  d%   V\'        RR	V
4      V
,          ,          pVR,          pV^ 8  d   \(        P*                  ! V4      p\-        V\.        4      '       d   VP1                  \2        4      pV\5        R
4      V,          ,          pWpP7                  4       P9                  V4      ,          pW,           ^ 8  dm   W,           V,           ^d8  dY   V P7                  4       P;                  4       '       d   VR\5        R4      ,          ,          pM:VR\5        R4      ,          ,          pM V^d8  d   VR\5        R4      ,          ,          pW,           V,           ^8  d*   \5        R4      p\5        R4      pV P=                  W4       R# Wpn         R# )zXdisplay the list of changed packages (apt.Package) and
return if the user confirms them
r   
z"%d package is going to be removed.z$%d packages are going to be removed. z(%d new package is going to be installed.z*%d new packages are going to be installed.z#%d package is going to be upgraded.z%%d packages are going to be upgraded.z&

You have to download a total of %s. z

%sznInstalling the upgrade can take several hours. Once the download has finished, the process cannot be canceled.z{Fetching and installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled.z.Removing the packages can take several hours. z,The software on this computer is up to date.zRThere are no upgrades available for your system. The upgrade will now be canceled.FT)confirmChangesMessage	toInstalltoReinstall	toUpgradetoRemovetoRemoveAutotoDowngrademarked_installappendmarked_upgrademarked_reinstallmarked_delete_pcache	_depcacheis_auto_installed_pkgmarked_downgradesortlenr   r1   size_to_str
isinstancebytesdecodeENCODINGr   r   rV   rO   rm   )r"   summarychangesdownloadSizeactionsremoval_boldr   r   pkgs_remove	pkgs_instpkgs_upgradedownloadSizeStrs   &&&&&&      r   confirmChangesDistUpgradeView.confirmChanges@  s   
 &("C!!!nn##C(###nn##C(%%%%%c*"""&&88BB!!((-$$S)%%%%%c*  $*:*:: $--(3t/@/@+AA'#d.>.>*??	4>>*? >@%')45 5# *#q=
 '''02 5>> ># *#!
?A&(*67 7# )#!#//=/// / 6 6x @o
=> #
((*@@N
N#%*,2J[2X\_1_$$&??AA8a "Q R R RC 8a "Q R R RC 38a "< = = =C ${2a7DE' 6 7#
**W
"%("r   c                    R# )z/ask a Yes/No question and return True on 'Yes' Nr>   r"   r  r   defaults   &&&&r   askYesNoQuestion DistUpgradeView.askYesNoQuestion  r   r   c                    R# )z<ask a Cancel/Continue question and return True on 'Continue'Nr>   r  s   &&&&r   askCancelContinueQuestion)DistUpgradeView.askCancelContinueQuestion  r   r   c                P    \        R4      p\        R4      pV P                  W4      # )z1generic ask about the restart, can be overridden zReboot requiredzMThe upgrade is finished and a reboot is required. Do you want to do this now?)r   r  )r"   r  r   s   &  r   confirmRestartDistUpgradeView.confirmRestart  s/    %&   $$W22r   c                h    \        R 4      p\        R4      p\        R4      pV P                  WV4      # )zAction requiredz9Exit all other instances of Ubuntu WSL before continuing.z'Unsaved progress may otherwise be lost.r   informationr"   r  r   extendeds   &   r   adviseExitOtherWSL"DistUpgradeView.adviseExitOtherWSL  s6    %&KL>?h77r   c                h    \        R 4      p\        R4      p\        R4      pV P                  WV4      # )zWSL restart requiredz!Exit this instance of Ubuntu WSL.z"The upgrade will then be complete.r  r  s   &   r   adviseRestartWSL DistUpgradeView.adviseRestartWSL  s6    *+349:h77r   c                    R# )zdisplay a error Nr>   r"   r  r   extended_msgs   &&&&r   rm   DistUpgradeView.error  r   r   c                    R# )zdisplay a information msgNr>   r'  s   &&&&r   r  DistUpgradeView.information  r   r   c                    R# )zDprocess gui events (to keep the gui alive during a long
computation Nr>   rN   s   &r   processEventsDistUpgradeView.processEvents  s     	r   c                    R# )zGdo a progress pulse (e.g. bounce a bar back and forth, show
a spinner)
Nr>   )r"   finisheds   &&r   pulseProgressDistUpgradeView.pulseProgress  s     r   )r   r   r   r   r   r   r   r   rX   )NT)No)Cancelr   )rY   rZ   r[   r\   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r!  r$  rm   r  r-  r1  r]   r^   r   s   @r   r   r     sx     (.!! 

Wr38
8
 r   r   )(DistUpgradeGettextr   r   r   	telemetryr   r   rd   enumr   ro   rr   r1   localer3   r   rj   DistUpgradeApportr   	setlocaleLC_ALLgetdefaultlocalecoder  r   putenvr	   rm   info	getlocaler   re   rf   r   rb   objectr   r   r   r   r>   r   r   <module>rB     s  , - ( + 
   	      0
V]]B'..0T8 HIIj)$)4  6#3#3#55 6AH2cll''77 2l>%cll''77 >%@6 V 
4 
 #$M	jf jY34H << s    1E< F <FF,+F,