
    fXf3                     d   d Z ddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZ ddlmZmZ ddlmZmZ ddlmZ ddl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# ddl$m%Z% ddl&m'Z'm(Z( ddl)m*Z* ddl+m,Z,m-Z-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8  ej9        e:          Z; ej<        dej=                  Z>ee%ge?f         Z@ee	e%         e	e%         f         ZAdeBde?fdZC	 d1de%de?de
e@         de?fdZDde%de?fdZEde%d e@de?fd!ZFde%de
e?         fd"ZGde%d#edeBfd$ZHde%d%eBddfd&ZIde%d'eBd(e?d)e	eB         d*e	eB         d+e?de
eB         fd,ZJde%d'eBd)e	eB         d*e	eB         d+e?de
eB         fd-ZKde%d*e	eB         de?fd.ZLd/ee%         d#ed(e?d)e	eB         d*e	eB         deAfd0ZMdS )2z;Orchestrator for building wheels from InstallRequirements.
    N)CallableIterableListOptionalTuple)canonicalize_namecanonicalize_version)InvalidVersionVersion)
WheelCache)InvalidWheelFilenameUnsupportedWheel)FilesystemWheelget_wheel_distribution)Link)Wheel)build_wheel_pep517)build_wheel_editable)build_wheel_legacy)InstallRequirement)&LegacyInstallReasonMissingWheelPackage2LegacyInstallReasonNoBinaryForcesSetuptoolsInstall)
indent_log)
ensure_dir	hash_fileis_wheel_installed)make_setuptools_clean_args)call_subprocess)TempDirectory)path_to_url)vcsz([a-z0-9_.]+)-([a-z0-9_.!+-]+)sreturnc                 P    t          t                              |                     S )zjDetermine whether the string looks like an egg_info.

    :param s: The string to parse. E.g. foo-2.1
    )bool_egg_info_research)r"   s    T/var/www/html/Qu*py/bism/lib/python3.11/site-packages/pip/_internal/wheel_builder.py_contains_egg_infor)   *   s     
 ##A&&'''    req
need_wheelcheck_bdist_wheelc                 B   | j         rdS | j        r$|r t                              d| j                   dS |rdS | j        sdS | j        r|                                 S | j        rdS |J  ||           st          | _
        dS t                      st          | _
        dS dS )zBReturn whether an InstallRequirement should be built into a wheel.Fz(Skipping %s, due to already being wheel.T)
constraintis_wheelloggerinfoname
source_direditablesupports_pyproject_editable
use_pep517r   legacy_install_reasonr   r   )r+   r,   r-   s      r(   _should_buildr9   2   s     ~ u
|  	KK:   u t
 > u
| 1..000
~ t(((S!!  %W!u $J!u4r*   c                 $    t          | d          S )NT)r,   r9   )r+   s    r(   should_build_for_wheel_commandr<   f   s     ....r*   check_bdist_wheel_allowedc                 &    t          | d|          S )NF)r,   r-   r;   )r+   r=   s     r(    should_build_for_install_commandr?   l   s#     1J   r*   c                 r   | j         s| j        sdS | j        ri| j        j        r]| j         rJ | j        sJ t	          j        | j        j                  }|sJ |                    | j        j        | j                  rdS dS | j        sJ | j        	                                \  }}t          |          rdS dS )z
    Return whether a built InstallRequirement can be stored in the persistent
    wheel cache, assuming the wheel cache is available, and _should_build()
    has determined a wheel needs to be built.
    FT)r5   r4   linkis_vcsr!   get_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr)   )r+   vcs_backendbaseexts       r(   _should_cacherK   u   s     | 3> u
x 	CHO 	 <~0AA00s~NN 	4u8OOO!!##ID#$ t 5r*   wheel_cachec                     t          |j                  }| j        sJ |r*t          |           r|                    | j                  }n|                    | j                  }|S )zdReturn the persistent or temporary cache directory where the built
    wheel need to be stored.
    )r%   	cache_dirrA   rK   get_path_for_linkget_ephem_path_for_link)r+   rL   cache_availablerN   s       r(   _get_cache_dirrR      sj     ;011O8OOO B=-- B11#(;;		77AA	r*   
wheel_pathc                 >   t          | j        pd          }t          t          j                            |                    }t          |j                  |k    r(t          d                    ||j                            t          t          |          |          }t          |j                  }t          |          t          |j                  k    r(t          d                    ||j                            |j        }|t          d          	 t          |          }n"# t           $ r d| }t          |          w xY w|t          d          k    r<t#          |j        t                    s$t          d                    |                    d S d S )N z7Wheel has unexpected file name: expected {!r}, got {!r}zMissing Metadata-VersionzInvalid Metadata-Version: z1.2z6Metadata 1.2 mandates PEP 440 version, but {!r} is not)r   r3   r   ospathbasenamer   formatr   r   strversionr	   metadata_versionr   r   r
   
isinstance)	r+   rS   canonical_namewdistdist_verstrmetadata_version_valuer\   msgs	            r(   _verify_onerd      s   &sx~266Nbgz**++A  N22"vnaf55
 
 	
 "/*"="=~NNDdl##KK((,@,K,KKK"vk1955
 
 	
 "2%9:::$"#9:: $ $ $C+ACCs###$ 75>>))*T\72S2S)$f[11
 
 	
 *)))s   D* *E	
output_dirverifybuild_optionsglobal_optionsr5   c                    |rdnd}	 t          |           n:# t          $ r-}t                              d|| j        |           Y d}~dS d}~ww xY w| j        5  t          | ||||          }ddd           n# 1 swxY w Y   |rU|rS	 t          | |           nA# t          t          f$ r-}t                              d|| j        |           Y d}~dS d}~ww xY w|S )zaBuild one wheel.

    :return: The filename of the built wheel, or None if the build failed.
    r5   wheelzBuilding %s for %s failed: %sNzBuilt %s for %s is invalid: %s)
r   OSErrorr1   warningr3   	build_env_build_one_inside_envrd   r   r   )	r+   re   rf   rg   rh   r5   artifacterS   s	            r(   
_build_onerq      sr    &2zz7H	:   +H		
 	
 	
 ttttt 
 
 
*]NH
 


 
 
 
 
 
 
 
 
 
 
 
 
 
 
  f 	Z(((($&67 	 	 	NN;XsxQRSSS44444	 s>    
A"A

AA99A= A=	B C+"CCc           	      H   t          d          5 }| j        sJ | j        r| j        sJ | j        sJ |r t
                              d| j                   |r t
                              d| j                   |r(t          | j        | j        | j        |j                  }nQt          | j        | j        | j        |j                  }n)t          | j        | j        | j        |||j                  }|t          j                            |          }t          j                            ||          }	 t!          |          \  }	}
t#          j        ||           t
                              d| j        ||
|	                                           t
                              d|           |cd d d            S # t*          $ r+}t
                              d	| j        |           Y d }~nd }~ww xY w| j        st-          | |           	 d d d            d S # 1 swxY w Y   d S )
Nrj   )kindz7Ignoring --global-option when building %s using PEP 517z6Ignoring --build-option when building %s using PEP 517)r3   backendmetadata_directorytempd)r3   setup_py_pathr4   rh   rg   rv   z3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %sz Building wheel for %s failed: %s)r   r3   r7   ru   pep517_backendr1   rl   r   rW   r   r   rw   unpacked_source_directoryrV   rX   joinr   shutilmover2   	hexdigest	Exception_clean_one_legacy)r+   re   rg   rh   r5   temp_dirrS   
wheel_name	dest_path
wheel_hashlengthrp   s               r(   rn   rn      s    
G	$	$	$ =x> !	))))%%%% Msx    Lch    1.'*'="-	  

 0.'*'="-	  

 ,X!/8-+m  J !))*55JZ<<I%.z%:%:"
FJ	222IH((**   5zBBB g= = = = = = = =h    6H        ~ 	3c>222{= = = = = = = = = = = = = = = = = =s7   D#H5A8F::
G/!G*%H*G//HHHc                    t          | j        |          }t                              d| j                   	 t          |d| j                   dS # t          $ r$ t                              d| j                   Y dS w xY w)N)rh   zRunning setup.py clean for %szpython setup.py clean)command_desccwdTz Failed cleaning build dir for %sF)	r   rw   r1   r2   r3   r   r4   r~   error)r+   rh   
clean_argss      r(   r   r   0  s    +%  J
 KK/:::%<#.	
 	
 	
 	
 t   7BBBuus   A *A?>A?requirementsc           
      ^   | sg g fS t                               dd                    d | D                                  t                      5  g g }}| D ]}|j        sJ t          ||          }t          ||||||j        o|j                  }	|	rx|j	        |
                    ||j	                   t          t          |	                    |_        |j        j        |_        |j        j        sJ |                    |           |                    |           	 ddd           n# 1 swxY w Y   |r8t                               dd                    d |D                                  |r8t                               dd                    d	 |D                                  ||fS )
zBuild wheels.

    :return: The list of InstallRequirement that succeeded to build and
        the list of InstallRequirement that failed to build.
    z*Building wheels for collected packages: %sz, c              3   $   K   | ]}|j         V  d S Nr3   .0r+   s     r(   	<genexpr>zbuild.<locals>.<genexpr>S  s$      33s#(333333r*   NzSuccessfully built %s c                     g | ]	}|j         
S  r   r   s     r(   
<listcomp>zbuild.<locals>.<listcomp>v  s    :::3ch:::r*   zFailed to build %sc                     g | ]	}|j         
S r   r   r   s     r(   r   zbuild.<locals>.<listcomp>{  s    9993ch999r*   )r1   r2   rz   r   r3   rR   rq   r5   permit_editable_wheelsdownload_inforecord_download_originr   r    rA   	file_pathlocal_file_pathr0   append)
r   rL   rf   rg   rh   build_successesbuild_failuresr+   rN   
wheel_files
             r(   buildr   A  s1     2v KK4		33l33333  
 
 + +*,b 	+ 	+C8OOO&sK88I#;!; J  +$0  66y#BSTTTJ 7 788&)h&8#x((((&&s++++%%c****1	++ + + + + + + + + + + + + + +:  
#HH::/:::;;	
 	
 	
  
 HH99.999::	
 	
 	

 N**s   CD,,D03D0r   )N__doc__loggingos.pathrV   rer{   typingr   r   r   r   r   pip._vendor.packaging.utilsr   r	   pip._vendor.packaging.versionr
   r   pip._internal.cacher   pip._internal.exceptionsr   r   pip._internal.metadatar   r   pip._internal.models.linkr   pip._internal.models.wheelr   $pip._internal.operations.build.wheelr   -pip._internal.operations.build.wheel_editabler   +pip._internal.operations.build.wheel_legacyr   pip._internal.req.req_installr   pip._internal.utils.deprecationr   r   pip._internal.utils.loggingr   pip._internal.utils.miscr   r   r   $pip._internal.utils.setuptools_buildr   pip._internal.utils.subprocessr   pip._internal.utils.temp_dirr   pip._internal.utils.urlsr    pip._internal.vcsr!   	getLogger__name__r1   compile
IGNORECASEr&   r%   BdistWheelAllowedPredicateBuildResultrZ   r)   r9   r<   r?   rK   rR   rd   rq   rn   r   r   r   r*   r(   <module>r      s      				  < < < < < < < < < < < < < < O O O O O O O O A A A A A A A A * * * * * * K K K K K K K K J J J J J J J J * * * * * * , , , , , , C C C C C C N N N N N N J J J J J J < < < < < <        3 2 2 2 2 2 N N N N N N N N N N K K K K K K : : : : : : 6 6 6 6 6 6 0 0 0 0 0 0 ! ! ! ! ! !		8	$	$rz;R]KK%'9&:D&@A D+,d3E.FFG(# ($ ( ( ( ( ?C1 1	11   :;1 
	1 1 1 1h/	/	/ / / /	9 
   	d^   @	 	    
' 
S 
T 
 
 
 
<#	## # 9	#
 I# # c]# # # #LD	DD 9D I	D
 D c]D D D DN- tCy T    "=+-.=+=+ =+ 9	=+
 I=+ =+ =+ =+ =+ =+ =+r*   