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/apt/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/apt/__pycache__/package.cpython-311.pyc
�

�xkd)���:�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlmZddlmZmZmZmZmZmZmZmZmZmZmZddlZddlZddlm Z m!Z!dd	lm"Z#d
Z$d�Z%Gd�d
e&��Z'Gd�de'��Z(Gd�de)��Z*Gd�dee*��Z+Gd�de)��Z,Gd�deeef��Z-Gd�de)��Z.Gd�dee.��Z/Gd�de)��Z0ed���Z1e2dkre1��dSdS) z"Functionality related to packages.�)�print_functionN)�
BadStatusLine)�	HTTPError)�urlopen)�Any�Iterable�Iterator�List�Optional�Set�Tuple�Union�
no_type_check�Mapping�Sequence)�AcquireProgress�InstallProgress)�gettext)�BaseDependency�
Dependency�Origin�Package�Record�Version�VersionListc��tj�|��rgtj�|��|krDt	|��5}tj|��j|kcddd��S#1swxYwYdS)z(Return ``True`` if the file is the same.NF)�os�path�exists�getsize�open�apt_pkg�Hashes�hashes)r�sizer$�fobjs    �-/usr/lib/python3/dist-packages/apt/package.py�
_file_is_samer(Gs���
�w�~�~�d���9������ 5� 5�� =� =�
�$�Z�Z�	9�4��>�$�'�'�.�&�8�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9��5s�A<�<B�Bc��eZdZdZdS)�
FetchErrorz(Raised when a file could not be fetched.N��__name__�
__module__�__qualname__�__doc__��r'r*r*Ps������2�2�2�2r1r*c��eZdZdZdS)�UntrustedErrorz/Raised when a file did not have a trusted hash.Nr+r0r1r'r3r3Ts������9�9�9�9r1r3c��eZdZdZGd�de��Zd�Zd�Zd�Ze	d���Z
e	d���Ze	d	���Ze	d
���Z
e	d���Ze	d���Ze	d
���Ze	d���Ze	d���ZdS)rzA single dependency.c��eZdZdZd�Zd�ZdS)�BaseDependency.__dstraQCompare helper for compatibility with old third-party code.

        Old third-party code might still compare the relation with the
        previously used relations (<<,<=,==,!=,>=,>>,) instead of the curently
        used ones (<,<=,=,!=,>=,>,). This compare helper lets < match to <<,
        > match to >> and = match to ==.
        c��t�||��rdSt�|d��rt�d|��St�|d��rt�d|��St�|d��rt�d|��SdS)	NT�<z<<�>z>>�=z==F)�str�__eq__��self�others  r'r<zBaseDependency.__dstr.__eq__ds����z�z�$��&�&�	
��t����D�#�&�&�
��z�z�$��.�.�.����D�#�&�&�
��z�z�$��.�.�.����D�#�&�&�
��z�z�$��.�.�.��ur1c�.�|�|��S�N)r<r=s  r'�__ne__zBaseDependency.__dstr.__ne__qs���{�{�5�)�)�)�)r1N)r,r-r.r/r<rBr0r1r'�__dstrr6[s<������	�	�	�	�	�	*�	*�	*�	*�	*r1rCc�"�||_||_dSrA)�_version�_dep)r>�version�deps   r'�__init__zBaseDependency.__init__us����
���	�	�	r1c�$�|j�d|j��S�Nz: ��rawtype�rawstr�r>s r'�__str__zBaseDependency.__str__z����<�<�<����5�5r1c	�H�d|j�d|j�d|j�d|j�d�	S)Nz<BaseDependency: name:z
 relation:�	 version:z	 rawtype:r9)�name�relationrGrMrOs r'�__repr__zBaseDependency.__repr__~s4���
�I�I�I��M�M�M��L�L�L��L�L�L�	
�	
r1c�$�|jjjS)zThe name of the target package.)rF�
target_pkgrTrOs r'rTzBaseDependency.name�s���y�#�(�(r1c�@�|�|jj��S)z�The relation (<, <=, =, !=, >=, >, '') in mathematical notation.

        The empty string will be returned in case of an unversioned dependency.
        )�_BaseDependency__dstrrF�	comp_typerOs r'rUzBaseDependency.relation�s���{�{�4�9�.�/�/�/r1c��|jjS)avThe relation (<<, <=, =, !=, >=, >>, '') in Debian notation.

        The empty string will be returned in case of an unversioned dependency.
        For more details see the Debian Policy Manual on the syntax of
        relationship fields:
        https://www.debian.org/doc/debian-policy/ch-relationships.html#s-depsyntax  # noqa

        .. versionadded:: 1.0.0
        )rF�
comp_type_debrOs r'�relation_debzBaseDependency.relation_deb�s���y�&�&r1c��|jjS)z�The target version or an empty string.

        Note that the version is only an empty string in case of an unversioned
        dependency. In this case the relation is also an empty string.
        )rF�
target_verrOs r'rGzBaseDependency.version�s���y�#�#r1c���g}|j���}|D]T}|j}|jjj}|�|��}t||��}|�|���U|S)zfA list of all Version objects which satisfy this dependency.

        .. versionadded:: 1.0.0
        )	rF�all_targets�
parent_pkgrE�package�_pcache�_rawpkg_to_pkgr�append)r>�tvers�_tvers�_tver�_pkg�cache�pkg�tvers        r'�target_versionszBaseDependency.target_versions�s|������&�&�(�(���	�	�E��#�D��M�)�1�E��&�&�t�,�,�C��3��&�&�D��L�L�������r1c�$�d�|jD��S)�iA list of all installed Version objects which satisfy this dep.

        .. versionadded:: 1.0.0
        c� �g|]}|j�	|��Sr0��is_installed��.0rns  r'�
<listcomp>z<BaseDependency.installed_target_versions.<locals>.<listcomp>�� ��K�K�K���9J�K��K�K�Kr1�rorOs r'�installed_target_versionsz(BaseDependency.installed_target_versions����L�K��!5�K�K�K�Kr1c�P�|jr|j�d|j�d|j��S|jS)a�String represenation of the dependency.

        Returns the string representation of the dependency as it would be
        written in the debian/control file.  The string representation does not
        include the type of the dependency.

        Example for an unversioned dependency:
          python3

        Example for a versioned dependency:
          python3 >= 3.2

        .. versionadded:: 1.0.0
        � )rGrTr^rOs r'rNzBaseDependency.rawstr�s6��"�<�	�!%����D�,=�,=�,=�t�|�|�L�L��9�r1c��|jjS)z�Type of the dependency.

        This should be one of 'Breaks', 'Conflicts', 'Depends', 'Enhances',
        'PreDepends', 'Recommends', 'Replaces', 'Suggests'.

        Additional types might be added in the future.
        �rF�dep_type_untranslatedrOs r'rMzBaseDependency.rawtype�s���y�.�.r1c�"�|jjdkS)zWhether this is a PreDepends.�
PreDependsrrOs r'�
pre_dependzBaseDependency.pre_depend�s���y�.�,�>�>r1N)r,r-r.r/r;rZrIrPrV�propertyrTrUr^rGrorzrNrMr�r0r1r'rrXsg��������*�*�*�*�*��*�*�*�4���
6�6�6�
�
�
��)�)��X�)�
�0�0��X�0��'�'��X�'��$�$��X�$�����X�� �L�L��X�L�����X��*�	/�	/��X�	/��?�?��X�?�?�?r1rc���eZdZdZ�fd�Zd�Zd�Zed���Zed���Z	ed���Z
ed���Zed	���Z�xZ
S)
raMRepresent an Or-group of dependencies.

    Attributes defined here:
        or_dependencies - The possible choices
        rawstr - String represenation of the Or-group of dependencies
        rawtype - The type of the dependencies in the Or-group
        target_version - A list of Versions which satisfy this Or-group of deps
    c�t��tt|���|��||_||_dSrA)�superrrIrE�_rawtype)r>rG�	base_depsrM�	__class__s    �r'rIzDependency.__init__�s3���
�j�$���(�(��3�3�3���
���
�
�
r1c�$�|j�d|j��SrKrLrOs r'rPzDependency.__str__rQr1c�F�dd�d�|D����zS)Nz<Dependency: [%s]>�, c3�4K�|]}t|��V��dSrA)�repr�rv�bds  r'�	<genexpr>z&Dependency.__repr__.<locals>.<genexpr>s(����0I�0I�b��b���0I�0I�0I�0I�0I�0Ir1��joinrOs r'rVzDependency.__repr__s(��#�t�y�y�0I�0I�D�0I�0I�0I�'I�'I�J�Jr1c��|SrAr0rOs r'�or_dependencieszDependency.or_dependencies	s	���r1c�@�d�d�|D����S)axString represenation of the Or-group of dependencies.

        Returns the string representation of the Or-group of dependencies as it
        would be written in the debian/control file.  The string representation
        does not include the type of the Or-group of dependencies.

        Example:
          python2 >= 2.7 | python3

        .. versionadded:: 1.0.0
        z | c3�$K�|]}|jV��dSrA)rNr�s  r'r�z$Dependency.rawstr.<locals>.<genexpr>s$����3�3��"�)�3�3�3�3�3�3r1r�rOs r'rNzDependency.rawstrs%���z�z�3�3�d�3�3�3�3�3�3r1c��|jS)aType of the Or-group of dependency.

        This should be one of 'Breaks', 'Conflicts', 'Depends', 'Enhances',
        'PreDepends', 'Recommends', 'Replaces', 'Suggests'.

        Additional types might be added in the future.

        .. versionadded:: 1.0.0
        )r�rOs r'rMzDependency.rawtypes���}�r1c�Z�g}|D]%}|jD]}||vr|�|����&|S)zlA list of all Version objects which satisfy this Or-group of deps.

        .. versionadded:: 1.0.0
        )rorg)r>rhr�rns    r'rozDependency.target_versions,sT�����	'�	'�B��*�
'�
'���u�$�$��L�L��&�&�&��
'��r1c�$�d�|jD��S)rqc� �g|]}|j�	|��Sr0rsrus  r'rwz8Dependency.installed_target_versions.<locals>.<listcomp>Arxr1ryrOs r'rzz$Dependency.installed_target_versions:r{r1)r,r-r.r/rIrPrVr�r�rNrMrorz�
__classcell__)r�s@r'rr�s���������� � � � � �6�6�6�K�K�K�����X���
4�
4��X�
4�����X������X���L�L��X�L�L�L�L�Lr1rc��eZdZdZd�Zd�ZdS)ra�The origin of a version.

    Attributes defined here:
        archive   - The archive (eg. unstable)
        component - The component (eg. main)
        label     - The Label, as set in the Release file
        origin    - The Origin, as set in the Release file
        codename  - The Codename, as set in the Release file
        site      - The hostname of the site.
        trusted   - Boolean value whether this is trustworthy.
    c��|j|_|j|_|j|_|j|_|j|_|j|_|j|_|jj�	|��}|r|j
r	d|_dSd|_dS�NTF)�archive�	component�label�origin�codename�site�
not_automaticre�_list�
find_index�
is_trusted�trusted)r>rm�packagefile�	indexfiles    r'rIzOrigin.__init__Qs���"�*���$�.��� �&��
�!�(���#�,��
��$��	�(�6����K�%�0�0��=�=�	��	!��-�	!��D�L�L�L� �D�L�L�Lr1c
�h�d|j�d|j�d|j�d|j�d|j�d|j�d�
S)Nz<Origin component:z	 archive:z origin:z label:z site:z isTrusted:r9)r�r�r�r�r�r�rOs r'rVzOrigin.__repr__asF���
�N�N�N��L�L�L��K�K�K��J�J�J��I�I�I��L�L�L�

�
	
r1N)r,r-r.r/rIrVr0r1r'rrDs<������
�
�!�!�!� 
�
�
�
�
r1rc�P�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d
d
�Zd�Zd�Z
d	S)ra"Record in a Packages file

    Represent a record as stored in a Packages file. You can use this like
    a dictionary mapping the field names of the record to their values::

        >>> record = Record("Package: python-apt\nVersion: 0.8.0\n\n")
        >>> record["Package"]
        'python-apt'
        >>> record["Version"]
        '0.8.0'

    For example, to get the tasks of a package from a cache, you could do::

        package.candidate.record["Tasks"].split()

    Of course, you can also use the :attr:`Version.tasks` property.

    c�8�tj|��|_dSrA)r"�
TagSection�_rec)r>�
record_strs  r'rIzRecord.__init__�s���&�z�2�2��	�	�	r1c�*�t|j��SrA)�hashr�rOs r'�__hash__zRecord.__hash__�s���D�I���r1c�*�t|j��SrA)r;r�rOs r'rPzRecord.__str__�����4�9�~�~�r1c��|j|SrA�r��r>�keys  r'�__getitem__zRecord.__getitem__�s���y��~�r1c��||jvSrAr�r�s  r'�__contains__zRecord.__contains__�s���d�i��r1c�N�t|j�����SrA)�iterr��keysrOs r'�__iter__zRecord.__iter__�s���D�I�N�N�$�$�%�%�%r1c#�dK�|j���D]}||j|fV��dS)z6An iterator over the (key, value) items of the record.N)r�r�r�s  r'�	iteritemszRecord.iteritems�sG�����9�>�>�#�#�	&�	&�C��t�y��~�%�%�%�%�%�	&�	&r1Nc�8�|j�||��S)zReturn record[key] if key in record, else *default*.

        The parameter *default* must be either a string or None.
        )r��get�r>r��defaults   r'r�z
Record.get�s���y�}�}�S�'�*�*�*r1c��||jvS)z deprecated form of ``key in x``.r�r�s  r'�has_keyzRecord.has_key�s���d�i��r1c�*�t|j��SrA)�lenr�rOs r'�__len__zRecord.__len__�r�r1rA)r,r-r.r/rIr�rPr�r�r�r�r�r�r�r0r1r'rrps���������&3�3�3���������� � � �&�&�&�&�&�&�+�+�+�+� � � �
����r1rc��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zed
���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Z ed���Z!d�Z"ed ���Z#ed!���Z$ed"���Z%ed#���Z&ed$���Z'ed%���Z(ed&���Z)ed'���Z*ed(���Z+ed)���Z,ed*���Z-d+�Z.ed,���Z/ed-���Z0d3d0�Z1	d4d2�Z2d/S)5rz�Representation of a package version.

    The Version class contains all information related to a
    specific package version.

    .. versionadded:: 0.7.9
    c�j�||_||_|jjj�|��dSrA)rd�_candre�
_weakversions�add)r>rd�cands   r'rIzVersion.__init__�s2�������
����*�.�.�t�4�4�4�4�4r1c�.�	|jj}|jj}||krdS||krdStj|jj|j��S#t$r<	tj|jj|��cYS#t$rtcYcYSwxYwwxYw)a:Compares against another apt.Version object or a version string.

        This method behaves like Python 2's cmp builtin and returns an integer
        according to the outcome.  The return value is negative in case of
        self < other, zero if self == other and positive if self > other.

        The comparison includes the package name and architecture if other is
        an apt.Version object.  If other isn't an apt.Version object it'll be
        assumed that other is a version string (without package name/arch).

        .. versionchanged:: 1.0.0
        ����)
rd�fullnamer"�version_comparer��ver_strrG�AttributeError�	TypeError�NotImplemented)r>r?�	self_name�
other_names    r'�_cmpzVersion._cmp�s���
	&���-�I���/�J��:�%�%��r��Z�'�'��q��*�4�:�+=�u�}�M�M�M���	&�	&�	&�
&��.�t�z�/A�5�I�I�I�I�I���
&�
&�
&�%�%�%�%�%�%�
&����		&���s9�A�A�#A�
B�A:�7B�:B�B�B�Bc�4�|�|��dkS�Nr�r�r=s  r'r<zVersion.__eq__�����y�y����1�$�$r1c�4�|�|��dkSr�r�r=s  r'�__ge__zVersion.__ge__�r�r1c�4�|�|��dkSr�r�r=s  r'�__gt__zVersion.__gt__�����y�y����!�#�#r1c�4�|�|��dkSr�r�r=s  r'�__le__zVersion.__le__�r�r1c�4�|�|��dkSr�r�r=s  r'�__lt__zVersion.__lt__�r�r1c�d�	|�|��dkS#t$r
tcYSwxYwr�)r�r�r�r=s  r'rBzVersion.__ne__�sE��	"��9�9�U�#�#�q�(�(���	"�	"�	"�!�!�!�!�	"���s��/�/c��|jjSrA)r�r�rOs r'r�zVersion.__hash__�s���z��r1c�.�|jj�d|j��S)Nr:�rdrTrGrOs r'rPzVersion.__str__s���,�+�+�+�T�\�\�:�:r1c�2�d|jj�d|j�d�S)Nz<Version: package:rSr9r�rOs r'rVzVersion.__repr__s ���59�\�5F�5F�5F�����U�Ur1c��|jjj�|jjd��st
d���|jjjS)z=Internal helper that moves the Records to the right position.rzCould not lookup record)rdre�_records�lookupr��	file_list�LookupErrorrOs r'r�zVersion._recordssI��
�|�#�,�3�3�D�J�4H��4K�L�L�	9��7�8�8�8��|�#�,�,r1c��|jj}|jjj�|j�d����r|jjjSdS)z2Internal helper to get the translated description.rN)r��translated_descriptionrdrer�r�r��pop)r>�	desc_iters  r'�_translated_recordszVersion._translated_recordssP���J�5�	��<��(�/�/�	�0C�0G�0G��0J�0J�K�K�	1��<�'�0�0��tr1c��|jjS)z.Return the size of the package when installed.)r��installed_sizerOs r'r�zVersion.installed_sizes���z�(�(r1c��|jjS)z$Return the homepage for the package.)r��homepagerOs r'rzVersion.homepage!s���}�%�%r1c��|jjS)zReturn the size of the package.)r�r%rOs r'r%zVersion.size'����z��r1c��|jjS)z/Return the architecture of the package version.)r��archrOs r'�architecturezVersion.architecture-rr1c�4�t|jj��S)z:Return whether the version of the package is downloadable.)�boolr��downloadablerOs r'rzVersion.downloadable3s���D�J�+�,�,�,r1c�V�|jj}|duo|jj|jjkS)zkReturn wether this version of the package is currently installed.

        .. versionadded:: 1.0.0
        N)rd�	installedr��id)r>�inst_vers  r'rtzVersion.is_installed9s,���<�)���t�#�J���(9�T�Z�]�(J�Jr1c��|jjS)zReturn the version as a string.)r�r�rOs r'rGzVersion.versionC����z�!�!r1c�&�|j}|�|jndS)z0Return the short description (one line summary).N)r��
short_desc)r>�recordss  r'�summaryzVersion.summaryIs���*��%,�%8�w�!�!�d�Br1c��|jjS)z"return the long description (raw).)r��	long_descrOs r'�raw_descriptionzVersion.raw_descriptionPs���}�&�&r1c��|jjS)z"Return the section of the package.)r��sectionrOs r'rzVersion.sectionVrr1c��d}|j}|�|jnd}|std��|jjzS	t|t��s|�d��}n5#t$r(}td��|jj|fzcYd}~Sd}~wwxYwt|�
d����}t|��|D]�}|���dkr|�
d��s|dz
}�5|�d	��r1|�
d��sd
|dd�z}nNd|dd�z}n@|�d
��r)|�
d��s|dkr|dd�}n|}n|}||z
}��|S)z�Return the formatted long description.

        Return the formatted long description according to the Debian policy
        (Chapter 5.6.13).
        See http://www.debian.org/doc/debian-policy/ch-controlfields.html
        for more information.
        �Nz+Missing description for '%s'.Please report.�utf-8z<Invalid unicode in description for '%s' (%s). Please report.�
�.z

z  z
%s
�z%s
r}r�)r�r�_rdrT�
isinstancer;�decode�UnicodeDecodeErrorr��split�next�strip�endswith�
startswith)r>�descr�dsc�err�lines�raw_line�lines        r'�descriptionzVersion.description\s������*��#*�#6�g���D���	��E�F�F���!��
�	)��c�3�'�'�
*��j�j��)�)����!�	)�	)�	)��Q�����"�C�(�)�
)�
)�
)�
)�
)�
)�����	)����
�S�Y�Y�t�_�_�%�%���U�����	�	�H��~�~���3�&�&��}�}�T�*�*�#��F�N�D���"�"�4�(�(�
 ��}�}�T�*�*�1�#�h�q�r�r�l�2�D�D�!�H�Q�R�R�L�0�D�D��$�$�S�)�)�
 ��=�=��&�&�$�$�"�*�*�#�A�B�B�<�D�D�#�D�D����D�L�D�D��s�*A�
B�)B�B�Bc�l�	|jjp|jjS#t$r|jjcYSwxYw)z&Return the name of the source package.)r��
source_pkgrd�	shortname�
IndexErrorrOs r'�source_namezVersion.source_name�sH��	*��=�+�E�t�|�/E�E���	*�	*�	*��<�)�)�)�)�	*������3�3c�l�	|jjp|jjS#t$r|jjcYSwxYw)z)Return the version of the source package.)r��
source_verr�r�r1rOs r'�source_versionzVersion.source_version�sH��	&��=�+�A�t�z�/A�A���	&�	&�	&��:�%�%�%�%�	&���r3c��|jjS)z.Return the priority of the package, as string.)r��priority_strrOs r'�priorityzVersion.priority�s���z�&�&r1c�^�|jjjj�|j��S)z�Return the internal policy priority as a number.
        See apt_preferences(5) for more information about what it means.
        )rdre�	_depcache�policy�get_priorityr�rOs r'�policy_priorityzVersion.policy_priority�s%���|�#�-�4�A�A�$�*�M�M�Mr1c�4�t|jj��S)z�Return a Record() object for this version.

        Return a Record() object for this version which provides access
        to the raw attributes of the candidate version
        )rr��recordrOs r'r@zVersion.record�s���d�m�*�+�+�+r1c	��g}|jj}|D]l}	||D]P}g}|D]%}|�t||�����&|�t	|||�����Q�]#t
$rY�iwxYw|S)a(Return a list of Dependency objects for the given types.

        Multiple types can be specified. Possible types are:
        'Breaks', 'Conflicts', 'Depends', 'Enhances', 'PreDepends',
        'Recommends', 'Replaces', 'Suggests'

        Additional types might be added in the future.
        )r��depends_listrgrr�KeyError)r>�typesrB�depends�type_�dep_ver_listr��dep_ors        r'�get_dependencieszVersion.get_dependencies�s������*�)���	�	�E�
�$+�E�N�L�L�L� "�I�".�G�G��!�(�(���f�)E�)E�F�F�F�F� �'�'�
�4��E�(J�(J�K�K�K�K�	L��
�
�
�
���
�����s�AA.�.
A;�:A;c�.�d�|jjD��S)z2Return a list of names that this version provides.c��g|]
}|d��S)rr0)rv�ps  r'rwz$Version.provides.<locals>.<listcomp>�s��7�7�7���!��7�7�7r1)r��
provides_listrOs r'�provideszVersion.provides�s��8�7�d�j�6�7�7�7�7r1c�,�|�d��S)z4Return the list of enhances for the package version.�Enhances�rIrOs r'�enhanceszVersion.enhances�����$�$�Z�0�0�0r1c�.�|�dd��S)z/Return the dependencies of the package version.r��DependsrQrOs r'�dependencieszVersion.dependencies�s���$�$�\�9�=�=�=r1c�,�|�d��S)z-Return the recommends of the package version.�
RecommendsrQrOs r'�
recommendszVersion.recommends�s���$�$�\�2�2�2r1c�,�|�d��S)z+Return the suggests of the package version.�SuggestsrQrOs r'�suggestszVersion.suggests�rSr1c�~�g}|jjD]-\}}|�t|j|�����.|S)z1Return a list of origins for the package version.)r�r�rgrrd)r>�originsr��_unuseds    r'r^zVersion.origins�sH����$(�J�$8�	>�	>� �K���N�N�6�$�,��<�<�=�=�=�=��r1c��|jjS)zZReturn the path to the file inside the archive.

        .. versionadded:: 0.7.10
        )r��filenamerOs r'razVersion.filename�����}�%�%r1c��|jjS)zKReturn the md5sum of the binary.

        .. versionadded:: 0.7.10
        )r��md5_hashrOs r'�md5zVersion.md5rbr1c��|jjS)zLReturn the sha1sum of the binary.

        .. versionadded:: 0.7.10
        )r��	sha1_hashrOs r'�sha1zVersion.sha1s���}�&�&r1c��|jjS)zNReturn the sha256sum of the binary.

        .. versionadded:: 0.7.10
        )r��sha256_hashrOs r'�sha256zVersion.sha256s���}�(�(r1c�Z�t|jd�����S)z�Get the tasks of the package.

        A set of the names of the tasks this package belongs to.

        .. versionadded:: 0.8.0
        �Task)�setr@r"rOs r'�tasksz
Version.tasks s%���4�;�v�&�,�,�.�.�/�/�/r1c#�K�|jjD]L\}}|jjj�|��}|r!|�|jj��V��MdS)zVReturn an iterator over all available urls.

        .. versionadded:: 0.7.10
        N)	r�r�rdrer�r��archive_urir�ra)r>r�r_r�s    r'�_urisz
Version._uris+ss����%)�J�$8�	D�	D� �K����,�2�=�=�k�J�J�I��
D��+�+�D�M�,B�C�C�C�C�C��	D�	Dr1c�D�t|�����S)z^Return a list of all available uris for the binary.

        .. versionadded:: 0.7.10
        )�listrrrOs r'�uriszVersion.uris6s���D�J�J�L�L�!�!�!r1c��	tt|�������S#t$rYdSwxYw)zNReturn a single URI for the binary.

        .. versionadded:: 0.7.10
        N)r#r�rr�
StopIterationrOs r'�urizVersion.uri?sG��	���T�Z�Z�\�\�*�*�+�+�+���	�	�	��4�4�	���s�-0�
>�>rNc�n�|� tj�dd��}tj�|jj��}tj�||��}t||j
|jj��r6tj
d|z��tj�|��S|jjd\}}|jjj�|��}|s@|r|js7t-d|jj�d|j�dt3|d	d
���d����|jst7d���|jj}	|s|	jst-d
|z���tj|p"t<jj �!����}
tj"|
|j|	|j
||���}|
�#��|j$|j%krtMd|j'�d|j(�����tj�|��S)aCFetch the binary version of the package.

        The parameter *destdir* specifies the directory where the package will
        be fetched to.

        The parameter *progress* may refer to an apt_pkg.AcquireProgress()
        object. If not specified or None, apt.progress.text.AcquireProgress()
        is used.

        The keyword-only parameter *allow_unauthenticated* specifies whether
        to allow unauthenticated downloads. If not specified, it defaults to
        the configuration option `APT::Get::AllowUnauthenticated`.

        .. versionadded:: 0.7.10
        N�APT::Get::AllowUnauthenticatedF�"Ignoring already existing file: %sr�Could not fetch r}� source package: Source �describez<unkown>� is not trustedzNo URI for this binary.�8The item %r could not be fetched: No trusted hash found.��destfile�	The item � could not be fetched: ))r"�config�find_brr�basenamer�rar�r(r%r$�logging�debug�abspathr�r�rdrer�r�r�r3rTrG�getattrrx�
ValueError�usable�Acquire�apt�progress�textr�AcquireFile�run�status�	STAT_DONEr*r��
error_text)r>�destdirr��allow_unauthenticated�baser��pfile�offset�indexr$�acq�acqfiles            r'�fetch_binaryzVersion.fetch_binaryKs/��"!�(�$+�N�$9�$9�3�U�%�%�!��w����
� 6�7�7���7�<�<���.�.����4�9�d�m�.B�C�C�	-��M�>��I�J�J�J��7�?�?�8�,�,�,��
�,�Q�/�
��v���$�*�5�5�e�<�<��%�		�%�		�E�4D�		� �.��L�%�%�%��L�L�L��E�:�z�:�:�:�:����
��x�	8��6�7�7�7���%��%�	���	� �M�PX�X���
��o�h�M�#�,�*;�*K�*K�*M�*M�N�N���%����6�4�9�d�X�
�
�
��	���	�	�	��>�W�.�.�.��*��#�#�#�W�%7�%7�9���
�
�w���x�(�(�(r1Tc��|� tj�dd��}tj��}tj|p"t
jj�����}d}|j	}|j
p|jj}	|j
p|jj}
|�|	��}|r-|
|jkr"|�|	��}|r|
|jk�"|st%d|z���t'��}|s>|jjs2t-d|jj�d|j�d|jj�d����|jD]�}
t4j�|
j��}t4j�||��}|
jd	kr|}t?||
j |
j!��rtEj#d
|z����|s|
j!j$st-d|z���|�%tj&||j�'|
j��|
j!|
j ||�������|�(��|�t%d|z���|j)D]1}|j*|j+krtYd
|j-�d|j.������2|r{|jdztj/|j��z}t4j�||��}taj1dd||g��t4j�2|��St4j�2|��S)a9Get the source code of a package.

        The parameter *destdir* specifies the directory where the source will
        be fetched to.

        The parameter *progress* may refer to an apt_pkg.AcquireProgress()
        object. If not specified or None, apt.progress.text.AcquireProgress()
        is used.

        The parameter *unpack* describes whether the source should be unpacked
        (``True``) or not (``False``). By default, it is unpacked.

        If *unpack* is ``True``, the path to the extracted directory is
        returned. Otherwise, the path to the .dsc file is returned.

        The keyword-only parameter *allow_unauthenticated* specifies whether
        to allow unauthenticated downloads. If not specified, it defaults to
        the configuration option `APT::Get::AllowUnauthenticated`.
        NrzFzNo source for %rr|r}r}rr(r{r�r�r�r��-zdpkg-sourcez-x)3r"r�r��
SourceRecordsr�r�r�r�rr�r/rdr0r5r�r�r�rGr�rtr�r�r3rTr~�filesrrr�r��typer(r%r$r�r�r�rgr�rqr��itemsr�r�r*r�r��upstream_version�
subprocess�
check_callr�)r>r�r��unpackr��srcr�r(r@r2r6�
source_lookupr��filr�r��item�outdirs                  r'�fetch_sourcezVersion.fetch_source�sS��.!�(�$+�N�$9�$9�3�U�%�%�!��#�%�%���o�h�M�#�,�*;�*K�*K�*M�*M�N�N��������'�A�4�<�+A���*�@�d�j�.@���
�
�;�/�/�
��	4��#�+� =� =��J�J�{�3�3�M��	4��#�+� =� =��	8��/�$�6�7�7�7�����%�	���)=�	� �.��<�$�$�$�d�l�l�l�C�I�4F�4F�4F�H���
�
�9�	�	�C��7�#�#�C�H�-�-�D��w�|�|�G�T�2�2�H��x�5� � ����X�s�x���<�<�
��
�B�X�M�N�N�N��)�
�S�Z�->�
�$�-�/7�8����
�L�L��#���I�)�)�#�(�3�3��J��H��%�
���	
�	
�	
�	
�	���	�	�	��;��/�$�6�7�7�7��I�	�	�D��{�d�n�,�,� �j��}�}�}�d�o�o�7����-��	(��[�3�&��)A�#�+�)N�)N�N�F��W�\�\�'�6�2�2�F��!�=�$��V�"D�E�E�E��7�?�?�6�*�*�*��7�?�?�3�'�'�'r1)rNN)rNTN)3r,r-r.r/rIr�r<r�r�r�r�rBr�rPrVr�r�r�r�rr%rrrtrGrrrr-r2r6r9r>r@rIrNrRrVrYr\r^rarerhrkrorrrurxr�r�r0r1r'rr�sl��������5�5�5�&�&�&�<%�%�%�%�%�%�$�$�$�%�%�%�$�$�$�"�"�"����;�;�;�V�V�V��-�-��X�-�����X���)�)��X�)�
�&�&��X�&�
����X��
����X��
�-�-��X�-�
�K�K��X�K��"�"��X�"�
�C�C��X�C��'�'��X�'�
�"�"��X�"�
�5�5��X�5�n�*�*��X�*��&�&��X�&��'�'��X�'�
�N�N��X�N��,�,��X�,����.�8�8��X�8�
�1�1��X�1�
�>�>��X�>�
�3�3��X�3�
�1�1��X�1�
����X���&�&��X�&��&�&��X�&��'�'��X�'��)�)��X�)��0�0��X�0�	D�	D�	D��"�"��X�"��	�	��X�	�<)�<)�<)�<)�~MQ�[(�[(�[(�[(�[(�[(r1rc�R�eZdZdZd
d�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd
d�Z
dS)ra�Provide a mapping & sequence interface to all versions of a package.

    This class can be used like a dictionary, where version strings are the
    keys. It can also be used as a sequence, where integers are the keys.

    You can also convert this to a dictionary or a list, using the usual way
    of dict(version_list) or list(version_list). This is useful if you need
    to access the version objects multiple times, because they do not have to
    be recreated this way.

    Examples ('package.versions' being a version list):
        '0.7.92' in package.versions # Check whether 0.7.92 is a valid version.
        package.versions[0] # Return first version or raise IndexError
        package.versions[0:2] # Return a new VersionList for objects 0-2
        package.versions['0.7.92'] # Return version 0.7.92 or raise KeyError
        package.versions.keys() # All keys, as strings.
        max(package.versions)
    Nc�b�||_|jj|_|r|j||_dSdSrA)�_packagerk�version_list�	_versions)r>rd�slice_s   r'rIzVersionList.__init__�s9����
� ��2����	4�!�^�F�3�D�N�N�N�	4�	4r1c�D�t|t��r|�|j|��S	t	|j|j|��S#t$r1|jD]&}|j|krt	|j|��ccYS�'YnwxYwtd|z���)NzVersion: %r not found.)	r�slicer�r�rr�r�r�rC�r>r��vers   r'r�zVersionList.__getitem__s����d�E�"�"�	7��>�>�$�-��6�6�6�	7��4�=�$�.��*>�?�?�?���	7�	7�	7��~�
7�
7���;�$�&�&�"�4�=�#�6�6�6�6�6�6�6�'�
7�
7�	7����
�/�4�8�9�9�9s�A�5B
�	B
�B
c�F�dd�d�|D����zS)Nz[%s]r�c3�4K�|]}t|��V��dSrA)r;�rvr�s  r'r�z&VersionList.__str__.<locals>.<genexpr>s(����"<�"<��3�s�8�8�"<�"<�"<�"<�"<�"<r1r�rOs r'rPzVersionList.__str__s(������"<�"<�t�"<�"<�"<�<�<�=�=r1c�0�d|���zS)Nz<VersionList: %r>)r�rOs r'rVzVersionList.__repr__s��"�T�Y�Y�[�[�0�0r1c�*���fd��jD��S)z*Return an iterator over all value objects.c3�B�K�|]}t�j|��V��dSrA)rr�)rvr�r>s  �r'r�z'VersionList.__iter__.<locals>.<genexpr>s/�����F�F����
�s�+�+�F�F�F�F�F�Fr1�r�rOs`r'r�zVersionList.__iter__s"���G�F�F�F�t�~�F�F�F�Fr1c�n�t|t��r|j}|jD]}|j|krdS�dSr�)rrrGr�r�r�s   r'r�zVersionList.__contains__sJ���d�G�$�$�	 ��<�D��>�	�	�C��{�d�"�"��t�t�#��ur1c�B�t|��t|��kSrA)rtr=s  r'r<zVersionList.__eq__)s���D�z�z�T�%�[�[�(�(r1c�*�t|j��SrA)r�r�rOs r'r�zVersionList.__len__-s���4�>�"�"�"r1c�$�d�|jD��S)z*Return a list of all versions, as strings.c��g|]	}|j��
Sr0)r�r�s  r'rwz$VersionList.keys.<locals>.<listcomp>6s��6�6�6����6�6�6r1r�rOs r'r�zVersionList.keys3s��7�6�t�~�6�6�6�6r1c�8�	||S#t$r|cYSwxYw)zReturn the key or the default.)r�r�s   r'r�zVersionList.get8s5��	���9����	�	�	��N�N�N�	���s�
��rA)r,r-r.r/rIr�rPrVr�r�r<r�r�r�r0r1r'rr�s���������&4�4�4�4�:�:�:� >�>�>�1�1�1�G�G�G�
���)�)�)�#�#�#�7�7�7�
�����r1rc�h�eZdZdZd�Zd�Zd�Zd�Zed���Z	e	j
d���Z	ed���Zed	���Zed
���Z
ed���Zed���Zed
���Zd�Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zd(d�Zed���Zed���Zed���Z ed���Z!d �Z"d)d#�Z#d*d$�Z$d+d%�Z%d+d&�Z&d'�Z'dS),rz�Representation of a package in a cache.

    This class provides methods and properties for working with a package. It
    lets you mark the package for installation, check if it is installed, and
    much more.
    c�0�||_||_d|_dS)zInit the Package objectrN)rkre�
_changelog)r>�pcache�pkgiters   r'rIzPackage.__init__Is����	��������r1c��|jSrA�rTrOs r'rPzPackage.__str__Ps
���y�r1c�V�d|jj�d|jj�d|jj�d�S)Nz<Package: name:z architecture=z id:r9)rkrTrrrOs r'rVzPackage.__repr__Ts4���
�I�N�N�N��I�"�"�"��I�L�L�L�
�	
r1c�"�|j|jkSrAr�r=s  r'r�zPackage.__lt__\s���y�5�:�%�%r1c�r�|jj�|j��}|�t	||��SdS)z�Return the candidate version of the package.

        This property is writeable to allow you to set the candidate version
        of the package. Just assign a Version() object, and it will be set as
        the candidate version.
        N)rer;�get_candidate_verrkr)r>r�s  r'�	candidatezPackage.candidate`s9���|�%�7�7��	�B�B�����4��&�&�&��tr1c��|j���|jj�|j|j��|j���dS)z)Set the candidate version of the package.N)re�cache_pre_changer;�set_candidate_verrkr��cache_post_change)r>rGs  r'r�zPackage.candidatensQ��	
��%�%�'�'�'����0�0���G�M�J�J�J���&�&�(�(�(�(�(r1c�R�|jj�t||jj��SdS)z`Return the currently installed version of the package.

        .. versionadded:: 0.7.9
        N)rk�current_verrrOs r'r
zPackage.installedvs)���9� �,��4���!6�7�7�7��tr1c�6�|j�d��S)a}Return the name of the package, possibly including architecture.

        If the package is not part of the system's preferred architecture,
        return the same as :attr:`fullname`, otherwise return the same
        as :attr:`shortname`

        .. versionchanged:: 0.7.100.3

        As part of multi-arch, this field now may include architecture
        information.
        T�rk�get_fullnamerOs r'rTzPackage.name�s���y�%�%�d�+�+�+r1c�6�|j�d��S)z�Return the name of the package, including architecture.

        Note that as for :meth:`architecture`, this returns the
        native architecture for Architecture: all packages.

        .. versionadded:: 0.7.100.3Fr�rOs r'r�zPackage.fullname�s���y�%�%�e�,�,�,r1c��|jjS)zZReturn the name of the package, without architecture.

        .. versionadded:: 0.7.100.3)rkrTrOs r'r0zPackage.shortname�s���y�~�r1c��|jjS)znReturn a uniq ID for the package.

        This can be used eg. to store additional information about the pkg.)rkrrOs r'rz
Package.id�s���y�|�r1c��|jjS)z>Return True if the package is an essential part of the system.)rk�	essentialrOs r'r�zPackage.essential�s���y�"�"r1c��|jjS)aReturn the Architecture of the package.

        Note that for Architecture: all packages, this returns the
        native architecture, as they are internally treated like native
        packages. To get the concrete architecture, look at the
        :attr:`Version.architecture` attribute.

        .. versionchanged:: 0.7.100.3
            This is now the package's architecture in the multi-arch sense,
            previously it was the architecture of the candidate version
            and deprecated.
        )rkrrOs r'rzPackage.architecture�s���y�%�%r1c�J�|jj�|j��S)z5Return ``True`` if the package is marked for install.)rer;�marked_installrkrOs r'r�zPackage.marked_install�����|�%�4�4�T�Y�?�?�?r1c�J�|jj�|j��S)z5Return ``True`` if the package is marked for upgrade.)rer;�marked_upgraderkrOs r'r�zPackage.marked_upgrade�r�r1c�J�|jj�|j��S)z4Return ``True`` if the package is marked for delete.)rer;�
marked_deleterkrOs r'r�zPackage.marked_delete�����|�%�3�3�D�I�>�>�>r1c�J�|jj�|j��S)z2Return ``True`` if the package is marked for keep.)rer;�marked_keeprkrOs r'r�zPackage.marked_keep�s���|�%�1�1�$�)�<�<�<r1c�J�|jj�|j��S)zPackage is marked for downgrade)rer;�marked_downgraderkrOs r'r�zPackage.marked_downgrade�����|�%�6�6�t�y�A�A�Ar1c�J�|jj�|j��S)z7Return ``True`` if the package is marked for reinstall.)rer;�marked_reinstallrkrOs r'r�zPackage.marked_reinstall�r�r1c��|jjduS)z,Return ``True`` if the package is installed.N)rkr�rOs r'rtzPackage.is_installed�s���y�$�D�0�0r1c�X�|jo#|jj�|j��S)z-Return ``True`` if the package is upgradable.)rtrer;�
is_upgradablerkrOs r'r�zPackage.is_upgradable�s'��� �T�T�\�%;�%I�%I�$�)�%T�%T�Tr1c�f�|jp|jo#|jj�|j��S)z�Return ``True`` if the package is no longer required.

        If the package has been installed automatically as a dependency of
        another package, and if no packages depend on it anymore, the package
        is no longer required.
        )rtr�rer;�
is_garbagerkrOs r'�is_auto_removablezPackage.is_auto_removable�s4��
��4��!4�;��l�$�/�/��	�:�:�	;r1c�J�|jj�|j��S)z@Return whether the package is marked as automatically installed.)rer;�is_auto_installedrkrOs r'r�zPackage.is_auto_installeds���|�%�7�7��	�B�B�Br1c��|j|jfD]|}d|z}	t|d��5}|����d���d��cddd��cS#1swxYwY�m#t$rY�ywxYwgS)z�Return a list of files installed by the package.

        Return a list of unicode names of the files which have
        been installed by this package
        z/var/lib/dpkg/info/%s.list�rbrrN)rTr�r!�readr r"�EnvironmentError)r>rTrr�s    r'�installed_fileszPackage.installed_files	s���I�t�}�,�	�	�D�/�$�6�D�
��$��%�%�H��$�>�>�+�+�2�2�7�;�;�A�A�$�G�G�H�H�H�H�H�H�H�H�H�H�H�H�H�H����H�H�H�H�H��#�
�
�
���
�����	s4�A<�:A0�!A<�0A4	�4A<�7A4	�8A<�<
B	�B	Nc�
�|jdkr|jS|jstd��S|�w|jjdjdkrd}nY|jjdjdkrd}n;td��}t|t��r|S|�d	��S|jj}d
}|jj	}|jj
}	tj��}|�
|��rm|js�|jj
|jkr|j}|j	}nAtj|j|��dkr|j}|j	}|�
|���mn#t $rYnwxYw|�dd��}	t%|	��dkr|	d}~	|d}
|�d
��rd
|dz}
|�dd��}t%|��dkrd�|dd���}~|||
||d�z}t+j��}		t+jd��|r+|���r	t+j|��dSt3|��}
d}dt5j|��z}	|r+|���r	t+j|��dS|
���}|sn�|�d	��}t5j||��}|r�t=|jdd��}|r d|vr|�dd��d}|� d��}|r d|vr|�dd��d}|rtj||��dkrn||z
}��t%|��dkr9td��}t|t��s|�d	��}||_�n#tB$r�|jjdjdkrtd��||fz}ntd��}t|t��r|cYt+j|��S|�d	��cYt+j|��StDtFf$rhtd��}t|t��r|cYt+j|��S|�d	��cYt+j|��SwxYw	t+j|��n#t+j|��wxYw|jS)a�
        Download the changelog of the package and return it as unicode
        string.

        The parameter *uri* refers to the uri of the changelog file. It may
        contain multiple named variables which will be substitued. These
        variables are (src_section, prefix, src_pkg, src_ver). An example is
        the Ubuntu changelog::

            "http://changelogs.ubuntu.com/changelogs/pool" \
                "/%(src_section)s/%(prefix)s/%(src_pkg)s" \
                "/%(src_pkg)s_%(src_ver)s/changelog"

        The parameter *cancel_lock* refers to an instance of threading.Event,
        which if set, prevents the download.
        rz$The list of changes is not availableNr�Debianzshttp://packages.debian.org/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelog�Ubuntuzuhttp://changelogs.ubuntu.com/changelogs/pool/%(src_section)s/%(prefix)s/%(src_pkg)s/%(src_pkg)s_%(src_ver)s/changelogr�main�/r��lib��:)�src_section�prefix�src_pkg�src_verrz^%s \((.*)\)(.*)$TrGz�The list of changes is not available yet.

Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog
until the changes become available or try again later.zOFailed to download the list of changes. 
Please check your Internet connection.)$r�r�rr^r�rr;r r2rr6r"r�r�rGr��SystemErrorr"r�r&r��socket�getdefaulttimeout�setdefaulttimeout�is_setr�re�escape�readline�matchr�r
�groupr�IOErrorr)r>rx�cancel_lock�resrrrr	�src_records�
section_splitr�
src_ver_split�timeout�changelog_file�	changelog�regexp�line_rawr,rr
�
changelog_vers                     r'�
get_changelogzPackage.get_changelogs��&�?�b� � ��?�"��~�	=��;�<�<�<��;��~�%�a�(�/�8�;�;�9���
��'��*�1�X�=�=�9����>�?�?���c�3�'�'�/��J��:�:�g�.�.�.��.�,�����.�(���.�/��	2�
"�/�1�1�K��$�$�W�-�-�
2�"�*����>�0�K�4G�G�G�)�1�G�)�1�G���*�;�+>��H�H�1�L�L�)�1�G�)�1�G��$�$�W�-�-�
2����	�	�	��D�	����  �
�
�c�1�-�-�
��}����!�!�'��*�K���������e�$�$�	(��W�Q�Z�'�F� �
�
�c�1�-�-�
��}����!�!��g�g�m�A�B�B�/�0�0�G���&����	
�
�
���*�,�,��N	.�K
/��(��+�+�+���;�#5�#5�#7�#7���N
�$�W�-�-�-�-�-�K")������	�.�"�)�G�2D�2D�E��&�"�"�{�'9�'9�';�';�"�!�|
�$�W�-�-�-�-�-�y .�6�6�8�8�H�#���$�?�?�7�3�3�D��H�V�T�2�2�E��"�%,�D�N�I�t�$L�$L�	�$�C��	�)9�)9�(1����Q�(?�(?��(B�I�(-���A���
�(�K�S�M�-A�-A�,9�,?�,?��Q�,G�,G��,J�M�&�"� '� 7�
�y� Q� Q�UV� V� V�!���%�I�=&�B�y�>�>�Q�&�&� !�"H� I� I�I�%�i��5�5�>�$-�$4�$4�W�$=�$=�	�"+������
/�
/�
/��>�)�!�,�3�x�?�?��!���!�'�*�+�C�C��B�C�C�C��c�3�'�'�/��J�J�
�$�W�-�-�-�-��:�:�g�.�.�.�.�
�$�W�-�-�-�-��]�+�
/�
/�
/��6�����c�3�'�'�/��J�J�
�$�W�-�-�-�-��:�:�g�.�.�.�.��$�W�-�-�-�-�
/����% �8
�$�W�-�-�-�-��F�$�W�-�-�-�-������sn�	E�
E,�+E,�/*O0�0?O0�D(O0�.T"�0A T	�T"�&T	�;T"�6T	�T"�T	�2T"�T	�	T"�"T8c� �t|��S)zcReturn a VersionList() object for all available versions.

        .. versionadded:: 0.7.9
        )rrOs r'�versionszPackage.versions�s���4� � � r1c�J�|jj�|j��S)z5Return True if the to-be-installed package is broken.)rer;�is_inst_brokenrkrOs r'r$zPackage.is_inst_broken�r�r1c�J�|jj�|j��S)z/Return True if the installed package is broken.)rer;�
is_now_brokenrkrOs r'r&zPackage.is_now_broken�r�r1c�6�|jjtjkS)z8Checks whether the package is is the config-files state.)rk�
current_stater"�CURSTATE_CONFIG_FILESrOs r'�has_config_fileszPackage.has_config_files�s���y�&�'�*G�G�Gr1c��|j���|jj�|j��|j���dS)zMark a package for keep.N)rer�r;�	mark_keeprkr�rOs r'r,zPackage.mark_keep�sM��	
��%�%�'�'�'����(�(���3�3�3���&�&�(�(�(�(�(r1TFc���|j���|jj�|j|��|r�|jjjdkr�t
j|jj��}|�|j��|�	|j��|�
|j��|���|j���dS)a+Mark a package for deletion.

        If *auto_fix* is ``True``, the resolver will be run, trying to fix
        broken packages.  This is the default.

        If *purge* is ``True``, remove the configuration files of the package
        as well.  The default is to keep the configuration.
        rN)
rer�r;�mark_deleterk�broken_countr"�ProblemResolver�clear�protect�remove�resolver�)r>�auto_fix�purge�fixs    r'r.zPackage.mark_delete�s���	
��%�%�'�'�'����*�*�4�9�e�<�<�<��	���.�;�a�?�?��)�$�,�*@�A�A�C��I�I�d�i� � � ��K�K��	�"�"�"��J�J�t�y�!�!�!��K�K�M�M�M���&�&�(�(�(�(�(r1c��|j���|jj�|j||��|r||jjjdkrgt
j|jj��}|�|j��|�	|j��|�
d��|j���dS)a0Mark a package for install.

        If *autoFix* is ``True``, the resolver will be run, trying to fix
        broken packages.  This is the default.

        If *autoInst* is ``True``, the dependencies of the packages will be
        installed automatically.  This is the default.

        If *fromUser* is ``True``, this package will not be marked as
        automatically installed. This is the default. Set it to False if you
        want to be able to automatically remove the package at a later stage
        when no other package depends on it.
        rTN)rer�r;�mark_installrkr/r"r0r1r2r4r�)r>r5�	auto_inst�	from_user�fixers     r'r9zPackage.mark_installs���	
��%�%�'�'�'����+�+�D�I�y�)�L�L�L��	 ���.�;�a�?�?��+�D�L�,B�C�C�E��K�K��	�"�"�"��M�M�$�)�$�$�$��M�M�$������&�&�(�(�(�(�(r1c���|jr4|j}|�|���|�|��dStj�d|jjz��dS)zMark a package for upgrade.)r;z4MarkUpgrade() called on a non-upgradeable pkg: '%s'
N)	r�r�r9�	mark_auto�sys�stderr�writerkrT)r>r;�autos   r'�mark_upgradezPackage.mark_upgrade's{����		��)�D����	��2�2�2��N�N�4� � � � � �
�J���K��)�.�!�
�
�
�
�
r1c�P�|jj�|j|��dS)aMark a package as automatically installed.

        Call this function to mark a package as automatically installed. If the
        optional parameter *auto* is set to ``False``, the package will not be
        marked as automatically installed anymore. The default is ``True``.
        N)rer;r>rk)r>rBs  r'r>zPackage.mark_auto5s'��	
���(�(���D�9�9�9�9�9r1c�F�|jj�||��dS)aCommit the changes.

        The parameter *fprogress* refers to a apt_pkg.AcquireProgress() object,
        like apt.progress.text.AcquireProgress().

        The parameter *iprogress* refers to an InstallProgress() object, as
        found in apt.progress.base.
        N)rer;�commit)r>�	fprogress�	iprogresss   r'rFzPackage.commit?s%��	
���%�%�i��;�;�;�;�;r1)NN�TF)TTT)T)(r,r-r.r/rIrPrVr�r�r��setterr
rTr�r0rr�rr�r�r�r�r�r�rtr�r�r�r�r r"r$r&r*r,r.r9rCr>rFr0r1r'rrAsy��������������
�
�
�&�&�&�����X����)�)���)�����X���
,�
,��X�
,��-�-��X�-�����X������X���#�#��X�#�
&�&�&�$�@�@��X�@�
�@�@��X�@�
�?�?��X�?�
�=�=��X�=�
�B�B��X�B�
�B�B��X�B�
�1�1��X�1�
�U�U��X�U�
�
;�
;��X�
;��C�C��X�C�����X��"x�x�x�x�t�!�!��X�!��@�@��X�@�
�?�?��X�?�
�H�H��X�H�)�)�)�)�)�)�)�*)�)�)�)�2����:�:�:�:�
<�
<�
<�
<�
<r1rc��td��ddl}tj��tjj���}t	j|��}|d}td|j	z��td|j
z��td|jjz��td|j
jz��td	|j
jz��td
|jjz��td|jjz��td|jjz��td
|jjz��td|jz��td|jjz��td|jjz��td|jjz��td|jjz��td|jjz��td|j
jz��td|j
jz��|jjD]3}td�d�|jD�������4td|jjz��td|jjz��td|jj��t|d�����dD]�}td|��|D]8}|j r/|�!dd��dkr|�"|���9td|j#j$z��td |j#j%z����t��dD]�}td!|z��t	j|��}|�&��D][}|�!dd��dkr?	||�'|���9#tP$rtd"|z��Y�WwxYw�\td|j#j$z��td#|j#j)z����dS)$z
Self-test.zSelf-test for the Package modulrNz	apt-utilsz	Name: %s zID: %s zPriority (Candidate): %s zPriority (Installed): %s zInstalled: %s zCandidate: %s zCandidateDownloadable: %szCandidateOrigins: %szSourcePkg: %s zSection: %s zSummary: %szDescription (formatted) :
%szDescription (unformatted):
%szInstalledSize: %s zPackageSize: %s zDependencies: %szRecommends: %s�,c	3�ZK�|]&}|j�d|j�d|j�d|j�d�V��'dS)z (z) (�)N)rTrGrUr�)rv�os  r'r�z_test.<locals>.<genexpr>isW�������()�v�v�v�q�y�y�y�!�*�*�*�a�l�l�l�S������r1zarch: %szhomepage: %szrec: �2vcardrIz8Running install on random upgradable pkgs with AutoFix: r�zBroken: %s zInstCount: %s z.Randomly remove some packages with AutoFix: %szError trying to remove: %s z
DelCount: %s )*�print�randomr"�initr�r�r��
OpProgress�CacherTrr�r9r
rGrr^r2rrr-rr�r%rVrYr�r�rrr@r r��randintr9r;r/�
inst_countr�r.r
�	del_count)rRr�rlrmrH�irTs       r'�_testrZLsY��
�
+�,�,�,��M�M�M��L�N�N�N��|� �+�+�-�-�H��I�h���E�
��
�C�	�+���
 �!�!�!�	�)�c�f�
����	�
%��
�(>�
>�?�?�?�	�
%��
�(>�
>�?�?�?�	�
�S�]�2�
2�3�3�3�	�
�S�]�2�
2�3�3�3�	�
%��
�(B�
B�C�C�C�	�
 �3�=�#8�
8�9�9�9�	�
�S�]�6�
6�7�7�7�	�.�3�;�
&�'�'�'�	�-�#�-�/�
/�0�0�0�	�
)�C�M�,E�
E�F�F�F�	�
*�S�]�-J�
J�K�K�K�	�
���!=�
=�>�>�>�	�
�s�}�1�
1�2�2�2�	�
�s�}�9�
9�:�:�:�	�
�S�]�5�
5�6�6�6��}�)�
�
��
��H�H����,����
�
�	
�	
�	
�	
�
�*�s�}�1�
1�2�2�2�	�.�3�=�1�
1�2�2�2�	�'�3�=�'�(�(�(�	�%��/�
'�
'�
)�
)�*�*�*�
�=�=��
�H�!�L�L�L��	(�	(�C�� �
(��>�>�!�Q�'�'�1�,�,��$�$�Q�'�'�'��
�m�e�o�:�:�;�;�;�
����!;�;�<�<�<�<�	�G�G�G�
�
;�
;��
�>��B�C�C�C��	�(�#�#���J�J�L�L�	@�	@�D��~�~�a��#�#�q�(�(�@��$�K�+�+�A�.�.�.�.��"�@�@�@��7�$�>�?�?�?�?�?�@����)�
	�m�e�o�:�:�;�;�;�
�o��� 9�9�:�:�:�:�
;�
;s�O9�9P�P�__main__)3r/�
__future__rr�rr?rrr��	threading�http.clientr�urllib.errorr�urllib.requestr�typingrrr	r
rrr
rrrrr"�apt.progress.textr��apt.progress.baserrrr�__all__r(�	Exceptionr*r3�objectrrrrrrrrZr,r0r1r'�<module>rgs���*)�(�%�%�%�%�%�%�����	�	�	�	�
�
�
�
�	�	�	�	�
�
�
�
���������%�%�%�%�%�%�"�"�"�"�"�"�"�"�"�"�"�"�������������������������������������������
!� � � � � ������3�3�3�3�3��3�3�3�:�:�:�:�:�Z�:�:�:�V?�V?�V?�V?�V?�V�V?�V?�V?�rPL�PL�PL�PL�PL��n�%�PL�PL�PL�f)
�)
�)
�)
�)
�V�)
�)
�)
�XA�A�A�A�A�W�S�#�X�
�A�A�A�Hp(�p(�p(�p(�p(�f�p(�p(�p(�fW�W�W�W�W�(�7�#�W�W�W�tH<�H<�H<�H<�H<�f�H<�H<�H<�V�;;�;;���;;�~�z���	�E�G�G�G�G�G��r1