+
    UBis                        R t ^ RIHt ^ RIHt ^ 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t^ RIHtHtHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ]P:                  '       d   ^ RIt^ RIH t H!t!  ! R R] 4      t"0 Rmt#0 Rm]#,          t$0 Rmt%Rt&Rt' ! R R]4      t(Rt)R R lt*RR R llt+R R lt,R R lt-R# ) z*Code that creates simple startup projects.)annotations)Path)EnumN)glob)buildmesonlibmlog)FORBIDDEN_TARGET_NAMES)detect_ninja)create_meson_build)sample_generator)	OptionKey)ProtocolLiteralc                      ] tR t^t$ R]R&   R]R&   R]R&   R]R&   R]R&   R]R	&   R
]R&   R]R&   R
]R&   R]R&   R]R&   RtR# )	ArgumentszT.List[Path]srcfilesstrwdname
executabledepsz[Literal['c', 'cpp', 'cs', 'cuda', 'd', 'fortran', 'java', 'rust', 'objc', 'objcpp', 'vala']languageboolr   builddirforcez Literal['executable', 'library']typeversion N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r       5/usr/lib/python3.14/site-packages/mesonbuild/minit.pyr   r      s<    		mm..r%   r   r   z0.1c                      ] tR t^3tRtRtRtR# )DEFAULT_TYPESr   libraryr   N)r   r    r!   r"   EXELIBr$   r   r%   r&   r(   r(   3   s    
C
Cr%   r(   zpSample project created. To build it run the
following commands:

meson setup builddir
meson compile -C builddir
c                    V ^8  d   QhRRRR/# )   optionsr   returnNoner   )formats   "r&   __annotate__r2   ?   s      9  r%   c                ,   \        V 4      pV P                  \        R,          P                  8X  d   VP	                  4        MBV P                  \        R,          P                  8X  d   VP                  4        M\        R4      h\        \        4       R# )z
Based on what arguments are passed we check for a match in language
then check for project type and create new Meson samples project.
r*   r+   zUnreachable codeN)	r   r   r(   valuecreate_executablecreate_libraryRuntimeErrorprintINFO_MESSAGE)r.   
sample_gens   & r&   create_sampler;   ?   sh    
 "'*J||}U+111$$&	u-33	3!!#-..	,r%   c               $    V ^8  d   QhRRRRRR/# )r-   r.   r   sampler   r/   r0   r   )r1   s   "r&   r2   r2   M   s&     C8 C8	 C84 C8D C8r%   c                   V P                   '       g   \        4       P                  4       P                  V n         \        P
                  ! RV P                   4      '       g"   V'       d   \        RV P                    R24      h\        RV P                    R24       V P                  '       g+   V P                   V n        \        RV P                   R24       V P                  \        9   d&   \        P                  ! RV P                  : R24      hV'       d   R	# V P                  '       g   . pR
 \        4       P                  4        4        F+  pVP                  \        9   g   K  VP!                  V4       K-  	  V'       g   \        R4      hW n        \        RRP#                  R V 4       4      ,           4       V P$                  '       Egt   V P                   EF'  pVP                  R8X  d   RV n         EMVP                  R%9   d
   RV n         MVP                  R8X  d
   RV n         MVP                  R8X  d
   RV n         MVP                  R8X  d
   RV n         MVP                  \&        9   d
   RV n         MVP                  R8X  d
   RV n         MmVP                  R8X  d
   RV n         MSVP                  R8X  d
   RV n         M9VP                  R8X  d
   R V n         MVP                  R!8X  g   EK!  R"V n         M	  V P$                  '       g   \        R#4      h\        R$V P$                  ,           4       R	# R	# )&zT
Here we autodetect options for args not passed in so don't have to
think about it.
z[a-zA-Z_][a-zA-Z0-9]*zName of current directory "zM" is not usable as a sample project name.
Specify a project name with --name.zUsing "z." (name of current directory) as project name.z0" (project name) as name of executable to build.zExecutable name zI is reserved for Meson internal use. Refusing to init an invalid project.Nc              3  T   "   T F  qP                  4       '       g   K  Vx  K   	  R # 5iN)is_file).0fs   & r&   	<genexpr>%autodetect_options.<locals>.<genexpr>c   s     =-!!-s   (
(zdNo recognizable source files found.
Run meson init in an empty directory to create a sample project.zDetected source files:  c              3  8   "   T F  p\        V4      x  K  	  R # 5ir@   )r   )rB   ss   & r&   rD   rE   j   s     2L8a3q668s   .cccpp.cscs.cucuda.ddfortran.rsrust.mobjc.mmobjcpp.javajava.valavalaz5Can't autodetect language, please specify it with -l.zDetected language: >   .cc.cpp)r   r   resolvestemrematch
SystemExitr8   r   r	   r   MesonExceptionr   iterdirsuffixLANG_SUFFIXESappendjoinr   FORTRAN_SUFFIXES)r.   r=   r   rC   s   &&  r&   autodetect_optionsrk   M   s   
 <<<v~~',,xx/>>6:7<<. IC C D D~%STU$\\**++[\]33%%(89K9K8N OM 'M N 	N!#=TV^^-=Axx=(" >  ` a a#'#((2L82L*LLM!!Axx4#& xx?*#( xx5 #' xx5 #) xx4#& xx++#, xx5 #) xx4#) xx5 #+ xx7"#) xx7"#) C "D TUU#g&6&667K r%   c                    V ^8  d   QhRRRR/# )r-   parserz'argparse.ArgumentParser'r/   r0   r   )r1   s   "r&   r2   r2      s     s s3 s sr%   c                8   V P                  RRR\        RR7       V P                  RR\        P                  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\	        \
        4      RR7       V P                  RRRRR7       V P                  RRRR 7       V P                  R!R"RR#R7       V P                  R$\        R+R%\         R&2R'7       V P                  R(\        R)\         2R 7       R*# ),zP
Here we add args for that the user can passed when making a new
Meson project.
r   
sourcefile*z@source files. default: all recognized files in current directory)metavarnargsr   help-Cr   z#directory to cd into before running)destactionrs   z-nz--namez0project name. default: name of current directory)rs   z-ez--executablez&executable name. default: project namez-dz--depszdependencies, comma-separatedz-lz
--languagez=project language. default: autodetected based on source files)choicesrs   z-bz--build
store_truezbuild after generation)rv   rs   z
--builddirr   zdirectory for build)defaultrs   z-fz--forcez2force overwrite of existing files and directories.z--typezproject type. default: z based project)ry   rw   rs   z	--versionzproject version. default: N)r   r)   )add_argumentr   r   RealPathActionsortedLANG_SUPPORTEDDEFAULT_PROJECTDEFAULT_VERSION)rm   s   &r&   add_argumentsr      sK   
 
L$  VX  Y
40G0GB  D
h-_`
n3[\
h-LM
lF>4J  RQ  R
iC[\
g<QR
iCwx
/C\e|  ~M  }N  N\  d]  ^
_E_`o_pCqrr%   c                    V ^8  d   QhRRRR/# )r-   r.   r   r/   intr   )r1   s   "r&   r2   r2      s     ' ' 's 'r%   c                   \        V P                  4      P                  4       '       g   \        P                  ! R4       \
        P                  ! V P                  4       \        R4      '       g>   \        V RR7       V P                  '       g   \        R4       RV n	        \        V 4       MR\        V 4       \        R4      P                  4       '       d   V P                  '       g   \        R4      h\        V 4       V P                   '       Ed   \        V P"                  4      P%                  4       '       d>   V P                  '       d,   \        R	4       \&        P(                  ! V P"                  4       \        R
4       \*        P,                  ! 4       RV P"                  .,           p\.        P0                  ! V4      pVP2                  '       d   \        h\         P4                  ! V P"                  4      p\6        P8                  ! RVP:                  P<                  P>                  PA                  \C        R4      4      4      p\*        PD                  ! V4      pV'       d,   \F        PH                  ! \F        PJ                  ! R4      R4       \M        4       RV P"                  .,           p\.        P0                  ! V4      pVP2                  '       d   \        h^ # )z0
Here we generate the new Meson sample project.
zSProject source root directory not found. Run this command in source directory root.rp   T)r=   z.Defaulting to generating a C language project.rJ   zmeson.buildz5meson.build already exists. Use --force to overwrite.z,Build directory already exists, deleting it.zBuilding...setupr   vsenvzINFO:z1automatically activated MSVC compiler environmentrt   )'r   r   existssysexitoschdirr   rk   r   r8   r;   rA   r   rc   r   r   r   is_dirshutilrmtreer   get_meson_command
subprocessrun
returncodeloadTcastenvironmentcoredataoptstoreget_value_forr   setup_vsenvr   loggreenr
   )r.   cmdretb
need_vsenvvsenv_actives   &     r&   r   r      s    

""$$fgHHWZZ99740BC"Gg7#&&((TUU7#}}}  !((**w}}}@AMM'**+m((*gw7G7G-HHnnS!>>>JJw''(VVFAMM$:$:$C$C$Q$QR[\cRd$ef
++J7HHTZZ(*]^ng&6&677nnS!>>>r%   >   .F.f.F90.f90.for>   rI   rP   rU   r]   rL   rN   rW   rS   r^   rY   r[   >   rJ   rQ   rM   rK   rO   rZ   rV   rT   r\   rX   rR   )F).__doc__
__future__r   pathlibr   enumr   r   r   r   r   ra   r   typingr   
mesonbuildr   r   r   mesonbuild.coredatar	   mesonbuild.tooldetectr
   #mesonbuild.templates.mesontemplatesr   "mesonbuild.templates.samplefactoryr   mesonbuild.optionsr   TYPE_CHECKINGargparsetyping_extensionsr   r   r   rj   rg   r}   r~   r   r(   r9   r;   rk   r   r   r   r%   r&   <module>r      s    1 "     
 	 	   , , 6 . B ? (???3H  8 _brreD C8Ns$'r%   