
    $Ȃi.                         S SK r S SKrS SKrS SKrS SKJr  S SKJr  S SKJr	  S SK
JrJrJr  SSKJr  S rS	 r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      rSS jrSS jrS r " S S5      rg)    N)contextmanager)abspath)join)STDOUT
check_callcheck_output   )_in_proc_script_pathc                 |    [        USSS9 n[        R                  " X40 UD6  S S S 5        g ! , (       d  f       g = f)Nwutf-8encoding)openjsondump)objpathkwargsfs       RD:\sksbv-state-backend\venv\Lib\site-packages\pip/_vendor/pyproject_hooks/_impl.py
write_jsonr      s-    	dC'	*a		##F# 
+	*	*s   -
;c                 x    [        U SS9 n[        R                  " U5      sS S S 5        $ ! , (       d  f       g = f)Nr   r   )r   r   load)r   r   s     r   	read_jsonr      s%    	dW	%yy| 
&	%	%s   +
9c                       \ rS rSrSrS rSrg)BackendUnavailable   zEWill be raised if the backend cannot be imported in the hook process.c                     Xl         g N	tracebackselfr"   s     r   __init__BackendUnavailable.__init__       "    r!   N__name__
__module____qualname____firstlineno____doc__r%   __static_attributes__ r(   r   r   r      s
    O#r(   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )BackendInvalid   z)Will be raised if the backend is invalid.c                 <   > [         TU ]  U5        Xl        X l        g r    )superr%   backend_namebackend_path)r$   r6   r7   message	__class__s       r   r%   BackendInvalid.__init__   s    !((r(   )r6   r7   r*   r+   r,   r-   r.   r%   r/   __classcell__r9   s   @r   r2   r2      s    3) )r(   r2   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )HookMissing%   z>Will be raised on missing hooks (if a fallback can't be used).c                 0   > [         TU ]  U5        Xl        g r    )r5   r%   	hook_name)r$   rB   r9   s     r   r%   HookMissing.__init__'   s    #"r(   )rB   r;   r=   s   @r   r?   r?   %   s    H# #r(   r?   c                       \ rS rSrSrS rSrg)UnsupportedOperation,   zDMay be raised by build_sdist if the backend indicates that it can't.c                     Xl         g r    r!   r#   s     r   r%   UnsupportedOperation.__init__.   r'   r(   r!   Nr)   r0   r(   r   rE   rE   ,   s
    N#r(   rE   c                     [         R                  R                  5       nU(       a  UR                  U5        [	        XUS9  g)zoThe default method of calling the wrapper subprocess.

This uses :func:`subprocess.check_call` under the hood.
)cwdenvN)osenvironcopyupdater   cmdrJ   extra_environrK   s       r   default_subprocess_runnerrS   2   s-    
 **//
C

=!s%r(   c                     [         R                  R                  5       nU(       a  UR                  U5        [	        XU[
        S9  g)ziCall the subprocess while suppressing output.

This uses :func:`subprocess.check_output` under the hood.
)rJ   rK   stderrN)rL   rM   rN   rO   r   r   rP   s       r   quiet_subprocess_runnerrV   >   s/    
 **//
C

=!3v6r(   c                    [         R                  R                  U5      (       a  [        S5      e[         R                  R	                  U 5      n[         R                  R                  [         R                  R                  X!5      5      n[         R                  R                  U5      n[         R                  R                  U5      n[         R                  R                  XE/5      U:w  a  [        S5      eU$ )zNormalise and check a backend path.

Ensure that the requested backend path is specified as a relative path,
and resolves to a location under the given source tree.

Return an absolute version of the requested path.
zpaths must be relativez paths must be inside source tree)	rL   r   isabs
ValueErrorr   normpathr   normcasecommonprefix)source_tree	requested
abs_sourceabs_requestednorm_sourcenorm_requesteds         r   norm_and_checkrc   J   s     
ww}}Y122-JGG$$RWW\\*%HIM ''"":.KWW%%m4N	ww[9:kI;<<r(   c                       \ rS rSrSr   SS jr\S 5       rS rSS jr	  SS jr
  SS	 jrSS
 jr  SS jr  SS jrSS jrSS jrS rSrg)BuildBackendHookCallerb   zFA wrapper to call the build backend hooks for a source directory.
    Nc                     Uc  [         n[        U5      U l        X l        U(       a%  U Vs/ sH  n[	        U R                  U5      PM     nnX0l        X@l        U(       d  [        R                  nXPl	        gs  snf )a[  
:param source_dir: The source directory to invoke the build backend for
:param build_backend: The build backend spec
:param backend_path: Additional path entries for the build backend spec
:param runner: The :ref:`subprocess runner <Subprocess Runners>` to use
:param python_executable:
    The Python executable used to invoke the build backend
N)
rS   r   
source_dirbuild_backendrc   r7   _subprocess_runnersys
executablepython_executable)r$   rh   ri   r7   runnerrm   ps          r   r%   BuildBackendHookCaller.__init__f   sp      >.F!*-*<H<Hqt2L   )"(  #!2s   A6c              #   \   #    U R                   nXl          Sv   X l         g! X l         f = f7f)zA context manager for temporarily overriding the default
:ref:`subprocess runner <Subprocess Runners>`.

.. code-block:: python

    hook_caller = BuildBackendHookCaller(...)
    with hook_caller.subprocess_runner(quiet_subprocess_runner):
        ...
N)rj   )r$   rn   prevs      r   subprocess_runner(BuildBackendHookCaller.subprocess_runner   s,      &&"(	+&*#d#s   ,! ,),c                 &    U R                  S0 5      $ )z>Return the list of optional features supported by the backend._supported_features
_call_hook)r$   s    r   rv   *BuildBackendHookCaller._supported_features   s    4b99r(   c                 *    U R                  SSU05      $ )a  Get additional dependencies required for building a wheel.

:returns: A list of :pep:`dependency specifiers <508>`.
:rtype: list[str]

.. admonition:: Fallback

    If the build backend does not defined a hook with this name, an
    empty list will be returned.
get_requires_for_build_wheelconfig_settingsrw   r$   r|   s     r   r{   3BuildBackendHookCaller.get_requires_for_build_wheel   s#     =@
  	r(   c                 @    U R                  S[        U5      UUS.5      $ )a  Prepare a ``*.dist-info`` folder with metadata for this project.

:returns: Name of the newly created subfolder within
          ``metadata_directory``, containing the metadata.
:rtype: str

.. admonition:: Fallback

    If the build backend does not define a hook with this name and
    ``_allow_fallback`` is truthy, the backend will be asked to build a
    wheel via the ``build_wheel`` hook and the dist-info extracted from
    that will be returned.
 prepare_metadata_for_build_wheelmetadata_directoryr|   _allow_fallbackrx   r   r$   r   r|   r   s       r   r   7BuildBackendHookCaller.prepare_metadata_for_build_wheel   s-      A")*<"=..D
  	r(   c                 \    Ub  [        U5      nU R                  S[        U5      UUS.5      $ )a  Build a wheel from this project.

:returns:
    The name of the newly created wheel within ``wheel_directory``.

.. admonition:: Interaction with fallback

    If the ``build_wheel`` hook was called in the fallback for
    :meth:`prepare_metadata_for_build_wheel`, the build backend would
    not be invoked. Instead, the previously built wheel will be copied
    to ``wheel_directory`` and the name of that file will be returned.
build_wheelwheel_directoryr|   r   r   rx   r$   r   r|   r   s       r   r   "BuildBackendHookCaller.build_wheel   s<     )!();!<}&7."4/
  	r(   c                 *    U R                  SSU05      $ )a  Get additional dependencies required for building an editable wheel.

:returns: A list of :pep:`dependency specifiers <508>`.
:rtype: list[str]

.. admonition:: Fallback

    If the build backend does not defined a hook with this name, an
    empty list will be returned.
get_requires_for_build_editabler|   rw   r}   s     r   r   6BuildBackendHookCaller.get_requires_for_build_editable   s#     @C
  	r(   c                 @    U R                  S[        U5      UUS.5      $ )a  Prepare a ``*.dist-info`` folder with metadata for this project.

:returns: Name of the newly created subfolder within
          ``metadata_directory``, containing the metadata.
:rtype: str

.. admonition:: Fallback

    If the build backend does not define a hook with this name and
    ``_allow_fallback`` is truthy, the backend will be asked to build a
    wheel via the ``build_editable`` hook and the dist-info
    extracted from that will be returned.
#prepare_metadata_for_build_editabler   r   r   s       r   r   :BuildBackendHookCaller.prepare_metadata_for_build_editable   s-      D")*<"=..G
  	r(   c                 \    Ub  [        U5      nU R                  S[        U5      UUS.5      $ )a  Build an editable wheel from this project.

:returns:
    The name of the newly created wheel within ``wheel_directory``.

.. admonition:: Interaction with fallback

    If the ``build_editable`` hook was called in the fallback for
    :meth:`prepare_metadata_for_build_editable`, the build backend
    would not be invoked. Instead, the previously built wheel will be
    copied to ``wheel_directory`` and the name of that file will be
    returned.
build_editabler   r   r   s       r   r   %BuildBackendHookCaller.build_editable   s=      )!();!</&7."42
  	r(   c                 *    U R                  SSU05      $ )zGet additional dependencies required for building an sdist.

:returns: A list of :pep:`dependency specifiers <508>`.
:rtype: list[str]
get_requires_for_build_sdistr|   rw   r}   s     r   r   3BuildBackendHookCaller.get_requires_for_build_sdist  s#     =@
  	r(   c                 >    U R                  S[        U5      US.5      $ )zqBuild an sdist from this project.

:returns:
    The name of the newly created sdist within ``wheel_directory``.
build_sdist)sdist_directoryr|   r   )r$   r   r|   s      r   r   "BuildBackendHookCaller.build_sdist  s'     }&7./
  	r(   c           
         SU R                   0nU R                  (       a-  [        R                  R	                  U R                  5      nXCS'   [
        R                  " 5        nSU0n[        U[        US5      SS9  [        5        nU R                  nU R                  U[        [        U5      5      X/U R                  US9  S S S 5        [        [        US5      5      n	U	R!                  S	5      (       a  [#        U	R!                  S
S5      5      eU	R!                  S5      (       a  [%        U	R!                  S
S5      5      eU	R!                  S5      (       a/  ['        U R                   U R                  U	R!                  SS5      S9eU	R!                  S5      (       a#  [)        U	R!                  S5      =(       d    U5      eU	S   sS S S 5        $ ! , (       d  f       GN= f! , (       d  f       g = f)NPEP517_BUILD_BACKENDPEP517_BACKEND_PATHr   z
input.json   )indent)rJ   rR   zoutput.jsonunsupportedr"    
no_backendbackend_invalidbackend_error)r6   r7   r8   hook_missingmissing_hook_name
return_val)ri   r7   rL   pathsepr   tempfileTemporaryDirectoryr   pjoinr
   rm   rj   r   strrh   r   getrE   r   r2   r?   )
r$   rB   r   rR   r7   td
hook_inputscriptpythondatas
             r   rx   !BuildBackendHookCaller._call_hook)  s   /1C1CD::??4+<+<=L3?/0((*b"F+Jz5\#:1E &'6//''WS[19A"/ (  ( U2}56Dxx&&*488K+DEExx%%(+r)BCCxx)**$!%!3!3!%!2!2 HH_b9 
 xx''!$((+>"?"L9MM%5 +*
 (' +*s%   "$G =GDG 
G	G  
G.)rj   r7   ri   rm   rh   )NNNr    )NTNN)r*   r+   r,   r-   r.   r%   r   rs   rv   r{   r   r   r   r   r   r   r   rx   r/   r0   r(   r   re   re   b   s}     "3> + +":  7; . 48#.  7; . 48#0	!&r(   re   r   )r   rL   rk   r   
contextlibr   os.pathr   r   r   
subprocessr   r   r   _in_processr
   r   r   	Exceptionr   r2   r?   rE   rS   rV   rc   re   r0   r(   r   <module>r      sx     	 
  %  ! 7 7 -$

# #)Y )#) ##9 #	&	70h& h&r(   