
    \Zif                         S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	J
r
JrJrJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJrJr  \" \5      rS\4S jr \S 5       r!\S 5       r"g)z\Disk utility functions testing path properties (e.g., writable, hardlinks, softlinks, etc.).    )cache)	getLogger)W_OKaccess)basenamedirnameisdirisfilejoin)uuid4   )TRACE)expand)LinkType   )create_link)rm_rf)islinklexistsreturnc                 n   [        U 5      n [        R                  [        SU 5        [        [	        U 5      5      (       a;  [        U 5      n [        U S5      nUR                  5         U(       d  [        U 5        g[        U [        5      $ ! [         a  n[        R                  U5         S nAgS nAff = f)Nzchecking path is writable %sza+TF)r   logr   r	   r   r   opencloser   OSErrordebugr   r   )pathpath_existedfhes       8lib/python3.13/site-packages/conda/gateways/disk/test.pyfile_path_is_writabler"      s    $<DGGE148WT]t}		dD!B
 HHJd dD!!  	IIaL	s   B 
B4B//B4c           
         [        US[        U 5       S[        [        5       5      S S  35      n[	        U 5      (       d  [        SU  S35      e[        U5      (       d  [        SU S35      e[        U5      (       a  [        U5        [        U5      (       a  [        U S35      e [        X[        R                  SS	9  [        U5      (       + nU(       a  [        R                  [        S
X5        O[        R                  [        SX5        U[        U5        $ ! [
         a)    [        R                  [        SX5         [        U5        gf = f! [        U5        f = f)N.tmp..   Path  is not a file is not a directoryz should not exist anymoreTforcez hard link supported for %s => %sz'hard link IS NOT supported for %s => %sF)r   r   strr   r
   r   r	   r   r   r   r   hardlinkr   r   r   )source_filedest_dir	test_fileis_supporteds       r!   hardlink_supportedr2   )   s2   Xx'<&=Qs57|BQ?O>PQRI+k].9::??hZ':;<<yiy#<=>> 	KH,=,=TJ!),,GGE={UGG@+ 
 	i	  @+Xi	 	is%   (A(D %EE EE Ec                    [         R                  [        SX5        [        US[        U 5      -   5      n[	        U 5      (       d  [        SU  S35      e[        U5      (       d  [        SU S35      e[        U5      (       a  [        U S35      e [        X[        R                  SS9  [        U5      [        U5        $ ! [
         a     [        U5        g	f = f! [        U5        f = f)
Nz*checking soft link capability for %s => %sr$   r'   r(   r)   z should not existTr*   F)r   r   r   r   r
   r   r	   r   r   r   softlinkr   r   )r.   r/   	test_paths      r!   softlink_supportedr6   G   s     GGE?WXw+)>>?I+k].9::??hZ':;<<y#4566KH,=,=TJi  	i  i 	is$   #C   
C
C CC C(N)#__doc__	functoolsr   loggingr   osr   r   os.pathr   r   r	   r
   r   uuidr   common.constantsr   common.pathr   models.enumsr   creater   deleter   linkr   r   __name__r   boolr"   r2   r6        r!   <module>rG      sm    c    : :  % ! $   !"4 "(  :  rF   