+
    {:j>                        R t ^ RIt^ RIt^ RI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 ^ RIt]P                  ! ]4      t]3t ! R R]4      tRR ltRR lt]P.                  P1                  ]P.                  P3                  RR	4      4      3tRR
 ltR tRR lt]P<                  R R l4       tR t RR lt!RR lt"RR lt#R t$RR lt%R R lt&R t'R t(R# )!zR
conda_build utils we need, without configuring logging as an import side effect.
N)stat)isdirisfileislinkc                       ] tR t^tRtRtR# )	LockErrorz(Raised when we failed to acquire a lock. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       7lib/python3.14/site-packages/conda_index/utils_build.pyr   r      s    2r   r   c                N    V f   . # \        WR7      '       d   \        V 4      # V .# )z
Ensure the object is a list. If not return it in a list.

:param arg: Object to ensure is a list
:type arg: any
:param include_dict: Whether to treat `dict` as a `list`
:type include_dict: bool, optional
:return: `arg` as a `list`
:rtype: list
)include_dict)islistlist)argr   s   &&r   ensure_listr   #   s*     {			/	/Cyur   c                  aa \        V \        4      '       g   \        V R4      '       g   R# V'       g   \        V \        4      '       d   R# S'       g   R# SRJ d'   \	        V 4      p  \        \        V 4      4      oT3R lo \        ;QJ d    V3R lV  4       F  '       d   K   R# 	  R# ! V3R lV  4       4      #   \         d     R# i ; i  \        \        3 d     R# i ; i)a  
Check whether `arg` is a `list`. Optionally determine whether the list elements
are all uniform.

When checking for generic uniformity (`uniform=True`) we check to see if all
elements are of the first element's type (`type(arg[0]) == type(arg[1])`). For
any other kinds of uniformity checks are desired provide a uniformity function:

.. code-block:: pycon
    # uniformity function checking if elements are str and not empty
    >>> truthy_str = lambda e: isinstance(e, str) and e
    >>> islist(["foo", "bar"], uniform=truthy_str)
    True
    >>> islist(["", "bar"], uniform=truthy_str)
    False
    >>> islist([0, "bar"], uniform=truthy_str)
    False

.. note::
    Testing for uniformity will consume generators.

:param arg: Object to ensure is a `list`
:type arg: any
:param uniform: Whether to check for uniform or uniformity function
:type uniform: bool, function, optional
:param include_dict: Whether to treat `dict` as a `list`
:type include_dict: bool, optional
:return: Whether `arg` is a `list`
:rtype: bool
__iter__FTc                     < \        V 4      S8H  # N)type)eetypes   &r   uniformislist.<locals>.uniformj   s    7e##r   c              3   4   <"   T F  pS! V4      x  K  	  R # 5ir   r   ).0r   r   s   & r   	<genexpr>islist.<locals>.<genexpr>n   s     +s!71::ss   )
isinstancestrhasattrdictiterr   nextStopIterationall
ValueError	TypeError)r   r   r   r   s   &f&@r   r   r   6   s    > #s73
#;#;jd33 $3i	cOE	$s+s+ss+s+s+s+++  		 	" s<   )B> 
C C &C )C -C >CCC%$C%~z.conda_build_locksc                    R p \         P                  P                  \         P                  P                  V 4      4      pTp\        VR4      '       d   VP                  4       p\        P                  ! V4      P                  4       p\         F  p \         P                  P                  V4      '       g   \         P                  ! V4       \         P                  P                  We4      p\        VR4      ;_uu_ 4       pVP                  R4       R R R 4       \         P"                  ! Wq4      p V# 	  \%        RP&                  ! \         4      h  \         d    T p EL!i ; i  + '       g   i     L[; i  \         d     K  i ; i)Nencodew z\Could not write locks folder to either system location ({})or user location ({}).  Aborting.)ospathabspathnormpathOSErrorr&   r0   hashlibsha256	hexdigest_lock_foldersr   makedirsjoinopenwritefilelockFileLockRuntimeErrorformat)	foldertimeoutfllocation
b_locationlock_filename	locks_dir	lock_filefs	   &&       r   get_lockrM   z   s:   	B77??277#3#3F#;< Jz8$$&&(
 NN:.88:M"			77==++I&Y>Ii%% &""96B I! # 00678EG
 	
+   &%  		s<   <E A.E8 E%E8E"!E"%E50E88FFc                 x   W8H  p\        V\        4      '       Ed   \        V \        4      '       Ed   \        P                  P	                  V 4      '       gZ   \        P                  P                  \        P                  P                  \        P                  P                  W 4      4      4      p \        P                  P	                  V4      '       gZ   \        P                  P                  \        P                  P                  \        P                  P                  W!4      4      4      pW0V8H  ,          pV# r   )r$   string_typesr3   r4   isabsr5   r6   r=   )
base_valuevaluer4   
equivalents   &&& r   _equivalentrT      s    $J%&&:j,+O+Oww}}Z((  d!?@J ww}}U##GGOOBGG$4$4RWW\\$5N$OPEE))
r   c           	      \   W8X  d   V # V'       g=   \        V 4      \        V4      8  d   T pTpMTpT pV Uu. uF  qV9   g   K  VNK  	  p	pMVP                  4       p	V	 EF  pW,          p
W9   g   V'       g   K  V P                  W4      p\        V
R 4      '       d   \	        WW#VR7      pWV&   KS  \        V
R4      '       dM   \        V
\        4      '       g7   V'       d)   W8w  d    VP                  V
4        \        V4      W&   K  WV&   K  V'       dH   V'       d@   \        WV4      '       g.   V'       d&   \        P                  RP                  WV
4      4       V
f   W9   d   W EK  WV&   EK  	  V # u upi   \        \        3 d    T
p Li ; i  \         d
    YT&    EKK  i ; i)keys)raise_on_clobberr   z3clobbering key {} (original value {}) with value {})lenrV   getr&   merge_or_update_dictr$   r%   extendr-   AttributeErrorr   rT   logdebugrC   )basenewr4   mergerW   add_missing_keyssmallerlargerkeyrV   rR   rQ   s   &&&&&&      r   rZ   rZ      s    { t9s3xGFGF&8w-w8xxz;**#-Juf%%1tEU
 'S	
++Juc4J4J!*/&--e4/$($4	 !&I '
4@@(IIMTTU
 =S[	 %IK L KU 9$ !*>: /).J/ % /$.S	/s/   E9E9)E>;F>FFF+*F+c                N    V ^8  d   QhR\         \        P                  ,          /# )   locks)r   r@   rA   )rC   s   "r   __annotate__ri      s     ' 'T("3"34 'r   c              #    "   \         P                   ! 4       p\         P                   ! 4       V,
          V8  d    V  F  pVP                  RR7       K  	  M\        R4      h Rx  V  F  pVP	                  4        K  	  R#   \        P                   d    T  F  pTP	                  4        K  	   K  i ; i  T  F  pTP	                  4        K  	  i ; i5i)a"  Try to acquire all locks.

If any lock can't be immediately acquired, free all locks.
If the timeout is reached withou acquiring all locks, free all locks and raise.

http://stackoverflow.com/questions/9814008/multiple-mutex-locking-strategies-and-why-libraries-dont-use-address-comparison
g?rE   zFailed to acquire all locksN)timeacquirer@   Timeoutreleaser   )rh   rE   tlocks   &&  r   try_acquire_locksrr      s      			A
))+/G
#	S)  
 566DLLN )  	  	( DLLN s@   7CB C"B6 &C.B3/C2B33C6CCc           	         R p\         P                  \         P                  \         P                  3 F  p V! W4       Rp M	  V'       g@    \        P                  ! RV  RV 2R\        P                  \        P                  R7       R# R#   \        \
        3 d     Ko  i ; i  \        P                   dE   p\        P                  P                  T4      '       g   \	        RT  RT RT 24      h Rp?R# Rp?ii ; i)	FTzcp -a  )shellstderrstdoutzFailed to copy  to z.  Error was: N)shutilcopy2copycopyfiler7   PermissionError
subprocess
check_callPIPECalledProcessErrorr3   r4   r   )srcdst	is_copiedfuncr   s   &&   r   _copy_with_shell_fallbackr     s    Iv{{FOO<	NI	 = 		Q!!Qse$!!	  ) 		 ,, 	Q77>>#&&uD^A3OPP '	Qs)   
B<B% B"!B"%C>:9C99C>c                    \         P                  P                  V4      '       g-   \         P                  ! V4       \        P
                  ! W4       \         P                  ! V 4      pV'       d"   V! W4      pV Uu. uF  qwV9  g   K  VNK  	  ppR V9   d   VP                  R 4       V Uu. uF"  p\         P                  P                  W4      NK$  	  p	pV'       Eg`   \        V4       EFO  w  r\         P                  P                  W4      pW,          pV'       d   \         P                  P                  V4      '       d   \         P                  P                  V4      '       d   \         P                  ! V4       \         P                  ! \         P                  ! V4      V4        \         P                  ! V4      p\        P                   ! VP"                  4      p\         P$                  ! W4       EK  \         P                  P'                  V4      '       d   \)        WW#4       EKD  \+        W4       EKR  	  V	# u upi u upi     EKf  ; i)z.conda_lock)r3   r4   existsr<   ry   copystatlistdirremover=   	enumerater   lexistssymlinkreadlinklstatr   S_IMODEst_modelchmodr   copytreer   )r   r   symlinksignoredry_runlstexclxitemdst_lstidxsdstmodes   &&&&&          r   r   r   (  s   77>>#
C!
**S/Cc/#Q$qq#/ 

=!36734rww||C&3G77"3ICS'AABGGNN1--77??1%%IIaL

2;;q>1-!B<<

3DIIa& q!!x0)!/! ($ N7 0 8s   <I	I-(I,AIIc                   \         P                  P                  \         P                  P                  V4      4      p\         P                  P                  \         P                  P                  V 4      4      p VP	                  V 4      '       d   Q RP                  W4      4       h\        WVRR7      pV Uu. uF  p\        V4      '       g   K  VNK  	  p	pV	'       d+   V'       g#   \        RP                  WV	^ ,          4      4      h. p
V'       d   V'       g   \        WR7      pV.p
\        W4      ;_uu_ 4        \        WVR7       RRR4       R# u upi   + '       g   i     R# ; i)z
Merge src into dst recursively by copying all files from src into dst.
Return a list of all files copied.

Like copytree(src, dst), but raises an error if merging the two trees
would overwrite any files.
zyCan't merge/copy source into subdirectory of itself.  Please create separate spaces for these things.
  src: {}
  dst: {}T)r   r   z'Can't merge {} into {}: file exists: {}rk   )r   N)r3   r4   r6   normcase
startswithrC   r   r   r7   rM   rr   )r   r   r   rE   rq   lockingclobber	new_filesrL   existingrh   s   &&&&&&&    r   
merge_treer   M  s    ''

277++C0
1C
''

277++C0
1C~~c"" 	 F3$	" HdCI$29aq	9H25<<SxPQ{S
 	
 EC1D	5	*	*H- 
+	* 3 
+	*	*s   8EE>EE,	c           
     &    \        V VVVRVVR7      # )z!
merge_tree() with locking=False
N)r   rE   rq   r   r   )r   )r   r   r   rE   rq   r   r   s   &&&&&&&r   merge_tree_nolockr   q  s&      r   c                 h   V P                  \        P                  P                  4      pVP                  \        P                  P                  4      pV'       d   VR,          VR,          8X  d	   VR VR K%  \        P                  P                  ! V!  \        P                  P                  ! V!  3# )   )splitr3   r4   sepr=   )r   r   ssplitdsplits   &&  r   get_prefix_replacement_pathsr     ss    YYrww{{#FYYrww{{#F
VBZ6":-2J2J77<< "'',,"777r   c           
     b   V'       Ed   \        V 4      '       Ed	    \        P                  ! \        P                  P	                  V4      4       \        P                  P                  V4      '       d   \        P                  ! V4       \        W4      w  rx\        P                  ! V 4      p	V	P                  Wx4      p
\        P                  ! W4        \        P                  ! V 4      p\        P                  ! VP                  4      p\        P                   ! W4       R# \#        V 4      '       d   \%        V VVVVVVR7       R# \#        V4      '       d?   \        P                  P'                  V\        P                  P)                  V 4      4      pMTp\        P                  P+                  V 4      '       d!   \        P                  P	                  V 4      pM\        P                  P,                  V9   d\   \        P                  P	                  V4      p\        P                  P#                  V4      '       g   \        P                  ! V4       M\        P.                  ! 4       p\        P                  P                  V 4      '       d[   \        P                  P1                  \        P                  P3                  V 4      4      '       g   \4        P7                  RV 4       R# V'       g   V'       d   \9        WR7      pV'       d   V.M. p\;        W4      ;_uu_ 4        \        P                  P	                  V4      pV'       d=   \        P                  P1                  V4      '       g    \        P                  ! V4        \=        W4       RRR4       R#   \
         d     ELai ; i    R# ; i  \
         d     L=i ; i  \>        P@                   d8    \4        PC                  R\        P                  P)                  T 4      T4        Li ; i  + '       g   i     R# ; i)z>Copy all the files and directories in src to the directory dst)rE   rq   r   r   z+path %s is a broken symlink - ignoring copyNrk   z"skipping %s - already exists in %s)"r   r3   r<   r4   dirnamer7   r   r   r   r   replacer   r   r   r   r   r   r   r   r=   basenamerP   r   getcwdr   realpathr]   warningrM   rr   r   ry   Errorr^   )r   r   rE   r   rq   r   r   src_basedst_base
src_targetsrc_replacedr   r   dst_fn
src_folderrh   
dst_folders   &&&&&&&          r   	copy_intor     s   
 xF3KK	KK,- 77??3IIcN9#C[[%
!))(=


<%	#B<<

+DIIc  
s	
 ::WW\\#rww'7'7'<=FF77==-Jww{{f$WW__V4
ww}}Z00KK
+YY[
77>>#rww~~bgg6F6Fs6K'L'LKKEsKJ8D!ru..-J"''.."<"<KK
+)#6 /.a  			R   << 		8"'':J:J3:OQT /..sh   3N# AN5 )AP7N=O#N21N25N:=OP
OPA	PPPPP.	c           
     &    \        V VVVRVVR7      # )z!
copy_into() with locking=False.
N)rE   r   rq   r   r   )r   )r   r   rE   r   rq   r   r   s   &&&&&&&r   copy_into_nolockr     s&      r   c           	           \         P                  ! W4       R#   \         dV     \        Y4       \        P
                  ! T 4        R#   \         d"    \        P                  R T  RT R24         R# i ; ii ; i) Failed to copy/remove path from rx    due to permission errorN)ry   mover}   r   r3   unlinkr]   r^   r   r   s   &&r   move_with_fallbackr     sm    	C 	cIIcN 	II23%tC5@XY 		&    A:!A

'A61A:5A66A:c           	          \         P                  ! W4       R#   \         dV     \        Y4       \        P
                  ! T 4        R#   \         d"    \        P                  RT  RT R24         R# i ; ii ; i)zK
Call shutil.move(src, dst) and try own implementation on PermissionError.
r   rx   r   N)ry   r   r}   r   r3   r   r]   r^   r   s   &&r   move_with_fallback_nolockr     sm    	C 	S&IIcN 	II23%tC5@XY 		r   )T)FT)  )r2   TFT)FNF)Fr   NTF)Fr   NFF)r   FNTF)r   FNFF))r   
contextlibr8   loggingr3   ry   r~   rl   r   os.pathr   r   r   r@   	getLoggerr	   r]   r%   rO   	Exceptionr   r   r   r4   
expanduserr=   r;   rM   rT   rZ   contextmanagerrr   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s       	     ) ) ! v3	 3&;B ##BGGLL6J$KLN@
9x ' 'ZQ."J!.H"8EP"
r   