
    <hH                       S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SK	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  SSKJrJr  SSKJr  SSKJr  SSKJr  \R2                  (       a;  S SKJr  S SKr " S S\R:                  \5      r\R>                  \ \RB                  4   r"SS jr#SS jr$ " S S\RJ                  5      r& " S S5      r'SS jr(SS jr)SS jr*S S jr+g)!    )annotationsN   )build)coredataoptions)environment)mesonlib)mintro)mlog)AstIDGeneratorIntrospectionInterpreter)MachineChoice)	OptionKey)OptionInterpreter)Protocolc                  4    \ rS rSr% S\S'   S\S'   S\S'   Srg)	
CMDOptions   strbuilddirbool
clearcachepager N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r       q/mnt/mint/home/seanl/mnt/public/Repos/ladybird/Build/vcpkg/downloads/tools/meson-1.9.0-d1fcc2/mesonbuild/mconf.pyr   r      s    r"   r   c                    [         R                  " U 5        U R                  SSSS9  U R                  SSSSS	9  U R                  S
SSSS9  U R                  S[         R                  S0 SS9  g )Nr   ?.)nargsdefaultz--clearcache
store_trueFz,Clear cached state (e.g. found dependencies))actionr(   helpz
--no-pagerstore_falser   z!Do not redirect output to a pager)r*   destr+   z-Ucmd_line_optionszRemove a subproject option.)r*   r-   r(   r+   )r   register_builtin_argumentsadd_argumentKeyNoneAction)parsers    r#   add_argumentsr3   *   s    ''/

#s;
|UK  M
]@  B
X%;%;BT^`:  <r"   c                    [        U [        5      (       a  [        U 5      R                  5       $ [        U [        5      (       a  SR                  S U  5       5      nSU S3$ U c  g[        U 5      $ )Nz, c              3  8   #    U  H  n[        U5      v   M     g 7fN)	stringify).0is     r#   	<genexpr>stringify.<locals>.<genexpr>8   s     0CqillCs   [] )
isinstancer   r   lowerlistjoin)valss     r#   r7   r7   4   s_    #t3x~~	C		II0C001#Qx	3xr"   c                      \ rS rSrSrg)ConfException@   r   N)r   r   r   r   r!   r   r"   r#   rF   rF   @   s    r"   rF   c                      \ rS rS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rg)ConfD   c                h   [         R                  R                  [         R                  R                  U5      5      U l        S[         R                  R                  U R                  5      U R                  4;   a.  [         R                  R                  U R                  5      U l        S U l        SU l        S U l	        / U l
        / U l        / U l        / U l        [        5       U l        [         R                  R!                  [         R                  R#                  U R                  S5      5      (       Ga.  [        R$                  " U R                  5      U l        U R                  R&                  R)                  5       U l        U R                  R&                  R,                  U l        SU l        U R,                  R0                  R3                  5        GH  u  p#Ub  [         R                  R5                  US   5      (       a  US   n[7        US5       n[8        R:                  " UR=                  5       5      R?                  5       nXcS   :w  a{  [A        U R,                  RB                  U5      nURE                  U5        U R,                  RB                  RG                  URH                  U5        XF4U R,                  R0                  U'   S S S 5        GM  [         R                  R#                  U R*                  S5      n[         R                  R5                  U5      (       d*  [         R                  R#                  U R*                  S	5      n[         R                  R5                  U5      (       a  [A        U R,                  RB                  U5      nURE                  U5        U R,                  RB                  RG                  URH                  U5        [7        US5       n[8        R:                  " UR=                  5       5      R?                  5       nS S S 5        UW4U R,                  R0                  U'   GMd  U R,                  RB                  RG                  0 U5        GM     g [         R                  RK                  [         R                  R#                  U R                  [&        RL                  5      5      (       a  [N        RP                  " 5          [         R                  R                  [         R                  R                  U R                  5      5      U l        [S        U R*                  S
S[U        5       /S9nURW                  5         S S S 5        WR,                  U l        SU l        g [Y        SU S35      e! , (       d  f       GM  = f! , (       d  f       GN= f! , (       d  f       N[= f)Nzmeson.build<   zmeson-privateFr   rbr   zmeson.optionszmeson_options.txtr>   ninja)visitorsTz
Directory zC is neither a Meson build directory nor a project source directory.)-ospathabspathrealpath	build_dirbasenamedirnamer   max_choices_line_lengthpending_sectionname_col	value_colchoices_col	descr_colsetall_subprojectsisdirrB   loadr	   get_source_dir
source_dirr   default_values_onlyoptions_filesitemsexistsopenhashlibsha1read	hexdigestr   optstoreprocessupdate_project_optionsr   isfilebuild_filenamer   
no_loggingr   r   analyzerF   )	selfrT   subconf_optionsopfilefophashoiintrs	            r#   __init__Conf.__init__E   s   )9)9))DERWW--dnn=t~~NNWW__T^^<DN
')$04)+*,,.*,+.577==dnnoFGGDNN3DJ"jj44CCEDO JJ22;;DM',D$
 &*]]%@%@%F%F%H!+|A0O0O)!_Ffd+q!(affh!7!A!A!C!!_4!24==3I3I3!OBJJv. MM22II"**VYZ@F?ODMM77< ,+  WW\\$//?KF77>>&11!#doo?R!Sww~~f--.t}}/E/EsK

6*..EEbjjRUV!&$/1%,\\!&&(%;%E%E%GF 0<BF;K33C8..EEb#N- &I. WW^^BGGLL9S9STUU""$''//"''2B2B4>>2R"S/WZhZjYkl # !MMDM'+D$*YK7z {||; ,+ 0/ #"s&   B6U>3VA;V#>
V	
V 	#
V1c                8    U R                   R                  5         g r6   )r   clear_cachers   s    r#   r~   Conf.clear_cache}   s    !!#r"   c                ~    U R                   (       a  g [        R                  " U R                  U R                  5        g r6   )rc   r   saverT   r   s    r#   r   	Conf.save   s$    ##dmmT^^4r"   c           	        [         R                  " SS9S   n[        US-  S5      nUSU-  -
  S-
  nX"X#S:  a  UOU4n[        U R                  U R
                  U R                  U R                  5       GH  n[        U5      (       d  [        R                  " S5        M,  US   (       a.  [        USS	 5      (       d  [        R                  " US   5        Md  SS
 jnU" US   US   5      nU" US   US   5      nU" US   US   5      n	U" US   US   5      n
[        R                  " XxXSS9 HC  n[        S5       Vs/ s H  oU   (       a  X   OSXL   -  PM     nn[        R                  " U6   ME     GM     g	s  snf )a  Do the actual printing.

This prints the generated output in an aligned, pretty form. it aims
for a total width of 160 characters, but will use whatever the tty
reports its value to be. Though this is much wider than the standard
80 characters of terminals, and even than the newer 120, compressing
it to those lengths makes the output hard to read.

Each column will have a specific width, and will be line wrapped.
)   r   )fallbackr            r   r>   Nc           
     $   [        U [        R                  5      (       a  U R                  OU nUR	                  S5      (       a  SOSn[
        R                  " X!US9n[        U [        R                  5      (       aG  [        R                  " SU Vs/ s H#  n[        R                  " XPR                  5      PM%     sn5      nO[        R                  " SU5      nU Vs/ s H   n[        U5      SU[        U5      -
  -  -   PM"     sn$ s  snf s  snf )Nr<    r>   )subsequent_indentzT.List[LOGLINE])r?   r   AnsiDecoratortext
startswithtextwrapwrapTcastcoder   len)r   widthrawindentwrapped_r9   wrappeds          r#   	wrap_text%Conf.print_aligned.<locals>.wrap_text   s    #-dD4F4F#G#GdiiT #s 3 3#==vN dD$6$677ff%6ck8lck^_9K9KAyy9Yck8lmGff%6AG BIIAAA!77II 9m
 Js   *D
'D   )	fillvalue   r   )r   LOGLINEr   intreturnzmlog.TV_LoggableList)shutilget_terminal_sizemaxziprY   rZ   r[   r\   anyr   log	itertoolszip_longestrange)rs   total_width_collast_columnfour_columnliner   namerC   choicedesclr9   re   s                 r#   print_alignedConf.print_aligned   sh    ..A!D;!#R(!QX.24aTRt~~t7G7GXDt99 Aws48}}a!J$ T!Wk!n5DDG[^4CtAwA7FT!Wk!n5D**4fbQINqRA13+??R%  RC YD Ss   ?E<c                    0 nUR                  5        HU  u  p4UR                  b%  U R                  R                  UR                  5        XBR	                  UR                  0 5      U'   MW     U$ r6   )re   
subprojectr^   add
setdefault)rs   optsresultkos        r#   split_options_per_subproject!Conf.split_options_per_subproject   s[    BDJJLDA||'$$((656allB/2 ! r"   c                   [        U[        R                  5      (       a"  SU R                  -  UR                  -   Ul        OSU R                  -  U-   nU R
                  R                  U5        U R                  R                  U5        U R                  R                  U5        U R                  R                  U5        g )Nr   )
r?   r   r   print_marginr   rY   appendrZ   r[   r\   )rs   r   valuechoicesdescrs        r#   	_add_lineConf._add_line   s    dD..//d///$));DI***T1DT"e$(e$r"   c           
        U R                  5         [        U5      n[        U5      nU R                  [        R                  " [        UR                  S S95      5      [        R                  " U5      [        R                  " U5      U5        g )N)r   )	_add_sectionr7   r   r   greenr   evolveyellowblue)rs   keyr   r   r   s        r#   
add_optionConf.add_option   sc    % G$tzz#cjjDj&A"BCT[[QVEWyy)5	2r"   c           	        U R                  5         [        R                  " U5      n[        R                  " S5      n[        R                  " U R                  (       a  SOS5      n[        R                  " S5      nU R	                  SSSS5        U R	                  X$XS5        U R	                  S[        U5      -  S[        U5      -  S[        U5      -  S[        U5      -  5        g )NDescriptionzDefault ValuezCurrent ValuezPossible Valuesr>   -)r   r   cyanrc   r   r   )rs   titlenewtitler   r   r   s         r#   	add_titleConf.add_title   s    99U#		-(		T-E-E/?[))-.r2r2&x7sS]*C#e*,<cCL>PRUX[\aXbRbcr"   c                    U R                   (       d  g SU l        U R                  SSSS5        U R                  [        R                  " U R                   S-   5      SSS5        SU l        S U l         g )Nr   r>   :r   )rX   r   r   r   normal_yellowr   s    r#   r   Conf._add_section   s`    ##r2r2&t))$*>*>*DEr2rR#r"   c                    Xl         g r6   )rX   )rs   sections     r#   add_sectionConf.add_section   s    &r"   c                    U(       d  g U(       a  U R                  U5        [        UR                  5       5       H?  u  p4UR                  5       nU R	                  X4R
                  XTR                  5       5        MA     g r6   )r   sortedre   printable_valuer   descriptionprintable_choices)rs   r   r   r   r   r   s         r#   print_optionsConf.print_options   sY    NN5!4::<(DA//1O OOA}}o?R?R?TU )r"   c           
     r   U(       a  [         R                  " 5         SS jnU R                  (       a  U" 5         [         R                  " S5        [         R                  " S5        [         R                  " SU R                  5        U R                  (       d!  [         R                  " SU R
                  5        [        [        R                  5      n[        S5      [        S5      1n0 n0 n0 n[        R                  " [        5      nU R                  R                  R                  R                  5        H  u  pX;   a  XU	'   M  X;   a  XU	'   M  U	R!                  5       (       aE  U	R#                  5       nU R$                  (       a  XR$                  R&                  ;  a  Ml  XU   U	'   Mu  U R                  R                  R)                  U	5      (       d  M  XU	'   M     U R+                  UR                  5        V	V
s0 s H&  u  pU	R,                  [.        R0                  L d  M$  X_M(     sn
n	5      nU R+                  UR                  5        V	V
s0 s H&  u  pU	R,                  [.        R2                  L d  M$  X_M(     sn
n	5      nU R+                  U R                  R                  R                  5        V	V
s0 s HR  u  pU R                  R                  R5                  U	5      (       d  M1  U	R,                  [.        R0                  L d  MP  X_MT     sn
n	5      nU R+                  U R                  R                  R                  5        V	V
s0 s HR  u  pU R                  R                  R5                  U	5      (       d  M1  U	R,                  [.        R2                  L d  MP  X_MT     sn
n	5      nU R+                  U R                  R                  R                  5        V	V
s0 s H3  u  pU R                  R                  R7                  U	5      (       d  M1  X_M5     sn
n	5      nU R                  =(       d$    U R$                  R8                  R;                  5       nU R=                  S5        U R?                  S	US    5        U(       a  U(       a  U R?                  SUS    5        U R?                  S
U R                  R                  R                  5        V	V
s0 s H3  u  pU R                  R                  RA                  U	5      (       d  M1  X_M5     sn
n	5        U R?                  SU R                  R                  R                  5        V	V
s0 s H3  u  pU R                  R                  RC                  U	5      (       d  M1  X_M5     sn
n	5        U R?                  SURE                  S 0 5      5        U(       a"  U R?                  SURE                  S 0 5      5        UR                  5        H  u  nnU R?                  U S3U5        M     U R?                  SU5        U R?                  SU5        U R?                  SURE                  S0 5      5        [G        U RH                  5       H  nUS:X  a  U R=                  S5        OU R=                  SU-   5        UU;   a  U R?                  S	UU   5        UU;   a  U(       a  U R?                  SUU   5        UU;   a  U R?                  SUU   5        UU;   a  U(       a  U R?                  SUU   5        US:w  d  M  UU;   d  M  U R?                  SUU   5        M     U RK                  5         U R                  (       a  [         R                  " S5        U" 5         U RM                  5         U RO                  5         g s  sn
n	f s  sn
n	f s  sn
n	f s  sn
n	f s  sn
n	f s  sn
n	f s  sn
n	f )Nc                 \    [         R                  " S5        [         R                  " S5        g )NzBThe source directory instead of the build directory was specified.z4Only the default values for the project are printed.)r   warningr   r"   r#   print_default_values_warning5Conf.print_conf.<locals>.print_default_values_warning  s    LL]^LLOPr"   r>   zCore properties:z  Source dirz  Build dir 	errorlogsstdsplitzGlobal build optionszCore optionszBackend optionszBase optionszCompiler optionsz module optionsDirectorieszTesting optionszProject optionszMain projectzSubproject r   None)(r   start_pagerrc   r   rb   rT   r]   r   BUILTIN_DIR_OPTIONSr   collectionsdefaultdictdictr   rl   re   has_module_prefixget_module_prefixr   modulesis_builtin_optionr   machiner   HOSTBUILDis_compiler_optionis_project_optionr	   is_cross_buildr   r   is_backend_optionis_base_optiongetr   r^   r   "print_nondefault_buildtype_optionsprint_augments)rs   r   r   dir_option_namestest_option_namesdir_optionstest_optionscore_optionsmodule_optionsr   vmodnamehost_core_optionsbuild_core_optionshost_compiler_optionsbuild_compiler_optionsproject_optionsshow_build_optionsmodmod_optionsr   s                        r#   
print_confConf.print_conf   sL   	Q ##(*HHRL#$1''HH^T^^4w::;&{3&z24 ;=;=;=JUJaJabfJgMM**2288:DA$!"A'"#Q$$&& --/::'1C1C"C-.w'*''99!<<"#Q ; !==P\PbPbPd  ?IPdhihqhq  vC  vH  vH  iHtqtPd  ?I  J!>>Q]QcQcQe  @KQeijirir  wD  wJ  wJ  jJQe  @K  L $ A ATXTaTaTjTjTpTpTr  CHTrDAvz  wD  wD  wM  wM  w`  w`  ab  wc4  hi  hq  hq  uB  uG  uG  hG414Tr  CH  !I!%!B!BUYUbUbUkUkUqUqUs  DJUsTQw{  xE  xE  xN  xN  xa  xa  bc  xdD  ij  ir  ir  vC  vI  vI  iIDADUs  DJ  "K;;dmmNdNdNjNjNl  =]Nldaptp}p}  qG  qG  qY  qY  Z[  q\TQTNl  =]  ^!55`9O9O9^9^9`/0>+<T+BC"4r#5d#;<,@V@V@\@\@^  /O@^bfbobobxbx  cK  cK  LM  cNtqt@^  /O  	P>T]]=S=S=Y=Y=[  ,I=[TQ_c_l_l_u_u  `E  `E  FG  `HDAD=[  ,I  	J-/D/H/Hr/RSr#9#=#=dB#GH . 4 4 6C#o6D !7=+6,l;,o.A.A"b.IJ !5!56JR  0  !;<.."">3DZ3PQ//4F""2'9*'EF22""#57LZ7XY338J""2'=j'IJRJ/$A""#4oj6QR 7 	 ##HHRL(*//1Y ?I @K CH DJ =] /O ,Is`   =#^
$^
#^
7^
70^
+^

^

0^!
>^!
^!
0^'
^'
0^-^-0^3;^3c                   U R                   R                  5       nU(       d  g [        R                  " S5        [        R                  " S5        U H+  n[        R                  " US   S US   S US   S 35        M-     g )NzL
The following option(s) have a different value than the build type default
z                current   defaultr   21r   10r   )r   get_nondefault_buildtype_argsr   r   )rs   mismatchingms      r#   r  'Conf.print_nondefault_buildtype_optionsS  si    mmAACab34AHH!Ry1b	!A$r34 r"   c                P   U R                   R                  R                  (       ak  [        R                  " S5        U R                   R                  R                  R                  5        H"  u  p[        R                  " U<S US 35        M$     g [        R                  " S5        g )Nz
Currently set option augments:r  r  z
There are no option augments.)r   rl   augmentsr   r   re   )rs   r   r  s      r#   r  Conf.print_augments\  sr    ==!!**HH78..77==?A88Ab6*+ @ HH67r"   )r^   r   rT   r[   r   rc   r\   rW   rY   rX   r   rb   rZ   N)rT   r   r   )r   @T.Union[options.MutableKeyedOptionDictType, options.OptionStore]r   z/T.Dict[str, options.MutableKeyedOptionDictType])
r   r   r   r   r   r   r   r   r   r   )
r   r   r   r   r   T.Anyr   r$  r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r#  r   r   )r   r   r   r   )r   r   r   r   r{   r~   r   r   r   r   r   r   r   r   r   r  r  r  r!   r   r"   r#   rI   rI   D   sW    6}p$53!j*Y%2d$'VTl58r"   rI   c                ,    [        U R                  5      $ r6   )r   r.   r   s    r#   has_option_flagsr&  d  s    (())r"   c                J    [        U 5      (       a  gU R                  (       a  gg)NFT)r&  r   r   s    r#   is_print_onlyr(  g  s      r"   c                   [        U 5      nS n [        U5      nUR                  (       a  U(       d  [        R                  " S5      eUR                  (       d  U(       a  UR                  U R                  5        gSn[        U 5      (       a3  XCR                  R                  U 5      -  n[        R                  " X5        U R                  (       a  UR                  5         SnU(       ap  UR                  5         [        R                  " UR                  UR                   R"                  R$                  5        [        R&                  " UR                   / 5        g! [(         aO  n[*        R,                  " S5        Ub/  UR                   b"  [        R&                  " UR                   U/5        UeS nAf[.         a     gf = f)Nz6No valid build directory found, cannot modify options.r   FTz(Meson configurator encountered an error:)r(  rI   rc   r
   MesonExceptionr  r   r&  r   set_from_configure_commandupdate_cmd_line_filer   r~   r   r   update_build_optionsr   r	   info_dirwrite_meson_info_filerF   r   r   BrokenPipeError)r   r   
print_onlycr   es         r#   run_implr4  n  sE   w'JAN  ))*bcc  JLL'G$$JJ99'BBD))(<MMODFFH''

AGG4G4G4P4PQ(("5   ;<=QWW0((1#6 s&   A,E <CE 
G &A
F00G ?G c                    [         R                  " U 5        [        R                  R	                  [        R                  R                  U R                  5      5      n[        X5      $ r6   )r   parse_cmd_line_optionsrP   rQ   rR   rS   r   r4  )r   r   s     r#   runr7    sB    ##G,wwrww//0@0@ABHG&&r"   )r2   z'argparse.ArgumentParser'r   r   )rC   r$  r   r   )r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   ),
__future__r   r   rh   r   rP   r   typingr   r   r>   r   r   r   r	   r
   r   r   astr   r   r   r   optinterpreterr   TYPE_CHECKINGtyping_extensionsr   argparseSharedCMDOptionsr   Unionr   r   r   r3   r7   r*  rF   rI   r&  r(  r4  r7  r   r"   r#   <module>rA     s   
 #    	           9 #  -??*X..  ggc4---.G<		H++ 	^8 ^8@	*@'r"   