관리-도구
편집 파일: metadata.cpython-311.pyc
� �܋f� � � � d Z ddlmZ ddlZddlZddlZddlZddlZddl m Z ddlmZ ddl mZ ddlmZ d � Zej d � � � Ze� e� � d� � � Zd� Zd � Zd� Zd d�Zd!d�Zd"d�Zd#d�ZdS )$z2 Tools for converting old- to new-style metadata. � )�annotationsN)�Message)�Parser)�Iterator� )�Requirementc �2 � | o| � d� � S )N�#)� startswith)�strs �r/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/setuptools/_vendor/wheel/metadata.py� _nonblankr s � ��*�s�~�~�c�*�*�*�*� c �f � t j � t t | � � � � S )a� Yield valid lines of a string or iterable. >>> list(yield_lines('')) [] >>> list(yield_lines(['foo', 'bar'])) ['foo', 'bar'] >>> list(yield_lines('foo\nbar')) ['foo', 'bar'] >>> list(yield_lines('\nfoo\n#bar\nbaz #comment')) ['foo', 'baz #comment'] >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n'])) ['foo', 'bar', 'baz', 'bing'] )� itertools�chain� from_iterable�map�yield_lines)�iterables r r r s$ � � �?�(�(��[�(�)C�)C�D�D�Dr c � � t t t t j | � � � � � � � S �N)�filterr r r �strip� splitlines)�texts r �_r ) s( � ��)�S���D�O�O�,=�,=�>�>�?�?�?r c # �2 K � d}g }t | � � D ]z}|� d� � rN|� d� � r)|s|r||fV � |dd� � � � }g }�Ut d|� � �|� |� � �{||fV � dS )ar Split a string or iterable thereof into (section, content) pairs Each ``section`` is a stripped version of the section header ("[section]") and each ``content`` is a list of stripped lines excluding blank lines and comment-only lines. If there are any such lines before the first section header, they're returned in a first ``section`` of ``None``. N�[�]� ���zInvalid section heading)r r �endswithr � ValueError�append)�s�section�content�lines r �split_sectionsr* . s� � � � � �G��G��A��� !� !���?�?�3��� !��}�}�S�!�!� B�� +�g� +�!�7�*�*�*�*��q��t�*�*�*�,�,����� �!:�D�A�A�A��N�N�4� � � � � �7� �����r c �R � t j dd| � � � � � 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 )�re�sub�lower)�extras r � safe_extrar0 G s% � � �6�#�S�%�0�0�6�6�8�8�8r c �. � t j dd| � � S )z�Convert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. z[^A-Za-z0-9.]+�-)r, r- )�names r � safe_namer4 O s � � �6�"�C��.�.�.r �requirementr �returnr c �� � t | dd� � r d| j z S g }| j D ]$}|� |j |j z � � �%|r%dd� t |� � � � z S dS )zFReturn the version specifier for a requirement in PEP 345/566 fashion.�urlNz @ � �,� )�getattrr8 � specifierr% �operator�version�join�sorted)r5 � requires_dist�specs r �requires_to_requires_distrD V s� � ��{�E�4�(�(� '��{��&�&��M��%� ;� ;�����T�]�T�\�9�:�:�:�:�� ��S�X�X�f�]�3�3�4�4�4�4��rr �requirements� list[str]� Iterator[str]c # � K � | D ]u}t |� � }t |� � }d� t d� |j D � � � � � � }|rd|� d�}t |j � � |z |z V � �vdS )z=Yield Requires-Dist: strings for parsed requirements strings.r: c 3 �4 K � | ]}t |� � V � �d S r )r0 )�.0�es r � <genexpr>z'convert_requirements.<locals>.<genexpr>j s( � � � � R� R�1��A��� R� R� R� R� R� Rr r r N)r rD r@ rA �extrasr4 r3 )rE �req�parsed_requirementrC rM s r �convert_requirementsrP e s� � � � �� A� A��(��-�-��(�);�<�<�����&� R� R�8J�8Q� R� R� R�R�R�S�S��� #�"��]�]�]�F��*�/�0�0�6�9�D�@�@�@�@�@�A� Ar �extras_require�dict[str, list[str]]�Iterator[tuple[str, str]]c # � K � | � � � D ]s\ }}d}|pd}d|v r|� dd� � \ }}t |� � }|rd|fV � |rd|z dz }|d|z z }|rd|z }t |� � D ]}d ||z fV � ��td S )a, Convert requirements from a setup()-style dictionary to ('Requires-Dist', 'requirement') and ('Provides-Extra', 'extra') tuples. extras_require is a dictionary of {extra: [requirements]} as passed to setup(), using the empty extra {'': [requirements]} to hold install_requires. r; �:r! �Provides-Extra�(z) and z extra == '%s'z ; � Requires-DistN)�items�splitr0 rP )rQ r/ �depends� condition�new_reqs r �generate_requirementsr^ q s� � � � � )�.�.�0�0� 7� 7���w�� ������%�<�<�$�{�{�3��2�2��E�9��5�!�!��� 1�"�E�)�)�)�)�� 7��)�O�h�6� ���5�0�0�I�� *�� �)�I�+�G�4�4� 7� 7�G�!�7�Y�#6�6�6�6�6�6� 7�!7� 7r � egg_info_path�pkginfo_pathr c � � t |d�� � 5 }t � � � |� � }ddd� � n# 1 swxY w Y |� dd� � |d= |d= t j � | d� � }t j � |� � r�t |d�� � 5 }|� � � }ddd� � n# 1 swxY w Y t t |� � d � � � � }|D ]9\ }} t || i� � D ]"\ } }| |f|� � � vr||| <