
    Ki7                       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rS SKrS SKrS SKrS SKJrJr  SSKJr  SSKJr  SSKJr  SSKJr  \R2                  S	   r\R6                  " \5      r " S
 S\R:                  5      rSSS jjr " S S\5      r  " S S\R:                  5      r! " S S\!5      r" " S S\!5      r#\RH                  SS j5       r%SS jr&SS/r'g)    )annotationsN)
CollectionMapping   )_ctx)run_subprocess)FailedProcessError)check_dependency)pipuvc                  r    \ rS rSrSr\\R                  SS j5       5       r\R                  SS j5       r	Sr
g)	IsolatedEnv   zIsolated build environment ABC.c                    g)z2The Python executable of the isolated environment.N selfs    K/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/build/env.pypython_executableIsolatedEnv.python_executable            c                    g)zBGenerate additional env vars specific to the isolated environment.Nr   r   s    r   make_extra_environIsolatedEnv.make_extra_environ%   r   r   r   Nreturnstr)r   zMapping[str, str] | None)__name__
__module____qualname____firstlineno____doc__propertyabcabstractmethodr   r   __static_attributes__r   r   r   r   r      sC    )A  A 	Q Qr   r   c          	         SSK Jn  SSKJn   [	        [        UR                  R                  " SSU 0UD65      5      nUc  gU" UR                  5      U" U5      :  $ ! [         a     gf = f)	z
Given a distribution name, see if it is present and return True if the version is
sufficient for build, False if it is not, None if the package is missing.
r   )Versionr   	importlibnameNTr   )
packaging.versionr)   _compatr+   nextitermetadatadistributionsStopIterationversion)r,   minimum_version_strdistargsr)   r+   distributions         r   _has_dependencyr8   *   sr    
 *"D!3!3!A!A!Xt!Xx!XYZ "<''(G4G,HHH  s   0A 
A*)A*c                      \ rS rSrSrSS.   SS jjrSS jrSS jr\SS j5       r	\SS	 j5       r
SS
 jrSS jrSrg)DefaultIsolatedEnv>   zS
Isolated environment which supports several different underlying implementations.
r   	installerc                   Xl         g Nr<   )r   r=   s     r   __init__DefaultIsolatedEnv.__init__C   s	    
 %.r   c                    [         R                  " SS9n[        R                  R	                  U5      nXl        U   U R                  S:X  a  [        5       U l        O[        5       U l        [        R                  " SU R                  R                   S35        U R                  R                  U R
                  5        U $ ! [         a$    U R                  " [         R"                  " 5       6   e f = f)Nz
build-env-prefixr   zCreating isolated environment: z...)tempfilemkdtempospathrealpath_pathr=   
_UvBackend_env_backend_PipBackendr   logdisplay_namecreate	Exception__exit__sysexc_infor   rH   s     r   	__enter__DefaultIsolatedEnv.__enter__J   s    	##<8D 77##D)DJ ~~%$.L!$/M!HH6t7H7H7U7U6VVYZ[$$TZZ0 	  	MM3<<>*	s   B=C .C/c                    [         R                  R                  U R                  5      (       a!  [        R
                  " U R                  5        g g r?   )rG   rH   existsrJ   shutilrmtree)r   argss     r   rR   DefaultIsolatedEnv.__exit__f   s.    77>>$**%%MM$**% &r   c                    U R                   $ )z/The location of the isolated build environment.)rJ   r   s    r   rH   DefaultIsolatedEnv.pathj   s     zzr   c                .    U R                   R                  $ )z8The python executable of the isolated build environment.)rL   r   r   s    r   r   $DefaultIsolatedEnv.python_executableo   s       222r   c                    [         R                  R                  S5      nSUb6  [         R                  R	                  U R
                  R                  U/5      0$ U R
                  R                  0$ )NPATH)rG   environgetpathsepjoinrL   scripts_dirrU   s     r   r   %DefaultIsolatedEnv.make_extra_environt   se    zz~~f% JJOOT%6%6%B%BD$IJ
 	
 ""..
 	
r   c           	         U(       d  g[         R                  " SSR                  S [        U5       5       5      -   5        U R                  R                  U5        g)aL  
Install packages from PEP 508 requirements in the isolated build environment.

:param requirements: PEP 508 requirement specification to install

:note: Passing non-PEP 508 strings will result in undefined behavior, you *should not* rely on it. It is
       merely an implementation detail, it may change any time without warning.
Nz-Installing packages in isolated environment:

c              3  ,   #    U  H
  nS U 3v   M     g7f)z- Nr   ).0rs     r   	<genexpr>-DefaultIsolatedEnv.install.<locals>.<genexpr>   s     Mu`t[\PRSTRUh`ts   )r   rN   rg   sortedrL   install_requirementsr   requirementss     r   installDefaultIsolatedEnv.install|   sF     ADIIMu`fgs`tMuDuuv..|<r   )rL   rJ   r=   N)r=   	Installerr   None)r   r:   )r\   objectr   rx   r   )r   zdict[str, str]rt   zCollection[str]r   rx   )r   r    r!   r"   r#   r@   rV   rR   r$   rH   r   r   ru   r'   r   r   r   r:   r:   >   sa      %. . 
	.8&   3 3
=r   r:   c                  R    \ rS rSr% S\S'   S\S'   S
S jrSS jr\SS j5       rSr	g	)_EnvBackend   r   r   rh   c                    g r?   r   rU   s     r   rP   _EnvBackend.create   s    r   c                    g r?   r   rs   s     r   rr    _EnvBackend.install_requirements   s    3r   c                    g r?   r   r   s    r   rO   _EnvBackend.display_name   s    #&r   r   NrH   r   r   rx   rz   r   )
r   r    r!   r"   __annotations__rP   rr   r$   rO   r'   r   r   r   r|   r|      s"    ,N& &r   r|   c                      \ rS rSrSS jr\R                  SS j5       r\R                  SS j5       r\	SS j5       r
SS jrSS jr\SS j5       rS	rg
)rM      c                V    U R                   (       + =(       a    U R                  U l        g r?   )_has_valid_outer_pip_has_virtualenv_create_with_virtualenvr   s    r   r@   _PipBackend.__init__   s    +/+D+D'D']I]I]$r   c                   [        SS5      (       d  g[        R                  " 5          [        R                  " S5        [        R
                  R                  S5      c
   SSS5        g SSS5        g! , (       d  f       g= f)zz
This checks for a valid global pip. Returns None if pip is missing, False
if pip is too old, and True if it can be used.
r   z22.3Fignorezpip._vendorNT)r8   warningscatch_warningssimplefilterr+   util	find_specr   s    r   r    _PipBackend._has_valid_outer_pip   sk     uf-- $$&!!(+~~''6> '&> '
  '&
 s   8A33
Bc                   ^^ SSK Jm  Sm[        R                  R	                  T5      SL=(       a(    [        UU4S j[        ST S35       5       5      (       + $ )z
virtualenv might be incompatible if it was installed separately
from build. This verifies that virtualenv and all of its
dependencies are installed as required by build.
r   )Requirement
virtualenvNc              3  v   >#    U  H.  n[        U5      S :  d  M  T" US    5      R                  T:H  v   M0     g7f)r   N)lenr,   )rm   dr   r,   s     r   ro   ._PipBackend._has_virtualenv.<locals>.<genexpr>   s<      F
4VqZ]^_Z`cdZd*K!""d*4Vs   99zbuild[])packaging.requirementsr   r+   r   r   anyr
   )r   r   r,   s    @@r   r   _PipBackend._has_virtualenv   sY     	7~~''-T9 
# F
4DvdVSTEU4VF
 C
 ?
 	
r   c                     [         R                  " 5       S:X  aI  [         R                  " 5       u  pn[        U S U R	                  S5       5      S:  a  US:g  nU(       a  S$ S$ g)NDarwin.   x86_64z21.0.1z20.3.0z19.1.0)platformsystemmac_verintfind)release_machineis_apple_silicon_pythons       r   _get_minimum_pip_version_str(_PipBackend._get_minimum_pip_version_str   sa    ??("*"2"2"4G7.W\\#./0B6 +2X*='#:xHH r   c                   U R                   (       a  SS KnSS KnSSKJn  UR
                  R                  UR                  R                  S5      5      nUSSSS/nXRR
                  R                  S	5      :  a  UR                  S
5        UR                  USS9n[        UR                  R                  5      U l        [        UR                  R                  5      U l        g SS KnU R"                  (       + n	 UR%                  ['        5       U	S9R)                  U5        [5        U5      u  U l        U l        nU	(       ak  U R7                  5       n[9        SUU/S9(       d  [;        U R                  SSSSU 3/5        [9        SU/S9(       a  [;        U R                  SSSSS/5        g g g ! [*        R,                   a(  n
[.        R0                  " U
5        [3        U
S5      S eS n
A
ff = f)Nr   r   r*   r   z--activators z--no-setuptoolsz--no-periodic-updatez20.31.0z
--no-wheelF)setup_loggingsymlinkswith_pipz7Failed to create venv. Maybe try installing virtualenv.r   )rH   -Imru   zpip>=
setuptools	uninstallz-y)r   r-   r   r.   r+   r4   r)   r1   appendcli_runr   creatorexer   
script_dirrh   venvr   
EnvBuilder_fs_supports_symlinkrP   
subprocessCalledProcessErrorr   log_subprocess_errorr	   _find_executable_and_scriptsr   r8   r   )r   rH   	packagingr   r+   virtualenv_veroptsresultr   r   excpurelibminimum_pip_version_strs                r   rP   _PipBackend.create   s   ''$*&..66y7I7I7Q7QR^7_`N !&D  1 1 9 9) DDL)''E'BF &)););%<D""6>>#<#<=D 444Hs)=)?(SZZ[_`
 A]]a@b=D"D$4g*.*K*K*M'&+!
 #D$:$:E5)W\]t\uUv#wx # ! #D$:$:E5+W[]i#jk	  00 s))#.(.ghnrrss   9'F, ,G( #G##G(c           	        [         R                  " SSSSSS9 nUR                  [        R                  R                  U5      5        S S S 5         U R                  (       a   [        R                  SSS	U R                  /nOU R                  S
S/n[        R                  S:  a  USS[        R                  S-
  -   3/-  nUSSSSS[        R                  R                  WR                  5      /-  n[        U5        [        R                   " UR                  5        g ! , (       d  f       N= f! [        R                   " WR                  5        f = f)Nwzbuild-reqs-z.txtFzutf-8)rD   suffixdeleteencodingz-mr   z--pythonr   r   -vru   z--use-pep517z--no-warn-script-locationz--no-compilez-r)rE   NamedTemporaryFilewriterG   lineseprg   r   rS   
executabler   r   	verbosityrH   abspathr,   r   unlink)r   rt   req_filecmds       r   rr    _PipBackend.install_requirements  s    ((]6Z_jqrv~NN2::??<89 s	%((~~tUJ@V@VW--ue<~~!!C4>>A#567899+. C 3 IIhmm$/ sr. IIhmm$s   /D B.D1  
D.1"Ec                ,    U R                   (       a  S$ S$ )Nzvirtualenv+pipzvenv+pip)r   r   s    r   rO   _PipBackend.display_name#  s    #'#?#?OZOr   )r   r   rh   N)r   rx   )r   bool | Noner   boolr   r   rz   )r   r    r!   r"   r@   	functoolscached_propertyr   r   staticmethodr   rP   rr   r$   rO   r'   r   r   r   rM   rM      sr    ^  * 
 
  6lp%8 P Pr   rM   c                  <    \ rS rSrSS jrSS jr\S	S j5       rSrg)
rK   i(  c                   SS K nXl         SS KnUR                  5       U l        UR                  [!        5       SS9R#                  U R                  5        [%        U R                  5      u  U l        U l        ng ! [
        [        4 ao    [        R                  " [        R                  R                  S5      =(       d    S5      nUc  Sn[        U5      S e[        R                  " SU 35        X@l         Nf = f)Nr   UVr   zuv executable not foundzUsing external uv from Fr   )r   	_env_pathr   find_uv_bin_uv_binModuleNotFoundErrorFileNotFoundErrorrZ   whichrG   rd   re   RuntimeErrorr   rN   r   r   rP   r   r   rh   )r   rH   r   r   uv_binmsgr   s          r   rP   _UvBackend.create)  s    	">>+DL 	!5!7%HOOPTP^P^_6RSWSaSa6b3 0! $%67 	"\\"**.."6">$?F~/"3'T1HH.vh78!L	"s   A: :A<C98C9c                    U R                   S/n[        R                  S:  a'  USS[        S[        R                  S-
  5      -   3/-  n[	        / UQSPUQ0 [
        R                  ESU R                  0ES9  g )	Nr   r   r   r      ru   VIRTUAL_ENV)env)r   r   r   minr   rG   rd   r   )r   rt   r   s      r   rr   _UvBackend.install_requirements>  sx    ||U#>>Aac!T^^a%7889:;;C77i7,7=j

=jM[_[i[i=jkr   c                    g)Nzvenv+uvr   r   s    r   rO   _UvBackend.display_nameD  s    r   )r   r   r   rh   Nr   rz   r   )	r   r    r!   r"   rP   rr   r$   rO   r'   r   r   r   rK   rK   (  s"    c*l  r   rK   c                 L   [         R                  S:w  a  g[        R                  " SS9 n U  S3n [         R                  " U R                  U5        [         R
                  " U5         SSS5        g! [        [        [        4 a     SSS5        gf = f! , (       d  f       g= f)z%Return True if symlinks are supportedntTzbuild-symlink-rC   z-bNF)	rG   r,   rE   r   symlinkr   OSErrorNotImplementedErrorAttributeError)tmp_filedests     r   r   r   I  s     
ww$ 
	$	$,<	=2	JJx}}d+IIdO  
>	=
 ,n= 	 
>	=
	 
>	=s.   B7A2(B2BBBB
B#c                :   [         R                  " 5       R                  5       nXS'   [         R                  " 5       nSU;   a  [         R                  " SUS9nOLSU;   a  [         R                  " SUS9nO0SU;   a  [         R                  " SUS9nO[         R                  " US9n[
        R                  R                  US   [
        R                  S	:X  a  S
OS5      n[
        R                  R                  U5      (       d  SU S3n[        U5      eXCS   US   4$ )z
Detect the Python executable and script folder of a virtual environment.

:param path: The location of the virtual environment
:return: The Python executable, script folder, and purelib folder
baser   )schemevarsposix_localposix_prefixosx_framework_library)r  scriptsr   z
python.exepythonz0Virtual environment creation failed, executable z missingr   )	sysconfigget_config_varscopyget_scheme_names	get_pathsrG   rH   rg   r,   rY   r   )rH   config_varsscheme_namespathsr   r   s         r   r   r   [  s     ++-224K--/L ##6D	,	& ##>L	 L	0 ##>L##5eI.4U]^J77>>*%%@HU3Y'y)999r   r?   )r,   r   r5   z
str | Noner6   ry   r   r   r   )rH   r   r   ztuple[str, str, str])(
__future__r   r%   r   importlib.utilr+   rG   r   rZ   r   rS   r  rE   typingr   collections.abcr   r   r   r   r   _exceptionsr	   _utilr
   Literalrw   get_args
INSTALLERSProtocolr   r8   r:   r|   rM   rK   cacher   r   __all__r   r   r   <module>r      s    " 
   	    
     /    + # NN;'	__Y'

Q&// 
QI(K= K=\	'&// 	'MP+ MP` B  "(:X r   