� ��^i�;�� �dZddlZddlZddlZddlmZmZmZmZm Z m Z ddl m Z ddl mZmZddlmZddlmZmZddlmZdd lmZmZdd lmZdd lmZdd lmZdd l m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+m,Z,gd�Z-ej.e/��Z0ej1�2��Z3de4de e4ee4ffd�Z5dee4dee4fd�Z6de4de ee4e4ee4ffd�Z7de4de4fd�Z8Gd�d��Z9de4de9fd�Z: d6de4d!ee e!e4fd"ee;d#e;d$eee4efd%e;d&e;d'e;de!fd(�Zd)e4d,ee4de9fd-�Z? d7d)e4d!ee e4e!fd"ee;d#e;d$eee4efd%e;d,ee4d&e;de!fd.�Z@ d8d/e4d!ee!d#e;d"ee;d&e;de!f d0�ZA d9d1ed#e;d"ee;d&e;de!f d2�ZBd3ed4e!de!fd5�ZCdS):a~Backing implementation for InstallRequirement's various constructors The idea here is that these formed a major chunk of InstallRequirement's size so, moving them and support code dedicated to them outside of that class helps creates for better understandability for the rest of the code. These are meant to be used elsewhere within pip to create instances of InstallRequirement. �N)�Any�Dict�Optional�Set�Tuple�Union)�Marker)�InvalidRequirement� Requirement)� Specifier)�RequirementParseError�parse_requirements)�InstallationError)�PyPI�TestPyPI)�Link)�Wheel)�ParsedRequirement)�InstallRequirement)�is_archive_file)�is_installable_dir)�get_requirement)� path_to_url)�is_url�vcs)�install_req_from_editable�install_req_from_line�parse_editable�path�returnc��tjd|��}d}|r+|�d��}|�d��}n|}||fS)Nz^(.+)(\[[^\]]+\])$��)�re�match�group)r�m�extras�path_no_extrass ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/req/constructors.py� _strip_extrasr++sQ�� ��&��-�-�A� �F�������������������� �6� !�!�r(c�t�|st��Std|���z��jS)N� placeholder)�setr�lowerr()r(s r*�convert_extrasr17s1�� ���u�u� � �=�6�<�<�>�>�9� :� :� A�Ar,� editable_reqc��|}t|��\}}tj�|��rt |��}|����d��rSt|��j}|r,||td|���z��j fS||t��fStD]5}|����|�d���r |�d|��}n�6t|��}|j s4d�tj��}t!|�d|�d����|j}|s"t!d�|�����||t��fS) aParses an editable requirement into: - a requirement name - an URL - extras - editable options Accepted requirements: svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir .[some_extra] zfile:r.�:�+z, zq is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with z).zZCould not detect requirement name for '{}', please specify one with #egg=your_package_name)r+�osr�isdirrr0� startswithr� egg_fragmentrr(r/r�is_vcs�join� all_schemesr�format)r2�url� url_no_extrasr(� package_name�version_control�link�backendss r*rr=s��� �C�*�#�.�.��M�6� �w�}�}�]�#�#�3�#�M�2�2� ������'�'��0�0� 6��M�*�*�7� � � 6���� �� � ��� >�?�?�F�� �  �����5� 5����� �9�9�;�;� !� !�_�"7�"7�"7� 8� 8� �$�,�,�s�,�,�C� �E� � ��9�9�D� �;� ��9�9�S�_�-�-���� ,� ,�'� ,� ,� ,� � � � �$�L� � �� *�*0�&��*>�*>� � � � ��c�e�e� #�#r,�reqc��d}tj�|��r�d} t|��5}t t |�������|d�|��z }ddd��n #1swxYwYn6#t$r t� d|d���Yn wxYw|d|�d �z }|S) z�Returns helpful msg in case requirements file does not exist, or cannot be parsed. :params req: Requirements file path �z The path does exist. z�The argument you provided ({}) appears to be a requirements file. If that is the case, use the '-r' flag to install the packages specified within it.Nz&Cannot parse '%s' as requirements fileT)�exc_infoz File 'z' does not exist.) r6r�exists�open�nextr�readr=r �logger�debug)rD�msg�fps r*�deduce_helpful_msgrPts"�� �C� �w�~�~�c���0�&�� W��c��� �b��'���� � �2�2�3�3�3��9� �&��+�+� �� � � � � � � � � � � ���� � � � ���%� W� W� W� �L�L�A�3�QU�L� V� V� V� V� V� W���� �/��/�/�/�/�� �Js5�B�AB�; B�B � B�B �B�'B=�<B=c �V�eZdZdeedeedeedeefd�Z dS)�RequirementParts� requirementrB�markersr(c�>�||_||_||_||_dS�N)rSrBrTr()�selfrSrBrTr(s r*�__init__zRequirementParts.__init__�s%��'����� ��� ��� � � r,N) �__name__� __module__� __qualname__rr rr r�strrX�r,r*rRrR�s`������ ��k�*� ��t�n� ��&�!� � �C�� � � � � � r,rRc���t|��\}}}|�2 t|��}n##t$rtd|�d����wxYwd}t |��}t ||d|��S)N�Invalid requirement: '�')rr r rrrR)r2�namer>�extras_overriderDrBs r*�parse_req_from_editablerc�s���!/� �!=�!=��D�#�� �� F�)4�T�):�):�C�C��!� F� F� F�#�$D�T�$D�$D�$D�E�E� E� F������ ��9�9�D� �C��t�_� =� =�=s �'�AF� comes_from� use_pep517�isolated�options� constraint� user_supplied�permit_editable_wheelsc��t|��}t|j||d||j||||r|�dg��ng|r|�dg��ng|r|�di��ni|j�� � S)NT�install_options�global_options�hashes) rdri�editablerjrBrhrerfrlrm� hash_optionsr()rcrrSrB�getr() r2rdrerfrgrhrirj�partss r*rr�s��� $�L� 1� 1�E� � ���#��5� �Z����>E�M�� � �$5�r�:�:�:�2�.with_source4s'���� ��K��-�-�{�-�-�-�-r,� req_as_stringc���� t���}|jD];}t|��}|�d��rd|�d�}t |����zAparse_req_from_line.._parse_req_string..@s9�����2�2�(*��m�#�2�2�2�2�2�2r,z,= is not a valid operator. Did you mean == ?rFzInvalid requirement: z Hint: ) r� specifierr\�endswithrr r6rrurP�any� operators)r�rD�spec�spec_strrN�add_msgr�s` �r*�_parse_req_stringz.parse_req_from_line.._parse_req_string9sO���� 1�!�-�0�0�C�(� � 1� 1���t�9�9���$�$�S�)�)�1�?�8�?�?�?�C�+�C�0�0�0�1� 1��'"� )� )� )��w�{�m�+�+�1���-�m�<�<�<���� �%�%�c�2�2�2�2�.7�2�2�2�/�/�%�I������+�G�m�G�G�H�H�C�� ,��+�'�+�+�+��#�C�(�(� (� )����0� s �A�BC)rr{�stripr r6r�normpath�abspathrr+r�schemer$�searchr>r�is_wheelr�filenamera�versionr9r1r\r rR)rar�� marker_sep�markers_as_stringrTr�rrB�extras_as_string�pr>�wheelr(r�rDr�s ` @r*�parse_req_from_liner�sB���� �d�|�|��� � �� ��T���"&�*�*�Z��";�";����-�3�3�5�5�� � 0��G�G��.�/�/�G�G��� �:�:�<�<�D��M� �7� � �B�G�O�O�D�1�1� 2� 2�D� �D��� �d�|�|���D�z�z���+�D�1�1��� � ��D�)�)�� �?���9�9�D� �� �;�&� � �R�Y�x���%B�%B� �� �B�G�$4�$4�R�W�_�_�T�Y�5O�5O�$P�$P�Q�Q�R�R�D� �=� .��$�-�(�(�E�$�z�<�<�U�]�<�<�M�M�!�-�M�M�� � �,� -� -�F�.�#�.�#�.�.�.�.�.�.� ����������:� �%6�%6�}�%E�%E����� �C��w�� 7� 7�7r,c��t||��}t|j||j|j|||r|�dg��ng|r|�dg��ng|r|�di��ni||j|�� � S)aCreates an InstallRequirement from a name, which might be a requirement, directory containing 'setup.py', filename, or URL. :param line_source: An optional string describing where the line is from, for logging purposes in case of an error. rlrmrn) rBrTrerfrlrmrprhr(ri)r�rrSrBrTrqr() rardrerfrgrhr�rirrs r*rr^s��� ��k� 2� 2�E� � ��� �Z�� ���>E�M�� � �$5�r�:�:�:�2�rB�netlocr=rar)r�rdrfrerirD�domains_not_alloweds r*�install_req_from_req_stringr��s���H��j�)�)���� �H�H�H�� F�� F� F� F�G�G�G�H���� � ��$��� ��  � �  � �O�  � �O� "�&9� 9� 9� � � &��z��� <� <� � � � � ����#�  � � �s��0� parsed_reqc ��|jr%t|j|j||j||���}n0t |j|j|||j|j|j|���}|S)N)rdrerhrfri)rdrerfrgrhr�ri)� is_editablerrSrdrhrrgr�)r�rfrerirDs r*�#install_req_from_parsed_requirementr��s��� �� �'� � "�!�,�!�!�,��'�  � � ���$� � "�!�,�!���&�!�,�"�.�'�  �  �  �� �Jr,rB�ireqc ��t|j|j|j||j|j|j|j|j|j �� � S)N) rDrdrorBrTrerfrlrmrp) rrDrdrorTrerfrlrmrp)rBr�s r*�install_req_from_link_and_ireqr��sN�� � �H��?��� �� ��?����,��*��&� � � � r,)NNFNFFF)NNFNFNF)NFNF)FNF)D�__doc__�loggingr6r$�typingrrrrrr�pip._vendor.packaging.markersr �"pip._vendor.packaging.requirementsr r � pip._vendor.packaging.specifiersr �pip._vendor.pkg_resourcesr r�pip._internal.exceptionsr�pip._internal.models.indexrr�pip._internal.models.linkr�pip._internal.models.wheelr�pip._internal.req.req_filer�pip._internal.req.req_installr�pip._internal.utils.filetypesr�pip._internal.utils.miscr�pip._internal.utils.packagingr�pip._internal.utils.urlsr�pip._internal.vcsrr�__all__� getLoggerrYrL� _operators�keysr�r\r+r1rrPrRrc�boolrrwrr�rr�r�r�r]r,r*�r�s��������� � � � � � � � �9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�9�0�0�0�0�0�0�N�N�N�N�N�N�N�N�6�6�6�6�6�6�O�O�O�O�O�O�O�O�6�6�6�6�6�6�5�5�5�5�5�5�5�5�*�*�*�*�*�*�,�,�,�,�,�,�8�8�8�8�8�8�<�<�<�<�<�<�9�9�9�9�9�9�7�7�7�7�7�7�9�9�9�9�9�9�0�0�0�0�0�0�)�)�)�)�)�)�)�)� � � �� �� �8� $� $�� � � %� %� '� '� � "�� "��c�8�C�=�&8� 9� "� "� "� "�B�8�C�=�B�S��X�B�B�B�B� 4$��4$��x��}�c�3�s�8�/K�)L�4$�4$�4$�4$�n�C��C�����8 � � � � � � � � >�#� >�2B� >� >� >� >�*<@�!%��(,���#(�������1�3�6�7�8������� � �d�3��8�n� %� � � ���!�������<�3��4�����&�S������ �����DW8�c�W8��� �W8�BR�W8�W8�W8�W8�x<@�!%��(,��!%���� ����s�$6�6�7�8������� � �d�3��8�n� %� � � ��#����������H04��!%�� #�#��#��+�,�#��#���� #� � #� � #�#�#�#�P�!%�� ��!��������� � � ����<� ��(��������r,