+
    2j E                    0   R t ^ RIH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Ht ^ RIt^ RIt^ RIt^ RIHtHt ^ RIHt ^R	IHt ^R
IHt ^RIHtH t  ^RI!H"t" ^RI#H$t$H%t% ^RI&H't'H(t( ^RI)H*t*H+t+H,t, ^RI-H.t. ]'       d   ^ RI/H0t0 ^RI1H2t2 . R/Ot3]Ph                  ! ]54      t6Rt7R0t8RRRR1/R R llt9RRRR1/R R llt:]
R R l4       t;R R lt<R R  lt=R! R" lt>R# R$ lt?R% R& lt@R' R( ltAR) R* ltBR+ R, ltCR- R. ltDR# )2a,  Orchestrate ``[build-system]`` setup and metadata extraction.

The entry point is :func:`run_build_backend`.  Given a source
directory with a ``pyproject.toml`` whose ``project.dynamic``
contains fields nab cannot read statically, run_build_backend:

1. Reads ``[build-system].requires`` and ``[build-system].build-backend``
   (defaulting to ``setuptools.build_meta:__legacy__`` per PEP 517).
2. Opens a :class:`~nab_python._build.env.NabBuildEnv` populated with
   those requirements.
3. Hands the env to ``build.ProjectBuilder.from_isolated_env`` and
   asks it for the wheel metadata via ``prepare()``, falling back to
   a full ``build_wheel`` and reading the wheel's own dist-info when
   the backend lacks ``prepare_metadata_for_build_wheel``.
4. Parses the resulting ``METADATA`` file into
   :class:`~nab_python.metadata.WheelMetadata`.

The hatchling-with-dynamic-deps quirk uv documents (the prepare
hook can return data that does not match the eventual wheel) is
covered by skipping the prepare step for that combination; see
:func:`_should_skip_prepare`.
)annotationsN)contextmanager)message_from_string)Path)TYPE_CHECKINGAny)UnsupportedWheelErrorwheel_metadata_member)ResolutionError)Requirement)SpecifierSet)canonicalize_nameparse_wheel_filename)Version)WheelMetadatavalidate_specifier_versions)	PathState
path_state)
BuildChainBuildEnvErrorNabBuildEnv)BuildBackendError)Iterator)NabProjectConfigz setuptools.build_meta:__legacy__offlineFchainc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )   
source_dirr   configr   r   boolr   r   returnr    )formats   "c/home/user/billing-ledger-validation/.venv/lib/python3.14/site-packages/nab_python/_build/runner.py__annotate__r%   G   s<     ': ':': ': 	':
 ': ':    c               |   \        V 4      p\        WWVR7      ;_uu_ 4       w  rV\        P                  ! RR7      ;_uu_ 4       p\	        V\        V4      V\        Wd4      R7      p\        VR,          4      uuRRR4       uuRRR4       #   + '       g   i     M; i RRR4       R#   + '       g   i     R# ; i)a  Extract wheel metadata for ``source_dir`` via the build backend.

Returns a :class:`~nab_python.metadata.WheelMetadata` parsed from
the ``METADATA`` file the backend produces.  Raises
:class:`BuildBackendError` on any failure: backend import
error, a rejected ``backend-path``, hook crash, malformed
METADATA, an unreadable built wheel, a build requirement that
cannot be installed or built, or build requirements ``offline``
bars from being fetched.

The build runs in an isolated venv driven by
:class:`NabBuildEnv`; nothing in the user's main environment is
perturbed.  The build env owns its own HTTP transport (see
:class:`NabBuildEnv` for why) so callers do not pass one in.

``chain`` names the builds this one is nested inside; see
:data:`~nab_python._build.env.BuildChain`.
r   r   r   znab-build-meta-)prefix)backendskip_prepareMETADATAN)_read_pyproject_prepared_projecttempfileTemporaryDirectory_extract_metadata_dirr   _should_skip_prepare_parse_metadata)	r   r   r   r   dataprojectr*   out_strmetadata_dirs	   &$$$     r$   run_build_backendr8   G   s    2 :&D 	VE	
 	
g##+<==,M-g<	
 |j89 	>=	
 	
 	>==	
 	
 	
 	
s#   "B*3B	7
B*BB**B;	c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   r   r   
output_dirr   r   r   r    r   r   r!   r"   )r#   s   "r$   r%   r%   q   sF      2  2 2  2 	 2
  2  2 
 2r&   c          
         \        V 4      p\        WW#VR7      ;_uu_ 4       w  rg \        VP                  R\	        V4      4      4      uuRRR4       #   \
         d   pRT: RT 2p	\        T	4      ThRp?ii ; i  + '       g   i     R# ; i)a  Build ``source_dir`` into a wheel under ``output_dir`` and return its path.

The metadata path only ever needs a backend's answer, so it can
stop at ``prepare_metadata_for_build_wheel``.  This one is for a
build requirement that has to be installed, which takes a real
wheel and therefore the full ``build_wheel`` hook.

Raises :class:`BuildBackendError` on any failure, like
:func:`run_build_backend`.
r(   wheelNbuild backend z. returned a non-string path from build_wheel: )r-   r.   r   buildstr	TypeErrorr   )
r   r:   r   r   r   r4   r5   r*   excmsgs
   &$$$$     r$   build_wheel_for_installrC   q   s    $ :&D	
 
	'		2gs:?@	
 
  	2  ,&&)U,  $C(c1	2
 
 
s(   A<#AA9A44A99A<<B	c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r   r   r   r4   dictr   r   r   r    r   r   r!   z*Iterator[tuple[build.ProjectBuilder, str]]r"   )r#   s   "r$   r%   r%      sD     &. &.&.
&. 	&.
 &. &. 0&.r&   c             #  D  "   \        V4      w  rVp\        W4        \        \        V4      W#VR7      ;_uu_ 4       p\        P
                  P                  V\        V 4      \        P                  R7      p	\        WVR7       W3x  RRR4       R#   + '       g   i     R# ; i  \        P                  \        P                  \        P                  3 d   p
RT: RT
 2p\        T4      T
hRp
?
i\        \         3 d   p
RT: RT
 2p\        T4      T
hRp
?
ii ; i5i)aC  Yield a builder for ``source_dir`` in an env holding its build requirements.

Yields the backend name beside the builder because every failure
message names it.  Failures from setting the env up and from the
caller's own block both come out as :class:`BuildBackendError`,
which is the contract both entry points advertise.
)requiresr   r   r   )r   runnerr*   Nr=   z	 failed: zbuild env setup for )_read_build_system_validate_backend_pathr   listr>   ProjectBuilderfrom_isolated_envr?   pyproject_hooksquiet_subprocess_runner_install_extra_requiresBuildExceptionBuildBackendExceptionFailedProcessErrorr   r   r
   )r   r4   r   r   r   r*   rG   backend_pathenvr5   rA   rB   s   &&$$$       r$   r.   r.      s      '9&>#G|:4.(^F5
 
**<<z?&>> = G
 $G'B""
 
 
 
 	##   .
 wk3%8$#-?+ .$WKy>$#-.s^   D B& ABB& D B#	B& !D #B& &4DC//DDDDD c               (    V ^8  d   QhRRRRRRRR/# )	r   r5   build.ProjectBuilderrV   r   r*   r?   r!   Noner"   )r#   s   "r$   r%   r%      s,      !(3AD	r&   c                   \        V P                  R4      \        R7      pV'       g   R# \        W2R7       \        P                  RV4       VP                  V4       R# )zBInstall whatever ``get_requires_for_build_wheel`` asks for on top.r<   )keyNrI   z"build backend asked for extras: %s)sortedget_requires_for_buildr?   _validate_extra_requiresloggerdebuginstall)r5   rV   r*   extras   &&$ r$   rQ   rQ      sD     711':DEU4
LL5u=KKr&   c               $    V ^8  d   QhRRRRRR/# )r   rb   z	list[Any]r*   r?   r!   rY   r"   )r#   s   "r$   r%   r%      s!     2 2I 23 24 2r&   c               $   V  Uu. uF  p\        V\        4      '       d   K  VNK  	  ppV'       d   RV: RV: 2p\        V4      hV  F  p VP                  R4       K  	  R# u upi   \         d   pRT: RT: 2p\        T4      ThRp?ii ; i)zReject a hook result the build env cannot install.

PEP 517 requires strings, and the build env writes each one into the
UTF-8 pyproject its inner resolve reads.
r=   zL returned a non-string build requirement from get_requires_for_build_wheel: utf-8za returned a build requirement from get_requires_for_build_wheel that cannot be encoded as UTF-8: N)
isinstancer?   r   encodeUnicodeEncodeError)rb   r*   itemnon_strrB   rA   s   &$    r$   r^   r^      s     !&CZc-BttGCWK (??FkK 	  $$	2KK   D " 	2  ,($ 
 $C(c1	2s"   A$A$A))B4B

Bc                    V ^8  d   QhRRRR/# )r   r   r   r!   rE   r"   )r#   s   "r$   r%   r%      s     ! ! ! !r&   c                   V R,          p\        V4      pVP                  '       d(    \        P                  ! VP	                  RR7      4      # V\        P                  Jd   V R2p\        V4      h\        V R,          4      P                  '       d   / # R	V  2p\        V4      h  \
        \        \        P                  3 d   pRT  RT 2p\        T4      ThRp?ii ; i)
zKReturn the parsed ``pyproject.toml``, or ``{}`` for a legacy setup.py tree.zpyproject.tomlre   encodingz!could not read pyproject.toml at : Nz! exists but is not a regular filezsetup.pyz!no pyproject.toml or setup.py at )r   should_readtomliloads	read_textOSErrorUnicodeDecodeErrorTOMLDecodeErrorr   r   ABSENT)r   	pyprojectstaterA   rB   s   &    r$   r-   r-      s    --Iy!E	2;;y22G2DEE I$$$<=$$*z)*666 	-j\
:C
C
   +U-B-BC 	25j\C5IC#C(c1	2s   %B& & CCCc                    V ^8  d   QhRRRR/# )r   r4   rE   r!   z3tuple[str, tuple[str, ...], tuple[str, ...] | None]r"   )r#   s   "r$   r%   r%     s      +  +
 +8 +r&   c                   RV 9  d   \         \        R3# V R,          p\        V\        4      '       g$   R\	        V4      P
                   2p\        V4      hVP                  R4      p\        V\        4      '       g   \         pVP                  R4      p\        V\        4      '       dG   \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   \        V4      pM\        pVP                  R	4      pRp\        V\        4      '       dF   \        ;QJ d    R
 V 4       F  '       d   K   RM	  RM! R
 V 4       4      '       d   \        V4      pW5V3# )zReturn ``(backend, requires, backend_path)`` per PEP 517 / 518.

A missing ``[build-system]`` takes the PEP 517 defaults; a
``build-system`` that is not a table is malformed, not absent.
zbuild-systemNz4build-system in pyproject.toml must be a table, not zbuild-backendrG   c              3  B   "   T F  p\        V\        4      x  K  	  R # 5iNrf   r?   ).0rs   & r$   	<genexpr>%_read_build_system.<locals>.<genexpr>  s     -W,QjC.@.@,   FTzbackend-pathc              3  B   "   T F  p\        V\        4      x  K  	  R # 5ir}   r~   )r   ps   & r$   r   r     s     )Oh*Q*<*<hr   )_DEFAULT_BACKEND_DEFAULT_REQUIRESrf   rE   type__name__r   getr?   rL   alltuple)r4   tablerB   r*   raw_requiresrG   raw_pathrU   s   &       r$   rJ   rJ     s    T!!2D88 EeT""K(()+ 	  $$ii(Ggs##"99Z(L,%%##-W,-W###-W,-W*W*W&$yy(H+/L(D!!cc)Oh)Occc)Oh)O&O&OXl**r&   c               $    V ^8  d   QhRRRRRR/# )r   r   r   rU   ztuple[str, ...] | Noner!   rY   r"   )r#   s   "r$   r%   r%   $  s$     ) ))$:)	)r&   c           	        \         P                  P                  V 4      p\         P                  P                  V4      pT;'       g    R F  p\         P                  P	                  V4      '       d   RV: R2p\        V4      h\         P                  P                  \         P                  P                  \         P                  P                  W$4      4      4      pVP                  V4      '       d   K  RV: R2p\        V4      h	  R# )zReject a ``backend-path`` a PEP 517 frontend would refuse.

pyproject_hooks raises a bare ``ValueError`` for an absolute entry
or one that leaves the source tree.
zbackend-path entry z7 in pyproject.toml must be relative to the project rootz- in pyproject.toml is outside the source treeNr"   )	ospathabspathnormcaseisabsr   normpathjoin
startswith)r   rU   root	norm_rootentryrB   resolveds   &&     r$   rK   rK   $  s     77??:&D  &I###77==%eY /0 0  $C(( 77##BGG$4$4RWW\\$5N$OP""9--%eY /# #  $C((! $r&   c               $    V ^8  d   QhRRRRRR/# )r   r*   r?   r4   rE   r!   r    r"   )r#   s   "r$   r%   r%   B  s&     A A# AT Ad Ar&   c                \   V P                  R4      '       g   R# VP                  R4      p\        V\        4      '       g   R# VP                  R4      p\        V\        4      '       g   R# V Uu0 uF  p\        V\
        4      '       g   K  VkK  	  pp\        VRR0,          4      # u upi )a0  Skip ``prepare_metadata_for_build_wheel`` when it would lie.

uv documents one specific quirk: hatchling's prepare-metadata
hook can return a metadata that does not match the eventual
``build_wheel`` output when ``project.dynamic`` includes
``dependencies`` (or ``optional-dependencies``).  Mirror that.
z
hatchling.Fr5   dynamicdependencieszoptional-dependencies)r   r   rf   rE   rL   r?   r    )r*   r4   r5   r   ddyns   &&    r$   r2   r2   B  s     l++hhy!Ggt$$kk)$Ggt$$
4gAs!311gC
4~'>??@@ 5s   0B)B)c          
     ,    V ^8  d   QhRRRRRRRRR	R/# )
r   r5   rX   r:   r   r*   r?   r+   r    r!   r"   )r#   s   "r$   r%   r%   V  s:     ,. ,.!,.,. 	,.
 ,. 
,.r&   c               r    V'       g"   V P                  RV4      pVe   \        V4      # \        W4      #   \        P                  \
        \        \        P                  \        P                  \        3 d   pRT: RT 2p\        T4      ThRp?i\         d   pRT: RT 2p\        T4      ThRp?ii ; i)a  Return the dist-info directory the backend produced.

``prepare_metadata_for_build_wheel`` is optional; ``prepare``
returns ``None`` when the backend has no such hook, which takes
the same route as ``skip_prepare``.

Two faults arrive raw rather than as a ``BuildBackendException``:
reading back the built wheel, and ``build`` joining a
path-returning hook's result onto ``output_dir``.
r<   Nr=   z produced an unreadable wheel: z/ returned a non-string path from a build hook: )preparer   _build_wheel_and_extractzipfile
BadZipFile
ValueErrorrt   zliberrorlzma	LZMAErrorRuntimeErrorr   r@   )r5   r:   r*   r+   preparedrA   rB   s   &&$$   r$   r1   r1   V  s    ".w
;H#H~%'<<
 	

 	. wk)HN$#-  .WK (##&%) 	  $#-.s0   6  6 
6 AB69BB6B6B11B6c               $    V ^8  d   QhRRRRRR/# )r   r5   rX   output_directoryr   r!   r"   )r#   s   "r$   r%   r%     s$     "+ "+!"+59"+	"+r&   c                ^  a
 V P                  R\        V4      4      p\        V4      p\        VP                  4      ^ ,          p\
        P                  ! V4      ;_uu_ 4       pVP                  4       p \        Wd4      pTf   RTP                   R2p	\        T	4      hTP                  R4      ^ ,          o
TP                  TT
3R lT 4       4       RRR4       TS
,          #   \         d$   pRTP                   RT 2p	\        T	4      ThRp?ii ; i  + '       g   i     TS
,          # ; i)a  Build a wheel and extract its own dist-info directory.

The built wheel ends up in ``output_directory``; this helper pulls
out the ``*.dist-info/`` for the distribution the wheel's filename
names and returns the path so the caller can read ``METADATA``.
Selection goes through
:func:`nab_index.local_index.wheel_metadata_member` so a built wheel
and an indexed one agree on what a wheel's own metadata is.
r<   zbuilt wheel z is unusable: Nz has no .dist-info/METADATA/c              3  f   <"   T F&  qP                  SR ,           4      '       g   K"  Vx  K(  	  R# 5i)r   N)r   )r   mdistinfo_dirs   & r$   r   +_build_wheel_and_extract.<locals>.<genexpr>  s!     B1lS.@!AQQs   1
1)r>   r?   r   r   namer   ZipFilenamelistr	   r   r   	partition
extractall)r5   r   r<   
wheel_pathexpectedzfnamesmemberrA   rB   r   s   &&        @r$   r   r     s    MM'3'7#89EeJ#JOO4Q7H		$	$	2*5;F >  11LMC#C(('',Q/
BB	
 
%$ l** % 	2  1uEC#C(c1	2 
%	$$ l**s1   "D4C#?AD#D.DDDD,	c                    V ^8  d   QhRRRR/# )r   metadata_pathr   r!   r   r"   )r#   s   "r$   r%   r%     s     @ @4 @M @r&   c                h   V P                  4       '       g   RV  2p\        V4      h V P                  RR7      p\	        T4      pTP                  R4      pTP                  R4      pT'       d	   T'       g   RT  R	T: R
T: R2p\        T4      h \        T4      pTP                  R4      pRp	T'       d    \        T4      p	\        T	4       . p
TP                  R4      ;'       g    R F5  p \        T4      p\        TP                  4       T
P                  T4       K7  	  \        TP                  R4      ;'       g    R Uu0 uF(  pTP                  4       ;p'       g   K  \!        T4      kK*  	  up4      p\#        \!        T4      TT	T
TR7      #   \         d   pRT  RT 2p\        T4      ThRp?ii ; i  \         d   pRT: RT 2p\        T4      ThRp?ii ; i  \         d   pRT: RT 2p\        T4      ThRp?ii ; i  \         d   pRT 2p\        T4      ThRp?ii ; iu upi )z6Parse a ``METADATA`` file into :class:`WheelMetadata`.z%backend produced no METADATA file at re   rm   zbackend METADATA at z is not valid UTF-8: NNamer   z" is missing Name or Version (Name=z
, Version=)z%backend METADATA has invalid Version ro   zRequires-Pythonz-backend METADATA has invalid Requires-Python zRequires-Distz/backend METADATA has an invalid Requires-Dist: zProvides-Extra)r   versionrequires_pythonrequires_distprovides_extrar"   )is_filer   rs   ru   r   r   r   r   r   r   get_allr   	specifierappendr\   stripr   r   )r   rB   textrA   msg_objname_rawversion_rawr   requires_python_rawr   r   rawreqrb   strippedr   s   &               r$   r3   r3     sr     ""5m_E$$.&&&8 "$'G{{6"H++i(K;"=/ 2\K?!= 	  $$.+& "++&78O	2*+>?O'8 (*M/5525	2c"C'6 	S! 6 !' !)9:@@b@	
@!KKM)) (h'@	
!N x('#% g  .$]O3HN$#-.  .5k_BseL$#-.  	2?&)C52  $C(c1	2  	2CC5IC#C(c1	2	
sk   F F; 8G# / HH/%H/F8F33F8;G GG #H.HHH,H''H,)r   rC   r8   )zsetuptools >= 40.8.0r"   )E__doc__
__future__r   loggingr   r   r/   r   r   
contextlibr   emailr   pathlibr   typingr   r   r>   rO   rq   nab_index.local_indexr   r	   nab_resolver.errorsr
   _vendor.packaging.requirementsr   _vendor.packaging.specifiersr   _vendor.packaging.utilsr   r   _vendor.packaging.versionr   metadatar   r   pathsr   r   rV   r   r   r   errorsr   collections.abcr   r   r   __all__	getLoggerr   r_   r   r   r8   rC   r.   rQ   r^   r-   rJ   rK   r2   r1   r   r3   r"   r&   r$   <module>r      s  . #   	    % %  %    N / 8 7 M / A ) 7 7 %() 
		8	$ 6 - ': 	':
 ':T 2
  2  2F &. &.R 24!2 +F)<A(,.^"+J@r&   