ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/distlib/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/distlib/__pycache__/database.cpython-311.pyc

�

�܋f������dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZddlmZddlmZmZddlmZmZmZmZdd	lmZmZmZmZmZmZm Z gd
�Z!ej"e#��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%�Z6dS)'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�ZdS)�_CachezL
    A simple cache mapping names and .dist-info paths to distributions
    c�0�i|_i|_d|_dS)zZ
        Initialise an instance. There is normally one for each DistributionPath.
        FN)�name�path�	generated��selfs �a/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/distlib/database.py�__init__z_Cache.__init__1s����	���	������c�x�|j���|j���d|_dS)zC
        Clear the cache, setting it to its initial state.
        FN)r"�clearr#r$r%s r'r+z_Cache.clear9s3��	
�	�������	����������r)c��|j|jvrD||j|j<|j�|jg���|��dSdS)z`
        Add a distribution to the cache.
        :param dist: The distribution to add.
        N)r#r"�
setdefault�key�append�r&�dists  r'�addz
_Cache.addAsW��
�9�D�I�%�%�#'�D�I�d�i� ��I� � ���2�.�.�5�5�d�;�;�;�;�;�&�%r)N)�__name__�
__module__�__qualname__�__doc__r(r+r2�r)r'r r ,sK��������������<�<�<�<�<r)r c��eZdZdZdd�Zd�Zd�Zeee��Zd�Z	d�Z
d	�Zed
���Z
d�Zd�Zdd
�Zd�Zdd�ZdS)rzU
    Represents a set of distributions installed on a path (typically sys.path).
    NFc���|�tj}||_d|_||_t	��|_t	��|_d|_td��|_	dS)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__PsX���<��8�D���	�!���'����h�h��� �(�(���"���!�)�,�,����r)c��|jS�N�r@r%s r'�_get_cache_enabledz#DistributionPath._get_cache_enabledds���"�"r)c��||_dSrDrE)r&�values  r'�_set_cache_enabledz#DistributionPath._set_cache_enabledgs��#����r)c�j�|j���|j���dS)z,
        Clears the internal cache.
        N)r>r+r?r%s r'�clear_cachezDistributionPath.clear_cachels2��	
���������������r)c#��K�t��}|jD�]P}tj|��}|��|�d��}|r|js�9t
|j��}|D�]�}|�|��}|r	|j|vr�$	|j�r|�t��r�tttg}|D]0}tj||��}	|�|	��}
|
rn�1��tj|
�����5}t%|d���}ddd��n#1swxYwYt&�d|j��|�|j��t-|j||���V�nm|jrf|�d��rQt&�d|j��|�|j��t1|j|��V����#t2$rS}
d}t&�||j|
��d	dl}|�||j|
fzd
���Yd}
~
���d}
~
wwxYw��RdS)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�u���I�,	C�,	C�D��.�t�4�4�F��~�����B���A��
�A�N�
���!�+�&�&�D��$
C�$
C���K�K��&�&����A�F�d�N�N�� C��)�;�e�n�n�\�.J�.J�;�-�/F�4�.�*�2D�%�%�-�,5�N� %�'8�-:�-:�M�%+�[�[��%?�%?�F�%�&� %��&�%�'�/��0@�0@�0B�0B�C�C�A�v�'/��7?�(A�(A�(A�H�A�A�A�A�A�A�A�A�A�A�A����A�A�A�A����Z���8�8�8������(�(�(�,�Q�V�6>�15�7�7�7�7�7�7�7��*�;�u�~�~�1�03�03�;����Z���8�8�8������(�(�(�,�Q�V�T�:�:�:�:�:��� �C�C�C�^�C��N�N�3����2�2�2�#�O�O�O��M�M�#�����"3��M�B�B�B�B�B�B�B�B�����	C����A$
C�,	C�,	CsE�A)H�6&H�D:�.H�:D>�>H�D>�CH�
I%�AI � I%c�R�|jj}|jo|jj}|s|r|���D]L}t|t��r|j�|���2|j�|���M|rd|j_|rd|j_dSdSdS)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�,E�(E���
	1�w�
	1��1�1�3�3�
.�
.���d�$9�:�:�.��K�O�O�D�)�)�)�)��O�'�'��-�-�-�-��
-�(,���%��
1�,0���)�)�)�
	1�
	1�
1�
1r)c�l�|�dd��}d�||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�s2��&�|�|�C��%�%���x�x��w��(�(�<�7�7r)c#� K�|js|���D]}|V��dS|���|jj���D]}|V��|jr%|jj���D]}|V��dSdS)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�3�
�
���
�
�
�
�
�
�
� � �"�"�"���(�/�/�1�1�
�
���
�
�
�
�� �
� �O�0�7�7�9�9���D��J�J�J�J�
�
��r)c�^�d}|���}|js'|���D]}|j|kr|}n�nh|���||jjvr|jj|d}n-|jr&||jjvr|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�|�|���"�	7��1�1�3�3�
�
���8�t�#�#�!�F��E�$��
� � �"�"�"��t�{�'�'�'���)�$�/��2����"�
7�t�t��/C�'C�'C���-�d�3�A�6���
r)c#�K�d}|�E	|j�|�d|�d���}n##t$rtd|�d|�����wxYw|���D]|}t|d��st�d|���.|j}|D]D}t|��\}}|�
||kr|V�n#�#||kr|�
|��r|V�n�E�}dS)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_distributionsB��������
8��,�.�.�D�D�D�'�'�'�/J�K�K�����
8�
8�
8�&�&�(,���g�g�(7�8�8�8�
8�����*�*�,�,�	"�	"�D��4��,�,�
"����0�$�7�7�7�7��=��!�	"�	"�A�$:�1�$=�$=�M�F�E���!�T�>�>�"&�J�J�J�!�E�*�"�T�>�>�g�m�m�E�.B�.B�>�"&�J�J�J�!�E���#	"�	"s	� )� A	c�~�|�|��}|�td|z���|�|��S)z5
        Return the path to a resource file.
        Nzno distribution named %r found)r��LookupError�get_resource_path)r&r"�
relative_pathr1s    r'�
get_file_pathzDistributionPath.get_file_path+sD���$�$�T�*�*���<��>��E�F�F�F��%�%�m�4�4�4r)c#�K�|���D]A}|j}||vr4||}|�||vr
||V��&|���D]}|V���BdS)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_entries4s������*�*�,�,�		 �		 �D���A��1�}�}��h�K���#��q�y�y���g�
�
�
���X�X�Z�Z� � ��������		 �		 r))NFrD)r3r4r5r6r(rFrI�property�
cache_enabledrKrxr}�classmethodr�r�r�r�r�r�r7r)r'rrKs��������-�-�-�-�(#�#�#�$�$�$��H�/�1C�D�D�M� � � �4C�4C�4C�l1�1�1�&�8�8��[�8�*���,���4'"�'"�'"�'"�R5�5�5� � � � � � r)rc��eZdZdZdZ	dZ	d�Zed���ZeZ	ed���Z
ed���Zd�Zed���Z
ed	���Zed
���Zed���Zed���Zd
�Zd�Zd�Zd�ZdS)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|_|j���|_|j|_d|_d|_d|_d|_t��|_
i|_dS)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__Ysd��!��
��M��	��9�?�?�$�$����'��������������� �U�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�I�t�|�|�|�4�4r)c�t�|jj}|j�d|j�d�}||vr|�|��|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.provideszsA���
�&������D�L�L�L�1���E�>�>��L�L��O�O�O��r)c���|j}t||��}t�d|j||��t|�||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�sk��
�]����H�%�%�����@�$�)��u�	&�	&�	&������d�k�t�|��L�L�N�N�	Nr)c�,�|�d��S)N�run_requires�r�r%s r'r�zDistribution.run_requires�����%�%�n�5�5�5r)c�,�|�d��S)N�
meta_requiresr�r%s r'r�zDistribution.meta_requires�����%�%�o�6�6�6r)c�,�|�d��S)N�build_requiresr�r%s r'r�zDistribution.build_requires�s���%�%�&6�7�7�7r)c�,�|�d��S)N�
test_requiresr�r%s r'r�zDistribution.test_requires�r�r)c�,�|�d��S)N�dev_requiresr�r%s r'r�zDistribution.dev_requires�r�r)c���t|��}t|jj��}	|�|j��}nZ#t$rMt�d|��|�	��d}|�|��}YnwxYw|j
}d}|jD]B}t|��\}}	||kr�	|�
|	��}n#t$rY�?wxYw|S)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�0�1�1��	+��n�n�Q�]�3�3�G�G��&�	+�	+�	+��N�N�H�#�N�N�N��9�9�;�;�q�>�D��n�n�T�*�*�G�G�G�		+�����{������	�	�A�2�1�5�5�M�F�E���~�~��
� ���u�-�-�����*�
�
�
���
�����
s$�A�AB�B�C"�"
C/�.C/c�V�|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__�s?���?�	��t��.�F�F��F��-1�Y�Y�Y�����f�f�f�M�Mr)c��t|��t|��urd}n0|j|jko|j|jko|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__�sZ����;�;�d�4�j�j�(�(��F�F��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__�s0���D�I����d�l�!3�!3�3�d�4�?�6K�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'rrGsz��������"���
�I�5����"�(�(��X�(��L�
�5�5��X�5��	�	��X�	�N�N�N��6�6��X�6��7�7��X�7��8�8��X�8��7�7��X�7��6�6��X�6����BN�N�N�
�
�
�L�L�L�L�Lr)rc�0��eZdZdZdZd�fd�	Zdd�Z�xZS)rz]
    This is the base class for installed distributions (whether PEP 376 or
    legacy).
    Nc�t��tt|���|��||_||_dS)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__�s6���	�'��.�.�7�7��A�A�A���	�����r)c�.�|�|j}|�tj}d}ntt|��}d|jz}||�����}tj|���d���d��}|�|��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
        NrMz%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�F��W�f�-�-�F��T�[�(�F������$�$�&�&���)�&�1�1�8�8��>�>�E�E�g�N�N������(�(r)rD)r3r4r5r6r�r(r��
__classcell__�r�s@r'rr�sb���������
�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�ZejZ�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).
    �sha256Nc�x��g|_tj|��x|_}|�t	d|z���|r-|jr&||jjvr|jj|j}n�|��|�	t��}|�|�	t��}|�|�	t��}|�t	dt�d|�����tj|�����5}t!|d���}ddd��n#1swxYwYt#t$|���|||��|r!|jr|j�|��|�	d��}|du|_t,j�|d��}t,j�|��rjt3|d��5}|����d	��}	ddd��n#1swxYwY|	���|_dSdS)
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��>�>�>���f��>��8�4�?�@�@�@��	E�3�%�	E�$�#�*�/�*A�*A��z��t�,�5�H�H�
�
����-�.�.�A��y��K�K� 7�8�8���y��K�K� 8�9�9���y� �j�"3�"3�"3�T�T�";�<�<�<��#�A�K�K�M�M�2�2�
E�f�#�F�8�D�D�D��
E�
E�
E�
E�
E�
E�
E�
E�
E�
E�
E����
E�
E�
E�
E�	�#�T�*�*�3�3�H�d�C�H�H�H��	!�3�%�	!��J�N�N�4� � � ��K�K��$�$���$�����G�L�L���/�/��
�7�>�>�!���	-��a����
0�!��v�v�x�x���w�/�/��
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0��?�?�,�,�D�L�L�L�	-�	-s$�=D�D�"D� (H�H�Hc�8�d|j�d|j�d|j�d�S)Nz<InstalledDistribution � � at r��r"r�r#r%s r'r�zInstalledDistribution.__repr__Fs'����I�I�I�t�|�|�|�T�Y�Y�Y�0�	0r)c�$�|j�d|j��S�Nrr�r%s r'�__str__zInstalledDistribution.__str__J����)�)�)�T�\�\�2�2r)c	��g}|�d��}tj|�����5}t	|���5}|D]J}d�tt
|��d��D��}||z\}}}	|�|||	f���K	ddd��n#1swxYwYddd��n#1swxYwY|S)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�ruc��g|]}d��SrDr7)�.0�is  r'�
<listcomp>z6InstalledDistribution._get_records.<locals>.<listcomp>\s��@�@�@��t�@�@�@r)�N)�get_distinfo_resourcerarbrcr�range�lenr/)
r&�resultsrnru�
record_reader�row�missingr#�checksum�sizes
          r'�_get_recordsz"InstalledDistribution._get_recordsMsX�����&�&�x�0�0��
�
����
�
�
.�
.�	;�&��&�)�)�)�

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

;�

;�

;�

;�

;�

;�

;�

;�

;�

;�

;����

;�

;�

;�

;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;�	;����	;�	;�	;�	;��s6�C�AB*�C�*B.	�.C�1B.	�2C�C�Cc�j�i}|�t��}|r|���}|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.exportsds;�����&�&�'7�8�8���	)��&�&�(�(�F��
r)c���i}|�t��}|rMtj|�����5}t|��}ddd��n#1swxYwY|S)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)rrrarbrcr)r&r�rnrus    r'rz"InstalledDistribution.read_exportsrs������&�&�'7�8�8���	.��#�A�K�K�M�M�2�2�
.�f�%�f�-�-��
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.��
s�A!�!A%�(A%c��|�t��}t|d��5}t||��ddd��dS#1swxYwYdS)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�
5��
�"�c�]�]�	&�a��'�1�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&�	&�	&s�A	�	A
�A
c�r�|�d��}tj|�����5}t	|���5}|D]'\}}||kr|ccddd��cddd��S�(	ddd��n#1swxYwYddd��n#1swxYwYtd|z���)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)rrarbrcr�KeyError)r&r�rnru�resources_reader�relative�destinations       r'r�z'InstalledDistribution.get_resource_path�s���
�&�&�{�3�3��
�
����
�
�
.�
.�	+�&��&�)�)�)�
+�-=�-=�+�+�)�H�k��=�0�0�*�*�*�
+�
+�
+�
+�
+�
+�
+�	+�	+�	+�	+�	+�	+�	+�	+�1�+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�
�&�(5�6�7�7�	7sA�B�
B�B�7B�9B�B		�	B�B		�
B�B �#B c#�@K�|���D]}|V��dS)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�s8�����'�'�)�)�	�	�F��L�L�L�L�	�	r)Fc�r�tj�|d��}tj�|j��}|�|��}tj�|d��}|�d��}t�d|��|rdSt|��5}|D�]}tj�	|��s|�
d��rdx}	}
nqdtj�|��z}
t|d��5}|�
|�����}	ddd��n#1swxYwY|�|��s|r5|�|��r tj�||��}|�||	|
f����|�|��r tj�||��}|�|ddf��ddd��n#1swxYwY|S)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�sq������f�b�)�)���w���t�y�)�)�� �O�O�F�3�3���w�|�|�D�"�%�%���,�,�X�6�6�����M�;�/�/�/��	��4�
�{�
#�
#�	3�v��
:�
:���7�=�=��&�&�>�$�-�-�8H�*I�*I�>�(*�*�J����"�'�/�/�$�"7�"7�7�D��d�D�)�)�>�R�%)�]�]�2�7�7�9�9�%=�%=�
�>�>�>�>�>�>�>�>�>�>�>����>�>�>�>��?�?�4�(�(�7�->�7�15����1H�1H�7��7�?�?�4��6�6�D�����z�4� 8�9�9�9�9��%�%�d�+�+�
A� �g�o�o�k�4�@�@���O�O�[�"�b�1�2�2�2�#	3�	3�	3�	3�	3�	3�	3�	3�	3�	3�	3����	3�	3�	3�	3�$�s8�=A1H,�.(E"�H,�"E&�&H,�)E&�*B6H,�,H0�3H0c��g}tj�|j��}|�d��}|���D�]�\}}}tj�|��s tj�||��}||kr�Mtj�|��s|�|dddf����tj�	|��r�ttj�|����}|r ||kr|�|d||f����|r�d|vr|�dd��d}nd	}t|d
��5}	|�|	���|��}
|
|kr|�|d||
f��d	d	d	��n#1swxYwY���|S)�
        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&�
mismatchesr4r6r#r8r�actual_sizer�r�actual_hashs           r'�check_installed_filesz+InstalledDistribution.check_installed_files�s'���
��w���t�y�)�)���,�,�X�6�6��&*�&?�&?�&A�&A�	I�	I�"�D�*�d��7�=�=��&�&�
0��w�|�|�D�$�/�/���{�"�"���7�>�>�$�'�'�
I��!�!�4��4��"?�@�@�@�@������%�%�
I�!�"�'�/�/�$�"7�"7�8�8���I�K�4�/�/��%�%�t�V�T�;�&G�H�H�H�H��
I��j�(�(�!+�!1�!1�#�q�!9�!9�!�!<���!%���d�D�)�)�I�Q�&*�m�m�A�F�F�H�H�f�&E�&E��&�*�4�4�&�-�-�!%�v�z�;� G�I�I�I�I�I�I�I�I�I�I�I�I�I�I����I�I�I�I��
�s�8AG�G	�G	c���i}tj�|jd��}tj�|��r�t	j|dd���5}|������}ddd��n#1swxYwY|D]P}|�dd��\}}|dkr*|�	|g���
|���K|||<�Q|S)	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�l�l�4�9�h�7�7��
�7�>�>�+�&�&�	(���[�#��@�@�@�
.�A������+�+�-�-��
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.��
(�
(��!�Z�Z��Q�/�/�
��U��+�%�%��%�%�c�2�.�.�5�5�e�<�<�<�<�"'�F�3�K�K��
s�'B�B�Bc�:�tj�|jd��}t�d|��|rdSg}dD]I}||}tj�||��r|�|�d|�����J|�dd��D]}|�d|z���tj	|d	d
���5}|�
d�|����ddd��n#1swxYwY|S)
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=rHr7znamespace=%srr�rF�
)r�r#r`rdr-r.r/�getrIr��write)	r&r2r3rJrKr.r#�nsrs	         r'�write_shared_locationsz,InstalledDistribution.write_shared_locationssU���g�l�l�4�9�h�7�7�����M�;�/�/�/��	��4���B�	4�	4�C���:�D��w�}�}�U�3�Z�(�(�
4�������T�T�2�3�3�3���)�)�K��,�,�	.�	.�B��L�L��"�,�-�-�-�-�
�[��c�G�
<�
<�
<�	&��
�G�G�D�I�I�e�$�$�%�%�%�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&��s�)D�D�Dc���|tvrtd|�d|j�����tj|j��}|�td|jz���|�|��S)N�#invalid path for a dist-info file: rzUnable to get a finder for %s)�
DIST_FILESrr#rrYrZ)r&r#rms   r'rz+InstalledDistribution.get_distinfo_resource%sw���z�!�!�"�"�15���t�y�y�$B�C�C�
C��*�4�9�5�5���>�"�#B�T�Y�#N�O�O�O��{�{�4� � � r)c	���|�tj��dkr{|�tj��dd�\}}||j�tj��dkr#td|�d|j�d|j�d����|tvrtd	|�d
|j�����tj�	|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
 distributionrXr)
rZr��sepr�r#rr"r�rYr`)r&r#r�s   r'rz'InstalledDistribution.get_distinfo_file.s����9�9�R�V����!�!�%)�Z�Z���%7�%7����%<�"��d��4�9�?�?�2�6�#:�#:�2�#>�>�>�&�&�&*�d�d�D�I�I�I�t�|�|�|�E�F�F�F�
�z�!�!�"�"�15���t�y�y�$B�C�C�
C��w�|�|�D�I�t�,�,�,r)c#�BK�tj�|j��}|���D]c\}}}tj�|��s tj�||��}|�|j��r|V��ddS)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&r4r#rrs     r'�list_distinfo_filesz)InstalledDistribution.list_distinfo_filesKs������w���t�y�)�)��$(�$5�$5�$7�$7�	�	� �D�(�D��7�=�=��&�&�
0��w�|�|�D�$�/�/�����t�y�)�)�
��
�
�
��	�	r)c�L�t|t��o|j|jkSrD)rzrr#�r&r�s  r'r�zInstalledDistribution.__eq__[s&���5�"7�8�8�,��I���+�	-r))NN�F)r3r4r5r6r�r(r�rrrr�rrr�r'r:rDrMrVrrr_r��objectr�r�r�s@r'rrs`����������F� -� -� -� -� -� -�D0�0�0�3�3�3����.����_��
�
�
�	&�	&�	&�7�7�7�(���!�!�!�!�F"�"�"�H����_��4����2!�!�!�-�-�-�:��� -�-�-�
��H�H�H�H�Hr)rc�f��eZdZdZdZiZd
�fd�	Zd�Zd�Zd�Z	d�Z
d	�Zdd�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.TNc���d�}||_||_|rD|jr=||jjvr/|jj|j}|||j|j��nO|�|��}|||j|j��|r!|jr|j�|��tt|���|||��dS)Nc�T�||_|���|_||_dSrD)r"r�r.r�)r��nr�s   r'�set_name_and_versionz:EggInfoDistribution.__init__.<locals>.set_name_and_versionns#���A�F��G�G�I�I�A�E��A�I�I�Ir))r#r�r@r?rRr"r��
_get_metadatar2r�rr()r&r#rSrhrRr�s     �r'r(zEggInfoDistribution.__init__ls����	�	�	�
��	�����
	)�3�%�
	)�$�#�.�2E�*E�*E��~�*�4�0�9�H� � ��x�}�h�6F�G�G�G�G��)�)�$�/�/�H�
!� ��x�}�h�6F�G�G�G��
)�s�)�
)���"�"�4�(�(�(�
�!�4�(�(�1�1�(�D�#�F�F�F�F�Fr)c�4��d}d���fd�}dx}}|�d���r�tj�|��r�tj�|d��}tj�|d��}t|d���}tj�|d��}	tj�|d	��}||	��}�n�t
j|��}
t|
�	d
���
d����}t|d���}	|
�	d
��}|
�	d���
d��}�|�
d����}n�#t$rd}Yn�wxYw|�d��r�tj�|��rktj�|d��}	||	��}tj�|d��}tj�|d	��}t|d���}ntd|z���|r|�
|��|�p|�ntj�|��rOt|d��5}
|
����
d��}ddd��n#1swxYwY|sg}n|���}||_|S)Nc�:�g}|���}|D�]}|���}|s�|�d��rt�d|��n�t|��}|st�d|���y|jrt�d��|js|�|j	����d�
d�|jD����}|�|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|zV��
dS)z%s%sNr7)r�cs  r'�	<genexpr>zQEggInfoDistribution._get_metadata.<locals>.parse_requires_data.<locals>.<genexpr>�s&����$G�$G�A�V�a�Z�$G�$G�$G�$G�$G�$Gr)r�r�)r��stripr,rdrirr��constraintsr/r"r`)r��reqsrKrLrn�conss      r'�parse_requires_dataz>EggInfoDistribution._get_metadata.<locals>.parse_requires_data�s4��
�D��O�O�%�%�E��
<�
<���z�z�|�|������?�?�3�'�'���N�N�H�$�P�P�P��E�%�d�+�+�����N�N�#H�$�O�O�O���8�4��N�N�$3�4�4�4��}�<��K�K���'�'�'�'��9�9�$G�$G���$G�$G�$G�G�G�D��K�K�Q�V�V�V�T�T�T� :�;�;�;�;��Kr)c����g}	tj|dd��5}�|�����}ddd��n#1swxYwYn#t$rYnwxYw|S)z�Create a list of dependencies from a requires.txt file.

            *req_path*: the path to a setuptools-produced requires.txt file.
            rnr�N)rIr�r��IOError)�req_pathrrr9rts   �r'�parse_requires_pathz>EggInfoDistribution._get_metadata.<locals>.parse_requires_path�s�����D�
��[��3��8�8�:�B�.�.�r�w�w�y�y�9�9�D�:�:�:�:�:�:�:�:�:�:�:����:�:�:�:����
�
�
���
�����Ks3�A�A�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�rvr�add_requirementsr�r�r�r�r�)r&r#�requiresrx�tl_path�tl_datar��	meta_pathrRrw�zipfrPr�rrts              @r'riz!EggInfoDistribution._get_metadata�s>�����	�	�	�<	�	�	�	�	�!� ��'��=�=�� � �	4��w�}�}�T�"�"�
$��G�L�L��z�2�2���G�L�L��J�7�7�	�#��8�D�D�D���7�<�<��>�:�:���'�,�,�q�/�:�:��.�.�x�8�8���!�,�T�2�2��"��M�M�"5�6�6�=�=�f�E�E�G�G��#�G�H�E�E�E��$��=�=�)@�A�A�D�"�m�m�,D�E�E�L�L��!�!�G�2�2�4�;�;�w�3G�3G�H�H�H�H���$�$�$�#�H�H�H�$����
�]�]�;�
'�
'�		4��w�}�}�T�"�"�
>��7�<�<��n�=�=��.�.�x�8�8���w�|�|�D�*�5�5���'�,�,�t�_�=�=���T�(�;�;�;�H�H�"�$,�.2�$3�4�4�
4��	0��%�%�h�/�/�/��?��"�r�w�~�~�g�'>�'>�"��'�4�(�(�7�A��f�f�h�h�o�o�g�6�6�G�7�7�7�7�7�7�7�7�7�7�7����7�7�7�7��	+��G�G��(�(�*�*�G�����s%�>AF�F)�(F)�9(K-�-K1�4K1c�8�d|j�d|j�d|j�d�S)Nz<EggInfoDistribution rrr�rr%s r'r�zEggInfoDistribution.__repr__�s*���6:�i�i�i�����6:�i�i�i�A�	Ar)c�$�|j�d|j��Srr�r%s r'rzEggInfoDistribution.__str__�rr)c�F�g}tj�|jd��}tj�|��rZ|���D]E\}}}||kr�
tj�|��s|�|dddf���F|S)r<�installed-files.txtr�TF)r�r#r`r�r'r/)r&rAr6r#r�s     r'rDz)EggInfoDistribution.check_installed_files�s����
��g�l�l�4�9�.C�D�D��
�7�>�>�+�&�&�	E�"�7�7�9�9�
E�
E�
��a���;�&�&���w�~�~�d�+�+�E��%�%�t�X�t�U�&C�D�D�D���r)c	��d�}d�}tj�|jd��}g}tj�|���r<t	j|dd���5}|D]�}|���}tj�tj�|j|����}tj�|��s1t�	d|��|�
d��r��tj�|��s*|�|||��||��f����	d	d	d	��n#1swxYwY|�|d	d	f��|S)
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��}	|���}|���n#|���wxYwtj|�����S)Nr�)r�r��closer�r��	hexdigest)r#r�contents   r'�_md5z6EggInfoDistribution.list_installed_files.<locals>._md5s`���T�4� � �A�
��&�&�(�(�����	�	�	�	�����	�	�	�	�����;�w�'�'�1�1�3�3�3s	�;�Ac�4�tj|��jSrD)r��stat�st_size)r#s r'�_sizez7EggInfoDistribution.list_installed_files.<locals>._size
s���7�4�=�=�(�(r)r�rnr�rFzNon-existent file: %sr*N)
r�r#r`r�rIr�rp�normpathrdrir]r.r/)r&r�r�r6r�rrLr�s        r'r'z(EggInfoDistribution.list_installed_files�s���	4�	4�	4�	)�	)�	)��g�l�l�4�9�.C�D�D����
�7�>�>�+�&�&�	5���[�#��@�@�@�
>�A��>�>�D��:�:�<�<�D���(�(�����d�i��)F�)F�G�G�A��7�>�>�!�,�,�%����'>��B�B�B��:�:�&6�7�7�%�$��7�=�=��+�+�>��
�
�q�$�$�q�'�'�5�5��8�8�&<�=�=�=��>�
>�
>�
>�
>�
>�
>�
>�
>�
>�
>�
>����
>�
>�
>�
>�
�M�M�;��d�3�4�4�4��
s�%C5E'�'E+�.E+Fc#�K�tj�|jd��}tj�|��r�d}t	j|dd���5}|D]�}|���}|dkrd}�|sgtj�tj�|j|����}|�|j��r|r|V���|V���	ddd��dS#1swxYwYdSdS)	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�rFz./FN)	r�r#r`r�rIr�rpr�r,)r&�absoluter6�skiprrLr�s       r'r_z'EggInfoDistribution.list_distinfo_files sQ�����g�l�l�4�9�.C�D�D��
�7�>�>�+�&�&�	+��D���[�#��@�@�@�
+�A��+�+�D��:�:�<�<�D��t�|�|�$�� ��+��G�,�,�R�W�\�\�$�)�T�-J�-J�K�K���<�<��	�2�2�+�'�+�&'�����&*�
�
�
��+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+�
+�
+�	+�	+s� BC:�:C>�C>c�L�t|t��o|j|jkSrD)rzrr#ras  r'r�zEggInfoDistribution.__eq__=s&���5�"5�6�6�,��I���+�	-r)rDrb)r3r4r5r6r�rMr(rir�rrDr'r_r�rcr�r�r�s@r'rrcs��������/�/�
�I���G�G�G�G�G�G�,\�\�\�|A�A�A�3�3�3����&$�$�$�L+�+�+�+�:-�-�-�
��H�H�H�H�Hr)rc�N�eZdZdZd�Zd�Zdd�Zd�Zd�Zdd	�Z	dd�Z
d�Zd
�ZdS)�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�0�i|_i|_i|_dSrD)�adjacency_list�reverse_listrr%s r'r(zDependencyGraph.__init__Ys�� ����������r)c�.�g|j|<g|j|<dS)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|�||f��||j|vr"|j|�|��dSdS)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_edgehsa��	
��A��%�%�q�%�j�1�1�1��D�%�a�(�(�(���a� �'�'��*�*�*�*�*�)�(r)c��t�d||��|j�|g���|��dS)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_missingwsF��	���_�l�K�@�@�@������b�1�1�8�8��E�E�E�E�Er)c�$�|j�d|j��Srr�r0s  r'�
_repr_distzDependencyGraph._repr_dist�rr)rc��|�|��g}|j|D]�\}}|�|��}|�|�d|�d�}|�d|zt|��z��|�||dz��}|�d��}|�|dd�����d�|��S)zPrints only a subgraphNz [�]z    rrR)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�� �$(�D�D�%�%�%�0���M�M�&�5�.�3�t�9�9�4�5�5�5����u�e�a�i�8�8�I��?�?�4�(�(�D��M�M�$�q�r�r�(�#�#�#�#��y�y�� � � r)Tc���g}|�d��|j���D]�\}}t|��dkr|s|�|��|D]W\}}|�*|�d|j�d|j�d|�d����1|�d|j�d|j�d����X��|s�t|��dkr�|�d	��|�d
��|�d��|D]4}|�d|jz��|�d
���5|�d��|�d��dS)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"rRz}
)rTr��itemsrr/r")r&r�skip_disconnected�disconnectedr1�adjsr�r�s        r'�to_dotzDependencyGraph.to_dot�s�����	���*�+�+�+��-�3�3�5�5�	H�	H�J�D�$��4�y�y�A�~�~�&7�~��#�#�D�)�)�)� $�
H�
H���u��$��G�G�G�!�Y�Y�Y��
�
�
�E�E�E�;�<�<�<�<��G�G�G��	�	�	�5�:�:�:�F�G�G�G�G�
H�!�	�S��%6�%6��%:�%:�
�G�G�/�0�0�0�
�G�G�.�/�/�/�
�G�G�%�&�&�&�$�
�
��������*�+�+�+�����
�
�
�
�
�G�G�E�N�N�N�	��������r)c���g}i}|j���D]\}}|dd�||<�	g�t|�����dd�D]\}}|s��|��||=� �snf|���D]\}}�fd�|D��||<�t�dd��D����|������|t|�����fS)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.
        NTc�&��g|]
\}}|�v�	||f��Sr7r7)rr�rn�	to_removes   �r'rz4DependencyGraph.topological_sort.<locals>.<listcomp>�s+���G�G�G�t�q�!�A�Y�4F�4F�Q��F�4F�4F�4Fr)zMoving to result: %sc�2�g|]}|j�d|j�d���S)r�r�r�)rr�s  r'rz4DependencyGraph.topological_sort.<locals>.<listcomp>�s)��M�M�M�a�q�v�v�v�q�y�y�y�9�M�M�Mr))r�r��listr/rdrer��keys)r&r��alist�kr�r�s     @r'�topological_sortz DependencyGraph.topological_sort�sF��������'�-�-�/�/�	�	�D�A�q�����t�E�!�H�H�	%��I��U�[�[�]�]�+�+�A�A�A�.�
!�
!���1��!��$�$�Q�'�'�'��a����
�����
�
�
H�
H���1�G�G�G�G�q�G�G�G��a����L�L�/�M�M�9�M�M�M�
O�
O�
O��M�M�)�$�$�$�	%� �t�E�J�J�L�L�)�)�)�)r)c��g}|j���D]-\}}|�|�|�����.d�|��S)zRepresentation of the graphrR)r�r�r/r�r`)r&r�r1r�s    r'r�zDependencyGraph.__repr__�s\�����-�3�3�5�5�	0�	0�J�D�$��M�M�$�.�.��.�.�/�/�/�/��y�y�� � � r)rD)r)T)
r3r4r5r6r(r�r�r�r�r�r�r�r�r7r)r'r�r�Is�������
�
����
-�-�-�
+�
+�
+�
+�	F�	F�	F�3�3�3�!�!�!�!�����@*�*�*�>!�!�!�!�!r)r�r:c�j�t|��}t��}i}|D]{}|�|��|jD]\}t	|��\}}t
�d|||��|�|g���||f���]�||D�]}|j	|j
z|jz|jz}|D]�}		|�
|	��}
nZ#t$rMt
�d|	��|	���d}|�
|��}
YnwxYw|
j}d}||vrT||D]K\}}	|
�|��}
n#t$rd}
YnwxYw|
r|�|||	��d}n�L|s|�||	�����|S)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�B��
���t�$�$�$���	B�	B�A�2�1�5�5�M�D�'��L�L�6��g�t�L�L�L�����b�)�)�0�0�'�4��A�A�A�A�	B��-�-���%��(:�:��)�*�,0�,=�>���	-�	-�C�
/� �.�.��-�-����*�
/�
/�
/����L�"�$�$�$��y�y�{�{�1�~�� �.�.��.�.����
/�����;�D��G��x���)1�$��	�	�%�G�X�&� '�
�
�g� 6� 6����2�&�&�&� %����&���������t�X�s�;�;�;�"&������
-��!�!�$��,�,�,��3	-�4�Ls%�C�AD4�3D4�E(�(E7	�6E7	c�P�||vrtd|jz���t|��}|g}|j|}|rT|���}|�|��|j|D]}||vr|�|���|�T|�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� 9�:�:�	:��u���E��&�C���d�#�D�
�"��H�H�J�J���
�
�1�
�
�
��&�q�)�	"�	"�D��3������D�!�!�!���"��G�G�A�J�J�J��Jr)c��||vrtd|jz���t|��}t��}|j|}td�|D����}|r}|���d}|�|��|j|}|D]<}|d}||vr.||vr*|�|��|�|���=|�}|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�|]}|dV��
dS)rNr7)r�ts  r'roz%get_required_dists.<locals>.<genexpr>8s&����"�"��q��t�"�"�"�"�"�"r)r)rr"r�rXr�r�r2r/)	r�r1r�r�r�rlr��	pred_list�preds	         r'�get_required_distsr�)s���5���� -�/3�y� 9�:�:�	:��u���E�

�%�%�C����%�D��"�"�T�"�"�"�"�"�D�
�"��H�H�J�J�q�M������
�
�
��(��+�	��	"�	"�D��Q��A���|�|���
�
�����������D�!�!�!���"��Jr)c��|�dd��}tdi|��}||_||_|pd|_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�FsT���j�j��$=�>�>�G�	�	�	�F�	�	�B��B�G��B�J��5�5�B�J�����r))r:)7r6�
__future__rr�rIrar��loggingr�r_r;rzrMrr�compatrr�rr	rRr
rrr
�utilrrrrrrr�__all__�	getLoggerr3rdr�COMMANDS_FILENAMErYr^rcr rrrrrrfrgr�r�r�r�r�r7r)r'�<module>r�sj����'�'�'�'�'�'�
�
�
�
�
�
�
�
�������������	�	�	�	�����
�
�
�
�����)�)�)�)�)�)�)�)�������8�8�8�8�8�8�8�8�1�1�1�1�1�1�1�1�1�1�1�1�F�F�F�F�F�F�F�F�F�F�F�F�F�F�F�F�F�F�����

��	�8�	$�	$��(��*���,�h���+�X�7�
���<�<�<�<�<�V�<�<�<�>y �y �y �y �y �v�y �y �y �xYL�YL�YL�YL�YL�6�YL�YL�YL�x4)�4)�4)�4)�4)��4)�4)�4)�nF�F�F�F�F�5�F�F�F�R
_�_�_�_�_�3�_�_�_�D'��$��M!�M!�M!�M!�M!�f�M!�M!�M!�`3�3�3�3�l���4���:	�	�	�	�	r)

Zerion Mini Shell 1.0