� ��^ia3����dZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZmZejZe d e��Zerd nd Zd Zed dddd���Zejej ej!ej"ej#fZ$ej ejej!fZ%ee&��Z'dedefd�Z(dede efd�Z)deee effd�Z*Gd�d��Z+dS)a Configuration management setup Some terminology: - name As written in config files. - value Value associated with a name - key Name combined with it's section (section.name) - variant A single word describing where the configuration key-value pair came from �N)�Any�Dict�Iterable�List�NewType�Optional�Tuple)�ConfigurationError�!ConfigurationFileCouldNotBeLoaded)�appdirs)�WINDOWS)� getLogger)� ensure_dir�enum�Kindzpip.inizpip.conf)�version�help�user�global�site�envzenv-var)�USER�GLOBAL�SITE�ENV�ENV_VAR�name�returnc��|����dd��}|�d��r |dd�}|S)zAMake a name consistent regardless of source (environment or file)�_�-z--�N)�lower�replace� startswith)rs ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/configuration.py�_normalize_namer'2sE�� �:�:�<�<� � ��S� )� )�D� ���t�����A�B�B�x�� �K�c�~�d|vr$d�|��}t|���|�dd��S)N�.zbKey does not contain dot separated section and key. Perhaps you wanted to use 'global.{}' instead?�)�formatr �split)r� error_messages r&�_disassemble_keyr/:sD�� �$��� =� �&��,�,� �!��/�/�/� �:�:�c�1� � �r(c���d�tjd��D��}tj�t jt��}tj�tj�d��trdndt��}tj�tj d��t��}tj |tj |gtj||giS)Nc�X�g|]'}tj�|t����(S�)�os�path�join�CONFIG_BASENAME)�.0r4s r&� z+get_configuration_files..Es5�����04��� � �T�?�+�+���r(�pip�~z.pip)r �site_config_dirsr3r4r5�sys�prefixr6� expanduserr �user_config_dir�kindsrrr)�global_config_files�site_config_file�legacy_config_file�new_config_files r&�get_configuration_filesrEDs�����8?�8P�QV�8W�8W������w�|�|�C�J��@�@������ ����3����$���f����� �g�l�l�7�#:�5�#A�#A�?�S�S�O� � �)� � �%�&� � �'��9� �r(c�"��eZdZdZd"dedeeddf�fd� Zd#d�Zdee fd�Z de e e e ffd �Zd e de fd �Zd e d e ddfd �Zd e ddfd�Zd#d�Zd#d�Zedee e ffd���Zd#d�Zdede defd�Zde defd�Zd#d�Zde de e e e fdee e ffd�Zde e e e ffd�Zde e eee ffd�Zdedee e ffd�Z de e effd�Z!de deddfd �Z"de fd!�Z#�xZ$S)$� Configurationa�Handles management of configuration. Provides an interface to accessing and managing configuration files. This class converts provides an API that takes "section.key-name" style keys and stores the value associated with it as "key-name" under the section "section". This allows for a clean interface wherein the both the section and the key-name are preserved in an easy to manage form in the configuration files and the data stored is also nice. N�isolated� load_onlyrc �z��t�����|�V|tvrMtd�d�t tt���������||_||_ d�tD��|_ d�tD��|_ g|_ dS)Nz5Got invalid value for load_only - should be one of {}z, c��i|]}|g��Sr2r2�r7�variants r&� z*Configuration.__init__..rs-��H �H �H �#�G�R�H �H �H r(c��i|]}|i��Sr2r2rLs r&rNz*Configuration.__init__..us'��4 �4 �4 �#�G�R�4 �4 �4 r()�super�__init__�VALID_LOAD_ONLYr r,r5�map�reprrHrI�OVERRIDE_ORDER�_parsers�_config�_modified_parsers)�selfrHrI� __class__s �r&rQzConfiguration.__init__es���� �������� � �Y�o�%E�%E�$�G�N�N��I�I�c�$��8�8�9�9����� � !�� �"���H �H �'5�H �H �H �� �4 �4 �'5�4 �4 �4 �� �EG����r(c�h�|���|js|���dSdS)z�2� 2� 2�$�%;�c�%;�%;�<�<� <��2�2�4�4� ��v� � �,�S�1�1�M�G�T��"�"�7�+�+� �06�0D�0D�W�d�0S�0S� �)�J���� �<�<��(�(� /��%�%�g�.�.�.� � "� "�5�&� 1� 1� 1� �L��� (�� -� -� -r(c�P�|���|jD]�\}}t�d|��t t j�|����t|d��5}|� |��ddd��n #1swxYwY��dS)z!Save the current in-memory state.z Writing to %s�wN) rnrX�logger�inforr3r4�dirname�open�write)rYrsrt�fs r&�savezConfiguration.save�s��� �#�#�%�%�%�!�3� � �M�E�6� �K�K��� /� /� /� �r�w���u�-�-� .� .� .��e�S�!�!� �Q�� � �Q���� � � � � � � � � � � ���� � � � ��  � s�8B�B �!B c�r�|j�td���t�d|j��dS)Nz'Needed a specific file to be modifying.z$Will be working with %s variant only)rIr r}�debugr^s r&rnz$Configuration._ensure_have_load_only�s6�� �>� !�$�%N�O�O� O�� � �;�T�^�L�L�L�L�Lr(c�^�i}tD]"}|�|j|���#|S)z3A dictionary representing the loaded configuration.)rU�updaterW)rY�retvalrMs r&rezConfiguration._dictionary�s9�� ��%� 1� 1�G� �M�M�$�,�w�/� 0� 0� 0� 0�� r(c���t|�����}|tjdd�tjgkrt �d��dS|���D]q\}}|D]i}|j �(||j krt �d||���1|� ||��}|j |� ||f���j�rdS)z,Loads configuration from configuration filesrr+zZSkipping loading configuration files due to environment's PIP_CONFIG_FILE being os.devnullNz Skipping file '%s' (variant: %s)) �dict�iter_config_filesr@rr3�devnullr}r�rfrI� _load_filerV�append)rY� config_filesrM�filesrsrts r&r\z Configuration._load_config_files�s���D�2�2�4�4�5�5� � �� � "�1�Q�3� '�B�J�<� 7� 7� �L�L�A� � � � �F�*�0�0�2�2� ?� ?�N�G�U�� ?� ?���>�-�'�T�^�2K�2K��L�L�!C�U�G�T�T�T������%�8�8��� �g�&�-�-�u�f�o�>�>�>�>� ?� ?� ?r(rMrsc�(�t�d||��|�|��}|���D]K}|�|��}|j|�|�||�����L|S)Nz'For variant '%s', will try loading '%s')r}�verbose�_construct_parser�sectionsrfrWr��_normalized_keys)rYrMrsrtrurfs r&r�zConfiguration._load_file�s������@�'�5�Q�Q�Q��'�'��.�.�����(�(� P� P�G��L�L��)�)�E� �L�� !� (� (��)>�)>�w��)N�)N� O� O� O� O�� r(c�d�tj��}tj�|��r} |�|��nf#t $r7td�tj d����|����tj $r}t|����d}~wwxYw|S)Nzcontains invalid {} charactersF)�reasonrs)�error) � configparser�RawConfigParserr3r4�exists�read�UnicodeDecodeErrorr r,�locale�getpreferredencoding�Error)rYrsrtr�s r&r�zConfiguration._construct_parsers����-�/�/�� �7�>�>�%� � � E� E�� � �E�"�"�"�"��%� � � �7�;�B�B��3�E�:�:��� � ����  �%� E� E� E�7�e�D�D�D�D����� E����� s�A � AB-�B(�(B-c��|jtj�|�d|�������dS)z.Loads configuration from environment variablesz:env:N)rWr@rr�r��get_environ_varsr^s r&r]z$Configuration._load_environment_varssL�� � �U�]�#�*�*� � !� !�'�4�+@�+@�+B�+B� C� C� � � � � r(rurfc�N�i}|D]\}}|dzt|��z}|||<� |S)z�Normalizes items to construct a dictionary with normalized keys. This routine is where the names become keys and are made the same regardless of source - configuration files or environment. r*)r')rYrurf� normalizedr�valrgs r&r�zConfiguration._normalized_keys"sC��� �� "� "�I�D�#��C�-�/�$�"7�"7�7�C�!�J�s�O�O��r(c#��K�tj���D]E\}}|�d��r+|dd����}|t vr||fV��FdS)z@Returns a generator with all environmental vars with prefix PIP_�PIP_�N)r3�environrfr%r#�ENV_NAMES_IGNORED)rYrgr�rs r&r�zConfiguration.get_environ_vars0st����� �(�(�*�*� $� $�H�C���~�~�f�%�%� $��1�2�2�w�}�}�����0�0�0���)�O�O�O��  $� $r(c#��K�tj�dd��}|�tj|gfV�ntjgfV�t ��}tj|tjfV�|j o!|otj� |�� }|r tj |tj fV�tj |tj fV�dS)zYields variant and configuration files associated with it. This should be treated like items of a dictionary. �PIP_CONFIG_FILEN) r3r��getr@rrErrHr4r�rr)rY� config_filer��should_load_user_configs r&r�zConfiguration.iter_config_files9s������j�n�n�%6��=�=� � � "��)�k�]�*� *� *� *� *��)�R�-� � � �.�0�0� ��l�L���6�6�6�6�6�'+�m�"3�# � � 7�B�G�N�N�;�7�7�9 �� #� 7��*�l�5�:�6�6� 6� 6� 6��j�,�u�z�2�2�2�2�2�2�2r(c��|j|S)z#Get values present in a config file)rW)rYrMs r&�get_values_in_configz"Configuration.get_values_in_configWs���|�G�$�$r(c�j�|jsJ�|j|j}|std���|dS)Nz4Fatal Internal error [id=2]. Please report as a bug.�����)rIrVr )rY�parserss r&raz#Configuration._get_parser_to_modify[sF���~���~��-���/��� �$�F��� � �r�{�r(rtc�X�||f}||jvr|j�|��dSdS�N)rXr�)rYrsrt�file_parser_tuples r&rrzConfiguration._mark_as_modifiedis@��"�F�O�� �D�$:� :� :� � "� )� )�*;� <� <� <� <� <� ;� :r(c�0�|jj�d|j�d�S)N�(�))rZ�__name__rer^s r&�__repr__zConfiguration.__repr__ns!���.�)�A�A�D�,<�A�A�A�Ar(r�)rN)%r�� __module__� __qualname__�__doc__�boolrrrQr_�strrcrr rrfrkrvrzr�rn�propertyrrer\r�r�r�r]r�r�rr�r�rarrr�� __classcell__)rZs@r&rGrGWs7������� � �G�G��G�(�4�.�G�D�G�G�G�G�G�G�**�*�*�*� �(�3�-�����(�x��c�3�h��0�(�(�(�(� =�S�=�S�=�=�=�=�.�S�.��.��.�.�.�.�$.�s�.�t�.�.�.�.�6  �  �  �  �"M�M�M�M� � �T�#�s�(�^� � � ��X� �?�?�?�?�.�$��s��������s�������, � � � � �� �#+�E�#�s�(�O�#<� � �c�3�h�� � � � �$�(�5��c��?�";�$�$�$�$�3�8�E�$��S� �/�,B�#C�3�3�3�3�<%�D�%�T�#�s�(�^�%�%�%�%� �u�S�/�-A�'B� � � � �=�s�=�O�=��=�=�=�=� B�#�B�B�B�B�B�B�B�Br(rG),r�r�r�r3r<�typingrrrrrrr �pip._internal.exceptionsr r �pip._internal.utilsr �pip._internal.utils.compatr �pip._internal.utils.loggingr�pip._internal.utils.miscrrr�r�rr6r�r@rrrrrrUrRr�r}r'r/rErGr2r(r&�r�s-�� � ����� � � � � � � � � � � � �F�F�F�F�F�F�F�F�F�F�F�F�F�F�F�F�F�F���������(�'�'�'�'�'�.�.�.�.�.�.�1�1�1�1�1�1�5�5�5�5�5�5�5�5��.���w�v�s����&�6�)�)�J��%�� �� � � � � �  � � ����u�z�5�:�u�y�%�-�O���*�e�l�E�J�6�� ��8� � ���#��#������3��4��9�������d�D��I�o�!6�����&XB�XB�XB�XB�XB�XB�XB�XB�XB�XBr(