
    !2iy7                        d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	m
Z
 ddlmZ ddlmZ ddlmZmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZmZ ddlmZm Z  ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z*m+Z+ erddl,m-Z- ddl.m/Z/  G d ded          Z0 ej1        e2          Z3d+dZ4 G d d          Z5d,d Z6d-d"Z7 G d# d$e          Z8 G d% d&          Z9 G d' d(          Z: G d) d*e:          Z;dS ).z:Build Environment used for isolation during sdist building    )annotationsN)OrderedDict)Iterable)TracebackType)TYPE_CHECKINGProtocol	TypedDict)Version)__file__)open_spinner)get_platlibget_purelib
get_scheme)get_default_environmentget_environment)
deprecated)VERBOSE)get_requirement)call_subprocess)TempDirectorytempdir_kinds)PackageFinder)InstallRequirementc                      e Zd ZU ded<   dS )ExtraEnvironzdict[str, str]extra_environN)__name__
__module____qualname____annotations__     V/var/www/html/pixcura-vrs/venv/lib/python3.11/site-packages/pip/_internal/build_env.pyr   r       s         %%%%%%r"   r   F)totalastrbreturntuple[str] | tuple[str, str]c                    | |k    r| |fn| fS Nr!   )r%   r'   s     r#   _dedupr,   '   s    !VVAq66!%r"   c                      e Zd ZddZdS )_Prefixpathr&   r(   Nonec                    || _         d| _        t          d|          }|j        | _        t          |j        |j                  | _        d S )NF )prefix)	r/   setupr   scriptsbin_dirr,   purelibplatliblib_dirs)selfr/   schemes      r#   __init__z_Prefix.__init__,   sD    	
Bt,,,~v~v~>>r"   N)r/   r&   r(   r0   )r   r   r   r<   r!   r"   r#   r.   r.   +   s(        ? ? ? ? ? ?r"   r.   c                     t          j        t                                                    j        } |                                 st          |           S t          j        | dz            S )zGet a file to pass to a Python executable, to run the currently-running pip.

    This is used to run a pip subprocess, for installing requirements into the build
    environment.
    z__pip-runner__.py)	pathlibPathpip_locationresolveparentis_dirr&   osfsdecode)sources    r#   get_runnable_piprG   4   sV     \,''//118F==??  6{{;v 33444r"   set[str]c                     t          t          d          rt          j                    } nt                      t	                      g} d | D             S )zGet system site packages

    Usually from site.getsitepackages,
    but fallback on `get_purelib()/get_platlib()` if unavailable
    (e.g. in a virtualenv created by virtualenv<20)

    Returns normalized set of strings.
    getsitepackagesc                L    h | ]!}t           j                            |          "S r!   )rD   r/   normcase).0r/   s     r#   	<setcomp>z+_get_system_sitepackages.<locals>.<setcomp>U   s(    <<<tBGT""<<<r"   )hasattrsiterJ   r   r   )system_sitess    r#   _get_system_sitepackagesrR   D   sO     t&'' 6+-- ${}}5<<|<<<<r"   c                      e Zd ZdZddZdS )BuildEnvironmentInstallerz]
    Interface for installing build dependencies into an isolated build
    environment.
    requirementsIterable[str]r3   r.   kindr&   for_reqInstallRequirement | Noner(   r0   c                   d S r+   r!   )r:   rU   r3   rW   rX   s        r#   installz!BuildEnvironmentInstaller.install^   s	     sr"   N
rU   rV   r3   r.   rW   r&   rX   rY   r(   r0   )r   r   r   __doc__r[   r!   r"   r#   rT   rT   X   s2         
     r"   rT   c                  0    e Zd ZdZ	 	 dddZddZddZdS )#SubprocessBuildEnvironmentInstallerzD
    Install build dependencies by calling pip in a subprocess.
    NFfinderr   build_constraintslist[str] | None build_constraint_feature_enabledboolr(   r0   c                4    || _         |pg | _        || _        d S r+   )r`   _build_constraints!_build_constraint_feature_enabled)r:   r`   ra   rc   s       r#   r<   z,SubprocessBuildEnvironmentInstaller.__init__m   s&     "3"9r1Q...r"   c                    | j         s| j        rdS t          j                            d          }|r|                                sdS t          dddd           dS )z
        Check for deprecation warning: PIP_CONSTRAINT affecting build environments.

        This warns when build-constraint feature is NOT enabled and PIP_CONSTRAINT
        is not empty.
        NPIP_CONSTRAINTzGSetting PIP_CONSTRAINT will not affect build constraints in the future,zto specify build constraints using --build-constraint or PIP_BUILD_CONSTRAINT. To disable this warning without any build constraints set --use-feature=build-constraint or PIP_USE_FEATURE="build-constraint"z26.2)reasonreplacementgone_inissue)rg   rf   rD   environgetstripr   )r:   pip_constraints     r#   _deprecation_constraint_checkzASubprocessBuildEnvironmentInstaller._deprecation_constraint_checkw   s     1 	T5L 	F(899 	^%9%9%;%; 	F35
 	
 	
 	
 	
 	
 	
r"   rU   rV   r3   r.   rW   r&   rX   rY   c                  |                                   | j        }t          j        t	                      dddd|j        ddddd	g}t                                          t          j	        k    r|
                    d
           n7t                                          t          k    r|
                    d           dD ]h}t          |j        |          }|                    d|                    dd          z   d                    t#          |pdh                    f           i|j        }	|	rB|                    d|	d         g           |	dd          D ]}
|                    d|
g           n|
                    d           |j        D ]}|                    d|g           |j        r|                    d|j        g           |j        D ]}|                    d|g           |j        r|                    d|j        g           |j        r|                    d|j        g           |j        r|
                    d           |j        r|
                    d           | j        r|                    ddg           | j        r8| j        D ]0}|                    d |g           |                    d!|g           1i }| j        r| j        sd"d#d$ii}|
                    d           |                    |           |r|j        r
d%|j         nd	}t;          d&|           5 }t=          |fd'| | |d(| d d d            d S # 1 swxY w Y   d S ))Nr[   z--ignore-installedz	--no-userz--prefixz--no-warn-script-locationz--disable-pip-version-checkz--no-compilez--targetr2   z-vvz-v)	no_binaryonly_binaryz--_-,z:none:z-ir      z--extra-index-urlz
--no-indexz--find-linksz--proxyz--trusted-hostz--certz--client-certz--prez--prefer-binaryz--use-featurezbuild-constraintz--constraintz--build-constraintr    _PIP_IN_BUILD_IGNORE_CONSTRAINTS1z for zInstalling zinstalling )command_descspinner)rr   r`   sys
executablerG   r/   loggergetEffectiveLevelloggingDEBUGappendr   getattrformat_controlextendreplacejoinsorted
index_urls
find_linksproxytrusted_hostscustom_certclient_certallow_all_prereleasesprefer_binaryrg   rf   namer   r   )r:   rU   r3   rW   rX   r`   argsr   formatsr   extra_indexlinkhostconstraint_filer   identify_requirementr}   s                    r#   r[   z+SubprocessBuildEnvironmentInstaller.install   sK    	**,,,N K')  #
& ##%%66KK%%''722KK: 	 	Nf3^DDGKK>11#s;;;HHVG$9z::;;    &
 	&KKz!}-...)!""~ @ @0+>????@ KK%%%% 	0 	0DKK.////< 	3KKFL1222( 	2 	2DKK)401111 	8KK6#56777 	?KK&*<=>>>' 	!KK    	+KK)*** 1 	?KK*<=>>>" 	E $(#: E E^_=>>>1?CDDDD&(1 	Y$:Q 	Y -/QSV.WXMDL!!! '.F',F"GL"""B 	 ...// 	7G4G1EGG   	  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   +MMM)NF)r`   r   ra   rb   rc   rd   r(   r0   r(   r0   r\   )r   r   r   r]   r<   rr   r[   r!   r"   r#   r_   r_   h   sr          /316	R R R R R
 
 
 
:a a a a a ar"   r_   c                  @    e Zd ZdZddZddZddZddZddd dZdS )!BuildEnvironmentzACreates and manages an isolated environment to install build deps	installerrT   r(   r0   c                   || _         t          t          j        d          t	          fddD                       | _        g | _        g | _        t          t          | j        
                                                    D ]@}| j                            |j                   | j                            |j                   At                      }t           j                            j        d          | _        t           j                            | j                  st!          j        | j                   t-          t           j                            | j        d          dd	          5 }|                    t1          j        d
                              || j                             d d d            d S # 1 swxY w Y   d S )NT)rW   globally_managedc              3     K   | ]8}|t          t          j                            j        |                    fV  9d S r+   )r.   rD   r/   r   )rM   r   temp_dirs     r#   	<genexpr>z,BuildEnvironment.__init__.<locals>.<genexpr>   sV       %
 %
 727<<t<<==>%
 %
 %
 %
 %
 %
r"   )normaloverlayrP   zsitecustomize.pywzutf-8)encodinga  
                import os, site, sys

                # First, drop system-sites related paths.
                original_sys_path = sys.path[:]
                known_paths = set()
                for path in {system_sites!r}:
                    site.addsitedir(path, known_paths=known_paths)
                system_paths = set(
                    os.path.normcase(path)
                    for path in sys.path[len(original_sys_path):]
                )
                original_sys_path = [
                    path for path in original_sys_path
                    if os.path.normcase(path) not in system_paths
                ]
                sys.path = original_sys_path

                # Second, add lib directories.
                # ensuring .pth file are processed.
                for path in {lib_dirs!r}:
                    assert not path in sys.path
                    site.addsitedir(path)
                )rQ   r9   )r   r   r   	BUILD_ENVr   	_prefixes	_bin_dirs	_lib_dirsreversedlistvaluesr   r6   r   r9   rR   rD   r/   r   	_site_direxistsmkdiropenwritetextwrapdedentformat)r:   r   r3   rQ   fpr   s        @r#   r<   zBuildEnvironment.__init__   s   " m&=PTUUU$ %
 %
 %
 %
-%
 %
 %
 
 

 %'$&tDN$9$9$;$;<<== 	3 	3FN!!&.111N!!&/2222
 011hmV<<w~~dn-- 	%HT^$$$GLL);<<cG
 
 
 	HH 2 &lT^&LL5  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   0AF??GGc                   d dD             | _         | j        d d          }| j         d         }|r2|                    |                    t          j                             | j        g}t          j                            t          j        	                    |          dt          j        	                    |          d           d S )Nc                P    i | ]#}|t           j                            |d           $S r+   )rD   rn   ro   )rM   r   s     r#   
<dictcomp>z.BuildEnvironment.__enter__.<locals>.<dictcomp>3  s:     
 
 
 "*..t,,
 
 
r"   )PATHPYTHONNOUSERSITE
PYTHONPATHr   r{   )
	_save_envr   r   splitrD   pathsepr   rn   updater   )r:   r/   old_path
pythonpaths       r#   	__enter__zBuildEnvironment.__enter__2  s    
 
B
 
 

 ~aaa >&) 	4KKrz22333n%



--$' jooj99 	
 	
 	
 	
 	
r"   exc_typetype[BaseException] | Noneexc_valBaseException | Noneexc_tbTracebackType | Nonec                    | j                                         D ]7\  }}|!t          j                            |d            (|t          j        |<   8d S r+   )r   itemsrD   rn   pop)r:   r   r   r   varname	old_values         r#   __exit__zBuildEnvironment.__exit__G  s^     #'."6"6"8"8 	0 	0GY 
w----&/
7##		0 	0r"   reqsrV   %tuple[set[tuple[str, str]], set[str]]c                j   t                      }t                      }|rt          | d          rt          | j                  nt	                      }|D ]}t          |          }|j        |j                            ddi          s5|                    |j	                  }|s|
                    |           gt          |j        t                    r|j	         d|j         }n|j	         d|j         }|j                            |j        d          s|
                    ||f           ||fS )	zReturn 2 sets:
        - conflicting requirements: set of (installed, wanted) reqs tuples
        - missing requirements: set of reqs
        r   Nextrar2   z==z===T)prereleases)setrO   r   r   r   r   markerevaluateget_distributionr   add
isinstanceversionr
   	specifiercontains)	r:   r   missingconflictingenvreq_strreqdistinstalled_req_strs	            r#   check_requirementsz#BuildEnvironment.check_requirementsS  sU    %%ee 	B 4--////,.. 
   B B%g.. :)#*2E2EwPRm2T2T)++CH55 KK(((dlG44 G+.8(E(Et|(E(E%%+.8(F(F(F(F%}--dl-MM BOO%6$@AAAG##r"   NrX   rU   prefix_as_stringr&   rW   rX   rY   c                   | j         |         }|j        rJ d|_        |sd S | j                            ||||           d S )NT)rW   rX   )r   r4   r   r[   )r:   rU   r   rW   rX   r3   s         r#   install_requirementsz%BuildEnvironment.install_requirementsu  sX      01< 	F|V$PPPPPr"   )r   rT   r(   r0   r   r   r   r   r   r   r   r(   r0   )r   rV   r(   r   
rU   rV   r   r&   rW   r&   rX   rY   r(   r0   )	r   r   r   r]   r<   r   r   r   r   r!   r"   r#   r   r      s        KK5 5 5 5n
 
 
 
*
0 
0 
0 
0 $  $  $  $P .2Q Q Q Q Q Q Q Qr"   r   c                  @    e Zd ZdZddZddZddZddZddddZdS )NoOpBuildEnvironmentz0A no-op drop-in replacement for BuildEnvironmentr(   r0   c                    d S r+   r!   r:   s    r#   r<   zNoOpBuildEnvironment.__init__      r"   c                    d S r+   r!   r   s    r#   r   zNoOpBuildEnvironment.__enter__  r   r"   r   r   r   r   r   r   c                    d S r+   r!   )r:   r   r   r   s       r#   r   zNoOpBuildEnvironment.__exit__  s	     	r"   c                    d S r+   r!   r   s    r#   cleanupzNoOpBuildEnvironment.cleanup  r   r"   Nr   rU   rV   r   r&   rW   rX   rY   c                   t                      r+   )NotImplementedError)r:   rU   r   rW   rX   s        r#   r   z)NoOpBuildEnvironment.install_requirements  s     "###r"   r   r   r   )	r   r   r   r]   r<   r   r   r   r   r!   r"   r#   r   r     s        ::             .2$ $ $ $ $ $ $ $r"   r   )r%   r&   r'   r&   r(   r)   )r(   r&   )r(   rH   )<r]   
__future__r   r   rD   r>   rP   r~   r   collectionsr   collections.abcr   typesr   typingr   r   r	   pip._vendor.packaging.versionr
   pipr   r@   pip._internal.cli.spinnersr   pip._internal.locationsr   r   r   pip._internal.metadatar   r   pip._internal.utils.deprecationr   pip._internal.utils.loggingr   pip._internal.utils.packagingr   pip._internal.utils.subprocessr   pip._internal.utils.temp_dirr   r   "pip._internal.index.package_finderr   pip._internal.req.req_installr   r   	getLoggerr   r   r,   r.   rG   rR   rT   r_   r   r   r!   r"   r#   <module>r
     s   @ @ " " " " " "  				   



  # # # # # # $ $ $ $ $ $       5 5 5 5 5 5 5 5 5 5 1 1 1 1 1 1 ( ( ( ( ( ( 3 3 3 3 3 3 H H H H H H H H H H K K K K K K K K 6 6 6 6 6 6 / / / / / / 9 9 9 9 9 9 : : : : : : E E E E E E E E &@@@@@@@@@@@@& & & & &y & & & & 
	8	$	$& & & &? ? ? ? ? ? ? ?5 5 5 5 = = = =(        M M M M M M M M`JQ JQ JQ JQ JQ JQ JQ JQZ$ $ $ $ $+ $ $ $ $ $r"   