+
    kGj"                       R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
HtHtHt ]	'       d   ^ RIHt ^ RIt^ RIt^ RIHtHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIH t  ^ RI!H"t" ^ RI#H$t$ ^ RI%H&t& ^ RI'H(t(H)t) ^ RI*H+t+ ^ RI,H-t- ]P\                  ! ]/4      t0]Pb                  ! R4      t2]Pb                  ! R4      t3R R lt4R R lt5 ! R R4      t6R# )z:
Convert a dependency tree from pypi into .conda packages
)annotationsN)Path)TYPE_CHECKINGIterableListOptionalUnion)Solver)contextfresh_context)get_python_short_path)UnsatisfiableError)Channel)	MatchSpec)PrefixRecord)get_spinner)ChannelIndex)PackageFinder)build_conda)find_and_fetchget_package_finder)update_index)SuppressOutputznothing provides (.*) needed byz-\b(.*), (.)* (n|N)o candidates were found(.*)c                   V ^8  d   QhRR/#    messagestr )formats   "7lib/python3.14/site-packages/conda_pypi/convert_tree.py__annotate__r!   (   s     ! ! !    c              #     "   V P                  4        F5  p\        P                  V4      ;p'       g   K"  VP                  ^4      x  K7  	  R# 5iz;
Parse missing packages out of UnsatisfiableError message.
N)
splitlinesNOTHING_PROVIDES_REsearchgroupr   linematchs   &  r    parse_libmamba_solver_errorr,   (   sA      ""$'..t44544++a.  %
   .AAc                   V ^8  d   QhRR/# r   r   )r   s   "r    r!   r!   1   s     ! ! !r"   c              #     "   V P                  4        F5  p\        P                  V4      ;p'       g   K"  VP                  ^4      x  K7  	  R# 5ir$   )r%   RATTLER_NOTHING_PROVIDES_REr'   r(   r)   s   &  r    parse_rattler_solver_errorr1   1   sA      ""$/66t<<5<<++a.  %r-   c                  X    ] tR t^;tRR R lltRR R lltR tR R ltRR	 R
 lltRt	R# )ConvertTreeNc               $    V ^8  d   QhRRRRRR/# )r   prefixz"Optional[Union[pathlib.Path, str]]repozOptional[pathlib.Path]finderzOptional[PackageFinder]r   )r   s   "r    r!   ConvertTree.__annotate__<   s(      2 %	
 (r"   c                	j   T;'       g     \        \        P                  ! R 4      4      V n        T;'       g    \        P
                  pV'       g   \        R4      h\        V4      V n        W n        \        V P                  \        4       4      V n
        V'       g   V P                  4       pW@n        R# )z
conda-pypizprefix is requiredN)r   platformdirsuser_data_dirr6   r
   active_prefix
ValueErrorr5   override_channelsr   
python_exedefault_package_finderr7   )selfr5   r>   r6   r7   s   &&&&&r    __init__ConvertTree.__init__<   s     JJD!;!;L!IJ	007001226l!2t{{,A,CD002Fr"   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   max_attemptsintsolverr	   tmp_pathr   channelszIterable[str]return@tuple[tuple[PrefixRecord, ...], tuple[PrefixRecord, ...]] | Noner   )r   s   "r    r!   r8   Q   sD     J JJ J 	J
  J 
JJr"   c           
     	   \        4       p\        4       p\        4       p^ pV P                  p	VR,          p
V
P                  RR7       \        V4      V8  d?   W8  d9   V^,          p \	        4       ;_uu_ 4        VP                  4       pRRR4        X# \        P                  RV R24       R#   + '       g   i     L.; i  \        P                  P                   d?   p\        TP                  R,          4      p\        P                  RT 24        Rp?MyRp?i\         di   p\        P                  RT4       TP                  \        TP                  4      4       TP                  \!        TP                  4      4        Rp?MRp?ii ; i\#        Yv,
          4       F*  p\%        T P&                  Y4       TP)                  T4       K,  	  T
P+                  R4       F  pY9   d   K  \        P                  R	T R
24       Y>P,                  ,          pTP                  4         \/        TTT	R,          T P0                  RTR7      p\        P                  RT4       M+  \2         d    \        P                  RT 2RR7        Mi ; iTP)                  T4       K  	  \5        \7        T	RRRRR7      4       EKy  )    wheelsTexist_okNpackageszMissing packages: zUnsatisfiable: %rz*.whlzConverting ''noarchF)is_editablerI   zConda atz3Tried to convert wheel that is already conda-ized: )exc_infowrite_run_exportscompact_jsonwrite_current_repodatazExceeded maximum of z	 attempts)setr6   mkdirlenr   solve_for_diffconda
exceptionsPackagesNotFoundError_kwargslogdebugr   updater,   r   r1   sortedr   r7   addglobstemr   r?   FileExistsErrorr   r   )rA   rE   rG   rH   rI   	convertedfetched_packagesmissing_packagesattemptsr6   	wheel_dirchangesepackagenormal_wheel
build_pathpackage_condas   &&&&&            r    _convert_loopConvertTree._convert_loopQ   s[    E	55yyx'	&"#l2x7NMHO#%%$335G &h  II,\N)DEk &% ##99 C#&qyy'<#= 		./?.@ABB% O		-q1 ''(CAII(NO ''(B199(MNNO
 ""2"EFt{{I? $$W- G !*w 7,		La89%(9(99
  "$/$"x$)!)%M IIj-8& IIMl^\!%   l+3 !86 &*!%+0sU   (C :B1C 1C	<C F#4DF)F*AFF,8I%%%JJc                	,    \        V P                  4      # )N)r   r5   )rA   s   &r    r@   "ConvertTree.default_package_finder   s    !$++..r"   c                   V ^8  d   QhRR/# )r   rJ   r   r   )r   s   "r    r!   r8      s     
 
3 
r"   c           
     	   R P                  R V P                  P                   4       4      p\        \        P                  V Uu. uF  p\        V4      P                  NK  	  up4      4      pR P                  V4      pRV RV R2# u upi )z
 - c              3  r   "   T F-  qP                  R 4      R8X  g   K  VP                  R4      x  K/  	  R# 5i)typeindexurlN)get).0ss   & r    	<genexpr>>ConvertTree._get_converting_spinner_message.<locals>.<genexpr>   s-      /
"5Qv'9QLAEE%LL"5s   77z?Inspecting pypi and conda dependencies
PYPI index channels:
 - z
Conda channels:
 - z"
Converting required pypi packages)joinr7   sourceslistdictfromkeysr   canonical_name)rA   rI   pypi_index_names_dashedccanonical_namescanonical_names_dasheds   &&    r    _get_converting_spinner_message+ConvertTree._get_converting_spinner_message   s    "),, /
"&++"5"5/
 #
 t}}QY-ZQYAgaj.G.GQY-Z[\!(o!>)* +() *0	0	
 .[s   Bc               $    V ^8  d   QhRRRRRR/# )r   	requestedzList[MatchSpec]rE   rF   rJ   rK   r   )r   s   "r    r!   r8      s)     H H(H8;H	IHr"   c                   V P                   R,          P                  RRR7       V P                   R,          R,          P                  4       '       g$   \        \	        V P                   RRRRR7      4       \
        P                  ! 4       ;_uu_ 4       p\        P                  ! V4      pVR,          pVP                  RR	7       \        P                  ! V P                  4      pVP                  4       '       g   Q h\        V P                   P                  4       4      pV P                  '       g.   V.\        P                  Op\        \        P                  4      pMV.pRp\        P                   P#                  4       p	V	! \%        V4      V\        P&                  VR
R7      p
RRRR/p\)        V P+                  V4      4      ;_uu_ 4        \-        VR7      ;_uu_ 4        V P/                  VV
VVR7      pRRR4       RRR4       XuuRRR4       #   + '       g   i     L$; i  + '       g   i     L/; i  + '       g   i     R# ; i)a]  
Preform a solve on the list of requested packages and converts the full dependency
tree to conda packages if required. The converted packages will be stored in the
local conda-pypi channel.

Args:
    requested: The list of requested packages.
    max_attempts: max number of times to try to execute the solve.

Returns:
    A two-tuple of PackageRef sequences.  The first is the group of packages to
    remove from the environment, in sorted dependency order from leaves to roots.
    The second is the group of packages to add to the environment, in sorted
    dependency order from roots to leaves.

rS   T)parentsrP   zrepodata.jsonNFrV   rN   rO   install)r5   rI   subdirsspecs_to_addcommand CONDA_AGGRESSIVE_UPDATE_PACKAGES CONDA_AUTO_UPDATE_CONDAfalse)env)rE   rG   rH   rI   r   )r6   r[   existsr   r   tempfileTemporaryDirectorypathlibr   r5   r   as_urir>   r
   rI   tupleplugin_managerget_cached_solver_backendr   r   r   r   r   ru   )rA   r   rE   rH   	WHEEL_DIRr5   local_channelrI   build_channelssolver_backendrG   context_envro   s   &&&          r    convert_treeConvertTree.convert_tree   s   & 
X	$$TD$A		H$6>>@@II&*!%+0 ((**h||H-H 8+IOOTO*\\$++.F==??"?#DII$4$4$67M))))=G,<,<=!&w'7'7!8)?!#$33MMON#6{!&!F 3B)7K
 TAA(KLL"{33"00%1%!)!/	 1 G 4 M S +*B 43 MLA +**s=   D;H;H(	#H9H(		H;H% H(	(H83H;;I	)r7   r>   r5   r?   r6   )FNN)r   )P   )
__name__
__module____qualname____firstlineno__rB   ru   r@   r   r   __static_attributes__r   r"   r    r3   r3   ;   s$    *JX/
 H Hr"   r3   )7__doc__
__future__r   loggingr   rer   r   typingr   r   r   r   r   conda.core.solver	   conda.exceptionsr^   r:   conda.base.contextr
   r   conda.common.pathr   r   conda.models.channelr   conda.models.match_specr   conda.models.recordsr   conda.reportersr   conda_index.indexr   unearthr   conda_pypi.buildr   conda_pypi.downloaderr   r   conda_pypi.indexr   conda_pypi.utilsr   	getLoggerr   rb   compiler&   r0   r,   r1   r3   r   r"   r    <module>r      s    #   	   A A'   5 3 / ( - - ' * ! ( D ) +!jj!CD  jj)YZ !!} }r"   