
    <hQ:                       S SK Jr  S SKJr  S SKJr  S SKJr  S SK	r	S SK
r
S SKrSSKJrJrJr  SSKJr  SS	KJrJrJrJr  SS
KJrJrJrJr  SSKJrJrJrJ r J!r!  SSK"J#r#J$r$J%r%J&r&J'r'J(r(  \RR                  (       a<  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/J0r0  S SK1J2r2   " S S\25      r3 " S S\25      r4 " S S\5      r5SS jr6g)    )annotations)sep)PathN   )ExtensionModuleModuleReturnValue
ModuleInfo   )mlog)BuildTargetCustomTargetCustomTargetIndexInvalidArguments)
INSTALL_KWINSTALL_MODE_KWINSTALL_TAG_KWNoneType)
FeatureNew	KwargInfotyped_kwargstyped_pos_argsnoKwargs)FileMesonExceptionhas_path_sep
is_windowspath_is_in_rootrelpath)ModuleState)BuildTargetTypes)Interpreter)TYPE_kwargs)FileOrStringFileMode)	TypedDictc                  $    \ rS rSr% SrS\S'   Srg)
ReadKwArgs   zKeyword Arguments for fs.read.strencoding N__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r+       v/mnt/mint/home/seanl/mnt/public/Repos/ladybird/Build/vcpkg/downloads/tools/meson-1.9.0-d1fcc2/mesonbuild/modules/fs.pyr'   r'      s
    ,r4   r'   c                  B    \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   S
rg)CopyKw!   zKwargs for fs.copyboolinstallzT.Optional[str]install_dirr$   install_modeinstall_tagr+   Nr,   r+   r4   r5   r7   r7   !   s     $$$$r4   r7   c                    ^  \ rS rSr\" SS5      rS7U 4S jjrS8S jr\S9S j5       r	S8S jr
\\" SS	5      \" S\5      S:S
 j5       5       5       r\\" SS	5      \" S\\45      S;S j5       5       5       r\\" SS	5      \" S\5      S:S j5       5       5       r\\" S\5      S<S j5       5       r\\" S\\45      S;S j5       5       r\\" S\5      S<S j5       5       r\\" S\5      S<S j5       5       r\\" S\\4\5      S=S j5       5       r\\" S\\45      S>S j5       5       r\\" S\\4\\45      S?S j5       5       r\\" S\\\\\4\5      S@S j5       5       r\\" S\\\\\45      SAS  j5       5       r\\" S!\\\\\45      SAS" j5       5       r\\" S#\\\\\45      \" S#S	5      SAS$ j5       5       5       r \\" S%\\\\\45      \" S%S&5      SAS' j5       5       5       r!\" S(S)5      \" S(\\45      \"" S(\#" S*\S+S,95      SBS- j5       5       5       r$\" S.S/5      \" S.\\4\/S09\"" S.\%\&\'\#" S1\\(45      5          SCS2 j5       5       5       r)\" S3S45      \" S3\\\\\4\\\\\45      \SDS5 j5       5       5       r*S6r+U =r,$ )EFSModule+   fsz0.53.0c                0  > [         TU ]  U5        U R                  R                  0 SU R                  _SU R
                  _SU R                  _SU R                  _SU R                  _SU R                  _SU R                  _SU R                  _S	U R                  _S
U R                  _SU R                  _SU R                  _SU R                   _SU R"                  _SU R$                  _SU R&                  _SU R(                  _SU R*                  0E5        g )Nas_posixcopyfileexists
expanduserhashis_absoluteis_diris_fileis_samepath
is_symlinknameparentreadrelative_toreplace_suffixsizestemsuffix)super__init__methodsupdaterC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   )selfinterpreter	__class__s     r5   rV   FSModule.__init__/   sK   % 


 dkk
 $//	

 DII
 4++
 dkk
 t||
 4++
 $//
 DII
 dkk
 DII
 4++
 d11
  DII!
" DII#
$ dkk%
 	r4   c                8   [        U[        5      (       a4  UR                  UR                  UR                  R                  5       5      $ [        R                  R                  UR                  UR                  [        R                  R                  U5      5      $ )zH
make an absolute path from a relative path, WITHOUT resolving symlinks
)
isinstancer   absolute_pathsource_rootenvironmentget_build_dirospathjoinsubdirrF   )rY   stateargs      r5   _absolute_dirFSModule._absolute_dirF   sj     c4  $$U%6%68I8I8W8W8YZZww||E--u||RWW=O=OPS=TUUr4   c                j   [        U[        5      (       a  U$ [        U[        5      (       a<  [        U  S3S5      R	                  UR
                  UR                  S9  [        U5      $ [        U  S3S5      R	                  UR
                  UR                  S9  UR                  R                  U5      $ )Nz
 with file0.59.0locationz+ with build_tgt, custom_tgt, and custom_idxz1.4.0)	r^   r)   r   r   use
subprojectcurrent_nodebackendget_target_filename)feature_new_prefixobjrg   s      r5   _obj_to_pathstrFSModule._obj_to_pathstrN   s    c3Jc4  ,-Z8(CGGHXHXchcucuGvs8O())TUW^_ccdidtdt  @E  @R  @Rc  	S}}0055r4   c                    U R                  X5      n [        R                  R                  U5      nU$ ! [         a     U$ f = f)zk
resolves symlinks and makes absolute a directory relative to calling meson.build,
if not already absolute
)ri   rc   rd   realpath	Exception)rY   rg   rh   rd   s       r5   _resolve_dirFSModule._resolve_dirZ   sM    
 !!%-	77##D)D   		s   4 
AAzfs.expanduserz0.54.0c                F    [         R                  R                  US   5      $ Nr   )rc   rd   rF   rY   rg   argskwargss       r5   rF   FSModule.expanduserh   s     ww!!$q'**r4   zfs.is_absolutec                   US   n[        U[        5      (       a9  [        SS5      R                  UR                  UR
                  S9  [        U5      n[        5       (       aU  US S R                  [        [        5      nUR                  [        S-  5      =(       d    UR                  S[        -   S5      $ UR                  [        5      $ )	Nr   zfs.is_absolute with filerl   rm      r
   :r   )r^   r   r   ro   rp   rq   r)   r   replaceposixsepntsep
startswithrY   rg   r   r   rd   s        r5   rH   FSModule.is_absoluten   s     AwdD!!18<@@AQAQ\a\n\n@ot9D<<8##He4D??519-Pua1PPx((r4   zfs.as_posixc                <    US   R                  [        [        5      $ )z
this function assumes you are passing a Windows path, even if on a Unix-like system
and so ALL '\' are turned to '/', even if you meant to escape a character
r   )r   r   r   r   s       r5   rC   FSModule.as_posix|   s     Awuh//r4   z	fs.existsc                d    [         R                  R                  U R                  XS   5      5      $ r~   )rc   rd   rE   r{   r   s       r5   rE   FSModule.exists   &     ww~~d//Aw?@@r4   zfs.is_symlinkc                    [        US   [        5      (       a.  [        SS5      R                  UR                  UR
                  S9  [        R                  R                  U R                  XS   5      5      $ )Nr   zfs.is_symlink with filerl   rm   )
r^   r   r   ro   rp   rq   rc   rd   islinkri   r   s       r5   rL   FSModule.is_symlink   s_     d1gt$$0(;??@P@P[`[m[m?nww~~d00Q@AAr4   z
fs.is_filec                d    [         R                  R                  U R                  XS   5      5      $ r~   )rc   rd   isfiler{   r   s       r5   rJ   FSModule.is_file   r   r4   z	fs.is_dirc                d    [         R                  R                  U R                  XS   5      5      $ r~   )rc   rd   isdirr{   r   s       r5   rI   FSModule.is_dir   s&     ww}}T..u1g>??r4   zfs.hashc           	        [        US   [        5      (       a.  [        SS5      R                  UR                  UR
                  S9  U R                  XS   5      n[        R                  R                  U5      (       d  [        U S35      e [        R                  " US   5      n[        R                   " SR                  US   U[        R"                  " U5      R$                  5      5        ['        US	SS
9 nUR)                  UR+                  5       5        S S S 5        UR-                  5       $ ! [         a    [        SR                  US   5      5      ef = f! , (       d  f       UR-                  5       $ = f)Nr   zfs.hash with filerl   rm   z- is not a file and therefore cannot be hashedr   z"hash algorithm {} is not availablez$computing {} sum of {} size {} bytesrb)mode	buffering)r^   r   r   ro   rp   rq   r{   rc   rd   r   r   hashlibnew
ValueErrorformatr   debugstatst_sizeopenrX   rO   	hexdigest)rY   rg   r   r   filehfs          r5   rG   FSModule.hash   s9    d1gt$$*H599%:J:JUZUgUg9h  Q0ww~~d## D6)V!WXX	WDG$A 	

9@@a$PRPWPWX\P]PePefg$TQ/1HHQVVX 0{{}  	W !E!L!LTRSW!UVV	W 0/{{}s   D2 : E2(E
E:zfs.sizec                   [        US   [        5      (       a.  [        SS5      R                  UR                  UR
                  S9  U R                  XS   5      n[        R                  R                  U5      (       d  [        U S35      e [        R                  " U5      R                  $ ! [         a    [        SR                  US   5      5      ef = f)Nr   zfs.size with filerl   rm   z, is not a file and therefore cannot be sizedz{} size could not be determined)r^   r   r   ro   rp   rq   r{   rc   rd   r   r   r   r   r   r   )rY   rg   r   r   r   s        r5   rR   FSModule.size   s     d1gt$$*H599%:J:JUZUgUg9h  Q0ww~~d## D6)U!VWW	T774=((( 	T !B!I!I$q'!RSS	Ts   B. .(Czfs.is_samepathc                   [        US   [        5      (       d  [        US   [        5      (       a.  [        SS5      R                  UR                  UR
                  S9  U R                  XS   5      nU R                  XS   5      n[        R                  R                  U5      (       d  g[        R                  R                  U5      (       d  g [        R                  R                  XE5      $ ! [         a     gf = f)Nr   r   zfs.is_samepath with filerl   rm   F)r^   r   r   ro   rp   rq   r{   rc   rd   rE   samefileOSError)rY   rg   r   r   file1file2s         r5   rK   FSModule.is_samepath   s     d1gt$$
47D(A(A18<@@AQAQ\a\n\n@o!!%a1!!%a1ww~~e$$ww~~e$$	77##E11 		s   C1 1
C>=C>fs.replace_suffixc                    US   (       a+  US   R                  S5      (       d  [        SUS   < 35      eU R                  SUS   U5      n[        R                  R                  U5      S   US   -   $ )Nr   .zInvalid suffix r   r   )r   r   rv   rc   rd   splitextr   s        r5   rQ   FSModule.replace_suffix   sq     747--c22tAwk:;;##$7a%Hww%a(4722r4   	fs.parentc                    U R                  SUS   U5      n[        R                  R                  U5      S   =(       d    S$ )Nr   r   r   )rv   rc   rd   splitr   s        r5   rN   FSModule.parent   s9     ##Ka%@ww}}T"1%,,r4   fs.namec                l    U R                  SUS   U5      n[        R                  R                  U5      $ Nr   r   )rv   rc   rd   basenamer   s        r5   rM   FSModule.name   s1     ##ItAw>ww%%r4   zfs.stemc                    U R                  SUS   U5      n[        R                  R                  [        R                  R	                  U5      5      S   $ r   )rv   rc   rd   r   r   r   s        r5   rS   FSModule.stem   sE     ##ItAw>ww 0 0 67::r4   	fs.suffixz1.9.0c                r    U R                  SUS   U5      n[        R                  R                  U5      S   $ )Nr   r   r   )rv   rc   rd   r   r   s        r5   rT   FSModule.suffix   s6     ##Ka%@ww%a((r4   zfs.readz0.57.0r*   zutf-8)defaultc                   US   nUS   nUR                   R                  nUR                  nUR                   R                  5       n[	        U[
        5      (       aJ  UR                  (       a  [        S5      e[        R                  R                  XdR                  5       5      nOEU(       a  [        R                  R                  Xg5      n[        R                  R                  Xd5      n[        R                  R                  U5      n[        [        U5      [        U5      SS9(       a  [        S5      e [        XES9 n	U	R!                  5       n
SSS5        U R&                  R)                  U5        W
$ ! , (       d  f       N+= f! ["         a    [        S	US    S
35      e[$         a    [        SUS    35      ef = f)a  Read a file from the source tree and return its value as a decoded
string.

If the encoding is not specified, the file is assumed to be utf-8
encoded. Paths must be relative by default (to prevent accidents) and
are forbidden to be read from the build directory (to prevent build
loops)
r   r*   z-fs.read does not accept built files() objectsT)resolvez"path must not be in the build tree)r*   NzFile z does not exist.zdecoding failed for )ra   
source_dirrf   rb   r^   r   is_builtr   rc   rd   re   relative_nameabspathr   r   r   rO   FileNotFoundErrorUnicodeDecodeErrorrZ   add_build_def_file)rY   rg   r   r   rd   r*   src_dirsub_dir	build_dirr   datas              r5   rO   FSModule.read   sl    Aw*%##..,,%%335	dD!!}}$CE E77<<););)=>D'',,w877<<.Dwwt$4:tIE !EFF	Cd.!vvx / 	++D1 /.  	D 5a	1A!BCC! 	C #7Qy!ABB	Cs*   8	F E7F 7
FF F 7F?zfs.copyfilez0.64.0)optargsr;   c                   US   (       a  US   (       d  [        S5      eU R                  R                  US   /5      S   nUS   (       a  US   O([        R                  R                  UR                  5      n[        U5      (       a  [        S5      e[        UUR                  UR                  UR                  UR                  R                  5       / SQ-   U/U/SUS   US   /US	   US
   /UR                  SS9n[        Xf/5      $ )z3Copy a file into the build directory at build time.r:   r;   z6"install_dir" must be specified when "install" is truer   r   z-Destination path may not have path separators)z
--internalcopyz@INPUT@z@OUTPUT@Tr<   r=   zCopying file {})build_by_defaultr:   r;   r<   r=   rr   description)r   rZ   source_strings_to_filesrc   rd   r   fnamer   r   rf   rp   ra   get_build_commandrr   r   )rY   rg   r   r   srcdestcts          r5   rD   FSModule.copyfile  s    )VM%:"#[\\66QyA!D q'tAwrww'7'7		'B"#RSSLL//14aaEF!9%.//./MM)
" !T**r4   zfs.relative_toz1.3.0c                V   ^ SU4S jjnU" US   5      nU" US   5      n[        XV5      $ )Nc                  > [        U [        5      (       a:  U R                  TR                  R                  TR                  R
                  5      $ [        U [        [        [        45      (       a  TR                  R                  U 5      $ [        R                  R                  TR                  R                  TR                  U 5      $ N)r^   r   r_   ra   r   r   r   r   r   rr   get_target_filename_absrc   rd   re   rf   )rh   rg   s    r5   to_path%FSModule.relative_to.<locals>.to_pathF  s    #t$$(():):)E)EuGXGXGbGbccC,0A;!OPP}}<<SAAww||E$5$5$@$@%,,PSTTr4   r   r   )rh   zCT.Union[FileOrString, CustomTarget, CustomTargetIndex, BuildTarget]returnr)   )r   )rY   rg   r   r   r   tr   s    `     r5   rP   FSModule.relative_toB  s1    	U DGDGq}r4   r+   )rZ   r!   r   None)rg   r   rh   r#   r   r)   )rt   r)   ru   z'T.Union[FileOrString, BuildTargetTypes]rg   r   r   r)   )rg   r   r   T.Tuple[str]r   T.Dict[str, T.Any]r   r)   )rg   r   r   T.Tuple[FileOrString]r   r   r   r9   )rg   r   r   r   r   r   r   r9   )rg   r   r   zT.Tuple[FileOrString, str]r   r   r   r)   )rg   r   r   r   r   r   r   int)rg   r   r   z#T.Tuple[FileOrString, FileOrString]r   r   r   r9   )rg   r   r   z5T.Tuple[T.Union[FileOrString, BuildTargetTypes], str]r   r   r   r)   )rg   r   r   z0T.Tuple[T.Union[FileOrString, BuildTargetTypes]]r   r   r   r)   )rg   r   r   r   r   r'   r   r)   )rg   r   r   z&T.Tuple[FileOrString, T.Optional[str]]r   r7   r   r   )rg   r   r   zYT.Tuple[T.Union[FileOrString, BuildTargetTypes], T.Union[FileOrString, BuildTargetTypes]]r   r"   r   r)   )-r-   r.   r/   r0   r	   INFOrV   ri   staticmethodrv   r{   r   r   r   r)   rF   r   rH   rC   rE   rL   rJ   rI   rG   rR   rK   r   r   r   rQ   rN   rM   rS   rT   r   r   rO   r   r   r   r   rD   rP   r3   __classcell__)r[   s   @r5   r?   r?   +   s   dH%D.V 	6 	6 *OS)+ * + +  (+$sDk2	) 3 , 	) x(M3'0 ( ) 0 K%A & A Oc4[1B 2 B
 L#&A ' A K%@ & @ IT{C0 1  IT{+	T , 	T $sDkC;? @  '#t\CTVa)bdgh3 i 3 K#t\;Lk!Z[- \ - IT<9JKXY& Z & IT<9JKXY	8$; % Z ; K#t\;Lk!Z[W%) & \ ) 	8$IT{+)Yz3HI' J , %'R x(MD#;>-#x1++$5+ ? )+B  '*$sD,@QS^&_begkmy  |M  OZ  b[  \  \ +r4   r?   c                     [        U 0 UD6$ r   )r?   )r   r   s     r5   
initializer   T  s    T$V$$r4   )r   T.Anyr   r   r   r?   )7
__future__r   ntpathr   r   pathlibr   	posixpathr   r   rc   typingT r   r   r	   r   buildr   r   r   r   interpreter.type_checkingr   r   r   r   interpreterbaser   r   r   r   r   mesonlibr   r   r   r   r   r   TYPE_CHECKINGr   r    rZ   r!   r"   r#   r$   typing_extensionsr%   r'   r7   r?   r   r+   r4   r5   <module>r     s    #   %  	  < <  R R ] ] [ [ _ _??()-1+Y 
% %f fR	%r4   