o
    nc                     @  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e	 Z
e
d e
jddd e
jdddd e
jd	d
dd e
jddd e
jddg d e
jddd d ddZd!ddZdS )"    )annotationsNcommandz--build-dir )default-iz--input-oz--outputz	--itstoolitstoolz--itsappend)actionr   mo_files+)nargs	build_dirstr	its_filesT.List[str]in_fname	out_fnamereturnintc                 C  sf  |st d dS tjtj|| d}g }|D ]e}tj|s0t d|   W d    dS |dsEt d|   W d    dS |d}	|	d tj	d	fratj|	d d d
 }
ntj|	d }
tj
||
d }t|| || q|g}|r|D ]	}|d|g q|d|d|g || t|W  d    S 1 sw   Y  d S )Nz-No mo files specified to use for translation.   )prefixdirzCould not find mo file z.mozFile is not a mo file: LC_MESSAGESr   /r   z-jr   )printtempfileTemporaryDirectoryospathbasenameexistsendswith	partitionsepjoinshutilcopyr	   extend
subprocesscall)r   r   r   r   r   r   Ztmp_dirZlocale_mo_filesZmo_filepartslocaleZtmp_mo_fnamecmdfname r0   yhome/ych/rk3568/buildroot/output/rockchip_rk3568_recovery/host/lib/python3.10/site-packages/mesonbuild/scripts/itstool.pyrun_join!   s>   


$r2   argsc                 C  s^   t | }|j}tjdt }|jr|j}|dkr)t||j	|j
|j|j|jS td dS )NZMESON_BUILD_ROOTr&   zUnknown subcommand.r   )parser
parse_argsr   r   environgetgetcwdr   r2   r   Zitsr   inputoutputr   )r3   optionsr   r   r0   r0   r1   runF   s   
r<   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r3   r   r   r   )
__future__r   r   argparser*   r   r'   typingTArgumentParserr4   add_argumentr2   r<   r0   r0   r0   r1   <module>   s"   

%