
    <h#F                    8   S SK Jr  S SKrS SK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  SSKJrJrJr  SSKJr  SS	K	Jr  SS
KJrJrJrJrJrJr  SSKJrJ r J!r!  \RD                  (       a  SSK
J#r#  SSKJ$r$  SSK%J&r&  / SQr' " S S5      r( " S S\5      r)g)    )annotationsN   )	compilersenvironmentmesonliboptions)
ExecutableJarSharedLibrarySharedModuleStaticLibrary)detect_compiler_for)InvalidArguments
SubProjectUnknownValue)MachineChoice)	OptionKey)BaseNode	ArrayNodeElementaryNodeIdNodeFunctionNode
StringNode   )AstInterpreterIntrospectionBuildTargetIntrospectionDependency)BuildTarget)TYPE_var)
AstVisitor)
executablejarlibraryshared_libraryshared_modulestatic_libraryboth_librariesc                  (    \ rS rSrSS jrSS jrSrg)IntrospectionHelper!   c                H    Ub  U/O/ U l         / U l        0 U l        / U l        g N)
cross_filenative_filecmd_line_optionsprojectoptions)selfr-   s     }/mnt/mint/home/seanl/mnt/public/Repos/ladybird/Build/vcpkg/downloads/tools/meson-1.9.0-d1fcc2/mesonbuild/ast/introspection.py__init__IntrospectionHelper.__init__#   s*    *4*@:,b(*8:+-    c                    [         $ r,   )NotImplemented)r1   others     r2   __eq__IntrospectionHelper.__eq__)   s    r5   )r/   r-   r.   r0   N)r-   T.Optional[str])r8   objectreturnbool)__name__
__module____qualname____firstlineno__r3   r9   __static_attributes__ r5   r2   r)   r)   !   s    .r5   r)   c                  &  ^  \ rS rSrSS\" S5      SS4               SU 4S jjjrSS jrSS jrSS jrSS	 jr	SS
 jr
S S jrS!S jrS!S jrS!S jrS!S jrS!S jrS!S jrS!S jrS!S jrS!S jrS"S jrS#S jrS$S jrS%S&S jjrSrU =r$ )'IntrospectionInterpreter,   N subprojectsc	                  > [        U5      n	U=(       d    [        R                  " US U	5      n
[        TU ]  XXgXS9  XPl        X0l        0 U l        / U l        / U l	        S U l
        U R                  R                  U R                  U R                  U R                  U R                   U R"                  U R$                  U R&                  U R(                  U R*                  U R,                  S.
5        g )N)visitors)
add_languages
dependencyr!   r"   r#   projectr$   r%   r&   r'   )r)   r   Environmentsuperr3   r-   backendproject_datatargetsdependenciesproject_nodefuncsupdatefunc_add_languagesfunc_dependencyfunc_executablefunc_jarfunc_libraryfunc_projectfunc_shared_libfunc_shared_modulefunc_static_libfunc_both_lib)r1   source_rootsubdirrQ   rK   r-   
subprojectsubproject_direnvr   env_	__class__s              r2   r3   !IntrospectionInterpreter.__init__2   s     &j1Ik--k4Ij$b$029;=?*.

!44....==(((("22!44"22"00
 	r5   c                   U R                   (       a  [        S5      e[        U[        5      (       d   eXl         [	        U5      S:  a  [        S5      eSS jnSSS jjnUS   nUR                  SS5      n[        U[        5      (       a  UR                  n[        U[        5      (       d  SnU R                  USS  5      nU" UR                  S	S 5      5      =(       d    S
/n	U" UR                  SS 5      5      =(       d    / n
XgXS.U l
        U R                  5         U R                  5       (       dR  SU;   aL  US   n[        U[        5      (       a2  [        UR                  [        5      (       d   eUR                  U l        U R                  5       (       d  / U R                  S'   [        R                   R#                  U R$                  U R                  5      n[        R                   R'                  U5      (       az  [        R(                  " U5       H`  n[        R                   R'                  [        R                   R#                  X5      5      (       d  MF  U R+                  [-        U5      5        Mb     U R.                  R1                  U R2                  5        U R4                  R6                  R9                  5        VVs0 s H=  u  pU R4                  R.                  R:                  R=                  U5      (       d  M;  X_M?     nnnU R.                  R?                  U5        U RA                  US[B        RD                  5        U RA                  US[B        RF                  5        g s  snnf )NzSecond call to project()r   zCNot enough arguments to project(). Needs at least the project name.c                   [        U [        5      (       aS  / nU R                  R                   H5  n[        U[        5      (       d    g UR                  UR                  5        M7     U$ [        U [        5      (       a  U R                  /$ g r,   )
isinstancer   args	argumentsr   appendvalue)nodervs      r2   	_str_list8IntrospectionInterpreter.func_project.<locals>._str_list[   sk    $	**,,A%a44#HHQWW% - $
++

|#r5   c                    0 nU  H%  n UR                  SS5      u  pEXR[	        U5      '   M'     U$ ! [         a    [        R                  " SU< S35      ef = f)N=r   zOption z, must have a value separated by equals sign.)split
ValueErrorr   MesonExceptionr   )r   rd   resultokeyrp   s         r2   create_options_dictBIntrospectionInterpreter.func_project.<locals>.create_options_dictg   sk    79Fo#$773?LS */y~&  M " o"11GA5@l2mnnos	   0&Ar   version	undefinedlicenseunknownlicense_files)descriptive_namer   r   r   re   rI   T)rq   zT.Anyr=   zT.Optional[T.List[str]])rH   )r   zT.List[str]rd   strr=   zT.Mapping[OptionKey, str])$rU   r   rl   r   lengetr   rp   r   flatten_argsrR   _load_option_fileis_subprojectr   re   ospathjoinrb   isdirlistdirdo_subprojectr   coredatainit_backend_optionsrQ   r   r   itemsoptstoreis_backend_optionset_options_add_languagesr   HOSTBUILD)r1   rq   rm   kwargsrt   r~   	proj_name	proj_vers
proj_langsproj_licenseproj_license_files	spdirnamesubprojects_dirikrs   r   s                    r2   r]   %IntrospectionInterpreter.func_projectS   s   "#=>>$---- t9q="#hii
		 G	JJy+6	i00!I)S))#I&&tABx0
 !It!<=L)&vzz/4'HIOR1:]i  P !!##(8F(B/0I)Z00!)//37777&/oo#!!##/1Dm, ggll4+;+;T=P=PQOww}}_--O4Aww}}RWW\\/%EFF**:a=9 5 	**4<<8$($4$4$<$<$B$B$D  A$DDAHXHXHaHaHjHjH|H|}~H414$D  A!!'*Jm.@.@AJm.A.AB	 As   	:M.M.c                
   [         R                  R                  U R                  R	                  5       U R
                  5      n[         R                  R                  X!5      n [        USU R                  U R                  XR
                  U R                  U R                  S9nUR                  5         XR                  S'   U R                  S==   UR                  /-  ss'   g ! [        R                  [        4 a     g f = f)NrH   )r-   rd   re   rf   rK   namerI   )r   r   r   r   get_source_dirre   rF   rQ   r-   rK   analyzerR   r   rz   RuntimeError)r1   dirnamesubproject_dir_abssubprsubis        r2   r   &IntrospectionInterpreter.do_subproject   s    WW\\$*:*:*I*I*KTM`M`a/9	+E2t||PTP_P_ls  EX  EX  ^b  ^n  ^n  y}  yF  yF  GDLLN(/f%m,1B1B0CC,''6 		s   #BC% %DDc                @   U R                  U5      nUR                  SS5      n[        U[        [        R
                  [        45      (       d   S5       e[        U[        R
                  5      (       a  UR                  5       nSU;   aS  UR                  SS5      nU R                  X$U(       a  [        R                  O[        R                  5        [        5       $ [        R                  [        R                  4 H  nU R                  X$U5        M     [        5       $ )NrequiredTfor mypynativeF)flatten_kwargsr   rl   r>   r   UserFeatureOptionr   
is_enabledr   r   r   r   )r1   rq   rm   r   r   r   for_machines          r2   rX   +IntrospectionInterpreter.func_add_languages   s    $$V,::j$/(T7+D+Dl$STT`V``Th 9 9::**,HvZZ%0Fv0C0CS`SeSef ~ !. 3 3]5G5GH##DK@  I~r5   c                   / nU R                  U5       H]  n[        U[        5      (       a  UR                  U5        M+  [        U[        5      (       d  MB  UR                  UR
                  5        M_     [        U[        R                  S9 H  nUR                  5       nX`R                  R                  U   ;  d  M1   [        U R                  XcSU R                  5      nU(       d  M]  U R                  R#                  XgU R                  5        M     g ! [        R                   a!    [        U[         5      (       d  U(       a  e  M  f = f)N)r}   T)r   rl   r   ro   r   rp   sortedr   
sort_clinklowerr   r   r   rd   r   rz   r   process_compiler_options)r1   	raw_langsr   r   langsllangcomps           r2   r   'IntrospectionInterpreter._add_languages   s    ""9-A!S!!QAz**QWW%	 . 5i&:&:;D::<D==22;??!.t/?/?TXZ^ZiZijD 4MM::4tW <
  .. !!(L99X !s   ?"D1E
	E
c           	        [        U[        5      (       d   eU R                  U5      nU R                  U5      nU(       d  g US   n[        U[        [
        45      (       d   eSU;   nUR                  SS5      nUR                  S/ 5      n[        U[        5      (       d  U/n[        S U 5       5      (       a  [        5       nOE[        S U 5       5      (       d   e[        R                  " [        R                  [           U5      n[        U[        [
        45      (       d   e[        UUUUUR                  S:  US9nU =R                   U/-  sl        U$ )	Nr   fallbackr   Tr   c              3  B   #    U  H  n[        U[        5      v   M     g 7fr,   )rl   r   .0els     r2   	<genexpr>;IntrospectionInterpreter.func_dependency.<locals>.<genexpr>   s     >gz"l++g   c              3  B   #    U  H  n[        U[        5      v   M     g 7fr,   )rl   r   r   s     r2   r   r      s     =Wrz"c**Wr   )r   r   r   has_fallbackconditionalrq   )rl   r   r   r   r   r   r   listanyallTcastListr>   r   condition_levelrT   )	r1   rq   rm   r   r   r   r   r   newdeps	            r2   rY   (IntrospectionInterpreter.func_dependency   s:   $----  &$$V,Aw$l 34444!V+::j$/**Y+'4((iG>g>>>"nG=W=====ffQVVC['2G(T<$89999(%,,q0 	fX%r5   c                n   [        U[        5      (       d   eU R                  U5      nU(       a  [        US   [        5      (       d
  [	        5       $ US   nU/n/ nSU;   a  U[
        R                  " US   5      -  nSU;   a  U[
        R                  " US   5      -  nU R                  US5      n[        UR                  R                  5      n	UR                  R                  SS  n
UR                  R                  R                  5        H?  u  p[        U[        5      (       d   eUR                  S:X  d  M.  U
R                  U5        MA     U	[        UR                  R                  5      :X  d   eS nUR                  R                  R                  5        H5  u  p[        U[        5      (       d   eUR                  S:X  d  M.  Ub   eUnM7     UR                  5        VVs0 s H   u  pXR                   ;   d  M  US;   d  M  X_M"     nnnUR                  5        VVs0 s H)  u  pU[        U["        5      (       a  UR                  OU_M+     nnnUR                  5        VVs0 s H  u  p[        U[$        5      (       a  M  X_M      nnnUR'                  SS5      (       a  [(        R*                  O[(        R,                  n/ n/ nSUS	'   U" XPR.                  U R0                  UUS UU R2                  U R4                  R6                  U   U5
      nUR9                  5         [;        UR=                  5       UR>                  RA                  5       URC                  5       URE                  5       [F        RH                  RK                  [F        RH                  RM                  U RN                  U R.                  [2        RP                  5      5      U R.                  URR                  URU                  5       URW                  5       U
UUUS
9nU =RX                  U/-  sl,        U$ s  snnf s  snnf s  snnf )Nr   sourcesextra_filesTr   >   installname_prefixbuild_alwaysbuild_by_defaultr   F_allow_no_sources)r   machineidtypename
defined_inrc   r   	installedoutputssource_nodesr   r   rq   )-rl   r   r   r   r   r   listifyr   r   rm   rn   r   r   r   rp   ro   known_kwargsr   r   r   r   r   r   rc   rd   r   r   r   process_compilers_later   get_basenamer   get_lower_case_nameget_idget_typenamer   r   normpathr   rb   build_filenamer   should_installget_outputsrS   )r1   rq   rm   
kwargs_rawtargetclassr   srcqueueextra_queuer   oldlenr   r   rs   extraf_nodeskwargs_reducedr   objectsempty_sourcestarget
new_targets                       r2   build_target%IntrospectionInterpreter.build_target   s   $----  &:d1gs33>!Aw&*V 
"((I)>??HJ&8++J},EFFK$$Z6TYY(()yy**12.II$$**,DAa((((ww)###A& - TYY001111II$$**,DAa((((ww-'#+++ 	 - ,2<<>  d>41QBZBZ=Z$_`  ec  `c$!$>  dYgYmYmYopYoQUQR!
1n(E(EQWW1LYop+9+?+?+Aa+A41TUW_I`$!$+Aa-3ZZ%-H-Hm))mN`N`!#').2*+T;;m]acj!--t}}/F/F{/SUce%%'-$$&&&::<}}((*ww''T5E5Et{{T_TnTn(op;;#44++-&&(%$
 	$9 dpas$   (P%P%	P%%0P++P1
P1c                    U R                   R                  R                  [        SU R                  S95      nUS:X  a  U R                  XU[        5      $ US:X  a  U R                  XU[        5      $ US:X  a  U R                  XU[        5      $ g )Ndefault_libraryrd   sharedstaticboth)r   r   get_value_forr   rd   r   r   r   )r1   rq   rm   r   r  s        r2   build_library&IntrospectionInterpreter.build_library   s    --00>>yIZgkgvgv?wxh&$$TGG($$TGG&$$TGGr5   c                0    U R                  XU[        5      $ r,   )r   r	   r1   rq   rm   r   s       r2   rZ   (IntrospectionInterpreter.func_executable*  s      VZ@@r5   c                0    U R                  XU[        5      $ r,   )r   r   r
  s       r2   r`   (IntrospectionInterpreter.func_static_lib-        V]CCr5   c                0    U R                  XU[        5      $ r,   r   r   r
  s       r2   r^   (IntrospectionInterpreter.func_shared_lib0  r  r5   c                0    U R                  XU[        5      $ r,   r  r
  s       r2   ra   &IntrospectionInterpreter.func_both_lib3  r  r5   c                0    U R                  XU[        5      $ r,   )r   r   r
  s       r2   r_   +IntrospectionInterpreter.func_shared_module6  s      V\BBr5   c                &    U R                  XU5      $ r,   )r  r
  s       r2   r\   %IntrospectionInterpreter.func_library9  s    !!$f55r5   c                0    U R                  XU[        5      $ r,   )r   r
   r
  s       r2   r[   !IntrospectionInterpreter.func_jar<  s      VS99r5   c                   SU;  a  g UR                  S5      n[        U[        5      (       a  UR                  nUS:X  a  U R	                  XU[
        5      $ US:X  a  U R	                  XU[        5      $ US:X  a  U R	                  XU[        5      $ US:X  a  U R	                  XU[        5      $ US:X  a  U R                  XU5      $ US:X  a  U R	                  XU[        5      $ g )Ntarget_typer!   r$   r&   r'   r#   r"   )
poprl   r   rp   r   r	   r   r   r  r
   )r1   rq   rm   r   r  s        r2   func_build_target*IntrospectionInterpreter.func_build_target?  s    &jj/k>22%++K,&$$TDD,,$$TGG,,$$TGG,,$$TGGI%%%d&99E!$$T==r5   c                     U R                   S:g  $ )NrH   r  r1   s    r2   r   &IntrospectionInterpreter.is_subprojectS  s    "$$r5   c                    U R                  5         U R                  5         U R                  5         U R                  5         g r,   )load_root_meson_filesanity_check_astparse_projectrunr   s    r2   r    IntrospectionInterpreter.analyzeV  s/    !!#
r5   c                   U R                   R                  (       d  gU R                   R                  S   n[        U[        5      (       d  gUR                  R
                  R                  5        HV  u  p#[        U[        5      (       d   S5       eUR                  S:X  d  M3  [        U[        5      (       d  MJ  UR                  s  $    g)zFast path to extract subproject_dir kwarg.
This is faster than self.parse_project() which also initialize options
and also calls parse_project() on every subproject.
Nr   r   re   )
astlinesrl   r   rm   r   r   r   rp   r   )r1   rN   kwvals       r2   extract_subproject_dir/IntrospectionInterpreter.extract_subproject_dir\  s    
 xx~~((..#'<00||**002GBb&))5:5)xx++c:..99$ 3 r5   c                   0 nUR                  5        Hh  u  pE[        U[        5      (       a  U R                  U5      nUb  XcU'   M4  M6  [        U[        [
        [        [        45      (       d	  U(       d  Md  XSU'   Mj     U$ r,   )r   rl   r   node_to_runtime_valuer   r>   intfloat)r1   r   include_unknown_argsflattened_kwargsr}   r,  resolveds          r2   r   'IntrospectionInterpreter.flatten_kwargso  sv    HC#x((55c:',4S) (C#tS%!899=Q=Q(+% '  r5   )rQ   r-   rT   rR   rU   re   rS   )rb   r   rc   r   rQ   r   rK   zT.Optional[T.List[AstVisitor]]r-   r;   rd   r   re   r   rf   z#T.Optional[environment.Environment])rq   r   rm   T.List[TYPE_var]r   T.Dict[str, TYPE_var]r=   None)r   r   r=   r9  )rq   r   rm   r7  r   r8  r=   r   )r   r7  r   zT.Union[bool, UnknownValue]r   r   r=   r9  )rq   r   rm   r7  r   r8  r=   z#T.Optional[IntrospectionDependency])
rq   r   rm   r7  r   r8  r   zT.Type[BuildTarget]r=   /T.Union[IntrospectionBuildTarget, UnknownValue])rq   r   rm   r7  r   r8  r=   r:  )r=   r>   )r=   r9  )r=   r;   )F)r   r8  r3  r>   r=   r8  )r?   r@   rA   rB   r   r3   r]   r   rX   r   rY   r   r  rZ   r`   r^   ra   r_   r\   r[   r  r   r   r-  r   rC   __classcell__)rh   s   @r2   rF   rF   ,   s     =A/3*4R.'4<@!  :	
 - ( "% : B?CB	X,:>@ADDDC6:(%&	  	 r5   rF   )*
__future__r   r   typingr   rH   r   r   r   r   buildr	   r
   r   r   r   r   interpreterbaser   r   r   r   r   mparserr   r   r   r   r   r   interpreterr   r   r   TYPE_CHECKINGr   r   visitorr    BUILD_TARGET_FUNCTIONSr)   rF   rD   r5   r2   <module>rE     sg    # 	  8 8 O O + H H $  [ [ Z Z??#*# 
	 	L ~ L r5   