
    2i<                       S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
r
S SKrS SKrS SKrS SKrS SKJrJr  S SKJr  S SKJrJr  S SKrSSKJrJr  SSKJr  SS	KJrJrJ r   SS
K!J"r"J#r#J$r$  SSKJ%r%  SSSSSSSS.r&\'RQ                  \&S5      r)\RT                  " S\&S9r+S1S jr,S2S3S jjr-  S4             S5S jjr.\R^                  " 5       R`                  S-
  r1\1S ::  a  Sr1\" \Rd                  S\1S9r3SS.S6S jjr4S7S  jr5S8S9S! jjr6S:S" jr7            S;S# jr8 S<           S=S$ jjr9                S>S% jr:\Rv                  S?S& j5       r<S@S' jr=    SA               SBS( jjr>    SA               SBS) jjr?SCS* jr@SDSES+ jjrAS1S, jrB\CS-:X  a  \A" \
R                  SS S.5        S/S0/rEg)F    )annotationsN)IteratorSequence)partial)NoReturnTextIO   )ProjectBuilder_ctx)env)BuildBackendExceptionBuildExceptionFailedProcessError)ConfigSettingsDistributionStrPath)DefaultIsolatedEnvz[91mz[92mz[93mz[1mz[2mz[4mz[0m)redgreenyellowbolddim	underlinereset _styles)defaultc                 T   S[         R                  ;   aC  S[         R                  ;   a  [        R                  " SSS9  [        R                  [        5        O8S[         R                  ;   d#  [        R                  R                  5       (       a  g [        R                  [        5        g )NNO_COLORFORCE_COLORzLBoth NO_COLOR and FORCE_COLOR environment variables are set, disabling color   )
stacklevel)
osenvironwarningswarnr   set
_NO_COLORSsysstdoutisatty     H/home/james-whalen/.local/lib/python3.13/site-packages/build/__main__.py_init_colorsr/   /   sc    RZZBJJ&MMhuvwJ	"**	$

(9(9(;(;KK
r-   c                `    [        U R                  " U40 [        R                  5       D6USS9  g )NT)fileflush)printformatr   get)fmtmsgr1   s      r.   _cprintr8   9   s"    	#**S
*GKKM
*TBr-   c                .    [        S[        U 5      5        g )Nz{yellow}WARNING{reset} {})r8   str)messagecategoryfilenamelinenor1   lines         r.   _showwarningr@   =   s     'W6r-   r!   N     )subsequent_indentwidth)originc          	     D   UcB  U R                  5       tp#[        S[        USS95        U H  n[        [        USS95        M     g US   S:X  aR  US   S:X  a  S	OS
nUS   S:X  a  [        R
                  OS nU R                  5        H  n[        S[        XES9US9  M     g g )Nz{bold}{}{reset}z* )initial_indentrB   r   
subprocessr	   cmdz> z< stderrz{dim}{}{reset})r1   )
splitlinesr8   _fillr3   r)   rJ   )r;   rE   firstrestr?   rG   r1   s          r.   _logrO   P   s    ~ ++-!5t#DED%T23  
l	"!'e!3#AY(2szz&&(D$eD&PW[\ ) 
#r-   c                6   [         [        l        [        R                  " 5       S:X  a   SS KnUR                  5         [        5         [        R                  R                  [        5        [        R                  R                  U 5        g ! [         a     NYf = f)NWindowsr   )r@   r%   showwarningplatformsystemcoloramainitModuleNotFoundErrorr/   r   LOGGERr'   rO   	VERBOSITY)	verbosityrU   s     r.   
_setup_clir[   ^   sg    'HI%	MMO NKKOODNNy! # 		s   B 
BBc                0    [        SU 5        [        U5      e)z
Print an error message and exit. Will color the output when writing to a TTY.

:param msg: Error message
:param code: Error code
z{red}ERROR{reset} {})r8   
SystemExit)r7   codes     r.   _errorr_   o   s     "C(
T
r-   c                2    SR                  S U  5       5      $ )Nz -> c              3  d   #    U  H&  oR                  S 5      S   R                  5       v   M(     g7f);r   N)	partitionstrip).0deps     r.   	<genexpr>$_format_dep_chain.<locals>.<genexpr>{   s(     J	}}S)!,2244	s   .0)join)	dep_chains    r.   _format_dep_chainrk   z   s    ;;J	JJJr-   c                4   [        US9 n[        R                  " XP5      nUR                  UR                  5        UR                  UR                  X#=(       d    0 5      5        UR                  X!U=(       d    0 5      sS S S 5        $ ! , (       d  f       g = f)N)	installer)r   r
   from_isolated_envinstallbuild_system_requiresget_requires_for_buildbuild)srcdiroutdirdistributionconfig_settingsrm   r   builders          r.   _build_in_isolated_envrx   ~   sl     
i	0C 223?G112G22<AVTVWX}}\?3HbI 
1	0	0s   A5B		
Bc                    [        U 5      nU(       dQ  UR                  X#=(       d    0 5      nU(       a0  SR                  S U 5       5      n[        5         [	        SU 35        UR                  X!U=(       d    0 5      $ )Nr   c              3  p   #    U  H,  oS    [        USS 5      4  H  o"(       d  M  SU-   v   M     M.     g7f)r   r	   Nz
	)rk   )re   depsrf   s      r.   rg   (_build_in_current_env.<locals>.<genexpr>   s;     "}GDUVPWYjkopqprksYtOuy|<6C<Ou<Gs    66zMissing dependencies:)r
   check_dependenciesri   r8   r_   rr   )rs   rt   ru   rv   skip_dependency_checkrw   missingdependenciess           r.   _build_in_current_envr      sh     V$G ,,\;PbQ77"}G"}}LI*<.9:==/D"EEr-   c                D    U (       a  [        XX4U5      $ [        XX4U5      $ N)rx   r   )	isolationrs   rt   ru   rv   r~   rm   s          r.   _buildr      s'     %flU^__$V\Tijjr-   c               #  "  #     S v   g ! [         [        4 a  n [        [        U 5      5         S n A g S n A f[         a  n [        U R                  [        R                  5      (       a  [        5         [        [        U 5      5        U R                  (       aP  [        R                  " U R                  S   U R                  S   U R                  S   SS9nSR                  U5      nO[        R                  " S5      n[        SUR                  S5      5        [        [        U 5      5         S n A g S n A f[          aN  n [        R                  " 5       R                  S5      n[        SU5        [        [        U 5      5         S n A g S n A ff = f7f)	Nr   r	   r!   )limitr   z
{dim}{}{reset}

)r   r   r_   r:   r   
isinstance	exceptionrH   CalledProcessErrorr8   exc_info	tracebackformat_exceptionri   
format_excrd   	Exception)etb_linestbs      r.   _handle_build_errorr      s    ./ s1v  akk:#@#@AAI3q6N:: 11

1

1

1	H "B%%b)B$bhhtn5s1v !!#))$/$b)s1vsL   F	 FF2FFC-D1,F1F>AFFFFc                    [        U 5      S:X  a  Sn[        U5      e[        U 5      S:X  a  U S   $ SR                  SR                  U S S 5      U S   5      $ )Nr   zno elementsr	   z	{} and {}z, r   )len
IndexErrorr4   ri   )elementsr7   s     r.   _natural_language_listr      s_    
8}o	X!	{!!IIhsm$RL
 	
r-   c           
         / nU H?  n[        X@XX5U5      n	UR                  [        R                  R	                  U	5      5        MA     U$ )a`  
Run the build process.

:param srcdir: Source directory
:param outdir: Output directory
:param distribution: Distribution to build (sdist or wheel)
:param config_settings: Configuration settings to be passed to the backend
:param isolation: Isolate the build in a separate environment
:param skip_dependency_check: Do not perform the dependency check
)r   appendr#   pathbasename)
rs   rt   distributionsrv   r   r~   rm   builtru   outs
             r.   build_packager      sF    & E%YofopRWW%%c*+ & Lr-   c                   SSK Jn  SU;   a  Sn[        U5      e[        X@USX5U5      n	[        R
                  R                  U	5      n
[        R                  " SS9n/ nU(       a  UR                  R                  U	5       nUR                  U5         [        R                  " S[        U5       S35        [        R
                  R                  XS	[!        S
5      *  5      n U H?  n[        X@XX5U5      nUR#                  [        R
                  R                  U5      5        MA     [$        R&                  " USS9   S	S	S	5        U
/UQ$ ! [$        R&                  " USS9  f = f! , (       d  f       N-= f)a  
Build a sdist and then the specified distributions from it.

:param srcdir: Source directory
:param outdir: Output directory
:param distribution: Distribution to build (only wheel)
:param config_settings: Configuration settings to be passed to the backend
:param isolation: Isolate the build in a separate environment
:param skip_dependency_check: Do not perform the dependency check
r	   )tarfilesdistz=Only binary distributions are allowed but sdist was specifiedzbuild-via-sdist-)prefixz	Building z from sdistNz.tar.gzT)ignore_errors)_compatr   
ValueErrorr   r#   r   r   tempfilemkdtempTarFileopen
extractallr   logr   ri   r   r   shutilrmtree)rs   rt   r   rv   r   r~   rm   r   r7   r   
sdist_name	sdist_outr   tru   r   s                   r.   build_package_via_sdistr      s5   & !-Mo9fg_hiE!!%(J  (:;IE__!!%(ALL#=9%;M%J$K;WXi<Ms9~o1NO$1L F/r{|CLL!1!1#!67 %2 it< )  it< )(s%    E$BE
'E$
E!!E$$
E2c                 2   [        [        R                  [        [        S5      S9n [
        R                  S:  a
  [        U SS9n [        [        R                  [        R                  " [        R                  " S5      R                  5       S5      U S9n[
        R                  S:  a  [        USSS	9nU" 5       nUR                  S
[        S[        R                  " 5       SS9  UR                  SSSS[         R"                   SSR%                  [         R&                  5       S3S9  UR                  SSSSSSS9  UR                  SSSS S!S"S#9  UR                  S$S%SS S&S'S#9  UR                  S(S)[        S*[        R(                   S+3S,S-9  UR                  S.S/S0S1S29  UR+                  5       nUR                  S3S4S0S5S29  UR                  S6[,        R.                  S7S89  UR+                  5       nUR                  S9S:S;S<S=S>S?9  UR                  S@SASBSCSD9  U$ )Ez
Construct the main parser.
   )rD   )      T)colora  
                A simple, correct Python build frontend.

                By default, a source distribution (sdist) is built from {srcdir}
                and a binary distribution (wheel) is built from the sdist.
                This is recommended as it will ensure the sdist can be used
                to build wheels.

                Pass -s/--sdist and/or -w/--wheel to build a specific distribution.
                If you do this, the default behavior will be disabled, and all
                artifacts will be built from {srcdir} (even if you combine
                -w/--wheel with -s/--sdist, the wheel will be built from {srcdir}).
                z    )descriptionformatter_class)suggest_on_errorr   rs   ?z0source directory (defaults to current directory))typenargsr   helpz	--versionz-Vversionzbuild z (,))actionr   z	--verbosez-vrZ   countr   zincrease verbosity)destr   r   r   z--sdistz-sr   append_constr   z;build a source distribution (disables the default behavior))r   r   constr   z--wheelz-wwheelz-build a wheel (disables the default behavior)z--outdirz-oz&output directory (defaults to {srcdir}zdist)PATH)r   r   metavarz--skip-dependency-checkz-x
store_truez2do not check that build dependencies are installed)r   r   z--no-isolationz-nzdisable building the project in an isolated virtual environment. Build dependencies must be installed separately when this option is usedz--installerz1Python package installer to use (defaults to pip))choicesr   z--config-settingz-Crv   r   zsettings to pass to the backend.  Multiple settings can be provided. Settings beginning with a hyphen will erroneously be interpreted as options to build if separated by a space character; use ``--config-setting=--my-setting -C--my-other-setting``zKEY[=VALUE])r   r   r   r   z--config-jsonconfig_jsonzsettings to pass to the backend as a JSON object. This is an alternative to --config-setting that allows complex nested structures. Cannot be used together with --config-settingJSON_STRING)r   r   r   )r   argparseRawDescriptionHelpFormattermin_max_terminal_widthr)   version_infoArgumentParsertextwrapindentdedentrd   add_argumentr:   r#   getcwdrr   __version__ri   __path__sepadd_mutually_exclusive_group_env
INSTALLERS)r   make_parserparser	env_groupconfig_groups        r.   main_parserr   !  s    hBB#NacfJghO
7"!/>OOOO eg!
( (-K0 7"kDM]F
		?   **+2chhu~~.F-GqI	   !   J   <   7xuE   !A	   335IS	   @  
 668L[   	 8    Mr-   c                   [        5       nU(       a  Xl        UR                  U 5      n[        UR                  S9  0 nUR
                  (       aB   [        R                  " UR
                  5      n[        U[        5      (       d  [        S5        OtUR                  (       ac  UR                   HS  nUR                  S5      u  pxn	Xt;  a  XU'   M"  [        XG   [        5      (       d  XG   /XG'   XG   R                  U	5        MU     UR                   c*  ["        R$                  R'                  UR(                  S5      OUR                   n
UR*                  nU(       a  [,        nO	[.        nS/n[1        5          U" UR(                  U
UUUR2                  (       + UR4                  UR6                  5      n[9        U Vs/ s H(  nSR:                  " U40 [<        R?                  5       D6PM*     sn5      n[A        S	U5        SSS5        g! [        R                   a  n[        SU 35         SnAGN(SnAff = fs  snf ! , (       d  f       g= f)
z
Parse the CLI arguments and invoke the build process.

:param cli_args: CLI arguments
:param prog: Program name to show in help text
)rZ   zN--config-json must contain a JSON object (dict), not a list or primitive valuezInvalid JSON in --config-json: N=distr   z!{underline}{}{reset}{bold}{green}z){bold}{green}Successfully built {}{reset})!r   prog
parse_argsr[   rZ   r   jsonloadsr   dictr_   JSONDecodeErrorrv   rc   listr   rt   r#   r   ri   rs   r   r   r   r   no_isolationr~   rm   r   r4   r   r5   r8   )cli_argsr   r   argsrv   r   argsetting_valuert   r   
build_callr   artifactartifact_lists                   r.   mainr     s    ]FX&D(O 	:"jj)9)9:Oot44gh
 
		''C #c 2G-+0(!/":DAA0?0H/IO,(//6 ( 37++2ERWW\\$++v.4;;F(,(:(:M"
,
 			KK!!!&&NN
 /chichW_077RGKKMRchi
 	;]K 
	3 ## 	:4QC899	:H j 
	s8   A H 5AH::/H5
)H:H2H--H25H::
Ic                 <    [        [        R                  SS  5        g )Nr	   )r   r)   argvr,   r-   r.   
entrypointr     s    !"r-   __main__zpython -m buildr   r   )returnNone)r   r   N)r6   r:   r7   r:   r1   TextIO | Noner   r  )NN)r;   zWarning | strr<   ztype[Warning]r=   r:   r>   intr1   r  r?   
str | Noner   r  )r;   r:   rE   ztuple[str, ...] | Noner   r  )rZ   r  r   r  )r	   )r7   r:   r^   r  r   r   )rj   Sequence[str]r   r:   )rs   r   rt   r   ru   r   rv   ConfigSettings | Nonerm   _env.Installerr   r:   )F)rs   r   rt   r   ru   r   rv   r  r~   boolr   r:   )r   r  rs   r   rt   r   ru   r   rv   r  r~   r  rm   r  r   r:   )r   zIterator[None])r   r  r   r:   )NTFpip)rs   r   rt   r   r   zSequence[Distribution]rv   r  r   r  r~   r  rm   r  r   r  )r   zargparse.ArgumentParserr   )r   r  r   r  r   r  )F
__future__r   r   
contextlibcontextvarsr   r#   rS   r   rH   r)   r   r   r   r%   collections.abcr   r   	functoolsr   typingr   r   rr   r   r
   r   r   r   _exceptionsr   r   r   _typesr   r   r   r   _COLORSr   fromkeysr(   
ContextVarr   r/   r8   r@   get_terminal_sizecolumnsr   fillrL   rO   r[   r_   rk   rx   r   r   contextmanagerr   r   r   r   r   r   r   __name__r   __all__r,   r-   r.   <module>r     sQ   #     	    
     .  #  "  R R 9 9 #  ]]7B'
 
 
 G
<C 777 7 	7
 7 7 
7 ..0881< ! 	=PQ <@ ]""KJJJ J +	J
 J 	J* #(FFF F +	F
  F 	F&kkk k 	k
 +k  k k 	k  8

" .2"' % * +	
     < .2"' %* * *  **  +	* 
 *   *  *  * Zxv<L~ z!"() r-   