
    nj~                        S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SS	KJr  S
SKJr  S
SKJr  \" S5      r\\S4   r      SS jr    SS jr      SS jrS rS rS rS rS rS rg)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
    )annotationsN)defaultdict)Mapping)filterfalse)TypeVar)yield_lines)Requirement   )_reqs)
_StrOrIter_Tc                .    [        U5      n[        X5      $ )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)install_requiresextras_requireextrass      [/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/setuptools/command/_requirestxt.py_preparer      s     *.9F-.>GG    c                    [         [        [        [           4   " [        5      nU R                  5        HE  u  p#X     [        R                  " U5       H"  nX[        U5      -      R                  U5        M$     MG     U$ )z
Convert requirements in `extras_require` of the form
`"extra": ["barbazquux; {marker}"]` to
`"extra:{marker}": ["barbazquux"]`.
)
r   str_Orderedr	   dictitemsr   parse_suffix_for
setdefault)r   outputsectionvrs        r   r   r   '   sj     h{334T:F$**,
QA[^+,77:   - Mr   c                   [        [        R                  " U 5      5      n[        [        U5      n[        [        U5      n[        [        [        U5      5      nU H-  nUS[        UR                  5      -      R                  U5        M/     UR                  5        VVs0 s H9  u  pxU[        [        R                  S [        [        U5       5       5      5      _M;     n	nnXY4$ s  snnf )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  8   #    U  H  n[        U5      v   M     g 7fN)r   ).0r"   s     r   	<genexpr>5_move_install_requirements_markers.<locals>.<genexpr>R   s     A.@c!ff.@s   )listr   r   filter
_no_markerr   mapr   markerr   r   r   fromkeys
_clean_req)
r   r   	inst_reqssimple_reqscomplex_reqssimple_install_requiresr"   kr!   expanded_extrass
             r   r   r   9   s     U[[!123IY/Kz95L"3sK#89sS]*+66q9  #((* +DA 	
4Ac*a.@AABB*   #33s   A C%c                X    U R                   (       a  S[        U R                   5      -   $ S$ )z;Return the 'extras_require' suffix for a given requirement.r$    )r.   r   reqs    r   r   r   Y   s     $'JJ3SZZ 6B6r   c                <    [        [        U 5      5      nSUl        U$ )z=Given a Requirement, remove environment markers and return itN)r	   r   r.   )r:   r"   s     r   r0   r0   ^   s    CHAAHHr   c                $    U R                   (       + $ r&   )r.   r9   s    r   r,   r,   e   s    zz>r   c                j    [        U=(       d    S5      nS n[        X25      nU R                  U5        g )N c                    U S-   $ )N
r>   )lines    r   	append_cr&_write_requirements.<locals>.append_crl   s    d{r   )r   r-   
writelines)streamreqslinesrB   s       r   _write_requirementsrH   i   s/    
#E 	!E
er   c           	        U R                   n[        R                  " 5       n[        UR                  =(       d    SUR
                  =(       d    0 5      u  pV[        XE5        [        U5       H:  nUR                  SR                  " S0 [        5       D65        [        XFU   5        M<     U R                  SX$R                  5       5        g )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   s   s    D;;=D'/#T%8%8%>B($ /'

?))3DF34D"78 ( ^X}}Gr   c                    [         R                  " 5       n[        X0R                  R                  5        U R                  SX#R                  5       5        g )Nzsetup-requirements)rL   rM   rH   rK   setup_requiresrR   rS   )rT   rU   rV   rX   s       r   write_setup_requirementsr]      s8    ;;=D..==>18]]_Mr   )r   r   r   Mapping[str, _StrOrIter]return&tuple[list[str], dict[str, list[str]]])r   r^   r_   z'defaultdict[str, _Ordered[Requirement]])r   r   r   z#Mapping[str, _Ordered[Requirement]]r_   r`   )__doc__
__future__r   rL   collectionsr   collections.abcr   	itertoolsr   typingr   jaraco.textr   packaging.requirementsr	   r8   r   r   r   r   r   r   r   r   r   r0   r,   rH   rZ   r]   r>   r   r   <module>ri      s    # 	 # # !  # .   T]D>H H2JH+H,,$4 42U4+4@7

HNr   