o
    WªodÖA  ã                   @  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mZmZmZ ddlmZ ddlmZmZ ddlmZ dd	l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S )é    )ÚannotationsN)ÚPathé   )ÚenvironmentÚinterpreterÚmesonlib)Úbuild)ÚmlogÚcoredata)Úmintro)ÚMesonExceptionÚMachineChoice)ÚPkgConfigDependencyz\# 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 | 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--reconfigurez…Set 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--wipez¦Wipe build directory and reconfigure using previous command line options. Useful when build directory got corrupted, or when rebuilding with a newer version of meson.Úbuilddirú?)Únargsr   Ú	sourcedir)r
   Zregister_builtin_argumentsÚadd_argumentr   ÚargparseZSUPPRESS)r   © r"   úphome/ych/rk3568/buildroot/output/rockchip_rk3568_recovery/host/lib/python3.10/site-packages/mesonbuild/msetup.pyÚadd_arguments.   s8   
ýý
ÿ
ÿ
ÿÿÿ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„Zd+dd„Z	d,d"d#„Z
d$S )-ÚMesonAppÚoptionsúargparse.Namespacer   r   c                 C  s–  |   |j|j|j|j¡\| _| _|jrÆg }t ¡ ¥}t	 
| j¡gt tj | jtjjd¡¡ D ]}z| t ||¡|f¡ W q/ tyG   Y q/w t	 | j|¡ zHt | j¡D ]!}tj | j|¡}tj |¡rrtj |¡srt |¡ qVt |¡ qVW |  | j¡ |D ]\}}tjtj |¡dd t  ||¡ qn|  | j¡ |D ]\}}tjtj |¡dd t  ||¡ q w W d   ƒ n1 sÁw   Y  || _!d S )Nz*.iniT©Úexist_ok)"Úvalidate_dirsr   r   ÚreconfigureÚwipeÚ
source_dirÚ	build_dirÚtempfileÚTemporaryDirectoryr
   Zget_cmd_line_fileÚglobÚosÚpathÚjoinr   ÚEnvironmentZprivate_dirr   ÚshutilÚcopyÚFileNotFoundErrorÚread_cmd_line_fileÚlistdirÚisdirÚislinkr   Zwindows_proof_rmtreeZwindows_proof_rmÚadd_vcs_ignore_filesÚmakedirsÚdirnameÚmover&   )Úselfr&   ÚrestoreÚdÚfilenameÚlÚbÚfr"   r"   r#   Ú__init__J   sD   ý
.ýûþÿþé
zMesonApp.__init__r?   ÚstrÚboolc                 C  s   t j |tj¡}t j |¡S ©N)r2   r3   r4   r   Úbuild_filenameÚexists)rA   r?   Úfnamer"   r"   r#   Úhas_build_fileq   s   zMesonApp.has_build_fileÚdir1Ú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 
||¡r²td
d„ t |¡t |¡fD ƒƒ}|r®||kr²tdƒ‚|   |¡rÉ|   |¡rÅt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 )rO   r   r2   Úgetcwdr3   ÚabspathÚrealpathrM   r>   ÚFileExistsErrorÚsamefileÚanyÚstatr   rL   )rA   rP   rQ   Zinvalid_msg_prefixZndir1Zndir2ÚeZhas_undefinedr"   r"   r#   Úvalidate_core_dirsu   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Úwzutf-8)Úencodingz	.hgignore)Úopenr2   r3   r4   ÚwriteÚgit_ignore_fileÚhg_ignore_file)rA   r.   Zofiler"   r"   r#   r=   ™   s   ÿ"ÿzMesonApp.add_vcs_ignore_filesr+   r,   c           
      C  sÄ   |   ||¡\}}t|ƒt|ƒjv rtd|› d|› ƒ‚t |¡s)|  |¡ ||fS tj |d¡}tj 	tj |d¡¡}tj 
|¡}	|rS|sO|sOtdƒ tdƒ‚||fS |	s^|r^td|› ƒ‚||fS )NzBuild directory z( cannot be a parent of source directory úmeson-privatezcoredata.data–  Directory already configured.

Just run your build command (e.g. ninja) and Meson will regenerate as necessary.
If ninja fails, run "ninja reconfigure" or "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.
To change option values, run "meson configure" instead.r   z>Directory is not empty and does not contain a previous build:
)ra   r   Úparentsr   r2   r:   r=   r3   r4   rM   r;   ÚprintÚ
SystemExit)
rA   rP   rQ   r+   r,   Úsrc_dirr.   Zpriv_dirZhas_valid_buildZhas_partial_buildr"   r"   r#   r*   Ÿ   s"   

þzMesonApp.validate_dirsc                 C  sz   t  | j| j| j¡}t | ¡ | jj¡ | jj	rt 
t ¡ ¡ t | j¡ |  |¡ W d   ƒ d S 1 s6w   Y  d S rK   )r   r5   r-   r.   r&   r	   Z
initializeZget_log_dirr   r   Zset_timestamp_startÚtimeÚ	monotonicr   ZBuildDirLockÚ	_generate)rA   Úenvr"   r"   r#   Úgenerate¼   s   "ÿzMesonApp.generaterp   úenvironment.Environmentc              
   C  s8  t jd)i 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| ¡ r…tjntj¡}|jd }|jd }|jd }t|tjƒs J ‚t|tjƒs¨J ‚t|tjƒs°J ‚|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 }z¸t"j# $| ,¡ d¡}| -¡ }| jj!rbd|j.j/› d}	t"j# $| jd|	¡}	t!j%dt&ƒ t'ƒ |	d n|j. 0¡  |  1||¡ t 2||¡ |j3rŒ|jj4| j_5|jj6| j_7t 8| j| j¡ nt 9| j| j¡ | jj!r®t"j# $| jdd¡}	t!j%d t&ƒ t'ƒ |	d nt* :||j.¡ t* +|g d!¡ |j. ;¡  |jjt< =d"¡ j>d#krÓt ?d$¡ |jjt< =d%¡ j>d&krèt ?d'¡ W d S W d S  t)y }
 z$t* +||
g¡ |d ur|d( }t"j# @|¡rt" A||¡ ‚ t" B|¡ ‚ d }
~
ww )*Nz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:rh   zprofile-interpreter.logz
intr.run())rD   z	build.datzprofile-z-backend.logzintr.backend.generate()zprofile-introspector.logz3mintro.generate_introspection_file(b, intr.backend)TÚbackendZxcodez8xcode backend is currently unmaintained, patches welcomeZlayoutZ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.prevr"   )Cr!   Ú	NamespaceÚvarsr&   r
   r9   r.   r	   ÚdebugÚdatetimeÚnowÚ	isoformatÚsysÚ
executableZformat_cmd_line_optionsÚplatformÚsystemÚlogZboldr   r-   Zis_cross_buildr   ÚBuildr   ZInterpreterÚTÚcastÚbuiltinÚ
isinstanceZMachineHolderZcpu_family_methodZ
cpu_methodr   r2   r3   r4   ZrunctxÚglobalsÚlocalsÚrunÚ	Exceptionr   Zwrite_meson_info_fileZget_scratch_dirZdump_coredatarw   Únamerq   Ú_finalize_devenvÚsaveZfirst_invocationZcross_filesZ
cross_fileZconfig_filesZnative_fileZwrite_cmd_line_fileZupdate_cmd_line_fileZgenerate_introspection_fileZrun_postconf_scriptsr   Z	OptionKeyÚvalueÚwarningrM   ÚreplaceÚunlink)rA   rp   rs   rF   ÚintrZ
logger_funrt   ru   rv   rN   r`   ZcdfZdumpfileZold_cdfr"   r"   r#   ro   Ä   sž   
ÿ



€€þ




ÿ

ÿ€øzMesonApp._generaterF   úbuild.Buildr“   úinterpreter.Interpreterc                 C  sZ   |j  |j ¡ ¡ |j  tj|jtjdd¡ |j	 
¡ D ]}| ¡ }|r*|j  |¡ qd S )NT)Zuninstalled)Údevenvr   rw   Z
get_devenvr   Zget_envr   r   ZHOSTÚmodulesÚvalues)rA   rF   r“   Úmodr–   r"   r"   r#   r   /  s   €ýzMesonApp._finalize_devenvN)r&   r'   r   r   )r?   rI   r   rJ   )rP   rI   rQ   rI   r   rR   )r.   rI   r   r   )
rP   rI   rQ   rI   r+   rJ   r,   rJ   r   rR   )r   r   )rp   rr   r   r   )rF   r”   r“   r•   r   r   )Ú__name__Ú
__module__Ú__qualname__rH   rO   ra   r=   r*   rq   ro   r   r"   r"   r"   r#   r%   I   s    

'

$


kr%   r&   ú(T.Union[argparse.Namespace, T.List[str]]Úintc                 C  sD   t | tjƒst ¡ }t|ƒ | | ¡} t | ¡ t| ƒ}| 	¡  dS )Nr   )
r‡   r!   rx   ÚArgumentParserr$   Ú
parse_argsr
   Zparse_cmd_line_optionsr%   rq   )r&   r   Zappr"   r"   r#   rŠ   7  s   

rŠ   )r   r   r   r   )r&   r   r   rž   )#Ú
__future__r   Útypingr„   rm   r~   r{   Úos.pathr2   r€   ZcProfiler   r!   r/   r6   r1   Úpathlibr   Ú r   r   r   r   r	   r
   r   r   r   Údependenciesr   rf   rg   r$   r%   rŠ   r"   r"   r"   r#   Ú<module>   s2   
 o