Your IP : 216.73.216.26
U
�Qab}%�@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl m
Z
ddlmZddl
mZdddd d
ddgZGd
d�de�ZGdd�dejj�Zdd�Zdd�Zdd�Zdd�ZGdd�de�ZGdd�de�Ze�ZejZejZejZejZej Z e�Z!dS)a-A PEP 517 interface to setuptools
Previously, when a user or a command line tool (let's call it a "frontend")
needed to make a request of setuptools to take a certain action, for
example, generating a list of installation requirements, the frontend would
would call "setup.py egg_info" or "setup.py bdist_wheel" on the command line.
PEP 517 defines a different method of interfacing with setuptools. Rather
than calling "setup.py" directly, the frontend should:
1. Set the current directory to the directory with a setup.py file
2. Import this module into a safe python interpreter (one in which
setuptools can potentially set global variables or crash hard).
3. Call one of the functions defined in PEP 517.
What each function does is defined in PEP 517. However, here is a "casual"
definition of the functions (this definition should not be relied on for
bug reports or API stability):
- `build_wheel`: build a wheel in the folder and return the basename
- `get_requires_for_build_wheel`: get the `setup_requires` to build
- `prepare_metadata_for_build_wheel`: get the `install_requires`
- `build_sdist`: build an sdist in the folder and return the basename
- `get_requires_for_build_sdist`: get the `setup_requires` to build
Again, this is not a formal definition! Just a "taste" of the module.
�N)�TemporaryDirectory)�parse_requirements)�makedirs�get_requires_for_build_sdist�get_requires_for_build_wheel� prepare_metadata_for_build_wheel�build_wheel�build_sdist�
__legacy__�SetupRequirementsErrorc@seZdZdd�ZdS)rcCs
||_dS�N)�
specifiers)�selfr
�r�9/usr/lib/python3.8/site-packages/setuptools/build_meta.py�__init__4szSetupRequirementsError.__init__N)�__name__�
__module__�__qualname__rrrrrr3sc@s&eZdZdd�Zeejdd���ZdS)�DistributioncCstttt|���}t|��dSr)�list�map�strrr)rr
Zspecifier_listrrr�fetch_build_eggs9szDistribution.fetch_build_eggsccs*tjj}|tj_z
dVW5|tj_XdS)zw
Replace
distutils.dist.Distribution with this class
for the duration of this context.
N)� distutilsZcorer)�clsZorigrrr�patch>s
zDistribution.patchN)rrrr�classmethod�
contextlib�contextmanagerrrrrrr8srcCs*tjddkr&t|t�s&|�t���S|S)z�
Convert a filename to a string (on Python 2, explicitly
a byte string, not Unicode) as distutils checks for the
exact type str.
r�)�sys�version_info�
isinstancer�encode�getfilesystemencoding)�srrr�_to_strNsr'cs�fdd�t���D�S)Ncs&g|]}tj�tj��|��r|�qSr)�os�path�isdir�join)�.0�name�Za_dirrr�
<listcomp>\s�z1_get_immediate_subdirectories.<locals>.<listcomp>�r(�listdirr.rr.r�_get_immediate_subdirectories[sr2cs"�fdd�t�|�D�}|\}|S)Nc3s|]}|���r|VqdSr��endswith�r,�f�� extensionrr� <genexpr>as
�z'_file_with_extension.<locals>.<genexpr>r0)Z directoryr8Zmatching�filerr7r�_file_with_extension`s
�r;cCs&tj�|�st�d�Sttdt�|�S)Nz%from setuptools import setup; setup()�open)r(r)�exists�io�StringIO�getattr�tokenizer<��setup_scriptrrr�_open_setup_scriptis
rDc@s`eZdZdd�Zdd�Zddd�Zdd d
�Zddd�Zdd
d�Zdd�Z ddd�Z
ddd�ZdS)�_BuildMetaBackendcCs|pi}|�dg�|S)N�--global-option)�
setdefault�r�config_settingsrrr�_fix_configssz_BuildMetaBackend._fix_configc
Csz|�|�}tjdd�dg|dt_z t���|��W5QRXWn,tk
rt}z||j7}W5d}~XYnX|S)N�Zegg_inforF)rJr!�argvrr� run_setuprr
)rrI�requirements�errr�_get_build_requiresxs
�
z%_BuildMetaBackend._get_build_requires�setup.pyc CsD|}d}t|��}|���dd�}W5QRXtt||d�t��dS)N�__main__z\r\nz\n�exec)rD�read�replacerS�compile�locals)rrC�__file__rr6�coderrrrM�s
z_BuildMetaBackend.run_setupNcCs|�|�}|j|dgd�S)NZwheel�rN�rJrPrHrrrr�s
z._BuildMetaBackend.get_requires_for_build_wheelcCs|�|�}|j|gd�S)NrZr[rHrrrr�s
z._BuildMetaBackend.get_requires_for_build_sdistcCs�tjdd�ddt|�gt_|��|}dd�t�|�D�}t|�dkrttt|��dkrttj� |t�|�d�}q*t|�dks�t
�q�q*||kr�t�tj� ||d�|�tj
|dd�|dS) NrKZ dist_infoz
--egg-basecSsg|]}|�d�r|�qS)z
.dist-infor3r5rrrr/�s
�zF_BuildMetaBackend.prepare_metadata_for_build_wheel.<locals>.<listcomp>rT)�
ignore_errors)r!rLr'rMr(r1�lenr2r)r+�AssertionError�shutilZmoveZrmtree)r�metadata_directoryrIZdist_info_directoryZ
dist_infosrrrr�s.����z2_BuildMetaBackend.prepare_metadata_for_build_wheelc Cs�|�|�}tj�|�}t|dd�t|d��v}tjdd�|d|g|dt_|��t ||�}tj�
||�}tj�|�r�t�|�t�
tj�
||�|�W5QRX|S)NT)�exist_ok)�dirrKz
--dist-dirrF)rJr(r)�abspathrrr!rLrMr;r+r=�remove�rename)rZ
setup_commandZresult_extensionZresult_directoryrIZtmp_dist_dirZresult_basenameZresult_pathrrr�_build_with_temp_dir�s
��
z&_BuildMetaBackend._build_with_temp_dircCs|�dgd||�S)NZbdist_wheelz.whl�rf)rZwheel_directoryrIr`rrrr�s
�z_BuildMetaBackend.build_wheelcCs|�dddgd||�S)NZsdistz --formatsZgztarz.tar.gzrg)rZsdist_directoryrIrrrr �s
�z_BuildMetaBackend.build_sdist)rQ)N)N)N)NN)N)rrrrJrPrMrrrrfrr rrrrrEqs
�
�
rEcs"eZdZdZd�fdd� Z�ZS)�_BuildMetaLegacyBackendaCCompatibility backend for setuptools
This is a version of setuptools.build_meta that endeavors to maintain backwards
compatibility with pre-PEP 517 modes of invocation. It exists as a temporary
bridge between the old packaging mechanism and the new packaging mechanism,
and will eventually be removed.
rQc
sbttj�}tj�tj�|��}|tjkr6tj�d|�ztt|�j |d�W5|tjdd�<XdS)NrrB)
rr!r)r(�dirnamerc�insert�superrhrM)rrCZsys_pathZ
script_dir�� __class__rrrM�s
��
z!_BuildMetaLegacyBackend.run_setup)rQ)rrr�__doc__rM�
__classcell__rrrlrrh�srh)"rnr>r(r!rAr_rZ
setuptoolsrZsetuptools.py31compatrZ
pkg_resourcesrZpkg_resources.py31compatr�__all__�
BaseExceptionrZdistrr'r2r;rD�objectrErhZ_BACKENDrrrrr r
rrrr�<module>sD�
h
?>