%PDF- %PDF-
Mini Shell

Mini Shell

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

�

\Ne�C���ddlmZddlmZddlmZddlZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZ	e
j&e
j(d�e
j*�\ZZes3d
Zej2dd�	e
j&e
j4d�ej8d
e
j:�z�d�ZGd�dej>j@jB�Z!Gd�dej>j@jD�Z"Gd�de#�Z$Gd�de#�Z%Gd�de	�Z&ed�ed�ed�ed�ed�fGd�de#�Z'e(d k(re!�Z)e)jU�yy#ej0d	�d
ZY��6xYw#e
j6$rY��wxYw)!�)�gettext)�ngettext)�get�N)�Enum)�apport_pkgfailure�zgetting the encoding failedzutf-8�LC_CTYPEzC.UTF-8zlocale: '%s' '%s'c���t|�}|dz}|dzdz}|dzdz}|dz}|dk(rd}ddddd�}|dkDrtd	d
|�|z|d<|dkDrtdd
|�|z|d<|dkDrtdd|�|z|d<tdd|�|z|d<|dkDr|ddk(r|dStd�|zS|dkDr|dS|dkDr|ddk(r|dStd�|zS|dkDr|dS|dS)z; return the time a bit fuzzy (no seconds if time > 60 secs i�Qi��<rrr	)�str_days�	str_hours�str_minutes�str_secondsz%li dayz%li daysrz%li hourz	%li hoursrz
%li minutez%li minutesrz
%li secondz%li secondsrz%(str_days)s %(str_hours)s�z%(str_hours)s %(str_minutes)s)�intr�_)�sec�days�hours�minutes�seconds�maps      �=/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeView.py�FuzzyTimeToStrr;se��	�C��#�	�x��$�

��,��
�%�
�"�W��N�'��"�H�'���\��G�����	
�#�
�A�X��y��T�:�T�A�C�
�O�
�Q�Y��
�;��>��F�C����q�[�!�,�}�g�F��P�C�
����]�G�D�w�N�#�m��
�A�X�
�;��2���:���
�
)�*�S�0�0��q�y��{����q�y�
�=��R���;���
�
,�-��3�3���{��}���	�]�	��c�P��eZdZ�fd�Z�fd�Z�fd�Zd�Zd�fd�	Zd�Zd�Z	�xZ
S)	�AcquireProgressc�8��tt|��d|_y)N�)�superr�__init__�	est_speed��self�	__class__s �rr#zAcquireProgress.__init__�s���	�/�4�)�+��D�Nrc�b��tt|��d|_d|_d|_d|_y)Nr!F)r"r�startr$�eta�percent�release_file_download_errorr%s �rr)zAcquireProgress.start�s-���	�/�4�&�(��D�N��D�H��D�L�',�D�$rc���tt|�||||�|tjk(r]tjd|z�|jd�s|jd�r"dD]}|j|�s�d|_	yyyy)Nz update_status: dlFailed on '%s' zRelease.gpg�Release)�http�ftp�mirrorT)
r"r�
update_status�apt_pkg�STAT_FAILED�logging�warning�endswith�
startswithr,)r&�uri�descr�
shortDescr�status�netr's      �rr2zAcquireProgress.update_status�s����	�/�4�.�s�E�:�v�N���$�$�$�
�o�o�8�3�>�?�	���m�	$����Y�(?�+�	�C�
�^�^�C�
 �/3�D�,��	�)@�%rc��y�NT�)r&�args  r�pulse_itemszAcquireProgress.pulse_items�s��rc���tt|�|�|j|jzdzt|j|jz�z|_|j|jkDr!|j|jzdz|_
|jdkDr4|j|jz
t|j�z|_y)NgY@g@rT)r"r�pulse�
current_bytes�
current_items�float�total_bytes�total_itemsr+�current_cpsr$r*)r&�ownerr's  �rrDzAcquireProgress.pulse�s����	�/�4�&�u�-��(�(�4�+=�+=�=��F��$�*�*�T�-=�-=�=�>�?�D�L����$�.�.�(����t�'7�'7�7��<�d�n����!���#�#�d�&8�&8�8���(�(�)�*�d�h�rc� �|jdk7S)Nr)r$�r&s r�isDownloadSpeedEstimatedz(AcquireProgress.isDownloadSpeedEstimated�s���N�N�a�� rc���|jdk(r.|dz}|dz}td�t|�t|�fz}|Std�t||jz�z}|S)z! get the estimated download time rg�#Ag�SAz_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. )r$rr)r&�required_download�	time5Mbit�
time40Mbit�ss     r�estimatedDownloadTimez%AcquireProgress.estimatedDownloadTime�sw���~�~���#�]�3�i�$�n�5�j�	
�3�
4�7E�j�7Q�Sa�bk�Sl�6m�
n�a�
�h�	�
C�D�~�Vg�hl�hv�hv�Vv�Gw�w�A��Hr�N)�__name__�
__module__�__qualname__r#r)r2rBrDrNrT�
__classcell__)r's@rrrs&����-���	�!�

rrc�(�eZdZdZd�Zd�Zd�Zd�Zy)�InstallProgressz_ Base class for InstallProgress that supports some fancy
      stuff like apport integration
  c�x�tjjjj	|�d|_yrU)�apt�progress�baser[r#�	master_fdrMs rr#zInstallProgress.__init__�s'���L�L���%�%�.�.�t�4��D�Nrc�<�		tj|jggg|j�|j�	tj|jtj�\}}||jk(r	|S	��#tj$r+}|jdt
jk7r�Yd}~��d}~wwxYw#t$rK}|j
t
jk7r�|j
t
jk(rYd}~SYd}~��d}~wwxYw)z�Wait for child progress to exit.

      The return values is the full status returned from os.waitpid()
      (not only the return code).
      rN)�select�statusfd�select_timeout�error�args�errno�EINTR�update_interface�os�waitpid�	child_pid�WNOHANG�OSError�ECHILD)r&�e�pid�ress    r�
wait_childzInstallProgress.wait_child�s���
���m�m�T�]�]�O�R��T�5H�5H�I��
�
�
!���:�:�d�n�n�b�j�j�A�j�s�C�����&���j�'�
�����������e�k�k�)��*���������E�K�K�'�����E�L�L�(��
�j�)���s0�-B�AC�C�!B?�?C�	D�;D�Dc�n�|j�}|dk(rctjtjtj�	|j	|j
�}tj�||_tj"|j%��}|S#t$r�}td|�tjd�tdd�5}|jt|��ddd�n#1swYnxYwtj|j�Yd}~��d}~wwxYw)Nrz!Exception during pm.DoInstall(): zException during pm.DoInstall()z./var/run/ubuntu-release-upgrader-apt-exception�w)�fork�signal�SIGPIPE�SIG_IGN�
do_install�writefd�	Exception�printr5�	exception�open�write�strrj�_exit�
RESULT_FAILEDrl�WEXITSTATUSrs)r&�pmrqrrrp�fs      r�runzInstallProgress.run�s���
�)�)�+�C�
�a�x�
�m�m�F�N�N�6�>�>�2�#��m�m�D�L�L�)��	�h�h�s�m��D�N�
�.�.����*�
+�C��J���#�
�1�1�5����;�<�
�B�3�
G�	�1�
�G�G�C��F�O�	�	�	��
����!�!�"�"��#�s0�	B%�%	D4�.-D/�C?�6	D/�?D	�&D/�/D4c��tjjjj	|||�tjd|�d|�d��d|vrtjj|�}|jd�dj�r#dj|jd�dd�}d	|vr|jd	�d}t||�y)
z install error from a package z!got an error from dpkg for pkg: 'z': '�'�/�-rrNr)
r]r^r_r[rer5rj�path�basename�split�isdigit�joinr)r&�pkg�errormsgs   rrezInstallProgress.error�s����L�L���%�%�+�+�D�#�x�@��M�M�#�x�P�Q�
�c�z��G�G���S�!�c�
�y�y��~�a�� � �"�
�J�J�s�y�y��~�a�b�)�*�c�
�c�z��I�I�c�N�1��c��c�8�$rN)rVrWrX�__doc__r#rsr�rer@rrr[r[�s�����0�&%rr[c��eZdZdd�Zy)�DumbTerminalc�.�ddl}|j|�y)z7 expects a command in the subprocess style (as a list) rN)�
subprocess�call)r&�cmd�hiddenr�s    rr�zDumbTerminal.call�s�������rN�F)rVrWrXr�r@rrr�r��s��rr�c��eZdZd�Zd�Zd�Zy)�SampleHtmlViewc��yrUr@)r&�urls  rrzSampleHtmlView.open�s��rc��yrUr@rMs r�showzSampleHtmlView.show����
rc��yrUr@rMs r�hidezSampleHtmlView.hider�rN)rVrWrXrr�r�r@rrr�r��s��
��rr�c�(�eZdZdZdZdZdZdZdZdZ	y)	�Stepr�r����N)
rVrWrX�PREPARE�MODIFY_SOURCES�FETCH�INSTALL�CLEANUP�REBOOT�Nr@rrr�r�s%���G��N�
�E��G��G�
�F�	�Arr�zPreparing to upgradezGetting new software channelszGetting new packageszInstalling the upgradeszCleaning upc��eZdZdZd�Zd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Z	dd�Zdd�Zdd�Zd�Zd�Zd�Zdd�Zdd�Zd�Zdd�Zd�Zy)�DistUpgradeViewz" abstraction for the upgrade view c��d|_y)NF)�needs_screenrMs rr#zDistUpgradeView.__init__s
��!���rc�R�tjjj�S)z5 return a OpProgress() subclass for the given graphic)r]r^r_�
OpProgressrMs r�getOpCacheProgressz"DistUpgradeView.getOpCacheProgresss���|�|� � �+�+�-�-rc��t�S)z# return an acquire progress object )rrMs r�getAcquireProgressz"DistUpgradeView.getAcquireProgress���� � rNc��t�S)z" return a install progress object )r[)r&�caches  r�getInstallProgressz"DistUpgradeView.getInstallProgress r�rc��t�SrU)r�rMs r�getTerminalzDistUpgradeView.getTerminal#s
���~�rc��t�SrU)r�rMs r�getHtmlViewzDistUpgradeView.getHtmlView%s����rc��y)z\ update the current status of the distUpgrade based
            on the current view
        Nr@)r&�msgs  r�updateStatuszDistUpgradeView.updateStatus's��	
rc��y)z8 provide a visual feedback that the upgrade was aborted Nr@rMs r�abortzDistUpgradeView.abort,���rc�J�t�j|j�y)z� we 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�setStepzDistUpgradeView.setStep/s��	��!�!�$�)�)�,�rc��y)z" hide a certain step from the GUI Nr@r�s  r�hideStepzDistUpgradeView.hideStep:r�rc��y)z" show a certain step from the GUI Nr@r�s  r�showStepzDistUpgradeView.showStep=r�rc�T�d|_||_g|_g|_g|_g|_g|_g|_|D�]}|jr|jj|��,|jr|jj|��T|jr|jj|��||jrg|jjj|j �r|jj|���|j
j|���|j"s��|jj|���|j|jz|_|jj%�|jj%�|j
j%�|jj%�|jj%�d}t'|j
�t'|j�z}	t'|j�t'|j�z}
t'|j�}t'|j�dkDr@|t)ddt'|j��dt'|j�izz
}|dz
}|	dkDr|t)dd	|	�|	zz
}|d
z
}|
dkDr|t)dd|
�|
zz
}|d
z
}|dkDr|t)d
d|�|zz
}|d
z
}|dkDrmt+j,|�}t/|t0�r|j3t4�}|t7d�|zz
}||j9�j;|�z
}||
zdkDrM||
z|	zdkDrB|j9�j=�r|dt7d�zz
}n(|dt7d�zz
}n|	dkDr|dt7d�zz
}||
z|	zdkr)t7d�}t7d�}|j?||�y||_y)zm display the list of changed packages (apt.Package) and
            return if the user confirms them
        r	�
rzo%(amount)d installed package is no longer supported by Canonical. You can still get support from the community.zq%(amount)d installed packages are no longer supported by Canonical. You can still get support from the community.�amountz

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. �dz

%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. rz,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�	demotions�	toInstall�toReinstall�	toUpgrade�toRemove�toRemoveAuto�toDowngrade�marked_install�append�marked_upgrade�marked_reinstall�
marked_delete�_pcache�	_depcache�is_auto_installed�_pkg�marked_downgrade�sort�lenrr3�size_to_str�
isinstance�bytes�decode�ENCODINGrr�rTrNre)
r&�summary�changesr��downloadSize�actions�removal_boldr�r��pkgs_remove�	pkgs_inst�pkgs_upgrade�downloadSizeStrs
             r�confirmChangeszDistUpgradeView.confirmChanges@s��
&(��"�"��������������
��������
	+�C��!�!��n�n�#�#�C�(��#�#��n�n�#�#�C�(��%�%����%�%�c�*��"�"����&�&�8�8����B��!�!�(�(��-��
�
�$�$�S�)��%�%����%�%�c�*�
	+����$�*:�*:�:����������������
�
��������� ����������$�-�-�(�3�t�/@�/@�+A�A������'�#�d�.>�.>�*?�?�	��4�>�>�*���t�~�~���"�

��
<�
G������!�
&.��D�N�N�0C�#E�F�F�#���-�#���?���>�@�%�'�)4�5�5�#���*�#��q�=�

��'�'�'0�2�5>�>�>�#���*�#��!��

��?�A�&�(�*6�7�7�#���)�#��!��#�/�/��=�/�
���
/� /� 6� 6�x� @�o�

��=�>����#�

��(�(�*�@�@��N�
N�#�
�I�
%��*�,��2J�[�2X�\_�1_�
�
$�
$�
&�
?�
?�
A��8�a�"Q�R�R�
R�C�
�8�a�"Q�R�R�
R�C��3�
��8�a�"<�=�=�
=�C�
�9�$�{�2�a�7��D�E�'��6�7�#�
�*�*�W�c�
"��%(��"�rc��y)z0 ask a Yes/No question and return True on 'Yes' Nr@�r&r�r��defaults    r�askYesNoQuestionz DistUpgradeView.askYesNoQuestion�r�rc��y)z= ask a Cancel/Continue question and return True on 'Continue'Nr@r�s    r�askCancelContinueQuestionz)DistUpgradeView.askCancelContinueQuestion�r�rc�R�td�}td�}|j||�S)z2 generic ask about the restart, can be overridden zReboot requiredzMThe upgrade is finished and a reboot is required. Do you want to do this now?)rr)r&r�r�s   r�confirmRestartzDistUpgradeView.confirmRestart�s1���%�&�������$�$�W�c�2�2rc�j�td�}td�}td�}|j|||�S)NzAction requiredz9Exit all other instances of Ubuntu WSL before continuing.z'Unsaved progress may otherwise be lost.�r�information�r&r�r��extendeds    r�adviseExitOtherWSLz"DistUpgradeView.adviseExitOtherWSL�s8���%�&���K�L���>�?�������h�7�7rc�j�td�}td�}td�}|j|||�S)NzWSL restart requiredz!Exit this instance of Ubuntu WSL.z"The upgrade will then be complete.rrs    r�adviseRestartWSLz DistUpgradeView.adviseRestartWSL�s8���*�+���3�4���9�:�������h�7�7rc��y)z display a error Nr@�r&r�r��extended_msgs    rrezDistUpgradeView.error�r�rc��y)z display a information msgNr@rs    rrzDistUpgradeView.information�r�rc��y)zQ process gui events (to keep the gui alive during a long
            computation Nr@rMs r�
processEventszDistUpgradeView.processEvents�s��	
rc��y)zX do a progress pulse (e.g. bounce a bar back and forth, show
          a spinner)
      Nr@)r&�finisheds  r�
pulseProgresszDistUpgradeView.pulseProgress�s��rc�H�|j||dj|��y)zr
      show demoted packages to the user, default implementation
      is to just show a information dialog
      r�N)rr�)r&r�r�r�s    r�
showDemotionszDistUpgradeView.showDemotions�s��
���w��T�Y�Y�y�%9�:rrUr?)�No)�Cancelr�)rVrWrXr�r#r�r�r�r�r�r�r�r�r�r�r�rrrr
rrerrrrr@rrr�r�sz��(�
�.�!�!�� �
�

�

�
�
�37�a�F
�
�3�8�
8�

�
�
��
;rr��__main__)+�DistUpgradeGettextrrr�	telemetryrr�r]�enumrrgrjr3�localer5rwrb�DistUpgradeApportr�	setlocale�LC_ALL�getdefaultlocale�coder�r~�putenvr
re�info�	getlocalerr^r_rr[�objectr�r�r�r�rV�fprDr@rr�<module>r)s���,-�(�+�
���	��
��
�
�0���F���V�]�]�B�'�.�v�.�.�0��T�8���H�
�B�I�I�j�)�$�
��������)�4�
����
 �#3�6�#3�#3�#5�
5�6�A�H2
�c�l�l�'�'�7�7�2
�l>%�c�l�l�'�'�7�7�>%�@�6���V��
�4�
�����#�$��������M��	�z;�f�z;�x�z����"��(�(�*���Q
��G���3�4��H���<�<�
��
�s�1F�	F*�F'�*F=�<F=

Zerion Mini Shell 1.0