� ��^i����` �dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZ ddlZn#e$rddlZYnwxYw e n #e!$re"Z YnwxYwddl#m$Z$ddl%m&Z&m'Z'm(Z(ddlm)Z) ddlm*Z*m+Z+m,Z,d Z-n #e$rd Z-YnwxYwdd lm.Z/dd l0m1Z1m2Z2 ddl3m4Z5e5j6n #e$rdZ5YnwxYwd dl7m8Z8ddl#m9Z9ddl#m:Z:e;d��e;d��e;d��e;d��ecxkrdkrnn e?d���e$j@rdZAdZBdZCdZDdZEdZFdZGdZHdZIdZJdZKdZLdZMdZNdZOdZPdZQdZRdZSGd�deT��ZUd�ZViZWd�ZXd�ZYd�ZZd�Z[d�Z\d �Z]d!�Z^d"�xZ_Z`d#�Zagd$�ZbGd%�d&ec��ZdGd'�d(ed��ZeGd)�d*ee��ZfGd+�d,ed��ZgGd-�d.ed��ZhiZid/jjej>�Zkd0Zld1Zmd ZndZod2Zpd3�Zqd4�Zrgfd5�Zsd6�Ztd7�Zuejvd8��Zwejvd9��ZxeuZyd:�Zzd;�Z{e{Z|d<�Z}d=�Z~d�d>�Zd?�Z�Gd@�dA��Z�GdB�dCe���Z�GdD�dE��Z�GdF�dGe���Z�GdH�dI��Z�e�Z�GdJ�dKe?��Z�GdL�dM��Z�dN�Z�dO�Z�dP�Z�dQ�Z�dR�Z�dS�Z�d�dT�Z�GdU�dV��Z�eqe�e���GdW�dXe���Z�GdY�dZe���Z�e�����Gd[�d\e���Z�e���Z�Gd]�d^e���Z�Gd_�d`e���Z�Gda�dbe���Z�eqe j�e���Gdc�dde���Z�Gde�dfe���Z�Gdg�dhe���Z�eXdii�j��dk�Z�d�dl�Z�d�dm�Z�e�e j�e���d�dn�Z�e�e�e���do�Z�d�dp�Z�dq�Z�Gdr�ds��Z�dt�Z�du�Z�dv�Z�dw�Z�e�ej�e���e�e5dx��re�e5j�e���eXdii�y��eXdii�z��d{�Z�d|�Z�d}�Z�d~�Z�d�d�Z�d��Z�e�ej�e���e�e j�e���e�e5dx��re�e5j�e���d��Z�e�e�e���d��Z�d��Z�ifd��Z�d��Z�d��Z�d��Z�d��Z�ejvd���j�Z�ejvd�ej�ej�z��j�Z�Gd��d���Z�d��Z�d��Z�Gd��d���Z�Gd��d�eĦ�Z�Gd��d�eĦ�Z�e�e�e�d��Z�d��Z�Gd��d�eɦ�Z�d��Z�Gd��d�e:j�j���Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�e j�d�eUd ����d��Z�e�e֦�fd����Z�e�d����Z�Gd��d�e٦�Z�dS)�aZ Package resource API -------------------- A resource is a logical file contained within a package, or a logical subdirectory thereof. The package resource API expects resource names to have their path parts separated with ``/``, *not* whatever the local path separator is. Do not use os.path operations to manipulate resource names being passed into the API. The package resource API is designed to work with normal filesystem packages, .egg files, and unpacked .egg files. It can also work in a limited way with .zip files and with custom PEP 302 loaders that support the ``get_data()`` method. �)�absolute_importN)� get_importer)�six)�urllib�map�filter)�utime)�mkdir�rename�unlinkTF)�open)�isdir�split�)� py31compat)� platformdirs)� packagingzpip._vendor.packaging.versionz pip._vendor.packaging.specifiersz"pip._vendor.packaging.requirementszpip._vendor.packaging.markers)�r)r�zPython 3.5 or later is requiredc��eZdZdZdS)� PEP440Warningza Used when there is an issue with a version or specifier not complying with PEP 440. N��__name__� __module__� __qualname__�__doc__����/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/pkg_resources/__init__.pyrrxs���������rrc�� tj�|��S#tjj$r"tj�|��cYSwxYw�N)r�version�Version�InvalidVersion� LegacyVersion)�vs r� parse_versionr's\��2�� �(�(��+�+�+�� � � +�2�2�2�� �.�.�q�1�1�1�1�1�2���s�!�3A�Ac ��t���|��t�t�||����dSr!)�globals�update� _state_vars�dict�fromkeys)�vartype�kws r�_declare_stater0�sB�� �I�I���R�������t�}�}�R��1�1�2�2�2�2�2rc��i}t��}t���D]"\}}|d|z||��||<�#|S)N�_sget_)r)r+�items��state�g�kr&s r� __getstate__r8�sU�� �E�� � �A��!�!�#�#�)�)���1�"�1�X��\�?�1�Q�4�(�(��a��� �Lrc��t��}|���D],\}}|dt|z||||���-|S)N�_sset_)r)r3r+r4s r� __setstate__r;�sT��� � �A�� � � � �1�1���1�$��(�[��^� #�$�Q��!��a�0�0�0�0� �Lrc�*�|���Sr!)�copy��vals r� _sget_dictr@�s�� �8�8�:�:�rc�X�|���|�|��dSr!)�clearr*��key�obr5s r� _sset_dictrF�s'���H�H�J�J�J��I�I�e�����rc�*�|���Sr!)r8r>s r� _sget_objectrH�s�� � � � � �rc�0�|�|��dSr!)r;rCs r� _sset_objectrJ�s���O�O�E�����rc��dSr!r��argss r�rN�s���rc� �t��}t�|��}|�ctjdkrSdd�t ��dd����d|�d����}n#t$rYnwxYw|S)aZReturn this platform's maximum compatible version. distutils.util.get_platform() normally reports the minimum version of Mac OS X that would be required to *use* extensions produced by distutils. But what we want when checking compatibility is to know the version of Mac OS X that we are *running*. To allow usage of packages that explicitly require a newer version of Mac OS X, we must also know the current version of the OS. If this condition occurs for any other platform with a version in its platform strings, this function should be extended accordingly. N�darwin�macosx-�.��-r) �get_build_platform�macosVersionString�match�sys�platform�join� _macosx_vers�group� ValueError)�plat�ms r�get_supported_platformr`�s��� � � �D�� � ��&�&�A��}����1�1� �%(�X�X�l�n�n�R�a�R�.@�%A�%A�%A�%A�1�7�7�1�:�:�:�N�D�D��� � � � �D� ���� �Ks�AA>�> B � B )G�require� run_script� get_provider�get_distribution�load_entry_point� get_entry_map�get_entry_info�iter_entry_points�resource_string�resource_stream�resource_filename�resource_listdir�resource_exists�resource_isdir�declare_namespace� working_set�add_activation_listener�find_distributions�set_extraction_path�cleanup_resources�get_default_cache� Environment� WorkingSet�ResourceManager� Distribution� Requirement� EntryPoint�ResolutionError�VersionConflict�DistributionNotFound� UnknownExtra�ExtractionErrorr�parse_requirementsr'� safe_name� safe_version� get_platform�compatible_platforms� yield_lines�split_sections� safe_extra� to_filename�invalid_marker�evaluate_marker�ensure_directory�normalize_path�EGG_DIST� BINARY_DIST� SOURCE_DIST� CHECKOUT_DIST� DEVELOP_DIST�IMetadataProvider�IResourceProvider� FileMetadata� PathMetadata� EggMetadata� EmptyProvider�empty_provider� NullProvider� EggProvider�DefaultProvider� ZipProvider�register_finder�register_namespace_handler�register_loader_type�fixup_namespace_packagesr�PkgResourcesDeprecationWarning�run_main�AvailableDistributionsc��eZdZdZd�ZdS)r|z.Abstract base for dependency resolution errorsc�D�|jjt|j��zSr!)� __class__r�reprrM��selfs r�__repr__zResolutionError.__repr__�s���~�&��d�i���8�8rN)rrrrr�rrrr|r|�s)������8�8�9�9�9�9�9rr|c�N�eZdZdZdZed���Zed���Zd�Zd�Z dS)r}z� An already-installed version conflicts with the requested version. Should be initialized with the installed Distribution and the requested Requirement. z3{self.dist} is installed but {self.req} is requiredc��|jdS�NrrLr�s r�distzVersionConflict.dist ����y��|�rc��|jdS�NrrLr�s r�reqzVersionConflict.reqr�rc�>�|jjdit����S�Nr�� _template�format�localsr�s r�reportzVersionConflict.report�!��$�t�~�$�0�0�v�x�x�0�0�0rc�2�|s|S|j|fz}t|�S)zt If required_by is non-empty, return a version of self that is a ContextualVersionConflict. )rM�ContextualVersionConflict)r�� required_byrMs r� with_contextzVersionConflict.with_contexts*�� � ��K��y�K�>�)��(�$�/�/rN) rrrrr��propertyr�r�r�r�rrrr}r}sx��������F�I� ����X������X��1�1�1�0�0�0�0�0rr}c�<�eZdZdZejdzZed���ZdS)r�z� A VersionConflict that accepts a third parameter, the set of the requirements that required the installed Distribution. z by {self.required_by}c��|jdS)NrSrLr�s rr�z%ContextualVersionConflict.required_by*r�rN)rrrrr}r�r�r�rrrr�r�"sG��������  �)�,D�D�I� ����X���rr�c�d�eZdZdZdZed���Zed���Zed���Zd�Z d�Z dS) r~z&A requested distribution was not foundzSThe '{self.req}' distribution was not found and is required by {self.requirers_str}c��|jdSr�rLr�s rr�zDistributionNotFound.req5r�rc��|jdSr�rLr�s r� requirerszDistributionNotFound.requirers9r�rc�H�|jsdSd�|j��S)Nzthe applicationz, )r�rZr�s r� requirers_strz"DistributionNotFound.requirers_str=s&���~� %�$�$��y�y���(�(�(rc�>�|jjdit����Sr�r�r�s rr�zDistributionNotFound.reportCr�rc�*�|���Sr!)r�r�s r�__str__zDistributionNotFound.__str__Fs���{�{�}�}�rN) rrrrr�r�r�r�r�r�r�rrrr~r~/s�������0�0�;�I�����X������X���)�)��X�)� 1�1�1�����rr~c��eZdZdZdS)rz>Distribution doesn't have an "extra feature" of the given nameNrrrrrrJs������H�H�H�Hrrz{}.{}rrS�����c��|t|<dS)aRegister `provider_factory` to make providers for `loader_type` `loader_type` is the type or class of a PEP 302 ``module.__loader__``, and `provider_factory` is a function that, passed a *module* object, returns an ``IResourceProvider`` for that module. N)�_provider_factories)� loader_type�provider_factorys rr�r�Xs��(8�� �$�$�$rc��t|t��r�>�D� �|�x������ �(B�(B�� �"�n�n�G��h�j�j��m�+�+�C��5�5�G�$��G�A�J����W�Q�Z����W�%�%�(�� ��� � � � �D� ���� �Ks�A5B-�- B:�9B:zmacosx-(\d+)\.(\d+)-(.*)zdarwin-(\d+)\.(\d+)\.(\d+)-(.*)c���|�|�||krdSt�|��}|�rGt�|��}|s�t�|��}|rit|�d����}|�d���d|�d����}|dkr|dks |dkr|d krdSd S|�d��|�d��ks,|�d ��|�d ��krd St|�d����t|�d����krd SdSd S) z�Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes. NTrrRrS�z10.3�z10.4Fr)rVrW�darwinVersionStringr�r\)�provided�required�reqMac�provMac� provDarwin�dversion� macosversions rr�r��sq����8�+�x�8�/C�/C��t� � %� %�h� /� /�F� ��$�*�*�8�4�4��� �-�2�2�8�<�<�J�� ��z�/�/��2�2�3�3��*0�,�,�q�/�/�/�/�6�<�<��?�?�?�K� ��q�=�=�\�V�%;�%;� �A� � �,�&�*@�*@��4��5� �=�=�� � �v�|�|�A��� .� .�� � �a� � �F�L�L��O�O�3�3��5� �w�}�}�Q��� � �3�v�|�|�A���#7�#7� 7� 7��5��t� �5rc���tjd��j}|d}|���||d<t |��d�||��dS)z@Locate distribution `dist_spec` and run its `script_name` scriptrrrN�rX� _getframe� f_globalsrBrarb)� dist_spec� script_name�ns�names rrbrb�s\�� ��q� � � #�B� �j�>�D��H�H�J�J�J��B�z�N� �I���q��$�$�[�"�5�5�5�5�5rc��t|tj��rt�|��}t|t��rt |��}t|t ��std|���|S)z@Return a current distribution object for a Requirement or stringz-Expected string, Requirement, or Distribution)r�r� string_typesrz�parsercry� TypeError�r�s rrdrd�sr���$��(�)�)�'�� � ��&�&���$� �$�$�"��D�!�!�� �d�L� )� )�O��G��N�N�N� �Krc�H�t|���||��S)zDReturn `name` entry point of `group` for `dist` or raise ImportError)rdre�r�r\rs rrere�s �� �D� !� !� 2� 2�5�$� ?� ?�?rc�F�t|���|��S)�=Return the entry point map for `group`, or the full entry map)rdrf)r�r\s rrfrf�s�� �D� !� !� /� /�� 6� 6�6rc�H�t|���||��S�zIs the named metadata a directory? (like ``os.path.isdir()``)Nrrs r�metadata_isdirz IMetadataProvider.metadata_isdirrrc��dS)z?List of metadata names in the directory (like ``os.listdir()``)Nrrs r�metadata_listdirz"IMetadataProvider.metadata_listdirrrc��dS)z=Execute the named script in the supplied namespace dictionaryNr)r � namespaces rrbzIMetadataProvider.run_script rrN) rrrrr!r#r%r'rbrrrr�r��s������J�J�J�6�6�6�C�C�C� M�M�M�N�N�N�L�L�L�L�Lrr�c�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z dS) r�z3An object that provides access to package resourcesc��dS)zdReturn a true filesystem path for `resource_name` `manager` must be an ``IResourceManager``Nr��manager� resource_names r�get_resource_filenamez'IResourceProvider.get_resource_filenamerrc��dS)ziReturn a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``Nrr,s r�get_resource_streamz%IResourceProvider.get_resource_streamrrc��dS)zmReturn a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``Nrr,s r�get_resource_stringz%IResourceProvider.get_resource_stringrrc��dS)z,Does the package contain the named resource?Nr�r.s r� has_resourcezIResourceProvider.has_resourcerrc��dS)z>Is the named resource a directory? (like ``os.path.isdir()``)Nrr5s rrnz IResourceProvider.resource_isdir"rrc��dS)z?List of resource names in the directory (like ``os.listdir()``)Nrr5s rrlz"IResourceProvider.resource_listdir%rrN) rrrrr/r1r3r6rnrlrrrr�r� s|������=�=�5�5�5� 5�5�5� 5�5�5� ;�;�;�M�M�M�N�N�N�N�Nrr�c��eZdZdZdd�Zed���Zed���Zd�Zd�Z d�Z dd �Z d �Z d �Z dd�Z dd�Z dd�Zd�Zdd�Zd�Zd�Zd�ZdS)rwzDA collection of active distributions on sys.path (or a similar list)Nc��g|_i|_i|_g|_|� tj}|D]}|�|���dS)z?Create working set from list of path entries (default=sys.path)N)�entries� entry_keys�by_key� callbacksrXr�� add_entry)r�r;�entrys r�__init__zWorkingSet.__init__,sX���� ������ ���� �?��h�G�� "� "�E� �N�N�5� !� !� !� !� "� "rc���|��} ddlm}n#t$r|cYSwxYw |�|��n%#t$r|�|��cYSwxYw|S)z1 Prepare the master working set. r)� __requires__)�__main__rC� ImportErrorrar}�_build_from_requirements)�cls�wsrCs r� _build_masterzWorkingSet._build_master9s��� �S�U�U�� � -� -� -� -� -� -� -��� � � ��I�I�I� ����  >� �J�J�|� $� $� $� $��� >� >� >��/�/� �=�=� =� =� =� >����� s�� "�"�<�A�Ac�8�|g��}t|��}|�|t����}|D]}|�|���tjD] }||jvr|�|���!|jtjdd�<|S)zQ Build a working set from a requirement spec. Rewrites sys.path. N)r��resolverv�addrXr�r;r?)rG�req_specrH�reqs�distsr�r@s rrFz#WorkingSet._build_from_requirementsMs����S��W�W��!�(�+�+��� � �4����/�/��� � �D� �F�F�4�L�L�L�L��X� $� $�E��B�J�&�&�� � �U�#�#�#���j������ �� rc���|j�|g��|j�|��t |d��D]}|�||d���dS)a�Add a path item to ``.entries``, finding any distributions on it ``find_distributions(entry, True)`` is used to find distributions corresponding to the path entry, and they are added. `entry` is always appended to ``.entries``, even if it is already present. (This is because ``sys.path`` can contain the same value more than once, and the ``.entries`` of the ``sys.path`` WorkingSet should always equal ``sys.path``.) TFN)r<� setdefaultr;r�rrrL)r�r@r�s rr?zWorkingSet.add_entrycsn�� ��"�"�5�"�-�-�-� � ���E�"�"�"�&�u�d�3�3� )� )�D� �H�H�T�5�%� (� (� (� (� )� )rc�H�|j�|j��|kS)z9True if `dist` is the active distribution for its project)r=r�rD�r�r�s r� __contains__zWorkingSet.__contains__rs���{���t�x�(�(�D�0�0rc�p�|j�|j��}|�||vrt||���|S)a�Find a distribution matching requirement `req` If there is an active distribution for the requested project, this returns it as long as it meets the version requirement specified by `req`. But, if there is an active distribution for the project and it does *not* meet the `req` requirement, ``VersionConflict`` is raised. If there is no active distribution for the requested project, ``None`` is returned. )r=r�rDr})r�r�r�s rr�zWorkingSet.findvs<���{���s�w�'�'�� � ��C���!�$��,�,� ,�� rc�$�����fd�|D��S)aYield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution order). c3��K�|]=}|�������D]}�� �|jk�|V���>dSr!)rf�valuesr)�.0r�r@r\rs ��r� z/WorkingSet.iter_entry_points..�sq����� � ���+�+�E�2�2�9�9�;�;� � ���|�t�u�z�1�1� � 2�1�1�1�1�  � rr�r�r\rs ``rrhzWorkingSet.iter_entry_points�s4���� � � � � �� � � � rc���tjd��j}|d}|���||d<|�|��d�||��dS)z?Locate distribution for `requires` and run `script_name` scriptrrrNr )r��requiresr rrs rrbzWorkingSet.run_script�s`�� �]�1� � � '���*�~�� ��� � � ���:�� � � �X���q�!�,�,�[�"�=�=�=�=�=rc#�K�i}|jD]4}||jvr� |j|D]}||vrd||<|j|V���5dS)z�Yield distributions for non-duplicate projects in the working set The yield order is the order in which the items' path entries were added to the working set. rN)r;r<r=)r��seen�itemrDs r�__iter__zWorkingSet.__iter__�sy���� ���L� +� +�D��4�?�*�*����t�,� +� +���d�?�?� !�D��I��+�c�*�*�*�*�� +�  +� +rTFc���|r|�|j||���|�|j}|j�|g��}|j�|jg��}|s|j|jvrdS||j|j<|j|vr|�|j��|j|vr|�|j��|�|��dS)aAdd `dist` to working set, associated with `entry` If `entry` is unspecified, it defaults to the ``.location`` of `dist`. On exit from this routine, `entry` is added to the end of the working set's ``.entries`` (if it wasn't already present). `dist` is only added to the working set if it's for a project that doesn't already have a distribution in the set, unless `replace=True`. If it's added, any callbacks registered with the ``subscribe()`` method will be called. �r�N) � insert_onr;�locationr<rQrDr=r�� _added_new)r�r�r@�insertr��keys�keys2s rrLzWorkingSet.add�s��� � A� �N�N�4�<���N� @� @� @� �=��M�E���)�)�%��4�4����*�*�4�=�"�=�=��� �4�8�t�{�2�2� �F� $�� �D�H�� �8�4� � � �K�K��� !� !� !� �8�5� � � �L�L��� "� "� "� ��������rc���t|��ddd�}i}i}g}t��} tjt��} |�r�|�d��} | |vr�| �| |��s�4|�| j��} | ��|j �| j��} | �| | vr�|r�|} |�5| �t|j ��}ntg��}tg��} |� | | ||���x} || j<| �&| �| d��}t| |���|�| ��| | vr+| | }t!| | ���|���| �| j��ddd�}|�|��|D],}| |�| j��| j| |<�-d|| <|���|S)a�List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, if supplied, should be an ``Environment`` instance. If not supplied, it defaults to all distributions available within any entry or distribution in the working set. `installer`, if supplied, will be invoked with each requirement that cannot be met by an already-installed distribution; it should return a ``Distribution`` or ``None``. Unless `replace_conflicting=True`, raises a VersionConflict exception if any requirements are found on the path that have the correct name but the wrong version. Otherwise, if an `installer` is supplied it will be invoked to obtain the correct version of the requirement and activate it. `extras` is a list of the extras to be used with these requirements. This is important because extra requirements may look like `my_req; extra = "my_extra"`, which would otherwise be interpreted as a purely optional requirement. Instead, we want to be able to assert that these requirements are truly required. Nr�r)�replace_conflictingT)�list� _ReqExtras� collections� defaultdict�set�pop� markers_passr�rDr=rvr;rw� best_matchr~r�r}r�r]�extras�extendrL� project_name)r�� requirements�env� installerrkrt� processed�best� to_activate� req_extrasr�r�r�rHr�� dependent_req�new_requirements�new_requirements rrKzWorkingSet.resolve�s.��6�L�)�)�$�$�B�$�/� �� ���� ��\�\� �"�-�c�2�2� ��/ "��"�"�1�%�%�C��i�����*�*�3��7�7� ���8�8�C�G�$�$�D��|��{���s�w�/�/���<�D��O�O�8K�O��B��{��<�"-�d�l�";�";�C�C� #.�b�/�/�C�!+�B���B�+.�>�>��R��,?�,:�,�,��D�4���=��|�$/�O�O�C��$>�$>� �2�3� �B�B�B��"�"�4�(�(�(��3��� +�C� 0� �%�d�C�0�0�=�=�m�L�L�L� $�}�}�S�Z�8�8���2��>� � � � � 0� 1� 1� 1�$4� 9� 9���O�,�0�0��1A�B�B�B�.1�j� �?�+�+�!�I�c�N�_�/ "�d�rc��t|��}|���i}i}|�t|j��}||z }n||z}|�g��} tt | j|����|D]�} || D]�} | ���g} | �| ||��} tt | j| ����|� t� | ����n$#t$r}||| <|rYd}~��Yd}~nd}~wwxYw��t|��}|���||fS)asFind all activatable distributions in `plugin_env` Example usage:: distributions, errors = working_set.find_plugins( Environment(plugin_dirlist) ) # add plugins+libs to sys.path map(working_set.add, distributions) # display errors print('Could not load', errors) The `plugin_env` should be an ``Environment`` instance that contains only distributions that are in the project's "plugin directory" or directories. The `full_env`, if supplied, should be an ``Environment`` contains all currently-available distributions. If `full_env` is not supplied, one is created automatically from the ``WorkingSet`` this method is called on, which will typically mean that every directory on ``sys.path`` will be scanned for distributions. `installer` is a standard installer callback as used by the ``resolve()`` method. The `fallback` flag indicates whether we should attempt to resolve older versions of a plugin if the newest version cannot be resolved. This method returns a 2-tuple: (`distributions`, `error_info`), where `distributions` is a list of the distributions found in `plugin_env` that were loadable, along with any other distributions that are needed to resolve their dependencies. `error_info` is a dictionary mapping unloadable plugin distributions to an exception instance describing the error that occurred. Usually this will be a ``DistributionNotFound`` or ``VersionConflict`` instance. N) rl�sortrvr;r�rrL�as_requirementrKr*r,r-r|)r�� plugin_env�full_envry�fallback�plugin_projects� error_info� distributionsrx� shadow_setrvr�r�� resolveesr&s r� find_pluginszWorkingSet.find_plugins's���H�z�*�*��������� �� � � ��d�l�+�+�C� �:� �C�C��Z�'�C��^�^�B�'�'� � �S���� &� &�'�'�'�+� � �L�"�<�0� � ���*�*�,�,�-��� *� 2� 2�3��Y� G� G�I���Z�^�Y�7�7�8�8�8�!�(�(����y�)A�)A�B�B�B��E��'����'(�J�t�$��� ��������������������"�]�+�+� ��������j�(�(s�$D � D-�D(�(D-c�~�|�t|����}|D]}|�|���|S)a�Ensure that distributions matching `requirements` are activated `requirements` must be a string or a (possibly-nested) sequence thereof, specifying the distributions and versions required. The return value is a sequence of the distributions that needed to be activated to fulfill the requirements; all relevant distributions are included, even if they were already activated in this working set. )rKr�rL)r�rw�neededr�s rrazWorkingSet.require{sC�����0��>�>�?�?��� � �D� �H�H�T�N�N�N�N�� rc�x�||jvrdS|j�|��|sdS|D] }||���dS)z�Invoke `callback` for all distributions If `existing=True` (default), call on all existing ones, as well. N)r>r�)r��callback�existingr�s r� subscribezWorkingSet.subscribe�sa�� �t�~� %� %� �F� ����h�'�'�'�� � �F�� � �D� �H�T�N�N�N�N� � rc�0�|jD] }||���dSr!)r>)r�r�r�s rrfzWorkingSet._added_new�s,���� � �H� �H�T�N�N�N�N� � rc��|jdd�|j���|j���|jdd�fSr!)r;r<r=r=r>r�s rr8zWorkingSet.__getstate__�sG�� �L����O�T�_�1�1�3�3�T�[�5E�5E�5G�5G� �N�1�1�1� � � rc��|\}}}}|dd�|_|���|_|���|_|dd�|_dSr!)r;r=r<r=r>)r��e_k_b_cr;rhr=r>s rr;zWorkingSet.__setstate__�sP��+2�(���v�y��q�q�q�z�� ��)�)�+�+����k�k�m�m�� �"�1�1�1�����rr!)NTF)NNFN)NNT�T)rrrrrA� classmethodrIrFr?rTr�rhrbrarLrKr�rar�rfr8r;rrrrwrw)sh������N�N� "� "� "� "�����[��&����[��* )� )� )�1�1�1����  �  �  �  �>�>�>�+�+�+�"����<9=�26�Z�Z�Z�Z�zGK�R)�R)�R)�R)�h��� � � � ���� � � � &�&�&�&�&rrwc��eZdZdZdd�ZdS)rmz> Map each requirement to the extras that demanded it. Nc����fd�|��d��|pdzD��}�j pt|��S)z� Evaluate markers for req against each extra that demanded it. Return False if the req has a marker and fails evaluation. Otherwise, return True. c3�P�K�|] }�j�d|i��V��!dS)�extraN��marker�evaluate)rYr�r�s �rrZz*_ReqExtras.markers_pass..�sL����� � �� �J� � ��%� 0� 1� 1� � � � � � rrr!)r�r��any)r�r�rt� extra_evalss ` rrrz_ReqExtras.markers_pass�s\��� � � � ����#�r�*�*�f�.?��@� � � � ��:�~�1��[�!1�!1�1rr!)rrrrrrrrrrmrm�s2�������� 2� 2� 2� 2� 2� 2rrmc�t�eZdZdZde��efd�Zd�Zd�Zdd�Z d�Z d�Z dd �Z dd �Z d �Zd �Zd�ZdS)rvz5Searchable snapshot of distributions on a search pathNc�Z�i|_||_||_|�|��dS)a!Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. N)�_distmaprY�python�scan)r�� search_pathrYr�s rrAzEnvironment.__init__�s1��&�� � �� ��� � � � �+�����rc�~�|jdup|jdup|j|jk}|ot|j|j��S)z�Is distribution `dist` acceptable for this environment? The distribution must match the platform and python version requirements specified when this environment was created, or False is returned. N)r�� py_versionr�rY)r�r�� py_compats r�can_addzEnvironment.can_add�sO�� �K�4� � .���$�&� .���$�+�-� � �O�1�$�-���O�O�Orc�P�|j|j�|��dS)z"Remove `dist` from the environmentN)r�rD�removerSs rr�zEnvironment.remove�s%�� � �d�h��&�&�t�,�,�,�,�,rc�z�|� tj}|D])}t|��D]}|�|����*dS)adScan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. N)rXr�rrrL)r�r�r`r�s rr�zEnvironment.scan�sW�� � ��(�K�� � �D�*�4�0�0� � ���������� � � rc�`�|���}|j�|g��S)aReturn a newest-to-oldest list of distributions for `project_name` Uses case-insensitive `project_name` comparison, assuming all the project's distributions use their project's name converted to all lowercase as their key. )�lowerr�r�)r�rv�distribution_keys r� __getitem__zEnvironment.__getitem__�s/��(�-�-�/�/���}� � �!1�2�6�6�6rc�(�|�|��rx|���rf|j�|jg��}||vrD|�|��|�tjd��d���dSdSdSdS)zLAdd `dist` if we ``can_add()`` it and it has not already been added �hashcmpT�rD�reverseN) r�� has_versionr�rQrDr�r��operator� attrgetter)r�r�rOs rrLzEnvironment.adds��� �<�<�� � � M�$�"2�"2�"4�"4� M��M�,�,�T�X�r�:�:�E��5� � �� � �T�"�"�"�� � �x�2�9�=�=�t� �L�L�L�L�L�  M� M� M� M� � rFc�� |�|��}n#t$r|s�d}YnwxYw|�|S||jD] }||vr|cS� |�||��S)a�Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ``VersionConflict`` if an unsuitable version of the project is already active in the specified `working_set`.) If a suitable distribution isn't active, this method returns the newest distribution in the environment that meets the ``Requirement`` in `req`. If no suitable distribution is found, and `installer` is supplied, then the result of calling the environment's ``obtain(req, installer)`` method will be returned. N)r�r}rD�obtain)r�r�rpryrkr�s rrszEnvironment.best_matchs��� ��#�#�C�(�(�D�D��� � � �&� ���D�D�D� ���� � ��K����M� � �D��s�{�{�� � � ���{�{�3� �*�*�*s ��*�*c� �|� ||��SdS)a�Obtain a distribution matching `requirement` (e.g. via download) Obtain a distro that matches requirement (e.g. via download). In the base ``Environment`` class, this routine just returns ``installer(requirement)``, unless `installer` is None, in which case None is returned instead. This method is a hook that allows subclasses to attempt other ways of obtaining a distribution before falling back to the `installer` argument.Nr)r�� requirementrys rr�zEnvironment.obtain+s"�� � ��9�[�)�)� )� !� rc#�ZK�|j���D]}||r|V��dS)z=Yield the unique project names of the available distributionsN)r�rh�r�rDs rrazEnvironment.__iter__7sC�����=�%�%�'�'� � �C��C�y� �� � � �� � rc���t|t��r|�|��nNt|t��r&|D]"}||D]}|�|����#nt d|�d����|S)z2In-place addition of a distribution or environmentz Can't add z to environment)r�ryrLrvr)r��other�projectr�s r�__iadd__zEnvironment.__iadd__=s��� �e�\� *� *� F� �H�H�U�O�O�O�O� ��{� +� +� F� � #� #��!�'�N�#�#�D��H�H�T�N�N�N�N�#� #��)�U�U�U�D�E�E� E�� rc�N�|�gdd���}||fD]}||z }�|S)z4Add an environment or distribution to an environmentN)rYr��r�)r�r��newrxs r�__add__zEnvironment.__add__Is<���n�n�R�$�t�n�<�<����;� � �C� �3�J�C�C�� rr!�NF)rrrrr`�PY_MAJORrAr�r�r�r�rLrsr�rar�r�rrrrvrv�s�������?�?�#�-C�-C�-E�-E������0 P� P� P�-�-�-� � � � � 7� 7� 7�M�M�M�IN�+�+�+�+�8 *� *� *� *���� � � �����rrvc��eZdZdZdS)r�aTAn error occurred extracting a resource The following attributes are available from instances of this exception: manager The resource manager that raised this exception cache_path The base directory for resource extraction original_error The exception instance that caused extraction to fail Nrrrrr�r�Us������ � � � rr�c�x�eZdZdZdZd�Zd�Zd�Zd�Zd�Z d�Z d �Z d �Z dd �Z ed ���Zd�Zd�Zdd�ZdS)rxz'Manage resource extraction and packagesNc��i|_dSr!)� cached_filesr�s rrAzResourceManager.__init__is������rc�F�t|���|��S)zDoes the named resource exist?)rcr6�r��package_or_requirementr.s rrmzResourceManager.resource_existsls���2�3�3�@�@��O�O�Orc�F�t|���|��S)z,Is the named resource an existing directory?)rcrnr�s rrnzResourceManager.resource_isdirps&���2�3�3�B�B� � � � rc�H�t|���||��S)z4Return a true filesystem path for specified resource)rcr/r�s rrkz!ResourceManager.resource_filenamevs(���2�3�3�I�I� �-� � � rc�H�t|���||��S)z9Return a readable file-like object for specified resource)rcr1r�s rrjzResourceManager.resource_stream|�(���2�3�3�G�G� �-� � � rc�H�t|���||��S)z%Return specified resource as a string)rcr3r�s rrizResourceManager.resource_string�r�rc�F�t|���|��S)z1List the contents of the named resource directory)rcrlr�s rrlz ResourceManager.resource_listdir�s&���2�3�3�D�D� � � � rc�$�tj��d}|jp t��}t jd�����}t|jdit������}||_ ||_ ||_ |�)z5Give an error message for problems extracting file(s)ra Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: {old_exc} The Python egg cache directory is currently set to: {cache_path} Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory. Nr) rX�exc_info�extraction_pathru�textwrap�dedent�lstripr�r�r�r-� cache_path�original_error)r��old_excr��tmpl�errs r�extraction_errorz ResourceManager.extraction_error�s����,�.�.��#���)�@�->�-@�-@� ��� ������� � �k�d�k�5�5�F�H�H�5�5�6�6���� �#���$���� rrc��|jp t��}tjj||dzg|�R�} t |��n$#t $r|���YnwxYw|�|��d|j |<|S)a�Return absolute location in cache for `archive_name` and `names` The parent directory of the resulting path will be created if it does not already exist. `archive_name` should be the base filename of the enclosing egg (which may not be the name of the enclosing zipfile!), including its ".egg" extension. `names`, if provided, should be a sequence of path name parts "under" the egg's extraction location. This method should only be called by resource providers that need to obtain an extraction location, and only for names they intend to extract, as it tracks the generated names for possible cleanup later. z-tmpr) r�rur�r�rZ�_bypass_ensure_directory� Exceptionr��_warn_unsafe_extraction_pathr�)r�� archive_name�names� extract_path� target_paths r�get_cache_pathzResourceManager.get_cache_path�s����+�B�/@�/B�/B� ��g�l�<���1F�O��O�O�O� � $� $�[� 1� 1� 1� 1��� $� $� $� � !� !� #� #� #� #� #� $���� �)�)�,�7�7�7�)*���+�&��s�A�A#�"A#c�$�tjdkr'|�tjd��sdStj|��j}|tjzs|tjzr!d|z}tj |t��dSdS)aN If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location is used. See Distribute #375 for more details. �nt�windirNz�%s is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).) r�rr��environ�stat�st_mode�S_IWOTH�S_IWGRP�warnings�warn� UserWarning)r��mode�msgs rr�z,ResourceManager._warn_unsafe_extraction_path�s��� �7�d�?�?�4�?�?�2�:�h�3G�#H�#H�?� �F��w�t�}�}�$�� �$�,� � ,�$���"5� ,�:�=A� A� � �M�#�{� +� +� +� +� +� ,� ,rc��tjdkr6tj|��jdzdz}tj||��dSdS)a4Perform any platform-specific postprocessing of `tempname` This is where Mac header rewrites should be done; other platforms don't have anything special they should do. Resource providers should call this method ONLY after successfully extracting a compressed resource. They must NOT call it on resources that are already in the filesystem. `tempname` is the current (temporary) name of the file, and `filename` is the name it will be renamed to by the caller after this routine returns. �posiximi�N)r�rr�r��chmod)r��tempname�filenamer�s r� postprocesszResourceManager.postprocess�sM�� �7�g� � ��W�X�&�&�.�%�7�6�A�D� �H�X�t� $� $� $� $� $� � rc�@�|jrtd���||_dS)a�Set the base path where resources will be extracted to, if needed. If you do not call this routine before any extractions take place, the path defaults to the return value of ``get_default_cache()``. (Which is based on the ``PYTHON_EGG_CACHE`` environment variable, with various platform-specific fallbacks. See that routine's documentation for more details.) Resources are extracted to subdirectories of this path based upon information given by the ``IResourceProvider``. You may set this to a temporary directory, but then you must call ``cleanup_resources()`` to delete the extracted files when done. There is no guarantee that ``cleanup_resources()`` will be able to remove all extracted files. (Note: you may not change the extraction path for a given resource manager once resources have been extracted, unless you first call ``cleanup_resources()``.) z5Can't change extraction path, files already extractedN)r�r]r��r�r�s rrsz#ResourceManager.set_extraction_path�s4��& � � ��G��� � $����rFc��dS)aB Delete all extracted resource files and directories, returning a list of the file and directory names that could not be successfully removed. This function does not have any concurrency protection, so it should generally only be called when the extraction path is a temporary directory exclusive to a single process. This method is not automatically called; you must call it explicitly or register it as an ``atexit`` function if you wish to ensure cleanup of a temporary directory used for extractions. Nr)r��forces rrtz!ResourceManager.cleanup_resources rr�r�F)rrrrr�rArmrnrkrjrirlr�r�� staticmethodr�r�rsrtrrrrxrxes�������1�1��O����P�P�P� � � �  � � �  � � �  � � �  � � � ���8����2�,�,��\�,�2%�%�%�($�$�$�4  �  �  �  �  �  rrxc�j�tj�d��ptjd���S)z� Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs". �PYTHON_EGG_CACHEz Python-Eggs)�appname)r�r�r�r�user_cache_dirrrrrurus1�� � ���)�*�*� >� � &�}� =� =� =�rc�.�tjdd|��S)z�Convert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. �[^A-Za-z0-9.]+rT)�re�subrs rr�r�%s�� �6�"�C�� .� .�.rc��� ttj�|����S#tjj$r/|�dd��}t jdd|��cYSwxYw)zB Convert an arbitrary string to a standard version string r�rRr rT)r�rr"r#r$r�r r )r"s rr�r�-su��6��9�$�,�,�W�5�5�6�6�6�� � � +�6�6�6��/�/�#�s�+�+���v�&��W�5�5�5�5�5�6���s�+.�AA1�0A1c�R�tjdd|�����S)z�Convert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased. z[^A-Za-z0-9.-]+r�)r r r�)r�s rr�r�9s%�� �6�#�S�%� 0� 0� 6� 6� 8� 8�8rc�.�|�dd��S)z|Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. rTr�rcrs rr�r�Bs�� �<�<��S� !� !�!rc�v� t|��n'#t$r}d|_d|_|cYd}~Sd}~wwxYwdS)zo Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. NF)r�� SyntaxErrorr��lineno)�text�es rr�r�Js[�� �������� ������ ������������������� �5s�� 6�1�6�6c��� tj�|��}|���S#tjj$r}t |���d}~wwxYw)z� Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module. N)r�markers�Markerr�� InvalidMarkerr)rr�r�rs rr�r�Xs^����"�)�)�$�/�/����� � � �� � � *�����!�n�n���������s�25�A� A�Ac��eZdZdZdZdZdZd�Zd�Zd�Z d�Z d�Z d�Z d �Z d �Zd �Zd �Zd �Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed���Zd�ZdS)r�zETry to implement resources and metadata for arbitrary PEP 302 loadersNc��t|dd��|_tj�t|dd����|_dS)Nr��__file__r�)r�r�r�r��dirname� module_path�r�r�s rrAzNullProvider.__init__ns=���f�l�D�9�9�� ��7�?�?�7�6�:�r�+J�+J�K�K����rc�8�|�|j|��Sr!)�_fnr�r�r-r.s rr/z"NullProvider.get_resource_filenamers���x�x��(�-�8�8�8rc�R�tj|�||����Sr!)�io�BytesIOr3r"s rr1z NullProvider.get_resource_streamus"���z�$�2�2�7�M�J�J�K�K�Krc�^�|�|�|j|����Sr!)�_getr!rr"s rr3z NullProvider.get_resource_stringx�%���y�y����$�"2�M�B�B�C�C�Crc�^�|�|�|j|����Sr!)�_hasr!r�r�r.s rr6zNullProvider.has_resource{r(rc�8�|�|j|��Sr!)r!�egg_info�r�rs r�_get_metadata_pathzNullProvider._get_metadata_path~s���x�x�� �t�,�,�,rc�r�|js|jS|�|��}|�|��Sr!)r-r/r*�r�rr�s rrzNullProvider.has_metadata�s7���}� !��=� ��&�&�t�,�,���y�y����rc��|jsdS|�|��}|�|��}tjr|S |�d��S#t $r*}|xjd�||��z c_�d}~wwxYw)Nr��utf-8z in {} file at path: {}) r-r/r'r�PY2�decode�UnicodeDecodeError�reasonr�)r�rr��value�excs rr!zNullProvider.get_metadata�s����}� ��2��&�&�t�,�,��� � �$���� �7� ��L� ��<�<��(�(� (��!� � � � �J�J�3�:�:�4��F�F� F�J�J� �����  ���s�A� B �"%B�B c�F�t|�|����Sr!�r�r!r.s rr#zNullProvider.get_metadata_lines�����4�,�,�T�2�2�3�3�3rc�^�|�|�|j|����Sr!)�_isdirr!rr+s rrnzNullProvider.resource_isdir�s%���{�{�4�8�8�D�$4�m�D�D�E�E�Erc�l�|jo-|�|�|j|����Sr!)r-r>r!r.s rr%zNullProvider.metadata_isdir�s+���}�K����T�X�X�d�m�T�-J�-J�!K�!K�Krc�^�|�|�|j|����Sr!)�_listdirr!rr+s rrlzNullProvider.resource_listdir�s%���}�}�T�X�X�d�&6� �F�F�G�G�Grc�p�|jr.|�|�|j|����SgSr!)r-rAr!r.s rr'zNullProvider.metadata_listdir�s4�� �=� @��=�=����$�-��!>�!>�?�?� ?�� rc��d|z}|�|��s&tdjd it�������|�|���dd��}|�dd��}|�|j|��}||d<tj � |��rEt|��� ��}t||d��}t|||��dSdd lm}t#|��d|�d��|f||<t||d��} t| ||��dS) Nzscripts/z