+
    :1j.5                     J   R t ^ RIt^ RIHt ^ RIHt ^ RIHtH	t	 ^ RIH
t ^ RIHt ^RIHt ^RIHtHt R0t]! ]4      t]P,                  P.                  R	8H  t ^ R
IHt ]t]'       g   ^ RIHtHt ]t]tM^ RIHtH t  ]PB                  PD                  t#] PH                  ]#n%        ] PL                  ] PL                  ] PN                  .]#n(         ]PB                  PR                  t*] PH                  ]*n%        ] PL                  ] PL                  ] PV                  .]*n(        R t-R t.]-t].t]'       d	   ]'       g   ^ RIH/t/ ]t
]t]/t/R# ^ RI0t0^ RI1t1^ RIt^ RIH2t2H3t3H4t4H5t5H6t6HtH t  ^ RIH7t7 ^ RIH8t8 R t
R tRt9Rt:Rt;Rt<^ t=^t> ! R R]34      t?]2! ]?4      t@]PB                  P                  tB] P                  ]@3]Bn(        ] P                  ]Bn%        ]PB                  P                  tF] P                  ]@3]Fn(        ] P                  ]Fn%        ] P                  ! R14      P                  tI]PB                  P                  tK] PV                  ]Kn%        ] P                  3]Kn(        R tLR tM ! R R]0P                  4      tNR  tOR! tPR" tQR# tRR$ tSR% tT^tUR&tVR'tWR(tX]2! ] PV                  4      tY] PN                  tZ ! R) R*]34      t[]2! ][4      t\]PB                  P                  t^] P                  ] PV                  ] PV                  ]\] PV                  ] PV                  ] P                  3]^n(        ] P                  ]^n%        ]PB                  P                  t_] P                  3]_n(        ] P                  ]_n%        ^ R+IH`t`HataHbtbHctcHdtdHete  ! R, R-]34      tfR. t/]PB                  P                  tg] P                  ] PV                  ] PN                  ] PV                  ] PN                  ] PV                  ]Y]Z.]gn(        ] PH                  ]gn%        R2R/ lthR#   ] d    R t ELi ; i  ], d    Rt* ELi ; i)3a  Disk utility functions for symlinking files and folders.

Portions of the code within this module are taken from https://github.com/jaraco/jaraco.windows
which is MIT licensed by Jason R. Coombs.

https://github.com/jaraco/skeleton/issues/1#issuecomment-285448440
N)	getLogger)chmod)abspathisdir)islink)lexists)on_win)CondaOSError
ParseErrorpypy)lchmodc                 B    \        V 4      '       g   \        W4       R # R # N)r   os_chmod)pathmodes   &&8lib/python3.14/site-packages/conda/gateways/disk/link.pyr   r   !   s     d||T      )linksymlink)windllwintypesc                L    \        WR4      '       g   \        RV  RV 24      hR# )z;Equivalent to os.link, using the win32 CreateHardLink call.Nzwin32 hard link failed
  src: 
  dst: )CreateHardLinkr	   srcdsts   &&r   win_hard_linkr   ?   s-    c--!@YseTUU .r   c                    \         f   \        R4      h\        W\        V 4      4      '       g   \        RV  RV 24      hR# )zBEquivalent to os.symlink, using the win32 CreateSymbolicLink call.Nzwin32 soft link not supportedzwin32 soft link failed
  src: r   )CreateSymbolicLinkr	   r   r   s   &&r   win_soft_linkr!   D   sC    %>??!#E#J77!@YseTUU 8r   )readlink)POINTER	Structurebyrefc_uint64castr   r   )getcwd)isfilec                >    \        V 4      ;'       d    \        V 4      # )z(Determine if the given path is a symlink)is_reparse_point
is_symlinkr   s   &r   r   r   ^   s    %::*T*::r   c                 x    \        V 4      '       d   R # \        V 4      '       d   R # \        V 4      '       d   R # R# )TF)r   r   r)   r-   s   &r   r   r   b   s)    $<<;;$<<r   i  l     @ l    i   c            
       <  a  ] tR t^rt o R]P
                  3R]P                  3R]P                  3R]P                  3R]P
                  ^,          3R]P
                  ^,          3R]P                  ],          3R]P                  ^,          3.t	]
R	 4       tR
tV tR# )WIN32_FIND_DATAfile_attributescreation_timelast_access_timelast_write_timefile_size_wordsreservedfilenamealternate_filenamec                \    \        V P                  \        \        4      4      P                  # r   )r'   r5   r#   r&   contentsselfs   &r   	file_sizeWIN32_FIND_DATA.file_size~   s     ,,gh.?@IIIr    N)__name__
__module____qualname____firstlineno__r   DWORDFILETIMEWCHARMAX_PATH_fields_propertyr=   __static_attributes____classdictcell____classdict__s   @r   r0   r0   r   s     /h//0!2!23 1 12 23!+,(23!8>>B#67	
 
	J 
	Jr   r0   c                 (    V ^ 8X  d   \        4       hR# )    N)OSError)results   &r   handle_nonzero_successrR      s    Q;)O r   c           	     $   RpRpW,          pRpT p^ p\         P                  ! 4       p^ pRp	\        P                  P	                  VVVV\        V4      VV	4      p
\        V
4       VP                  p\        P                  P                  V4       V# )zZ
Call FormatMessage with a system error number to retrieve
the descriptive error message.
   i   N)	r   LPWSTRr   kernel32FormatMessageWr%   rR   value	LocalFree)errnoALLOCATE_BUFFERFROM_SYSTEMflagssource
message_idlanguage_idresult_bufferbuffer_size	argumentsbytesmessages   &           r   format_system_messagerf      s        -
 )	..- 
 	u%%%!!-0r   c                   b   a a ] tR t^t oRV 3R llt]R 4       t]R 4       tR tR t	Rt
VtV ;t# )WindowsErrorc                   < Vf   \         P                  P                  4       p\        V4      p^ VR V3p\        SV `  ! V!   R # r   )r   rV   GetLastErrorrf   super__init__)r<   rX   strerrorargs	__class__s   &&  r   rl   WindowsError.__init__   s?    }446,U3Hhe+DGd#r   c                    V P                   # r   )rm   r;   s   &r   re   WindowsError.message       == r   c                    V P                   # r   )winerrorr;   s   &r   codeWindowsError.code   rs   r   c                    V P                   # r   )re   r;   s   &r   __str__WindowsError.__str__   s    <<r   c                6    R P                   ! R/ \        4       B # )z*{self.__class__.__name__}({self.winerror})r?   )formatvarsr;   s   &r   __repr__WindowsError.__repr__   s    ?FFPPPr   r?   r   )r@   rA   rB   rC   rl   rI   re   rv   ry   r~   rJ   rK   __classcell__)ro   rM   s   @@r   rh   rh      sC     	$ 
	! 
	! 
	! 
	!	 	Q 	Qr   rh   c                 6    V P                   ^ ,          \        8H  # )rO   )r6   IO_REPARSE_TAG_SYMLINK)	find_datas   &r   _is_symlinkr      s    !!!$(>>>r   c                    V P                  R4      '       d   V # \        V 4      p V ^,          R8X  g   \        4       R,          V ,           p RV ,           # )a  
Paths have a max length of api.MAX_PATH characters (260). If a target path
is longer than that, it needs to be made absolute and prepended with
\\?\ in order to work with API calls.
See http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx for
details.
z\\?\::N   N)
startswithr   r(   r-   s   &r   _patch_pathr      sG     ??9%%Kt}Aw#~8B<$&D4r   c                v    \         P                  ! 4       P                  P                  pV P	                  V4      # )zFormat the string using variables in the caller's local namespace.

.. code-block:: pycon
    >>> a = 3
    >>> local_format("{a:5}")
    '    3'
)inspectcurrentframef_backf_locals
format_map)stringcontexts   & r   local_formatr      s/     &&(//88  ))r   c                    \        V 4      p  \        \        \        V 4      4      4      #   \         d   pRp\	        \        T4      4      hRp?ii ; i)z>Assuming path is a reparse point, determine if it's a symlink.z,Error accessing {path}: {orig_error.message}N)r   r   next
find_filesrP   r   )r   
orig_errortmpls   &  r   r,   r,      sK    4 	.tJt$4566 	.AD,t,--	.s   * AAAc              #  R  "   \        4       p\        V \        V4      4      p V\        8X  d   \	        4       hVx  \        4       p\        V\        V4      4      pV^ 8X  g   KB  \        4       pVP                  \        8X  d   MVh\        P                  P                  V4       R# 5i)a<  
A pythonic wrapper around the FindFirstFile/FindNextFile win32 api.
>>> root_files = tuple(find_files(r'c:\*'))
>>> len(root_files) > 1
True
>>> root_files[0].filename == root_files[1].filename
False
>>> # This test might fail on a non-standard installation
>>> 'Windows' in (fd.filename for fd in root_files)
True
N)r0   FindFirstFiler%   INVALID_HANDLE_VALUErP   FindNextFilerh   rv   ERROR_NO_MORE_FILESr   rV   	FindClose)specfdhandlereserrors   &    r   r   r      s      tU2Y/--iH "BvuRy1Cax$::!44K 	!!&)s   AB'$AB'c                f    \        V 4      pV\        8g  ;'       d    \        V\        ,          4      # )z
Determine if the given path is a reparse point.
Return False if the file does not exist or the file attributes cannot
be determined.
)GetFileAttributesINVALID_FILE_ATTRIBUTESboolFILE_ATTRIBUTE_REPARSE_POINT)r   r   s   & r   r+   r+     s6      %-- 
 
$..3
 	
r   i    i   i 	 c                   h    ] tR tRtR]P
                  3R]P                  3R]P                  33tRt	R# )SECURITY_ATTRIBUTESi%  lengthp_security_descriptorinherit_handler?   N)
r@   rA   rB   rC   r   rD   LPVOIDBOOLEANrH   rJ   r?   r   r   r   r   %  s/    x~~&$hoo6x//0
r   r   )Arrayc_bytec_ulongc_ushortcreate_string_buffersizeofc                   t   a  ] tR tRt o R]3R]3R]3R]3R]3R]3R]3R	]3R
]^,          3.	tR tR t	Rt
V tR# )REPARSE_DATA_BUFFERi@  tagdata_lengthr6   substitute_name_offsetsubstitute_name_lengthprint_name_offsetprint_name_lengthr]   path_bufferc                   \        \        P                  4      p\        P                  V P                  V,          ,          p\	        V P
                  V P                  4      p\        V\        V4      4      P                  P                  # r   )r   r   rF   r   r%   r   r   r'   r#   r:   rX   r<   
wchar_sizearr_typdatas   &   r   get_print_name"REPARSE_DATA_BUFFER.get_print_nameM  s_    /Jnn(>(>*(LMG))4+A+ABDgg./88>>>r   c                   \        \        P                  4      p\        P                  V P                  V,          ,          p\	        V P
                  V P                  4      p\        V\        V4      4      P                  P                  # r   )r   r   rF   r   r%   r   r   r'   r#   r:   rX   r   s   &   r   get_substitute_name'REPARSE_DATA_BUFFER.get_substitute_nameS  s_    /Jnn(C(Cz(QRG))4+F+FGDgg./88>>>r   r?   N)r@   rA   rB   rC   r   r   r   rH   r   r   rJ   rK   rL   s   @r   r   r   @  sg     GH%"%x0%x0 (+ (+gFQJ'

	?	? 	?r   r   c           	        \        V ^ ^ R\        \        \        ,          R4      pV\        8X  d   \        4       h\        V\        RR4      p\        V4      p\        V\        \        4      4      pVP                  pVP                  \        8X  g   \        RVP                  ,          4      h\!        \#        V4      4       VP%                  4       # )zcReturn a string representing the path to which the symbolic link points.

readlink(link) -> target
Ni (  z+Expected IO_REPARSE_TAG_SYMLINK, but got %d)
CreateFileOPEN_EXISTINGFILE_FLAG_OPEN_REPARSE_POINTFILE_FLAG_BACKUP_SEMANTICSr   rP   reparse_DeviceIoControlFSCTL_GET_REPARSE_POINTr   r'   r#   r   r:   r   r   r
   rR   CloseHandler   )r   r   r   rd   p_rdbrdbs   &     r   r"   r"   Y  s    
 (+EE
 )))O%f.EtUS$S)UG$789nnww00JSWWTUU{623&&((r   c           
      t   Ve   \        R4      h\        V\        4      '       d   \        V4      pVe   \	        V4      M^ p\	        V4      p\        V\
        4      '       g   \        R4      h\        P                  ! 4       p\        V VVVVVVV4      p\        V4       \        V4       VR VP                   # )Nz$overlapped handles not yet supportedzout_buffer must be Array)NotImplementedError
isinstanceintr   lenr   	TypeErrorr   rD   DeviceIoControlrR   rX   )	deviceio_control_code	in_buffer
out_buffer
overlappedin_buffer_sizeout_buffer_sizereturned_bytesr   s	   &&&&&    r   r   r     s     !%&LMMj#&&-j9J+4+@Yaj/*e,,677!)	
 	s#~.0N0011r   )r   r   r   r   r"   r   r   )i__doc__sysloggingr   osr   r   os.pathr   r   r   	os_islinkr   
os_lexistscommon.compatr   
exceptionsr	   r
   __all__r@   logimplementationnamePYPYr   	os_lchmodImportErrorr   r   ctypesr   r   rV   CreateHardLinkWr   BOOLrestypeLPCWSTRr   argtypesCreateSymbolicLinkWr    rD   AttributeErrorr   r!   r"   builtinsr   r#   r$   r%   r&   r'   r(   r)   rG   r   r   r   NULLr   r0   LPWIN32_FIND_DATAFindFirstFileWr   rU   HANDLEFindNextFileWr   r   rX   r   GetFileAttributesWr   rR   rf   rh   r   r   r   r,   r   r+   r   r   r   r   LPDWORDLPOVERLAPPEDr   LPSECURITY_ATTRIBUTESCreateFileWr   r   r   r   r   r   r   r   r   r   r   r?   r   r   <module>r     s       " ' ) # 2
H
&(
!&F  DG (__44N%]]N'//1A1A8??SN	"#__@@%-]]"NN'
#V
V DG 	4FGH RRR; H'(#( DJ) J   0OO22M&oo/@AM$OOM??00L%__.?@L#++L#??2.44:: ("*//!3!FQx,, Q0?  	*.*<	
 M#- !*%hnn%G??L
i 
 $$78,,JJ "J//--K$OO-K"**KUU?i ?2): oo55O	 O 'mmO2I  !!!:  "!"s%   P AP 
PP	P"!P"