
    eVM                        d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlmZ d dlZddlmZmZmZmZmZmZmZ ddlmZ dZdZdd	Z G d
 d      ZddZddZ y)    )annotationsN)Path   )buildcoredataenvironmentinterpretermesonlibmintromlog)MesonExceptionz\# This file is autogenerated by Meson. If you change or delete it, it won't be recreated.
*
zl# This file is autogenerated by Meson. If you change or delete it, it won't be recreated.
syntax: glob
**/*
c                   t        j                  |        | j                  dg dd       | j                  dg dd       | j                  ddd	t         j                  
       | j                  dddt        j
                         | j                  dddd       | j                  ddd       | j                  ddd       | j                  dddd       | j                  ddd        | j                  ddd        y )Nz--native-fileappendz=File containing overrides for native compilation environment.)defaultactionhelpz--cross-filez.File describing cross compilation environment.z-vz	--versionversion)r   r   z--profile-self
store_trueprofile)r   destr   z--fatal-meson-warningsfatal_warningszMake all Meson warnings fatalz--reconfigurezSet options and reconfigure the project. Useful when new options have been added to the project and the default value is not working.)r   r   z--wipezWipe build directory and reconfigure using previous command line options. Useful when build directory got corrupted, or when rebuilding with a newer version of meson.z--clearcacheFz:Clear cached state (e.g. found dependencies). Since 1.3.0.)r   r   r   builddir?)nargsr   	sourcedir)r   register_builtin_argumentsadd_argumentr   argparseSUPPRESS)parsers    3/usr/lib/python3/dist-packages/mesonbuild/msetup.pyadd_argumentsr"   $   s8   ''/
 "'\  ^  "'M  O k) ( 0 0  2
(I%..  0
0L\<  >
/  0 7  8 |UY  [

#t<
3=    c                  N    e Zd Zd
dZddZddZddZddZdddZddZ	dd	Z
y)MesonAppc           	        || _         | j                         \  | _        | _        |j                  rg }t        j                         5 }t        j                  | j                        gt        j                  t        j                  j                  | j                  t        j                  j                  d            z   D ]*  }	 |j!                  t#        j$                  ||      |f       , t        j(                  | j                  |       	 t        j*                  | j                        D ]  }t        j                  j                  | j                  |      }t        j                  j-                  |      r5t        j                  j/                  |      st1        j2                  |       t1        j4                  |        	 | j7                  | j                         |D ]O  \  }}t        j8                  t        j                  j;                  |      d       t#        j<                  ||       Q 	 d d d        y y # t&        $ r Y w xY w# | j7                  | j                         |D ]O  \  }}t        j8                  t        j                  j;                  |      d       t#        j<                  ||       Q w xY w# 1 sw Y   y xY w)Nz*.iniTexist_ok)optionsvalidate_dirs
source_dir	build_dirwipetempfileTemporaryDirectoryr   get_cmd_line_fileglobospathjoinr   Environmentprivate_dirr   shutilcopyFileNotFoundErrorread_cmd_line_filelistdirisdirislinkr
   windows_proof_rmtreewindows_proof_rmadd_vcs_ignore_filesmakedirsdirnamemove)selfr)   restoredfilenamelbfs           r!   __init__zMesonApp.__init__B   s<   ,0,>,>,@)$.<< G,,. *!!)!;!;DNN!K LtyyY[Y`Y`YeYefjftft  wB  wN  wN  wZ  wZ  \c  Zd  Pe  !e HHa(@('KL ++DNNGD*  ZZ7 9GGLL;77==+BGGNN14E$99!<$55a89 --dnn= ' *1BGGOOA$6FAq)*/* *  -  $ --dnn= ' *1BGGOOA$6FAq)*/* *sL   A;K'I +"KB7IA/K 	I	KIKA1KKKc                    t         j                  j                  |t        j                        }t         j                  j                  |      S N)r2   r3   r4   r   build_filenameexists)rD   rB   fnames      r!   has_build_filezMesonApp.has_build_filee   s/    Wk&@&@Aww~~e$$r#   c                   d|d|}|F|0| j                  d      s| j                  d      rd}nt        d      t        j                         }|t        j                         }t        j                  j                  t        j                  j                  |            }t        j                  j                  t        j                  j                  |            }t        j                  j                  |      s-t        j                  j                  |      st        | d      	 t        j                  |d       	 t        j                  |d       t        j                  j                  ||      rLt        d
 t        j                  |      t        j                  |      fD              }|r||k(  rt        d      | j                  |      r2| j                  |      rt        dt        j                   d      ||fS | j                  |      r||fS t        | dt        j                   d      # t        $ r}t        | d	      |d }~ww xY w# t        $ r}t        | d	      |d }~ww xY w)NzNeither source directory z nor build directory .z..z)Must specify at least one directory name.z exist.Tr'   z is not a directoryc              3  \   K   | ]$  }|j                   d k(  xr |j                  d k(   & yw)r   N)st_inost_dev).0ss     r!   	<genexpr>z.MesonApp.validate_core_dirs.<locals>.<genexpr>   s(     laQ!@188q=!@ls   *,zUSource and build directories must not be the same. Create a pristine build directory.z&Both directories contain a build file z contain a build file )rQ   r   r2   getcwdr3   abspathrealpathrO   rA   FileExistsErrorsamefileanystatr   rN   )rD   dir1dir2invalid_msg_prefixndir1ndir2ehas_undefineds           r!   validate_core_dirszMesonApp.validate_core_dirsi   s+   8@UVZU]^<|**3/D4G4G4MD()TUU99;D<99;D 0 0 67 0 0 67ww~~e$RWW^^E-B $6#7w!?@@	FKK-	FKK- 77E5)lBGGTYN\^\c\cdi\jKkllM EUN$%|}}u%""5)$'MkNhNhMiij%kll%<u%%< 233I+JdJdIeefghh#  	F D6)<!=>AE	F  	F D6)<!=>AE	Fs0   ,H> I >	III	I;'I66I;c                \   t        t        j                  j                  |d      dd      5 }|j	                  t
               d d d        t        t        j                  j                  |d      dd      5 }|j	                  t               d d d        y # 1 sw Y   TxY w# 1 sw Y   y xY w)Nz
.gitignorewutf-8encodingz	.hgignore)openr2   r3   r4   writegit_ignore_filehg_ignore_file)rD   r,   ofiles      r!   r@   zMesonApp.add_vcs_ignore_files   s    "'',,y,7wO 	)SXKK(	)"'',,y+6gN 	(RWKK'	( 	(	) 	)	( 	(s   B7B"B"B+c                   | j                  | j                  j                  | j                  j                        \  }}t	        |      t	        |      j
                  v rt        d| d|       t        j                  |      s| j                  |       ||fS t        j                  j                  |d      }t        j                  j                  t        j                  j                  |d            }t        j                  j                  |      }|r| j                  j                  sm| j                  j                  sWt!        d       | j                  j"                  r+ddlm} t)        |j+                  | j                  |            t)        d      ||fS |s$| j                  j                  rt        d	|       ||fS )
NzBuild directory z( cannot be a parent of source directory zmeson-privatezcoredata.data6  Directory already configured.

Just run your build command (e.g. ninja) and Meson will regenerate as necessary.
Run "meson setup --reconfigure to force Meson to regenerate.

If build failures persist, run "meson setup --wipe" to rebuild from scratch
using the same options as passed when configuring the build.r   )mconfr   z>Directory is not empty and does not contain a previous build:
)rh   r)   r   r   r   parentsr   r2   r;   r@   r3   r4   rO   r<   reconfigurer-   printcmd_line_options rt   
SystemExitrun_impl)rD   src_dirr,   priv_dirhas_valid_buildhas_partial_buildrt   s          r!   r*   zMesonApp.validate_dirs   sk   #66t||7L7LdllNdNde)	?d7m333 #3I;>fgnfo!pqqzz)$%%i0I%%77<<	?;''..h)OPGGMM(3<<++DLL4E4E U V
 <<00'$U^^DLL)%LMM m# 	!! #t||'8'8 #bclbm!noo	!!r#   Nc                F   t        j                  | j                  | j                  | j                        }t        j                  |j                         | j                  j                         | j                  j                  r't        j                  t        j                                | j                  j                  r|j                  j                          t!        j"                  | j                        5  | j%                  |||      cd d d        S # 1 sw Y   y xY wrM   )r   r5   r+   r,   r)   r   
initializeget_log_dirr   r   set_timestamp_starttime	monotonic
clearcacher   clear_cacher
   BuildDirLock	_generate)rD   capture
vslite_ctxenvs       r!   generatezMesonApp.generate   s    %%doot~~t||T)4<<+F+FG<<$$T^^%56<<""LL$$&""4>>2 	<>>#w
;	< 	< 	<s   :DD c           	        t        j                  d3i t        | j                        }t	        j
                  | j                  |       t        j                  dt        j                  j                         j                                t        j                  dt        j                         t        j                  dt	        j                  |             t        j                  dt        j                                 t        j"                  t        j$                  d             t        j"                  dt        j&                         t        j"                  dt        j$                  | j(                               t        j"                  dt        j$                  | j                               |j+                         r*t        j"                  d	t        j$                  d
             n)t        j"                  d	t        j$                  d             t-        j.                  |      }t1        j2                  ||      }t5        j6                  d|j+                         rt        j"                  nt        j                        }|j8                  d   }|j8                  d   }	|j8                  d   }
t;        |t0        j<                        sJ t;        |	t0        j<                        sJ t;        |
t0        j<                        sJ  |dt        j$                  |j?                  g i                     |dt        j$                  |jA                  g i                    t        j"                  dt        j$                  |	j?                  g i                    t        j"                  dt        j$                  |	jA                  g i                     |dt        j$                  |
j?                  g i                     |dt        j$                  |
jA                  g i                    	 | j                  jB                  rUtD        jF                  jI                  | j                  dd      }tC        jJ                  dtM               tO               |       n|jQ                          d }d }	 tD        jF                  jI                  |jY                         d      }|j[                         }| j]                  ||       | j                  jB                  rd|j^                  j`                   d}tD        jF                  jI                  | j                  d|      }tC        jJ                  dtM               tO               |       tO               d   }|.t;        |tb              sJ |j^                  je                  ||      }t-        jf                  ||       |jh                  ru|j                  jj                  | j                  _6        |j                  jn                  | j                  _8        t	        jr                  | j                  | j                         n*t	        jt                  | j                  | j                         | j                  jB                  rUtD        jF                  jI                  | j                  dd       }tC        jJ                  d!tM               tO               |       n tU        jv                  ||j^                         tU        jV                  |g d"       |j^                  jy                          |j                  j                  t{        j|                  d#         j~                  d$k(  rt        j                  d%       |j                  j                  t{        j|                  d&         j~                  d'k(  rt        j                  d(       | j                  jB                  rtD        jF                  jI                  | j                  dd)      }t        t        j                  j                               }|D ch c]  }|d*z   j                  d+      s| }}t        ||z
        }|t        |      d,t        |      t        |      d,d-}t        |d.d/0      5 }t        j                  ||       d d d        t        j"                  d1       |S # tR        $ r}tU        jV                  ||g        d }~ww xY wc c}w # 1 sw Y   NxY w# tR        $ ro}tU        jV                  ||g       |P|d2z   }tD        jF                  j                  |      rtE        j                  ||        tE        j                  |        d }~ww xY w)4NzBuild started atzMain binary:zBuild Options:zPython system:zThe Meson build systemzVersion:zSource dir:z
Build dir:zBuild type:zcross buildznative build)user_defined_optionsz6T.Callable[[mlog.TV_Loggable, mlog.TV_Loggable], None]build_machinehost_machinetarget_machinezBuild machine cpu family:zBuild machine cpu:zHost machine cpu family:zHost machine cpu:zTarget machine cpu family:zTarget machine cpu:z
meson-logszprofile-interpreter.logz
intr.run())rG   z	build.datzprofile-z-backend.logz7gen_result = intr.backend.generate(capture, vslite_ctx)
gen_resultzprofile-introspector.logz3mintro.generate_introspection_file(b, intr.backend)Tbackendxcodez8xcode backend is currently unmaintained, patches welcomelayoutflatay  -Dlayout=flat is unsupported and probably broken. It was a failed experiment at making Windows build artifacts runnable while uninstalled, due to PATH considerations, but was untested by CI and anyways breaks reasonable use of conflicting targets in different subdirs. Please consider using `meson devenv` instead. See https://github.com/mesonbuild/meson/pull/9243 for details.zprofile-startup-modules.jsonrS   zmesonbuild.)modulescount)stdlibmesonrj   rk   rl   zmeson setup completedz.prev )Mr   	Namespacevarsr)   r   r:   r,   r   debugdatetimenow	isoformatsys
executableformat_cmd_line_optionsplatformsystemlogboldr   r+   is_cross_buildr   Buildr	   InterpreterTcastbuiltin
isinstanceMachineHoldercpu_family_method
cpu_methodr   r2   r3   r4   runctxglobalslocalsrun	Exceptionr   write_meson_info_fileget_scratch_dirdump_coredatafinalize_postconf_hooksr   namedictr   savefirst_invocationcross_files
cross_fileconfig_filesnative_filewrite_cmd_line_fileupdate_cmd_line_filegenerate_introspection_filerun_postconf_scriptsr
   	OptionKeyvaluewarningsetr   keys
startswithsortedlenrn   jsondumprO   replaceunlink)rD   r   r   r   r   rI   intr
logger_funr   r   r   rP   rf   cdfcaptured_compile_argsdumpfilemodsmod	mesonmodsstdmodsdatarJ   old_cdfs                          r!   r   zMesonApp._generate   s     (11GD4FG##DNN4HI

%x'8'8'<'<'>'H'H'JK

>3>>2

#X%E%EFZ%[\

#X__%67345X--.		$// :;tyy89HH]DIIm$<=HH]DIIn$=>KK&&q?ST VVT),););)=TXX4::P
_5||N3&67-)B)BCCC,(A(ABBB.+*C*CDDD.		-:Y:YZ\^`:a0bc'=3K3KBPR3S)TU+TYY|7U7UVXZ\7]-^_$dii0G0GB0O&PQ/>;[;[\^`b;c1de($))N4M4MbRT4U*VW	||##T^^\C\]|WY5Q

  $26G	ww||C$7$7$9;GH ##%C((D1||##"4<<#4#4"5\BT^^\5IXZaZcekemx}~(.(>%,4
CXZ^8___(,(=(=gz(R%JJq(### +.,,*B*B'+.<<+D+D(,,T^^T\\J--dnndllK ||##T^^\C]^TV]V_agaityz221dllC((B5 LL--/ ||##H$6$6y$ABHHGSWX||##H$6$6x$@AGG6Q , - ||##T^^\Cab3;;++-.,0XSSW4H4H4WSX	X 	!12.5G"Mdjktdu  AD  EN  AO  YP  Q%w7 '1IIdA&' 01 %$_  	((QC0	z Y' '
  	((QC0-77>>'*JJw,  IIcN	sd   'A;c 'Nd =c>c>Ad d6d 	c;c66c;>d dd 	fA*ffc                    |j                   j                  |j                  j                                |j                  j                         D ]  }|j                  |        y rM   )devenvr   r   
get_devenvr   valuespostconf_hook)rD   rI   r   r   s       r!   r   z MesonApp.finalize_postconf_hooks4  sI    	//12<<&&( 	!Ca 	!r#   r)   zargparse.NamespacereturnNone)rB   strr   bool)ra   T.Optional[str]rb   r   r   T.Tuple[str, str])r,   r   r   r   )r   r   )FN)r   r   r   T.Optional[dict]r   r   )r   zenvironment.Environmentr   r   r   r   r   r   )rI   zbuild.Buildr   zinterpreter.Interpreterr   r   )__name__
__module____qualname__rK   rQ   rh   r@   r*   r   r   r   r   r#   r!   r%   r%   A   s/    !*F%"iH("4<{%z!r#   r%   c                   | j                   }| j                  j                  t        j                  d            }t        j                  d      }|| j                  j                         v r| j                  |   dk7  rt        d      d| j                  |<   t        j                         }i }|D ]P  }| d| | _         || j                  t        j                  d      <   t        |       }|j                  d      ||<   R | d	| _         || j                  t        j                  d      <   t        |       }|j                  d
|       y )N	genvsliter   ninjazExplicitly specifying a backend option with 'genvslite' is not necessary (the ninja backend is always used) but specifying a non-ninja backend conflicts with a 'genvslite' setup_	buildtypeT)r   _vsF)r   r   )r   rx   popr
   r   r   r   r    get_genvs_default_buildtype_listr%   r   )r)   builddir_prefixgenvsliteval	k_backendbuildtypes_listr   buildtypestrapps           r!   run_genvslite_setupr   9  sJ    &&O++//0B0B;0OPL ""9-IG,,1133##I.'9  "H I I /6  +??AOJ' >-.a~>DP  !3!3K!@Aw#&<<<#=
< 	> **#.G@LGX//<=
7
CLL:L6r#   c                n   t        | t        j                        s0t        j                         }t	        |       |j                  |       } t        j                  |        t        j                  d      | j                  j                         v rt        |        yt        |       }|j                          y)Nr   r   )r   r   r   ArgumentParserr"   
parse_argsr   parse_cmd_line_optionsr
   r   rx   r   r   r%   r   )r)   r    r   s      r!   r   r   [  s    gx112((*f##G,##G,+&'*B*B*G*G*IIG$
  wr#   )r    zargparse.ArgumentParserr   r   r   )r)   z(T.Union[argparse.Namespace, T.List[str]]r   int)!
__future__r   r   r   r1   r   r2   r   r7   r   r.   r   cProfiler   pathlibr   typingr   ry   r   r   r   r	   r
   r   r   r   rp   rq   r"   r%   r   r   r   r#   r!   <module>r     sY    # P P P P P    O O O $>:v! v!p 7Dr#   