+
    4jn                    r   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	t	^ RI
Ht ^ RIHtHtHt ^ RIHt ^ RIHtH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" ^RI#H$t$ ^RI%H&t& ^RI'H(t(H)t) ^RI*H+t+ ^RI,H-t-H.t.H/t/ ^RI0H1t1 ^RI2H3t3 ]'       dG   ^ RI4H5t5H6t6H7t7 ^ RI8H9t9 ^ RI:H;t; ^ RI<H=t= ^ RI>H?t? ^RI%H@t@HAtA ^RI*HBtBHCtCHDtDHEtE ^RIFHGtG ]! R]A]@4      tHR.tI] ! R R]4      4       tJ]P                  ! ]L4      tM]P                  R 8X  d   ]P                  R?8  d   R!M]P                  R 8X  d   R"MR#tPR$tQ ! R% R&]R4      tS]T]UR'3,          tV R( R) ltW]! R*R*R+7       ! R, R-4      4       tX ! R. R4      tYR/ R0 ltZR1 R2 lt[R3 R4 lt\R5 R6 lt]R7 R8 lt^R9 R: lt_R; R< lt`R= R> ltaR# )@a  Isolated build env that uses nab itself plus the PyPA ``installer``.

``NabBuildEnv`` implements ``build.env.IsolatedEnv`` so it slots into
``build.ProjectBuilder.from_isolated_env``.  The pieces:

* ``venv.EnvBuilder`` (stdlib) creates an empty interpreter at a temp
  path, ``with_pip=False``; nab does not need pip in there.
* nab's own resolver picks versions for ``[build-system].requires``
  using the same indexes / ``uploaded-prior-to`` window as the outer
  resolve.
* ``download_lock`` from :mod:`nab_python.download` fetches the
  resolved wheels into a temp directory.
* :func:`installer.install` writes each wheel into the venv via
  ``installer.SchemeDictionaryDestination``, configured from the
  venv's own scheme paths.

The env is a context manager.  Entering it builds the venv and
installs the requirements; exiting removes the temp tree.  The
``python_executable`` and ``make_extra_environ`` properties come
from ``build.env.IsolatedEnv``.
)annotationsN)suppress)	dataclassfieldreplace)Path)TYPE_CHECKINGTypeVar)install)SchemeDictionaryDestination)	WheelFile)extract_sdist_archive)Urllib3AsyncTransport)UnsupportedVcsErrorcanonicalize_name)NabProjectConfig)DownloadErrordownload_lock)IndexPin)BuildPolicy
DistPolicyMissingExtraError)InvalidProjectRequirementError)BuildBackendError)CallableIterableMapping)RecordEntry)Scheme)Self)AsyncHttpTransport)IndexOverridePackageOverride)	LockInputPinShapeSdistArtifact
TargetLock)TagSet
_OverrideTNabBuildEnvc                  f   a  ] tR t^Jt$ Rt]! ]RRR7      tR]R&   R V 3R llt	R V 3R	 llt
R
tV ;t# ) _FastSchemeDictionaryDestinationa  ``SchemeDictionaryDestination`` that skips bytecode-compile work.

The stock ``_compile_bytecode`` always resolves the target file's
real path before checking ``bytecode_optimization_levels``; with
an empty levels tuple, the loop body never runs but the resolve
still hits the filesystem twice per record.  Skipping the early
work when the levels tuple is empty is safe because the body
would have been a no-op.

``written`` records ``(scheme root, path within it)`` for every
file the install writes, so a later install can remove them.
F)default_factoryinitreprlist[tuple[Path, Path]]writtenc               $    V ^8  d   QhRRRRRR/# )   schemer   recordr   returnNone )formats   "g/home/user/pdf2html-billing-ledger-validate/.venv/lib/python3.14/site-packages/nab_python/_build/env.py__annotate__-_FastSchemeDictionaryDestination.__annotate__]   s!     2 2 2 2 2    c                	N   < V P                   '       g   R # \        SV `	  W4       R # N)bytecode_optimization_levelssuper_compile_bytecode)selfr4   r5   	__class__s   &&&r:   rB   2_FastSchemeDictionaryDestination._compile_bytecode]   s    000!&1r=   c               (    V ^8  d   QhRRRRRRRR/# )	r3   r4   r   record_file_pathstrrecordsz$Iterable[tuple[Scheme, RecordEntry]]r6   r7   r8   )r9   s   "r:   r;   r<   b   s8     I II I 6	I
 
Ir=   c                	   < \        V4      pV UUu. uF6  w  rV\        V P                  V,          4      \        VP                  4      3NK8  	  uppV n        \
        SV `  WV4       R # u uppi r?   )listr   scheme_dictpathr1   rA   finalize_installation)rC   r4   rG   rI   entriesentry_schemeentryrD   s   &&&&   r:   rN   6_FastSchemeDictionaryDestination.finalize_installationb   sf     w- (/
'.# $""<014

3CD'.

 	%fH
s   <A))r1   )__name__
__module____qualname____firstlineno____doc__r   rK   r1   __annotations__rB   rN   __static_attributes____classcell__)rD   s   @r:   r,   r,   J   s9     (-5u(G$ 2 2
I Ir=   r,   win32z	win-amd64zwin-ia32posixzimport json, sys, sysconfig;print(json.dumps({'paths': sysconfig.get_paths(),'prefix': sys.prefix,'py_version': '%d.%d' % sys.version_info[:2],}))c                      ] tR t^tRtRtR# )BuildEnvErrorzThe build env could not be set up.

Covers venv creation, the interpreter scheme probe, and the inner
resolve, download, and install of ``[build-system].requires``.
r8   N)rS   rT   rU   rV   rW   rY   r8   r=   r:   r^   r^      s    r=   r^   .c               $    V ^8  d   QhRRRRRR/# )r3   namerH   versionr6   r8   )r9   s   "r:   r;   r;      s!     2 2c 2C 2C 2r=   c                "    \        V 4       RV 2# )zGReturn the chain entry for one build, canonical so two spellings match. r   )r`   ra   s   &&r:   chain_labelrd      s    %&ay11r=   T)frozenslotsc                  0    ] tR t^t$ RtR]R&   R]R&   RtR# )_PendingBuildzCA build requirement this env has to build before it can install it.rH   labelr&   sdistr8   N)rS   rT   rU   rV   rW   rX   rY   r8   r=   r:   rh   rh      s    MJr=   rh   c                      ] tR t^tRtRRR]RR#/R R lltR R	 ltR
 R ltR R lt	R R lt
]R R l4       tR R ltR R ltRR/R R llt]R R l4       tR R ltR R ltR  R! ltR"tR# )$r*   a  An isolated PEP 518 build environment driven by nab.

Implements ``build.env.IsolatedEnv`` so it can be passed to
``build.ProjectBuilder.from_isolated_env``. The runtime cost
is one venv creation, one inner resolve over
``[build-system].requires``, one wheel download per dep, and
one ``installer.install`` per wheel.

``requires`` is the PEP 508 string list from
``[build-system].requires``. ``config`` carries the indexes,
``uploaded-prior-to`` window and other nab inputs from the outer
resolve; it is pruned (no local sources, no workspace, no
marker overlay) before the inner resolve so the build env is
computed against PyPI alone.

``offline`` refuses to populate the env at all, since every build
requirement would have to come off the network.  An empty
``requires`` needs nothing fetched and is still served.

``chain`` is the :data:`BuildChain` of builds this env is already
nested inside.  It is empty for the build a resolve asked for, and
every build requirement this env has to build itself passes on a
longer one, which is what bounds the recursion against
``[tool.nab].build-requires-depth`` and detects a cycle.

The venv is created from the host interpreter and the PEP 517
hooks run in it, so the build requirements resolve for the host
and not for any ``--python`` retarget: a wheel for another
Python's ABI would not import, and a build requirement the host
needs would be dropped by its marker.

Construction is cheap; the work happens in ``__enter__``.
offlineFtransport_factorychainc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r3   requires	list[str]configr   rl   boolrm   z Callable[[], AsyncHttpTransport]rn   
BuildChainr6   r7   r8   )r9   s   "r:   r;   NabBuildEnv.__annotate__   sF     < << !	<
 < << < 
<r=   c                   \        V4      V n        W n        W0n        W@n        \        V4      V n        RV n        RV n        RV n	        RV n
        . V n        R# )z?Capture inputs; the venv and inner resolve happen in __enter__.N)rK   	_requires_config_offline_transport_factorytuple_chain_tmpdir
_venv_path_python_executable_scripts_dir_installed_files)rC   rp   rr   rl   rm   rn   s   &&$$$$r:   __init__NabBuildEnv.__init__   sP     h"3El@D'+/3)-9;r=   c                   V ^8  d   QhRR/# )r3   r6   r    r8   )r9   s   "r:   r;   ru      s     	 	4 	r=   c                    \         P                  ! RR7      V n         V P                  \	        V P                  P
                  4      4       V #   \         d$    T P                  P                  4        RT n        h i ; i)zBBuild the venv, run the inner resolve, install build requirements.znab-build-env-prefixN)tempfileTemporaryDirectoryr}   
_provisionr   r`   BaseExceptioncleanuprC   s   &r:   	__enter__NabBuildEnv.__enter__   sg    22:JK	OOD!2!234
 	  	LL  "DL	s   .A .A<c                    V ^8  d   QhRRRR/# )r3   rootr   r6   r7   r8   )r9   s   "r:   r;   ru      s     R Rt R Rr=   c                n   VR,          V n         VR,          p\        P                  RV P                   4       \        P                  ! R\        4       RR7      p VP                  4        VP                  V P                   4       \        T P                   4      T n        T P                  P                  T n        \        T P                  4      pT P                  '       g   R# T P!                  T P#                  T4      T4       R#   \         d$   pRT P                    RT 2p\        T4      ThRp?ii ; i)	z=Lay out the venv, install build requirements, populate paths.venvwheelszcreating build venv at %sF)with_pipsymlinksclearzcould not create build venv at : N)r~   loggerdebugr   
EnvBuilder_supports_symlinksmkdircreateOSErrorr^   _venv_pythonr   parentr   _venv_scheme_pathsrw   _install_wheels_resolve_and_download)rC   r   	wheel_dirbuilderexcmsgscheme_pathss   &&     r:   r   NabBuildEnv._provision   s    -8O	0$//B//%7%9
	.OONN4??+
 #/t"? 33::)$*A*AB~~~T77	BLQ  	.3DOO3DBseLC$#-	.s   +D D4D//D4c               $    V ^8  d   QhRRRRRR/# )r3   wheel_paths
list[Path]r   dict[str, str]r6   r7   r8   )r9   s   "r:   r;   ru     s$     (2 (2%(25C(2	(2r=   c                H   \        V P                  4       . V n        V F  p\        P                  RVP                  4        \
        P                  ! V4      ;_uu_ 4       p\        \        W$P                  4      \        V P                  4      \        R
RR7      p\        VVRR/R7       V P                  P                  VP                  4       RRR4       K  	  R#   + '       g   i     K  ; i  \          d$   pRTP                   R	T 2p\#        T4      ThRp?ii ; i)a?  Remove what this env installed before, then install ``wheel_paths``.

Each resolve produces a whole environment, so the previous
install comes out rather than being written over: two
``.dist-info`` directories for one distribution leave the
version ``importlib.metadata`` reports up to listing order.
The removals all run before the first write, since two
distributions can ship the same path within a scheme.

A downloaded build dependency can be corrupt or malformed, so
opening or installing it surfaces as :class:`BuildEnvError`
rather than a raw zip or installer error.
zinstalling %sT)rL   interpreterscript_kindr@   overwrite_existing	INSTALLERs   nab
)sourcedestinationadditional_metadataNz#could not install build dependency r   r8   )_remove_filesr   r   r   r`   r   openr,   _dist_scheme_pathsdistributionrH   r   _LAUNCHER_KINDinstaller_installextendr1   	Exceptionr^   )rC   r   r   
wheel_pathr   r   r   r   s   &&&     r:   r   NabBuildEnv._install_wheels  s      	d++, "%JLL*//:2^^J//6"B$6(*=*=% %((?(?$@$257+/#K &%$/-8(,C
 ))001D1DE 0/ & 0//   2;JOO;LBseT#C(c12s7   C3!A0CC3C0*C30C33D!>DD!c                    V ^8  d   QhRRRR/# )r3   argsobjectr6   r7   r8   )r9   s   "r:   r;   ru   /  s        f    r=   c                h    V P                   e$   V P                   P                  4        RV n         R# R# )z?Remove the temp tree that holds the venv and downloaded wheels.N)r}   r   )rC   r   s   &*r:   __exit__NabBuildEnv.__exit__/  s(    <<#LL  "DL $r=   c                   V ^8  d   QhRR/# )r3   r6   rH   r8   )r9   s   "r:   r;   ru   6  s     , ,3 ,r=   c                b    V P                   f   Rp\        V4      h\        V P                   4      # )z:Path to the venv's interpreter (str, per ``IsolatedEnv``).2NabBuildEnv used outside its context-manager scope)r   r^   rH   )rC   r   s   & r:   python_executableNabBuildEnv.python_executable5  s1     ""*FC$$4**++r=   c                   V ^8  d   QhRR/# )r3   r6   zMapping[str, str]r8   )r9   s   "r:   r;   ru   =  s     4 4$5 4r=   c                    V P                   f   Rp\        V4      h\        P                  P	                  R4      pV'       d!   V P                    \        P
                   V 2M\        V P                   4      pRVRR/# )a  PATH / PYTHONPATH overrides for the build subprocess.

Prepends the venv's scripts dir so build backends find their
installed entry points; clears ``PYTHONPATH`` so the host's
``sys.path`` does not leak in (matches the convention used by
``build.env.DefaultIsolatedEnv``).
r   PATH
PYTHONPATH )r   r^   osenvirongetpathseprH   )rC   r   	host_pathnew_paths   &   r:   make_extra_environNabBuildEnv.make_extra_environ=  sx     $FC$$JJNN6*	    !"**i[9T&&' 	
 ,33r=   c                    V ^8  d   QhRRRR/# )r3   requirementsrq   r6   r7   r8   )r9   s   "r:   r;   ru   P  s     W WI W$ Wr=   c                   V P                   e   V P                  f   Rp\        V4      hV'       g   R# V P                   P                  R,          pVR\	        \        VP                  4       4      4       2,          pVP                  RRR7       V P                  WAR7      pV P                  V\        V P                  4      4       R# )a  Install additional requirements into the live env.

Used for ``get_requires_for_build_wheel`` follow-up requests
(the backend asks for additional deps after the env is
already up).  The inner resolve runs over ``requires`` and
``requirements`` together, so its result is the whole build
env rather than an addition to it: it can pin a different
version of something already installed, or drop it.
Nr   r   _extra_Tparentsexist_ok)extra)r~   r   r^   r   lenrK   iterdirr   r   r   r   )rC   r   r   r   subr   s   &&    r:   r
   NabBuildEnv.installP  s     ??"d&=&=&EFC$$OO**X5	 GCY->->-@(A$B#CDD		$	.000I[*<T=T=T*UVr=   r   Nc               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   zlist[str] | Noner6   r   r8   )r9   s   "r:   r;   ru   g  s-     g gg  	g
 
gr=   c                 a a ^RI HpHp \        S P                  4      pV'       d   VP                  V4       S P                  '       d"   RP                  V4      pRV 2p\        V4      hSP                  R,          pVP                  RRR7       VR,          p	V	P                  \        V4      RR	7       \        S P                  P                  \         ;QJ d(    . R
 S P                  P"                   4       F  NK  	  5M!! R
 S P                  P"                   4       4      S P                  P$                  P'                  4        U
Uu/ uF  w  rV
\)        V4      bK  	  upp
S P                  P*                  \,        P.                  \0        P2                  R7      pS P5                  4       p V! V	VVR7      pVP7                  4        S PA                  T! YR7      4      w  pp \C        TTS4      p\        TPF                  4      \        TPH                  4      ,           pT Uu. uF  pTPJ                  R8X  g   K  TNK  	  ppTP                  T T3R lT 4       4       T# u upp
i   \8        \:        \<        \>        3 d   pRT 2p\        T4      ThRp?ii ; i  \D         d   pRT 2p\        T4      ThRp?ii ; iu upi )as  Resolve ``requires`` (+ ``extra``) and write wheels under ``wheel_dir``.

The inner resolve runs against a synthetic pyproject so it
can reuse :func:`nab_python.resolve.resolve_for_targets` and
:func:`nab_python.download.download_lock` end-to-end.  No
local sources / workspace / marker overlay; build deps
come from the configured indexes only.

It admits wheels and sdists, like any resolve, so the version
it settles on is the one the requirement asked for rather than
the newest that happens to publish a wheel.  Whether a version
without an installable wheel can be used is
:meth:`_plan_install`'s decision, taken once the resolve has
named it.

It reads metadata statically: its build policy is ``never`` and
no inherited override may raise it.  A backend invocation to
learn a build requirement's dependencies would be a second
recursion, one the depth budget does not count.
)build_lock_inputresolve_for_targetsz, z0build requirements unavailable in offline mode: _inner_projectTr   zpyproject.tomlzutf-8)encodingc              3  8   "   T F  p\        V4      x  K  	  R # 5ir?   )_without_build_permission).0overrides   & r:   	<genexpr>4NabBuildEnv._resolve_and_download.<locals>.<genexpr>  s      $ >H *(33 >s   )indexespackage_overridesindex_overridesuploaded_prior_todist_policybuild_policy)rr   zbuild env resolve failed: Nzbuild env download failed: z.whlc              3  H   <"   T F  pSP                  VS4      x  K  	  R # 5ir?   )_build_requirement)r   pendingrC   r   s   & r:   r   r     s$      
GOGD##GY77xs   ")&resolver   r   rK   rw   r   ry   joinr^   r   r   
write_text_render_synthetic_pyprojectr   rx   r   r{   r   r   itemsr   r   r   WHEEL_OR_SDISTr   NEVERrz   raise_for_failurer   NotImplementedErrorr   r   _plan_installr   r   r1   skippedsuffix)rC   r   r   r   r   rp   joinedr   synthetic_dir	syntheticr`   r   inner_config	transportresultr   
lock_inputto_builddownload_result	all_pathspr   s   ff$                   r:   r   !NabBuildEnv._resolve_and_downloadg  s   : 	D'OOE"===YYx(FDVHMC$$!((+;;D48!$44	8BWU'LL((#e $ $ > >$ee $ $ > >$  '+ll&B&B&H&H&J&JND /99&J #ll<<"11$**
" ++-		.(#F $$&  $11V9 

H	.+J	9MO 001D9P9P4QQ	&=Y!((f*<!!Y= 
GO
 	
 i,  *	
 	. /se4C$#-	.&  	. 0u5C$#-	. >sB   I$/I* &J &K>K*JJJJ?)J::J?c                   V ^8  d   QhRR/# )r3   r6   intr8   )r9   s   "r:   r;   ru     s     D Ds Dr=   c                b    V P                   P                  \        V P                  4      ,
          # )z8How many more build envs may be opened beneath this one.)rx   build_requires_depthr   r|   r   s   &r:   _build_budgetNabBuildEnv._build_budget  s"     ||003t{{3CCCr=   c                    V ^8  d   QhRRRR/# )r3   r  r$   r6   z%tuple[LockInput, list[_PendingBuild]]r8   )r9   s   "r:   r;   ru     s     > >#>	.>r=   c                "   / p. pVP                   P                  4        F`  w  rE/ pVP                  P                  4        F-  w  rxV P                  WP                  P
                  V4      Wg&   K/  	  \        WVR7      W$&   Kb  	  \        WR7      V3# )a  Decide how each pin reaches the env, and narrow it to that artifact.

A pin with a wheel the host accepts is narrowed to that one
wheel: a lock records every wheel of the pinned version the
target admits, which can be several (the tiered manylinux
aliases, or a ``py3-none-any`` beside a platform wheel), and
the env installs one.  Narrowing is for the download and the
install; a written lock keeps every wheel, so one lock stays
portable across targets.

A pin with no such wheel has to be built, and comes back in the
second element with its wheels dropped so only its sdist is
fetched.  Refusing that build is this method's other job: it
raises rather than leaving a requirement quietly uninstalled,
because the backend would then fail on an import error that
names nothing useful.
)pins)targets)r  r   r  _planned_pintargettagsr   )	rC   r  plannedr  ri   lockr  r`   pins	   &&       r:   r  NabBuildEnv._plan_install  s    ( *,(*%--335KE(*D!YY__.	!..sKK4D4DhO
 /$T5GN	 6 z3X==r=   c               (    V ^8  d   QhRRRRRRRR/# )r3   r!  r%   r  r(   r  zlist[_PendingBuild]r6   r8   )r9   s   "r:   r;   ru     s,     0' 0'0'#)0'5H0'	0'r=   c                   \        V\        4      '       g   V# VP                  '       d   VP                  VP                  4      MRpVe   \	        W3RR7      # \        VP                  VP                  4      pV P                  pVP                  f   V R\        V4       2p\        V4      hWV9   d$   RRP                  . VOVN4       2p\        V4      hV P                  ^ 8:  d2   V RV P                  P                   \        V4       2p\        V4      hVP!                  \#        WQP                  R7      4       \	        VR	R7      # )
a/  Return ``pin`` narrowed to the artifact the env will install.

Appends to ``to_build`` when the answer is the sdist, so the
caller knows which pins still owe it a build.

The wheel is chosen by the target's tags rather than by the
provider's ``pick_dist``.  That one answers whose METADATA the
pin has to satisfy, so between wheels the tags rank equally it
takes the one carrying a :pep:`658` sidecar, and it may answer
with an sdist or with a wheel this host cannot install.  An
install has none of those outs: it must be the wheel
:pep:`425` ranks highest.
N)r   rj   zF publishes no wheel this build host can install, and no sdist to buildzcyclic build requirement:  -> zx publishes no wheel this build host can install, so satisfying it means building it; [tool.nab].build-requires-depth is )ri   rj   )r   r8   )
isinstancer   r   pickr   rd   r`   ra   r|   rj   _chain_suffixr^   r   r  rx   r  appendrh   )rC   r!  r  r  	preferredri   rn   r   s   &&&&    r:   r  NabBuildEnv._planned_pin  s9     #x((J-0ZZZDIIcjj)T	  3|4@@CHHckk299' ))6u)=(>@   $$ >.v{{?U?E?/K.LMC$$"' ||889-:N9OQ 
  $$ECDs2&&r=   c               $    V ^8  d   QhRRRRRR/# )r3   r   rh   r   r   r6   r8   )r9   s   "r:   r;   ru   %  s!     #2 #2- #2D #2T #2r=   c           
        ^RI Hp VP                  pW!P                  P                  ,          p\
        P                  RV4        VP                  4       p\        P                  ! RR7      ;_uu_ 4       p	 \        T\        T	4      4      p
 T! T
TT P                  T P                   . T P"                  OTN5R
7      uuRRR4       #   \         d   pRT 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  + '       g   i     R# ; i)zBuild the downloaded sdist of ``pending`` and return the wheel's path.

The wheel lands beside the downloaded artifacts, which live as
long as the env does.
)build_wheel_for_installz#building %s to populate a build envzbuild requirement z could not be read at r   Nznab-build-req-r   z could not be extracted: )
output_dirrr   rl   rn   z could not be built: )runnerr.  ri   rj   filenamer   info
read_bytesr   r^   r   r   r   r   
ValueErrorrx   ry   r|   r   )rC   r   r   r.  ri   archivedatar   r   td
source_dirs   &&&        r:   r   NabBuildEnv._build_requirement%  sQ    	4mm44495A	.%%'D
 ((0@AAR224bB

2.(<< MM/DKK// BA	  	.&ug-CG9BseTC$#-	.  2*5'1J3%P#C(c12 % 2*5'1FseL#C(c12 BAAs`   C 5D?7C1/DC.C))C.1D<DDD?D<#D77D<<D??E	)
r|   rx   r   ry   r   rw   r   r}   rz   r~   r8   )rS   rT   rU   rV   rW   r   r   r   r   r   r   propertyr   r   r
   r   r  r  r  r   rY   r8   r=   r:   r*   r*      s     D<
 < ?T< <,	R4(2T  , ,4&W.g #'	gR D D><0'd#2 #2r=   c                    V ^8  d   QhRRRR/# )r3   rn   rt   r6   rH   r8   )r9   s   "r:   r;   r;   K  s     > > > >r=   c                @    V '       d   RRP                  V 4       R2# R# )zCRender ``chain`` for an error message, or nothing when it is empty.z	 (chain: r%  )r   )r   )rn   s   &r:   r(  r(  K  s"    05Yv{{5)*!,=2=r=   c                    V ^8  d   QhRRRR/# )r3   r   r)   r6   r8   )r9   s   "r:   r;   r;   P  s     
0 
0
 
0z 
0r=   c                b    V P                   R\        P                  39   d   V # \        V RR7      # )a6  Return ``override`` with any build permission it grants removed.

An override reaches the build env's own resolve, where the build
policy is ``never``.  Letting one raise it there would start a
backend invocation nothing counts against the depth budget, so a
permission is dropped and only a refusal survives.
N)r   )r   r   r   r   )r   s   &r:   r   r   P  s/     {'8'8 998$//r=   c                    V ^8  d   QhRRRR/# )r3   rO   r0   r6   r7   r8   )r9   s   "r:   r;   r;   ]  s     ! !2 !t !r=   c                ~  a \        4       p\        4       pV  F  w  opSV,          pVP                  RR7       VP                  R8X  dZ   VP                  R,          pVP	                  VP
                   R24       F  pVP                  4        K  	  VP                  V4       VP                  S4       VP                  V3R lVP                   4       4       K  	  \        W,
          R RR7       F3  p\        \        4      ;_uu_ 4        VP                  4        R	R	R	4       K5  	  R	#   + '       g   i     KJ  ; i)
a  Delete installed files and their bytecode, and directories left empty.

``entries`` are ``(scheme root, path within it)`` pairs.  The
scheme roots stay, as does any directory still holding something
the install did not write.

Cached bytecode goes with its source file: the backend has already
run in this venv, so a removed package has usually been imported,
and the ``__pycache__`` that import wrote would keep its directory
importable as a namespace package.
T)
missing_okz.py__pycache__z.*.pycc              3  6   <"   T F  pSV,          x  K  	  R # 5ir?   r8   )r   r   r   s   & r:   r    _remove_files.<locals>.<genexpr>w  s     H7GV4&==7Gs   c                ,    \        V P                  4      # r?   )r   parts)rM   s   &r:   <lambda>_remove_files.<locals>.<lambda>{  s    c$**or=   )keyreverseN)setunlinkr  r   globstemaddupdater   sortedr   r   rmdir)	rO   directoriesrootsrelativer  cachecompiled	directoryr   s	   &       @r:   r   r   ]  s     !UKuE!h&==E!MMM1E!JJ&++f'=>! ?OOE"		$Hx7G7GHH " !=t	 gOO  s   D++D<c                    V ^8  d   QhRRRR/# )r3   	venv_pathr   r6   r8   )r9   s   "r:   r;   r;     s     ( (D (T (r=   c                l    \         P                  R8X  d   V R,          R,          # V R,          R,          # )zEReturn the venv interpreter path (``Scripts\python.exe`` on Windows).r[   Scriptsz
python.exebinpythonsysplatform)r[  s   &r:   r   r     s.    
||w9$|33ux''r=   c                    V ^8  d   QhRRRR/# )r3   r   r   r6   r   r8   )r9   s   "r:   r;   r;     s     ! !$ !> !r=   c           
         \         P                  ! \        V 4      R\        .RRRR7      p \        P                  ! TP                  4      p\        TR,          4      p\        \        TR,          R	R
RTR,           24      4      TR&   T#   \        \         P
                  3 d   pRT 2p\        T4      ThRp?ii ; i  \        P                   d   pRT 2p\        T4      ThRp?ii ; i)a  Ask the venv's interpreter for the scheme paths ``installer`` writes to.

Subprocessing the venv guarantees the returned paths reflect the
venv's layout (``site-packages`` under the venv root, scripts in
its ``bin``/``Scripts`` dir, etc.) regardless of how nab itself
was installed.  One subprocess per env construction; negligible.

``sysconfig`` has no ``headers`` scheme, and its ``include`` names
the base interpreter rather than the venv, so the header root comes
from the venv's own prefix instead.
z-cT)capture_outputtextcheckz%build venv interpreter probe failed: Nz7build venv interpreter probe returned non-JSON output: pathsr   includesiter_  
py_versionheaders)
subprocessrunrH   _SCHEME_PROBEr   CalledProcessErrorr^   jsonloadsstdoutJSONDecodeErrordictr   )r   r  r   r   proberh  s   &     r:   r   r     s    	*"#T=9	
*

6==)
 !w0EU8_i6%:M9N1OPE) L Z223 *5cU;C c)*  *GuMC c)*s.   *B  C  B='B88B= C+C&&C+c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   rH   r6   r8   )r9   s   "r:   r;   r;     s$       03r=   c                Z    \        V 4      p\        \        VR,          V4      4      VR&   V# )zEScheme paths for one wheel; its headers go in a directory of its own.rl  )ru  rH   r   )r   r   rh  s   && r:   r   r     s.     E4i 0,?@E)Lr=   c                   V ^8  d   QhRR/# )r3   r6   rs   r8   )r9   s   "r:   r;   r;     s     # #D #r=   c                 (    \         P                  R8g  # )zB``venv.EnvBuilder(symlinks=...)`` heuristic; avoids Windows traps.r[   r`  r8   r=   r:   r   r     s    <<7""r=   c                    V ^8  d   QhRRRR/# )r3   rp   rq   r6   rH   r8   )r9   s   "r:   r;   r;     s      )  r=   c           	     >    \         P                  ! RRRRRRV //4      # )a  Render a tiny pyproject.toml whose deps are ``requires``.

Used as input to the inner resolve; the on-disk file is
discarded with the rest of the temp tree.  The dummy name and
version make the inner resolver happy without depending on the
outer project's name/version.
projectr`   _nab_build_envra   z0.0.0dependencies)tomli_wdumps)rp   s   &r:   r   r     s2     ==(7	
 r=   l        )brW   
__future__r   rq  loggingr   rm  ra  r   r   
contextlibr   dataclassesr   r   r   pathlibr   typingr   r	   r  	installerr
   r   installer.destinationsr   installer.sourcesr   nab_index.clientr   !nab_index.urllib3_async_transportr   _vcs_admissionr   _vendor.packaging.utilsr   rr   r   downloadr   r   lockfiler   providerr   r   r   requirements_filer   errorsr   collections.abcr   r   r   installer.recordsr   installer.utilsr   typing_extensionsr    nab_index.transportr!   r"   r#   r$   r%   r&   r'   r  r(   r)   __all__r,   	getLoggerrS   r   rb  maxsizer   ro  r   r^   r{   rH   rt   rd   rh   r*   r(  r   r   r   r   r   r   r   r8   r=   r:   <module>r     s  , #   	  
    1 1  )  2 > ' 2 C 0 7 % 3  A A > %;;-&&67IIFJ 
 $I'B $I $IN 
		8	$
 ||w3;;#6  ||w 
	 
 I  38_
2
 $d#  $a2 a2H>

0!H(!H#
r=   