<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
U
    .e                     @   s   d 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Zddlm	Z	 ddl
mZ ddlmZmZ eeZdd	 ZG d
d deZdddZdddZdS )zIBuild wheels/sdists by installing build deps to a temporary environment.
    N)
check_call)	get_paths)mkdtemp   )Pep517HookCallerLoggerWrapperc              	   C   sH   t tj| d}t|}W 5 Q R X |d }|d |d |dfS )Nzpyproject.tomlzbuild-systemrequireszbuild-backendzbackend-path)openospathjointomlloadget)
source_dirfZpyproject_dataZbuildsys r   ?/usr/lib/python3.8/site-packages/pip/_vendor/pep517/envbuild.py_load_pyproject   s    r   c                   @   s6   e Zd ZdZdZdddZdd Zdd	 Zd
d ZdS )BuildEnvironmentzContext manager to install build deps in a simple temporary environment

    Based on code I wrote for pip, which is MIT licensed.
    NTc                 C   s
   || _ d S )N)_cleanup)selfZcleanupr   r   r   __init__9   s    zBuildEnvironment.__init__c                 C   s   t dd| _td| j tjdd | _tjdd | _tj	dkrHdnd}t
|| j| jdd	}|d
 }| jr|tj | j tjd< n|tj tj tjd< |d |d kr|d }n|d tj |d  }| jr|tj | j tjd< n
|tjd< | S )Nzpep517-build-env-)prefixzTemporary build environment: %sPATH
PYTHONPATHntZposix_prefix)baseZplatbase)varsscriptsZpurelibZplatlib)r   r   loginfor
   environr   	save_pathsave_pythonpathnamer   pathsepdefpath)r   Zinstall_schemeZinstall_dirsr   Zlib_dirsr   r   r   	__enter__<   s0    


zBuildEnvironment.__enter__c                 C   sT   |sdS t d| tjddddd| jgt| }t|tt tj	tt tj
d dS )	zAInstall dependencies into this env by calling pip in a subprocessNzCalling pip to install %sz-mZpipZinstallz--ignore-installedz--prefix)stdoutstderr)r    r!   sys
executabler   listr   r   loggingINFOZERROR)r   reqscmdr   r   r   pip_install\   s$         

zBuildEnvironment.pip_installc                 C   s~   | j o| jd k	otj| j}|r.t| j | jd krHtjdd  n| jtjd< | j	d krntjdd  n| j	tjd< d S )Nr   r   )
r   r   r
   isdirshutilZrmtreer#   r"   popr$   )r   exc_typeZexc_valZexc_tbZneeds_cleanupr   r   r   __exit__j   s    

zBuildEnvironment.__exit__)T)	__name__
__module____qualname____doc__r   r   r(   r2   r7   r   r   r   r   r      s   
 r   c           	   
   C   sn   |dkri }t | \}}}t| ||}t 8}|| ||}|| |||W  5 Q R  S Q R X dS )am  Build a wheel from a source directory using PEP 517 hooks.

    :param str source_dir: Source directory containing pyproject.toml
    :param str wheel_dir: Target directory to create wheel in
    :param dict config_settings: Options to pass to build backend

    This is a blocking function which will run pip in a subprocess to install
    build requirements.
    N)r   r   r   r2   Zget_requires_for_build_wheelbuild_wheel)	r   Z	wheel_dirconfig_settingsr   backendbackend_pathhooksenvr0   r   r   r   r<   ~   s    



r<   c           	   
   C   sn   |dkri }t | \}}}t| ||}t 8}|| ||}|| |||W  5 Q R  S Q R X dS )am  Build an sdist from a source directory using PEP 517 hooks.

    :param str source_dir: Source directory containing pyproject.toml
    :param str sdist_dir: Target directory to place sdist in
    :param dict config_settings: Options to pass to build backend

    This is a blocking function which will run pip in a subprocess to install
    build requirements.
    N)r   r   r   r2   Zget_requires_for_build_sdistbuild_sdist)	r   Z	sdist_dirr=   r   r>   r?   r@   rA   r0   r   r   r   rB      s    



rB   )N)N)r;   r
   r.   r   r4   
subprocessr   r+   Z	sysconfigr   Ztempfiler   Zwrappersr   r   Z	getLoggerr8   r    r   objectr   r<   rB   r   r   r   r   <module>   s   
a
