HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_vendor/pep517/__pycache__/wrappers.cpython-310.pyc
o

@%Neu4�@s
ddlZddlmZddlZddlmZmZddlZddl	m
Z
mZmZddl
Z
ddlmZddlmZddlmZgd	�Zed
d��ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�Zddd�Zddd�Zdd�ZGdd�de�ZGdd�dej �Z!dS)�N)�contextmanager)�abspath�join)�
check_call�check_output�STDOUT)�mkdtemp�)�compat)�_in_proc_script_path)�BackendUnavailable�BackendInvalid�HookMissing�UnsupportedOperation�default_subprocess_runner�quiet_subprocess_runner�Pep517HookCallerc	cs,�t�}z|VWt�|�dSt�|�w�N)r�shutil�rmtree)�td�r�=/usr/lib/python3/dist-packages/pip/_vendor/pep517/wrappers.py�tempdirs
�rc@�eZdZdZdd�ZdS)rzEWill be raised if the backend cannot be imported in the hook process.cC�
||_dSr��	traceback��selfrrrr�__init__#�
zBackendUnavailable.__init__N��__name__�
__module__�__qualname__�__doc__r rrrrr!�rc@r)r
z)Will be raised if the backend is invalid.cCs||_||_||_dSr��backend_name�backend_path�message)rr)r*r+rrrr )s
zBackendInvalid.__init__Nr"rrrrr
'r'r
cs eZdZdZ�fdd�Z�ZS)rz Will be raised on missing hooks.cstt|��|�||_dSr)�superrr �	hook_name)rr-��	__class__rrr 1s
zHookMissing.__init__)r#r$r%r&r �
__classcell__rrr.rr/src@r)rzDMay be raised by build_sdist if the backend indicates that it can't.cCrrrrrrrr 8r!zUnsupportedOperation.__init__Nr"rrrrr6r'rcCs*tj��}|r|�|�t|||d�dS)z5The default method of calling the wrapper subprocess.)�cwd�envN)�os�environ�copy�updater��cmdr1�
extra_environr2rrrr<s

rcCs,tj��}|r|�|�t|||td�dS)zDA method of calling the wrapper subprocess while suppressing output.)r1r2�stderrN)r3r4r5r6rrr7rrrrEs

rcCsntj�|�r
td��tj�|�}tj�tj�||��}tj�|�}tj�|�}tj�||g�|kr5td��|S)z�Normalise 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.
    zpaths must be relativez paths must be inside source tree)	r3�path�isabs�
ValueErrorr�normpathr�normcase�commonprefix)�source_tree�	requested�
abs_source�
abs_requested�norm_source�norm_requestedrrr�norm_and_checkNsrGc@s�eZdZdZ			ddd�Zedd��Zdd�Zdd	d
�Z		ddd
�Z			ddd�Z
ddd�Z		ddd�Z		ddd�Z
ddd�Zddd�Zdd�ZdS) ra�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.
    NcsR|durt}t|��_|�_|r�fdd�|D�}|�_|�_|s$tj}|�_dS)Ncsg|]}t�j|��qSr)rG�
source_dir)�.0�p�rrr�
<listcomp>�s�z-Pep517HookCaller.__init__.<locals>.<listcomp>)	rrrH�
build_backendr*�_subprocess_runner�sys�
executable�python_executable)rrHrMr*�runnerrQrrKrr zs

�
zPep517HookCaller.__init__ccs*�|j}||_z	dVW||_dS||_w)z\A context manager for temporarily overriding the default subprocess
        runner.
        N)rN)rrR�prevrrr�subprocess_runner�s�z"Pep517HookCaller.subprocess_runnercCs|�di�S)z>Return the list of optional features supported by the backend.�_supported_features��
_call_hookrKrrrrU�sz$Pep517HookCaller._supported_featurescC�|�dd|i�S)aIIdentify 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_settingsrV�rrZrrrrY���z-Pep517HookCaller.get_requires_for_build_wheelTcC�|�dt|�||d��S)auPrepare 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_directoryrZ�_allow_fallback�rWr�rr`rZrarrrr^��
�z1Pep517HookCaller.prepare_metadata_for_build_wheelcC�(|durt|�}|�dt|�||d��S)avBuild 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_directoryrZr`�rrW�rrhrZr`rrrrf���zPep517HookCaller.build_wheelcCrX)aSIdentify 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_editablerZrVr[rrrrl�r\z0Pep517HookCaller.get_requires_for_build_editablecCr])aPrepare 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_editabler_rbrcrrrrm�rdz4Pep517HookCaller.prepare_metadata_for_build_editablecCre)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_editablergrirjrrrrn�rkzPep517HookCaller.build_editablecCrX)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_sdistrZrVr[rrrror\z-Pep517HookCaller.get_requires_for_build_sdistcCs|�dt|�|d��S)z�Build 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_directoryrZrb)rrqrZrrrrps�zPep517HookCaller.build_sdistc	Cs�tjddkr|j�d�}n|j}d|i}|jr1tj�|j�}tjddkr-|�t���}||d<t	���}d|i}t
j|t|d�dd�t
��}|j}	|j|	tt|��||g|j|d	�Wd�n1sfwYt
�t|d
��}
|
�d�r�t|
�dd
���|
�d�r�t|
�dd
���|
�d�r�t|j|j|
�dd
�d��|
�d�r�t|
�d�p�|��|
dWd�S1s�wYdS)Nr��ASCII�PEP517_BUILD_BACKEND�PEP517_BACKEND_PATH�kwargsz
input.json)�indent)r1r9zoutput.json�unsupportedr��
no_backend�backend_invalid�
backend_errorr(�hook_missing�missing_hook_name�
return_val)rO�version_inforM�encoder*r3�pathsepr�getfilesystemencodingrr
�
write_json�pjoinrrQrNr�strrH�	read_json�getrrr
r)rr-rvrMr9r*r�
hook_input�script�python�datarrrrW&sJ���



�
$�zPep517HookCaller._call_hook)NNNr�NT�NN)r#r$r%r&r rrTrUrYr^rfrlrmrnrorprWrrrrrfs4
�


�
�

�
�

rc@s<eZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dS)
�
LoggerWrapperzd
    Read messages from a pipe and redirect them
    to a logger (see python's logging module).
    cCsHtj�|�d|_||_||_t��\|_|_	t�
|j�|_|��dSr�)
�	threading�Threadr �daemon�logger�levelr3�pipe�fd_read�fd_write�fdopen�reader�start)rr�r�rrrr ^szLoggerWrapper.__init__cCs|jSr)r�rKrrr�filenokszLoggerWrapper.filenocCs|�tj�r|dd�S|S)N���)�endswithr3�linesep)�msgrrr�remove_newlinenszLoggerWrapper.remove_newlinecCs |jD]
}|�|�|��qdSr)r��_writer�)r�linerrr�runrs
�zLoggerWrapper.runcCs|j�|j|�dSr)r��logr�)rr+rrrr�vszLoggerWrapper._writeN)
r#r$r%r&r r��staticmethodr�r�r�rrrrr�Xs

r�r�)"r��
contextlibrr3�os.pathrrr�r�
subprocessrrrrO�tempfilerryr
�
in_processr�__all__r�	Exceptionrr
rrrrrG�objectrr�r�rrrr�<module>s.


		s