o
    uJAfVM                     @  s   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dZG dd dZdddZdddZ dS )    )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
**/*
parserargparse.ArgumentParserreturnNonec                 C  s   t |  | jdg ddd | jdg ddd | jddd	t jd
 | jdddtjd | jddddd | jdddd | jdddd | jddddd | jddd d | jddd d d S )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)r    r"   6/usr/lib/python3.10/site-packages/mesonbuild/msetup.pyadd_arguments$   s>   




r$   c                   @  s^   e Zd Zd(ddZd)d
dZd*ddZd+ddZd,ddZd-d.ddZd/d d!Z	d0d&d'Z
dS )1MesonAppoptionsargparse.Namespacer   r   c                 C  s  || _ |  \| _| _|jrg }t }t| jgt		t
j| jtjjd D ]}z|t|||f W q* tyB   Y q*w t| j| zHt
| jD ]!}t
j| j|}t
j|rmt
j|smt| qQt| qQW | | j |D ]\}}t
jt
j|dd t|| q|n| | j |D ]\}}t
jt
j|dd t|| qw W d    d S 1 sw   Y  d S d S )Nz*.iniTexist_ok)r&   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fr"   r"   r#   __init__B   s>   
."zMesonApp.__init__rB   strboolc                 C  s   t j|tj}t j|S N)r2   r3   r4   r   build_filenameexists)rD   rB   fnamer"   r"   r#   has_build_filee   s   zMesonApp.has_build_filedir1T.Optional[str]dir2T.Tuple[str, str]c              
   C  s  d|d|}|d u r%|d u r!|  ds|  drd}ntdt }|d u r-t }tjtj|}tjtj|}tj|sTtj|sTt| dz	tj|dd W n t	yq } zt| d	|d }~ww z	tj|dd W n t	y } zt| d	|d }~ww tj
||rtd
d t|t|fD }|r||krtd|  |r|  |rtdtj d||fS |  |r||fS t| dtj d)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                 s  s$    | ]}|j d ko|jd kV  qdS )r   N)st_inost_dev).0sr"   r"   r#   	<genexpr>   s   " z.MesonApp.validate_core_dirs.<locals>.<genexpr>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 )rR   r   r2   getcwdr3   abspathrealpathrP   rA   FileExistsErrorsamefileanystatr   rO   )rD   rS   rU   Zinvalid_msg_prefixZndir1Zndir2eZhas_undefinedr"   r"   r#   validate_core_dirsi   sH   "


zMesonApp.validate_core_dirsr,   c                 C  s   t tj|dddd}|t W d    n1 sw   Y  t tj|dddd}|t W d    d S 1 s>w   Y  d S )Nz
.gitignorewutf-8encodingz	.hgignore)openr2   r3   r4   writegit_ignore_filehg_ignore_file)rD   r,   ofiler"   r"   r#   r@      s   "zMesonApp.add_vcs_ignore_filesc                 C  s   |  | jj| jj\}}t|t|jv rtd| d| t|s-| 	| ||fS tj
|d}tj
tj
|d}tj
|}|rn| jjsj| jjsjtd | jjrfddlm} t|| 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:
)re   r&   r   r   r   parentsr   r2   r;   r@   r3   r4   rP   r<   reconfigurer-   printcmd_line_options ro   
SystemExitrun_impl)rD   src_dirr,   priv_dirZhas_valid_buildZhas_partial_buildro   r"   r"   r#   r*      s(   

zMesonApp.validate_dirsFNcapture
vslite_ctxT.Optional[dict]c                 C  s   t | j| j| j}t| | jj | jj	rt
t  | jjr(|j  t| j | |||W  d    S 1 s@w   Y  d S rN   )r   r5   r+   r,   r&   r   
initializeget_log_dirr   r   set_timestamp_starttime	monotonic
clearcacher   clear_cacher	   BuildDirLock	_generate)rD   ry   rz   envr"   r"   r#   generate   s   
$zMesonApp.generater   environment.Environmentc              
   C  s  t jd3i t| j}t| j| tdt	j	
   tdtj tdt| tdt  ttd tdtj tdt| j tdt| j | rftd	td
 n	td	td t|}tj||d}td| rtjntj}|jd }|jd }	|jd }
t|tjsJ t|	tjsJ t|
tjsJ |dt|g i  |dt| g i  tdt|	g i  tdt|	 g i  |dt|
g i  |dt|
 g i  z | jj!rt"j#$| jdd}t!j%dt& t' |d n|(  W n t)y/ } zt*+||g  d }~ww d }d }z"t"j#$|, d}|- }| .|| | jj!r}d|j/j0 d}t"j#$| jd|}t!j%dt& t' |d t' d }|d u s|t|t1s|J n|j/2||}t3|| |j4r|jj5| j_6|jj7| j_8t9| j| j nt:| j| j | jj!rt"j#$| jdd }t!j%d!t& t' |d nt*;||j/ t*+|g d" |j/<  |jjt=>d# j?d$krt@d% |jjt=>d& j?d'krt@d( | jj!rUt"j#$| jdd)}tAtjBC }d*d+ |D }tD|| }|tE|d,tD|tE|d,d-}tF|d.d/d0}tGH|| W d    n	1 sHw   Y  td1 W |S W |S  t)y } z$t*+||g |d ur|d2 }t"j#I|r~t"J||  t"K|  d }~w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)Z
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.jsonc                 S  s   h | ]}|d   dr|qS )rW   zmesonbuild.)
startswith)rZ   modr"   r"   r#   	<setcomp>   s    z%MesonApp._generate.<locals>.<setcomp>)modulescount)stdlibmesonrf   rg   rh   zmeson setup completedz.prevr"   )Lr    	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   Z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sortedlenrj   jsondumprP   replaceunlink)rD   r   ry   rz   r   rI   intr
logger_funr   r   r   rQ   rd   ZcdfZcaptured_compile_argsZdumpfilemodsZ	mesonmodsZstdmodsdatarJ   Zold_cdfr"   r"   r#   r      s   











"

zMesonApp._generaterI   build.Buildr   interpreter.Interpreterc                 C  s0   |j |j  |j D ]}|| qd S rN   )devenvr   r   
get_devenvr   valuespostconf_hook)rD   rI   r   r   r"   r"   r#   r   4  s   z MesonApp.finalize_postconf_hooksr&   r'   r   r   )rB   rL   r   rM   )rS   rT   rU   rT   r   rV   )r,   rL   r   r   )r   rV   )FN)ry   rM   rz   r{   r   r{   )r   r   ry   rM   rz   r{   r   r{   )rI   r   r   r   r   r   )__name__
__module____qualname__rK   rR   re   r@   r*   r   r   r   r"   r"   r"   r#   r%   A   s    

#

$


}r%   r&   r'   c                 C  s   | j }| jtd}td}|| j v r$| j| dkr#tdnd| j|< t }i }|D ]}| d| | _ || jtd< t	| }|j
dd||< q1| d	| _ || jtd< t	| }|j
d
|d d S )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)ry   Z_vsF)ry   rz   )r   rs   popr	   r   r   r   r    get_genvs_default_buildtype_listr%   r   )r&   Zbuilddir_prefixZgenvslitevalZ	k_backendZbuildtypes_listrz   Zbuildtypestrappr"   r"   r#   run_genvslite_setup9  s&   

r   (T.Union[argparse.Namespace, T.List[str]]intc                 C  sd   t | tjst }t| || } t|  t	d| j
 v r(t|  dS t| }|  dS )Nr   r   )r   r    r   ArgumentParserr$   
parse_argsr   parse_cmd_line_optionsr	   r   rs   r   r   r%   r   )r&   r   r   r"   r"   r#   r   [  s   

r   )r   r   r   r   r   )r&   r   r   r   )!
__future__r   r    r   r1   r   r2   r   r7   r   r.   r   ZcProfiler   pathlibr   typingr   rt   r   r   r   r   r	   r
   r   r   rl   rm   r$   r%   r   r   r"   r"   r"   r#   <module>   s   P$
 
y"