
    e.                       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	 ej                         Zej                  d       ej                  dd       ej                  ddd       ej                  d	d
d       ej                  dd       ej                  ddg        ej                  dd       	 	 	 	 	 	 ddZddZy)    )annotationsNcommandz--build-dir )default-iz--input-oz--outputz	--itstoolitstoolz--itsappend)actionr   mo_files+)nargsc                   |st        d       yt        j                  t        j                  j                  |      |       5 }g }|D ]*  }t        j                  j                  |      st        d|         d d d        y|j                  d      st        d|         d d d        y|j                  d      }	|	d   j                  t        j                  d	f      r&t        j                  j                  |	d   d d
       }
n"t        j                  j                  |	d         }
t        j                  j                  ||
dz         }t        j                  ||       |j                  |       - t        j                  |      }|r|D ]  }|j!                  d|g        |j!                  d|d|g       |j!                  |       t#        j$                  |      cd d d        S # 1 sw Y   y xY w)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
   shlexsplitextend
subprocesscall)	build_dirr	   	its_filesr   in_fname	out_fnametmp_dirlocale_mo_filesmo_filepartslocaletmp_mo_fnamecmdfnames                 </usr/lib/python3/dist-packages/mesonbuild/scripts/itstool.pyrun_joinr5   "   s   =>		$	$BGG,<,<X,FI	V $Za 	1G77>>'*/y9:$ $ ##E*/y9:$ $ %%m4EQx  "&&#/))%(3B-8))%(377<<%@LKK.""<0	1" kk'"" *

D%=)*

D()% 	&

?#s#9$ $ $s   7G+ G+,D5G++G4c                ~   t         j                  |       }|j                  }t        j                  j                  dt        j                               }|j                  r|j                  }|dk(  rBt        ||j                  |j                  |j                  |j                  |j                        S t        d       y)NMESON_BUILD_ROOTr    zUnknown subcommand.r   )parser
parse_argsr   r   environgetgetcwdr(   r5   r	   itsr   inputoutputr   )argsoptionsr   r(   s       r4   runrB   G   s    %GooG

1299;?I%%	&	((( 	( 	#$    )r(   strr	   rD   r)   T.List[str]r   rE   r*   rD   r+   rD   returnint)r@   rE   rF   rG   )
__future__r   r   argparser&   r   r#   r!   typingTArgumentParserr8   add_argumentr5   rB    rC   r4   <module>rO      s    # 	      	 	 	 	"   I    M2  .   D)R  0   D*b  1   K  3   GHb  9   Jc  *"$"$'*"$/2"$JrC   