%PDF- %PDF-
Mini Shell

Mini Shell

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

�

\�e����ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZm
Z
ddlmZmZmZmZmZddlZddlmZddlmZmZed�Zgd�Zd	ed
edefd�Zd
eedeefd�Z Gd�de!�Z"Gd�de!�Z#Gd�de!ee�Z$dedefd�Z%d+d�Z&Gd�d�Z'Gd�d�Z(Gd�d�Z)ee)e'fZ*ee)e'e(fZ+Gd�d�Z,Gd �d!�Z-Gd"�d#�Z.e/d$k(r�ej`�e-�Z1e1D]%Z2ejfd%e2j9�z��'ed&d'�Z4ejfd(e4z�ejfed)d'��ejfed&d*��yy),�N)�Callable�Iterable�Iterator)�Any�Generic�Optional�TypeVar�Union�)�_deb822)�DistInfo�Template�T)�	is_mirror�Deb822SourceEntry�SourceEntry�NullMatcher�SourcesList�SourceEntryMatcher�
master_uri�compare_uri�returnc��|jd�}|jd�}||k(ry	|jd�d}|jd�d}d|vr||jd�dzd|k(ryy#t$rYywxYw)z�check if the given add_url is idential or a mirror of orig_uri e.g.:
    master_uri = archive.ubuntu.com
    compare_uri = de.archive.ubuntu.com
    -> True
    z/ Tz//rF�.N)�rstrip�split�
IndexError�index)rr�compare_srv�
master_srvs    �8/usr/lib/python3/dist-packages/aptsources/sourceslist.pyrr;s����$�$�T�*�K��"�"�4�(�J��j� ���!�'�'��-�a�0���%�%�d�+�A�.�
��k��k�+�*;�*;�C�*@�1�*D�*F�G�:�U��������s�(A2�2	A>�=A>�sc�*�tt|��S)a-simple and efficient way to return uniq collection

    This is not intended for use with a SourceList. It is provided
    for internal use only. It does not have a leading underscore to
    not break any old code that uses it; but it should not be used
    in new code (and is not listed in __all__).)�list�set)r"s r!�uniqr&Xs����A��<��c�`�eZdZdedefd�Z	ddeddedzdedzfd	�Zddd
edzddfd�Zy)
�SingleValueProperty�key�docc� �||_||_y�N�r*�__doc__��selfr*r+s   r!�__init__zSingleValueProperty.__init__c��������r'N�objr�objtyperc�V�|�|S|jj|jd�Sr-)�section�getr*�r1r4r5s   r!�__get__zSingleValueProperty.__get__gs'���;��K��{�{���t�x�x��.�.r'�valuec�j�|�|j|j=y||j|j<yr-)r7r*�r1r4r;s   r!�__set__zSingleValueProperty.__set__ns)���=����D�H�H�%�$)�C�K�K����!r'r-)	�__name__�
__module__�__qualname__�strr2r�typer:r>�r'r!r)r)bsf���C��c��
JN�/��/�0�/�;?�$�;�/�	�t��/�*�.�*�s�T�z�*�d�*r'r)c�`�eZdZdedefd�Z	ddeddedzdeefd	�Zddd
eeddfd�Z	y)
�MultiValuePropertyr*r+c� �||_||_yr-r.r0s   r!r2zMultiValueProperty.__init__vr3r'Nr4rr5rc�|�|�|Stj|jj|jd��S)N�)r�mysplitr7r8r*r9s   r!r:zMultiValueProperty.__get__zs2���;��K��"�"�3�;�;�?�?�4�8�8�R�#@�A�Ar'�valuesc�T�dj|�|j|j<y)N� )�joinr7r*)r1r4rKs   r!r>zMultiValueProperty.__set__�s�� #���� 0����D�H�H�r'r-)
r?r@rArBr2rrCr$r:r>rDr'r!rFrFusj���C��c��
JN�B��/�0�B�;?�$�;�B�	
�c��B�1�.�1��S�	�1�d�1r'rFc�P�eZdZdefd�Z	ddeddedzdefd�Zddd	eddfd
�Zy)�ExplodedEntryProperty�parentc��||_yr-)rQ�r1rQs  r!r2zExplodedEntryProperty.__init__�s	����r'Nr4�ExplodedDeb822SourceEntryr5rc�T�|�|S|jj|j�Sr-)rQr:r9s   r!r:zExplodedEntryProperty.__get__�s'���;��K��{�{�"�"�3�:�:�.�.r'r;c�p�|j�|jj|j|�yr-)�	split_outrQr>r=s   r!r>zExplodedEntryProperty.__set__�s#���
�
�������C�J�J��.r'r-)	r?r@rArr2rrCr:r>rDr'r!rPrP�sW���q��RV�/��7�8�/�CG�$�;�/�	
�/�/�6�/�q�/�T�/r'rP�propc��|Sr-rD)rXs r!�DeprecatedPropertyrZ�s���Kr'c��y)z3Behaves like an expired weakref.ref, returning NoneNrDrDr'r!�
_null_weakrefr\�s��r'c�R�eZdZ	d%dejezdzdededfd�Zdedefd	�Z	e
d
d�Ze
dd
�Ze
edd
��Ze
dd�Ze
edd��Ze
dd�Ze
edd��Ze
dd�Zedefd��Zej.deddfd��Zededzfd��Zej.dedzddfd��Zedefd��Zej.deddfd��Zedefd��Zedefd��Zdefd�Zdefd�Zd eddfd!�Zdd"defd#�Zd&d$�Z y)'rNr7�filer$rc��|�tjd�|_n2t|t�rtj|�|_n||_t	|j�|_||_d|_d|_tjd�|_|rtj|�|_
yt|_
y)NrIFrT)r�Sectionr7�
isinstancerB�_liner^�template�	may_merge�weakref�WeakSet�	_children�ref�_listr\)r1r7r^r$s    r!r2zDeb822SourceEntry.__init__�s����?�"�?�?�2�.�D�L�
���
%�"�?�?�7�3�D�L�"�D�L�����&��
���	�)-��
���� ���)D�E�G����;B�;�;�t�;L�D�J�&�D�Jr'�otherrc�d�|j|jk(xr�|j|jk(xr{|jxrm|jjd�|jjd�k(xr4|j|jk(xr|j
|j
k(S�z+equal operator for two sources.list entries�/��disabledrC�urir�dist�comps�r1rjs  r!�__eq__zDeb822SourceEntry.__eq__�s���
�M�M�U�^�^�+�
*��	�	�U�Z�Z�'�
*����
*�������$��	�	�(8�(8��(=�=�
*��	�	�U�Z�Z�'�	
*�
�
�
�e�k�k�)�
	
r'�
ArchitectureszThe list of architectures�TypeszThe list of types�URIszURIs in the source�SuiteszSuites in the source�
ComponentszComponents in the sourcec�.�|jjS)�1Legacy attribute describing the paragraph header.�r7�header�r1s r!�commentzDeb822SourceEntry.comment�s���|�|�"�"�"r'rc�&�||j_y)r{Nr|)r1rs  r!rzDeb822SourceEntry.comment�s��&����r'c�f�	tj|jd�S#t$rYywxYw)z%Return the value of the Trusted field�TrustedN)�apt_pkg�string_to_boolr7�KeyErrorr~s r!�trustedzDeb822SourceEntry.trusted�s3��	��)�)�$�,�,�y�*A�B�B���	��	�s�!$�	0�0r;c�j�|�	|jd=y|rdnd|jd<y#t$rYywxYw)Nr��yes�no�r7r��r1r;s  r!r�zDeb822SourceEntry.trusted�s@���=�
��L�L��+�05�e�$�D�L�L��#���
��
�s�
&�	2�2c�b�tj|jjdd��S)zCheck if Enabled: no is set.�Enabledr�)r�r�r7r8r~s r!rozDeb822SourceEntry.disabled�s)���)�)�$�,�,�*:�*:�9�e�*L�M�M�Mr'c�b�|rd|jd<y	|jd=y#t$rYywxYw)Nr�r�r�r�s  r!rozDeb822SourceEntry.disabled�s6���&*�D�L�L��#�
��L�L��+���
��
�s�
"�	.�.c��|jS)z7A section is invalid if it doesn't have proper entries.)r7r~s r!�invalidzDeb822SourceEntry.invalid�s���<�<��r'c��|jS)z The entire (original) paragraph.)rbr~s r!�linezDeb822SourceEntry.line�s���z�z�r'c�>�|j�j�Sr-�rB�stripr~s r!�__str__zDeb822SourceEntry.__str__s���x�x�z���!�!r'c�,�t|j�S)z(Section as a string, newline terminated.)rBr7r~s r!rBzDeb822SourceEntry.strs���4�<�<� � r'�enabledc��||_y)z.Deprecated (for deb822) accessor for .disabledN�ro�r1r�s  r!�set_enabledzDeb822SourceEntry.set_enabled���#���
r'�AnySourceEntryc
�d�|js)|j�td�|jD��sy|j|jk7ryt|t�sy|j|jk7r)td�|j|jfD��sytt|jj�t|jj�z�D]T}|j�dvr�|jj|d�}|jj|d�}||k7s�Tytt|j �t|j �k7t|j"�t|j"�k7t|j$�t|j$�k7t|j&�t|j&�k7t|j(�t|j(�k7g�dkDry|j D]'}||j vs�|xj |gz
c_�)|j"D]'}||j"vs�|xj"|gz
c_�)|j$D]'}||j$vs�|xj$|gz
c_�)|j&D]'}||j&vs�|xj&|gz
c_�)|j(D]'}	|	|j(vs�|xj(|	gz
c_�)y)z-Merge the two entries if they are compatible.Nc3�4K�|]}|j���y�wr-)rc)�.0�childs  r!�	<genexpr>z*Deb822SourceEntry.merge.<locals>.<genexpr>s����C�5����C�s�Fc3�$K�|]}d|v���
y�w)zAdded by software-propertiesNrD)r��cs  r!r�z*Deb822SourceEntry.merge.<locals>.<genexpr>s����5
�45�*�a�/�5
�s�)�types�uris�suites�
components�
architecturesz	signed-byrT)rdrc�allrgr^rarr�anyr%r$r7�tags�lowerr8�sumr�r�r�rrr�)
r1rj�tag�in_self�in_other�typrp�suite�	component�archs
          r!�mergezDeb822SourceEntry.merges�������
�
�%��C�D�N�N�C�C���9�9��
�
�"���%�!2�3���<�<�5�=�=�(��5
�:>�,�,��
�
�9V�5
�2
���t�D�L�L�-�-�.��e�m�m�6H�6H�1I�I�J�
	�C��y�y�{�����l�l�&�&�s�D�1�G��}�}�(�(��d�3�H��(�"��
	� 
���
�
�O�s�5�;�;�'7�7���	�	�N�c�%�*�*�o�5�����$��E�L�L�(9�9���
�
�O�s�5�;�;�'7�7���*�*�+�s�5�3F�3F�/G�G��
��	
���;�;�	$�C��$�*�*�$��
�
�s�e�#�
�	$��:�:�	#�C��$�)�)�#��	�	�c�U�"�	�	#��\�\�	'�E��D�K�K�'�����w�&��	'����	*�I���
�
�*��
�
�y�k�)�
�	*��'�'�	-�D��4�-�-�-��"�"�t�f�,�"�	-�r'c�6�|jD]�}|jD]y}|jD]h}|jD]W}|j|j
|jf|||fk(s�-|j|k(sJ�tj|�|_
�Y�j�{��y)z_If we end up being split, check if any of our children need to be reparented to the new parent.N)rgr�r�r��_type�_uri�_suiterQrerh�_parent)r1�tor�r�rpr�s      r!�_reparent_childrenz$Deb822SourceEntry._reparent_childrenPs����^�^�	<�E��x�x�
<���7�7�<�C�!#���<��!�K�K����U�\�\�B�s�C�QV�FW�W�#(�<�<�4�#7�7�#7�,3�K�K��O�E�M�<�<�
<�	<r'r-)r�rrN)!r?r@rArr`rBrr2rrtrFr�r�rZr)rCr�rpr�rqrr�propertyr�setter�boolr�ror�r�r�r�r�r�rDr'r!rr�s��
)-�	'����3�&��-�'��'��}�%�	'�0

�C�

�C�

�'��8S�T�M��w�(;�<�E��1�'�;N�O�P�D��f�&:�;�D�
�0��9M�N�
O�C�
��*@�
A�F��1�(�<R�S�T�D��|�-G�H�E�
�#��#��#�
�^�^�&�s�&�t�&��&���������
�^�^�?�T�D�[�?�T�?��?��N�$�N��N��_�_��d��t����� �� �� ���c����"��"�!�S�!�$�4�$�D�$�B�+�B��B�H<r'rc��eZdZdZgd�Zdedededefd�Zedefd	��Z	edefd
��Z
e
jdeddfd��Z
edeefd
��Z
edeefd��Zedeefd��Zedefd��Zejdeddfd��Zedefd��Zejdeddfd��Zdd�Zdd�Zdefd�Zeej,�Zeej.�Zeej0�Zeeej4�Zeej6�Zeej8�Zdeddfd�Zedefd��Zy)rTzXThis represents a bit of a deb822 paragraph corresponding to a legacy sources.list entry)r�r�r�r�rc�__weakref__rQr�rpr�c��tj|�|_||_||_||_|j|_|jj|�yr-)	rerhr�r�r�r�rcrg�add)r1rQr�rpr�s     r!r2z"ExplodedDeb822SourceEntry.__init__asF���{�{�6�*�����
���	��������
������T�"r'rc�X�|j�|j�x}�|Std��)Nz#The parent entry is no longer valid)r��
ValueErrorrSs  r!rQz ExplodedDeb822SourceEntry.parentis.���<�<�#��,�,�.�(��5��
��>�?�?r'c�:�|j�|jSr-)�'_ExplodedDeb822SourceEntry__check_validr�r~s r!rpzExplodedDeb822SourceEntry.urips�������y�y�r'Nc���|j�|jjD�cgc]}||jk7r|n|��c}|j_||_ycc}wr-)rWrQr�r�)r1rp�us   r!rpzExplodedDeb822SourceEntry.uriusI������BF�+�+�BR�BR�S�Q��d�i�i��A�S�8�S�������	��Ts�Ac��|jgSr-�rCr~s r!r�zExplodedDeb822SourceEntry.types{����	�	�{�r'c��|jgSr-�rqr~s r!r�z ExplodedDeb822SourceEntry.suitesr�r'c��|jgSr-�rpr~s r!r�zExplodedDeb822SourceEntry.uris�s�����z�r'c�:�|j�|jSr-)r�r�r~s r!rCzExplodedDeb822SourceEntry.type�s�������z�z�r'c���|j�|g|j_||_|j	�|j|k(sJ�|jj|jgk(sJ�yr-)rWrQr�r�r�)r1r�s  r!rCzExplodedDeb822SourceEntry.type�s]������ �E�������
������z�z�S� � � ��{�{� � �T�Z�Z�L�0�0�0r'c�:�|j�|jSr-)r�r�r~s r!rqzExplodedDeb822SourceEntry.dist�s�������{�{�r'c���|j�|g|j_||_|j	�|j|k(sJ�|jj|jgk(sJ�yr-)rWrQr�r�r�)r1r�s  r!rqzExplodedDeb822SourceEntry.dist�s]������#�W�������������{�{�e�#�#�#��{�{�!�!�d�k�k�]�2�2�2r'c�d�|jj��td��|jjD]e}|jjD]J}|jj
D]/}|||f|j|j|jfk(s�-y�L�gtd|����)N�The parent entry is dead�Could not find parent of )	rQrir�r�r�r�r�r�r�)r1rCrpr�s    r!�
__check_validz'ExplodedDeb822SourceEntry.__check_valid�s����;�;����&��7�8�8��K�K�%�%�	�D��{�{�'�'�
��!�[�[�/�/��E��c�5�)�d�j�j�$�)�)�T�[�[�-Q�Q���
�	�
�4�T�F�;�<�<r'c���|j}|j|j|jf|jg|j
g|jgfk(ry|j�}|�td��	|jj|�}|j|�d}t|j�D]�}t|j�D]�}t|j�D]�}ttj|j �|j"|��}	|g|	_|g|	_|g|	_d|	_|j'|	�|jj)||	�|||f|j|j
|jfk(s��t+j,|	�|_d}������|std|����y#t$r}td|�d��|�d}~wwxYw)Nr�z Parent entry for partial deb822 z no longer validF)r7r^r$Tr�)rQr�r�r�r�r�r�rir�r$r�remove�reversedrrr`r7r^rdr��insertrerhr�)
r1rQ�sources_listr�e�
reparentedrCrpr��news
          r!rWz#ExplodedDeb822SourceEntry.split_out�s��������L�L�&�+�+�v�}�}�5�
�Z�Z�L�
�Y�Y�K�
�[�[�M�:
�
�

��|�|�~�����7�8�8�	� �%�%�+�+�F�3�E�	���F�#��
��V�\�\�*�	*�D�����,�
*��%�f�m�m�4�*�E�+� '������ ?�#�[�[�)��C�
"&��C�I� #�u�C�H�"'��C�J�$(�C�M��-�-�c�2� �%�%�,�,�U�C�8��c�5�)�d�j�j�$�)�)�T�[�[�-Q�Q�'.�{�{�3�'7���%)�
�*�
*�	*�$��8���?�@�@���5�	��2�4�&�8H�I���
��	�s�6G
�
	G(�G#�#G(c�n�d|j�d|j�d|j�d|j��S)Nz<child rMz of )r�r�r�r�r~s r!�__repr__z"ExplodedDeb822SourceEntry.__repr__�s1�������A�d�i�i�[��$�+�+��d�4�<�<�.�Q�Qr'r�c��||_y)zSet the source to enabled.Nr�r�s  r!r�z%ExplodedDeb822SourceEntry.set_enabled�r�r'c�.�|jjS)zReturn the file.)rQr^r~s r!r^zExplodedDeb822SourceEntry.file�s���{�{���r'�rN)r?r@rAr/�	__slots__rrBr2r�rQrpr�r$r�r�r�rCrqr�rWr�rPr�rrr�r�ror�rr�r^rDr'r!rTrT[s&��b�R�I�#�0�#�s�#��#�S�#��@�)�@��@���S����	�Z�Z��s��t����
��t�C�y�������S�	������d�3�i������c����
�[�[�1��1��1��1���c����
�[�[�3�#�3�$�3��3�=�)A�VR�#�R�*�*;�*I�*I�J�M�!�"3�"9�"9�:�E�#�$5�$=�$=�>�G�*�$�T�*�+<�+E�+E�F�H�#�$5�$=�$=�>�G�#�$5�$=�$=�>�G�$�4�$�D�$�� �c� �� r'rTc� �eZdZdZddededzfd�Zdedefd�Zedede	efd	��Z
deddfd
�Zdeddfd�Z
defd
�Zdefd�Zede	ejfd��Zede	ejfd��Zede	ejfd��Zy)rzsingle sources.list entryNr�r^c�V�d|_d|_d|_g|_d|_d|_d|_g|_d|_||_	|�tjjd�}|jd�rtd��||_|j!|�d|_g|_y)NFrI�Dir::Etc::sourcelist�.sourcesz6Classic SourceEntry cannot be written to .sources file)r�rorCr�r�rprqrrrr�r��config�	find_file�endswithr�r^�parserc�children)r1r�r^s   r!r2zSourceEntry.__init__�s��������
���	�(*���$(��������	� "��
������	��<��>�>�+�+�,B�C�D��=�=��$��U�V�V���	��
�
�4��)-��
�+-��
r'rjrc�H�|j|jk(xr�|j|jk(xrm|jjd�|jjd�k(xr4|j|jk(xr|j
|j
k(Srlrnrss  r!rtzSourceEntry.__eq__s���
�M�M�U�^�^�+�
*��	�	�U�Z�Z�'�
*�������$��	�	�(8�(8��(=�=�
*��	�	�U�Z�Z�'�
*��
�
�e�k�k�)�	
r'c���|j�}g}d}d}d}tt|��D]�}||dk(r(|rd}d}|j|�||}�(d}|||z
}�3||dk(rd}|||z
}�F|r,||j	�sd}|j|�||}�t||j	�r|sd}��|||z
}��t|�dkDr|j|�|S)z|a split() implementation that understands the sources.list
        format better and takes [] into account (for e.g. cdroms)rIF�[T�]r)r��range�len�append�isspace)r��pieces�tmp�p_found�space_found�is      r!rJzSourceEntry.mysplit
s���z�z�|�����������s�4�y�!�	�A��A�w�#�~��"'�K�"�G��M�M�#�&��q�'�C�"�G��4��7�N�C��a��C�����t�A�w����T�!�W�_�_�%6�#���
�
�c�"��1�g���a����"�7�"���t�A�w���-	�0�s�8�a�<��M�M�#���
r'c�0�||_|j�}|dk(s|dk(rd|_y|ddk(r<d|_|ddj�j	�}|ddvrd|_y|dd}|jd�}|dkDr||dzd|_|d|}|j|�}t|�dkrd|_y|dj�|_	|jd	vrd|_y|dj�dd
k(r�|jd�jd�j	�}|D][}	|j	dd�\}}|d
k(r|j	d�|_�5|dk(rtj|�|_�Ud|_�]|dj�|_t|j �dkrd|_|dj�|_t|�dkDr|dd|_yg|_y#t$r
d|_Y��wxYw)zXparse a given sources.list (textual) line and break it up
        into the field we haverI�#TNrr)�rpm�rpm-src�deb�deb-src�)rrrrr�z[]�=r��,r��)r�r�r�ror�findrrJr�rC�popr�r�r�r��	Exceptionrprqrr)r1r�r�r��options�optionr*r;s        r!r�zSourceEntry.parse3s
����	��z�z�|���2�:�����D�L����7�c�>� �D�M��!�"�X�^�^�%�+�+�-�F��!�9� D�D�#�����A�B�x���I�I�c�N���q�5���A���=�D�L����8�D����d�#���v�;��?��D�L���1�I�O�O�%��	��9�9�@�@��D�L���!�9�?�?��Q��3�&��j�j��m�)�)�$�/�5�5�7�G�!�
,��
,�!'���c�1�!5�J�C���f�}�-2�[�[��-=��*��	�)�'.�'=�'=�e�'D���'+���
,��!�9�?�?�$����t�x�x�=�1���D�L��1�I�O�O�%��	��v�;��?�����D�J��D�J��+!�(�#'�D�L�(�s�8H�H�H�	new_valuec���||_|r/|jj�jd�|_y|jj�ddk7rd|jz|_yy)z!set a line to enabled or disabledrrN)ror��lstripr�)r1rs  r!r�zSourceEntry.set_enabledss[��%�
��
���	�	�(�(�*�1�1�#�6�D�I��y�y��� ��#�s�*��$�)�)�O��	�+r'c�>�|j�j�S)zdebug helperr�r~s r!r�zSourceEntry.__str__~s���x�x�z���!�!r'c��|jr|jSd}|jrd}||jz
}|jrI|j
�=|dj
dj|j�|j
rdnd�z
}nP|j
�|d|j
rdndzz
}n-|jr!|ddj|j�zz
}|d	|j�d	|j��z
}t|j�d
kDr!|d	d	j|j�zz
}|jdk7r|d|jzz
}|dz
}|S)
z!return the current line as stringrIz# z [arch={} trusted={}]rr�r�z
 [trusted=%s]z
 [arch=%s]rMrz #�
)
r�r�rorCr�r��formatrNrprqr�rrr)r1r�s  r!rBzSourceEntry.str�s;���<�<��9�9�����=�=��D���	�	������$�,�,�":��+�2�2�����+�+�,�����4��
�D��\�\�
%��O����u�$�G�G�D�
�
�
��L�3�8�8�D�,>�,>�#?�?�?�D��!�D�H�H�:�Q�t�y�y�k�*�*���t�z�z�?�Q���C�#�(�(�4�:�:�.�.�.�D��<�<�2���D�4�<�<�'�'�D������r'c��|jgS)z'deb822 compatible accessor for the typer�r~s r!r�zSourceEntry.types�����	�	�{�r'c��|jgS)z&deb822 compatible accessor for the urir�r~s r!r�zSourceEntry.uris�s�����z�r'c��|jgS)z(deb822 compatible accessor for the suiter�r~s r!r�zSourceEntry.suites�rr'r-)r?r@rAr/rBr2rrt�staticmethodr$rJr�r�r�r�r��builtinsr�r�r�rDr'r!rr�s��#�.�S�.��d�
�.�(
�C�
�C�
��#�c�#�d�3�i�#��#�J>�#�>�$�>�@	,�T�	,�d�	,�"��"��S��6��t�H�L�L�)������d�8�<�<�(�������X�\�\�*���r'rc� �eZdZdZdedefd�Zy)rza Matcher that does nothingr"rc��y)NTrD)r1r"s  r!�matchzNullMatcher.match�s��r'N)r?r@rAr/�AnyExplodedSourceEntryr�rrDr'r!rr�s��%��-��$�r'rc�t�eZdZdZ		d(dd�dededefd�Zd)d
�Zdee	fd�Z
deegefd
e
deefd�Zddd	gd	fdedededeedededed	zdeeded	zdefd�Zdedd	fd�Zdedd	fd�Zd*ded	zdefd�Zdedd	fd �Zd!edefd"�Zd)d#�Zd)d$�Zd%ee	deee	eeee	fffd&�Zdeefd'�Zy	)+rz6represents the full sources.list + sources.list.d fileF)�deb822�withMatcher�matcherPathr c��g|_||rt|�|_nt�|_||_|j�yr-)r$r�matcherrr �refresh)r1r!r"r s    r!r2zSourcesList.__init__�s6��+-��	���-�k�:�D�L�&�=�D�L�������r'rNc��g|_tjjd�}|dk7r0tj
j
|�r|j|�tjjd�}|dk7r�tj
j
|�rxt	j|�D]`}|jr|jd�s|jd�s�2|jtj
j||���b|jD]*}|jr�|jj|��,y)z update the list of known entriesr�z	/dev/null�Dir::Etc::sourcepartsr�z.listN)r$r�r�r��os�path�exists�load�find_dir�listdirr r�rNr�r$r)r1r^�partsdir�sources    r!r%zSourcesList.refresh�s�����	��~�~�'�'�(>�?���;��2�7�7�>�>�$�#7��I�I�d�O��>�>�*�*�+B�C���{�"�r�w�w�~�~�h�'?��
�
�8�,�
<���K�K�D�M�M�*�$=�$�-�-��C��I�I�b�g�g�l�l�8�T�:�;�	
<��i�i�	+�F��>�>����"�"�6�*�	+r'c#�8K�|jEd{���y7��w)zGsimple iterator to go over self.list, returns SourceEntry
        typesN�r$r~s r!�__iter__zSourcesList.__iter__�s�����9�9���s����
predicates�attrsc/�4��K��jdd�}|j�D]m�|r:�jr.|jd��jjd�k7r�?t	��fd��D��s�Ut	�fd�|D��s�j����oy�w)Nrprmc3�B�K�|]}t�|��|k(���y�wr-)�getattr)r�r*r4r/s  ��r!r�z%SourcesList.__find.<locals>.<genexpr>�s!�����G�#�7�6�3�'�5��:�5�G�s�c3�.�K�|]}|�����y�wr-rD)r��	predicater/s  �r!r�z%SourcesList.__find.<locals>.<genexpr>�s�����P�&/�	�&�!�P�s�)r
�
exploded_listrprr�)r1r3r4rpr/s  ` @r!�__findzSourcesList.__find�s�������i�i��t�$���(�(�*�	�F��v�z�z�c�j�j��o����9J�9J�3�9O�&O���G��G�G�C�P�3=�P�M���
	�s�A7B�<B�BrI���rCrprq�
orig_compsr�posr^r�rQc
���|j�}|jd�}
|
r|ddj�}t���|dd}|j	�fd�|
d|||��}|D]>}
|D]7}||
j
vs�||j
|�=t|�dk(s�3|
ccS�@|j	�fd�d|||�	�}|D]�}
|
j|
k(rBt|
j
�t|�k7rt|
j
|z�|
_|
cS|
js�a|
r�dt|
j
�t|�k(s��d|
_|
cS|�tjjd
�}|jd�r�td||��}|	rVt|	d
|	�}	t!|	t�sJ�|	j"j$D]}|	j"||j"|<� |g|_|g|_|g|_||_�rt-��|_||j"_|
|_nw|
rdnd|�rddj3��znd||g}|j5|�|r|j7d|z�dj3d�|D��dz}t9|�}|�||_|j<j?|�|dkr|j,j7|�|S|j,jA||�|S)z�
        Add a new source to the sources.list.
        The method will search for existing matching repos and will try to
        reuse them as far as possible
        rrNc�4��t|j��k(Sr-�r%r��r"r�s �r!�<lambda>z!SourcesList.add.<locals>.<lambda>
����c�!�/�/�*�m�;�r'F)ror�rCrprqrc�4��t|j��k(Sr-rArBs �r!rCz!SourcesList.add.<locals>.<lambda>rDr')r�rCrprqr�r�)r^r$rQrIz	[arch=%s]rrMc3�&K�|]	}|s�|���y�wr-rD)r��parts  r!r�z"SourcesList.add.<locals>.<genexpr>Ps����;�T�d�D�;�s��r)!r��
startswithrr%�_SourcesList__findrrrr�ror&r�r�r�r�rr7rar7r�r�r�r�r$r�r}rN�extendr�rr^r$rr�)r1rCrprqr=rr>r^r�rQrorr�sourcesr/�new_comp�	new_entry�k�partsr�s        `          r!r�zSourcesList.add�s����$�z�z�|���?�?�3�'������8�?�?�$�D��M�*�
��1�
���+�+�;������
�
���	&�F�!�
&���v�|�|�+��e�k�k�(�3�4��5�z�Q��%�
�

&�	&��+�+�;������
���	"�F����(�*��v�|�|�$��E�
�2�#'����u�(<�#=�F�L��
������v�|�|�$��E�
�2�&+�F�O�!�M�	"��<��>�>�+�+�,B�C�D��=�=��$�)�$�T��E�I�� ���6�:��!�&�*;�<�<�<����,�,�=�A�+1�>�>�!�+<�I�%�%�a�(�=�#�f�I�O�!�U�I�N� $�v�I��#�I�O��*.�}�*=�	�'�'.�I���$�!)�I�� ��R��;H��s�x�x�
�6�6�b����E�
�L�L�������S�7�]�+��8�8�;�U�;�;�d�B�D�#�D�)�I���!%�	�������9�%���7��I�I���Y�'���
�I�I���S�)�,��r'�source_entryc��t|t�r|j�|j}|jj|�y)z0remove the specified entry from the sources.listN)rarTrWrQr$r�)r1rPs  r!r�zSourcesList.remove]s6���l�$=�>��"�"�$�'�.�.�L��	�	����&r'�
backup_extc���tjjd�}tjj||z�r8tjj|�rt
j||z|�tjjd�}tjd|z�D]>}tjj||z�s�&t
j||z|��@y)z8restore sources.list files based on the backup extensionr�r'z%s/*N)
r�r�r�r(r)r*�shutil�copyr,�glob)r1rRr^r.s    r!�restore_backupzSourcesList.restore_backupds����~�~�'�'�(>�?��
�7�7�>�>�$��+�,�������1E��K�K��z�)�4�0��>�>�*�*�+B�C���I�I�f�x�/�0�	5�D��w�w�~�~�d�Z�/�0����D�:�-�t�4�	5r'c�8�t�}|�tjd�}|jD]i}|j|vs�t
jj|j�s�<tj|j|j�|����k|S)z�make a backup of the current source files, if no backup extension
        is given, the current date/time is used (and returned)z%y%m%d.%H%M)
r%�time�strftimer$r^r(r)r*rTrU)r1rR�already_backupedr/s    r!�backupzSourcesList.backupos|��+.�%�������}�5�J��i�i�	G�F��{�{�"2�2�r�w�w�~�~�f�k�k�7R����F�K�K�F�K�K�=���)E�F�	G��r'c	��	t|�5}|jd�rBtj|�D])}|jjt
|||����+n.|D])}t||�}|jj|��+ddd�y#1swYyxYw#t$r&}tjd|�d|�d��Yd}~yd}~wwxYw)z(re)load the current sourcesr�r1Nzcould not open file 'z': r)�openr�r�Filer$r�rrr�logging�warning)r1r^�fr7r�r/�excs       r!r+zSourcesList.loadzs���
	F��d��
1�q��=�=��,�#*�<�<��?�V���	�	�(�(�):�7�D�t�)T�U�V�!"�1��!,�T�4�!8���	�	�(�(��0�1�
1�
1�
1���	F��O�O�3�D�6��S�E��D�E�E��	F�s5�B$�BB�B$�B!�B$�!B$�$	C�-C�C�entryc��t|t�r%|jj|j�S|jj|�Sr-)rarTr$rrQ)r1rds  r!rzSourcesList.index�s7���e�6�7��9�9�?�?�5�<�<�0�0��y�y���u�%�%r'c��d}|r�d}d}|dzt|j�kr�|j|}t|t�ri|dz}|t|j�krL|j	|j|�r|j|=d}n|dz
}|t|j�kr�L|dz
}|dzt|j�kr��|r��yy)z=Merge consecutive entries that have been split back together.TrFrN)r�r$rarr�)r1�mergedr�rd�js     r!r�zSourcesList.merge�s�������A��F��a�%�#�d�i�i�.�(��	�	�!����e�%6�7��A��A��c�$�)�)�n�,� �;�;�t�y�y��|�4� $�	�	�!��%)�F���F�A��c�$�)�)�n�,��Q����a�%�#�d�i�i�.�(�r'c���i}t|j�dk(rHtjj	d�}d}t|d�5}|j
|�ddd�y|j�	|jD]�}|j|vr$t|jd�||j<n.t|t�r||jj
d�||jj
|j����	|j�D]}|j��y#1swYyxYw#|j�D]}|j��wxYw)zsave the current sourcesrr�z�## See sources.list(5) for more information, especialy
# Remember that you can only use http, ftp or file URIs
# CDROMs are managed through the apt-cdrom tool.
�wNr)r�r$r�r�r�r^�writer�r^rarrBrK�close)r1�filesr)r}rbr/s      r!�savezSourcesList.save�s+��-/���t�y�y�>�Q���>�>�+�+�,B�C�D�E�
��d�C��
 �A������
 ���
�
��		��)�)�
7���;�;�e�+�)-�f�k�k�3�)?�E�&�+�+�&���(9�:��&�+�+�&�,�,�T�2��f�k�k�"�(�(�����6�
7��\�\�^�
�����	�
�
 ����\�\�^�
�����	�
�s�D8�4BE�8E�'E+r�c�&�g}i}|D]�}|j��|jjr,|j}||vrg||<||}|j|��Rt|jj�dkDs�u|j|���||fS)z5get all parent and child channels in the sources listr)rcr�r�r�r�)r1r��parents�used_child_templatesr/r*�temps       r!�check_for_relationszSourcesList.check_for_relations�s�����EG��"�	+�F����&�����$�$��o�o���2�2�02�(��-�+�C�0�����F�#��v���/�/�0�1�4��N�N�6�*�	+�$�-�.�.r'c��g}|jD]�}t|t�r|j|��%t	|j
�dk(rBt	|j�dk(r*t	|j�dk(r|j|��|j
D]_}|jD]N}|jD]=}|jt||||��|jj|d��?�P�a��|S)aFPresent an exploded view of the list where each entry corresponds exactly to a Release file.

        A release file is uniquely identified by the triplet (type, uri, suite). Old style entries
        always referred to a single release file, but deb822 entries allow multiple values for each
        of those fields.
        rr<)r$rarr�r�r�r�r�rTr$r)r1�resrdr�rp�suis      r!r:zSourcesList.exploded_list�s���-/���Y�Y�	8�E��%��-��
�
�5�!��E�K�K� �A�%���
�
�O�q�(�����%��*��
�
�5�!� �;�;�8�C�$�z�z�8��#(�<�<�8�C��J�J�'@���S�RU�'V�W� �L�L�.�.�s�2�w�7�8�8�8�	8� �
r')Tz /usr/share/python-apt/templates/r�r-)r?r@rAr/r�rBr2r%rr�r2rrrrIr$�intrr�r�rWr\r+rr�rn�tuple�dictrrsr:rDr'r!rr�s���@�!�=��
������
�� +�(�(�>�2��

�#�%;�$<�d�$B�C�
�NQ�
�	�(�	)�
�$���')�04�i��i��i��	i�
��I�i��
i��i��D�j�i� ��}�i�'��-�i�
 �i�V'�#9�'�d�'�	5��	5��	5�	��t��	�s�	�F��F��F�&�1�&�c�&�
�$�8/�$�^�4�/�	�t�N�#�T�(�D��4H�*H�%I�I�	J�/�4�t�$:�;�r'rc�,�eZdZdZdefd�Zdedefd�Zy)rztmatcher class to make a source entry look nice
    lots of predefined matchers to make it i18n/gettext friendly
    r"c�F�g|_tjd|z�}|D]}}tjj	|�}|jd�}|d|}t
||��}|jD]*}|j��|jj|��,�y)Nz	%s/*.infoz.infor)�base_dir)	�	templatesrVr(r)�basenamer	r
�	match_urir�)r1r"�
spec_filesrbr�rqrcs       r!r2zSourceEntryMatcher.__init__�s���)+����Y�Y�{�[�8�9�
��	4�A���� � ��#�A����w��A��!�A��A��A��4�D� �N�N�
4���%�%�1��N�N�)�)�(�3�
4�	4�	r'r/rc��d}|jD�]A}|j�|j��|j��|j��|j��|j��tj|j|j�r^tj|j|j�r4|j|jk(s|jdk(rd}||_	|S|j|j�s��|j���|j���tj|j|j�s��8d}||_	|S|S)z%Add a matching template to the sourceFrT)r}rprqr�
match_name�re�searchrrCrcr)r1r/�foundrcs    r!rzSourceEntryMatcher.matchs�������	�H��z�z�!�V�[�[�%8���"�"�.��'�'�3��J�J�*��K�K�+��I�I�h�0�0�&�*�*�=��H�H�X�0�0�&�+�+�>�����
�
�-����%�1G���"*�������"�"�6�:�:�.��'�'�3��K�K�+��H�H�X�0�0�&�+�+�>���"*������7	�6�r'N)	r?r@rAr/rBr2rr�rrDr'r!rr�s'����C���2��t�r'r�__main__zentry %sz!http://archive.ubuntu.com/ubuntu/z$http://de.archive.ubuntu.com/ubuntu/zis_mirror(): %sz http://archive.ubuntu.com/ubuntuz#http://de.archive.ubuntu.com/ubuntur�)5rrV�ior`�os.pathr(r�rTrYre�collections.abcrrr�typingrrrr	r
r�rIr�distinfor
rr�__all__rBr�rr$r&r�r)rFrPrZr\rrTrr�rrrrr?�init_configrKrd�info�mirrorrDr'r!�<module>r�s���4��	���	�
���8�8�9�9���(��C�L�����#��C��D��:�H�Q�K��D��G��*�(�*�&
1��
1� 
/�H�g�a�j�
/� �Q��1���
z<�z<�zN �N �b~�~�B�{�$5�5�6����"�$=�=���
��s�s�l	1�1�j�z���G�����m�G��/������Z�%�)�)�+�-�.�/��+�-S��F��G�L�L�"�V�+�,��G�L�L��.�0V�	
��
�G�L�L��/�1V�	
��%r'

Zerion Mini Shell 1.0