%PDF- %PDF-
Mini Shell

Mini Shell

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

�

\�e6_����ddlZddlZddlZddlZddlZddlZddlmZddlmZ	Gd�de
�ZGd�d�ZGd�d	e�Z
Gd
�de�ZGd�d
e�Zd�Zd�ZGd�d�Zddddgfd�Zy)�N)�ElementTree)�gettextc��eZdZy)�NoDistroTemplateExceptionN)�__name__�
__module__�__qualname__���4/usr/lib/python3/dist-packages/DistUpgrade/distro.pyrr%s��rrc�V�eZdZgfd�Zd�Zd
d�Zd�Zd�Zdd�Zd�Z	d	�Z
d
�Zd�Zd�Z
y)�Distributionc�f�||_||_||_||_||_d|_d|_y)z0Container for distribution specific informations�debzdeb-srcN)�id�codename�description�release�is_like�binary_type�source_type)�selfrrrrrs      r�__init__zDistribution.__init__*s8����� ��
�&��������� ���$��rc�	�||_d|_g|_g|_g|_g|_g|_g|_g|_g|_	d|_
g|_d|_d|_
d|_g|_|jj j"D]@}|j%|j&�s�|j(|j*k(s�9||_n|j�%t-d|j*�d|j.����g}g}g}g}|jj1�D�]#}|j2�sB|j%|j4��r&|j6�r|j6j8�r|j%|j6j&��r�|j:j=d�rD|j>s8|j
jA|�|jC|jD��n}|j:j=d�r)|j>r|j
jA|��n9|jF|jHk(r^|j>sR|jjA|�|jC|jD�|jA|j:�n�|jF|jHk(r(|j>r|jjA|�n�|jF|jJk(r(|j>s|jjA|�n@|jF|jJk(r'|j>r|jjA|�|j2r��a|j6|jjLvs���|j>s6|jF|jHk(r|jjA|����|j>s6|jF|jJk(r|jjA|���	|jjA|���&tO|�|_tO|�|_|jC|�|jC|�tO|�|_tO|�|_	|jQ�y)zf
        Find the corresponding template, main and child sources
        for the distribution
        NF�z2Error: could not find a distribution template for �/�cdrom:))�sourceslist�source_template�
child_sources�main_sources�disabled_sources�
cdrom_sources�download_comps�
enabled_comps�cdrom_comps�
used_media�get_source_code�source_code_sources�default_server�main_server�nearest_server�used_servers�matcher�	templates�is_codename�name�distributionrrr�
exploded_list�invalid�dist�template�official�uri�
startswith�disabled�append�extend�comps�typerr�children�set�get_mirrors)rrr6�mediar=r&r%�sources        r�get_sourceszDistribution.get_sources6s���'���#��������� "������ ������������$���#%�� �!������ �������(�(�0�0�:�:�	�H�����
�
�.�8�3H�3H�D�G�G�3S�(0��$��
	����'�+��7�7�D�M�M�+��
��������
��&�&�4�4�6�	9�F��N�N��$�$�V�[�[�1��O�O��O�O�,�,��$�$�V�_�_�%9�%9�:��:�:�(�(��2�6�?�?��&�&�-�-�f�5��&�&�v�|�|�4��Z�Z�*�*�8�4�����&�&�-�-�f�5��[�[�D�$4�$4�4�V�_�_��%�%�,�,�V�4��L�L����.��L�L����,��[�[�D�$4�$4�4�����)�)�0�0��8��[�[�D�$4�$4�4�V�_�_��,�,�3�3�F�;��[�[�D�$4�$4�4�����)�)�0�0��8��>�>�f�o�o��9M�9M�9V�9V�&V����6�;�;�$�:J�:J�+J��&�&�-�-�f�5����V�[�[�D�<L�<L�-L��,�,�3�3�F�;��)�)�0�0��8�?	9�@"�%�j����{�+������U�#����[�)� ��/����e�*������rNc�~�|jj|_|jD]/}|j	d�r�|j
j
|��1t|j�dk(r|j|_	n|jdj|_	i|_d}tjj|�r�t|��}t!|dd��|j"|_|j%d�}|D]S}	|j&d}	|j&d
}t+j,d|�|j|j/�<�Ud|_d|_tj4d
d��}	|	j7d�}
|	j7d�}|dk(rt|	�}|	|
dz|j/�}|r
||z|_||jvr|j||_||_yy#t($r|j&d	}Y��wxYw#t($r|j&d}Y��wxYw)zR
        Provide a set of mirrors where you can get the distribution from
        rrz%/usr/share/xml/iso-codes/iso_3166.xml)�file�iterN�iso_3166_entry�common_namer1�alpha_2_code�alpha_3_code�iso_3166�LANG�en_UK)�default�_�.����)r�base_urir+r'r9r-r;�lenr!r*r8�	countries�os�path�existsr�getattr�getiteratorrG�attrib�KeyErrorr�dgettext�lower�country�country_code�getenv�findr,)
r�mirror_template�medium�fname�et�it�elm�descr�code�locale�a�zras
             rrAzDistribution.get_mirrors�s��
 �/�/�8�8����o�o�	1�F��$�$�X�.��!�!�(�(��0�	1�
�t� � �!�Q�&�"&�"2�"2�D��"&�"3�"3�A�"6�":�":�D�����7��
�7�7�>�>�%� ��%�(�B��r�6�4�(�0��.�.������)�*�B��	
S��/��J�J�}�5�E�6��:�:�n�5�D�07�/?�/?�
�E�/R����t�z�z�|�,�	
S���� ������6�7�3���K�K�����K�K������7��F��A��a�!�e�a�(�.�.�0���"1�L�"@�D���4�>�>�)��>�>�,�7�D�L� ,�D��*��+ �/��J�J�v�.�E�/�� �6��:�:�n�5�D�6�s$�H�H �H�H� H<�;H<c��d}|jd�}|jd�}|dk7r|dk7r||td�z|}||jvrtd�|j|zSd|j	d�zS)zoTry to get a human readable name for the main mirror of a country
        Customize for different distributionsNz://z.archive.ubuntu.comrR�
Server for %s�%s�/ )rcrUrVrP�rstrip�r�serverr`�i�lis     r�_get_mirror_namezDistribution._get_mirror_name�s������K�K����
�[�[�.�
/����7�r�R�x��Q��U��^�b�1�G��d�n�n�$��_�%����w�(?�?�?��&�-�-��-�-�-rc�`�d�}g}t|j�dks8t|j�dk(r�||jd|j�rl|jt	d�|jdg�|j
r7|j|j
|j
�|j
dg�|St|j�dk(r�||jd|j�s�|jt	d�|jdg�|jd}|j
rJ|||j
�s7|j|j
|j
�|j
dg�|r#|j|j
|�|dg�|St|j�dkDr�|jt	d�|jdg�|j
r7|j|j
|j
�|j
dg�|jt	d�ddg�|jD]S}|j
|�|dg}|||j
�s|||j�r�>||vs�C|j|��U|S)	z+Return a list of used and suggested serversc�j�tj|jd�|jd��S)zgHelper function that handles comaprision of mirror urls
            that could contain trailing slashesrr)�re�match�striprs)�mir1�mir2s  r�compare_mirrorsz5Distribution.get_server_list.<locals>.compare_mirrors�s'���8�8�D�J�J�t�,�d�k�k�$�.?�@�@rrSrzMain serverTFzCustom serversN)rUr-r+r;rPr,rx)rr��mirrorsru�mirror_entrys     r�get_server_listzDistribution.get_server_list�s���	A����t� � �!�A�%���!�!�"�a�'��� 1� 1�!� 4�d�6F�6F�G��N�N�A�m�,�d�.>�.>��E�F��"�"�����-�-�d�.A�.A�B��+�+����d��W��"�"�
#�q�
(�����a� �$�"2�"2�2
�
�N�N�A�m�,�d�.>�.>��F�G��&�&�q�)�F��"�"�&�v�t�/B�/B�C��N�N� �1�1�$�2E�2E�F� �/�/�!�������� 5� 5�f� =�v�t�L�M�2��/��"�"�
#�a�
'�
�N�N�A�m�,�d�.>�.>��F�G��"�"�����-�-�d�.A�.A�B��+�+����
�N�N�A�.�/��t�<�=��+�+�
1�� $� 5� 5�f� =�v�u�M��"�6�4�+>�+>�?�?��D�,�,�D��!��0��N�N�<�0�
1��rc�B�|�|j}|�|j}|�t|j�}|�|j}d}d}t|j�xst|j�D]}|j}n|jj|||||||��}|jrn||jk(r^|jj|j|||||j||jjj|�dz��yyy)z3
        Add distribution specific sources
        N)�parentrFrS)rFr��pos)r*r�listr%r�reversedr r!rFr�addr(r�index)	rr>r8r5r=�commentr�rF�
new_sources	         r�
add_sourcezDistribution.add_sources*���;��%�%�C��<��=�=�D��=���+�+�,�E��<��#�#�D������t�1�1�2�Q�h�t�?P�?P�6Q�	�F��;�;�D��	��%�%�)�)��#�t�U�G�F��*�
�
�
���D�D�,<�,<�$<���� � �� � ������_�_�!��$�$�)�)�/�/�
�;�a�?�
!�	
�%=�rc�2�t|g�}|jD]d}|jjD]I}|j|k(s�|j
s� |j
|vs�/|j
|j
��K�f|D]}|j|��y)z�
        Enable a component in all main, child and source code sources
        (excluding cdrom based sources)

        comp:         the component that should be enabled
        N)r�r!r6�
componentsr1�parent_componentr;�_enable_component)r�compr=rC�cs     r�enable_componentzDistribution.enable_component<s����d�V����'�'�	9�F��_�_�/�/�
9���6�6�T�>�a�&8�&8��)�)��6����Q�%7�%7�8�
9�	9�
�	&�A��"�"�1�%�	&rc�����fd�}g}|j|j�|j|j�i}i}|D]p}|j|jk(s�|j
|vrt
�||j
<|jD] }||j
j|��"�r|jD]p}|j|jk(s�|j
|vrt
�||j
<|jD] }||j
j|��"�rt|j�dkr|jd�zg��n*|D]}|||��
|jD]}|||��
|jrUt|j�dkr"|j|jd�zg��y|jD]}|||��
yy)Nc���|j|vry�||jvry|j�gz|_||jj��y)z�
            Check if we already added the component to the repository, since
            a repository could be splitted into different apt lines. If not
            add the component
            N)r5r=r�)rC�comps_per_distr�s  �r�add_component_only_oncez?Distribution._enable_component.<locals>.add_component_only_onceNsS����{�{�.�0���~�f�k�k�2�2��!�<�<�4�&�0�F�L��6�;�;�'�+�+�D�1rrSrq)r=)r>r=)r<r!r r>rr5r@r=r�r)rrUr�r()	rr�r��sourcesr��comps_per_sdist�sr�rCs	 `       rr�zDistribution._enable_componentMs����	2�$�����t�(�(�)����t�)�)�*������	2�A��v�v��)�)�)��6�6��/�-0�U�N�1�6�6�*����2�A�"�1�6�6�*�.�.�q�1�2�		2��)�)�	3�A��v�v��)�)�)��6�6��0�.1�e�O�A�F�F�+����3�A�#�A�F�F�+�/�/��2�3�		3��t� � �!�A�%��O�O�4�$�;�-�O�0�"�
@��'���?�
@��2�2�
A��'���@�
A�����4�+�+�,�q�0����T�%5�%5�d�T�k�]��K�#�6�6�E�F�+�F�O�D�E�
 rc���g}|j|j�|j|j�|j|j�||jvrg}|j|j�|D]i}||j
vs�|j
}|j
|�||_t|j
�dks�O|jj
|��ky)zx
        Disable a component in all main, child and source code sources
        (excluding cdrom based sources)
        rSN)	r<r!r r)r&r=�removerUr)rr�r�rCr=s     r�disable_componentzDistribution.disable_component�s���
�����t�(�(�)����t�)�)�*����t�/�/�0��4�#�#�#��G��N�N�4�,�,�-��	4�F��v�|�|�#��������T�"�$����v�|�|�$�q�(��$�$�+�+�F�3�
	4rc�<���fd�}g}g}|�_�jD]}||||���jD]F}|jj�$|jj|j
k7s�=||||��H�jD]}||||��y)zHChange the server of all distro specific sources to
        a given hostc�\��||_|jD]a}|j|j|g|vr|jj|��:|j	|j|j|g��ct|j�dkr�jj|�yy)NrS)r8r=r5r�r;rUr)rCr8�seenr�rs    �r�change_server_of_sourcez;Distribution.change_server.<locals>.change_server_of_source�s�����F�J����
A���J�J����T�2�d�:��L�L�'�'��-��K�K����V�[�[�$� ?�@�	
A�
�6�<�<� �1�$�� � �'�'��/�%rN)r*r!r r6rTr8r))rr8r��seen_binary�seen_sourcerCs`     r�
change_serverzDistribution.change_server�s����		0�����!����'�'�	>�F�#�F�C��=�	>��(�(�	B�F����(�(�0��?�?�+�+�v�z�z�9�'���[�A�
	B��.�.�	>�F�#�F�C��=�	>rc�$�||jk(ryy)z/Compare a given name with the release codename.TF)r�rr1s  rr0zDistribution.is_codename�s���4�=�=� ��r�N)NNNNr)rrr	rrDrArxr�r�r�r�r�r�r0r
rrrr)sD��CE�
%�T�l6-�p.�C�J#�J&�";E�z4�(>�<rrc�"�eZdZdZd�Zd�Zd�Zy)�DebianDistributionz)Class to support specific Debian featuresc�@�||jk(s|jdvryy)z}Compare a given name with the release codename and check if
        if it can be used as a synonym for a development releases)�testing�unstableTF)rrr�s  rr0zDebianDistribution.is_codename�s"���4�=�=� �D�L�L�4K�$K��rc�Z�d}|jd�}|jd�}|dk7r|dk7r||td�z|}||jvrKtd�t	j
d|j|j
��j
�zSd|j
d�zS)	zYTry to get a human readable name for the main mirror of a country
        Debian specificNz://ftp.z.debian.orgrRrprLrqrr)rcrUrVrPrr^rsrts     rrxz#DebianDistribution._get_mirror_name�s������K�K�	�"��
�[�[��
'����7�r�R�x��Q��Y��/�"�5�G��d�n�n�$��/�"��"�"�����w� 7� >� >� @���&�(��
��&�-�-��-�-�-rc�2�tj|d��y)Nz http://ftp.%s.debian.org/debian/�rd�rrA�rs rrAzDebianDistribution.get_mirrors�s��� � ��"D�	!�	
rN)rrr	�__doc__r0rxrAr
rrr�r��s��3��.�&
rr�c��eZdZdZd�Zy)�UbuntuDistributionz)Class to support specific Ubuntu featuresc�2�tj|d��y)Nz$http://%s.archive.ubuntu.com/ubuntu/r�r�r�s rrAzUbuntuDistribution.get_mirrors�s��� � ��"H�	!�	
rN�rrr	r�rAr
rrr�r��s
��3�
rr�c��eZdZdZd�Zy)�UbuntuRTMDistributionz-Class to support specific Ubuntu RTM featuresc�:�|jj|_yr�)rrTr+r�s rrAz!UbuntuRTMDistribution.get_mirrors�s���/�/�8�8��rNr�r
rrr�r��s
��7�9rr�c�h�ddl}ddlm}m}ddddd�}	|d	d
g|��j	�d}|jd�}|j
d
�|jd�D��|S#t$r<}|j|jk7rtjd|z�Yd}~|Sd}~wwxYw)z-Call lsb_release --idrc and return a mapping.rN)�PIPE�Popen�sid�DebianzDebian GNU/Linux unstable (sid)r�)�Codename�Distributor ID�Description�Release�lsb_releasez-idrc)�stdoutzutf-8c3�HK�|]}d|vs�|jd����y�w)z:	N)�split)�.0�lines  r�	<genexpr>z_lsb_release.<locals>.<genexpr>s ����U�D�u�PT�}�d�j�j��'�U�s�	"�"�
z#lsb_release failed, using defaults:)�errno�
subprocessr�r��communicate�decode�updater��OSError�ENOENT�logging�warning)r�r�r��result�out�excs      r�_lsb_releaser��s����&��"�8��	�F�I��]�G�,�T�:�F�F�H��K���j�j��!���
�
�U�C�I�I�d�O�U�U��M���I��9�9����$��O�O�A�C�G�H���M��I�s�AA,�,	B1�51B,�,B1c�j�ddl}ddlm}m}m}	|ddg||d��j�d}|j
�D]*}|jd�s�|jd	d
�d
cS	y#t$r;}|j|jk7rtjd|z�Yd}~yd}~wwxYw)z=Get the current channel from system-image-cli -i if possible.rN)�DEVNULLr�r�zsystem-image-cliz-iT)r��stderr�universal_newlinesz	channel: z: rSz+system-image-cli failed, using defaults: %s)
r�r�r�r�r�r��
splitlinesr9r�r�r�r�r�)r�r�r�r�r�r�r�s       r�_system_image_channelr�s����/�/�Q��
��&���#�	
�
�+�-�����N�N�$�	.�D����{�+��z�z�$��*�1�-�-�	.����Q��9�9����$��O�O�I�C�O�P����Q�s$�AA.�A.�+A.�.	B2�71B-�-B2c�4�eZdZdZdZdd�Zd�Zd�Zd�Zd�Z	y)	�
_OSReleasez/etc/os-releasec���i|_d|_tj|_t
jj|j�sy|j�d|_|r|j�yy)NFT)
r��validr��OS_RELEASE_FILErFrWrX�isfile�parse�inject_lsb_compat)r�
lsb_compats  rrz_OSRelease.__init__'sX�������
��.�.��	��w�w�~�~�d�i�i�(���
�
����
���"�"�$�rc��|jd|jd<|jd|jd<|jjd�|jd<|jds(|jjd�|jd<|jjd�|jd	<y)
N�IDr��PRETTY_NAMEr��VERSION_CODENAMEr��UBUNTU_CODENAME�
VERSION_IDr�)r��getr�s rr�z_OSRelease.inject_lsb_compat5s���(,���D�(9����$�%�%)�[�[��%?����M�"�"&�+�+�/�/�2D�"E����J���{�{�:�&�&*�k�k�o�o�6G�&H�D�K�K�
�#�!%������!>����I�rc��t|j�}|D]4}|j�}|s�|j|j	dd���6|j�y)N�=rS)�openrFr}�parse_entryr��close)r�fr�s   rr�z_OSRelease.parse?sU������O���	2�D��:�:�<�D����D���d�j�j��a�0�1�		2�
	
���	rc��|j|�}|dk(r!t|t�r|jd�}||j|<y)N�ID_LIKE� )�parse_value�
isinstance�strr�r�)r�key�values   rr�z_OSRelease.parse_entryHsA��� � ��'���)��
�5�#� 6��K�K��$�E� ����C�rc�V�tj|�}t|�dk(r|dS|S)NrSr)�shlexr�rU)rr��valuess   rr�z_OSRelease.parse_valuePs+�����U�#���v�;�!���!�9���
rN)T)
rrr	�DEFAULT_OS_RELEASE_FILEr�rr�r�r�r�r
rrr�r�#s&��/��'�O�%�?��!�rr�c�2�|r|r|r|s�|s|s|s|rtjdtd��t�}g}t	�}|j
r|j}t	�}|d}|d}|d}|d}|jdg�}|d	k(r>t�}|�2d
|vr.d}|jdd
�d
jdd
�d}|}|}|d	k(rt|||||�S|dk(rt|||||�S|dk(rt|||||�St|||||�S)z�
    Check the currently used distribution and return the corresponding
    distriubtion class that supports distro specific features.

    If no paramter are given the distro will be auto detected via
    a call to lsb-release
    z#Provided only a subset of arguments�)�
stacklevelr�r�r�r�r��Ubuntuzubuntu-rtm/z
Ubuntu-RTMrrS�-rr�)�warnings�warn�DeprecationWarningr�r�r�r�r�r��rsplitr�r�r�r�r)	rrrrr�
os_release�	os_result�
lsb_result�channels	         r�
get_distrorWsJ��
�8���
��[�G��M�M�5�7I�VW�
� �\�
��	�!�^�
����"�)�)�I�"�^�
�
�(�
)���j�)�� ��/���Y�'���-�-�	�2�.��
��>�+�-�G��"�}��'?�!��"�>�>�#�q�1�!�4�:�:�3��B�1�E��&��"��	�X�~�!�"�h��W�g�N�N�	�\��$�R��;���Q�Q�	�x��!�"�h��W�g�N�N��B��+�w��H�Hr)rr�rWr{r�r�xml.etree.ElementTreer�apt_pkgrP�	Exceptionrrr�r�r�r�r�r�rr
rr�<module>rs���4��	�	���-� �	�	�	�X�X�v!
��!
�H
��
�9�.�9��,�*1�1�h��4��r�1Ir

Zerion Mini Shell 1.0