
    @[h1                     L   d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z
 d dlmZmZmZ ddlmZ g dZd	 Zd
 Z G d de          Z G d de          Z G d de          Z G d de          ZddZddZd Z G d d          Z G d dej                  ZdS )    N)contextmanager)abspath)join)STDOUT
check_callcheck_output   )_in_proc_script_path)BackendUnavailableBackendInvalidHookMissingUnsupportedOperationdefault_subprocess_runnerquiet_subprocess_runnerPep517HookCallerc                     t          |dd          5 }t          j        | |fi | d d d            d S # 1 swxY w Y   d S )Nwutf-8encoding)openjsondump)objpathkwargsfs       j/var/www/api.easyaligner.net/htdocs/venv_linux/lib/python3.11/site-packages/pip/_vendor/pep517/wrappers.py
write_jsonr      s    	dC'	*	*	* $a	#q##F###$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $s   488c                     t          | d          5 }t          j        |          cd d d            S # 1 swxY w Y   d S )Nr   r   )r   r   load)r   r   s     r   	read_jsonr"      s    	dW	%	%	% y||                 s   377c                       e Zd ZdZd ZdS )r   zEWill be raised if the backend cannot be imported in the hook process.c                     || _         d S N	tracebackselfr'   s     r   __init__zBackendUnavailable.__init__$       "    N__name__
__module____qualname____doc__r*    r,   r   r   r   "   s)        OO# # # # #r,   r   c                       e Zd ZdZd ZdS )r   z)Will be raised if the backend is invalid.c                 0    || _         || _        || _        d S r%   backend_namebackend_pathmessage)r)   r6   r7   r8   s       r   r*   zBackendInvalid.__init__*   s    ((r,   Nr-   r2   r,   r   r   r   (   s)        33    r,   r   c                   "     e Zd ZdZ fdZ xZS )r   z Will be raised on missing hooks.c                 X    t                                          |           || _        d S r%   )superr*   	hook_name)r)   r<   	__class__s     r   r*   zHookMissing.__init__2   s&    ###"r,   )r.   r/   r0   r1   r*   __classcell__)r=   s   @r   r   r   0   s>        **# # # # # # # # #r,   r   c                       e Zd ZdZd ZdS )r   zDMay be raised by build_sdist if the backend indicates that it can't.c                     || _         d S r%   r&   r(   s     r   r*   zUnsupportedOperation.__init__9   r+   r,   Nr-   r2   r,   r   r   r   7   s)        NN# # # # #r,   r   c                     t           j                                        }|r|                    |           t	          | ||           dS )z5The default method of calling the wrapper subprocess.)cwdenvN)osenvironcopyupdater   cmdrB   extra_environrC   s       r   r   r   =   sH    
*//

C "

=!!!s%%%%%%r,   c                     t           j                                        }|r|                    |           t	          | ||t
                     dS )zDA method of calling the wrapper subprocess while suppressing output.)rB   rC   stderrN)rD   rE   rF   rG   r   r   rH   s       r   r   r   F   sJ    
*//

C "

=!!!#3v666666r,   c                    t           j                            |          rt          d          t           j                            |           }t           j                            t           j                            ||                    }t           j                            |          }t           j                            |          }t           j                            ||g          |k    rt          d          |S )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)	rD   r   isabs
ValueErrorr   normpathr   normcasecommonprefix)source_tree	requested
abs_sourceabs_requestednorm_sourcenorm_requesteds         r   norm_and_checkrY   O   s     
w}}Y 31222--JG$$RW\\*i%H%HIIM '"":..KW%%m44N	w[.9::kII;<<<r,   c                       e Zd ZdZ	 	 	 ddZed             Zd ZddZ	 	 ddZ		 	 dd	Z
dd
Z	 	 ddZ	 	 ddZddZddZd ZdS )r   a  A wrapper around a source directory to be built with a PEP 517 backend.

    :param source_dir: The path to the source directory, containing
        pyproject.toml.
    :param build_backend: The build backend spec, as per PEP 517, from
        pyproject.toml.
    :param backend_path: The backend path, as per PEP 517, from pyproject.toml.
    :param runner: A callable that invokes the wrapper subprocess.
    :param python_executable: The Python executable used to invoke the backend

    The 'runner', if provided, must expect the following:

    - cmd: a list of strings representing the command and arguments to
      execute, as would be passed to e.g. 'subprocess.check_call'.
    - cwd: a string representing the working directory that must be
      used for the subprocess. Corresponds to the provided source_dir.
    - extra_environ: a dict mapping environment variable names to values
      which must be set for the subprocess execution.
    Nc                      |t           }t          |           _        | _        |r fd|D             }| _        | _        |st          j        }| _        d S )Nc                 :    g | ]}t          j        |          S r2   )rY   
source_dir).0pr)   s     r   
<listcomp>z-Pep517HookCaller.__init__.<locals>.<listcomp>   s2       78t22  r,   )	r   r   r]   build_backendr7   _subprocess_runnersys
executablepython_executable)r)   r]   ra   r7   runnerre   s   `     r   r*   zPep517HookCaller.__init__{   s     >.F!*--* 	   <H  L )"(  	/ #!2r,   c              #   V   K   | j         }|| _         	 dV  || _         dS # || _         w xY w)z\A context manager for temporarily overriding the default subprocess
        runner.
        N)rb   )r)   rf   prevs      r   subprocess_runnerz"Pep517HookCaller.subprocess_runner   sH      
 &"(	+EEE&*D###dD#****s    	(c                 .    |                      di           S )z>Return the list of optional features supported by the backend._supported_features
_call_hookr)   s    r   rk   z$Pep517HookCaller._supported_features   s    4b999r,   c                 2    |                      dd|i          S )aI  Identify packages required for building a wheel

        Returns a list of dependency specifications, e.g.::

            ["wheel >= 0.25", "setuptools"]

        This does not include requirements specified in pyproject.toml.
        It returns the result of calling the equivalently named hook in a
        subprocess.
        get_requires_for_build_wheelconfig_settingsrl   r)   rq   s     r   rp   z-Pep517HookCaller.get_requires_for_build_wheel   (     =@
   	r,   Tc                 P    |                      dt          |          ||d          S )au  Prepare a ``*.dist-info`` folder with metadata for this project.

        Returns the name of the newly created folder.

        If the build backend defines a hook with this name, it will be called
        in a subprocess. If not, the backend will be asked to build a wheel,
        and the dist-info extracted from that (unless _allow_fallback is
        False).
         prepare_metadata_for_build_wheelmetadata_directoryrq   _allow_fallbackrm   r   r)   rw   rq   rx   s       r   ru   z1Pep517HookCaller.prepare_metadata_for_build_wheel   s;     A")*<"="=..D
 D
   	r,   c                 r    |t          |          }|                     dt          |          ||d          S )av  Build a wheel from this project.

        Returns the name of the newly created file.

        In general, this will call the 'build_wheel' hook in the backend.
        However, if that was previously called by
        'prepare_metadata_for_build_wheel', and the same metadata_directory is
        used, the previously built wheel will be copied to wheel_directory.
        Nbuild_wheelwheel_directoryrq   rw   r   rm   r)   r~   rq   rw   s       r   r|   zPep517HookCaller.build_wheel   sL     )!();!<!<}&77."4/
 /
   	r,   c                 2    |                      dd|i          S )aS  Identify packages required for building an editable wheel

        Returns a list of dependency specifications, e.g.::

            ["wheel >= 0.25", "setuptools"]

        This does not include requirements specified in pyproject.toml.
        It returns the result of calling the equivalently named hook in a
        subprocess.
        get_requires_for_build_editablerq   rl   rr   s     r   r   z0Pep517HookCaller.get_requires_for_build_editable   s(     @C
   	r,   c                 P    |                      dt          |          ||d          S )a  Prepare a ``*.dist-info`` folder with metadata for this project.

        Returns the name of the newly created folder.

        If the build backend defines a hook with this name, it will be called
        in a subprocess. If not, the backend will be asked to build an editable
        wheel, and the dist-info extracted from that (unless _allow_fallback is
        False).
        #prepare_metadata_for_build_editablerv   ry   rz   s       r   r   z4Pep517HookCaller.prepare_metadata_for_build_editable   s;     D")*<"="=..G
 G
   	r,   c                 r    |t          |          }|                     dt          |          ||d          S )a  Build an editable wheel from this project.

        Returns the name of the newly created file.

        In general, this will call the 'build_editable' hook in the backend.
        However, if that was previously called by
        'prepare_metadata_for_build_editable', and the same metadata_directory
        is used, the previously built wheel will be copied to wheel_directory.
        Nbuild_editabler}   r   r   s       r   r   zPep517HookCaller.build_editable   sM     )!();!<!</&77."42
 2
   	r,   c                 2    |                      dd|i          S )a>  Identify packages required for building a wheel

        Returns a list of dependency specifications, e.g.::

            ["setuptools >= 26"]

        This does not include requirements specified in pyproject.toml.
        It returns the result of calling the equivalently named hook in a
        subprocess.
        get_requires_for_build_sdistrq   rl   rr   s     r   r   z-Pep517HookCaller.get_requires_for_build_sdist  rs   r,   c                 N    |                      dt          |          |d          S )zBuild an sdist from this project.

        Returns the name of the newly created file.

        This calls the 'build_sdist' backend hook in a subprocess.
        build_sdist)sdist_directoryrq   ry   )r)   r   rq   s      r   r   zPep517HookCaller.build_sdist  s4     }&77./
 /
   	r,   c           
         d| j         i}| j        r)t          j                            | j                  }||d<   t          j                    5 }d|i}t          |t          |d          d           t                      5 }| j
        }|                     |t          t          |                    ||g| j        |           d d d            n# 1 swxY w Y   t          t          |d                    }	|	                    d	          r#t#          |	                    d
d                    |	                    d          r#t%          |	                    d
d                    |	                    d          r0t'          | j         | j        |	                    dd                    |	                    d          r$t)          |	                    d          p|          |	d         cd d d            S # 1 swxY w Y   d S )NPEP517_BUILD_BACKENDPEP517_BACKEND_PATHr   z
input.json   )indent)rB   rJ   zoutput.jsonunsupportedr'    
no_backendbackend_invalidbackend_errorr5   hook_missingmissing_hook_name
return_val)ra   r7   rD   pathsepr   tempfileTemporaryDirectoryr   pjoinr
   re   rb   r   strr]   r"   getr   r   r   r   )
r)   r<   r   rJ   r7   td
hook_inputscriptpythondatas
             r   rm   zPep517HookCaller._call_hook'  s   /1CD 	@:??4+<==L3?M/0(** 	&b"F+Jz5\#:#:1EEEE &'' 6/''WS[[119bA"/ (                  U2}5566Dxx&& F*488K+D+DEEExx%% D(+r)B)BCCCxx)** $!%!3!%!2 HH_b99   
 xx'' N!$((+>"?"?"L9MMM%5	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&s8   3G9 ACG9C	G9C	DG99G= G=)NNNr%   NTNN)r.   r/   r0   r1   r*   r   ri   rk   rp   ru   r|   r   r   r   r   r   rm   r2   r,   r   r   r   g   s6        . "3 3 3 3. 	+ 	+ ^	+: : :     7;    & 48#   (     7;    & 48#   (   
 
 
 
!& !& !& !& !&r,   r   c                   @    e Zd ZdZd Zd Zed             Zd Zd Z	dS )LoggerWrapperzd
    Read messages from a pipe and redirect them
    to a logger (see python's logging module).
    c                    t           j                            |            d| _        || _        || _        t          j                    \  | _        | _	        t          j
        | j                  | _        |                                  d S r   )	threadingThreadr*   daemonloggerlevelrD   pipefd_readfd_writefdopenreaderstart)r)   r   r   s      r   r*   zLoggerWrapper.__init__Q  sh    !!$'''
 ')gii#dmi--

r,   c                     | j         S r%   )r   rn   s    r   filenozLoggerWrapper.fileno^  s
    }r,   c                 X    |                      t          j                  r
| d d         n| S )N)endswithrD   linesep)msgs    r   remove_newlinezLoggerWrapper.remove_newlinea  s'    <<
33<s3B3xx<r,   c                 j    | j         D ]*}|                     |                     |                     +d S r%   )r   _writer   )r)   lines     r   runzLoggerWrapper.rune  s@    K 	3 	3DKK++D112222	3 	3r,   c                 F    | j                             | j        |           d S r%   )r   logr   )r)   r8   s     r   r   zLoggerWrapper._writei  s     
G,,,,,r,   N)
r.   r/   r0   r1   r*   r   staticmethodr   r   r   r2   r,   r   r   r   K  su         
     = = \=3 3 3- - - - -r,   r   r   )r   rD   rc   r   r   
contextlibr   os.pathr   r   r   
subprocessr   r   r   
in_processr
   __all__r   r"   	Exceptionr   r   r   r   r   r   rY   r   r   r   r2   r,   r   <module>r      s    				 



      % % % % % %       ! ! ! ! ! ! 7 7 7 7 7 7 7 7 7 7 , , , , , ,  $ $ $
  
# # # # # # # #    Y   # # # # #) # # ## # # # #9 # # #& & & &7 7 7 7  0a& a& a& a& a& a& a& a&H- - - - -I$ - - - - -r,   