<!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>
B
    Re                  @   s`  d Z ddlmZ ddlm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
Z
ddlZddlZejd dkrdd Zd	d
 Zndd Zdd
 ZG dd deZG dd deZG dd deZdd Zdd Zdd Zdd ZdZdd Zdd Zd d! Zd/d"d#Zd$d% ZG d&d' d'eZG d(d) d)eZd*d+ Z ddd#d%d+hZ!d,d- Z"e#d.kr\e"  dS )0ag  This is invoked in a subprocess to call the build backend hooks.

It expects:
- Command line args: hook_name, control_dir
- Environment variables:
      PEP517_BUILD_BACKEND=entry.point:spec
      PEP517_BACKEND_PATH=paths (separated with os.pathsep)
- control_dir/input.json:
  - {"kwargs": {...}}

Results:
- control_dir/output.json
  - {"return_val": ...}
    )glob)import_moduleN)join   c          	   K   s.   t |ddd}tj| |f| W d Q R X d S )Nwzutf-8)encoding)openjsondump)objpathkwargsf r   /builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py
write_json!   s    r   c          	   C   s$   t | ddd}t|S Q R X d S )Nrzutf-8)r   )r   r	   load)r   r   r   r   r   	read_json%   s    r   c          	   K   s2   t |d}tj| |fddi| W d Q R X d S )Nwbr   zutf-8)r   r	   r
   )r   r   r   r   r   r   r   r   +   s    c          	   C   s    t | d}t|S Q R X d S )Nrb)r   r	   r   )r   r   r   r   r   r   /   s    c               @   s   e Zd ZdZdd ZdS )BackendUnavailablez&Raised if we cannot import the backendc             C   s
   || _ d S )N)	traceback)selfr   r   r   r   __init__6   s    zBackendUnavailable.__init__N)__name__
__module____qualname____doc__r   r   r   r   r   r   4   s   r   c               @   s   e Zd ZdZdd ZdS )BackendInvalidz Raised if the backend is invalidc             C   s
   || _ d S )N)message)r   r    r   r   r   r   <   s    zBackendInvalid.__init__N)r   r   r   r   r   r   r   r   r   r   :   s   r   c               @   s   e Zd ZdZdS )HookMissingzARaised if a hook is missing and we are not executing the fallbackN)r   r   r   r   r   r   r   r   r!   @   s   r!   c             C   s<   t jt j| } t jt j|}t j| |g|kS )z5Test if a file is located within the given directory.)osr   normcaseabspathcommonprefix)filename	directoryr   r   r   contained_inD   s    r(   c                 s   t jd} | r*| t j}|tjdd< t jd }|d\}}}yt| W n  t	k
rp   t
t Y nX | rt fdd|D std|rx|d	D ]}t | qW  S )
zFind and load the build backendPEP517_BACKEND_PATHNr   PEP517_BUILD_BACKEND:c             3   s   | ]}t  j|V  qd S )N)r(   __file__).0r   )r   r   r   	<genexpr>\   s   z!_build_backend.<locals>.<genexpr>z(Backend was not loaded from backend-path.)r"   environgetsplitpathsepsysr   	partitionr   ImportErrorr   r   
format_excanyr   getattr)backend_pathZextra_pathitemsepZmod_path_Zobj_pathZ	path_partr   )r   r   _build_backendK   s&    


r=   c             C   s2   t  }y
|j}W n tk
r$   g S X || S dS )zfInvoke the optional get_requires_for_build_wheel hook

    Returns [] if the hook is not defined.
    N)r=   get_requires_for_build_wheelAttributeError)config_settingsbackendhookr   r   r   r>   g   s    
r>   c             C   sF   t  }y
|j}W n& tk
r6   |s*t t|| |S X || |S dS )zInvoke optional prepare_metadata_for_build_wheel

    Implements a fallback by building a wheel if the hook isn't defined,
    unless _allow_fallback is False in which case HookMissing is raised.
    N)r=    prepare_metadata_for_build_wheelr?   r!   _get_wheel_metadata_from_wheel)metadata_directoryr@   _allow_fallbackrA   rB   r   r   r   rC   u   s    
rC   ZPEP517_ALREADY_BUILT_WHEELc             C   sD   g }x*|   D ]}td|}|r|| qW |r8|S tddS )z6Identify the .dist-info folder inside a wheel ZipFile.z[^/\\]+-[^/\\]+\.dist-info/z#No .dist-info folder found in wheelN)namelistrematchappend	Exception)Zwhl_zipresr   mr   r   r   _dist_info_files   s    rN   c          	   C   s   ddl m} | ||}ttj|td W dQ R X tj||}||}t|}|j	||d W dQ R X |d 
dd S )zBuild a wheel and extract the metadata from it.

    Fallback for when the build backend does not
    define the 'get_wheel_metadata' hook.
    r   )ZipFiler   N)r   members/)zipfilerO   build_wheelr   r"   r   r   WHEEL_BUILT_MARKERrN   
extractallr2   )rA   rE   r@   rO   Zwhl_basenameZwhl_fileZzipfZ	dist_infor   r   r   rD      s    

rD   c             C   sl   | sdS t j| }t jt|ts*dS tt j|d}|sLtd dS t	|dkrdtd dS |d S )zHCheck for a wheel already built during the get_wheel_metadata hook.
    Nz*.whlz+Found wheel built marker, but no .whl files   zHFound multiple .whl files; unspecified behaviour. Will call build_wheel.r   )
r"   r   dirnameisfilepjoinrT   r   r   printlen)rE   Zmetadata_parentZ	whl_filesr   r   r   _find_already_built_wheel   s    r\   c             C   s4   t |}|r$t||  tj|S t | ||S )zInvoke the mandatory build_wheel hook.

    If a wheel was already built in the
    prepare_metadata_for_build_wheel fallback, this
    will copy it rather than rebuilding the wheel.
    )r\   shutilcopy2r"   r   basenamer=   rS   )wheel_directoryr@   rE   Zprebuilt_whlr   r   r   rS      s    
rS   c             C   s2   t  }y
|j}W n tk
r$   g S X || S dS )zfInvoke the optional get_requires_for_build_wheel hook

    Returns [] if the hook is not defined.
    N)r=   get_requires_for_build_sdistr?   )r@   rA   rB   r   r   r   ra      s    
ra   c               @   s   e Zd ZdZdS )_DummyExceptionz(Nothing should ever raise this exceptionN)r   r   r   r   r   r   r   r   rb      s   rb   c               @   s   e Zd ZdZdd ZdS )GotUnsupportedOperationz9For internal use when backend raises UnsupportedOperationc             C   s
   || _ d S )N)r   )r   r   r   r   r   r      s    z GotUnsupportedOperation.__init__N)r   r   r   r   r   r   r   r   r   rc      s   rc   c             C   s@   t  }y|| |S  t|dtk
r:   tt Y nX dS )z&Invoke the mandatory build_sdist hook.UnsupportedOperationN)r=   build_sdistr9   rb   rc   r   r7   )sdist_directoryr@   rA   r   r   r   re      s
    re   c           
   C   sJ  t tjdk rtd tjd } tjd }| tkrBtd|   t |  }tt|d}dd d}y|f |d	 |d
< W n tk
r } zd|d< |j	|d< W d d }~X Y n t
k
r } zd|d< |j|d< W d d }~X Y nR tk
r } zd|d< |j	|d< W d d }~X Y n tk
r0   d|d< Y nX t|t|ddd d S )Nr   z"Needs args: hook_name, control_dirrV      zUnknown hook: %sz
input.jsonF)unsupported
return_valr   ri   T
no_backendr   backend_invalidbackend_errorrh   hook_missingzoutput.json)indent)r[   r4   argvexit
HOOK_NAMESglobalsr   rY   r   r   r   r    rc   r!   r   )	hook_nameZcontrol_dirrB   
hook_inputZjson_outer   r   r   main   s.    




rv   __main__)N)$r   r   	importlibr   r	   r"   os.pathr   rY   rH   r]   r4   r   version_infor   r   rK   r   r   r!   r(   r=   r>   rC   rT   rN   rD   r\   rS   ra   rb   rc   re   rq   rv   r   r   r   r   r   <module>   sN   



