� ,�Re/��J�dZddlZddlmZddlmZdZGd�de��ZdS) z�distutils.pypirc Provides the PyPIRCCommand class, the base class for the command classes that uses .pypirc in the distutils.command package. �N)�RawConfigParser�)�CommandzE[distutils] index-servers = pypi [pypi] username:%s password:%s c�`�eZdZdZdZdZdZdZdddezfdgZd gZ d �Z d �Z d �Z d �Z d�Zd�ZdS)� PyPIRCCommandz6Base command that knows how to handle the .pypirc filezhttps://upload.pypi.org/legacy/�pypiNz repository=�rzurl of repository [default: %s])� show-responseNz&display full response text from serverr c�|�tj�tj�d��d��S)zReturns rc file path.�~z.pypirc)�os�path�join� expanduser��selfs ��/builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/_distutils/config.py� _get_rc_filezPyPIRCCommand._get_rc_file%s(���w�|�|�B�G�.�.�s�3�3�Y�?�?�?�c��|���}tjtj|tjtjzd��d��5}|�t||fz��ddd��dS#1swxYwYdS)zCreates a default .pypirc file.i��wN)rr �fdopen�open�O_CREAT�O_WRONLY�write�DEFAULT_PYPIRC)r�username�password�rc�fs r� _store_pypirczPyPIRCCommand._store_pypirc)s��� � � � � �� �Y�r�w�r�2�:�� �#;�U�C�C�S� I� I� ;�Q� �G�G�N�h��%9�9� :� :� :� ;� ;� ;� ;� ;� ;� ;� ;� ;� ;� ;� ;���� ;� ;� ;� ;� ;� ;s� B�B� Bc���|���}tj�|���r�|�d|z��|jp|j}t��}|�|��|� ��}d|vr�|� dd��}d�|� d��D��}|gkr d|vrdg}niS|D]�}d|i}|� |d��|d<d |jfd |j fd fD]:\} } |� || ��r|� || ��|| <�5| || <�;|dkr||jdfvr|j|d <|cS|d|ks |d |kr|cS��nod |vrkd }|� |d ��r|� |d ��}n|j}|� |d��|� |d ��|||j d�SiS)zReads the .pypirc file.zUsing PyPI login from %s� distutilsz index-serversc�f�g|].}|���dk�|�����/S)�)�strip)�.0�servers r� z.PyPIRCCommand._read_pypirc..<s=�������|�|�~�~��+�+��L�L�N�N�+�+�+r� rr)r� repository�realm)rNz server-loginr)rrr,r)r-)rr r�exists�announcer,�DEFAULT_REPOSITORYr�read�sections�get�split� DEFAULT_REALM� has_option) rr r,�configr2� index_servers�_serversr)�current�key�defaults r� _read_pypirczPyPIRCCommand._read_pypirc/s��� � � � � �� �7�>�>�"� � �B � �M�M�4�r�9� :� :� :���C�D�,C�J�$�&�&�F� �K�K��O�O�O����(�(�H��h�&�&� &� � �;�� H� H� ���"/�"5�"5�d�";�";����� �r�>�>���)�)�$*�8��� "� �&�'�'�F�'��0�G�*0�*�*�V�Z�*H�*H�G�J�'�&�t�'>�?� �$�"4�5�*�)�3�3� ��W� "�,�,�V�S�9�9�3�+1�:�:�f�c�+B�+B�G�C�L�L�+2�G�C�L�L� ��'�'�J��/��;�-�-�15�0G�� �-�&���� ��)�Z�7�7�"�<�0�J�>�>�&����?�7'�< �8�+�+�'���$�$�V�\�:�:�9�!'���F�L�!A�!A�J�J�!%�!8�J� &� � �6�:� >� >� &� � �6�:� >� >�",�$�!�/� ���� rc���ddl}|�dd��}|�|��d�dd��}|����|��S)z%Read and decode a PyPI HTTP response.rNz content-typez text/plainr�charset�ascii)�cgi� getheader� parse_headerr3r1�decode)r�responserA� content_type�encodings r�_read_pypi_responsez!PyPIRCCommand._read_pypi_responsexsd��� � � ��)�)�.�,�G�G� ��#�#�L�1�1�!�4�8�8��G�L�L���}�}���%�%�h�/�/�/rc�0�d|_d|_d|_dS)zInitialize options.Nr)r,r-� show_responsers r�initialize_optionsz PyPIRCCommand.initialize_options�s������� �����rc�V�|j� |j|_|j�|j|_dSdS)zFinalizes options.N)r,r0r-r5rs r�finalize_optionszPyPIRCCommand.finalize_options�s2�� �?� "�"�5�D�O� �:� ��+�D�J�J�J� � r)�__name__� __module__� __qualname__�__doc__r0r5r,r-� user_options�boolean_optionsrr"r=rHrKrM�rrrrs�������@�@�:���M��J� �E� ��>�AS�S�T�I��L� '�'�O�@�@�@�;�;�;� G�G�G�R0�0�0���� ,�,�,�,�,rr)rQr � configparserr�cmdrrrrTrr�rWs�����  � � � �(�(�(�(�(�(���������u,�u,�u,�u,�u,�G�u,�u,�u,�u,�u,r