Current File : //usr/lib/python3/dist-packages/pip/_vendor/distlib/__pycache__/database.cpython-312.pyc
�

/�g������dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZddlmZddlmZmZddlmZmZmZmZdd	lmZmZmZmZmZmZm Z gd
�Z!ejDe#�Z$dZ%dZ&d
eddde%dfZ'dZ(Gd�de)�Z*Gd�de)�Z+Gd�de)�Z,Gd�de,�Z-Gd�de-�Z.Gd�de-�Z/e.Z0e/Z1Gd�d e)�Z2d%d!�Z3d"�Z4d#�Z5d$�Z6y)&zPEP 376 implementation.�)�unicode_literalsN�)�DistlibException�	resources)�StringIO)�
get_scheme�UnsupportedVersionError)�Metadata�METADATA_FILENAME�WHEEL_METADATA_FILENAME�LEGACY_METADATA_FILENAME)�parse_requirement�cached_property�parse_name_and_version�read_exports�
write_exports�	CSVReader�	CSVWriter)�Distribution�BaseInstalledDistribution�InstalledDistribution�EggInfoDistribution�DistributionPathzpydist-exports.jsonzpydist-commands.json�	INSTALLER�RECORD�	REQUESTED�	RESOURCES�SHAREDz
.dist-infoc�"�eZdZdZd�Zd�Zd�Zy)�_CachezL
    A simple cache mapping names and .dist-info paths to distributions
    c�.�i|_i|_d|_y)zZ
        Initialise an instance. There is normally one for each DistributionPath.
        FN)�name�path�	generated��selfs �>/usr/lib/python3/dist-packages/pip/_vendor/distlib/database.py�__init__z_Cache.__init__1s����	���	����c�z�|jj�|jj�d|_y)zC
        Clear the cache, setting it to its initial state.
        FN)r"�clearr#r$r%s r'r+z_Cache.clear9s'��	
�	�	�����	�	������r)c���|j|jvrO||j|j<|jj|jg�j	|�yy)z`
        Add a distribution to the cache.
        :param dist: The distribution to add.
        N)r#r"�
setdefault�key�append�r&�dists  r'�addz
_Cache.addAsN��
�9�9�D�I�I�%�#'�D�I�I�d�i�i� ��I�I� � ����2�.�5�5�d�;�&r)N)�__name__�
__module__�__qualname__�__doc__r(r+r2�r)r'r r ,s�����<r)r c�z�eZdZdZdd�Zd�Zd�Zeee�Zd�Z	d�Z
d�Zed	��Z
d
�Zd�Zdd�Zd
�Zdd�Zy)rzU
    Represents a set of distributions installed on a path (typically sys.path).
    Nc��|�tj}||_d|_||_t	�|_t	�|_d|_td�|_	y)a�
        Create an instance from a path, optionally including legacy (distutils/
        setuptools/distribute) distributions.
        :param path: The path to use, as a list of directories. If not specified,
                     sys.path is used.
        :param include_egg: If True, this instance will look for and return legacy
                            distributions as well as those based on PEP 376.
        NT�default)
�sysr#�
_include_dist�_include_eggr �_cache�
_cache_egg�_cache_enabledr�_scheme)r&r#�include_eggs   r'r(zDistributionPath.__init__PsO���<��8�8�D���	�!���'����h��� �(���"���!�)�,��r)c��|jS�N�r@r%s r'�_get_cache_enabledz#DistributionPath._get_cache_enabledds���"�"�"r)c��||_yrDrE)r&�values  r'�_set_cache_enabledz#DistributionPath._set_cache_enabledgs
��#��r)c�l�|jj�|jj�y)z,
        Clears the internal cache.
        N)r>r+r?r%s r'�clear_cachezDistributionPath.clear_cachels$��	
�����������r)c#��K�t�}|jD�]�}tj|�}|��|j	d�}|r|j
s�<t
|j�}|D�]�}|j	|�}|r|j|vr�&	|jr�|jt�r�tttg}|D]-}tj||�}	|j	|	�}
|
s�-n��tj |
j#��5}t%|d��}ddd�t&j)d|j�|j+|j�t-|j|����np|j.rd|jd�rSt&j)d|j�|j+|j�t1|j|���������y#1swY��xYw#t2$rT}
d}t&j5||j|
�d	dl}|j9||j|
fzd
��Yd}
~
���d}
~
wwxYw�w)zD
        Yield .dist-info and/or .egg(-info) distributions.
        N��legacy��fileobj�schemezFound %s)�metadata�env)�	.egg-info�.eggzBUnable to read distribution at %s, perhaps due to bad metadata: %sr�)�
stacklevel)�setr#r�finder_for_path�find�is_container�sortedr<�endswith�DISTINFO_EXTrrr
�	posixpath�join�
contextlib�closing�	as_streamr
�logger�debugr2�new_dist_classr=�old_dist_class�	Exception�warning�warnings�warn)r&�seenr#�finder�r�rset�entry�possible_filenames�metadata_filename�
metadata_path�pydist�streamrR�e�msgrjs                r'�_yield_distributionsz%DistributionPath._yield_distributionsss�����u���I�I�,	C�D��.�.�t�4�F��~�����B��A��A�N�N���!�+�+�&�D��$
C���K�K��&���A�F�F�d�N�� C��)�)�e�n�n�\�.J�-�/F�4�.�*�2D�%�-�,5�N�N� %�'8�-:�M�%+�[�[��%?�F�%� %�%�%�'�/�/��0@�0@�0B�C�A�v�'/��7?�(A�H�A����Z����8�������(�,�Q�V�V�6>�15�7�7��*�*�u�~�~�1�03����Z����8�������(�,�Q�V�V�T�:�:��?$
C�,	C�6A�A��!�C�^�C��N�N�3�����2�#��M�M�#������"3��M�B�B��	C�s]�BI*�A H
�4H
�7I*�8#H
�G>�)CH
�7I*�>H�H
�
	I'�A	I"�I*�"I'�'I*c��|jj}|jxr|jj}|s|r�|j	�D]I}t|t�r|jj|��/|jj|��K|rd|j_|rd|j_yyy)zk
        Scan the path for distributions and populate the cache with
        those that are found.
        TN)r>r$r=r?rx�
isinstancerr2)r&�gen_dist�gen_eggr1s    r'�_generate_cachez DistributionPath._generate_cache�s���
�{�{�,�,�,���#�#�E�D�O�O�,E�,E�(E���w��1�1�3�
.���d�$9�:��K�K�O�O�D�)��O�O�'�'��-�	
.��(,����%��,0����)��r)c�Z�|jdd�}dj||g�tzS)ao
        The *name* and *version* parameters are converted into their
        filename-escaped form, i.e. any ``'-'`` characters are replaced
        with ``'_'`` other than the one in ``'dist-info'`` and the one
        separating the name from the version number.

        :parameter name: is converted to a standard distribution name by replacing
                         any runs of non- alphanumeric characters with a single
                         ``'-'``.
        :type name: string
        :parameter version: is converted to a standard version string. Spaces
                            become dots, and all other non-alphanumeric characters
                            (except dots) become dashes, with runs of multiple
                            dashes condensed to a single dash.
        :type version: string
        :returns: directory name
        :rtype: string�-�_)�replacer`r^)�clsr"�versions   r'�distinfo_dirnamez!DistributionPath.distinfo_dirname�s,��&�|�|�C��%���x�x��w��(�<�7�7r)c#�FK�|js|j�D]}|���y|j�|jjj�D]}|���|jr.|jjj�D]}|���yy�w)a5
        Provides an iterator that looks for distributions and returns
        :class:`InstalledDistribution` or
        :class:`EggInfoDistribution` instances for each one of them.

        :rtype: iterator of :class:`InstalledDistribution` and
                :class:`EggInfoDistribution` instances
        N)r@rxr}r>r#�valuesr=r?r0s  r'�get_distributionsz"DistributionPath.get_distributions�s������"�"��1�1�3�
���
�
�
� � �"����(�(�/�/�1�
���
�
�� � � �O�O�0�0�7�7�9��D��J��!�s�BB!c��d}|j�}|js+|j�D]}|j|k(s�|}|S|S|j	�||j
jvr|j
j|d}|S|jr4||jjvr|jj|d}|S)a=
        Looks for a named distribution on the path.

        This function only returns the first result found, as no more than one
        value is expected. If nothing is found, ``None`` is returned.

        :rtype: :class:`InstalledDistribution`, :class:`EggInfoDistribution`
                or ``None``
        Nr)	�lowerr@rxr.r}r>r"r=r?)r&r"�resultr1s    r'�get_distributionz!DistributionPath.get_distribution�s������z�z�|���"�"��1�1�3�
���8�8�t�#�!�F���
�
��
�

� � �"��t�{�{�'�'�'����)�)�$�/��2���
��"�"�t�t���/C�/C�'C����-�-�d�3�A�6���
r)c#�K�d}|�"	|jj|�d|�d��}|j	�D]q}t|d�stjd|��&|j}|D];}t|�\}}|�||k(s�|���S||k(s�%|j|�s�7|���q�sy#t$rtd|�d|����wxYw�w)a
        Iterates over all distributions to find which distributions provide *name*.
        If a *version* is provided, it will be used to filter the results.

        This function only returns the first result found, since no more than
        one values are expected. If the directory is not found, returns ``None``.

        :parameter version: a version specifier that indicates the version
                            required, conforming to the format in ``PEP-345``

        :type name: string
        :type version: string
        N� (�)zinvalid name or version: �, �provideszNo "provides": %s)rA�matcher�
ValueErrorrr��hasattrrdrer�r�match)	r&r"r�r�r1�provided�p�p_name�p_vers	         r'�provides_distributionz&DistributionPath.provides_distributions���������
8��,�,�.�.�D�'�/J�K��
�*�*�,�	"�D��4��,����0�$�7��=�=��!�	"�A�$:�1�$=�M�F�E���!�T�>�"&�J�!�!�T�>�g�m�m�E�.B�"&�J�!�	"�	"��	�
8�&�(,�g�(7�8�8�
8�s.�C�!B.�AC�C�C�$
C�.C	�	Cc�f�|j|�}|�td|z��|j|�S)z5
        Return the path to a resource file.
        zno distribution named %r found)r��LookupError�get_resource_path)r&r"�
relative_pathr1s    r'�
get_file_pathzDistributionPath.get_file_path+s;���$�$�T�*���<��>��E�F�F��%�%�m�4�4r)c#�K�|j�D]@}|j}||vs�||}|�
||vs� ||���(|j�D]}|����By�w)z�
        Return all of the exported entries in a particular category.

        :param category: The category to search for entries.
        :param name: If specified, only entries with that name are returned.
        N)r��exportsr�)r&�categoryr"r1rn�d�vs       r'�get_exported_entriesz%DistributionPath.get_exported_entries4si�����*�*�,�		 �D����A��1�}��h�K���#��q�y���g�
��X�X�Z� ���� �		 �s�$A�A�$A)NFrD)r3r4r5r6r(rFrI�property�
cache_enabledrKrxr}�classmethodr�r�r�r�r�r�r7r)r'rrKse���-�(#�$��/�1C�D�M� �4C�l1�&�8��8�*�,�4'"�R5� r)rc���eZdZdZdZ	dZ	d�Zed��ZeZ	ed��Z
ed��Zd�Zed��Z
ed	��Zed
��Zed��Zed��Zd
�Zd�Zd�Zd�Zy)rz�
    A base class for distributions, whether installed or from indexes.
    Either way, it must have some metadata, so that's all that's needed
    for construction.
    Fc��||_|j|_|jj�|_|j|_d|_d|_d|_d|_t�|_
i|_y)z�
        Initialise an instance.
        :param metadata: The instance of :class:`Metadata` describing this
        distribution.
        N)rRr"r�r.r��locator�digest�extras�contextrX�
download_urls�digests)r&rRs  r'r(zDistribution.__init__Ysb��!��
��M�M��	��9�9�?�?�$����'�'��������������� �U�����r)c�.�|jjS)zH
        The source archive download URL for this distribution.
        )rR�
source_urlr%s r'r�zDistribution.source_urljs��
�}�}�'�'�'r)c�:�|j�d|j�d�S)zX
        A utility property which displays the name and version in parentheses.
        r�r��r"r�r%s r'�name_and_versionzDistribution.name_and_versionss��
!�I�I�t�|�|�4�4r)c��|jj}|j�d|j�d�}||vr|j	|�|S)z�
        A set of distribution names and versions provided by this distribution.
        :return: A set of "name (version)" strings.
        r�r�)rRr�r"r�r/)r&�plist�ss   r'r�zDistribution.provideszs<���
�
�&�&�����D�L�L�1���E�>��L�L��O��r)c���|j}t||�}tjd|j||�t|j
||j|j���S)Nz)%s: got requirements %r from metadata: %r)r�rS)	rR�getattrrdrer"rX�get_requirementsr�r�)r&�req_attr�md�reqtss    r'�_get_requirementszDistribution._get_requirements�s]��
�]�]����H�%�����@�$�)�)��u�	&������d�k�k�t�|�|��L�N�	Nr)c�$�|jd�S)N�run_requires�r�r%s r'r�zDistribution.run_requires�����%�%�n�5�5r)c�$�|jd�S)N�
meta_requiresr�r%s r'r�zDistribution.meta_requires�����%�%�o�6�6r)c�$�|jd�S)N�build_requiresr�r%s r'r�zDistribution.build_requires�s���%�%�&6�7�7r)c�$�|jd�S)N�
test_requiresr�r%s r'r�zDistribution.test_requires�r�r)c�$�|jd�S)N�dev_requiresr�r%s r'r�zDistribution.dev_requires�r�r)c���t|�}t|jj�}	|j	|j
�}|j}d}|jD]*}t|�\}}	||k7r�	|j|	�}|S|S#t$r=tjd|�|j�d}|j	|�}Y��wxYw#t$rY��wxYw)z�
        Say if this instance matches (fulfills) a requirement.
        :param req: The requirement to match.
        :rtype req: str
        :return: True if it matches, else False.
        �+could not read version %r - using name onlyrF)rrrRrQr��requirementr	rdri�splitr.r�rr�)
r&�reqrnrQr�r"r�r�r�r�s
          r'�matches_requirementz Distribution.matches_requirement�s���
�c�"���D�M�M�0�0�1��	+��n�n�Q�]�]�3�G��{�{�������	�A�2�1�5�M�F�E���~��
� ���u�-����
�	��
��%'�	+��N�N�H�#�N��9�9�;�q�>�D��n�n�T�*�G�		+�� +�
��
�s$�B�9C�AC�C�	C%�$C%c�~�|jrd|jz}nd}d|j�d|j�d|�d�S)zC
        Return a textual representation of this instance,
        z [%s]rMz<Distribution r�r��>)r�r"r�)r&�suffixs  r'�__repr__zDistribution.__repr__�s4���?�?��t���.�F��F��-1�Y�Y����f�M�Mr)c���t|�t|�urd}|S|j|jk(xr4|j|jk(xr|j|jk(}|S)a<
        See if this distribution is the same as another.
        :param other: The distribution to compare with. To be equal to one
                      another. distributions must have the same type, name,
                      version and source_url.
        :return: True if it is the same, else False.
        F)�typer"r�r�)r&�otherr�s   r'�__eq__zDistribution.__eq__�sg����;�d�4�j�(��F��
��i�i�5�:�:�-�>�$�,�,�%�-�-�2O�>��/�/�U�-=�-=�=�
��
r)c��t|j�t|j�zt|j�zS)zH
        Compute hash in a way which matches the equality test.
        )�hashr"r�r�r%s r'�__hash__zDistribution.__hash__�s.���D�I�I���d�l�l�!3�3�d�4�?�?�6K�K�Kr)N)r3r4r5r6�build_time_dependency�	requestedr(r�r��download_urlr�r�r�r�r�r�r�r�r�r�r�r�r7r)r'rrGs����"���
�I�5��"�(��(��L�
�5��5��	��	�N��6��6��7��7��8��8��7��7��6��6��BN�
�Lr)rc�0��eZdZdZdZd�fd�	Zdd�Z�xZS)rz]
    This is the base class for installed distributions (whether PEP 376 or
    legacy).
    Nc�H��tt|�|�||_||_y)a
        Initialise an instance.
        :param metadata: An instance of :class:`Metadata` which describes the
                         distribution. This will normally have been initialised
                         from a metadata file in the ``path``.
        :param path:     The path of the ``.dist-info`` or ``.egg-info``
                         directory for the distribution.
        :param env:      This is normally the :class:`DistributionPath`
                         instance where this distribution was found.
        N)�superrr(r#�	dist_path)r&rRr#rS�	__class__s    �r'r(z"BaseInstalledDistribution.__init__�s#���	�'��7��A���	���r)c�$�|�|j}|�tj}d}ntt|�}d|jz}||�j	�}tj|�jd�jd�}|�|��S)a�
        Get the hash of some data, using a particular hash algorithm, if
        specified.

        :param data: The data to be hashed.
        :type data: bytes
        :param hasher: The name of a hash implementation, supported by hashlib,
                       or ``None``. Examples of valid values are ``'sha1'``,
                       ``'sha224'``, ``'sha384'``, '``sha256'``, ``'md5'`` and
                       ``'sha512'``. If no hasher is specified, the ``hasher``
                       attribute of the :class:`InstalledDistribution` instance
                       is used. If the hasher is determined to be ``None``, MD5
                       is used as the hashing algorithm.
        :returns: The hash of the data. If a hasher was explicitly specified,
                  the returned hash will be prefixed with the specified hasher
                  followed by '='.
        :rtype: str
        rMz%s=�=�ascii)	�hasher�hashlib�md5r�r��base64�urlsafe_b64encode�rstrip�decode)r&�datar��prefixr�s     r'�get_hashz"BaseInstalledDistribution.get_hash�s���&�>��[�[�F��>��[�[�F��F��W�f�-�F��T�[�[�(�F����$�$�&���)�)�&�1�8�8��>�E�E�g�N����(�(r)rD)r3r4r5r6r�r(r��
__classcell__�r�s@r'rr�s����
�F�
�)r)rc���eZdZdZdZd�fd�	Zd�Zd�Zd�Ze	d��Z
d�Zd	�Zd
�Z
d�Zdd�Zd
�Ze	d��Zdd�Zd�Zd�Zd�Zd�Zej0Z�xZS)ra
    Created with the *path* of the ``.dist-info`` directory provided to the
    constructor. It reads the metadata contained in ``pydist.json`` when it is
    instantiated., or uses a passed in Metadata instance (useful for when
    dry-run mode is being used).
    �sha256c���g|_tj|�x|_}|�t	d|z��|rH|j
r<||jjvr$|jj|j}n�|��|jt�}|�|jt�}|�|jt�}|�t	dt�d|����tj|j��5}t!|d��}ddd�t"t$|�O|||�|r'|j
r|jj)|�|jd�}|du|_t,jj/|d�}t,jj1|�rJt3|d�5}|j5�j7d	�}	ddd�	j9�|_yy#1swY��xYw#1swY�,xYw)
Nzfinder unavailable for %szno z
 found in rNrOr�
top_level.txt�rb�utf-8)�modulesrrYrmr�r@r>r#rRrZrrr
rarbrcr
r�rr(r2r��osr`�exists�open�readr��
splitlines)r&r#rRrSrmrnrur��fr�r�s          �r'r(zInstalledDistribution.__init__$s�������(�8�8��>�>���f��>��8�4�?�@�@��3�%�%�$�#�*�*�/�/�*A��z�z���t�,�5�5�H�
�
����-�.�A��y��K�K� 7�8���y��K�K� 8�9���y� �"3�T�";�<�<��#�#�A�K�K�M�2�
E�f�#�F�8�D��
E�	�#�T�3�H�d�C�H��3�%�%��J�J�N�N�4� ��K�K��$���$�����G�G�L�L���/��
�7�7�>�>�!���a���
0�!��v�v�x���w�/��
0��?�?�,�D�L��
E�
E��
0�
0�s�>G6�7 H�6G?�Hc�V�d|j�d|j�d|j�d�S)Nz<InstalledDistribution � � at r��r"r�r#r%s r'r�zInstalledDistribution.__repr__Fs���I�I�t�|�|�T�Y�Y�0�	0r)c�8�|j�d|j��S�Nrr�r%s r'�__str__zInstalledDistribution.__str__J����)�)�T�\�\�2�2r)c�x�g}|jd�}tj|j��5}t	|��5}|D]A}tt
|�d�D�cgc]}d��}}||z\}}	}
|j||	|
f��C	ddd�ddd�|Scc}w#1swY�xYw#1swY|SxYw)a"
        Get the list of installed files for the distribution
        :return: A list of tuples of path, hash and size. Note that hash and
                 size might be ``None`` for some entries. The path is exactly
                 as stored in the file (which is as in PEP 376).
        r�ru�N)�get_distinfo_resourcerarbrcr�range�lenr/)r&�resultsrnru�
record_reader�row�i�missingr#�checksum�sizes           r'�_get_recordsz"InstalledDistribution._get_recordsMs������&�&�x�0��
�
�
����
�
.�	;�&��&�)�

;�]�)�;�C�-2�3�s�8�Q�-?�@��t�@�G�@�+.��=�(�D�(�D��N�N�D�(�D�#9�:�
;�	

;�	;����
A�

;�

;��	;���s5�
B/�B#�!	B
�*!B#�B/�B#�#B,	�(B/�/B9c�X�i}|jt�}|r|j�}|S)a
        Return the information exported by this distribution.
        :return: A dictionary of exports, mapping an export category to a dict
                 of :class:`ExportEntry` instances describing the individual
                 export entries, and keyed by name.
        )r�EXPORTS_FILENAMEr)r&r�rns   r'r�zInstalledDistribution.exportsds0�����&�&�'7�8����&�&�(�F��
r)c���i}|jt�}|r9tj|j	��5}t|�}ddd�|S|S#1swY|SxYw)z�
        Read exports data from a file in .ini format.

        :return: A dictionary of exports, mapping an export category to a list
                 of :class:`ExportEntry` instances describing the individual
                 export entries.
        N)rrrarbrcr)r&r�rnrus    r'rz"InstalledDistribution.read_exportsrs[�����&�&�'7�8����#�#�A�K�K�M�2�
.�f�%�f�-��
.��
�v�
�
.��
�s�A�Ac��|jt�}t|d�5}t||�ddd�y#1swYyxYw)a
        Write a dictionary of exports to a file in .ini format.
        :param exports: A dictionary of exports, mapping an export category to
                        a list of :class:`ExportEntry` instances describing the
                        individual export entries.
        �wN)�get_distinfo_filerr�r)r&r��rfrs    r'rz#InstalledDistribution.write_exports�s?���
#�
#�$4�
5��
�"�c�]�	&�a��'�1�%�	&�	&�	&�s	�
8�Ac�>�|jd�}tj|j��5}t	|��5}|D] \}}||k(s�|ccddd�cddd�S	ddd�ddd�td|z��#1swY�xYw#1swY�#xYw)aW
        NOTE: This API may change in the future.

        Return the absolute path to a resource file with the given relative
        path.

        :param relative_path: The path, relative to .dist-info, of the resource
                              of interest.
        :return: The absolute path where the resource is to be found.
        rr
Nz3no resource file with relative path %r is installed)rrarbrcr�KeyError)r&r�rnru�resources_reader�relative�destinations       r'r�z'InstalledDistribution.get_resource_path�s���
�&�&�{�3��
�
�
����
�
.�	+�&��&�)�
+�-=�-=�+�)�H�k��=�0�*�*�
+�
+�	+�	+�+�
+�	+�
�&�(5�6�7�	7�	
+�
+��	+�	+�s5�
B�B�B�	B�'B�)B�B	�B�Bc#�>K�|j�D]}|���y�w)z�
        Iterates over the ``RECORD`` entries and returns a tuple
        ``(path, hash, size)`` for each line.

        :returns: iterator of (path, hash, size)
        N)r)r&r�s  r'�list_installed_filesz*InstalledDistribution.list_installed_files�s%�����'�'�)�	�F��L�	�s�c��tjj|d�}tjj|j�}|j	|�}tjj|d�}|jd�}tjd|�|ryt|�5}|D]�}tjj|�s|jd�rdx}	}
nVdtjj|�z}
t|d�5}|j|j��}	ddd�|j	|�s|r1|j	|�r tjj||�}|j!|	|
f���|j	|�r tjj||�}|j!|ddf�ddd�|S#1swY��xYw#1swY|SxYw)z�
        Writes the ``RECORD`` file, using the ``paths`` iterable passed in. Any
        existing ``RECORD`` file is silently overwritten.

        prefix is used to determine when to write absolute paths.
        rMr�creating %sN�z.pycz.pyoz%dr�)r�r#r`�dirname�
startswithrrd�infor�isdirr]�getsizer�r�r��relpath�writerow)r&�pathsr��dry_run�base�base_under_prefix�record_path�writerr#�
hash_valuer�fps            r'�write_installed_filesz+InstalledDistribution.write_installed_files�s��������f�b�)���w�w���t�y�y�)�� �O�O�F�3���w�w�|�|�D�"�%���,�,�X�6�����M�;�/���
�{�
#�	3�v��
:���7�7�=�=��&�$�-�-�8H�*I�(*�*�J���"�'�'�/�/�$�"7�7�D��d�D�)�>�R�%)�]�]�2�7�7�9�%=�
�>��?�?�4�(�->�15����1H��7�7�?�?�4��6�D�����z�4� 8�9�
:��%�%�d�+� �g�g�o�o�k�4�@���O�O�[�"�b�1�2�#	3�$��>�>��	3�$��s&�0A)G6� G*�9B'G6�*G3�/G6�6Hc�h�g}tjj|j�}|jd�}|j	�D�]T\}}}tjj|�s tjj
||�}||k(r�Mtjj|�s|j|dddf���tjj|�s��ttjj|��}|r||k7r|j|d||f���|s��d|vr|jdd�d}nd	}t|d
�5}	|j|	j�|�}
|
|k7r|j|d||
f�d	d	d	���W|S#1swY��dxYw)�
        Checks that the hashes and sizes of the files in ``RECORD`` are
        matched by the files themselves. Returns a (possibly empty) list of
        mismatches. Each entry in the mismatch list will be a tuple consisting
        of the path, 'exists', 'size' or 'hash' according to what didn't match
        (existence is checked first, then size, then hash), the expected
        value and the actual value.
        rr�TFr�=rrNr�r�)r�r#r(rr$�isabsr`r�r/�isfile�strr,r�r�r�r�)r&�
mismatchesr1r3r#r5r�actual_sizer�r�actual_hashs           r'�check_installed_filesz+InstalledDistribution.check_installed_files�s����
��w�w���t�y�y�)���,�,�X�6��&*�&?�&?�&A�	I�"�D�*�d��7�7�=�=��&��w�w�|�|�D�$�/���{�"���7�7�>�>�$�'��!�!�4��4��"?�@�������%�!�"�'�'�/�/�$�"7�8���K�4�/��%�%�t�V�T�;�&G�H���j�(�!+�!1�!1�#�q�!9�!�!<��!%���d�D�)�I�Q�&*�m�m�A�F�F�H�f�&E��&�*�4�&�-�-�!%�v�z�;� G�I�I�I�#	I�,��I�I�s�;F'�'F1	c���i}tjj|jd�}tjj|�r�t	j
|dd��5}|j
�j�}ddd�D]C}|jdd�\}}|dk(r"|j|g�j|��?|||<�E|S#1swY�SxYw)	a�
        A dictionary of shared locations whose keys are in the set 'prefix',
        'purelib', 'platlib', 'scripts', 'headers', 'data' and 'namespace'.
        The corresponding value is the absolute path of that category for
        this distribution, and takes into account any paths selected by the
        user at installation time (e.g. via command-line arguments). In the
        case of the 'namespace' key, this would be a list of absolute paths
        for the roots of namespace packages in this distribution.

        The first time this property is accessed, the relevant information is
        read from the SHARED file in the .dist-info directory.
        rrnr���encodingNr:r�	namespace)r�r#r`r<�codecsr�r�r�r�r-r/)r&r��shared_pathr�lines�liner.rHs        r'�shared_locationsz&InstalledDistribution.shared_locations�s������g�g�l�l�4�9�9�h�7��
�7�7�>�>�+�&����[�#��@�
.�A�����+�+�-��
.��
(��!�Z�Z��Q�/�
��U��+�%��%�%�c�2�.�5�5�e�<�"'�F�3�K�
(��
�
.�
.�s�$C�Cc��tjj|jd�}tj	d|�|ryg}dD]@}||}tjj||�s�+|j
|�d|����B|jdd�D]}|j
d|z��tj|d	d
��5}|jdj|��ddd�|S#1swY|SxYw)
aa
        Write shared location information to the SHARED file in .dist-info.
        :param paths: A dictionary as described in the documentation for
        :meth:`shared_locations`.
        :param dry_run: If True, the action is logged but no file is actually
                        written.
        :return: The path of the file written to.
        rr&N)r��lib�headers�scriptsr�r:rEr7znamespace=%srr�rC�
)r�r#r`rdr*r+r/�getrFr��write)	r&r/r0rGrHr.r#�nsrs	         r'�write_shared_locationsz,InstalledDistribution.write_shared_locationss����g�g�l�l�4�9�9�h�7�����M�;�/�����B�	4�C���:�D��w�w�}�}�U�3�Z�(�����T�2�3�	4��)�)�K��,�	.�B��L�L��"�,�-�	.��[�[��c�G�
<�	&��
�G�G�D�I�I�e�$�%�	&���	&���s�!C9�9Dc���|tvrtd|�d|j����tj|j�}|�td|jz��|j|�S)N�#invalid path for a dist-info file: rzUnable to get a finder for %s)�
DIST_FILESrr#rrYrZ)r&r#rms   r'rz+InstalledDistribution.get_distinfo_resource%se���z�!�"�15�t�y�y�$B�C�
C��*�*�4�9�9�5���>�"�#B�T�Y�Y�#N�O�O��{�{�4� � r)c	���|jtj�dk\r}|jtj�dd\}}||jjtj�dk7r)td|�d|j�d|j�d���|tvrtd	|�d
|j����tjj|j|�S)a�
        Returns a path located under the ``.dist-info`` directory. Returns a
        string representing the path.

        :parameter path: a ``'/'``-separated path relative to the
                         ``.dist-info`` directory or an absolute path;
                         If *path* is an absolute path and doesn't start
                         with the ``.dist-info`` directory path,
                         a :class:`DistlibException` is raised
        :type path: str
        :rtype: str
        r���N���zdist-info file z does not belong to the rz
 distributionrUr)
rZr��sepr�r#rr"r�rVr`)r&r#r�s   r'rz'InstalledDistribution.get_distinfo_file.s����9�9�R�V�V���!�%)�Z�Z����%7���%<�"��d��4�9�9�?�?�2�6�6�#:�2�#>�>�&�&*�D�I�I�t�|�|�E�F�F�
�z�!�"�15�t�y�y�$B�C�
C��w�w�|�|�D�I�I�t�,�,r)c#�NK�tjj|j�}|j�D]e\}}}tjj	|�s tjj||�}|j
|j�s�b|���gy�w)z�
        Iterates over the ``RECORD`` entries and returns paths for each line if
        the path is pointing to a file located in the ``.dist-info`` directory
        or one of its subdirectories.

        :returns: iterator of paths
        N)r�r#r(rr;r`r))r&r1r#rrs     r'�list_distinfo_filesz)InstalledDistribution.list_distinfo_filesKsv�����w�w���t�y�y�)��$(�$5�$5�$7�	� �D�(�D��7�7�=�=��&��w�w�|�|�D�$�/�����t�y�y�)��
�	�s�BB%�B%c�X�t|t�xr|j|jk(SrD)rzrr#�r&r�s  r'r�zInstalledDistribution.__eq__[s'���5�"7�8�,��I�I����+�	-r))NN�F)r3r4r5r6r�r(r�rrrr�rrr�r$r7rArJrSrrr\r��objectr�r�r�s@r'rrs������F� -�D0�3��.����
�	&�7�(�!�F"�H����4�2!�-�:� -�
���Hr)rc�p��eZdZdZdZiZd�fd�	Zd�Zd�Zd�Z	d�Z
d�Zdd	�Zd
�Z
ejZ�xZS)
raCreated with the *path* of the ``.egg-info`` directory or file provided
    to the constructor. It reads the metadata contained in the file itself, or
    if the given path happens to be a directory, the metadata is read from the
    file ``PKG-INFO`` under that directory.Tc����d�}||_||_|rf|jrZ||jjvrB|jj|j}|||j
|j�nX|j|�}|||j
|j�|r'|jr|jj|�tt|�/|||�y)Nc�J�||_|j�|_||_yrD)r"r�r.r�)r��nr�s   r'�set_name_and_versionz:EggInfoDistribution.__init__.<locals>.set_name_and_versionns���A�F��G�G�I�A�E��A�Ir))r#r�r@r?rRr"r��
_get_metadatar2r�rr()r&r#rSrerRr�s     �r'r(zEggInfoDistribution.__init__ls����	�
��	�����3�%�%�$�#�.�.�2E�2E�*E��~�~�*�*�4�0�9�9�H� ��x�}�}�h�6F�6F�G��)�)�$�/�H�
!��x�}�}�h�6F�6F�G��s�)�)����"�"�4�(�
�!�4�1�(�D�#�Fr)c���d}d���fd�}dx}}|jd��rKtjj|�r�tjj	|d�}tjj	|d�}t|d��}tjj	|d�}	tjj	|d	�}||	�}�nIt
j|�}
t|
jd
�jd��}t|d��}	|
jd
�}|
jd�jd�}�|jd��}n�|jd�r�tjj|�rhtjj	|d�}	||	�}tjj	|d�}tjj	|d	�}t|d��}ntd|z��|r|j|�|�U|�Stjj|�r4t|d�5}
|
j!�jd�}ddd�|sg}n|j#�}||_|S#t$rd}Y��wxYw#1swY�8xYw)Nc��g}|j�}|D]�}|j�}|s�|jd�rtj	d|�|St|�}|stj	d|��d|jrtj	d�|js|j|j���djd�|jD��}|j|j�d|�d����|S)	z�Create a list of dependencies from a requires.txt file.

            *data*: the contents of a setuptools-produced requires.txt file.
            �[z.Unexpected line: quitting requirement scan: %rz#Not recognised as a requirement: %rz4extra requirements in requires.txt are not supportedr�c3�&K�|]	}d|z���y�w)z%s%sNr7)�.0�cs  r'�	<genexpr>zQEggInfoDistribution._get_metadata.<locals>.parse_requires_data.<locals>.<genexpr>�s����$G�A�V�a�Z�$G���r�r�)r��stripr)rdrirr��constraintsr/r"r`)r��reqsrHrIrn�conss      r'�parse_requires_dataz>EggInfoDistribution._get_metadata.<locals>.parse_requires_data�s���
�D��O�O�%�E��
<���z�z�|�����?�?�3�'��N�N�H�$�P���K�&�d�+����N�N�#H�$�O���8�8��N�N�$3�4��}�}��K�K����'��9�9�$G����$G�G�D��K�K�Q�V�V�T� :�;�)
<�*�Kr)c���g}	tj|dd�5}�|j��}ddd�|S#1swY|SxYw#t$rY|SwxYw)z�Create a list of dependencies from a requires.txt file.

            *req_path*: the path to a setuptools-produced requires.txt file.
            rnr�N)rFr�r��IOError)�req_pathrqr6rss   �r'�parse_requires_pathz>EggInfoDistribution._get_metadata.<locals>.parse_requires_path�sg����D�
��[�[��3��8�:�B�.�r�w�w�y�9�D�:��K�	:��K���
���K�
�s+�A
�=�A
�A�A
�A
�
	A�ArUzEGG-INFOzPKG-INFOrN)r#rQzrequires.txtr�zEGG-INFO/PKG-INFO�utf8rOzEGG-INFO/requires.txtzEGG-INFO/top_level.txtr�rTz,path must end with .egg-info or .egg, got %rr�)r]r�r#r+r`r
�	zipimport�zipimporterr�get_datar�rur�add_requirementsr�r�r�r�r�)r&r#�requiresrw�tl_path�tl_datar��	meta_pathrRrv�zipfrPr�rrss              @r'rfz!EggInfoDistribution._get_metadata�sI�����	�<	�!� ��'��=�=�� ��w�w�}�}�T�"��G�G�L�L��z�2���G�G�L�L��J�7�	�#��8�D���7�7�<�<��>�:���'�'�,�,�q�/�:��.�x�8��!�,�,�T�2��"��M�M�"5�6�=�=�f�E�G��#�G�H�E��$��=�=�)@�A�D�"�m�m�,D�E�L�L��!�G�2�4�;�;�w�3G�H�H��]�]�;�
'��w�w�}�}�T�"��7�7�<�<��n�=��.�x�8���w�w�|�|�D�*�5���'�'�,�,�t�_�=���T�(�;�H�"�$,�.2�$3�4�
4���%�%�h�/��?��"�r�w�w�~�~�g�'>��'�4�(�7�A��f�f�h�o�o�g�6�G�7���G��(�(�*�G�������3�$�#�H�$��$7�7�s�$AJ)�# J:�)J7�6J7�:Kc�V�d|j�d|j�d|j�d�S)Nz<EggInfoDistribution rrr�rr%s r'r�zEggInfoDistribution.__repr__�s"��6:�i�i����6:�i�i�A�	Ar)c�8�|j�d|j��Srr�r%s r'rzEggInfoDistribution.__str__�rr)c�D�g}tjj|jd�}tjj|�rT|j	�D]A\}}}||k(r�
tjj|�r�-|j|dddf��C|S)r9�installed-files.txtr�TF)r�r#r`r�r$r/)r&r>r3r#r�s     r'rAz)EggInfoDistribution.check_installed_files�s����
��g�g�l�l�4�9�9�.C�D��
�7�7�>�>�+�&�"�7�7�9�
E�
��a���;�&���w�w�~�~�d�+��%�%�t�X�t�U�&C�D�	
E�
�r)c	��d�}d�}tjj|jd�}g}tjj|��rt	j
|dd��5}|D]�}|j
�}tjjtjj|j|��}tjj|�s(tjd|�|jd�r��tjj|�r��|j|||�||�f���	d	d	d	�|j|d	d	f�|S#1swY�xYw)
z�
        Iterates over the ``installed-files.txt`` entries and returns a tuple
        ``(path, hash, size)`` for each line.

        :returns: a list of (path, hash, size)
        c���t|d�}	|j�}|j�tj|�j�S#|j�wxYw)Nr�)r�r��closer�r��	hexdigest)r#r�contents   r'�_md5z6EggInfoDistribution.list_installed_files.<locals>._md5sL���T�4� �A�
��&�&�(�����	��;�;�w�'�1�1�3�3�����	�s�A�A#c�@�tj|�jSrD)r��stat�st_size)r#s r'�_sizez7EggInfoDistribution.list_installed_files.<locals>._size
s���7�7�4�=�(�(�(r)r�rnr�rCzNon-existent file: %sr'N)
r�r#r`r�rFr�ro�normpathrdrir]r+r/)r&r�r�r3r�rrIr�s        r'r$z(EggInfoDistribution.list_installed_files�s��	4�	)��g�g�l�l�4�9�9�.C�D����
�7�7�>�>�+�&����[�#��@�
>�A��>�D��:�:�<�D����(�(������d�i�i��)F�G�A��7�7�>�>�!�,����'>��B��:�:�&6�7�$��7�7�=�=��+��
�
�q�$�q�'�5��8�&<�=�>�
>�
�M�M�;��d�3�4��
�
>�
>�s�+CE0�/"E0�0E9c#� K�tjj|jd�}tjj|�r�d}t	j
|dd��5}|D]�}|j
�}|dk(rd}�|r�tjjtjj|j|��}|j|j�s��|r|����|����	ddd�yy#1swYyxYw�w)	a
        Iterates over the ``installed-files.txt`` entries and returns paths for
        each line if the path is pointing to a file located in the
        ``.egg-info`` directory or one of its subdirectories.

        :parameter absolute: If *absolute* is ``True``, each returned path is
                          transformed into a local absolute path. Otherwise the
                          raw value from ``installed-files.txt`` is returned.
        :type absolute: boolean
        :returns: iterator of paths
        r�Trnr�rCz./FN)	r�r#r`r�rFr�ror�r))r&�absoluter3�skiprrIr�s       r'r\z'EggInfoDistribution.list_distinfo_files s������g�g�l�l�4�9�9�.C�D��
�7�7�>�>�+�&��D����[�#��@�
+�A��+�D��:�:�<�D��t�|�$�� ���G�G�,�,�R�W�W�\�\�$�)�)�T�-J�K���<�<��	�	�2�'�&'��&*�
�+�
+�
+�'�
+�
+�s+�A$D�& D�A"D�*
D�8
D�D�Dc�X�t|t�xr|j|jk(SrD)rzrr#r^s  r'r�zEggInfoDistribution.__eq__=s'���5�"5�6�,��I�I����+�	-r)rDr_)r3r4r5r6r�rJr(rfr�rrAr$r\r�r`r�r�r�s@r'rrcsM���/�
�I���G�,\�|A�3��&$�L+�:-�
���Hr)rc�L�eZdZdZd�Zd�Zdd�Zd�Zd�Zd
d�Z	dd	�Z
d
�Zd�Zy)�DependencyGrapha�
    Represents a dependency graph between distributions.

    The dependency relationships are stored in an ``adjacency_list`` that maps
    distributions to a list of ``(other, label)`` tuples where  ``other``
    is a distribution and the edge is labeled with ``label`` (i.e. the version
    specifier, if such was provided). Also, for more efficient traversal, for
    every distribution ``x``, a list of predecessors is kept in
    ``reverse_list[x]``. An edge from distribution ``a`` to
    distribution ``b`` means that ``a`` depends on ``b``. If any missing
    dependencies are found, they are stored in ``missing``, which is a
    dictionary that maps distributions to a list of requirements that were not
    provided by any other distributions.
    c�.�i|_i|_i|_yrD)�adjacency_list�reverse_listrr%s r'r(zDependencyGraph.__init__Ys�� ��������r)c�@�g|j|<g|j|<y)z�Add the *distribution* to the graph.

        :type distribution: :class:`distutils2.database.InstalledDistribution`
                            or :class:`distutils2.database.EggInfoDistribution`
        N)r�r�)r&�distributions  r'�add_distributionz DependencyGraph.add_distribution^s$��-/����L�)�*,����,�'r)Nc��|j|j||f�||j|vr|j|j|�yy)a�Add an edge from distribution *x* to distribution *y* with the given
        *label*.

        :type x: :class:`distutils2.database.InstalledDistribution` or
                 :class:`distutils2.database.EggInfoDistribution`
        :type y: :class:`distutils2.database.InstalledDistribution` or
                 :class:`distutils2.database.EggInfoDistribution`
        :type label: ``str`` or ``None``
        N)r�r/r�)r&�x�y�labels    r'�add_edgezDependencyGraph.add_edgehsR��	
���A��%�%�q�%�j�1��D�%�%�a�(�(����a� �'�'��*�)r)c��tjd||�|jj|g�j	|�y)a
        Add a missing *requirement* for the given *distribution*.

        :type distribution: :class:`distutils2.database.InstalledDistribution`
                            or :class:`distutils2.database.EggInfoDistribution`
        :type requirement: ``str``
        z
%s missing %rN)rdrerr-r/)r&r�r�s   r'�add_missingzDependencyGraph.add_missingws3��	���_�l�K�@�������b�1�8�8��Er)c�8�|j�d|j��Srr�r0s  r'�
_repr_distzDependencyGraph._repr_dist�rr)c�`�|j|�g}|j|D]z\}}|j|�}|�|�d|�d�}|jd|zt|�z�|j	||dz�}|jd�}|j
|dd��|dj|�S)zPrints only a subgraphNz [�]z    rrO)r�r�r/r=�	repr_noder��extendr`)r&r1�level�outputr�r��	suboutput�subss        r'r�zDependencyGraph.repr_node�s����/�/�$�'�(�� �/�/��5�	$�L�E�5��?�?�5�)�D�� �$(�%�0���M�M�&�5�.�3�t�9�4�5����u�e�a�i�8�I��?�?�4�(�D��M�M�$�q�r�(�#�	$��y�y�� � r)c��g}|jd�|jj�D]�\}}t|�dk(r|s|j	|�|D]c\}}|�0|jd|j
�d|j
�d|�d���8|jd|j
�d|j
�d���e��|s�t|�dkDrz|jd	�|jd
�|jd�|D]1}|jd|j
z�|jd
��3|jd�|jd�y)a9Writes a DOT output for the graph to the provided file *f*.

        If *skip_disconnected* is set to ``True``, then all distributions
        that are not dependent on any other distribution are skipped.

        :type f: has to support ``file``-like operations
        :type skip_disconnected: ``bool``
        zdigraph dependencies {
rN�"z" -> "z
" [label="z"]
z"
zsubgraph disconnected {
zlabel = "Disconnected"
zbgcolor = red
z"%s"rOz}
)rQr��itemsrr/r")r&r�skip_disconnected�disconnectedr1�adjsr�r�s        r'�to_dotzDependencyGraph.to_dot�s+����	���*�+��-�-�3�3�5�	H�J�D�$��4�y�A�~�&7��#�#�D�)� $�
H���u��$��G�G�!�Y�Y��
�
�E�;�<��G�G��	�	�5�:�:�F�G�
H�	H�!�S��%6��%:�
�G�G�/�0�
�G�G�.�/�
�G�G�%�&�$�
���������*�+�����
�
�
�G�G�E�N�	����r)c
�:�g}i}|jj�D]
\}}|dd||<�	g}t|j��ddD]\}}|r�	|j|�||=�|sn�|j�D]$\}}|D��cgc]\}}||vs�||f��c}}||<�&tjd|D�cgc]}|j�d|j�d��� c}�|j|���|t|j��fScc}}wcc}w)aa
        Perform a topological sort of the graph.
        :return: A tuple, the first element of which is a topologically sorted
                 list of distributions, and the second element of which is a
                 list of distributions that cannot be sorted because they have
                 circular dependencies and so form a cycle.
        NzMoving to result: %sr�r�)
r�r��listr/rdrer"r�r��keys)r&r��alist�kr��	to_remover�rns        r'�topological_sortz DependencyGraph.topological_sort�s#�������'�'�-�-�/�	�D�A�q���t�E�!�H�	���I��U�[�[�]�+�A�.�
!���1���$�$�Q�'��a��
!������
�
H���1�/0�G�t�q�!�A�Y�4F�Q��F�G��a��
H��L�L�/�CL�M�a�q�v�v�q�y�y�9�M�
O��M�M�)�$�� �t�E�J�J�L�)�)�)��	H��Ms�D�D�;#D
c��g}|jj�D]%\}}|j|j|���'dj	|�S)zRepresentation of the graphrO)r�r�r/r�r`)r&r�r1r�s    r'r�zDependencyGraph.__repr__�sM�����-�-�3�3�5�	0�J�D�$��M�M�$�.�.��.�/�	0��y�y�� � r)rD)r)T)
r3r4r5r6r(r�r�r�r�r�r�r�r�r7r)r'r�r�Is6��
��
-�
+�	F�3�!��@*�>!r)r�c�0�t|�}t�}i}|D]m}|j|�|jD]K}t	|�\}}t
j
d|||�|j|g�j||f��M�o|D]�}|j|jz|jz|jz}|D]s}		|j|	�}
|
j"}d}||vr8||D]0\}}	|
j%|�}
|
s�|j'|||	�d}n|r�b|j)||	��u��|S#t$r=t
jd|	�|	j!�d}|j|�}
Y��wxYw#t$rd}
Y��wxYw)a6Makes a dependency graph from the given distributions.

    :parameter dists: a list of distributions
    :type dists: list of :class:`distutils2.database.InstalledDistribution` and
                 :class:`distutils2.database.EggInfoDistribution` instances
    :rtype: a :class:`DependencyGraph` instance
    zAdd to provided: %s, %s, %sr�rFT)rr�r�r�rrdrer-r/r�r�r�r�r�r	rir�r.r�r�r�)�distsrQ�graphr�r1r�r"r�r}r�r��matched�providerr�s              r'�
make_graphr��s�����
�F���E��H��B��
���t�$����	B�A�2�1�5�M�D�'��L�L�6��g�t�L�����b�)�0�0�'�4��A�	B�B��-���%�%��(:�(:�:��)�)�*�,0�,=�,=�>���	-�C�
/� �.�.��-���;�;�D��G��x��)1�$��	�%�G�X�&� '�
�
�g� 6������t�X�s�;�"&���	���!�!�$��,�3	-�-�:�L��/+�
/����L�"�$��y�y�{�1�~�� �.�.��.��
/��3�&� %��&�s%�D>�7F�>AF�F�F	�F	c�:�||vrtd|jz��t|�}|g}|j|}|rN|j	�}|j|�|j|D]}||vs�|j|��|r�N|j	d�|S)z�Recursively generate a list of distributions from *dists* that are
    dependent on *dist*.

    :param dists: a list of distributions
    :param dist: a distribution, member of *dists* for which we are interested
    �1given distribution %r is not a member of the listr)rr"r�r��popr/)r�r1r��dep�todor��succs       r'�get_dependent_distsr�s����5��� -�/3�y�y� 9�:�	:��u��E��&�C����d�#�D�
��H�H�J���
�
�1�
��&�&�q�)�	"�D��3�����D�!�	"���G�G�A�J��Jr)c��||vrtd|jz��t|�}t�}|j|}td�|D��}|rn|j�d}|j
|�|j|}|D]3}|d}||vs�
||vs�|j
|�|j|��5|r�n|S)aRecursively generate a list of distributions from *dists* that are
    required by *dist*.

    :param dists: a list of distributions
    :param dist: a distribution, member of *dists* for which we are interested
                 in finding the dependencies.
    r�c3�&K�|]	}|d���y�w)rNr7)rk�ts  r'rmz%get_required_dists.<locals>.<genexpr>8s����"��q��t�"�rnr)rr"r�rXr�r�r2r/)	r�r1r�r�r�rlr��	pred_list�preds	         r'�get_required_distsr�)s����5��� -�/3�y�y� 9�:�	:��u��E�

�%�C�����%�D��"�T�"�"�D�
��H�H�J�q�M������
��(�(��+�	��	"�D��Q��A���|���
���������D�!�		"�	��Jr)c��|jdd�}tdi|��}||_||_|xsd|_t|�S)zO
    A convenience method for making a dist given just a name and version.
    �summaryzPlaceholder for summaryr7)r�r
r"r�r�r)r"r��kwargsr�r�s     r'�	make_distr�FsH���j�j��$=�>�G�	�	�F�	�B��B�G��B�J��5�5�B�J����r))r:)7r6�
__future__rr�rFrar��loggingr�r_r;ryrMrr�compatrr�rr	rRr
rrr
�utilrrrrrrr�__all__�	getLoggerr3rdr�COMMANDS_FILENAMErVr^r`r rrrrrrfrgr�r�r�r�r�r7r)r'�<module>r�s���'�
�
����	��
��)��8�1�1�F�F�F���

��	�	�8�	$��(��*���,�h���+�X�7�
���<�V�<�>y �v�y �xYL�6�YL�x4)��4)�nF�5�F�R
_�3�_�D'��$��M!�f�M!�`3�l�4�:	r)
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!