+
    UBiG                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHtHtHtHtHt ^R	IH t  ^ R
I!H"t# ^ RI$H%t% ^ RI&H't'H(t(H)t) ^RI*H+t+ ]PX                  '       d   ^RI-H.t. ^RI/H0t0 . R4Ot1RRRRRRRR/t2]Pf                  R58  d"   ]4! ]	Pj                  4      ]	Pl                  n7        R R lt"R R lt8Rt9R R lt:R R  lt;R! R" lt<] ! R# R$]Pz                  R%7      4       t> ! R& R']>4      t? ! R( R)]>4      t@R* R+ ltAR, R- ltBR. R/ ltCR0 R1 ltDR2 R3 ltER# )6    )annotationsN)	dataclass)glob)Path)Environment)detect_ninja)GITMesonExceptionRealPathActionget_meson_command	quiet_gitwindows_proof_rmtreesetup_vsenv)	OptionKey)add_arguments)wrap)mlogbuildcmdline)run_exe)ImmutableListProtocol)ExecutableSerialisationbztargztarxztarzipz.tar.bz2z.tar.gzz.tar.xz.zipc                    V ^8  d   QhRRRR/# )   parserzargparse.ArgumentParserreturnNone )formats   "5/usr/lib/python3.14/site-packages/mesonbuild/mdist.py__annotate__r&   1   s     
J 
J1 
Jd 
J    c                    V P                  R R\        RR7       V P                  RRRR7       V P                  RR	R
R7       V P                  RRRR7       V P                  RRRR7       R# )-Cwdz#directory to cd into before running)destactionhelpz--allow-dirty
store_truez8Allow even when repository contains uncommitted changes.)r,   r-   z	--formatsr   zaComma separated list of archive types to create. Supports xztar (default), bztar, gztar, and zip.)defaultr-   z--include-subprojectszEInclude source code of subprojects that have been used for the build.z
--no-testsz)Do not build and test generated packages.N)add_argumentr   )r    s   &r%   r   r   1   s    
4B  D
W  Y
W A  B
/d  f
\H  Jr'   c                    V ^8  d   QhRRRR/# )r   fnamestrr!   r"   r#   )r$   s   "r%   r&   r&   >   s     K Ks Kt Kr'   c           
        V R ,           p\         P                  ! 4       pVP                  \        V R4      P	                  4       4       \        VRRR7      ;_uu_ 4       pVP                  RP                  VP                  4       \        P                  P                  V 4      4      4       RRR4       R#   + '       g   i     R# ; i)z
.sha256sumrbwzutf-8)encodingz{} *{}
N)hashlibsha256updateopenreadwriter$   	hexdigestospathbasename)r2   hashnamemfs   &   r%   create_hashrE   >   s    |#HAHHT%##%&	hg	.	.! 	

!!!++-1A1A%1HIJ 
/	.	.	.s   AB55C	zPRepository has uncommitted changes that will not be included in the dist tarballc               $    V ^8  d   QhRRRRRR/# )r   msgr3   allow_dirtyboolr!   r"   r#   )r$   s   "r%   r&   r&   J   s!      # D T r'   c                    V'       d   \         P                  ! V 4       R# \         P                  ! V R ,           R,           4       \        P                  ! ^4       R# )
z:Use --allow-dirty to ignore the warning and proceed anywayN)r   warningerrorsysexit)rG   rH   s   &&r%   handle_dirty_optrP   J   s2    S

3: \\]r'   c                    V ^8  d   QhRRRR/# r   src_rootr3   r!   rI   r#   )r$   s   "r%   r&   r&   Q   s     ! !S !T !r'   c                   \        . ROV 4      ^ ,          '       d   R# \        P                  P                  \        P                  P	                  V R4      4      '       d   Rp\
        '       g)   VR,          pR\        P                  9   d
   VR,          pM2VR,          p\        R.V 4      w  r#R	V9   d   VR
,          pM	VR,          p\        P                  ! V4       R# )z
Checks if meson.build file at the root source directory is tracked by git.
It could be a subproject part of the parent project git repository.
Tz.gitz-Source tree looks like it may be a git repo, zbut git is not installed!	GITLAB_CIz This is a gitlab bug.zbut git returned a failure. statuszdubious ownershipzPThis is a bug in git itself, please set `git config --global safe.directory "*"`z/meson.build may not have been committed to git?F)zls-filesz--error-unmatchzmeson.build)	r   r?   r@   existsjoinr	   environr   rL   )rS   rG   poes   &   r%   is_gitr\   Q   s    
 ?J1MM	ww~~bggll8V455=s..Cbjj(//11Cxj(3EA"b( iiHHSr'   c                    V ^8  d   QhRRRR/# rR   r#   )r$   s   "r%   r&   r&   u   s     8 8C 8D 8r'   c                |    \         P                  P                  \         P                  P                  V R 4      4      # )z.hg)r?   r@   isdirrX   )rS   s   &r%   is_hgr`   u   s$    77==h677r'   c                      ] tR t^yt$ R]R&   R]R&   R]R&   R]R&   R]R&   R	]R
&   R R lt]P                  R R l4       tR R lt	Rt
R# )Distr3   	dist_namerS   bld_rootzT.List[ExecutableSerialisation]dist_scriptszT.Dict[str, str]subprojectsargparse.Namespaceoptionsc                   V ^8  d   QhRR/# r   r!   r"   r#   )r$   s   "r%   r&   Dist.__annotate__   s     C Ct Cr'   c                	    \         P                  P                  V P                  R 4      V n        \         P                  P                  V P                  V P
                  4      V n        R# )z
meson-distN)r?   r@   rX   rd   dist_subrc   distdir)selfs   &r%   __post_init__Dist.__post_init__   s:    T]]LAww||DMM4>>Br'   c                    V ^8  d   QhRRRR/# r   archivesT.List[str]r!   r#   )r$   s   "r%   r&   rk      s      K K r'   c                	    R # Nr#   )ro   rt   s   &&r%   create_distDist.create_dist   s    r'   c                   V ^8  d   QhRR/# rj   r#   )r$   s   "r%   r&   rk      s      $ r'   c                	   \         P                  P                  V P                  4      '       g   Q h\        P
                  ! 4       R .,           pRV P                  RV P                  RV P                  RRP                  R V 4       4      /pV P                   EF6  pVP                  '       d   VP                  V P                  9  d   K3  V P                  P                  VP                  R4      p\         P                  P                  V P                  V4      VR&   \         P                  P                  V P                  V4      VR	&   \         P                  P                  V P                  V4      VR
&   RP                  VP                  4      p\        RV: 24        \        W24      pV^ 8w  d   \         P"                  ! R4       EK6  EK9  	  R#   \$         d+    \        RT: 24       \         P"                  ! ^4        EKq  i ; i)rewriteMESON_DIST_ROOTMESON_SOURCE_ROOTMESON_BUILD_ROOTMESONREWRITE c              3  N   "   T F  p\         P                  ! V4      x  K  	  R # 5irw   )shlexquote).0xs   & r%   	<genexpr>(Dist.run_dist_scripts.<locals>.<genexpr>   s     'M1As   #% MESON_PROJECT_DIST_ROOTMESON_PROJECT_SOURCE_ROOTMESON_PROJECT_BUILD_ROOTzRunning custom dist script zDist script errored outzFailed to run dist script N)r?   r@   isabsrn   r   get_build_commandrS   rd   rX   re   
subprojectrf   getcmd_argsprintr   rN   rO   OSError)ro   mesonrewriteenvdsubdirnamercs   &      r%   run_dist_scriptsDist.run_dist_scripts   s   ww}}T\\****"446)D $,,"DMM!4==sxx'M'MM
 ""A|||D4D4D D%%))!,,;F-/WW\\$,,-OC)*/1ww||DMM6/RC+,.0ggll4==&.QC*+88AJJ'D/x89Q_7HH67  #  24(;<s   $(G0H
H)rm   rn   N)__name__
__module____qualname____firstlineno____annotations__rp   abcabstractmethodrx   r   __static_attributes__r#   r'   r%   rb   rb   y   sM    NMM11!!C 	  r'   rb   )	metaclassc                  b    ] tR t^tR R ltR R ltRR R lltR R	 ltR
 R ltR R lt	Rt
R# )GitDistc                    V ^8  d   QhRRRR/# )r   dir_r3   r!   r   r#   )r$   s   "r%   r&   GitDist.__annotate__   s     4 4S 4T 4r'   c                	    \        R R.VRR7      ^,          P                  4       pV'       g   \        V4      # \        \        V4      P                  4      p\        V4      P                  V^,
          ,          # )z	rev-parsez--show-prefixT)check)r   stripr   lenparents)ro   r   prefixprefix_levels   &&  r%   git_rootGitDist.git_root   s`     K94tLQOUUW:4<//0Dz!!,"233r'   c                   V ^8  d   QhRR/# r   r!   rI   r#   )r$   s   "r%   r&   r      s      $ r'   c                    \         P                  ! RRV P                  RRR.4       \         P                  ! RRV P                  RRR.4      pV^8H  # )	z2Check whether there are uncommitted changes in gitgitr)   zupdate-indexz-qz	--refreshz
diff-indexz--quietHEAD)
subprocesscallrS   )ro   rets   & r%   have_dirty_indexGitDist.have_dirty_index   sJ     	dmm^T;WXooudDMM<TZ[\axr'   Nc               0    V ^8  d   QhRRRRRRRRRRR	R
/# )r   srczT.Union[str, os.PathLike]rn   r3   revisionr   zT.Optional[str]r   r!   r"   r#   )r$   s   "r%   r&   r      s:     ' '5 ' 's '('9H'TX'r'   c                	   R RRRV.pVe   VP                  ^RV R24       Ve   VP                  RV.4       \        P                  ! 4       ;_uu_ 4       p\        P
                  ! WaVR7       VP                  ^ 4       \        P                  ! VR	7      pVP                  VR
7       RRR4       R#   + '       g   i     R# ; i)r   archivez--formattarNz	--prefix=/z--)cwdstdout)fileobj)r@   )
insertextendtempfileTemporaryFiler   
check_callseektarfiler;   
extractall)	ro   r   rn   r   r   r   cmdrD   ts	   &&&&&&   r%   copy_gitGitDist.copy_git   s    iUH=JJqIfXQ/0JJf~&##%%!!#q9FF1IQ'ALLgL&	 &%%%s   AB33C	c               $    V ^8  d   QhRRRRRR/# )r   rS   r3   rn   r!   r"   r#   )r$   s   "r%   r&   r      s!     3 3C 3# 3$ 3r'   c                	   V P                  4       '       d%   \        \        V P                  P                  4       \
        P                  P                  V4      '       d   \        V4       V P                  V4      pVP                  V4      '       d)   \
        P                  ! V4       V P                  W4       M\        V4      P                  V4      pVR ,           p\
        P                  P                  V4      '       d   \        V4       \
        P                  ! V4       V P                  W5\        V4      R7       \        WT4      P!                  V4       \        V4       V P#                  W4       R# )z-tmp)r   N)r   rP   msg_uncommitted_changesrh   rH   r?   r@   rW   r   r   samefilemakedirsr   r   relative_tor3   renameprocess_submodules)ro   rS   rn   	repo_rootr   tmp_distdirs   &&&   r%   process_git_projectGitDist.process_git_project   s      ""4dll6N6NO77>>'"" )MM(+	h''KK MM(,(^//	:F!F*Kww~~k**$[1KK$MM)VME%,,W5 -2r'   c               $    V ^8  d   QhRRRRRR/# )r   r   r3   rn   r!   r"   r#   )r$   s   "r%   r&   r      s&     ^ ^c ^C ^D ^r'   c                	v   \         P                  P                  VR 4      p\         P                  P                  V4      '       g   R# . ROp\        P
                  ! WARR7      P                  4       pV F  pVR,          pVR,          P                  R^4      w  rV	P                  R^4      ^ ,          p
VR8X  d   \        P                  ! RV
: R	24       Kd  VR9   d&   \        RV
: R
2V P                  P                  4       V P                  \         P                  P                  W4      W(V
R7       K  	  R# )z.gitmodulesNT)r   universal_newlines:N   N:r   NNr   -z
Submodule z3 is not checked out and cannot be added to the distzF has uncommitted changes that will not be included in the dist tarball)r   r   )r   	submodulerV   z--cachedz--recursive>   +U)r?   r@   rX   rW   r   check_output
splitlinessplitrsplitr   rL   rP   rh   rH   r   )ro   r   rn   module_filer   modlistr   rV   sha1restsubpaths   &&&        r%   r   GitDist.process_submodules   s   ggll36ww~~k**G))#4P[[] Ir]F"2,,S!4JDkk#q)!,G}z'4ghi:% :g[8~!  BF  BN  BN  BZ  BZ  [MM"'',,s4gU\M] !r'   c                    V ^8  d   QhRRRR/# rs   r#   )r$   s   "r%   r&   r      s      K K r'   c                	*   V P                  V P                  V P                  4       V P                  P	                  4        F  p\
        P                  P                  V P                  V4      p\
        P                  P                  V P                  V4      p\
        P                  P                  V4      '       d   K~  \        V4      '       d   V P                  W44       K  \        P                  ! W44       K  	  V P                  4        . pV Fi  pV P                  \        V,          ,           p\        P                  ! V P                  W`P                  V P                   R 7       VP#                  V4       Kk  	  \%        V P                  4       V# ))root_dirbase_dir)r   rS   rn   rf   valuesr?   r@   rX   rW   r\   shutilcopytreer   archive_extensionmake_archiverm   rc   appendr   )ro   rt   r@   sub_src_rootsub_distdiroutput_namesacompressed_names   &&      r%   rx   GitDist.create_dist   s     =$$++-D77<<t<L'',,t||T:Kww~~k**l##((C: . 	A"ll->q-AAOa--RVR`R`a0  	T\\*r'   r#   )r   NN)r   r   r   r   r   r   r   r   r   rx   r   r#   r'   r%   r   r      s&    4'3(^& r'   r   c                  .    ] tR t^tR R ltR R ltRtR# )HgDistc                   V ^8  d   QhRR/# r   r#   )r$   s   "r%   r&   HgDist.__annotate__   s     - -$ -r'   c                    \         P                  P                  4       pRVR&   VP                  RR4       \        P
                  ! RRV P                  R.VR7      pR	V9  # )
z1Check whether there are uncommitted changes in hgCLC_ALLLANGUAGENhg-Rsummary)r   s   commit: (clean))r?   rY   copypopr   r   rS   )ro   r   outs   &  r%   r   HgDist.have_dirty_index   sV    jjooH 	
D!%%tT4==)&LRUV!,,r'   c                    V ^8  d   QhRRRR/# rs   r#   )r$   s   "r%   r&   r  
  s     * *K *K *r'   c                	   V P                  4       '       d%   \        \        V P                  P                  4       V P
                  '       d   \        P                  ! R 4       \        P                  ! V P                  RR7       \        P                  P                  V P                  V P                  R,           4      pVR,           pVR,           pVR,           p\        P                  P                  V P                  V P                  R,           4      p\        P                  ! RR	R
V P                   RRRRV P                   R,           V.
4       . pRV9   dl   ^ RIpVP%                  VR4      ;_uu_ 4       p	\%        VR4      ;_uu_ 4       p
\&        P(                  ! W4       RRR4       RRR4       VP+                  V4       RV9   dl   ^ RIpVP%                  VR4      ;_uu_ 4       p\%        VR4      ;_uu_ 4       p
\&        P(                  ! W4       RRR4       RRR4       VP+                  V4       RV9   dl   ^ RIpVP%                  VR4      ;_uu_ 4       p\%        VR4      ;_uu_ 4       p
\&        P(                  ! W4       RRR4       RRR4       VP+                  V4       \        P0                  ! V4       RV9   d:   \        P                  ! RR	R
V P                   RRRV.4       VP+                  V4       V#   + '       g   i     ELf; i  + '       g   i     ELr; i  + '       g   i     EL; i  + '       g   i     EL(; i  + '       g   i     L; i  + '       g   i     L; i)z4dist scripts are not supported in Mercurial projectsT)exist_okz.tarz.xzz.bz2z.gzr   r	  r   r
  z-Sz-tr   z-Xz
/.hg[a-z]*r   Nwbr5   r   r   r   )r   rP   r   rh   rH   re   r   rL   r?   r   rm   r@   rX   rc   r   r   rS   lzmar;   r   copyfileobjr   bz2gzipunlink)ro   rt   tarnamexznamebz2namegznamezipnamer   r  xftfr  bfr  zfs   &&             r%   rx   HgDist.create_dist
  sm     ""4dll6N6NOLLOP
DMMD1'',,t}}dnnv.EF5F"5'',,t}}dnnv.EF 	tYdmmT4QV#T]]\%A7L 	Mh64((BWd0C0Cr""2* 1D('h'4((BWd0C0Cr""2* 1D((h64((BWd0C0Cr""2* 1D('
		'H!!4D$--tUZ\c"de(# 1D0C0C(((
 1D0C0C(((
 1D0C((sl   8LL	$L*L=?L)	L=M$1M	M$L	LL&	)L:4	L==M	M!M$$M4	r#   N)r   r   r   r   r   rx   r   r#   r'   r%   r  r     s    -* *r'   r  c               0    V ^8  d   QhRRRRRRRRRRRR	/# )
r   meson_commandru   unpacked_src_dirr3   builddir
installdir
ninja_argsr!   intr#   )r$   s   "r%   r&   r&   7  s>      +  PS ad r}   CF r'   c                   \         P                  ! V R W.,           4      ^ 8w  d   \        R4       ^# \         P                  ! WBR7      ^ 8w  d   \        R4       ^# \         P                  ! VR.,           VR7      ^ 8w  d   \        R4       ^# \        P                  P                  4       pW5R&   \         P                  ! VR.,           W%R7      ^ 8w  d   \        R	4       ^# ^ # )
z--backend=ninjaz,Running Meson on distribution package failed)r   z)Compiling the distribution package failedtestz5Running unit tests on the distribution package failedDESTDIRinstall)r   r   z*Installing the distribution package failed)r   r   r   r?   rY   r  )r$  r%  r&  r'  r(  myenvs   &&&&& r%   run_dist_stepsr/  7  s    }(9;K'VVW[\\<=z0A59:zVH,(;q@EFJJOOE!)zYK/XIQN:;r'   c               0    V ^8  d   QhRRRRRRRRRRR	R
/# )r   packagenamer3   _meson_commandzImmutableListProtocol[str]extra_meson_argsru   rd   privdirr!   r)  r#   )r$   s   "r%   r&   r&   H  sC      C 1K _j vy   EH   MP r'   c                \   \        R V  24       \        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  P                  VR4      pWVV3 FI  p\        P                  P	                  V4      '       d   \        V4       \        P                  ! V4       KK  	  \        4       p	\        P                  ! W4       \        \        P                  P                  VR4      4      p
\        V
4      ^8X  g   Q hV
^ ,          pVP                  4       pVR.,          pV\        V4      ,          pW,          p\        WWgV	4      pV^ 8  d   \        RV 24       V# \        V4       \        V4       \        V4       \        RV  R24       V# )	zTesting distribution package zdist-unpackz
dist-buildzdist-install*setupzDist check build directory was zDistribution package z tested)r   r?   r@   rX   rW   r   mkdirr   r   unpack_archiver   r   r  create_cmdline_argsr/  )r1  r2  r3  rd   r4  	unpackdirr&  r'  rZ   r(  unpacked_filesr%  r$  r   s   &&&&&         r%   
check_distr=  H  sa   	)+
78Wm4Iww||G\2Hg~6J:.77>>! #
 / J
+1"'',,y#67N~!###%a("'')MgYM(22M%M
(PZ
[C
Qw/z:; J	 	Y'X&Z(%k]':;Jr'   c                    V ^8  d   QhRRRR/# )r   rd   r3   r!   ru   r#   )r$   s   "r%   r&   r&   e  s     > ># >+ >r'   c                   \         P                  ! 4       p\        V4       \        P                  ! R VP                  . 4      4      p\        P                  ! V4       \        P                  ! W4       VP                  P                  \        R4      R4       \        P                  ! \        P                  ! V4      4      # )zcmdline.SharedCMDOptionsbackendr   )argparseArgumentParsermsetup_argparseTcast
parse_argsr   parse_cmd_line_optionsread_cmd_line_filecmd_line_optionsr  r   r   r   format_cmd_line_options)rd   r    argss   &  r%   r:  r:  e  s    $$&FF66,f.?.?.CDD""4(x.i	2B7;;w66t<==r'   c                    V ^8  d   QhRRRR/# )r   rh   rg   r!   ru   r#   )r$   s   "r%   r&   r&   n  s      ,> ; r'   c                   . pV P                   P                  R 4       F@  pV\        9  d"   \        P                  ! RV R\         R24       VP                  V4       KB  	  \        X4      ^ 8X  d   \        P                  ! R4       V# ),zValue "z" not one of permitted values .zNo archive types specified.)formatsr   archive_choicesrN   rO   r   r   )rh   resultis   &  r%   determine_archives_to_generaterT  n  sq    F__""3'O#HHwqc!??PPQRSa ( 1v{./Mr'   c                    V ^8  d   QhRRRR/# )r   rh   rg   r!   r)  r#   )r$   s   "r%   r&   r&   x  s     1 1# 1 1r'   c                   \        V P                  4      R ,          R,          pVP                  4       '       g   \        RV P                  : R24      h\        P
                  ! V P                  4      p\        P                  ! RVP                  P                  P                  P                  \        R4      4      4      p\        V4       VP                  P                  pVP                  P                  p\         P"                  P%                  VR 4      pVP&                  R,           VP(                  ,           p\+        V 4      p/ p	. p
V P,                  '       d   \         P"                  P%                  WBP.                  4      pVP0                   FE  p\2        P4                  ! W4      p\         P"                  P%                  VP.                  V4      W&   KG  	  V
P7                  R4       \9        V4      '       d   \:        pM:\=        V4      '       d   V	'       d   \?        R4       ^# \@        pM\?        R	4       ^# V! WtWRPB                  W4      pVPE                  V4      pVf   ^# ^ pV PF                  '       g   \I        V^ ,          \K        4       WV4      pV^ 8X  d!   V F  p\M        V4       \?        R
V4       K  	  V# )zmeson-privatez	build.datz
Directory z- does not seem to be a Meson build directory.rI   vsenvr   z-Dwrap_mode=nodownloadzC--include-subprojects option currently not supported with Mercurialz5Dist currently only works with Git or Mercurial reposCreated)'r   r*   is_filer
   r   loadrD  rE  environmentcoredataoptstoreget_value_forr   r   
source_dir	build_dirr?   r@   rX   project_nameproject_versionrT  include_subprojectssubproject_dirrf   r   get_directoryr   r\   r   r`   r   r  re   rx   no_testsr=  r   rE   )rh   	buildfileb
need_vsenvrS   rd   priv_dirrc   rt   rf   r3  rd  sub	directoryclsprojectnamesr   r   s   &                  r%   runrp  x  s   WZZ ?2[@Iz'**7deff

7::A 6 6 ? ? M MiX_N` abJ
}}''H}}&&Hww||Ho6H$q'8'88I-g6HK"""h0@0@A==C**>?I!ww||A,<,<iHK ! 	 89 h	xWXEF)xVG)E}	
Ba"3"57GS[\	QwD)T"  Ir'   )r   r   r   r   )      )F
__future__r   r   rA  r?   rN   r   r   r   r   r   r8   typingrD  dataclassesr   r   pathlibr   mesonbuild.environmentr   mesonbuild.tooldetectr   mesonbuild.mesonlibr	   r
   r   r   r   r   r   rh   r   mesonbuild.msetupr   rC  mesonbuild.wrapr   
mesonbuildr   r   r   scripts.meson_exer   TYPE_CHECKING_typingr   mesonlibr   rQ  r   version_infostaticmethodfully_trusted_filterTarFileextraction_filterrE   r   rP   r\   r`   ABCMetarb   r   r  r/  r=  r:  rT  rp  r#   r'   r%   <module>r     s1  
 #   	 
        !   . .D D D  >   + + &???.14jiiF$ 
 w(4W5Q5Q(RGOO%
JK m !H8 'S[[ ' 'TXd Xv5T 5p":>1r'   