
    n&ph+                    X   S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
Jr  S SKJrJr  SSKJrJr  \(       a  S SKJr  SSKJr  S S	KJr  S S
KJr   " S S\SS9r " S S\5      r " S S\5      r " S S5      r " S S\5      r " S S\5      r S r!S r"S r#S r$S r%g)    )annotationsN)Iterable)TYPE_CHECKING	TypedDict   )metadata	resources)Self)SetuptoolsWarning)first_line_re)get_platformc                  *    \ rS rSr% S\S'   S\S'   Srg)
_SplitArgs   boolcommentsposix N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r       F/var/www/html/venv/lib/python3.13/site-packages/setuptools/_scripts.pyr   r      s    NKr   r   F)totalc                      \ rS rSr% Sr/ rS\S'   \" 5       r\	S 5       r
\	S 5       r\	SS j5       r\	S 5       r\	SS	 j5       rSS
 jr\S 5       rS r\S 5       r\S 5       rSrg)CommandSpec   za
A command spec for a #! header, specified as a list of arguments akin to
those passed to Popen.
z	list[str]optionsc                    U $ )zF
Choose the best CommandSpec class based on environmental conditions.
r   clss    r   bestCommandSpec.best'   s	    
 
r   c                    [         R                  R                  [        R                  5      n[         R
                  R                  SU5      $ )N__PYVENV_LAUNCHER__)ospathnormpathsys
executableenvironget)r$   _defaults     r   _sys_executableCommandSpec._sys_executable.   s0    77##CNN3zz~~3X>>r   c                    [        X5      (       a  U$ [        U[        5      (       a  U R                  U5      $ [        U[        5      (       a  U " U5      $ Uc  U R	                  5       $ [        S[        U5       35      e)zO
Construct a CommandSpec from a parameter to build_scripts, which may
be None.
z!Argument has an unsupported type )
isinstancestrfrom_stringr   from_environment	TypeErrortype)r$   params     r   
from_paramCommandSpec.from_param3   sr     e!!LeS!!??5))eX&&u:=''));DK=IJJr   c                0    U " U R                  5       /5      $ N)r1   r#   s    r   r7   CommandSpec.from_environmentC   s    C'')*++r   c                T    [         R                  " U40 U R                  D6nU " U5      $ )ze
Construct a command spec from a simple string representing a command
line parseable by shlex.split.
)shlexsplit
split_args)r$   stringitemss      r   r6   CommandSpec.from_stringG   s%     F5cnn55zr   c                    [         R                  " U R                  U5      5      U l        [        R
                  " U 5      n[        U5      (       d  S/U R                  S S& g g )Nz-xr   )rA   rB   _extract_optionsr!   
subprocesslist2cmdlineisascii)selfscript_textcmdlines      r   install_optionsCommandSpec.install_optionsP   sO    {{4#8#8#EF))$/w $vDLL!  r   c                    U S-   R                  5       S   n[        5       R                  U5      nU(       a  UR                  S5      =(       d    SOSnUR	                  5       $ )z8
Extract any options from the first line of the script.

r   r    )
splitlines_first_line_rematchgroupstrip)orig_scriptfirstrV   r!   s       r   rH   CommandSpec._extract_optionsV   sR    
 t#//1!4 &&u-*/%++a.&BR}}r   c                P    U R                  U [        U R                  5      -   5      $ r>   )_renderlistr!   )rL   s    r   	as_headerCommandSpec.as_header`   s    ||D4#5566r   c                    SnU H8  nU R                  U5      (       d  M  U R                  U5      (       d  M3  U SS s  $    U $ )Nz"'r   )
startswithendswith)item_QUOTESqs      r   _strip_quotesCommandSpec._strip_quotesc   sA    Aq!!dmmA&6&6Abz!  r   c                L    [         R                  " S U  5       5      nSU-   S-   $ )Nc              3  h   #    U  H(  n[         R                  UR                  5       5      v   M*     g 7fr>   )r   rh   rX   ).0re   s     r   	<genexpr>&CommandSpec._render.<locals>.<genexpr>m   s'      *
@EK%%djjl33s   02z#!rR   )rI   rJ   )rE   rN   s     r   r]   CommandSpec._renderk   s0    )) *
@E*
 
 g~$$r   )r!   N)r:   z!Self | str | Iterable[str] | Nonereturnr
   )rD   r5   rp   r
   )rM   r5   )r   r   r   r   __doc__r!   r   r   rC   classmethodr%   r1   r;   r7   r6   rO   staticmethodrH   r_   rh   r]   r   r   r   r   r   r      s    
 GYJ  ? ? K K , ,  &  7   % %r   r   c                       \ rS rSr\" SS9rSrg)WindowsCommandSpecs   F)r   r   N)r   r   r   r   r   rC   r   r   r   r   ru   ru   s   s    %(Jr   ru   c                      \ rS rSrSr\R                  " S5      R                  5       r\	r
\SS j5       r\S 5       r\S 5       r\S 5       r\  S     SS	 jj5       rS
rg)ScriptWriterw   zT
Encapsulates behavior around writing entry point scripts for console and
gui apps.
aJ  
        # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r
        import re
        import sys

        # for compatibility with easy_install; see #2198
        __requires__ = %(spec)r

        try:
            from importlib.metadata import distribution
        except ImportError:
            try:
                from importlib_metadata import distribution
            except ImportError:
                from pkg_resources import load_entry_point


        def importlib_load_entry_point(spec, group, name):
            dist_name, _, _ = spec.partition('==')
            matches = (
                entry_point
                for entry_point in distribution(dist_name).entry_points
                if entry_point.group == group and entry_point.name == name
            )
            return next(matches).load()


        globals().setdefault('load_entry_point', importlib_load_entry_point)


        if __name__ == '__main__':
            sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
            sys.exit(load_entry_point(%(spec)r, %(group)r, %(name)r)())
        Nc              #  0  #    [        US5      (       d?  [        R                  " S5        [        R                  R                  UR                  5      nUc  U R                  5       nUR                   SUR                   3nS H  nU S3nUR                  R                  US9 Hg  nUR                  nU R                  UR                  5        U R                  [        5       -  nU R                  XFR                  X(5      n	U	 Sh  vN   Mi     M     g N7f)zi
Yield write_script() argument tuples for a distribution's
console_scripts and gui_scripts entry points.
entry_pointsz%Unsupported distribution encountered.Nz==consolegui_scripts)rW   )hasattrr   emitr   Distributionategg_info
get_headernameversionr{   select_ensure_safe_nametemplatelocals_get_script_args)
r$   distheaderspectype_rW   epr   rM   argss
             r   get_argsScriptWriter.get_args   s      t^,,""#JK((++DMM:D>^^%F))Bt||n-%EgX&E''..U.;ww%%bgg.!llVX5++E77FP < &  s   DDDDc                V    [         R                  " SU 5      nU(       a  [        S5      eg)z/
Prevent paths in *_scripts entry point names.
z[\\/]z+Path separators not allowed in script namesN)research
ValueError)r   has_path_seps     r   r   ScriptWriter._ensure_safe_name   s(    
 yy40JKK r   c                    [         R                  S:X  d(  [        R                  S:X  a(  [        R                  S:X  a  [
        R                  5       $ U $ )z4
Select the best ScriptWriter for this environment.
win32javant)r,   platformr)   r   _nameWindowsScriptWriterr%   r#   s    r   r%   ScriptWriter.best   s:    
 <<7"rww&'8RXX=M&++--Jr   c              #     #    X#U-   4v   g 7fr>   r   )r$   r   r   r   rM   s        r   r   ScriptWriter._get_script_args   s      k)**s   
c                    U R                   R                  5       R                  U5      nUR                  U5        UR	                  5       $ )z;Create a #! line, getting options (if any) from script_text)command_spec_classr%   r;   rO   r_   )r$   rM   r-   cmds       r   r   ScriptWriter.get_header   s=     $$))+66zBK(}}r   r   r>   )rS   N)rM   r5   r-   z(str | CommandSpec | Iterable[str] | Nonerp   r5   )r   r   r   r   rq   textwrapdedentlstripr   r   r   rr   r   rs   r   r%   r   r   r   r   r   r   rx   rx   w   s    
 !	#F fhG J %   0 L L   + +  ?C = 
	 r   rx   c                  X    \ rS rSr\r\S 5       r\S 5       r\S 5       r	\
S 5       rSrg)r      c                f    [        [        U S9n[        R                  R	                  SS5      nX   $ )z3
Select the best ScriptWriter suitable for Windows
)r-   naturalSETUPTOOLS_LAUNCHERr-   )dictWindowsExecutableLauncherWriterr)   r.   r/   )r$   writer_lookuplaunchers      r   r%   WindowsScriptWriter.best   s4    
 6

 ::>>"7F&&r   c              #    #    [        SSS9U   nU[        R                  S   R                  5       R	                  S5      ;  a0  SR
                  " S
0 [        5       D6n[        R                  " U5        / SQnUR                  U5        U R                  X5      nU Vs/ s H  oU-   PM	     n	nX%-   X4-   SU	4v   g	s  snf 7f)z For Windows, add a .py extension.pya.pywr|   PATHEXT;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.)r   .py
-script.py.pyc.pyor   .exetNr   )r   r)   r.   lowerrB   formatr   r   r   remove_adjust_header)
r$   r   r   r   rM   extmsgoldxblockerss
             r   r   $WindowsScriptWriter._get_script_args   s      6v.u5bjj+11399#>>-f ! x!C ""3'K

3##E2&)*c1Hc*j&.X== +s   BC B;,C c                    SnSnUS:X  a  XCpC[         R                  " [         R                  " U5      [         R                  5      nUR	                  X$S9nU R                  U5      (       a  U$ U$ )zn
Make sure 'pythonw' is used for gui and 'python' is used for
console (regardless of what sys.executable is).
zpythonw.exez
python.exer~   )rD   repl)r   compileescape
IGNORECASEsub_use_header)r$   r   orig_headerpatternr   
pattern_ob
new_headers          r   r   "WindowsScriptWriter._adjust_header  s`      E> TZZ		' 2BMMB
^^;^B
 __Z88zIkIr   c                    U SS R                  S5      n[        R                  S:g  =(       d    [        R                  " U5      $ )z
Should _adjust_header use the replaced header?

On non-windows systems, always use. On
Windows systems, only use the replaced header if it resolves
to an executable on the system.
   rb   "r   )rX   r,   r   shutilwhich)r   clean_headers     r   r   WindowsScriptWriter._use_header  s8     "!B'--c2||w&D&,,|*DDr   r   N)r   r   r   r   ru   r   rr   r%   r   r   rs   r   r   r   r   r   r   r      sZ    +
' 
' > > J J 	E 	Er   r   c                  $    \ rS rSr\S 5       rSrg)r   i  c              #    #    US:X  a  SnSnS/nOSnSn/ SQnU R                  X5      nU V	s/ s H  oU	-   PM	     n
n	X&-   X-   SU
4v   US-   [        U5      S	4v   [        5       (       d  US
-   nU[        U5      S4v   ggs  sn	f 7f)z7
For Windows, add a .py extension and an .exe launcher
r~   z-script.pywr   clir   )r   r   r   r   r   bz.exe.manifestN)r   get_win_launcheris_64bitload_launcher_manifest)r$   r   r   r   rM   launcher_typer   r   hdrr   r   m_names               r   r   0WindowsExecutableLauncherWriter._get_script_args  s     
 E>!MC(C!MC)C  /&)*c1Hc*z3,c8<<6M]+
 	

 zz O+F1$7==  +s   ,BBABr   N)r   r   r   r   rr   r   r   r   r   r   r   r     s    > >r   r   c                   U  S3n[        5       (       a4  [        5       S:X  a  UR                  SS5      nO%UR                  SS5      nOUR                  SS5      n[        R                  " S5      R                  U5      R                  5       $ )z
Load the Windows launcher (executable) suitable for launching a script.

`type` should be either 'cli' or 'gui'

Returns the executable as a byte string.
r   z	win-arm64.z-arm64.z-64.z-32.
setuptools)r   r   replacer	   filesjoinpath
read_bytes)r9   launcher_fns     r   r   r   <  sy     F$-Kzz>[(%--c9=K%--c6:K!))#v6??<(11+>IIKKr   c                    [         R                  " [        5      R                  S5      nUR	                  SS9[        5       -  $ )Nzlauncher manifest.xmlzutf-8)encoding)r	   r   r   r   	read_textvars)r   ress     r   r   r   O  s4    
//(
#
,
,-D
EC=='=*TV33r   c                     [        [        R                  [        5      (       a  [        $ [        R
                  " [        R                  R                  5       5      $ )zS
Return a regular expression based on first_line_re suitable for matching
strings.
)r4   r   r   r5   r   r   decoder   r   r   rU   rU   T  s=    
 -''-- ::m++22455r   c                 4    [         R                  " S5      S:H  $ )NP   )structcalcsizer   r   r   r   r   `  s    ??31$$r   c                H     U R                  S5        g! [         a     gf = f)NasciiFT)encodeUnicodeError)ss    r   rK   rK   d  s,    	   s    
!!)&
__future__r   r)   r   rA   r   r   rI   r,   r   collections.abcr   typingr   r   
_importlibr   r	   typing_extensionsr
   warningsr   distutils.command.build_scriptsr   distutils.utilr   r   r^   r   ru   rx   r   r   r   r   rU   r   rK   r   r   r   <module>r
     s    " 	 	     
  $ + +& ' 9 '% 
R%$ R%j) )g gT8E, 8Ev>&9 >@L&4
	6%r   