
    )h+                        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
 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& ddl'm(Z(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3  ejh                  e5      Z6 ejn                  dejp                        Z9e
ee$   ee$   f   Z:de;de<fdZ=de$de<fdZ>de$de<fdZ?de$de	e<   fdZ@de$dede;fdZAde$d e;ddfd!ZBde$d"e;d#e<d$ee;   d%ee;   d&e<de	e;   fd'ZCde$d"e;d$ee;   d%ee;   d&e<de	e;   fd(ZDde$d%ee;   de<fd)ZEd*ee$   ded#e<d$ee;   d%ee;   de:fd+ZFy),z:Orchestrator for building wheels from InstallRequirements.    N)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)
indent_log)
ensure_dir	hash_file)make_setuptools_clean_args)call_subprocess)TempDirectory)path_to_url)vcsz([a-z0-9_.]+)-([a-z0-9_.!+-]+)sreturnc                 >    t        t        j                  |             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    N/var/www/html/venv/lib/python3.12/site-packages/pip/_internal/wheel_builder.py_contains_egg_infor%   $   s    
 ##A&''    reqc                     | j                   rJ | j                  ry| j                  sJ | j                  r| j                  S y)zBReturn whether an InstallRequirement should be built into a wheel.FT)
constraintis_wheel
source_direditablesupports_pyproject_editabler'   s    r$   _should_buildr/   ,   s=     ~~
||>>>
||...r&   c                     t        |       S N)r/   r.   s    r$    should_build_for_install_commandr2   >   s     r&   c                    | j                   s| j                  sy| j                  r| j                  j                  r{| j                   rJ | j                  sJ t	        j
                  | j                  j                        }|sJ |j                  | j                  j                  | j                        ryy| j                  sJ | j                  j                         \  }}t        |      ryy)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)r,   r+   linkis_vcsr   get_backend_for_schemeschemeis_immutable_rev_checkouturlsplitextr%   )r'   vcs_backendbaseexts       r$   _should_cacher>   D   s     ||3>>
xxCHHOO <<~~~00A{00s~~N88O8!!#ID#$ r&   wheel_cachec                     t        |j                        }| j                  sJ |r(t        |       r|j	                  | j                        }|S |j                  | j                        }|S )zdReturn the persistent or temporary cache directory where the built
    wheel need to be stored.
    )r!   	cache_dirr4   r>   get_path_for_linkget_ephem_path_for_link)r'   r?   cache_availablerA   s       r$   _get_cache_dirrE   d   sa     ;001O88O8=-11#((;	   77A	r&   
wheel_pathc                    t        | j                  xs d      }t        t        j                  j                  |            }t        |j                        |k7  rt        d|d|j                        t        t        |      |      }t        |j                        }t        |      t        |j                        k7  rt        d|d|j                        |j                  }|t        d      	 t        |      }|t        d      k\  r*t!        |j                  t              st        d|d      y y # t        $ r d| }t        |      w xY w)	N z)Wheel has unexpected file name: expected z, got zMissing Metadata-VersionzInvalid Metadata-Version: z1.2z+Metadata 1.2 mandates PEP 440 version, but z is not)r   namer   ospathbasenamer   r   r   strversionr   metadata_versionr   r
   r	   
isinstance)	r'   rF   canonical_namewdistdist_verstrmetadata_version_valuerO   msgs	            r$   _verify_onerW   t   s_   &sxx~26Nbggz*+A N2"77I J66*
 	
 "/*"=~NDdll#KK(,@,KK"7 G99-!
 	
 "22%9::$"#9: 75>)*T\\72S9+P
 	
 3T)  $*+A*BCs##$s   5D9 9E
output_dirverifybuild_optionsglobal_optionsr,   c                    |rdnd}	 t        |       | j
                  5  t        | ||||      }ddd       r|r	 t        | |       |S |S # t        $ r,}t        j                  d|| j                  |       Y d}~yd}~ww xY w# 1 sw Y   VxY w# t        t        f$ r,}t        j                  d|| j                  |       Y d}~yd}~ww xY w)zaBuild one wheel.

    :return: The filename of the built wheel, or None if the build failed.
    r,   wheelzBuilding %s for %s failed: %sNzBuilt %s for %s is invalid: %s)
r   OSErrorloggerwarningrI   	build_env_build_one_inside_envrW   r   r   )	r'   rX   rY   rZ   r[   r,   artifacterF   s	            r$   
_build_onere      s     &z7H	: 
 
*]NH


 f	Z( :)  +HH		
 
 
 %&67 	NN;XsxxQRS	s9   A BB 	B"A<<BBC"CCc           	         t        d      5 }| j                  sJ | j                  r| j                  sJ | j                  sJ |r t
        j                  d| j                         |r t
        j                  d| j                         |r8t        | j                  | j                  | j                  |j                        }nqt        | j                  | j                  | j                  |j                        }n9t        | j                  | j                  | j                  |||j                        }|t        j                  j                  |      }t        j                  j                  ||      }	 t!        |      \  }	}
t#        j$                  ||       t
        j'                  d| j                  ||
|	j)                                t
        j'                  d|       |cd d d        S | j                  st-        | |       	 d d d        y # t*        $ r+}t
        j                  d	| j                  |       Y d }~Qd }~ww xY w# 1 sw Y   y xY w)
Nr]   )kindz7Ignoring --global-option when building %s using PEP 517z6Ignoring --build-option when building %s using PEP 517)rI   backendmetadata_directorytempd)rI   setup_py_pathr+   r[   rZ   rj   z3Created wheel for %s: filename=%s size=%d sha256=%szStored in directory: %sz Building wheel for %s failed: %s)r   rI   
use_pep517ri   pep517_backendr_   r`   r   rK   r   r   rk   unpacked_source_directoryrJ   rL   joinr   shutilmoveinfo	hexdigest	Exception_clean_one_legacy)r'   rX   rZ   r[   r,   temp_dirrF   
wheel_name	dest_path
wheel_hashlengthrd   s               r$   rb   rb      s    
G	$ =xxx>>))))%%%%Msxx Lchh 1..'*'='="--	
 0..'*'='="--	
 ,XX!//88-+mmJ !))*5JZ<I%.z%:"
FJ	2IHH((* 5zB g= =v ~~c>2{= =h  6HH i= =s7   E'I5A,H+I	I!H<7I<IIIc                    t        | j                  |      }t        j                  d| j                         	 t        |d| j                         y# t        $ r# t        j                  d| j                         Y yw xY w)N)r[   zRunning setup.py clean for %szpython setup.py clean)command_desccwdTz Failed cleaning build dir for %sF)	r   rk   r_   rr   rI   r   r+   rt   error)r'   r[   
clean_argss      r$   ru   ru      sp    +%J
 KK/:%<#..	
  7Bs   A )A>=A>requirementsc                    | sg g fS t         j                  ddj                  d | D                     t               5  g g }}| D ]  }|j                  sJ t        ||      }t        ||||||j                  xr |j                        }	|	r|j                  |j                  ||j                         t        t        |	            |_        |j                  j                  |_        |j                  j                   sJ |j#                  |       |j#                  |        	 ddd       r=t         j                  ddj                  |D cg c]  }|j                   c}             r=t         j                  ddj                  |D cg c]  }|j                   c}             ||fS # 1 sw Y   xY wc c}w c c}w )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   4   K   | ]  }|j                     y wr1   )rI   ).0r'   s     r$   	<genexpr>zbuild.<locals>.<genexpr>!  s     3s#((3s   NzSuccessfully built %s zFailed to build %s)r_   rr   ro   r   rI   rE   re   r,   permit_editable_wheelsdownload_inforecord_download_originr   r   r4   	file_pathlocal_file_pathr*   append)
r   r?   rY   rZ   r[   build_successesbuild_failuresr'   rA   
wheel_files
             r$   buildr     s    2v KK4		3l33
 
 +*,b 	+C88O8&sK8I#;!;!;J $$0  66y#BSBSTJ 78&)hh&8&8#xx((((&&s+%%c*1	++: #HH/:3chh:;	
  HH.93chh9:	

 N**Q+ +@ ;
 :s   C'F/F;G /F8)G__doc__loggingos.pathrJ   rerp   typingr   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.loggingr   pip._internal.utils.miscr   r   $pip._internal.utils.setuptools_buildr   pip._internal.utils.subprocessr   pip._internal.utils.temp_dirr   pip._internal.utils.urlsr   pip._internal.vcsr   	getLogger__name__r_   compile
IGNORECASEr"   BuildResultrM   r!   r%   r/   r2   r>   rE   rW   re   rb   ru   r    r&   r$   <module>r      s4   @   	  2 2 O A * K J * , C N J < 2 : K : 6 0 !			8	$rzz;R]]KD+,d3E.FFG(# ($ (		$			d^@	 	 
' 
S 
T 
:#	## # 9	#
 I# # c]#LD	DD 9D I	D
 D c]DN- tCy T "=+-.=+=+ =+ 9	=+
 I=+ =+r&   