+
    UBi^$                    2   ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^RI	H
t
HtHtHtHtHt ^RIHtHt ]P&                  '       d   ^ RItR R ltR R	 ltR
 R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R lt R# )    )annotationsN)glob)open_wrapdburlread_and_decompressWrapExceptionget_releasesget_releases_dataparse_patch_url)mesonlibmsubprojectsc                    V ^8  d   QhRRRR/# )   parserz'argparse.ArgumentParser'returnNone )formats   "=/usr/lib/python3.14/site-packages/mesonbuild/wrap/wraptool.py__annotate__r      s     *( *(3 *( *(    c                h   V P                  R RR7      pRVn        VP                  RRR7      pVP                  RRR	R
R7       VP	                  \
        R7       VP                  RRR7      pVP                  RRR	R
R7       VP                  R4       VP	                  \        R7       VP                  RRR7      pVP                  RRR	R
R7       VP                  R4       VP	                  \        R7       \        P                  ! V4      pVP	                  \        P                  R7       VP                  RRR7      pVP                  RRR	R
R7       VP                  R4       VP	                  \        R7       VP                  RRR7      pVP                  RRR	R
R7       VP	                  \        R7       VP                  RRR7      pVP                  R4       VP	                  \        R7       VP                  RRR7      pVP                  RRR	R
R7       VP	                  \        R7       R# )Commandscommand)titledestTlistzshow all available projects)helpz--allow-insecureF
store_truez"Allow insecure server connections.)defaultactionr   	wrap_funcsearchzsearch the db by namenameinstallzinstall the specified projectinfoz$show available versions of a projectstatusz6show installed and available versions of your projectspromotez.bring a subsubproject up to the master projectproject_pathz	update-dbz:Update list of projects available in WrapDB (Since 0.61.0)N)add_subparsersrequired
add_parseradd_argumentset_defaultslist_projectsr#   r%   r   add_wrap_update_parserrunr&   r'   r(   	update_db)r   
subparsersps   &  r   add_argumentsr5      s   &&Zi&HJJf+HIANN%u\<  >NN]N+h-DEANN%u\<  >NN6NNVN$i.MNANN%u\<  >NN6NNWN%++J7ANN\--N.f+QRANN%u\<  >NN6NNTN"h-efANN%u\<  >NNVN$i.^_ANN>"NNWN%k0lmANN%u\<  >NNYN'r   c                    V ^8  d   QhRRRR/# r   options'argparse.Namespace'r   r   r   )r   s   "r   r   r   A   s      / D r   c                t    \        V P                  4      pVP                  4        F  p\        V4       K  	  R # )N)r   allow_insecurekeysprint)r8   releasesr4   s   &  r   r/   r/   A   s)    G223H]]_a r   c                    V ^8  d   QhRRRR/# r7   r   )r   s   "r   r   r   F   s     	A 	A( 	AT 	Ar   c                D   V P                   p\        V P                  4      pVP                  4        Fj  w  r4VP	                  V4      R8w  d   \        V4       K(  VP                  R. 4       F,  pVP	                  V4      R8w  g   K  \        RV RV 24       K.  	  Kl  	  R# )   dependency_nameszDependency z found in wrap N)r$   r   r;   itemsfindr=   get)r8   r$   r>   r4   r&   deps   &     r   r#   r#   F   s    <<DG223H>>#66$<2!Hxx 2B788D>R'KuOA3?@ 8	 $r   c               $    V ^8  d   QhRRRRRR/# )r   r$   strr;   boolr   zT.Tuple[str, str]r   )r   s   "r   r   r   Q   s"      S $ ;L r   c                    \        V4      pVP                  V 4      pV'       g   \        R V  R24      hVR,          ^ ,          pVP                  R^4      w  rVWV3# )Wrap  not found in wrapdbversions-)r   rF   r   rsplit)r$   r;   r>   r&   latest_versionversionrevisions   &&     r   get_latest_versionrT   Q   s_    N+H<<DeD6)=>??*%a(N&--c15Gr   c                    V ^8  d   QhRRRR/# r7   r   )r   s   "r   r   r   Z   s     E E) Ed Er   c                *   V P                   p\        P                  ! 4       pVe&   \        P                  P                  V4      '       g   \        R4      h\        P                  P                  \        P                  P                  W!4      4      '       d   \        R4      h\        P                  P                  W!R,           4      p\        P                  P                  V4      '       d   \        R4      h\        WP                  4      w  rE\        RV RV RV RV R2	V P                  R	R	4      p\        VR
4      ;_uu_ 4       pVP                  \        V4      4       R R R 4       \        RV RV RV 24       R #   + '       g   i     L&; i)NzISubprojects dir not found. Run this script in your source root directory.z5Subproject directory for this project already exists..wrapzWrap file already exists.z!https://wrapdb.mesonbuild.com/v2/_rO   /Twbz
Installed z	 version z
 revision )r$   r   get_subproject_dirospathisdir
SystemExitjoinexistsrT   r;   r   openwriter   r=   )r8   r$   subproject_dir_namewrapfilerR   rS   urlfs   &       r   r%   r%   Z   sC   <<D"557""''--8K*L*Ldee	ww}}RWW\\"5<==PQQww||/@H	ww~~h455,T3I3IJW
<TF!G9AhZWXY]X^^cdfmf|f|  C  EI  JC	h			#C() 
	JtfIgYj

CD 
	s   	FF	c                    V ^8  d   QhRRRR/# )r   re   rI   r   z,T.Tuple[str, str, str, str, T.Optional[str]]r   )r   s   "r   r   r   j   s     b b# b*V br   c                d   \         P                  ! R R7      pVP                  V 4        VR,          p TR,          p\        T4      w  rETR,          pYETR,          TR,          T3#   \         d    \	        R4      hi ; i  \         d$    \        P                  ! TR,          4      pRR re L[i ; i)	N)interpolationz	wrap-filez1Not a wrap-file, cannot have come from the wrapdb	patch_urlpatch_filenamesource_filename1	directory)configparserConfigParserreadKeyErrorr   r
   r   search_version)re   cp	wrap_datark   branchrS   rl   s   &      r   get_current_versionrx   j   s    		"	"	6BGGHQ{O	
5k*	 +95"#34Y{3Y?P5QSaaa  QOPPQ  - ((3D)EF#&.-s   	A' 	B 'A>+B/.B/c                    V ^8  d   QhRRRR/# r7   r   )r   s   "r   r   r   ~   s      & 4 r   c                    V P                   p\        V P                  4      pVP                  V4      pV'       g   \	        R V R24      h\        RV R24       VR,           F  p\        RV4       K  	  R# )rL   rM   zAvailable versions of :rN    N)r$   r   r;   rF   r   r=   )r8   r$   r>   r&   vs   &    r   r&   r&   ~   sn    <<DG223H<<DeD6)=>??	"4&
*+*c1 r   c               $    V ^8  d   QhRRRRRR/# )r   	from_pathrI   
spdir_namer   r   r   )r   s   "r   r   r      s!     = =C =S =T =r   c                x   \         P                  P                  V 4      '       d2   V P                  R 4      '       g   Q h\        P
                  ! W4       R# \         P                  P                  V 4      '       d   \         P                  P                  V 4      p\         P                  P                  W4      p\         P                  P                  V4      '       d   \        RV R24      h\        P                  ! 4       pVe   \        P                  ! V4      pMRp\        P                  ! WVR7       R# R# )rW   zOutput dir z$ already exists. Will not overwrite.N)ignore)r\   r]   isfileendswithshutilcopyr^   basenamer`   ra   r_   r   r[   ignore_patternscopytree)r   r   
sproj_name	outputdirsubpdirr   s   &&    r   do_promotionr      s    	ww~~i  !!'****I*	y	!	!WW%%i0
GGLL8	77>>)$${9+5YZ[[--/++G4FF	V< 
"r   c                    V ^8  d   QhRRRR/# r7   r   )r   s   "r   r   r      s     ) )) )d )r   c                D   V P                   p\        P                  ! 4       pVf   \        R4      h\        P                  ! V4      pVP                  R\        P                  4      pVP                  4        F  pWE9   g   K  \        WB4        R # 	  W9  d   \        RV R24      hW1,          p\        V4      ^8  dO   \        RV R2\        P                  R7       V F  p\        V\        P                  R7       K   	  \        ^4      h\        V^ ,          V4       R # )NHSubproject dir not found. Run this script in your source root directory.rY   zSubproject z not found in directory tree.z"There is more than one version of z/ in tree. Please specify which one to promote:
file)r)   r   r[   r_   detect_subprojectsreplacer\   sepvaluesr   lenr=   sysstderr)r8   argumentr   sprojssystem_native_path_argumentmatchesss   &      r   r(   r(      s    ##H,,.Jcdd((4F #+"2"23"?==?&14A # ;xj0MNOOG
7|a28*<lmtwt~t~A!#**% mZ(r   c                    V ^8  d   QhRRRR/# r7   r   )r   s   "r   r   r      s     N N( NT Nr   c                P   \        R 4       \        P                  ! 4       pVf   Q R4       h\        V R24       F  p\        P
                  P                  V4      RR p \        W0P                  4      w  rE \        T4      w  rg  pYd8X  d   Yu8X  d   \        RTRT R	T R
24       Kp  \        RTRT RT RT RT R2	4       K  	  R#   \         d"    \        RTR\        P                  R7        K  i ; i  \         d"    \        RTR\        P                  R7        K  i ; i)zSubproject statusNz2This should only happen in a non-native subprojectz/*.wrap znot available in wrapdb.r   zWrap file not from wrapdb.zup to date. Branch z, revision .znot up to date. Have r|   z, but z is available.)r=   r   r[   r   r\   r]   r   rT   r;   	Exceptionr   r   rx   )	r8   subdirwr$   latest_branchlatest_revisioncurrent_branchcurrent_revisionrX   s	   &        r   r'   r'      sC   	
((*FSSSVHG$%ww"3B'	/A$H^H^/_,]	:Ma:P7^q!Q */?/R"d1.1AM]L^^_`a"d3N3C1EUDVV\]j\kklm|l}  ~L  M  N &  	"d6SZZH	
  	"d8szzJ	s$    C
8C9
(C65C69(D%$D%c                    V ^8  d   QhRRRR/# r7   r   )r   s   "r   r   r      s      +  r   c                h   \        V P                  4      p\        P                  ! 4       pVf   \	        R4      h\
        P                  ! VRR7       \        \
        P                  P                  VR4      R4      ;_uu_ 4       pVP                  V4       R R R 4       R #   + '       g   i     R # ; i)Nr   T)exist_okzwrapdb.jsonrZ   )r	   r;   r   r[   r_   r\   makedirsrb   r]   r`   rc   )r8   datard   rg   s   &   r   r2   r2      s|    W334D"557"cddKK#d3	bggll.>	E	E	 
F	E	E	Es   B  B1	c                    V ^8  d   QhRRRR/# )r   r8   r9   r   intr   )r   s   "r   r   r      s      % # r   c                (    V P                  V 4       ^ # )r   r!   )r8   s   &r   r1   r1      s    gr   )!
__future__r   r   r\   rp   r   typingTr   wrapr   r   r   r   r	   r
   r   r   r   TYPE_CHECKINGargparser5   r/   r#   rT   r%   rx   r&   r   r(   r'   r2   r1   r   r   r   <module>r      ss    #     7 7 %???*(X
	AE b(=$)2N*r   