
    wff~                     r   d Z ddlZddlmZ ddlmZ ddlmZmZm	Z	m
Z
mZ ddlmZ ddlmZ dd	lmZ  ed
      Zeedf   ZeZej,                  Zdede
eef   de	ee   eeee   f   f   fdZde
eef   de
eee   f   fdZdede
eee   f   de	ee   eeee   f   f   fdZd Zd Zd Zd Zd Zd Z y)aS  Helper code used to generate ``requires.txt`` files in the egg-info directory.

The ``requires.txt`` file has an specific format:
    - Environment markers need to be part of the section headers and
      should not be part of the requirement spec itself.

See https://setuptools.pypa.io/en/latest/deprecated/python_eggs.html#requires-txt
    N)defaultdict)filterfalse)DictListTupleMappingTypeVar   )_reqs)yield_lines)Requirement_Tinstall_requiresextras_requirereturnc                 0    t        |      }t        | |      S )zGiven values for ``install_requires`` and ``extras_require``
    create modified versions in a way that can be written in ``requires.txt``
    )_convert_extras_requirements"_move_install_requirements_markers)r   r   extrass      XC:\xampp-8.1.2\htdocs\client\python\Lib\site-packages\setuptools/command/_requirestxt.py_preparer      s     *.9F-.>GG    c                     t        t              }| j                         D ]D  \  }}||    t        j                  |      D ]"  }||t        |      z      j                  |       $ F |S )z
    Convert requirements in `extras_require` of the form
    `"extra": ["barbazquux; {marker}"]` to
    `"extra:{marker}": ["barbazquux"]`.
    )r   dictitemsr   parse_suffix_for
setdefault)r   outputsectionvrs        r   r   r   %   sk     3>d2CF$**, ;
wQ 	;A7[^+,77:	;; Mr   c                 Z   t        t        j                  |             }t        t        |      }t        t        |      }t        t        t        |            }|D ],  }|dt        |j                        z      j                  |       . t        d |j                         D              }||fS )a+  
    The ``requires.txt`` file has an specific format:
        - Environment markers need to be part of the section headers and
          should not be part of the requirement spec itself.

    Move requirements in ``install_requires`` that are using environment
    markers ``extras_require``.
    :c              3      K   | ]<  \  }}|t        t        j                  d  t        t        |      D                    f > yw)c              3   2   K   | ]  }t        |        y wN)str).0r"   s     r   	<genexpr>z?_move_install_requirements_markers.<locals>.<genexpr>.<genexpr>P   s     B!s1vBs   N)listr   fromkeysmap
_clean_req)r)   kr!   s      r   r*   z5_move_install_requirements_markers.<locals>.<genexpr>N   s>       Aq 
DBs:q/ABBCDs   AA)r+   r   r   filter
_no_markerr   r-   r(   markerr   r   r   )r   r   	inst_reqssimple_reqscomplex_reqssimple_install_requiresr"   expanded_extrass           r   r   r   7   s     U[[!123IY/Kz95L"3sK#89 :sS]*+66q9:   #((* O #O33r   c                 N    | j                   rdt        | j                         z   S dS )z;Return the 'extras_require' suffix for a given requirement.r$    )r2   r(   reqs    r   r   r   W   s     $'JJ3SZZ 6B6r   c                 <    t        t        |             }d|_        |S )z=Given a Requirement, remove environment markers and return itN)r   r(   r2   )r;   r"   s     r   r.   r.   \   s    CHAAHHr   c                     | j                    S r'   )r2   r:   s    r   r1   r1   c   s    zz>r   c                 b    t        |xs d      }d }t        ||      }| j                  |       y )N c                     | dz   S )N
r?   )lines    r   	append_crz&_write_requirements.<locals>.append_crj   s    d{r   )r   r-   
writelines)streamreqslinesrC   s       r   _write_requirementsrH   g   s1    
#E 	5!E
er   c           	         | j                   }t        j                         }t        |j                  xs d|j
                  xs i       \  }}t        ||       t        |      D ]:  }|j                   dj                  di t                      t        |||          < | j                  d||j                                y )Nr?   z
[{extra}]
requirements)distributionioStringIOr   r   r   rH   sortedwriteformatvarswrite_or_delete_filegetvalue)cmdbasenamefilenamedistdatar   r   extras           r   write_requirementsrZ   q   s    D;;=D'/#T%8%8%>B($n ./' 9

)?))3DF34D."789 ^Xt}}Gr   c                     t        j                         }t        || j                  j                         | j                  d||j                                y )Nzsetup-requirements)rL   rM   rH   rK   setup_requiresrR   rS   )rT   rU   rV   rX   s       r   write_setup_requirementsr]   ~   s<    ;;=Dc..==>18T]]_Mr   )!__doc__rL   collectionsr   	itertoolsr   typingr   r   r   r   r	   r9   r   extern.jaraco.textr   extern.packaging.requirementsr   r   _Orderedr   _ordered
_StrOrIterr(   r   r   r   r   r.   r1   rH   rZ   r]   r?   r   r   <module>rg      s&   
 # ! 6 6  , 7 T]D>
H H29#z/2JH
49d3S	>**+HCO,S(;''($4 429#x?T:T2U4
49d3S	>**+4@7

HNr   